Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
Diffstat (limited to 'winsup')
-rw-r--r--winsup/CYGWIN_LICENSE38
-rw-r--r--winsup/ChangeLog255
-rw-r--r--winsup/MAINTAINERS7
-rw-r--r--winsup/Makefile.common180
-rw-r--r--winsup/Makefile.in115
-rw-r--r--winsup/bz2lib/CHANGES167
-rw-r--r--winsup/bz2lib/ChangeLog11
-rw-r--r--winsup/bz2lib/LICENSE39
-rw-r--r--winsup/bz2lib/Makefile141
-rw-r--r--winsup/bz2lib/Makefile-libbz2_so43
-rw-r--r--winsup/bz2lib/Makefile.in118
-rw-r--r--winsup/bz2lib/README166
-rw-r--r--winsup/bz2lib/README.COMPILATION.PROBLEMS130
-rw-r--r--winsup/bz2lib/Y2K_INFO34
-rw-r--r--winsup/bz2lib/aclocal.m4137
-rw-r--r--winsup/bz2lib/blocksort.c1134
-rw-r--r--winsup/bz2lib/bzip2.1439
-rw-r--r--winsup/bz2lib/bzip2.1.preformatted462
-rw-r--r--winsup/bz2lib/bzip2.c2044
-rw-r--r--winsup/bz2lib/bzip2.txt376
-rw-r--r--winsup/bz2lib/bzip2recover.c435
-rw-r--r--winsup/bz2lib/bzlib.c1564
-rw-r--r--winsup/bz2lib/bzlib.h319
-rw-r--r--winsup/bz2lib/bzlib_private.h530
-rw-r--r--winsup/bz2lib/compress.c714
-rwxr-xr-xwinsup/bz2lib/configure1896
-rw-r--r--winsup/bz2lib/configure.in65
-rw-r--r--winsup/bz2lib/crctable.c144
-rw-r--r--winsup/bz2lib/decompress.c660
-rw-r--r--winsup/bz2lib/dlltest.c176
-rw-r--r--winsup/bz2lib/dlltest.dsp93
-rw-r--r--winsup/bz2lib/huffman.c228
-rw-r--r--winsup/bz2lib/libbz2.def27
-rw-r--r--winsup/bz2lib/libbz2.dsp130
-rw-r--r--winsup/bz2lib/makefile.msc63
-rw-r--r--winsup/bz2lib/manual.ps3808
-rw-r--r--winsup/bz2lib/manual.texi2215
-rw-r--r--winsup/bz2lib/manual_1.html47
-rw-r--r--winsup/bz2lib/manual_2.html484
-rw-r--r--winsup/bz2lib/manual_3.html1773
-rw-r--r--winsup/bz2lib/manual_4.html528
-rw-r--r--winsup/bz2lib/manual_toc.html173
-rw-r--r--winsup/bz2lib/randtable.c124
-rw-r--r--winsup/bz2lib/sample1.bz2bin32348 -> 0 bytes
-rw-r--r--winsup/bz2lib/sample1.refbin98696 -> 0 bytes
-rw-r--r--winsup/bz2lib/sample2.bz2bin73732 -> 0 bytes
-rw-r--r--winsup/bz2lib/sample2.refbin212340 -> 0 bytes
-rw-r--r--winsup/bz2lib/sample3.bz2bin235 -> 0 bytes
-rw-r--r--winsup/bz2lib/sample3.ref30007
-rw-r--r--winsup/bz2lib/spewG.c39
-rw-r--r--winsup/bz2lib/unzcrash.c126
-rw-r--r--winsup/bz2lib/words05
-rw-r--r--winsup/bz2lib/words14
-rw-r--r--winsup/bz2lib/words25
-rw-r--r--winsup/bz2lib/words323
-rwxr-xr-xwinsup/configure1332
-rwxr-xr-xwinsup/configure.in92
-rw-r--r--winsup/cygserver/client.cc207
-rw-r--r--winsup/cygserver/cygserver.cc549
-rw-r--r--winsup/cygserver/process.cc388
-rw-r--r--winsup/cygserver/shm.cc665
-rwxr-xr-xwinsup/cygserver/shm.h92
-rw-r--r--winsup/cygserver/threaded_queue.cc250
-rw-r--r--winsup/cygserver/transport.cc92
-rw-r--r--winsup/cygserver/transport_pipes.cc210
-rw-r--r--winsup/cygserver/transport_sockets.cc131
-rw-r--r--winsup/cygwin/CYGWIN_LICENSE38
-rw-r--r--winsup/cygwin/ChangeLog2239
-rw-r--r--winsup/cygwin/ChangeLog-1995177
-rw-r--r--winsup/cygwin/ChangeLog-19962031
-rw-r--r--winsup/cygwin/ChangeLog-19972800
-rw-r--r--winsup/cygwin/ChangeLog-19984490
-rw-r--r--winsup/cygwin/ChangeLog-19993562
-rw-r--r--winsup/cygwin/ChangeLog-20004150
-rw-r--r--winsup/cygwin/ChangeLog-20015337
-rw-r--r--winsup/cygwin/Makefile.in346
-rw-r--r--winsup/cygwin/ROADMAP129
-rw-r--r--winsup/cygwin/acconfig.h14
-rw-r--r--winsup/cygwin/ansi.sgml59
-rw-r--r--winsup/cygwin/assert.cc52
-rw-r--r--winsup/cygwin/autoload.cc511
-rw-r--r--winsup/cygwin/automode.c26
-rw-r--r--winsup/cygwin/binmode.c21
-rw-r--r--winsup/cygwin/child_info.h111
-rw-r--r--winsup/cygwin/config.h.in41
-rw-r--r--winsup/cygwin/config/i386/longjmp.c51
-rw-r--r--winsup/cygwin/config/i386/makefrag17
-rw-r--r--winsup/cygwin/config/i386/profile.h58
-rw-r--r--winsup/cygwin/config/i386/setjmp.c48
-rwxr-xr-xwinsup/cygwin/configure2416
-rw-r--r--winsup/cygwin/configure.in257
-rw-r--r--winsup/cygwin/cygerrno.h39
-rw-r--r--winsup/cygwin/cygheap.cc498
-rw-r--r--winsup/cygwin/cygheap.h292
-rwxr-xr-xwinsup/cygwin/cygmagic36
-rw-r--r--winsup/cygwin/cygrun.c51
-rwxr-xr-xwinsup/cygwin/cygserver.cc549
-rwxr-xr-xwinsup/cygwin/cygserver_client.cc207
-rwxr-xr-xwinsup/cygwin/cygserver_process.cc388
-rwxr-xr-xwinsup/cygwin/cygserver_shm.cc665
-rw-r--r--winsup/cygwin/cygserver_shm.h92
-rwxr-xr-xwinsup/cygwin/cygserver_transport.cc92
-rwxr-xr-xwinsup/cygwin/cygserver_transport_pipes.cc210
-rwxr-xr-xwinsup/cygwin/cygserver_transport_sockets.cc131
-rw-r--r--winsup/cygwin/cygwin.din1274
-rw-r--r--winsup/cygwin/cygwin.sc111
-rw-r--r--winsup/cygwin/cygwin_version.h31
-rw-r--r--winsup/cygwin/dcrt0.cc1069
-rw-r--r--winsup/cygwin/debug.cc361
-rw-r--r--winsup/cygwin/debug.h83
-rw-r--r--winsup/cygwin/delqueue.cc103
-rw-r--r--winsup/cygwin/dir.cc347
-rw-r--r--winsup/cygwin/dlfcn.cc151
-rw-r--r--winsup/cygwin/dll_init.cc412
-rw-r--r--winsup/cygwin/dll_init.h91
-rw-r--r--winsup/cygwin/dll_init.sgml11
-rw-r--r--winsup/cygwin/dlmalloc.c3906
-rw-r--r--winsup/cygwin/dlmalloc.h96
-rw-r--r--winsup/cygwin/dtable.cc817
-rw-r--r--winsup/cygwin/dtable.h88
-rw-r--r--winsup/cygwin/dtable.sgml20
-rw-r--r--winsup/cygwin/environ.cc948
-rw-r--r--winsup/cygwin/environ.h40
-rw-r--r--winsup/cygwin/errno.cc688
-rw-r--r--winsup/cygwin/exceptions.cc1244
-rw-r--r--winsup/cygwin/exec.cc98
-rw-r--r--winsup/cygwin/external.cc247
-rw-r--r--winsup/cygwin/external.sgml18
-rw-r--r--winsup/cygwin/fcntl.cc49
-rw-r--r--winsup/cygwin/fhandler.cc1163
-rw-r--r--winsup/cygwin/fhandler.h1198
-rw-r--r--winsup/cygwin/fhandler_clipboard.cc279
-rw-r--r--winsup/cygwin/fhandler_console.cc1778
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc818
-rw-r--r--winsup/cygwin/fhandler_dsp.cc646
-rw-r--r--winsup/cygwin/fhandler_floppy.cc191
-rw-r--r--winsup/cygwin/fhandler_mem.cc436
-rw-r--r--winsup/cygwin/fhandler_proc.cc502
-rw-r--r--winsup/cygwin/fhandler_process.cc736
-rw-r--r--winsup/cygwin/fhandler_random.cc165
-rw-r--r--winsup/cygwin/fhandler_raw.cc563
-rw-r--r--winsup/cygwin/fhandler_registry.cc544
-rw-r--r--winsup/cygwin/fhandler_serial.cc883
-rw-r--r--winsup/cygwin/fhandler_socket.cc559
-rw-r--r--winsup/cygwin/fhandler_tape.cc839
-rw-r--r--winsup/cygwin/fhandler_termios.cc352
-rw-r--r--winsup/cygwin/fhandler_tty.cc1231
-rw-r--r--winsup/cygwin/fhandler_virtual.cc226
-rw-r--r--winsup/cygwin/fhandler_windows.cc148
-rw-r--r--winsup/cygwin/fhandler_zero.cc60
-rw-r--r--winsup/cygwin/fork.cc753
-rw-r--r--winsup/cygwin/gcrt0.c41
-rw-r--r--winsup/cygwin/glob.c956
-rw-r--r--winsup/cygwin/gmon.c285
-rw-r--r--winsup/cygwin/gmon.h166
-rw-r--r--winsup/cygwin/grp.cc459
-rw-r--r--winsup/cygwin/heap.cc144
-rw-r--r--winsup/cygwin/heap.h19
-rw-r--r--winsup/cygwin/hires.h47
-rw-r--r--winsup/cygwin/how-cygheap-works.txt120
-rw-r--r--winsup/cygwin/how-fhandlers-work.txt75
-rw-r--r--winsup/cygwin/how-signals-work.txt128
-rw-r--r--winsup/cygwin/how-spawn-works.txt32
-rw-r--r--winsup/cygwin/how-to-debug-cygwin.txt103
-rw-r--r--winsup/cygwin/how-vfork-works.txt36
-rw-r--r--winsup/cygwin/include/a.out.h431
-rw-r--r--winsup/cygwin/include/arpa/ftp.h109
-rw-r--r--winsup/cygwin/include/arpa/inet.h35
-rw-r--r--winsup/cygwin/include/arpa/telnet.h322
-rw-r--r--winsup/cygwin/include/asm/byteorder.h103
-rw-r--r--winsup/cygwin/include/asm/socket.h71
-rw-r--r--winsup/cygwin/include/asm/types.h23
-rw-r--r--winsup/cygwin/include/cygwin/acl.h98
-rw-r--r--winsup/cygwin/include/cygwin/core_dump.h73
-rwxr-xr-xwinsup/cygwin/include/cygwin/cygserver.h135
-rwxr-xr-xwinsup/cygwin/include/cygwin/cygserver_process.h84
-rwxr-xr-xwinsup/cygwin/include/cygwin/cygserver_transport.h32
-rwxr-xr-xwinsup/cygwin/include/cygwin/cygserver_transport_pipes.h39
-rwxr-xr-xwinsup/cygwin/include/cygwin/cygserver_transport_sockets.h33
-rw-r--r--winsup/cygwin/include/cygwin/cygwin_dll.h94
-rw-r--r--winsup/cygwin/include/cygwin/grp.h48
-rw-r--r--winsup/cygwin/include/cygwin/icmp.h1
-rw-r--r--winsup/cygwin/include/cygwin/if.h90
-rw-r--r--winsup/cygwin/include/cygwin/in.h188
-rw-r--r--winsup/cygwin/include/cygwin/in_systm.h34
-rw-r--r--winsup/cygwin/include/cygwin/mtio.h205
-rw-r--r--winsup/cygwin/include/cygwin/rdevio.h42
-rw-r--r--winsup/cygwin/include/cygwin/socket.h167
-rw-r--r--winsup/cygwin/include/cygwin/sockios.h1
-rw-r--r--winsup/cygwin/include/cygwin/stat.h88
-rw-r--r--winsup/cygwin/include/cygwin/types.h105
-rw-r--r--winsup/cygwin/include/cygwin/uio.h1
-rw-r--r--winsup/cygwin/include/cygwin/version.h225
-rw-r--r--winsup/cygwin/include/dlfcn.h41
-rw-r--r--winsup/cygwin/include/exceptions.h120
-rw-r--r--winsup/cygwin/include/fcntl.h17
-rw-r--r--winsup/cygwin/include/features.h16
-rw-r--r--winsup/cygwin/include/fnmatch.h63
-rw-r--r--winsup/cygwin/include/getopt.h84
-rw-r--r--winsup/cygwin/include/glob.h112
-rw-r--r--winsup/cygwin/include/icmp.h1
-rw-r--r--winsup/cygwin/include/io.h29
-rw-r--r--winsup/cygwin/include/lastlog.h22
-rw-r--r--winsup/cygwin/include/limits.h169
-rw-r--r--winsup/cygwin/include/mapi.h102
-rw-r--r--winsup/cygwin/include/memory.h17
-rw-r--r--winsup/cygwin/include/mntent.h47
-rw-r--r--winsup/cygwin/include/net/if.h16
-rw-r--r--winsup/cygwin/include/netdb.h168
-rw-r--r--winsup/cygwin/include/netinet/in.h16
-rw-r--r--winsup/cygwin/include/netinet/in_systm.h16
-rw-r--r--winsup/cygwin/include/netinet/ip.h199
-rw-r--r--winsup/cygwin/include/netinet/ip_icmp.h16
-rw-r--r--winsup/cygwin/include/netinet/tcp.h144
-rw-r--r--winsup/cygwin/include/netinet/udp.h51
-rw-r--r--winsup/cygwin/include/paths.h19
-rw-r--r--winsup/cygwin/include/poll.h11
-rw-r--r--winsup/cygwin/include/pthread.h187
-rw-r--r--winsup/cygwin/include/sched.h64
-rw-r--r--winsup/cygwin/include/semaphore.h41
-rw-r--r--winsup/cygwin/include/strings.h6
-rw-r--r--winsup/cygwin/include/sys/acl.h17
-rw-r--r--winsup/cygwin/include/sys/cdefs.h22
-rw-r--r--winsup/cygwin/include/sys/copying.dj41
-rw-r--r--winsup/cygwin/include/sys/cygwin.h259
-rw-r--r--winsup/cygwin/include/sys/file.h30
-rw-r--r--winsup/cygwin/include/sys/ioctl.h30
-rw-r--r--winsup/cygwin/include/sys/ipc.h53
-rw-r--r--winsup/cygwin/include/sys/mman.h52
-rw-r--r--winsup/cygwin/include/sys/mount.h42
-rw-r--r--winsup/cygwin/include/sys/mtio.h18
-rw-r--r--winsup/cygwin/include/sys/poll.h43
-rw-r--r--winsup/cygwin/include/sys/procfs.h18
-rw-r--r--winsup/cygwin/include/sys/resource.h76
-rw-r--r--winsup/cygwin/include/sys/select.h35
-rw-r--r--winsup/cygwin/include/sys/shm.h89
-rw-r--r--winsup/cygwin/include/sys/smallprint.h27
-rw-r--r--winsup/cygwin/include/sys/socket.h55
-rw-r--r--winsup/cygwin/include/sys/soundcard.h1287
-rw-r--r--winsup/cygwin/include/sys/strace.h158
-rw-r--r--winsup/cygwin/include/sys/syslog.h83
-rw-r--r--winsup/cygwin/include/sys/sysmacros.h24
-rw-r--r--winsup/cygwin/include/sys/termio.h12
-rw-r--r--winsup/cygwin/include/sys/termios.h313
-rw-r--r--winsup/cygwin/include/sys/ttychars.h1
-rw-r--r--winsup/cygwin/include/sys/uio.h37
-rw-r--r--winsup/cygwin/include/sys/un.h26
-rw-r--r--winsup/cygwin/include/sys/utsname.h33
-rw-r--r--winsup/cygwin/include/sys/vfs.h38
-rw-r--r--winsup/cygwin/include/sys/wait.h73
-rw-r--r--winsup/cygwin/include/sysexits.h118
-rw-r--r--winsup/cygwin/include/syslog.h16
-rw-r--r--winsup/cygwin/include/termio.h16
-rw-r--r--winsup/cygwin/include/tzfile.h19
-rw-r--r--winsup/cygwin/include/wchar.h29
-rw-r--r--winsup/cygwin/init.cc54
-rw-r--r--winsup/cygwin/ioctl.cc53
-rw-r--r--winsup/cygwin/ipc.cc39
-rw-r--r--winsup/cygwin/lib/_cygwin_S_IEXEC.cc21
-rw-r--r--winsup/cygwin/lib/_cygwin_crt0_common.cc99
-rw-r--r--winsup/cygwin/lib/crt0.h22
-rw-r--r--winsup/cygwin/lib/cygwin_attach_dll.c25
-rw-r--r--winsup/cygwin/lib/cygwin_crt0.c33
-rw-r--r--winsup/cygwin/lib/dll_entry.c17
-rw-r--r--winsup/cygwin/lib/dll_main.cc41
-rw-r--r--winsup/cygwin/lib/getopt.c501
-rw-r--r--winsup/cygwin/lib/libcmain.c35
-rw-r--r--winsup/cygwin/lib/premain0.c14
-rw-r--r--winsup/cygwin/lib/premain1.c14
-rw-r--r--winsup/cygwin/lib/premain2.c14
-rw-r--r--winsup/cygwin/lib/premain3.c14
-rw-r--r--winsup/cygwin/libc/fnmatch.c230
-rw-r--r--winsup/cygwin/localtime.cc2160
-rw-r--r--winsup/cygwin/malloc_wrapper.cc246
-rw-r--r--winsup/cygwin/mcount.c173
-rw-r--r--winsup/cygwin/misc-std.sgml74
-rw-r--r--winsup/cygwin/miscfuncs.cc178
-rwxr-xr-xwinsup/cygwin/mkvers.sh177
-rw-r--r--winsup/cygwin/mmap.cc989
-rw-r--r--winsup/cygwin/net.cc2539
-rwxr-xr-xwinsup/cygwin/newsym24
-rw-r--r--winsup/cygwin/ntdll.h392
-rw-r--r--winsup/cygwin/ntea.cc327
-rw-r--r--winsup/cygwin/passwd.cc446
-rw-r--r--winsup/cygwin/path.cc3660
-rw-r--r--winsup/cygwin/path.h204
-rw-r--r--winsup/cygwin/path.sgml205
-rw-r--r--winsup/cygwin/perprocess.h28
-rw-r--r--winsup/cygwin/perthread.h97
-rw-r--r--winsup/cygwin/pinfo.cc410
-rw-r--r--winsup/cygwin/pinfo.h212
-rw-r--r--winsup/cygwin/pipe.cc196
-rw-r--r--winsup/cygwin/poll.cc100
-rw-r--r--winsup/cygwin/posix.sgml98
-rw-r--r--winsup/cygwin/profil.c173
-rw-r--r--winsup/cygwin/profil.h44
-rw-r--r--winsup/cygwin/pthread.cc489
-rw-r--r--winsup/cygwin/pwdgrp.h124
-rw-r--r--winsup/cygwin/regex/COPYRIGHT20
-rw-r--r--winsup/cygwin/regex/cclass.h31
-rw-r--r--winsup/cygwin/regex/cname.h102
-rw-r--r--winsup/cygwin/regex/engine.c1019
-rw-r--r--winsup/cygwin/regex/engine.ih35
-rwxr-xr-xwinsup/cygwin/regex/mkh76
-rw-r--r--winsup/cygwin/regex/regcomp.c1546
-rw-r--r--winsup/cygwin/regex/regcomp.ih48
-rw-r--r--winsup/cygwin/regex/regerror.c127
-rw-r--r--winsup/cygwin/regex/regerror.ih12
-rw-r--r--winsup/cygwin/regex/regex.3509
-rw-r--r--winsup/cygwin/regex/regex.7235
-rw-r--r--winsup/cygwin/regex/regex.h83
-rw-r--r--winsup/cygwin/regex/regex2.h134
-rw-r--r--winsup/cygwin/regex/regexec.c141
-rw-r--r--winsup/cygwin/regex/regfree.c38
-rw-r--r--winsup/cygwin/regex/tests477
-rw-r--r--winsup/cygwin/regex/utils.h22
-rw-r--r--winsup/cygwin/regexp/COPYRIGHT22
-rw-r--r--winsup/cygwin/regexp/README84
-rw-r--r--winsup/cygwin/regexp/regexp.h34
-rw-r--r--winsup/cygwin/regexp/regmagic.h17
-rw-r--r--winsup/cygwin/regexp/v8_regerror.c28
-rw-r--r--winsup/cygwin/regexp/v8_regexp.c1321
-rw-r--r--winsup/cygwin/regexp/v8_regsub.c88
-rw-r--r--winsup/cygwin/registry.cc252
-rw-r--r--winsup/cygwin/registry.h43
-rw-r--r--winsup/cygwin/resource.cc190
-rwxr-xr-xwinsup/cygwin/rmsym11
-rw-r--r--winsup/cygwin/scandir.cc100
-rw-r--r--winsup/cygwin/sched.cc444
-rw-r--r--winsup/cygwin/sec_acl.cc1046
-rw-r--r--winsup/cygwin/sec_helper.cc389
-rw-r--r--winsup/cygwin/security.cc1670
-rw-r--r--winsup/cygwin/security.h221
-rw-r--r--winsup/cygwin/select.cc1512
-rw-r--r--winsup/cygwin/select.h56
-rw-r--r--winsup/cygwin/shared.cc304
-rw-r--r--winsup/cygwin/shared.sgml17
-rw-r--r--winsup/cygwin/shared_info.h177
-rw-r--r--winsup/cygwin/shm.cc558
-rw-r--r--winsup/cygwin/shortcut.c170
-rw-r--r--winsup/cygwin/shortcut.h28
-rw-r--r--winsup/cygwin/signal.cc410
-rw-r--r--winsup/cygwin/sigproc.cc1341
-rw-r--r--winsup/cygwin/sigproc.h129
-rw-r--r--winsup/cygwin/smallprint.c243
-rw-r--r--winsup/cygwin/spawn.cc1040
-rwxr-xr-xwinsup/cygwin/speclib23
-rw-r--r--winsup/cygwin/stackdump.sgml13
-rw-r--r--winsup/cygwin/strace.cc413
-rw-r--r--winsup/cygwin/string.h44
-rw-r--r--winsup/cygwin/strsep.cc65
-rw-r--r--winsup/cygwin/sync.cc149
-rw-r--r--winsup/cygwin/sync.h49
-rw-r--r--winsup/cygwin/syscalls.cc2622
-rw-r--r--winsup/cygwin/sysconf.cc98
-rw-r--r--winsup/cygwin/syslog.cc412
-rw-r--r--winsup/cygwin/termios.cc234
-rw-r--r--winsup/cygwin/textmode.c21
-rw-r--r--winsup/cygwin/thread.cc2347
-rw-r--r--winsup/cygwin/thread.h522
-rwxr-xr-xwinsup/cygwin/threaded_queue.cc250
-rwxr-xr-xwinsup/cygwin/threaded_queue.h67
-rw-r--r--winsup/cygwin/times.cc678
-rw-r--r--winsup/cygwin/tty.cc451
-rw-r--r--winsup/cygwin/tty.h153
-rw-r--r--winsup/cygwin/tz_posixrules.h48
-rw-r--r--winsup/cygwin/uinfo.cc415
-rw-r--r--winsup/cygwin/uname.cc91
-rw-r--r--winsup/cygwin/wait.cc126
-rw-r--r--winsup/cygwin/winbase.h83
-rw-r--r--winsup/cygwin/wincap.cc504
-rw-r--r--winsup/cygwin/wincap.h107
-rw-r--r--winsup/cygwin/window.cc265
-rw-r--r--winsup/cygwin/winsup.h299
-rw-r--r--winsup/cygwin/winver.rc53
-rw-r--r--winsup/cygwin/wsock_event.h32
-rw-r--r--winsup/doc/ChangeLog123
-rw-r--r--winsup/doc/Makefile.in121
-rw-r--r--winsup/doc/calls.texinfo707
-rw-r--r--winsup/doc/changes.texinfo202
-rwxr-xr-xwinsup/doc/configure1067
-rw-r--r--winsup/doc/configure.in54
-rw-r--r--winsup/doc/copy.texinfo382
-rw-r--r--winsup/doc/cygwin-api.in.sgml67
-rw-r--r--winsup/doc/cygwin-ug-net.in.sgml72
-rw-r--r--winsup/doc/cygwin-ug.in.sgml71
-rw-r--r--winsup/doc/cygwinenv.sgml130
-rw-r--r--winsup/doc/dll.sgml120
-rw-r--r--winsup/doc/doctool.c622
-rw-r--r--winsup/doc/doctool.txt146
-rw-r--r--winsup/doc/faq.texinfo18
-rw-r--r--winsup/doc/fhandler-tut.txt83
-rw-r--r--winsup/doc/filemodes.sgml34
-rw-r--r--winsup/doc/gcc.sgml78
-rw-r--r--winsup/doc/gdb.sgml88
-rw-r--r--winsup/doc/history.texinfo5
-rw-r--r--winsup/doc/how-api.texinfo293
-rw-r--r--winsup/doc/how-programming.texinfo593
-rw-r--r--winsup/doc/how-resources.texinfo123
-rw-r--r--winsup/doc/how-using.texinfo706
-rw-r--r--winsup/doc/how.texinfo6
-rw-r--r--winsup/doc/install.texinfo274
-rw-r--r--winsup/doc/legal.sgml30
-rw-r--r--winsup/doc/ntsec.sgml663
-rw-r--r--winsup/doc/overview.sgml88
-rw-r--r--winsup/doc/overview2.sgml322
-rw-r--r--winsup/doc/pathnames.sgml361
-rw-r--r--winsup/doc/programming.sgml11
-rw-r--r--winsup/doc/readme.texinfo17
-rw-r--r--winsup/doc/relnotes.texinfo24
-rw-r--r--winsup/doc/setup-net.sgml15
-rw-r--r--winsup/doc/setup.sgml47
-rw-r--r--winsup/doc/setup2.sgml133
-rw-r--r--winsup/doc/textbinary.sgml181
-rw-r--r--winsup/doc/using.sgml19
-rw-r--r--winsup/doc/what.texinfo160
-rw-r--r--winsup/doc/who.texinfo88
-rw-r--r--winsup/doc/windres.sgml167
-rw-r--r--winsup/mingw/CRT_fp10.c16
-rw-r--r--winsup/mingw/CRT_fp8.c18
-rw-r--r--winsup/mingw/CRT_noglob.c17
-rw-r--r--winsup/mingw/CRTfmode.c20
-rw-r--r--winsup/mingw/CRTglob.c18
-rw-r--r--winsup/mingw/CRTinit.c32
-rw-r--r--winsup/mingw/ChangeLog1262
-rw-r--r--winsup/mingw/Makefile.in406
-rw-r--r--winsup/mingw/README10
-rw-r--r--winsup/mingw/TODO1
-rwxr-xr-xwinsup/mingw/config.guess1342
-rwxr-xr-xwinsup/mingw/config.sub1332
-rwxr-xr-xwinsup/mingw/configure2159
-rw-r--r--winsup/mingw/configure.in133
-rw-r--r--winsup/mingw/crt1.c251
-rw-r--r--winsup/mingw/crtdll.def704
-rw-r--r--winsup/mingw/crtmt.c14
-rw-r--r--winsup/mingw/crtst.c12
-rw-r--r--winsup/mingw/ctype_old.c52
-rw-r--r--winsup/mingw/dllcrt1.c196
-rw-r--r--winsup/mingw/dllmain.c33
-rw-r--r--winsup/mingw/gccmain.c85
-rw-r--r--winsup/mingw/include/_mingw.h68
-rw-r--r--winsup/mingw/include/assert.h71
-rw-r--r--winsup/mingw/include/conio.h74
-rw-r--r--winsup/mingw/include/ctype.h257
-rw-r--r--winsup/mingw/include/dir.h26
-rw-r--r--winsup/mingw/include/direct.h95
-rw-r--r--winsup/mingw/include/dirent.h147
-rw-r--r--winsup/mingw/include/dos.h110
-rw-r--r--winsup/mingw/include/errno.h117
-rw-r--r--winsup/mingw/include/excpt.h123
-rw-r--r--winsup/mingw/include/fcntl.h135
-rw-r--r--winsup/mingw/include/fenv.h91
-rw-r--r--winsup/mingw/include/float.h168
-rw-r--r--winsup/mingw/include/inttypes.h275
-rw-r--r--winsup/mingw/include/io.h296
-rw-r--r--winsup/mingw/include/limits.h115
-rw-r--r--winsup/mingw/include/locale.h100
-rw-r--r--winsup/mingw/include/malloc.h87
-rw-r--r--winsup/mingw/include/math.h485
-rw-r--r--winsup/mingw/include/mbctype.h97
-rw-r--r--winsup/mingw/include/mbstring.h132
-rw-r--r--winsup/mingw/include/mem.h8
-rw-r--r--winsup/mingw/include/memory.h9
-rw-r--r--winsup/mingw/include/process.h158
-rw-r--r--winsup/mingw/include/setjmp.h72
-rw-r--r--winsup/mingw/include/share.h44
-rw-r--r--winsup/mingw/include/signal.h111
-rw-r--r--winsup/mingw/include/stdarg.h7
-rw-r--r--winsup/mingw/include/stddef.h7
-rw-r--r--winsup/mingw/include/stdint.h186
-rw-r--r--winsup/mingw/include/stdio.h407
-rw-r--r--winsup/mingw/include/stdlib.h493
-rw-r--r--winsup/mingw/include/string.h206
-rw-r--r--winsup/mingw/include/strings.h12
-rw-r--r--winsup/mingw/include/sys/fcntl.h8
-rw-r--r--winsup/mingw/include/sys/file.h9
-rw-r--r--winsup/mingw/include/sys/locking.h52
-rw-r--r--winsup/mingw/include/sys/stat.h190
-rw-r--r--winsup/mingw/include/sys/time.h3
-rw-r--r--winsup/mingw/include/sys/timeb.h82
-rw-r--r--winsup/mingw/include/sys/types.h118
-rw-r--r--winsup/mingw/include/sys/unistd.h9
-rw-r--r--winsup/mingw/include/sys/utime.h89
-rw-r--r--winsup/mingw/include/tchar.h396
-rw-r--r--winsup/mingw/include/time.h219
-rw-r--r--winsup/mingw/include/unistd.h10
-rw-r--r--winsup/mingw/include/values.h4
-rw-r--r--winsup/mingw/include/varargs.h7
-rw-r--r--winsup/mingw/include/wchar.h318
-rw-r--r--winsup/mingw/include/wctype.h141
-rw-r--r--winsup/mingw/init.c84
-rwxr-xr-xwinsup/mingw/install-sh253
-rw-r--r--winsup/mingw/jamfile72
-rw-r--r--winsup/mingw/main.c96
-rw-r--r--winsup/mingw/mingwex/Makefile.in236
-rw-r--r--winsup/mingw/mingwex/_Exit.c3
-rw-r--r--winsup/mingw/mingwex/atoll.c3
-rwxr-xr-xwinsup/mingw/mingwex/configure1007
-rw-r--r--winsup/mingw/mingwex/configure.in52
-rw-r--r--winsup/mingw/mingwex/copysignl.S21
-rw-r--r--winsup/mingw/mingwex/dirent.c320
-rw-r--r--winsup/mingw/mingwex/fdim.c7
-rw-r--r--winsup/mingw/mingwex/fdimf.c7
-rw-r--r--winsup/mingw/mingwex/fdiml.c7
-rw-r--r--winsup/mingw/mingwex/feclearexcept.c14
-rw-r--r--winsup/mingw/mingwex/fegetenv.c12
-rw-r--r--winsup/mingw/mingwex/fegetexceptflag.c15
-rw-r--r--winsup/mingw/mingwex/fegetround.c14
-rw-r--r--winsup/mingw/mingwex/feholdexcept.c18
-rw-r--r--winsup/mingw/mingwex/feraiseexcept.c19
-rw-r--r--winsup/mingw/mingwex/fesetenv.c41
-rw-r--r--winsup/mingw/mingwex/fesetexceptflag.c22
-rw-r--r--winsup/mingw/mingwex/fesetround.c19
-rw-r--r--winsup/mingw/mingwex/fetestexcept.c15
-rw-r--r--winsup/mingw/mingwex/feupdateenv.c20
-rw-r--r--winsup/mingw/mingwex/fma.S12
-rw-r--r--winsup/mingw/mingwex/fmaf.S12
-rw-r--r--winsup/mingw/mingwex/fmal.c4
-rw-r--r--winsup/mingw/mingwex/fmax.c7
-rw-r--r--winsup/mingw/mingwex/fmaxf.c7
-rw-r--r--winsup/mingw/mingwex/fmaxl.c7
-rw-r--r--winsup/mingw/mingwex/fmin.c7
-rw-r--r--winsup/mingw/mingwex/fminf.c7
-rw-r--r--winsup/mingw/mingwex/fminl.c7
-rw-r--r--winsup/mingw/mingwex/fp_consts.c81
-rw-r--r--winsup/mingw/mingwex/fpclassify.c20
-rw-r--r--winsup/mingw/mingwex/fpclassifyf.c10
-rw-r--r--winsup/mingw/mingwex/fpclassifyl.c10
-rw-r--r--winsup/mingw/mingwex/fucom.c11
-rw-r--r--winsup/mingw/mingwex/fwide.c25
-rw-r--r--winsup/mingw/mingwex/imaxabs.c17
-rw-r--r--winsup/mingw/mingwex/imaxdiv.c25
-rw-r--r--winsup/mingw/mingwex/isnan.c14
-rw-r--r--winsup/mingw/mingwex/isnanf.c12
-rw-r--r--winsup/mingw/mingwex/isnanl.c13
-rw-r--r--winsup/mingw/mingwex/lltoa.c3
-rw-r--r--winsup/mingw/mingwex/lltow.c3
-rw-r--r--winsup/mingw/mingwex/log2.c8
-rw-r--r--winsup/mingw/mingwex/log2f.c8
-rw-r--r--winsup/mingw/mingwex/log2l.c8
-rw-r--r--winsup/mingw/mingwex/math_stubs.c12
-rw-r--r--winsup/mingw/mingwex/mbsinit.c21
-rw-r--r--winsup/mingw/mingwex/mingw-fseek.c119
-rw-r--r--winsup/mingw/mingwex/rint.c6
-rw-r--r--winsup/mingw/mingwex/rintf.c7
-rw-r--r--winsup/mingw/mingwex/rintl.c7
-rw-r--r--winsup/mingw/mingwex/round.c29
-rw-r--r--winsup/mingw/mingwex/roundf.c29
-rw-r--r--winsup/mingw/mingwex/roundl.c30
-rw-r--r--winsup/mingw/mingwex/signbit.c13
-rw-r--r--winsup/mingw/mingwex/signbitf.c10
-rw-r--r--winsup/mingw/mingwex/signbitl.c11
-rw-r--r--winsup/mingw/mingwex/sitest.c1527
-rw-r--r--winsup/mingw/mingwex/snprintf.c13
-rw-r--r--winsup/mingw/mingwex/snwprintf.c13
-rw-r--r--winsup/mingw/mingwex/strtof.c6
-rw-r--r--winsup/mingw/mingwex/strtoimax.c112
-rw-r--r--winsup/mingw/mingwex/strtoumax.c110
-rw-r--r--winsup/mingw/mingwex/testwmem.c104
-rw-r--r--winsup/mingw/mingwex/trunc.c17
-rw-r--r--winsup/mingw/mingwex/truncf.c17
-rw-r--r--winsup/mingw/mingwex/truncl.c17
-rw-r--r--winsup/mingw/mingwex/ulltoa.c3
-rw-r--r--winsup/mingw/mingwex/ulltow.c3
-rw-r--r--winsup/mingw/mingwex/vsnprintf.c5
-rw-r--r--winsup/mingw/mingwex/vsnwprintf.c5
-rw-r--r--winsup/mingw/mingwex/wcstof.c6
-rw-r--r--winsup/mingw/mingwex/wcstoimax.c119
-rw-r--r--winsup/mingw/mingwex/wcstoumax.c113
-rw-r--r--winsup/mingw/mingwex/wdirent.c3
-rw-r--r--winsup/mingw/mingwex/wmemchr.c28
-rw-r--r--winsup/mingw/mingwex/wmemcmp.c32
-rw-r--r--winsup/mingw/mingwex/wmemcpy.c32
-rw-r--r--winsup/mingw/mingwex/wmemmove.c43
-rw-r--r--winsup/mingw/mingwex/wmemset.c30
-rw-r--r--winsup/mingw/mingwex/wtoll.c3
-rwxr-xr-xwinsup/mingw/mkinstalldirs36
-rw-r--r--winsup/mingw/moldname-crtdll.def143
-rw-r--r--winsup/mingw/moldname-msvcrt.def143
-rw-r--r--winsup/mingw/moldname.def137
-rw-r--r--winsup/mingw/moldname.def.in143
-rw-r--r--winsup/mingw/msvcrt.def737
-rw-r--r--winsup/mingw/msvcrt20.def719
-rw-r--r--winsup/mingw/msvcrt40.def676
-rw-r--r--winsup/mingw/mthr.c197
-rw-r--r--winsup/mingw/mthr_init.c80
-rw-r--r--winsup/mingw/mthr_stub.c45
-rw-r--r--winsup/mingw/profile/Makefile.in134
-rwxr-xr-xwinsup/mingw/profile/configure1031
-rw-r--r--winsup/mingw/profile/configure.in72
-rw-r--r--winsup/mingw/profile/gcrt0.c52
-rw-r--r--winsup/mingw/profile/gmon.c289
-rw-r--r--winsup/mingw/profile/gmon.h181
-rw-r--r--winsup/mingw/profile/mcount.c180
-rw-r--r--winsup/mingw/profile/profil.c185
-rw-r--r--winsup/mingw/profile/profil.h51
-rw-r--r--winsup/mingw/profile/profile.h63
-rw-r--r--winsup/mingw/readme.txt685
-rw-r--r--winsup/mingw/samples/dirent/jamfile3
-rw-r--r--winsup/mingw/samples/dirent/test.c91
-rw-r--r--winsup/mingw/samples/dirent/wtest.c98
-rw-r--r--winsup/mingw/samples/dlltest/dll.c22
-rw-r--r--winsup/mingw/samples/dlltest/dll.def3
-rw-r--r--winsup/mingw/samples/dlltest/dll.h4
-rw-r--r--winsup/mingw/samples/dlltest/exe.c23
-rw-r--r--winsup/mingw/samples/dlltest/exe.exp8
-rw-r--r--winsup/mingw/samples/dlltest/expexe.c17
-rw-r--r--winsup/mingw/samples/dlltest/expexe.def2
-rw-r--r--winsup/mingw/samples/dlltest/jamfile46
-rw-r--r--winsup/mingw/samples/dlltest/loaddll.c40
-rw-r--r--winsup/mingw/samples/dlltest/loadexe.c47
-rw-r--r--winsup/mingw/samples/dlltest/readme.txt39
-rw-r--r--winsup/mingw/samples/dlltest/silly.cpp55
-rw-r--r--winsup/mingw/samples/dlltest/silly.def11
-rw-r--r--winsup/mingw/samples/dlltest/silly.exp8
-rw-r--r--winsup/mingw/samples/dlltest/silly.h27
-rw-r--r--winsup/mingw/samples/dlltest/sillydll.cpp107
-rw-r--r--winsup/mingw/samples/filehand/filehand.c57
-rw-r--r--winsup/mingw/samples/filehand/jamfile3
-rw-r--r--winsup/mingw/samples/filehand/junk.txt1
-rw-r--r--winsup/mingw/samples/fixargv/fixargv.c290
-rw-r--r--winsup/mingw/samples/fixargv/fixargv.h24
-rw-r--r--winsup/mingw/samples/fixargv/readme.txt85
-rw-r--r--winsup/mingw/samples/fmode/all.c46
-rw-r--r--winsup/mingw/samples/fmode/jamfile5
-rw-r--r--winsup/mingw/samples/fmode/readme.txt5
-rw-r--r--winsup/mingw/samples/fmode/test.c31
-rw-r--r--winsup/mingw/samples/globbing/glob.c20
-rw-r--r--winsup/mingw/samples/globbing/jamfile11
-rw-r--r--winsup/mingw/samples/globbing/noglob.c22
-rw-r--r--winsup/mingw/samples/globbing/readme.txt14
-rw-r--r--winsup/mingw/samples/print/jamfile9
-rw-r--r--winsup/mingw/samples/print/prntest.c65
-rw-r--r--winsup/mingw/samples/seh/eh3.c112
-rw-r--r--winsup/mingw/samples/seh/exutil.c68
-rw-r--r--winsup/mingw/samples/seh/exutil.def3
-rw-r--r--winsup/mingw/samples/seh/exutil.h23
-rw-r--r--winsup/mingw/samples/seh/jamfile13
-rw-r--r--winsup/mingw/samples/seh/sehfix.c60
-rw-r--r--winsup/mingw/samples/seh/sehsub.c43
-rw-r--r--winsup/mingw/samples/seh/sehtest.c72
-rw-r--r--winsup/mingw/samples/simpledll/dll.c33
-rw-r--r--winsup/mingw/samples/simpledll/dll.cpp44
-rw-r--r--winsup/mingw/samples/simpledll/dll.def2
-rw-r--r--winsup/mingw/samples/simpledll/exe.c13
-rw-r--r--winsup/mingw/samples/simpledll/jamfile14
-rw-r--r--winsup/mingw/samples/simpledll/makedll.bat23
-rw-r--r--winsup/mingw/samples/test/jamfile9
-rw-r--r--winsup/mingw/samples/test/test.c20
-rw-r--r--winsup/mingw/samples/wintest/jamfile8
-rw-r--r--winsup/mingw/samples/wintest/test.c212
-rw-r--r--winsup/mingw/string_old.c47
-rw-r--r--winsup/subauth/ChangeLog21
-rw-r--r--winsup/subauth/Makefile.in89
-rwxr-xr-xwinsup/subauth/configure1253
-rw-r--r--winsup/subauth/configure.in91
-rw-r--r--winsup/subauth/cygsuba.c141
-rw-r--r--winsup/subauth/cygsuba.din5
-rw-r--r--winsup/testsuite/ChangeLog308
-rw-r--r--winsup/testsuite/Makefile.in189
-rw-r--r--winsup/testsuite/README35
-rw-r--r--winsup/testsuite/config/default.exp13
-rw-r--r--winsup/testsuite/configure1193
-rwxr-xr-xwinsup/testsuite/configure.in19
-rw-r--r--winsup/testsuite/libltp/include/dataascii.h65
-rw-r--r--winsup/testsuite/libltp/include/databin.h44
-rw-r--r--winsup/testsuite/libltp/include/file_lock.h40
-rw-r--r--winsup/testsuite/libltp/include/forker.h63
-rw-r--r--winsup/testsuite/libltp/include/open_flags.h73
-rw-r--r--winsup/testsuite/libltp/include/pattern.h90
-rw-r--r--winsup/testsuite/libltp/include/random_range.h45
-rw-r--r--winsup/testsuite/libltp/include/rmobj.h12
-rw-r--r--winsup/testsuite/libltp/include/search_path.h36
-rw-r--r--winsup/testsuite/libltp/include/str_to_bytes.h39
-rw-r--r--winsup/testsuite/libltp/include/string_to_tokens.h48
-rw-r--r--winsup/testsuite/libltp/include/test.h216
-rw-r--r--winsup/testsuite/libltp/include/tlibio.h148
-rw-r--r--winsup/testsuite/libltp/include/usctest.h319
-rw-r--r--winsup/testsuite/libltp/include/write_log.h169
-rw-r--r--winsup/testsuite/libltp/lib/dataascii.c218
-rw-r--r--winsup/testsuite/libltp/lib/databin.c298
-rw-r--r--winsup/testsuite/libltp/lib/datapid.c374
-rw-r--r--winsup/testsuite/libltp/lib/forker.c286
-rw-r--r--winsup/testsuite/libltp/lib/get_high_address.c20
-rw-r--r--winsup/testsuite/libltp/lib/libtestsuite.c74
-rw-r--r--winsup/testsuite/libltp/lib/open_flags.c330
-rw-r--r--winsup/testsuite/libltp/lib/parse_opts.c878
-rw-r--r--winsup/testsuite/libltp/lib/pattern.c168
-rw-r--r--winsup/testsuite/libltp/lib/rmobj.c211
-rw-r--r--winsup/testsuite/libltp/lib/search_path.c249
-rw-r--r--winsup/testsuite/libltp/lib/str_to_bytes.c211
-rw-r--r--winsup/testsuite/libltp/lib/string_to_tokens.c109
-rw-r--r--winsup/testsuite/libltp/lib/tst_res.c964
-rw-r--r--winsup/testsuite/libltp/lib/tst_sig.c220
-rw-r--r--winsup/testsuite/libltp/lib/tst_tmpdir.c351
-rw-r--r--winsup/testsuite/libltp/lib/write_log.c468
-rw-r--r--winsup/testsuite/winsup.api/checksignal.c79
-rw-r--r--winsup/testsuite/winsup.api/crlf.c527
-rw-r--r--winsup/testsuite/winsup.api/devzero.c113
-rw-r--r--winsup/testsuite/winsup.api/iospeed.c115
-rw-r--r--winsup/testsuite/winsup.api/known_bugs.tcl8
-rw-r--r--winsup/testsuite/winsup.api/ltp/access01.c302
-rw-r--r--winsup/testsuite/winsup.api/ltp/access03.c507
-rw-r--r--winsup/testsuite/winsup.api/ltp/access04.c243
-rw-r--r--winsup/testsuite/winsup.api/ltp/access05.c425
-rw-r--r--winsup/testsuite/winsup.api/ltp/alarm01.c226
-rw-r--r--winsup/testsuite/winsup.api/ltp/alarm02.c240
-rw-r--r--winsup/testsuite/winsup.api/ltp/alarm03.c229
-rw-r--r--winsup/testsuite/winsup.api/ltp/alarm07.c203
-rw-r--r--winsup/testsuite/winsup.api/ltp/asyncio02.c365
-rw-r--r--winsup/testsuite/winsup.api/ltp/chdir02.c220
-rw-r--r--winsup/testsuite/winsup.api/ltp/chdir04.c189
-rw-r--r--winsup/testsuite/winsup.api/ltp/chmod01.c231
-rw-r--r--winsup/testsuite/winsup.api/ltp/chmod02.c260
-rw-r--r--winsup/testsuite/winsup.api/ltp/chown01.c244
-rw-r--r--winsup/testsuite/winsup.api/ltp/close01.c199
-rw-r--r--winsup/testsuite/winsup.api/ltp/close02.c142
-rw-r--r--winsup/testsuite/winsup.api/ltp/close08.c241
-rw-r--r--winsup/testsuite/winsup.api/ltp/creat01.c206
-rw-r--r--winsup/testsuite/winsup.api/ltp/creat03.c153
-rw-r--r--winsup/testsuite/winsup.api/ltp/creat09.c246
-rw-r--r--winsup/testsuite/winsup.api/ltp/dup01.c261
-rw-r--r--winsup/testsuite/winsup.api/ltp/dup02.c246
-rw-r--r--winsup/testsuite/winsup.api/ltp/dup03.c292
-rw-r--r--winsup/testsuite/winsup.api/ltp/dup04.c297
-rw-r--r--winsup/testsuite/winsup.api/ltp/dup05.c266
-rw-r--r--winsup/testsuite/winsup.api/ltp/execl01.c258
-rw-r--r--winsup/testsuite/winsup.api/ltp/execle01.c257
-rw-r--r--winsup/testsuite/winsup.api/ltp/execlp01.c256
-rw-r--r--winsup/testsuite/winsup.api/ltp/execv01.c257
-rw-r--r--winsup/testsuite/winsup.api/ltp/execve01.c258
-rw-r--r--winsup/testsuite/winsup.api/ltp/execvp01.c257
-rw-r--r--winsup/testsuite/winsup.api/ltp/exit01.c163
-rw-r--r--winsup/testsuite/winsup.api/ltp/exit02.c227
-rw-r--r--winsup/testsuite/winsup.api/ltp/fchdir01.c248
-rw-r--r--winsup/testsuite/winsup.api/ltp/fchdir02.c159
-rw-r--r--winsup/testsuite/winsup.api/ltp/fchmod01.c241
-rw-r--r--winsup/testsuite/winsup.api/ltp/fchown01.c234
-rw-r--r--winsup/testsuite/winsup.api/ltp/fcntl02.c244
-rw-r--r--winsup/testsuite/winsup.api/ltp/fcntl03.c240
-rw-r--r--winsup/testsuite/winsup.api/ltp/fcntl04.c239
-rw-r--r--winsup/testsuite/winsup.api/ltp/fcntl05.c249
-rw-r--r--winsup/testsuite/winsup.api/ltp/fcntl07.c426
-rw-r--r--winsup/testsuite/winsup.api/ltp/fcntl07B.c427
-rw-r--r--winsup/testsuite/winsup.api/ltp/fcntl08.c250
-rw-r--r--winsup/testsuite/winsup.api/ltp/fcntl09.c272
-rw-r--r--winsup/testsuite/winsup.api/ltp/fcntl10.c278
-rw-r--r--winsup/testsuite/winsup.api/ltp/fork01.c317
-rw-r--r--winsup/testsuite/winsup.api/ltp/fork02.c142
-rw-r--r--winsup/testsuite/winsup.api/ltp/fork03.c164
-rw-r--r--winsup/testsuite/winsup.api/ltp/fork04.c405
-rw-r--r--winsup/testsuite/winsup.api/ltp/fork06.c152
-rw-r--r--winsup/testsuite/winsup.api/ltp/fork07.c198
-rw-r--r--winsup/testsuite/winsup.api/ltp/fork09.c228
-rw-r--r--winsup/testsuite/winsup.api/ltp/fork10.c215
-rw-r--r--winsup/testsuite/winsup.api/ltp/fork11.c140
-rw-r--r--winsup/testsuite/winsup.api/ltp/fpathconf01.c257
-rw-r--r--winsup/testsuite/winsup.api/ltp/fstat01.c239
-rw-r--r--winsup/testsuite/winsup.api/ltp/fstat02.c245
-rw-r--r--winsup/testsuite/winsup.api/ltp/fstat03.c192
-rw-r--r--winsup/testsuite/winsup.api/ltp/fstat04.c245
-rw-r--r--winsup/testsuite/winsup.api/ltp/fsync01.c248
-rw-r--r--winsup/testsuite/winsup.api/ltp/ftruncate01.c244
-rw-r--r--winsup/testsuite/winsup.api/ltp/ftruncate02.c314
-rw-r--r--winsup/testsuite/winsup.api/ltp/ftruncate03.c325
-rw-r--r--winsup/testsuite/winsup.api/ltp/getegid01.c226
-rw-r--r--winsup/testsuite/winsup.api/ltp/geteuid01.c226
-rw-r--r--winsup/testsuite/winsup.api/ltp/getgid01.c219
-rw-r--r--winsup/testsuite/winsup.api/ltp/getgid02.c158
-rw-r--r--winsup/testsuite/winsup.api/ltp/getgid03.c157
-rw-r--r--winsup/testsuite/winsup.api/ltp/getgroups01.c315
-rw-r--r--winsup/testsuite/winsup.api/ltp/getgroups02.c226
-rw-r--r--winsup/testsuite/winsup.api/ltp/gethostid01.c224
-rw-r--r--winsup/testsuite/winsup.api/ltp/gethostname01.c226
-rw-r--r--winsup/testsuite/winsup.api/ltp/getpgid01.c240
-rw-r--r--winsup/testsuite/winsup.api/ltp/getpgid02.c172
-rw-r--r--winsup/testsuite/winsup.api/ltp/getpgrp01.c219
-rw-r--r--winsup/testsuite/winsup.api/ltp/getpid01.c217
-rw-r--r--winsup/testsuite/winsup.api/ltp/getpid02.c188
-rw-r--r--winsup/testsuite/winsup.api/ltp/getppid01.c219
-rw-r--r--winsup/testsuite/winsup.api/ltp/getppid02.c146
-rw-r--r--winsup/testsuite/winsup.api/ltp/getuid01.c219
-rw-r--r--winsup/testsuite/winsup.api/ltp/getuid02.c136
-rw-r--r--winsup/testsuite/winsup.api/ltp/getuid03.c137
-rw-r--r--winsup/testsuite/winsup.api/ltp/kill01.c161
-rw-r--r--winsup/testsuite/winsup.api/ltp/kill02.c858
-rw-r--r--winsup/testsuite/winsup.api/ltp/kill03.c169
-rw-r--r--winsup/testsuite/winsup.api/ltp/kill04.c180
-rw-r--r--winsup/testsuite/winsup.api/ltp/kill09.c258
-rw-r--r--winsup/testsuite/winsup.api/ltp/link02.c263
-rw-r--r--winsup/testsuite/winsup.api/ltp/link03.c330
-rw-r--r--winsup/testsuite/winsup.api/ltp/link04.c426
-rw-r--r--winsup/testsuite/winsup.api/ltp/link05.c351
-rw-r--r--winsup/testsuite/winsup.api/ltp/lseek01.c256
-rw-r--r--winsup/testsuite/winsup.api/ltp/lseek02.c243
-rw-r--r--winsup/testsuite/winsup.api/ltp/lseek03.c290
-rw-r--r--winsup/testsuite/winsup.api/ltp/lseek04.c257
-rw-r--r--winsup/testsuite/winsup.api/ltp/lseek05.c253
-rw-r--r--winsup/testsuite/winsup.api/ltp/lseek06.c237
-rw-r--r--winsup/testsuite/winsup.api/ltp/lseek07.c288
-rw-r--r--winsup/testsuite/winsup.api/ltp/lseek08.c242
-rw-r--r--winsup/testsuite/winsup.api/ltp/lseek09.c269
-rw-r--r--winsup/testsuite/winsup.api/ltp/lseek10.c347
-rw-r--r--winsup/testsuite/winsup.api/ltp/lstat02.c253
-rw-r--r--winsup/testsuite/winsup.api/ltp/mkdir01.c271
-rw-r--r--winsup/testsuite/winsup.api/ltp/mkdir08.c236
-rw-r--r--winsup/testsuite/winsup.api/ltp/mknod01.c274
-rw-r--r--winsup/testsuite/winsup.api/ltp/mmap001.c206
-rw-r--r--winsup/testsuite/winsup.api/ltp/mmap02.c294
-rw-r--r--winsup/testsuite/winsup.api/ltp/mmap03.c294
-rw-r--r--winsup/testsuite/winsup.api/ltp/mmap04.c295
-rw-r--r--winsup/testsuite/winsup.api/ltp/mmap05.c303
-rw-r--r--winsup/testsuite/winsup.api/ltp/mmap06.c237
-rw-r--r--winsup/testsuite/winsup.api/ltp/mmap07.c236
-rw-r--r--winsup/testsuite/winsup.api/ltp/mmap08.c236
-rw-r--r--winsup/testsuite/winsup.api/ltp/munmap01.c282
-rw-r--r--winsup/testsuite/winsup.api/ltp/munmap02.c307
-rw-r--r--winsup/testsuite/winsup.api/ltp/nice05.c220
-rw-r--r--winsup/testsuite/winsup.api/ltp/open02.c150
-rw-r--r--winsup/testsuite/winsup.api/ltp/open03.c243
-rw-r--r--winsup/testsuite/winsup.api/ltp/pathconf01.c246
-rw-r--r--winsup/testsuite/winsup.api/ltp/pause01.c229
-rw-r--r--winsup/testsuite/winsup.api/ltp/pipe01.c157
-rw-r--r--winsup/testsuite/winsup.api/ltp/pipe08.c159
-rw-r--r--winsup/testsuite/winsup.api/ltp/pipe09.c232
-rw-r--r--winsup/testsuite/winsup.api/ltp/pipe10.c168
-rw-r--r--winsup/testsuite/winsup.api/ltp/pipe11.c227
-rw-r--r--winsup/testsuite/winsup.api/ltp/poll01.c251
-rw-r--r--winsup/testsuite/winsup.api/ltp/read01.c280
-rw-r--r--winsup/testsuite/winsup.api/ltp/read04.c175
-rw-r--r--winsup/testsuite/winsup.api/ltp/readdir01.c351
-rw-r--r--winsup/testsuite/winsup.api/ltp/readlink01.c230
-rw-r--r--winsup/testsuite/winsup.api/ltp/readlink02.c244
-rw-r--r--winsup/testsuite/winsup.api/ltp/readlink03.c361
-rw-r--r--winsup/testsuite/winsup.api/ltp/rename01.c264
-rw-r--r--winsup/testsuite/winsup.api/ltp/rename02.c251
-rw-r--r--winsup/testsuite/winsup.api/ltp/rename08.c206
-rw-r--r--winsup/testsuite/winsup.api/ltp/rename10.c204
-rw-r--r--winsup/testsuite/winsup.api/ltp/rmdir01.c190
-rw-r--r--winsup/testsuite/winsup.api/ltp/rmdir04.c237
-rw-r--r--winsup/testsuite/winsup.api/ltp/rmdir05.c448
-rw-r--r--winsup/testsuite/winsup.api/ltp/sbrk01.c280
-rw-r--r--winsup/testsuite/winsup.api/ltp/select01.c276
-rw-r--r--winsup/testsuite/winsup.api/ltp/select02.c268
-rw-r--r--winsup/testsuite/winsup.api/ltp/select03.c282
-rw-r--r--winsup/testsuite/winsup.api/ltp/setgid01.c219
-rw-r--r--winsup/testsuite/winsup.api/ltp/setgroups01.c229
-rw-r--r--winsup/testsuite/winsup.api/ltp/setpgid01.c240
-rw-r--r--winsup/testsuite/winsup.api/ltp/setregid01.c338
-rw-r--r--winsup/testsuite/winsup.api/ltp/setreuid01.c338
-rw-r--r--winsup/testsuite/winsup.api/ltp/setuid01.c225
-rw-r--r--winsup/testsuite/winsup.api/ltp/setuid02.c240
-rw-r--r--winsup/testsuite/winsup.api/ltp/signal03.c665
-rw-r--r--winsup/testsuite/winsup.api/ltp/stat01.c268
-rw-r--r--winsup/testsuite/winsup.api/ltp/stat02.c277
-rw-r--r--winsup/testsuite/winsup.api/ltp/stat03.c393
-rw-r--r--winsup/testsuite/winsup.api/ltp/stat05.c241
-rw-r--r--winsup/testsuite/winsup.api/ltp/stat06.c378
-rw-r--r--winsup/testsuite/winsup.api/ltp/symlink01.c2033
-rw-r--r--winsup/testsuite/winsup.api/ltp/symlink02.c245
-rw-r--r--winsup/testsuite/winsup.api/ltp/symlink03.c404
-rw-r--r--winsup/testsuite/winsup.api/ltp/symlink04.c239
-rw-r--r--winsup/testsuite/winsup.api/ltp/symlink05.c223
-rw-r--r--winsup/testsuite/winsup.api/ltp/sync01.c216
-rw-r--r--winsup/testsuite/winsup.api/ltp/sync02.c240
-rw-r--r--winsup/testsuite/winsup.api/ltp/time01.c218
-rw-r--r--winsup/testsuite/winsup.api/ltp/time02.c183
-rw-r--r--winsup/testsuite/winsup.api/ltp/times01.c222
-rw-r--r--winsup/testsuite/winsup.api/ltp/times02.c135
-rw-r--r--winsup/testsuite/winsup.api/ltp/times03.c246
-rw-r--r--winsup/testsuite/winsup.api/ltp/truncate01.c262
-rw-r--r--winsup/testsuite/winsup.api/ltp/truncate02.c335
-rw-r--r--winsup/testsuite/winsup.api/ltp/ulimit01.c273
-rw-r--r--winsup/testsuite/winsup.api/ltp/umask01.c220
-rw-r--r--winsup/testsuite/winsup.api/ltp/umask02.c134
-rw-r--r--winsup/testsuite/winsup.api/ltp/umask03.c169
-rw-r--r--winsup/testsuite/winsup.api/ltp/uname01.c221
-rw-r--r--winsup/testsuite/winsup.api/ltp/unlink05.c246
-rw-r--r--winsup/testsuite/winsup.api/ltp/unlink06.c255
-rw-r--r--winsup/testsuite/winsup.api/ltp/unlink07.c329
-rw-r--r--winsup/testsuite/winsup.api/ltp/unlink08.c433
-rw-r--r--winsup/testsuite/winsup.api/ltp/vfork01.c402
-rw-r--r--winsup/testsuite/winsup.api/ltp/wait02.c230
-rw-r--r--winsup/testsuite/winsup.api/ltp/wait401.c187
-rw-r--r--winsup/testsuite/winsup.api/ltp/wait402.c202
-rw-r--r--winsup/testsuite/winsup.api/ltp/write01.c250
-rw-r--r--winsup/testsuite/winsup.api/ltp/write02.c165
-rw-r--r--winsup/testsuite/winsup.api/ltp/write03.c193
-rw-r--r--winsup/testsuite/winsup.api/mmaptest01.c176
-rw-r--r--winsup/testsuite/winsup.api/mmaptest02.c189
-rw-r--r--winsup/testsuite/winsup.api/mmaptest03.c127
-rw-r--r--winsup/testsuite/winsup.api/mmaptest04.c100
-rw-r--r--winsup/testsuite/winsup.api/nullgetcwd.c16
-rw-r--r--winsup/testsuite/winsup.api/pthread/cleanup2.c157
-rw-r--r--winsup/testsuite/winsup.api/pthread/cleanup3.c160
-rw-r--r--winsup/testsuite/winsup.api/pthread/condvar1.c65
-rw-r--r--winsup/testsuite/winsup.api/pthread/condvar2.c80
-rw-r--r--winsup/testsuite/winsup.api/pthread/condvar2_1.c107
-rw-r--r--winsup/testsuite/winsup.api/pthread/condvar3.c115
-rw-r--r--winsup/testsuite/winsup.api/pthread/condvar3_1.c145
-rw-r--r--winsup/testsuite/winsup.api/pthread/condvar3_2.c139
-rw-r--r--winsup/testsuite/winsup.api/pthread/condvar3_3.c100
-rw-r--r--winsup/testsuite/winsup.api/pthread/condvar4.c137
-rw-r--r--winsup/testsuite/winsup.api/pthread/condvar5.c136
-rw-r--r--winsup/testsuite/winsup.api/pthread/condvar6.c209
-rw-r--r--winsup/testsuite/winsup.api/pthread/condvar8.c221
-rw-r--r--winsup/testsuite/winsup.api/pthread/count1.c62
-rw-r--r--winsup/testsuite/winsup.api/pthread/create1.c34
-rw-r--r--winsup/testsuite/winsup.api/pthread/create2.c74
-rw-r--r--winsup/testsuite/winsup.api/pthread/equal1.c34
-rw-r--r--winsup/testsuite/winsup.api/pthread/exit1.c18
-rw-r--r--winsup/testsuite/winsup.api/pthread/exit2.c30
-rw-r--r--winsup/testsuite/winsup.api/pthread/exit3.c34
-rw-r--r--winsup/testsuite/winsup.api/pthread/inherit1.c99
-rw-r--r--winsup/testsuite/winsup.api/pthread/join0.c40
-rw-r--r--winsup/testsuite/winsup.api/pthread/join1.c51
-rw-r--r--winsup/testsuite/winsup.api/pthread/join2.c41
-rw-r--r--winsup/testsuite/winsup.api/pthread/mutex1.c36
-rw-r--r--winsup/testsuite/winsup.api/pthread/mutex1r.c42
-rw-r--r--winsup/testsuite/winsup.api/pthread/mutex2.c34
-rw-r--r--winsup/testsuite/winsup.api/pthread/mutex3.c43
-rw-r--r--winsup/testsuite/winsup.api/pthread/mutex6r.c68
-rw-r--r--winsup/testsuite/winsup.api/pthread/once1.c45
-rw-r--r--winsup/testsuite/winsup.api/pthread/priority1.c78
-rw-r--r--winsup/testsuite/winsup.api/pthread/priority2.c80
-rw-r--r--winsup/testsuite/winsup.api/pthread/self1.c26
-rw-r--r--winsup/testsuite/winsup.api/pthread/self2.c46
-rw-r--r--winsup/testsuite/winsup.api/pthread/test.h99
-rw-r--r--winsup/testsuite/winsup.api/pthread/tsd1.c170
-rw-r--r--winsup/testsuite/winsup.api/samples/sample-fail.c4
-rw-r--r--winsup/testsuite/winsup.api/samples/sample-miscompile.c1
-rw-r--r--winsup/testsuite/winsup.api/samples/sample-pass.c4
-rw-r--r--winsup/testsuite/winsup.api/sigchld.c20
-rwxr-xr-xwinsup/testsuite/winsup.api/signal-into-win32-api.c57
-rw-r--r--winsup/testsuite/winsup.api/systemcall.c65
-rw-r--r--winsup/testsuite/winsup.api/waitpid.c22
-rw-r--r--winsup/testsuite/winsup.api/winsup.exp81
-rw-r--r--winsup/utils/ChangeLog831
-rw-r--r--winsup/utils/ChangeLog-2000347
-rw-r--r--winsup/utils/Makefile.in218
-rw-r--r--winsup/utils/aclocal.m478
-rwxr-xr-xwinsup/utils/configure1358
-rw-r--r--winsup/utils/configure.in88
-rw-r--r--winsup/utils/cygcheck.cc1369
-rw-r--r--winsup/utils/cygpath.cc745
-rw-r--r--winsup/utils/dump_setup.cc249
-rw-r--r--winsup/utils/dumper.cc880
-rw-r--r--winsup/utils/dumper.h132
-rw-r--r--winsup/utils/getfacl.c256
-rw-r--r--winsup/utils/kill.cc237
-rw-r--r--winsup/utils/mkgroup.c630
-rw-r--r--winsup/utils/mkpasswd.c625
-rw-r--r--winsup/utils/module_info.cc114
-rw-r--r--winsup/utils/mount.cc470
-rw-r--r--winsup/utils/parse_pe.cc91
-rw-r--r--winsup/utils/passwd.c441
-rw-r--r--winsup/utils/path.cc350
-rw-r--r--winsup/utils/path.h11
-rw-r--r--winsup/utils/ps.cc405
-rw-r--r--winsup/utils/regtool.cc682
-rw-r--r--winsup/utils/setfacl.c568
-rw-r--r--winsup/utils/ssp.c948
-rw-r--r--winsup/utils/ssp.txt125
-rw-r--r--winsup/utils/strace.cc1007
-rw-r--r--winsup/utils/umount.cc251
-rw-r--r--winsup/utils/utils.sgml815
966 files changed, 0 insertions, 283003 deletions
diff --git a/winsup/CYGWIN_LICENSE b/winsup/CYGWIN_LICENSE
deleted file mode 100644
index 25656ba58..000000000
--- a/winsup/CYGWIN_LICENSE
+++ /dev/null
@@ -1,38 +0,0 @@
---------------------------------------------------------------------------
-This program is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License (GPL) 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.
---------------------------------------------------------------------------
-
- *** NOTE ***
-
-In accordance with section 10 of the GPL, Red Hat permits programs whose
-sources are distributed under a license that complies with the Open
-Source definition to be linked with libcygwin.a without libcygwin.a
-itself causing the resulting program to be covered by the GNU GPL.
-
-This means that you can port an Open Source(tm) 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 DLL
-you must adhere to the terms of the GPL, i.e. you must provide sources
-for the cygwin DLL.
-
-See http://www.opensource.org/osd.html for the precise Open Source
-Definition referenced above.
-
-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/tools/cygwin/,
-or call 866-2REDHAT ext. 3007
-
diff --git a/winsup/ChangeLog b/winsup/ChangeLog
deleted file mode 100644
index b01edf1b3..000000000
--- a/winsup/ChangeLog
+++ /dev/null
@@ -1,255 +0,0 @@
-2002-06-02 Christopher Faylor <cgf@redhat.com>
-
- * configure.in: Complain about lack of w32api directory.
- * configure: Regenerate.
-
-2002-04-25 Christopher Faylor <cgf@redhat.com>
-
- * configure.in: Remove cinstall target.
- * Makefile.in: Ditto.
- * configure: Regenerate.
-
-2002-02-19 Christopher Faylor <cgf@redhat.com>
-
- * configure.in: Avoid building w32api or mingw if they don't exist.
- * configure: Regenerate.
-
-2001-12-18 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Don't attempt to use zlib directory as a dependency if
- it doesn't exist.
-
-2001-12-14 Christopher Faylor <cgf@redhat.com>
-
- * 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 <cgf@redhat.com>
-
- * Makefile.in: Force configure in testsuite directory if config.status
- does not exist.
-
-2001-11-03 Christopher Faylor <cgf@redhat.com>
-
- * configure.in: Disable subauth directory test.
- * configure: Regenerate.
- * Makefile.in: Use MAKE variable in directory builds.
-
-2001-11-03 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Add directory dependencies to ensure ordering when using
- 'make -jN'.
-
-2001-11-03 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.common: Remove preferred-stack-boundary setting since gcc
- 2.95.3 doesn't work well with it.
-
-2001-11-01 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.common: Add some stuff to common CFLAGS.
-
-2001-10-29 Egor Duda <deo@logos-m.ru>
-
- * Makefile.in: Propagate 'clean' to subdirs properly.
-
-2001-10-26 Corinna Vinschen <corinna@vinschen.de>
-
- * configure: Regenerate, removing erroneous SUBDIRS substitution.
-
-2001-10-24 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Only build testsuite directory on first 'make check'.
- * configure.in: Remove testsuite from SUBDIRS.
- * configure: Regenerate.
-
-2001-10-12 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Add -nostdinc to CXXFLAGS.
-
-2001-10-12 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.common: Perform more include file testing trickery.
-
-Sun Oct 7 23:08:46 2001 Christopher Faylor <cgf@cygnus.com>
-
- * 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 <cgf@cygnus.com>
-
- * Makefile.common: Change method for finding current directory.
-
-Sat May 5 00:14:03 2001 Christopher Faylor <cgf@cygnus.com>
-
- * configure.in: Fix typo.
- * configure: Regenerate.
-
-Fri May 4 11:24:53 2001 Christopher Faylor <cgf@cygnus.com>
-
- * configure.in: Make subauth configuration optional.
- * configure: Regenerate.
-
-Fri May 4 15:06:00 Corinna Vinschen <corinna@vinschen.de>
-
- * 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 <cgf@cygnus.com>
-
- * configure.in: Add bz2lib.
-
-2001-03-19 DJ Delorie <dj@redhat.com>
-
- * configure: fix regeneration bug.
-
-Thu Feb 22 13:36:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * Makefile.common: Revert previous change.
-
-Wed Feb 21 22:41:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * Makefile.common: Add `-fvtable-thunks' to COMPILE_CXX.
-
-Sun Dec 3 00:21:31 2000 Christopher Faylor <cgf@cygnus.com>
-
- * 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 <cgf@cygnus.com>
-
- * Makefile.common (LIBGCC): Acommodate older gcc's that don't need
- libstdc++.a.
-
-Sat Oct 21 18:01:22 2000 Christopher Faylor <cgf@cygnus.com>
-
- * 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 <cgf@cygnus.com>
-
- * 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 <cgf@cygnus.com>
-
- * Makefile.common: Default to VERBOSE when part of overall source
- tree build.
-
-2000-09-02 Egor Duda <deo@logos-m.ru>
-
- * 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 <cgf@cygnus.com>
-
- * Makefile.in: More normalization.
-
-Thu Aug 31 16:37:31 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Normalize 'pwd' based on location of winsup.
-
-Thu Aug 24 15:02:26 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.common: Add bupdir2 to reference above the i686-pc-cygwin
- directory.
-
-Thu Jun 22 18:28:06 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Add dummy info targets.
-
-Tue Jun 20 13:36:23 2000 Christopher Faylor <cgf@cygnus.com>
-
- * configure.in: Bow to necessity and build w32api before anything else.
- * configure: Regenerate.
-
-Sat Jun 17 13:50:04 2000 Christopher Faylor <cgf@cygnus.com>
-
- * 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 <cgf@cygnus.com>
-
- * configure.in: Don't assume that cinstall directory exists.
- * configure: Regenerate
-
-2000-05-24 DJ Delorie <dj@cygnus.com>
-
- * 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 <cgf@cygnus.com>
-
- * MAINTAINERS: Add Corinna to general list.
-
-2000-04-17 DJ Delorie <dj@cygnus.com>
-
- * Makefile.common (srcdir): remove dependence on where pwd is
-
-Sun Apr 9 23:47:45 2000 Christopher Faylor <cgf@cygnus.com>
-
- * 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 <cgf@cygnus.com>
-
- * Makefile.in: Work around MAKEOVERRIDES problem with older versions
- of make.
- * Makefile.common: Ditto.
-
-Fri Apr 7 17:04:02 Ron Parker <rdparker@sourceware.cygnus.com>
-
- * configure.in: Added cinstall to the list of subdirs.
- * configure: Regenerate.
-
-Thu Mar 30 23:45:00 2000 Christopher Faylor <cgf@cygnus.com>
-
- * MAINTAINERS: Add Ron Parker as maintainer of cinstall stuff.
-
-Sun Feb 6 18:15:44 2000 Christopher Faylor <cgf@cygnus.com>
-
- * configure.in: Do the standard CC/CFLAGS stuff for propagation to
- sub-configures.
- * configure: Regenerate.
-
-2000-01-26 DJ Delorie <dj@cygnus.com>
-
- * doc/Makefile.in: fix doctool -d options
-
-Fri Jan 21 12:51:32 2000 Christopher Faylor <cgf@cygnus.com>
-
- * 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 <cgf@cygnus.com>
-
- * 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 <cgf@cygnus.com>
-
- * 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 <cgf@cygnus.com>
-
- 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/MAINTAINERS b/winsup/MAINTAINERS
deleted file mode 100644
index 873e96c70..000000000
--- a/winsup/MAINTAINERS
+++ /dev/null
@@ -1,7 +0,0 @@
-Please send email to the cygwin mailing list at cygwin@cygwin.com if you
-have questions or comments about the code in this directory.
-
-All of the maintainers would prefer that you use the cygwin mailing list for
-all communication.
-
-Thank you.
diff --git a/winsup/Makefile.common b/winsup/Makefile.common
deleted file mode 100644
index d80d9748f..000000000
--- a/winsup/Makefile.common
+++ /dev/null
@@ -1,180 +0,0 @@
-# Makefile.common - common definitions for the winsup directory
-#
-# Copyright 2000, 2001 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.
-
-CFLAGS_COMMON:=-Wall -Wwrite-strings -fno-common -pipe -Winline -fbuiltin# -finline-functions
-MALLOC_DEBUG:=#-DMALLOC_DEBUG -I/cygnus/src/uberbaum/winsup/cygwin/dlmalloc
-MALLOC_OBJ:=#/cygnus/src/uberbaum/winsup/cygwin/dlmalloc/malloc.o
-
-override srcdir:=${shell cd $(srcdir); pwd}
-ifneq (,${filter-out /%,$(srcdir)})
- updir:=$(srcdir)/..
- updir1:=$(updir)/..
-else
- updir:=${patsubst %:::,%,${patsubst %/:::,%,$(dir $(srcdir)):::}}
-ifneq (,${findstring /,$(updir)})
- updir1:=${patsubst %:::,%,${patsubst %/:::,%,$(dir $(updir)):::}}
-else
- updir1:=$(updir)/..
-endif
-endif
-
-pwd:=${shell pwd}
-ifneq "${filter winsup%,${notdir $(pwd)}}" ""
-a:=${shell ${filter winsup%,${notdir $(pwd)}} >/dev/tty}
- here:=${pwd}/cygwin
-else
-a:=${shell ${filter winsup%,${notdir $(pwd)}} >/dev/tty}
- here:=${dir $(pwd)}cygwin
-endif
-bupdir:=${shell cd $(here)/..; pwd}
-ifneq (,${filter-out /%,$(bupdir)})
- bupdir1:=../..
- bupdir2:=../../..
-else
-ifneq (,${findstring /,$(bupdir)})
- bupdir1:=${patsubst %:::,%,${patsubst %/:::,%,$(dir $(bupdir)):::}}
-else
- bupdir1:=$(bupdir)/..
-endif
-ifneq (,${findstring /,$(bupdir1)})
- bupdir2:=${patsubst %:::,%,${patsubst %/:::,%,$(dir $(bupdir1)):::}}
-else
- bupdir2:=$(bupdir1)/..
-endif
-endif
-
-zlib_source:=$(updir)/zlib
-zlib_build:=$(bupdir)/zlib
-bz2lib_source:=$(updir)/bz2lib
-bz2lib_build:=$(bupdir)/bz2lib
-w32api_source:=$(updir)/w32api
-w32api_build:=$(bupdir)/w32api
-ifeq (,${findstring $(w32api_source),$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})
-w32api_include:=-I$(w32api_source)/include
-endif
-w32api_lib:=$(w32api_build)/lib
-newlib_source:=$(updir1)/newlib
-newlib_build:=$(bupdir1)/newlib
-cygwin_build:=$(bupdir)/cygwin
-cygwin_source:=$(updir)/cygwin
-mingw_build:=$(bupdir)/mingw
-mingw_source:=$(updir)/mingw
-utils_build:=$(bupdir)/utils
-utils_source:=$(updir)/utils
-ifeq (,${findstring $(newlib_source)/libc/include,$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})
-newlib_include:=-I$(newlib_source)/libc/include
-endif
-ifeq (,${findstring $(newlib_source)/libc/sys/cygwin,$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})
-newlib_sys_include:=-I$(newlib_source)/libc/sys/cygwin
-endif
-ifeq (,${findstring $(newlib_source)/libc/sys/cygwin/include,$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})
-newlib_sys_include_include:=-I$(newlib_source)/libc/sys/cygwin/include
-endif
-ifeq (,${findstring $(cygwin_source)/include,$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})
-cygwin_include:=-I$(cygwin_source)/include
-endif
-
-INCLUDES:=-I. $(cygwin_include) -I$(cygwin_source) $(newlib_sys_include) $(newlib_include) $(newlib_sys_include_include) $(w32api_include)
-ifdef CONFIG_DIR
-INCLUDES+=-I$(CONFIG_DIR)
-endif
-
-MINGW_INCLUDES:=-I$(updir)/mingw/include $(INCLUDES)
-
-GCC_DEFAULT_OPTIONS:=$(CFLAGS_COMMON) $(CFLAGS_CONFIG) $(INCLUDES)
-
-# Link in libc and libm from newlib
-
-LIBC:=$(newlib_build)/libc/libc.a
-LIBM:=$(newlib_build)/libm/libm.a
-CRT0:=$(newlib_build)/libc/crt0.o
-
-ALL_CFLAGS:=$(DEFS) $(MALLOC_DEBUG) $(CFLAGS) $(GCC_DEFAULT_OPTIONS)
-ALL_CXXFLAGS:=$(DEFS) $(MALLOC_DEBUG) $(CXXFLAGS) $(GCC_DEFAULT_OPTIONS)
-
-ifndef PREPROCESS
-c=-c
-o=.o
-else
-c=-E
-o=.E
-endif
-
-libgcc:=${subst \,/,${shell $(CC_FOR_TARGET) -print-libgcc-file-name}}
-gcc_libdir:=${word 1,${dir $(libgcc)}}
-ifeq (,${findstring $(gcc_libdir),$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})
-GCC_INCLUDE:=-I$(gcc_libdir)/include
-endif
-
-COMPILE_CXX:=$(CXX) $c -nostdinc++ -nostdinc $(ALL_CXXFLAGS) $(GCC_INCLUDE) \
- -fno-rtti -fno-exceptions
-COMPILE_CC:=$(CC) $c -nostdinc $(ALL_CFLAGS) $(GCC_INCLUDE)
-
-vpath %.a $(cygwin_build):$(w32api_lib):$(newlib_build)/libc:$(newlib_build)/libm
-
-MAKEOVERRIDES_WORKAROUND=${wordlist 2,1,a b c}
-
-ifneq ($(MAKEOVERRIDES_WORKAROUND),)
- override MAKE:=$(MAKE) $(MAKEOVERRIDES)
- MAKEOVERRIDES:=
- export MAKEOVERRIDES
-endif
-
-ifdef RPATH_ENVVAR
-VERBOSE=1
-endif
-
-ifneq "${findstring -B,$(COMPILE_CXX) $(COMPILE_CC)}" ""
-VERBOSE=1
-endif
-
-.PRECIOUS: %.o
-
-%.o: %.cc
-ifdef VERBOSE
- $(COMPILE_CXX) -o $(@D)/$(*F)$o $<
-else
- @echo $(CXX) $c $(CXXFLAGS) ... $(*F).cc
- @$(COMPILE_CXX) -o $(@D)/$(*F)$o $<
-endif
-
-%.o: %.c
-ifdef VERBOSE
- $(COMPILE_CC) -o $(@D)/$(*F)$o $<
-else
- @echo $(CC) $c $(CFLAGS) ... $(*F).c
- @$(COMPILE_CC) -o $(@D)/$(*F)$o $<
-endif
-
-$(bupdir1)/libiberty/%.o: $(updir1)/libiberty/%.c
- @$(MAKE) -C $(@D) $(@F)
-
-$(w32api_lib)/%.a: $(w32api_lib)/Makefile
- @$(MAKE) --no-print-dir -C $(@D) $(@F)
-
-$(bz2lib)/%.a: $(bz2lib)/Makefile
- @$(MAKE) --no-print-dir -C $(@D) $(@F)
-
-$(zlib)/%.a: $(zlib)/Makefile
- @$(MAKE) --no-print-dir -C $(@D) $(@F)
-
-all:
-
-# For auto-rebuilding the Makefile
-
-.PRECIOUS: Makefile
-
-Makefile: Makefile.in $(srcdir)/configure.in config.status
- $(SHELL) config.status
-
-config.status: configure
- $(SHELL) config.status --recheck
diff --git a/winsup/Makefile.in b/winsup/Makefile.in
deleted file mode 100644
index 54171e475..000000000
--- a/winsup/Makefile.in
+++ /dev/null
@@ -1,115 +0,0 @@
-# Makefile.in for windows stuff
-# Copyright 1995, 1996, 1997, 1998, 1999, 2000 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@
-
-SUBDIRS=@SUBDIRS@
-INSTALL_SUBDIRS=${patsubst %,install_%,$(SUBDIRS)}
-CLEAN_SUBDIRS=${patsubst %,clean_%,$(SUBDIRS)}
-ZLIB=${findstring zlib,$(SUBDIRS)}
-
-.PHONY: all install clean all-info info install-info 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: Makefile $(INSTALL_SUBDIRS)
-
-clean: $(CLEAN_SUBDIRS)
-
-all-info:
-
-install-info:
-
-info:
-
-$(SUBDIRS):
- @if cd $@ 2>/dev/null; then \
- $(MAKE) all || exit 1; \
- fi || exit 0
-
-$(INSTALL_SUBDIRS):
- @if cd ${patsubst install_%,%,$@} 2>/dev/null; then \
- $(MAKE) install || exit 1; \
- fi || exit 0
-
-$(CLEAN_SUBDIRS):
- @if cd ${patsubst clean_%,%,$@} 2>/dev/null; then \
- $(MAKE) clean || exit 1; \
- fi || exit 0
-
-.PRECIOUS: Makefile
-
-Makefile: Makefile.in $(srcdir)/configure.in config.status
- $(SHELL) config.status
-
-config.status: configure
- $(SHELL) config.status --recheck
-
-check: cygwin
- @if [ -f testsuite/config.status ]; then \
- cd testsuite; \
- else \
- (mkdir testsuite 2>/dev/null || exit 0); \
- cd testsuite; \
- sed -n -e '1,/^done/{' -e 's%/cygwin%/testsuite%g; ' -e 'p; }' ../cygwin/config.status > config.status; \
- chmod a+x config.status; \
- sh ./config.status --recheck; \
- sh ./config.status; \
- fi; \
- $(MAKE) check
-
-utils: cygwin mingw
-
-mingw: w32api
-
-cygwin: w32api
-
-install_utils: cygwin mingw
-
-install_mingw: w32api
-
-install_cygwin: w32api
diff --git a/winsup/bz2lib/CHANGES b/winsup/bz2lib/CHANGES
deleted file mode 100644
index ecaf4170e..000000000
--- a/winsup/bz2lib/CHANGES
+++ /dev/null
@@ -1,167 +0,0 @@
-
-
-0.9.0
-~~~~~
-First version.
-
-
-0.9.0a
-~~~~~~
-Removed 'ranlib' from Makefile, since most modern Unix-es
-don't need it, or even know about it.
-
-
-0.9.0b
-~~~~~~
-Fixed a problem with error reporting in bzip2.c. This does not effect
-the library in any way. Problem is: versions 0.9.0 and 0.9.0a (of the
-program proper) compress and decompress correctly, but give misleading
-error messages (internal panics) when an I/O error occurs, instead of
-reporting the problem correctly. This shouldn't give any data loss
-(as far as I can see), but is confusing.
-
-Made the inline declarations disappear for non-GCC compilers.
-
-
-0.9.0c
-~~~~~~
-Fixed some problems in the library pertaining to some boundary cases.
-This makes the library behave more correctly in those situations. The
-fixes apply only to features (calls and parameters) not used by
-bzip2.c, so the non-fixedness of them in previous versions has no
-effect on reliability of bzip2.c.
-
-In bzlib.c:
- * made zero-length BZ_FLUSH work correctly in bzCompress().
- * fixed bzWrite/bzRead to ignore zero-length requests.
- * fixed bzread to correctly handle read requests after EOF.
- * wrong parameter order in call to bzDecompressInit in
- bzBuffToBuffDecompress. Fixed.
-
-In compress.c:
- * changed setting of nGroups in sendMTFValues() so as to
- do a bit better on small files. This _does_ effect
- bzip2.c.
-
-
-0.9.5a
-~~~~~~
-Major change: add a fallback sorting algorithm (blocksort.c)
-to give reasonable behaviour even for very repetitive inputs.
-Nuked --repetitive-best and --repetitive-fast since they are
-no longer useful.
-
-Minor changes: mostly a whole bunch of small changes/
-bugfixes in the driver (bzip2.c). Changes pertaining to the
-user interface are:
-
- allow decompression of symlink'd files to stdout
- decompress/test files even without .bz2 extension
- give more accurate error messages for I/O errors
- when compressing/decompressing to stdout, don't catch control-C
- read flags from BZIP2 and BZIP environment variables
- decline to break hard links to a file unless forced with -f
- allow -c flag even with no filenames
- preserve file ownerships as far as possible
- make -s -1 give the expected block size (100k)
- add a flag -q --quiet to suppress nonessential warnings
- stop decoding flags after --, so files beginning in - can be handled
- resolved inconsistent naming: bzcat or bz2cat ?
- bzip2 --help now returns 0
-
-Programming-level changes are:
-
- fixed syntax error in GET_LL4 for Borland C++ 5.02
- let bzBuffToBuffDecompress return BZ_DATA_ERROR{_MAGIC}
- fix overshoot of mode-string end in bzopen_or_bzdopen
- wrapped bzlib.h in #ifdef __cplusplus ... extern "C" { ... }
- close file handles under all error conditions
- added minor mods so it compiles with DJGPP out of the box
- fixed Makefile so it doesn't give problems with BSD make
- fix uninitialised memory reads in dlltest.c
-
-0.9.5b
-~~~~~~
-Open stdin/stdout in binary mode for DJGPP.
-
-0.9.5c
-~~~~~~
-Changed BZ_N_OVERSHOOT to be ... + 2 instead of ... + 1. The + 1
-version could cause the sorted order to be wrong in some extremely
-obscure cases. Also changed setting of quadrant in blocksort.c.
-
-0.9.5d
-~~~~~~
-The only functional change is to make bzlibVersion() in the library
-return the correct string. This has no effect whatsoever on the
-functioning of the bzip2 program or library. Added a couple of casts
-so the library compiles without warnings at level 3 in MS Visual
-Studio 6.0. Included a Y2K statement in the file Y2K_INFO. All other
-changes are minor documentation changes.
-
-1.0
-~~~
-Several minor bugfixes and enhancements:
-
-* Large file support. The library uses 64-bit counters to
- count the volume of data passing through it. bzip2.c
- is now compiled with -D_FILE_OFFSET_BITS=64 to get large
- file support from the C library. -v correctly prints out
- file sizes greater than 4 gigabytes. All these changes have
- been made without assuming a 64-bit platform or a C compiler
- which supports 64-bit ints, so, except for the C library
- aspect, they are fully portable.
-
-* Decompression robustness. The library/program should be
- robust to any corruption of compressed data, detecting and
- handling _all_ corruption, instead of merely relying on
- the CRCs. What this means is that the program should
- never crash, given corrupted data, and the library should
- always return BZ_DATA_ERROR.
-
-* Fixed an obscure race-condition bug only ever observed on
- Solaris, in which, if you were very unlucky and issued
- control-C at exactly the wrong time, both input and output
- files would be deleted.
-
-* Don't run out of file handles on test/decompression when
- large numbers of files have invalid magic numbers.
-
-* Avoid library namespace pollution. Prefix all exported
- symbols with BZ2_.
-
-* Minor sorting enhancements from my DCC2000 paper.
-
-* Advance the version number to 1.0, so as to counteract the
- (false-in-this-case) impression some people have that programs
- with version numbers less than 1.0 are in someway, experimental,
- pre-release versions.
-
-* Create an initial Makefile-libbz2_so to build a shared library.
- Yes, I know I should really use libtool et al ...
-
-* Make the program exit with 2 instead of 0 when decompression
- fails due to a bad magic number (ie, an invalid bzip2 header).
- Also exit with 1 (as the manual claims :-) whenever a diagnostic
- message would have been printed AND the corresponding operation
- is aborted, for example
- bzip2: Output file xx already exists.
- When a diagnostic message is printed but the operation is not
- aborted, for example
- bzip2: Can't guess original name for wurble -- using wurble.out
- then the exit value 0 is returned, unless some other problem is
- also detected.
-
- I think it corresponds more closely to what the manual claims now.
-
-
-1.0.1
-~~~~~
-* Modified dlltest.c so it uses the new BZ2_ naming scheme.
-* Modified makefile-msc to fix minor build probs on Win2k.
-* Updated README.COMPILATION.PROBLEMS.
-
-There are no functionality changes or bug fixes relative to version
-1.0.0. This is just a documentation update + a fix for minor Win32
-build problems. For almost everyone, upgrading from 1.0.0 to 1.0.1 is
-utterly pointless. Don't bother.
diff --git a/winsup/bz2lib/ChangeLog b/winsup/bz2lib/ChangeLog
deleted file mode 100644
index c703a6e76..000000000
--- a/winsup/bz2lib/ChangeLog
+++ /dev/null
@@ -1,11 +0,0 @@
-Wed Apr 18 23:54:53 2001 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Add -U_WIN32 to CFLAGS compile line to avoid
- inappropriate Windows-isms.
-
-Wed Apr 18 15:58:28 2001 Christopher Faylor <cgf@cygnus.com>
-
- Initial checkin from net sources.
- Makefile.in: New file.
- configure.in: New file.
- configure: New file.
diff --git a/winsup/bz2lib/LICENSE b/winsup/bz2lib/LICENSE
deleted file mode 100644
index 88fa6d88a..000000000
--- a/winsup/bz2lib/LICENSE
+++ /dev/null
@@ -1,39 +0,0 @@
-
-This program, "bzip2" and associated library "libbzip2", are
-copyright (C) 1996-2000 Julian R Seward. 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. The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
-3. Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-
-4. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
-
-Julian Seward, Cambridge, UK.
-jseward@acm.org
-bzip2/libbzip2 version 1.0 of 21 March 2000
-
diff --git a/winsup/bz2lib/Makefile b/winsup/bz2lib/Makefile
deleted file mode 100644
index ab17f4979..000000000
--- a/winsup/bz2lib/Makefile
+++ /dev/null
@@ -1,141 +0,0 @@
-
-SHELL=/bin/sh
-CC=gcc
-BIGFILES=-D_FILE_OFFSET_BITS=64
-CFLAGS=-Wall -Winline -O2 -fomit-frame-pointer -fno-strength-reduce $(BIGFILES)
-
-OBJS= blocksort.o \
- huffman.o \
- crctable.o \
- randtable.o \
- compress.o \
- decompress.o \
- bzlib.o
-
-all: libbz2.a bzip2 bzip2recover test
-
-bzip2: libbz2.a bzip2.o
- $(CC) $(CFLAGS) -o bzip2 bzip2.o -L. -lbz2
-
-bzip2recover: bzip2recover.o
- $(CC) $(CFLAGS) -o bzip2recover bzip2recover.o
-
-libbz2.a: $(OBJS)
- rm -f libbz2.a
- ar cq libbz2.a $(OBJS)
- @if ( test -f /usr/bin/ranlib -o -f /bin/ranlib -o \
- -f /usr/ccs/bin/ranlib ) ; then \
- echo ranlib libbz2.a ; \
- ranlib libbz2.a ; \
- fi
-
-test: bzip2
- @cat words1
- ./bzip2 -1 < sample1.ref > sample1.rb2
- ./bzip2 -2 < sample2.ref > sample2.rb2
- ./bzip2 -3 < sample3.ref > sample3.rb2
- ./bzip2 -d < sample1.bz2 > sample1.tst
- ./bzip2 -d < sample2.bz2 > sample2.tst
- ./bzip2 -ds < sample3.bz2 > sample3.tst
- cmp sample1.bz2 sample1.rb2
- cmp sample2.bz2 sample2.rb2
- cmp sample3.bz2 sample3.rb2
- cmp sample1.tst sample1.ref
- cmp sample2.tst sample2.ref
- cmp sample3.tst sample3.ref
- @cat words3
-
-PREFIX=/usr
-
-install: bzip2 bzip2recover
- if ( test ! -d $(PREFIX)/bin ) ; then mkdir $(PREFIX)/bin ; fi
- if ( test ! -d $(PREFIX)/lib ) ; then mkdir $(PREFIX)/lib ; fi
- if ( test ! -d $(PREFIX)/man ) ; then mkdir $(PREFIX)/man ; fi
- if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir $(PREFIX)/man/man1 ; fi
- if ( test ! -d $(PREFIX)/include ) ; then mkdir $(PREFIX)/include ; fi
- cp -f bzip2 $(PREFIX)/bin/bzip2
- cp -f bzip2 $(PREFIX)/bin/bunzip2
- cp -f bzip2 $(PREFIX)/bin/bzcat
- cp -f bzip2recover $(PREFIX)/bin/bzip2recover
- chmod a+x $(PREFIX)/bin/bzip2
- chmod a+x $(PREFIX)/bin/bunzip2
- chmod a+x $(PREFIX)/bin/bzcat
- chmod a+x $(PREFIX)/bin/bzip2recover
- cp -f bzip2.1 $(PREFIX)/man/man1
- chmod a+r $(PREFIX)/man/man1/bzip2.1
- cp -f bzlib.h $(PREFIX)/include
- chmod a+r $(PREFIX)/include/bzlib.h
- cp -f libbz2.a $(PREFIX)/lib
- chmod a+r $(PREFIX)/lib/libbz2.a
-
-clean:
- rm -f *.o libbz2.a bzip2 bzip2recover \
- sample1.rb2 sample2.rb2 sample3.rb2 \
- sample1.tst sample2.tst sample3.tst
-
-blocksort.o: blocksort.c
- @cat words0
- $(CC) $(CFLAGS) -c blocksort.c
-huffman.o: huffman.c
- $(CC) $(CFLAGS) -c huffman.c
-crctable.o: crctable.c
- $(CC) $(CFLAGS) -c crctable.c
-randtable.o: randtable.c
- $(CC) $(CFLAGS) -c randtable.c
-compress.o: compress.c
- $(CC) $(CFLAGS) -c compress.c
-decompress.o: decompress.c
- $(CC) $(CFLAGS) -c decompress.c
-bzlib.o: bzlib.c
- $(CC) $(CFLAGS) -c bzlib.c
-bzip2.o: bzip2.c
- $(CC) $(CFLAGS) -c bzip2.c
-bzip2recover.o: bzip2recover.c
- $(CC) $(CFLAGS) -c bzip2recover.c
-
-DISTNAME=bzip2-1.0.1
-tarfile:
- rm -f $(DISTNAME)
- ln -sf . $(DISTNAME)
- tar cvf $(DISTNAME).tar \
- $(DISTNAME)/blocksort.c \
- $(DISTNAME)/huffman.c \
- $(DISTNAME)/crctable.c \
- $(DISTNAME)/randtable.c \
- $(DISTNAME)/compress.c \
- $(DISTNAME)/decompress.c \
- $(DISTNAME)/bzlib.c \
- $(DISTNAME)/bzip2.c \
- $(DISTNAME)/bzip2recover.c \
- $(DISTNAME)/bzlib.h \
- $(DISTNAME)/bzlib_private.h \
- $(DISTNAME)/Makefile \
- $(DISTNAME)/manual.texi \
- $(DISTNAME)/manual.ps \
- $(DISTNAME)/LICENSE \
- $(DISTNAME)/bzip2.1 \
- $(DISTNAME)/bzip2.1.preformatted \
- $(DISTNAME)/bzip2.txt \
- $(DISTNAME)/words0 \
- $(DISTNAME)/words1 \
- $(DISTNAME)/words2 \
- $(DISTNAME)/words3 \
- $(DISTNAME)/sample1.ref \
- $(DISTNAME)/sample2.ref \
- $(DISTNAME)/sample3.ref \
- $(DISTNAME)/sample1.bz2 \
- $(DISTNAME)/sample2.bz2 \
- $(DISTNAME)/sample3.bz2 \
- $(DISTNAME)/dlltest.c \
- $(DISTNAME)/*.html \
- $(DISTNAME)/README \
- $(DISTNAME)/README.COMPILATION.PROBLEMS \
- $(DISTNAME)/CHANGES \
- $(DISTNAME)/libbz2.def \
- $(DISTNAME)/libbz2.dsp \
- $(DISTNAME)/dlltest.dsp \
- $(DISTNAME)/makefile.msc \
- $(DISTNAME)/Y2K_INFO \
- $(DISTNAME)/unzcrash.c \
- $(DISTNAME)/spewG.c \
- $(DISTNAME)/Makefile-libbz2_so
diff --git a/winsup/bz2lib/Makefile-libbz2_so b/winsup/bz2lib/Makefile-libbz2_so
deleted file mode 100644
index a347c50e9..000000000
--- a/winsup/bz2lib/Makefile-libbz2_so
+++ /dev/null
@@ -1,43 +0,0 @@
-
-# This Makefile builds a shared version of the library,
-# libbz2.so.1.0.1, with soname libbz2.so.1.0,
-# at least on x86-Linux (RedHat 5.2),
-# with gcc-2.7.2.3. Please see the README file for some
-# important info about building the library like this.
-
-SHELL=/bin/sh
-CC=gcc
-BIGFILES=-D_FILE_OFFSET_BITS=64
-CFLAGS=-fpic -fPIC -Wall -Winline -O2 -fomit-frame-pointer -fno-strength-reduce $(BIGFILES)
-
-OBJS= blocksort.o \
- huffman.o \
- crctable.o \
- randtable.o \
- compress.o \
- decompress.o \
- bzlib.o
-
-all: $(OBJS)
- $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.1 $(OBJS)
- $(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.1
- rm -f libbz2.so.1.0
- ln -s libbz2.so.1.0.1 libbz2.so.1.0
-
-clean:
- rm -f $(OBJS) bzip2.o libbz2.so.1.0.1 libbz2.so.1.0 bzip2-shared
-
-blocksort.o: blocksort.c
- $(CC) $(CFLAGS) -c blocksort.c
-huffman.o: huffman.c
- $(CC) $(CFLAGS) -c huffman.c
-crctable.o: crctable.c
- $(CC) $(CFLAGS) -c crctable.c
-randtable.o: randtable.c
- $(CC) $(CFLAGS) -c randtable.c
-compress.o: compress.c
- $(CC) $(CFLAGS) -c compress.c
-decompress.o: decompress.c
- $(CC) $(CFLAGS) -c decompress.c
-bzlib.o: bzlib.c
- $(CC) $(CFLAGS) -c bzlib.c
diff --git a/winsup/bz2lib/Makefile.in b/winsup/bz2lib/Makefile.in
deleted file mode 100644
index 622445d23..000000000
--- a/winsup/bz2lib/Makefile.in
+++ /dev/null
@@ -1,118 +0,0 @@
-# Copyright (c) 2000, 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 Christopher Faylor <cgf@redhat.com>
-#
-# Makefile for Cygwin installer
-
-SHELL :=@SHELL@
-
-srcdir:=@srcdir@
-VPATH:=@srcdir@
-prefix:=@prefix@
-exec_prefix:=@exec_prefix@
-
-bindir:=@bindir@
-etcdir:=$(exec_prefix)/etc
-
-program_transform_name :=@program_transform_name@
-
-INSTALL:=@INSTALL@
-INSTALL_PROGRAM:=@INSTALL_PROGRAM@
-INSTALL_DATA:=@INSTALL_DATA@
-
-EXEEXT:=@EXEEXT@
-EXEEXT_FOR_BUILD :=@EXEEXT_FOR_BUILD@
-
-CC:=@CC@
-CC_FOR_TARGET:=$(CC)
-CXX:=@CXX@
-
-CFLAGS:=@CFLAGS@ -nostdinc
-CXXFLAGS:=@CXXFLAGS@ -fno-exceptions -fno-rtti
-CXX:=@CXX@
-
-WINDRES:=@WINDRES@
-OBJCOPY:=@OBJCOPY@
-AR:=@AR@
-RANLIB:=@RANLIB@
-
-include $(srcdir)/../Makefile.common
-
-MINGW_INCLUDES:=-I. -I$(srcdir) -I$(mingw_source)/include -I$(w32api_include) -I$(updir)/bz2lib
-
-MINGW_CXXFLAGS:=-MMD $(CXXFLAGS) -mno-cygwin $(MINGW_INCLUDES) -mwindows -U_WIN32
-MINGW_CFLAGS:=-MMD $(CFLAGS) -mno-cygwin $(MINGW_INCLUDES) -mwindows -U_WIN32
-
-ZLIB:=zlib/libzcygw.a
-BZ2LIB:=$(bupdir)/bz2lib/libbz2.a
-libmingw32.a:=$(mingw_build)/libmingw32.a
-libuser32:=$(w32api_lib)/libuser32.a
-libkernel32:=$(w32api_lib)/libkernel32.a
-
-ALL_DEP_LDLIBS:=$(ZLIB) $(BZ2LIB) $(w32api_lib)/libole32.a $(w32api_lib)/libwsock32.a \
- $(w32api_lib)/libnetapi32.a $(w32api_lib)/libadvapi32.a \
- $(w32api_lib)/libuuid.a $(libkernel32) $(w32api_lib)/libuser32.a \
- $(libmingw32)
-
-ALL_LDLIBS:=${patsubst $(mingw_build)/lib%.a,-l%,\
- ${patsubst $(w32api_lib)/lib%.a,-l%,\
- ${filter-out $(libmingw32),\
- ${filter-out $(libuser32),\
- ${filter-out $(libkernel32), $(ALL_DEP_LDLIBS)}}}}}
-
-ALL_LDFLAGS:=${filter-out -I%, \
- ${filter-out -W%, \
- -B$(w32api_lib)/ -B${mingw_build}/ $(MINGW_CFLAGS) $(LDFLAGS)}}
-
-LIBS:=libbz2.a
-
-OBJS:=blocksort.o bzlib.o compress.o decompress.o huffman.o crctable.o randtable.o
-
-.SUFFIXES:
-.NOEXPORT:
-
-.PHONY: all install clean realclean
-
-all: Makefile $(LIBS)
-
-$(LIBS): $(OBJS)
- $(AR) cru $@ $?
- $(RANLIB) $@
-
-clean:
- rm -f *.o *.rc *.a
-
-realclean: clean
- rm -f Makefile config.cache
-
-install: all
-: Nothing to install
-
-%.o: %.c
-ifdef VERBOSE
- $(CC) $(MINGW_CFLAGS) -c -o $@ $<
-else
- @echo $(CC) -c $(CFLAGS) ... $(<F)
- @$(CC) $(MINGW_CFLAGS) -c -o $@ $<
-endif
-
-%.o: %.cc
-ifdef VERBOSE
- $(CXX) $(MINGW_CXXFLAGS) -c -o $@ $<
-else
- @echo $(CXX) -c $(CXXFLAGS) ... $(<F)
- @$(CXX) $(MINGW_CXXFLAGS) -c -o $@ $<
-endif
-
-D=$(wildcard *.d)
-ifneq ($D,)
-include $D
-endif
diff --git a/winsup/bz2lib/README b/winsup/bz2lib/README
deleted file mode 100644
index 22945a256..000000000
--- a/winsup/bz2lib/README
+++ /dev/null
@@ -1,166 +0,0 @@
-
-This is the README for bzip2, a block-sorting file compressor, version
-1.0. This version is fully compatible with the previous public
-releases, bzip2-0.1pl2, bzip2-0.9.0 and bzip2-0.9.5.
-
-bzip2-1.0 is distributed under a BSD-style license. For details,
-see the file LICENSE.
-
-Complete documentation is available in Postscript form (manual.ps) or
-html (manual_toc.html). A plain-text version of the manual page is
-available as bzip2.txt. A statement about Y2K issues is now included
-in the file Y2K_INFO.
-
-
-HOW TO BUILD -- UNIX
-
-Type `make'. This builds the library libbz2.a and then the
-programs bzip2 and bzip2recover. Six self-tests are run.
-If the self-tests complete ok, carry on to installation:
-
-To install in /usr/bin, /usr/lib, /usr/man and /usr/include, type
- make install
-To install somewhere else, eg, /xxx/yyy/{bin,lib,man,include}, type
- make install PREFIX=/xxx/yyy
-If you are (justifiably) paranoid and want to see what 'make install'
-is going to do, you can first do
- make -n install or
- make -n install PREFIX=/xxx/yyy respectively.
-The -n instructs make to show the commands it would execute, but
-not actually execute them.
-
-
-HOW TO BUILD -- UNIX, shared library libbz2.so.
-
-Do 'make -f Makefile-libbz2_so'. This Makefile seems to work for
-Linux-ELF (RedHat 5.2 on an x86 box), with gcc. I make no claims
-that it works for any other platform, though I suspect it probably
-will work for most platforms employing both ELF and gcc.
-
-bzip2-shared, a client of the shared library, is also build, but
-not self-tested. So I suggest you also build using the normal
-Makefile, since that conducts a self-test.
-
-Important note for people upgrading .so's from 0.9.0/0.9.5 to
-version 1.0. All the functions in the library have been renamed,
-from (eg) bzCompress to BZ2_bzCompress, to avoid namespace pollution.
-Unfortunately this means that the libbz2.so created by
-Makefile-libbz2_so will not work with any program which used an
-older version of the library. Sorry. I do encourage library
-clients to make the effort to upgrade to use version 1.0, since
-it is both faster and more robust than previous versions.
-
-
-HOW TO BUILD -- Windows 95, NT, DOS, Mac, etc.
-
-It's difficult for me to support compilation on all these platforms.
-My approach is to collect binaries for these platforms, and put them
-on the master web page (http://sourceware.cygnus.com/bzip2). Look
-there. However (FWIW), bzip2-1.0 is very standard ANSI C and should
-compile unmodified with MS Visual C. For Win32, there is one
-important caveat: in bzip2.c, you must set BZ_UNIX to 0 and
-BZ_LCCWIN32 to 1 before building. If you have difficulties building,
-you might want to read README.COMPILATION.PROBLEMS.
-
-
-VALIDATION
-
-Correct operation, in the sense that a compressed file can always be
-decompressed to reproduce the original, is obviously of paramount
-importance. To validate bzip2, I used a modified version of Mark
-Nelson's churn program. Churn is an automated test driver which
-recursively traverses a directory structure, using bzip2 to compress
-and then decompress each file it encounters, and checking that the
-decompressed data is the same as the original. There are more details
-in Section 4 of the user guide.
-
-
-
-Please read and be aware of the following:
-
-WARNING:
-
- This program (attempts to) compress data by performing several
- non-trivial transformations on it. Unless you are 100% familiar
- with *all* the algorithms contained herein, and with the
- consequences of modifying them, you should NOT meddle with the
- compression or decompression machinery. Incorrect changes can and
- very likely *will* lead to disastrous loss of data.
-
-
-DISCLAIMER:
-
- I TAKE NO RESPONSIBILITY FOR ANY LOSS OF DATA ARISING FROM THE
- USE OF THIS PROGRAM, HOWSOEVER CAUSED.
-
- Every compression of a file implies an assumption that the
- compressed file can be decompressed to reproduce the original.
- Great efforts in design, coding and testing have been made to
- ensure that this program works correctly. However, the complexity
- of the algorithms, and, in particular, the presence of various
- special cases in the code which occur with very low but non-zero
- probability make it impossible to rule out the possibility of bugs
- remaining in the program. DO NOT COMPRESS ANY DATA WITH THIS
- PROGRAM UNLESS YOU ARE PREPARED TO ACCEPT THE POSSIBILITY, HOWEVER
- SMALL, THAT THE DATA WILL NOT BE RECOVERABLE.
-
- That is not to say this program is inherently unreliable. Indeed,
- I very much hope the opposite is true. bzip2 has been carefully
- constructed and extensively tested.
-
-
-PATENTS:
-
- To the best of my knowledge, bzip2 does not use any patented
- algorithms. However, I do not have the resources available to
- carry out a full patent search. Therefore I cannot give any
- guarantee of the above statement.
-
-End of legalities.
-
-
-WHAT'S NEW IN 0.9.0 (as compared to 0.1pl2) ?
-
- * Approx 10% faster compression, 30% faster decompression
- * -t (test mode) is a lot quicker
- * Can decompress concatenated compressed files
- * Programming interface, so programs can directly read/write .bz2 files
- * Less restrictive (BSD-style) licensing
- * Flag handling more compatible with GNU gzip
- * Much more documentation, i.e., a proper user manual
- * Hopefully, improved portability (at least of the library)
-
-WHAT'S NEW IN 0.9.5 ?
-
- * Compression speed is much less sensitive to the input
- data than in previous versions. Specifically, the very
- slow performance caused by repetitive data is fixed.
- * Many small improvements in file and flag handling.
- * A Y2K statement.
-
-WHAT'S NEW IN 1.0
-
- See the CHANGES file.
-
-I hope you find bzip2 useful. Feel free to contact me at
- jseward@acm.org
-if you have any suggestions or queries. Many people mailed me with
-comments, suggestions and patches after the releases of bzip-0.15,
-bzip-0.21, bzip2-0.1pl2 and bzip2-0.9.0, and the changes in bzip2 are
-largely a result of this feedback. I thank you for your comments.
-
-At least for the time being, bzip2's "home" is (or can be reached via)
-http://www.muraroa.demon.co.uk.
-
-Julian Seward
-jseward@acm.org
-
-Cambridge, UK
-18 July 1996 (version 0.15)
-25 August 1996 (version 0.21)
- 7 August 1997 (bzip2, version 0.1)
-29 August 1997 (bzip2, version 0.1pl2)
-23 August 1998 (bzip2, version 0.9.0)
- 8 June 1999 (bzip2, version 0.9.5)
- 4 Sept 1999 (bzip2, version 0.9.5d)
- 5 May 2000 (bzip2, version 1.0pre8)
diff --git a/winsup/bz2lib/README.COMPILATION.PROBLEMS b/winsup/bz2lib/README.COMPILATION.PROBLEMS
deleted file mode 100644
index d621ad597..000000000
--- a/winsup/bz2lib/README.COMPILATION.PROBLEMS
+++ /dev/null
@@ -1,130 +0,0 @@
-
-bzip2-1.0 should compile without problems on the vast majority of
-platforms. Using the supplied Makefile, I've built and tested it
-myself for x86-linux, sparc-solaris, alpha-linux, x86-cygwin32 and
-alpha-tru64unix. With makefile.msc, Visual C++ 6.0 and nmake, you can
-build a native Win32 version too. Large file support seems to work
-correctly on at least alpha-tru64unix and x86-cygwin32 (on Windows
-2000).
-
-When I say "large file" I mean a file of size 2,147,483,648 (2^31)
-bytes or above. Many older OSs can't handle files above this size,
-but many newer ones can. Large files are pretty huge -- most files
-you'll encounter are not Large Files.
-
-Earlier versions of bzip2 (0.1, 0.9.0, 0.9.5) compiled on a wide
-variety of platforms without difficulty, and I hope this version will
-continue in that tradition. However, in order to support large files,
-I've had to include the define -D_FILE_OFFSET_BITS=64 in the Makefile.
-This can cause problems.
-
-The technique of adding -D_FILE_OFFSET_BITS=64 to get large file
-support is, as far as I know, the Recommended Way to get correct large
-file support. For more details, see the Large File Support
-Specification, published by the Large File Summit, at
- http://www.sas.com/standard/large.file/
-
-As a general comment, if you get compilation errors which you think
-are related to large file support, try removing the above define from
-the Makefile, ie, delete the line
- BIGFILES=-D_FILE_OFFSET_BITS=64
-from the Makefile, and do 'make clean ; make'. This will give you a
-version of bzip2 without large file support, which, for most
-applications, is probably not a problem.
-
-Alternatively, try some of the platform-specific hints listed below.
-
-You can use the spewG.c program to generate huge files to test bzip2's
-large file support, if you are feeling paranoid. Be aware though that
-any compilation problems which affect bzip2 will also affect spewG.c,
-alas.
-
-
-Known problems as of 1.0pre8:
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-* HP/UX 10.20 and 11.00, using gcc (2.7.2.3 and 2.95.2): A large
- number of warnings appear, including the following:
-
- /usr/include/sys/resource.h: In function `getrlimit':
- /usr/include/sys/resource.h:168:
- warning: implicit declaration of function `__getrlimit64'
- /usr/include/sys/resource.h: In function `setrlimit':
- /usr/include/sys/resource.h:170:
- warning: implicit declaration of function `__setrlimit64'
-
- This would appear to be a problem with large file support, header
- files and gcc. gcc may or may not give up at this point. If it
- fails, you might be able to improve matters by adding
- -D__STDC_EXT__=1
- to the BIGFILES variable in the Makefile (ie, change its definition
- to
- BIGFILES=-D_FILE_OFFSET_BITS=64 -D__STDC_EXT__=1
-
- Even if gcc does produce a binary which appears to work (ie passes
- its self-tests), you might want to test it to see if it works properly
- on large files.
-
-
-* HP/UX 10.20 and 11.00, using HP's cc compiler.
-
- No specific problems for this combination, except that you'll need to
- specify the -Ae flag, and zap the gcc-specific stuff
- -Wall -Winline -O2 -fomit-frame-pointer -fno-strength-reduce.
- You should retain -D_FILE_OFFSET_BITS=64 in order to get large
- file support -- which is reported to work ok for this HP/UX + cc
- combination.
-
-
-* SunOS 4.1.X.
-
- Amazingly, there are still people out there using this venerable old
- banger. I shouldn't be too rude -- I started life on SunOS, and
- it was a pretty darn good OS, way back then. Anyway:
-
- SunOS doesn't seem to have strerror(), so you'll have to use
- perror(), perhaps by doing adding this (warning: UNTESTED CODE):
-
- char* strerror ( int errnum )
- {
- if (errnum < 0 || errnum >= sys_nerr)
- return "Unknown error";
- else
- return sys_errlist[errnum];
- }
-
- Or you could comment out the relevant calls to strerror; they're
- not mission-critical. Or you could upgrade to Solaris. Ha ha ha!
- (what?? you think I've got Bad Attitude?)
-
-
-* Making a shared library on Solaris. (Not really a compilation
- problem, but many people ask ...)
-
- Firstly, if you have Solaris 8, either you have libbz2.so already
- on your system, or you can install it from the Solaris CD.
-
- Secondly, be aware that there are potential naming conflicts
- between the .so file supplied with Solaris 8, and the .so file
- which Makefile-libbz2_so will make. Makefile-libbz2_so creates
- a .so which has the names which I intend to be "official" as
- of version 1.0.0 and onwards. Unfortunately, the .so in
- Solaris 8 appeared before I decided on the final names, so
- the two libraries are incompatible. We have since communicated
- and I hope that the problems will have been solved in the next
- version of Solaris, whenever that might appear.
-
- All that said: you might be able to get somewhere
- by finding the line in Makefile-libbz2_so which says
-
- $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.1 $(OBJS)
-
- and replacing with
-
- ($CC) -G -shared -o libbz2.so.1.0.1 -h libbz2.so.1.0 $(OBJS)
-
- If gcc objects to the combination -fpic -fPIC, get rid of
- the second one, leaving just "-fpic".
-
-
-That's the end of the currently known compilation problems.
diff --git a/winsup/bz2lib/Y2K_INFO b/winsup/bz2lib/Y2K_INFO
deleted file mode 100644
index 55fd56a2e..000000000
--- a/winsup/bz2lib/Y2K_INFO
+++ /dev/null
@@ -1,34 +0,0 @@
-
-Y2K status of bzip2 and libbzip2, versions 0.1, 0.9.0 and 0.9.5
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Informally speaking:
- bzip2 is a compression program built on top of libbzip2,
- a library which does the real work of compression and
- decompression. As far as I am aware, libbzip2 does not have
- any date-related code at all.
-
- bzip2 itself copies dates from source to destination files
- when compressing or decompressing, using the 'stat' and 'utime'
- UNIX system calls. It doesn't examine, manipulate or store the
- dates in any way. So as far as I can see, there shouldn't be any
- problem with bzip2 providing 'stat' and 'utime' work correctly
- on your system.
-
- On non-unix platforms (those for which BZ_UNIX in bzip2.c is
- not set to 1), bzip2 doesn't even do the date copying.
-
- Overall, informally speaking, I don't think bzip2 or libbzip2
- have a Y2K problem.
-
-Formally speaking:
- I am not prepared to offer you any assurance whatsoever
- regarding Y2K issues in my software. You alone assume the
- entire risk of using the software. The disclaimer of liability
- in the LICENSE file in the bzip2 source distribution continues
- to apply on this issue as with every other issue pertaining
- to the software.
-
-Julian Seward
-Cambridge, UK
-25 August 1999
diff --git a/winsup/bz2lib/aclocal.m4 b/winsup/bz2lib/aclocal.m4
deleted file mode 100644
index f5379a5be..000000000
--- a/winsup/bz2lib/aclocal.m4
+++ /dev/null
@@ -1,137 +0,0 @@
-dnl aclocal.m4 generated automatically by aclocal 1.4
-
-dnl Copyright (C) 1994, 1995-8, 1999 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.
-
-# Do all the work for Automake. This macro actually does too much --
-# some checks are only needed if your package does certain things.
-# But this isn't really a big deal.
-
-# serial 1
-
-dnl Usage:
-dnl AM_INIT_AUTOMAKE(package,version, [no-define])
-
-AC_DEFUN(AM_INIT_AUTOMAKE,
-[AC_REQUIRE([AC_PROG_INSTALL])
-PACKAGE=[$1]
-AC_SUBST(PACKAGE)
-VERSION=[$2]
-AC_SUBST(VERSION)
-dnl test to see if srcdir already configured
-if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
- AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
-fi
-ifelse([$3],,
-AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
-AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
-AC_REQUIRE([AM_SANITY_CHECK])
-AC_REQUIRE([AC_ARG_PROGRAM])
-dnl FIXME This is truly gross.
-missing_dir=`cd $ac_aux_dir && pwd`
-AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
-AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
-AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
-AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
-AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
-AC_REQUIRE([AC_PROG_MAKE_SET])])
-
-#
-# Check to make sure that the build environment is sane.
-#
-
-AC_DEFUN(AM_SANITY_CHECK,
-[AC_MSG_CHECKING([whether build environment is sane])
-# Just in case
-sleep 1
-echo timestamp > conftestfile
-# Do `set' in a subshell so we don't clobber the current shell's
-# arguments. Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
- set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
- if test "[$]*" = "X"; then
- # -L didn't work.
- set X `ls -t $srcdir/configure conftestfile`
- fi
- if test "[$]*" != "X $srcdir/configure conftestfile" \
- && test "[$]*" != "X conftestfile $srcdir/configure"; then
-
- # If neither matched, then we have a broken ls. This can happen
- # if, for instance, CONFIG_SHELL is bash and it inherits a
- # broken ls alias from the environment. This has actually
- # happened. Such a system could not be considered "sane".
- AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
-alias in your environment])
- fi
-
- test "[$]2" = conftestfile
- )
-then
- # Ok.
- :
-else
- AC_MSG_ERROR([newly created file is older than distributed files!
-Check your system clock])
-fi
-rm -f conftest*
-AC_MSG_RESULT(yes)])
-
-dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
-dnl The program must properly implement --version.
-AC_DEFUN(AM_MISSING_PROG,
-[AC_MSG_CHECKING(for working $2)
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if ($2 --version) < /dev/null > /dev/null 2>&1; then
- $1=$2
- AC_MSG_RESULT(found)
-else
- $1="$3/missing $2"
- AC_MSG_RESULT(missing)
-fi
-AC_SUBST($1)])
-
-# Add --enable-maintainer-mode option to configure.
-# From Jim Meyering
-
-# serial 1
-
-AC_DEFUN(AM_MAINTAINER_MODE,
-[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
- dnl maintainer-mode is disabled by default
- AC_ARG_ENABLE(maintainer-mode,
-[ --enable-maintainer-mode enable make rules and dependencies not useful
- (and sometimes confusing) to the casual installer],
- USE_MAINTAINER_MODE=$enableval,
- USE_MAINTAINER_MODE=no)
- AC_MSG_RESULT($USE_MAINTAINER_MODE)
- AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
- MAINT=$MAINTAINER_MODE_TRUE
- AC_SUBST(MAINT)dnl
-]
-)
-
-# Define a conditional.
-
-AC_DEFUN(AM_CONDITIONAL,
-[AC_SUBST($1_TRUE)
-AC_SUBST($1_FALSE)
-if $2; then
- $1_TRUE=
- $1_FALSE='#'
-else
- $1_TRUE='#'
- $1_FALSE=
-fi])
-
diff --git a/winsup/bz2lib/blocksort.c b/winsup/bz2lib/blocksort.c
deleted file mode 100644
index ec426725b..000000000
--- a/winsup/bz2lib/blocksort.c
+++ /dev/null
@@ -1,1134 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Block sorting machinery ---*/
-/*--- blocksort.c ---*/
-/*-------------------------------------------------------------*/
-
-/*--
- This file is a part of bzip2 and/or libbzip2, a program and
- library for lossless, block-sorting data compression.
-
- Copyright (C) 1996-2000 Julian R Seward. 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. The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 3. Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-
- 4. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
-
- Julian Seward, Cambridge, UK.
- jseward@acm.org
- bzip2/libbzip2 version 1.0 of 21 March 2000
-
- This program is based on (at least) the work of:
- Mike Burrows
- David Wheeler
- Peter Fenwick
- Alistair Moffat
- Radford Neal
- Ian H. Witten
- Robert Sedgewick
- Jon L. Bentley
-
- For more information on these sources, see the manual.
-
- To get some idea how the block sorting algorithms in this file
- work, read my paper
- On the Performance of BWT Sorting Algorithms
- in Proceedings of the IEEE Data Compression Conference 2000,
- Snowbird, Utah, USA, 27-30 March 2000. The main sort in this
- file implements the algorithm called cache in the paper.
---*/
-
-
-#include "bzlib_private.h"
-
-/*---------------------------------------------*/
-/*--- Fallback O(N log(N)^2) sorting ---*/
-/*--- algorithm, for repetitive blocks ---*/
-/*---------------------------------------------*/
-
-/*---------------------------------------------*/
-static
-__inline__
-void fallbackSimpleSort ( UInt32* fmap,
- UInt32* eclass,
- Int32 lo,
- Int32 hi )
-{
- Int32 i, j, tmp;
- UInt32 ec_tmp;
-
- if (lo == hi) return;
-
- if (hi - lo > 3) {
- for ( i = hi-4; i >= lo; i-- ) {
- tmp = fmap[i];
- ec_tmp = eclass[tmp];
- for ( j = i+4; j <= hi && ec_tmp > eclass[fmap[j]]; j += 4 )
- fmap[j-4] = fmap[j];
- fmap[j-4] = tmp;
- }
- }
-
- for ( i = hi-1; i >= lo; i-- ) {
- tmp = fmap[i];
- ec_tmp = eclass[tmp];
- for ( j = i+1; j <= hi && ec_tmp > eclass[fmap[j]]; j++ )
- fmap[j-1] = fmap[j];
- fmap[j-1] = tmp;
- }
-}
-
-
-/*---------------------------------------------*/
-#define fswap(zz1, zz2) \
- { Int32 zztmp = zz1; zz1 = zz2; zz2 = zztmp; }
-
-#define fvswap(zzp1, zzp2, zzn) \
-{ \
- Int32 yyp1 = (zzp1); \
- Int32 yyp2 = (zzp2); \
- Int32 yyn = (zzn); \
- while (yyn > 0) { \
- fswap(fmap[yyp1], fmap[yyp2]); \
- yyp1++; yyp2++; yyn--; \
- } \
-}
-
-
-#define fmin(a,b) ((a) < (b)) ? (a) : (b)
-
-#define fpush(lz,hz) { stackLo[sp] = lz; \
- stackHi[sp] = hz; \
- sp++; }
-
-#define fpop(lz,hz) { sp--; \
- lz = stackLo[sp]; \
- hz = stackHi[sp]; }
-
-#define FALLBACK_QSORT_SMALL_THRESH 10
-#define FALLBACK_QSORT_STACK_SIZE 100
-
-
-static
-void fallbackQSort3 ( UInt32* fmap,
- UInt32* eclass,
- Int32 loSt,
- Int32 hiSt )
-{
- Int32 unLo, unHi, ltLo, gtHi, n, m;
- Int32 sp, lo, hi;
- UInt32 med, r, r3;
- Int32 stackLo[FALLBACK_QSORT_STACK_SIZE];
- Int32 stackHi[FALLBACK_QSORT_STACK_SIZE];
-
- r = 0;
-
- sp = 0;
- fpush ( loSt, hiSt );
-
- while (sp > 0) {
-
- AssertH ( sp < FALLBACK_QSORT_STACK_SIZE, 1004 );
-
- fpop ( lo, hi );
- if (hi - lo < FALLBACK_QSORT_SMALL_THRESH) {
- fallbackSimpleSort ( fmap, eclass, lo, hi );
- continue;
- }
-
- /* Random partitioning. Median of 3 sometimes fails to
- avoid bad cases. Median of 9 seems to help but
- looks rather expensive. This too seems to work but
- is cheaper. Guidance for the magic constants
- 7621 and 32768 is taken from Sedgewick's algorithms
- book, chapter 35.
- */
- r = ((r * 7621) + 1) % 32768;
- r3 = r % 3;
- if (r3 == 0) med = eclass[fmap[lo]]; else
- if (r3 == 1) med = eclass[fmap[(lo+hi)>>1]]; else
- med = eclass[fmap[hi]];
-
- unLo = ltLo = lo;
- unHi = gtHi = hi;
-
- while (1) {
- while (1) {
- if (unLo > unHi) break;
- n = (Int32)eclass[fmap[unLo]] - (Int32)med;
- if (n == 0) {
- fswap(fmap[unLo], fmap[ltLo]);
- ltLo++; unLo++;
- continue;
- };
- if (n > 0) break;
- unLo++;
- }
- while (1) {
- if (unLo > unHi) break;
- n = (Int32)eclass[fmap[unHi]] - (Int32)med;
- if (n == 0) {
- fswap(fmap[unHi], fmap[gtHi]);
- gtHi--; unHi--;
- continue;
- };
- if (n < 0) break;
- unHi--;
- }
- if (unLo > unHi) break;
- fswap(fmap[unLo], fmap[unHi]); unLo++; unHi--;
- }
-
- AssertD ( unHi == unLo-1, "fallbackQSort3(2)" );
-
- if (gtHi < ltLo) continue;
-
- n = fmin(ltLo-lo, unLo-ltLo); fvswap(lo, unLo-n, n);
- m = fmin(hi-gtHi, gtHi-unHi); fvswap(unLo, hi-m+1, m);
-
- n = lo + unLo - ltLo - 1;
- m = hi - (gtHi - unHi) + 1;
-
- if (n - lo > hi - m) {
- fpush ( lo, n );
- fpush ( m, hi );
- } else {
- fpush ( m, hi );
- fpush ( lo, n );
- }
- }
-}
-
-#undef fmin
-#undef fpush
-#undef fpop
-#undef fswap
-#undef fvswap
-#undef FALLBACK_QSORT_SMALL_THRESH
-#undef FALLBACK_QSORT_STACK_SIZE
-
-
-/*---------------------------------------------*/
-/* Pre:
- nblock > 0
- eclass exists for [0 .. nblock-1]
- ((UChar*)eclass) [0 .. nblock-1] holds block
- ptr exists for [0 .. nblock-1]
-
- Post:
- ((UChar*)eclass) [0 .. nblock-1] holds block
- All other areas of eclass destroyed
- fmap [0 .. nblock-1] holds sorted order
- bhtab [ 0 .. 2+(nblock/32) ] destroyed
-*/
-
-#define SET_BH(zz) bhtab[(zz) >> 5] |= (1 << ((zz) & 31))
-#define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~(1 << ((zz) & 31))
-#define ISSET_BH(zz) (bhtab[(zz) >> 5] & (1 << ((zz) & 31)))
-#define WORD_BH(zz) bhtab[(zz) >> 5]
-#define UNALIGNED_BH(zz) ((zz) & 0x01f)
-
-static
-void fallbackSort ( UInt32* fmap,
- UInt32* eclass,
- UInt32* bhtab,
- Int32 nblock,
- Int32 verb )
-{
- Int32 ftab[257];
- Int32 ftabCopy[256];
- Int32 H, i, j, k, l, r, cc, cc1;
- Int32 nNotDone;
- Int32 nBhtab;
- UChar* eclass8 = (UChar*)eclass;
-
- /*--
- Initial 1-char radix sort to generate
- initial fmap and initial BH bits.
- --*/
- if (verb >= 4)
- VPrintf0 ( " bucket sorting ...\n" );
- for (i = 0; i < 257; i++) ftab[i] = 0;
- for (i = 0; i < nblock; i++) ftab[eclass8[i]]++;
- for (i = 0; i < 256; i++) ftabCopy[i] = ftab[i];
- for (i = 1; i < 257; i++) ftab[i] += ftab[i-1];
-
- for (i = 0; i < nblock; i++) {
- j = eclass8[i];
- k = ftab[j] - 1;
- ftab[j] = k;
- fmap[k] = i;
- }
-
- nBhtab = 2 + (nblock / 32);
- for (i = 0; i < nBhtab; i++) bhtab[i] = 0;
- for (i = 0; i < 256; i++) SET_BH(ftab[i]);
-
- /*--
- Inductively refine the buckets. Kind-of an
- "exponential radix sort" (!), inspired by the
- Manber-Myers suffix array construction algorithm.
- --*/
-
- /*-- set sentinel bits for block-end detection --*/
- for (i = 0; i < 32; i++) {
- SET_BH(nblock + 2*i);
- CLEAR_BH(nblock + 2*i + 1);
- }
-
- /*-- the log(N) loop --*/
- H = 1;
- while (1) {
-
- if (verb >= 4)
- VPrintf1 ( " depth %6d has ", H );
-
- j = 0;
- for (i = 0; i < nblock; i++) {
- if (ISSET_BH(i)) j = i;
- k = fmap[i] - H; if (k < 0) k += nblock;
- eclass[k] = j;
- }
-
- nNotDone = 0;
- r = -1;
- while (1) {
-
- /*-- find the next non-singleton bucket --*/
- k = r + 1;
- while (ISSET_BH(k) && UNALIGNED_BH(k)) k++;
- if (ISSET_BH(k)) {
- while (WORD_BH(k) == 0xffffffff) k += 32;
- while (ISSET_BH(k)) k++;
- }
- l = k - 1;
- if (l >= nblock) break;
- while (!ISSET_BH(k) && UNALIGNED_BH(k)) k++;
- if (!ISSET_BH(k)) {
- while (WORD_BH(k) == 0x00000000) k += 32;
- while (!ISSET_BH(k)) k++;
- }
- r = k - 1;
- if (r >= nblock) break;
-
- /*-- now [l, r] bracket current bucket --*/
- if (r > l) {
- nNotDone += (r - l + 1);
- fallbackQSort3 ( fmap, eclass, l, r );
-
- /*-- scan bucket and generate header bits-- */
- cc = -1;
- for (i = l; i <= r; i++) {
- cc1 = eclass[fmap[i]];
- if (cc != cc1) { SET_BH(i); cc = cc1; };
- }
- }
- }
-
- if (verb >= 4)
- VPrintf1 ( "%6d unresolved strings\n", nNotDone );
-
- H *= 2;
- if (H > nblock || nNotDone == 0) break;
- }
-
- /*--
- Reconstruct the original block in
- eclass8 [0 .. nblock-1], since the
- previous phase destroyed it.
- --*/
- if (verb >= 4)
- VPrintf0 ( " reconstructing block ...\n" );
- j = 0;
- for (i = 0; i < nblock; i++) {
- while (ftabCopy[j] == 0) j++;
- ftabCopy[j]--;
- eclass8[fmap[i]] = (UChar)j;
- }
- AssertH ( j < 256, 1005 );
-}
-
-#undef SET_BH
-#undef CLEAR_BH
-#undef ISSET_BH
-#undef WORD_BH
-#undef UNALIGNED_BH
-
-
-/*---------------------------------------------*/
-/*--- The main, O(N^2 log(N)) sorting ---*/
-/*--- algorithm. Faster for "normal" ---*/
-/*--- non-repetitive blocks. ---*/
-/*---------------------------------------------*/
-
-/*---------------------------------------------*/
-static
-__inline__
-Bool mainGtU ( UInt32 i1,
- UInt32 i2,
- UChar* block,
- UInt16* quadrant,
- UInt32 nblock,
- Int32* budget )
-{
- Int32 k;
- UChar c1, c2;
- UInt16 s1, s2;
-
- AssertD ( i1 != i2, "mainGtU" );
- /* 1 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
- /* 2 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
- /* 3 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
- /* 4 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
- /* 5 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
- /* 6 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
- /* 7 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
- /* 8 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
- /* 9 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
- /* 10 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
- /* 11 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
- /* 12 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
-
- k = nblock + 8;
-
- do {
- /* 1 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- s1 = quadrant[i1]; s2 = quadrant[i2];
- if (s1 != s2) return (s1 > s2);
- i1++; i2++;
- /* 2 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- s1 = quadrant[i1]; s2 = quadrant[i2];
- if (s1 != s2) return (s1 > s2);
- i1++; i2++;
- /* 3 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- s1 = quadrant[i1]; s2 = quadrant[i2];
- if (s1 != s2) return (s1 > s2);
- i1++; i2++;
- /* 4 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- s1 = quadrant[i1]; s2 = quadrant[i2];
- if (s1 != s2) return (s1 > s2);
- i1++; i2++;
- /* 5 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- s1 = quadrant[i1]; s2 = quadrant[i2];
- if (s1 != s2) return (s1 > s2);
- i1++; i2++;
- /* 6 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- s1 = quadrant[i1]; s2 = quadrant[i2];
- if (s1 != s2) return (s1 > s2);
- i1++; i2++;
- /* 7 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- s1 = quadrant[i1]; s2 = quadrant[i2];
- if (s1 != s2) return (s1 > s2);
- i1++; i2++;
- /* 8 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- s1 = quadrant[i1]; s2 = quadrant[i2];
- if (s1 != s2) return (s1 > s2);
- i1++; i2++;
-
- if (i1 >= nblock) i1 -= nblock;
- if (i2 >= nblock) i2 -= nblock;
-
- k -= 8;
- (*budget)--;
- }
- while (k >= 0);
-
- return False;
-}
-
-
-/*---------------------------------------------*/
-/*--
- Knuth's increments seem to work better
- than Incerpi-Sedgewick here. Possibly
- because the number of elems to sort is
- usually small, typically <= 20.
---*/
-static
-Int32 incs[14] = { 1, 4, 13, 40, 121, 364, 1093, 3280,
- 9841, 29524, 88573, 265720,
- 797161, 2391484 };
-
-static
-void mainSimpleSort ( UInt32* ptr,
- UChar* block,
- UInt16* quadrant,
- Int32 nblock,
- Int32 lo,
- Int32 hi,
- Int32 d,
- Int32* budget )
-{
- Int32 i, j, h, bigN, hp;
- UInt32 v;
-
- bigN = hi - lo + 1;
- if (bigN < 2) return;
-
- hp = 0;
- while (incs[hp] < bigN) hp++;
- hp--;
-
- for (; hp >= 0; hp--) {
- h = incs[hp];
-
- i = lo + h;
- while (True) {
-
- /*-- copy 1 --*/
- if (i > hi) break;
- v = ptr[i];
- j = i;
- while ( mainGtU (
- ptr[j-h]+d, v+d, block, quadrant, nblock, budget
- ) ) {
- ptr[j] = ptr[j-h];
- j = j - h;
- if (j <= (lo + h - 1)) break;
- }
- ptr[j] = v;
- i++;
-
- /*-- copy 2 --*/
- if (i > hi) break;
- v = ptr[i];
- j = i;
- while ( mainGtU (
- ptr[j-h]+d, v+d, block, quadrant, nblock, budget
- ) ) {
- ptr[j] = ptr[j-h];
- j = j - h;
- if (j <= (lo + h - 1)) break;
- }
- ptr[j] = v;
- i++;
-
- /*-- copy 3 --*/
- if (i > hi) break;
- v = ptr[i];
- j = i;
- while ( mainGtU (
- ptr[j-h]+d, v+d, block, quadrant, nblock, budget
- ) ) {
- ptr[j] = ptr[j-h];
- j = j - h;
- if (j <= (lo + h - 1)) break;
- }
- ptr[j] = v;
- i++;
-
- if (*budget < 0) return;
- }
- }
-}
-
-
-/*---------------------------------------------*/
-/*--
- The following is an implementation of
- an elegant 3-way quicksort for strings,
- described in a paper "Fast Algorithms for
- Sorting and Searching Strings", by Robert
- Sedgewick and Jon L. Bentley.
---*/
-
-#define mswap(zz1, zz2) \
- { Int32 zztmp = zz1; zz1 = zz2; zz2 = zztmp; }
-
-#define mvswap(zzp1, zzp2, zzn) \
-{ \
- Int32 yyp1 = (zzp1); \
- Int32 yyp2 = (zzp2); \
- Int32 yyn = (zzn); \
- while (yyn > 0) { \
- mswap(ptr[yyp1], ptr[yyp2]); \
- yyp1++; yyp2++; yyn--; \
- } \
-}
-
-static
-__inline__
-UChar mmed3 ( UChar a, UChar b, UChar c )
-{
- UChar t;
- if (a > b) { t = a; a = b; b = t; };
- if (b > c) {
- b = c;
- if (a > b) b = a;
- }
- return b;
-}
-
-#define mmin(a,b) ((a) < (b)) ? (a) : (b)
-
-#define mpush(lz,hz,dz) { stackLo[sp] = lz; \
- stackHi[sp] = hz; \
- stackD [sp] = dz; \
- sp++; }
-
-#define mpop(lz,hz,dz) { sp--; \
- lz = stackLo[sp]; \
- hz = stackHi[sp]; \
- dz = stackD [sp]; }
-
-
-#define mnextsize(az) (nextHi[az]-nextLo[az])
-
-#define mnextswap(az,bz) \
- { Int32 tz; \
- tz = nextLo[az]; nextLo[az] = nextLo[bz]; nextLo[bz] = tz; \
- tz = nextHi[az]; nextHi[az] = nextHi[bz]; nextHi[bz] = tz; \
- tz = nextD [az]; nextD [az] = nextD [bz]; nextD [bz] = tz; }
-
-
-#define MAIN_QSORT_SMALL_THRESH 20
-#define MAIN_QSORT_DEPTH_THRESH (BZ_N_RADIX + BZ_N_QSORT)
-#define MAIN_QSORT_STACK_SIZE 100
-
-static
-void mainQSort3 ( UInt32* ptr,
- UChar* block,
- UInt16* quadrant,
- Int32 nblock,
- Int32 loSt,
- Int32 hiSt,
- Int32 dSt,
- Int32* budget )
-{
- Int32 unLo, unHi, ltLo, gtHi, n, m, med;
- Int32 sp, lo, hi, d;
-
- Int32 stackLo[MAIN_QSORT_STACK_SIZE];
- Int32 stackHi[MAIN_QSORT_STACK_SIZE];
- Int32 stackD [MAIN_QSORT_STACK_SIZE];
-
- Int32 nextLo[3];
- Int32 nextHi[3];
- Int32 nextD [3];
-
- sp = 0;
- mpush ( loSt, hiSt, dSt );
-
- while (sp > 0) {
-
- AssertH ( sp < MAIN_QSORT_STACK_SIZE, 1001 );
-
- mpop ( lo, hi, d );
- if (hi - lo < MAIN_QSORT_SMALL_THRESH ||
- d > MAIN_QSORT_DEPTH_THRESH) {
- mainSimpleSort ( ptr, block, quadrant, nblock, lo, hi, d, budget );
- if (*budget < 0) return;
- continue;
- }
-
- med = (Int32)
- mmed3 ( block[ptr[ lo ]+d],
- block[ptr[ hi ]+d],
- block[ptr[ (lo+hi)>>1 ]+d] );
-
- unLo = ltLo = lo;
- unHi = gtHi = hi;
-
- while (True) {
- while (True) {
- if (unLo > unHi) break;
- n = ((Int32)block[ptr[unLo]+d]) - med;
- if (n == 0) {
- mswap(ptr[unLo], ptr[ltLo]);
- ltLo++; unLo++; continue;
- };
- if (n > 0) break;
- unLo++;
- }
- while (True) {
- if (unLo > unHi) break;
- n = ((Int32)block[ptr[unHi]+d]) - med;
- if (n == 0) {
- mswap(ptr[unHi], ptr[gtHi]);
- gtHi--; unHi--; continue;
- };
- if (n < 0) break;
- unHi--;
- }
- if (unLo > unHi) break;
- mswap(ptr[unLo], ptr[unHi]); unLo++; unHi--;
- }
-
- AssertD ( unHi == unLo-1, "mainQSort3(2)" );
-
- if (gtHi < ltLo) {
- mpush(lo, hi, d+1 );
- continue;
- }
-
- n = mmin(ltLo-lo, unLo-ltLo); mvswap(lo, unLo-n, n);
- m = mmin(hi-gtHi, gtHi-unHi); mvswap(unLo, hi-m+1, m);
-
- n = lo + unLo - ltLo - 1;
- m = hi - (gtHi - unHi) + 1;
-
- nextLo[0] = lo; nextHi[0] = n; nextD[0] = d;
- nextLo[1] = m; nextHi[1] = hi; nextD[1] = d;
- nextLo[2] = n+1; nextHi[2] = m-1; nextD[2] = d+1;
-
- if (mnextsize(0) < mnextsize(1)) mnextswap(0,1);
- if (mnextsize(1) < mnextsize(2)) mnextswap(1,2);
- if (mnextsize(0) < mnextsize(1)) mnextswap(0,1);
-
- AssertD (mnextsize(0) >= mnextsize(1), "mainQSort3(8)" );
- AssertD (mnextsize(1) >= mnextsize(2), "mainQSort3(9)" );
-
- mpush (nextLo[0], nextHi[0], nextD[0]);
- mpush (nextLo[1], nextHi[1], nextD[1]);
- mpush (nextLo[2], nextHi[2], nextD[2]);
- }
-}
-
-#undef mswap
-#undef mvswap
-#undef mpush
-#undef mpop
-#undef mmin
-#undef mnextsize
-#undef mnextswap
-#undef MAIN_QSORT_SMALL_THRESH
-#undef MAIN_QSORT_DEPTH_THRESH
-#undef MAIN_QSORT_STACK_SIZE
-
-
-/*---------------------------------------------*/
-/* Pre:
- nblock > N_OVERSHOOT
- block32 exists for [0 .. nblock-1 +N_OVERSHOOT]
- ((UChar*)block32) [0 .. nblock-1] holds block
- ptr exists for [0 .. nblock-1]
-
- Post:
- ((UChar*)block32) [0 .. nblock-1] holds block
- All other areas of block32 destroyed
- ftab [0 .. 65536 ] destroyed
- ptr [0 .. nblock-1] holds sorted order
- if (*budget < 0), sorting was abandoned
-*/
-
-#define BIGFREQ(b) (ftab[((b)+1) << 8] - ftab[(b) << 8])
-#define SETMASK (1 << 21)
-#define CLEARMASK (~(SETMASK))
-
-static
-void mainSort ( UInt32* ptr,
- UChar* block,
- UInt16* quadrant,
- UInt32* ftab,
- Int32 nblock,
- Int32 verb,
- Int32* budget )
-{
- Int32 i, j, k, ss, sb;
- Int32 runningOrder[256];
- Bool bigDone[256];
- Int32 copyStart[256];
- Int32 copyEnd [256];
- UChar c1;
- Int32 numQSorted;
- UInt16 s;
- if (verb >= 4) VPrintf0 ( " main sort initialise ...\n" );
-
- /*-- set up the 2-byte frequency table --*/
- for (i = 65536; i >= 0; i--) ftab[i] = 0;
-
- j = block[0] << 8;
- i = nblock-1;
- for (; i >= 3; i -= 4) {
- quadrant[i] = 0;
- j = (j >> 8) | ( ((UInt16)block[i]) << 8);
- ftab[j]++;
- quadrant[i-1] = 0;
- j = (j >> 8) | ( ((UInt16)block[i-1]) << 8);
- ftab[j]++;
- quadrant[i-2] = 0;
- j = (j >> 8) | ( ((UInt16)block[i-2]) << 8);
- ftab[j]++;
- quadrant[i-3] = 0;
- j = (j >> 8) | ( ((UInt16)block[i-3]) << 8);
- ftab[j]++;
- }
- for (; i >= 0; i--) {
- quadrant[i] = 0;
- j = (j >> 8) | ( ((UInt16)block[i]) << 8);
- ftab[j]++;
- }
-
- /*-- (emphasises close relationship of block & quadrant) --*/
- for (i = 0; i < BZ_N_OVERSHOOT; i++) {
- block [nblock+i] = block[i];
- quadrant[nblock+i] = 0;
- }
-
- if (verb >= 4) VPrintf0 ( " bucket sorting ...\n" );
-
- /*-- Complete the initial radix sort --*/
- for (i = 1; i <= 65536; i++) ftab[i] += ftab[i-1];
-
- s = block[0] << 8;
- i = nblock-1;
- for (; i >= 3; i -= 4) {
- s = (s >> 8) | (block[i] << 8);
- j = ftab[s] -1;
- ftab[s] = j;
- ptr[j] = i;
- s = (s >> 8) | (block[i-1] << 8);
- j = ftab[s] -1;
- ftab[s] = j;
- ptr[j] = i-1;
- s = (s >> 8) | (block[i-2] << 8);
- j = ftab[s] -1;
- ftab[s] = j;
- ptr[j] = i-2;
- s = (s >> 8) | (block[i-3] << 8);
- j = ftab[s] -1;
- ftab[s] = j;
- ptr[j] = i-3;
- }
- for (; i >= 0; i--) {
- s = (s >> 8) | (block[i] << 8);
- j = ftab[s] -1;
- ftab[s] = j;
- ptr[j] = i;
- }
-
- /*--
- Now ftab contains the first loc of every small bucket.
- Calculate the running order, from smallest to largest
- big bucket.
- --*/
- for (i = 0; i <= 255; i++) {
- bigDone [i] = False;
- runningOrder[i] = i;
- }
-
- {
- Int32 vv;
- Int32 h = 1;
- do h = 3 * h + 1; while (h <= 256);
- do {
- h = h / 3;
- for (i = h; i <= 255; i++) {
- vv = runningOrder[i];
- j = i;
- while ( BIGFREQ(runningOrder[j-h]) > BIGFREQ(vv) ) {
- runningOrder[j] = runningOrder[j-h];
- j = j - h;
- if (j <= (h - 1)) goto zero;
- }
- zero:
- runningOrder[j] = vv;
- }
- } while (h != 1);
- }
-
- /*--
- The main sorting loop.
- --*/
-
- numQSorted = 0;
-
- for (i = 0; i <= 255; i++) {
-
- /*--
- Process big buckets, starting with the least full.
- Basically this is a 3-step process in which we call
- mainQSort3 to sort the small buckets [ss, j], but
- also make a big effort to avoid the calls if we can.
- --*/
- ss = runningOrder[i];
-
- /*--
- Step 1:
- Complete the big bucket [ss] by quicksorting
- any unsorted small buckets [ss, j], for j != ss.
- Hopefully previous pointer-scanning phases have already
- completed many of the small buckets [ss, j], so
- we don't have to sort them at all.
- --*/
- for (j = 0; j <= 255; j++) {
- if (j != ss) {
- sb = (ss << 8) + j;
- if ( ! (ftab[sb] & SETMASK) ) {
- Int32 lo = ftab[sb] & CLEARMASK;
- Int32 hi = (ftab[sb+1] & CLEARMASK) - 1;
- if (hi > lo) {
- if (verb >= 4)
- VPrintf4 ( " qsort [0x%x, 0x%x] "
- "done %d this %d\n",
- ss, j, numQSorted, hi - lo + 1 );
- mainQSort3 (
- ptr, block, quadrant, nblock,
- lo, hi, BZ_N_RADIX, budget
- );
- numQSorted += (hi - lo + 1);
- if (*budget < 0) return;
- }
- }
- ftab[sb] |= SETMASK;
- }
- }
-
- AssertH ( !bigDone[ss], 1006 );
-
- /*--
- Step 2:
- Now scan this big bucket [ss] so as to synthesise the
- sorted order for small buckets [t, ss] for all t,
- including, magically, the bucket [ss,ss] too.
- This will avoid doing Real Work in subsequent Step 1's.
- --*/
- {
- for (j = 0; j <= 255; j++) {
- copyStart[j] = ftab[(j << 8) + ss] & CLEARMASK;
- copyEnd [j] = (ftab[(j << 8) + ss + 1] & CLEARMASK) - 1;
- }
- for (j = ftab[ss << 8] & CLEARMASK; j < copyStart[ss]; j++) {
- k = ptr[j]-1; if (k < 0) k += nblock;
- c1 = block[k];
- if (!bigDone[c1])
- ptr[ copyStart[c1]++ ] = k;
- }
- for (j = (ftab[(ss+1) << 8] & CLEARMASK) - 1; j > copyEnd[ss]; j--) {
- k = ptr[j]-1; if (k < 0) k += nblock;
- c1 = block[k];
- if (!bigDone[c1])
- ptr[ copyEnd[c1]-- ] = k;
- }
- }
-
- AssertH ( copyStart[ss]-1 == copyEnd[ss], 1007 );
-
- for (j = 0; j <= 255; j++) ftab[(j << 8) + ss] |= SETMASK;
-
- /*--
- Step 3:
- The [ss] big bucket is now done. Record this fact,
- and update the quadrant descriptors. Remember to
- update quadrants in the overshoot area too, if
- necessary. The "if (i < 255)" test merely skips
- this updating for the last bucket processed, since
- updating for the last bucket is pointless.
-
- The quadrant array provides a way to incrementally
- cache sort orderings, as they appear, so as to
- make subsequent comparisons in fullGtU() complete
- faster. For repetitive blocks this makes a big
- difference (but not big enough to be able to avoid
- the fallback sorting mechanism, exponential radix sort).
-
- The precise meaning is: at all times:
-
- for 0 <= i < nblock and 0 <= j <= nblock
-
- if block[i] != block[j],
-
- then the relative values of quadrant[i] and
- quadrant[j] are meaningless.
-
- else {
- if quadrant[i] < quadrant[j]
- then the string starting at i lexicographically
- precedes the string starting at j
-
- else if quadrant[i] > quadrant[j]
- then the string starting at j lexicographically
- precedes the string starting at i
-
- else
- the relative ordering of the strings starting
- at i and j has not yet been determined.
- }
- --*/
- bigDone[ss] = True;
-
- if (i < 255) {
- Int32 bbStart = ftab[ss << 8] & CLEARMASK;
- Int32 bbSize = (ftab[(ss+1) << 8] & CLEARMASK) - bbStart;
- Int32 shifts = 0;
-
- while ((bbSize >> shifts) > 65534) shifts++;
-
- for (j = bbSize-1; j >= 0; j--) {
- Int32 a2update = ptr[bbStart + j];
- UInt16 qVal = (UInt16)(j >> shifts);
- quadrant[a2update] = qVal;
- if (a2update < BZ_N_OVERSHOOT)
- quadrant[a2update + nblock] = qVal;
- }
- AssertH ( ((bbSize-1) >> shifts) <= 65535, 1002 );
- }
-
- }
-
- if (verb >= 4)
- VPrintf3 ( " %d pointers, %d sorted, %d scanned\n",
- nblock, numQSorted, nblock - numQSorted );
-}
-
-#undef BIGFREQ
-#undef SETMASK
-#undef CLEARMASK
-
-
-/*---------------------------------------------*/
-/* Pre:
- nblock > 0
- arr2 exists for [0 .. nblock-1 +N_OVERSHOOT]
- ((UChar*)arr2) [0 .. nblock-1] holds block
- arr1 exists for [0 .. nblock-1]
-
- Post:
- ((UChar*)arr2) [0 .. nblock-1] holds block
- All other areas of block destroyed
- ftab [ 0 .. 65536 ] destroyed
- arr1 [0 .. nblock-1] holds sorted order
-*/
-void BZ2_blockSort ( EState* s )
-{
- UInt32* ptr = s->ptr;
- UChar* block = s->block;
- UInt32* ftab = s->ftab;
- Int32 nblock = s->nblock;
- Int32 verb = s->verbosity;
- Int32 wfact = s->workFactor;
- UInt16* quadrant;
- Int32 budget;
- Int32 budgetInit;
- Int32 i;
-
- if (nblock < 10000) {
- fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb );
- } else {
- /* Calculate the location for quadrant, remembering to get
- the alignment right. Assumes that &(block[0]) is at least
- 2-byte aligned -- this should be ok since block is really
- the first section of arr2.
- */
- i = nblock+BZ_N_OVERSHOOT;
- if (i & 1) i++;
- quadrant = (UInt16*)(&(block[i]));
-
- /* (wfact-1) / 3 puts the default-factor-30
- transition point at very roughly the same place as
- with v0.1 and v0.9.0.
- Not that it particularly matters any more, since the
- resulting compressed stream is now the same regardless
- of whether or not we use the main sort or fallback sort.
- */
- if (wfact < 1 ) wfact = 1;
- if (wfact > 100) wfact = 100;
- budgetInit = nblock * ((wfact-1) / 3);
- budget = budgetInit;
-
- mainSort ( ptr, block, quadrant, ftab, nblock, verb, &budget );
- if (verb >= 3)
- VPrintf3 ( " %d work, %d block, ratio %5.2f\n",
- budgetInit - budget,
- nblock,
- (float)(budgetInit - budget) /
- (float)(nblock==0 ? 1 : nblock) );
- if (budget < 0) {
- if (verb >= 2)
- VPrintf0 ( " too repetitive; using fallback"
- " sorting algorithm\n" );
- fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb );
- }
- }
-
- s->origPtr = -1;
- for (i = 0; i < s->nblock; i++)
- if (ptr[i] == 0)
- { s->origPtr = i; break; };
-
- AssertH( s->origPtr != -1, 1003 );
-}
-
-
-/*-------------------------------------------------------------*/
-/*--- end blocksort.c ---*/
-/*-------------------------------------------------------------*/
diff --git a/winsup/bz2lib/bzip2.1 b/winsup/bz2lib/bzip2.1
deleted file mode 100644
index 7de54a011..000000000
--- a/winsup/bz2lib/bzip2.1
+++ /dev/null
@@ -1,439 +0,0 @@
-.PU
-.TH bzip2 1
-.SH NAME
-bzip2, bunzip2 \- a block-sorting file compressor, v1.0
-.br
-bzcat \- decompresses files to stdout
-.br
-bzip2recover \- recovers data from damaged bzip2 files
-
-.SH SYNOPSIS
-.ll +8
-.B bzip2
-.RB [ " \-cdfkqstvzVL123456789 " ]
-[
-.I "filenames \&..."
-]
-.ll -8
-.br
-.B bunzip2
-.RB [ " \-fkvsVL " ]
-[
-.I "filenames \&..."
-]
-.br
-.B bzcat
-.RB [ " \-s " ]
-[
-.I "filenames \&..."
-]
-.br
-.B bzip2recover
-.I "filename"
-
-.SH DESCRIPTION
-.I bzip2
-compresses files using the Burrows-Wheeler block sorting
-text compression algorithm, and Huffman coding. Compression is
-generally considerably better than that achieved by more conventional
-LZ77/LZ78-based compressors, and approaches the performance of the PPM
-family of statistical compressors.
-
-The command-line options are deliberately very similar to
-those of
-.I GNU gzip,
-but they are not identical.
-
-.I bzip2
-expects a list of file names to accompany the
-command-line flags. Each file is replaced by a compressed version of
-itself, with the name "original_name.bz2".
-Each compressed file
-has the same modification date, permissions, and, when possible,
-ownership as the corresponding original, so that these properties can
-be correctly restored at decompression time. File name handling is
-naive in the sense that there is no mechanism for preserving original
-file names, permissions, ownerships or dates in filesystems which lack
-these concepts, or have serious file name length restrictions, such as
-MS-DOS.
-
-.I bzip2
-and
-.I bunzip2
-will by default not overwrite existing
-files. If you want this to happen, specify the \-f flag.
-
-If no file names are specified,
-.I bzip2
-compresses from standard
-input to standard output. In this case,
-.I bzip2
-will decline to
-write compressed output to a terminal, as this would be entirely
-incomprehensible and therefore pointless.
-
-.I bunzip2
-(or
-.I bzip2 \-d)
-decompresses all
-specified files. Files which were not created by
-.I bzip2
-will be detected and ignored, and a warning issued.
-.I bzip2
-attempts to guess the filename for the decompressed file
-from that of the compressed file as follows:
-
- filename.bz2 becomes filename
- filename.bz becomes filename
- filename.tbz2 becomes filename.tar
- filename.tbz becomes filename.tar
- anyothername becomes anyothername.out
-
-If the file does not end in one of the recognised endings,
-.I .bz2,
-.I .bz,
-.I .tbz2
-or
-.I .tbz,
-.I bzip2
-complains that it cannot
-guess the name of the original file, and uses the original name
-with
-.I .out
-appended.
-
-As with compression, supplying no
-filenames causes decompression from
-standard input to standard output.
-
-.I bunzip2
-will correctly decompress a file which is the
-concatenation of two or more compressed files. The result is the
-concatenation of the corresponding uncompressed files. Integrity
-testing (\-t)
-of concatenated
-compressed files is also supported.
-
-You can also compress or decompress files to the standard output by
-giving the \-c flag. Multiple files may be compressed and
-decompressed like this. The resulting outputs are fed sequentially to
-stdout. Compression of multiple files
-in this manner generates a stream
-containing multiple compressed file representations. Such a stream
-can be decompressed correctly only by
-.I bzip2
-version 0.9.0 or
-later. Earlier versions of
-.I bzip2
-will stop after decompressing
-the first file in the stream.
-
-.I bzcat
-(or
-.I bzip2 -dc)
-decompresses all specified files to
-the standard output.
-
-.I bzip2
-will read arguments from the environment variables
-.I BZIP2
-and
-.I BZIP,
-in that order, and will process them
-before any arguments read from the command line. This gives a
-convenient way to supply default arguments.
-
-Compression is always performed, even if the compressed
-file is slightly
-larger than the original. Files of less than about one hundred bytes
-tend to get larger, since the compression mechanism has a constant
-overhead in the region of 50 bytes. Random data (including the output
-of most file compressors) is coded at about 8.05 bits per byte, giving
-an expansion of around 0.5%.
-
-As a self-check for your protection,
-.I
-bzip2
-uses 32-bit CRCs to
-make sure that the decompressed version of a file is identical to the
-original. This guards against corruption of the compressed data, and
-against undetected bugs in
-.I bzip2
-(hopefully very unlikely). The
-chances of data corruption going undetected is microscopic, about one
-chance in four billion for each file processed. Be aware, though, that
-the check occurs upon decompression, so it can only tell you that
-something is wrong. It can't help you
-recover the original uncompressed
-data. You can use
-.I bzip2recover
-to try to recover data from
-damaged files.
-
-Return values: 0 for a normal exit, 1 for environmental problems (file
-not found, invalid flags, I/O errors, &c), 2 to indicate a corrupt
-compressed file, 3 for an internal consistency error (eg, bug) which
-caused
-.I bzip2
-to panic.
-
-.SH OPTIONS
-.TP
-.B \-c --stdout
-Compress or decompress to standard output.
-.TP
-.B \-d --decompress
-Force decompression.
-.I bzip2,
-.I bunzip2
-and
-.I bzcat
-are
-really the same program, and the decision about what actions to take is
-done on the basis of which name is used. This flag overrides that
-mechanism, and forces
-.I bzip2
-to decompress.
-.TP
-.B \-z --compress
-The complement to \-d: forces compression, regardless of the
-invokation name.
-.TP
-.B \-t --test
-Check integrity of the specified file(s), but don't decompress them.
-This really performs a trial decompression and throws away the result.
-.TP
-.B \-f --force
-Force overwrite of output files. Normally,
-.I bzip2
-will not overwrite
-existing output files. Also forces
-.I bzip2
-to break hard links
-to files, which it otherwise wouldn't do.
-.TP
-.B \-k --keep
-Keep (don't delete) input files during compression
-or decompression.
-.TP
-.B \-s --small
-Reduce memory usage, for compression, decompression and testing. Files
-are decompressed and tested using a modified algorithm which only
-requires 2.5 bytes per block byte. This means any file can be
-decompressed in 2300k of memory, albeit at about half the normal speed.
-
-During compression, \-s selects a block size of 200k, which limits
-memory use to around the same figure, at the expense of your compression
-ratio. In short, if your machine is low on memory (8 megabytes or
-less), use \-s for everything. See MEMORY MANAGEMENT below.
-.TP
-.B \-q --quiet
-Suppress non-essential warning messages. Messages pertaining to
-I/O errors and other critical events will not be suppressed.
-.TP
-.B \-v --verbose
-Verbose mode -- show the compression ratio for each file processed.
-Further \-v's increase the verbosity level, spewing out lots of
-information which is primarily of interest for diagnostic purposes.
-.TP
-.B \-L --license -V --version
-Display the software version, license terms and conditions.
-.TP
-.B \-1 to \-9
-Set the block size to 100 k, 200 k .. 900 k when compressing. Has no
-effect when decompressing. See MEMORY MANAGEMENT below.
-.TP
-.B \--
-Treats all subsequent arguments as file names, even if they start
-with a dash. This is so you can handle files with names beginning
-with a dash, for example: bzip2 \-- \-myfilename.
-.TP
-.B \--repetitive-fast --repetitive-best
-These flags are redundant in versions 0.9.5 and above. They provided
-some coarse control over the behaviour of the sorting algorithm in
-earlier versions, which was sometimes useful. 0.9.5 and above have an
-improved algorithm which renders these flags irrelevant.
-
-.SH MEMORY MANAGEMENT
-.I bzip2
-compresses large files in blocks. The block size affects
-both the compression ratio achieved, and the amount of memory needed for
-compression and decompression. The flags \-1 through \-9
-specify the block size to be 100,000 bytes through 900,000 bytes (the
-default) respectively. At decompression time, the block size used for
-compression is read from the header of the compressed file, and
-.I bunzip2
-then allocates itself just enough memory to decompress
-the file. Since block sizes are stored in compressed files, it follows
-that the flags \-1 to \-9 are irrelevant to and so ignored
-during decompression.
-
-Compression and decompression requirements,
-in bytes, can be estimated as:
-
- Compression: 400k + ( 8 x block size )
-
- Decompression: 100k + ( 4 x block size ), or
- 100k + ( 2.5 x block size )
-
-Larger block sizes give rapidly diminishing marginal returns. Most of
-the compression comes from the first two or three hundred k of block
-size, a fact worth bearing in mind when using
-.I bzip2
-on small machines.
-It is also important to appreciate that the decompression memory
-requirement is set at compression time by the choice of block size.
-
-For files compressed with the default 900k block size,
-.I bunzip2
-will require about 3700 kbytes to decompress. To support decompression
-of any file on a 4 megabyte machine,
-.I bunzip2
-has an option to
-decompress using approximately half this amount of memory, about 2300
-kbytes. Decompression speed is also halved, so you should use this
-option only where necessary. The relevant flag is -s.
-
-In general, try and use the largest block size memory constraints allow,
-since that maximises the compression achieved. Compression and
-decompression speed are virtually unaffected by block size.
-
-Another significant point applies to files which fit in a single block
--- that means most files you'd encounter using a large block size. The
-amount of real memory touched is proportional to the size of the file,
-since the file is smaller than a block. For example, compressing a file
-20,000 bytes long with the flag -9 will cause the compressor to
-allocate around 7600k of memory, but only touch 400k + 20000 * 8 = 560
-kbytes of it. Similarly, the decompressor will allocate 3700k but only
-touch 100k + 20000 * 4 = 180 kbytes.
-
-Here is a table which summarises the maximum memory usage for different
-block sizes. Also recorded is the total compressed size for 14 files of
-the Calgary Text Compression Corpus totalling 3,141,622 bytes. This
-column gives some feel for how compression varies with block size.
-These figures tend to understate the advantage of larger block sizes for
-larger files, since the Corpus is dominated by smaller files.
-
- Compress Decompress Decompress Corpus
- Flag usage usage -s usage Size
-
- -1 1200k 500k 350k 914704
- -2 2000k 900k 600k 877703
- -3 2800k 1300k 850k 860338
- -4 3600k 1700k 1100k 846899
- -5 4400k 2100k 1350k 845160
- -6 5200k 2500k 1600k 838626
- -7 6100k 2900k 1850k 834096
- -8 6800k 3300k 2100k 828642
- -9 7600k 3700k 2350k 828642
-
-.SH RECOVERING DATA FROM DAMAGED FILES
-.I bzip2
-compresses files in blocks, usually 900kbytes long. Each
-block is handled independently. If a media or transmission error causes
-a multi-block .bz2
-file to become damaged, it may be possible to
-recover data from the undamaged blocks in the file.
-
-The compressed representation of each block is delimited by a 48-bit
-pattern, which makes it possible to find the block boundaries with
-reasonable certainty. Each block also carries its own 32-bit CRC, so
-damaged blocks can be distinguished from undamaged ones.
-
-.I bzip2recover
-is a simple program whose purpose is to search for
-blocks in .bz2 files, and write each block out into its own .bz2
-file. You can then use
-.I bzip2
-\-t
-to test the
-integrity of the resulting files, and decompress those which are
-undamaged.
-
-.I bzip2recover
-takes a single argument, the name of the damaged file,
-and writes a number of files "rec0001file.bz2",
-"rec0002file.bz2", etc, containing the extracted blocks.
-The output filenames are designed so that the use of
-wildcards in subsequent processing -- for example,
-"bzip2 -dc rec*file.bz2 > recovered_data" -- lists the files in
-the correct order.
-
-.I bzip2recover
-should be of most use dealing with large .bz2
-files, as these will contain many blocks. It is clearly
-futile to use it on damaged single-block files, since a
-damaged block cannot be recovered. If you wish to minimise
-any potential data loss through media or transmission errors,
-you might consider compressing with a smaller
-block size.
-
-.SH PERFORMANCE NOTES
-The sorting phase of compression gathers together similar strings in the
-file. Because of this, files containing very long runs of repeated
-symbols, like "aabaabaabaab ..." (repeated several hundred times) may
-compress more slowly than normal. Versions 0.9.5 and above fare much
-better than previous versions in this respect. The ratio between
-worst-case and average-case compression time is in the region of 10:1.
-For previous versions, this figure was more like 100:1. You can use the
-\-vvvv option to monitor progress in great detail, if you want.
-
-Decompression speed is unaffected by these phenomena.
-
-.I bzip2
-usually allocates several megabytes of memory to operate
-in, and then charges all over it in a fairly random fashion. This means
-that performance, both for compressing and decompressing, is largely
-determined by the speed at which your machine can service cache misses.
-Because of this, small changes to the code to reduce the miss rate have
-been observed to give disproportionately large performance improvements.
-I imagine
-.I bzip2
-will perform best on machines with very large caches.
-
-.SH CAVEATS
-I/O error messages are not as helpful as they could be.
-.I bzip2
-tries hard to detect I/O errors and exit cleanly, but the details of
-what the problem is sometimes seem rather misleading.
-
-This manual page pertains to version 1.0 of
-.I bzip2.
-Compressed
-data created by this version is entirely forwards and backwards
-compatible with the previous public releases, versions 0.1pl2, 0.9.0
-and 0.9.5,
-but with the following exception: 0.9.0 and above can correctly
-decompress multiple concatenated compressed files. 0.1pl2 cannot do
-this; it will stop after decompressing just the first file in the
-stream.
-
-.I bzip2recover
-uses 32-bit integers to represent bit positions in
-compressed files, so it cannot handle compressed files more than 512
-megabytes long. This could easily be fixed.
-
-.SH AUTHOR
-Julian Seward, jseward@acm.org.
-
-http://sourceware.cygnus.com/bzip2
-http://www.muraroa.demon.co.uk
-
-The ideas embodied in
-.I bzip2
-are due to (at least) the following
-people: Michael Burrows and David Wheeler (for the block sorting
-transformation), David Wheeler (again, for the Huffman coder), Peter
-Fenwick (for the structured coding model in the original
-.I bzip,
-and many refinements), and Alistair Moffat, Radford Neal and Ian Witten
-(for the arithmetic coder in the original
-.I bzip).
-I am much
-indebted for their help, support and advice. See the manual in the
-source distribution for pointers to sources of documentation. Christian
-von Roques encouraged me to look for faster sorting algorithms, so as to
-speed up compression. Bela Lubkin encouraged me to improve the
-worst-case compression performance. Many people sent patches, helped
-with portability problems, lent machines, gave advice and were generally
-helpful.
diff --git a/winsup/bz2lib/bzip2.1.preformatted b/winsup/bz2lib/bzip2.1.preformatted
deleted file mode 100644
index 9f18339e9..000000000
--- a/winsup/bz2lib/bzip2.1.preformatted
+++ /dev/null
@@ -1,462 +0,0 @@
-
-
-
-bzip2(1) bzip2(1)
-
-
-NNAAMMEE
- bzip2, bunzip2 - a block-sorting file compressor, v1.0
- bzcat - decompresses files to stdout
- bzip2recover - recovers data from damaged bzip2 files
-
-
-SSYYNNOOPPSSIISS
- bbzziipp22 [ --ccddffkkqqssttvvzzVVLL112233445566778899 ] [ _f_i_l_e_n_a_m_e_s _._._. ]
- bbuunnzziipp22 [ --ffkkvvssVVLL ] [ _f_i_l_e_n_a_m_e_s _._._. ]
- bbzzccaatt [ --ss ] [ _f_i_l_e_n_a_m_e_s _._._. ]
- bbzziipp22rreeccoovveerr _f_i_l_e_n_a_m_e
-
-
-DDEESSCCRRIIPPTTIIOONN
- _b_z_i_p_2 compresses files using the Burrows-Wheeler block
- sorting text compression algorithm, and Huffman coding.
- Compression is generally considerably better than that
- achieved by more conventional LZ77/LZ78-based compressors,
- and approaches the performance of the PPM family of sta-
- tistical compressors.
-
- The command-line options are deliberately very similar to
- those of _G_N_U _g_z_i_p_, but they are not identical.
-
- _b_z_i_p_2 expects a list of file names to accompany the com-
- mand-line flags. Each file is replaced by a compressed
- version of itself, with the name "original_name.bz2".
- Each compressed file has the same modification date, per-
- missions, and, when possible, ownership as the correspond-
- ing original, so that these properties can be correctly
- restored at decompression time. File name handling is
- naive in the sense that there is no mechanism for preserv-
- ing original file names, permissions, ownerships or dates
- in filesystems which lack these concepts, or have serious
- file name length restrictions, such as MS-DOS.
-
- _b_z_i_p_2 and _b_u_n_z_i_p_2 will by default not overwrite existing
- files. If you want this to happen, specify the -f flag.
-
- If no file names are specified, _b_z_i_p_2 compresses from
- standard input to standard output. In this case, _b_z_i_p_2
- will decline to write compressed output to a terminal, as
- this would be entirely incomprehensible and therefore
- pointless.
-
- _b_u_n_z_i_p_2 (or _b_z_i_p_2 _-_d_) decompresses all specified files.
- Files which were not created by _b_z_i_p_2 will be detected and
- ignored, and a warning issued. _b_z_i_p_2 attempts to guess
- the filename for the decompressed file from that of the
- compressed file as follows:
-
- filename.bz2 becomes filename
- filename.bz becomes filename
- filename.tbz2 becomes filename.tar
-
-
-
- 1
-
-
-
-
-
-bzip2(1) bzip2(1)
-
-
- filename.tbz becomes filename.tar
- anyothername becomes anyothername.out
-
- If the file does not end in one of the recognised endings,
- _._b_z_2_, _._b_z_, _._t_b_z_2 or _._t_b_z_, _b_z_i_p_2 complains that it cannot
- guess the name of the original file, and uses the original
- name with _._o_u_t appended.
-
- As with compression, supplying no filenames causes decom-
- pression from standard input to standard output.
-
- _b_u_n_z_i_p_2 will correctly decompress a file which is the con-
- catenation of two or more compressed files. The result is
- the concatenation of the corresponding uncompressed files.
- Integrity testing (-t) of concatenated compressed files is
- also supported.
-
- You can also compress or decompress files to the standard
- output by giving the -c flag. Multiple files may be com-
- pressed and decompressed like this. The resulting outputs
- are fed sequentially to stdout. Compression of multiple
- files in this manner generates a stream containing multi-
- ple compressed file representations. Such a stream can be
- decompressed correctly only by _b_z_i_p_2 version 0.9.0 or
- later. Earlier versions of _b_z_i_p_2 will stop after decom-
- pressing the first file in the stream.
-
- _b_z_c_a_t (or _b_z_i_p_2 _-_d_c_) decompresses all specified files to
- the standard output.
-
- _b_z_i_p_2 will read arguments from the environment variables
- _B_Z_I_P_2 and _B_Z_I_P_, in that order, and will process them
- before any arguments read from the command line. This
- gives a convenient way to supply default arguments.
-
- Compression is always performed, even if the compressed
- file is slightly larger than the original. Files of less
- than about one hundred bytes tend to get larger, since the
- compression mechanism has a constant overhead in the
- region of 50 bytes. Random data (including the output of
- most file compressors) is coded at about 8.05 bits per
- byte, giving an expansion of around 0.5%.
-
- As a self-check for your protection, _b_z_i_p_2 uses 32-bit
- CRCs to make sure that the decompressed version of a file
- is identical to the original. This guards against corrup-
- tion of the compressed data, and against undetected bugs
- in _b_z_i_p_2 (hopefully very unlikely). The chances of data
- corruption going undetected is microscopic, about one
- chance in four billion for each file processed. Be aware,
- though, that the check occurs upon decompression, so it
- can only tell you that something is wrong. It can't help
- you recover the original uncompressed data. You can use
- _b_z_i_p_2_r_e_c_o_v_e_r to try to recover data from damaged files.
-
-
-
- 2
-
-
-
-
-
-bzip2(1) bzip2(1)
-
-
- Return values: 0 for a normal exit, 1 for environmental
- problems (file not found, invalid flags, I/O errors, &c),
- 2 to indicate a corrupt compressed file, 3 for an internal
- consistency error (eg, bug) which caused _b_z_i_p_2 to panic.
-
-
-OOPPTTIIOONNSS
- --cc ----ssttddoouutt
- Compress or decompress to standard output.
-
- --dd ----ddeeccoommpprreessss
- Force decompression. _b_z_i_p_2_, _b_u_n_z_i_p_2 and _b_z_c_a_t are
- really the same program, and the decision about
- what actions to take is done on the basis of which
- name is used. This flag overrides that mechanism,
- and forces _b_z_i_p_2 to decompress.
-
- --zz ----ccoommpprreessss
- The complement to -d: forces compression, regard-
- less of the invokation name.
-
- --tt ----tteesstt
- Check integrity of the specified file(s), but don't
- decompress them. This really performs a trial
- decompression and throws away the result.
-
- --ff ----ffoorrccee
- Force overwrite of output files. Normally, _b_z_i_p_2
- will not overwrite existing output files. Also
- forces _b_z_i_p_2 to break hard links to files, which it
- otherwise wouldn't do.
-
- --kk ----kkeeeepp
- Keep (don't delete) input files during compression
- or decompression.
-
- --ss ----ssmmaallll
- Reduce memory usage, for compression, decompression
- and testing. Files are decompressed and tested
- using a modified algorithm which only requires 2.5
- bytes per block byte. This means any file can be
- decompressed in 2300k of memory, albeit at about
- half the normal speed.
-
- During compression, -s selects a block size of
- 200k, which limits memory use to around the same
- figure, at the expense of your compression ratio.
- In short, if your machine is low on memory (8
- megabytes or less), use -s for everything. See
- MEMORY MANAGEMENT below.
-
- --qq ----qquuiieett
- Suppress non-essential warning messages. Messages
- pertaining to I/O errors and other critical events
-
-
-
- 3
-
-
-
-
-
-bzip2(1) bzip2(1)
-
-
- will not be suppressed.
-
- --vv ----vveerrbboossee
- Verbose mode -- show the compression ratio for each
- file processed. Further -v's increase the ver-
- bosity level, spewing out lots of information which
- is primarily of interest for diagnostic purposes.
-
- --LL ----lliicceennssee --VV ----vveerrssiioonn
- Display the software version, license terms and
- conditions.
-
- --11 ttoo --99
- Set the block size to 100 k, 200 k .. 900 k when
- compressing. Has no effect when decompressing.
- See MEMORY MANAGEMENT below.
-
- ---- Treats all subsequent arguments as file names, even
- if they start with a dash. This is so you can han-
- dle files with names beginning with a dash, for
- example: bzip2 -- -myfilename.
-
- ----rreeppeettiittiivvee--ffaasstt ----rreeppeettiittiivvee--bbeesstt
- These flags are redundant in versions 0.9.5 and
- above. They provided some coarse control over the
- behaviour of the sorting algorithm in earlier ver-
- sions, which was sometimes useful. 0.9.5 and above
- have an improved algorithm which renders these
- flags irrelevant.
-
-
-MMEEMMOORRYY MMAANNAAGGEEMMEENNTT
- _b_z_i_p_2 compresses large files in blocks. The block size
- affects both the compression ratio achieved, and the
- amount of memory needed for compression and decompression.
- The flags -1 through -9 specify the block size to be
- 100,000 bytes through 900,000 bytes (the default) respec-
- tively. At decompression time, the block size used for
- compression is read from the header of the compressed
- file, and _b_u_n_z_i_p_2 then allocates itself just enough memory
- to decompress the file. Since block sizes are stored in
- compressed files, it follows that the flags -1 to -9 are
- irrelevant to and so ignored during decompression.
-
- Compression and decompression requirements, in bytes, can
- be estimated as:
-
- Compression: 400k + ( 8 x block size )
-
- Decompression: 100k + ( 4 x block size ), or
- 100k + ( 2.5 x block size )
-
- Larger block sizes give rapidly diminishing marginal
- returns. Most of the compression comes from the first two
-
-
-
- 4
-
-
-
-
-
-bzip2(1) bzip2(1)
-
-
- or three hundred k of block size, a fact worth bearing in
- mind when using _b_z_i_p_2 on small machines. It is also
- important to appreciate that the decompression memory
- requirement is set at compression time by the choice of
- block size.
-
- For files compressed with the default 900k block size,
- _b_u_n_z_i_p_2 will require about 3700 kbytes to decompress. To
- support decompression of any file on a 4 megabyte machine,
- _b_u_n_z_i_p_2 has an option to decompress using approximately
- half this amount of memory, about 2300 kbytes. Decompres-
- sion speed is also halved, so you should use this option
- only where necessary. The relevant flag is -s.
-
- In general, try and use the largest block size memory con-
- straints allow, since that maximises the compression
- achieved. Compression and decompression speed are virtu-
- ally unaffected by block size.
-
- Another significant point applies to files which fit in a
- single block -- that means most files you'd encounter
- using a large block size. The amount of real memory
- touched is proportional to the size of the file, since the
- file is smaller than a block. For example, compressing a
- file 20,000 bytes long with the flag -9 will cause the
- compressor to allocate around 7600k of memory, but only
- touch 400k + 20000 * 8 = 560 kbytes of it. Similarly, the
- decompressor will allocate 3700k but only touch 100k +
- 20000 * 4 = 180 kbytes.
-
- Here is a table which summarises the maximum memory usage
- for different block sizes. Also recorded is the total
- compressed size for 14 files of the Calgary Text Compres-
- sion Corpus totalling 3,141,622 bytes. This column gives
- some feel for how compression varies with block size.
- These figures tend to understate the advantage of larger
- block sizes for larger files, since the Corpus is domi-
- nated by smaller files.
-
- Compress Decompress Decompress Corpus
- Flag usage usage -s usage Size
-
- -1 1200k 500k 350k 914704
- -2 2000k 900k 600k 877703
- -3 2800k 1300k 850k 860338
- -4 3600k 1700k 1100k 846899
- -5 4400k 2100k 1350k 845160
- -6 5200k 2500k 1600k 838626
- -7 6100k 2900k 1850k 834096
- -8 6800k 3300k 2100k 828642
- -9 7600k 3700k 2350k 828642
-
-
-
-
-
-
- 5
-
-
-
-
-
-bzip2(1) bzip2(1)
-
-
-RREECCOOVVEERRIINNGG DDAATTAA FFRROOMM DDAAMMAAGGEEDD FFIILLEESS
- _b_z_i_p_2 compresses files in blocks, usually 900kbytes long.
- Each block is handled independently. If a media or trans-
- mission error causes a multi-block .bz2 file to become
- damaged, it may be possible to recover data from the
- undamaged blocks in the file.
-
- The compressed representation of each block is delimited
- by a 48-bit pattern, which makes it possible to find the
- block boundaries with reasonable certainty. Each block
- also carries its own 32-bit CRC, so damaged blocks can be
- distinguished from undamaged ones.
-
- _b_z_i_p_2_r_e_c_o_v_e_r is a simple program whose purpose is to
- search for blocks in .bz2 files, and write each block out
- into its own .bz2 file. You can then use _b_z_i_p_2 -t to test
- the integrity of the resulting files, and decompress those
- which are undamaged.
-
- _b_z_i_p_2_r_e_c_o_v_e_r takes a single argument, the name of the dam-
- aged file, and writes a number of files "rec0001file.bz2",
- "rec0002file.bz2", etc, containing the extracted blocks.
- The output filenames are designed so that the use of
- wildcards in subsequent processing -- for example, "bzip2
- -dc rec*file.bz2 > recovered_data" -- lists the files in
- the correct order.
-
- _b_z_i_p_2_r_e_c_o_v_e_r should be of most use dealing with large .bz2
- files, as these will contain many blocks. It is clearly
- futile to use it on damaged single-block files, since a
- damaged block cannot be recovered. If you wish to min-
- imise any potential data loss through media or transmis-
- sion errors, you might consider compressing with a smaller
- block size.
-
-
-PPEERRFFOORRMMAANNCCEE NNOOTTEESS
- The sorting phase of compression gathers together similar
- strings in the file. Because of this, files containing
- very long runs of repeated symbols, like "aabaabaabaab
- ..." (repeated several hundred times) may compress more
- slowly than normal. Versions 0.9.5 and above fare much
- better than previous versions in this respect. The ratio
- between worst-case and average-case compression time is in
- the region of 10:1. For previous versions, this figure
- was more like 100:1. You can use the -vvvv option to mon-
- itor progress in great detail, if you want.
-
- Decompression speed is unaffected by these phenomena.
-
- _b_z_i_p_2 usually allocates several megabytes of memory to
- operate in, and then charges all over it in a fairly ran-
- dom fashion. This means that performance, both for com-
- pressing and decompressing, is largely determined by the
-
-
-
- 6
-
-
-
-
-
-bzip2(1) bzip2(1)
-
-
- speed at which your machine can service cache misses.
- Because of this, small changes to the code to reduce the
- miss rate have been observed to give disproportionately
- large performance improvements. I imagine _b_z_i_p_2 will per-
- form best on machines with very large caches.
-
-
-CCAAVVEEAATTSS
- I/O error messages are not as helpful as they could be.
- _b_z_i_p_2 tries hard to detect I/O errors and exit cleanly,
- but the details of what the problem is sometimes seem
- rather misleading.
-
- This manual page pertains to version 1.0 of _b_z_i_p_2_. Com-
- pressed data created by this version is entirely forwards
- and backwards compatible with the previous public
- releases, versions 0.1pl2, 0.9.0 and 0.9.5, but with the
- following exception: 0.9.0 and above can correctly decom-
- press multiple concatenated compressed files. 0.1pl2 can-
- not do this; it will stop after decompressing just the
- first file in the stream.
-
- _b_z_i_p_2_r_e_c_o_v_e_r uses 32-bit integers to represent bit posi-
- tions in compressed files, so it cannot handle compressed
- files more than 512 megabytes long. This could easily be
- fixed.
-
-
-AAUUTTHHOORR
- Julian Seward, jseward@acm.org.
-
- http://sourceware.cygnus.com/bzip2
- http://www.muraroa.demon.co.uk
-
- The ideas embodied in _b_z_i_p_2 are due to (at least) the fol-
- lowing people: Michael Burrows and David Wheeler (for the
- block sorting transformation), David Wheeler (again, for
- the Huffman coder), Peter Fenwick (for the structured cod-
- ing model in the original _b_z_i_p_, and many refinements), and
- Alistair Moffat, Radford Neal and Ian Witten (for the
- arithmetic coder in the original _b_z_i_p_)_. I am much
- indebted for their help, support and advice. See the man-
- ual in the source distribution for pointers to sources of
- documentation. Christian von Roques encouraged me to look
- for faster sorting algorithms, so as to speed up compres-
- sion. Bela Lubkin encouraged me to improve the worst-case
- compression performance. Many people sent patches, helped
- with portability problems, lent machines, gave advice and
- were generally helpful.
-
-
-
-
-
-
-
-
- 7
-
-
diff --git a/winsup/bz2lib/bzip2.c b/winsup/bz2lib/bzip2.c
deleted file mode 100644
index 56adfdcbc..000000000
--- a/winsup/bz2lib/bzip2.c
+++ /dev/null
@@ -1,2044 +0,0 @@
-
-/*-----------------------------------------------------------*/
-/*--- A block-sorting, lossless compressor bzip2.c ---*/
-/*-----------------------------------------------------------*/
-
-/*--
- This file is a part of bzip2 and/or libbzip2, a program and
- library for lossless, block-sorting data compression.
-
- Copyright (C) 1996-2000 Julian R Seward. 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. The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 3. Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-
- 4. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
-
- Julian Seward, Cambridge, UK.
- jseward@acm.org
- bzip2/libbzip2 version 1.0 of 21 March 2000
-
- This program is based on (at least) the work of:
- Mike Burrows
- David Wheeler
- Peter Fenwick
- Alistair Moffat
- Radford Neal
- Ian H. Witten
- Robert Sedgewick
- Jon L. Bentley
-
- For more information on these sources, see the manual.
---*/
-
-
-/*----------------------------------------------------*/
-/*--- IMPORTANT ---*/
-/*----------------------------------------------------*/
-
-/*--
- WARNING:
- This program and library (attempts to) compress data by
- performing several non-trivial transformations on it.
- Unless you are 100% familiar with *all* the algorithms
- contained herein, and with the consequences of modifying them,
- you should NOT meddle with the compression or decompression
- machinery. Incorrect changes can and very likely *will*
- lead to disasterous loss of data.
-
- DISCLAIMER:
- I TAKE NO RESPONSIBILITY FOR ANY LOSS OF DATA ARISING FROM THE
- USE OF THIS PROGRAM, HOWSOEVER CAUSED.
-
- Every compression of a file implies an assumption that the
- compressed file can be decompressed to reproduce the original.
- Great efforts in design, coding and testing have been made to
- ensure that this program works correctly. However, the
- complexity of the algorithms, and, in particular, the presence
- of various special cases in the code which occur with very low
- but non-zero probability make it impossible to rule out the
- possibility of bugs remaining in the program. DO NOT COMPRESS
- ANY DATA WITH THIS PROGRAM AND/OR LIBRARY UNLESS YOU ARE PREPARED
- TO ACCEPT THE POSSIBILITY, HOWEVER SMALL, THAT THE DATA WILL
- NOT BE RECOVERABLE.
-
- That is not to say this program is inherently unreliable.
- Indeed, I very much hope the opposite is true. bzip2/libbzip2
- has been carefully constructed and extensively tested.
-
- PATENTS:
- To the best of my knowledge, bzip2/libbzip2 does not use any
- patented algorithms. However, I do not have the resources
- available to carry out a full patent search. Therefore I cannot
- give any guarantee of the above statement.
---*/
-
-
-
-/*----------------------------------------------------*/
-/*--- and now for something much more pleasant :-) ---*/
-/*----------------------------------------------------*/
-
-/*---------------------------------------------*/
-/*--
- Place a 1 beside your platform, and 0 elsewhere.
---*/
-
-/*--
- Generic 32-bit Unix.
- Also works on 64-bit Unix boxes.
---*/
-#define BZ_UNIX 1
-
-/*--
- Win32, as seen by Jacob Navia's excellent
- port of (Chris Fraser & David Hanson)'s excellent
- lcc compiler.
---*/
-#define BZ_LCCWIN32 0
-
-#if defined(_WIN32) && !defined(__CYGWIN__)
-#undef BZ_LCCWIN32
-#define BZ_LCCWIN32 1
-#undef BZ_UNIX
-#define BZ_UNIX 0
-#endif
-
-
-/*---------------------------------------------*/
-/*--
- Some stuff for all platforms.
---*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-#include <math.h>
-#include <errno.h>
-#include <ctype.h>
-#include "bzlib.h"
-
-#define ERROR_IF_EOF(i) { if ((i) == EOF) ioError(); }
-#define ERROR_IF_NOT_ZERO(i) { if ((i) != 0) ioError(); }
-#define ERROR_IF_MINUS_ONE(i) { if ((i) == (-1)) ioError(); }
-
-
-/*---------------------------------------------*/
-/*--
- Platform-specific stuff.
---*/
-
-#if BZ_UNIX
-# include <sys/types.h>
-# include <utime.h>
-# include <unistd.h>
-# include <sys/stat.h>
-# include <sys/times.h>
-
-# define PATH_SEP '/'
-# define MY_LSTAT lstat
-# define MY_S_IFREG S_ISREG
-# define MY_STAT stat
-
-# define APPEND_FILESPEC(root, name) \
- root=snocString((root), (name))
-
-# define APPEND_FLAG(root, name) \
- root=snocString((root), (name))
-
-# define SET_BINARY_MODE(fd) /**/
-
-# ifdef __GNUC__
-# define NORETURN __attribute__ ((noreturn))
-# else
-# define NORETURN /**/
-# endif
-# ifdef __DJGPP__
-# include <io.h>
-# include <fcntl.h>
-# undef MY_LSTAT
-# define MY_LSTAT stat
-# undef SET_BINARY_MODE
-# define SET_BINARY_MODE(fd) \
- do { \
- int retVal = setmode ( fileno ( fd ), \
- O_BINARY ); \
- ERROR_IF_MINUS_ONE ( retVal ); \
- } while ( 0 )
-# endif
-# ifdef __CYGWIN__
-# include <io.h>
-# include <fcntl.h>
-# undef SET_BINARY_MODE
-# define SET_BINARY_MODE(fd) \
- do { \
- int retVal = setmode ( fileno ( fd ), \
- O_BINARY ); \
- ERROR_IF_MINUS_ONE ( retVal ); \
- } while ( 0 )
-# endif
-#endif
-
-
-
-#if BZ_LCCWIN32
-# include <io.h>
-# include <fcntl.h>
-# include <sys\stat.h>
-
-# define NORETURN /**/
-# define PATH_SEP '\\'
-# define MY_LSTAT _stat
-# define MY_STAT _stat
-# define MY_S_IFREG(x) ((x) & _S_IFREG)
-
-# define APPEND_FLAG(root, name) \
- root=snocString((root), (name))
-
-# if 0
- /*-- lcc-win32 seems to expand wildcards itself --*/
-# define APPEND_FILESPEC(root, spec) \
- do { \
- if ((spec)[0] == '-') { \
- root = snocString((root), (spec)); \
- } else { \
- struct _finddata_t c_file; \
- long hFile; \
- hFile = _findfirst((spec), &c_file); \
- if ( hFile == -1L ) { \
- root = snocString ((root), (spec)); \
- } else { \
- int anInt = 0; \
- while ( anInt == 0 ) { \
- root = snocString((root), \
- &c_file.name[0]); \
- anInt = _findnext(hFile, &c_file); \
- } \
- } \
- } \
- } while ( 0 )
-# else
-# define APPEND_FILESPEC(root, name) \
- root = snocString ((root), (name))
-# endif
-
-# define SET_BINARY_MODE(fd) \
- do { \
- int retVal = setmode ( fileno ( fd ), \
- O_BINARY ); \
- ERROR_IF_MINUS_ONE ( retVal ); \
- } while ( 0 )
-
-#endif
-
-
-/*---------------------------------------------*/
-/*--
- Some more stuff for all platforms :-)
---*/
-
-typedef char Char;
-typedef unsigned char Bool;
-typedef unsigned char UChar;
-typedef int Int32;
-typedef unsigned int UInt32;
-typedef short Int16;
-typedef unsigned short UInt16;
-
-#define True ((Bool)1)
-#define False ((Bool)0)
-
-/*--
- IntNative is your platform's `native' int size.
- Only here to avoid probs with 64-bit platforms.
---*/
-typedef int IntNative;
-
-
-/*---------------------------------------------------*/
-/*--- Misc (file handling) data decls ---*/
-/*---------------------------------------------------*/
-
-Int32 verbosity;
-Bool keepInputFiles, smallMode, deleteOutputOnInterrupt;
-Bool forceOverwrite, testFailsExist, unzFailsExist, noisy;
-Int32 numFileNames, numFilesProcessed, blockSize100k;
-Int32 exitValue;
-
-/*-- source modes; F==file, I==stdin, O==stdout --*/
-#define SM_I2O 1
-#define SM_F2O 2
-#define SM_F2F 3
-
-/*-- operation modes --*/
-#define OM_Z 1
-#define OM_UNZ 2
-#define OM_TEST 3
-
-Int32 opMode;
-Int32 srcMode;
-
-#define FILE_NAME_LEN 1034
-
-Int32 longestFileName;
-Char inName [FILE_NAME_LEN];
-Char outName[FILE_NAME_LEN];
-Char tmpName[FILE_NAME_LEN];
-Char *progName;
-Char progNameReally[FILE_NAME_LEN];
-FILE *outputHandleJustInCase;
-Int32 workFactor;
-
-static void panic ( Char* ) NORETURN;
-static void ioError ( void ) NORETURN;
-static void outOfMemory ( void ) NORETURN;
-static void configError ( void ) NORETURN;
-static void crcError ( void ) NORETURN;
-static void cleanUpAndFail ( Int32 ) NORETURN;
-static void compressedStreamEOF ( void ) NORETURN;
-
-static void copyFileName ( Char*, Char* );
-static void* myMalloc ( Int32 );
-
-
-
-/*---------------------------------------------------*/
-/*--- An implementation of 64-bit ints. Sigh. ---*/
-/*--- Roll on widespread deployment of ANSI C9X ! ---*/
-/*---------------------------------------------------*/
-
-typedef
- struct { UChar b[8]; }
- UInt64;
-
-static
-void uInt64_from_UInt32s ( UInt64* n, UInt32 lo32, UInt32 hi32 )
-{
- n->b[7] = (UChar)((hi32 >> 24) & 0xFF);
- n->b[6] = (UChar)((hi32 >> 16) & 0xFF);
- n->b[5] = (UChar)((hi32 >> 8) & 0xFF);
- n->b[4] = (UChar) (hi32 & 0xFF);
- n->b[3] = (UChar)((lo32 >> 24) & 0xFF);
- n->b[2] = (UChar)((lo32 >> 16) & 0xFF);
- n->b[1] = (UChar)((lo32 >> 8) & 0xFF);
- n->b[0] = (UChar) (lo32 & 0xFF);
-}
-
-static
-double uInt64_to_double ( UInt64* n )
-{
- Int32 i;
- double base = 1.0;
- double sum = 0.0;
- for (i = 0; i < 8; i++) {
- sum += base * (double)(n->b[i]);
- base *= 256.0;
- }
- return sum;
-}
-
-static
-void uInt64_add ( UInt64* src, UInt64* dst )
-{
- Int32 i;
- Int32 carry = 0;
- for (i = 0; i < 8; i++) {
- carry += ( ((Int32)src->b[i]) + ((Int32)dst->b[i]) );
- dst->b[i] = (UChar)(carry & 0xFF);
- carry >>= 8;
- }
-}
-
-static
-void uInt64_sub ( UInt64* src, UInt64* dst )
-{
- Int32 t, i;
- Int32 borrow = 0;
- for (i = 0; i < 8; i++) {
- t = ((Int32)dst->b[i]) - ((Int32)src->b[i]) - borrow;
- if (t < 0) {
- dst->b[i] = (UChar)(t + 256);
- borrow = 1;
- } else {
- dst->b[i] = (UChar)t;
- borrow = 0;
- }
- }
-}
-
-static
-void uInt64_mul ( UInt64* a, UInt64* b, UInt64* r_hi, UInt64* r_lo )
-{
- UChar sum[16];
- Int32 ia, ib, carry;
- for (ia = 0; ia < 16; ia++) sum[ia] = 0;
- for (ia = 0; ia < 8; ia++) {
- carry = 0;
- for (ib = 0; ib < 8; ib++) {
- carry += ( ((Int32)sum[ia+ib])
- + ((Int32)a->b[ia]) * ((Int32)b->b[ib]) );
- sum[ia+ib] = (UChar)(carry & 0xFF);
- carry >>= 8;
- }
- sum[ia+8] = (UChar)(carry & 0xFF);
- if ((carry >>= 8) != 0) panic ( "uInt64_mul" );
- }
-
- for (ia = 0; ia < 8; ia++) r_hi->b[ia] = sum[ia+8];
- for (ia = 0; ia < 8; ia++) r_lo->b[ia] = sum[ia];
-}
-
-
-static
-void uInt64_shr1 ( UInt64* n )
-{
- Int32 i;
- for (i = 0; i < 8; i++) {
- n->b[i] >>= 1;
- if (i < 7 && (n->b[i+1] & 1)) n->b[i] |= 0x80;
- }
-}
-
-static
-void uInt64_shl1 ( UInt64* n )
-{
- Int32 i;
- for (i = 7; i >= 0; i--) {
- n->b[i] <<= 1;
- if (i > 0 && (n->b[i-1] & 0x80)) n->b[i]++;
- }
-}
-
-static
-Bool uInt64_isZero ( UInt64* n )
-{
- Int32 i;
- for (i = 0; i < 8; i++)
- if (n->b[i] != 0) return 0;
- return 1;
-}
-
-static
-Int32 uInt64_qrm10 ( UInt64* n )
-{
- /* Divide *n by 10, and return the remainder. Long division
- is difficult, so we cheat and instead multiply by
- 0xCCCC CCCC CCCC CCCD, which is 0.8 (viz, 0.1 << 3).
- */
- Int32 i;
- UInt64 tmp1, tmp2, n_orig, zero_point_eight;
-
- zero_point_eight.b[1] = zero_point_eight.b[2] =
- zero_point_eight.b[3] = zero_point_eight.b[4] =
- zero_point_eight.b[5] = zero_point_eight.b[6] =
- zero_point_eight.b[7] = 0xCC;
- zero_point_eight.b[0] = 0xCD;
-
- n_orig = *n;
-
- /* divide n by 10,
- by multiplying by 0.8 and then shifting right 3 times */
- uInt64_mul ( n, &zero_point_eight, &tmp1, &tmp2 );
- uInt64_shr1(&tmp1); uInt64_shr1(&tmp1); uInt64_shr1(&tmp1);
- *n = tmp1;
-
- /* tmp1 = 8*n, tmp2 = 2*n */
- uInt64_shl1(&tmp1); uInt64_shl1(&tmp1); uInt64_shl1(&tmp1);
- tmp2 = *n; uInt64_shl1(&tmp2);
-
- /* tmp1 = 10*n */
- uInt64_add ( &tmp2, &tmp1 );
-
- /* n_orig = n_orig - 10*n */
- uInt64_sub ( &tmp1, &n_orig );
-
- /* n_orig should now hold quotient, in range 0 .. 9 */
- for (i = 7; i >= 1; i--)
- if (n_orig.b[i] != 0) panic ( "uInt64_qrm10(1)" );
- if (n_orig.b[0] > 9)
- panic ( "uInt64_qrm10(2)" );
-
- return (int)n_orig.b[0];
-}
-
-/* ... and the Whole Entire Point of all this UInt64 stuff is
- so that we can supply the following function.
-*/
-static
-void uInt64_toAscii ( char* outbuf, UInt64* n )
-{
- Int32 i, q;
- UChar buf[32];
- Int32 nBuf = 0;
- UInt64 n_copy = *n;
- do {
- q = uInt64_qrm10 ( &n_copy );
- buf[nBuf] = q + '0';
- nBuf++;
- } while (!uInt64_isZero(&n_copy));
- outbuf[nBuf] = 0;
- for (i = 0; i < nBuf; i++) outbuf[i] = buf[nBuf-i-1];
-}
-
-
-/*---------------------------------------------------*/
-/*--- Processing of complete files and streams ---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------*/
-static
-Bool myfeof ( FILE* f )
-{
- Int32 c = fgetc ( f );
- if (c == EOF) return True;
- ungetc ( c, f );
- return False;
-}
-
-
-/*---------------------------------------------*/
-static
-void compressStream ( FILE *stream, FILE *zStream )
-{
- BZFILE* bzf = NULL;
- UChar ibuf[5000];
- Int32 nIbuf;
- UInt32 nbytes_in_lo32, nbytes_in_hi32;
- UInt32 nbytes_out_lo32, nbytes_out_hi32;
- Int32 bzerr, bzerr_dummy, ret;
-
- SET_BINARY_MODE(stream);
- SET_BINARY_MODE(zStream);
-
- if (ferror(stream)) goto errhandler_io;
- if (ferror(zStream)) goto errhandler_io;
-
- bzf = BZ2_bzWriteOpen ( &bzerr, zStream,
- blockSize100k, verbosity, workFactor );
- if (bzerr != BZ_OK) goto errhandler;
-
- if (verbosity >= 2) fprintf ( stderr, "\n" );
-
- while (True) {
-
- if (myfeof(stream)) break;
- nIbuf = fread ( ibuf, sizeof(UChar), 5000, stream );
- if (ferror(stream)) goto errhandler_io;
- if (nIbuf > 0) BZ2_bzWrite ( &bzerr, bzf, (void*)ibuf, nIbuf );
- if (bzerr != BZ_OK) goto errhandler;
-
- }
-
- BZ2_bzWriteClose64 ( &bzerr, bzf, 0,
- &nbytes_in_lo32, &nbytes_in_hi32,
- &nbytes_out_lo32, &nbytes_out_hi32 );
- if (bzerr != BZ_OK) goto errhandler;
-
- if (ferror(zStream)) goto errhandler_io;
- ret = fflush ( zStream );
- if (ret == EOF) goto errhandler_io;
- if (zStream != stdout) {
- ret = fclose ( zStream );
- if (ret == EOF) goto errhandler_io;
- }
- if (ferror(stream)) goto errhandler_io;
- ret = fclose ( stream );
- if (ret == EOF) goto errhandler_io;
-
- if (nbytes_in_lo32 == 0 && nbytes_in_hi32 == 0)
- nbytes_in_lo32 = 1;
-
- if (verbosity >= 1) {
- Char buf_nin[32], buf_nout[32];
- UInt64 nbytes_in, nbytes_out;
- double nbytes_in_d, nbytes_out_d;
- uInt64_from_UInt32s ( &nbytes_in,
- nbytes_in_lo32, nbytes_in_hi32 );
- uInt64_from_UInt32s ( &nbytes_out,
- nbytes_out_lo32, nbytes_out_hi32 );
- nbytes_in_d = uInt64_to_double ( &nbytes_in );
- nbytes_out_d = uInt64_to_double ( &nbytes_out );
- uInt64_toAscii ( buf_nin, &nbytes_in );
- uInt64_toAscii ( buf_nout, &nbytes_out );
- fprintf ( stderr, "%6.3f:1, %6.3f bits/byte, "
- "%5.2f%% saved, %s in, %s out.\n",
- nbytes_in_d / nbytes_out_d,
- (8.0 * nbytes_out_d) / nbytes_in_d,
- 100.0 * (1.0 - nbytes_out_d / nbytes_in_d),
- buf_nin,
- buf_nout
- );
- }
-
- return;
-
- errhandler:
- BZ2_bzWriteClose64 ( &bzerr_dummy, bzf, 1,
- &nbytes_in_lo32, &nbytes_in_hi32,
- &nbytes_out_lo32, &nbytes_out_hi32 );
- switch (bzerr) {
- case BZ_CONFIG_ERROR:
- configError(); break;
- case BZ_MEM_ERROR:
- outOfMemory (); break;
- case BZ_IO_ERROR:
- errhandler_io:
- ioError(); break;
- default:
- panic ( "compress:unexpected error" );
- }
-
- panic ( "compress:end" );
- /*notreached*/
-}
-
-
-
-/*---------------------------------------------*/
-static
-Bool uncompressStream ( FILE *zStream, FILE *stream )
-{
- BZFILE* bzf = NULL;
- Int32 bzerr, bzerr_dummy, ret, nread, streamNo, i;
- UChar obuf[5000];
- UChar unused[BZ_MAX_UNUSED];
- Int32 nUnused;
- UChar* unusedTmp;
-
- nUnused = 0;
- streamNo = 0;
-
- SET_BINARY_MODE(stream);
- SET_BINARY_MODE(zStream);
-
- if (ferror(stream)) goto errhandler_io;
- if (ferror(zStream)) goto errhandler_io;
-
- while (True) {
-
- bzf = BZ2_bzReadOpen (
- &bzerr, zStream, verbosity,
- (int)smallMode, unused, nUnused
- );
- if (bzf == NULL || bzerr != BZ_OK) goto errhandler;
- streamNo++;
-
- while (bzerr == BZ_OK) {
- nread = BZ2_bzRead ( &bzerr, bzf, obuf, 5000 );
- if (bzerr == BZ_DATA_ERROR_MAGIC) goto errhandler;
- if ((bzerr == BZ_OK || bzerr == BZ_STREAM_END) && nread > 0)
- fwrite ( obuf, sizeof(UChar), nread, stream );
- if (ferror(stream)) goto errhandler_io;
- }
- if (bzerr != BZ_STREAM_END) goto errhandler;
-
- BZ2_bzReadGetUnused ( &bzerr, bzf, (void**)(&unusedTmp), &nUnused );
- if (bzerr != BZ_OK) panic ( "decompress:bzReadGetUnused" );
-
- for (i = 0; i < nUnused; i++) unused[i] = unusedTmp[i];
-
- BZ2_bzReadClose ( &bzerr, bzf );
- if (bzerr != BZ_OK) panic ( "decompress:bzReadGetUnused" );
-
- if (nUnused == 0 && myfeof(zStream)) break;
-
- }
-
- if (ferror(zStream)) goto errhandler_io;
- ret = fclose ( zStream );
- if (ret == EOF) goto errhandler_io;
-
- if (ferror(stream)) goto errhandler_io;
- ret = fflush ( stream );
- if (ret != 0) goto errhandler_io;
- if (stream != stdout) {
- ret = fclose ( stream );
- if (ret == EOF) goto errhandler_io;
- }
- if (verbosity >= 2) fprintf ( stderr, "\n " );
- return True;
-
- errhandler:
- BZ2_bzReadClose ( &bzerr_dummy, bzf );
- switch (bzerr) {
- case BZ_CONFIG_ERROR:
- configError(); break;
- case BZ_IO_ERROR:
- errhandler_io:
- ioError(); break;
- case BZ_DATA_ERROR:
- crcError();
- case BZ_MEM_ERROR:
- outOfMemory();
- case BZ_UNEXPECTED_EOF:
- compressedStreamEOF();
- case BZ_DATA_ERROR_MAGIC:
- if (zStream != stdin) fclose(zStream);
- if (stream != stdout) fclose(stream);
- if (streamNo == 1) {
- return False;
- } else {
- if (noisy)
- fprintf ( stderr,
- "\n%s: %s: trailing garbage after EOF ignored\n",
- progName, inName );
- return True;
- }
- default:
- panic ( "decompress:unexpected error" );
- }
-
- panic ( "decompress:end" );
- return True; /*notreached*/
-}
-
-
-/*---------------------------------------------*/
-static
-Bool testStream ( FILE *zStream )
-{
- BZFILE* bzf = NULL;
- Int32 bzerr, bzerr_dummy, ret, nread, streamNo, i;
- UChar obuf[5000];
- UChar unused[BZ_MAX_UNUSED];
- Int32 nUnused;
- UChar* unusedTmp;
-
- nUnused = 0;
- streamNo = 0;
-
- SET_BINARY_MODE(zStream);
- if (ferror(zStream)) goto errhandler_io;
-
- while (True) {
-
- bzf = BZ2_bzReadOpen (
- &bzerr, zStream, verbosity,
- (int)smallMode, unused, nUnused
- );
- if (bzf == NULL || bzerr != BZ_OK) goto errhandler;
- streamNo++;
-
- while (bzerr == BZ_OK) {
- nread = BZ2_bzRead ( &bzerr, bzf, obuf, 5000 );
- if (bzerr == BZ_DATA_ERROR_MAGIC) goto errhandler;
- }
- if (bzerr != BZ_STREAM_END) goto errhandler;
-
- BZ2_bzReadGetUnused ( &bzerr, bzf, (void**)(&unusedTmp), &nUnused );
- if (bzerr != BZ_OK) panic ( "test:bzReadGetUnused" );
-
- for (i = 0; i < nUnused; i++) unused[i] = unusedTmp[i];
-
- BZ2_bzReadClose ( &bzerr, bzf );
- if (bzerr != BZ_OK) panic ( "test:bzReadGetUnused" );
- if (nUnused == 0 && myfeof(zStream)) break;
-
- }
-
- if (ferror(zStream)) goto errhandler_io;
- ret = fclose ( zStream );
- if (ret == EOF) goto errhandler_io;
-
- if (verbosity >= 2) fprintf ( stderr, "\n " );
- return True;
-
- errhandler:
- BZ2_bzReadClose ( &bzerr_dummy, bzf );
- if (verbosity == 0)
- fprintf ( stderr, "%s: %s: ", progName, inName );
- switch (bzerr) {
- case BZ_CONFIG_ERROR:
- configError(); break;
- case BZ_IO_ERROR:
- errhandler_io:
- ioError(); break;
- case BZ_DATA_ERROR:
- fprintf ( stderr,
- "data integrity (CRC) error in data\n" );
- return False;
- case BZ_MEM_ERROR:
- outOfMemory();
- case BZ_UNEXPECTED_EOF:
- fprintf ( stderr,
- "file ends unexpectedly\n" );
- return False;
- case BZ_DATA_ERROR_MAGIC:
- if (zStream != stdin) fclose(zStream);
- if (streamNo == 1) {
- fprintf ( stderr,
- "bad magic number (file not created by bzip2)\n" );
- return False;
- } else {
- if (noisy)
- fprintf ( stderr,
- "trailing garbage after EOF ignored\n" );
- return True;
- }
- default:
- panic ( "test:unexpected error" );
- }
-
- panic ( "test:end" );
- return True; /*notreached*/
-}
-
-
-/*---------------------------------------------------*/
-/*--- Error [non-] handling grunge ---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------*/
-static
-void setExit ( Int32 v )
-{
- if (v > exitValue) exitValue = v;
-}
-
-
-/*---------------------------------------------*/
-static
-void cadvise ( void )
-{
- if (noisy)
- fprintf (
- stderr,
- "\nIt is possible that the compressed file(s) have become corrupted.\n"
- "You can use the -tvv option to test integrity of such files.\n\n"
- "You can use the `bzip2recover' program to *attempt* to recover\n"
- "data from undamaged sections of corrupted files.\n\n"
- );
-}
-
-
-/*---------------------------------------------*/
-static
-void showFileNames ( void )
-{
- if (noisy)
- fprintf (
- stderr,
- "\tInput file = %s, output file = %s\n",
- inName, outName
- );
-}
-
-
-/*---------------------------------------------*/
-static
-void cleanUpAndFail ( Int32 ec )
-{
- IntNative retVal;
-
- if ( srcMode == SM_F2F
- && opMode != OM_TEST
- && deleteOutputOnInterrupt ) {
- if (noisy)
- fprintf ( stderr, "%s: Deleting output file %s, if it exists.\n",
- progName, outName );
- if (outputHandleJustInCase != NULL)
- fclose ( outputHandleJustInCase );
- retVal = remove ( outName );
- if (retVal != 0)
- fprintf ( stderr,
- "%s: WARNING: deletion of output file (apparently) failed.\n",
- progName );
- }
- if (noisy && numFileNames > 0 && numFilesProcessed < numFileNames) {
- fprintf ( stderr,
- "%s: WARNING: some files have not been processed:\n"
- "\t%d specified on command line, %d not processed yet.\n\n",
- progName, numFileNames,
- numFileNames - numFilesProcessed );
- }
- setExit(ec);
- exit(exitValue);
-}
-
-
-/*---------------------------------------------*/
-static
-void panic ( Char* s )
-{
- fprintf ( stderr,
- "\n%s: PANIC -- internal consistency error:\n"
- "\t%s\n"
- "\tThis is a BUG. Please report it to me at:\n"
- "\tjseward@acm.org\n",
- progName, s );
- showFileNames();
- cleanUpAndFail( 3 );
-}
-
-
-/*---------------------------------------------*/
-static
-void crcError ( void )
-{
- fprintf ( stderr,
- "\n%s: Data integrity error when decompressing.\n",
- progName );
- showFileNames();
- cadvise();
- cleanUpAndFail( 2 );
-}
-
-
-/*---------------------------------------------*/
-static
-void compressedStreamEOF ( void )
-{
- fprintf ( stderr,
- "\n%s: Compressed file ends unexpectedly;\n\t"
- "perhaps it is corrupted? *Possible* reason follows.\n",
- progName );
- perror ( progName );
- showFileNames();
- cadvise();
- cleanUpAndFail( 2 );
-}
-
-
-/*---------------------------------------------*/
-static
-void ioError ( void )
-{
- fprintf ( stderr,
- "\n%s: I/O or other error, bailing out. "
- "Possible reason follows.\n",
- progName );
- perror ( progName );
- showFileNames();
- cleanUpAndFail( 1 );
-}
-
-
-/*---------------------------------------------*/
-static
-void mySignalCatcher ( IntNative n )
-{
- fprintf ( stderr,
- "\n%s: Control-C or similar caught, quitting.\n",
- progName );
- cleanUpAndFail(1);
-}
-
-
-/*---------------------------------------------*/
-static
-void mySIGSEGVorSIGBUScatcher ( IntNative n )
-{
- if (opMode == OM_Z)
- fprintf (
- stderr,
- "\n%s: Caught a SIGSEGV or SIGBUS whilst compressing.\n"
- "\n"
- " Possible causes are (most likely first):\n"
- " (1) This computer has unreliable memory or cache hardware\n"
- " (a surprisingly common problem; try a different machine.)\n"
- " (2) A bug in the compiler used to create this executable\n"
- " (unlikely, if you didn't compile bzip2 yourself.)\n"
- " (3) A real bug in bzip2 -- I hope this should never be the case.\n"
- " The user's manual, Section 4.3, has more info on (1) and (2).\n"
- " \n"
- " If you suspect this is a bug in bzip2, or are unsure about (1)\n"
- " or (2), feel free to report it to me at: jseward@acm.org.\n"
- " Section 4.3 of the user's manual describes the info a useful\n"
- " bug report should have. If the manual is available on your\n"
- " system, please try and read it before mailing me. If you don't\n"
- " have the manual or can't be bothered to read it, mail me anyway.\n"
- "\n",
- progName );
- else
- fprintf (
- stderr,
- "\n%s: Caught a SIGSEGV or SIGBUS whilst decompressing.\n"
- "\n"
- " Possible causes are (most likely first):\n"
- " (1) The compressed data is corrupted, and bzip2's usual checks\n"
- " failed to detect this. Try bzip2 -tvv my_file.bz2.\n"
- " (2) This computer has unreliable memory or cache hardware\n"
- " (a surprisingly common problem; try a different machine.)\n"
- " (3) A bug in the compiler used to create this executable\n"
- " (unlikely, if you didn't compile bzip2 yourself.)\n"
- " (4) A real bug in bzip2 -- I hope this should never be the case.\n"
- " The user's manual, Section 4.3, has more info on (2) and (3).\n"
- " \n"
- " If you suspect this is a bug in bzip2, or are unsure about (2)\n"
- " or (3), feel free to report it to me at: jseward@acm.org.\n"
- " Section 4.3 of the user's manual describes the info a useful\n"
- " bug report should have. If the manual is available on your\n"
- " system, please try and read it before mailing me. If you don't\n"
- " have the manual or can't be bothered to read it, mail me anyway.\n"
- "\n",
- progName );
-
- showFileNames();
- if (opMode == OM_Z)
- cleanUpAndFail( 3 ); else
- { cadvise(); cleanUpAndFail( 2 ); }
-}
-
-
-/*---------------------------------------------*/
-static
-void outOfMemory ( void )
-{
- fprintf ( stderr,
- "\n%s: couldn't allocate enough memory\n",
- progName );
- showFileNames();
- cleanUpAndFail(1);
-}
-
-
-/*---------------------------------------------*/
-static
-void configError ( void )
-{
- fprintf ( stderr,
- "bzip2: I'm not configured correctly for this platform!\n"
- "\tI require Int32, Int16 and Char to have sizes\n"
- "\tof 4, 2 and 1 bytes to run properly, and they don't.\n"
- "\tProbably you can fix this by defining them correctly,\n"
- "\tand recompiling. Bye!\n" );
- setExit(3);
- exit(exitValue);
-}
-
-
-/*---------------------------------------------------*/
-/*--- The main driver machinery ---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------*/
-static
-void pad ( Char *s )
-{
- Int32 i;
- if ( (Int32)strlen(s) >= longestFileName ) return;
- for (i = 1; i <= longestFileName - (Int32)strlen(s); i++)
- fprintf ( stderr, " " );
-}
-
-
-/*---------------------------------------------*/
-static
-void copyFileName ( Char* to, Char* from )
-{
- if ( strlen(from) > FILE_NAME_LEN-10 ) {
- fprintf (
- stderr,
- "bzip2: file name\n`%s'\n"
- "is suspiciously (more than %d chars) long.\n"
- "Try using a reasonable file name instead. Sorry! :-)\n",
- from, FILE_NAME_LEN-10
- );
- setExit(1);
- exit(exitValue);
- }
-
- strncpy(to,from,FILE_NAME_LEN-10);
- to[FILE_NAME_LEN-10]='\0';
-}
-
-
-/*---------------------------------------------*/
-static
-Bool fileExists ( Char* name )
-{
- FILE *tmp = fopen ( name, "rb" );
- Bool exists = (tmp != NULL);
- if (tmp != NULL) fclose ( tmp );
- return exists;
-}
-
-
-/*---------------------------------------------*/
-/*--
- if in doubt, return True
---*/
-static
-Bool notAStandardFile ( Char* name )
-{
- IntNative i;
- struct MY_STAT statBuf;
-
- i = MY_LSTAT ( name, &statBuf );
- if (i != 0) return True;
- if (MY_S_IFREG(statBuf.st_mode)) return False;
- return True;
-}
-
-
-/*---------------------------------------------*/
-/*--
- rac 11/21/98 see if file has hard links to it
---*/
-static
-Int32 countHardLinks ( Char* name )
-{
- IntNative i;
- struct MY_STAT statBuf;
-
- i = MY_LSTAT ( name, &statBuf );
- if (i != 0) return 0;
- return (statBuf.st_nlink - 1);
-}
-
-
-/*---------------------------------------------*/
-static
-void copyDatePermissionsAndOwner ( Char *srcName, Char *dstName )
-{
-#if BZ_UNIX
- IntNative retVal;
- struct MY_STAT statBuf;
- struct utimbuf uTimBuf;
-
- retVal = MY_LSTAT ( srcName, &statBuf );
- ERROR_IF_NOT_ZERO ( retVal );
- uTimBuf.actime = statBuf.st_atime;
- uTimBuf.modtime = statBuf.st_mtime;
-
- retVal = chmod ( dstName, statBuf.st_mode );
- ERROR_IF_NOT_ZERO ( retVal );
-
- retVal = utime ( dstName, &uTimBuf );
- ERROR_IF_NOT_ZERO ( retVal );
-
- retVal = chown ( dstName, statBuf.st_uid, statBuf.st_gid );
- /* chown() will in many cases return with EPERM, which can
- be safely ignored.
- */
-#endif
-}
-
-
-/*---------------------------------------------*/
-static
-void setInterimPermissions ( Char *dstName )
-{
-#if BZ_UNIX
- IntNative retVal;
- retVal = chmod ( dstName, S_IRUSR | S_IWUSR );
- ERROR_IF_NOT_ZERO ( retVal );
-#endif
-}
-
-
-/*---------------------------------------------*/
-static
-Bool containsDubiousChars ( Char* name )
-{
- Bool cdc = False;
- for (; *name != '\0'; name++)
- if (*name == '?' || *name == '*') cdc = True;
- return cdc;
-}
-
-
-/*---------------------------------------------*/
-#define BZ_N_SUFFIX_PAIRS 4
-
-Char* zSuffix[BZ_N_SUFFIX_PAIRS]
- = { ".bz2", ".bz", ".tbz2", ".tbz" };
-Char* unzSuffix[BZ_N_SUFFIX_PAIRS]
- = { "", "", ".tar", ".tar" };
-
-static
-Bool hasSuffix ( Char* s, Char* suffix )
-{
- Int32 ns = strlen(s);
- Int32 nx = strlen(suffix);
- if (ns < nx) return False;
- if (strcmp(s + ns - nx, suffix) == 0) return True;
- return False;
-}
-
-static
-Bool mapSuffix ( Char* name,
- Char* oldSuffix, Char* newSuffix )
-{
- if (!hasSuffix(name,oldSuffix)) return False;
- name[strlen(name)-strlen(oldSuffix)] = 0;
- strcat ( name, newSuffix );
- return True;
-}
-
-
-/*---------------------------------------------*/
-static
-void compress ( Char *name )
-{
- FILE *inStr;
- FILE *outStr;
- Int32 n, i;
-
- deleteOutputOnInterrupt = False;
-
- if (name == NULL && srcMode != SM_I2O)
- panic ( "compress: bad modes\n" );
-
- switch (srcMode) {
- case SM_I2O:
- copyFileName ( inName, "(stdin)" );
- copyFileName ( outName, "(stdout)" );
- break;
- case SM_F2F:
- copyFileName ( inName, name );
- copyFileName ( outName, name );
- strcat ( outName, ".bz2" );
- break;
- case SM_F2O:
- copyFileName ( inName, name );
- copyFileName ( outName, "(stdout)" );
- break;
- }
-
- if ( srcMode != SM_I2O && containsDubiousChars ( inName ) ) {
- if (noisy)
- fprintf ( stderr, "%s: There are no files matching `%s'.\n",
- progName, inName );
- setExit(1);
- return;
- }
- if ( srcMode != SM_I2O && !fileExists ( inName ) ) {
- fprintf ( stderr, "%s: Can't open input file %s: %s.\n",
- progName, inName, strerror(errno) );
- setExit(1);
- return;
- }
- for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++) {
- if (hasSuffix(inName, zSuffix[i])) {
- if (noisy)
- fprintf ( stderr,
- "%s: Input file %s already has %s suffix.\n",
- progName, inName, zSuffix[i] );
- setExit(1);
- return;
- }
- }
- if ( srcMode == SM_F2F && !forceOverwrite && notAStandardFile ( inName )) {
- if (noisy)
- fprintf ( stderr, "%s: Input file %s is not a normal file.\n",
- progName, inName );
- setExit(1);
- return;
- }
- if ( srcMode == SM_F2F && !forceOverwrite && fileExists ( outName ) ) {
- fprintf ( stderr, "%s: Output file %s already exists.\n",
- progName, outName );
- setExit(1);
- return;
- }
- if ( srcMode == SM_F2F && !forceOverwrite &&
- (n=countHardLinks ( inName )) > 0) {
- fprintf ( stderr, "%s: Input file %s has %d other link%s.\n",
- progName, inName, n, n > 1 ? "s" : "" );
- setExit(1);
- return;
- }
-
- switch ( srcMode ) {
-
- case SM_I2O:
- inStr = stdin;
- outStr = stdout;
- if ( isatty ( fileno ( stdout ) ) ) {
- fprintf ( stderr,
- "%s: I won't write compressed data to a terminal.\n",
- progName );
- fprintf ( stderr, "%s: For help, type: `%s --help'.\n",
- progName, progName );
- setExit(1);
- return;
- };
- break;
-
- case SM_F2O:
- inStr = fopen ( inName, "rb" );
- outStr = stdout;
- if ( isatty ( fileno ( stdout ) ) ) {
- fprintf ( stderr,
- "%s: I won't write compressed data to a terminal.\n",
- progName );
- fprintf ( stderr, "%s: For help, type: `%s --help'.\n",
- progName, progName );
- if ( inStr != NULL ) fclose ( inStr );
- setExit(1);
- return;
- };
- if ( inStr == NULL ) {
- fprintf ( stderr, "%s: Can't open input file %s: %s.\n",
- progName, inName, strerror(errno) );
- setExit(1);
- return;
- };
- break;
-
- case SM_F2F:
- inStr = fopen ( inName, "rb" );
- outStr = fopen ( outName, "wb" );
- if ( outStr == NULL) {
- fprintf ( stderr, "%s: Can't create output file %s: %s.\n",
- progName, outName, strerror(errno) );
- if ( inStr != NULL ) fclose ( inStr );
- setExit(1);
- return;
- }
- if ( inStr == NULL ) {
- fprintf ( stderr, "%s: Can't open input file %s: %s.\n",
- progName, inName, strerror(errno) );
- if ( outStr != NULL ) fclose ( outStr );
- setExit(1);
- return;
- };
- setInterimPermissions ( outName );
- break;
-
- default:
- panic ( "compress: bad srcMode" );
- break;
- }
-
- if (verbosity >= 1) {
- fprintf ( stderr, " %s: ", inName );
- pad ( inName );
- fflush ( stderr );
- }
-
- /*--- Now the input and output handles are sane. Do the Biz. ---*/
- outputHandleJustInCase = outStr;
- deleteOutputOnInterrupt = True;
- compressStream ( inStr, outStr );
- outputHandleJustInCase = NULL;
-
- /*--- If there was an I/O error, we won't get here. ---*/
- if ( srcMode == SM_F2F ) {
- copyDatePermissionsAndOwner ( inName, outName );
- deleteOutputOnInterrupt = False;
- if ( !keepInputFiles ) {
- IntNative retVal = remove ( inName );
- ERROR_IF_NOT_ZERO ( retVal );
- }
- }
-
- deleteOutputOnInterrupt = False;
-}
-
-
-/*---------------------------------------------*/
-static
-void uncompress ( Char *name )
-{
- FILE *inStr;
- FILE *outStr;
- Int32 n, i;
- Bool magicNumberOK;
- Bool cantGuess;
-
- deleteOutputOnInterrupt = False;
-
- if (name == NULL && srcMode != SM_I2O)
- panic ( "uncompress: bad modes\n" );
-
- cantGuess = False;
- switch (srcMode) {
- case SM_I2O:
- copyFileName ( inName, "(stdin)" );
- copyFileName ( outName, "(stdout)" );
- break;
- case SM_F2F:
- copyFileName ( inName, name );
- copyFileName ( outName, name );
- for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++)
- if (mapSuffix(outName,zSuffix[i],unzSuffix[i]))
- goto zzz;
- cantGuess = True;
- strcat ( outName, ".out" );
- break;
- case SM_F2O:
- copyFileName ( inName, name );
- copyFileName ( outName, "(stdout)" );
- break;
- }
-
- zzz:
- if ( srcMode != SM_I2O && containsDubiousChars ( inName ) ) {
- if (noisy)
- fprintf ( stderr, "%s: There are no files matching `%s'.\n",
- progName, inName );
- setExit(1);
- return;
- }
- if ( srcMode != SM_I2O && !fileExists ( inName ) ) {
- fprintf ( stderr, "%s: Can't open input file %s: %s.\n",
- progName, inName, strerror(errno) );
- setExit(1);
- return;
- }
- if ( srcMode == SM_F2F && !forceOverwrite && notAStandardFile ( inName )) {
- if (noisy)
- fprintf ( stderr, "%s: Input file %s is not a normal file.\n",
- progName, inName );
- setExit(1);
- return;
- }
- if ( /* srcMode == SM_F2F implied && */ cantGuess ) {
- if (noisy)
- fprintf ( stderr,
- "%s: Can't guess original name for %s -- using %s\n",
- progName, inName, outName );
- /* just a warning, no return */
- }
- if ( srcMode == SM_F2F && !forceOverwrite && fileExists ( outName ) ) {
- fprintf ( stderr, "%s: Output file %s already exists.\n",
- progName, outName );
- setExit(1);
- return;
- }
- if ( srcMode == SM_F2F && !forceOverwrite &&
- (n=countHardLinks ( inName ) ) > 0) {
- fprintf ( stderr, "%s: Input file %s has %d other link%s.\n",
- progName, inName, n, n > 1 ? "s" : "" );
- setExit(1);
- return;
- }
-
- switch ( srcMode ) {
-
- case SM_I2O:
- inStr = stdin;
- outStr = stdout;
- if ( isatty ( fileno ( stdin ) ) ) {
- fprintf ( stderr,
- "%s: I won't read compressed data from a terminal.\n",
- progName );
- fprintf ( stderr, "%s: For help, type: `%s --help'.\n",
- progName, progName );
- setExit(1);
- return;
- };
- break;
-
- case SM_F2O:
- inStr = fopen ( inName, "rb" );
- outStr = stdout;
- if ( inStr == NULL ) {
- fprintf ( stderr, "%s: Can't open input file %s:%s.\n",
- progName, inName, strerror(errno) );
- if ( inStr != NULL ) fclose ( inStr );
- setExit(1);
- return;
- };
- break;
-
- case SM_F2F:
- inStr = fopen ( inName, "rb" );
- outStr = fopen ( outName, "wb" );
- if ( outStr == NULL) {
- fprintf ( stderr, "%s: Can't create output file %s: %s.\n",
- progName, outName, strerror(errno) );
- if ( inStr != NULL ) fclose ( inStr );
- setExit(1);
- return;
- }
- if ( inStr == NULL ) {
- fprintf ( stderr, "%s: Can't open input file %s: %s.\n",
- progName, inName, strerror(errno) );
- if ( outStr != NULL ) fclose ( outStr );
- setExit(1);
- return;
- };
- setInterimPermissions ( outName );
- break;
-
- default:
- panic ( "uncompress: bad srcMode" );
- break;
- }
-
- if (verbosity >= 1) {
- fprintf ( stderr, " %s: ", inName );
- pad ( inName );
- fflush ( stderr );
- }
-
- /*--- Now the input and output handles are sane. Do the Biz. ---*/
- outputHandleJustInCase = outStr;
- deleteOutputOnInterrupt = True;
- magicNumberOK = uncompressStream ( inStr, outStr );
- outputHandleJustInCase = NULL;
-
- /*--- If there was an I/O error, we won't get here. ---*/
- if ( magicNumberOK ) {
- if ( srcMode == SM_F2F ) {
- copyDatePermissionsAndOwner ( inName, outName );
- deleteOutputOnInterrupt = False;
- if ( !keepInputFiles ) {
- IntNative retVal = remove ( inName );
- ERROR_IF_NOT_ZERO ( retVal );
- }
- }
- } else {
- unzFailsExist = True;
- deleteOutputOnInterrupt = False;
- if ( srcMode == SM_F2F ) {
- IntNative retVal = remove ( outName );
- ERROR_IF_NOT_ZERO ( retVal );
- }
- }
- deleteOutputOnInterrupt = False;
-
- if ( magicNumberOK ) {
- if (verbosity >= 1)
- fprintf ( stderr, "done\n" );
- } else {
- setExit(2);
- if (verbosity >= 1)
- fprintf ( stderr, "not a bzip2 file.\n" ); else
- fprintf ( stderr,
- "%s: %s is not a bzip2 file.\n",
- progName, inName );
- }
-
-}
-
-
-/*---------------------------------------------*/
-static
-void testf ( Char *name )
-{
- FILE *inStr;
- Bool allOK;
-
- deleteOutputOnInterrupt = False;
-
- if (name == NULL && srcMode != SM_I2O)
- panic ( "testf: bad modes\n" );
-
- copyFileName ( outName, "(none)" );
- switch (srcMode) {
- case SM_I2O: copyFileName ( inName, "(stdin)" ); break;
- case SM_F2F: copyFileName ( inName, name ); break;
- case SM_F2O: copyFileName ( inName, name ); break;
- }
-
- if ( srcMode != SM_I2O && containsDubiousChars ( inName ) ) {
- if (noisy)
- fprintf ( stderr, "%s: There are no files matching `%s'.\n",
- progName, inName );
- setExit(1);
- return;
- }
- if ( srcMode != SM_I2O && !fileExists ( inName ) ) {
- fprintf ( stderr, "%s: Can't open input %s: %s.\n",
- progName, inName, strerror(errno) );
- setExit(1);
- return;
- }
-
- switch ( srcMode ) {
-
- case SM_I2O:
- if ( isatty ( fileno ( stdin ) ) ) {
- fprintf ( stderr,
- "%s: I won't read compressed data from a terminal.\n",
- progName );
- fprintf ( stderr, "%s: For help, type: `%s --help'.\n",
- progName, progName );
- setExit(1);
- return;
- };
- inStr = stdin;
- break;
-
- case SM_F2O: case SM_F2F:
- inStr = fopen ( inName, "rb" );
- if ( inStr == NULL ) {
- fprintf ( stderr, "%s: Can't open input file %s:%s.\n",
- progName, inName, strerror(errno) );
- setExit(1);
- return;
- };
- break;
-
- default:
- panic ( "testf: bad srcMode" );
- break;
- }
-
- if (verbosity >= 1) {
- fprintf ( stderr, " %s: ", inName );
- pad ( inName );
- fflush ( stderr );
- }
-
- /*--- Now the input handle is sane. Do the Biz. ---*/
- allOK = testStream ( inStr );
-
- if (allOK && verbosity >= 1) fprintf ( stderr, "ok\n" );
- if (!allOK) testFailsExist = True;
-}
-
-
-/*---------------------------------------------*/
-static
-void license ( void )
-{
- fprintf ( stderr,
-
- "bzip2, a block-sorting file compressor. "
- "Version %s.\n"
- " \n"
- " Copyright (C) 1996-2000 by Julian Seward.\n"
- " \n"
- " This program is free software; you can redistribute it and/or modify\n"
- " it under the terms set out in the LICENSE file, which is included\n"
- " in the bzip2-1.0 source distribution.\n"
- " \n"
- " This program is distributed in the hope that it will be useful,\n"
- " but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
- " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
- " LICENSE file for more details.\n"
- " \n",
- BZ2_bzlibVersion()
- );
-}
-
-
-/*---------------------------------------------*/
-static
-void usage ( Char *fullProgName )
-{
- fprintf (
- stderr,
- "bzip2, a block-sorting file compressor. "
- "Version %s.\n"
- "\n usage: %s [flags and input files in any order]\n"
- "\n"
- " -h --help print this message\n"
- " -d --decompress force decompression\n"
- " -z --compress force compression\n"
- " -k --keep keep (don't delete) input files\n"
- " -f --force overwrite existing output files\n"
- " -t --test test compressed file integrity\n"
- " -c --stdout output to standard out\n"
- " -q --quiet suppress noncritical error messages\n"
- " -v --verbose be verbose (a 2nd -v gives more)\n"
- " -L --license display software version & license\n"
- " -V --version display software version & license\n"
- " -s --small use less memory (at most 2500k)\n"
- " -1 .. -9 set block size to 100k .. 900k\n"
- "\n"
- " If invoked as `bzip2', default action is to compress.\n"
- " as `bunzip2', default action is to decompress.\n"
- " as `bzcat', default action is to decompress to stdout.\n"
- "\n"
- " If no file names are given, bzip2 compresses or decompresses\n"
- " from standard input to standard output. You can combine\n"
- " short flags, so `-v -4' means the same as -v4 or -4v, &c.\n"
-#if BZ_UNIX
- "\n"
-#endif
- ,
-
- BZ2_bzlibVersion(),
- fullProgName
- );
-}
-
-
-/*---------------------------------------------*/
-static
-void redundant ( Char* flag )
-{
- fprintf (
- stderr,
- "%s: %s is redundant in versions 0.9.5 and above\n",
- progName, flag );
-}
-
-
-/*---------------------------------------------*/
-/*--
- All the garbage from here to main() is purely to
- implement a linked list of command-line arguments,
- into which main() copies argv[1 .. argc-1].
-
- The purpose of this exercise is to facilitate
- the expansion of wildcard characters * and ? in
- filenames for OSs which don't know how to do it
- themselves, like MSDOS, Windows 95 and NT.
-
- The actual Dirty Work is done by the platform-
- specific macro APPEND_FILESPEC.
---*/
-
-typedef
- struct zzzz {
- Char *name;
- struct zzzz *link;
- }
- Cell;
-
-
-/*---------------------------------------------*/
-static
-void *myMalloc ( Int32 n )
-{
- void* p;
-
- p = malloc ( (size_t)n );
- if (p == NULL) outOfMemory ();
- return p;
-}
-
-
-/*---------------------------------------------*/
-static
-Cell *mkCell ( void )
-{
- Cell *c;
-
- c = (Cell*) myMalloc ( sizeof ( Cell ) );
- c->name = NULL;
- c->link = NULL;
- return c;
-}
-
-
-/*---------------------------------------------*/
-static
-Cell *snocString ( Cell *root, Char *name )
-{
- if (root == NULL) {
- Cell *tmp = mkCell();
- tmp->name = (Char*) myMalloc ( 5 + strlen(name) );
- strcpy ( tmp->name, name );
- return tmp;
- } else {
- Cell *tmp = root;
- while (tmp->link != NULL) tmp = tmp->link;
- tmp->link = snocString ( tmp->link, name );
- return root;
- }
-}
-
-
-/*---------------------------------------------*/
-static
-void addFlagsFromEnvVar ( Cell** argList, Char* varName )
-{
- Int32 i, j, k;
- Char *envbase, *p;
-
- envbase = getenv(varName);
- if (envbase != NULL) {
- p = envbase;
- i = 0;
- while (True) {
- if (p[i] == 0) break;
- p += i;
- i = 0;
- while (isspace((Int32)(p[0]))) p++;
- while (p[i] != 0 && !isspace((Int32)(p[i]))) i++;
- if (i > 0) {
- k = i; if (k > FILE_NAME_LEN-10) k = FILE_NAME_LEN-10;
- for (j = 0; j < k; j++) tmpName[j] = p[j];
- tmpName[k] = 0;
- APPEND_FLAG(*argList, tmpName);
- }
- }
- }
-}
-
-
-/*---------------------------------------------*/
-#define ISFLAG(s) (strcmp(aa->name, (s))==0)
-
-IntNative main ( IntNative argc, Char *argv[] )
-{
- Int32 i, j;
- Char *tmp;
- Cell *argList;
- Cell *aa;
- Bool decode;
-
- /*-- Be really really really paranoid :-) --*/
- if (sizeof(Int32) != 4 || sizeof(UInt32) != 4 ||
- sizeof(Int16) != 2 || sizeof(UInt16) != 2 ||
- sizeof(Char) != 1 || sizeof(UChar) != 1)
- configError();
-
- /*-- Initialise --*/
- outputHandleJustInCase = NULL;
- smallMode = False;
- keepInputFiles = False;
- forceOverwrite = False;
- noisy = True;
- verbosity = 0;
- blockSize100k = 9;
- testFailsExist = False;
- unzFailsExist = False;
- numFileNames = 0;
- numFilesProcessed = 0;
- workFactor = 30;
- deleteOutputOnInterrupt = False;
- exitValue = 0;
- i = j = 0; /* avoid bogus warning from egcs-1.1.X */
-
- /*-- Set up signal handlers for mem access errors --*/
- signal (SIGSEGV, mySIGSEGVorSIGBUScatcher);
-#if BZ_UNIX
-#ifndef __DJGPP__
- signal (SIGBUS, mySIGSEGVorSIGBUScatcher);
-#endif
-#endif
-
- copyFileName ( inName, "(none)" );
- copyFileName ( outName, "(none)" );
-
- copyFileName ( progNameReally, argv[0] );
- progName = &progNameReally[0];
- for (tmp = &progNameReally[0]; *tmp != '\0'; tmp++)
- if (*tmp == PATH_SEP) progName = tmp + 1;
-
-
- /*-- Copy flags from env var BZIP2, and
- expand filename wildcards in arg list.
- --*/
- argList = NULL;
- addFlagsFromEnvVar ( &argList, "BZIP2" );
- addFlagsFromEnvVar ( &argList, "BZIP" );
- for (i = 1; i <= argc-1; i++)
- APPEND_FILESPEC(argList, argv[i]);
-
-
- /*-- Find the length of the longest filename --*/
- longestFileName = 7;
- numFileNames = 0;
- decode = True;
- for (aa = argList; aa != NULL; aa = aa->link) {
- if (ISFLAG("--")) { decode = False; continue; }
- if (aa->name[0] == '-' && decode) continue;
- numFileNames++;
- if (longestFileName < (Int32)strlen(aa->name) )
- longestFileName = (Int32)strlen(aa->name);
- }
-
-
- /*-- Determine source modes; flag handling may change this too. --*/
- if (numFileNames == 0)
- srcMode = SM_I2O; else srcMode = SM_F2F;
-
-
- /*-- Determine what to do (compress/uncompress/test/cat). --*/
- /*-- Note that subsequent flag handling may change this. --*/
- opMode = OM_Z;
-
- if ( (strstr ( progName, "unzip" ) != 0) ||
- (strstr ( progName, "UNZIP" ) != 0) )
- opMode = OM_UNZ;
-
- if ( (strstr ( progName, "z2cat" ) != 0) ||
- (strstr ( progName, "Z2CAT" ) != 0) ||
- (strstr ( progName, "zcat" ) != 0) ||
- (strstr ( progName, "ZCAT" ) != 0) ) {
- opMode = OM_UNZ;
- srcMode = (numFileNames == 0) ? SM_I2O : SM_F2O;
- }
-
-
- /*-- Look at the flags. --*/
- for (aa = argList; aa != NULL; aa = aa->link) {
- if (ISFLAG("--")) break;
- if (aa->name[0] == '-' && aa->name[1] != '-') {
- for (j = 1; aa->name[j] != '\0'; j++) {
- switch (aa->name[j]) {
- case 'c': srcMode = SM_F2O; break;
- case 'd': opMode = OM_UNZ; break;
- case 'z': opMode = OM_Z; break;
- case 'f': forceOverwrite = True; break;
- case 't': opMode = OM_TEST; break;
- case 'k': keepInputFiles = True; break;
- case 's': smallMode = True; break;
- case 'q': noisy = False; break;
- case '1': blockSize100k = 1; break;
- case '2': blockSize100k = 2; break;
- case '3': blockSize100k = 3; break;
- case '4': blockSize100k = 4; break;
- case '5': blockSize100k = 5; break;
- case '6': blockSize100k = 6; break;
- case '7': blockSize100k = 7; break;
- case '8': blockSize100k = 8; break;
- case '9': blockSize100k = 9; break;
- case 'V':
- case 'L': license(); break;
- case 'v': verbosity++; break;
- case 'h': usage ( progName );
- exit ( 0 );
- break;
- default: fprintf ( stderr, "%s: Bad flag `%s'\n",
- progName, aa->name );
- usage ( progName );
- exit ( 1 );
- break;
- }
- }
- }
- }
-
- /*-- And again ... --*/
- for (aa = argList; aa != NULL; aa = aa->link) {
- if (ISFLAG("--")) break;
- if (ISFLAG("--stdout")) srcMode = SM_F2O; else
- if (ISFLAG("--decompress")) opMode = OM_UNZ; else
- if (ISFLAG("--compress")) opMode = OM_Z; else
- if (ISFLAG("--force")) forceOverwrite = True; else
- if (ISFLAG("--test")) opMode = OM_TEST; else
- if (ISFLAG("--keep")) keepInputFiles = True; else
- if (ISFLAG("--small")) smallMode = True; else
- if (ISFLAG("--quiet")) noisy = False; else
- if (ISFLAG("--version")) license(); else
- if (ISFLAG("--license")) license(); else
- if (ISFLAG("--exponential")) workFactor = 1; else
- if (ISFLAG("--repetitive-best")) redundant(aa->name); else
- if (ISFLAG("--repetitive-fast")) redundant(aa->name); else
- if (ISFLAG("--verbose")) verbosity++; else
- if (ISFLAG("--help")) { usage ( progName ); exit ( 0 ); }
- else
- if (strncmp ( aa->name, "--", 2) == 0) {
- fprintf ( stderr, "%s: Bad flag `%s'\n", progName, aa->name );
- usage ( progName );
- exit ( 1 );
- }
- }
-
- if (verbosity > 4) verbosity = 4;
- if (opMode == OM_Z && smallMode && blockSize100k > 2)
- blockSize100k = 2;
-
- if (opMode == OM_TEST && srcMode == SM_F2O) {
- fprintf ( stderr, "%s: -c and -t cannot be used together.\n",
- progName );
- exit ( 1 );
- }
-
- if (srcMode == SM_F2O && numFileNames == 0)
- srcMode = SM_I2O;
-
- if (opMode != OM_Z) blockSize100k = 0;
-
- if (srcMode == SM_F2F) {
- signal (SIGINT, mySignalCatcher);
- signal (SIGTERM, mySignalCatcher);
-# if BZ_UNIX
- signal (SIGHUP, mySignalCatcher);
-# endif
- }
-
- if (opMode == OM_Z) {
- if (srcMode == SM_I2O) {
- compress ( NULL );
- } else {
- decode = True;
- for (aa = argList; aa != NULL; aa = aa->link) {
- if (ISFLAG("--")) { decode = False; continue; }
- if (aa->name[0] == '-' && decode) continue;
- numFilesProcessed++;
- compress ( aa->name );
- }
- }
- }
- else
-
- if (opMode == OM_UNZ) {
- unzFailsExist = False;
- if (srcMode == SM_I2O) {
- uncompress ( NULL );
- } else {
- decode = True;
- for (aa = argList; aa != NULL; aa = aa->link) {
- if (ISFLAG("--")) { decode = False; continue; }
- if (aa->name[0] == '-' && decode) continue;
- numFilesProcessed++;
- uncompress ( aa->name );
- }
- }
- if (unzFailsExist) {
- setExit(2);
- exit(exitValue);
- }
- }
-
- else {
- testFailsExist = False;
- if (srcMode == SM_I2O) {
- testf ( NULL );
- } else {
- decode = True;
- for (aa = argList; aa != NULL; aa = aa->link) {
- if (ISFLAG("--")) { decode = False; continue; }
- if (aa->name[0] == '-' && decode) continue;
- numFilesProcessed++;
- testf ( aa->name );
- }
- }
- if (testFailsExist && noisy) {
- fprintf ( stderr,
- "\n"
- "You can use the `bzip2recover' program to attempt to recover\n"
- "data from undamaged sections of corrupted files.\n\n"
- );
- setExit(2);
- exit(exitValue);
- }
- }
-
- /* Free the argument list memory to mollify leak detectors
- (eg) Purify, Checker. Serves no other useful purpose.
- */
- aa = argList;
- while (aa != NULL) {
- Cell* aa2 = aa->link;
- if (aa->name != NULL) free(aa->name);
- free(aa);
- aa = aa2;
- }
-
- return exitValue;
-}
-
-
-/*-----------------------------------------------------------*/
-/*--- end bzip2.c ---*/
-/*-----------------------------------------------------------*/
diff --git a/winsup/bz2lib/bzip2.txt b/winsup/bz2lib/bzip2.txt
deleted file mode 100644
index 4f1ae8620..000000000
--- a/winsup/bz2lib/bzip2.txt
+++ /dev/null
@@ -1,376 +0,0 @@
-
-
-NAME
- bzip2, bunzip2 - a block-sorting file compressor, v1.0
- bzcat - decompresses files to stdout
- bzip2recover - recovers data from damaged bzip2 files
-
-
-SYNOPSIS
- bzip2 [ -cdfkqstvzVL123456789 ] [ filenames ... ]
- bunzip2 [ -fkvsVL ] [ filenames ... ]
- bzcat [ -s ] [ filenames ... ]
- bzip2recover filename
-
-
-DESCRIPTION
- bzip2 compresses files using the Burrows-Wheeler block
- sorting text compression algorithm, and Huffman coding.
- Compression is generally considerably better than that
- achieved by more conventional LZ77/LZ78-based compressors,
- and approaches the performance of the PPM family of sta-
- tistical compressors.
-
- The command-line options are deliberately very similar to
- those of GNU gzip, but they are not identical.
-
- bzip2 expects a list of file names to accompany the com-
- mand-line flags. Each file is replaced by a compressed
- version of itself, with the name "original_name.bz2".
- Each compressed file has the same modification date, per-
- missions, and, when possible, ownership as the correspond-
- ing original, so that these properties can be correctly
- restored at decompression time. File name handling is
- naive in the sense that there is no mechanism for preserv-
- ing original file names, permissions, ownerships or dates
- in filesystems which lack these concepts, or have serious
- file name length restrictions, such as MS-DOS.
-
- bzip2 and bunzip2 will by default not overwrite existing
- files. If you want this to happen, specify the -f flag.
-
- If no file names are specified, bzip2 compresses from
- standard input to standard output. In this case, bzip2
- will decline to write compressed output to a terminal, as
- this would be entirely incomprehensible and therefore
- pointless.
-
- bunzip2 (or bzip2 -d) decompresses all specified files.
- Files which were not created by bzip2 will be detected and
- ignored, and a warning issued. bzip2 attempts to guess
- the filename for the decompressed file from that of the
- compressed file as follows:
-
- filename.bz2 becomes filename
- filename.bz becomes filename
- filename.tbz2 becomes filename.tar
- filename.tbz becomes filename.tar
- anyothername becomes anyothername.out
-
- If the file does not end in one of the recognised endings,
- .bz2, .bz, .tbz2 or .tbz, bzip2 complains that it cannot
- guess the name of the original file, and uses the original
- name with .out appended.
-
- As with compression, supplying no filenames causes decom-
- pression from standard input to standard output.
-
- bunzip2 will correctly decompress a file which is the con-
- catenation of two or more compressed files. The result is
- the concatenation of the corresponding uncompressed files.
- Integrity testing (-t) of concatenated compressed files is
- also supported.
-
- You can also compress or decompress files to the standard
- output by giving the -c flag. Multiple files may be com-
- pressed and decompressed like this. The resulting outputs
- are fed sequentially to stdout. Compression of multiple
- files in this manner generates a stream containing multi-
- ple compressed file representations. Such a stream can be
- decompressed correctly only by bzip2 version 0.9.0 or
- later. Earlier versions of bzip2 will stop after decom-
- pressing the first file in the stream.
-
- bzcat (or bzip2 -dc) decompresses all specified files to
- the standard output.
-
- bzip2 will read arguments from the environment variables
- BZIP2 and BZIP, in that order, and will process them
- before any arguments read from the command line. This
- gives a convenient way to supply default arguments.
-
- Compression is always performed, even if the compressed
- file is slightly larger than the original. Files of less
- than about one hundred bytes tend to get larger, since the
- compression mechanism has a constant overhead in the
- region of 50 bytes. Random data (including the output of
- most file compressors) is coded at about 8.05 bits per
- byte, giving an expansion of around 0.5%.
-
- As a self-check for your protection, bzip2 uses 32-bit
- CRCs to make sure that the decompressed version of a file
- is identical to the original. This guards against corrup-
- tion of the compressed data, and against undetected bugs
- in bzip2 (hopefully very unlikely). The chances of data
- corruption going undetected is microscopic, about one
- chance in four billion for each file processed. Be aware,
- though, that the check occurs upon decompression, so it
- can only tell you that something is wrong. It can't help
- you recover the original uncompressed data. You can use
- bzip2recover to try to recover data from damaged files.
-
- Return values: 0 for a normal exit, 1 for environmental
- problems (file not found, invalid flags, I/O errors, &c),
- 2 to indicate a corrupt compressed file, 3 for an internal
- consistency error (eg, bug) which caused bzip2 to panic.
-
-
-OPTIONS
- -c --stdout
- Compress or decompress to standard output.
-
- -d --decompress
- Force decompression. bzip2, bunzip2 and bzcat are
- really the same program, and the decision about
- what actions to take is done on the basis of which
- name is used. This flag overrides that mechanism,
- and forces bzip2 to decompress.
-
- -z --compress
- The complement to -d: forces compression, regard-
- less of the invokation name.
-
- -t --test
- Check integrity of the specified file(s), but don't
- decompress them. This really performs a trial
- decompression and throws away the result.
-
- -f --force
- Force overwrite of output files. Normally, bzip2
- will not overwrite existing output files. Also
- forces bzip2 to break hard links to files, which it
- otherwise wouldn't do.
-
- -k --keep
- Keep (don't delete) input files during compression
- or decompression.
-
- -s --small
- Reduce memory usage, for compression, decompression
- and testing. Files are decompressed and tested
- using a modified algorithm which only requires 2.5
- bytes per block byte. This means any file can be
- decompressed in 2300k of memory, albeit at about
- half the normal speed.
-
- During compression, -s selects a block size of
- 200k, which limits memory use to around the same
- figure, at the expense of your compression ratio.
- In short, if your machine is low on memory (8
- megabytes or less), use -s for everything. See
- MEMORY MANAGEMENT below.
-
- -q --quiet
- Suppress non-essential warning messages. Messages
- pertaining to I/O errors and other critical events
- will not be suppressed.
-
- -v --verbose
- Verbose mode -- show the compression ratio for each
- file processed. Further -v's increase the ver-
- bosity level, spewing out lots of information which
- is primarily of interest for diagnostic purposes.
-
- -L --license -V --version
- Display the software version, license terms and
- conditions.
-
- -1 to -9
- Set the block size to 100 k, 200 k .. 900 k when
- compressing. Has no effect when decompressing.
- See MEMORY MANAGEMENT below.
-
- -- Treats all subsequent arguments as file names, even
- if they start with a dash. This is so you can han-
- dle files with names beginning with a dash, for
- example: bzip2 -- -myfilename.
-
- --repetitive-fast --repetitive-best
- These flags are redundant in versions 0.9.5 and
- above. They provided some coarse control over the
- behaviour of the sorting algorithm in earlier ver-
- sions, which was sometimes useful. 0.9.5 and above
- have an improved algorithm which renders these
- flags irrelevant.
-
-
-MEMORY MANAGEMENT
- bzip2 compresses large files in blocks. The block size
- affects both the compression ratio achieved, and the
- amount of memory needed for compression and decompression.
- The flags -1 through -9 specify the block size to be
- 100,000 bytes through 900,000 bytes (the default) respec-
- tively. At decompression time, the block size used for
- compression is read from the header of the compressed
- file, and bunzip2 then allocates itself just enough memory
- to decompress the file. Since block sizes are stored in
- compressed files, it follows that the flags -1 to -9 are
- irrelevant to and so ignored during decompression.
-
- Compression and decompression requirements, in bytes, can
- be estimated as:
-
- Compression: 400k + ( 8 x block size )
-
- Decompression: 100k + ( 4 x block size ), or
- 100k + ( 2.5 x block size )
-
- Larger block sizes give rapidly diminishing marginal
- returns. Most of the compression comes from the first two
- or three hundred k of block size, a fact worth bearing in
- mind when using bzip2 on small machines. It is also
- important to appreciate that the decompression memory
- requirement is set at compression time by the choice of
- block size.
-
- For files compressed with the default 900k block size,
- bunzip2 will require about 3700 kbytes to decompress. To
- support decompression of any file on a 4 megabyte machine,
- bunzip2 has an option to decompress using approximately
- half this amount of memory, about 2300 kbytes. Decompres-
- sion speed is also halved, so you should use this option
- only where necessary. The relevant flag is -s.
-
- In general, try and use the largest block size memory con-
- straints allow, since that maximises the compression
- achieved. Compression and decompression speed are virtu-
- ally unaffected by block size.
-
- Another significant point applies to files which fit in a
- single block -- that means most files you'd encounter
- using a large block size. The amount of real memory
- touched is proportional to the size of the file, since the
- file is smaller than a block. For example, compressing a
- file 20,000 bytes long with the flag -9 will cause the
- compressor to allocate around 7600k of memory, but only
- touch 400k + 20000 * 8 = 560 kbytes of it. Similarly, the
- decompressor will allocate 3700k but only touch 100k +
- 20000 * 4 = 180 kbytes.
-
- Here is a table which summarises the maximum memory usage
- for different block sizes. Also recorded is the total
- compressed size for 14 files of the Calgary Text Compres-
- sion Corpus totalling 3,141,622 bytes. This column gives
- some feel for how compression varies with block size.
- These figures tend to understate the advantage of larger
- block sizes for larger files, since the Corpus is domi-
- nated by smaller files.
-
- Compress Decompress Decompress Corpus
- Flag usage usage -s usage Size
-
- -1 1200k 500k 350k 914704
- -2 2000k 900k 600k 877703
- -3 2800k 1300k 850k 860338
- -4 3600k 1700k 1100k 846899
- -5 4400k 2100k 1350k 845160
- -6 5200k 2500k 1600k 838626
- -7 6100k 2900k 1850k 834096
- -8 6800k 3300k 2100k 828642
- -9 7600k 3700k 2350k 828642
-
-
-RECOVERING DATA FROM DAMAGED FILES
- bzip2 compresses files in blocks, usually 900kbytes long.
- Each block is handled independently. If a media or trans-
- mission error causes a multi-block .bz2 file to become
- damaged, it may be possible to recover data from the
- undamaged blocks in the file.
-
- The compressed representation of each block is delimited
- by a 48-bit pattern, which makes it possible to find the
- block boundaries with reasonable certainty. Each block
- also carries its own 32-bit CRC, so damaged blocks can be
- distinguished from undamaged ones.
-
- bzip2recover is a simple program whose purpose is to
- search for blocks in .bz2 files, and write each block out
- into its own .bz2 file. You can then use bzip2 -t to test
- the integrity of the resulting files, and decompress those
- which are undamaged.
-
- bzip2recover takes a single argument, the name of the dam-
- aged file, and writes a number of files "rec0001file.bz2",
- "rec0002file.bz2", etc, containing the extracted blocks.
- The output filenames are designed so that the use of
- wildcards in subsequent processing -- for example, "bzip2
- -dc rec*file.bz2 > recovered_data" -- lists the files in
- the correct order.
-
- bzip2recover should be of most use dealing with large .bz2
- files, as these will contain many blocks. It is clearly
- futile to use it on damaged single-block files, since a
- damaged block cannot be recovered. If you wish to min-
- imise any potential data loss through media or transmis-
- sion errors, you might consider compressing with a smaller
- block size.
-
-
-PERFORMANCE NOTES
- The sorting phase of compression gathers together similar
- strings in the file. Because of this, files containing
- very long runs of repeated symbols, like "aabaabaabaab
- ..." (repeated several hundred times) may compress more
- slowly than normal. Versions 0.9.5 and above fare much
- better than previous versions in this respect. The ratio
- between worst-case and average-case compression time is in
- the region of 10:1. For previous versions, this figure
- was more like 100:1. You can use the -vvvv option to mon-
- itor progress in great detail, if you want.
-
- Decompression speed is unaffected by these phenomena.
-
- bzip2 usually allocates several megabytes of memory to
- operate in, and then charges all over it in a fairly ran-
- dom fashion. This means that performance, both for com-
- pressing and decompressing, is largely determined by the
- speed at which your machine can service cache misses.
- Because of this, small changes to the code to reduce the
- miss rate have been observed to give disproportionately
- large performance improvements. I imagine bzip2 will per-
- form best on machines with very large caches.
-
-
-CAVEATS
- I/O error messages are not as helpful as they could be.
- bzip2 tries hard to detect I/O errors and exit cleanly,
- but the details of what the problem is sometimes seem
- rather misleading.
-
- This manual page pertains to version 1.0 of bzip2. Com-
- pressed data created by this version is entirely forwards
- and backwards compatible with the previous public
- releases, versions 0.1pl2, 0.9.0 and 0.9.5, but with the
- following exception: 0.9.0 and above can correctly decom-
- press multiple concatenated compressed files. 0.1pl2 can-
- not do this; it will stop after decompressing just the
- first file in the stream.
-
- bzip2recover uses 32-bit integers to represent bit posi-
- tions in compressed files, so it cannot handle compressed
- files more than 512 megabytes long. This could easily be
- fixed.
-
-
-AUTHOR
- Julian Seward, jseward@acm.org.
-
- http://sourceware.cygnus.com/bzip2
- http://www.muraroa.demon.co.uk
-
- The ideas embodied in bzip2 are due to (at least) the fol-
- lowing people: Michael Burrows and David Wheeler (for the
- block sorting transformation), David Wheeler (again, for
- the Huffman coder), Peter Fenwick (for the structured cod-
- ing model in the original bzip, and many refinements), and
- Alistair Moffat, Radford Neal and Ian Witten (for the
- arithmetic coder in the original bzip). I am much
- indebted for their help, support and advice. See the man-
- ual in the source distribution for pointers to sources of
- documentation. Christian von Roques encouraged me to look
- for faster sorting algorithms, so as to speed up compres-
- sion. Bela Lubkin encouraged me to improve the worst-case
- compression performance. Many people sent patches, helped
- with portability problems, lent machines, gave advice and
- were generally helpful.
-
diff --git a/winsup/bz2lib/bzip2recover.c b/winsup/bz2lib/bzip2recover.c
deleted file mode 100644
index ba3d17563..000000000
--- a/winsup/bz2lib/bzip2recover.c
+++ /dev/null
@@ -1,435 +0,0 @@
-
-/*-----------------------------------------------------------*/
-/*--- Block recoverer program for bzip2 ---*/
-/*--- bzip2recover.c ---*/
-/*-----------------------------------------------------------*/
-
-/*--
- This program is bzip2recover, a program to attempt data
- salvage from damaged files created by the accompanying
- bzip2-1.0 program.
-
- Copyright (C) 1996-2000 Julian R Seward. 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. The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 3. Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-
- 4. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
-
- Julian Seward, Cambridge, UK.
- jseward@acm.org
- bzip2/libbzip2 version 1.0 of 21 March 2000
---*/
-
-/*--
- This program is a complete hack and should be rewritten
- properly. It isn't very complicated.
---*/
-
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-typedef unsigned int UInt32;
-typedef int Int32;
-typedef unsigned char UChar;
-typedef char Char;
-typedef unsigned char Bool;
-#define True ((Bool)1)
-#define False ((Bool)0)
-
-
-Char inFileName[2000];
-Char outFileName[2000];
-Char progName[2000];
-
-UInt32 bytesOut = 0;
-UInt32 bytesIn = 0;
-
-
-/*---------------------------------------------------*/
-/*--- I/O errors ---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------*/
-void readError ( void )
-{
- fprintf ( stderr,
- "%s: I/O error reading `%s', possible reason follows.\n",
- progName, inFileName );
- perror ( progName );
- fprintf ( stderr, "%s: warning: output file(s) may be incomplete.\n",
- progName );
- exit ( 1 );
-}
-
-
-/*---------------------------------------------*/
-void writeError ( void )
-{
- fprintf ( stderr,
- "%s: I/O error reading `%s', possible reason follows.\n",
- progName, inFileName );
- perror ( progName );
- fprintf ( stderr, "%s: warning: output file(s) may be incomplete.\n",
- progName );
- exit ( 1 );
-}
-
-
-/*---------------------------------------------*/
-void mallocFail ( Int32 n )
-{
- fprintf ( stderr,
- "%s: malloc failed on request for %d bytes.\n",
- progName, n );
- fprintf ( stderr, "%s: warning: output file(s) may be incomplete.\n",
- progName );
- exit ( 1 );
-}
-
-
-/*---------------------------------------------------*/
-/*--- Bit stream I/O ---*/
-/*---------------------------------------------------*/
-
-typedef
- struct {
- FILE* handle;
- Int32 buffer;
- Int32 buffLive;
- Char mode;
- }
- BitStream;
-
-
-/*---------------------------------------------*/
-BitStream* bsOpenReadStream ( FILE* stream )
-{
- BitStream *bs = malloc ( sizeof(BitStream) );
- if (bs == NULL) mallocFail ( sizeof(BitStream) );
- bs->handle = stream;
- bs->buffer = 0;
- bs->buffLive = 0;
- bs->mode = 'r';
- return bs;
-}
-
-
-/*---------------------------------------------*/
-BitStream* bsOpenWriteStream ( FILE* stream )
-{
- BitStream *bs = malloc ( sizeof(BitStream) );
- if (bs == NULL) mallocFail ( sizeof(BitStream) );
- bs->handle = stream;
- bs->buffer = 0;
- bs->buffLive = 0;
- bs->mode = 'w';
- return bs;
-}
-
-
-/*---------------------------------------------*/
-void bsPutBit ( BitStream* bs, Int32 bit )
-{
- if (bs->buffLive == 8) {
- Int32 retVal = putc ( (UChar) bs->buffer, bs->handle );
- if (retVal == EOF) writeError();
- bytesOut++;
- bs->buffLive = 1;
- bs->buffer = bit & 0x1;
- } else {
- bs->buffer = ( (bs->buffer << 1) | (bit & 0x1) );
- bs->buffLive++;
- };
-}
-
-
-/*---------------------------------------------*/
-/*--
- Returns 0 or 1, or 2 to indicate EOF.
---*/
-Int32 bsGetBit ( BitStream* bs )
-{
- if (bs->buffLive > 0) {
- bs->buffLive --;
- return ( ((bs->buffer) >> (bs->buffLive)) & 0x1 );
- } else {
- Int32 retVal = getc ( bs->handle );
- if ( retVal == EOF ) {
- if (errno != 0) readError();
- return 2;
- }
- bs->buffLive = 7;
- bs->buffer = retVal;
- return ( ((bs->buffer) >> 7) & 0x1 );
- }
-}
-
-
-/*---------------------------------------------*/
-void bsClose ( BitStream* bs )
-{
- Int32 retVal;
-
- if ( bs->mode == 'w' ) {
- while ( bs->buffLive < 8 ) {
- bs->buffLive++;
- bs->buffer <<= 1;
- };
- retVal = putc ( (UChar) (bs->buffer), bs->handle );
- if (retVal == EOF) writeError();
- bytesOut++;
- retVal = fflush ( bs->handle );
- if (retVal == EOF) writeError();
- }
- retVal = fclose ( bs->handle );
- if (retVal == EOF) {
- if (bs->mode == 'w') writeError(); else readError();
- }
- free ( bs );
-}
-
-
-/*---------------------------------------------*/
-void bsPutUChar ( BitStream* bs, UChar c )
-{
- Int32 i;
- for (i = 7; i >= 0; i--)
- bsPutBit ( bs, (((UInt32) c) >> i) & 0x1 );
-}
-
-
-/*---------------------------------------------*/
-void bsPutUInt32 ( BitStream* bs, UInt32 c )
-{
- Int32 i;
-
- for (i = 31; i >= 0; i--)
- bsPutBit ( bs, (c >> i) & 0x1 );
-}
-
-
-/*---------------------------------------------*/
-Bool endsInBz2 ( Char* name )
-{
- Int32 n = strlen ( name );
- if (n <= 4) return False;
- return
- (name[n-4] == '.' &&
- name[n-3] == 'b' &&
- name[n-2] == 'z' &&
- name[n-1] == '2');
-}
-
-
-/*---------------------------------------------------*/
-/*--- ---*/
-/*---------------------------------------------------*/
-
-#define BLOCK_HEADER_HI 0x00003141UL
-#define BLOCK_HEADER_LO 0x59265359UL
-
-#define BLOCK_ENDMARK_HI 0x00001772UL
-#define BLOCK_ENDMARK_LO 0x45385090UL
-
-
-UInt32 bStart[20000];
-UInt32 bEnd[20000];
-UInt32 rbStart[20000];
-UInt32 rbEnd[20000];
-
-Int32 main ( Int32 argc, Char** argv )
-{
- FILE* inFile;
- FILE* outFile;
- BitStream* bsIn, *bsWr;
- Int32 currBlock, b, wrBlock;
- UInt32 bitsRead;
- Int32 rbCtr;
-
-
- UInt32 buffHi, buffLo, blockCRC;
- Char* p;
-
- strcpy ( progName, argv[0] );
- inFileName[0] = outFileName[0] = 0;
-
- fprintf ( stderr, "bzip2recover 1.0: extracts blocks from damaged .bz2 files.\n" );
-
- if (argc != 2) {
- fprintf ( stderr, "%s: usage is `%s damaged_file_name'.\n",
- progName, progName );
- exit(1);
- }
-
- strcpy ( inFileName, argv[1] );
-
- inFile = fopen ( inFileName, "rb" );
- if (inFile == NULL) {
- fprintf ( stderr, "%s: can't read `%s'\n", progName, inFileName );
- exit(1);
- }
-
- bsIn = bsOpenReadStream ( inFile );
- fprintf ( stderr, "%s: searching for block boundaries ...\n", progName );
-
- bitsRead = 0;
- buffHi = buffLo = 0;
- currBlock = 0;
- bStart[currBlock] = 0;
-
- rbCtr = 0;
-
- while (True) {
- b = bsGetBit ( bsIn );
- bitsRead++;
- if (b == 2) {
- if (bitsRead >= bStart[currBlock] &&
- (bitsRead - bStart[currBlock]) >= 40) {
- bEnd[currBlock] = bitsRead-1;
- if (currBlock > 0)
- fprintf ( stderr, " block %d runs from %d to %d (incomplete)\n",
- currBlock, bStart[currBlock], bEnd[currBlock] );
- } else
- currBlock--;
- break;
- }
- buffHi = (buffHi << 1) | (buffLo >> 31);
- buffLo = (buffLo << 1) | (b & 1);
- if ( ( (buffHi & 0x0000ffff) == BLOCK_HEADER_HI
- && buffLo == BLOCK_HEADER_LO)
- ||
- ( (buffHi & 0x0000ffff) == BLOCK_ENDMARK_HI
- && buffLo == BLOCK_ENDMARK_LO)
- ) {
- if (bitsRead > 49)
- bEnd[currBlock] = bitsRead-49; else
- bEnd[currBlock] = 0;
- if (currBlock > 0 &&
- (bEnd[currBlock] - bStart[currBlock]) >= 130) {
- fprintf ( stderr, " block %d runs from %d to %d\n",
- rbCtr+1, bStart[currBlock], bEnd[currBlock] );
- rbStart[rbCtr] = bStart[currBlock];
- rbEnd[rbCtr] = bEnd[currBlock];
- rbCtr++;
- }
- currBlock++;
-
- bStart[currBlock] = bitsRead;
- }
- }
-
- bsClose ( bsIn );
-
- /*-- identified blocks run from 1 to rbCtr inclusive. --*/
-
- if (rbCtr < 1) {
- fprintf ( stderr,
- "%s: sorry, I couldn't find any block boundaries.\n",
- progName );
- exit(1);
- };
-
- fprintf ( stderr, "%s: splitting into blocks\n", progName );
-
- inFile = fopen ( inFileName, "rb" );
- if (inFile == NULL) {
- fprintf ( stderr, "%s: can't open `%s'\n", progName, inFileName );
- exit(1);
- }
- bsIn = bsOpenReadStream ( inFile );
-
- /*-- placate gcc's dataflow analyser --*/
- blockCRC = 0; bsWr = 0;
-
- bitsRead = 0;
- outFile = NULL;
- wrBlock = 0;
- while (True) {
- b = bsGetBit(bsIn);
- if (b == 2) break;
- buffHi = (buffHi << 1) | (buffLo >> 31);
- buffLo = (buffLo << 1) | (b & 1);
- if (bitsRead == 47+rbStart[wrBlock])
- blockCRC = (buffHi << 16) | (buffLo >> 16);
-
- if (outFile != NULL && bitsRead >= rbStart[wrBlock]
- && bitsRead <= rbEnd[wrBlock]) {
- bsPutBit ( bsWr, b );
- }
-
- bitsRead++;
-
- if (bitsRead == rbEnd[wrBlock]+1) {
- if (outFile != NULL) {
- bsPutUChar ( bsWr, 0x17 ); bsPutUChar ( bsWr, 0x72 );
- bsPutUChar ( bsWr, 0x45 ); bsPutUChar ( bsWr, 0x38 );
- bsPutUChar ( bsWr, 0x50 ); bsPutUChar ( bsWr, 0x90 );
- bsPutUInt32 ( bsWr, blockCRC );
- bsClose ( bsWr );
- }
- if (wrBlock >= rbCtr) break;
- wrBlock++;
- } else
- if (bitsRead == rbStart[wrBlock]) {
- outFileName[0] = 0;
- sprintf ( outFileName, "rec%4d", wrBlock+1 );
- for (p = outFileName; *p != 0; p++) if (*p == ' ') *p = '0';
- strcat ( outFileName, inFileName );
- if ( !endsInBz2(outFileName)) strcat ( outFileName, ".bz2" );
-
- fprintf ( stderr, " writing block %d to `%s' ...\n",
- wrBlock+1, outFileName );
-
- outFile = fopen ( outFileName, "wb" );
- if (outFile == NULL) {
- fprintf ( stderr, "%s: can't write `%s'\n",
- progName, outFileName );
- exit(1);
- }
- bsWr = bsOpenWriteStream ( outFile );
- bsPutUChar ( bsWr, 'B' ); bsPutUChar ( bsWr, 'Z' );
- bsPutUChar ( bsWr, 'h' ); bsPutUChar ( bsWr, '9' );
- bsPutUChar ( bsWr, 0x31 ); bsPutUChar ( bsWr, 0x41 );
- bsPutUChar ( bsWr, 0x59 ); bsPutUChar ( bsWr, 0x26 );
- bsPutUChar ( bsWr, 0x53 ); bsPutUChar ( bsWr, 0x59 );
- }
- }
-
- fprintf ( stderr, "%s: finished\n", progName );
- return 0;
-}
-
-
-
-/*-----------------------------------------------------------*/
-/*--- end bzip2recover.c ---*/
-/*-----------------------------------------------------------*/
diff --git a/winsup/bz2lib/bzlib.c b/winsup/bz2lib/bzlib.c
deleted file mode 100644
index 4a06d9f14..000000000
--- a/winsup/bz2lib/bzlib.c
+++ /dev/null
@@ -1,1564 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Library top-level functions. ---*/
-/*--- bzlib.c ---*/
-/*-------------------------------------------------------------*/
-
-/*--
- This file is a part of bzip2 and/or libbzip2, a program and
- library for lossless, block-sorting data compression.
-
- Copyright (C) 1996-2000 Julian R Seward. 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. The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 3. Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-
- 4. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
-
- Julian Seward, Cambridge, UK.
- jseward@acm.org
- bzip2/libbzip2 version 1.0 of 21 March 2000
-
- This program is based on (at least) the work of:
- Mike Burrows
- David Wheeler
- Peter Fenwick
- Alistair Moffat
- Radford Neal
- Ian H. Witten
- Robert Sedgewick
- Jon L. Bentley
-
- For more information on these sources, see the manual.
---*/
-
-/*--
- CHANGES
- ~~~~~~~
- 0.9.0 -- original version.
-
- 0.9.0a/b -- no changes in this file.
-
- 0.9.0c
- * made zero-length BZ_FLUSH work correctly in bzCompress().
- * fixed bzWrite/bzRead to ignore zero-length requests.
- * fixed bzread to correctly handle read requests after EOF.
- * wrong parameter order in call to bzDecompressInit in
- bzBuffToBuffDecompress. Fixed.
---*/
-
-#include "bzlib_private.h"
-
-
-/*---------------------------------------------------*/
-/*--- Compression stuff ---*/
-/*---------------------------------------------------*/
-
-
-/*---------------------------------------------------*/
-#ifndef BZ_NO_STDIO
-void BZ2_bz__AssertH__fail ( int errcode )
-{
- fprintf(stderr,
- "\n\nbzip2/libbzip2: internal error number %d.\n"
- "This is a bug in bzip2/libbzip2, %s.\n"
- "Please report it to me at: jseward@acm.org. If this happened\n"
- "when you were using some program which uses libbzip2 as a\n"
- "component, you should also report this bug to the author(s)\n"
- "of that program. Please make an effort to report this bug;\n"
- "timely and accurate bug reports eventually lead to higher\n"
- "quality software. Thanks. Julian Seward, 21 March 2000.\n\n",
- errcode,
- BZ2_bzlibVersion()
- );
- exit(3);
-}
-#endif
-
-
-/*---------------------------------------------------*/
-static
-int bz_config_ok ( void )
-{
- if (sizeof(int) != 4) return 0;
- if (sizeof(short) != 2) return 0;
- if (sizeof(char) != 1) return 0;
- return 1;
-}
-
-
-/*---------------------------------------------------*/
-static
-void* default_bzalloc ( void* opaque, Int32 items, Int32 size )
-{
- void* v = malloc ( items * size );
- return v;
-}
-
-static
-void default_bzfree ( void* opaque, void* addr )
-{
- if (addr != NULL) free ( addr );
-}
-
-
-/*---------------------------------------------------*/
-static
-void prepare_new_block ( EState* s )
-{
- Int32 i;
- s->nblock = 0;
- s->numZ = 0;
- s->state_out_pos = 0;
- BZ_INITIALISE_CRC ( s->blockCRC );
- for (i = 0; i < 256; i++) s->inUse[i] = False;
- s->blockNo++;
-}
-
-
-/*---------------------------------------------------*/
-static
-void init_RL ( EState* s )
-{
- s->state_in_ch = 256;
- s->state_in_len = 0;
-}
-
-
-static
-Bool isempty_RL ( EState* s )
-{
- if (s->state_in_ch < 256 && s->state_in_len > 0)
- return False; else
- return True;
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzCompressInit)
- ( bz_stream* strm,
- int blockSize100k,
- int verbosity,
- int workFactor )
-{
- Int32 n;
- EState* s;
-
- if (!bz_config_ok()) return BZ_CONFIG_ERROR;
-
- if (strm == NULL ||
- blockSize100k < 1 || blockSize100k > 9 ||
- workFactor < 0 || workFactor > 250)
- return BZ_PARAM_ERROR;
-
- if (workFactor == 0) workFactor = 30;
- if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc;
- if (strm->bzfree == NULL) strm->bzfree = default_bzfree;
-
- s = BZALLOC( sizeof(EState) );
- if (s == NULL) return BZ_MEM_ERROR;
- s->strm = strm;
-
- s->arr1 = NULL;
- s->arr2 = NULL;
- s->ftab = NULL;
-
- n = 100000 * blockSize100k;
- s->arr1 = BZALLOC( n * sizeof(UInt32) );
- s->arr2 = BZALLOC( (n+BZ_N_OVERSHOOT) * sizeof(UInt32) );
- s->ftab = BZALLOC( 65537 * sizeof(UInt32) );
-
- if (s->arr1 == NULL || s->arr2 == NULL || s->ftab == NULL) {
- if (s->arr1 != NULL) BZFREE(s->arr1);
- if (s->arr2 != NULL) BZFREE(s->arr2);
- if (s->ftab != NULL) BZFREE(s->ftab);
- if (s != NULL) BZFREE(s);
- return BZ_MEM_ERROR;
- }
-
- s->blockNo = 0;
- s->state = BZ_S_INPUT;
- s->mode = BZ_M_RUNNING;
- s->combinedCRC = 0;
- s->blockSize100k = blockSize100k;
- s->nblockMAX = 100000 * blockSize100k - 19;
- s->verbosity = verbosity;
- s->workFactor = workFactor;
-
- s->block = (UChar*)s->arr2;
- s->mtfv = (UInt16*)s->arr1;
- s->zbits = NULL;
- s->ptr = (UInt32*)s->arr1;
-
- strm->state = s;
- strm->total_in_lo32 = 0;
- strm->total_in_hi32 = 0;
- strm->total_out_lo32 = 0;
- strm->total_out_hi32 = 0;
- init_RL ( s );
- prepare_new_block ( s );
- return BZ_OK;
-}
-
-
-/*---------------------------------------------------*/
-static
-void add_pair_to_block ( EState* s )
-{
- Int32 i;
- UChar ch = (UChar)(s->state_in_ch);
- for (i = 0; i < s->state_in_len; i++) {
- BZ_UPDATE_CRC( s->blockCRC, ch );
- }
- s->inUse[s->state_in_ch] = True;
- switch (s->state_in_len) {
- case 1:
- s->block[s->nblock] = (UChar)ch; s->nblock++;
- break;
- case 2:
- s->block[s->nblock] = (UChar)ch; s->nblock++;
- s->block[s->nblock] = (UChar)ch; s->nblock++;
- break;
- case 3:
- s->block[s->nblock] = (UChar)ch; s->nblock++;
- s->block[s->nblock] = (UChar)ch; s->nblock++;
- s->block[s->nblock] = (UChar)ch; s->nblock++;
- break;
- default:
- s->inUse[s->state_in_len-4] = True;
- s->block[s->nblock] = (UChar)ch; s->nblock++;
- s->block[s->nblock] = (UChar)ch; s->nblock++;
- s->block[s->nblock] = (UChar)ch; s->nblock++;
- s->block[s->nblock] = (UChar)ch; s->nblock++;
- s->block[s->nblock] = ((UChar)(s->state_in_len-4));
- s->nblock++;
- break;
- }
-}
-
-
-/*---------------------------------------------------*/
-static
-void flush_RL ( EState* s )
-{
- if (s->state_in_ch < 256) add_pair_to_block ( s );
- init_RL ( s );
-}
-
-
-/*---------------------------------------------------*/
-#define ADD_CHAR_TO_BLOCK(zs,zchh0) \
-{ \
- UInt32 zchh = (UInt32)(zchh0); \
- /*-- fast track the common case --*/ \
- if (zchh != zs->state_in_ch && \
- zs->state_in_len == 1) { \
- UChar ch = (UChar)(zs->state_in_ch); \
- BZ_UPDATE_CRC( zs->blockCRC, ch ); \
- zs->inUse[zs->state_in_ch] = True; \
- zs->block[zs->nblock] = (UChar)ch; \
- zs->nblock++; \
- zs->state_in_ch = zchh; \
- } \
- else \
- /*-- general, uncommon cases --*/ \
- if (zchh != zs->state_in_ch || \
- zs->state_in_len == 255) { \
- if (zs->state_in_ch < 256) \
- add_pair_to_block ( zs ); \
- zs->state_in_ch = zchh; \
- zs->state_in_len = 1; \
- } else { \
- zs->state_in_len++; \
- } \
-}
-
-
-/*---------------------------------------------------*/
-static
-Bool copy_input_until_stop ( EState* s )
-{
- Bool progress_in = False;
-
- if (s->mode == BZ_M_RUNNING) {
-
- /*-- fast track the common case --*/
- while (True) {
- /*-- block full? --*/
- if (s->nblock >= s->nblockMAX) break;
- /*-- no input? --*/
- if (s->strm->avail_in == 0) break;
- progress_in = True;
- ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) );
- s->strm->next_in++;
- s->strm->avail_in--;
- s->strm->total_in_lo32++;
- if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++;
- }
-
- } else {
-
- /*-- general, uncommon case --*/
- while (True) {
- /*-- block full? --*/
- if (s->nblock >= s->nblockMAX) break;
- /*-- no input? --*/
- if (s->strm->avail_in == 0) break;
- /*-- flush/finish end? --*/
- if (s->avail_in_expect == 0) break;
- progress_in = True;
- ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) );
- s->strm->next_in++;
- s->strm->avail_in--;
- s->strm->total_in_lo32++;
- if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++;
- s->avail_in_expect--;
- }
- }
- return progress_in;
-}
-
-
-/*---------------------------------------------------*/
-static
-Bool copy_output_until_stop ( EState* s )
-{
- Bool progress_out = False;
-
- while (True) {
-
- /*-- no output space? --*/
- if (s->strm->avail_out == 0) break;
-
- /*-- block done? --*/
- if (s->state_out_pos >= s->numZ) break;
-
- progress_out = True;
- *(s->strm->next_out) = s->zbits[s->state_out_pos];
- s->state_out_pos++;
- s->strm->avail_out--;
- s->strm->next_out++;
- s->strm->total_out_lo32++;
- if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
- }
-
- return progress_out;
-}
-
-
-/*---------------------------------------------------*/
-static
-Bool handle_compress ( bz_stream* strm )
-{
- Bool progress_in = False;
- Bool progress_out = False;
- EState* s = strm->state;
-
- while (True) {
-
- if (s->state == BZ_S_OUTPUT) {
- progress_out |= copy_output_until_stop ( s );
- if (s->state_out_pos < s->numZ) break;
- if (s->mode == BZ_M_FINISHING &&
- s->avail_in_expect == 0 &&
- isempty_RL(s)) break;
- prepare_new_block ( s );
- s->state = BZ_S_INPUT;
- if (s->mode == BZ_M_FLUSHING &&
- s->avail_in_expect == 0 &&
- isempty_RL(s)) break;
- }
-
- if (s->state == BZ_S_INPUT) {
- progress_in |= copy_input_until_stop ( s );
- if (s->mode != BZ_M_RUNNING && s->avail_in_expect == 0) {
- flush_RL ( s );
- BZ2_compressBlock ( s, (Bool)(s->mode == BZ_M_FINISHING) );
- s->state = BZ_S_OUTPUT;
- }
- else
- if (s->nblock >= s->nblockMAX) {
- BZ2_compressBlock ( s, False );
- s->state = BZ_S_OUTPUT;
- }
- else
- if (s->strm->avail_in == 0) {
- break;
- }
- }
-
- }
-
- return progress_in || progress_out;
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzCompress) ( bz_stream *strm, int action )
-{
- Bool progress;
- EState* s;
- if (strm == NULL) return BZ_PARAM_ERROR;
- s = strm->state;
- if (s == NULL) return BZ_PARAM_ERROR;
- if (s->strm != strm) return BZ_PARAM_ERROR;
-
- preswitch:
- switch (s->mode) {
-
- case BZ_M_IDLE:
- return BZ_SEQUENCE_ERROR;
-
- case BZ_M_RUNNING:
- if (action == BZ_RUN) {
- progress = handle_compress ( strm );
- return progress ? BZ_RUN_OK : BZ_PARAM_ERROR;
- }
- else
- if (action == BZ_FLUSH) {
- s->avail_in_expect = strm->avail_in;
- s->mode = BZ_M_FLUSHING;
- goto preswitch;
- }
- else
- if (action == BZ_FINISH) {
- s->avail_in_expect = strm->avail_in;
- s->mode = BZ_M_FINISHING;
- goto preswitch;
- }
- else
- return BZ_PARAM_ERROR;
-
- case BZ_M_FLUSHING:
- if (action != BZ_FLUSH) return BZ_SEQUENCE_ERROR;
- if (s->avail_in_expect != s->strm->avail_in)
- return BZ_SEQUENCE_ERROR;
- progress = handle_compress ( strm );
- if (s->avail_in_expect > 0 || !isempty_RL(s) ||
- s->state_out_pos < s->numZ) return BZ_FLUSH_OK;
- s->mode = BZ_M_RUNNING;
- return BZ_RUN_OK;
-
- case BZ_M_FINISHING:
- if (action != BZ_FINISH) return BZ_SEQUENCE_ERROR;
- if (s->avail_in_expect != s->strm->avail_in)
- return BZ_SEQUENCE_ERROR;
- progress = handle_compress ( strm );
- if (!progress) return BZ_SEQUENCE_ERROR;
- if (s->avail_in_expect > 0 || !isempty_RL(s) ||
- s->state_out_pos < s->numZ) return BZ_FINISH_OK;
- s->mode = BZ_M_IDLE;
- return BZ_STREAM_END;
- }
- return BZ_OK; /*--not reached--*/
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzCompressEnd) ( bz_stream *strm )
-{
- EState* s;
- if (strm == NULL) return BZ_PARAM_ERROR;
- s = strm->state;
- if (s == NULL) return BZ_PARAM_ERROR;
- if (s->strm != strm) return BZ_PARAM_ERROR;
-
- if (s->arr1 != NULL) BZFREE(s->arr1);
- if (s->arr2 != NULL) BZFREE(s->arr2);
- if (s->ftab != NULL) BZFREE(s->ftab);
- BZFREE(strm->state);
-
- strm->state = NULL;
-
- return BZ_OK;
-}
-
-
-/*---------------------------------------------------*/
-/*--- Decompression stuff ---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzDecompressInit)
- ( bz_stream* strm,
- int verbosity,
- int small )
-{
- DState* s;
-
- if (!bz_config_ok()) return BZ_CONFIG_ERROR;
-
- if (strm == NULL) return BZ_PARAM_ERROR;
- if (small != 0 && small != 1) return BZ_PARAM_ERROR;
- if (verbosity < 0 || verbosity > 4) return BZ_PARAM_ERROR;
-
- if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc;
- if (strm->bzfree == NULL) strm->bzfree = default_bzfree;
-
- s = BZALLOC( sizeof(DState) );
- if (s == NULL) return BZ_MEM_ERROR;
- s->strm = strm;
- strm->state = s;
- s->state = BZ_X_MAGIC_1;
- s->bsLive = 0;
- s->bsBuff = 0;
- s->calculatedCombinedCRC = 0;
- strm->total_in_lo32 = 0;
- strm->total_in_hi32 = 0;
- strm->total_out_lo32 = 0;
- strm->total_out_hi32 = 0;
- s->smallDecompress = (Bool)small;
- s->ll4 = NULL;
- s->ll16 = NULL;
- s->tt = NULL;
- s->currBlockNo = 0;
- s->verbosity = verbosity;
-
- return BZ_OK;
-}
-
-
-/*---------------------------------------------------*/
-static
-void unRLE_obuf_to_output_FAST ( DState* s )
-{
- UChar k1;
-
- if (s->blockRandomised) {
-
- while (True) {
- /* try to finish existing run */
- while (True) {
- if (s->strm->avail_out == 0) return;
- if (s->state_out_len == 0) break;
- *( (UChar*)(s->strm->next_out) ) = s->state_out_ch;
- BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch );
- s->state_out_len--;
- s->strm->next_out++;
- s->strm->avail_out--;
- s->strm->total_out_lo32++;
- if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
- }
-
- /* can a new run be started? */
- if (s->nblock_used == s->save_nblock+1) return;
-
-
- s->state_out_len = 1;
- s->state_out_ch = s->k0;
- BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
- k1 ^= BZ_RAND_MASK; s->nblock_used++;
- if (s->nblock_used == s->save_nblock+1) continue;
- if (k1 != s->k0) { s->k0 = k1; continue; };
-
- s->state_out_len = 2;
- BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
- k1 ^= BZ_RAND_MASK; s->nblock_used++;
- if (s->nblock_used == s->save_nblock+1) continue;
- if (k1 != s->k0) { s->k0 = k1; continue; };
-
- s->state_out_len = 3;
- BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
- k1 ^= BZ_RAND_MASK; s->nblock_used++;
- if (s->nblock_used == s->save_nblock+1) continue;
- if (k1 != s->k0) { s->k0 = k1; continue; };
-
- BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
- k1 ^= BZ_RAND_MASK; s->nblock_used++;
- s->state_out_len = ((Int32)k1) + 4;
- BZ_GET_FAST(s->k0); BZ_RAND_UPD_MASK;
- s->k0 ^= BZ_RAND_MASK; s->nblock_used++;
- }
-
- } else {
-
- /* restore */
- UInt32 c_calculatedBlockCRC = s->calculatedBlockCRC;
- UChar c_state_out_ch = s->state_out_ch;
- Int32 c_state_out_len = s->state_out_len;
- Int32 c_nblock_used = s->nblock_used;
- Int32 c_k0 = s->k0;
- UInt32* c_tt = s->tt;
- UInt32 c_tPos = s->tPos;
- char* cs_next_out = s->strm->next_out;
- unsigned int cs_avail_out = s->strm->avail_out;
- /* end restore */
-
- UInt32 avail_out_INIT = cs_avail_out;
- Int32 s_save_nblockPP = s->save_nblock+1;
- unsigned int total_out_lo32_old;
-
- while (True) {
-
- /* try to finish existing run */
- if (c_state_out_len > 0) {
- while (True) {
- if (cs_avail_out == 0) goto return_notr;
- if (c_state_out_len == 1) break;
- *( (UChar*)(cs_next_out) ) = c_state_out_ch;
- BZ_UPDATE_CRC ( c_calculatedBlockCRC, c_state_out_ch );
- c_state_out_len--;
- cs_next_out++;
- cs_avail_out--;
- }
- s_state_out_len_eq_one:
- {
- if (cs_avail_out == 0) {
- c_state_out_len = 1; goto return_notr;
- };
- *( (UChar*)(cs_next_out) ) = c_state_out_ch;
- BZ_UPDATE_CRC ( c_calculatedBlockCRC, c_state_out_ch );
- cs_next_out++;
- cs_avail_out--;
- }
- }
- /* can a new run be started? */
- if (c_nblock_used == s_save_nblockPP) {
- c_state_out_len = 0; goto return_notr;
- };
- c_state_out_ch = c_k0;
- BZ_GET_FAST_C(k1); c_nblock_used++;
- if (k1 != c_k0) {
- c_k0 = k1; goto s_state_out_len_eq_one;
- };
- if (c_nblock_used == s_save_nblockPP)
- goto s_state_out_len_eq_one;
-
- c_state_out_len = 2;
- BZ_GET_FAST_C(k1); c_nblock_used++;
- if (c_nblock_used == s_save_nblockPP) continue;
- if (k1 != c_k0) { c_k0 = k1; continue; };
-
- c_state_out_len = 3;
- BZ_GET_FAST_C(k1); c_nblock_used++;
- if (c_nblock_used == s_save_nblockPP) continue;
- if (k1 != c_k0) { c_k0 = k1; continue; };
-
- BZ_GET_FAST_C(k1); c_nblock_used++;
- c_state_out_len = ((Int32)k1) + 4;
- BZ_GET_FAST_C(c_k0); c_nblock_used++;
- }
-
- return_notr:
- total_out_lo32_old = s->strm->total_out_lo32;
- s->strm->total_out_lo32 += (avail_out_INIT - cs_avail_out);
- if (s->strm->total_out_lo32 < total_out_lo32_old)
- s->strm->total_out_hi32++;
-
- /* save */
- s->calculatedBlockCRC = c_calculatedBlockCRC;
- s->state_out_ch = c_state_out_ch;
- s->state_out_len = c_state_out_len;
- s->nblock_used = c_nblock_used;
- s->k0 = c_k0;
- s->tt = c_tt;
- s->tPos = c_tPos;
- s->strm->next_out = cs_next_out;
- s->strm->avail_out = cs_avail_out;
- /* end save */
- }
-}
-
-
-
-/*---------------------------------------------------*/
-__inline__ Int32 BZ2_indexIntoF ( Int32 indx, Int32 *cftab )
-{
- Int32 nb, na, mid;
- nb = 0;
- na = 256;
- do {
- mid = (nb + na) >> 1;
- if (indx >= cftab[mid]) nb = mid; else na = mid;
- }
- while (na - nb != 1);
- return nb;
-}
-
-
-/*---------------------------------------------------*/
-static
-void unRLE_obuf_to_output_SMALL ( DState* s )
-{
- UChar k1;
-
- if (s->blockRandomised) {
-
- while (True) {
- /* try to finish existing run */
- while (True) {
- if (s->strm->avail_out == 0) return;
- if (s->state_out_len == 0) break;
- *( (UChar*)(s->strm->next_out) ) = s->state_out_ch;
- BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch );
- s->state_out_len--;
- s->strm->next_out++;
- s->strm->avail_out--;
- s->strm->total_out_lo32++;
- if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
- }
-
- /* can a new run be started? */
- if (s->nblock_used == s->save_nblock+1) return;
-
-
- s->state_out_len = 1;
- s->state_out_ch = s->k0;
- BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
- k1 ^= BZ_RAND_MASK; s->nblock_used++;
- if (s->nblock_used == s->save_nblock+1) continue;
- if (k1 != s->k0) { s->k0 = k1; continue; };
-
- s->state_out_len = 2;
- BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
- k1 ^= BZ_RAND_MASK; s->nblock_used++;
- if (s->nblock_used == s->save_nblock+1) continue;
- if (k1 != s->k0) { s->k0 = k1; continue; };
-
- s->state_out_len = 3;
- BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
- k1 ^= BZ_RAND_MASK; s->nblock_used++;
- if (s->nblock_used == s->save_nblock+1) continue;
- if (k1 != s->k0) { s->k0 = k1; continue; };
-
- BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
- k1 ^= BZ_RAND_MASK; s->nblock_used++;
- s->state_out_len = ((Int32)k1) + 4;
- BZ_GET_SMALL(s->k0); BZ_RAND_UPD_MASK;
- s->k0 ^= BZ_RAND_MASK; s->nblock_used++;
- }
-
- } else {
-
- while (True) {
- /* try to finish existing run */
- while (True) {
- if (s->strm->avail_out == 0) return;
- if (s->state_out_len == 0) break;
- *( (UChar*)(s->strm->next_out) ) = s->state_out_ch;
- BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch );
- s->state_out_len--;
- s->strm->next_out++;
- s->strm->avail_out--;
- s->strm->total_out_lo32++;
- if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
- }
-
- /* can a new run be started? */
- if (s->nblock_used == s->save_nblock+1) return;
-
- s->state_out_len = 1;
- s->state_out_ch = s->k0;
- BZ_GET_SMALL(k1); s->nblock_used++;
- if (s->nblock_used == s->save_nblock+1) continue;
- if (k1 != s->k0) { s->k0 = k1; continue; };
-
- s->state_out_len = 2;
- BZ_GET_SMALL(k1); s->nblock_used++;
- if (s->nblock_used == s->save_nblock+1) continue;
- if (k1 != s->k0) { s->k0 = k1; continue; };
-
- s->state_out_len = 3;
- BZ_GET_SMALL(k1); s->nblock_used++;
- if (s->nblock_used == s->save_nblock+1) continue;
- if (k1 != s->k0) { s->k0 = k1; continue; };
-
- BZ_GET_SMALL(k1); s->nblock_used++;
- s->state_out_len = ((Int32)k1) + 4;
- BZ_GET_SMALL(s->k0); s->nblock_used++;
- }
-
- }
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzDecompress) ( bz_stream *strm )
-{
- DState* s;
- if (strm == NULL) return BZ_PARAM_ERROR;
- s = strm->state;
- if (s == NULL) return BZ_PARAM_ERROR;
- if (s->strm != strm) return BZ_PARAM_ERROR;
-
- while (True) {
- if (s->state == BZ_X_IDLE) return BZ_SEQUENCE_ERROR;
- if (s->state == BZ_X_OUTPUT) {
- if (s->smallDecompress)
- unRLE_obuf_to_output_SMALL ( s ); else
- unRLE_obuf_to_output_FAST ( s );
- if (s->nblock_used == s->save_nblock+1 && s->state_out_len == 0) {
- BZ_FINALISE_CRC ( s->calculatedBlockCRC );
- if (s->verbosity >= 3)
- VPrintf2 ( " {0x%x, 0x%x}", s->storedBlockCRC,
- s->calculatedBlockCRC );
- if (s->verbosity >= 2) VPrintf0 ( "]" );
- if (s->calculatedBlockCRC != s->storedBlockCRC)
- return BZ_DATA_ERROR;
- s->calculatedCombinedCRC
- = (s->calculatedCombinedCRC << 1) |
- (s->calculatedCombinedCRC >> 31);
- s->calculatedCombinedCRC ^= s->calculatedBlockCRC;
- s->state = BZ_X_BLKHDR_1;
- } else {
- return BZ_OK;
- }
- }
- if (s->state >= BZ_X_MAGIC_1) {
- Int32 r = BZ2_decompress ( s );
- if (r == BZ_STREAM_END) {
- if (s->verbosity >= 3)
- VPrintf2 ( "\n combined CRCs: stored = 0x%x, computed = 0x%x",
- s->storedCombinedCRC, s->calculatedCombinedCRC );
- if (s->calculatedCombinedCRC != s->storedCombinedCRC)
- return BZ_DATA_ERROR;
- return r;
- }
- if (s->state != BZ_X_OUTPUT) return r;
- }
- }
-
- AssertH ( 0, 6001 );
-
- return 0; /*NOTREACHED*/
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzDecompressEnd) ( bz_stream *strm )
-{
- DState* s;
- if (strm == NULL) return BZ_PARAM_ERROR;
- s = strm->state;
- if (s == NULL) return BZ_PARAM_ERROR;
- if (s->strm != strm) return BZ_PARAM_ERROR;
-
- if (s->tt != NULL) BZFREE(s->tt);
- if (s->ll16 != NULL) BZFREE(s->ll16);
- if (s->ll4 != NULL) BZFREE(s->ll4);
-
- BZFREE(strm->state);
- strm->state = NULL;
-
- return BZ_OK;
-}
-
-
-#ifndef BZ_NO_STDIO
-/*---------------------------------------------------*/
-/*--- File I/O stuff ---*/
-/*---------------------------------------------------*/
-
-#define BZ_SETERR(eee) \
-{ \
- if (bzerror != NULL) *bzerror = eee; \
- if (bzf != NULL) bzf->lastErr = eee; \
-}
-
-typedef
- struct {
- FILE* handle;
- Char buf[BZ_MAX_UNUSED];
- Int32 bufN;
- Bool writing;
- bz_stream strm;
- Int32 lastErr;
- Bool initialisedOk;
- }
- bzFile;
-
-
-/*---------------------------------------------*/
-static Bool myfeof ( FILE* f )
-{
- Int32 c = fgetc ( f );
- if (c == EOF) return True;
- ungetc ( c, f );
- return False;
-}
-
-
-/*---------------------------------------------------*/
-BZFILE* BZ_API(BZ2_bzWriteOpen)
- ( int* bzerror,
- FILE* f,
- int blockSize100k,
- int verbosity,
- int workFactor )
-{
- Int32 ret;
- bzFile* bzf = NULL;
-
- BZ_SETERR(BZ_OK);
-
- if (f == NULL ||
- (blockSize100k < 1 || blockSize100k > 9) ||
- (workFactor < 0 || workFactor > 250) ||
- (verbosity < 0 || verbosity > 4))
- { BZ_SETERR(BZ_PARAM_ERROR); return NULL; };
-
- if (ferror(f))
- { BZ_SETERR(BZ_IO_ERROR); return NULL; };
-
- bzf = malloc ( sizeof(bzFile) );
- if (bzf == NULL)
- { BZ_SETERR(BZ_MEM_ERROR); return NULL; };
-
- BZ_SETERR(BZ_OK);
- bzf->initialisedOk = False;
- bzf->bufN = 0;
- bzf->handle = f;
- bzf->writing = True;
- bzf->strm.bzalloc = NULL;
- bzf->strm.bzfree = NULL;
- bzf->strm.opaque = NULL;
-
- if (workFactor == 0) workFactor = 30;
- ret = BZ2_bzCompressInit ( &(bzf->strm), blockSize100k,
- verbosity, workFactor );
- if (ret != BZ_OK)
- { BZ_SETERR(ret); free(bzf); return NULL; };
-
- bzf->strm.avail_in = 0;
- bzf->initialisedOk = True;
- return bzf;
-}
-
-
-
-/*---------------------------------------------------*/
-void BZ_API(BZ2_bzWrite)
- ( int* bzerror,
- BZFILE* b,
- void* buf,
- int len )
-{
- Int32 n, n2, ret;
- bzFile* bzf = (bzFile*)b;
-
- BZ_SETERR(BZ_OK);
- if (bzf == NULL || buf == NULL || len < 0)
- { BZ_SETERR(BZ_PARAM_ERROR); return; };
- if (!(bzf->writing))
- { BZ_SETERR(BZ_SEQUENCE_ERROR); return; };
- if (ferror(bzf->handle))
- { BZ_SETERR(BZ_IO_ERROR); return; };
-
- if (len == 0)
- { BZ_SETERR(BZ_OK); return; };
-
- bzf->strm.avail_in = len;
- bzf->strm.next_in = buf;
-
- while (True) {
- bzf->strm.avail_out = BZ_MAX_UNUSED;
- bzf->strm.next_out = bzf->buf;
- ret = BZ2_bzCompress ( &(bzf->strm), BZ_RUN );
- if (ret != BZ_RUN_OK)
- { BZ_SETERR(ret); return; };
-
- if (bzf->strm.avail_out < BZ_MAX_UNUSED) {
- n = BZ_MAX_UNUSED - bzf->strm.avail_out;
- n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar),
- n, bzf->handle );
- if (n != n2 || ferror(bzf->handle))
- { BZ_SETERR(BZ_IO_ERROR); return; };
- }
-
- if (bzf->strm.avail_in == 0)
- { BZ_SETERR(BZ_OK); return; };
- }
-}
-
-
-/*---------------------------------------------------*/
-void BZ_API(BZ2_bzWriteClose)
- ( int* bzerror,
- BZFILE* b,
- int abandon,
- unsigned int* nbytes_in,
- unsigned int* nbytes_out )
-{
- BZ2_bzWriteClose64 ( bzerror, b, abandon,
- nbytes_in, NULL, nbytes_out, NULL );
-}
-
-
-void BZ_API(BZ2_bzWriteClose64)
- ( int* bzerror,
- BZFILE* b,
- int abandon,
- unsigned int* nbytes_in_lo32,
- unsigned int* nbytes_in_hi32,
- unsigned int* nbytes_out_lo32,
- unsigned int* nbytes_out_hi32 )
-{
- Int32 n, n2, ret;
- bzFile* bzf = (bzFile*)b;
-
- if (bzf == NULL)
- { BZ_SETERR(BZ_OK); return; };
- if (!(bzf->writing))
- { BZ_SETERR(BZ_SEQUENCE_ERROR); return; };
- if (ferror(bzf->handle))
- { BZ_SETERR(BZ_IO_ERROR); return; };
-
- if (nbytes_in_lo32 != NULL) *nbytes_in_lo32 = 0;
- if (nbytes_in_hi32 != NULL) *nbytes_in_hi32 = 0;
- if (nbytes_out_lo32 != NULL) *nbytes_out_lo32 = 0;
- if (nbytes_out_hi32 != NULL) *nbytes_out_hi32 = 0;
-
- if ((!abandon) && bzf->lastErr == BZ_OK) {
- while (True) {
- bzf->strm.avail_out = BZ_MAX_UNUSED;
- bzf->strm.next_out = bzf->buf;
- ret = BZ2_bzCompress ( &(bzf->strm), BZ_FINISH );
- if (ret != BZ_FINISH_OK && ret != BZ_STREAM_END)
- { BZ_SETERR(ret); return; };
-
- if (bzf->strm.avail_out < BZ_MAX_UNUSED) {
- n = BZ_MAX_UNUSED - bzf->strm.avail_out;
- n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar),
- n, bzf->handle );
- if (n != n2 || ferror(bzf->handle))
- { BZ_SETERR(BZ_IO_ERROR); return; };
- }
-
- if (ret == BZ_STREAM_END) break;
- }
- }
-
- if ( !abandon && !ferror ( bzf->handle ) ) {
- fflush ( bzf->handle );
- if (ferror(bzf->handle))
- { BZ_SETERR(BZ_IO_ERROR); return; };
- }
-
- if (nbytes_in_lo32 != NULL)
- *nbytes_in_lo32 = bzf->strm.total_in_lo32;
- if (nbytes_in_hi32 != NULL)
- *nbytes_in_hi32 = bzf->strm.total_in_hi32;
- if (nbytes_out_lo32 != NULL)
- *nbytes_out_lo32 = bzf->strm.total_out_lo32;
- if (nbytes_out_hi32 != NULL)
- *nbytes_out_hi32 = bzf->strm.total_out_hi32;
-
- BZ_SETERR(BZ_OK);
- BZ2_bzCompressEnd ( &(bzf->strm) );
- free ( bzf );
-}
-
-
-/*---------------------------------------------------*/
-BZFILE* BZ_API(BZ2_bzReadOpen)
- ( int* bzerror,
- FILE* f,
- int verbosity,
- int small,
- void* unused,
- int nUnused )
-{
- bzFile* bzf = NULL;
- int ret;
-
- BZ_SETERR(BZ_OK);
-
- if (f == NULL ||
- (small != 0 && small != 1) ||
- (verbosity < 0 || verbosity > 4) ||
- (unused == NULL && nUnused != 0) ||
- (unused != NULL && (nUnused < 0 || nUnused > BZ_MAX_UNUSED)))
- { BZ_SETERR(BZ_PARAM_ERROR); return NULL; };
-
- if (ferror(f))
- { BZ_SETERR(BZ_IO_ERROR); return NULL; };
-
- bzf = malloc ( sizeof(bzFile) );
- if (bzf == NULL)
- { BZ_SETERR(BZ_MEM_ERROR); return NULL; };
-
- BZ_SETERR(BZ_OK);
-
- bzf->initialisedOk = False;
- bzf->handle = f;
- bzf->bufN = 0;
- bzf->writing = False;
- bzf->strm.bzalloc = NULL;
- bzf->strm.bzfree = NULL;
- bzf->strm.opaque = NULL;
-
- while (nUnused > 0) {
- bzf->buf[bzf->bufN] = *((UChar*)(unused)); bzf->bufN++;
- unused = ((void*)( 1 + ((UChar*)(unused)) ));
- nUnused--;
- }
-
- ret = BZ2_bzDecompressInit ( &(bzf->strm), verbosity, small );
- if (ret != BZ_OK)
- { BZ_SETERR(ret); free(bzf); return NULL; };
-
- bzf->strm.avail_in = bzf->bufN;
- bzf->strm.next_in = bzf->buf;
-
- bzf->initialisedOk = True;
- return bzf;
-}
-
-
-/*---------------------------------------------------*/
-void BZ_API(BZ2_bzReadClose) ( int *bzerror, BZFILE *b )
-{
- bzFile* bzf = (bzFile*)b;
-
- BZ_SETERR(BZ_OK);
- if (bzf == NULL)
- { BZ_SETERR(BZ_OK); return; };
-
- if (bzf->writing)
- { BZ_SETERR(BZ_SEQUENCE_ERROR); return; };
-
- if (bzf->initialisedOk)
- (void)BZ2_bzDecompressEnd ( &(bzf->strm) );
- free ( bzf );
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzRead)
- ( int* bzerror,
- BZFILE* b,
- void* buf,
- int len )
-{
- Int32 n, ret;
- bzFile* bzf = (bzFile*)b;
-
- BZ_SETERR(BZ_OK);
-
- if (bzf == NULL || buf == NULL || len < 0)
- { BZ_SETERR(BZ_PARAM_ERROR); return 0; };
-
- if (bzf->writing)
- { BZ_SETERR(BZ_SEQUENCE_ERROR); return 0; };
-
- if (len == 0)
- { BZ_SETERR(BZ_OK); return 0; };
-
- bzf->strm.avail_out = len;
- bzf->strm.next_out = buf;
-
- while (True) {
-
- if (ferror(bzf->handle))
- { BZ_SETERR(BZ_IO_ERROR); return 0; };
-
- if (bzf->strm.avail_in == 0 && !myfeof(bzf->handle)) {
- n = fread ( bzf->buf, sizeof(UChar),
- BZ_MAX_UNUSED, bzf->handle );
- if (ferror(bzf->handle))
- { BZ_SETERR(BZ_IO_ERROR); return 0; };
- bzf->bufN = n;
- bzf->strm.avail_in = bzf->bufN;
- bzf->strm.next_in = bzf->buf;
- }
-
- ret = BZ2_bzDecompress ( &(bzf->strm) );
-
- if (ret != BZ_OK && ret != BZ_STREAM_END)
- { BZ_SETERR(ret); return 0; };
-
- if (ret == BZ_OK && myfeof(bzf->handle) &&
- bzf->strm.avail_in == 0 && bzf->strm.avail_out > 0)
- { BZ_SETERR(BZ_UNEXPECTED_EOF); return 0; };
-
- if (ret == BZ_STREAM_END)
- { BZ_SETERR(BZ_STREAM_END);
- return len - bzf->strm.avail_out; };
- if (bzf->strm.avail_out == 0)
- { BZ_SETERR(BZ_OK); return len; };
-
- }
-
- return 0; /*not reached*/
-}
-
-
-/*---------------------------------------------------*/
-void BZ_API(BZ2_bzReadGetUnused)
- ( int* bzerror,
- BZFILE* b,
- void** unused,
- int* nUnused )
-{
- bzFile* bzf = (bzFile*)b;
- if (bzf == NULL)
- { BZ_SETERR(BZ_PARAM_ERROR); return; };
- if (bzf->lastErr != BZ_STREAM_END)
- { BZ_SETERR(BZ_SEQUENCE_ERROR); return; };
- if (unused == NULL || nUnused == NULL)
- { BZ_SETERR(BZ_PARAM_ERROR); return; };
-
- BZ_SETERR(BZ_OK);
- *nUnused = bzf->strm.avail_in;
- *unused = bzf->strm.next_in;
-}
-#endif
-
-
-/*---------------------------------------------------*/
-/*--- Misc convenience stuff ---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzBuffToBuffCompress)
- ( char* dest,
- unsigned int* destLen,
- char* source,
- unsigned int sourceLen,
- int blockSize100k,
- int verbosity,
- int workFactor )
-{
- bz_stream strm;
- int ret;
-
- if (dest == NULL || destLen == NULL ||
- source == NULL ||
- blockSize100k < 1 || blockSize100k > 9 ||
- verbosity < 0 || verbosity > 4 ||
- workFactor < 0 || workFactor > 250)
- return BZ_PARAM_ERROR;
-
- if (workFactor == 0) workFactor = 30;
- strm.bzalloc = NULL;
- strm.bzfree = NULL;
- strm.opaque = NULL;
- ret = BZ2_bzCompressInit ( &strm, blockSize100k,
- verbosity, workFactor );
- if (ret != BZ_OK) return ret;
-
- strm.next_in = source;
- strm.next_out = dest;
- strm.avail_in = sourceLen;
- strm.avail_out = *destLen;
-
- ret = BZ2_bzCompress ( &strm, BZ_FINISH );
- if (ret == BZ_FINISH_OK) goto output_overflow;
- if (ret != BZ_STREAM_END) goto errhandler;
-
- /* normal termination */
- *destLen -= strm.avail_out;
- BZ2_bzCompressEnd ( &strm );
- return BZ_OK;
-
- output_overflow:
- BZ2_bzCompressEnd ( &strm );
- return BZ_OUTBUFF_FULL;
-
- errhandler:
- BZ2_bzCompressEnd ( &strm );
- return ret;
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzBuffToBuffDecompress)
- ( char* dest,
- unsigned int* destLen,
- char* source,
- unsigned int sourceLen,
- int small,
- int verbosity )
-{
- bz_stream strm;
- int ret;
-
- if (dest == NULL || destLen == NULL ||
- source == NULL ||
- (small != 0 && small != 1) ||
- verbosity < 0 || verbosity > 4)
- return BZ_PARAM_ERROR;
-
- strm.bzalloc = NULL;
- strm.bzfree = NULL;
- strm.opaque = NULL;
- ret = BZ2_bzDecompressInit ( &strm, verbosity, small );
- if (ret != BZ_OK) return ret;
-
- strm.next_in = source;
- strm.next_out = dest;
- strm.avail_in = sourceLen;
- strm.avail_out = *destLen;
-
- ret = BZ2_bzDecompress ( &strm );
- if (ret == BZ_OK) goto output_overflow_or_eof;
- if (ret != BZ_STREAM_END) goto errhandler;
-
- /* normal termination */
- *destLen -= strm.avail_out;
- BZ2_bzDecompressEnd ( &strm );
- return BZ_OK;
-
- output_overflow_or_eof:
- if (strm.avail_out > 0) {
- BZ2_bzDecompressEnd ( &strm );
- return BZ_UNEXPECTED_EOF;
- } else {
- BZ2_bzDecompressEnd ( &strm );
- return BZ_OUTBUFF_FULL;
- };
-
- errhandler:
- BZ2_bzDecompressEnd ( &strm );
- return ret;
-}
-
-
-/*---------------------------------------------------*/
-/*--
- Code contributed by Yoshioka Tsuneo
- (QWF00133@niftyserve.or.jp/tsuneo-y@is.aist-nara.ac.jp),
- to support better zlib compatibility.
- This code is not _officially_ part of libbzip2 (yet);
- I haven't tested it, documented it, or considered the
- threading-safeness of it.
- If this code breaks, please contact both Yoshioka and me.
---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------------*/
-/*--
- return version like "0.9.0c".
---*/
-const char * BZ_API(BZ2_bzlibVersion)(void)
-{
- return BZ_VERSION;
-}
-
-
-#ifndef BZ_NO_STDIO
-/*---------------------------------------------------*/
-
-#if defined(_WIN32) || defined(OS2) || defined(MSDOS)
-# include <fcntl.h>
-# include <io.h>
-# define SET_BINARY_MODE(file) setmode(fileno(file),O_BINARY)
-#else
-# define SET_BINARY_MODE(file)
-#endif
-static
-BZFILE * bzopen_or_bzdopen
- ( const char *path, /* no use when bzdopen */
- int fd, /* no use when bzdopen */
- const char *mode,
- int open_mode) /* bzopen: 0, bzdopen:1 */
-{
- int bzerr;
- char unused[BZ_MAX_UNUSED];
- int blockSize100k = 9;
- int writing = 0;
- char mode2[10] = "";
- FILE *fp = NULL;
- BZFILE *bzfp = NULL;
- int verbosity = 0;
- int workFactor = 30;
- int smallMode = 0;
- int nUnused = 0;
-
- if (mode == NULL) return NULL;
- while (*mode) {
- switch (*mode) {
- case 'r':
- writing = 0; break;
- case 'w':
- writing = 1; break;
- case 's':
- smallMode = 1; break;
- default:
- if (isdigit((int)(*mode))) {
- blockSize100k = *mode-'0';
- }
- }
- mode++;
- }
- strcat(mode2, writing ? "w" : "r" );
- strcat(mode2,"b"); /* binary mode */
-
- if (open_mode==0) {
- if (path==NULL || strcmp(path,"")==0) {
- fp = (writing ? stdout : stdin);
- SET_BINARY_MODE(fp);
- } else {
- fp = fopen(path,mode2);
- }
- } else {
-#ifdef BZ_STRICT_ANSI
- fp = NULL;
-#else
- fp = fdopen(fd,mode2);
-#endif
- }
- if (fp == NULL) return NULL;
-
- if (writing) {
- /* Guard against total chaos and anarchy -- JRS */
- if (blockSize100k < 1) blockSize100k = 1;
- if (blockSize100k > 9) blockSize100k = 9;
- bzfp = BZ2_bzWriteOpen(&bzerr,fp,blockSize100k,
- verbosity,workFactor);
- } else {
- bzfp = BZ2_bzReadOpen(&bzerr,fp,verbosity,smallMode,
- unused,nUnused);
- }
- if (bzfp == NULL) {
- if (fp != stdin && fp != stdout) fclose(fp);
- return NULL;
- }
- return bzfp;
-}
-
-
-/*---------------------------------------------------*/
-/*--
- open file for read or write.
- ex) bzopen("file","w9")
- case path="" or NULL => use stdin or stdout.
---*/
-BZFILE * BZ_API(BZ2_bzopen)
- ( const char *path,
- const char *mode )
-{
- return bzopen_or_bzdopen(path,-1,mode,/*bzopen*/0);
-}
-
-
-/*---------------------------------------------------*/
-BZFILE * BZ_API(BZ2_bzdopen)
- ( int fd,
- const char *mode )
-{
- return bzopen_or_bzdopen(NULL,fd,mode,/*bzdopen*/1);
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzread) (BZFILE* b, void* buf, int len )
-{
- int bzerr, nread;
- if (((bzFile*)b)->lastErr == BZ_STREAM_END) return 0;
- nread = BZ2_bzRead(&bzerr,b,buf,len);
- if (bzerr == BZ_OK || bzerr == BZ_STREAM_END) {
- return nread;
- } else {
- return -1;
- }
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzwrite) (BZFILE* b, void* buf, int len )
-{
- int bzerr;
-
- BZ2_bzWrite(&bzerr,b,buf,len);
- if(bzerr == BZ_OK){
- return len;
- }else{
- return -1;
- }
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzflush) (BZFILE *b)
-{
- /* do nothing now... */
- return 0;
-}
-
-
-/*---------------------------------------------------*/
-void BZ_API(BZ2_bzclose) (BZFILE* b)
-{
- int bzerr;
- FILE *fp = ((bzFile *)b)->handle;
-
- if (b==NULL) {return;}
- if(((bzFile*)b)->writing){
- BZ2_bzWriteClose(&bzerr,b,0,NULL,NULL);
- if(bzerr != BZ_OK){
- BZ2_bzWriteClose(NULL,b,1,NULL,NULL);
- }
- }else{
- BZ2_bzReadClose(&bzerr,b);
- }
- if(fp!=stdin && fp!=stdout){
- fclose(fp);
- }
-}
-
-
-/*---------------------------------------------------*/
-/*--
- return last error code
---*/
-static char *bzerrorstrings[] = {
- "OK"
- ,"SEQUENCE_ERROR"
- ,"PARAM_ERROR"
- ,"MEM_ERROR"
- ,"DATA_ERROR"
- ,"DATA_ERROR_MAGIC"
- ,"IO_ERROR"
- ,"UNEXPECTED_EOF"
- ,"OUTBUFF_FULL"
- ,"CONFIG_ERROR"
- ,"???" /* for future */
- ,"???" /* for future */
- ,"???" /* for future */
- ,"???" /* for future */
- ,"???" /* for future */
- ,"???" /* for future */
-};
-
-
-const char * BZ_API(BZ2_bzerror) (BZFILE *b, int *errnum)
-{
- int err = ((bzFile *)b)->lastErr;
-
- if(err>0) err = 0;
- *errnum = err;
- return bzerrorstrings[err*-1];
-}
-#endif
-
-
-/*-------------------------------------------------------------*/
-/*--- end bzlib.c ---*/
-/*-------------------------------------------------------------*/
diff --git a/winsup/bz2lib/bzlib.h b/winsup/bz2lib/bzlib.h
deleted file mode 100644
index c9447a295..000000000
--- a/winsup/bz2lib/bzlib.h
+++ /dev/null
@@ -1,319 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Public header file for the library. ---*/
-/*--- bzlib.h ---*/
-/*-------------------------------------------------------------*/
-
-/*--
- This file is a part of bzip2 and/or libbzip2, a program and
- library for lossless, block-sorting data compression.
-
- Copyright (C) 1996-2000 Julian R Seward. 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. The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 3. Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-
- 4. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
-
- Julian Seward, Cambridge, UK.
- jseward@acm.org
- bzip2/libbzip2 version 1.0 of 21 March 2000
-
- This program is based on (at least) the work of:
- Mike Burrows
- David Wheeler
- Peter Fenwick
- Alistair Moffat
- Radford Neal
- Ian H. Witten
- Robert Sedgewick
- Jon L. Bentley
-
- For more information on these sources, see the manual.
---*/
-
-
-#ifndef _BZLIB_H
-#define _BZLIB_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define BZ_RUN 0
-#define BZ_FLUSH 1
-#define BZ_FINISH 2
-
-#define BZ_OK 0
-#define BZ_RUN_OK 1
-#define BZ_FLUSH_OK 2
-#define BZ_FINISH_OK 3
-#define BZ_STREAM_END 4
-#define BZ_SEQUENCE_ERROR (-1)
-#define BZ_PARAM_ERROR (-2)
-#define BZ_MEM_ERROR (-3)
-#define BZ_DATA_ERROR (-4)
-#define BZ_DATA_ERROR_MAGIC (-5)
-#define BZ_IO_ERROR (-6)
-#define BZ_UNEXPECTED_EOF (-7)
-#define BZ_OUTBUFF_FULL (-8)
-#define BZ_CONFIG_ERROR (-9)
-
-typedef
- struct {
- char *next_in;
- unsigned int avail_in;
- unsigned int total_in_lo32;
- unsigned int total_in_hi32;
-
- char *next_out;
- unsigned int avail_out;
- unsigned int total_out_lo32;
- unsigned int total_out_hi32;
-
- void *state;
-
- void *(*bzalloc)(void *,int,int);
- void (*bzfree)(void *,void *);
- void *opaque;
- }
- bz_stream;
-
-
-#ifndef BZ_IMPORT
-#define BZ_EXPORT
-#endif
-
-#ifdef _WIN32
-# include <stdio.h>
-# include <windows.h>
-# ifdef small
- /* windows.h define small to char */
-# undef small
-# endif
-# ifdef BZ_EXPORT
-# define BZ_API(func) WINAPI func
-# define BZ_EXTERN extern
-# else
- /* import windows dll dynamically */
-# define BZ_API(func) (WINAPI * func)
-# define BZ_EXTERN
-# endif
-#else
-# define BZ_API(func) func
-# define BZ_EXTERN extern
-#endif
-
-
-/*-- Core (low-level) library functions --*/
-
-BZ_EXTERN int BZ_API(BZ2_bzCompressInit) (
- bz_stream* strm,
- int blockSize100k,
- int verbosity,
- int workFactor
- );
-
-BZ_EXTERN int BZ_API(BZ2_bzCompress) (
- bz_stream* strm,
- int action
- );
-
-BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) (
- bz_stream* strm
- );
-
-BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
- bz_stream *strm,
- int verbosity,
- int small
- );
-
-BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
- bz_stream* strm
- );
-
-BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
- bz_stream *strm
- );
-
-
-
-/*-- High(er) level library functions --*/
-
-#ifndef BZ_NO_STDIO
-#define BZ_MAX_UNUSED 5000
-
-typedef void BZFILE;
-
-BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) (
- int* bzerror,
- FILE* f,
- int verbosity,
- int small,
- void* unused,
- int nUnused
- );
-
-BZ_EXTERN void BZ_API(BZ2_bzReadClose) (
- int* bzerror,
- BZFILE* b
- );
-
-BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) (
- int* bzerror,
- BZFILE* b,
- void** unused,
- int* nUnused
- );
-
-BZ_EXTERN int BZ_API(BZ2_bzRead) (
- int* bzerror,
- BZFILE* b,
- void* buf,
- int len
- );
-
-BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) (
- int* bzerror,
- FILE* f,
- int blockSize100k,
- int verbosity,
- int workFactor
- );
-
-BZ_EXTERN void BZ_API(BZ2_bzWrite) (
- int* bzerror,
- BZFILE* b,
- void* buf,
- int len
- );
-
-BZ_EXTERN void BZ_API(BZ2_bzWriteClose) (
- int* bzerror,
- BZFILE* b,
- int abandon,
- unsigned int* nbytes_in,
- unsigned int* nbytes_out
- );
-
-BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) (
- int* bzerror,
- BZFILE* b,
- int abandon,
- unsigned int* nbytes_in_lo32,
- unsigned int* nbytes_in_hi32,
- unsigned int* nbytes_out_lo32,
- unsigned int* nbytes_out_hi32
- );
-#endif
-
-
-/*-- Utility functions --*/
-
-BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) (
- char* dest,
- unsigned int* destLen,
- char* source,
- unsigned int sourceLen,
- int blockSize100k,
- int verbosity,
- int workFactor
- );
-
-BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
- char* dest,
- unsigned int* destLen,
- char* source,
- unsigned int sourceLen,
- int small,
- int verbosity
- );
-
-
-/*--
- Code contributed by Yoshioka Tsuneo
- (QWF00133@niftyserve.or.jp/tsuneo-y@is.aist-nara.ac.jp),
- to support better zlib compatibility.
- This code is not _officially_ part of libbzip2 (yet);
- I haven't tested it, documented it, or considered the
- threading-safeness of it.
- If this code breaks, please contact both Yoshioka and me.
---*/
-
-BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
- void
- );
-
-#ifndef BZ_NO_STDIO
-BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (
- const char *path,
- const char *mode
- );
-
-BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
- int fd,
- const char *mode
- );
-
-BZ_EXTERN int BZ_API(BZ2_bzread) (
- BZFILE* b,
- void* buf,
- int len
- );
-
-BZ_EXTERN int BZ_API(BZ2_bzwrite) (
- BZFILE* b,
- void* buf,
- int len
- );
-
-BZ_EXTERN int BZ_API(BZ2_bzflush) (
- BZFILE* b
- );
-
-BZ_EXTERN void BZ_API(BZ2_bzclose) (
- BZFILE* b
- );
-
-BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
- BZFILE *b,
- int *errnum
- );
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/*-------------------------------------------------------------*/
-/*--- end bzlib.h ---*/
-/*-------------------------------------------------------------*/
diff --git a/winsup/bz2lib/bzlib_private.h b/winsup/bz2lib/bzlib_private.h
deleted file mode 100644
index fb51c7a1d..000000000
--- a/winsup/bz2lib/bzlib_private.h
+++ /dev/null
@@ -1,530 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Private header file for the library. ---*/
-/*--- bzlib_private.h ---*/
-/*-------------------------------------------------------------*/
-
-/*--
- This file is a part of bzip2 and/or libbzip2, a program and
- library for lossless, block-sorting data compression.
-
- Copyright (C) 1996-2000 Julian R Seward. 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. The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 3. Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-
- 4. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
-
- Julian Seward, Cambridge, UK.
- jseward@acm.org
- bzip2/libbzip2 version 1.0 of 21 March 2000
-
- This program is based on (at least) the work of:
- Mike Burrows
- David Wheeler
- Peter Fenwick
- Alistair Moffat
- Radford Neal
- Ian H. Witten
- Robert Sedgewick
- Jon L. Bentley
-
- For more information on these sources, see the manual.
---*/
-
-
-#ifndef _BZLIB_PRIVATE_H
-#define _BZLIB_PRIVATE_H
-
-#include <stdlib.h>
-
-#ifndef BZ_NO_STDIO
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#endif
-
-#include "bzlib.h"
-
-
-
-/*-- General stuff. --*/
-
-#define BZ_VERSION "1.0.1, 23-June-2000"
-
-typedef char Char;
-typedef unsigned char Bool;
-typedef unsigned char UChar;
-typedef int Int32;
-typedef unsigned int UInt32;
-typedef short Int16;
-typedef unsigned short UInt16;
-
-#define True ((Bool)1)
-#define False ((Bool)0)
-
-#ifndef __GNUC__
-#define __inline__ /* */
-#endif
-
-#ifndef BZ_NO_STDIO
-extern void BZ2_bz__AssertH__fail ( int errcode );
-#define AssertH(cond,errcode) \
- { if (!(cond)) BZ2_bz__AssertH__fail ( errcode ); }
-#if BZ_DEBUG
-#define AssertD(cond,msg) \
- { if (!(cond)) { \
- fprintf ( stderr, \
- "\n\nlibbzip2(debug build): internal error\n\t%s\n", msg );\
- exit(1); \
- }}
-#else
-#define AssertD(cond,msg) /* */
-#endif
-#define VPrintf0(zf) \
- fprintf(stderr,zf)
-#define VPrintf1(zf,za1) \
- fprintf(stderr,zf,za1)
-#define VPrintf2(zf,za1,za2) \
- fprintf(stderr,zf,za1,za2)
-#define VPrintf3(zf,za1,za2,za3) \
- fprintf(stderr,zf,za1,za2,za3)
-#define VPrintf4(zf,za1,za2,za3,za4) \
- fprintf(stderr,zf,za1,za2,za3,za4)
-#define VPrintf5(zf,za1,za2,za3,za4,za5) \
- fprintf(stderr,zf,za1,za2,za3,za4,za5)
-#else
-extern void bz_internal_error ( int errcode );
-#define AssertH(cond,errcode) \
- { if (!(cond)) bz_internal_error ( errcode ); }
-#define AssertD(cond,msg) /* */
-#define VPrintf0(zf) /* */
-#define VPrintf1(zf,za1) /* */
-#define VPrintf2(zf,za1,za2) /* */
-#define VPrintf3(zf,za1,za2,za3) /* */
-#define VPrintf4(zf,za1,za2,za3,za4) /* */
-#define VPrintf5(zf,za1,za2,za3,za4,za5) /* */
-#endif
-
-
-#define BZALLOC(nnn) (strm->bzalloc)(strm->opaque,(nnn),1)
-#define BZFREE(ppp) (strm->bzfree)(strm->opaque,(ppp))
-
-
-/*-- Constants for the back end. --*/
-
-#define BZ_MAX_ALPHA_SIZE 258
-#define BZ_MAX_CODE_LEN 23
-
-#define BZ_RUNA 0
-#define BZ_RUNB 1
-
-#define BZ_N_GROUPS 6
-#define BZ_G_SIZE 50
-#define BZ_N_ITERS 4
-
-#define BZ_MAX_SELECTORS (2 + (900000 / BZ_G_SIZE))
-
-
-
-/*-- Stuff for randomising repetitive blocks. --*/
-
-extern Int32 BZ2_rNums[512];
-
-#define BZ_RAND_DECLS \
- Int32 rNToGo; \
- Int32 rTPos \
-
-#define BZ_RAND_INIT_MASK \
- s->rNToGo = 0; \
- s->rTPos = 0 \
-
-#define BZ_RAND_MASK ((s->rNToGo == 1) ? 1 : 0)
-
-#define BZ_RAND_UPD_MASK \
- if (s->rNToGo == 0) { \
- s->rNToGo = BZ2_rNums[s->rTPos]; \
- s->rTPos++; \
- if (s->rTPos == 512) s->rTPos = 0; \
- } \
- s->rNToGo--;
-
-
-
-/*-- Stuff for doing CRCs. --*/
-
-extern UInt32 BZ2_crc32Table[256];
-
-#define BZ_INITIALISE_CRC(crcVar) \
-{ \
- crcVar = 0xffffffffL; \
-}
-
-#define BZ_FINALISE_CRC(crcVar) \
-{ \
- crcVar = ~(crcVar); \
-}
-
-#define BZ_UPDATE_CRC(crcVar,cha) \
-{ \
- crcVar = (crcVar << 8) ^ \
- BZ2_crc32Table[(crcVar >> 24) ^ \
- ((UChar)cha)]; \
-}
-
-
-
-/*-- States and modes for compression. --*/
-
-#define BZ_M_IDLE 1
-#define BZ_M_RUNNING 2
-#define BZ_M_FLUSHING 3
-#define BZ_M_FINISHING 4
-
-#define BZ_S_OUTPUT 1
-#define BZ_S_INPUT 2
-
-#define BZ_N_RADIX 2
-#define BZ_N_QSORT 12
-#define BZ_N_SHELL 18
-#define BZ_N_OVERSHOOT (BZ_N_RADIX + BZ_N_QSORT + BZ_N_SHELL + 2)
-
-
-
-
-/*-- Structure holding all the compression-side stuff. --*/
-
-typedef
- struct {
- /* pointer back to the struct bz_stream */
- bz_stream* strm;
-
- /* mode this stream is in, and whether inputting */
- /* or outputting data */
- Int32 mode;
- Int32 state;
-
- /* remembers avail_in when flush/finish requested */
- UInt32 avail_in_expect;
-
- /* for doing the block sorting */
- UInt32* arr1;
- UInt32* arr2;
- UInt32* ftab;
- Int32 origPtr;
-
- /* aliases for arr1 and arr2 */
- UInt32* ptr;
- UChar* block;
- UInt16* mtfv;
- UChar* zbits;
-
- /* for deciding when to use the fallback sorting algorithm */
- Int32 workFactor;
-
- /* run-length-encoding of the input */
- UInt32 state_in_ch;
- Int32 state_in_len;
- BZ_RAND_DECLS;
-
- /* input and output limits and current posns */
- Int32 nblock;
- Int32 nblockMAX;
- Int32 numZ;
- Int32 state_out_pos;
-
- /* map of bytes used in block */
- Int32 nInUse;
- Bool inUse[256];
- UChar unseqToSeq[256];
-
- /* the buffer for bit stream creation */
- UInt32 bsBuff;
- Int32 bsLive;
-
- /* block and combined CRCs */
- UInt32 blockCRC;
- UInt32 combinedCRC;
-
- /* misc administratium */
- Int32 verbosity;
- Int32 blockNo;
- Int32 blockSize100k;
-
- /* stuff for coding the MTF values */
- Int32 nMTF;
- Int32 mtfFreq [BZ_MAX_ALPHA_SIZE];
- UChar selector [BZ_MAX_SELECTORS];
- UChar selectorMtf[BZ_MAX_SELECTORS];
-
- UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
- Int32 code [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
- Int32 rfreq [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
- /* second dimension: only 3 needed; 4 makes index calculations faster */
- UInt32 len_pack[BZ_MAX_ALPHA_SIZE][4];
-
- }
- EState;
-
-
-
-/*-- externs for compression. --*/
-
-extern void
-BZ2_blockSort ( EState* );
-
-extern void
-BZ2_compressBlock ( EState*, Bool );
-
-extern void
-BZ2_bsInitWrite ( EState* );
-
-extern void
-BZ2_hbAssignCodes ( Int32*, UChar*, Int32, Int32, Int32 );
-
-extern void
-BZ2_hbMakeCodeLengths ( UChar*, Int32*, Int32, Int32 );
-
-
-
-/*-- states for decompression. --*/
-
-#define BZ_X_IDLE 1
-#define BZ_X_OUTPUT 2
-
-#define BZ_X_MAGIC_1 10
-#define BZ_X_MAGIC_2 11
-#define BZ_X_MAGIC_3 12
-#define BZ_X_MAGIC_4 13
-#define BZ_X_BLKHDR_1 14
-#define BZ_X_BLKHDR_2 15
-#define BZ_X_BLKHDR_3 16
-#define BZ_X_BLKHDR_4 17
-#define BZ_X_BLKHDR_5 18
-#define BZ_X_BLKHDR_6 19
-#define BZ_X_BCRC_1 20
-#define BZ_X_BCRC_2 21
-#define BZ_X_BCRC_3 22
-#define BZ_X_BCRC_4 23
-#define BZ_X_RANDBIT 24
-#define BZ_X_ORIGPTR_1 25
-#define BZ_X_ORIGPTR_2 26
-#define BZ_X_ORIGPTR_3 27
-#define BZ_X_MAPPING_1 28
-#define BZ_X_MAPPING_2 29
-#define BZ_X_SELECTOR_1 30
-#define BZ_X_SELECTOR_2 31
-#define BZ_X_SELECTOR_3 32
-#define BZ_X_CODING_1 33
-#define BZ_X_CODING_2 34
-#define BZ_X_CODING_3 35
-#define BZ_X_MTF_1 36
-#define BZ_X_MTF_2 37
-#define BZ_X_MTF_3 38
-#define BZ_X_MTF_4 39
-#define BZ_X_MTF_5 40
-#define BZ_X_MTF_6 41
-#define BZ_X_ENDHDR_2 42
-#define BZ_X_ENDHDR_3 43
-#define BZ_X_ENDHDR_4 44
-#define BZ_X_ENDHDR_5 45
-#define BZ_X_ENDHDR_6 46
-#define BZ_X_CCRC_1 47
-#define BZ_X_CCRC_2 48
-#define BZ_X_CCRC_3 49
-#define BZ_X_CCRC_4 50
-
-
-
-/*-- Constants for the fast MTF decoder. --*/
-
-#define MTFA_SIZE 4096
-#define MTFL_SIZE 16
-
-
-
-/*-- Structure holding all the decompression-side stuff. --*/
-
-typedef
- struct {
- /* pointer back to the struct bz_stream */
- bz_stream* strm;
-
- /* state indicator for this stream */
- Int32 state;
-
- /* for doing the final run-length decoding */
- UChar state_out_ch;
- Int32 state_out_len;
- Bool blockRandomised;
- BZ_RAND_DECLS;
-
- /* the buffer for bit stream reading */
- UInt32 bsBuff;
- Int32 bsLive;
-
- /* misc administratium */
- Int32 blockSize100k;
- Bool smallDecompress;
- Int32 currBlockNo;
- Int32 verbosity;
-
- /* for undoing the Burrows-Wheeler transform */
- Int32 origPtr;
- UInt32 tPos;
- Int32 k0;
- Int32 unzftab[256];
- Int32 nblock_used;
- Int32 cftab[257];
- Int32 cftabCopy[257];
-
- /* for undoing the Burrows-Wheeler transform (FAST) */
- UInt32 *tt;
-
- /* for undoing the Burrows-Wheeler transform (SMALL) */
- UInt16 *ll16;
- UChar *ll4;
-
- /* stored and calculated CRCs */
- UInt32 storedBlockCRC;
- UInt32 storedCombinedCRC;
- UInt32 calculatedBlockCRC;
- UInt32 calculatedCombinedCRC;
-
- /* map of bytes used in block */
- Int32 nInUse;
- Bool inUse[256];
- Bool inUse16[16];
- UChar seqToUnseq[256];
-
- /* for decoding the MTF values */
- UChar mtfa [MTFA_SIZE];
- Int32 mtfbase[256 / MTFL_SIZE];
- UChar selector [BZ_MAX_SELECTORS];
- UChar selectorMtf[BZ_MAX_SELECTORS];
- UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
-
- Int32 limit [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
- Int32 base [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
- Int32 perm [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
- Int32 minLens[BZ_N_GROUPS];
-
- /* save area for scalars in the main decompress code */
- Int32 save_i;
- Int32 save_j;
- Int32 save_t;
- Int32 save_alphaSize;
- Int32 save_nGroups;
- Int32 save_nSelectors;
- Int32 save_EOB;
- Int32 save_groupNo;
- Int32 save_groupPos;
- Int32 save_nextSym;
- Int32 save_nblockMAX;
- Int32 save_nblock;
- Int32 save_es;
- Int32 save_N;
- Int32 save_curr;
- Int32 save_zt;
- Int32 save_zn;
- Int32 save_zvec;
- Int32 save_zj;
- Int32 save_gSel;
- Int32 save_gMinlen;
- Int32* save_gLimit;
- Int32* save_gBase;
- Int32* save_gPerm;
-
- }
- DState;
-
-
-
-/*-- Macros for decompression. --*/
-
-#define BZ_GET_FAST(cccc) \
- s->tPos = s->tt[s->tPos]; \
- cccc = (UChar)(s->tPos & 0xff); \
- s->tPos >>= 8;
-
-#define BZ_GET_FAST_C(cccc) \
- c_tPos = c_tt[c_tPos]; \
- cccc = (UChar)(c_tPos & 0xff); \
- c_tPos >>= 8;
-
-#define SET_LL4(i,n) \
- { if (((i) & 0x1) == 0) \
- s->ll4[(i) >> 1] = (s->ll4[(i) >> 1] & 0xf0) | (n); else \
- s->ll4[(i) >> 1] = (s->ll4[(i) >> 1] & 0x0f) | ((n) << 4); \
- }
-
-#define GET_LL4(i) \
- ((((UInt32)(s->ll4[(i) >> 1])) >> (((i) << 2) & 0x4)) & 0xF)
-
-#define SET_LL(i,n) \
- { s->ll16[i] = (UInt16)(n & 0x0000ffff); \
- SET_LL4(i, n >> 16); \
- }
-
-#define GET_LL(i) \
- (((UInt32)s->ll16[i]) | (GET_LL4(i) << 16))
-
-#define BZ_GET_SMALL(cccc) \
- cccc = BZ2_indexIntoF ( s->tPos, s->cftab ); \
- s->tPos = GET_LL(s->tPos);
-
-
-/*-- externs for decompression. --*/
-
-extern Int32
-BZ2_indexIntoF ( Int32, Int32* );
-
-extern Int32
-BZ2_decompress ( DState* );
-
-extern void
-BZ2_hbCreateDecodeTables ( Int32*, Int32*, Int32*, UChar*,
- Int32, Int32, Int32 );
-
-
-#endif
-
-
-/*-- BZ_NO_STDIO seems to make NULL disappear on some platforms. --*/
-
-#ifdef BZ_NO_STDIO
-#ifndef NULL
-#define NULL 0
-#endif
-#endif
-
-
-/*-------------------------------------------------------------*/
-/*--- end bzlib_private.h ---*/
-/*-------------------------------------------------------------*/
diff --git a/winsup/bz2lib/compress.c b/winsup/bz2lib/compress.c
deleted file mode 100644
index cc5e31d6f..000000000
--- a/winsup/bz2lib/compress.c
+++ /dev/null
@@ -1,714 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Compression machinery (not incl block sorting) ---*/
-/*--- compress.c ---*/
-/*-------------------------------------------------------------*/
-
-/*--
- This file is a part of bzip2 and/or libbzip2, a program and
- library for lossless, block-sorting data compression.
-
- Copyright (C) 1996-2000 Julian R Seward. 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. The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 3. Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-
- 4. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
-
- Julian Seward, Cambridge, UK.
- jseward@acm.org
- bzip2/libbzip2 version 1.0 of 21 March 2000
-
- This program is based on (at least) the work of:
- Mike Burrows
- David Wheeler
- Peter Fenwick
- Alistair Moffat
- Radford Neal
- Ian H. Witten
- Robert Sedgewick
- Jon L. Bentley
-
- For more information on these sources, see the manual.
---*/
-
-/*--
- CHANGES
- ~~~~~~~
- 0.9.0 -- original version.
-
- 0.9.0a/b -- no changes in this file.
-
- 0.9.0c
- * changed setting of nGroups in sendMTFValues() so as to
- do a bit better on small files
---*/
-
-#include "bzlib_private.h"
-
-
-/*---------------------------------------------------*/
-/*--- Bit stream I/O ---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------------*/
-void BZ2_bsInitWrite ( EState* s )
-{
- s->bsLive = 0;
- s->bsBuff = 0;
-}
-
-
-/*---------------------------------------------------*/
-static
-void bsFinishWrite ( EState* s )
-{
- while (s->bsLive > 0) {
- s->zbits[s->numZ] = (UChar)(s->bsBuff >> 24);
- s->numZ++;
- s->bsBuff <<= 8;
- s->bsLive -= 8;
- }
-}
-
-
-/*---------------------------------------------------*/
-#define bsNEEDW(nz) \
-{ \
- while (s->bsLive >= 8) { \
- s->zbits[s->numZ] \
- = (UChar)(s->bsBuff >> 24); \
- s->numZ++; \
- s->bsBuff <<= 8; \
- s->bsLive -= 8; \
- } \
-}
-
-
-/*---------------------------------------------------*/
-static
-__inline__
-void bsW ( EState* s, Int32 n, UInt32 v )
-{
- bsNEEDW ( n );
- s->bsBuff |= (v << (32 - s->bsLive - n));
- s->bsLive += n;
-}
-
-
-/*---------------------------------------------------*/
-static
-void bsPutUInt32 ( EState* s, UInt32 u )
-{
- bsW ( s, 8, (u >> 24) & 0xffL );
- bsW ( s, 8, (u >> 16) & 0xffL );
- bsW ( s, 8, (u >> 8) & 0xffL );
- bsW ( s, 8, u & 0xffL );
-}
-
-
-/*---------------------------------------------------*/
-static
-void bsPutUChar ( EState* s, UChar c )
-{
- bsW( s, 8, (UInt32)c );
-}
-
-
-/*---------------------------------------------------*/
-/*--- The back end proper ---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------------*/
-static
-void makeMaps_e ( EState* s )
-{
- Int32 i;
- s->nInUse = 0;
- for (i = 0; i < 256; i++)
- if (s->inUse[i]) {
- s->unseqToSeq[i] = s->nInUse;
- s->nInUse++;
- }
-}
-
-
-/*---------------------------------------------------*/
-static
-void generateMTFValues ( EState* s )
-{
- UChar yy[256];
- Int32 i, j;
- Int32 zPend;
- Int32 wr;
- Int32 EOB;
-
- /*
- After sorting (eg, here),
- s->arr1 [ 0 .. s->nblock-1 ] holds sorted order,
- and
- ((UChar*)s->arr2) [ 0 .. s->nblock-1 ]
- holds the original block data.
-
- The first thing to do is generate the MTF values,
- and put them in
- ((UInt16*)s->arr1) [ 0 .. s->nblock-1 ].
- Because there are strictly fewer or equal MTF values
- than block values, ptr values in this area are overwritten
- with MTF values only when they are no longer needed.
-
- The final compressed bitstream is generated into the
- area starting at
- (UChar*) (&((UChar*)s->arr2)[s->nblock])
-
- These storage aliases are set up in bzCompressInit(),
- except for the last one, which is arranged in
- compressBlock().
- */
- UInt32* ptr = s->ptr;
- UChar* block = s->block;
- UInt16* mtfv = s->mtfv;
-
- makeMaps_e ( s );
- EOB = s->nInUse+1;
-
- for (i = 0; i <= EOB; i++) s->mtfFreq[i] = 0;
-
- wr = 0;
- zPend = 0;
- for (i = 0; i < s->nInUse; i++) yy[i] = (UChar) i;
-
- for (i = 0; i < s->nblock; i++) {
- UChar ll_i;
- AssertD ( wr <= i, "generateMTFValues(1)" );
- j = ptr[i]-1; if (j < 0) j += s->nblock;
- ll_i = s->unseqToSeq[block[j]];
- AssertD ( ll_i < s->nInUse, "generateMTFValues(2a)" );
-
- if (yy[0] == ll_i) {
- zPend++;
- } else {
-
- if (zPend > 0) {
- zPend--;
- while (True) {
- if (zPend & 1) {
- mtfv[wr] = BZ_RUNB; wr++;
- s->mtfFreq[BZ_RUNB]++;
- } else {
- mtfv[wr] = BZ_RUNA; wr++;
- s->mtfFreq[BZ_RUNA]++;
- }
- if (zPend < 2) break;
- zPend = (zPend - 2) / 2;
- };
- zPend = 0;
- }
- {
- register UChar rtmp;
- register UChar* ryy_j;
- register UChar rll_i;
- rtmp = yy[1];
- yy[1] = yy[0];
- ryy_j = &(yy[1]);
- rll_i = ll_i;
- while ( rll_i != rtmp ) {
- register UChar rtmp2;
- ryy_j++;
- rtmp2 = rtmp;
- rtmp = *ryy_j;
- *ryy_j = rtmp2;
- };
- yy[0] = rtmp;
- j = ryy_j - &(yy[0]);
- mtfv[wr] = j+1; wr++; s->mtfFreq[j+1]++;
- }
-
- }
- }
-
- if (zPend > 0) {
- zPend--;
- while (True) {
- if (zPend & 1) {
- mtfv[wr] = BZ_RUNB; wr++;
- s->mtfFreq[BZ_RUNB]++;
- } else {
- mtfv[wr] = BZ_RUNA; wr++;
- s->mtfFreq[BZ_RUNA]++;
- }
- if (zPend < 2) break;
- zPend = (zPend - 2) / 2;
- };
- zPend = 0;
- }
-
- mtfv[wr] = EOB; wr++; s->mtfFreq[EOB]++;
-
- s->nMTF = wr;
-}
-
-
-/*---------------------------------------------------*/
-#define BZ_LESSER_ICOST 0
-#define BZ_GREATER_ICOST 15
-
-static
-void sendMTFValues ( EState* s )
-{
- Int32 v, t, i, j, gs, ge, totc, bt, bc, iter;
- Int32 nSelectors, alphaSize, minLen, maxLen, selCtr;
- Int32 nGroups, nBytes;
-
- /*--
- UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
- is a global since the decoder also needs it.
-
- Int32 code[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
- Int32 rfreq[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
- are also globals only used in this proc.
- Made global to keep stack frame size small.
- --*/
-
-
- UInt16 cost[BZ_N_GROUPS];
- Int32 fave[BZ_N_GROUPS];
-
- UInt16* mtfv = s->mtfv;
-
- if (s->verbosity >= 3)
- VPrintf3( " %d in block, %d after MTF & 1-2 coding, "
- "%d+2 syms in use\n",
- s->nblock, s->nMTF, s->nInUse );
-
- alphaSize = s->nInUse+2;
- for (t = 0; t < BZ_N_GROUPS; t++)
- for (v = 0; v < alphaSize; v++)
- s->len[t][v] = BZ_GREATER_ICOST;
-
- /*--- Decide how many coding tables to use ---*/
- AssertH ( s->nMTF > 0, 3001 );
- if (s->nMTF < 200) nGroups = 2; else
- if (s->nMTF < 600) nGroups = 3; else
- if (s->nMTF < 1200) nGroups = 4; else
- if (s->nMTF < 2400) nGroups = 5; else
- nGroups = 6;
-
- /*--- Generate an initial set of coding tables ---*/
- {
- Int32 nPart, remF, tFreq, aFreq;
-
- nPart = nGroups;
- remF = s->nMTF;
- gs = 0;
- while (nPart > 0) {
- tFreq = remF / nPart;
- ge = gs-1;
- aFreq = 0;
- while (aFreq < tFreq && ge < alphaSize-1) {
- ge++;
- aFreq += s->mtfFreq[ge];
- }
-
- if (ge > gs
- && nPart != nGroups && nPart != 1
- && ((nGroups-nPart) % 2 == 1)) {
- aFreq -= s->mtfFreq[ge];
- ge--;
- }
-
- if (s->verbosity >= 3)
- VPrintf5( " initial group %d, [%d .. %d], "
- "has %d syms (%4.1f%%)\n",
- nPart, gs, ge, aFreq,
- (100.0 * (float)aFreq) / (float)(s->nMTF) );
-
- for (v = 0; v < alphaSize; v++)
- if (v >= gs && v <= ge)
- s->len[nPart-1][v] = BZ_LESSER_ICOST; else
- s->len[nPart-1][v] = BZ_GREATER_ICOST;
-
- nPart--;
- gs = ge+1;
- remF -= aFreq;
- }
- }
-
- /*---
- Iterate up to BZ_N_ITERS times to improve the tables.
- ---*/
- for (iter = 0; iter < BZ_N_ITERS; iter++) {
-
- for (t = 0; t < nGroups; t++) fave[t] = 0;
-
- for (t = 0; t < nGroups; t++)
- for (v = 0; v < alphaSize; v++)
- s->rfreq[t][v] = 0;
-
- /*---
- Set up an auxiliary length table which is used to fast-track
- the common case (nGroups == 6).
- ---*/
- if (nGroups == 6) {
- for (v = 0; v < alphaSize; v++) {
- s->len_pack[v][0] = (s->len[1][v] << 16) | s->len[0][v];
- s->len_pack[v][1] = (s->len[3][v] << 16) | s->len[2][v];
- s->len_pack[v][2] = (s->len[5][v] << 16) | s->len[4][v];
- }
- }
-
- nSelectors = 0;
- totc = 0;
- gs = 0;
- while (True) {
-
- /*--- Set group start & end marks. --*/
- if (gs >= s->nMTF) break;
- ge = gs + BZ_G_SIZE - 1;
- if (ge >= s->nMTF) ge = s->nMTF-1;
-
- /*--
- Calculate the cost of this group as coded
- by each of the coding tables.
- --*/
- for (t = 0; t < nGroups; t++) cost[t] = 0;
-
- if (nGroups == 6 && 50 == ge-gs+1) {
- /*--- fast track the common case ---*/
- register UInt32 cost01, cost23, cost45;
- register UInt16 icv;
- cost01 = cost23 = cost45 = 0;
-
-# define BZ_ITER(nn) \
- icv = mtfv[gs+(nn)]; \
- cost01 += s->len_pack[icv][0]; \
- cost23 += s->len_pack[icv][1]; \
- cost45 += s->len_pack[icv][2]; \
-
- BZ_ITER(0); BZ_ITER(1); BZ_ITER(2); BZ_ITER(3); BZ_ITER(4);
- BZ_ITER(5); BZ_ITER(6); BZ_ITER(7); BZ_ITER(8); BZ_ITER(9);
- BZ_ITER(10); BZ_ITER(11); BZ_ITER(12); BZ_ITER(13); BZ_ITER(14);
- BZ_ITER(15); BZ_ITER(16); BZ_ITER(17); BZ_ITER(18); BZ_ITER(19);
- BZ_ITER(20); BZ_ITER(21); BZ_ITER(22); BZ_ITER(23); BZ_ITER(24);
- BZ_ITER(25); BZ_ITER(26); BZ_ITER(27); BZ_ITER(28); BZ_ITER(29);
- BZ_ITER(30); BZ_ITER(31); BZ_ITER(32); BZ_ITER(33); BZ_ITER(34);
- BZ_ITER(35); BZ_ITER(36); BZ_ITER(37); BZ_ITER(38); BZ_ITER(39);
- BZ_ITER(40); BZ_ITER(41); BZ_ITER(42); BZ_ITER(43); BZ_ITER(44);
- BZ_ITER(45); BZ_ITER(46); BZ_ITER(47); BZ_ITER(48); BZ_ITER(49);
-
-# undef BZ_ITER
-
- cost[0] = cost01 & 0xffff; cost[1] = cost01 >> 16;
- cost[2] = cost23 & 0xffff; cost[3] = cost23 >> 16;
- cost[4] = cost45 & 0xffff; cost[5] = cost45 >> 16;
-
- } else {
- /*--- slow version which correctly handles all situations ---*/
- for (i = gs; i <= ge; i++) {
- UInt16 icv = mtfv[i];
- for (t = 0; t < nGroups; t++) cost[t] += s->len[t][icv];
- }
- }
-
- /*--
- Find the coding table which is best for this group,
- and record its identity in the selector table.
- --*/
- bc = 999999999; bt = -1;
- for (t = 0; t < nGroups; t++)
- if (cost[t] < bc) { bc = cost[t]; bt = t; };
- totc += bc;
- fave[bt]++;
- s->selector[nSelectors] = bt;
- nSelectors++;
-
- /*--
- Increment the symbol frequencies for the selected table.
- --*/
- if (nGroups == 6 && 50 == ge-gs+1) {
- /*--- fast track the common case ---*/
-
-# define BZ_ITUR(nn) s->rfreq[bt][ mtfv[gs+(nn)] ]++
-
- BZ_ITUR(0); BZ_ITUR(1); BZ_ITUR(2); BZ_ITUR(3); BZ_ITUR(4);
- BZ_ITUR(5); BZ_ITUR(6); BZ_ITUR(7); BZ_ITUR(8); BZ_ITUR(9);
- BZ_ITUR(10); BZ_ITUR(11); BZ_ITUR(12); BZ_ITUR(13); BZ_ITUR(14);
- BZ_ITUR(15); BZ_ITUR(16); BZ_ITUR(17); BZ_ITUR(18); BZ_ITUR(19);
- BZ_ITUR(20); BZ_ITUR(21); BZ_ITUR(22); BZ_ITUR(23); BZ_ITUR(24);
- BZ_ITUR(25); BZ_ITUR(26); BZ_ITUR(27); BZ_ITUR(28); BZ_ITUR(29);
- BZ_ITUR(30); BZ_ITUR(31); BZ_ITUR(32); BZ_ITUR(33); BZ_ITUR(34);
- BZ_ITUR(35); BZ_ITUR(36); BZ_ITUR(37); BZ_ITUR(38); BZ_ITUR(39);
- BZ_ITUR(40); BZ_ITUR(41); BZ_ITUR(42); BZ_ITUR(43); BZ_ITUR(44);
- BZ_ITUR(45); BZ_ITUR(46); BZ_ITUR(47); BZ_ITUR(48); BZ_ITUR(49);
-
-# undef BZ_ITUR
-
- } else {
- /*--- slow version which correctly handles all situations ---*/
- for (i = gs; i <= ge; i++)
- s->rfreq[bt][ mtfv[i] ]++;
- }
-
- gs = ge+1;
- }
- if (s->verbosity >= 3) {
- VPrintf2 ( " pass %d: size is %d, grp uses are ",
- iter+1, totc/8 );
- for (t = 0; t < nGroups; t++)
- VPrintf1 ( "%d ", fave[t] );
- VPrintf0 ( "\n" );
- }
-
- /*--
- Recompute the tables based on the accumulated frequencies.
- --*/
- for (t = 0; t < nGroups; t++)
- BZ2_hbMakeCodeLengths ( &(s->len[t][0]), &(s->rfreq[t][0]),
- alphaSize, 20 );
- }
-
-
- AssertH( nGroups < 8, 3002 );
- AssertH( nSelectors < 32768 &&
- nSelectors <= (2 + (900000 / BZ_G_SIZE)),
- 3003 );
-
-
- /*--- Compute MTF values for the selectors. ---*/
- {
- UChar pos[BZ_N_GROUPS], ll_i, tmp2, tmp;
- for (i = 0; i < nGroups; i++) pos[i] = i;
- for (i = 0; i < nSelectors; i++) {
- ll_i = s->selector[i];
- j = 0;
- tmp = pos[j];
- while ( ll_i != tmp ) {
- j++;
- tmp2 = tmp;
- tmp = pos[j];
- pos[j] = tmp2;
- };
- pos[0] = tmp;
- s->selectorMtf[i] = j;
- }
- };
-
- /*--- Assign actual codes for the tables. --*/
- for (t = 0; t < nGroups; t++) {
- minLen = 32;
- maxLen = 0;
- for (i = 0; i < alphaSize; i++) {
- if (s->len[t][i] > maxLen) maxLen = s->len[t][i];
- if (s->len[t][i] < minLen) minLen = s->len[t][i];
- }
- AssertH ( !(maxLen > 20), 3004 );
- AssertH ( !(minLen < 1), 3005 );
- BZ2_hbAssignCodes ( &(s->code[t][0]), &(s->len[t][0]),
- minLen, maxLen, alphaSize );
- }
-
- /*--- Transmit the mapping table. ---*/
- {
- Bool inUse16[16];
- for (i = 0; i < 16; i++) {
- inUse16[i] = False;
- for (j = 0; j < 16; j++)
- if (s->inUse[i * 16 + j]) inUse16[i] = True;
- }
-
- nBytes = s->numZ;
- for (i = 0; i < 16; i++)
- if (inUse16[i]) bsW(s,1,1); else bsW(s,1,0);
-
- for (i = 0; i < 16; i++)
- if (inUse16[i])
- for (j = 0; j < 16; j++) {
- if (s->inUse[i * 16 + j]) bsW(s,1,1); else bsW(s,1,0);
- }
-
- if (s->verbosity >= 3)
- VPrintf1( " bytes: mapping %d, ", s->numZ-nBytes );
- }
-
- /*--- Now the selectors. ---*/
- nBytes = s->numZ;
- bsW ( s, 3, nGroups );
- bsW ( s, 15, nSelectors );
- for (i = 0; i < nSelectors; i++) {
- for (j = 0; j < s->selectorMtf[i]; j++) bsW(s,1,1);
- bsW(s,1,0);
- }
- if (s->verbosity >= 3)
- VPrintf1( "selectors %d, ", s->numZ-nBytes );
-
- /*--- Now the coding tables. ---*/
- nBytes = s->numZ;
-
- for (t = 0; t < nGroups; t++) {
- Int32 curr = s->len[t][0];
- bsW ( s, 5, curr );
- for (i = 0; i < alphaSize; i++) {
- while (curr < s->len[t][i]) { bsW(s,2,2); curr++; /* 10 */ };
- while (curr > s->len[t][i]) { bsW(s,2,3); curr--; /* 11 */ };
- bsW ( s, 1, 0 );
- }
- }
-
- if (s->verbosity >= 3)
- VPrintf1 ( "code lengths %d, ", s->numZ-nBytes );
-
- /*--- And finally, the block data proper ---*/
- nBytes = s->numZ;
- selCtr = 0;
- gs = 0;
- while (True) {
- if (gs >= s->nMTF) break;
- ge = gs + BZ_G_SIZE - 1;
- if (ge >= s->nMTF) ge = s->nMTF-1;
- AssertH ( s->selector[selCtr] < nGroups, 3006 );
-
- if (nGroups == 6 && 50 == ge-gs+1) {
- /*--- fast track the common case ---*/
- UInt16 mtfv_i;
- UChar* s_len_sel_selCtr
- = &(s->len[s->selector[selCtr]][0]);
- Int32* s_code_sel_selCtr
- = &(s->code[s->selector[selCtr]][0]);
-
-# define BZ_ITAH(nn) \
- mtfv_i = mtfv[gs+(nn)]; \
- bsW ( s, \
- s_len_sel_selCtr[mtfv_i], \
- s_code_sel_selCtr[mtfv_i] )
-
- BZ_ITAH(0); BZ_ITAH(1); BZ_ITAH(2); BZ_ITAH(3); BZ_ITAH(4);
- BZ_ITAH(5); BZ_ITAH(6); BZ_ITAH(7); BZ_ITAH(8); BZ_ITAH(9);
- BZ_ITAH(10); BZ_ITAH(11); BZ_ITAH(12); BZ_ITAH(13); BZ_ITAH(14);
- BZ_ITAH(15); BZ_ITAH(16); BZ_ITAH(17); BZ_ITAH(18); BZ_ITAH(19);
- BZ_ITAH(20); BZ_ITAH(21); BZ_ITAH(22); BZ_ITAH(23); BZ_ITAH(24);
- BZ_ITAH(25); BZ_ITAH(26); BZ_ITAH(27); BZ_ITAH(28); BZ_ITAH(29);
- BZ_ITAH(30); BZ_ITAH(31); BZ_ITAH(32); BZ_ITAH(33); BZ_ITAH(34);
- BZ_ITAH(35); BZ_ITAH(36); BZ_ITAH(37); BZ_ITAH(38); BZ_ITAH(39);
- BZ_ITAH(40); BZ_ITAH(41); BZ_ITAH(42); BZ_ITAH(43); BZ_ITAH(44);
- BZ_ITAH(45); BZ_ITAH(46); BZ_ITAH(47); BZ_ITAH(48); BZ_ITAH(49);
-
-# undef BZ_ITAH
-
- } else {
- /*--- slow version which correctly handles all situations ---*/
- for (i = gs; i <= ge; i++) {
- bsW ( s,
- s->len [s->selector[selCtr]] [mtfv[i]],
- s->code [s->selector[selCtr]] [mtfv[i]] );
- }
- }
-
-
- gs = ge+1;
- selCtr++;
- }
- AssertH( selCtr == nSelectors, 3007 );
-
- if (s->verbosity >= 3)
- VPrintf1( "codes %d\n", s->numZ-nBytes );
-}
-
-
-/*---------------------------------------------------*/
-void BZ2_compressBlock ( EState* s, Bool is_last_block )
-{
- if (s->nblock > 0) {
-
- BZ_FINALISE_CRC ( s->blockCRC );
- s->combinedCRC = (s->combinedCRC << 1) | (s->combinedCRC >> 31);
- s->combinedCRC ^= s->blockCRC;
- if (s->blockNo > 1) s->numZ = 0;
-
- if (s->verbosity >= 2)
- VPrintf4( " block %d: crc = 0x%8x, "
- "combined CRC = 0x%8x, size = %d\n",
- s->blockNo, s->blockCRC, s->combinedCRC, s->nblock );
-
- BZ2_blockSort ( s );
- }
-
- s->zbits = (UChar*) (&((UChar*)s->arr2)[s->nblock]);
-
- /*-- If this is the first block, create the stream header. --*/
- if (s->blockNo == 1) {
- BZ2_bsInitWrite ( s );
- bsPutUChar ( s, 'B' );
- bsPutUChar ( s, 'Z' );
- bsPutUChar ( s, 'h' );
- bsPutUChar ( s, (UChar)('0' + s->blockSize100k) );
- }
-
- if (s->nblock > 0) {
-
- bsPutUChar ( s, 0x31 ); bsPutUChar ( s, 0x41 );
- bsPutUChar ( s, 0x59 ); bsPutUChar ( s, 0x26 );
- bsPutUChar ( s, 0x53 ); bsPutUChar ( s, 0x59 );
-
- /*-- Now the block's CRC, so it is in a known place. --*/
- bsPutUInt32 ( s, s->blockCRC );
-
- /*--
- Now a single bit indicating (non-)randomisation.
- As of version 0.9.5, we use a better sorting algorithm
- which makes randomisation unnecessary. So always set
- the randomised bit to 'no'. Of course, the decoder
- still needs to be able to handle randomised blocks
- so as to maintain backwards compatibility with
- older versions of bzip2.
- --*/
- bsW(s,1,0);
-
- bsW ( s, 24, s->origPtr );
- generateMTFValues ( s );
- sendMTFValues ( s );
- }
-
-
- /*-- If this is the last block, add the stream trailer. --*/
- if (is_last_block) {
-
- bsPutUChar ( s, 0x17 ); bsPutUChar ( s, 0x72 );
- bsPutUChar ( s, 0x45 ); bsPutUChar ( s, 0x38 );
- bsPutUChar ( s, 0x50 ); bsPutUChar ( s, 0x90 );
- bsPutUInt32 ( s, s->combinedCRC );
- if (s->verbosity >= 2)
- VPrintf1( " final combined CRC = 0x%x\n ", s->combinedCRC );
- bsFinishWrite ( s );
- }
-}
-
-
-/*-------------------------------------------------------------*/
-/*--- end compress.c ---*/
-/*-------------------------------------------------------------*/
diff --git a/winsup/bz2lib/configure b/winsup/bz2lib/configure
deleted file mode 100755
index c45c7001c..000000000
--- a/winsup/bz2lib/configure
+++ /dev/null
@@ -1,1896 +0,0 @@
-#! /bin/sh
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-
-# Defaults:
-ac_help=
-ac_default_prefix=/usr/local
-# Any additions from configure.in:
-ac_help="$ac_help
- --enable-maintainer-mode enable make rules and dependencies not useful
- (and sometimes confusing) to the casual installer"
-
-# Initialize some variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
-exec_prefix=NONE
-host=NONE
-no_create=
-nonopt=NONE
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-target=NONE
-verbose=
-x_includes=NONE
-x_libraries=NONE
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
-ac_prev=
-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=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case "$ac_option" in
-
- -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 ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$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" ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir="$ac_optarg" ;;
-
- -disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_${ac_feature}='$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)
- # 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 << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --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
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host="$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" ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- 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)
- 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" ;;
-
- -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 ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
- exit 0 ;;
-
- -with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "with_${ac_package}='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=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" ;;
-
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
- ;;
-
- *)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
-
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
-do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
- esac
-done
-
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
-
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=bzlib.h
-
-# 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 its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
- 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
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
- else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
- fi
-fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
-else
- echo "creating cache $cache_file"
- > $cache_file
-fi
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
-
-
-ac_aux_dir=
-for ac_dir in `cd $srcdir/../..;pwd` $srcdir/`cd $srcdir/../..;pwd`; 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
- fi
-done
-if test -z "$ac_aux_dir"; then
- { echo "configure: error: can not find install-sh or install.sh in `cd $srcdir/../..;pwd` $srcdir/`cd $srcdir/../..;pwd`" 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-# 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
-# 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"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:559: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/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
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
-
-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. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL="$ac_install_sh"
- fi
-fi
-echo "$ac_t""$INSTALL" 1>&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_PROGRAM}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:612: checking whether build environment is sane" >&5
-# Just in case
-sleep 1
-echo timestamp > conftestfile
-# Do `set' in a subshell so we don't clobber the current shell's
-# arguments. Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
- set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
- if test "$*" = "X"; then
- # -L didn't work.
- set X `ls -t $srcdir/configure conftestfile`
- fi
- if test "$*" != "X $srcdir/configure conftestfile" \
- && test "$*" != "X conftestfile $srcdir/configure"; then
-
- # If neither matched, then we have a broken ls. This can happen
- # if, for instance, CONFIG_SHELL is bash and it inherits a
- # broken ls alias from the environment. This has actually
- # happened. Such a system could not be considered "sane".
- { echo "configure: error: ls -t appears to fail. Make sure there is not a broken
-alias in your environment" 1>&2; exit 1; }
- fi
-
- test "$2" = conftestfile
- )
-then
- # Ok.
- :
-else
- { echo "configure: error: newly created file is older than distributed files!
-Check your system clock" 1>&2; exit 1; }
-fi
-rm -f conftest*
-echo "$ac_t""yes" 1>&6
-if test "$program_transform_name" = s,x,x,; then
- program_transform_name=
-else
- # Double any \ or $. echo might interpret backslashes.
- cat <<\EOF_SED > conftestsed
-s,\\,\\\\,g; s,\$,$$,g
-EOF_SED
- program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
- rm -f conftestsed
-fi
-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"
-
-# sed with no file args requires a program.
-test "$program_transform_name" = "" && program_transform_name="s,x,x,"
-
-echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:669: checking whether ${MAKE-make} sets \${MAKE}" >&5
-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftestmake <<\EOF
-all:
- @echo 'ac_maketemp="${MAKE}"'
-EOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
-if test -n "$ac_maketemp"; then
- eval ac_cv_prog_make_${ac_make}_set=yes
-else
- eval ac_cv_prog_make_${ac_make}_set=no
-fi
-rm -f conftestmake
-fi
-if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- SET_MAKE=
-else
- echo "$ac_t""no" 1>&6
- SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-
-PACKAGE=libbz2
-
-VERSION=0.0
-
-if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
- { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
-fi
-cat >> confdefs.h <<EOF
-#define PACKAGE "$PACKAGE"
-EOF
-
-cat >> confdefs.h <<EOF
-#define VERSION "$VERSION"
-EOF
-
-
-
-missing_dir=`cd $ac_aux_dir && pwd`
-echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:715: checking for working aclocal" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (aclocal --version) < /dev/null > /dev/null 2>&1; then
- ACLOCAL=aclocal
- echo "$ac_t""found" 1>&6
-else
- ACLOCAL="$missing_dir/missing aclocal"
- echo "$ac_t""missing" 1>&6
-fi
-
-echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:728: checking for working autoconf" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (autoconf --version) < /dev/null > /dev/null 2>&1; then
- AUTOCONF=autoconf
- echo "$ac_t""found" 1>&6
-else
- AUTOCONF="$missing_dir/missing autoconf"
- echo "$ac_t""missing" 1>&6
-fi
-
-echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:741: checking for working automake" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (automake --version) < /dev/null > /dev/null 2>&1; then
- AUTOMAKE=automake
- echo "$ac_t""found" 1>&6
-else
- AUTOMAKE="$missing_dir/missing automake"
- echo "$ac_t""missing" 1>&6
-fi
-
-echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:754: checking for working autoheader" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (autoheader --version) < /dev/null > /dev/null 2>&1; then
- AUTOHEADER=autoheader
- echo "$ac_t""found" 1>&6
-else
- AUTOHEADER="$missing_dir/missing autoheader"
- echo "$ac_t""missing" 1>&6
-fi
-
-echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:767: checking for working makeinfo" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (makeinfo --version) < /dev/null > /dev/null 2>&1; then
- MAKEINFO=makeinfo
- echo "$ac_t""found" 1>&6
-else
- MAKEINFO="$missing_dir/missing makeinfo"
- echo "$ac_t""missing" 1>&6
-fi
-
-
-echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:781: checking whether to enable maintainer-specific portions of Makefiles" >&5
- # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
-if test "${enable_maintainer_mode+set}" = set; then
- enableval="$enable_maintainer_mode"
- USE_MAINTAINER_MODE=$enableval
-else
- USE_MAINTAINER_MODE=no
-fi
-
- echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6
-
-
-if test $USE_MAINTAINER_MODE = yes; then
- MAINTAINER_MODE_TRUE=
- MAINTAINER_MODE_FALSE='#'
-else
- MAINTAINER_MODE_TRUE='#'
- MAINTAINER_MODE_FALSE=
-fi
- MAINT=$MAINTAINER_MODE_TRUE
-
-
-
-# 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.
-
-
-
-CPPFLAGS=-U_WIN32
-
-# Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:820: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
- case $nonopt in
- NONE)
- if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
- else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
- fi ;;
- *) host_alias=$nonopt ;;
- esac ;;
-esac
-
-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
-
-echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:841: checking build system type" >&5
-
-build_alias=$build
-case "$build_alias" in
-NONE)
- case $nonopt in
- NONE) build_alias=$host_alias ;;
- *) build_alias=$nonopt ;;
- esac ;;
-esac
-
-build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
-build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$build" 1>&6
-
-if test $host != $build; then
- ac_tool_prefix=${host_alias}-
-else
- ac_tool_prefix=
-fi
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:867: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$AR"; then
- ac_cv_prog_AR="$AR" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_AR="${ac_tool_prefix}ar"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-AR="$ac_cv_prog_AR"
-if test -n "$AR"; then
- echo "$ac_t""$AR" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_AR"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "ar", so it can be a program name with args.
-set dummy ar; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:899: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$AR"; then
- ac_cv_prog_AR="$AR" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_AR="ar"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
-fi
-fi
-AR="$ac_cv_prog_AR"
-if test -n "$AR"; then
- echo "$ac_t""$AR" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- AR="ar"
-fi
-fi
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:934: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$NM"; then
- ac_cv_prog_NM="$NM" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_NM="${ac_tool_prefix}nm"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-NM="$ac_cv_prog_NM"
-if test -n "$NM"; then
- echo "$ac_t""$NM" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_NM"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "nm", so it can be a program name with args.
-set dummy nm; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:966: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$NM"; then
- ac_cv_prog_NM="$NM" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_NM="nm"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_NM" && ac_cv_prog_NM="nm"
-fi
-fi
-NM="$ac_cv_prog_NM"
-if test -n "$NM"; then
- echo "$ac_t""$NM" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- NM="nm"
-fi
-fi
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1001: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_RANLIB"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1033: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB="ranlib"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- RANLIB="ranlib"
-fi
-fi
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1068: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="${ac_tool_prefix}gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_CC"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1100: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="gcc"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- CC="gcc"
-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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1136: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_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 $# -gt 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
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
- fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1185: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1194: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
-else
- ac_cv_prog_gcc=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1209: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
-else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
- CFLAGS="-gstabs+ -O2"
- else
- CFLAGS="-O2"
- fi
- if test "$ac_test_CXXFLAGS" != set; then
- CXXFLAGS='$(CFLAGS)'
- fi
-else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
-fi
-
-# 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
-# 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"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1251: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/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
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
-
-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. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL="$ac_install_sh"
- fi
-fi
-echo "$ac_t""$INSTALL" 1>&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_PROGRAM}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1304: checking how to run the C preprocessor" >&5
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- # This must be in double quotes, not single quotes, because CPP may get
- # substituted into the Makefile and "${CC-cc}" will confuse make.
- CPP="${CC-cc} -E"
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp.
- cat > conftest.$ac_ext <<EOF
-#line 1319 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1325: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -E -traditional-cpp"
- cat > conftest.$ac_ext <<EOF
-#line 1336 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1342: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -nologo -E"
- cat > conftest.$ac_ext <<EOF
-#line 1353 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1359: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP=/lib/cpp
-fi
-rm -f conftest*
-fi
-rm -f conftest*
-fi
-rm -f conftest*
- ac_cv_prog_CPP="$CPP"
-fi
- CPP="$ac_cv_prog_CPP"
-else
- ac_cv_prog_CPP="$CPP"
-fi
-echo "$ac_t""$CPP" 1>&6
-
-echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1384: checking for ANSI C header files" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1389 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1397: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- ac_cv_header_stdc=yes
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 1414 "configure"
-#include "confdefs.h"
-#include <string.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "memchr" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 1432 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "free" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-if test "$cross_compiling" = yes; then
- :
-else
- cat > conftest.$ac_ext <<EOF
-#line 1453 "configure"
-#include "confdefs.h"
-#include <ctype.h>
-#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int main () { int i; for (i = 0; i < 256; i++)
-if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
-exit (0); }
-
-EOF
-if { (eval echo configure:1464: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- :
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_header_stdc=no
-fi
-rm -fr conftest*
-fi
-
-fi
-fi
-
-echo "$ac_t""$ac_cv_header_stdc" 1>&6
-if test $ac_cv_header_stdc = yes; then
- cat >> confdefs.h <<\EOF
-#define STDC_HEADERS 1
-EOF
-
-fi
-
-echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:1488: checking for Cygwin environment" >&5
-if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1493 "configure"
-#include "confdefs.h"
-
-int main() {
-
-#ifndef __CYGWIN__
-#define __CYGWIN__ __CYGWIN32__
-#endif
-return __CYGWIN__;
-; return 0; }
-EOF
-if { (eval echo configure:1504: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_cygwin=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_cygwin=no
-fi
-rm -f conftest*
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_cygwin" 1>&6
-CYGWIN=
-test "$ac_cv_cygwin" = yes && CYGWIN=yes
-echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:1521: checking for mingw32 environment" >&5
-if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1526 "configure"
-#include "confdefs.h"
-
-int main() {
-return __MINGW32__;
-; return 0; }
-EOF
-if { (eval echo configure:1533: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_mingw32=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_mingw32=no
-fi
-rm -f conftest*
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_mingw32" 1>&6
-MINGW32=
-test "$ac_cv_mingw32" = yes && MINGW32=yes
-
-
-echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1552: checking for executable suffix" >&5
-if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
- ac_cv_exeext=.exe
-else
- rm -f conftest*
- echo 'int main () { return 0; }' > conftest.$ac_ext
- ac_cv_exeext=
- if { (eval echo configure:1562: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
- for file in conftest.*; do
- case $file in
- *.c | *.o | *.obj) ;;
- *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
- esac
- done
- else
- { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
- fi
- rm -f conftest*
- test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
-fi
-fi
-
-EXEEXT=""
-test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
-echo "$ac_t""${ac_cv_exeext}" 1>&6
-ac_exeext=$EXEEXT
-
-echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:1583: checking for object suffix" >&5
-if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- rm -f conftest*
-echo 'int i = 1;' > conftest.$ac_ext
-if { (eval echo configure:1589: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- for ac_file in conftest.*; do
- case $ac_file in
- *.c) ;;
- *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
- esac
- done
-else
- { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; }
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_objext" 1>&6
-OBJEXT=$ac_cv_objext
-ac_objext=$ac_cv_objext
-
-
-
-trap '' 1 2 15
-cat > confcache <<\EOF
-# 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. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# 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.
-(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
- if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
-fi
-
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
-s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
-s%\[%\\&%g
-s%\]%\\&%g
-s%\$%$$%g
-EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-rm -f conftest.defs
-
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
-
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
-# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
-# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
-
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
-do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
-done
-
-ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
-
-trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
-s%@INSTALL_DATA@%$INSTALL_DATA%g
-s%@PACKAGE@%$PACKAGE%g
-s%@VERSION@%$VERSION%g
-s%@ACLOCAL@%$ACLOCAL%g
-s%@AUTOCONF@%$AUTOCONF%g
-s%@AUTOMAKE@%$AUTOMAKE%g
-s%@AUTOHEADER@%$AUTOHEADER%g
-s%@MAKEINFO@%$MAKEINFO%g
-s%@SET_MAKE@%$SET_MAKE%g
-s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g
-s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g
-s%@MAINT@%$MAINT%g
-s%@host@%$host%g
-s%@host_alias@%$host_alias%g
-s%@host_cpu@%$host_cpu%g
-s%@host_vendor@%$host_vendor%g
-s%@host_os@%$host_os%g
-s%@build@%$build%g
-s%@build_alias@%$build_alias%g
-s%@build_cpu@%$build_cpu%g
-s%@build_vendor@%$build_vendor%g
-s%@build_os@%$build_os%g
-s%@AR@%$AR%g
-s%@NM@%$NM%g
-s%@RANLIB@%$RANLIB%g
-s%@CC@%$CC%g
-s%@CPP@%$CPP%g
-s%@EXEEXT@%$EXEEXT%g
-s%@OBJEXT@%$OBJEXT%g
-s%@installdata@%$installdata%g
-s%@uninstalldata@%$uninstalldata%g
-
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
- else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
- fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
- else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
- fi
-done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
-fi
-EOF
-
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
- fi
-
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
-
- case "$ac_given_INSTALL" in
- [/$]*) INSTALL="$ac_given_INSTALL" ;;
- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
- esac
-
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
- esac
-
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-s%@INSTALL@%$INSTALL%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
diff --git a/winsup/bz2lib/configure.in b/winsup/bz2lib/configure.in
deleted file mode 100644
index e65d0e2b6..000000000
--- a/winsup/bz2lib/configure.in
+++ /dev/null
@@ -1,65 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-
-AC_PREREQ(2.13)
-
-AC_INIT(bzlib.h)
-AC_CONFIG_AUX_DIR(`cd $srcdir/../..;pwd`)
-AM_INIT_AUTOMAKE(libbz2, 0.0)
-AM_MAINTAINER_MODE
-
-# 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,
-[AC_BEFORE([$0], [AC_PROG_CPP])dnl
-AC_CHECK_TOOL(CC, gcc, gcc)
-if test -z "$CC"; then
- AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
- test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
-fi
-
-AC_PROG_CC_GNU
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-dnl Check whether -g works, even if CFLAGS is set, in case the package
-dnl plays around with CFLAGS (such as to build both debugging and
-dnl normal versions of a library), tasteless as that idea is.
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- AC_PROG_CC_G
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
- CFLAGS="-gstabs+ -O2"
- else
- CFLAGS="-O2"
- fi
- if test "$ac_test_CXXFLAGS" != set; then
- CXXFLAGS='$(CFLAGS)'
- fi
-else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
-fi
-])
-
-CPPFLAGS=-U_WIN32
-AC_CANONICAL_HOST
-AC_CHECK_TOOL(AR, ar, ar)
-AC_CHECK_TOOL(NM, nm, nm)
-AC_CHECK_TOOL(RANLIB, ranlib, ranlib)
-LIB_AC_PROG_CC
-AC_PROG_INSTALL
-AC_STDC_HEADERS
-AC_EXEEXT
-AC_OBJEXT
-
-AC_SUBST(installdata)dnl
-AC_SUBST(uninstalldata)dnl
-
-AC_OUTPUT([Makefile])
diff --git a/winsup/bz2lib/crctable.c b/winsup/bz2lib/crctable.c
deleted file mode 100644
index 61c040c4f..000000000
--- a/winsup/bz2lib/crctable.c
+++ /dev/null
@@ -1,144 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Table for doing CRCs ---*/
-/*--- crctable.c ---*/
-/*-------------------------------------------------------------*/
-
-/*--
- This file is a part of bzip2 and/or libbzip2, a program and
- library for lossless, block-sorting data compression.
-
- Copyright (C) 1996-2000 Julian R Seward. 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. The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 3. Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-
- 4. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
-
- Julian Seward, Cambridge, UK.
- jseward@acm.org
- bzip2/libbzip2 version 1.0 of 21 March 2000
-
- This program is based on (at least) the work of:
- Mike Burrows
- David Wheeler
- Peter Fenwick
- Alistair Moffat
- Radford Neal
- Ian H. Witten
- Robert Sedgewick
- Jon L. Bentley
-
- For more information on these sources, see the manual.
---*/
-
-
-#include "bzlib_private.h"
-
-/*--
- I think this is an implementation of the AUTODIN-II,
- Ethernet & FDDI 32-bit CRC standard. Vaguely derived
- from code by Rob Warnock, in Section 51 of the
- comp.compression FAQ.
---*/
-
-UInt32 BZ2_crc32Table[256] = {
-
- /*-- Ugly, innit? --*/
-
- 0x00000000L, 0x04c11db7L, 0x09823b6eL, 0x0d4326d9L,
- 0x130476dcL, 0x17c56b6bL, 0x1a864db2L, 0x1e475005L,
- 0x2608edb8L, 0x22c9f00fL, 0x2f8ad6d6L, 0x2b4bcb61L,
- 0x350c9b64L, 0x31cd86d3L, 0x3c8ea00aL, 0x384fbdbdL,
- 0x4c11db70L, 0x48d0c6c7L, 0x4593e01eL, 0x4152fda9L,
- 0x5f15adacL, 0x5bd4b01bL, 0x569796c2L, 0x52568b75L,
- 0x6a1936c8L, 0x6ed82b7fL, 0x639b0da6L, 0x675a1011L,
- 0x791d4014L, 0x7ddc5da3L, 0x709f7b7aL, 0x745e66cdL,
- 0x9823b6e0L, 0x9ce2ab57L, 0x91a18d8eL, 0x95609039L,
- 0x8b27c03cL, 0x8fe6dd8bL, 0x82a5fb52L, 0x8664e6e5L,
- 0xbe2b5b58L, 0xbaea46efL, 0xb7a96036L, 0xb3687d81L,
- 0xad2f2d84L, 0xa9ee3033L, 0xa4ad16eaL, 0xa06c0b5dL,
- 0xd4326d90L, 0xd0f37027L, 0xddb056feL, 0xd9714b49L,
- 0xc7361b4cL, 0xc3f706fbL, 0xceb42022L, 0xca753d95L,
- 0xf23a8028L, 0xf6fb9d9fL, 0xfbb8bb46L, 0xff79a6f1L,
- 0xe13ef6f4L, 0xe5ffeb43L, 0xe8bccd9aL, 0xec7dd02dL,
- 0x34867077L, 0x30476dc0L, 0x3d044b19L, 0x39c556aeL,
- 0x278206abL, 0x23431b1cL, 0x2e003dc5L, 0x2ac12072L,
- 0x128e9dcfL, 0x164f8078L, 0x1b0ca6a1L, 0x1fcdbb16L,
- 0x018aeb13L, 0x054bf6a4L, 0x0808d07dL, 0x0cc9cdcaL,
- 0x7897ab07L, 0x7c56b6b0L, 0x71159069L, 0x75d48ddeL,
- 0x6b93dddbL, 0x6f52c06cL, 0x6211e6b5L, 0x66d0fb02L,
- 0x5e9f46bfL, 0x5a5e5b08L, 0x571d7dd1L, 0x53dc6066L,
- 0x4d9b3063L, 0x495a2dd4L, 0x44190b0dL, 0x40d816baL,
- 0xaca5c697L, 0xa864db20L, 0xa527fdf9L, 0xa1e6e04eL,
- 0xbfa1b04bL, 0xbb60adfcL, 0xb6238b25L, 0xb2e29692L,
- 0x8aad2b2fL, 0x8e6c3698L, 0x832f1041L, 0x87ee0df6L,
- 0x99a95df3L, 0x9d684044L, 0x902b669dL, 0x94ea7b2aL,
- 0xe0b41de7L, 0xe4750050L, 0xe9362689L, 0xedf73b3eL,
- 0xf3b06b3bL, 0xf771768cL, 0xfa325055L, 0xfef34de2L,
- 0xc6bcf05fL, 0xc27dede8L, 0xcf3ecb31L, 0xcbffd686L,
- 0xd5b88683L, 0xd1799b34L, 0xdc3abdedL, 0xd8fba05aL,
- 0x690ce0eeL, 0x6dcdfd59L, 0x608edb80L, 0x644fc637L,
- 0x7a089632L, 0x7ec98b85L, 0x738aad5cL, 0x774bb0ebL,
- 0x4f040d56L, 0x4bc510e1L, 0x46863638L, 0x42472b8fL,
- 0x5c007b8aL, 0x58c1663dL, 0x558240e4L, 0x51435d53L,
- 0x251d3b9eL, 0x21dc2629L, 0x2c9f00f0L, 0x285e1d47L,
- 0x36194d42L, 0x32d850f5L, 0x3f9b762cL, 0x3b5a6b9bL,
- 0x0315d626L, 0x07d4cb91L, 0x0a97ed48L, 0x0e56f0ffL,
- 0x1011a0faL, 0x14d0bd4dL, 0x19939b94L, 0x1d528623L,
- 0xf12f560eL, 0xf5ee4bb9L, 0xf8ad6d60L, 0xfc6c70d7L,
- 0xe22b20d2L, 0xe6ea3d65L, 0xeba91bbcL, 0xef68060bL,
- 0xd727bbb6L, 0xd3e6a601L, 0xdea580d8L, 0xda649d6fL,
- 0xc423cd6aL, 0xc0e2d0ddL, 0xcda1f604L, 0xc960ebb3L,
- 0xbd3e8d7eL, 0xb9ff90c9L, 0xb4bcb610L, 0xb07daba7L,
- 0xae3afba2L, 0xaafbe615L, 0xa7b8c0ccL, 0xa379dd7bL,
- 0x9b3660c6L, 0x9ff77d71L, 0x92b45ba8L, 0x9675461fL,
- 0x8832161aL, 0x8cf30badL, 0x81b02d74L, 0x857130c3L,
- 0x5d8a9099L, 0x594b8d2eL, 0x5408abf7L, 0x50c9b640L,
- 0x4e8ee645L, 0x4a4ffbf2L, 0x470cdd2bL, 0x43cdc09cL,
- 0x7b827d21L, 0x7f436096L, 0x7200464fL, 0x76c15bf8L,
- 0x68860bfdL, 0x6c47164aL, 0x61043093L, 0x65c52d24L,
- 0x119b4be9L, 0x155a565eL, 0x18197087L, 0x1cd86d30L,
- 0x029f3d35L, 0x065e2082L, 0x0b1d065bL, 0x0fdc1becL,
- 0x3793a651L, 0x3352bbe6L, 0x3e119d3fL, 0x3ad08088L,
- 0x2497d08dL, 0x2056cd3aL, 0x2d15ebe3L, 0x29d4f654L,
- 0xc5a92679L, 0xc1683bceL, 0xcc2b1d17L, 0xc8ea00a0L,
- 0xd6ad50a5L, 0xd26c4d12L, 0xdf2f6bcbL, 0xdbee767cL,
- 0xe3a1cbc1L, 0xe760d676L, 0xea23f0afL, 0xeee2ed18L,
- 0xf0a5bd1dL, 0xf464a0aaL, 0xf9278673L, 0xfde69bc4L,
- 0x89b8fd09L, 0x8d79e0beL, 0x803ac667L, 0x84fbdbd0L,
- 0x9abc8bd5L, 0x9e7d9662L, 0x933eb0bbL, 0x97ffad0cL,
- 0xafb010b1L, 0xab710d06L, 0xa6322bdfL, 0xa2f33668L,
- 0xbcb4666dL, 0xb8757bdaL, 0xb5365d03L, 0xb1f740b4L
-};
-
-
-/*-------------------------------------------------------------*/
-/*--- end crctable.c ---*/
-/*-------------------------------------------------------------*/
diff --git a/winsup/bz2lib/decompress.c b/winsup/bz2lib/decompress.c
deleted file mode 100644
index cdced1889..000000000
--- a/winsup/bz2lib/decompress.c
+++ /dev/null
@@ -1,660 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Decompression machinery ---*/
-/*--- decompress.c ---*/
-/*-------------------------------------------------------------*/
-
-/*--
- This file is a part of bzip2 and/or libbzip2, a program and
- library for lossless, block-sorting data compression.
-
- Copyright (C) 1996-2000 Julian R Seward. 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. The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 3. Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-
- 4. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
-
- Julian Seward, Cambridge, UK.
- jseward@acm.org
- bzip2/libbzip2 version 1.0 of 21 March 2000
-
- This program is based on (at least) the work of:
- Mike Burrows
- David Wheeler
- Peter Fenwick
- Alistair Moffat
- Radford Neal
- Ian H. Witten
- Robert Sedgewick
- Jon L. Bentley
-
- For more information on these sources, see the manual.
---*/
-
-
-#include "bzlib_private.h"
-
-
-/*---------------------------------------------------*/
-static
-void makeMaps_d ( DState* s )
-{
- Int32 i;
- s->nInUse = 0;
- for (i = 0; i < 256; i++)
- if (s->inUse[i]) {
- s->seqToUnseq[s->nInUse] = i;
- s->nInUse++;
- }
-}
-
-
-/*---------------------------------------------------*/
-#define RETURN(rrr) \
- { retVal = rrr; goto save_state_and_return; };
-
-#define GET_BITS(lll,vvv,nnn) \
- case lll: s->state = lll; \
- while (True) { \
- if (s->bsLive >= nnn) { \
- UInt32 v; \
- v = (s->bsBuff >> \
- (s->bsLive-nnn)) & ((1 << nnn)-1); \
- s->bsLive -= nnn; \
- vvv = v; \
- break; \
- } \
- if (s->strm->avail_in == 0) RETURN(BZ_OK); \
- s->bsBuff \
- = (s->bsBuff << 8) | \
- ((UInt32) \
- (*((UChar*)(s->strm->next_in)))); \
- s->bsLive += 8; \
- s->strm->next_in++; \
- s->strm->avail_in--; \
- s->strm->total_in_lo32++; \
- if (s->strm->total_in_lo32 == 0) \
- s->strm->total_in_hi32++; \
- }
-
-#define GET_UCHAR(lll,uuu) \
- GET_BITS(lll,uuu,8)
-
-#define GET_BIT(lll,uuu) \
- GET_BITS(lll,uuu,1)
-
-/*---------------------------------------------------*/
-#define GET_MTF_VAL(label1,label2,lval) \
-{ \
- if (groupPos == 0) { \
- groupNo++; \
- if (groupNo >= nSelectors) \
- RETURN(BZ_DATA_ERROR); \
- groupPos = BZ_G_SIZE; \
- gSel = s->selector[groupNo]; \
- gMinlen = s->minLens[gSel]; \
- gLimit = &(s->limit[gSel][0]); \
- gPerm = &(s->perm[gSel][0]); \
- gBase = &(s->base[gSel][0]); \
- } \
- groupPos--; \
- zn = gMinlen; \
- GET_BITS(label1, zvec, zn); \
- while (1) { \
- if (zn > 20 /* the longest code */) \
- RETURN(BZ_DATA_ERROR); \
- if (zvec <= gLimit[zn]) break; \
- zn++; \
- GET_BIT(label2, zj); \
- zvec = (zvec << 1) | zj; \
- }; \
- if (zvec - gBase[zn] < 0 \
- || zvec - gBase[zn] >= BZ_MAX_ALPHA_SIZE) \
- RETURN(BZ_DATA_ERROR); \
- lval = gPerm[zvec - gBase[zn]]; \
-}
-
-
-/*---------------------------------------------------*/
-Int32 BZ2_decompress ( DState* s )
-{
- UChar uc;
- Int32 retVal;
- Int32 minLen, maxLen;
- bz_stream* strm = s->strm;
-
- /* stuff that needs to be saved/restored */
- Int32 i;
- Int32 j;
- Int32 t;
- Int32 alphaSize;
- Int32 nGroups;
- Int32 nSelectors;
- Int32 EOB;
- Int32 groupNo;
- Int32 groupPos;
- Int32 nextSym;
- Int32 nblockMAX;
- Int32 nblock;
- Int32 es;
- Int32 N;
- Int32 curr;
- Int32 zt;
- Int32 zn;
- Int32 zvec;
- Int32 zj;
- Int32 gSel;
- Int32 gMinlen;
- Int32* gLimit;
- Int32* gBase;
- Int32* gPerm;
-
- if (s->state == BZ_X_MAGIC_1) {
- /*initialise the save area*/
- s->save_i = 0;
- s->save_j = 0;
- s->save_t = 0;
- s->save_alphaSize = 0;
- s->save_nGroups = 0;
- s->save_nSelectors = 0;
- s->save_EOB = 0;
- s->save_groupNo = 0;
- s->save_groupPos = 0;
- s->save_nextSym = 0;
- s->save_nblockMAX = 0;
- s->save_nblock = 0;
- s->save_es = 0;
- s->save_N = 0;
- s->save_curr = 0;
- s->save_zt = 0;
- s->save_zn = 0;
- s->save_zvec = 0;
- s->save_zj = 0;
- s->save_gSel = 0;
- s->save_gMinlen = 0;
- s->save_gLimit = NULL;
- s->save_gBase = NULL;
- s->save_gPerm = NULL;
- }
-
- /*restore from the save area*/
- i = s->save_i;
- j = s->save_j;
- t = s->save_t;
- alphaSize = s->save_alphaSize;
- nGroups = s->save_nGroups;
- nSelectors = s->save_nSelectors;
- EOB = s->save_EOB;
- groupNo = s->save_groupNo;
- groupPos = s->save_groupPos;
- nextSym = s->save_nextSym;
- nblockMAX = s->save_nblockMAX;
- nblock = s->save_nblock;
- es = s->save_es;
- N = s->save_N;
- curr = s->save_curr;
- zt = s->save_zt;
- zn = s->save_zn;
- zvec = s->save_zvec;
- zj = s->save_zj;
- gSel = s->save_gSel;
- gMinlen = s->save_gMinlen;
- gLimit = s->save_gLimit;
- gBase = s->save_gBase;
- gPerm = s->save_gPerm;
-
- retVal = BZ_OK;
-
- switch (s->state) {
-
- GET_UCHAR(BZ_X_MAGIC_1, uc);
- if (uc != 'B') RETURN(BZ_DATA_ERROR_MAGIC);
-
- GET_UCHAR(BZ_X_MAGIC_2, uc);
- if (uc != 'Z') RETURN(BZ_DATA_ERROR_MAGIC);
-
- GET_UCHAR(BZ_X_MAGIC_3, uc)
- if (uc != 'h') RETURN(BZ_DATA_ERROR_MAGIC);
-
- GET_BITS(BZ_X_MAGIC_4, s->blockSize100k, 8)
- if (s->blockSize100k < '1' ||
- s->blockSize100k > '9') RETURN(BZ_DATA_ERROR_MAGIC);
- s->blockSize100k -= '0';
-
- if (s->smallDecompress) {
- s->ll16 = BZALLOC( s->blockSize100k * 100000 * sizeof(UInt16) );
- s->ll4 = BZALLOC(
- ((1 + s->blockSize100k * 100000) >> 1) * sizeof(UChar)
- );
- if (s->ll16 == NULL || s->ll4 == NULL) RETURN(BZ_MEM_ERROR);
- } else {
- s->tt = BZALLOC( s->blockSize100k * 100000 * sizeof(Int32) );
- if (s->tt == NULL) RETURN(BZ_MEM_ERROR);
- }
-
- GET_UCHAR(BZ_X_BLKHDR_1, uc);
-
- if (uc == 0x17) goto endhdr_2;
- if (uc != 0x31) RETURN(BZ_DATA_ERROR);
- GET_UCHAR(BZ_X_BLKHDR_2, uc);
- if (uc != 0x41) RETURN(BZ_DATA_ERROR);
- GET_UCHAR(BZ_X_BLKHDR_3, uc);
- if (uc != 0x59) RETURN(BZ_DATA_ERROR);
- GET_UCHAR(BZ_X_BLKHDR_4, uc);
- if (uc != 0x26) RETURN(BZ_DATA_ERROR);
- GET_UCHAR(BZ_X_BLKHDR_5, uc);
- if (uc != 0x53) RETURN(BZ_DATA_ERROR);
- GET_UCHAR(BZ_X_BLKHDR_6, uc);
- if (uc != 0x59) RETURN(BZ_DATA_ERROR);
-
- s->currBlockNo++;
- if (s->verbosity >= 2)
- VPrintf1 ( "\n [%d: huff+mtf ", s->currBlockNo );
-
- s->storedBlockCRC = 0;
- GET_UCHAR(BZ_X_BCRC_1, uc);
- s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc);
- GET_UCHAR(BZ_X_BCRC_2, uc);
- s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc);
- GET_UCHAR(BZ_X_BCRC_3, uc);
- s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc);
- GET_UCHAR(BZ_X_BCRC_4, uc);
- s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc);
-
- GET_BITS(BZ_X_RANDBIT, s->blockRandomised, 1);
-
- s->origPtr = 0;
- GET_UCHAR(BZ_X_ORIGPTR_1, uc);
- s->origPtr = (s->origPtr << 8) | ((Int32)uc);
- GET_UCHAR(BZ_X_ORIGPTR_2, uc);
- s->origPtr = (s->origPtr << 8) | ((Int32)uc);
- GET_UCHAR(BZ_X_ORIGPTR_3, uc);
- s->origPtr = (s->origPtr << 8) | ((Int32)uc);
-
- if (s->origPtr < 0)
- RETURN(BZ_DATA_ERROR);
- if (s->origPtr > 10 + 100000*s->blockSize100k)
- RETURN(BZ_DATA_ERROR);
-
- /*--- Receive the mapping table ---*/
- for (i = 0; i < 16; i++) {
- GET_BIT(BZ_X_MAPPING_1, uc);
- if (uc == 1)
- s->inUse16[i] = True; else
- s->inUse16[i] = False;
- }
-
- for (i = 0; i < 256; i++) s->inUse[i] = False;
-
- for (i = 0; i < 16; i++)
- if (s->inUse16[i])
- for (j = 0; j < 16; j++) {
- GET_BIT(BZ_X_MAPPING_2, uc);
- if (uc == 1) s->inUse[i * 16 + j] = True;
- }
- makeMaps_d ( s );
- if (s->nInUse == 0) RETURN(BZ_DATA_ERROR);
- alphaSize = s->nInUse+2;
-
- /*--- Now the selectors ---*/
- GET_BITS(BZ_X_SELECTOR_1, nGroups, 3);
- if (nGroups < 2 || nGroups > 6) RETURN(BZ_DATA_ERROR);
- GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15);
- if (nSelectors < 1) RETURN(BZ_DATA_ERROR);
- for (i = 0; i < nSelectors; i++) {
- j = 0;
- while (True) {
- GET_BIT(BZ_X_SELECTOR_3, uc);
- if (uc == 0) break;
- j++;
- if (j >= nGroups) RETURN(BZ_DATA_ERROR);
- }
- s->selectorMtf[i] = j;
- }
-
- /*--- Undo the MTF values for the selectors. ---*/
- {
- UChar pos[BZ_N_GROUPS], tmp, v;
- for (v = 0; v < nGroups; v++) pos[v] = v;
-
- for (i = 0; i < nSelectors; i++) {
- v = s->selectorMtf[i];
- tmp = pos[v];
- while (v > 0) { pos[v] = pos[v-1]; v--; }
- pos[0] = tmp;
- s->selector[i] = tmp;
- }
- }
-
- /*--- Now the coding tables ---*/
- for (t = 0; t < nGroups; t++) {
- GET_BITS(BZ_X_CODING_1, curr, 5);
- for (i = 0; i < alphaSize; i++) {
- while (True) {
- if (curr < 1 || curr > 20) RETURN(BZ_DATA_ERROR);
- GET_BIT(BZ_X_CODING_2, uc);
- if (uc == 0) break;
- GET_BIT(BZ_X_CODING_3, uc);
- if (uc == 0) curr++; else curr--;
- }
- s->len[t][i] = curr;
- }
- }
-
- /*--- Create the Huffman decoding tables ---*/
- for (t = 0; t < nGroups; t++) {
- minLen = 32;
- maxLen = 0;
- for (i = 0; i < alphaSize; i++) {
- if (s->len[t][i] > maxLen) maxLen = s->len[t][i];
- if (s->len[t][i] < minLen) minLen = s->len[t][i];
- }
- BZ2_hbCreateDecodeTables (
- &(s->limit[t][0]),
- &(s->base[t][0]),
- &(s->perm[t][0]),
- &(s->len[t][0]),
- minLen, maxLen, alphaSize
- );
- s->minLens[t] = minLen;
- }
-
- /*--- Now the MTF values ---*/
-
- EOB = s->nInUse+1;
- nblockMAX = 100000 * s->blockSize100k;
- groupNo = -1;
- groupPos = 0;
-
- for (i = 0; i <= 255; i++) s->unzftab[i] = 0;
-
- /*-- MTF init --*/
- {
- Int32 ii, jj, kk;
- kk = MTFA_SIZE-1;
- for (ii = 256 / MTFL_SIZE - 1; ii >= 0; ii--) {
- for (jj = MTFL_SIZE-1; jj >= 0; jj--) {
- s->mtfa[kk] = (UChar)(ii * MTFL_SIZE + jj);
- kk--;
- }
- s->mtfbase[ii] = kk + 1;
- }
- }
- /*-- end MTF init --*/
-
- nblock = 0;
- GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym);
-
- while (True) {
-
- if (nextSym == EOB) break;
-
- if (nextSym == BZ_RUNA || nextSym == BZ_RUNB) {
-
- es = -1;
- N = 1;
- do {
- if (nextSym == BZ_RUNA) es = es + (0+1) * N; else
- if (nextSym == BZ_RUNB) es = es + (1+1) * N;
- N = N * 2;
- GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym);
- }
- while (nextSym == BZ_RUNA || nextSym == BZ_RUNB);
-
- es++;
- uc = s->seqToUnseq[ s->mtfa[s->mtfbase[0]] ];
- s->unzftab[uc] += es;
-
- if (s->smallDecompress)
- while (es > 0) {
- if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR);
- s->ll16[nblock] = (UInt16)uc;
- nblock++;
- es--;
- }
- else
- while (es > 0) {
- if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR);
- s->tt[nblock] = (UInt32)uc;
- nblock++;
- es--;
- };
-
- continue;
-
- } else {
-
- if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR);
-
- /*-- uc = MTF ( nextSym-1 ) --*/
- {
- Int32 ii, jj, kk, pp, lno, off;
- UInt32 nn;
- nn = (UInt32)(nextSym - 1);
-
- if (nn < MTFL_SIZE) {
- /* avoid general-case expense */
- pp = s->mtfbase[0];
- uc = s->mtfa[pp+nn];
- while (nn > 3) {
- Int32 z = pp+nn;
- s->mtfa[(z) ] = s->mtfa[(z)-1];
- s->mtfa[(z)-1] = s->mtfa[(z)-2];
- s->mtfa[(z)-2] = s->mtfa[(z)-3];
- s->mtfa[(z)-3] = s->mtfa[(z)-4];
- nn -= 4;
- }
- while (nn > 0) {
- s->mtfa[(pp+nn)] = s->mtfa[(pp+nn)-1]; nn--;
- };
- s->mtfa[pp] = uc;
- } else {
- /* general case */
- lno = nn / MTFL_SIZE;
- off = nn % MTFL_SIZE;
- pp = s->mtfbase[lno] + off;
- uc = s->mtfa[pp];
- while (pp > s->mtfbase[lno]) {
- s->mtfa[pp] = s->mtfa[pp-1]; pp--;
- };
- s->mtfbase[lno]++;
- while (lno > 0) {
- s->mtfbase[lno]--;
- s->mtfa[s->mtfbase[lno]]
- = s->mtfa[s->mtfbase[lno-1] + MTFL_SIZE - 1];
- lno--;
- }
- s->mtfbase[0]--;
- s->mtfa[s->mtfbase[0]] = uc;
- if (s->mtfbase[0] == 0) {
- kk = MTFA_SIZE-1;
- for (ii = 256 / MTFL_SIZE-1; ii >= 0; ii--) {
- for (jj = MTFL_SIZE-1; jj >= 0; jj--) {
- s->mtfa[kk] = s->mtfa[s->mtfbase[ii] + jj];
- kk--;
- }
- s->mtfbase[ii] = kk + 1;
- }
- }
- }
- }
- /*-- end uc = MTF ( nextSym-1 ) --*/
-
- s->unzftab[s->seqToUnseq[uc]]++;
- if (s->smallDecompress)
- s->ll16[nblock] = (UInt16)(s->seqToUnseq[uc]); else
- s->tt[nblock] = (UInt32)(s->seqToUnseq[uc]);
- nblock++;
-
- GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym);
- continue;
- }
- }
-
- /* Now we know what nblock is, we can do a better sanity
- check on s->origPtr.
- */
- if (s->origPtr < 0 || s->origPtr >= nblock)
- RETURN(BZ_DATA_ERROR);
-
- s->state_out_len = 0;
- s->state_out_ch = 0;
- BZ_INITIALISE_CRC ( s->calculatedBlockCRC );
- s->state = BZ_X_OUTPUT;
- if (s->verbosity >= 2) VPrintf0 ( "rt+rld" );
-
- /*-- Set up cftab to facilitate generation of T^(-1) --*/
- s->cftab[0] = 0;
- for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1];
- for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1];
-
- if (s->smallDecompress) {
-
- /*-- Make a copy of cftab, used in generation of T --*/
- for (i = 0; i <= 256; i++) s->cftabCopy[i] = s->cftab[i];
-
- /*-- compute the T vector --*/
- for (i = 0; i < nblock; i++) {
- uc = (UChar)(s->ll16[i]);
- SET_LL(i, s->cftabCopy[uc]);
- s->cftabCopy[uc]++;
- }
-
- /*-- Compute T^(-1) by pointer reversal on T --*/
- i = s->origPtr;
- j = GET_LL(i);
- do {
- Int32 tmp = GET_LL(j);
- SET_LL(j, i);
- i = j;
- j = tmp;
- }
- while (i != s->origPtr);
-
- s->tPos = s->origPtr;
- s->nblock_used = 0;
- if (s->blockRandomised) {
- BZ_RAND_INIT_MASK;
- BZ_GET_SMALL(s->k0); s->nblock_used++;
- BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK;
- } else {
- BZ_GET_SMALL(s->k0); s->nblock_used++;
- }
-
- } else {
-
- /*-- compute the T^(-1) vector --*/
- for (i = 0; i < nblock; i++) {
- uc = (UChar)(s->tt[i] & 0xff);
- s->tt[s->cftab[uc]] |= (i << 8);
- s->cftab[uc]++;
- }
-
- s->tPos = s->tt[s->origPtr] >> 8;
- s->nblock_used = 0;
- if (s->blockRandomised) {
- BZ_RAND_INIT_MASK;
- BZ_GET_FAST(s->k0); s->nblock_used++;
- BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK;
- } else {
- BZ_GET_FAST(s->k0); s->nblock_used++;
- }
-
- }
-
- RETURN(BZ_OK);
-
-
-
- endhdr_2:
-
- GET_UCHAR(BZ_X_ENDHDR_2, uc);
- if (uc != 0x72) RETURN(BZ_DATA_ERROR);
- GET_UCHAR(BZ_X_ENDHDR_3, uc);
- if (uc != 0x45) RETURN(BZ_DATA_ERROR);
- GET_UCHAR(BZ_X_ENDHDR_4, uc);
- if (uc != 0x38) RETURN(BZ_DATA_ERROR);
- GET_UCHAR(BZ_X_ENDHDR_5, uc);
- if (uc != 0x50) RETURN(BZ_DATA_ERROR);
- GET_UCHAR(BZ_X_ENDHDR_6, uc);
- if (uc != 0x90) RETURN(BZ_DATA_ERROR);
-
- s->storedCombinedCRC = 0;
- GET_UCHAR(BZ_X_CCRC_1, uc);
- s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc);
- GET_UCHAR(BZ_X_CCRC_2, uc);
- s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc);
- GET_UCHAR(BZ_X_CCRC_3, uc);
- s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc);
- GET_UCHAR(BZ_X_CCRC_4, uc);
- s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc);
-
- s->state = BZ_X_IDLE;
- RETURN(BZ_STREAM_END);
-
- default: AssertH ( False, 4001 );
- }
-
- AssertH ( False, 4002 );
-
- save_state_and_return:
-
- s->save_i = i;
- s->save_j = j;
- s->save_t = t;
- s->save_alphaSize = alphaSize;
- s->save_nGroups = nGroups;
- s->save_nSelectors = nSelectors;
- s->save_EOB = EOB;
- s->save_groupNo = groupNo;
- s->save_groupPos = groupPos;
- s->save_nextSym = nextSym;
- s->save_nblockMAX = nblockMAX;
- s->save_nblock = nblock;
- s->save_es = es;
- s->save_N = N;
- s->save_curr = curr;
- s->save_zt = zt;
- s->save_zn = zn;
- s->save_zvec = zvec;
- s->save_zj = zj;
- s->save_gSel = gSel;
- s->save_gMinlen = gMinlen;
- s->save_gLimit = gLimit;
- s->save_gBase = gBase;
- s->save_gPerm = gPerm;
-
- return retVal;
-}
-
-
-/*-------------------------------------------------------------*/
-/*--- end decompress.c ---*/
-/*-------------------------------------------------------------*/
diff --git a/winsup/bz2lib/dlltest.c b/winsup/bz2lib/dlltest.c
deleted file mode 100644
index f79279cef..000000000
--- a/winsup/bz2lib/dlltest.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- minibz2
- libbz2.dll test program.
- by Yoshioka Tsuneo(QWF00133@nifty.ne.jp/tsuneo-y@is.aist-nara.ac.jp)
- This file is Public Domain.
- welcome any email to me.
-
- usage: minibz2 [-d] [-{1,2,..9}] [[srcfilename] destfilename]
-*/
-
-#define BZ_IMPORT
-#include <stdio.h>
-#include <stdlib.h>
-#include "bzlib.h"
-#ifdef _WIN32
-#include <io.h>
-#endif
-
-
-#ifdef _WIN32
-
-#define BZ2_LIBNAME "libbz2-1.0.0.DLL"
-
-#include <windows.h>
-static int BZ2DLLLoaded = 0;
-static HINSTANCE BZ2DLLhLib;
-int BZ2DLLLoadLibrary(void)
-{
- HINSTANCE hLib;
-
- if(BZ2DLLLoaded==1){return 0;}
- hLib=LoadLibrary(BZ2_LIBNAME);
- if(hLib == NULL){
- fprintf(stderr,"Can't load %s\n",BZ2_LIBNAME);
- return -1;
- }
- BZ2_bzlibVersion=GetProcAddress(hLib,"BZ2_bzlibVersion");
- BZ2_bzopen=GetProcAddress(hLib,"BZ2_bzopen");
- BZ2_bzdopen=GetProcAddress(hLib,"BZ2_bzdopen");
- BZ2_bzread=GetProcAddress(hLib,"BZ2_bzread");
- BZ2_bzwrite=GetProcAddress(hLib,"BZ2_bzwrite");
- BZ2_bzflush=GetProcAddress(hLib,"BZ2_bzflush");
- BZ2_bzclose=GetProcAddress(hLib,"BZ2_bzclose");
- BZ2_bzerror=GetProcAddress(hLib,"BZ2_bzerror");
-
- if (!BZ2_bzlibVersion || !BZ2_bzopen || !BZ2_bzdopen
- || !BZ2_bzread || !BZ2_bzwrite || !BZ2_bzflush
- || !BZ2_bzclose || !BZ2_bzerror) {
- fprintf(stderr,"GetProcAddress failed.\n");
- return -1;
- }
- BZ2DLLLoaded=1;
- BZ2DLLhLib=hLib;
- return 0;
-
-}
-int BZ2DLLFreeLibrary(void)
-{
- if(BZ2DLLLoaded==0){return 0;}
- FreeLibrary(BZ2DLLhLib);
- BZ2DLLLoaded=0;
-}
-#endif /* WIN32 */
-
-void usage(void)
-{
- puts("usage: minibz2 [-d] [-{1,2,..9}] [[srcfilename] destfilename]");
-}
-
-int main(int argc,char *argv[])
-{
- int decompress = 0;
- int level = 9;
- char *fn_r = NULL;
- char *fn_w = NULL;
-
-#ifdef _WIN32
- if(BZ2DLLLoadLibrary()<0){
- fprintf(stderr,"Loading of %s failed. Giving up.\n", BZ2_LIBNAME);
- exit(1);
- }
- printf("Loading of %s succeeded. Library version is %s.\n",
- BZ2_LIBNAME, BZ2_bzlibVersion() );
-#endif
- while(++argv,--argc){
- if(**argv =='-' || **argv=='/'){
- char *p;
-
- for(p=*argv+1;*p;p++){
- if(*p=='d'){
- decompress = 1;
- }else if('1'<=*p && *p<='9'){
- level = *p - '0';
- }else{
- usage();
- exit(1);
- }
- }
- }else{
- break;
- }
- }
- if(argc>=1){
- fn_r = *argv;
- argc--;argv++;
- }else{
- fn_r = NULL;
- }
- if(argc>=1){
- fn_w = *argv;
- argc--;argv++;
- }else{
- fn_w = NULL;
- }
- {
- int len;
- char buff[0x1000];
- char mode[10];
-
- if(decompress){
- BZFILE *BZ2fp_r = NULL;
- FILE *fp_w = NULL;
-
- if(fn_w){
- if((fp_w = fopen(fn_w,"wb"))==NULL){
- printf("can't open [%s]\n",fn_w);
- perror("reason:");
- exit(1);
- }
- }else{
- fp_w = stdout;
- }
- if((BZ2fp_r == NULL && (BZ2fp_r = BZ2_bzdopen(fileno(stdin),"rb"))==NULL)
- || (BZ2fp_r != NULL && (BZ2fp_r = BZ2_bzopen(fn_r,"rb"))==NULL)){
- printf("can't bz2openstream\n");
- exit(1);
- }
- while((len=BZ2_bzread(BZ2fp_r,buff,0x1000))>0){
- fwrite(buff,1,len,fp_w);
- }
- BZ2_bzclose(BZ2fp_r);
- if(fp_w != stdout) fclose(fp_w);
- }else{
- BZFILE *BZ2fp_w = NULL;
- FILE *fp_r = NULL;
-
- if(fn_r){
- if((fp_r = fopen(fn_r,"rb"))==NULL){
- printf("can't open [%s]\n",fn_r);
- perror("reason:");
- exit(1);
- }
- }else{
- fp_r = stdin;
- }
- mode[0]='w';
- mode[1] = '0' + level;
- mode[2] = '\0';
-
- if((fn_w == NULL && (BZ2fp_w = BZ2_bzdopen(fileno(stdout),mode))==NULL)
- || (fn_w !=NULL && (BZ2fp_w = BZ2_bzopen(fn_w,mode))==NULL)){
- printf("can't bz2openstream\n");
- exit(1);
- }
- while((len=fread(buff,1,0x1000,fp_r))>0){
- BZ2_bzwrite(BZ2fp_w,buff,len);
- }
- BZ2_bzclose(BZ2fp_w);
- if(fp_r!=stdin)fclose(fp_r);
- }
- }
-#ifdef _WIN32
- BZ2DLLFreeLibrary();
-#endif
- return 0;
-}
diff --git a/winsup/bz2lib/dlltest.dsp b/winsup/bz2lib/dlltest.dsp
deleted file mode 100644
index 4b1615edc..000000000
--- a/winsup/bz2lib/dlltest.dsp
+++ /dev/null
@@ -1,93 +0,0 @@
-# Microsoft Developer Studio Project File - Name="dlltest" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
-# ** •ÒW‚µ‚È‚¢‚Å‚­‚¾‚³‚¢ **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=dlltest - Win32 Debug
-!MESSAGE ‚±‚ê‚Í—LŒø‚ÈÒ²¸Ì§²Ù‚Å‚Í‚ ‚è‚Ü‚¹‚ñB ‚±‚ÌÌßÛ¼Þª¸Ä‚ðËÞÙÄÞ‚·‚邽‚ß‚É‚Í NMAKE ‚ðŽg—p‚µ‚Ä‚­‚¾‚³‚¢B
-!MESSAGE [Ò²¸Ì§²Ù‚Ì´¸½Îß°Ä] ºÏÝÄÞ‚ðŽg—p‚µ‚ÄŽÀs‚µ‚Ä‚­‚¾‚³‚¢
-!MESSAGE
-!MESSAGE NMAKE /f "dlltest.mak".
-!MESSAGE
-!MESSAGE NMAKE ‚ÌŽÀsŽž‚É\¬‚ðŽw’è‚Å‚«‚Ü‚·
-!MESSAGE ºÏÝÄÞ ×²Ýã‚ÅϸۂÌÝ’è‚ð’è‹`‚µ‚Ü‚·B—á:
-!MESSAGE
-!MESSAGE NMAKE /f "dlltest.mak" CFG="dlltest - Win32 Debug"
-!MESSAGE
-!MESSAGE ‘I‘ð‰Â”\‚ÈËÞÙÄÞ Ó°ÄÞ:
-!MESSAGE
-!MESSAGE "dlltest - Win32 Release" ("Win32 (x86) Console Application" —p)
-!MESSAGE "dlltest - Win32 Debug" ("Win32 (x86) Console Application" —p)
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "dlltest - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x411 /d "NDEBUG"
-# ADD RSC /l 0x411 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"minibz2.exe"
-
-!ELSEIF "$(CFG)" == "dlltest - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "dlltest_"
-# PROP BASE Intermediate_Dir "dlltest_"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "dlltest_"
-# PROP Intermediate_Dir "dlltest_"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x411 /d "_DEBUG"
-# ADD RSC /l 0x411 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"minibz2.exe" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "dlltest - Win32 Release"
-# Name "dlltest - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\bzlib.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\dlltest.c
-# End Source File
-# End Target
-# End Project
diff --git a/winsup/bz2lib/huffman.c b/winsup/bz2lib/huffman.c
deleted file mode 100644
index 9b446c4b3..000000000
--- a/winsup/bz2lib/huffman.c
+++ /dev/null
@@ -1,228 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Huffman coding low-level stuff ---*/
-/*--- huffman.c ---*/
-/*-------------------------------------------------------------*/
-
-/*--
- This file is a part of bzip2 and/or libbzip2, a program and
- library for lossless, block-sorting data compression.
-
- Copyright (C) 1996-2000 Julian R Seward. 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. The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 3. Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-
- 4. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
-
- Julian Seward, Cambridge, UK.
- jseward@acm.org
- bzip2/libbzip2 version 1.0 of 21 March 2000
-
- This program is based on (at least) the work of:
- Mike Burrows
- David Wheeler
- Peter Fenwick
- Alistair Moffat
- Radford Neal
- Ian H. Witten
- Robert Sedgewick
- Jon L. Bentley
-
- For more information on these sources, see the manual.
---*/
-
-
-#include "bzlib_private.h"
-
-/*---------------------------------------------------*/
-#define WEIGHTOF(zz0) ((zz0) & 0xffffff00)
-#define DEPTHOF(zz1) ((zz1) & 0x000000ff)
-#define MYMAX(zz2,zz3) ((zz2) > (zz3) ? (zz2) : (zz3))
-
-#define ADDWEIGHTS(zw1,zw2) \
- (WEIGHTOF(zw1)+WEIGHTOF(zw2)) | \
- (1 + MYMAX(DEPTHOF(zw1),DEPTHOF(zw2)))
-
-#define UPHEAP(z) \
-{ \
- Int32 zz, tmp; \
- zz = z; tmp = heap[zz]; \
- while (weight[tmp] < weight[heap[zz >> 1]]) { \
- heap[zz] = heap[zz >> 1]; \
- zz >>= 1; \
- } \
- heap[zz] = tmp; \
-}
-
-#define DOWNHEAP(z) \
-{ \
- Int32 zz, yy, tmp; \
- zz = z; tmp = heap[zz]; \
- while (True) { \
- yy = zz << 1; \
- if (yy > nHeap) break; \
- if (yy < nHeap && \
- weight[heap[yy+1]] < weight[heap[yy]]) \
- yy++; \
- if (weight[tmp] < weight[heap[yy]]) break; \
- heap[zz] = heap[yy]; \
- zz = yy; \
- } \
- heap[zz] = tmp; \
-}
-
-
-/*---------------------------------------------------*/
-void BZ2_hbMakeCodeLengths ( UChar *len,
- Int32 *freq,
- Int32 alphaSize,
- Int32 maxLen )
-{
- /*--
- Nodes and heap entries run from 1. Entry 0
- for both the heap and nodes is a sentinel.
- --*/
- Int32 nNodes, nHeap, n1, n2, i, j, k;
- Bool tooLong;
-
- Int32 heap [ BZ_MAX_ALPHA_SIZE + 2 ];
- Int32 weight [ BZ_MAX_ALPHA_SIZE * 2 ];
- Int32 parent [ BZ_MAX_ALPHA_SIZE * 2 ];
-
- for (i = 0; i < alphaSize; i++)
- weight[i+1] = (freq[i] == 0 ? 1 : freq[i]) << 8;
-
- while (True) {
-
- nNodes = alphaSize;
- nHeap = 0;
-
- heap[0] = 0;
- weight[0] = 0;
- parent[0] = -2;
-
- for (i = 1; i <= alphaSize; i++) {
- parent[i] = -1;
- nHeap++;
- heap[nHeap] = i;
- UPHEAP(nHeap);
- }
-
- AssertH( nHeap < (BZ_MAX_ALPHA_SIZE+2), 2001 );
-
- while (nHeap > 1) {
- n1 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1);
- n2 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1);
- nNodes++;
- parent[n1] = parent[n2] = nNodes;
- weight[nNodes] = ADDWEIGHTS(weight[n1], weight[n2]);
- parent[nNodes] = -1;
- nHeap++;
- heap[nHeap] = nNodes;
- UPHEAP(nHeap);
- }
-
- AssertH( nNodes < (BZ_MAX_ALPHA_SIZE * 2), 2002 );
-
- tooLong = False;
- for (i = 1; i <= alphaSize; i++) {
- j = 0;
- k = i;
- while (parent[k] >= 0) { k = parent[k]; j++; }
- len[i-1] = j;
- if (j > maxLen) tooLong = True;
- }
-
- if (! tooLong) break;
-
- for (i = 1; i < alphaSize; i++) {
- j = weight[i] >> 8;
- j = 1 + (j / 2);
- weight[i] = j << 8;
- }
- }
-}
-
-
-/*---------------------------------------------------*/
-void BZ2_hbAssignCodes ( Int32 *code,
- UChar *length,
- Int32 minLen,
- Int32 maxLen,
- Int32 alphaSize )
-{
- Int32 n, vec, i;
-
- vec = 0;
- for (n = minLen; n <= maxLen; n++) {
- for (i = 0; i < alphaSize; i++)
- if (length[i] == n) { code[i] = vec; vec++; };
- vec <<= 1;
- }
-}
-
-
-/*---------------------------------------------------*/
-void BZ2_hbCreateDecodeTables ( Int32 *limit,
- Int32 *base,
- Int32 *perm,
- UChar *length,
- Int32 minLen,
- Int32 maxLen,
- Int32 alphaSize )
-{
- Int32 pp, i, j, vec;
-
- pp = 0;
- for (i = minLen; i <= maxLen; i++)
- for (j = 0; j < alphaSize; j++)
- if (length[j] == i) { perm[pp] = j; pp++; };
-
- for (i = 0; i < BZ_MAX_CODE_LEN; i++) base[i] = 0;
- for (i = 0; i < alphaSize; i++) base[length[i]+1]++;
-
- for (i = 1; i < BZ_MAX_CODE_LEN; i++) base[i] += base[i-1];
-
- for (i = 0; i < BZ_MAX_CODE_LEN; i++) limit[i] = 0;
- vec = 0;
-
- for (i = minLen; i <= maxLen; i++) {
- vec += (base[i+1] - base[i]);
- limit[i] = vec-1;
- vec <<= 1;
- }
- for (i = minLen + 1; i <= maxLen; i++)
- base[i] = ((limit[i-1] + 1) << 1) - base[i];
-}
-
-
-/*-------------------------------------------------------------*/
-/*--- end huffman.c ---*/
-/*-------------------------------------------------------------*/
diff --git a/winsup/bz2lib/libbz2.def b/winsup/bz2lib/libbz2.def
deleted file mode 100644
index 2dc0dd891..000000000
--- a/winsup/bz2lib/libbz2.def
+++ /dev/null
@@ -1,27 +0,0 @@
-LIBRARY LIBBZ2
-DESCRIPTION "libbzip2: library for data compression"
-EXPORTS
- BZ2_bzCompressInit
- BZ2_bzCompress
- BZ2_bzCompressEnd
- BZ2_bzDecompressInit
- BZ2_bzDecompress
- BZ2_bzDecompressEnd
- BZ2_bzReadOpen
- BZ2_bzReadClose
- BZ2_bzReadGetUnused
- BZ2_bzRead
- BZ2_bzWriteOpen
- BZ2_bzWrite
- BZ2_bzWriteClose
- BZ2_bzWriteClose64
- BZ2_bzBuffToBuffCompress
- BZ2_bzBuffToBuffDecompress
- BZ2_bzlibVersion
- BZ2_bzopen
- BZ2_bzdopen
- BZ2_bzread
- BZ2_bzwrite
- BZ2_bzflush
- BZ2_bzclose
- BZ2_bzerror
diff --git a/winsup/bz2lib/libbz2.dsp b/winsup/bz2lib/libbz2.dsp
deleted file mode 100644
index a21a20f75..000000000
--- a/winsup/bz2lib/libbz2.dsp
+++ /dev/null
@@ -1,130 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libbz2" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
-# ** •ÒW‚µ‚È‚¢‚Å‚­‚¾‚³‚¢ **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libbz2 - Win32 Debug
-!MESSAGE ‚±‚ê‚Í—LŒø‚ÈÒ²¸Ì§²Ù‚Å‚Í‚ ‚è‚Ü‚¹‚ñB ‚±‚ÌÌßÛ¼Þª¸Ä‚ðËÞÙÄÞ‚·‚邽‚ß‚É‚Í NMAKE ‚ðŽg—p‚µ‚Ä‚­‚¾‚³‚¢B
-!MESSAGE [Ò²¸Ì§²Ù‚Ì´¸½Îß°Ä] ºÏÝÄÞ‚ðŽg—p‚µ‚ÄŽÀs‚µ‚Ä‚­‚¾‚³‚¢
-!MESSAGE
-!MESSAGE NMAKE /f "libbz2.mak".
-!MESSAGE
-!MESSAGE NMAKE ‚ÌŽÀsŽž‚É\¬‚ðŽw’è‚Å‚«‚Ü‚·
-!MESSAGE ºÏÝÄÞ ×²Ýã‚ÅϸۂÌÝ’è‚ð’è‹`‚µ‚Ü‚·B—á:
-!MESSAGE
-!MESSAGE NMAKE /f "libbz2.mak" CFG="libbz2 - Win32 Debug"
-!MESSAGE
-!MESSAGE ‘I‘ð‰Â”\‚ÈËÞÙÄÞ Ó°ÄÞ:
-!MESSAGE
-!MESSAGE "libbz2 - Win32 Release" ("Win32 (x86) Dynamic-Link Library" —p)
-!MESSAGE "libbz2 - Win32 Debug" ("Win32 (x86) Dynamic-Link Library" —p)
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libbz2 - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD BASE RSC /l 0x411 /d "NDEBUG"
-# ADD RSC /l 0x411 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"libbz2.dll"
-
-!ELSEIF "$(CFG)" == "libbz2 - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD BASE RSC /l 0x411 /d "_DEBUG"
-# ADD RSC /l 0x411 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"libbz2.dll" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "libbz2 - Win32 Release"
-# Name "libbz2 - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\blocksort.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\bzlib.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\bzlib.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\bzlib_private.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\compress.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\crctable.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\decompress.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\huffman.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libbz2.def
-# End Source File
-# Begin Source File
-
-SOURCE=.\randtable.c
-# End Source File
-# End Target
-# End Project
diff --git a/winsup/bz2lib/makefile.msc b/winsup/bz2lib/makefile.msc
deleted file mode 100644
index 3fe42324a..000000000
--- a/winsup/bz2lib/makefile.msc
+++ /dev/null
@@ -1,63 +0,0 @@
-# Makefile for Microsoft Visual C++ 6.0
-# usage: nmake -f makefile.msc
-# K.M. Syring (syring@gsf.de)
-# Fixed up by JRS for bzip2-0.9.5d release.
-
-CC=cl
-CFLAGS= -DWIN32 -MD -Ox -D_FILE_OFFSET_BITS=64
-
-OBJS= blocksort.obj \
- huffman.obj \
- crctable.obj \
- randtable.obj \
- compress.obj \
- decompress.obj \
- bzlib.obj
-
-all: lib bzip2 test
-
-bzip2: lib
- $(CC) $(CFLAGS) -o bzip2 bzip2.c libbz2.lib setargv.obj
- $(CC) $(CFLAGS) -o bzip2recover bzip2recover.c
-
-lib: $(OBJS)
- lib /out:libbz2.lib $(OBJS)
-
-test: bzip2
- type words1
- .\\bzip2 -1 < sample1.ref > sample1.rb2
- .\\bzip2 -2 < sample2.ref > sample2.rb2
- .\\bzip2 -3 < sample3.ref > sample3.rb2
- .\\bzip2 -d < sample1.bz2 > sample1.tst
- .\\bzip2 -d < sample2.bz2 > sample2.tst
- .\\bzip2 -ds < sample3.bz2 > sample3.tst
- @echo All six of the fc's should find no differences.
- @echo If fc finds an error on sample3.bz2, this could be
- @echo because WinZip's 'TAR file smart CR/LF conversion'
- @echo is too clever for its own good. Disable this option.
- @echo The correct size for sample3.ref is 120,244. If it
- @echo is 150,251, WinZip has messed it up.
- fc sample1.bz2 sample1.rb2
- fc sample2.bz2 sample2.rb2
- fc sample3.bz2 sample3.rb2
- fc sample1.tst sample1.ref
- fc sample2.tst sample2.ref
- fc sample3.tst sample3.ref
-
-
-
-clean:
- del *.obj
- del libbz2.lib
- del bzip2.exe
- del bzip2recover.exe
- del sample1.rb2
- del sample2.rb2
- del sample3.rb2
- del sample1.tst
- del sample2.tst
- del sample3.tst
-
-.c.obj:
- $(CC) $(CFLAGS) -c $*.c -o $*.obj
-
diff --git a/winsup/bz2lib/manual.ps b/winsup/bz2lib/manual.ps
deleted file mode 100644
index 1a7dbac85..000000000
--- a/winsup/bz2lib/manual.ps
+++ /dev/null
@@ -1,3808 +0,0 @@
-%!PS-Adobe-2.0
-%%Creator: dvips(k) 5.78 Copyright 1998 Radical Eye Software (www.radicaleye.com)
-%%Title: manual.dvi
-%%Pages: 39
-%%PageOrder: Ascend
-%%BoundingBox: 0 0 596 842
-%%EndComments
-%DVIPSCommandLine: dvips -o manual.ps manual.dvi
-%DVIPSParameters: dpi=600, compressed
-%DVIPSSource: TeX output 2000.03.23:2343
-%%BeginProcSet: texc.pro
-%!
-/TeXDict 300 dict def TeXDict begin /N{def}def /B{bind def}N /S{exch}N
-/X{S N}B /TR{translate}N /isls false N /vsize 11 72 mul N /hsize 8.5 72
-mul N /landplus90{false}def /@rigin{isls{[0 landplus90{1 -1}{-1 1}
-ifelse 0 0 0]concat}if 72 Resolution div 72 VResolution div neg scale
-isls{landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div
-hsize mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul
-TR[matrix currentmatrix{dup dup round sub abs 0.00001 lt{round}if}
-forall round exch round exch]setmatrix}N /@landscape{/isls true N}B
-/@manualfeed{statusdict /manualfeed true put}B /@copies{/#copies X}B
-/FMat[1 0 0 -1 0 0]N /FBB[0 0 0 0]N /nn 0 N /IE 0 N /ctr 0 N /df-tail{
-/nn 8 dict N nn begin /FontType 3 N /FontMatrix fntrx N /FontBBox FBB N
-string /base X array /BitMaps X /BuildChar{CharBuilder}N /Encoding IE N
-end dup{/foo setfont}2 array copy cvx N load 0 nn put /ctr 0 N[}B /df{
-/sf 1 N /fntrx FMat N df-tail}B /dfs{div /sf X /fntrx[sf 0 0 sf neg 0 0]
-N df-tail}B /E{pop nn dup definefont setfont}B /ch-width{ch-data dup
-length 5 sub get}B /ch-height{ch-data dup length 4 sub get}B /ch-xoff{
-128 ch-data dup length 3 sub get sub}B /ch-yoff{ch-data dup length 2 sub
-get 127 sub}B /ch-dx{ch-data dup length 1 sub get}B /ch-image{ch-data
-dup type /stringtype ne{ctr get /ctr ctr 1 add N}if}B /id 0 N /rw 0 N
-/rc 0 N /gp 0 N /cp 0 N /G 0 N /sf 0 N /CharBuilder{save 3 1 roll S dup
-/base get 2 index get S /BitMaps get S get /ch-data X pop /ctr 0 N ch-dx
-0 ch-xoff ch-yoff ch-height sub ch-xoff ch-width add ch-yoff
-setcachedevice ch-width ch-height true[1 0 0 -1 -.1 ch-xoff sub ch-yoff
-.1 sub]/id ch-image N /rw ch-width 7 add 8 idiv string N /rc 0 N /gp 0 N
-/cp 0 N{rc 0 ne{rc 1 sub /rc X rw}{G}ifelse}imagemask restore}B /G{{id
-gp get /gp gp 1 add N dup 18 mod S 18 idiv pl S get exec}loop}B /adv{cp
-add /cp X}B /chg{rw cp id gp 4 index getinterval putinterval dup gp add
-/gp X adv}B /nd{/cp 0 N rw exit}B /lsh{rw cp 2 copy get dup 0 eq{pop 1}{
-dup 255 eq{pop 254}{dup dup add 255 and S 1 and or}ifelse}ifelse put 1
-adv}B /rsh{rw cp 2 copy get dup 0 eq{pop 128}{dup 255 eq{pop 127}{dup 2
-idiv S 128 and or}ifelse}ifelse put 1 adv}B /clr{rw cp 2 index string
-putinterval adv}B /set{rw cp fillstr 0 4 index getinterval putinterval
-adv}B /fillstr 18 string 0 1 17{2 copy 255 put pop}for N /pl[{adv 1 chg}
-{adv 1 chg nd}{1 add chg}{1 add chg nd}{adv lsh}{adv lsh nd}{adv rsh}{
-adv rsh nd}{1 add adv}{/rc X nd}{1 add set}{1 add clr}{adv 2 chg}{adv 2
-chg nd}{pop nd}]dup{bind pop}forall N /D{/cc X dup type /stringtype ne{]
-}if nn /base get cc ctr put nn /BitMaps get S ctr S sf 1 ne{dup dup
-length 1 sub dup 2 index S get sf div put}if put /ctr ctr 1 add N}B /I{
-cc 1 add D}B /bop{userdict /bop-hook known{bop-hook}if /SI save N @rigin
-0 0 moveto /V matrix currentmatrix dup 1 get dup mul exch 0 get dup mul
-add .99 lt{/QV}{/RV}ifelse load def pop pop}N /eop{SI restore userdict
-/eop-hook known{eop-hook}if showpage}N /@start{userdict /start-hook
-known{start-hook}if pop /VResolution X /Resolution X 1000 div /DVImag X
-/IE 256 array N 2 string 0 1 255{IE S dup 360 add 36 4 index cvrs cvn
-put}for pop 65781.76 div /vsize X 65781.76 div /hsize X}N /p{show}N
-/RMat[1 0 0 -1 0 0]N /BDot 260 string N /rulex 0 N /ruley 0 N /v{/ruley
-X /rulex X V}B /V{}B /RV statusdict begin /product where{pop false[
-(Display)(NeXT)(LaserWriter 16/600)]{dup length product length le{dup
-length product exch 0 exch getinterval eq{pop true exit}if}{pop}ifelse}
-forall}{false}ifelse end{{gsave TR -.1 .1 TR 1 1 scale rulex ruley false
-RMat{BDot}imagemask grestore}}{{gsave TR -.1 .1 TR rulex ruley scale 1 1
-false RMat{BDot}imagemask grestore}}ifelse B /QV{gsave newpath transform
-round exch round exch itransform moveto rulex 0 rlineto 0 ruley neg
-rlineto rulex neg 0 rlineto fill grestore}B /a{moveto}B /delta 0 N /tail
-{dup /delta X 0 rmoveto}B /M{S p delta add tail}B /b{S p tail}B /c{-4 M}
-B /d{-3 M}B /e{-2 M}B /f{-1 M}B /g{0 M}B /h{1 M}B /i{2 M}B /j{3 M}B /k{
-4 M}B /w{0 rmoveto}B /l{p -4 w}B /m{p -3 w}B /n{p -2 w}B /o{p -1 w}B /q{
-p 1 w}B /r{p 2 w}B /s{p 3 w}B /t{p 4 w}B /x{0 S rmoveto}B /y{3 2 roll p
-a}B /bos{/SS save N}B /eos{SS restore}B end
-
-%%EndProcSet
-TeXDict begin 39158280 55380996 1000 600 600 (manual.dvi)
-@start
-%DVIPSBitmapFont: Fa cmti10 10.95 1
-/Fa 1 47 df<120FEA3FC0127FA212FFA31380EA7F00123C0A0A77891C>46
-D E
-%EndDVIPSBitmapFont
-%DVIPSBitmapFont: Fb cmbxti10 14.4 1
-/Fb 1 47 df<13FCEA03FF000F13804813C05AA25AA2B5FCA31480A214006C5A6C5A6C5A
-EA0FE0121271912B>46 D E
-%EndDVIPSBitmapFont
-%DVIPSBitmapFont: Fc cmsl10 10.95 25
-/Fc 25 122 df<D901F8160CD907FE161ED91F07163E90263E0380157E017C6D15FC496C
-6CEC03F8D801F06DEC07F00003D900FCEC1FE04901EFEC7FC00007913AE3E007EF804901
-E0B5129F000F913A701FF83F0093C7127E48485E604D5A03F01303003F4A495A90C74A5A
-4D5A4DC7FC0201143E4B5B17FC4C5A003E4948485A4C5A003F01075C6C4A485A020E131F
-021E49C8FC6C6C48137E02385B3A07C0F001F82603E1E05B3A00FF8003E090263E000714
-7E90C73A0FC001FF80923A1F8007C1C0923A3F000F80E0033E90381F00F04B013E137003
-FC4913784A4801FC13384A485B913807E001DA0FC05BDB8003141CEC1F004A495A147E5C
-4948163C4948010F14384A5C495A130F4948167849C71570137E017C17F0494B13E01201
-4848EDC0014848020714C04848EE03804848160790C83903E00F00003E170E007E923801
-F03C486F6C5A48EE3FE00070EE0F803F4975C34C>37 D<EA0780EA0FE0EA1FF0123FA512
-1FEA0F301200A213701360A213E013C0120113801203EA07001206120E5A5A5A5A5A0C1C
-7A8919>44 D<EC07F8EC3FFF9138FC0FC0903903F003E0903907C001F0D90F8013F849C7
-FC013E14FC017E147C017C147E13FC485AA20003157F5B1207A2120F5BA2121F16FF5BA2
-123FA44848EB01FEA648C7EA03FCA5ED07F8A25A16F0A2150F16E0A3ED1FC0A21680007E
-143F1600157E123E003F5C4A5AD81F805B000FEB07E06C6C485A2603F03FC7FC3800FFFC
-EB1FE0283F79BC2D>48 D<157015F014011407143F903803FFE0137FEBFFCFEBF80F1300
-141F15C0A5143F1580A5147F1500A55C5CA513015CA513035CA513075CA5130F5CA3131F
-497EB612F8A31D3D78BC2D>I<133C137F5B481380A31400A26C5A137890C7FCB3EA0780
-EA0FE0121F123FA5121FEA0F601200A213E05BA212015B120390C7FC5A1206120E5A5A12
-3012705A5A11397AA619>59 D<EC7FC0903803FFF890380FC07E90383E003F496D7E01FF
-6D7E82A248140782A26C5A137890C7120FA25EA2EC03FF147F903807FF1FEB1FE0D97F80
-5B3801FE00EA03F8485A4848133F485A003F5D49EC81C048C7FCA2157F48ED03804814FF
-A2007F5B913903BF0700903880073F3A3FC00E1F8E260FE03C13FC3A03FFF00FF83A007F
-C003E02A2A7CA82D>97 D<EB3F80EA1FFFA3C6FC137FA291C9FCA55B5BA512015BA4EC07
-F80003EB3FFF9039F8F80FC09039FBE003E09039FF8001F891C77E5B4848147E49147F5B
-821780A2120F5B17C0A3167F001F16805BA4EEFF00123F5B4B5AA24B5A5E007F4A5AA24B
-5A6D495A4BC7FCD87CE0137E39F87001F839F03C07E039E00FFF80260003FCC8FC2A4077
-BE33>I<EC1FF0ECFFFE903903F01F8090390FC003C0D93F0013E0017E130F49131F0001
-15F04848EB3FE0485AA24848EB1FC0001FEC0F004990C7FC123FA2485AA412FF90C9FCA9
-6CEC0380150716006C6C5B151E001F5C6C6C5B6C6C5B6C6C485A3901F80F8026007FFEC7
-FCEB0FF0242A7AA828>I<EE03F8ED01FFA3ED000F1607A217F0A4160FA217E0A4161FA2
-17C0A491380FF03FECFFFC902603F81F138090390FC007BF90391F8003FF90387E000149
-7F0001157F48481500485A120F5B001F5D485A5E5B127FA2150112FF90C75BA41503A25E
-A37E1507A26C4A5A7F001F141F6C6C133F6C6CEBFFF83B03F001EFFFC03900F80F8F9038
-3FFE0FD90FF0EBE0002D407ABE33>I<EC3FE0903801FFF8903807E07E90380F801F9039
-3F000F80017E14C049EB07E0485A12034848EB03F0485AA2121F5B123FA248481307A290
-B6FCA2D8FF80C8FC90C9FCA87EED01C015036C15806D1307001FEC0F006D131E000F5C6C
-6C5B6C6C485A3900FC07C0D93FFFC7FCEB07F8242A7BA828>I<ED07F0ED3FFCEDFC1E91
-3803F03F4A48B4FC4A481380141FEC3F81DA7F0113008102FE137C93C7FCA213015CA513
-035CA50007B512F8A3260007F0C8FCA3130F5CA5131F5CA5133F5CA5137F91C9FCA55B5B
-A4EA03FF007F13FEB5FCA229407DBF1C>I<147FEB3FFFA313017FA25CA513015CA51303
-5CA4ED07F80107EB1FFF9139F0781FC09138F1E00F9139F38007E0ECF70002FE14F0495A
-5CA25CA24A130F131F4A14E0A4161F133F4A14C0A4163F137F91C71380A4167F5B491500
-A300015D486C491380B5D8F87F13FCA32E3F7DBE33>104 D<1478EB01FE130314FFA25B
-14FE130314FCEB00F01400ACEB03F8EA01FF14F0A2EA001F130FA314E0A5131F14C0A513
-3F1480A5137F1400A55B5BA4EA03FF007F13F0A2B5FC183E7DBD1A>I<143FEB1FFF5BA2
-13017FA214FEA5130114FCA5130314F8A5130714F0A5130F14E0A5131F14C0A5133F1480
-A5137F1400A55B5BA4EA03FF007F13F8A2B5FC183F7DBE1A>108
-D<902707F007F8EB03FCD803FFD91FFF90380FFF80913CE0781FC03C0FE09126E1E00FEB
-F0073E001FE38007E1C003F090260FE700EBE38002EEDAF70013F802FC14FE02D85C14F8
-4A5CA24A5C011F020F14074A4A14F0A5013F021F140F4A4A14E0A5017F023F141F91C749
-14C0A549027F143F4992C71380A300014B147F486C496DEBFFC0B5D8F87FD9FC3F13FEA3
-47287DA74C>I<903907F007F8D803FFEB1FFF9139E0781FC09138E1E00F3B001FE38007
-E090380FE70002EE14F014FC14D814F85CA24A130F131F4A14E0A4161F133F4A14C0A416
-3F137F91C71380A4167F5B491500A300015D486C491380B5D8F87F13FCA32E287DA733>
-I<EC0FF0ECFFFE903903F01F8090390FC007C049C66C7E013E6D7E01FC6D7E4848804914
-7C0003157E485A000F157F5B121FA2485AA2007F1680A2170048C85AA54B5AA25E5A6C4A
-5A7E4B5A5E6C140F6C6C5C4B5A6C6C013EC7FC6C6C5B6C6C485A3900FC0FE090383FFF80
-D90FF8C8FC292A7BA82D>I<91387F01FE903A7FFF0FFFC09139FE3E03F09238F801F890
-3A01FFE000FE4B137F6D497F4990C713804A15C04A141FA218E0A20103150F5C18F0A317
-1F010716E05CA3173F18C0130F4A147F1880A2EFFF004C5A011F5D16034C5A6E495AEE1F
-C06E495AD93FDC017EC7FC91388F01F8913883FFE0028090C8FC92C9FC137FA291CAFCA4
-5BA25BA31201487EB512F8A3343A81A733>I<903907F01F80D803FFEB7FE09138E1E1F0
-9138E387F839001FE707EB0FE614EE02FC13F002D813E09138F801804AC7FCA25C131FA2
-5CA4133F5CA5137F91C8FCA55B5BA31201487EB512FEA325287EA724>114
-D<9138FF81C0010713E390381F807F90397C003F8049131F4848130F5B00031407A24848
-1400A27FA27F6D90C7FCEBFF8014FC6C13FF6C14C015F06C6C7F011F7F13079038007FFE
-1403140100381300157EA2123C153E157E007C147CA2007E147815F8007F495A4A5A486C
-485A26F9E01FC7FC38E0FFFC38C01FE0222A7DA824>I<EB0380A4130791C7FCA25BA25B
-A2133EA2137E13FE12011207001FB512C0B6FCA2D801FCC7FCA312035BA512075BA5120F
-5BA41407001F130E13C0A4141E141C1380A26D5AA2000F5B14F03807E1E03801FF80D800
-7EC7FC1A3978B723>I<01FE147F00FFEC7FFF4914FEA20007140300031401A34914FCA4
-150312074914F8A41507120F4914F0A4150F121F4914E0A2151FA3153F4914C0157F15FF
-EC01DF3A0FC003BFE09138073FFF3803F01E3801FFF826003FE01380282977A733>I<B5
-39E007FFF05D17E02707FE000313006C48EB01FC6F5A5E00014A5A5EA24B5A6D13070000
-92C7FC5D150E6D5B7F5DA25D1480013F5B14815D14C3011F5B02C7C8FCA214CE14EEEB0F
-FCA25CA26D5A5CA25CA26D5A2C2878A630>I<B500C3B53803FFFCA204FE14F8290FFE00
-3FE00013C0D807F86D48EB7F000003173E183C150F18386D5E0001141F705B153F4D5A15
-776D4B5A0000ECE7F04DC7FCEC01C3170E9038FF0383017F5D91380703F85FEC0E01021E
-5CD93F9C14F002BC6D5A02B813FDDAF8005B4A13FF5F6D5A94C8FC5C4A137E167C6DC7FC
-1678010E14383E2878A642>I<90B539E007FFF05E18E0902707FE000313006D48EB01FC
-705A5F01014A5A5F16036E5C0100140794C7FC160E805E805E1678ED8070023F13F05EED
-81C015C191381FC38015C793C8FC15EF15EEEC0FFCA25DA26E5AA25DA26E5A5DA24AC9FC
-5C140E141E141C5C121C003F5B5A485B495A130300FE5B4848CAFCEA701EEA783CEA3FF0
-EA0FC0343A80A630>121 D E
-%EndDVIPSBitmapFont
-%DVIPSBitmapFont: Fd cmtt12 14.4 10
-/Fd 10 123 df<EC3FF80103B57E010F14E0013F14F84914FE48B7FC4816C048D9C01F7F
-270FFE00017F49EB007FD81FF0EC1FF848486E7E160748486E7E4914018300FF81A26D16
-80177FA36C5AA26CC9FCCAFCA217FF1800A25E5F16035F16075F160F4C5A163F4C5A5F4C
-5A4B90C7FCED07FE4B5A4B5A4B5A4B5A4B5A4A5B4A90C8FCEC0FFE4A5AEC3FF04A5A4A5A
-495B4990C9FCEB0FFC495A495A495A4948143F485B4890C8EA7F80EA0FFC485A48B8FC5A
-B9FCA36C17007E314A7AC93E>50 D<383FFF805AB57EA37E7EEA003FAEED07FC92383FFF
-8092B512E002C314F802CF8002DF8091B7FCDBF80F1380DBC00113C092C713E04A143F4A
-EC1FF04A15F84A140F4AEC07FCA217034A15FE1701A318FF83A95F18FEA280170318FC6E
-140718F86E140FEF1FF06E143F6EEC7FE06EECFFC0DBC0031380EDF01F92B6120002DF14
-FC02CF5C02C35CD91F8114C090260F807F90C7FC90C7EA0FF8384A7FC83E>98
-D<923803FFF85D4B7FA38181ED0003AEEC1FF0ECFFFE0103EBFF83010F14E34914F3017F
-14FB90B7FC48EBF80F48EBC00191C7FC4848143F4848141F5B4848140F491407123F4914
-03127F5BA312FF90C8FCA97F127FA216077F123F6D140FA26C6C141F6D143F000F157F6C
-6C14FF01FF5B6C6D5A6CD9F01FEBFFFC6C90B500FB13FE6D02F313FF6D14E3010F14C36D
-020113FE010101FC14FC9026003FE0C8FC384A7CC83E>100 D<143E147F4A7E497FA56D
-5B6EC8FC143E91C9FCAC003FB57E5A81A47EC7123FB3B3007FB71280B812C0A56C16802A
-4A76C93E>105 D<007FB512C0B6FC81A47EC7121FB3B3B3A5007FB712F8B812FCA56C16
-F82E4978C83E>108 D<EC1FF0ECFFFE01036D7E010F14E04980017F14FC90B67E489038
-F01FFFECC00748D90001138048486D13C04848EC7FE049143F4848EC1FF049140F003F16
-F8491407A24848EC03FCA448C8EA01FEAA6D1403007F16FCA26D1407A2003F16F86D140F
-6C6CEC1FF0A26C6CEC3FE06D147F6C6CECFFC06D5B6CD9C00713806CD9F01F13006C90B5
-5A6D5C6D5C010F14E001031480010049C7FCEC1FF02F3679B43E>111
-D<ED07FC3B3FFF803FFF804891B512E0B500C314F802CF8002DF806C90B7FC6CDAF80F13
-80D8003FD9C00113C092C713E04A143F4AEC1FF04A15F84A140F4AEC07FCA217034A15FE
-1701A318FF83A95F18FEA280170318FC6E140718F86E140FEF1FF06E143F6EEC7FE06EEC
-FFC0DBC0031380EDF01F92B6120002DF14FC02CF5C02C35C02C114C0DAC07F90C7FCED0F
-F892C9FCB3003FB512C04880B67EA36C5C6C5C384F7FB33E>I<903901FFF00F011F9038
-FE1F8090B612BF000315FF5A5A5A393FFE003F01F01307D87FC0130190C8FC5A48157FA4
-7EEE3F00D87FC091C7FC13F0EA3FFE381FFFF06CEBFFC06C14FE6C6E7EC615E0013F14F8
-010780D9003F7F02007F03071380030013C0003EED3FE0007F151F48150F17F06D1407A3
-7FA26D140F6D15E0161F01FCEC3FC06D14FF9026FFC00F138091B612005E485D013F5C6D
-14E0D8FC0714802778007FF8C7FC2C3677B43E>115 D<147C14FC497EAD003FB712FC5A
-B87EA36C5EA2260001FEC9FCB3A6173FA2EF7F80A76E14FF6D16006F5A9238C007FE9138
-7FF01F92B55A6E5C6E5C6E5C6E1480020149C7FC9138003FF031437DC13E>I<000FB812
-804817C04817E0A418C001C0C712014C13804C1300EE1FFE4C5AEE7FF06C484A5A4B5BC8
-485B4B90C7FC4B5A4B5A4B5A4B5A4B5A4A5B4A5B4A90C8FC4A5A4A5A4A5A4A5A4A5A495B
-495B4990C9FC495A495A4948EC0FC0495A4948EC1FE0485B00075B4890C8FCEA1FFC485A
-485A90B8FCB9FCA46C17C07E33337CB23E>122 D E
-%EndDVIPSBitmapFont
-%DVIPSBitmapFont: Fe cmtt12 13.14 31
-/Fe 31 123 df<ECFFE0010713FC011FEBFF80017F14E048B67E48814815FE489038007F
-FF01F8130748480101138048489038007FC049EC3FE04848141F90C8120F17F048150717
-F87F1603A36CC8FC123EC9FCA2160717F0A2160F17E0161F17C0163FEE7F80A2EEFF004B
-5A15034B5A4B5A4B5AED7FE04B5A4A5B4A90C7FC4A5AEC1FF84A5A4A5A4A5A495BD907FE
-C8FC495A495A495A495A2601FF80EB01F04890C7EA03F8485A485A485A48B7FC5AB8FCA3
-7E6C16F02D447BC338>50 D<003FB6FC4815E0B712F882826C816C16802701FC000113C0
-9238007FE0161FEE0FF0A2160717F81603A6160717F0A2160FEE1FE0163FEE7FC0923801
-FF80030F130090B65A5E16F08216FEEEFF8017C001FCC7EA7FE0EE1FF0EE07F8160317FC
-EE01FE1600A217FF177FA717FF17FE16011603EE07FC160FEE3FF8EEFFF0003FB7FC4816
-E0B812C01780EEFE006C15F86C15C030437DC238>66 D<DA07FC133C91393FFF807E91B5
-12E00103ECF8FE4914FC4914FF5B90383FFE0390387FF000D9FFC0133F4849131F91C712
-0F48481407485A49140348481401A2485AA248481400A25BA2007F167C90CAFCA35A5AAD
-7E7EA37F003F167C17FE7FA26C7EA26C6C140117FC6C7E6D14036C6C15F86C6C14076EEB
-0FF06C6D131FD97FF0EB7FE0903A3FFE03FFC06DB612806D15006D5C6D5C010014F0023F
-13C0DA07FCC7FC2F457CC338>I<007FB512F8B7FC16C08216F8826C813A03F8001FFF15
-07030113806F13C0167FEE3FE0161FEE0FF0A2EE07F8A2EE03FCA21601A217FE1600A417
-7FAD17FF17FEA4160117FCA2160317F81607A2EE0FF0161FEE3FE0167FEEFFC04B13805D
-031F1300007FB65AB75A5E5E16C093C7FC6C14F830437DC238>I<007FB712FCB87EA57E
-D801FCC8FCA9177C94C7FCA6ED07C04B7EA590B6FCA79038FC000FA56F5A92C9FCA7EF0F
-80EF1FC0AA007FB8FCB9FCA56C178032437DC238>I<91391FF003C091397FFC07E049B5
-FC010714CF4914EF4914FF5B90387FF81F9038FFE00748EB800191C7FC4848147F485A49
-143F485A161F485AA249140F123F5BA2127F90C8EA07C093C7FCA35A5AAA923807FFFC4B
-13FE4B13FF7E7E6F13FE6F13FC9238000FE07F003F151FA27F121F7F163F6C7EA26C6C14
-7F7F6C6C14FF6C6C5B6E5A6C6D5A90387FF81F6DB6FC6D14EF6D14CF6D148F0101140F90
-3A007FFC07C0DA1FF0C7FC30457CC338>71 D<007FB612F0B712F8A56C15F0260001FCC7
-FCB3B3B1007FB612F0B712F8A56C15F0254377C238>73 D<90380FFFFE90B612E0000315
-F8488148814881A2273FFE000F138001F01301497F49147F4848EC3FC0A290C8121FA448
-16E0A248150FB3AC6C151FA36C16C0A36D143FA36C6CEC7F806D14FF6D5B01FE130F6CB7
-1200A26C5D6C5D6C5DC615E0010F49C7FC2B457AC338>79 D<003FB512F04814FEB77E16
-E0826C816C813A01FC003FFEED07FF03017F81707E163F161F83160FA7161F5F163F167F
-4C5A5D030790C7FCED3FFE90B65A5E5E5EA282829038FC001FED07FC6F7E150115008282
-AA18E0EF01F0EF03F8A31783EE3F87263FFFE0ECC7F0486D14FFB56C7F18E07013C06C49
-6D13806C496D1300CA12FC35447EC238>82 D<003FB8FC481780B9FCA53BFE0007F0003F
-A9007CEE1F00C792C7FCB3B3A70107B512F04980A56D5C31437DC238>84
-D<267FFFF090387FFFF0B56C90B512F8A56C496D13F0D801FCC73801FC00B3B3A66D1403
-00005EA36D14076D5D6E130F6D6C495A6E133F6D6C495A6D6C495AECFF076D90B5C7FC6D
-5C6D5C6D5C023F13E0020F1380DA03FEC8FC35447FC238>I<D83FFE913803FFE0486C4A
-13F0B56C4913F8A36C90C76C13F06C486E13E0D80FC09138001F80A36C6CED3F00A86C6C
-157EA86C6C5DEC01FC4A7EA24A7EA4D800FC9038DF01F8020F1381A3158F021F13C1A201
-7C5DA2017E14C31507023F13E3A490263E3E035BA2027E13F3A2EC7C01013F14F7A3011F
-5DEC7800A202F813FFA34A137F010F5DA24A133F6D486DC7FC35447FC238>87
-D<001FB712F04816F85AA417F090C8121F17E0EE3FC0167F1780EEFF00A24B5A4B5A123E
-C8485A4B5AA24B5A4B5AA24B5A4BC7FCA24A5A14035D4A5A140F5D4A5A143F5D4A5A14FF
-92C8FC495A13035C495AA2495A495AA2495A495A17F849C7EA01FC485AA2485A485AA248
-5A121F5B485A127F90B7FCB8FCA56C16F82E437BC238>90 D<003FB712804816C0B812E0
-A46C16C06C16802B087A7D38>95 D<EB1FFF90B512E0000314F84814FE4880824881D9F0
-017F9138003FF0ED0FF815076C486D7E6C481301C87FA21500A4EC03FF147F0107B5FC13
-1F90B6FC5A000714C048EBE0004890C7FCEA3FF813E0EA7F8090C8FC5A5AA415017E6C6C
-13036D13076C6CEB3FFFD9FC01B6FC6CB812807E6C816C4A7E6CECF80F6C6CD9C0031300
-D90FFCC9FC31327AB038>97 D<EA3FFE487EB5FCA37E7EC67EACED3FC0913801FFF80207
-13FE021F7F4A804A8091B67E03C07F9139FE001FF802F86D7E4A13034A6D7E5C707E4A80
-188091C8123FA318C0171FA9173F6E1580A2177FA26EECFF00A26E495A6E13034C5A6E49
-5A02FE133F6E6CB45A92B55A6E5C6E5C6E91C7FC6D6C13FCD91E0313F090C7EA7F803244
-7FC238>I<EC3FFF49B512E0010714F8011F8049805B90B7FC48EBE001481300485AEA0F
-F8496D5A4848147C93C7FC485A5B127F90CAFCA35A5AA97E7EA27F123F6D141F6DEC3F80
-121F6C7E01FC147F6C6CECFF006C6C6C5A6C9038F00FFE91B55A6C6C5C6D5C6D5C010714
-80010149C7FC9038003FF0293278B038>I<ED1FFF4B7F5DA38181ED003FACEC7F809038
-03FFF0010F13FC013F13FF4914BF90B7FC5A48EBC07F48EB000FD80FFC7F497F48487F49
-7F485A167F485A163F90C8FCA25A5AA97E6C157FA36D14FF123F6D5B6C7E5D6C6C5B01FC
-5B6C6C133F2603FFC0B6FC6C90B712806C03BF13C06D143F6D13FC6D01F814800107D9E0
-1F1300010090C9FC32447CC238>I<EC3FE0903801FFFC010713FF011F14C04980498090
-B67E489038E03FFC4890380007FE48481301D80FF86D7E49804848158049143F003F16C0
-49141F127F90C8FC17E0160F5A90B7FCA617C048CAFC7E7EA27FA26C7EEE07C06C6CEC0F
-E07F6C7ED807FE141F6DEC3FC06C01C013FF6CD9FC0713806C90B612006D5C6D5C010F5C
-010314E001001480DA1FFCC7FC2B327AB038>I<ED1FF8ED7FFE4AB5FC020714804A14C0
-5C5C91387FF07F15809139FF003F804AEB1F00010191C7FC5CA9003FB612FE4881B8FCA4
-6C5D260001FCC8FCB3AF003FB612E04881A56C5D2A447CC338>I<14F0497E497E497EA4
-6D5A6D5A6D5A91C8FCAB383FFFFC487FB5FCA37E7EC7FCB3AF007FB612F0B712F816FCA3
-16F86C15F0264476C338>105 D<387FFFFEB6FCA57EC77EB3B3B1007FB7FCB81280A56C
-1600294379C238>108 D<023FEB07E03B3FE0FFC01FF8D87FF39038E07FFCD8FFF76D48
-7E90B500F97F15FB6C91B612806C01C1EBF83F00030100EBE01F4902C013C0A24990387F
-800FA2491400A349137EB3A73C3FFF03FFE07FFC4801879038F0FFFEB500C76D13FFA36C
-01874913FE6C01039038E07FFC383080AF38>I<ED7FC03A3FFE01FFF8267FFF0713FEB5
-001F7F4A805C6C90B67E6CECC07F3B007FFE001FE002F8130F4A805C16075C5CA391C7FC
-B3A6273FFFFE03B512E0486D4814F0B6008F14F8A36C020714F06C496C14E035307FAF38
->I<EC7FC0903803FFF8010F13FE497F017F14C090B67E4881489038C07FF8489038001F
-FC01FC130748486D7E49130148486D7E4980003F168049143F007F16C090C8121FA300FE
-ED0FE0A96C151FA26C16C0A26D143FA26C6CEC7F80A26C6CECFF006D5B6C6C495A6D1307
-6CB4EB1FFC6C9038C07FF86C90B55A6C5D6D5C6D5C010F49C7FC010313F89038007FC02B
-327AB038>I<ED3FC03A3FFE01FFF8267FFF0713FEB5001F7F4A804A806C90B67E6C02C0
-7F3B007FFE001FF802F86D7E4A13034A6D7E5C707E4A80188091C8123FA318C0171FA917
-3F6E1580A2177FA26EECFF00A26E495A6E13034C5A6E495A02FE133F6E6CB45A92B55A6E
-5C6E5C6E91C7FC6E13FC020313F09138007F8092C9FCB0383FFFFE487FB67EA36C91C9FC
-6C5B32487FAF38>I<EEFFC0277FFFC00713F8B5D8E01F13FC037F13FE92B5FC02E114FF
-14E36C01E713813A000FEFFC019139FFF000FE4B137C0380130092C8FCA25C5CA25CA25C
-A45CB2007FB67EB77E82A35E6C5D30307CAF38>114 D<903907FF80F0017FEBF1F848B5
-12FD000714FF5A5A5AEBFC00D87FE0131F0180130F48C71207481403A5007FEC01F001C0
-90C7FCEA3FF013FE381FFFF86CEBFFC0000314F8C614FF013F1480010714E0D9003F13F0
-020013F8ED0FFC1503003CEC01FE007E140000FE15FF167F7EA37F6D14FF16FE01F01303
-6DEB07FC01FF137F91B512F816F016E04815C0D8FC3F1400010F13FCD8780113E0283278
-B038>I<EB01E0497E1307AB003FB712804816C0B8FCA46C1680260007F0C8FCB3A4EE03
-E0EE07F0A66E130F17E06D6C131F6EEB3FC0903901FF81FF92B512806D15006E5B6E5B6E
-13F002075B020190C7FC2C3D7DBB38>I<D83FFE903803FFE0486C497FB55BA36C806C80
-C66CEB0007B3A9160FA2161F163F6E137F6D6C13FFDAF007EBFFE091B712F06D16F87F6D
-14E76D02C713F00100020313E0DA3FF8C8FC35307FAE38>I<000FB712FC4816FE5AA417
-FC0180C7EA1FF8EE3FF0EE7FE0EEFFC04B13804B13006CC7485AC8485A4B5A4B5A4B5A4B
-5A4A5B4A90C7FCEC07FC4A5A4A5A4A5A4A5A49485A4990C8FC495A495A495A495A494814
-7C494814FE485B4890C8FC485A485A485A485A48B7FCB8FCA56C16FC2F2F7DAE38>122
-D E
-%EndDVIPSBitmapFont
-%DVIPSBitmapFont: Ff cmbx12 13.14 53
-/Ff 53 122 df<923807FFE092B512FC020714FF021F81027F9038007FC0902601FFF0EB
-0FE04901C0497E4990C7487ED90FFC147F011F824A14FF495AA2137F5CA2715A715A715A
-EF078094C8FCA7EF07FCB9FCA526007FF0C7123F171FB3B3A2003FB5D8E00FB512F8A53D
-4D7ECC44>12 D<B7FCAA200A7F9D29>45 D<EA07E0EA1FF8EA3FFCEA7FFEA2B5FCA6EA7F
-FEA2EA3FFCEA1FF8EA07E01010778F22>I<177817F8EE01FCA21603A2EE07F8A217F016
-0FA217E0161FA2EE3FC0A21780167FA217005EA24B5AA25E1503A24B5AA25E150FA25E15
-1FA24B5AA25E157FA24BC7FCA25D1401A25D1403A24A5AA25D140FA24A5AA25D143FA25D
-147FA24AC8FCA25C1301A25C1303A2495AA25C130FA2495AA25C133FA25C137FA249C9FC
-A25B1201A2485AA25B1207A25B120FA2485AA25B123FA25B127FA248CAFCA25AA2127CA2
-2E6D79D13D>I<15F014011407141F147FEB03FF137FB6FCA313FC1380C7FCB3B3B2007F
-B712E0A52B4777C63D>49 D<ECFFF80107EBFF80013F14F090B612FC4881480101EBFF80
-2707F8003F13C0D80FE0010F13E0D81F806D13F0003F80D87FF06D13F86D15FC6D7F00FF
-16FE6D147FA217FF82A36C5A6C5A6C5A6C5AC95A17FEA3EEFFFCA24B13F817F05D17E04B
-13C017804B13004B5A4B5A5EED7FE04B5A4A5B4A90C7FCEC07FC4A5A4A5A4B131FEC3F80
-4AC7FC14FE4948143E495AEB07E0495A4948147E49C8FC017E15FE90B7FC4816FC5A5A5A
-5A5A5AB8FC17F8A430477AC63D>I<EC3FFE0103B512E0010F14FC013F14FF90267FE01F
-7F9026FF000713E0D801FC6D7FD803F07F486C6D7FD80FFE817F486D80167FA3805C16FF
-7E91C75B6C5A6C5AD80020495B90C75C5D5F4B5B5F031F90C7FCED3FFC4AB45A49B512E0
-168016E016FC90C7EA3FFF030713C06F7F6F7F6F7F83707E83A2701380A318C0EA07E0EA
-1FF8487E487EA2B5FCA31880A25E491600127F494A5A6C485D01E05B001F4A5BD80FFC49
-5B2707FFC03F13C06C90B65AC64BC7FC013F14F8010714E09026007FFEC8FC32487BC63D
->I<EE07E0160FA2161F163F167F16FFA25D5D5DA25D5D5DA2157D15FDEC01F915F1EC03
-E11407EC0FC1EC1F811501143F147E14FC14F8EB01F01303EB07E014C0EB0F80131FEB3F
-00133E5B13FC485A485A5B1207485A485A90C7FC123E127E5AB912FCA5C80003EBE000AD
-023FB612FCA536487DC73D>I<D8038015E001E0140301FC143F9039FFE003FF91B612C0
-17801700A25E5E16F05E5E93C7FC15FC15F001E790C8FC01E0C9FCAAEC1FFC01E1B512C0
-01E714F001EF14FC9039FFE01FFFDA0007138001FC6D13C001F06D13E04915F0497F17F8
-C913FC167F17FEA417FFA3EA0FC0EA3FF0487EA2487EA317FEA34914FF6C4815FC5B0180
-15F86CC74813F07F6C6C4913E0D80FF04913C0D807FC011F13806CB46CB512006C90B512
-FC6C5D013F14C0010F91C7FC010113F030487AC63D>I<ED7FF8913807FFFE021F6D7E02
-7F80903A01FFF01FE0010790388003F04948486C7E49486D7ED93FF013074948130F01FF
-4A7E4849133F5C5A4890C7FCA25A705A48486E5A705A003F92C8FCA3485AA21520913807
-FFE0021F13FC00FF497F4A6D7EDAFC017F9026FDF0007F4A6D7ED9FFC06D7E4A6D7E8391
-C7FC8382491680A318C05BA3127FA6123FA27F001F1780A3000F4B1300A26C6C5DA26C6D
-495A6C6D5C6C6D495A6D6C48485A90263FFC075B6DB65A6D4AC7FC01035C010014F0020F
-90C8FC32487BC63D>I<121F7F7F13FE90B812E0A45A18C0188018005F5FA25F485E90C8
-EA07E0007E4B5A5F007C151F4CC7FC167E5E485D15014B5A4B5AC8485A4B5AA24BC8FC15
-7EA25D1401A24A5A1407A24A5AA2141FA24A5AA2147FA314FFA3495BA45BA55BAA6D5BA2
-6D90C9FCEB007C334B79C93D>I<EC1FFF49B512F0010714FC011F14FF90263FF00713C0
-49C77F01FCEC3FF04848EC0FF848481407000782491403000F821601A2121F7FA27F13FE
-6D140302C05C14F002FC495A6C6D130FDAFF805B9238E01FE06C6E485A9238FCFF806C91
-B5C7FC6C15FC6C5D7F6D14FE6D806D15C06D81011F81017F81D9FFDF804813072603FE01
-8048486C804848133F4848010F1480003F8049130148486D6C13C0161F824848140382A2
-82A2177FA218807F127FEFFF007F6C6C4A5AA2D81FFC4A5A6C6CEC0FF86C6C6CEB3FF06C
-9039F003FFE06C90B612806C6C92C7FC011F14FC010714E09026003FFEC8FC32487BC63D
->I<EC1FFE49B512C0010F14F04914FC90397FFC0FFE903AFFE003FF804849C67F48496D
-7E4890C7FC486F7E484881161F003F825B007F82A28300FF81A31880A518C0A45E127FA3
-003F5D7F121F5E120F6C6C91B5FC6C90388001EF6CEBC0036C9038E00FCF6DB5128F011F
-140F010701FE1480010113F8903800010091C7FCA24C1300A3D803F85D487E487E486C4A
-5AA25F4C5AA24C5A49495B6C485D49010790C7FC01E0495AD807F8EB3FFC6CB448B45A6C
-90B55A6C15C06D91C8FC011F13FC010313C032487BC63D>I<EE01F8A24C7EA34C7EA24C
-7EA34C7FA24C7FA34C7FA293B57EA34B8016F303038016E316E103078016C0030F805E83
-031F814C7E4B81153E83037E81037C7F03FC815D830201824B7F0203825D830207824B7F
-020F825D84021F8392B8FC4A83A34A83027CC8120F02FC835C840101844A810103845C84
-0107844A81010F845C85011F85496C82B600C091B712F0A5544D7CCC5D>65
-D<93261FFF80EB01C00307B500F81303033F02FE13074AB7EAC00F0207EEE03F021F903A
-FE007FF87F027F01E0903807FCFF91B5C70001B5FC010301FC6E7E4901F0151F4901C081
-4949814990C97E494882494882485B48197F4A173F5A4A171F5A5C48190FA2485B1A07A2
-5AA297C7FC91CDFCA2B5FCAD7EA280A2F207C07EA36C7FA26C190F6E18807E6E171F6C1A
-006E5F6C193E6C6D177E6D6C5F6D6C4C5A6D6D15036D6D4B5A6D01F04B5A6D01FCED3FC0
-010001FFEDFF806E01E0D903FEC7FC021F01FEEB3FFC020790B612F002015EDA003F92C8
-FC030714FCDB001F13804A4D79CB59>67 D<B912F0F0FF8019F019FC19FFD8001F902680
-000114C0DD001F7F060713F806017F726C7E737E737F737F737F8587737F8587A2747EA3
-8786A21C80A51CC0A586A462A51C80A51C00A26263A2631AFF636163614F5B634F5B073F
-90C7FC4F5A4F5A06035B061F5B4DB512C0BBC8FC19FC19F0198006F0C9FC524B7CCA5E>
-I<BB12C0A486D8000F01E0C77E18071801F0007F193F191F190F1907861903A31901A3EF
-0F80A2737EA497C7FC171FA2173F177F17FF160392B6FCA5EDE0031600177F173F171FA2
-050FEC0F80A3F21F00A494C8FC621A3EA21A7EA31AFE6219011903A21907190FF13FF819
-FF1803183FBBFCA262A3494A7CC951>I<BBFCA41A80D8001F01C0C7FC181F1803848419
-7F193F191F1AC0190FA31907A4171FF103E0A496C7FCA25FA25F5F5E160792B6FCA5EDC0
-071601828383A283A794C9FCB1B8FCA5434A7CC94D>I<93261FFF80EB01C00307B500F8
-1303033F02FE13074AB7EAC00F0207EEE03F021F903AFE007FF87F027F01E0903807FCFF
-91B5C70001B5FC010301FC6E7E4901F0151F4901C0814949814990C97E49488249488248
-5B48197F4A173F5A4A171F5A5C48190FA2485B1A07A25AA297C8FC91CEFCA2B5FCAD6C04
-0FB712C0A280A36C93C7001FEBC000A2807EA27E807E807E806C7F7E6D7E6D7E6D7F6D01
-E05D6D6D5D6D13FC010001FF4AB5FC6E01E0EB07F9021F01FFEB3FF0020791B5EAE07F02
-01EEC01FDA003FED0007030702F81301DB001F018090C8FC524D79CB61>I<B7D8FC01B7
-12F8A5D8001F01C0C8001FEBC000B3AA92B9FCA503C0C8121FB3AEB7D8FC01B712F8A555
-4B7BCA60>I<B712FEA5D8000FEBE000B3B3B3ABB712FEA5274B7DCA2E>I<B8FCA5D8001F
-01C0C9FCB3B3A4193EA4197E197CA519FCA31801A2F003F8A21807180F181F183F187FEF
-01FF1707173FBA12F0A53F4B7BCA4A>76 D<B600E04DB612806F5FA26F5FA2D8001F09FC
-C7FC6FEF0F7FA2DABFFE171EA2DA9FFF173CA3028F6D1678A202876D16F0A202836DED01
-E0A302816DED03C0A202806DED0780A26F6CED0F00A36F6C151EA26F6C5DA26F6D5CA26F
-6D5CA36F6D495AA26F6D495AA26F6D495AA3706C49C7FCA2706C131EA2706C5BA3706D5A
-A2706D5AA270EBE1E0A370EBF3C0A270EBFF80A27190C8FCA2715AA3715AA2715A497EB6
-00F06D480103B71280A3715A715A694B7BCA74>I<B600E092B612F88181A281D8001F6D
-9239001FE0006F705A82A28202BF7F029F7FA2028F7F02877F02837F8214810280806F7F
-6F7F83816F7F6F7F6F7F83816F80707F707F8482707F707F707FA2707F7014807113C019
-E0837113F07113F87113FC19FE837113FF71148F7213CF1AEF847213FF8484A284848485
-A2858585A285858585497EB600F8167F1A3F1A1F1A0FA2554B7BCA60>I<EEFFF8031FEB
-FFC04AB612FC020715FF021FD9C01F13C091277FFE000313F0902601FFF09038007FFC49
-496E7E490180EC0FFF4990C86C7F49486F7F49486F7F017F8449486F7F4849707EA24849
-707E4885A24849701380A2481AC04A82A2481AE0A34890CA6C13F0A5B519F8AE6C1AF0A2
-6E5EA36C1AE0A26E5E6C1AC0A26C1A806E5E6C1A006E5E6C616E16FF6C616C6D4B5B6D6C
-4B5B6E5D6D6D4A5B6D6D4A5B01076D4A90C7FC6D01F8ECFFFE6D01FE01035B9028007FFF
-C01F13F0021F90B612C0020793C8FC020115FCDA001F14C0030101FCC9FC4D4D79CB5C>
-I<B912C018FCF0FF8019F085D8001F902680000713FE05007F063F1380060F13C07213E0
-1AF0841AF8A27213FCA31AFEA81AFCA34E13F8A21AF0601AE04E13C0063F138095B51200
-050713FC92B75A19E096C7FC18F803C0CAFCB3ABB712FCA5474B7BCA54>I<B9FC18F8F0
-FF8019E019F8D8000F9026C0000713FE9439007FFF80061F7F727F727F727F84868684A2
-86A862A24E5BA2624E5B4E5B4E5B4E5B95B5C8FC050713FC92B712F0198006FCC9FC18FF
-9226C0003F13C0050713F0717F717F717F187F85727FA28486A786A71C3E86A28474137E
-72157C726D13FCB700FC6D9038FE01F872EBFF8373EBFFF0071F14E007031480CD383FFE
-00574C7CCA5C>82 D<DA7FFCEB01C00103B5EAC003011FECF00749ECFC0F90B7121F48D9
-E00F13BF4890C713FFD807FC141F4848804848140382484880177F485A173F171F12FFA2
-170F7FA217077F7F7F6D92C7FC6D7E6C13F014FF15F86CECFF8016F86C15FF6C16C0836C
-826C826C826C82013F816D1680010716C01300020F15E01400030714F0ED007F160F1603
-7013F882177F127800F8163FA3171FA27E18F0A27EA26CEE3FE07F18C001E0157F6DEDFF
-8001FC160001FF140302E0EB0FFED97FFEEB3FFC486CB612F0D8FC0F5DD8F803158048C6
-6C49C7FC48010313F0354D79CB44>I<003FBB12C0A5DA80019038FC001FD9FC001601D8
-7FF09438007FE001C0183F49181F90C7170FA2007E1907A3007C1903A500FC1AF0481901
-A5C894C7FCB3B3A749B812FCA54C4A7CC955>I<B700F8023FB512F8A5D8001F01C0C938
-0FE000745AB3B3AD6D180F63811A1F6D96C7FC626D7F1A7E6D7F6D606E6C4B5A6E6CED07
-F06E6C4B5A6E01C0EC3FC06E01F049B45A020101FF011F90C8FC6E91B55A033F15F80307
-15E0030092C9FC040713F0554C7CCA5E>I<B700F00203B6FCA5D8001F01E0C93803FC00
-745A6D61811A036D6D5F1A076D6D5F1A0F6D616F161FA26D6D94C7FC626E6D153E1A7E6E
-177C7015FC6E5F8219016E6D5D19036E5F7014076E5F82190F6E6D5D191F6E6D92C8FC61
-6F153E83197E6F6D137C19FC6F6D5B18016F5DEFF003A26F01F85B18076F01FC5B180F6F
-5DEFFE1F6F92C9FC17FF607013BE18FE705BA2705BA3705BA2705BA2705BA3705BA27090
-CAFCA2177EA2584C7ECA5D>I<B700F84AB6FCA5D8001F01F0C93803FC006F705A6D4E5A
-6D6D4C5A816D4E5A6D6D4C5A826D4EC7FC6E6D5D70157E6E5F6E7F704A5A6E4C5A6E7F70
-4A5A6E4C5A6E7F71495A6E4CC8FC6F7F71137E6F5D6F7F71485A6F4A5A6F13FC71485A6F
-4A5A6F13FFF09F806F02BFC9FC7013FF60705B8260705B8260B3A7037FB612FEA5584B7E
-CA5D>89 D<ECFFFC010FEBFFC0017F14F090B612FC489038803FFE3B03FC0007FF80486C
-6D7F6D7F486D6C7F83167F83A2707E6C90C7FC6C5A6C5AC9FCA5ED1FFF021FB5FC49B6FC
-130F013FEBC03F9038FFFE00000313F04813C04890C7FC485A485AA2485AA2485AA4167F
-A26D14FF007F15EF6D01017F6C6C903907CFFF806C6CD90F8F13FE6C9038E07F076C9038
-FFFE0300014A7ED8003F9038F0007F0103018090C7FC37347CB23C>97
-D<EB7FC0B5FCA512037EB3ED07FF037F13E002C1B512FC02C714FF9126CFF80F7F9126DF
-C0017F02FFC77F4AEC3FF002F8814A6E7E717E4A81831980A37113C0A319E0AC19C0A35F
-1980A219005F606E141F6E5D4D5A6E4A5A02BF4A5A91261FC0035B9027FE0FF01F5B496C
-B548C7FCD9F80114F8496C6C13E0C8D80FFEC8FC3B4D7CCB44>I<91380FFF8091B512F8
-010314FF010F15804948C613C0D97FF8EB1FE0D9FFE0EB3FF04849137F4849EBFFF84890
-C7FCA2485A121FA24848EC7FF0EE3FE0EE1FC0007F92C7FC5BA212FFAC127FA27FA2123F
-A26C6C153EA26C6C157E177C6C6D14FC6C6D14F86C6D13036C6DEB07F0D97FFCEB1FE06D
-B4EBFFC0010F90B5120001035C010014F0020F13802F347CB237>I<EF1FF0EE3FFFA516
-00177FB3EC0FFF91B512E0010314F8010F14FC013FEB01FF903A7FF8003FFFD9FFE0130F
-48497F48497F4890C77E48815B121F5B123FA2127F5BA312FFAC127FA36C7EA3121F6D5C
-120F6C6C5C6C6D5B6C5D6C01E0013F7F6D6C49EBFFE090393FFE03FE6DB512F801075C01
-00148091261FFC00EBC0003B4D7CCB44>I<EC0FFF91B512F0010314FC010F14FF90263F
-FE077F90267FF0007F49486D7E4801806D7E486F7E4890C7120F484881707E121F491403
-003F82A2127F5B701380A212FFA390B8FCA401F8CAFCA5127FA27FA2123FA26C6CED0F80
-A26C6C151F6C17006E5C6C6D147E6C6D5C6C6D495AD93FFCEB07F0903A1FFF803FE00107
-90B55A010192C7FC6D6C13FC020713C031347DB238>I<ED7FF0913807FFFC023F7F4A7F
-902601FFE0138049018113C049484813E0EB0FFCEB1FF8A2EB3FF0A2017F6D13C04A6C13
-80EE7F00163E93C7FCACB77EA526007FF0C8FCB3B3A3003FB512F8A52B4D7DCC26>I<DA
-7FFCEB0FE00103B538807FF8010F9138E1FFFC013F02FB13FE903A7FF01FFFF39026FFC0
-07138348D90001130348168348486DEBC1FCEFC0F8000FEEE00049147F001F82A9000F5E
-6D14FF00075EA26C6C495B6C93C7FC6C9038C007FE9138F01FFC4890B55A01EF14E0D803
-C314809026C07FFCC8FC000790CAFCA47FA27F13FC90B612FCEEFFC06C16F817FE6C8218
-806C17C06D16E00003B812F0120FD81FFCC7000F13F8D83FF0140049153F4848ED1FFC00
-FF160F491507A56D150F007F17F86D151F6C6CED3FF06C6CED7FE0D80FFE913801FFC06C
-6C6C010713806C01F8017F1300C690B612FC013F15F001071580D9003F01F0C7FC37497D
-B13D>I<EB7FC0B5FCA512037EB3923801FFC0030F13F8033F7F4B13FFDBFE077F9138C1
-F0039126C3E0017FDAC78080ECCF0014DE02DC6D7F14FC5CA25CA35CB3AAB6D8C07FEBFF
-E0A53B4C7BCB44>I<13FCEA03FF487F487FA2487FA66C5BA26C5B6C90C7FCEA00FC90C8
-FCABEB7FC0B5FCA512037EB3B3A2B61280A5194D7BCC22>I<EB7FC0B5FCA512037EB3B3
-B3AAB61280A5194C7BCB22>108 D<90287FC001FFC0EC7FF0B5010F01FC0103B5FC033F
-6D010F804B6D4980DBFE079026803F817F9126C1F801903AC07E007FF00003D9C3E0DAE0
-F8806C9026C78000D9F1E06D7E02CFC7EBF3C002DEEDF780DD7FFF6E7E02FC93C7FC4A5D
-A24A5DA34A5DB3AAB6D8C03FB5D8F00FB512FCA55E327BB167>I<903A7FC001FFC0B501
-0F13F8033F7F4B13FFDBFE077F9138C1F00300039026C3E0017F6CD9C78080ECCF0014DE
-02DC6D7F14FC5CA25CA35CB3AAB6D8C07FEBFFE0A53B327BB144>I<913807FF80027F13
-F80103B6FC010F15C090261FFE017F903A7FF0003FF849486D7E480180EB07FE4890C76C
-7E4817804980000F17C048486E13E0A2003F17F0A249157F007F17F8A400FF17FCAB007F
-17F8A46C6CEDFFF0A2001F17E0A26C6C4A13C0A26C6C4A13806C6D4913006C5E6C01E0EB
-1FFC6D6C495A903A3FFE01FFF0010FB612C0010392C7FCD9007F13F80207138036347DB2
-3D>I<90397FC007FFB5017F13E002C1B512FC02C714FF9126CFF80F7F9126DFC0037F00
-0301FFC77F6C496E7E02F8814A6E7E717E4A81831980A28319C0A37113E0AC19C05FA319
-805F19005F606E143F6E5D4D5A6E4A5A02FF495BDBC0075B9126EFF01F5B02E7B548C7FC
-02E114F8DAE07F13E0DB0FFEC8FC92CAFCAFB612C0A53B477CB144>I<9039FF803FE0B5
-EBFFF8028113FE02837FDA87E11380EC8F830003D99F0713C06C139E14BCA214F8A24A6C
-13806F13006F5A4A90C7FCA45CB3A8B612E0A52A327CB132>114
-D<903907FF8070017FEBF1F048B6FC1207380FFC01391FE0003F4848130F491307127F90
-C71203A2481401A27FA27F01F090C7FC13FCEBFFC06C13FEECFFE06C14FC6C806CECFF80
-6C15C06C15E06C15F06C7E011F14F8010114FCEB000FEC007FED1FFE0078140F00F81407
-15037E1501A27E16FC7E15036D14F86D13076D14F001F8EB1FE001FFEBFFC04890B51280
-486C1400D8F81F13FCD8E00313C027347CB230>I<14F8A51301A41303A21307A2130FA2
-131F133F137F13FF1203000F90B512F0B7FCA426007FF8C7FCB3A7167CAA013F14F880A2
-90391FFE01F0010F1303903907FF87E06DEBFFC06D14806D6C1300EC0FFC26467EC430>
-I<D97FE0EC3FF0B5EC7FFFA5000315016C81B3AC5EA25EA25E7E6EEB0F7F017F021E7F6E
-017CEBFFE090393FFE01F86DB512F0010714E0010114C09027003FFE00EBC0003B337BB1
-44>I<B600C090387FFFF0A5C601F0C73803F8006E5D017F5E801707013F5E6E140F011F
-5E6E141F6D93C7FC6F5B6D153E81177E6D157C6F13FC6D5DEDF0016D5DEDF803027F5CA2
-EDFC07023F5CEDFE0F021F5CEDFF1F6E91C8FC169F16BF6E13BE16FE6E5BA26E5BA26E5B
-A36F5AA26F5AA26F5AA23C327EB041>I<B60081B500FC90387FFFF0A500019026E00003
-90C73801FC006E6F5C6C6F5E6E6F1303017F61A26E6F1307013F4A5E846E49150F011F61
-6E6F131F6D4A93C7FC179F03806E5B6D021F153EEF0FFE6DD9C03F5DEE3E0703E06E13FC
-6D027E5DEE7C0303F015816D4A6C5C03F815C3DA7FF95E4C7E03FD15E7DA3FFF5E4C137F
-19FF6E496D5BA26E94C8FC4C7FA26E5E93C7120FA26E486E5AA202015E4B1403A26E486E
-5A54327EB059>I<007FB500C090387FFFE0A5C601F0C73803F8006E5D017F5E6E140701
-3F5E80170F011F5E6E141F6D93C7FC6F5B6D153E6F137E6D157C6F13FCA26D6D5B16016D
-5DEDF803027F5CEDFC07023F5CEDFE0F021F5C15FF161F6E91C8FC16BF6E13BE16FE6E5B
-A26E5BA36E5BA26F5AA26F5AA26F5AA393C9FC5D153E157E157CD81F8013FC486C5B387F
-E001D8FFF05B14035D14074A5A49485A007F133F4948CAFC383F81FE381FFFF86C5B6C13
-C0C648CBFC3B477EB041>121 D E
-%EndDVIPSBitmapFont
-%DVIPSBitmapFont: Fg cmtt12 17.28 6
-/Fg 6 123 df<913803FFC0023F13FC49B67E010715F04981013F15FE498190B812C048
-8348D9FC0180489026E0001F7F480180130391C87F48486F7E49153F4848ED0FFF834848
-178083496F13C012FF8319E07FA2187FA36C5A6C5A6C5ACBFCA218FFA219C05FA219805F
-A24D13005F604D5A173F4D5A4D5AA24C5B4C5B4C5B041F90C7FC4C5A4C5A4C5A4B5B4B5B
-4B5B031F5B4B90C8FC4B5AEDFFF84A5B4A5B4A5B021F5B4A90C9FCEC7FFC4A5A495B495B
-010F5B495B4948CAFC4948ED1F804948ED3FC04849ED7FE0485B000F5B4890C9FC4890B8
-FC5ABAFCA56C18C06C18803B5A79D94A>50 D<383FFFF0487F80B5FCA37EA27EEA000FB0
-EE0FFC93B57E030714E0031F14F84B14FE92B7FC02FD8291B87E85DCE01F7FEE000703FC
-01017F4B6D7F03E0143F4B6E7E4B140F8592C87E4A6F1380A34A6F13C0A284A21AE0A219
-7FAA19FFA21AC0A26E5DA24E138080606F1600606F4A5A6F143F6F4A5A6F4A5A6F130303
-FF010F5BDCC03F5B93B65A6102FD93C7FC02FC5D6F5C031F14F0902607F80714C0902603
-F00191C8FC90C8EA3FF043597FD74A>98 D<EC01F0EC07FC4A7EA24A7EA56E5AA26E5AEC
-01F091CAFCAE001FB512FC4880815AA37EA27EC71203B3B3A8003FB812C04817E0A2B912
-F0A36C17E0A26C17C0345974D84A>105 D<003FB512FE4880B77EA57E7EC71201B3B3B3
-B0003FB812FC4817FEBAFCA56C17FE6C17FC385877D74A>108 D<EE0FFC263FFFF090B5
-7E48D9F80714E0DAFC1F14F8B54914FE92B7FC02FD826C90B87E856CDBE01F7FD8000FEC
-000703FC01017F4B6D7F03E0143F4B6E7E4B140F8592C87E4A6F1380A34A6F13C0A284A2
-1AE0A2197FAA19FFA21AC0A26E5DA24E138080606F1600606F4A5A6F143F6F4A5A6F4A5A
-6F130303FF010F5BDCC03F5B93B65A6102FD93C7FC02FC5D6F5C031F14F0030714C00301
-91C8FC9238003FF093CAFCB3A4003FB6FC4881A2B77EA36C5DA26C92CAFC435F7FBE4A>
-112 D<000FB912E04818F04818F8A619F001F0C8000313E04D13C04D13804D13004D5A4D
-5A4D5A6C484A5B6C484A5BC9000F5B4C5B4C90C7FC4C5A4C5A4B5B4B5B4B5B4B5B4B5B4B
-90C8FC4B5A4B5A4A5B4A5B4A5B4A5B4A5B4A90C9FC4A5A4A5A495B495B495B4949EC07E0
-4949EC0FF04948C8EA1FF8495A495A485B485B485B485B4890C9FC485A48B9FCBAFCA66C
-18F06C18E03D3E7BBD4A>122 D E
-%EndDVIPSBitmapFont
-%DVIPSBitmapFont: Fh cmbx12 17.28 28
-/Fh 28 120 df<16F04B7E1507151F153FEC01FF1407147F010FB5FCB7FCA41487EBF007
-C7FCB3B3B3B3007FB91280A6395E74DD51>49 D<913801FFF8021FEBFFC091B612F80103
-15FF010F16C0013F8290267FFC0114F89027FFE0003F7F4890C7000F7F48486E7FD807F8
-6E148048486E14C048486E14E048486F13F001FC17F8486C816D17FC6E80B56C16FE8380
-A219FFA283A36C5BA26C5B6C90C8FCD807FC5DEA01F0CA14FEA34D13FCA219F85F19F04D
-13E0A294B512C019804C14004C5B604C5B4C5B604C13804C90C7FC4C5A4C5A4B13F05F4B
-13804B90C8FC4B5AED1FF84B5A4B5A4B48143F4A5B4A48C8FC4A5A4A48157E4A5A4A5AEC
-7F8092C9FC02FE16FE495A495A4948ED01FCD90FC0150749B8FC5B5B90B9FC5A4818F85A
-5A5A5A5ABAFCA219F0A4405E78DD51>I<92B5FC020F14F8023F14FF49B712C04916F001
-0FD9C01F13FC90271FFC00077FD93FE001017F49486D8049C86C7F484883486C6F7F14C0
-486D826E806E82487FA4805CA36C5E4A5E6C5B6C5B6C495E011FC85A90C95CA294B55A61
-4C91C7FC604C5B4C5B4C5B4C5B047F138092260FFFFEC8FC020FB512F817E094C9FC17F8
-17FF91C7003F13E0040713F8040113FE707F717F7113E085717FA2717F85A285831A80A3
-1AC0EA03FCEA0FFF487F487F487FA2B57EA31A80A34D14005C7E4A5E5F6C495E49C8485B
-D81FF85F000F5ED807FE92B55A6C6C6C4914806C01F0010791C7FC6C9026FF803F5B6D90
-B65A011F16F0010716C001014BC8FCD9001F14F0020149C9FC426079DD51>I<F01F804E
-7E187F18FFA25F5F5F5FA25F5F5FA294B5FC5E5E5EA25E5EEE3FBFEE7F3FA216FEED01FC
-ED03F8ED07F0A2ED0FE0ED1FC0ED3F8016005D15FE4A5A4A5AA24A5A4A5A4A5A4A5AA24A
-C7FC14FE495A5C1303495A495A495A5C133F49C8FC13FE485AA2485A485A485A5B121F48
-5A48C9FC12FEBCFCA6CA6CEBC000B1037FB8FCA6485E7CDD51>I<4DB5ED03C0057F02F0
-14070407B600FE140F047FDBFFC0131F4BB800F0133F030F05FC137F033F9127F8007FFE
-13FF92B6C73807FF814A02F0020113C3020702C09138007FE74A91C9001FB5FC023F01FC
-16074A01F08291B54882490280824991CB7E49498449498449498449865D49498490B5FC
-484A84A2484A84A24891CD127FA25A4A1A3F5AA348491A1FA44899C7FCA25CA3B5FCB07E
-A380A27EA2F50FC0A26C7FA37E6E1A1F6C1D80A26C801D3F6C6E1A00A26C6E616D1BFE6D
-7F6F4E5A7F6D6D4E5A6D6D4E5A6D6D4E5A6D6E171F6D02E04D5A6E6DEFFF806E01FC4C90
-C7FC020F01FFEE07FE6E02C0ED1FF8020102F8ED7FF06E02FF913803FFE0033F02F8013F
-1380030F91B648C8FC030117F86F6C16E004071680DC007F02F8C9FC050191CAFC626677
-E375>67 D<B96C90B91280A6D8000102C0C9000102C0C7FCB3B3A293BBFCA604C0C91201
-B3B3A6B96C90B91280A671627AE17E>72 D<B912E0A6C702E0C7FCB3B3B3B3AEB912E0A6
-33627CE13C>I<B700C0083FB612F070627097B7FCA37061D800010DF8C7FC70F103EFA2
-02FD6DF107CFA202FC6DF10F8FA36F6DF01F0FA26F6D183EA26F6D187CA26F6D18F8A36F
-6DEF01F0A26F6DEF03E0A26F6DEF07C0A26F6DEF0F80A3706DEE1F00A2706D163EA2706D
-5EA2706D5EA3706D4B5AA2706D4B5AA2706D4B5AA2706D4B5AA3716D4AC7FCA2716D143E
-A2716D5CA2716D5CA3716D495AA2716D495AA2716D495AA2716D495AA3726D48C8FCA272
-EBC03EA2726D5AA2726D5AA372EBF9F0A272EBFFE0A2725CA2725CA37390C9FCA2735AA2
-735A90381FFFC0B700F86E480207B812F0A3735AA2735A8C627AE199>77
-D<BB7E1AFCF2FFC01BF81BFE757ED800010280C7001F80070114F0736C7F081F7F747F74
-7F7414807414C0A27414E0A21DF0A27513F8A41DFCA91DF8A498B512F0A21DE0A25014C0
-1D8062501400505B505B087F5B4FB512E0071F5C93B9C7FC1BFC1BF01B8008F0C8FC04C0
-CCFCB3B3A2B97EA65E627AE16E>80 D<001FBEFCA64849C79126E0000F148002E0180091
-C8171F498601F81A0349864986A2491B7FA2491B3F007F1DC090C9181FA4007E1C0FA600
-FE1DE0481C07A5CA95C7FCB3B3B3A3021FBAFCA663617AE070>84
-D<913803FFFE027FEBFFF00103B612FE010F6F7E4916E090273FFE001F7FD97FE001077F
-D9FFF801017F486D6D7F717E486D6E7F85717FA2717FA36C496E7FA26C5B6D5AEB1FC090
-C9FCA74BB6FC157F0207B7FC147F49B61207010F14C0013FEBFE004913F048B512C04891
-C7FC485B4813F85A5C485B5A5CA2B55AA45FA25F806C5E806C047D7F6EEB01F96C6DD903
-F1EBFF806C01FED90FE114FF6C9027FFC07FC01580000191B5487E6C6C4B7E011F02FC13
-0F010302F001011400D9001F90CBFC49437CC14E>97 D<903807FF80B6FCA6C6FC7F7FB3
-A8EFFFF8040FEBFF80047F14F00381B612FC038715FF038F010014C0DBBFF0011F7FDBFF
-C001077F93C76C7F4B02007F03F8824B6F7E4B6F13804B17C0851BE0A27313F0A21BF8A3
-7313FCA41BFEAE1BFCA44F13F8A31BF0A24F13E0A24F13C06F17804F1300816F4B5A6F4A
-5B4AB402075B4A6C6C495B9126F83FE0013F13C09127F00FFC03B55A4A6CB648C7FCDAC0
-0115F84A6C15E091C7001F91C8FC90C8000313E04F657BE35A>I<92380FFFF04AB67E02
-0F15F0023F15FC91B77E01039039FE001FFF4901F8010113804901E0010713C049018049
-13E0017F90C7FC49484A13F0A2485B485B5A5C5A7113E0485B7113C048701380943800FE
-0095C7FC485BA4B5FCAE7EA280A27EA2806C18FCA26C6D150119F87E6C6D15036EED07F0
-6C18E06C6D150F6D6DEC1FC06D01E0EC7F806D6DECFF00010701FCEB03FE6D9039FFC03F
-FC010091B512F0023F5D020F1580020102FCC7FCDA000F13C03E437BC148>I<F17FF805
-0FB5FCA6EF000F8484B3A892380FFF804AB512F8020F14FE023FECFF8391B712E3010391
-38807FF3499039F8000FFB011F01E00103B5FC494913004990C87E49488148498148834A
-815A485BA2485BA25AA3485BA4B5FCAE7EA46C7FA37EA26C7FA26C5F806C5F6C6D5D6C6D
-5D017F93B5FC6D6C6C0103806D6D49806D01F0D91FF7EBFFFE6D9039FE01FFE7010190B6
-12876D6CECFE07021F14F8020314E09127003FFE00ECC0004F657BE35A>I<92380FFFC0
-4AB512FC020FECFF80023F15E091B712F80103D9FE037F499039F0007FFF011F01C0011F
-7F49496D7F4990C76C7F49486E7F48498048844A804884485B727E5A5C48717EA35A5C72
-1380A2B5FCA391B9FCA41A0002C0CBFCA67EA380A27EA27E6E160FF11F806C183F6C7FF1
-7F006C7F6C6D16FE6C17016D6C4B5A6D6D4A5A6D01E04A5A6D6DEC3FE0010301FC49B45A
-6D9026FFC01F90C7FC6D6C90B55A021F15F8020715E0020092C8FC030713F041437CC14A
->I<EE3FFC0307B51280033F14C04AB612F0020715F84A9038F03FFC4AEB807F913A7FFE
-00FFFE4A5A4B4813FF4913F05B4913E0A24913C0A27013FE4949EB7FFCEF3FF8EF1FF0EF
-07C094C7FCB0B812C0A6D8001F01C0C8FCB3B3B0007FB612FCA638657CE431>I<F107F8
-DB7FFEEC3FFE020FB5D8F001B5FC027FDAFE03148049B7128F49DCDFFD13C0010FD9F00F
-EBFFC149D9800114014990C7EBFC0349486E6C7E4948EC3FFF48496E0181138007801300
-48F0C03E97C7FC48496E7FA34884A96C60A36C6D4A5BA26C60A26C6D4A90C8FC6D6C4A5A
-6D6C4A5A6D6D485BDBF00F5B4990B612C060D97C7F4AC9FCD9FC0F14F09126007FFECAFC
-92CCFC1201A47FA27F8014F091B77E18FE6CEFFFC019F06D17FC19FF6D846D846D846D84
-013F8490BAFC0003854801E0C712014890C9000F7F484816014848EE007F4848717E8512
-FF5B85A56D5F007F616D173F003F616D177F6C6C4D5A6C01C003035B6C6D4B5B6C01F803
-1F5BC601FF92B5C7FC6D01F8011F5B011F90B712F8010717E0010094C8FC020F15F0DA00
-3F01FCC9FC4A607CC151>I<903807FF80B6FCA6C6FC7F7FB3A8EF1FFF94B512F0040714
-FC041F14FF4C8193267FE07F7F922781FE001F7FDB83F86D7FDB87F07FDB8FC0814C7F03
-9FC78015BE03BC8003FC825DA25DA25DA45DB3B2B7D8F007B71280A651647BE35A>I<EB
-0FE0EB3FF8497E48B5FCA24880A24880A76C5CA26C91C7FCA238007FFC6D5AEB0FE090C9
-FCAF903807FF80007FB5FCA6C6FC7F7FB3B3AEB712C0A622657BE42C>I<903807FF80B6
-FCA6C6FC7F7FB3B3B3B3ADB712E0A623647BE32C>108 D<902607FF80D91FFFEEFFF8B6
-91B500F00207EBFF80040702FC023F14E0041F02FF91B612F84C6F488193267FE07F6D48
-01037F922781FE001F9027E00FF0007FC6DA83F86D9026F01FC06D7F6DD987F06D4A487F
-6DD98FC0DBF87EC7804C6D027C80039FC76E488203BEEEFDF003BC6E4A8003FC04FF834B
-5FA24B5FA24B94C8FCA44B5EB3B2B7D8F007B7D8803FB612FCA67E417BC087>I<902607
-FF80EB1FFFB691B512F0040714FC041F14FF4C8193267FE07F7F922781FE001F7FC6DA83
-F86D7F6DD987F07F6DD98FC0814C7F039FC78015BE03BC8003FC825DA25DA25DA45DB3B2
-B7D8F007B71280A651417BC05A>I<923807FFE092B6FC020715E0021F15F8027F15FE49
-4848C66C6C7E010701F0010F13E04901C001037F49496D7F4990C87F49486F7E49486F7E
-48496F13804819C04A814819E048496F13F0A24819F8A348496F13FCA34819FEA4B518FF
-AD6C19FEA46C6D4B13FCA36C19F8A26C6D4B13F0A26C19E06C6D4B13C0A26C6D4B13806C
-6D4B13006D6C4B5A6D6D495B6D6D495B010701F0010F13E06D01FE017F5B010090B7C7FC
-023F15FC020715E0020092C8FC030713E048437CC151>I<D90FFFEB0FFCB690383FFF80
-93B512E04B14F04B14F8923907FC7FFC92390FE0FFFEC6EC1F806DD93F0113FF6D133E15
-7E157C15F8A215F07013FEA24BEB7FFCEF3FF8EF0FE04B90C7FCA55DB3B0B712F8A63841
-7BC042>114 D<913A3FFF8007800107B5EAF81F011FECFE7F017F91B5FC48B8FC48EBE0
-014890C7121FD80FFC1407D81FF0801600485A007F167F49153FA212FF171FA27F7F7F6D
-92C7FC13FF14E014FF6C14F8EDFFC06C15FC16FF6C16C06C16F06C826C826C826C82013F
-1680010F16C01303D9007F15E0020315F0EC001F1500041F13F81607007C150100FC8117
-7F6C163FA2171F7EA26D16F0A27F173F6D16E06D157F6D16C001FEEDFF806D0203130002
-C0EB0FFE02FCEB7FFC01DFB65A010F5DD8FE0315C026F8007F49C7FC48010F13E035437B
-C140>I<EC07E0A6140FA5141FA3143FA2147FA214FF5BA25B5B5B5B137F48B5FC000F91
-B512FEB8FCA5D8001F01E0C8FCB3AFEF0FC0AC171F6D6D1480A2173F6D16006F5B6D6D13
-7E6D6D5B6DEBFF836EEBFFF86E5C020F14C002035C9126003FFCC7FC325C7DDA3F>I<90
-2607FFC0ED3FFEB60207B5FCA6C6EE00076D826D82B3B3A260A360A2607F60183E6D6D14
-7E4E7F6D6D4948806D6DD907F0ECFF806D01FFEB3FE06D91B55A6E1500021F5C020314F8
-DA003F018002F0C7FC51427BC05A>I<B70081B600FC0103B512FCA6C66C0180C701FCC8
-381FFE006F6FED03F86D047F5F856F6E16076D646F70140F6D705F866F6E161F6D646F4A
-6D143F6D99C7FC4E7F6F616D1B7E6F4A6D14FE6D6395B57E7001FC15016E62DCC0016E13
-036EDBF87F5D05038004E0496C14076E62DCF007ED800F6E4B6C5D050F15C004F8496C14
-1F6E62DCFC1FEDE03F6E4B6C92C8FC053F15F004FE496C5C6E197E7048EDF8FE6E027E6D
-5C05FE15FC4D6D13FD6F601BFF6F496E5BA24D806F60A26F496E5BA24D806F60A26F496E
-90C9FCA294C87E6F5FA26F486F5A047C6F5A6E417DBF75>119 D
-E
-%EndDVIPSBitmapFont
-%DVIPSBitmapFont: Fi cmsy10 10.95 1
-/Fi 1 16 df<EB0FFCEB3FFF90B512C0000314F04880488048804880A2481580A3B712C0
-AA6C1580A36C1500A26C5C6C5C6C5C6C5CC614C0013F90C7FCEB0FFC22227BA72D>15
-D E
-%EndDVIPSBitmapFont
-%DVIPSBitmapFont: Fj cmtt10 10.95 89
-/Fj 89 127 df<121C127FEAFF80B3EA7F00B2123EC7FCA8121C127FA2EAFF80A3EA7F00
-A2121C09396DB830>33 D<00101304007C131F00FEEB3F80A26C137FA248133FB2007E14
-00007C7F003C131E00101304191C75B830>I<903907C007C0A2496C487EA8011F131FA2
-02C05BA3007FB7FCA2B81280A36C16006C5D3A007F807F80A2020090C7FCA9495BA2003F
-90B512FE4881B81280A36C1600A22701FC01FCC7FCA300031303A201F85BA76C486C5AA2
-29387DB730>I<EB07E0EB1FF8497E137F497E803801FC7F497E810003131F13F0A6143F
-92C8FC91387F0FFF9026F87E1F1380000113FEEBF9FC13FB4A6C1300D9FFF013C06C13E0
-151F02C05BEB7F809038FF003F4892C7FC485C48EB807E5A15FE391FDFC0FC383F8FE014
-E1397F07F1F8EB03F300FEEBFBF0EB01FF5D7FEDC006027F130F91393F801F8015C06C13
-7F6CEBFFE049EBF83F018701FC1300263FFFFBB5FC6C01F15B14E06C9038C03FFC000390
-38001FF8D801FCEB07E0293A7DB830>38 D<EA07C0EA0FF0EA1FF8A213FCA213FE120F12
-07EA007EA513FE13FCA2120113F81203EA07F0120FEA1FE0127FEAFFC013801300127C12
-380F1D70B730>I<141E147F14FF5BEB03FEEB07FCEB0FF0EB1FE0EB3FC0EB7F80EBFF00
-485A5B12035B485A120F5BA2485AA2123F5BA2127F90C7FCA412FEAD127FA47F123FA27F
-121FA26C7EA27F12076C7E7F12017F6C7EEB7F80EB3FC0EB1FE0EB0FF0EB07FCEB03FEEB
-01FF7F147F141E184771BE30>I<127812FE7E7F6C7E6C7EEA0FF06C7E6C7E6C7E6C7EEB
-7F80133F14C0131FEB0FE014F01307A2EB03F8A214FC1301A214FE1300A4147FAD14FEA4
-130114FCA2130314F8A2EB07F0A2130F14E0EB1FC0133F1480137FEBFF00485A485A485A
-485AEA3FE0485A485A90C7FC5A1278184778BE30>I<14E0497E497EA60038EC0380007E
-EC0FC0D8FF83EB3FE001C3137F9038F3F9FF267FFBFB13C06CB61280000FECFE00000314
-F86C5C6C6C13C0011F90C7FC017F13C048B512F04880000F14FE003FECFF80267FFBFB13
-C026FFF3F913E09038C3F87F0183133FD87E03EB0FC00038EC0380000091C7FCA66D5A6D
-5A23277AAE30>I<143EA2147FAF007FB7FCA2B81280A36C1600A2C76CC8FCAF143EA229
-297DAF30>I<EA03E0EA0FF0EA1FF813FCEA3FFEA213FFA27EA27E1203EA007FA2137E13
-FEEA01FC1203EA07F8EA3FF0127FEAFFE0EA7F801300123C1019708B30>I<007FB612F0
-A2B712F8A36C15F0A225077B9E30>I<120FEA3FC0EA7FE0A2EAFFF0A4EA7FE0A2EA3FC0
-EA0F000C0C6E8B30>I<16F01501ED03F8A21507A2ED0FF0A2ED1FE0A2ED3FC0A2ED7F80
-A2EDFF00A24A5AA25D1403A24A5AA24A5AA24A5AA24A5AA24A5AA24AC7FCA2495AA25C13
-03A2495AA2495AA2495AA2495AA2495AA249C8FCA2485AA25B1203A2485AA2485AA2485A
-A2485AA2485AA248C9FCA25AA2127CA225477BBE30>I<14FE903807FFC0497F013F13F8
-497F90B57E48EB83FF4848C6138049137F4848EB3FC04848EB1FE049130F001F15F04913
-07A24848EB03F8A290C712014815FCA400FEEC00FEAD6C14016C15FCA36D1303003F15F8
-A26D1307001F15F0A26D130F6C6CEB1FE0A26C6CEB3FC06C6CEB7F806D13FF2601FF8313
-006CEBFFFE6D5B6D5B010F13E06D5BD900FEC7FC273A7CB830>I<EB03C0497EA2130FA2
-131FA2133F137F13FF1203123FB5FCA213EF138FEA7E0F1200B3B0003FB512F84814FCB6
-12FEA26C14FC6C14F81F3977B830>I<EB07FC90383FFFC090B512F00003804814FE4880
-261FF80F1380263FE00113C09038C0007F4848EB3FE090C7121FED0FF04814075A6C15F8
-1503A3127E1218C8FCA2150716F0150F16E0151F16C0153FED7F8015FF4A13005DEC07FC
-4A5A4A5A4A5A4A5A4A5A4990C7FC495A495AEB0FF0EB3FE0495A495A4890C8FC4848EB01
-F04848EB03F8485AEA1FE048B6FCB7FCA37E6C15F025397BB830>I<EB03FF013F13E090
-B512F84814FE4880481580260FFE0113C09038F0007F4848EB1FE0150F16F01507A26C5A
-6C5AC8FC150F16E0A2151FED3FC0157FEDFF8002071300903807FFFE495B5D8115FF6D14
-80D9000113C09138003FE0ED1FF0ED07F8150316FC150116FE1500A21218127EB4FCA215
-0116FC4814036C15F86C6C13076DEB1FF0D83FF0133F3A1FFE01FFE06CB612C06C15806C
-ECFE00C65C013F13F001031380273A7CB830>I<EC03FC4A7E140F141FA2143F147F157E
-14FEA2EB01FCEB03F8A2EB07F0A2EB0FE0EB1FC0A2EB3F80A2EB7F0013FEA2485A485AA2
-485AA2485A485AA2485AA248C7FC12FEB8FC1780A46C1600C8007EC7FCAA91387FFFFE91
-B6FCA46E5B29397DB830>I<000FB612804815C05AA316800180C8FCAEEB83FF019F13C0
-90B512F015FC8181D9FE0313809039F0007FC049133F0180EB1FE06CC7120F000E15F0C8
-1207A216F81503A31218127EA2B4FC150716F048140F6C15E06C141F6DEB3FC06D137F3A
-3FE001FF80261FFC0F13006CB55A6C5C6C5C6C14E06C6C1380D90FFCC7FC25397BB730>
-I<EC0FF8EC7FFF49B51280010714E0131F4914F090387FF80F9039FFC007F84813803803
-FE005B485A4848EB03F0ED01E0484890C7FC5B123F5BA2127FEB000C903803FFE0010F13
-F8D8FF3F13FE48B6FCB7128016C09039FE007FE001F8EB1FF001E0130F49EB07F8ED03FC
-5B90C7120116FE1500A37EA46C7E15016D14FC121F6D1303000FEC07F86D130F6C6CEB1F
-F06DEB3FE03A03FF81FFC06C90B512806C15006D5B011F13F8010713E001011380273A7C
-B830>I<127CB712FC16FEA416FC48C7EA0FF816F0ED1FE0007CEC3FC0C8EA7F80EDFF00
-A24A5A4A5A5D14075D140F5D4A5AA24A5AA24AC7FCA25C5C13015CA213035CA213075CA4
-495AA6131F5CA96D5A6DC8FC273A7CB830>I<49B4FC011F13F0017F13FC90B57E0003EC
-FF804815C048010113E03A1FF8003FF049131FD83FC0EB07F8A24848EB03FC90C71201A5
-6D1303003F15F86D13076C6CEB0FF06C6CEB1FE0D807FCEB7FC03A03FF83FF806C90B512
-006C6C13FC011F13F0497F90B512FE48802607FE0013C0D80FF8EB3FE0D81FE0EB0FF048
-48EB07F8491303007F15FC90C712014815FE481400A66C14016C15FC6D1303003F15F86D
-1307D81FF0EB1FF06D133F3A0FFF01FFE06C90B512C06C1580C6ECFE006D5B011F13F001
-0190C7FC273A7CB830>I<49B4FC010F13E0013F13F890B57E4880488048010113803A0F
-FC007FC0D81FF0EB3FE04848131F49EB0FF048481307A290C7EA03F85A4815FC1501A416
-FEA37E7E6D130315076C7E6C6C130F6D133FD80FFC13FF6CB6FC7E6C14FE6C14F9013FEB
-E1FC010F138190380060011400ED03F8A2150716F0150F000F15E0486C131F486CEB3FC0
-157FEDFF804A1300EC07FE391FF01FFC90B55A6C5C6C5C6C1480C649C7FCEB3FF0273A7C
-B830>I<120FEA3FC0EA7FE0A2EAFFF0A4EA7FE0A2EA3FC0EA0F00C7FCAF120FEA3FC0EA
-7FE0A2EAFFF0A4EA7FE0A2EA3FC0EA0F000C276EA630>I<EA03C0EA0FF0EA1FF8A2EA3F
-FCA4EA1FF8A2EA0FF0EA03C0C7FCAFEA03C0EA0FF0121F13F8123F13FCA3121FA2120F12
-031200120113F8120313F01207EA1FE0123FEA7FC0EAFF80EA7F00127E12380E3470A630
->I<16F01503ED07F8151F157FEDFFF014034A13C0021F138091383FFE00ECFFF8495B01
-0713C0495BD93FFEC7FC495A3801FFF0485B000F13804890C8FCEA7FFC5BEAFFE05B7FEA
-7FF87FEA1FFF6C7F000313E06C7F38007FFC6D7E90380FFF806D7F010113F06D7FEC3FFE
-91381FFF80020713C06E13F01400ED7FF8151F1507ED03F01500252F7BB230>I<007FB7
-FCA2B81280A36C16006C5DCBFCA7003FB612FE4881B81280A36C1600A229157DA530>I<
-1278127EB4FC13C07FEA7FF813FEEA1FFF6C13C000037F6C13F86C6C7EEB1FFF6D7F0103
-13E06D7F9038007FFC6E7E91380FFF806E13C0020113F080ED3FF8151F153FEDFFF05C02
-0713C04A138091383FFE004A5A903801FFF0495B010F13804990C7FCEB7FFC48485A4813
-E0000F5B4890C8FCEA7FFE13F8EAFFE05B90C9FC127E1278252F7BB230>I<EC1FE0ECFF
-F8010313FE010F7F4914804914C090397FF03FE09038FF800F4890380007F0D803FC1303
-3A07F801FBF89038F007FF380FE01F4A13FCEA1FC0495A003FEBFF0F903800FE07903901
-FC03FE007FEBF801EA7E03ECF000A2EAFE0700FC49137EAA00FE6D13FED87E0314FCA2EC
-F801D87F0114F8003FEBFC03903900FE07F0903880FF0F001F90387FFFE06D6C13C0EA0F
-E06E13803A07F007FE009038F801F86C6CC7127C6CB414FE6CEB800390387FF01F6DB512
-FC6D14F86D14E0010314C00100EBFE00EC1FF0273A7CB830>64 D<147F4A7EA2497FA449
-7F14F7A401077F14E3A3010F7FA314C1A2011F7FA490383F80FEA590387F007FA4498049
-133F90B6FCA34881A39038FC001F00038149130FA4000781491307A2D87FFFEB7FFFB56C
-B51280A46C496C130029397DB830>I<007FB512F0B612FE6F7E82826C813A03F8001FF8
-15076F7E1501A26F7EA615015EA24B5A1507ED1FF0ED7FE090B65A5E4BC7FC6F7E16E082
-9039F8000FF8ED03FC6F7E1500167FA3EE3F80A6167F1700A25E4B5A1503ED1FFC007FB6
-FCB75A5E16C05E6C02FCC7FC29387EB730>I<91387F803C903903FFF03E49EBFC7E011F
-13FE49EBFFFE5B9038FFE07F48EB801F3903FE000F484813075B48481303A2484813015B
-123F491300A2127F90C8FC167C16005A5AAC7E7EA2167C6D14FE123FA27F121F6D13016C
-6C14FCA26C6CEB03F86D13076C6CEB0FF03901FF801F6C9038E07FE06DB512C06D14806D
-1400010713FC6D13F09038007FC0273A7CB830>I<003FB512E04814FCB67E6F7E6C816C
-813A03F8007FF0ED1FF8150F6F7E6F7E15016F7EA2EE7F80A2163F17C0161FA4EE0FE0AC
-161F17C0A3163F1780A2167F17005E4B5A15034B5A150F4B5AED7FF0003FB65A485DB75A
-93C7FC6C14FC6C14E02B387FB730>I<007FB7FCB81280A47ED803F8C7123FA8EE1F0093
-C7FCA4157C15FEA490B5FCA6EBF800A4157C92C8FCA5EE07C0EE0FE0A9007FB7FCB8FCA4
-6C16C02B387EB730>I<003FB712804816C0B8FCA27E7ED801FCC7121FA8EE0F8093C7FC
-A5153E157FA490B6FCA69038FC007FA4153E92C8FCAE383FFFF8487FB5FCA27E6C5B2A38
-7EB730>I<02FF13F00103EBC0F8010F13F1013F13FD4913FF90B6FC4813C1EC007F4848
-133F4848131F49130F485A491307121F5B123F491303A2127F90C7FC6F5A92C8FC5A5AA8
-92B5FC4A14805CA26C7F6C6D1400ED03F8A27F003F1407A27F121F6D130F120F7F6C6C13
-1FA2D803FE133F6C6C137FECC1FF6C90B5FC7F6D13FB010F13F30103EBC1F0010090C8FC
-293A7DB830>I<3B3FFF800FFFE0486D4813F0B56C4813F8A26C496C13F06C496C13E0D8
-03F8C7EAFE00B290B6FCA601F8C7FCB3A23B3FFF800FFFE0486D4813F0B56C4813F8A26C
-496C13F06C496C13E02D387FB730>I<007FB6FCB71280A46C1500260007F0C7FCB3B3A8
-007FB6FCB71280A46C1500213879B730>I<49B512F04914F85BA27F6D14F090C7EAFE00
-B3B3123C127EB4FCA24A5A1403EB8007397FF01FF86CB55A5D6C5C00075C000149C7FC38
-003FF025397AB730>I<D83FFF90380FFF80486D4813C0B56C5AA26C497E6C496C1380D8
-03F0903803F8004B5A4B5A151F4B5A5E4BC7FC15FE14014A5A5D4A5A4A5A141F5D4A5A4A
-C8FC5C13F18101F37F13F790B57E14EFECC7F01483EC03F8140101FE7F496C7E5B157F49
-7F82151F82150F826F7EA26F7E1501821500D83FFF903803FFC0486D4813E0B56C5AA26C
-497E6C496C13C02B387FB730>I<383FFFF8487FB57EA26C5B6C5BD801FCC9FCB3B0EE0F
-80EE1FC0A9003FB7FC5AB8FCA27E6C16802A387EB730>I<D83FF8ECFFE0486C4913F048
-6C4913F8A2007F16F06C6C4913E00007160001EF14BFEC800FA39039E7C01F3FA4ECE03F
-01E3133EA2ECF07EA201E1137CA2ECF8FCA201E013F8A214FDEC7DF0A3147FEC3FE0A3EC
-1FC0A2EC070091C7FCADD83FFC903801FFE0486C4913F0B54913F8A26C486D13F06C486D
-13E02D387FB730>I<D83FFC90381FFF80486C4913C0B54913E0A26C6D6C13C06C6E1380
-0003913801F800EBF7C0A3EBF3E0A314F013F1A214F8A213F014FCA2147C147EA2143E14
-3FA2141FA21581A2140F15C1A2140715E1A2140315F1A21401A215F91400A3157DA3153F
-EA3FFF481380B5EAC01FA26CEB800F6C496C5A2B387EB730>I<90383FFFE048B512FC00
-0714FF4815804815C04815E0EBF80001E0133FD87F80EB0FF0A290C71207A44815F84814
-03B3A96C1407A26C15F0A36D130FA26D131F6C6CEB3FE001F813FF90B6FC6C15C06C1580
-6C1500000114FCD8003F13E0253A7BB830>I<007FB512F0B612FE6F7E16E0826C813903
-F8003FED0FFCED03FE15016F7EA2821780163FA6167F17005EA24B5A1503ED0FFCED3FF8
-90B6FC5E5E16804BC7FC15F001F8C9FCB0387FFFC0B57EA46C5B29387EB730>I<90383F
-FFE048B512FC000714FF4815804815C04815E0EBF80001E0133F4848EB1FF049130F90C7
-1207A44815F8481403B3A8147E14FE6CEBFF076C15F0EC7F87A2EC3FC7018013CF9038C0
-1FFFD83FE014E0EBF80F90B6FC6C15C06C15806C1500000114FCD8003F7FEB00016E7EA2
-1680157F16C0153F16E0151F16F0150FED07E025467BB830>I<003FB57E4814F0B612FC
-15FF6C816C812603F8017F9138003FF0151F6F7E15071503821501A515035E1507150F4B
-5A153F4AB45A90B65A5E93C7FC5D8182D9F8007FED3FE0151F150F821507A817F8EEF1FC
-A53A3FFF8003FB4801C0EBFFF8B56C7E17F06C496C13E06C49EB7FC0C9EA1F002E397FB7
-30>I<90390FF803C0D97FFF13E048B512C74814F74814FF5A381FF80F383FE001497E48
-48137F90C7123F5A48141FA2150FA37EED07C06C91C7FC7F7FEA3FF0EA1FFEEBFFF06C13
-FF6C14E0000114F86C80011F13FF01031480D9003F13C014019138007FE0151FED0FF0A2
-ED07F8A2007C140312FEA56C140716F07F6DEB0FE06D131F01F8EB3FC001FF13FF91B512
-80160000FD5CD8FC7F13F8D8F81F5BD878011380253A7BB830>I<003FB712C04816E0B8
-FCA43AFE003F800FA8007CED07C0C791C7FCB3B1011FB5FC4980A46D91C7FC2B387EB730
->I<3B7FFFC007FFFCB56C4813FEA46C496C13FCD803F8C7EA3F80B3B16D147F00011600
-A36C6C14FE6D13016D5CEC800390393FE00FF890391FF83FF06DB55A6D5C6D5C6D91C7FC
-9038007FFCEC1FF02F3980B730>I<D87FFE90380FFFC0B54913E06E5AA24A7E6C486D13
-C0D807F0903801FC00A26D130300035DA46C6C495AA46C6C495AA46D131F6D5CA3EC803F
-013F5CA46D6C48C7FCA490380FE0FEA401075B14F1A301035BA314FB01015BA314FFA26D
-5BA46E5A6E5A2B397EB730>I<D83FFC903801FFE0486C4913F000FF16F8A2007F16F06C
-486D13E0D81FC09038001FC0000F1680A76D143F00071600A7000390380F803E9039F01F
-C07EEC3FE0A3EC7FF0A2147D0001157CA29039F8FDF8FCA314F8A300005D01F913FCA2EC
-F07CA201FD137DA2017D5CECE03DA3017F133FA2ECC01FA2013F5CA2EC800F6D486C5A2D
-397FB730>I<3A3FFF01FFF84801837F02C77FA202835B6C01015B3A01FC007F806D91C7
-FC00005C6D5BEB7F01EC81FCEB3F8314C3011F5B14E7010F5B14FF6D5BA26D5BA26D5BA2
-6D90C8FCA4497FA2497FA2815B81EB0FE781EB1FC381EB3F8181EB7F0081497F49800001
-143F49800003141F49800007140FD87FFEEB7FFFB590B5128080A25C6C486D130029387D
-B730>I<D87FFF90381FFFC0B56C4813E0A46C496C13C0D803F8903803F8006D1307A26C
-6C495AA26C6C5C151F6D5CEC803F013F5CECC07F011F91C7FCA290380FE0FEA214F10107
-5BA2903803FBF8A201015B14FF6D5BA26E5AA36E5AB1903803FFF8497F497FA26D5B6D5B
-2B387EB730>I<001FB612FC4815FE5AA490C7EA03FCED07F816F0150FED1FE016C0153F
-ED7F80003E1500C85A4A5A5D14034A5A5D140F4A5A5D143F4A5A92C7FC5C495A5C130349
-5A5C130F495A5C133F495A91C8FC5B4848147C4914FE1203485A5B120F485A5B123F485A
-90B6FCB7FCA46C15FC27387CB730>I<007FB5FCB61280A4150048C8FCB3B3B3A5B6FC15
-80A46C140019476DBE30>I<007FB5FCB61280A47EC7123FB3B3B3A5007FB5FCB6FCA46C
-140019477DBE30>93 D<1307EB1FC0EB7FF0497E000313FE000FEBFF80003F14E0D87FFD
-13F039FFF07FF8EBC01FEB800F38FE0003007CEB01F00010EB00401D0E77B730>I<007F
-B612F0A2B712F8A36C15F0A225077B7D30>I<EB3FFC48B57E4814E04880488048809038
-F00FFE9038E001FF806F7E6C48133F6C4880C8121FA491B5FC130F137F48B6FC12075A48
-EBC01F383FFC00EA7FE0138048C7FC5AA46C143FA26C6C137F9038C001FF263FF80FEBFF
-C06CB712E0A2000714F76C14C3C6020013C0D93FF090C7FC2B2A7CA830>97
-D<EA3FFC487E12FFA2127F123F1200AAEC03FE91381FFF80027F13E091B57E90B612FC82
-ECFE079138F001FF4A6C13804A137F4AEB3FC091C7121F4915E0160FA217F01607A8160F
-A217E07F161F6EEB3FC0A26EEB7F806E13FFDAF00313009138FC0FFE91B55A5E495CD97E
-7F13C0D93C1F90C7FC90380003FC2C3980B730>I<ECFFE0010713FC011F7F017F7F90B6
-12804815C048EB807F3907FC003F485A485A49EB1F804848EB0F004990C7FC127F90C9FC
-A25A5AA87E7EA27F003FEC07C06DEB0FE06C7E6D131F6C6C14C0D807FE133F9039FFC0FF
-806C90B5FCC615006D5B011F13F801075B01011380232A7AA830>I<913801FFE04A7F5C
-A28080EC0007AAEB03FE90381FFF874913E790B6FC5A5A481303380FFC00D81FF0133F49
-131F485A150F4848130790C7FCA25AA25AA87E6C140FA27F003F141F6D133F6C7E6D137F
-390FF801FF2607FE07EBFFC06CB712E06C16F06C14F76D01C713E0011F010313C0D907FC
-C8FC2C397DB730>I<49B4FC010713E0011F13F8017F7F90B57E488048018113803A07FC
-007FC04848133FD81FE0EB1FE0150F484814F0491307127F90C7FCED03F85A5AB7FCA516
-F048C9FC7E7EA27F003FEC01F06DEB03F86C7E6C7E6D1307D807FEEB1FF03A03FFC07FE0
-6C90B5FC6C15C0013F14806DEBFE00010713F8010013C0252A7CA830>I<EDFF80020713
-E0021F13F05C4A13F891B5FC491387903803FE079138FC03F0903907F800C04A1300A800
-3FB612C04815E0B7FCA36C15C0260007F0C7FCB3A9003FB512FE4880B71280A26C15006C
-5C25397DB830>I<D903FC13FF90261FFF8713C04913DF90B712E05A5A2607FE07138F90
-3AF801FE07C048486C6CC7FCA2497F001F8149133FA56D137F000F92C7FC6D5BA26C6C48
-5AEBFE0790B55A5D485C15C001DF5BD9C3FCC8FC01C0C9FCA37F7F6CB512F015FF6C15C0
-4815F0488148813A3FE0001FFE0180130148C8127F007E8100FE168048151FA56C153F00
-7FED7F006D5C6C6C495A01F013076CB4EB7FFC6C90B55A6C5D000115C06C6C91C7FC011F
-13FC010113C02B3E7DA730>I<EA3FFC487E12FFA2127F123F1200AAEC01FE91380FFF80
-023F13E091B57E90B67EA29138FE07FCECF8039138E001FE14C0EC8000A291C7FCA25BB3
-A23B3FFFF81FFFF8486D4813FCB500FE14FEA26C01FC14FC6C496C13F82F3880B730>I<
-14E0EB03F8A2497EA36D5AA2EB00E091C8FCA9381FFFF8487F5AA27E7EEA0001B3A9003F
-B612C04815E0B7FCA27E6C15C023397AB830>I<EC01C0EC07F0A2EC0FF8A3EC07F0A2EC
-01C091C7FCA990B512F04814F8A47EEB0003B3B3A5EC07F0A2123C007EEB0FE0B4131FEC
-3FC0147F90B512806C14005C6C5B000F13F0000313C01D4E7CB830>I<EA7FF8487EA412
-7F1200AB0203B512804A14C017E0A217C06E14809139001FE0004B5A4B5A4BC7FC4A5A4A
-5AEC0FF84A5A4A5A4A5A4A5A01FD7F90B57E8114F7ECE3F8ECC1FCEC81FEEC00FF497F49
-6D7E6F7E826F7E15076F7E6F7E3B7FFFF81FFFE0B56C4813F017F8A217F06C496C13E02D
-387FB730>I<387FFFF8B57EA47EEA0001B3B3A8007FB612F0B712F8A46C15F025387BB7
-30>I<02FC137E3B7FC3FF01FF80D8FFEF01877F90B500CF7F15DF92B57E6C010F138726
-07FE07EB03F801FC13FE9039F803FC01A201F013F8A301E013F0B3A23C7FFE0FFF07FF80
-B548018F13C0A46C486C01071380322881A730>I<EC01FE3A3FFC0FFF80267FFE3F13E0
-00FF90B57E90B67E7E6C9038FE07FCC6EBF8039138E001FE14C0EC8000A291C7FCA25BB3
-A23B3FFFF81FFFF8486D4813FCB500FE14FEA26C01FC14FC6C496C13F82F2880A730>I<
-49B4FC010F13E0013F13F8497F90B57E0003ECFF8014013A07FC007FC04848EB3FE0D81F
-E0EB0FF0A24848EB07F8491303007F15FC90C71201A300FEEC00FEA86C14016C15FCA26D
-1303003F15F86D13076D130F6C6CEB1FF06C6CEB3FE06D137F3A07FF01FFC06C90B51280
-6C15006C6C13FC6D5B010F13E0010190C7FC272A7CA830>I<EC03FE3A3FFC1FFF80267F
-FE7F13E000FF90B57E90B612FC6C816CEBFE07C69038F001FF4A6C13804A137F4AEB3FC0
-91C7121F4915E0160FA217F01607A8160FA217E07F161F6EEB3FC0A26EEB7F806E13FFDA
-F00313009138FC0FFE91B55A5E495C6E13C0021F90C7FCEC03FC91C9FCAD383FFFF8487F
-B57EA26C5B6C5B2C3C80A730>I<49B413F8010FEBC1FC013F13F14913FD48B6FC5A4813
-81390FFC007F49131F4848130F491307485A491303127F90C7FC15015A5AA77E7E15037F
-A26C6C1307150F6C6C131F6C6C133F01FC137F3907FF01FF6C90B5FC6C14FD6C14F9013F
-13F1010F13C1903803FE0190C7FCAD92B512F84A14FCA46E14F82E3C7DA730>I<ED07F8
-3A3FFF803FFF486DB51280B512C302CF14C06C13DF6C9038FFFC3FD8001F13E09238801F
-809238000F004A90C7FC5C5C5CA25CA45CAF003FB512FC4880B7FCA26C5C6C5C2A287EA7
-30>I<90381FFC1E48B5129F000714FF5A5A5A387FF007EB800100FEC7FC4880A46C143E
-007F91C7FC13E06CB4FC6C13FC6CEBFF806C14E0000114F86C6C7F01037F9038000FFF02
-001380007C147F00FEEC1FC0A2150F7EA27F151F6DEB3F806D137F9039FC03FF0090B6FC
-5D5D00FC14F0D8F83F13C026780FFEC7FC222A79A830>I<EB0780497E131FA9003FB612
-E04815F0B7FCA36C15E026001FC0C7FCB216F8ED01FCA5ECE003010FEB07F814F09138FC
-1FF06DB512E06D14C016806D14009038007FFCEC1FF026337EB130>I<D83FFCEB3FFC48
-6C497E00FF14FFA2007F147F003F143F00001400B3A41501A2150315076D130F903A7FC0
-7FFFF891B612FC6D15FE7F6D4913FC6D9038F87FF8010001C0C7FC2F2880A630>I<3B3F
-FFC07FFF80486DB512C0B515E0A26C16C06C496C13803B01F80003F000A26D130700005D
-A26D130F017E5CA2017F131F6D5CA2EC803F011F91C7FCA26E5A010F137EA2ECE0FE0107
-5BA214F101035BA3903801FBF0A314FF6D5BA36E5A6E5A2B277EA630>I<3B3FFFC01FFF
-E0486D4813F0B515F8A26C16F06C496C13E0D807E0C7EA3F00A26D5C0003157EA56D14FE
-00015DEC0F80EC1FC0EC3FE0A33A00FC7FF1F8A2147DA2ECFDF9017C5C14F8A3017E13FB
-A290393FF07FE0A3ECE03FA2011F5C90390F800F802D277FA630>I<3A3FFF81FFFC4801
-C37FB580A26C5D6C01815BC648C66CC7FC137FEC80FE90383F81FC90381FC3F8EB0FE3EC
-E7F06DB45A6D5B7F6D5B92C8FC147E147F5C497F81903803F7E0EB07E790380FE3F0ECC1
-F890381F81FC90383F80FE90387F007E017E137F01FE6D7E48486D7E267FFF80B5FCB500
-C1148014E3A214C16C0180140029277DA630>I<3B3FFFC07FFF80486DB512C0B515E0A2
-6C16C06C496C13803B01FC0003F000A2000014076D5C137E150F017F5C7F151FD91F805B
-A214C0010F49C7FCA214E00107137EA2EB03F0157C15FCEB01F85DA2EB00F9ECFDF0147D
-147FA26E5AA36E5AA35DA2143F92C8FCA25C147EA2000F13FE486C5AEA3FC1EBC3F81387
-EB8FF0EBFFE06C5B5C6C90C9FC6C5AEA01F02B3C7EA630>I<001FB612FC4815FE5AA316
-FC90C7EA0FF8ED1FF0ED3FE0ED7FC0EDFF80003E491300C7485A4A5A4A5A4A5A4A5A4A5A
-4A5A4990C7FC495A495A495A495A495A495A4948133E4890C7127F485A485A485A485A48
-5A48B7FCB8FCA46C15FE28277DA630>I<ED3FF0913803FFF8140F5C147F16F09138FFF0
-0092C7FC495A5CB3A21303495A133F383FFFF0B55A5C91C8FC14C080003F7F38003FF813
-076D7E1301B3A2806D7E15F091387FFFF016F8141F8014039138003FF025477BBE30>I<
-127CA212FEB3B3B3AD127CA207476CBE30>I<EA7FE0EAFFFE6D7E8014F07EC66C7E1307
-6D7E1301B3A2806D7E15E091387FFFE06E13F8801407141F5C4A13E09138FFE00092C7FC
-495A5CB3A21303495A137F387FFFF0B5FC14C05C49C8FCEA7FE025477BBE30>I<017C13
-3848B4137C48EB80FE4813C14813C348EBEFFC397FEFFFF0D8FF8713E0010713C0486C13
-80D87C0113003838007C1F0C78B730>I E
-%EndDVIPSBitmapFont
-%DVIPSBitmapFont: Fk cmbx12 14.4 49
-/Fk 49 122 df<EEFFFC031FEBFF804AB612E0020781021F9038C00FF8913A7FFE0003FC
-DAFFF0EB00FE4949EB03FF4901805B4990C7487F49485CA2495A4D7F013F6F5B5CA37190
-C7FC715AEF01F894C9FCA90403B512C0BAFCA526003FFCC7120783B3B3A6003FB5D8FC03
-B612C0A542547DD34B>12 D<B712F0AB240B7F9F2D>45 D<EA07F0487E487E487E487EB5
-1280A76C13006C5A6C5A6C5A6C5A1111769025>I<157815FC14031407141F14FF130F00
-07B5FCB6FCA2147F13F0EAF800C7FCB3B3B3A6007FB712FEA52F4E76CD43>49
-D<EC3FFE0103B512E0010F14FC013F14FF90B712C048D9C07F7F2703FE000F13F8D807F8
-01037FD80FE06D7F48486D7F48488001F01680486C6E13C07F486C6E13E07FA27013F0A5
-6C5AA26C5AEA0FF0EA03C0C914E05EA218C05E1880A24C13005F4C5A4B5B5F4B5B5F4B5B
-4B90C7FC4B5A5E4B5AED7FE04B5A4A5B4A48C8FC4A5A5D4A48EB01F04A5AEC3F804AC7FC
-02FEEC03E0495A495A495A495AD91F80140749C8FC013E150F017FB7FC90B812C05A5A5A
-5A5A5A5AB9FC1880A4344E79CD43>I<91380FFFC091B512FC0107ECFF80011F15E09026
-3FF8077F9026FF800113FC4848C76C7ED803F86E7E491680D807FC8048B416C080486D15
-E0A4805CA36C17C06C5B6C90C75AD801FC1680C9FC4C13005FA24C5A4B5B4B5B4B13C04B
-5BDBFFFEC7FC91B512F816E016FCEEFF80DA000713E0030113F89238007FFE707E701380
-7013C018E07013F0A218F8A27013FCA218FEA2EA03E0EA0FF8487E487E487EB57EA318FC
-A25E18F891C7FC6C17F0495C6C4816E001F04A13C06C484A1380D80FF84A13006CB44A5A
-6CD9F0075BC690B612F06D5D011F1580010302FCC7FCD9001F1380374F7ACD43>I<177C
-17FEA2160116031607160FA2161F163F167FA216FF5D5DA25D5DED1FBFED3F3F153E157C
-15FCEC01F815F0EC03E01407EC0FC01580EC1F005C147E147C5C1301495A495A5C495A13
-1F49C7FC133E5B13FC485A5B485A1207485A485A90C8FC123E127E5ABA12C0A5C96C48C7
-FCAF020FB712C0A53A4F7CCE43>I<D80380150ED807E0157E01FEEC03FED9FFF0137F91
-B65A5F5F5F5F5F94C7FC5E5E16F016C093C8FC15F801E190C9FC01E0CAFCABEC0FFF027F
-13F001E3B512FE01E76E7E9026FFF8077FDAC0017F49C713F8496E7E49143F4981496E7E
-6C481680C9FC18C08218E0A418F0A3EA0FE0487E487E487E487EA418E0A35B6C484A13C0
-5B491680003EC85A003F17006C6C4A5A6D5D6C6C4A5AD807F8495BD803FE01075B2701FF
-C03F5B6C90B65A013F4AC7FC6D14F8010314C09026007FF8C8FC344F79CD43>I<ED0FFF
-92B512E0020780021F14FC91397FFE03FE903A01FFF0007F4901C0EB3F804990C7121F49
-48EC7FC0494814FF49484913E049485B01FF5C485BA2485B5AA2486F13C04A6D1380486F
-1300177E94C7FC5AA291CAFC5AA21508913801FFF8020713FFB54814C04A14F04AC66C7E
-023C6D7E4A6D7E4A6D7E7013804A15C0A24A15E07013F05C18F8A491C714FCA37EA67EA4
-6C17F880A27E18F06C5D18E06C6D15C07E6E4913806C6D15006D6C495A6D6CEB7FFC6DB4
-48485A6D90B55A010315C0010092C7FC023F13FC020713C0364F7ACD43>I<121F7F7FEB
-FF8091B81280A45A1900606060A2606060485F0180C86CC7FC007EC95A4C5A007C4B5A5F
-4C5A160F4C5A484B5A4C5A94C8FC16FEC812014B5A5E4B5A150F4B5AA24B5AA24B5A15FF
-A24A90C9FCA25C5D1407A2140FA25D141FA2143FA4147F5DA314FFA55BAC6D5BA2EC3FC0
-6E5A395279D043>I<913807FFC0027F13FC0103B67E010F15E090261FFC0113F8903A3F
-E0003FFCD97F80EB0FFE49C76C7E48488048486E1380000717C04980120F18E0177FA212
-1F7FA27F7F6E14FF02E015C014F802FE4913806C7FDBC00313009238F007FE6C02F85B92
-38FE1FF86C9138FFBFF06CEDFFE017806C4BC7FC6D806D81010F15E06D81010115FC0107
-81011F81491680EBFFE748018115C048D9007F14E04848011F14F048487F484813030300
-14F8484880161F4848020713FC1601824848157F173FA2171FA2170FA218F8A27F007F17
-F06D151FA26C6CED3FE0001F17C06D157F6C6CEDFF806C6C6C010313006C01E0EB0FFE6C
-01FCEBFFFC6C6CB612F06D5D010F1580010102FCC7FCD9000F13C0364F7ACD43>I<9138
-0FFF8091B512F8010314FE010F6E7E4901037F90267FF8007F4948EB3FF048496D7E4849
-80486F7E484980824817805A91C714C05A7013E0A218F0B5FCA318F8A618FCA46C5DA37E
-A25E6C7F6C5DA26C5D6C7F6C6D137B6C6D13F390387FF803011FB512E36D14C301030283
-13F89039007FFE03EC00401500A218F05EA3D801F816E0487E486C16C0487E486D491380
-A218005E5F4C5A91C7FC6C484A5A494A5A49495B6C48495BD803FC010F5B9027FF807FFE
-C7FC6C90B55A6C6C14F06D14C0010F49C8FC010013F0364F7ACD43>I<91B5FC010F14F8
-017F14FF90B712C00003D9C00F7F2707FC00017FD80FE06D7F48486E7E48C87FD87FE06E
-7E7F7F486C1680A66C5A18006C485C6C5AC9485A5F4B5B4B5B4B5B4B5B4B90C7FC16FC4B
-5A4B5A16C04B5A93C8FC4A5A5D14035D5D14075DA25D140FA25DAB91CAFCAAEC1FC04A7E
-ECFFF8497FA2497FA76D5BA26D5BEC3FE06E5A315479D340>63 D<BA7E19FCF1FF801AF0
-1AFCD8000701F0C7000F13FF060014C0071F7F070713F807017F737F747E747F747F8674
-7F747F8886888688A2757EA31D8087A21DC0A51DE0A387A963A31DC0A51D80A2631D00A3
-515AA2646264505B6264505B505B5090C7FCF2FFFE4F5B07075B071F5B96B512C0060F91
-C8FCBB5A1AF01AC007FCC9FC19805B527CD167>68 D<BC1280A5D8000701F8C7000114C0
-F0001F19071901851A7F1A3F1A1FA2F20FE0A21A07A31A03A318F81BF01A01A497C7FC17
-01A317031707170F177F92B6FCA59238F8007F170F170717031701A317001B3EA31B7CA3
-95C8FCA21BFCA21BF8A21A01A31A031BF01A071A0FA21A1F1A3FF27FE0F101FF1907191F
-0603B5FCBCFCA21BC0A34F517CD058>I<BB12FEA5D8000701F8C700077FF0007F191F19
-0785858586861B80A21A1FA31A0FA41BC006F81307A497C7FCA31701A317031707170F17
-7F92B6FCA59238F8007F170F170717031701A31700A795C9FCB3B812F8A54A517CD055>
-I<B8D8C003B8FCA5D8000701F8C9001FEBE000B3AE92BAFCA503F8C9121FB3B1B8D8C003
-B8FCA560527CD169>72 D<B812C0A5D8000701F8C7FCB3B3B3B2B812C0A52A527CD132>
-I<027FB71280A591C76C90C7FCB3B3B3EA07F0EA1FFC487E487EA2B57EA44C5AA34A485B
-7E49495BD83FF8495BD81FE05DD80FFC011F5B2707FF807F90C8FC000190B512FC6C6C14
-F0011F14C0010101F8C9FC39537DD145>I<B812F8A5D8000701F8CAFCB3B3A91A7CA41A
-FC1AF8A51901A31903A219071AF0190FA2191F193F197F19FF180360183F4DB5FCBB12E0
-A546527CD151>76 D<B600FC073FB512FE6F61A26F96B6FCA2D80007F5C00070EF01EFA2
-02EF6DEF03CFA202E76DEF078FA202E36DEF0F0FA202E16D171EA302E06D173CA26F6C17
-78A26F6C17F0A26F6DED01E0A26F6DED03C0A36F6DED0780A26F6DED0F00A26F6D151EA2
-6F6D5DA3706C5DA2706C5DA2706D495AA2706D495AA2706D495AA3706D49C7FCA2706D13
-1EA2706D5BA2716C5BA3716C5BA271EB81E0A271EBC3C0A271EBE780A27101FFC8FCA371
-5BA2715BA2725AA2725AA2D93FFC6F5AB74DB712FEA2725AA2725A77527CD180>I<BAFC
-19F819FF1AE086D8000701F0C7001F13FC060113FF726C13807313C0070F13E01BF08573
-13F81BFCA27313FEA41BFFA81BFEA31BFC61A21BF84F13F04F13E0614F13C04F13004E48
-5A061F5B92B812F01AC04FC7FC19E003F8CBFCB3AEB812C0A550527CD15C>80
-D<B912F0F0FF8019F819FF1AC0D8000701F0C714F0060F7F060113FE727F737F737F8573
-7F87A2737FA387A863A2616363A24F5B4F5B4F90C8FC4F5A06035B060F13F095B512C092
-B8C9FC19F819E019F89226F0000313FE9439007FFF80727F727F727F727F727F8684A286
-84A787A71D1C75133EA38575137E73157C7513FC731401B86C6D9038F803F807039038FE
-07F07390B512E0736C14C0080F1400CEEA7FFC5F537CD164>82 D<91260FFF80130791B5
-00F85B010702FF5B011FEDC03F49EDF07F9026FFFC006D5A4801E0EB0FFD4801800101B5
-FC4848C87E48488149150F001F824981123F4981007F82A28412FF84A27FA26D82A27F7F
-6D93C7FC14C06C13F014FF15F86CECFF8016FC6CEDFFC017F06C16FC6C16FF6C17C06C83
-6C836D826D82010F821303010082021F16801400030F15C0ED007F040714E01600173F05
-0F13F08383A200788200F882A3187FA27EA219E07EA26CEFFFC0A27F6D4B13806D17006D
-5D01FC4B5A01FF4B5A02C04A5A02F8EC7FF0903B1FFFC003FFE0486C90B65AD8FC0393C7
-FC48C66C14FC48010F14F048D9007F90C8FC3C5479D24B>I<003FBC1280A59126C0003F
-9038C0007F49C71607D87FF8060113C001E08449197F49193F90C8171FA2007E1A0FA300
-7C1A07A500FC1BE0481A03A6C994C7FCB3B3AC91B912F0A553517BD05E>I<B800C00103
-B612FCA5D8000701F8CAEBF000F31F80B3B3B11B3FA26D97C7FC81637F1B7E6D6D17FE50
-5A6E7E505A6E6D15076E4D5A6E6D4B5A6E6D4B5A6E01F84B5A6E6DDA03FFC8FC6E6CB46C
-EB0FFE6F9039F001FFF8030F90B65A030316C0DB007F92C9FC040F14F8DC007F13805E53
-7CD167>I<B700FC017FB600FE91B612F0A5D8003F01C0C8001F01E0C9EBF8006F71EE0F
-C06D7161876F1C1F6D7196C7FC6F8373606D1E3E6F836D7160876F1CFC6D666F4B801F01
-6D66704A806E525A88704A17076E059F5F70021F80080F160F6E6570023F806EDC3E074C
-C8FC8870027E5F6EDC7C03163E7002FC804F6C167E6E1C7C700101814F6C16FC6E745B70
-010317016E4C6D5D060716C00580496D14036F63DDC00F16E04F6D14076F07F05BDDE01F
-170F6F92C76C5D1DF8DDF03E6E141F6F98C9FCDDF87E16FC067C6E5C6FF1FE3EDDFCFC17
-7E6F4A6E147C1DFFDDFFF06E14FC6F62A24E816F62A270496F5BA24E817061A295C97E70
-61A270487090CAFCA37048705AA24D1601040360A27048705A84537DD18B>87
-D<EC7FFF0107B512F0013F14FE90B77E48D9E00F7F2703FE000113F0486C6D7F6EEB3FFC
-48826E131F83707FA36C496D7FA26C90C7FC6C5AC9FCA6037FB5FC020FB6FC91B7FC0107
-1487013FEBF0074913803901FFFC004813F0485B485B485B4890C7FC5A5BA2485AA45EA2
-6D5C007F151D163D6C6C02797F6C6D01F113F86C9026C003E1EBFFE06C9026F81FC014F0
-6C90B5487EC6ED001F011F01FC010713E0010101E090C8FC3C387CB641>97
-D<EB3FF0B5FCA51203C6FCB3A4923801FFE0030F13FE033FEBFFC092B612F002F301017F
-913AF7F8003FFEDAFFE0EB0FFF03806D7F92C76C7F4A6E7F4A824A6E7FA2727EA285A285
-84A31A80AC1A00A44E5AA36118FF616E4A5BA26E4A5B6E4A5B6F495BDACFC04990C7FCDA
-87F0EB7FFC913A03FE03FFF849C6B612E0496D148049011F01FCC8FC90C7000313C04154
-7BD24B>I<913801FFF8021FEBFF8091B612F0010315FC010F9038C00FFE903A1FFE0001
-FFD97FFC491380D9FFF05B4817C048495B5C5A485BA2486F138091C7FC486F1300705A48
-92C8FC5BA312FFAD127F7FA27EA2EF03E06C7F17076C6D15C07E6E140F6CEE1F806C6DEC
-3F006C6D147ED97FFE5C6D6CEB03F8010F9038E01FF0010390B55A01001580023F49C7FC
-020113E033387CB63C>I<4DB47E0407B5FCA5EE001F1707B3A4913801FFE0021F13FC91
-B6FC010315C7010F9038E03FE74990380007F7D97FFC0101B5FC49487F4849143F484980
-485B83485B5A91C8FC5AA3485AA412FFAC127FA36C7EA37EA26C7F5F6C6D5C7E6C6D5C6C
-6D49B5FC6D6C4914E0D93FFED90FEFEBFF80903A0FFFC07FCF6D90B5128F0101ECFE0FD9
-003F13F8020301C049C7FC41547CD24B>I<913803FFC0023F13FC49B6FC010715C04901
-817F903A3FFC007FF849486D7E49486D7E4849130F48496D7E48178048497F18C0488191
-C7FC4817E0A248815B18F0A212FFA490B8FCA318E049CAFCA6127FA27F7EA218E06CEE01
-F06E14037E6C6DEC07E0A26C6DEC0FC06C6D141F6C6DEC3F806D6CECFF00D91FFEEB03FE
-903A0FFFC03FF8010390B55A010015C0021F49C7FC020113F034387CB63D>I<ED3FFC02
-03B5FC020F14C0023F14E09139FFF81FF0499038C03FF849EB807F49903800FFFC495A49
-5AA2495AA2EE7FF8495AEE3FF0EE0FC093C7FCAEB712E0A526007FF8C8FCB3B3A7007FB5
-12FEA52E547CD329>I<DA3FFF14FF0103B5D8F00713C0010FDAFC1F13E0013FECFF7F90
-267FFC0F9038FF9FF09026FFE001EBF83F48496C13E0484990387FF01F4890C7D83FF813
-E0489338FC0FC0F0078048486E6CC7FCA2003F82A9001F5EA26C6C4A5AA26C5E6C6D495A
-6C6D495A6C6D485BDAFC0F5B4890B6C8FCD803EF14FC01C314F02607C03F90C9FC91CBFC
-A2120FA37FA213F813FE90B7FC6C16F817FF18C06C836C836C836D828448B9FC12074848
-C700031480D81FF8EC003F4848150748486F13C083485A83A56D5D007F18806D5D003F18
-006C6C4B5AD80FFEED1FFC6C6C6CEC7FF86C01E049485A6C01FE011F5B6C6CB71280010F
-03FCC7FC010115E0D9000F01FCC8FC3C4F7CB543>I<EB3FF0B5FCA51203C6FCB3A4EE1F
-FC93B512C0030314F0030F8092391FE07FFC92393F001FFE037C8003F07FDAF1E081ECF3
-C0DAF7807F8502FFC7FC5CA25CA45CB3ACB6D8F807B612C0A542537BD24B>I<137F497E
-000313E0487FA2487FA76C5BA26C5BC613806DC7FC90C8FCADEB3FF0B5FCA512017EB3B3
-A6B612E0A51B547BD325>I<EB3FF0B5FCA51203C6FCB3A54CB512F8A59339003FFE00EF
-1FF0EF3FC04D5A4DC7FCEE03FEEE07F84C5A4C5AEE7FC04CC8FC4B5A4B5AED0FF8ED1FE0
-4B7E4B7EECF1FF02F37F02F77F91B6FC83159F030F7F02FE80DAF8077F4A7E6F7F6F7F83
-707E82707F84707F707F82707F84707F177F717E4D13C0B6D8F003B6FCA540537CD247>
-107 D<EB3FF0B5FCA512017EB3B3B3B1B612F0A51C537BD225>I<D93FF0D91FFCEDFFE0
-B591B500C0010713FE030302F0011F6D7E030F6E017F8092271FE07FFCD9FF037F922A3F
-001FFE01F8007F0003027C9126FF03E080C602F06DD90780137FDAF1E0038FC77FDAF3C0
-159EDAF7806D01BC143F07FC8102FFC75C4A5EA24A5EA44A5EB3ACB6D8F807B6D8C03FB5
-12FEA567367BB570>I<D93FF0EB1FFCB591B512C0030314F0030F8092391FE07FFC9239
-3F001FFE0003027C80C602F07FDAF1E081ECF3C0DAF7807F8502FFC7FC5CA25CA45CB3AC
-B6D8F807B612C0A542367BB54B>I<913801FFE0021F13FE91B612C0010315F0010F9038
-807FFC903A1FFC000FFED97FF86D6C7E49486D7F48496D7F48496D7F4A147F48834890C8
-6C7EA24883A248486F7EA3007F1880A400FF18C0AC007F1880A3003F18006D5DA26C5FA2
-6C5F6E147F6C5F6C6D4A5A6C6D495B6C6D495B6D6C495BD93FFE011F90C7FC903A0FFF80
-7FFC6D90B55A010015C0023F91C8FC020113E03A387CB643>I<903A3FF001FFE0B5010F
-13FE033FEBFFC092B612F002F301017F913AF7F8007FFE0003D9FFE0EB1FFFC602806D7F
-92C76C7F4A824A6E7F4A6E7FA2717FA285187F85A4721380AC1A0060A36118FFA2615F61
-6E4A5BA26E4A5B6E4A5B6F495B6F4990C7FC03F0EBFFFC9126FBFE075B02F8B612E06F14
-80031F01FCC8FC030313C092CBFCB1B612F8A5414D7BB54B>I<90397FE003FEB590380F
-FF80033F13E04B13F09238FE1FF89139E1F83FFC0003D9E3E013FEC6ECC07FECE78014EF
-150014EE02FEEB3FFC5CEE1FF8EE0FF04A90C7FCA55CB3AAB612FCA52F367CB537>114
-D<903903FFF00F013FEBFE1F90B7FC120348EB003FD80FF81307D81FE0130148487F4980
-127F90C87EA24881A27FA27F01F091C7FC13FCEBFFC06C13FF15F86C14FF16C06C15F06C
-816C816C81C681013F1580010F15C01300020714E0EC003F030713F015010078EC007F00
-F8153F161F7E160FA27E17E07E6D141F17C07F6DEC3F8001F8EC7F0001FEEB01FE9039FF
-C00FFC6DB55AD8FC1F14E0D8F807148048C601F8C7FC2C387CB635>I<143EA6147EA414
-FEA21301A313031307A2130F131F133F13FF5A000F90B6FCB8FCA426003FFEC8FCB3A9EE
-07C0AB011FEC0F8080A26DEC1F0015806DEBC03E6DEBF0FC6DEBFFF86D6C5B021F5B0203
-13802A4D7ECB34>I<D93FF8913801FFC0B50207B5FCA50003ED001FC61607B3AE5FA35F
-A2017F5D173B177B6D6C14F3DC01E313F06D6CD907C3EBFFC0903A0FFFC03F836D90B512
-03010114FE6D6C13F8020701E091C7FC42377BB54B>I<B600F00107B5FCA5000101F8C8
-EA7FE06C6DED3F00A2017F163E6E157E013F167C6E15FC6D5E6F13016D5E8117036D5E6F
-13076D5E6F130F6D5E6F131F6D93C7FC815F6E6C133E177E023F147C6F13FC6E5C16816E
-5C16C3A26EEBE3E016E76E5C16FF6E5CA26E91C8FCA26F5AA36F5AA26F5AA26F5AA26F5A
-6F5A40367DB447>I<B6D8E07FB5D8C003B512C0A5000101F0C701F0C7381FF8006E027F
-ED07E06C715DA26E023F150F017F705DA26E181F013F4B6C92C7FC6E606D70143E94B5FC
-6F177E6D4A6E137C03C001F315FC6D715B160303E001E114016D020702E05B03F013C06D
-71485A160F03F8D9807F13076D05F85B93381F003F03FC160F027F4902FC5BDBFE3E011F
-131F023F04FE90C8FC167EDBFF7C010F5B6E01FCECFF3E4C6D137E6E5FA24C7F6E5F4C7F
-6E5FA24C7F6E5F4C147FA26E5F93C8123F6F5EA2033E6FC9FC5A367DB461>I<B600F001
-07B5FCA5C601F8C8EA7FE06EED3F00A26D6C153E187E013F167C6E15FC6D5E6F13016D5E
-6F13036D5E8117076D6D5C170F6D6D5C171F6D93C7FC6F5B027F143E6F137E023F147C6F
-13FCA26E6D5A16816EEBC1F016C36E5C16E76E5C16FF6E5CA26E91C8FCA36F5AA26F5AA2
-6F5AA26F5AA26F5AA35E150F5E151F93C9FC5DD81FC0133E486C137E486C137C486C13FC
-5D14015D14034A5A6C48485A49485A263FC07FCAFCEB81FE6CB45A6C13F000035BC690CB
-FC404D7DB447>121 D E
-%EndDVIPSBitmapFont
-%DVIPSBitmapFont: Fl cmr10 10.95 86
-/Fl 86 124 df<4AB4EB0FE0021F9038E03FFC913A7F00F8FC1ED901FC90383FF03FD907
-F090397FE07F80494801FF13FF4948485BD93F805C137F0200ED7F00EF003E01FE6D91C7
-FC82ADB97EA3C648C76CC8FCB3AE486C4A7E007FD9FC3FEBFF80A339407FBF35>11
-D<4AB4FC021F13C091387F01F0903901FC0078D907F0131C4948133E494813FF49485A13
-7F1400A213FE6F5A163893C7FCAA167FB8FCA33900FE00018182B3AC486CECFF80007FD9
-FC3F13FEA32F407FBF33>I<4AB47E021F13F791387F00FFEB01F8903807F001EB0FE0EB
-1FC0EB3F80137F14008101FE80AEB8FCA3C648C77EB3AE486CECFF80007FD9FC3F13FEA3
-2F407FBF33>I<4AB4ECFF80021FD9C00F13E0913B7F01F03F80F8903C01F80078FE003C
-D907F0D93FF8130E49484948131F49484948EB7F804948484913FF137F02005CA201FE92
-C7FC6FED7F0070141C96C7FCAAF13F80BBFCA3C648C76CC7FC197F193FB3AC486C4A6CEB
-7FC0007FD9FC3FD9FE1FB5FCA348407FBF4C>I<121EEA7F80EAFFC0A9EA7F80ACEA3F00
-AC121EAB120CC7FCA8121EEA7F80A2EAFFC0A4EA7F80A2EA1E000A4179C019>33
-D<001E130F397F803FC000FF137F01C013E0A201E013F0A3007F133F391E600F30000013
-00A401E01370491360A3000114E04913C00003130101001380481303000EEB070048130E
-0018130C0038131C003013181C1C7DBE2D>I<013F4C7ED9FFC04B7E2601E0E015072607
-C070150F48486C4B5A023E4BC7FC48486C5D48D90FC0EB01FE003ED90EF0EB07FCDA0F3F
-133E007E903A070FFFF8F8007C0200EBC1F0EE000300FC6D6C495A604D5A171F95C8FC17
-3E177E177C5F16015F007C4948485A1607007E5E003E49495A020E131F003F93C9FC6C49
-133E260F803C137E0238137C6C6C485B3901E0E0016CB448485AD93F0049133F90C74848
-EBFFC0030F903801E0E093398007C0704B4848487E4B153C033E90381F001C4B497F03FC
-133E4B150F4A48017E7F0203147C5D4A4801FCEB0380140F5D4AC7FC5C143E5C14FC5C49
-5A13034948027CEB07005C4948147E011F033E5B91C8140E013E153F017E6F5B017C9238
-0F803C4917380001706C5A49923801E0E0496FB45A6C48043FC7FC41497BC34C>37
-D<EC0FC0EC3FF0ECF878903801F01CEB03E049487E130FEC800F011F7FA2EB3F00A5EC80
-0EA25DA25DA25D6D6C5AECC1C0A2ECC38002E7C7387FFFFCEB0FEE14FC4A020713C06D48
-913801FE006E5DEF00F06D7E4D5A496C5D010F1503D91DFF4A5A013893C7FC496C6C5B01
-E0150E48486C6C131E00036E131C2607801F143C000F6E5B001F6D6C1370263F000714F0
-6F485A48D903FE5B913801FF03486D495A0487C8FCED7FCFED3FFE6F4814386D6D5AA200
-7F6E6C14786D6D6C14704B6C14F06C6C496C6C13E0001F91393E3FC0016C6C903AFC1FF0
-03C03D07FC07F007FC1F800001B5D8C001B512006C6C90C7EA7FFCD90FF8EC0FF03E437C
-C047>I<121EEA7F8012FF13C0A213E0A3127FEA1E601200A413E013C0A3120113801203
-13005A120E5A1218123812300B1C79BE19>I<1430147014E0EB01C0EB03801307EB0F00
-131E133E133C5B13F85B12015B1203A2485AA2120F5BA2121F90C7FCA25AA3123E127EA6
-127C12FCB2127C127EA6123E123FA37EA27F120FA27F1207A26C7EA212017F12007F1378
-7F133E131E7FEB07801303EB01C0EB00E014701430145A77C323>I<12C07E12707E7E12
-1E7E6C7E7F12036C7E7F12007F1378137CA27FA2133F7FA21480130FA214C0A3130714E0
-A6130314F0B214E01307A614C0130FA31480A2131F1400A25B133EA25BA2137813F85B12
-015B485A12075B48C7FC121E121C5A5A5A5A145A7BC323>I<EB03C0A2805CA600F0140F
-00FC143F00FE147F00FF14FF393FC3C3FC390FE187F03903F18FC03900FDBF00EB3FFCEB
-0FF0EB03C0EB0FF0EB3FFCEBFDBF3903F18FC0390FE187F0393FC3C3FC39FF03C0FF00FE
-147F00FC143F00F0140F00001400A6805CA220277AC32D>I<121EEA7F8012FF13C0A213
-E0A3127FEA1E601200A413E013C0A312011380120313005A120E5A1218123812300B1C79
-8919>44 D<B512FEA617067F961E>I<121EEA7F80A2EAFFC0A4EA7F80A2EA1E000A0A79
-8919>I<ED0180ED03C01507A21680150FA216005DA2151E153EA2153C157CA2157815F8
-A25D1401A25D1403A25D1407A25D140FA24AC7FCA2141E143EA2143C147CA2147814F8A2
-5C1301A25C1303A25C1307A25C130FA291C8FC5BA2131E133EA25BA2137813F8A25B1201
-A25B1203A25B1207A25B120FA290C9FC5AA2121E123EA2123C127CA2127812F8A25A1260
-225B7BC32D>I<EB01FE90380FFFC090383F03F090387C00F849137C48487F48487F4848
-EB0F80A2000F15C04848EB07E0A3003F15F0A290C712034815F8A64815FCB3A26C15F8A5
-6C6CEB07F0A3001F15E0A36C6CEB0FC0A26C6CEB1F80000315006C6C133E6C6C5B017C5B
-90383F03F090380FFFC0D901FEC7FC263F7DBC2D>I<EB01C013031307131F137FEA07FF
-B5FC139FEAF81F1200B3B3ACEB7FF0B612F8A31D3D78BC2D>I<EB07FC90383FFF8090B5
-12E03903F01FF83907C007FC390F0001FE001E6D7E001C1580003CEC7FC05AED3FE01270
-B4FC6DEB1FF07FA56C5A6CC7FC120CC813E0153FA216C0157F168015FF16004A5A5D4A5A
-4A5A5D4A5A4A5A4AC7FC147E147C5C495A495A495A495A49C71270133E133C5B4914E048
-5A485A485A48C7120148B6FCA25A4815C0B7FCA3243D7CBC2D>I<EB07FC90383FFF8090
-38F80FE03901E003F839078001FCD80F007F000E6D7E001E1580D81F80137F486C14C07F
-A27F5BA2121F6C5AC8138015FF1600A24A5AA24A5A5DEC07E04A5A023FC7FCEB1FFCECFF
-809038000FE0EC07F86E7E6E7E6E7E1680ED7FC0A216E0153FA216F0A2120C123F487E48
-7EA316E0A249137F6CC713C01278EDFF807E6C4913006C495A3907C007FC3903F80FF0C6
-B55A013F1380D907F8C7FC243F7CBC2D>I<150E151E153EA2157EA215FE1401A21403EC
-077E1406140E141CA214381470A214E0EB01C0A2EB0380EB0700A2130E5BA25B5BA25B5B
-1201485A90C7FC5A120E120C121C5AA25A5AB8FCA3C8EAFE00AC4A7E49B6FCA3283E7EBD
-2D>I<00061403D80780131F01F813FE90B5FC5D5D5D15C092C7FC14FCEB3FE090C9FCAC
-EB01FE90380FFF8090383E03E090387001F8496C7E49137E497F90C713800006141FC813
-C0A216E0150FA316F0A3120C127F7F12FFA416E090C7121F12FC007015C012780038EC3F
-80123C6CEC7F00001F14FE6C6C485A6C6C485A3903F80FE0C6B55A013F90C7FCEB07F824
-3F7CBC2D>I<EC1FE0ECFFF8903803F03E90380FC00F90391F000780133E017EEB1FC049
-133F4848137F12035B12074848EB3F80ED1F00001F91C7FC5BA2123FA3485AA214FE9038
-87FF8039FF8F07E090389C01F09038B800FC01B0137E13F0497F16804914C0A2ED1FE0A3
-4914F0A5127FA6123F6D14E0A2121FED3FC0A26C6C1480A20007EC7F006C6C137E6C6C5B
-6C6C485A90387E07F06DB45A010F1380D903FCC7FC243F7CBC2D>I<1238123C123F90B6
-12FCA316F85A16F016E00078C712010070EC03C0ED078016005D48141E151C153C5DC812
-7015F04A5A5D14034A5A92C7FC5C141EA25CA2147C147814F8A213015C1303A31307A313
-0F5CA2131FA6133FAA6D5A0107C8FC26407BBD2D>I<EB03FC90381FFF8090387C07E090
-38F001F83901E0007C48487F48487F48C7FCED0F80121E16C0003E1407A4123FA26DEB0F
-807F6C6C131F6D140001FC133E6C6C5B9038FF80786C6D5A6CEBF3E06CEBFF806C91C7FC
-133F6D13C06D7F013F13F801787F48486C7E3903E01FFF48486C1380260F800313C04848
-7E489038007FE0003E143F007E141F007CEC0FF01507481403A31501A46C15E0007C1403
-A2007E15C06C14076CEC0F806DEB1F006C6C133ED807F05B3901FC03F86CB512E0011F13
-80D903FCC7FC243F7CBC2D>I<EB03FCEB1FFF90387E07C09038FC03F048486C7E48486C
-7E4848137C000F147E4848137F81003F15805B007F15C0A2151F12FF16E0A516F0A5127F
-153FA36C7EA2001F147F120F6C6C13FF6D13DF000313013900F8039F90387E0F1FD91FFE
-13E0EB07F090C7FCA2ED3FC0A41680157FD80F801400487E486C13FEA24A5A5D49485AEB
-8007391E000FE0001F495A260FC07FC7FC3803FFFE6C13F838003FC0243F7CBC2D>I<12
-1EEA7F80A2EAFFC0A4EA7F80A2EA1E00C7FCB3121EEA7F80A2EAFFC0A4EA7F80A2EA1E00
-0A2779A619>I<121EEA7F80A2EAFFC0A4EA7F80A2EA1E00C7FCB3121E127FEAFF80A213
-C0A4127F121E1200A412011380A3120313005A1206120E120C121C5A1230A20A3979A619
->I<007FB912E0BA12F0A26C18E0CDFCAE007FB912E0BA12F0A26C18E03C167BA147>61
-D<EB1FF890B5FC3903E01FC0390F0007F0001EEB03F848EB01FC4814FE140000FE14FF7E
-7FA46CC7FC123EC7EA01FEA2EC03FCEC07F815F0EC0FC0EC1F80EC3F00143E5C147814F8
-5C13015CA2495AA25CAB91C7FC90C8FCA8EB0780EB1FE0A2497EA46D5AA2EB078020407B
-BF2B>63 D<15074B7EA34B7EA34B7EA34B7EA34B7E15E7A2913801C7FC15C3A291380381
-FEA34AC67EA3020E6D7EA34A6D7EA34A6D7EA34A6D7EA34A6D7EA349486D7E91B6FCA249
-819138800001A249C87EA24982010E157FA2011E82011C153FA2013C820138151FA20178
-82170F13FC00034C7ED80FFF4B7EB500F0010FB512F8A33D417DC044>65
-D<B712FCEEFF8017F00001903980000FF86C6CC7EA03FE707E701380EF7FC0EF3FE0A2EF
-1FF0A218F8A3170F171FA318F0A2EF3FE0177F18C0EFFF804C1300EE03FCEE0FF8EE7FE0
-91B6C7FC17E091C7EA07FCEE01FE933800FF80EF7FC0EF3FE0EF1FF018F8170F18FC1707
-A218FEA718FC170FA2EF1FF818F0173FEF7FE0EFFFC00403138048486C90380FFE00B85A
-17E094C7FC373E7DBD40>I<DB3FF01306912603FFFE130E020F9038FF801E913A3FF007
-E03E9139FF8000F8D903FEC7EA7C7ED907F8EC1EFE4948140FD93FE0140749481403495A
-91C812014848150012034848167E5B000F173EA24848161EA2123F5B180E127FA3491600
-12FFAC127F7F180EA2123FA27F001F171E181C6C7EA20007173C6D16386C6C1678000117
-706C6C16F06EEC01E06D6C15C06D6C1403D90FF0EC07806D6CEC1F00D903FE143E902600
-FF8013F891393FF007F0020FB512C0020391C7FC9138003FF037427BBF42>I<B712FCEE
-FF8017E000019039C0001FF86C6C48EB03FEEE00FF717E717EEF0FE084717E717E170184
-717EA21980187F19C0A3F03FE0A519F0AB19E0A5F07FC0A21980A218FF19004D5AA24D5A
-6017074D5A4D5AEF7FC04DC7FCEE03FE48486CEB1FF8B85A178004FCC8FC3C3E7DBD45>
-I<B912E0A300019038C000016C6C48EB001FEF0FF01703A217011700A31870A41838161C
-A41800A2163CA2167C16FC150391B5FCA3EC80031500167C163CA2161CA21807A3180E93
-C7FCA4181E181CA2183CA2187CA218F8170117031707171F48486CEB01FFB912F0A3383E
-7DBD3E>I<B91280A300019038C000036C6C48EB007FEF1FC0170F1707A21703A31701A4
-EF00E0A21638A31800A31678A216F81501150791B5FCA3EC8007150115001678A21638A6
-93C8FCAF3801FFE0B612F0A3333E7DBD3B>I<DB3FE0130C912603FFFE131C021F9038FF
-803C913A7FF00FC07C9139FF0001F0D903FC90380078FC4948143DD91FE0141F4948140F
-4948140701FF15034890C8FC491501485A000716005B000F177C5B001F173CA2485AA218
-1C127FA25B95C7FC12FFAB041FB512F0127FA26D9139000FFE00EF03FC123FA27F121FA2
-6C7EA212077F12036C7E7F6C7F6D6C14076D7E6D6C140FD907F8141ED903FEEC3C7C9026
-00FF80EBF83C913A7FF007F01C021FB5EAC00C020391C8FC9138003FF03C427BBF47>I<
-B6D8C01FB512F8A3000101E0C7383FFC0026007F80EC0FF0B3A691B7FCA30280C7120FB3
-A92601FFE0EC3FFCB6D8C01FB512F8A33D3E7DBD44>I<B612F0A3C6EBF000EB3FC0B3B3
-B2EBFFF0B612F0A31C3E7EBD21>I<011FB512FCA3D9000713006E5A1401B3B3A6123FEA
-7F80EAFFC0A44A5A1380D87F005B007C130700385C003C495A6C495A6C495A2603E07EC7
-FC3800FFF8EB3FC026407CBD2F>I<B600C090387FFFFCA3000101E0C7000F138026007F
-80913807FE0018F818E0604D5A4DC7FC173E5F5F4C5A4C5A4C5A4C5A4CC8FC163E5E5E4B
-5A4B5AED07804B7E151F4B7E4B7E15FF913881EFF8913883C7FCEC878791388F03FE9138
-9E01FF14BCDAF8007F4A6D7E5C4A6D7E4A6D7EA2707E707EA2707E707EA2707F717E8417
-3F717E717EA2717E848419802601FFE04A13C0B600C090B6FCA3403E7DBD47>I<B612F8
-A3000101E0C9FC38007F80B3B0EF0380A517071800A45FA35FA25F5F5F4C5A160748486C
-133FB8FCA3313E7DBD39>I<B500C093383FFFF0A300016D93387FF800D8007F18E0D977
-F016EFA3D973F8ED01CFA2D971FCED038FA3D970FEED070FA26E150E80A26E6C141CA36E
-6C1438A26E6C1470A36E6C14E0A26E6CEB01C0A36E6CEB0380A36E6CEB0700A2037F130E
-A36F6C5AA26F6C5AA36F6C5AA25FED07F0A2923803F9C0A36FB45AA26F90C7FCA213F848
-6C147ED807FFEF3FF8B500F8013C011FB512F0A34C3E7DBD53>I<B56C91B512F88080D8
-007F030713006EEC01FC6E6E5A1870EB77FCEB73FEA2EB71FF01707FA26E7E6E7EA26E7E
-6E7EA26E7E6E7EA26E7E6E7FA26F7E6F7EA26F7E6F7EA26F7E6F7EA26F7E6F1380A2EE7F
-C0EE3FE0A2EE1FF0EE0FF8A2EE07FCEE03FEA2EE01FF7013F0A2177F173FA2171F170FA2
-170701F81503487ED807FF1501B500F81400A218703D3E7DBD44>I<ED7FE0913807FFFE
-91391FC03F8091397E0007E04948EB03F8D907F0EB00FE4948147F49486E7E49486E7E49
-C86C7E01FE6F7E00018349150300038348486F7EA248486F7EA2001F188049167F003F18
-C0A3007F18E049163FA300FF18F0AC007F18E06D167FA4003F18C0A26C6CEEFF80A36C6C
-4B1300A26C6C4B5A00035F6D150700015F6C6C4B5A6D5E6D6C4A5A6D6C4A5A6D6C4AC7FC
-6D6C14FED901FCEB03F8D9007FEB0FE091391FC03F80912607FFFEC8FC9138007FE03C42
-7BBF47>I<B712F8EEFF8017E000019039C0003FF86C6C48EB07FCEE01FE707EEF7F80EF
-3FC018E0A2EF1FF0A218F8A818F0A2EF3FE0A218C0EF7F80EFFF004C5AEE07FCEE3FF091
-B612C04CC7FC0280C9FCB3A73801FFE0B612C0A3353E7DBD3E>I<ED7FE0913807FFFE91
-391FC03F8091397F000FE0D901FCEB03F8D907F0EB00FE4948147F49486E7E49486E7E49
-C86C7E498248486F7E49150300038348486F7EA2000F834981001F1880A24848EE7FC0A3
-007F18E0A249163FA200FF18F0AC007F18E0A26D167FA3003F18C0A26C6CEEFF80A3000F
-18006D5D0007DA0F805B6C6C90393FE003FCED70706C6C496C485A6C6C48486C485A017F
-D9800E5BD93F819038061FC0D91FC19038073F80D90FE14AC7FCD907F1EB03FE902601FD
-C013F8903A007EE007E091271FF03FC013180207B5FC9139007FE1E0DB00011438837113
-78A2706C13F0EFFF0318FFA27113E0A37113C0711380711300715AEF01F83D527BBF47>
-I<B712C016FCEEFF800001D9C00013E06C6C48EB1FF0EE07FCEE01FE707E84717EA2717E
-A284A760177F606017FF95C7FCEE01FCEE07F8EE1FE0EEFF8091B500FCC8FC16F0913880
-01FCED003FEE1FC0707E707E83160383160183A383A484A4F0C004190EA28218E0057F13
-1E2601FFE0161CB600C0EB3FF094381FF83805071370CA3801FFE09438003F803F407DBD
-43>I<D907FC130C90391FFF801C017FEBF03C3901FC03F83A03F0007E7CD807C0EB1FFC
-4848130F001F140748C71203003E1401007E1400A2007C157C12FCA2163CA36C151CA27E
-A26C6C14007F7FEA3FF8EBFF806C13F86CEBFF806C14F06C14FC6C14FF6C15C0013F14E0
-010714F0EB007F020713F89138007FFC150FED07FE15031501ED00FFA200E0157FA3163F
-A27EA3163E7E167E6C157C6C15FC6C15F86D13016DEB03F06DEB07E0D8F9FCEB0FC03AF0
-7F803F8090391FFFFE00D8E00713F839C0007FC028427BBF33>I<003FB91280A3903AF0
-007FE001018090393FC0003F48C7ED1FC0007E1707127C00781703A300701701A548EF00
-E0A5C81600B3B14B7E4B7E0107B612FEA33B3D7DBC42>I<B600C090B512F8A3000101E0
-C70007130026007F80EC01FC715A1870B3B3A4013F16F06E5DA21701011F5E80010F1503
-6E4A5A010793C7FC6D6C5C6D6C141E6D6C5C027F14F86E6C485A91390FF00FE00203B512
-80020049C8FCED1FF03D407DBD44>I<B691380FFFFEA3000301E0020113E06C01809138
-007F806CEF3F00017F163E181C6E153C013F1638A26E1578011F1670A26D6C5DA26E1401
-01075EA26E140301035EA26D6C4AC7FCA2806D150EA26F131E027F141CA26F133C023F14
-38A26E6C5BA26F13F0020F5CA2EDF80102075CA26E6C485AA2EDFE07020191C8FCA26F5A
-6E130EA2ED7F9CA216DCED3FF8A36F5AA36F5AA26F5AA36F5A3F407EBD44>I<B500FE01
-7FB5D88007B5FCA3000301C0010101E0C713F86C90C849EC3FE07148EC0F807E7215006E
-143F017F190E84A26D6C60A24D7E6D6C60A2EFE7F86D6C60A2933801C3FC6E18F0010761
-04037F6E0281140101036104077F17006D6C4D5AA2040EEB7F806D6C4DC7FCA24CEB3FC0
-DA7F80160EA24CEB1FE003C0161E023F171C047814F0DBE070010F133C021F173804F014
-F84C1307DA0FF05EA2DBF1C0EB03FCDA07F95EA2DBFB80EB01FEDA03FF6F5AA293C8FCA2
-6E5FA24B157F020094C8FCA24B81037C153EA20378151E0338151C58407EBD5D>I<007F
-B5D8C003B512E0A3C649C7EBFC00D93FF8EC3FE06D48EC1F806D6C92C7FC171E6D6C141C
-6D6C143C5F6D6C14706D6D13F04C5ADA7FC05B023F13036F485ADA1FF090C8FC020F5BED
-F81E913807FC1C163C6E6C5A913801FF7016F06E5B6F5AA26F7E6F7EA28282153FED3BFE
-ED71FF15F103E07F913801C07F0203804B6C7EEC07004A6D7E020E6D7E5C023C6D7E0238
-6D7E14784A6D7E4A6D7F130149486E7E4A6E7E130749C86C7E496F7E497ED9FFC04A7E00
-076DEC7FFFB500FC0103B512FEA33F3E7EBD44>I<B66C0103B51280A3000101F0C8EBF8
-006C6C48ED3FC0725A013F041EC7FC6D7E606D6C15386D6C1578606D6C5D6E14016D5E6D
-6D1303606E6C49C8FC6E6C5B170E6E6C131E171C6E6C5B6E6C137817706E6C13F06F5B6E
-13016EEB83C05FED7FC7DB3FE7C9FC16EFED1FFE5E150F6F5AB3A4ED1FFC020FB512FCA3
-413E7FBD44>I<003FB712F8A391C7EA1FF013F801E0EC3FE00180EC7FC090C8FC003EED
-FF80A2003C4A1300007C4A5A12784B5A4B5AA200704A5AA24B5A4B5AA2C8485A4A90C7FC
-A24A5A4A5AA24A5AA24A5A4A5AA24A5A4A5AA24990C8FCA2495A4948141CA2495A495AA2
-495A495A173C495AA24890C8FC485A1778485A484815F8A24848140116034848140F4848
-143FED01FFB8FCA32E3E7BBD38>I<EAFFFCA4EAF000B3B3B3B3ABEAFFFCA40E5B77C319>
-I<486C13C00003130101001380481303000EEB070048130E0018130C0038131C00301318
-0070133800601330A300E01370481360A400CFEB678039FFC07FE001E013F0A3007F133F
-A2003F131F01C013E0390F0007801C1C73BE2D>I<EAFFFCA4EA003CB3B3B3B3ABEAFFFC
-A40E5B7FC319>I<EB0FF8EBFFFE3903F01F8039078007E0000F6D7E9038E001F8D81FF0
-7F6E7EA3157F6C5AEA0380C8FCA4EC1FFF0103B5FC90381FF87FEB7F803801FC00EA07F8
-EA0FE0485A485AA248C7FCEE038012FEA315FFA3007F5BEC03BF3B3F80071F8700261FC0
-0E13CF3A07F03C0FFE3A01FFF807FC3A003FC001F0292A7DA82D>97
-D<EA01FC12FFA3120712031201B1EC03FC91381FFF8091387C07E09039FDE001F09039FF
-C000FC4A137E91C77E49158049141F17C0EE0FE0A217F0A2160717F8AA17F0A2160FA217
-E0161F17C06D1580EE3F006D5C6E13FE9039F3C001F89039F1E003F09039E0780FC09026
-C03FFFC7FCC7EA07F82D407EBE33>I<49B4FC010F13E090383F00F8017C131E4848131F
-4848137F0007ECFF80485A5B121FA24848EB7F00151C007F91C7FCA290C9FC5AAB6C7EA3
-003FEC01C07F001F140316806C6C13076C6C14000003140E6C6C131E6C6C137890383F01
-F090380FFFC0D901FEC7FC222A7DA828>I<ED01FC15FFA3150715031501B114FF010713
-E190381F80F990387E003D49131FD803F81307485A49130348481301121F123F5B127FA2
-90C7FCA25AAA7E7FA2123FA26C7E000F14037F000714076C6C497E6C6C497ED8007C0179
-13F890383F01F190380FFFC1903A01FE01FC002D407DBE33>I<EB01FE90380FFFC09038
-3F03F09038FC01F848486C7E4848137E48487F000F158049131F001F15C04848130FA212
-7F16E090C7FCA25AA290B6FCA290C9FCA67EA27F123F16E06C7E1501000F15C06C6C1303
-6DEB07806C6C1400C66C131E017E5B90381F80F8903807FFE0010090C7FC232A7EA828>
-I<EC1FC0EC7FF8903801F83C903807E07E90380FC0FFEB1FC1EB3F811401137FEC00FE01
-FE137C1500AEB6FCA3C648C7FCB3AE487E007F13FFA320407EBF1C>I<167C903903F801
-FF903A1FFF078F8090397E0FDE1F9038F803F83803F001A23B07E000FC0600000F6EC7FC
-49137E001F147FA8000F147E6D13FE00075C6C6C485AA23901F803E03903FE0FC026071F
-FFC8FCEB03F80006CAFC120EA3120FA27F7F6CB512E015FE6C6E7E6C15E06C810003813A
-0FC0001FFC48C7EA01FE003E140048157E825A82A46C5D007C153E007E157E6C5D6C6C49
-5A6C6C495AD803F0EB0FC0D800FE017FC7FC90383FFFFC010313C0293D7EA82D>I<EA01
-FC12FFA3120712031201B1EC01FE913807FFC091381E07E091387803F09138E001F8D9FD
-C07F148001FF6D7E91C7FCA25BA25BB3A6486C497EB5D8F87F13FCA32E3F7DBE33>I<EA
-01E0EA07F8A2487EA46C5AA2EA01E0C8FCACEA01FC127FA3120712031201B3AC487EB512
-F0A3143E7DBD1A>I<1478EB01FEA2EB03FFA4EB01FEA2EB00781400AC147FEB7FFFA313
-017F147FB3B3A5123E127F38FF807E14FEA214FCEB81F8EA7F01387C03F0381E07C0380F
-FF803801FC00185185BD1C>I<EA01FC12FFA3120712031201B292B51280A392383FFC00
-16E0168093C7FC153C5D5D4A5AEC07C04A5A4AC8FC143E147F4A7E13FD9038FFDFC0EC9F
-E0140F496C7E01FC7F496C7E1401816E7E81826F7E151F826F7EA282486C14FEB539F07F
-FFE0A32B3F7EBE30>I<EA01FC12FFA3120712031201B3B3B1487EB512F8A3153F7DBE1A>
-I<2701F801FE14FF00FF902707FFC00313E0913B1E07E00F03F0913B7803F03C01F80007
-903BE001F87000FC2603F9C06D487F000101805C01FBD900FF147F91C75B13FF4992C7FC
-A2495CB3A6486C496CECFF80B5D8F87FD9FC3F13FEA347287DA74C>I<3901F801FE00FF
-903807FFC091381E07E091387803F000079038E001F82603F9C07F0001138001FB6D7E91
-C7FC13FF5BA25BB3A6486C497EB5D8F87F13FCA32E287DA733>I<14FF010713E090381F
-81F890387E007E01F8131F4848EB0F804848EB07C04848EB03E0000F15F04848EB01F8A2
-003F15FCA248C812FEA44815FFA96C15FEA36C6CEB01FCA3001F15F86C6CEB03F0A26C6C
-EB07E06C6CEB0FC06C6CEB1F80D8007EEB7E0090383F81FC90380FFFF0010090C7FC282A
-7EA82D>I<3901FC03FC00FF90381FFF8091387C0FE09039FDE003F03A03FFC001FC6C49
-6C7E91C7127F49EC3F805BEE1FC017E0A2EE0FF0A3EE07F8AAEE0FF0A4EE1FE0A2EE3FC0
-6D1580EE7F007F6E13FE9138C001F89039FDE007F09039FC780FC0DA3FFFC7FCEC07F891
-C9FCAD487EB512F8A32D3A7EA733>I<02FF131C0107EBC03C90381F80F090397F00387C
-01FC131CD803F8130E4848EB0FFC150748481303121F485A1501485AA448C7FCAA6C7EA3
-6C7EA2001F14036C7E15076C6C130F6C7E6C6C133DD8007E137990383F81F190380FFFC1
-903801FE0190C7FCAD4B7E92B512F8A32D3A7DA730>I<3901F807E000FFEB1FF8EC787C
-ECE1FE3807F9C100031381EA01FB1401EC00FC01FF1330491300A35BB3A5487EB512FEA3
-1F287EA724>I<90383FC0603901FFF8E03807C03F381F000F003E1307003C1303127C00
-78130112F81400A27E7E7E6D1300EA7FF8EBFFC06C13F86C13FE6C7F6C1480000114C0D8
-003F13E0010313F0EB001FEC0FF800E01303A214017E1400A27E15F07E14016C14E06CEB
-03C0903880078039F3E01F0038E0FFFC38C01FE01D2A7DA824>I<131CA6133CA4137CA2
-13FCA2120112031207001FB512C0B6FCA2D801FCC7FCB3A215E0A912009038FE01C0A2EB
-7F03013F138090381F8700EB07FEEB01F81B397EB723>I<D801FC14FE00FF147FA30007
-14030003140100011400B3A51501A31503120015076DEB06FF017E010E13806D4913FC90
-381FC078903807FFE00100903880FE002E297DA733>I<B539E00FFFE0A32707FE000313
-006C48EB00FC5E00015D7F00005DA26D13016D5CA26D6C485AA2ECC007011F91C7FCA290
-380FE00EA2ECF01E0107131CA26D6C5AA2ECFC7801011370A2ECFEF001005BA2EC7FC0A3
-6E5AA26EC8FCA3140E2B287EA630>I<B53BC3FFFE03FFF8A3290FFE003FE00013C06C48
-6D48EB3F806C4817006D010F141E00016F131C15076D163C00004A6C1338A2017F5E4B7E
-151DD93F805DED3DFC1538D91FC04A5AED78FE9238707E03D90FE0017F5BEDE03F02F014
-0701070387C7FC9138F1C01F02F9148F010315CE9138FB800F02FF14DE6D15FCED00076D
-5DA24A1303027E5CA2027C1301023C5C023813003D287EA642>I<B539F01FFFE0A30003
-D9C00F1300C690388007F8D97F0013E002805BD93FC05B011F49C7FC90380FE00EECF01E
-6D6C5A01035B6D6C5A6E5AEB00FF6E5A6E5A81141F814A7E81147BECF1FC903801E1FEEC
-C0FF01037F49486C7ED90F007F011E6D7E013E130F496D7E01FC80486C80000F4A7EB539
-803FFFF8A32D277FA630>I<B539E00FFFE0A32707FE000313006C48EB01FC6F5A00015D
-7F00005DA2017F495AA2EC8003013F5CA26D6C48C7FCA26E5A010F130EA26D6C5AA2ECF8
-3C01031338A26D6C5AA2ECFEF001005BA2EC7FC0A36E5AA36EC8FCA2140EA2141E141C14
-3C1438A2147800181370127EB45BA2495AA248485AD87E07C9FCEA780EEA3C3CEA1FF8EA
-07E02B3A7EA630>I<001FB61280A2EBE0000180140049485A001E495A121C4A5A003C49
-5A141F00385C4A5A147F5D4AC7FCC6485AA2495A495A130F5C495A90393FC00380A2EB7F
-80EBFF005A5B484813071207491400485A48485BA248485B4848137F00FF495A90B6FCA2
-21277EA628>I<B812F0A22C0280982D>I E
-%EndDVIPSBitmapFont
-%DVIPSBitmapFont: Fm cmbx12 20.736 9
-/Fm 9 123 df<92380FFFE04AB67E020F15F0027F15FE49B87E4917E0010F17F8013F83
-49D9C01F14FF9027FFFC0001814801E06D6C80480180021F804890C86C8048486F804848
-6F8001FF6F804801C06E8002F081486D18806E816E18C0B5821BE06E81A37214F0A56C5B
-A36C5B6C5B6C5B000313C0C690C9FC90CA15E060A34E14C0A21B80601B0060626295B55A
-5F624D5C624D5C4D91C7FC614D5B4D13F04D5B6194B55A4C49C8FC4C5B4C5B4C13E04C5B
-604C90C9FCEE7FFC4C5A4B5B4B5B4B0180EC0FF04B90C8FC4B5A4B5A4B48ED1FE0EDFFE0
-4A5B4A5B4A90C9FC4A48163F4A5ADA3FF017C05D4A48167F4A5A4990CA12FFD903FC1607
-49BAFC5B4919805B5B90BBFC5A5A5A5A481A005A5ABCFCA462A44C7176F061>50
-D<92383FFFF80207B612E0027F15FC49B87E010717E0011F83499026F0007F13FC4948C7
-000F7F90B502036D7E486E6D806F6D80727F486E6E7F8486727FA28684A26C5C72806C5C
-6D90C8FC6D5AEB0FF8EB03E090CAFCA70507B6FC041FB7FC0303B8FC157F0203B9FC021F
-ECFE0391B612800103ECF800010F14C04991C7FC017F13FC90B512F04814C0485C4891C8
-FC485B5A485B5C5A5CA2B5FC5CA360A36E5DA26C5F6E5D187E6C6D846E4A48806C6D4A48
-14FC6C6ED90FF0ECFFFC6C02E090263FE07F14FE00019139FC03FFC06C91B6487E013F4B
-487E010F4B1307010303F01301D9003F0280D9003F13FC020101F8CBFC57507ACE5E>97
-D<903801FFFCB6FCA8C67E131F7FB3ADF0FFFC050FEBFFE0057F14FE0403B77E040F16E0
-043F16F84CD9007F13FE9226FDFFF001077F92B500C001018094C86C13E004FC6F7F4C6F
-7F04E06F7F4C6F7F5E747F93C915804B7014C0A27414E0A21DF087A21DF8A31DFC87A41D
-FEAF1DFCA4631DF8A31DF098B5FC1DE0A25014C0A26F1980501400705D705F704B5B505B
-704B5B04FC4B5BDBE7FE92B55A9226C3FF8001035C038101E0011F49C7FC9226807FFC90
-B55A4B6CB712F04A010F16C04A010393C8FC4A010015F84A023F14C090C9000301F0C9FC
-5F797AF76C>I<97380FFFE00607B6FCA8F00003190086B3AD93383FFF800307B512F803
-3F14FF4AB712C0020716F0021F16FC027F9039FE007FFE91B500F0EB0FFF010302800101
-90B5FC4949C87E49498149498149498149498190B548814884484A8192CAFC5AA2485BA2
-5A5C5AA35A5CA4B5FCAF7EA4807EA37EA2807EA26C7F616C6E5D6C606C80616D6D5D6D6D
-5D6D6D92B67E6D6D4A15FC010301FF0207EDFFFE6D02C0EB3FFE6D6C9039FC01FFF86E90
-B65A020F16C002031600DA007F14FC030F14E09226007FFEC749C7FC5F797AF76C>100
-D<EB01FCEB07FF011F13C0497F497F90B57EA24880A24880A76C5CA26C5CA26D5B6D5B6D
-5B010790C8FCEB01FC90CAFCB2903801FFFC007FB5FCA8C67E131F7FB3B3B3A5B81280A8
-297979F835>105 D<903801FFFCB6FCA8C67E131F7FB3B3B3B3B3ABB812C0A82A7879F7
-35>108 D<902601FFF891380FFFE0B692B512FE05036E7E050F15E0053F15F84D819327
-01FFF01F7F4CD900077FDC07FC6D80C66CDA0FF06D80011FDA1FC07F6D4A48824CC8FC04
-7E6F7F5EEDF9F85E03FB707F5E15FF5EA25EA293C9FCA45DB3B3A6B8D8E003B81280A861
-4E79CD6C>110 D<902601FFFCEC7FFEB6020FB512F0057F14FE4CB712C0040716F0041F
-82047F16FE93B5C66C7F92B500F0010F14C0C66C0380010380011F4AC76C806D4A6E8004
-F06F7F4C6F7F4C6F7F4C8193C915804B7014C0861DE0A27414F0A27414F8A47513FCA575
-13FEAF5113FCA598B512F8A31DF0621DE0621DC0621D806F5E701800704B5B505B704B5B
-7092B55A04FC4A5C704A5C706C010F5C05E0013F49C7FC9227FE7FFC01B55A70B712F004
-0F16C0040393C8FC040015F8053F14C0050301F0C9FC94CCFCB3A6B812E0A85F6F7ACD6C
->112 D<0007BA12FC1AFEA503E0C714FC4AC74814F84801F04A14F05C02804A14E091C8
-4814C04D14805B494B14004D5B4992B55AA24C5C494A5C615E4C5C001F4B5C5B4C91C7FC
-4C5B93B55AA24B5CC8485C4B5CA24B5C4B5C4B91C8FCA24B5B92B55AA24A5C4A5C4A4A14
-FFA24A5C4A5C4A91C8FC614A4915FE91B55A495CA2495C494A14035E5B495C4991C81207
-A24949ED0FFC90B55A484A151FA2484A153F484A157F484A15FF1803484A140F4891C812
-3F48490207B5FC91B9FCBB12F8A57E484D7BCC56>122 D E
-%EndDVIPSBitmapFont
-end
-%%EndProlog
-%%BeginSetup
-%%Feature: *Resolution 600dpi
-TeXDict begin
-%%PaperSize: A4
-
-%%EndSetup
-%%Page: 1 1
-1 0 bop 150 1318 a Fm(bzip2)64 b(and)g(libbzip2)p 150
-1418 3600 34 v 2010 1515 a Fl(a)31 b(program)f(and)g(library)e(for)i
-(data)h(compression)2198 1623 y(cop)m(yrigh)m(t)f(\(C\))h(1996-2000)j
-(Julian)28 b(Sew)m(ard)2605 1731 y(v)m(ersion)i(1.0)h(of)g(21)g(Marc)m
-(h)g(2000)150 5091 y Fk(Julian)46 b(Sew)l(ard)p 150 5141
-3600 17 v eop
-%%Page: 1 2
-1 1 bop 3705 -116 a Fl(1)150 299 y(This)24 b(program,)j
-Fj(bzip2)p Fl(,)e(and)g(asso)s(ciated)i(library)c Fj(libbzip2)p
-Fl(,)i(are)h(Cop)m(yrigh)m(t)g(\(C\))g(1996-2000)j(Julian)150
-408 y(R)h(Sew)m(ard.)40 b(All)29 b(righ)m(ts)h(reserv)m(ed.)150
-565 y(Redistribution)f(and)i(use)h(in)f(source)h(and)g(binary)e(forms,)
-j(with)e(or)h(without)f(mo)s(di\014cation,)g(are)i(p)s(er-)150
-675 y(mitted)d(pro)m(vided)f(that)i(the)f(follo)m(wing)f(conditions)g
-(are)i(met:)225 832 y Fi(\017)60 b Fl(Redistributions)26
-b(of)k(source)g(co)s(de)g(m)m(ust)g(retain)f(the)h(ab)s(o)m(v)m(e)h
-(cop)m(yrigh)m(t)g(notice,)f(this)f(list)f(of)i(con-)330
-941 y(ditions)e(and)i(the)h(follo)m(wing)e(disclaimer.)225
-1076 y Fi(\017)60 b Fl(The)33 b(origin)f(of)h(this)f(soft)m(w)m(are)j
-(m)m(ust)e(not)h(b)s(e)e(misrepresen)m(ted;)i(y)m(ou)g(m)m(ust)f(not)g
-(claim)g(that)h(y)m(ou)330 1185 y(wrote)d(the)h(original)d(soft)m(w)m
-(are.)44 b(If)31 b(y)m(ou)g(use)g(this)f(soft)m(w)m(are)i(in)e(a)h(pro)
-s(duct,)g(an)f(ac)m(kno)m(wledgmen)m(t)330 1295 y(in)f(the)i(pro)s
-(duct)e(do)s(cumen)m(tation)h(w)m(ould)f(b)s(e)h(appreciated)g(but)g
-(is)f(not)i(required.)225 1429 y Fi(\017)60 b Fl(Altered)21
-b(source)g(v)m(ersions)f(m)m(ust)h(b)s(e)f(plainly)e(mark)m(ed)j(as)g
-(suc)m(h,)i(and)d(m)m(ust)h(not)g(b)s(e)f(misrepresen)m(ted)330
-1539 y(as)31 b(b)s(eing)e(the)h(original)f(soft)m(w)m(are.)225
-1674 y Fi(\017)60 b Fl(The)27 b(name)h(of)f(the)h(author)f(ma)m(y)h
-(not)g(b)s(e)f(used)g(to)h(endorse)f(or)h(promote)g(pro)s(ducts)e
-(deriv)m(ed)g(from)330 1783 y(this)j(soft)m(w)m(are)j(without)d(sp)s
-(eci\014c)h(prior)e(written)i(p)s(ermission.)150 1965
-y(THIS)37 b(SOFTW)-10 b(ARE)38 b(IS)f(PR)m(O)m(VIDED)i(BY)g(THE)f(A)m
-(UTHOR)g(\\AS)g(IS")g(AND)h(ANY)f(EXPRESS)150 2074 y(OR)31
-b(IMPLIED)h(W)-10 b(ARRANTIES,)31 b(INCLUDING,)i(BUT)f(NOT)f(LIMITED)g
-(TO,)h(THE)f(IMPLIED)150 2184 y(W)-10 b(ARRANTIES)27
-b(OF)h(MER)m(CHANT)-8 b(ABILITY)28 b(AND)g(FITNESS)f(F)m(OR)g(A)h(P)-8
-b(AR)g(TICULAR)28 b(PUR-)150 2294 y(POSE)37 b(ARE)g(DISCLAIMED.)h(IN)f
-(NO)h(EVENT)f(SHALL)g(THE)g(A)m(UTHOR)h(BE)g(LIABLE)g(F)m(OR)150
-2403 y(ANY)56 b(DIRECT,)f(INDIRECT,)h(INCIDENT)-8 b(AL,)56
-b(SPECIAL,)e(EXEMPLAR)-8 b(Y,)57 b(OR)e(CONSE-)150 2513
-y(QUENTIAL)48 b(D)m(AMA)m(GES)i(\(INCLUDING,)g(BUT)f(NOT)f(LIMITED)g
-(TO,)g(PR)m(OCUREMENT)150 2622 y(OF)35 b(SUBSTITUTE)e(GOODS)i(OR)f(SER)
--10 b(VICES;)34 b(LOSS)f(OF)i(USE,)g(D)m(A)-8 b(T)g(A,)36
-b(OR)f(PR)m(OFITS;)f(OR)150 2732 y(BUSINESS)28 b(INTERR)m(UPTION\))g
-(HO)m(WEVER)i(CA)m(USED)f(AND)g(ON)g(ANY)g(THEOR)-8 b(Y)29
-b(OF)g(LIA-)150 2842 y(BILITY,)36 b(WHETHER)g(IN)g(CONTRA)m(CT,)g
-(STRICT)e(LIABILITY,)i(OR)g(TOR)-8 b(T)35 b(\(INCLUDING)150
-2951 y(NEGLIGENCE)45 b(OR)g(OTHER)-10 b(WISE\))44 b(ARISING)h(IN)g(ANY)
-h(W)-10 b(A)i(Y)46 b(OUT)e(OF)i(THE)e(USE)h(OF)150 3061
-y(THIS)29 b(SOFTW)-10 b(ARE,)31 b(EVEN)f(IF)g(AD)m(VISED)i(OF)e(THE)g
-(POSSIBILITY)e(OF)j(SUCH)f(D)m(AMA)m(GE.)150 3218 y(Julian)e(Sew)m
-(ard,)i(Cam)m(bridge,)g(UK.)150 3374 y Fj(jseward@acm.org)150
-3531 y(http://sourceware.cygnus)o(.com)o(/bzi)o(p2)150
-3688 y(http://www.cacheprof.org)150 3845 y(http://www.muraroa.demon)o
-(.co.)o(uk)150 4002 y(bzip2)p Fl(/)p Fj(libbzip2)d Fl(v)m(ersion)j(1.0)
-i(of)e(21)h(Marc)m(h)g(2000.)150 4159 y(P)-8 b(A)g(TENTS:)40
-b(T)-8 b(o)40 b(the)g(b)s(est)g(of)g(m)m(y)g(kno)m(wledge,)j
-Fj(bzip2)38 b Fl(do)s(es)i(not)g(use)g(an)m(y)g(paten)m(ted)h
-(algorithms.)150 4268 y(Ho)m(w)m(ev)m(er,)33 b(I)e(do)f(not)h(ha)m(v)m
-(e)h(the)f(resources)g(a)m(v)-5 b(ailable)30 b(to)h(carry)g(out)g(a)g
-(full)d(paten)m(t)k(searc)m(h.)42 b(Therefore)150 4378
-y(I)30 b(cannot)h(giv)m(e)g(an)m(y)g(guaran)m(tee)h(of)e(the)h(ab)s(o)m
-(v)m(e)g(statemen)m(t.)p eop
-%%Page: 2 3
-2 2 bop 150 -116 a Fl(Chapter)30 b(1:)41 b(In)m(tro)s(duction)2591
-b(2)150 299 y Fh(1)80 b(In)l(tro)t(duction)150 555 y
-Fj(bzip2)20 b Fl(compresses)h(\014les)f(using)g(the)h(Burro)m
-(ws-Wheeler)g(blo)s(c)m(k-sorting)f(text)j(compression)d(algorithm,)150
-665 y(and)33 b(Hu\013man)g(co)s(ding.)50 b(Compression)32
-b(is)h(generally)g(considerably)f(b)s(etter)i(than)f(that)h(ac)m(hiev)m
-(ed)h(b)m(y)150 775 y(more)f(con)m(v)m(en)m(tional)g(LZ77/LZ78-based)g
-(compressors,)g(and)f(approac)m(hes)h(the)f(p)s(erformance)g(of)h(the)
-150 884 y(PPM)c(family)f(of)i(statistical)f(compressors.)150
-1041 y Fj(bzip2)k Fl(is)h(built)e(on)i(top)h(of)g Fj(libbzip2)p
-Fl(,)e(a)i(\015exible)e(library)f(for)i(handling)e(compressed)i(data)i
-(in)d(the)150 1151 y Fj(bzip2)c Fl(format.)43 b(This)30
-b(man)m(ual)g(describ)s(es)g(b)s(oth)g(ho)m(w)i(to)g(use)f(the)g
-(program)g(and)g(ho)m(w)g(to)h(w)m(ork)f(with)150 1260
-y(the)d(library)d(in)m(terface.)41 b(Most)28 b(of)g(the)g(man)m(ual)f
-(is)g(dev)m(oted)i(to)f(this)f(library)-8 b(,)26 b(not)i(the)g
-(program,)g(whic)m(h)150 1370 y(is)h(go)s(o)s(d)i(news)e(if)h(y)m(our)g
-(in)m(terest)h(is)e(only)g(in)h(the)g(program.)150 1527
-y(Chapter)24 b(2)g(describ)s(es)f(ho)m(w)h(to)h(use)f
-Fj(bzip2)p Fl(;)h(this)e(is)g(the)i(only)e(part)h(y)m(ou)h(need)f(to)h
-(read)f(if)f(y)m(ou)h(just)g(w)m(an)m(t)150 1636 y(to)35
-b(kno)m(w)f(ho)m(w)g(to)g(op)s(erate)h(the)f(program.)51
-b(Chapter)34 b(3)g(describ)s(es)e(the)i(programming)f(in)m(terfaces)h
-(in)150 1746 y(detail,)23 b(and)d(Chapter)h(4)h(records)f(some)h
-(miscellaneous)e(notes)i(whic)m(h)e(I)h(though)m(t)h(ough)m(t)g(to)g(b)
-s(e)f(recorded)150 1855 y(somewhere.)p eop
-%%Page: 3 4
-3 3 bop 150 -116 a Fl(Chapter)30 b(2:)41 b(Ho)m(w)31
-b(to)g(use)f Fj(bzip2)2375 b Fl(3)150 299 y Fh(2)80 b(Ho)l(w)53
-b(to)g(use)g Fg(bzip2)150 566 y Fl(This)29 b(c)m(hapter)i(con)m(tains)f
-(a)h(cop)m(y)g(of)g(the)f Fj(bzip2)f Fl(man)h(page,)h(and)f(nothing)g
-(else.)390 818 y Ff(NAME)570 1004 y Fj(bzip2)p Fl(,)f
-Fj(bunzip2)g Fl(-)h(a)h(blo)s(c)m(k-sorting)f(\014le)f(compressor,)i
-(v1.0)570 1136 y Fj(bzcat)e Fl(-)i(decompresses)f(\014les)f(to)i
-(stdout)570 1267 y Fj(bzip2recover)c Fl(-)k(reco)m(v)m(ers)h(data)f
-(from)f(damaged)g(bzip2)g(\014les)390 1519 y Ff(SYNOPSIS)570
-1706 y Fj(bzip2)f Fl([)h(-cdfkqstvzVL123456789)35 b(])c([)g
-(\014lenames)e(...)41 b(])570 1837 y Fj(bunzip2)28 b
-Fl([)j(-fkvsVL)f(])h([)f(\014lenames)g(...)41 b(])570
-1968 y Fj(bzcat)29 b Fl([)h(-s)h(])g([)f(\014lenames)g(...)41
-b(])570 2100 y Fj(bzip2recover)27 b Fl(\014lename)390
-2352 y Ff(DESCRIPTION)390 2538 y Fj(bzip2)i Fl(compresses)i(\014les)f
-(using)f(the)i(Burro)m(ws-Wheeler)g(blo)s(c)m(k)f(sorting)g(text)i
-(compres-)390 2642 y(sion)40 b(algorithm,)j(and)d(Hu\013man)h(co)s
-(ding.)71 b(Compression)40 b(is)g(generally)g(considerably)390
-2746 y(b)s(etter)25 b(than)g(that)h(ac)m(hiev)m(ed)g(b)m(y)f(more)g
-(con)m(v)m(en)m(tional)h(LZ77/LZ78-based)g(compressors,)390
-2850 y(and)k(approac)m(hes)h(the)f(p)s(erformance)g(of)h(the)f(PPM)g
-(family)f(of)i(statistical)f(compressors.)390 3001 y(The)e
-(command-line)e(options)i(are)h(delib)s(erately)d(v)m(ery)i(similar)e
-(to)j(those)g(of)f(GNU)h Fj(gzip)p Fl(,)390 3104 y(but)h(they)g(are)h
-(not)g(iden)m(tical.)390 3255 y Fj(bzip2)f Fl(exp)s(ects)h(a)g(list)f
-(of)h(\014le)f(names)h(to)h(accompan)m(y)h(the)e(command-line)e
-(\015ags.)43 b(Eac)m(h)390 3359 y(\014le)e(is)h(replaced)g(b)m(y)g(a)h
-(compressed)f(v)m(ersion)g(of)g(itself,)i(with)e(the)g(name)g
-Fj(original_)390 3463 y(name.bz2)p Fl(.)49 b(Eac)m(h)34
-b(compressed)g(\014le)f(has)g(the)h(same)g(mo)s(di\014cation)e(date,)k
-(p)s(ermissions,)390 3567 y(and,)24 b(when)f(p)s(ossible,)f(o)m
-(wnership)f(as)j(the)f(corresp)s(onding)f(original,)h(so)g(that)h
-(these)g(prop-)390 3671 y(erties)34 b(can)g(b)s(e)f(correctly)i
-(restored)f(at)g(decompression)f(time.)51 b(File)34 b(name)g(handling)d
-(is)390 3774 y(naiv)m(e)26 b(in)f(the)i(sense)f(that)h(there)f(is)f(no)
-i(mec)m(hanism)e(for)h(preserving)f(original)f(\014le)i(names,)390
-3878 y(p)s(ermissions,)37 b(o)m(wnerships)f(or)h(dates)i(in)d
-(\014lesystems)h(whic)m(h)g(lac)m(k)h(these)g(concepts,)j(or)390
-3982 y(ha)m(v)m(e)32 b(serious)d(\014le)g(name)i(length)f
-(restrictions,)f(suc)m(h)h(as)h(MS-DOS.)390 4133 y Fj(bzip2)26
-b Fl(and)h Fj(bunzip2)e Fl(will)f(b)m(y)k(default)e(not)i(o)m(v)m
-(erwrite)g(existing)e(\014les.)38 b(If)27 b(y)m(ou)h(w)m(an)m(t)g(this)
-390 4237 y(to)j(happ)s(en,)e(sp)s(ecify)g(the)i Fj(-f)e
-Fl(\015ag.)390 4388 y(If)34 b(no)h(\014le)f(names)g(are)i(sp)s
-(eci\014ed,)e Fj(bzip2)f Fl(compresses)i(from)f(standard)g(input)f(to)j
-(stan-)390 4491 y(dard)c(output.)49 b(In)32 b(this)g(case,)k
-Fj(bzip2)31 b Fl(will)g(decline)h(to)i(write)e(compressed)h(output)g
-(to)h(a)390 4595 y(terminal,)29 b(as)i(this)e(w)m(ould)g(b)s(e)h(en)m
-(tirely)f(incomprehensible)e(and)j(therefore)h(p)s(oin)m(tless.)390
-4746 y Fj(bunzip2)36 b Fl(\(or)j Fj(bzip2)29 b(-d)p Fl(\))37
-b(decompresses)i(all)e(sp)s(eci\014ed)f(\014les.)63 b(Files)37
-b(whic)m(h)g(w)m(ere)i(not)390 4850 y(created)e(b)m(y)f
-Fj(bzip2)f Fl(will)e(b)s(e)i(detected)j(and)d(ignored,)i(and)e(a)i(w)m
-(arning)d(issued.)56 b Fj(bzip2)390 4954 y Fl(attempts)31
-b(to)f(guess)g(the)g(\014lename)f(for)h(the)g(decompressed)f(\014le)g
-(from)h(that)g(of)g(the)g(com-)390 5058 y(pressed)f(\014le)h(as)h
-(follo)m(ws:)570 5209 y Fj(filename.bz2)57 b Fl(b)s(ecomes)31
-b Fj(filename)570 5340 y(filename.bz)58 b Fl(b)s(ecomes)30
-b Fj(filename)p eop
-%%Page: 4 5
-4 4 bop 150 -116 a Fl(Chapter)30 b(2:)41 b(Ho)m(w)31
-b(to)g(use)f Fj(bzip2)2375 b Fl(4)570 299 y Fj(filename.tbz2)27
-b Fl(b)s(ecomes)j Fj(filename.tar)570 470 y(filename.tbz)57
-b Fl(b)s(ecomes)31 b Fj(filename.tar)570 641 y(anyothername)57
-b Fl(b)s(ecomes)31 b Fj(anyothername.out)390 859 y Fl(If)j(the)h
-(\014le)e(do)s(es)i(not)f(end)g(in)f(one)i(of)g(the)g(recognised)f
-(endings,)g Fj(.bz2)p Fl(,)h Fj(.bz)p Fl(,)g Fj(.tbz2)e
-Fl(or)390 963 y Fj(.tbz)p Fl(,)h Fj(bzip2)f Fl(complains)f(that)j(it)e
-(cannot)i(guess)f(the)g(name)h(of)f(the)g(original)e(\014le,)j(and)390
-1067 y(uses)30 b(the)g(original)f(name)h(with)g Fj(.out)f
-Fl(app)s(ended.)390 1218 y(As)j(with)f(compression,)h(supplying)c(no)k
-(\014lenames)f(causes)i(decompression)e(from)h(stan-)390
-1321 y(dard)d(input)g(to)i(standard)e(output.)390 1472
-y Fj(bunzip2)k Fl(will)g(correctly)j(decompress)e(a)i(\014le)e(whic)m
-(h)g(is)h(the)g(concatenation)i(of)e(t)m(w)m(o)i(or)390
-1576 y(more)j(compressed)f(\014les.)67 b(The)39 b(result)g(is)g(the)g
-(concatenation)i(of)f(the)g(corresp)s(onding)390 1680
-y(uncompressed)c(\014les.)59 b(In)m(tegrit)m(y)38 b(testing)f(\()p
-Fj(-t)p Fl(\))g(of)g(concatenated)i(compressed)e(\014les)f(is)390
-1784 y(also)30 b(supp)s(orted.)390 1935 y(Y)-8 b(ou)40
-b(can)g(also)f(compress)g(or)g(decompress)g(\014les)g(to)h(the)f
-(standard)g(output)g(b)m(y)g(giving)390 2039 y(the)30
-b Fj(-c)g Fl(\015ag.)40 b(Multiple)28 b(\014les)h(ma)m(y)i(b)s(e)e
-(compressed)h(and)f(decompressed)h(lik)m(e)f(this.)39
-b(The)390 2142 y(resulting)31 b(outputs)i(are)h(fed)f(sequen)m(tially)f
-(to)i(stdout.)49 b(Compression)32 b(of)h(m)m(ultiple)e(\014les)390
-2246 y(in)24 b(this)g(manner)h(generates)h(a)g(stream)f(con)m(taining)g
-(m)m(ultiple)e(compressed)i(\014le)f(represen-)390 2350
-y(tations.)58 b(Suc)m(h)36 b(a)g(stream)g(can)h(b)s(e)e(decompressed)h
-(correctly)h(only)e(b)m(y)h Fj(bzip2)e Fl(v)m(ersion)390
-2454 y(0.9.0)g(or)e(later.)47 b(Earlier)30 b(v)m(ersions)i(of)g
-Fj(bzip2)f Fl(will)f(stop)i(after)h(decompressing)e(the)i(\014rst)390
-2558 y(\014le)c(in)h(the)g(stream.)390 2709 y Fj(bzcat)f
-Fl(\(or)i Fj(bzip2)e(-dc)p Fl(\))g(decompresses)i(all)e(sp)s(eci\014ed)
-g(\014les)g(to)i(the)g(standard)e(output.)390 2860 y
-Fj(bzip2)f Fl(will)g(read)i(argumen)m(ts)g(from)f(the)h(en)m(vironmen)m
-(t)g(v)-5 b(ariables)28 b Fj(BZIP2)h Fl(and)g Fj(BZIP)p
-Fl(,)g(in)390 2963 y(that)24 b(order,)g(and)f(will)e(pro)s(cess)i(them)
-g(b)s(efore)g(an)m(y)h(argumen)m(ts)f(read)h(from)f(the)g(command)390
-3067 y(line.)39 b(This)29 b(giv)m(es)h(a)h(con)m(v)m(enien)m(t)h(w)m(a)
-m(y)f(to)g(supply)d(default)i(argumen)m(ts.)390 3218
-y(Compression)h(is)h(alw)m(a)m(ys)i(p)s(erformed,)e(ev)m(en)h(if)f(the)
-h(compressed)g(\014le)f(is)g(sligh)m(tly)f(larger)390
-3322 y(than)26 b(the)g(original.)38 b(Files)25 b(of)h(less)g(than)g(ab)
-s(out)g(one)g(h)m(undred)e(b)m(ytes)j(tend)f(to)h(get)g(larger,)390
-3426 y(since)34 b(the)g(compression)f(mec)m(hanism)h(has)f(a)i(constan)
-m(t)g(o)m(v)m(erhead)h(in)d(the)h(region)g(of)g(50)390
-3529 y(b)m(ytes.)54 b(Random)34 b(data)h(\(including)d(the)i(output)h
-(of)f(most)h(\014le)f(compressors\))h(is)e(co)s(ded)390
-3633 y(at)e(ab)s(out)f(8.05)i(bits)d(p)s(er)h(b)m(yte,)h(giving)e(an)h
-(expansion)g(of)g(around)g(0.5\045.)390 3784 y(As)h(a)g(self-c)m(hec)m
-(k)h(for)e(y)m(our)h(protection,)g Fj(bzip2)f Fl(uses)g(32-bit)h(CR)m
-(Cs)f(to)i(mak)m(e)f(sure)f(that)390 3888 y(the)45 b(decompressed)f(v)m
-(ersion)g(of)g(a)h(\014le)e(is)h(iden)m(tical)f(to)i(the)g(original.)81
-b(This)43 b(guards)390 3992 y(against)i(corruption)e(of)h(the)h
-(compressed)f(data,)49 b(and)44 b(against)h(undetected)g(bugs)e(in)390
-4096 y Fj(bzip2)35 b Fl(\(hop)s(efully)e(v)m(ery)k(unlik)m(ely\).)56
-b(The)36 b(c)m(hances)h(of)f(data)h(corruption)e(going)h(unde-)390
-4199 y(tected)g(is)e(microscopic,)h(ab)s(out)f(one)h(c)m(hance)g(in)f
-(four)g(billion)d(for)j(eac)m(h)i(\014le)d(pro)s(cessed.)390
-4303 y(Be)38 b(a)m(w)m(are,)k(though,)d(that)f(the)g(c)m(hec)m(k)i(o)s
-(ccurs)d(up)s(on)f(decompression,)j(so)f(it)f(can)h(only)390
-4407 y(tell)28 b(y)m(ou)g(that)i(something)d(is)h(wrong.)40
-b(It)28 b(can't)i(help)d(y)m(ou)i(reco)m(v)m(er)h(the)e(original)f
-(uncom-)390 4511 y(pressed)h(data.)41 b(Y)-8 b(ou)30
-b(can)f(use)g Fj(bzip2recover)d Fl(to)k(try)f(to)h(reco)m(v)m(er)h
-(data)f(from)e(damaged)390 4614 y(\014les.)390 4766 y(Return)22
-b(v)-5 b(alues:)37 b(0)23 b(for)g(a)g(normal)f(exit,)j(1)e(for)g(en)m
-(vironmen)m(tal)f(problems)f(\(\014le)i(not)g(found,)390
-4869 y(in)m(v)-5 b(alid)30 b(\015ags,)k(I/O)f(errors,)g(&c\),)h(2)f(to)
-g(indicate)f(a)h(corrupt)f(compressed)h(\014le,)f(3)i(for)e(an)390
-4973 y(in)m(ternal)d(consistency)h(error)g(\(eg,)i(bug\))e(whic)m(h)f
-(caused)i Fj(bzip2)e Fl(to)i(panic.)390 5304 y Ff(OPTIONS)p
-eop
-%%Page: 5 6
-5 5 bop 150 -116 a Fl(Chapter)30 b(2:)41 b(Ho)m(w)31
-b(to)g(use)f Fj(bzip2)2375 b Fl(5)390 299 y Fj(-c)30
-b(--stdout)870 403 y Fl(Compress)f(or)i(decompress)f(to)h(standard)e
-(output.)390 557 y Fj(-d)h(--decompress)870 661 y Fl(F)-8
-b(orce)44 b(decompression.)77 b Fj(bzip2)p Fl(,)44 b
-Fj(bunzip2)d Fl(and)h Fj(bzcat)f Fl(are)i(really)f(the)870
-764 y(same)27 b(program,)h(and)e(the)i(decision)d(ab)s(out)i(what)g
-(actions)g(to)h(tak)m(e)g(is)e(done)870 868 y(on)k(the)h(basis)e(of)i
-(whic)m(h)e(name)h(is)g(used.)40 b(This)28 b(\015ag)j(o)m(v)m(errides)f
-(that)h(mec)m(h-)870 972 y(anism,)e(and)h(forces)h(bzip2)e(to)i
-(decompress.)390 1126 y Fj(-z)f(--compress)870 1230 y
-Fl(The)39 b(complemen)m(t)h(to)g Fj(-d)p Fl(:)59 b(forces)40
-b(compression,)h(regardless)d(of)i(the)g(in-)870 1334
-y(v)m(ok)-5 b(ation)31 b(name.)390 1488 y Fj(-t)f(--test)8
-b Fl(Chec)m(k)33 b(in)m(tegrit)m(y)j(of)f(the)g(sp)s(eci\014ed)e
-(\014le\(s\),)k(but)d(don't)h(decompress)g(them.)870
-1591 y(This)40 b(really)g(p)s(erforms)g(a)i(trial)e(decompression)h
-(and)g(thro)m(ws)g(a)m(w)m(a)m(y)j(the)870 1695 y(result.)390
-1849 y Fj(-f)30 b(--force)870 1953 y Fl(F)-8 b(orce)31
-b(o)m(v)m(erwrite)f(of)g(output)f(\014les.)40 b(Normally)-8
-b(,)29 b Fj(bzip2)f Fl(will)f(not)j(o)m(v)m(erwrite)870
-2057 y(existing)e(output)g(\014les.)39 b(Also)28 b(forces)h
-Fj(bzip2)e Fl(to)i(break)g(hard)e(links)f(to)k(\014les,)870
-2161 y(whic)m(h)f(it)h(otherwise)g(w)m(ouldn't)f(do.)390
-2315 y Fj(-k)h(--keep)8 b Fl(Keep)24 b(\(don't)i(delete\))h(input)d
-(\014les)g(during)g(compression)h(or)h(decompression.)390
-2469 y Fj(-s)k(--small)870 2573 y Fl(Reduce)23 b(memory)f(usage,)j(for)
-d(compression,)h(decompression)f(and)g(testing.)870 2676
-y(Files)f(are)i(decompressed)e(and)h(tested)h(using)e(a)h(mo)s
-(di\014ed)e(algorithm)h(whic)m(h)870 2780 y(only)30 b(requires)g(2.5)j
-(b)m(ytes)f(p)s(er)e(blo)s(c)m(k)h(b)m(yte.)44 b(This)30
-b(means)h(an)m(y)h(\014le)e(can)i(b)s(e)870 2884 y(decompressed)d(in)f
-(2300k)j(of)e(memory)-8 b(,)30 b(alb)s(eit)e(at)i(ab)s(out)f(half)g
-(the)g(normal)870 2988 y(sp)s(eed.)870 3117 y(During)42
-b(compression,)k Fj(-s)d Fl(selects)h(a)g(blo)s(c)m(k)g(size)f(of)h
-(200k,)k(whic)m(h)42 b(lim-)870 3220 y(its)33 b(memory)g(use)g(to)h
-(around)e(the)i(same)f(\014gure,)h(at)g(the)g(exp)s(ense)f(of)g(y)m
-(our)870 3324 y(compression)g(ratio.)50 b(In)33 b(short,)i(if)d(y)m
-(our)i(mac)m(hine)f(is)g(lo)m(w)g(on)h(memory)f(\(8)870
-3428 y(megab)m(ytes)42 b(or)e(less\),)j(use)d(-s)g(for)g(ev)m
-(erything.)71 b(See)40 b(MEMOR)-8 b(Y)41 b(MAN-)870 3532
-y(A)m(GEMENT)31 b(b)s(elo)m(w.)390 3686 y Fj(-q)f(--quiet)870
-3790 y Fl(Suppress)j(non-essen)m(tial)j(w)m(arning)e(messages.)58
-b(Messages)38 b(p)s(ertaining)33 b(to)870 3893 y(I/O)d(errors)g(and)g
-(other)h(critical)e(ev)m(en)m(ts)j(will)27 b(not)k(b)s(e)f(suppressed.)
-390 4047 y Fj(-v)g(--verbose)870 4151 y Fl(V)-8 b(erb)s(ose)28
-b(mo)s(de)f({)i(sho)m(w)e(the)h(compression)f(ratio)h(for)f(eac)m(h)i
-(\014le)e(pro)s(cessed.)870 4255 y(F)-8 b(urther)30 b
-Fj(-v)p Fl('s)g(increase)g(the)g(v)m(erb)s(osit)m(y)g(lev)m(el,)h(sp)s
-(ewing)d(out)j(lots)f(of)g(infor-)870 4359 y(mation)g(whic)m(h)f(is)h
-(primarily)d(of)j(in)m(terest)h(for)f(diagnostic)g(purp)s(oses.)390
-4513 y Fj(-L)g(--license)e(-V)h(--version)870 4617 y
-Fl(Displa)m(y)h(the)g(soft)m(w)m(are)i(v)m(ersion,)e(license)f(terms)i
-(and)e(conditions.)390 4771 y Fj(-1)h(to)g(-9)72 b Fl(Set)35
-b(the)g(blo)s(c)m(k)f(size)h(to)g(100)h(k,)g(200)g(k)f(..)53
-b(900)36 b(k)f(when)f(compressing.)53 b(Has)870 4875
-y(no)41 b(e\013ect)h(when)d(decompressing.)71 b(See)41
-b(MEMOR)-8 b(Y)41 b(MANA)m(GEMENT)870 4978 y(b)s(elo)m(w.)390
-5132 y Fj(--)324 b Fl(T)-8 b(reats)25 b(all)e(subsequen)m(t)g(argumen)m
-(ts)i(as)f(\014le)g(names,)h(ev)m(en)g(if)e(they)i(start)f(with)870
-5236 y(a)32 b(dash.)43 b(This)29 b(is)h(so)i(y)m(ou)g(can)f(handle)f
-(\014les)g(with)g(names)i(b)s(eginning)c(with)870 5340
-y(a)j(dash,)f(for)g(example:)40 b Fj(bzip2)29 b(--)h(-myfilename)p
-Fl(.)p eop
-%%Page: 6 7
-6 6 bop 150 -116 a Fl(Chapter)30 b(2:)41 b(Ho)m(w)31
-b(to)g(use)f Fj(bzip2)2375 b Fl(6)390 299 y Fj(--repetitive-fast)390
-427 y(--repetitive-best)870 530 y Fl(These)34 b(\015ags)g(are)h
-(redundan)m(t)e(in)g(v)m(ersions)g(0.9.5)j(and)e(ab)s(o)m(v)m(e.)53
-b(They)34 b(pro-)870 634 y(vided)h(some)i(coarse)g(con)m(trol)g(o)m(v)m
-(er)g(the)g(b)s(eha)m(viour)e(of)h(the)g(sorting)g(algo-)870
-738 y(rithm)h(in)h(earlier)g(v)m(ersions,)j(whic)m(h)d(w)m(as)h
-(sometimes)h(useful.)65 b(0.9.5)41 b(and)870 842 y(ab)s(o)m(v)m(e)34
-b(ha)m(v)m(e)g(an)f(impro)m(v)m(ed)g(algorithm)f(whic)m(h)f(renders)h
-(these)h(\015ags)h(irrel-)870 946 y(ev)-5 b(an)m(t.)390
-1190 y Ff(MEMOR)-10 b(Y)40 b(MANA)m(GEMENT)390 1377 y
-Fj(bzip2)25 b Fl(compresses)i(large)g(\014les)e(in)g(blo)s(c)m(ks.)39
-b(The)26 b(blo)s(c)m(k)h(size)f(a\013ects)i(b)s(oth)e(the)h(compres-)
-390 1481 y(sion)39 b(ratio)g(ac)m(hiev)m(ed,)k(and)d(the)f(amoun)m(t)i
-(of)e(memory)h(needed)f(for)h(compression)f(and)390 1585
-y(decompression.)59 b(The)36 b(\015ags)h Fj(-1)f Fl(through)h
-Fj(-9)f Fl(sp)s(ecify)f(the)i(blo)s(c)m(k)g(size)f(to)i(b)s(e)e
-(100,000)390 1688 y(b)m(ytes)29 b(through)e(900,000)k(b)m(ytes)d(\(the)
-h(default\))e(resp)s(ectiv)m(ely)-8 b(.)40 b(A)m(t)29
-b(decompression)e(time,)390 1792 y(the)32 b(blo)s(c)m(k)g(size)g(used)g
-(for)g(compression)f(is)g(read)h(from)g(the)g(header)g(of)h(the)f
-(compressed)390 1896 y(\014le,)j(and)f Fj(bunzip2)e Fl(then)i(allo)s
-(cates)h(itself)e(just)h(enough)g(memory)g(to)i(decompress)e(the)390
-2000 y(\014le.)39 b(Since)29 b(blo)s(c)m(k)g(sizes)g(are)h(stored)f(in)
-f(compressed)h(\014les,)g(it)g(follo)m(ws)f(that)i(the)g(\015ags)g
-Fj(-1)390 2103 y Fl(to)h Fj(-9)f Fl(are)h(irrelev)-5
-b(an)m(t)29 b(to)i(and)f(so)h(ignored)e(during)f(decompression.)390
-2255 y(Compression)h(and)g(decompression)h(requiremen)m(ts,)f(in)g(b)m
-(ytes,)j(can)e(b)s(e)g(estimated)h(as:)869 2406 y Fj(Compression:)140
-b(400k)46 b(+)i(\()f(8)h(x)f(block)f(size)h(\))869 2613
-y(Decompression:)d(100k)i(+)i(\()f(4)h(x)f(block)f(size)h(\),)g(or)1585
-2717 y(100k)f(+)i(\()f(2.5)g(x)g(block)g(size)f(\))390
-2868 y Fl(Larger)29 b(blo)s(c)m(k)f(sizes)h(giv)m(e)g(rapidly)d
-(diminishing)e(marginal)k(returns.)39 b(Most)29 b(of)g(the)g(com-)390
-2972 y(pression)d(comes)j(from)f(the)g(\014rst)g(t)m(w)m(o)h(or)f
-(three)h(h)m(undred)d(k)i(of)g(blo)s(c)m(k)g(size,)g(a)h(fact)g(w)m
-(orth)390 3075 y(b)s(earing)j(in)f(mind)g(when)h(using)f
-Fj(bzip2)h Fl(on)g(small)g(mac)m(hines.)47 b(It)33 b(is)f(also)h(imp)s
-(ortan)m(t)f(to)390 3179 y(appreciate)j(that)h(the)f(decompression)f
-(memory)h(requiremen)m(t)f(is)h(set)g(at)h(compression)390
-3283 y(time)30 b(b)m(y)g(the)h(c)m(hoice)g(of)g(blo)s(c)m(k)f(size.)390
-3434 y(F)-8 b(or)45 b(\014les)f(compressed)g(with)g(the)g(default)g
-(900k)i(blo)s(c)m(k)e(size,)49 b Fj(bunzip2)42 b Fl(will)g(require)390
-3538 y(ab)s(out)29 b(3700)j(kb)m(ytes)e(to)h(decompress.)40
-b(T)-8 b(o)30 b(supp)s(ort)e(decompression)h(of)h(an)m(y)g(\014le)f(on)
-g(a)i(4)390 3642 y(megab)m(yte)h(mac)m(hine,)d Fj(bunzip2)f
-Fl(has)i(an)g(option)f(to)i(decompress)e(using)g(appro)m(ximately)390
-3745 y(half)k(this)g(amoun)m(t)i(of)f(memory)-8 b(,)36
-b(ab)s(out)e(2300)i(kb)m(ytes.)53 b(Decompression)34
-b(sp)s(eed)g(is)f(also)390 3849 y(halv)m(ed,)i(so)f(y)m(ou)h(should)d
-(use)h(this)g(option)h(only)f(where)h(necessary)-8 b(.)53
-b(The)33 b(relev)-5 b(an)m(t)35 b(\015ag)390 3953 y(is)29
-b Fj(-s)p Fl(.)390 4104 y(In)34 b(general,)i(try)f(and)f(use)g(the)h
-(largest)h(blo)s(c)m(k)e(size)h(memory)f(constrain)m(ts)h(allo)m(w,)h
-(since)390 4208 y(that)45 b(maximises)f(the)h(compression)f(ac)m(hiev)m
-(ed.)85 b(Compression)43 b(and)h(decompression)390 4311
-y(sp)s(eed)30 b(are)g(virtually)e(una\013ected)j(b)m(y)f(blo)s(c)m(k)g
-(size.)390 4463 y(Another)25 b(signi\014can)m(t)f(p)s(oin)m(t)g
-(applies)f(to)j(\014les)e(whic)m(h)g(\014t)h(in)e(a)j(single)d(blo)s(c)
-m(k)i({)g(that)h(means)390 4566 y(most)g(\014les)g(y)m(ou'd)g(encoun)m
-(ter)h(using)d(a)j(large)f(blo)s(c)m(k)g(size.)39 b(The)25
-b(amoun)m(t)i(of)f(real)g(memory)390 4670 y(touc)m(hed)38
-b(is)e(prop)s(ortional)f(to)j(the)f(size)g(of)h(the)f(\014le,)h(since)f
-(the)g(\014le)g(is)f(smaller)g(than)h(a)390 4774 y(blo)s(c)m(k.)49
-b(F)-8 b(or)35 b(example,)f(compressing)e(a)i(\014le)e(20,000)k(b)m
-(ytes)e(long)f(with)f(the)i(\015ag)g Fj(-9)f Fl(will)390
-4878 y(cause)28 b(the)f(compressor)g(to)h(allo)s(cate)f(around)f(7600k)
-j(of)e(memory)-8 b(,)28 b(but)f(only)f(touc)m(h)i(400k)390
-4981 y Fj(+)h Fl(20000)j(*)e(8)g(=)f(560)i(kb)m(ytes)f(of)g(it.)40
-b(Similarly)-8 b(,)26 b(the)k(decompressor)f(will)e(allo)s(cate)j
-(3700k)390 5085 y(but)g(only)f(touc)m(h)i(100k)h Fj(+)e
-Fl(20000)i(*)f(4)g(=)f(180)i(kb)m(ytes.)390 5236 y(Here)41
-b(is)f(a)i(table)f(whic)m(h)e(summarises)g(the)j(maxim)m(um)d(memory)i
-(usage)h(for)e(di\013eren)m(t)390 5340 y(blo)s(c)m(k)25
-b(sizes.)38 b(Also)25 b(recorded)g(is)f(the)i(total)g(compressed)e
-(size)h(for)g(14)h(\014les)e(of)i(the)f(Calgary)p eop
-%%Page: 7 8
-7 7 bop 150 -116 a Fl(Chapter)30 b(2:)41 b(Ho)m(w)31
-b(to)g(use)f Fj(bzip2)2375 b Fl(7)390 299 y(T)-8 b(ext)38
-b(Compression)d(Corpus)h(totalling)h(3,141,622)k(b)m(ytes.)61
-b(This)36 b(column)g(giv)m(es)i(some)390 403 y(feel)23
-b(for)f(ho)m(w)h(compression)f(v)-5 b(aries)23 b(with)e(blo)s(c)m(k)i
-(size.)38 b(These)23 b(\014gures)f(tend)g(to)i(understate)390
-506 y(the)g(adv)-5 b(an)m(tage)26 b(of)e(larger)f(blo)s(c)m(k)h(sizes)f
-(for)h(larger)f(\014les,)h(since)g(the)g(Corpus)e(is)h(dominated)390
-610 y(b)m(y)30 b(smaller)f(\014les.)1107 761 y Fj(Compress)141
-b(Decompress)g(Decompress)f(Corpus)773 865 y(Flag)238
-b(usage)285 b(usage)332 b(-s)48 b(usage)237 b(Size)821
-1073 y(-1)286 b(1200k)332 b(500k)429 b(350k)285 b(914704)821
-1176 y(-2)h(2000k)332 b(900k)429 b(600k)285 b(877703)821
-1280 y(-3)h(2800k)f(1300k)428 b(850k)285 b(860338)821
-1384 y(-4)h(3600k)f(1700k)380 b(1100k)285 b(846899)821
-1488 y(-5)h(4400k)f(2100k)380 b(1350k)285 b(845160)821
-1591 y(-6)h(5200k)f(2500k)380 b(1600k)285 b(838626)821
-1695 y(-7)h(6100k)f(2900k)380 b(1850k)285 b(834096)821
-1799 y(-8)h(6800k)f(3300k)380 b(2100k)285 b(828642)821
-1903 y(-9)h(7600k)f(3700k)380 b(2350k)285 b(828642)390
-2147 y Ff(RECO)m(VERING)37 b(D)m(A)-10 b(T)g(A)40 b(FR)m(OM)h(D)m(AMA)m
-(GED)e(FILES)390 2333 y Fj(bzip2)25 b Fl(compresses)h(\014les)g(in)f
-(blo)s(c)m(ks,)h(usually)e(900kb)m(ytes)29 b(long.)39
-b(Eac)m(h)27 b(blo)s(c)m(k)e(is)h(handled)390 2437 y(indep)s(enden)m
-(tly)-8 b(.)47 b(If)32 b(a)i(media)e(or)h(transmission)e(error)i
-(causes)h(a)f(m)m(ulti-blo)s(c)m(k)f Fj(.bz2)g Fl(\014le)390
-2541 y(to)k(b)s(ecome)h(damaged,)g(it)e(ma)m(y)i(b)s(e)e(p)s(ossible)e
-(to)k(reco)m(v)m(er)g(data)f(from)g(the)f(undamaged)390
-2645 y(blo)s(c)m(ks)30 b(in)f(the)h(\014le.)390 2796
-y(The)j(compressed)h(represen)m(tation)f(of)h(eac)m(h)h(blo)s(c)m(k)e
-(is)g(delimited)e(b)m(y)j(a)g(48-bit)g(pattern,)390 2900
-y(whic)m(h)27 b(mak)m(es)j(it)e(p)s(ossible)e(to)j(\014nd)e(the)i(blo)s
-(c)m(k)f(b)s(oundaries)e(with)i(reasonable)g(certain)m(t)m(y)-8
-b(.)390 3003 y(Eac)m(h)34 b(blo)s(c)m(k)f(also)g(carries)g(its)g(o)m
-(wn)g(32-bit)g(CR)m(C,)h(so)f(damaged)h(blo)s(c)m(ks)f(can)g(b)s(e)g
-(distin-)390 3107 y(guished)c(from)h(undamaged)g(ones.)390
-3258 y Fj(bzip2recover)37 b Fl(is)j(a)h(simple)e(program)h(whose)g
-(purp)s(ose)f(is)h(to)i(searc)m(h)f(for)f(blo)s(c)m(ks)g(in)390
-3362 y Fj(.bz2)34 b Fl(\014les,)i(and)f(write)f(eac)m(h)j(blo)s(c)m(k)d
-(out)i(in)m(to)f(its)g(o)m(wn)g Fj(.bz2)f Fl(\014le.)55
-b(Y)-8 b(ou)36 b(can)f(then)g(use)390 3466 y Fj(bzip2)29
-b(-t)c Fl(to)i(test)f(the)g(in)m(tegrit)m(y)g(of)g(the)g(resulting)e
-(\014les,)i(and)f(decompress)h(those)g(whic)m(h)390 3569
-y(are)31 b(undamaged.)390 3721 y Fj(bzip2recover)41 b
-Fl(tak)m(es)46 b(a)f(single)e(argumen)m(t,)49 b(the)44
-b(name)h(of)g(the)f(damaged)h(\014le,)j(and)390 3824
-y(writes)33 b(a)i(n)m(um)m(b)s(er)d(of)j(\014les)e Fj(rec0001file.bz2)p
-Fl(,)e Fj(rec0002file.bz2)p Fl(,)g(etc,)36 b(con)m(taining)390
-3928 y(the)42 b(extracted)g(blo)s(c)m(ks.)74 b(The)41
-b(output)g(\014lenames)f(are)i(designed)e(so)i(that)g(the)g(use)f(of)
-390 4032 y(wildcards)30 b(in)h(subsequen)m(t)h(pro)s(cessing)f({)i(for)
-g(example,)g Fj(bzip2)c(-dc)g(rec*file.bz2)e(>)390 4136
-y(recovered_data)f Fl({)31 b(lists)e(the)i(\014les)e(in)g(the)i
-(correct)g(order.)390 4287 y Fj(bzip2recover)38 b Fl(should)i(b)s(e)g
-(of)i(most)g(use)f(dealing)f(with)g(large)i Fj(.bz2)e
-Fl(\014les,)k(as)d(these)390 4390 y(will)29 b(con)m(tain)j(man)m(y)g
-(blo)s(c)m(ks.)45 b(It)32 b(is)f(clearly)g(futile)f(to)i(use)g(it)f(on)
-h(damaged)g(single-blo)s(c)m(k)390 4494 y(\014les,)g(since)f(a)h
-(damaged)h(blo)s(c)m(k)e(cannot)i(b)s(e)e(reco)m(v)m(ered.)47
-b(If)32 b(y)m(ou)g(wish)e(to)j(minimise)c(an)m(y)390
-4598 y(p)s(oten)m(tial)36 b(data)i(loss)e(through)g(media)h(or)f
-(transmission)f(errors,)j(y)m(ou)f(migh)m(t)g(consider)390
-4702 y(compressing)29 b(with)g(a)i(smaller)e(blo)s(c)m(k)h(size.)390
-4946 y Ff(PERF)m(ORMANCE)39 b(NOTES)390 5132 y Fl(The)f(sorting)f
-(phase)h(of)h(compression)e(gathers)i(together)h(similar)35
-b(strings)i(in)g(the)i(\014le.)390 5236 y(Because)54
-b(of)f(this,)58 b(\014les)52 b(con)m(taining)g(v)m(ery)h(long)g(runs)e
-(of)i(rep)s(eated)g(sym)m(b)s(ols,)58 b(lik)m(e)390 5340
-y Fj(")p Fl(aabaabaabaab)e(...)p Fj(")g Fl(\(rep)s(eated)g(sev)m(eral)f
-(h)m(undred)e(times\))i(ma)m(y)h(compress)f(more)p eop
-%%Page: 8 9
-8 8 bop 150 -116 a Fl(Chapter)30 b(2:)41 b(Ho)m(w)31
-b(to)g(use)f Fj(bzip2)2375 b Fl(8)390 299 y(slo)m(wly)33
-b(than)g(normal.)50 b(V)-8 b(ersions)33 b(0.9.5)i(and)f(ab)s(o)m(v)m(e)
-h(fare)e(m)m(uc)m(h)h(b)s(etter)g(than)f(previous)390
-403 y(v)m(ersions)i(in)g(this)f(resp)s(ect.)57 b(The)35
-b(ratio)h(b)s(et)m(w)m(een)h(w)m(orst-case)g(and)e(a)m(v)m(erage-case)
-40 b(com-)390 506 y(pression)e(time)h(is)f(in)g(the)h(region)g(of)h
-(10:1.)69 b(F)-8 b(or)40 b(previous)e(v)m(ersions,)j(this)d(\014gure)h
-(w)m(as)390 610 y(more)f(lik)m(e)g(100:1.)66 b(Y)-8 b(ou)38
-b(can)h(use)e(the)i Fj(-vvvv)d Fl(option)i(to)h(monitor)e(progress)h
-(in)f(great)390 714 y(detail,)30 b(if)f(y)m(ou)i(w)m(an)m(t.)390
-865 y(Decompression)f(sp)s(eed)g(is)f(una\013ected)i(b)m(y)f(these)h
-(phenomena.)390 1016 y Fj(bzip2)i Fl(usually)g(allo)s(cates)i(sev)m
-(eral)f(megab)m(ytes)j(of)d(memory)h(to)g(op)s(erate)h(in,)e(and)g
-(then)390 1120 y(c)m(harges)k(all)d(o)m(v)m(er)j(it)f(in)e(a)i(fairly)e
-(random)h(fashion.)59 b(This)34 b(means)j(that)g(p)s(erformance,)390
-1224 y(b)s(oth)27 b(for)h(compressing)f(and)g(decompressing,)h(is)f
-(largely)g(determined)g(b)m(y)h(the)g(sp)s(eed)f(at)390
-1327 y(whic)m(h)35 b(y)m(our)h(mac)m(hine)g(can)g(service)g(cac)m(he)i
-(misses.)57 b(Because)37 b(of)g(this,)f(small)f(c)m(hanges)390
-1431 y(to)f(the)f(co)s(de)h(to)f(reduce)g(the)h(miss)d(rate)j(ha)m(v)m
-(e)h(b)s(een)d(observ)m(ed)h(to)h(giv)m(e)g(disprop)s(ortion-)390
-1535 y(ately)i(large)f(p)s(erformance)f(impro)m(v)m(emen)m(ts.)56
-b(I)35 b(imagine)f Fj(bzip2)g Fl(will)e(p)s(erform)i(b)s(est)h(on)390
-1639 y(mac)m(hines)30 b(with)f(v)m(ery)i(large)f(cac)m(hes.)390
-1885 y Ff(CA)-14 b(VEA)k(TS)390 2072 y Fl(I/O)38 b(error)g(messages)h
-(are)f(not)h(as)f(helpful)e(as)i(they)g(could)f(b)s(e.)64
-b Fj(bzip2)37 b Fl(tries)g(hard)g(to)390 2176 y(detect)29
-b(I/O)e(errors)g(and)f(exit)i(cleanly)-8 b(,)27 b(but)g(the)h(details)e
-(of)h(what)h(the)f(problem)f(is)g(some-)390 2280 y(times)k(seem)h
-(rather)f(misleading.)390 2431 y(This)j(man)m(ual)g(page)i(p)s(ertains)
-e(to)i(v)m(ersion)f(1.0)i(of)e Fj(bzip2)p Fl(.)51 b(Compressed)34
-b(data)h(created)390 2534 y(b)m(y)25 b(this)e(v)m(ersion)i(is)e(en)m
-(tirely)h(forw)m(ards)h(and)f(bac)m(kw)m(ards)h(compatible)f(with)f
-(the)i(previous)390 2638 y(public)18 b(releases,)24 b(v)m(ersions)c
-(0.1pl2,)k(0.9.0)e(and)f(0.9.5,)k(but)20 b(with)g(the)h(follo)m(wing)e
-(exception:)390 2742 y(0.9.0)43 b(and)e(ab)s(o)m(v)m(e)h(can)g
-(correctly)f(decompress)g(m)m(ultiple)e(concatenated)k(compressed)390
-2846 y(\014les.)c(0.1pl2)30 b(cannot)g(do)f(this;)f(it)h(will)e(stop)i
-(after)h(decompressing)e(just)g(the)i(\014rst)e(\014le)g(in)390
-2949 y(the)j(stream.)390 3100 y Fj(bzip2recover)20 b
-Fl(uses)k(32-bit)g(in)m(tegers)f(to)i(represen)m(t)f(bit)e(p)s
-(ositions)g(in)g(compressed)i(\014les,)390 3204 y(so)j(it)f(cannot)i
-(handle)d(compressed)i(\014les)f(more)h(than)f(512)i(megab)m(ytes)h
-(long.)39 b(This)25 b(could)390 3308 y(easily)30 b(b)s(e)f(\014xed.)390
-3555 y Ff(A)m(UTHOR)390 3741 y Fl(Julian)f(Sew)m(ard,)i
-Fj(jseward@acm.org)p Fl(.)390 3892 y(The)24 b(ideas)f(em)m(b)s(o)s
-(died)f(in)h Fj(bzip2)f Fl(are)j(due)e(to)i(\(at)g(least\))g(the)f
-(follo)m(wing)e(p)s(eople:)37 b(Mic)m(hael)390 3996 y(Burro)m(ws)48
-b(and)g(Da)m(vid)h(Wheeler)f(\(for)h(the)g(blo)s(c)m(k)f(sorting)g
-(transformation\),)53 b(Da)m(vid)390 4100 y(Wheeler)45
-b(\(again,)50 b(for)45 b(the)g(Hu\013man)g(co)s(der\),)k(P)m(eter)d(F)
--8 b(en)m(wic)m(k)46 b(\(for)g(the)f(structured)390 4204
-y(co)s(ding)26 b(mo)s(del)g(in)f(the)i(original)e Fj(bzip)p
-Fl(,)i(and)f(man)m(y)h(re\014nemen)m(ts\),)h(and)e(Alistair)f
-(Mo\013at,)390 4307 y(Radford)34 b(Neal)h(and)f(Ian)h(Witten)g(\(for)f
-(the)h(arithmetic)g(co)s(der)f(in)g(the)h(original)d
-Fj(bzip)p Fl(\).)390 4411 y(I)41 b(am)g(m)m(uc)m(h)h(indebted)e(for)h
-(their)f(help,)j(supp)s(ort)c(and)i(advice.)74 b(See)41
-b(the)h(man)m(ual)e(in)390 4515 y(the)28 b(source)g(distribution)23
-b(for)28 b(p)s(oin)m(ters)e(to)j(sources)e(of)h(do)s(cumen)m(tation.)40
-b(Christian)25 b(v)m(on)390 4619 y(Ro)s(ques)31 b(encouraged)h(me)g(to)
-g(lo)s(ok)f(for)h(faster)g(sorting)f(algorithms,)f(so)i(as)g(to)g(sp)s
-(eed)f(up)390 4723 y(compression.)47 b(Bela)34 b(Lubkin)c(encouraged)k
-(me)f(to)g(impro)m(v)m(e)g(the)g(w)m(orst-case)i(compres-)390
-4826 y(sion)25 b(p)s(erformance.)38 b(Man)m(y)26 b(p)s(eople)f(sen)m(t)
-h(patc)m(hes,)h(help)s(ed)d(with)g(p)s(ortabilit)m(y)f(problems,)390
-4930 y(len)m(t)30 b(mac)m(hines,)g(ga)m(v)m(e)j(advice)d(and)g(w)m(ere)
-h(generally)f(helpful.)p eop
-%%Page: 9 10
-9 9 bop 150 -116 a Fl(Chapter)30 b(3:)41 b(Programming)29
-b(with)g Fj(libbzip2)1927 b Fl(9)150 299 y Fh(3)80 b(Programming)53
-b(with)h Fg(libbzip2)150 568 y Fl(This)29 b(c)m(hapter)i(describ)s(es)d
-(the)j(programming)e(in)m(terface)i(to)g Fj(libbzip2)p
-Fl(.)150 725 y(F)-8 b(or)36 b(general)e(bac)m(kground)h(information,)f
-(particularly)f(ab)s(out)h(memory)h(use)f(and)g(p)s(erformance)g(as-)
-150 834 y(p)s(ects,)d(y)m(ou'd)f(b)s(e)g(w)m(ell)f(advised)g(to)j(read)
-e(Chapter)g(2)g(as)h(w)m(ell.)150 1124 y Fk(3.1)68 b(T)-11
-b(op-lev)l(el)46 b(structure)150 1316 y Fj(libbzip2)33
-b Fl(is)i(a)h(\015exible)e(library)f(for)j(compressing)f(and)g
-(decompressing)f(data)j(in)d(the)i Fj(bzip2)e Fl(data)150
-1426 y(format.)39 b(Although)24 b(pac)m(k)-5 b(aged)26
-b(as)e(a)h(single)e(en)m(tit)m(y)-8 b(,)27 b(it)d(helps)f(to)i(regard)g
-(the)g(library)d(as)i(three)h(separate)150 1535 y(parts:)40
-b(the)31 b(lo)m(w)f(lev)m(el)g(in)m(terface,)h(and)f(the)h(high)e(lev)m
-(el)h(in)m(terface,)h(and)f(some)h(utilit)m(y)d(functions.)150
-1692 y(The)38 b(structure)g(of)g Fj(libbzip2)p Fl('s)e(in)m(terfaces)j
-(is)e(similar)f(to)j(that)g(of)g(Jean-loup)e(Gailly's)g(and)h(Mark)150
-1802 y(Adler's)29 b(excellen)m(t)i Fj(zlib)e Fl(library)-8
-b(.)150 1959 y(All)29 b(externally)g(visible)f(sym)m(b)s(ols)h(ha)m(v)m
-(e)i(names)f(b)s(eginning)e Fj(BZ2_)p Fl(.)39 b(This)29
-b(is)g(new)h(in)f(v)m(ersion)h(1.0.)41 b(The)150 2068
-y(in)m(ten)m(tion)30 b(is)f(to)i(minimise)d(p)s(ollution)f(of)k(the)f
-(namespaces)h(of)g(library)d(clien)m(ts.)150 2321 y Ff(3.1.1)63
-b(Lo)m(w-lev)m(el)39 b(summary)150 2514 y Fl(This)21
-b(in)m(terface)h(pro)m(vides)g(services)g(for)g(compressing)f(and)h
-(decompressing)f(data)i(in)e(memory)-8 b(.)38 b(There's)150
-2623 y(no)43 b(pro)m(vision)e(for)h(dealing)g(with)f(\014les,)k
-(streams)e(or)g(an)m(y)g(other)g(I/O)g(mec)m(hanisms,)i(just)e(straigh)
-m(t)150 2733 y(memory-to-memory)25 b(w)m(ork.)38 b(In)23
-b(fact,)k(this)22 b(part)i(of)f(the)h(library)d(can)j(b)s(e)f(compiled)
-f(without)h(inclusion)150 2843 y(of)31 b Fj(stdio.h)p
-Fl(,)d(whic)m(h)h(ma)m(y)i(b)s(e)f(helpful)d(for)k(em)m(b)s(edded)e
-(applications.)150 2999 y(The)h(lo)m(w-lev)m(el)g(part)g(of)h(the)f
-(library)e(has)i(no)h(global)e(v)-5 b(ariables)29 b(and)h(is)g
-(therefore)g(thread-safe.)150 3156 y(Six)d(routines)g(mak)m(e)j(up)d
-(the)i(lo)m(w)f(lev)m(el)g(in)m(terface:)41 b Fj(BZ2_bzCompressInit)p
-Fl(,)24 b Fj(BZ2_bzCompress)p Fl(,)h(and)150 3266 y Fj
-(BZ2_bzCompressEnd)h Fl(for)k(compression,)f(and)h(a)h(corresp)s
-(onding)d(trio)i Fj(BZ2_bzDecompressInit)p Fl(,)150 3375
-y Fj(BZ2_bzDecompress)37 b Fl(and)j Fj(BZ2_bzDecompressEnd)c
-Fl(for)42 b(decompression.)72 b(The)41 b Fj(*Init)e Fl(functions)150
-3485 y(allo)s(cate)44 b(memory)g(for)f(compression/decompression)f(and)
-h(do)h(other)g(initialisations,)f(whilst)f(the)150 3595
-y Fj(*End)29 b Fl(functions)g(close)i(do)m(wn)f(op)s(erations)f(and)h
-(release)h(memory)-8 b(.)150 3751 y(The)36 b(real)f(w)m(ork)i(is)e
-(done)h(b)m(y)g Fj(BZ2_bzCompress)c Fl(and)j Fj(BZ2_bzDecompress)p
-Fl(.)54 b(These)36 b(compress)g(and)150 3861 y(decompress)30
-b(data)h(from)f(a)h(user-supplied)c(input)i(bu\013er)g(to)i(a)g
-(user-supplied)c(output)j(bu\013er.)40 b(These)150 3971
-y(bu\013ers)32 b(can)i(b)s(e)e(an)m(y)i(size;)g(arbitrary)e(quan)m
-(tities)h(of)g(data)h(are)g(handled)d(b)m(y)i(making)f(rep)s(eated)i
-(calls)150 4080 y(to)f(these)f(functions.)44 b(This)30
-b(is)h(a)h(\015exible)e(mec)m(hanism)i(allo)m(wing)e(a)i(consumer-pull)
-e(st)m(yle)i(of)g(activit)m(y)-8 b(,)150 4190 y(or)30
-b(pro)s(ducer-push,)e(or)i(a)h(mixture)e(of)i(b)s(oth.)150
-4443 y Ff(3.1.2)63 b(High-lev)m(el)41 b(summary)150 4635
-y Fl(This)d(in)m(terface)j(pro)m(vides)e(some)h(handy)f(wrapp)s(ers)f
-(around)h(the)i(lo)m(w-lev)m(el)f(in)m(terface)g(to)h(facilitate)150
-4745 y(reading)26 b(and)g(writing)f Fj(bzip2)g Fl(format)i(\014les)f
-(\()p Fj(.bz2)g Fl(\014les\).)38 b(The)27 b(routines)e(pro)m(vide)h(ho)
-s(oks)h(to)g(facilitate)150 4854 y(reading)43 b(\014les)f(in)h(whic)m
-(h)f(the)i Fj(bzip2)f Fl(data)h(stream)g(is)f(em)m(b)s(edded)f(within)g
-(some)i(larger-scale)g(\014le)150 4964 y(structure,)30
-b(or)h(where)e(there)i(are)g(m)m(ultiple)d Fj(bzip2)h
-Fl(data)i(streams)f(concatenated)j(end-to-end.)150 5121
-y(F)-8 b(or)31 b(reading)f(\014les,)f Fj(BZ2_bzReadOpen)p
-Fl(,)e Fj(BZ2_bzRead)p Fl(,)h Fj(BZ2_bzReadClose)e Fl(and)150
-5230 y Fj(BZ2_bzReadGetUnused)19 b Fl(are)25 b(supplied.)36
-b(F)-8 b(or)25 b(writing)d(\014les,)j Fj(BZ2_bzWriteOpen)p
-Fl(,)d Fj(BZ2_bzWrite)g Fl(and)150 5340 y Fj(BZ2_bzWriteFinish)k
-Fl(are)k(a)m(v)-5 b(ailable.)p eop
-%%Page: 10 11
-10 10 bop 150 -116 a Fl(Chapter)30 b(3:)41 b(Programming)29
-b(with)g Fj(libbzip2)1881 b Fl(10)150 299 y(As)24 b(with)f(the)h(lo)m
-(w-lev)m(el)h(library)-8 b(,)23 b(no)h(global)g(v)-5
-b(ariables)23 b(are)h(used)g(so)g(the)h(library)c(is)j(p)s(er)f(se)h
-(thread-safe.)150 408 y(Ho)m(w)m(ev)m(er,)32 b(if)c(I/O)h(errors)g(o)s
-(ccur)g(whilst)e(reading)i(or)g(writing)e(the)j(underlying)c
-(compressed)j(\014les,)g(y)m(ou)150 518 y(ma)m(y)j(ha)m(v)m(e)g(to)g
-(consult)e Fj(errno)g Fl(to)h(determine)g(the)g(cause)g(of)h(the)f
-(error.)42 b(In)30 b(that)i(case,)h(y)m(ou'd)e(need)g(a)150
-628 y(C)f(library)e(whic)m(h)h(correctly)i(supp)s(orts)d
-Fj(errno)h Fl(in)g(a)i(m)m(ultithreaded)e(en)m(vironmen)m(t.)150
-784 y(T)-8 b(o)56 b(mak)m(e)g(the)g(library)d(a)j(little)e(simpler)f
-(and)i(more)h(p)s(ortable,)61 b Fj(BZ2_bzReadOpen)51
-b Fl(and)k Fj(BZ2_)150 894 y(bzWriteOpen)34 b Fl(require)j(y)m(ou)g(to)
-i(pass)e(them)g(\014le)g(handles)f(\()p Fj(FILE*)p Fl(s\))g(whic)m(h)h
-(ha)m(v)m(e)h(previously)e(b)s(een)150 1004 y(op)s(ened)41
-b(for)g(reading)f(or)h(writing)f(resp)s(ectiv)m(ely)-8
-b(.)73 b(That)41 b(a)m(v)m(oids)h(p)s(ortabilit)m(y)d(problems)g(asso)s
-(ciated)150 1113 y(with)j(\014le)h(op)s(erations)g(and)g(\014le)g
-(attributes,)j(whilst)c(not)i(b)s(eing)e(m)m(uc)m(h)h(of)h(an)g(imp)s
-(osition)c(on)k(the)150 1223 y(programmer.)150 1474 y
-Ff(3.1.3)63 b(Utilit)m(y)40 b(functions)h(summary)150
-1666 y Fl(F)-8 b(or)45 b(v)m(ery)g(simple)d(needs,)48
-b Fj(BZ2_bzBuffToBuffCompres)o(s)38 b Fl(and)44 b Fj
-(BZ2_bzBuffToBuffDecompres)o(s)150 1776 y Fl(are)29 b(pro)m(vided.)38
-b(These)28 b(compress)g(data)h(in)e(memory)h(from)g(one)h(bu\013er)e
-(to)i(another)f(bu\013er)g(in)f(a)h(single)150 1885 y(function)38
-b(call.)67 b(Y)-8 b(ou)40 b(should)d(assess)j(whether)f(these)h
-(functions)d(ful\014ll)f(y)m(our)k(memory-to-memory)150
-1995 y(compression/decompression)26 b(requiremen)m(ts)h(b)s(efore)g(in)
-m(v)m(esting)g(e\013ort)i(in)d(understanding)f(the)j(more)150
-2105 y(general)i(but)g(more)h(complex)f(lo)m(w-lev)m(el)g(in)m
-(terface.)150 2261 y(Y)-8 b(oshiok)j(a)47 b(Tsuneo)e(\()p
-Fj(QWF00133@niftyserve.or.jp)40 b Fl(/)46 b Fj
-(tsuneo-y@is.aist-nara.ac.)o(jp)p Fl(\))40 b(has)150
-2371 y(con)m(tributed)f(some)h(functions)e(to)j(giv)m(e)f(b)s(etter)g
-Fj(zlib)f Fl(compatibilit)m(y)-8 b(.)67 b(These)40 b(functions)e(are)i
-Fj(BZ2_)150 2481 y(bzopen)p Fl(,)e Fj(BZ2_bzread)p Fl(,)f
-Fj(BZ2_bzwrite)p Fl(,)g Fj(BZ2_bzflush)p Fl(,)g Fj(BZ2_bzclose)p
-Fl(,)f Fj(BZ2_bzerror)f Fl(and)i Fj(BZ2_)150 2590 y(bzlibVersion)p
-Fl(.)49 b(Y)-8 b(ou)35 b(ma)m(y)g(\014nd)e(these)i(functions)d(more)j
-(con)m(v)m(enien)m(t)g(for)f(simple)f(\014le)g(reading)h(and)150
-2700 y(writing,)c(than)h(those)h(in)e(the)i(high-lev)m(el)e(in)m
-(terface.)45 b(These)31 b(functions)f(are)i(not)g(\(y)m(et\))h
-(o\016cially)d(part)150 2809 y(of)k(the)g(library)-8
-b(,)33 b(and)g(are)h(minimally)c(do)s(cumen)m(ted)k(here.)51
-b(If)33 b(they)h(break,)h(y)m(ou)f(get)h(to)g(k)m(eep)f(all)f(the)150
-2919 y(pieces.)40 b(I)31 b(hop)s(e)e(to)i(do)s(cumen)m(t)g(them)f(prop)
-s(erly)e(when)h(time)i(p)s(ermits.)150 3076 y(Y)-8 b(oshiok)j(a)27
-b(also)g(con)m(tributed)f(mo)s(di\014cations)f(to)i(allo)m(w)f(the)h
-(library)e(to)i(b)s(e)f(built)f(as)i(a)g(Windo)m(ws)f(DLL.)150
-3362 y Fk(3.2)68 b(Error)45 b(handling)150 3554 y Fl(The)23
-b(library)f(is)h(designed)g(to)i(reco)m(v)m(er)g(cleanly)f(in)e(all)h
-(situations,)h(including)d(the)j(w)m(orst-case)i(situation)150
-3664 y(of)j(decompressing)e(random)g(data.)41 b(I'm)28
-b(not)h(100\045)g(sure)f(that)h(it)f(can)h(alw)m(a)m(ys)g(do)f(this,)g
-(so)g(y)m(ou)h(migh)m(t)150 3774 y(w)m(an)m(t)i(to)g(add)e(a)i(signal)d
-(handler)g(to)j(catc)m(h)h(segmen)m(tation)f(violations)e(during)f
-(decompression)h(if)g(y)m(ou)150 3883 y(are)g(feeling)f(esp)s(ecially)f
-(paranoid.)39 b(I)28 b(w)m(ould)g(b)s(e)g(in)m(terested)h(in)e(hearing)
-h(more)h(ab)s(out)f(the)h(robustness)150 3993 y(of)i(the)f(library)e
-(to)j(corrupted)f(compressed)g(data.)150 4150 y(V)-8
-b(ersion)39 b(1.0)h(is)f(m)m(uc)m(h)g(more)h(robust)e(in)g(this)g(resp)
-s(ect)i(than)f(0.9.0)i(or)e(0.9.5.)70 b(In)m(v)m(estigations)39
-b(with)150 4259 y(Chec)m(k)m(er)21 b(\(a)g(to)s(ol)g(for)f(detecting)h
-(problems)d(with)h(memory)h(managemen)m(t,)k(similar)18
-b(to)j(Purify\))e(indicate)150 4369 y(that,)40 b(at)e(least)f(for)g
-(the)h(few)e(\014les)h(I)g(tested,)j(all)c(single-bit)f(errors)i(in)e
-(the)j(decompressed)f(data)h(are)150 4478 y(caugh)m(t)c(prop)s(erly)-8
-b(,)31 b(with)g(no)i(segmen)m(tation)h(faults,)e(no)g(reads)h(of)g
-(uninitialised)27 b(data)34 b(and)e(no)g(out)h(of)150
-4588 y(range)f(reads)g(or)f(writes.)44 b(So)32 b(it's)f(certainly)g(m)m
-(uc)m(h)h(impro)m(v)m(ed,)g(although)f(I)g(w)m(ouldn't)g(claim)g(it)g
-(to)i(b)s(e)150 4698 y(totally)d(b)s(om)m(bpro)s(of.)150
-4854 y(The)25 b(\014le)g Fj(bzlib.h)f Fl(con)m(tains)i(all)f
-(de\014nitions)e(needed)i(to)i(use)e(the)h(library)-8
-b(.)37 b(In)26 b(particular,)f(y)m(ou)h(should)150 4964
-y(de\014nitely)i(not)j(include)d Fj(bzlib_private.h)p
-Fl(.)150 5121 y(In)39 b Fj(bzlib.h)p Fl(,)h(the)g(v)-5
-b(arious)39 b(return)f(v)-5 b(alues)39 b(are)h(de\014ned.)68
-b(The)39 b(follo)m(wing)f(list)h(is)f(not)i(in)m(tended)f(as)150
-5230 y(an)c(exhaustiv)m(e)h(description)d(of)i(the)h(circumstances)f
-(in)f(whic)m(h)g(a)i(giv)m(en)f(v)-5 b(alue)35 b(ma)m(y)h(b)s(e)e
-(returned)h({)150 5340 y(those)h(descriptions)d(are)j(giv)m(en)f
-(later.)56 b(Rather,)37 b(it)d(is)h(in)m(tended)f(to)i(con)m(v)m(ey)h
-(the)e(rough)g(meaning)g(of)p eop
-%%Page: 11 12
-11 11 bop 150 -116 a Fl(Chapter)30 b(3:)41 b(Programming)29
-b(with)g Fj(libbzip2)1881 b Fl(11)150 299 y(eac)m(h)38
-b(return)d(v)-5 b(alue.)59 b(The)36 b(\014rst)g(\014v)m(e)g(actions)h
-(are)g(normal)f(and)f(not)i(in)m(tended)f(to)h(denote)g(an)f(error)150
-408 y(situation.)150 592 y Fj(BZ_OK)180 b Fl(The)30 b(requested)g
-(action)h(w)m(as)g(completed)f(successfully)-8 b(.)150
-756 y Fj(BZ_RUN_OK)150 866 y(BZ_FLUSH_OK)150 975 y(BZ_FINISH_OK)630
-1085 y Fl(In)24 b Fj(BZ2_bzCompress)p Fl(,)e(the)i(requested)g
-(\015ush/\014nish/nothing-sp)s(ecial)c(action)k(w)m(as)h(com-)630
-1194 y(pleted)30 b(successfully)-8 b(.)150 1358 y Fj(BZ_STREAM_END)630
-1468 y Fl(Compression)38 b(of)j(data)f(w)m(as)h(completed,)h(or)f(the)f
-(logical)f(stream)i(end)e(w)m(as)i(detected)630 1577
-y(during)28 b(decompression.)150 1761 y(The)i(follo)m(wing)f(return)g
-(v)-5 b(alues)30 b(indicate)f(an)h(error)g(of)h(some)g(kind.)150
-1945 y Fj(BZ_CONFIG_ERROR)630 2055 y Fl(Indicates)48
-b(that)h(the)g(library)e(has)h(b)s(een)g(improp)s(erly)d(compiled)j(on)
-g(y)m(our)h(platform)630 2164 y({)j(a)g(ma)5 b(jor)51
-b(con\014guration)g(error.)104 b(Sp)s(eci\014cally)-8
-b(,)55 b(it)c(means)g(that)h Fj(sizeof\(char\))p Fl(,)630
-2274 y Fj(sizeof\(short\))44 b Fl(and)i Fj(sizeof\(int\))f
-Fl(are)j(not)f(1,)52 b(2)c(and)f(4)h(resp)s(ectiv)m(ely)-8
-b(,)51 b(as)d(they)630 2384 y(should)27 b(b)s(e.)40 b(Note)30
-b(that)g(the)f(library)e(should)g(still)g(w)m(ork)i(prop)s(erly)e(on)i
-(64-bit)g(platforms)630 2493 y(whic)m(h)d(follo)m(w)h(the)g(LP64)h
-(programming)e(mo)s(del)h({)g(that)h(is,)g(where)e Fj(sizeof\(long\))f
-Fl(and)630 2603 y Fj(sizeof\(void*\))e Fl(are)k(8.)40
-b(Under)25 b(LP64,)j Fj(sizeof\(int\))c Fl(is)h(still)f(4,)k(so)f
-Fj(libbzip2)p Fl(,)e(whic)m(h)630 2712 y(do)s(esn't)30
-b(use)g(the)h Fj(long)e Fl(t)m(yp)s(e,)i(is)e(OK.)150
-2876 y Fj(BZ_SEQUENCE_ERROR)630 2986 y Fl(When)43 b(using)f(the)i
-(library)-8 b(,)45 b(it)e(is)f(imp)s(ortan)m(t)h(to)h(call)e(the)i
-(functions)e(in)g(the)i(correct)630 3095 y(sequence)28
-b(and)f(with)f(data)j(structures)e(\(bu\013ers)f(etc\))j(in)e(the)g
-(correct)i(states.)41 b Fj(libbzip2)630 3205 y Fl(c)m(hec)m(ks)26
-b(as)e(m)m(uc)m(h)h(as)f(it)g(can)g(to)h(ensure)f(this)f(is)g(happ)s
-(ening,)h(and)f(returns)g Fj(BZ_SEQUENCE_)630 3314 y(ERROR)36
-b Fl(if)h(not.)62 b(Co)s(de)37 b(whic)m(h)g(complies)f(precisely)g
-(with)h(the)g(function)g(seman)m(tics,)j(as)630 3424
-y(detailed)d(b)s(elo)m(w,)i(should)d(nev)m(er)i(receiv)m(e)h(this)d(v)
--5 b(alue;)41 b(suc)m(h)d(an)g(ev)m(en)m(t)h(denotes)f(buggy)630
-3534 y(co)s(de)31 b(whic)m(h)e(y)m(ou)h(should)f(in)m(v)m(estigate.)150
-3697 y Fj(BZ_PARAM_ERROR)630 3807 y Fl(Returned)43 b(when)f(a)i
-(parameter)g(to)h(a)f(function)e(call)h(is)f(out)i(of)g(range)g(or)g
-(otherwise)630 3917 y(manifestly)34 b(incorrect.)57 b(As)36
-b(with)e Fj(BZ_SEQUENCE_ERROR)p Fl(,)f(this)i(denotes)h(a)g(bug)f(in)g
-(the)630 4026 y(clien)m(t)23 b(co)s(de.)39 b(The)22 b(distinction)f(b)s
-(et)m(w)m(een)j Fj(BZ_PARAM_ERROR)c Fl(and)j Fj(BZ_SEQUENCE_ERROR)630
-4136 y Fl(is)29 b(a)i(bit)f(hazy)-8 b(,)31 b(but)f(still)e(w)m(orth)i
-(making.)150 4300 y Fj(BZ_MEM_ERROR)630 4409 y Fl(Returned)g(when)f(a)i
-(request)f(to)i(allo)s(cate)f(memory)f(failed.)40 b(Note)31
-b(that)g(the)g(quan)m(tit)m(y)g(of)630 4519 y(memory)21
-b(needed)g(to)i(decompress)e(a)g(stream)h(cannot)g(b)s(e)f(determined)f
-(un)m(til)g(the)h(stream's)630 4628 y(header)29 b(has)g(b)s(een)g
-(read.)40 b(So)29 b Fj(BZ2_bzDecompress)c Fl(and)j Fj(BZ2_bzRead)f
-Fl(ma)m(y)j(return)e Fj(BZ_)630 4738 y(MEM_ERROR)d Fl(ev)m(en)k(though)
-e(some)h(of)g(the)g(compressed)g(data)g(has)g(b)s(een)f(read.)39
-b(The)28 b(same)630 4847 y(is)38 b(not)i(true)f(for)g(compression;)k
-(once)d Fj(BZ2_bzCompressInit)34 b Fl(or)39 b Fj(BZ2_bzWriteOpen)630
-4957 y Fl(ha)m(v)m(e)32 b(successfully)c(completed,)j
-Fj(BZ_MEM_ERROR)c Fl(cannot)k(o)s(ccur.)150 5121 y Fj(BZ_DATA_ERROR)630
-5230 y Fl(Returned)h(when)g(a)h(data)g(in)m(tegrit)m(y)g(error)g(is)e
-(detected)k(during)30 b(decompression.)47 b(Most)630
-5340 y(imp)s(ortan)m(tly)-8 b(,)31 b(this)f(means)i(when)f(stored)g
-(and)g(computed)h(CR)m(Cs)f(for)g(the)h(data)g(do)g(not)p
-eop
-%%Page: 12 13
-12 12 bop 150 -116 a Fl(Chapter)30 b(3:)41 b(Programming)29
-b(with)g Fj(libbzip2)1881 b Fl(12)630 299 y(matc)m(h.)41
-b(This)28 b(v)-5 b(alue)29 b(is)f(also)i(returned)e(up)s(on)g
-(detection)i(of)g(an)m(y)g(other)f(anomaly)h(in)e(the)630
-408 y(compressed)i(data.)150 560 y Fj(BZ_DATA_ERROR_MAGIC)630
-670 y Fl(As)k(a)g(sp)s(ecial)f(case)i(of)f Fj(BZ_DATA_ERROR)p
-Fl(,)d(it)i(is)g(sometimes)h(useful)e(to)j(kno)m(w)f(when)f(the)630
-779 y(compressed)d(stream)h(do)s(es)f(not)g(start)h(with)e(the)i
-(correct)h(magic)e(b)m(ytes)h(\()p Fj('B')f('Z')f('h')p
-Fl(\).)150 931 y Fj(BZ_IO_ERROR)630 1040 y Fl(Returned)k(b)m(y)h
-Fj(BZ2_bzRead)d Fl(and)i Fj(BZ2_bzWrite)e Fl(when)i(there)h(is)f(an)g
-(error)h(reading)f(or)630 1150 y(writing)28 b(in)h(the)h(compressed)g
-(\014le,)f(and)h(b)m(y)g Fj(BZ2_bzReadOpen)c Fl(and)j
-Fj(BZ2_bzWriteOpen)630 1259 y Fl(for)i(attempts)i(to)f(use)f(a)h
-(\014le)e(for)i(whic)m(h)e(the)h(error)g(indicator)g(\(viz,)g
-Fj(ferror\(f\))p Fl(\))f(is)g(set.)630 1369 y(On)h(receipt)g(of)h
-Fj(BZ_IO_ERROR)p Fl(,)e(the)h(caller)h(should)d(consult)i
-Fj(errno)g Fl(and/or)g Fj(perror)f Fl(to)630 1479 y(acquire)g(op)s
-(erating-system)g(sp)s(eci\014c)f(information)g(ab)s(out)h(the)h
-(problem.)150 1630 y Fj(BZ_UNEXPECTED_EOF)630 1740 y
-Fl(Returned)36 b(b)m(y)g Fj(BZ2_bzRead)e Fl(when)i(the)h(compressed)f
-(\014le)g(\014nishes)e(b)s(efore)j(the)f(logical)630
-1849 y(end)30 b(of)g(stream)h(is)e(detected.)150 2001
-y Fj(BZ_OUTBUFF_FULL)630 2110 y Fl(Returned)g(b)m(y)i
-Fj(BZ2_bzBuffToBuffCompres)o(s)24 b Fl(and)30 b Fj
-(BZ2_bzBuffToBuffDecompres)o(s)630 2220 y Fl(to)h(indicate)f(that)h
-(the)f(output)g(data)h(will)d(not)i(\014t)h(in)m(to)f(the)h(output)f
-(bu\013er)f(pro)m(vided.)150 2492 y Fk(3.3)68 b(Lo)l(w-lev)l(el)47
-b(in)l(terface)150 2766 y Ff(3.3.1)63 b Fe(BZ2_bzCompressInit)390
-2953 y Fj(typedef)533 3057 y(struct)46 b({)676 3161 y(char)h(*next_in;)
-676 3264 y(unsigned)f(int)h(avail_in;)676 3368 y(unsigned)f(int)h
-(total_in_lo32;)676 3472 y(unsigned)f(int)h(total_in_hi32;)676
-3680 y(char)g(*next_out;)676 3783 y(unsigned)f(int)h(avail_out;)676
-3887 y(unsigned)f(int)h(total_out_lo32;)676 3991 y(unsigned)f(int)h
-(total_out_hi32;)676 4198 y(void)g(*state;)676 4406 y(void)g
-(*\(*bzalloc\)\(void)c(*,int,int\);)676 4510 y(void)k
-(\(*bzfree\)\(void)d(*,void)i(*\);)676 4614 y(void)h(*opaque;)533
-4717 y(})533 4821 y(bz_stream;)390 5029 y(int)g(BZ2_bzCompressInit)c
-(\()k(bz_stream)e(*strm,)1583 5132 y(int)i(blockSize100k,)1583
-5236 y(int)g(verbosity,)1583 5340 y(int)g(workFactor)e(\);)p
-eop
-%%Page: 13 14
-13 13 bop 150 -116 a Fl(Chapter)30 b(3:)41 b(Programming)29
-b(with)g Fj(libbzip2)1881 b Fl(13)150 456 y(Prepares)32
-b(for)h(compression.)47 b(The)32 b Fj(bz_stream)e Fl(structure)j(holds)
-e(all)h(data)h(p)s(ertaining)e(to)i(the)g(com-)150 565
-y(pression)i(activit)m(y)-8 b(.)62 b(A)37 b Fj(bz_stream)e
-Fl(structure)h(should)f(b)s(e)i(allo)s(cated)g(and)f(initialised)e
-(prior)h(to)j(the)150 675 y(call.)67 b(The)39 b(\014elds)e(of)j
-Fj(bz_stream)d Fl(comprise)h(the)i(en)m(tiret)m(y)g(of)f(the)h
-(user-visible)c(data.)68 b Fj(state)38 b Fl(is)h(a)150
-784 y(p)s(oin)m(ter)29 b(to)i(the)g(priv)-5 b(ate)30
-b(data)h(structures)f(required)e(for)i(compression.)150
-941 y(Custom)37 b(memory)g(allo)s(cators)g(are)h(supp)s(orted,)f(via)g
-(\014elds)f Fj(bzalloc)p Fl(,)h Fj(bzfree)p Fl(,)g(and)g
-Fj(opaque)p Fl(.)59 b(The)150 1051 y(v)-5 b(alue)32 b
-Fj(opaque)e Fl(is)i(passed)f(to)i(as)g(the)f(\014rst)g(argumen)m(t)h
-(to)g(all)e(calls)g(to)i Fj(bzalloc)d Fl(and)i Fj(bzfree)p
-Fl(,)f(but)h(is)150 1160 y(otherwise)d(ignored)g(b)m(y)h(the)g(library)
--8 b(.)38 b(The)29 b(call)h Fj(bzalloc)e(\()i(opaque,)e(n,)i(m)g(\))g
-Fl(is)e(exp)s(ected)j(to)f(return)150 1270 y(a)g(p)s(oin)m(ter)e
-Fj(p)h Fl(to)h Fj(n)g(*)g(m)f Fl(b)m(ytes)h(of)g(memory)-8
-b(,)30 b(and)e Fj(bzfree)h(\()h(opaque,)f(p)h(\))f Fl(should)e(free)i
-(that)h(memory)-8 b(.)150 1427 y(If)33 b(y)m(ou)g(don't)h(w)m(an)m(t)g
-(to)g(use)f(a)g(custom)h(memory)f(allo)s(cator,)h(set)g
-Fj(bzalloc)p Fl(,)e Fj(bzfree)g Fl(and)h Fj(opaque)e
-Fl(to)150 1537 y Fj(NULL)p Fl(,)e(and)h(the)h(library)d(will)f(then)k
-(use)f(the)g(standard)g Fj(malloc)p Fl(/)p Fj(free)e
-Fl(routines.)150 1693 y(Before)39 b(calling)d Fj(BZ2_bzCompressInit)p
-Fl(,)f(\014elds)h Fj(bzalloc)p Fl(,)h Fj(bzfree)f Fl(and)h
-Fj(opaque)f Fl(should)g(b)s(e)h(\014lled)150 1803 y(appropriately)-8
-b(,)35 b(as)h(just)f(describ)s(ed.)53 b(Up)s(on)34 b(return,)i(the)g
-(in)m(ternal)e(state)i(will)d(ha)m(v)m(e)j(b)s(een)f(allo)s(cated)150
-1913 y(and)43 b(initialised,)g(and)g Fj(total_in_lo32)p
-Fl(,)h Fj(total_in_hi32)p Fl(,)f Fj(total_out_lo32)d
-Fl(and)j Fj(total_out_)150 2022 y(hi32)37 b Fl(will)f(ha)m(v)m(e)j(b)s
-(een)f(set)h(to)g(zero.)65 b(These)38 b(four)g(\014elds)e(are)j(used)f
-(b)m(y)g(the)g(library)e(to)j(inform)e(the)150 2132 y(caller)j(of)g
-(the)h(total)g(amoun)m(t)g(of)g(data)g(passed)f(in)m(to)g(and)g(out)g
-(of)h(the)g(library)-8 b(,)41 b(resp)s(ectiv)m(ely)-8
-b(.)70 b(Y)-8 b(ou)150 2241 y(should)34 b(not)j(try)f(to)h(c)m(hange)g
-(them.)58 b(As)36 b(of)h(v)m(ersion)f(1.0,)j(64-bit)d(coun)m(ts)h(are)f
-(main)m(tained,)h(ev)m(en)g(on)150 2351 y(32-bit)i(platforms,)h(using)d
-(the)i Fj(_hi32)e Fl(\014elds)g(to)j(store)f(the)g(upp)s(er)d(32)k
-(bits)d(of)i(the)g(coun)m(t.)66 b(So,)41 b(for)150 2460
-y(example,)30 b(the)h(total)g(amoun)m(t)g(of)f(data)h(in)f(is)f
-Fj(\(total_in_hi32)d(<<)k(32\))g(+)g(total_in_lo32)p
-Fl(.)150 2617 y(P)m(arameter)g Fj(blockSize100k)25 b
-Fl(sp)s(eci\014es)i(the)h(blo)s(c)m(k)g(size)h(to)g(b)s(e)f(used)f(for)
-h(compression.)40 b(It)28 b(should)f(b)s(e)150 2727 y(a)k(v)-5
-b(alue)30 b(b)s(et)m(w)m(een)i(1)f(and)f(9)h(inclusiv)m(e,)e(and)h(the)
-h(actual)g(blo)s(c)m(k)f(size)g(used)g(is)g(100000)j(x)e(this)e
-(\014gure.)42 b(9)150 2836 y(giv)m(es)31 b(the)f(b)s(est)g(compression)
-g(but)f(tak)m(es)j(most)f(memory)-8 b(.)150 2993 y(P)m(arameter)29
-b Fj(verbosity)c Fl(should)h(b)s(e)h(set)i(to)f(a)h(n)m(um)m(b)s(er)d
-(b)s(et)m(w)m(een)j(0)f(and)f(4)h(inclusiv)m(e.)38 b(0)28
-b(is)f(silen)m(t,)h(and)150 3103 y(greater)j(n)m(um)m(b)s(ers)c(giv)m
-(e)j(increasingly)d(v)m(erb)s(ose)j(monitoring/debugging)d(output.)40
-b(If)29 b(the)g(library)e(has)150 3212 y(b)s(een)j(compiled)e(with)i
-Fj(-DBZ_NO_STDIO)p Fl(,)d(no)j(suc)m(h)g(output)g(will)e(app)s(ear)h
-(for)h(an)m(y)h(v)m(erb)s(osit)m(y)f(setting.)150 3369
-y(P)m(arameter)35 b Fj(workFactor)d Fl(con)m(trols)i(ho)m(w)g(the)g
-(compression)f(phase)h(b)s(eha)m(v)m(es)g(when)f(presen)m(ted)h(with)
-150 3479 y(w)m(orst)40 b(case,)j(highly)37 b(rep)s(etitiv)m(e,)k(input)
-d(data.)68 b(If)39 b(compression)g(runs)e(in)m(to)j(di\016culties)d
-(caused)i(b)m(y)150 3588 y(rep)s(etitiv)m(e)34 b(data,)j(the)e(library)
-d(switc)m(hes)j(from)f(the)h(standard)f(sorting)g(algorithm)g(to)i(a)f
-(fallbac)m(k)f(al-)150 3698 y(gorithm.)47 b(The)32 b(fallbac)m(k)g(is)g
-(slo)m(w)m(er)g(than)h(the)f(standard)g(algorithm)g(b)m(y)g(p)s(erhaps)
-f(a)i(factor)h(of)e(three,)150 3808 y(but)e(alw)m(a)m(ys)h(b)s(eha)m(v)
-m(es)f(reasonably)-8 b(,)31 b(no)f(matter)h(ho)m(w)g(bad)f(the)g
-(input.)150 3965 y(Lo)m(w)m(er)25 b(v)-5 b(alues)24 b(of)h
-Fj(workFactor)d Fl(reduce)i(the)h(amoun)m(t)g(of)g(e\013ort)g(the)g
-(standard)f(algorithm)f(will)f(exp)s(end)150 4074 y(b)s(efore)j
-(resorting)h(to)g(the)g(fallbac)m(k.)39 b(Y)-8 b(ou)27
-b(should)c(set)k(this)e(parameter)h(carefully;)g(to)s(o)h(lo)m(w,)g
-(and)e(man)m(y)150 4184 y(inputs)32 b(will)f(b)s(e)i(handled)f(b)m(y)i
-(the)g(fallbac)m(k)g(algorithm)f(and)g(so)h(compress)g(rather)g(slo)m
-(wly)-8 b(,)34 b(to)s(o)h(high,)150 4293 y(and)24 b(y)m(our)h(a)m(v)m
-(erage-to-w)m(orst)30 b(case)c(compression)e(times)h(can)g(b)s(ecome)g
-(v)m(ery)h(large.)39 b(The)24 b(default)g(v)-5 b(alue)150
-4403 y(of)31 b(30)g(giv)m(es)f(reasonable)h(b)s(eha)m(viour)e(o)m(v)m
-(er)i(a)g(wide)e(range)i(of)f(circumstances.)150 4560
-y(Allo)m(w)m(able)h(v)-5 b(alues)31 b(range)i(from)e(0)i(to)f(250)h
-(inclusiv)m(e.)44 b(0)32 b(is)f(a)h(sp)s(ecial)f(case,)i(equiv)-5
-b(alen)m(t)32 b(to)g(using)f(the)150 4669 y(default)f(v)-5
-b(alue)29 b(of)i(30.)150 4826 y(Note)38 b(that)f(the)g(compressed)f
-(output)g(generated)h(is)f(the)g(same)h(regardless)f(of)h(whether)f(or)
-g(not)h(the)150 4936 y(fallbac)m(k)30 b(algorithm)f(is)h(used.)150
-5093 y(Be)23 b(a)m(w)m(are)h(also)f(that)g(this)f(parameter)h(ma)m(y)g
-(disapp)s(ear)e(en)m(tirely)h(in)f(future)h(v)m(ersions)g(of)h(the)g
-(library)-8 b(.)36 b(In)150 5202 y(principle)20 b(it)j(should)e(b)s(e)h
-(p)s(ossible)f(to)j(devise)f(a)g(go)s(o)s(d)g(w)m(a)m(y)i(to)f
-(automatically)f(c)m(ho)s(ose)h(whic)m(h)e(algorithm)150
-5312 y(to)31 b(use.)41 b(Suc)m(h)29 b(a)i(mec)m(hanism)f(w)m(ould)f
-(render)g(the)i(parameter)g(obsolete.)p eop
-%%Page: 14 15
-14 14 bop 150 -116 a Fl(Chapter)30 b(3:)41 b(Programming)29
-b(with)g Fj(libbzip2)1881 b Fl(14)150 299 y(P)m(ossible)29
-b(return)h(v)-5 b(alues:)572 450 y Fj(BZ_CONFIG_ERROR)663
-554 y Fl(if)29 b(the)i(library)d(has)i(b)s(een)f(mis-compiled)572
-657 y Fj(BZ_PARAM_ERROR)663 761 y Fl(if)g Fj(strm)g Fl(is)h
-Fj(NULL)663 865 y Fl(or)g Fj(blockSize)e(<)i Fl(1)h(or)f
-Fj(blockSize)e(>)i Fl(9)663 969 y(or)g Fj(verbosity)e(<)i
-Fl(0)h(or)f Fj(verbosity)e(>)i Fl(4)663 1073 y(or)g Fj(workFactor)e(<)i
-Fl(0)g(or)h Fj(workFactor)c(>)j Fl(250)572 1176 y Fj(BZ_MEM_ERROR)663
-1280 y Fl(if)f(not)i(enough)f(memory)g(is)f(a)m(v)-5
-b(ailable)572 1384 y Fj(BZ_OK)663 1488 y Fl(otherwise)150
-1645 y(Allo)m(w)m(able)30 b(next)g(actions:)572 1796
-y Fj(BZ2_bzCompress)663 1899 y Fl(if)f Fj(BZ_OK)g Fl(is)g(returned)572
-2003 y(no)h(sp)s(eci\014c)f(action)i(needed)f(in)f(case)i(of)g(error)
-150 2255 y Ff(3.3.2)63 b Fe(BZ2_bzCompress)533 2441 y
-Fj(int)47 b(BZ2_bzCompress)d(\()j(bz_stream)f(*strm,)g(int)h(action)f
-(\);)150 2598 y Fl(Pro)m(vides)28 b(more)g(input)f(and/or)h(output)g
-(bu\013er)g(space)h(for)f(the)h(library)-8 b(.)38 b(The)28
-b(caller)g(main)m(tains)f(input)150 2708 y(and)j(output)g(bu\013ers,)f
-(and)h(calls)g Fj(BZ2_bzCompress)c Fl(to)31 b(transfer)f(data)h(b)s(et)
-m(w)m(een)g(them.)150 2865 y(Before)j(eac)m(h)g(call)e(to)i
-Fj(BZ2_bzCompress)p Fl(,)c Fj(next_in)h Fl(should)g(p)s(oin)m(t)h(at)h
-(the)g(data)h(to)g(b)s(e)e(compressed,)150 2974 y(and)41
-b Fj(avail_in)f Fl(should)g(indicate)h(ho)m(w)h(man)m(y)f(b)m(ytes)i
-(the)f(library)d(ma)m(y)k(read.)75 b Fj(BZ2_bzCompress)150
-3084 y Fl(up)s(dates)29 b Fj(next_in)p Fl(,)g Fj(avail_in)f
-Fl(and)i Fj(total_in)e Fl(to)j(re\015ect)g(the)g(n)m(um)m(b)s(er)e(of)h
-(b)m(ytes)h(it)f(has)g(read.)150 3241 y(Similarly)-8
-b(,)27 b Fj(next_out)h Fl(should)g(p)s(oin)m(t)h(to)i(a)f(bu\013er)f
-(in)g(whic)m(h)g(the)h(compressed)g(data)h(is)e(to)i(b)s(e)e(placed,)
-150 3350 y(with)i Fj(avail_out)f Fl(indicating)h(ho)m(w)h(m)m(uc)m(h)h
-(output)f(space)h(is)f(a)m(v)-5 b(ailable.)46 b Fj(BZ2_bzCompress)29
-b Fl(up)s(dates)150 3460 y Fj(next_out)p Fl(,)f Fj(avail_out)g
-Fl(and)i Fj(total_out)e Fl(to)j(re\015ect)g(the)f(n)m(um)m(b)s(er)g(of)
-g(b)m(ytes)h(output.)150 3617 y(Y)-8 b(ou)40 b(ma)m(y)g(pro)m(vide)e
-(and)h(remo)m(v)m(e)i(as)f(little)e(or)h(as)h(m)m(uc)m(h)f(data)h(as)g
-(y)m(ou)f(lik)m(e)g(on)g(eac)m(h)i(call)e(of)g Fj(BZ2_)150
-3726 y(bzCompress)p Fl(.)48 b(In)33 b(the)h(limit,)f(it)h(is)f
-(acceptable)h(to)h(supply)c(and)j(remo)m(v)m(e)h(data)g(one)f(b)m(yte)g
-(at)h(a)f(time,)150 3836 y(although)28 b(this)f(w)m(ould)g(b)s(e)h
-(terribly)e(ine\016cien)m(t.)39 b(Y)-8 b(ou)29 b(should)e(alw)m(a)m(ys)
-h(ensure)g(that)h(at)g(least)g(one)f(b)m(yte)150 3946
-y(of)j(output)f(space)g(is)g(a)m(v)-5 b(ailable)30 b(at)h(eac)m(h)g
-(call.)150 4102 y(A)38 b(second)h(purp)s(ose)d(of)j Fj(BZ2_bzCompress)
-34 b Fl(is)j(to)i(request)f(a)h(c)m(hange)g(of)g(mo)s(de)e(of)i(the)f
-(compressed)150 4212 y(stream.)150 4369 y(Conceptually)-8
-b(,)24 b(a)g(compressed)g(stream)g(can)f(b)s(e)g(in)g(one)h(of)f(four)g
-(states:)39 b(IDLE,)24 b(R)m(UNNING,)h(FLUSH-)150 4478
-y(ING)37 b(and)g(FINISHING.)g(Before)i(initialisation)33
-b(\()p Fj(BZ2_bzCompressInit)p Fl(\))g(and)j(after)i(termination)150
-4588 y(\()p Fj(BZ2_bzCompressEnd)p Fl(\),)27 b(a)j(stream)h(is)f
-(regarded)g(as)g(IDLE.)150 4745 y(Up)s(on)35 b(initialisation)e(\()p
-Fj(BZ2_bzCompressInit)p Fl(\),)h(the)i(stream)h(is)e(placed)h(in)e(the)
-j(R)m(UNNING)g(state.)150 4854 y(Subsequen)m(t)j(calls)g(to)i
-Fj(BZ2_bzCompress)37 b Fl(should)j(pass)g Fj(BZ_RUN)g
-Fl(as)h(the)g(requested)h(action;)47 b(other)150 4964
-y(actions)31 b(are)f(illegal)f(and)h(will)d(result)j(in)f
-Fj(BZ_SEQUENCE_ERROR)p Fl(.)150 5121 y(A)m(t)38 b(some)f(p)s(oin)m(t,)h
-(the)f(calling)e(program)i(will)d(ha)m(v)m(e)k(pro)m(vided)e(all)f(the)
-i(input)e(data)j(it)e(w)m(an)m(ts)i(to.)61 b(It)150 5230
-y(will)28 b(then)h(w)m(an)m(t)i(to)g(\014nish)d(up)h({)i(in)d
-(e\013ect,)k(asking)e(the)g(library)e(to)j(pro)s(cess)f(an)m(y)g(data)h
-(it)f(migh)m(t)g(ha)m(v)m(e)150 5340 y(bu\013ered)25
-b(in)m(ternally)-8 b(.)38 b(In)25 b(this)g(state,)k Fj(BZ2_bzCompress)
-22 b Fl(will)i(no)i(longer)g(attempt)h(to)g(read)f(data)h(from)p
-eop
-%%Page: 15 16
-15 15 bop 150 -116 a Fl(Chapter)30 b(3:)41 b(Programming)29
-b(with)g Fj(libbzip2)1881 b Fl(15)150 299 y Fj(next_in)p
-Fl(,)33 b(but)g(it)h(will)d(w)m(an)m(t)k(to)g(write)e(data)h(to)h
-Fj(next_out)p Fl(.)49 b(Because)36 b(the)e(output)f(bu\013er)g
-(supplied)150 408 y(b)m(y)e(the)h(user)e(can)i(b)s(e)f(arbitrarily)d
-(small,)j(the)g(\014nishing-up)d(op)s(eration)i(cannot)i(necessarily)e
-(b)s(e)h(done)150 518 y(with)e(a)i(single)e(call)h(of)g
-Fj(BZ2_bzCompress)p Fl(.)150 675 y(Instead,)47 b(the)d(calling)f
-(program)g(passes)h Fj(BZ_FINISH)d Fl(as)j(an)g(action)g(to)h
-Fj(BZ2_bzCompress)p Fl(.)77 b(This)150 784 y(c)m(hanges)30
-b(the)f(stream's)g(state)h(to)f(FINISHING.)g(An)m(y)g(remaining)e
-(input)g(\(ie,)i Fj(next_in[0)f(..)i(avail_)150 894 y(in-1])p
-Fl(\))36 b(is)f(compressed)i(and)f(transferred)g(to)h(the)g(output)g
-(bu\013er.)58 b(T)-8 b(o)38 b(do)e(this,)i Fj(BZ2_bzCompress)150
-1004 y Fl(m)m(ust)h(b)s(e)f(called)g(rep)s(eatedly)h(un)m(til)e(all)h
-(the)h(output)f(has)h(b)s(een)f(consumed.)66 b(A)m(t)40
-b(that)g(p)s(oin)m(t,)g Fj(BZ2_)150 1113 y(bzCompress)h
-Fl(returns)h Fj(BZ_STREAM_END)p Fl(,)i(and)f(the)h(stream's)g(state)h
-(is)d(set)j(bac)m(k)f(to)g(IDLE.)g Fj(BZ2_)150 1223 y(bzCompressEnd)27
-b Fl(should)h(then)i(b)s(e)g(called.)150 1380 y(Just)25
-b(to)i(mak)m(e)g(sure)e(the)i(calling)d(program)i(do)s(es)g(not)g(c)m
-(heat,)i(the)f(library)c(mak)m(es)k(a)f(note)h(of)f Fj(avail_in)150
-1489 y Fl(at)g(the)g(time)f(of)g(the)g(\014rst)g(call)g(to)h
-Fj(BZ2_bzCompress)21 b Fl(whic)m(h)j(has)h Fj(BZ_FINISH)e
-Fl(as)i(an)h(action)f(\(ie,)i(at)f(the)150 1599 y(time)d(the)h(program)
-g(has)f(announced)g(its)h(in)m(ten)m(tion)f(to)h(not)g(supply)e(an)m(y)
-i(more)g(input\).)37 b(By)24 b(comparing)150 1708 y(this)k(v)-5
-b(alue)28 b(with)g(that)h(of)h Fj(avail_in)c Fl(o)m(v)m(er)k(subsequen)
-m(t)f(calls)f(to)h Fj(BZ2_bzCompress)p Fl(,)d(the)j(library)e(can)150
-1818 y(detect)33 b(an)m(y)e(attempts)i(to)f(slip)d(in)h(more)h(data)h
-(to)h(compress.)43 b(An)m(y)31 b(calls)g(for)g(whic)m(h)f(this)g(is)h
-(detected)150 1928 y(will)j(return)h Fj(BZ_SEQUENCE_ERROR)p
-Fl(.)55 b(This)34 b(indicates)i(a)h(programming)e(mistak)m(e)i(whic)m
-(h)e(should)g(b)s(e)150 2037 y(corrected.)150 2194 y(Instead)i(of)g
-(asking)f(to)h(\014nish,)f(the)h(calling)f(program)g(ma)m(y)h(ask)g
-Fj(BZ2_bzCompress)c Fl(to)38 b(tak)m(e)g(all)e(the)150
-2304 y(remaining)j(input,)i(compress)f(it)g(and)g(terminate)h(the)g
-(curren)m(t)f(\(Burro)m(ws-Wheeler\))h(compression)150
-2413 y(blo)s(c)m(k.)e(This)26 b(could)h(b)s(e)g(useful)f(for)h(error)h
-(con)m(trol)g(purp)s(oses.)38 b(The)27 b(mec)m(hanism)g(is)g(analogous)
-h(to)g(that)150 2523 y(for)35 b(\014nishing:)46 b(call)35
-b Fj(BZ2_bzCompress)c Fl(with)i(an)i(action)g(of)g Fj(BZ_FLUSH)p
-Fl(,)g(remo)m(v)m(e)h(output)f(data,)i(and)150 2632 y(p)s(ersist)h
-(with)g(the)i Fj(BZ_FLUSH)e Fl(action)i(un)m(til)e(the)i(v)-5
-b(alue)39 b Fj(BZ_RUN)f Fl(is)h(returned.)68 b(As)39
-b(with)g(\014nishing,)150 2742 y Fj(BZ2_bzCompress)23
-b Fl(detects)28 b(an)m(y)f(attempt)h(to)f(pro)m(vide)f(more)h(input)e
-(data)i(once)g(the)g(\015ush)e(has)i(b)s(egun.)150 2899
-y(Once)j(the)h(\015ush)e(is)g(complete,)i(the)g(stream)f(returns)g(to)h
-(the)f(normal)g(R)m(UNNING)h(state.)150 3056 y(This)f(all)h(sounds)g
-(prett)m(y)h(complex,)h(but)e(isn't)g(really)-8 b(.)45
-b(Here's)33 b(a)f(table)g(whic)m(h)f(sho)m(ws)h(whic)m(h)f(actions)150
-3165 y(are)e(allo)m(w)m(able)f(in)f(eac)m(h)j(state,)g(what)f(action)g
-(will)c(b)s(e)j(tak)m(en,)j(what)d(the)h(next)f(state)i(is,)e(and)g
-(what)h(the)150 3275 y(non-error)h(return)f(v)-5 b(alues)29
-b(are.)41 b(Note)32 b(that)e(y)m(ou)h(can't)g(explicitly)d(ask)i(what)g
-(state)i(the)e(stream)h(is)e(in,)150 3384 y(but)h(nor)g(do)g(y)m(ou)h
-(need)f(to)h({)g(it)e(can)i(b)s(e)f(inferred)e(from)i(the)h(v)-5
-b(alues)29 b(returned)h(b)m(y)g Fj(BZ2_bzCompress)p Fl(.)390
-3535 y(IDLE/)p Fj(any)572 3639 y Fl(Illegal.)60 b(IDLE)30
-b(state)i(only)d(exists)h(after)h Fj(BZ2_bzCompressEnd)26
-b Fl(or)572 3743 y(b)s(efore)k Fj(BZ2_bzCompressInit)p
-Fl(.)572 3847 y(Return)f(v)-5 b(alue)30 b(=)g Fj(BZ_SEQUENCE_ERROR)390
-4054 y Fl(R)m(UNNING/)p Fj(BZ_RUN)572 4158 y Fl(Compress)f(from)h
-Fj(next_in)f Fl(to)i Fj(next_out)d Fl(as)i(m)m(uc)m(h)h(as)f(p)s
-(ossible.)572 4262 y(Next)h(state)h(=)e(R)m(UNNING)572
-4366 y(Return)f(v)-5 b(alue)30 b(=)g Fj(BZ_RUN_OK)390
-4573 y Fl(R)m(UNNING/)p Fj(BZ_FLUSH)572 4677 y Fl(Remem)m(b)s(er)g
-(curren)m(t)g(v)-5 b(alue)30 b(of)g Fj(next_in)p Fl(.)59
-b(Compress)30 b(from)g Fj(next_in)572 4781 y Fl(to)h
-Fj(next_out)d Fl(as)j(m)m(uc)m(h)f(as)h(p)s(ossible,)d(but)i(do)g(not)g
-(accept)i(an)m(y)f(more)f(input.)572 4885 y(Next)h(state)h(=)e
-(FLUSHING)572 4988 y(Return)f(v)-5 b(alue)30 b(=)g Fj(BZ_FLUSH_OK)390
-5196 y Fl(R)m(UNNING/)p Fj(BZ_FINISH)572 5300 y Fl(Remem)m(b)s(er)g
-(curren)m(t)g(v)-5 b(alue)30 b(of)g Fj(next_in)p Fl(.)59
-b(Compress)30 b(from)g Fj(next_in)p eop
-%%Page: 16 17
-16 16 bop 150 -116 a Fl(Chapter)30 b(3:)41 b(Programming)29
-b(with)g Fj(libbzip2)1881 b Fl(16)572 299 y(to)31 b Fj(next_out)d
-Fl(as)j(m)m(uc)m(h)f(as)h(p)s(ossible,)d(but)i(do)g(not)g(accept)i(an)m
-(y)f(more)f(input.)572 403 y(Next)h(state)h(=)e(FINISHING)572
-506 y(Return)f(v)-5 b(alue)30 b(=)g Fj(BZ_FINISH_OK)390
-714 y Fl(FLUSHING/)p Fj(BZ_FLUSH)572 818 y Fl(Compress)f(from)h
-Fj(next_in)f Fl(to)i Fj(next_out)d Fl(as)i(m)m(uc)m(h)h(as)f(p)s
-(ossible,)572 922 y(but)f(do)i(not)f(accept)i(an)m(y)f(more)f(input.)
-572 1025 y(If)g(all)f(the)i(existing)e(input)f(has)i(b)s(een)g(used)g
-(up)f(and)h(all)f(compressed)572 1129 y(output)h(has)g(b)s(een)g(remo)m
-(v)m(ed)663 1233 y(Next)h(state)h(=)e(R)m(UNNING;)i(Return)d(v)-5
-b(alue)30 b(=)g Fj(BZ_RUN_OK)572 1337 y Fl(else)663 1440
-y(Next)h(state)h(=)e(FLUSHING;)h(Return)e(v)-5 b(alue)30
-b(=)g Fj(BZ_FLUSH_OK)390 1648 y Fl(FLUSHING/other)572
-1752 y(Illegal.)572 1856 y(Return)f(v)-5 b(alue)30 b(=)g
-Fj(BZ_SEQUENCE_ERROR)390 2063 y Fl(FINISHING/)p Fj(BZ_FINISH)572
-2167 y Fl(Compress)f(from)h Fj(next_in)f Fl(to)i Fj(next_out)d
-Fl(as)i(m)m(uc)m(h)h(as)f(p)s(ossible,)572 2271 y(but)f(to)j(not)e
-(accept)i(an)m(y)f(more)f(input.)572 2374 y(If)g(all)f(the)i(existing)e
-(input)f(has)i(b)s(een)g(used)g(up)f(and)h(all)f(compressed)572
-2478 y(output)h(has)g(b)s(een)g(remo)m(v)m(ed)663 2582
-y(Next)h(state)h(=)e(IDLE;)g(Return)g(v)-5 b(alue)30
-b(=)g Fj(BZ_STREAM_END)572 2686 y Fl(else)663 2790 y(Next)h(state)h(=)e
-(FINISHING;)g(Return)g(v)-5 b(alue)30 b(=)g Fj(BZ_FINISHING)390
-2997 y Fl(FINISHING/other)572 3101 y(Illegal.)572 3205
-y(Return)f(v)-5 b(alue)30 b(=)g Fj(BZ_SEQUENCE_ERROR)150
-3361 y Fl(That)24 b(still)f(lo)s(oks)g(complicated?)39
-b(W)-8 b(ell,)25 b(fair)f(enough.)38 b(The)24 b(usual)f(sequence)i(of)f
-(calls)g(for)g(compressing)150 3471 y(a)31 b(load)f(of)g(data)h(is:)225
-3628 y Fi(\017)60 b Fl(Get)31 b(started)g(with)e Fj(BZ2_bzCompressInit)
-p Fl(.)225 3774 y Fi(\017)60 b Fl(Sho)m(v)m(el)38 b(data)h(in)e(and)g
-(shlurp)e(out)k(its)e(compressed)h(form)g(using)e(zero)j(or)f(more)h
-(calls)e(of)h Fj(BZ2_)330 3884 y(bzCompress)28 b Fl(with)h(action)h(=)g
-Fj(BZ_RUN)p Fl(.)225 4030 y Fi(\017)60 b Fl(Finish)23
-b(up.)38 b(Rep)s(eatedly)25 b(call)f Fj(BZ2_bzCompress)e
-Fl(with)i(action)h(=)g Fj(BZ_FINISH)p Fl(,)f(cop)m(ying)h(out)h(the)330
-4139 y(compressed)k(output,)g(un)m(til)f Fj(BZ_STREAM_END)e
-Fl(is)i(returned.)225 4285 y Fi(\017)60 b Fl(Close)30
-b(up)f(and)h(go)h(home.)41 b(Call)29 b Fj(BZ2_bzCompressEnd)p
-Fl(.)150 4478 y(If)23 b(the)h(data)h(y)m(ou)f(w)m(an)m(t)h(to)f
-(compress)g(\014ts)f(in)m(to)h(y)m(our)g(input)e(bu\013er)h(all)f(at)j
-(once,)h(y)m(ou)e(can)g(skip)f(the)h(calls)150 4588 y(of)37
-b Fj(BZ2_bzCompress)26 b(\()k(...,)f(BZ_RUN)g(\))36 b
-Fl(and)g(just)g(do)h(the)g Fj(BZ2_bzCompress)26 b(\()k(...,)f
-(BZ_FINISH)150 4698 y(\))h Fl(calls.)150 4854 y(All)36
-b(required)g(memory)h(is)f(allo)s(cated)i(b)m(y)f Fj
-(BZ2_bzCompressInit)p Fl(.)56 b(The)37 b(compression)g(library)e(can)
-150 4964 y(accept)g(an)m(y)f(data)h(at)g(all)d(\(ob)m(viously\).)51
-b(So)34 b(y)m(ou)g(shouldn't)e(get)j(an)m(y)f(error)f(return)g(v)-5
-b(alues)33 b(from)h(the)150 5074 y Fj(BZ2_bzCompress)29
-b Fl(calls.)46 b(If)32 b(y)m(ou)h(do,)g(they)g(will)d(b)s(e)i
-Fj(BZ_SEQUENCE_ERROR)p Fl(,)d(and)j(indicate)f(a)i(bug)f(in)150
-5183 y(y)m(our)e(programming.)150 5340 y(T)-8 b(rivial)28
-b(other)j(p)s(ossible)d(return)h(v)-5 b(alues:)p eop
-%%Page: 17 18
-17 17 bop 150 -116 a Fl(Chapter)30 b(3:)41 b(Programming)29
-b(with)g Fj(libbzip2)1881 b Fl(17)572 299 y Fj(BZ_PARAM_ERROR)663
-403 y Fl(if)29 b Fj(strm)g Fl(is)h Fj(NULL)p Fl(,)f(or)i
-Fj(strm->s)d Fl(is)h Fj(NULL)150 652 y Ff(3.3.3)63 b
-Fe(BZ2_bzCompressEnd)390 839 y Fj(int)47 b(BZ2_bzCompressEnd)c(\()k
-(bz_stream)f(*strm)g(\);)150 996 y Fl(Releases)31 b(all)e(memory)h
-(asso)s(ciated)h(with)e(a)i(compression)e(stream.)150
-1153 y(P)m(ossible)g(return)h(v)-5 b(alues:)481 1304
-y Fj(BZ_PARAM_ERROR)117 b Fl(if)30 b Fj(strm)f Fl(is)g
-Fj(NULL)g Fl(or)i Fj(strm->s)d Fl(is)i Fj(NULL)481 1408
-y(BZ_OK)120 b Fl(otherwise)150 1657 y Ff(3.3.4)63 b Fe
-(BZ2_bzDecompressInit)390 1844 y Fj(int)47 b(BZ2_bzDecompressInit)42
-b(\()48 b(bz_stream)d(*strm,)h(int)h(verbosity,)e(int)i(small)f(\);)150
-2001 y Fl(Prepares)30 b(for)f(decompression.)40 b(As)29
-b(with)g Fj(BZ2_bzCompressInit)p Fl(,)c(a)31 b Fj(bz_stream)c
-Fl(record)j(should)e(b)s(e)150 2110 y(allo)s(cated)c(and)f(initialised)
-e(b)s(efore)i(the)i(call.)38 b(Fields)22 b Fj(bzalloc)p
-Fl(,)i Fj(bzfree)e Fl(and)i Fj(opaque)e Fl(should)g(b)s(e)h(set)i(if)
-150 2220 y(a)h(custom)f(memory)g(allo)s(cator)g(is)g(required,)f(or)h
-(made)h Fj(NULL)e Fl(for)h(the)g(normal)f Fj(malloc)p
-Fl(/)p Fj(free)f Fl(routines.)150 2330 y(Up)s(on)h(return,)h(the)g(in)m
-(ternal)f(state)i(will)c(ha)m(v)m(e)k(b)s(een)f(initialised,)d(and)i
-Fj(total_in)f Fl(and)h Fj(total_out)f Fl(will)150 2439
-y(b)s(e)30 b(zero.)150 2596 y(F)-8 b(or)31 b(the)g(meaning)e(of)i
-(parameter)g Fj(verbosity)p Fl(,)d(see)j Fj(BZ2_bzCompressInit)p
-Fl(.)150 2753 y(If)e Fj(small)e Fl(is)h(nonzero,)i(the)f(library)e
-(will)f(use)j(an)g(alternativ)m(e)h(decompression)e(algorithm)g(whic)m
-(h)f(uses)150 2862 y(less)c(memory)g(but)g(at)h(the)g(cost)h(of)e
-(decompressing)g(more)g(slo)m(wly)g(\(roughly)f(sp)s(eaking,)i(half)f
-(the)h(sp)s(eed,)150 2972 y(but)34 b(the)i(maxim)m(um)d(memory)i
-(requiremen)m(t)g(drops)e(to)j(around)e(2300k\).)57 b(See)35
-b(Chapter)g(2)g(for)g(more)150 3082 y(information)29
-b(on)h(memory)g(managemen)m(t.)150 3238 y(Note)40 b(that)f(the)f(amoun)
-m(t)h(of)g(memory)f(needed)g(to)i(decompress)e(a)h(stream)f(cannot)h(b)
-s(e)f(determined)150 3348 y(un)m(til)j(the)h(stream's)h(header)f(has)g
-(b)s(een)g(read,)j(so)e(ev)m(en)g(if)e Fj(BZ2_bzDecompressInit)c
-Fl(succeeds,)46 b(a)150 3458 y(subsequen)m(t)30 b Fj(BZ2_bzDecompress)c
-Fl(could)j(fail)g(with)g Fj(BZ_MEM_ERROR)p Fl(.)150 3614
-y(P)m(ossible)g(return)h(v)-5 b(alues:)572 3765 y Fj(BZ_CONFIG_ERROR)
-663 3869 y Fl(if)29 b(the)i(library)d(has)i(b)s(een)f(mis-compiled)572
-3973 y Fj(BZ_PARAM_ERROR)663 4077 y Fl(if)g Fj(\(small)46
-b(!=)h(0)h(&&)f(small)f(!=)h(1\))663 4181 y Fl(or)30
-b Fj(\(verbosity)45 b(<)j(0)f(||)g(verbosity)e(>)j(4\))572
-4284 y(BZ_MEM_ERROR)663 4388 y Fl(if)29 b(insu\016cien)m(t)g(memory)h
-(is)f(a)m(v)-5 b(ailable)150 4545 y(Allo)m(w)m(able)30
-b(next)g(actions:)572 4696 y Fj(BZ2_bzDecompress)663
-4800 y Fl(if)f Fj(BZ_OK)g Fl(w)m(as)i(returned)572 4904
-y(no)f(sp)s(eci\014c)f(action)i(required)e(in)g(case)i(of)g(error)150
-5153 y Ff(3.3.5)63 b Fe(BZ2_bzDecompress)390 5340 y Fj(int)47
-b(BZ2_bzDecompress)c(\()48 b(bz_stream)d(*strm)h(\);)p
-eop
-%%Page: 18 19
-18 18 bop 150 -116 a Fl(Chapter)30 b(3:)41 b(Programming)29
-b(with)g Fj(libbzip2)1881 b Fl(18)150 299 y(Pro)m(vides)24
-b(more)g(input)f(and/out)h(output)g(bu\013er)g(space)h(for)f(the)g
-(library)-8 b(.)37 b(The)24 b(caller)g(main)m(tains)f(input)150
-408 y(and)30 b(output)g(bu\013ers,)f(and)h(uses)g Fj(BZ2_bzDecompress)c
-Fl(to)31 b(transfer)f(data)h(b)s(et)m(w)m(een)g(them.)150
-565 y(Before)g(eac)m(h)g(call)f(to)g Fj(BZ2_bzDecompress)p
-Fl(,)c Fj(next_in)i Fl(should)h(p)s(oin)m(t)g(at)h(the)h(compressed)e
-(data,)j(and)150 675 y Fj(avail_in)h Fl(should)h(indicate)h(ho)m(w)h
-(man)m(y)f(b)m(ytes)i(the)e(library)f(ma)m(y)i(read.)56
-b Fj(BZ2_bzDecompress)32 b Fl(up-)150 784 y(dates)f Fj(next_in)p
-Fl(,)e Fj(avail_in)f Fl(and)h Fj(total_in)g Fl(to)i(re\015ect)g(the)f
-(n)m(um)m(b)s(er)f(of)i(b)m(ytes)g(it)f(has)g(read.)150
-941 y(Similarly)-8 b(,)37 b Fj(next_out)f Fl(should)g(p)s(oin)m(t)i(to)
-g(a)h(bu\013er)e(in)g(whic)m(h)g(the)i(uncompressed)e(output)g(is)h(to)
-h(b)s(e)150 1051 y(placed,)d(with)e Fj(avail_out)f Fl(indicating)g(ho)m
-(w)i(m)m(uc)m(h)g(output)g(space)h(is)e(a)m(v)-5 b(ailable.)55
-b Fj(BZ2_bzCompress)150 1160 y Fl(up)s(dates)29 b Fj(next_out)p
-Fl(,)g Fj(avail_out)f Fl(and)h Fj(total_out)f Fl(to)j(re\015ect)g(the)g
-(n)m(um)m(b)s(er)e(of)h(b)m(ytes)h(output.)150 1317 y(Y)-8
-b(ou)40 b(ma)m(y)g(pro)m(vide)e(and)h(remo)m(v)m(e)i(as)f(little)e(or)h
-(as)h(m)m(uc)m(h)f(data)h(as)g(y)m(ou)f(lik)m(e)g(on)g(eac)m(h)i(call)e
-(of)g Fj(BZ2_)150 1427 y(bzDecompress)p Fl(.)e(In)27
-b(the)i(limit,)d(it)i(is)f(acceptable)j(to)f(supply)d(and)h(remo)m(v)m
-(e)j(data)f(one)f(b)m(yte)h(at)g(a)g(time,)150 1537 y(although)f(this)f
-(w)m(ould)g(b)s(e)h(terribly)e(ine\016cien)m(t.)39 b(Y)-8
-b(ou)29 b(should)e(alw)m(a)m(ys)h(ensure)g(that)h(at)g(least)g(one)f(b)
-m(yte)150 1646 y(of)j(output)f(space)g(is)g(a)m(v)-5
-b(ailable)30 b(at)h(eac)m(h)g(call.)150 1803 y(Use)g(of)f
-Fj(BZ2_bzDecompress)c Fl(is)k(simpler)e(than)i Fj(BZ2_bzCompress)p
-Fl(.)150 1960 y(Y)-8 b(ou)31 b(should)d(pro)m(vide)h(input)f(and)i
-(remo)m(v)m(e)i(output)d(as)i(describ)s(ed)d(ab)s(o)m(v)m(e,)k(and)d
-(rep)s(eatedly)h(call)f Fj(BZ2_)150 2069 y(bzDecompress)35
-b Fl(un)m(til)i Fj(BZ_STREAM_END)e Fl(is)j(returned.)64
-b(App)s(earance)39 b(of)g Fj(BZ_STREAM_END)c Fl(denotes)150
-2179 y(that)47 b Fj(BZ2_bzDecompress)42 b Fl(has)k(detected)h(the)f
-(logical)g(end)g(of)g(the)h(compressed)e(stream.)89 b
-Fj(BZ2_)150 2289 y(bzDecompress)28 b Fl(will)g(not)j(pro)s(duce)f
-Fj(BZ_STREAM_END)d Fl(un)m(til)j(all)f(output)i(data)h(has)e(b)s(een)h
-(placed)f(in)m(to)150 2398 y(the)36 b(output)g(bu\013er,)h(so)g(once)g
-Fj(BZ_STREAM_END)32 b Fl(app)s(ears,)38 b(y)m(ou)e(are)h(guaran)m(teed)
-g(to)g(ha)m(v)m(e)h(a)m(v)-5 b(ailable)150 2508 y(all)29
-b(the)i(decompressed)f(output,)g(and)g Fj(BZ2_bzDecompressEnd)25
-b Fl(can)31 b(safely)f(b)s(e)f(called.)150 2665 y(If)40
-b(case)h(of)f(an)h(error)e(return)h(v)-5 b(alue,)42 b(y)m(ou)f(should)d
-(call)h Fj(BZ2_bzDecompressEnd)c Fl(to)41 b(clean)f(up)g(and)150
-2774 y(release)31 b(memory)-8 b(.)150 2931 y(P)m(ossible)29
-b(return)h(v)-5 b(alues:)572 3082 y Fj(BZ_PARAM_ERROR)663
-3186 y Fl(if)29 b Fj(strm)g Fl(is)h Fj(NULL)f Fl(or)h
-Fj(strm->s)f Fl(is)g Fj(NULL)663 3290 y Fl(or)h Fj(strm->avail_out)44
-b(<)j(1)572 3393 y(BZ_DATA_ERROR)663 3497 y Fl(if)29
-b(a)i(data)g(in)m(tegrit)m(y)f(error)g(is)g(detected)h(in)e(the)i
-(compressed)f(stream)572 3601 y Fj(BZ_DATA_ERROR_MAGIC)663
-3705 y Fl(if)f(the)i(compressed)f(stream)g(do)s(esn't)h(b)s(egin)e
-(with)g(the)h(righ)m(t)g(magic)h(b)m(ytes)572 3808 y
-Fj(BZ_MEM_ERROR)663 3912 y Fl(if)e(there)i(w)m(asn't)f(enough)h(memory)
-f(a)m(v)-5 b(ailable)572 4016 y Fj(BZ_STREAM_END)663
-4120 y Fl(if)29 b(the)i(logical)e(end)h(of)h(the)f(data)h(stream)g(w)m
-(as)g(detected)g(and)f(all)663 4224 y(output)g(in)f(has)h(b)s(een)g
-(consumed,)f(eg)j Fj(s->avail_out)44 b(>)k(0)572 4327
-y(BZ_OK)663 4431 y Fl(otherwise)150 4588 y(Allo)m(w)m(able)30
-b(next)g(actions:)572 4739 y Fj(BZ2_bzDecompress)663
-4843 y Fl(if)f Fj(BZ_OK)g Fl(w)m(as)i(returned)572 4946
-y Fj(BZ2_bzDecompressEnd)663 5050 y Fl(otherwise)p eop
-%%Page: 19 20
-19 19 bop 150 -116 a Fl(Chapter)30 b(3:)41 b(Programming)29
-b(with)g Fj(libbzip2)1881 b Fl(19)150 299 y Ff(3.3.6)63
-b Fe(BZ2_bzDecompressEnd)390 486 y Fj(int)47 b(BZ2_bzDecompressEnd)42
-b(\()48 b(bz_stream)d(*strm)i(\);)150 643 y Fl(Releases)31
-b(all)e(memory)h(asso)s(ciated)h(with)e(a)i(decompression)e(stream.)150
-799 y(P)m(ossible)g(return)h(v)-5 b(alues:)572 950 y
-Fj(BZ_PARAM_ERROR)663 1054 y Fl(if)29 b Fj(strm)g Fl(is)h
-Fj(NULL)f Fl(or)h Fj(strm->s)f Fl(is)g Fj(NULL)572 1158
-y(BZ_OK)663 1262 y Fl(otherwise)150 1419 y(Allo)m(w)m(able)h(next)g
-(actions:)572 1570 y(None.)150 1857 y Fk(3.4)68 b(High-lev)l(el)47
-b(in)l(terface)150 2050 y Fl(This)35 b(in)m(terface)j(pro)m(vides)d
-(functions)h(for)g(reading)g(and)h(writing)e Fj(bzip2)g
-Fl(format)i(\014les.)59 b(First,)39 b(some)150 2159 y(general)30
-b(p)s(oin)m(ts.)225 2316 y Fi(\017)60 b Fl(All)35 b(of)h(the)g
-(functions)e(tak)m(e)k(an)e Fj(int*)f Fl(\014rst)g(argumen)m(t,)j
-Fj(bzerror)p Fl(.)56 b(After)36 b(eac)m(h)h(call,)g Fj(bzerror)330
-2426 y Fl(should)23 b(b)s(e)i(consulted)g(\014rst)g(to)h(determine)e
-(the)i(outcome)h(of)e(the)h(call.)38 b(If)25 b Fj(bzerror)f
-Fl(is)g Fj(BZ_OK)p Fl(,)i(the)330 2535 y(call)35 b(completed)g
-(successfully)-8 b(,)36 b(and)f(only)g(then)g(should)f(the)h(return)g
-(v)-5 b(alue)35 b(of)h(the)f(function)g(\(if)330 2645
-y(an)m(y\))30 b(b)s(e)f(consulted.)39 b(If)29 b Fj(bzerror)e
-Fl(is)h Fj(BZ_IO_ERROR)p Fl(,)f(there)i(w)m(as)h(an)f(error)g
-(reading/writing)e(the)330 2754 y(underlying)32 b(compressed)j(\014le,)
-h(and)f(y)m(ou)h(should)d(then)i(consult)g Fj(errno)p
-Fl(/)p Fj(perror)e Fl(to)j(determine)330 2864 y(the)i(cause)g(of)g(the)
-g(di\016cult)m(y)-8 b(.)61 b Fj(bzerror)36 b Fl(ma)m(y)i(also)g(b)s(e)f
-(set)h(to)g(v)-5 b(arious)37 b(other)h(v)-5 b(alues;)41
-b(precise)330 2974 y(details)29 b(are)i(giv)m(en)g(on)f(a)h(p)s
-(er-function)d(basis)h(b)s(elo)m(w.)225 3111 y Fi(\017)60
-b Fl(If)40 b Fj(bzerror)f Fl(indicates)g(an)i(error)f(\(ie,)j(an)m
-(ything)d(except)h Fj(BZ_OK)f Fl(and)g Fj(BZ_STREAM_END)p
-Fl(\),)g(y)m(ou)330 3220 y(should)56 b(immediately)h(call)g
-Fj(BZ2_bzReadClose)e Fl(\(or)j Fj(BZ2_bzWriteClose)p
-Fl(,)j(dep)s(ending)56 b(on)330 3330 y(whether)50 b(y)m(ou)g(are)h
-(attempting)g(to)g(read)f(or)g(to)i(write\))d(to)j(free)e(up)f(all)h
-(resources)g(asso)s(ci-)330 3439 y(ated)33 b(with)e(the)i(stream.)47
-b(Once)32 b(an)h(error)f(has)g(b)s(een)g(indicated,)f(b)s(eha)m(viour)g
-(of)i(all)e(calls)h(except)330 3549 y Fj(BZ2_bzReadClose)46
-b Fl(\()p Fj(BZ2_bzWriteClose)p Fl(\))h(is)j(unde\014ned.)99
-b(The)50 b(implication)e(is)i(that)h(\(1\))330 3659 y
-Fj(bzerror)44 b Fl(should)g(b)s(e)h(c)m(hec)m(k)m(ed)j(after)e(eac)m(h)
-h(call,)i(and)c(\(2\))i(if)e Fj(bzerror)f Fl(indicates)g(an)i(error,)
-330 3768 y Fj(BZ2_bzReadClose)26 b Fl(\()p Fj(BZ2_bzWriteClose)p
-Fl(\))h(should)h(then)i(b)s(e)g(called)g(to)h(clean)f(up.)225
-3905 y Fi(\017)60 b Fl(The)33 b Fj(FILE*)f Fl(argumen)m(ts)h(passed)g
-(to)h Fj(BZ2_bzReadOpen)p Fl(/)p Fj(BZ2_bzWriteOp)o(en)27
-b Fl(should)32 b(b)s(e)g(set)i(to)330 4015 y(binary)23
-b(mo)s(de.)38 b(Most)26 b(Unix)d(systems)i(will)d(do)i(this)g(b)m(y)g
-(default,)i(but)e(other)g(platforms,)h(including)330
-4124 y(Windo)m(ws)20 b(and)g(Mac,)k(will)19 b(not.)38
-b(If)20 b(y)m(ou)h(omit)g(this,)h(y)m(ou)f(ma)m(y)h(encoun)m(ter)f
-(problems)e(when)h(mo)m(ving)330 4234 y(co)s(de)31 b(to)g(new)f
-(platforms.)225 4371 y Fi(\017)60 b Fl(Memory)23 b(allo)s(cation)f
-(requests)h(are)g(handled)e(b)m(y)i Fj(malloc)p Fl(/)p
-Fj(free)p Fl(.)36 b(A)m(t)23 b(presen)m(t)g(there)g(is)f(no)h(facilit)m
-(y)330 4481 y(for)40 b(user-de\014ned)e(memory)i(allo)s(cators)g(in)f
-(the)h(\014le)g(I/O)g(functions)e(\(could)i(easily)f(b)s(e)g(added,)330
-4590 y(though\).)150 4842 y Ff(3.4.1)63 b Fe(BZ2_bzReadOpen)533
-5029 y Fj(typedef)46 b(void)h(BZFILE;)533 5236 y(BZFILE)f
-(*BZ2_bzReadOpen)e(\()j(int)g(*bzerror,)f(FILE)g(*f,)1726
-5340 y(int)h(small,)f(int)h(verbosity,)p eop
-%%Page: 20 21
-20 20 bop 150 -116 a Fl(Chapter)30 b(3:)h(Programming)e(with)g
-Fj(libbzip2)1891 b Fl(20)1726 299 y Fj(void)47 b(*unused,)f(int)g
-(nUnused)g(\);)150 456 y Fl(Prepare)29 b(to)g(read)g(compressed)f(data)
-i(from)e(\014le)g(handle)f Fj(f)p Fl(.)40 b Fj(f)29 b
-Fl(should)d(refer)j(to)h(a)f(\014le)f(whic)m(h)f(has)i(b)s(een)150
-565 y(op)s(ened)h(for)h(reading,)f(and)h(for)f(whic)m(h)g(the)h(error)g
-(indicator)e(\()p Fj(ferror\(f\))p Fl(\)is)f(not)k(set.)42
-b(If)31 b Fj(small)e Fl(is)h(1,)150 675 y(the)h(library)d(will)f(try)j
-(to)i(decompress)e(using)f(less)g(memory)-8 b(,)31 b(at)g(the)g(exp)s
-(ense)f(of)g(sp)s(eed.)150 832 y(F)-8 b(or)39 b(reasons)f(explained)f
-(b)s(elo)m(w,)j Fj(BZ2_bzRead)35 b Fl(will)h(decompress)i(the)g
-Fj(nUnused)e Fl(b)m(ytes)j(starting)f(at)150 941 y Fj(unused)p
-Fl(,)k(b)s(efore)e(starting)h(to)g(read)g(from)f(the)h(\014le)f
-Fj(f)p Fl(.)71 b(A)m(t)42 b(most)f Fj(BZ_MAX_UNUSED)c
-Fl(b)m(ytes)k(ma)m(y)h(b)s(e)150 1051 y(supplied)32 b(lik)m(e)k(this.)
-55 b(If)36 b(this)e(facilit)m(y)h(is)g(not)h(required,)g(y)m(ou)g
-(should)e(pass)h Fj(NULL)g Fl(and)g Fj(0)g Fl(for)h Fj(unused)150
-1160 y Fl(and)30 b(n)p Fj(Unused)e Fl(resp)s(ectiv)m(ely)-8
-b(.)150 1317 y(F)g(or)31 b(the)g(meaning)e(of)i(parameters)g
-Fj(small)e Fl(and)g Fj(verbosity)p Fl(,)f(see)j Fj
-(BZ2_bzDecompressInit)p Fl(.)150 1474 y(The)k(amoun)m(t)g(of)g(memory)g
-(needed)g(to)g(decompress)g(a)h(\014le)e(cannot)h(b)s(e)g(determined)e
-(un)m(til)h(the)h(\014le's)150 1584 y(header)22 b(has)f(b)s(een)g
-(read.)38 b(So)22 b(it)f(is)g(p)s(ossible)e(that)k Fj(BZ2_bzReadOpen)17
-b Fl(returns)k Fj(BZ_OK)f Fl(but)h(a)i(subsequen)m(t)150
-1693 y(call)30 b(of)g Fj(BZ2_bzRead)e Fl(will)f(return)j
-Fj(BZ_MEM_ERROR)p Fl(.)150 1850 y(P)m(ossible)f(assignmen)m(ts)h(to)h
-Fj(bzerror)p Fl(:)572 2001 y Fj(BZ_CONFIG_ERROR)663 2105
-y Fl(if)e(the)i(library)d(has)i(b)s(een)f(mis-compiled)572
-2209 y Fj(BZ_PARAM_ERROR)663 2313 y Fl(if)g Fj(f)h Fl(is)g
-Fj(NULL)663 2416 y Fl(or)g Fj(small)f Fl(is)g(neither)h
-Fj(0)g Fl(nor)g Fj(1)663 2520 y Fl(or)g Fj(\(unused)46
-b(==)h(NULL)g(&&)g(nUnused)f(!=)h(0\))663 2624 y Fl(or)30
-b Fj(\(unused)46 b(!=)h(NULL)g(&&)g(!\(0)g(<=)g(nUnused)f(<=)h
-(BZ_MAX_UNUSED\)\))572 2728 y(BZ_IO_ERROR)663 2831 y
-Fl(if)29 b Fj(ferror\(f\))f Fl(is)h(nonzero)572 2935
-y Fj(BZ_MEM_ERROR)663 3039 y Fl(if)g(insu\016cien)m(t)g(memory)h(is)f
-(a)m(v)-5 b(ailable)572 3143 y Fj(BZ_OK)663 3247 y Fl(otherwise.)150
-3403 y(P)m(ossible)29 b(return)h(v)-5 b(alues:)572 3554
-y(P)m(oin)m(ter)31 b(to)g(an)f(abstract)h Fj(BZFILE)663
-3658 y Fl(if)e Fj(bzerror)f Fl(is)i Fj(BZ_OK)572 3762
-y(NULL)663 3866 y Fl(otherwise)150 4023 y(Allo)m(w)m(able)g(next)g
-(actions:)572 4174 y Fj(BZ2_bzRead)663 4277 y Fl(if)f
-Fj(bzerror)f Fl(is)i Fj(BZ_OK)572 4381 y(BZ2_bzClose)663
-4485 y Fl(otherwise)150 4887 y Ff(3.4.2)63 b Fe(BZ2_bzRead)533
-5074 y Fj(int)47 b(BZ2_bzRead)e(\()j(int)e(*bzerror,)g(BZFILE)g(*b,)h
-(void)f(*buf,)h(int)g(len)g(\);)150 5230 y Fl(Reads)35
-b(up)f(to)h Fj(len)f Fl(\(uncompressed\))h(b)m(ytes)g(from)f(the)h
-(compressed)g(\014le)f Fj(b)g Fl(in)m(to)h(the)g(bu\013er)f
-Fj(buf)p Fl(.)53 b(If)150 5340 y(the)30 b(read)f(w)m(as)h(successful,)f
-Fj(bzerror)e Fl(is)i(set)h(to)g Fj(BZ_OK)e Fl(and)h(the)h(n)m(um)m(b)s
-(er)e(of)i(b)m(ytes)g(read)f(is)g(returned.)p eop
-%%Page: 21 22
-21 21 bop 150 -116 a Fl(Chapter)30 b(3:)41 b(Programming)29
-b(with)g Fj(libbzip2)1881 b Fl(21)150 299 y(If)33 b(the)g(logical)g
-(end-of-stream)h(w)m(as)g(detected,)i Fj(bzerror)31 b
-Fl(will)g(b)s(e)h(set)i(to)g Fj(BZ_STREAM_END)p Fl(,)d(and)i(the)150
-408 y(n)m(um)m(b)s(er)c(of)i(b)m(ytes)f(read)h(is)e(returned.)40
-b(All)29 b(other)h Fj(bzerror)f Fl(v)-5 b(alues)29 b(denote)i(an)g
-(error.)150 565 y Fj(BZ2_bzRead)37 b Fl(will)f(supply)h
-Fj(len)i Fl(b)m(ytes,)j(unless)c(the)i(logical)f(stream)h(end)e(is)h
-(detected)i(or)e(an)g(error)150 675 y(o)s(ccurs.)75 b(Because)43
-b(of)f(this,)i(it)d(is)g(p)s(ossible)e(to)k(detect)g(the)f(stream)g
-(end)f(b)m(y)h(observing)f(when)g(the)150 784 y(n)m(um)m(b)s(er)29
-b(of)h(b)m(ytes)g(returned)f(is)g(less)g(than)h(the)g(n)m(um)m(b)s(er)f
-(requested.)40 b(Nev)m(ertheless,)31 b(this)e(is)g(regarded)150
-894 y(as)38 b(inadvisable;)g(y)m(ou)g(should)d(instead)i(c)m(hec)m(k)i
-Fj(bzerror)d Fl(after)i(ev)m(ery)g(call)e(and)h(w)m(atc)m(h)i(out)f
-(for)f Fj(BZ_)150 1004 y(STREAM_END)p Fl(.)150 1160 y(In)m(ternally)-8
-b(,)47 b Fj(BZ2_bzRead)41 b Fl(copies)j(data)g(from)g(the)g(compressed)
-g(\014le)f(in)f(c)m(h)m(unks)i(of)g(size)g Fj(BZ_MAX_)150
-1270 y(UNUSED)31 b Fl(b)m(ytes)i(b)s(efore)f(decompressing)f(it.)47
-b(If)32 b(the)h(\014le)e(con)m(tains)i(more)g(b)m(ytes)g(than)f
-(strictly)f(needed)150 1380 y(to)48 b(reac)m(h)f(the)g(logical)f
-(end-of-stream,)52 b Fj(BZ2_bzRead)44 b Fl(will)g(almost)j(certainly)f
-(read)h(some)g(of)g(the)150 1489 y(trailing)c(data)j(b)s(efore)e
-(signalling)f Fj(BZ_SEQUENCE_END)p Fl(.)80 b(T)-8 b(o)46
-b(collect)f(the)g(read)g(but)g(un)m(used)e(data)150 1599
-y(once)29 b Fj(BZ_SEQUENCE_END)24 b Fl(has)k(app)s(eared,)g(call)f
-Fj(BZ2_bzReadGetUnused)c Fl(immediately)j(b)s(efore)i
-Fj(BZ2_)150 1708 y(bzReadClose)p Fl(.)150 1865 y(P)m(ossible)h
-(assignmen)m(ts)h(to)h Fj(bzerror)p Fl(:)572 2016 y Fj(BZ_PARAM_ERROR)
-663 2120 y Fl(if)e Fj(b)h Fl(is)g Fj(NULL)f Fl(or)h Fj(buf)g
-Fl(is)f Fj(NULL)g Fl(or)i Fj(len)46 b(<)i(0)572 2224
-y(BZ_SEQUENCE_ERROR)663 2328 y Fl(if)29 b Fj(b)h Fl(w)m(as)h(op)s(ened)
-e(with)h Fj(BZ2_bzWriteOpen)572 2431 y(BZ_IO_ERROR)663
-2535 y Fl(if)f(there)i(is)e(an)h(error)g(reading)g(from)g(the)g
-(compressed)g(\014le)572 2639 y Fj(BZ_UNEXPECTED_EOF)663
-2743 y Fl(if)f(the)i(compressed)f(\014le)f(ended)h(b)s(efore)g(the)g
-(logical)g(end-of-stream)h(w)m(as)g(detected)572 2847
-y Fj(BZ_DATA_ERROR)663 2950 y Fl(if)e(a)i(data)g(in)m(tegrit)m(y)f
-(error)g(w)m(as)h(detected)h(in)d(the)h(compressed)g(stream)572
-3054 y Fj(BZ_DATA_ERROR_MAGIC)663 3158 y Fl(if)f(the)i(stream)f(do)s
-(es)g(not)h(b)s(egin)e(with)g(the)i(requisite)e(header)h(b)m(ytes)h
-(\(ie,)f(is)g(not)663 3262 y(a)g Fj(bzip2)f Fl(data)i(\014le\).)61
-b(This)28 b(is)i(really)f(a)i(sp)s(ecial)e(case)i(of)g
-Fj(BZ_DATA_ERROR)p Fl(.)572 3365 y Fj(BZ_MEM_ERROR)663
-3469 y Fl(if)e(insu\016cien)m(t)g(memory)h(w)m(as)h(a)m(v)-5
-b(ailable)572 3573 y Fj(BZ_STREAM_END)663 3677 y Fl(if)29
-b(the)i(logical)e(end)h(of)h(stream)f(w)m(as)h(detected.)572
-3781 y Fj(BZ_OK)663 3884 y Fl(otherwise.)150 4041 y(P)m(ossible)e
-(return)h(v)-5 b(alues:)572 4192 y(n)m(um)m(b)s(er)29
-b(of)h(b)m(ytes)h(read)663 4296 y(if)e Fj(bzerror)f Fl(is)i
-Fj(BZ_OK)f Fl(or)h Fj(BZ_STREAM_END)572 4400 y Fl(unde\014ned)663
-4503 y(otherwise)150 4660 y(Allo)m(w)m(able)g(next)g(actions:)572
-4811 y(collect)h(data)g(from)f Fj(buf)p Fl(,)f(then)h
-Fj(BZ2_bzRead)e Fl(or)i Fj(BZ2_bzReadClose)663 4915 y
-Fl(if)f Fj(bzerror)f Fl(is)i Fj(BZ_OK)572 5019 y Fl(collect)h(data)g
-(from)f Fj(buf)p Fl(,)f(then)h Fj(BZ2_bzReadClose)d Fl(or)j
-Fj(BZ2_bzReadGetUnused)663 5123 y Fl(if)f Fj(bzerror)f
-Fl(is)i Fj(BZ_SEQUENCE_END)572 5226 y(BZ2_bzReadClose)663
-5330 y Fl(otherwise)p eop
-%%Page: 22 23
-22 22 bop 150 -116 a Fl(Chapter)30 b(3:)41 b(Programming)29
-b(with)g Fj(libbzip2)1881 b Fl(22)150 299 y Ff(3.4.3)63
-b Fe(BZ2_bzReadGetUnused)533 486 y Fj(void)47 b(BZ2_bzReadGetUnused)42
-b(\()48 b(int*)e(bzerror,)g(BZFILE)g(*b,)1822 589 y(void**)g(unused,)g
-(int*)g(nUnused)g(\);)150 746 y Fl(Returns)36 b(data)i(whic)m(h)d(w)m
-(as)j(read)f(from)f(the)h(compressed)g(\014le)f(but)g(w)m(as)h(not)h
-(needed)e(to)i(get)g(to)g(the)150 856 y(logical)k(end-of-stream.)78
-b Fj(*unused)41 b Fl(is)h(set)h(to)g(the)g(address)f(of)g(the)h(data,)k
-(and)42 b Fj(*nUnused)e Fl(to)k(the)150 965 y(n)m(um)m(b)s(er)29
-b(of)i(b)m(ytes.)41 b Fj(*nUnused)28 b Fl(will)g(b)s(e)h(set)i(to)g(a)g
-(v)-5 b(alue)30 b(b)s(et)m(w)m(een)h Fj(0)f Fl(and)g
-Fj(BZ_MAX_UNUSED)d Fl(inclusiv)m(e.)150 1122 y(This)d(function)h(ma)m
-(y)h(only)g(b)s(e)f(called)g(once)i Fj(BZ2_bzRead)c Fl(has)j(signalled)
-e Fj(BZ_STREAM_END)e Fl(but)j(b)s(efore)150 1232 y Fj(BZ2_bzReadClose)p
-Fl(.)150 1389 y(P)m(ossible)k(assignmen)m(ts)h(to)h Fj(bzerror)p
-Fl(:)572 1540 y Fj(BZ_PARAM_ERROR)663 1644 y Fl(if)e
-Fj(b)h Fl(is)g Fj(NULL)663 1747 y Fl(or)g Fj(unused)f
-Fl(is)g Fj(NULL)g Fl(or)i Fj(nUnused)d Fl(is)i Fj(NULL)572
-1851 y(BZ_SEQUENCE_ERROR)663 1955 y Fl(if)f Fj(BZ_STREAM_END)e
-Fl(has)j(not)h(b)s(een)e(signalled)663 2059 y(or)h(if)f
-Fj(b)h Fl(w)m(as)h(op)s(ened)f(with)f Fj(BZ2_bzWriteOpen)542
-2162 y(BZ_OK)663 2266 y Fl(otherwise)150 2423 y(Allo)m(w)m(able)h(next)
-g(actions:)572 2574 y Fj(BZ2_bzReadClose)150 2882 y Ff(3.4.4)63
-b Fe(BZ2_bzReadClose)533 3068 y Fj(void)47 b(BZ2_bzReadClose)c(\()48
-b(int)f(*bzerror,)e(BZFILE)h(*b)h(\);)150 3225 y Fl(Releases)36
-b(all)e(memory)h(p)s(ertaining)e(to)i(the)h(compressed)f(\014le)f
-Fj(b)p Fl(.)54 b Fj(BZ2_bzReadClose)31 b Fl(do)s(es)k(not)h(call)150
-3335 y Fj(fclose)c Fl(on)h(the)h(underlying)d(\014le)h(handle,)h(so)h
-(y)m(ou)g(should)e(do)h(that)h(y)m(ourself)f(if)g(appropriate.)49
-b Fj(BZ2_)150 3445 y(bzReadClose)27 b Fl(should)i(b)s(e)g(called)h(to)h
-(clean)f(up)g(after)h(all)e(error)h(situations.)150 3601
-y(P)m(ossible)f(assignmen)m(ts)h(to)h Fj(bzerror)p Fl(:)572
-3752 y Fj(BZ_SEQUENCE_ERROR)663 3856 y Fl(if)e Fj(b)h
-Fl(w)m(as)h(op)s(ened)e(with)h Fj(BZ2_bzOpenWrite)572
-3960 y(BZ_OK)663 4064 y Fl(otherwise)150 4221 y(Allo)m(w)m(able)g(next)
-g(actions:)572 4372 y(none)150 4679 y Ff(3.4.5)63 b Fe(BZ2_bzWriteOpen)
-533 4866 y Fj(BZFILE)46 b(*BZ2_bzWriteOpen)e(\()j(int)g(*bzerror,)e
-(FILE)i(*f,)1774 4970 y(int)g(blockSize100k,)d(int)j(verbosity,)1774
-5074 y(int)g(workFactor)e(\);)150 5230 y Fl(Prepare)33
-b(to)g(write)f(compressed)h(data)h(to)f(\014le)f(handle)g
-Fj(f)p Fl(.)47 b Fj(f)33 b Fl(should)e(refer)i(to)g(a)g(\014le)f(whic)m
-(h)g(has)h(b)s(een)150 5340 y(op)s(ened)d(for)g(writing,)e(and)i(for)g
-(whic)m(h)f(the)i(error)f(indicator)f(\()p Fj(ferror\(f\))p
-Fl(\)is)f(not)i(set.)p eop
-%%Page: 23 24
-23 23 bop 150 -116 a Fl(Chapter)30 b(3:)41 b(Programming)29
-b(with)g Fj(libbzip2)1881 b Fl(23)150 299 y(F)-8 b(or)31
-b(the)g(meaning)e(of)i(parameters)g Fj(blockSize100k)p
-Fl(,)c Fj(verbosity)g Fl(and)j Fj(workFactor)p Fl(,)e(see)150
-408 y Fj(BZ2_bzCompressInit)p Fl(.)150 565 y(All)d(required)f(memory)i
-(is)f(allo)s(cated)i(at)g(this)e(stage,)j(so)f(if)e(the)h(call)g
-(completes)g(successfully)-8 b(,)26 b Fj(BZ_MEM_)150
-675 y(ERROR)j Fl(cannot)i(b)s(e)f(signalled)e(b)m(y)i(a)h(subsequen)m
-(t)f(call)f(to)i Fj(BZ2_bzWrite)p Fl(.)150 832 y(P)m(ossible)e
-(assignmen)m(ts)h(to)h Fj(bzerror)p Fl(:)572 983 y Fj(BZ_CONFIG_ERROR)
-663 1087 y Fl(if)e(the)i(library)d(has)i(b)s(een)f(mis-compiled)572
-1190 y Fj(BZ_PARAM_ERROR)663 1294 y Fl(if)g Fj(f)h Fl(is)g
-Fj(NULL)663 1398 y Fl(or)g Fj(blockSize100k)44 b(<)k(1)30
-b Fl(or)g Fj(blockSize100k)44 b(>)k(9)572 1502 y(BZ_IO_ERROR)663
-1605 y Fl(if)29 b Fj(ferror\(f\))f Fl(is)h(nonzero)572
-1709 y Fj(BZ_MEM_ERROR)663 1813 y Fl(if)g(insu\016cien)m(t)g(memory)h
-(is)f(a)m(v)-5 b(ailable)572 1917 y Fj(BZ_OK)663 2021
-y Fl(otherwise)150 2177 y(P)m(ossible)29 b(return)h(v)-5
-b(alues:)572 2328 y(P)m(oin)m(ter)31 b(to)g(an)f(abstract)h
-Fj(BZFILE)663 2432 y Fl(if)e Fj(bzerror)f Fl(is)i Fj(BZ_OK)572
-2536 y(NULL)663 2640 y Fl(otherwise)150 2797 y(Allo)m(w)m(able)g(next)g
-(actions:)572 2948 y Fj(BZ2_bzWrite)663 3051 y Fl(if)f
-Fj(bzerror)f Fl(is)i Fj(BZ_OK)604 3155 y Fl(\(y)m(ou)25
-b(could)e(go)h(directly)f(to)h Fj(BZ2_bzWriteClose)p
-Fl(,)c(but)j(this)g(w)m(ould)g(b)s(e)g(prett)m(y)h(p)s(oin)m(tless\))
-572 3259 y Fj(BZ2_bzWriteClose)663 3363 y Fl(otherwise)150
-3639 y Ff(3.4.6)63 b Fe(BZ2_bzWrite)533 3826 y Fj(void)47
-b(BZ2_bzWrite)e(\()i(int)g(*bzerror,)e(BZFILE)h(*b,)h(void)g(*buf,)f
-(int)h(len)g(\);)150 3983 y Fl(Absorbs)26 b Fj(len)g
-Fl(b)m(ytes)i(from)e(the)i(bu\013er)e Fj(buf)p Fl(,)h(ev)m(en)m(tually)
-g(to)h(b)s(e)e(compressed)h(and)f(written)g(to)i(the)g(\014le.)150
-4140 y(P)m(ossible)h(assignmen)m(ts)h(to)h Fj(bzerror)p
-Fl(:)572 4291 y Fj(BZ_PARAM_ERROR)663 4395 y Fl(if)e
-Fj(b)h Fl(is)g Fj(NULL)f Fl(or)h Fj(buf)g Fl(is)f Fj(NULL)g
-Fl(or)i Fj(len)46 b(<)i(0)572 4498 y(BZ_SEQUENCE_ERROR)663
-4602 y Fl(if)29 b(b)h(w)m(as)h(op)s(ened)e(with)g Fj(BZ2_bzReadOpen)572
-4706 y(BZ_IO_ERROR)663 4810 y Fl(if)g(there)i(is)e(an)h(error)g
-(writing)f(the)h(compressed)g(\014le.)572 4914 y Fj(BZ_OK)663
-5017 y Fl(otherwise)150 5294 y Ff(3.4.7)63 b Fe(BZ2_bzWriteClose)p
-eop
-%%Page: 24 25
-24 24 bop 150 -116 a Fl(Chapter)30 b(3:)41 b(Programming)29
-b(with)g Fj(libbzip2)1881 b Fl(24)533 299 y Fj(void)47
-b(BZ2_bzWriteClose)c(\()48 b(int)f(*bzerror,)e(BZFILE*)h(f,)1679
-403 y(int)h(abandon,)1679 506 y(unsigned)e(int*)i(nbytes_in,)1679
-610 y(unsigned)e(int*)i(nbytes_out)e(\);)533 818 y(void)i
-(BZ2_bzWriteClose64)c(\()k(int)g(*bzerror,)e(BZFILE*)h(f,)1774
-922 y(int)h(abandon,)1774 1025 y(unsigned)f(int*)g(nbytes_in_lo32,)1774
-1129 y(unsigned)g(int*)g(nbytes_in_hi32,)1774 1233 y(unsigned)g(int*)g
-(nbytes_out_lo32,)1774 1337 y(unsigned)g(int*)g(nbytes_out_hi32)e(\);)
-150 1493 y Fl(Compresses)39 b(and)g(\015ushes)g(to)h(the)g(compressed)g
-(\014le)f(all)f(data)j(so)f(far)g(supplied)c(b)m(y)k
-Fj(BZ2_bzWrite)p Fl(.)150 1603 y(The)27 b(logical)g(end-of-stream)h
-(mark)m(ers)g(are)g(also)f(written,)h(so)f(subsequen)m(t)g(calls)g(to)h
-Fj(BZ2_bzWrite)d Fl(are)150 1713 y(illegal.)50 b(All)33
-b(memory)h(asso)s(ciated)g(with)f(the)i(compressed)e(\014le)h
-Fj(b)f Fl(is)g(released.)52 b Fj(fflush)33 b Fl(is)g(called)g(on)150
-1822 y(the)e(compressed)f(\014le,)f(but)h(it)g(is)f(not)i
-Fj(fclose)p Fl('d.)150 1979 y(If)i Fj(BZ2_bzWriteClose)c
-Fl(is)k(called)f(to)j(clean)e(up)f(after)i(an)g(error,)g(the)g(only)e
-(action)i(is)f(to)h(release)g(the)150 2089 y(memory)-8
-b(.)42 b(The)30 b(library)e(records)j(the)g(error)f(co)s(des)h(issued)e
-(b)m(y)h(previous)f(calls,)i(so)f(this)g(situation)g(will)150
-2198 y(b)s(e)c(detected)h(automatically)-8 b(.)40 b(There)26
-b(is)g(no)g(attempt)h(to)h(complete)e(the)h(compression)f(op)s
-(eration,)g(nor)150 2308 y(to)32 b Fj(fflush)d Fl(the)i(compressed)g
-(\014le.)42 b(Y)-8 b(ou)32 b(can)f(force)h(this)e(b)s(eha)m(viour)g(to)
-h(happ)s(en)f(ev)m(en)i(in)d(the)j(case)g(of)150 2417
-y(no)e(error,)g(b)m(y)h(passing)e(a)i(nonzero)f(v)-5
-b(alue)30 b(to)h Fj(abandon)p Fl(.)150 2574 y(If)j Fj(nbytes_in)d
-Fl(is)j(non-n)m(ull,)f Fj(*nbytes_in)e Fl(will)h(b)s(e)h(set)i(to)g(b)s
-(e)f(the)g(total)h(v)m(olume)f(of)g(uncompressed)150
-2684 y(data)k(handled.)60 b(Similarly)-8 b(,)35 b Fj(nbytes_out)g
-Fl(will)g(b)s(e)h(set)i(to)g(the)g(total)g(v)m(olume)f(of)g(compressed)
-g(data)150 2793 y(written.)h(F)-8 b(or)27 b(compatibilit)m(y)d(with)h
-(older)g(v)m(ersions)h(of)g(the)g(library)-8 b(,)25 b
-Fj(BZ2_bzWriteClose)d Fl(only)j(yields)150 2903 y(the)40
-b(lo)m(w)m(er)g(32)h(bits)d(of)i(these)h(coun)m(ts.)69
-b(Use)40 b Fj(BZ2_bzWriteClose64)35 b Fl(if)k(y)m(ou)h(w)m(an)m(t)h
-(the)f(full)d(64)k(bit)150 3013 y(coun)m(ts.)g(These)30
-b(t)m(w)m(o)i(functions)d(are)i(otherwise)f(absolutely)f(iden)m(tical.)
-150 3169 y(P)m(ossible)g(assignmen)m(ts)h(to)h Fj(bzerror)p
-Fl(:)572 3320 y Fj(BZ_SEQUENCE_ERROR)663 3424 y Fl(if)e
-Fj(b)h Fl(w)m(as)h(op)s(ened)e(with)h Fj(BZ2_bzReadOpen)572
-3528 y(BZ_IO_ERROR)663 3632 y Fl(if)f(there)i(is)e(an)h(error)g
-(writing)f(the)h(compressed)g(\014le)572 3736 y Fj(BZ_OK)663
-3839 y Fl(otherwise)150 4161 y Ff(3.4.8)63 b(Handling)41
-b(em)m(b)s(edded)g(compressed)h(data)e(streams)150 4354
-y Fl(The)i(high-lev)m(el)g(library)f(facilitates)h(use)h(of)g
-Fj(bzip2)e Fl(data)j(streams)f(whic)m(h)f(form)g(some)i(part)e(of)i(a)
-150 4463 y(surrounding,)27 b(larger)j(data)h(stream.)225
-4620 y Fi(\017)60 b Fl(F)-8 b(or)22 b(writing,)f(the)g(library)e(tak)m
-(es)k(an)e(op)s(en)f(\014le)g(handle,)i(writes)e(compressed)h(data)h
-(to)g(it,)g Fj(fflush)p Fl(es)330 4730 y(it)34 b(but)f(do)s(es)h(not)h
-Fj(fclose)d Fl(it.)52 b(The)34 b(calling)f(application)g(can)h(write)g
-(its)f(o)m(wn)i(data)g(b)s(efore)f(and)330 4839 y(after)d(the)f
-(compressed)h(data)g(stream,)g(using)d(that)j(same)g(\014le)f(handle.)
-225 5011 y Fi(\017)60 b Fl(Reading)34 b(is)f(more)i(complex,)g(and)f
-(the)h(facilities)d(are)j(not)g(as)g(general)f(as)h(they)f(could)g(b)s
-(e)g(since)330 5121 y(generalit)m(y)e(is)f(hard)f(to)j(reconcile)e
-(with)f(e\016ciency)-8 b(.)46 b Fj(BZ2_bzRead)29 b Fl(reads)i(from)g
-(the)h(compressed)330 5230 y(\014le)39 b(in)g(blo)s(c)m(ks)g(of)h(size)
-g Fj(BZ_MAX_UNUSED)c Fl(b)m(ytes,)44 b(and)39 b(in)g(doing)g(so)h
-(probably)e(will)f(o)m(v)m(ersho)s(ot)330 5340 y(the)i(logical)g(end)f
-(of)h(compressed)f(stream.)67 b(T)-8 b(o)40 b(reco)m(v)m(er)g(this)e
-(data)i(once)f(decompression)f(has)p eop
-%%Page: 25 26
-25 25 bop 150 -116 a Fl(Chapter)30 b(3:)41 b(Programming)29
-b(with)g Fj(libbzip2)1881 b Fl(25)330 299 y(ended,)28
-b(call)g Fj(BZ2_bzReadGetUnused)23 b Fl(after)29 b(the)g(last)f(call)g
-(of)g Fj(BZ2_bzRead)e Fl(\(the)j(one)g(returning)330
-408 y Fj(BZ_STREAM_END)p Fl(\))e(but)j(b)s(efore)g(calling)f
-Fj(BZ2_bzReadClose)p Fl(.)150 596 y(This)51 b(mec)m(hanism)g(mak)m(es)j
-(it)e(easy)h(to)g(decompress)f(m)m(ultiple)e Fj(bzip2)i
-Fl(streams)g(placed)g(end-to-)150 706 y(end.)90 b(As)48
-b(the)f(end)f(of)i(one)f(stream,)52 b(when)46 b Fj(BZ2_bzRead)f
-Fl(returns)h Fj(BZ_STREAM_END)p Fl(,)i(call)e Fj(BZ2_)150
-816 y(bzReadGetUnused)36 b Fl(to)41 b(collect)g(the)g(un)m(used)e(data)
-i(\(cop)m(y)g(it)f(in)m(to)g(y)m(our)h(o)m(wn)f(bu\013er)f
-(somewhere\).)150 925 y(That)25 b(data)g(forms)f(the)h(start)h(of)e
-(the)h(next)g(compressed)g(stream.)39 b(T)-8 b(o)25 b(start)h
-(uncompressing)c(that)k(next)150 1035 y(stream,)40 b(call)d
-Fj(BZ2_bzReadOpen)d Fl(again,)40 b(feeding)d(in)g(the)h(un)m(used)e
-(data)j(via)e(the)h Fj(unused)p Fl(/)p Fj(nUnused)150
-1144 y Fl(parameters.)54 b(Keep)34 b(doing)g(this)f(un)m(til)g
-Fj(BZ_STREAM_END)e Fl(return)j(coincides)f(with)h(the)g(ph)m(ysical)g
-(end)150 1254 y(of)d(\014le)e(\()p Fj(feof\(f\))p Fl(\).)39
-b(In)30 b(this)f(situation)h Fj(BZ2_bzReadGetUnused)25
-b Fl(will)i(of)k(course)g(return)e(no)h(data.)150 1411
-y(This)c(should)f(giv)m(e)j(some)g(feel)f(for)g(ho)m(w)h(the)g
-(high-lev)m(el)e(in)m(terface)i(can)f(b)s(e)g(used.)39
-b(If)27 b(y)m(ou)h(require)e(extra)150 1520 y(\015exibilit)m(y)-8
-b(,)28 b(y)m(ou'll)i(ha)m(v)m(e)h(to)g(bite)f(the)h(bullet)d(and)i(get)
-i(to)f(grips)e(with)g(the)h(lo)m(w-lev)m(el)h(in)m(terface.)150
-1779 y Ff(3.4.9)63 b(Standard)40 b(\014le-reading/writing)j(co)s(de)150
-1972 y Fl(Here's)31 b(ho)m(w)f(y)m(ou'd)h(write)e(data)j(to)f(a)f
-(compressed)g(\014le:)390 2330 y Fj(FILE*)142 b(f;)390
-2434 y(BZFILE*)46 b(b;)390 2538 y(int)238 b(nBuf;)390
-2642 y(char)190 b(buf[)46 b(/*)i(whatever)d(size)i(you)g(like)f(*/)i
-(];)390 2746 y(int)238 b(bzerror;)390 2849 y(int)g(nWritten;)390
-3057 y(f)47 b(=)h(fopen)e(\()i("myfile.bz2",)c("w")j(\);)390
-3161 y(if)g(\(!f\))g({)533 3264 y(/*)g(handle)f(error)h(*/)390
-3368 y(})390 3472 y(b)g(=)h(BZ2_bzWriteOpen)c(\()j(&bzerror,)e(f,)i(9)h
-(\);)390 3576 y(if)f(\(bzerror)f(!=)h(BZ_OK\))f({)533
-3680 y(BZ2_bzWriteClose)e(\()j(b)g(\);)533 3783 y(/*)g(handle)f(error)h
-(*/)390 3887 y(})390 4095 y(while)f(\()i(/*)f(condition)e(*/)i(\))h({)
-533 4198 y(/*)f(get)g(data)g(to)g(write)f(into)h(buf,)g(and)g(set)g
-(nBuf)f(appropriately)e(*/)533 4302 y(nWritten)i(=)h(BZ2_bzWrite)e(\()i
-(&bzerror,)f(b,)h(buf,)f(nBuf)h(\);)533 4406 y(if)g(\(bzerror)f(==)h
-(BZ_IO_ERROR\))e({)676 4510 y(BZ2_bzWriteClose)f(\()j(&bzerror,)e(b)j
-(\);)676 4614 y(/*)g(handle)e(error)g(*/)533 4717 y(})390
-4821 y(})390 5029 y(BZ2_bzWriteClose)d(\()48 b(&bzerror,)d(b)j(\);)390
-5132 y(if)f(\(bzerror)f(==)h(BZ_IO_ERROR\))d({)533 5236
-y(/*)j(handle)f(error)h(*/)390 5340 y(})p eop
-%%Page: 26 27
-26 26 bop 150 -116 a Fl(Chapter)30 b(3:)41 b(Programming)29
-b(with)g Fj(libbzip2)1881 b Fl(26)150 299 y(And)29 b(to)j(read)e(from)g
-(a)h(compressed)f(\014le:)390 450 y Fj(FILE*)142 b(f;)390
-554 y(BZFILE*)46 b(b;)390 657 y(int)238 b(nBuf;)390 761
-y(char)190 b(buf[)46 b(/*)i(whatever)d(size)i(you)g(like)f(*/)i(];)390
-865 y(int)238 b(bzerror;)390 969 y(int)g(nWritten;)390
-1176 y(f)47 b(=)h(fopen)e(\()i("myfile.bz2",)c("r")j(\);)390
-1280 y(if)g(\(!f\))g({)533 1384 y(/*)g(handle)f(error)h(*/)390
-1488 y(})390 1591 y(b)g(=)h(BZ2_bzReadOpen)c(\()j(&bzerror,)f(f,)h(0,)g
-(NULL,)f(0)i(\);)390 1695 y(if)f(\(bzerror)f(!=)h(BZ_OK\))f({)533
-1799 y(BZ2_bzReadClose)e(\()j(&bzerror,)f(b)h(\);)533
-1903 y(/*)g(handle)f(error)h(*/)390 2007 y(})390 2214
-y(bzerror)f(=)h(BZ_OK;)390 2318 y(while)f(\(bzerror)g(==)h(BZ_OK)f(&&)i
-(/*)f(arbitrary)e(other)h(conditions)f(*/\))i({)533 2422
-y(nBuf)g(=)g(BZ2_bzRead)e(\()j(&bzerror,)d(b,)i(buf,)g(/*)g(size)g(of)g
-(buf)g(*/)g(\);)533 2525 y(if)g(\(bzerror)f(==)h(BZ_OK\))f({)676
-2629 y(/*)i(do)f(something)e(with)i(buf[0)f(..)h(nBuf-1])f(*/)533
-2733 y(})390 2837 y(})390 2941 y(if)h(\(bzerror)f(!=)h(BZ_STREAM_END\))
-d({)533 3044 y(BZ2_bzReadClose)g(\()j(&bzerror,)f(b)h(\);)533
-3148 y(/*)g(handle)f(error)h(*/)390 3252 y(})g(else)g({)533
-3356 y(BZ2_bzReadClose)d(\()j(&bzerror)f(\);)390 3459
-y(})150 3753 y Fk(3.5)68 b(Utilit)l(y)47 b(functions)150
-4045 y Ff(3.5.1)63 b Fe(BZ2_bzBuffToBuffCompress)533
-4232 y Fj(int)47 b(BZ2_bzBuffToBuffCompress\()41 b(char*)428
-b(dest,)1965 4335 y(unsigned)46 b(int*)g(destLen,)1965
-4439 y(char*)428 b(source,)1965 4543 y(unsigned)46 b(int)94
-b(sourceLen,)1965 4647 y(int)524 b(blockSize100k,)1965
-4751 y(int)g(verbosity,)1965 4854 y(int)g(workFactor)45
-b(\);)150 5011 y Fl(A)m(ttempts)33 b(to)g(compress)f(the)g(data)h(in)e
-Fj(source[0)d(..)i(sourceLen-1])e Fl(in)m(to)k(the)h(destination)e
-(bu\013er,)150 5121 y Fj(dest[0)e(..)g(*destLen-1])p
-Fl(.)37 b(If)26 b(the)g(destination)g(bu\013er)f(is)h(big)f(enough,)j
-Fj(*destLen)c Fl(is)h(set)i(to)g(the)g(size)150 5230
-y(of)i(the)f(compressed)h(data,)g(and)f Fj(BZ_OK)f Fl(is)h(returned.)39
-b(If)28 b(the)h(compressed)f(data)h(w)m(on't)g(\014t,)g
-Fj(*destLen)150 5340 y Fl(is)g(unc)m(hanged,)i(and)e
-Fj(BZ_OUTBUFF_FULL)e Fl(is)i(returned.)p eop
-%%Page: 27 28
-27 27 bop 150 -116 a Fl(Chapter)30 b(3:)h(Programming)e(with)g
-Fj(libbzip2)1891 b Fl(27)150 299 y(Compression)22 b(in)g(this)h(manner)
-g(is)g(a)h(one-shot)g(ev)m(en)m(t,)j(done)c(with)g(a)h(single)e(call)h
-(to)i(this)d(function.)37 b(The)150 408 y(resulting)25
-b(compressed)i(data)i(is)d(a)i(complete)f Fj(bzip2)f
-Fl(format)i(data)g(stream.)40 b(There)27 b(is)f(no)i(mec)m(hanism)150
-518 y(for)23 b(making)g(additional)e(calls)i(to)h(pro)m(vide)f(extra)h
-(input)e(data.)39 b(If)23 b(y)m(ou)h(w)m(an)m(t)g(that)g(kind)e(of)h
-(mec)m(hanism,)150 628 y(use)30 b(the)h(lo)m(w-lev)m(el)f(in)m
-(terface.)150 784 y(F)-8 b(or)31 b(the)g(meaning)e(of)i(parameters)g
-Fj(blockSize100k)p Fl(,)c Fj(verbosity)g Fl(and)j Fj(workFactor)p
-Fl(,)150 894 y(see)h Fj(BZ2_bzCompressInit)p Fl(.)150
-1051 y(T)-8 b(o)27 b(guaran)m(tee)h(that)e(the)h(compressed)f(data)h
-(will)d(\014t)i(in)f(its)g(bu\013er,)i(allo)s(cate)f(an)g(output)g
-(bu\013er)g(of)g(size)150 1160 y(1\045)31 b(larger)f(than)g(the)g
-(uncompressed)f(data,)j(plus)c(six)h(h)m(undred)g(extra)i(b)m(ytes.)150
-1317 y Fj(BZ2_bzBuffToBuffDecompre)o(ss)25 b Fl(will)k(not)j(write)e
-(data)j(at)f(or)f(b)s(ey)m(ond)g Fj(dest[*destLen])p
-Fl(,)d(ev)m(en)k(in)150 1427 y(case)f(of)g(bu\013er)e(o)m(v)m(er\015o)m
-(w.)150 1584 y(P)m(ossible)g(return)h(v)-5 b(alues:)572
-1735 y Fj(BZ_CONFIG_ERROR)663 1839 y Fl(if)29 b(the)i(library)d(has)i
-(b)s(een)f(mis-compiled)572 1942 y Fj(BZ_PARAM_ERROR)663
-2046 y Fl(if)g Fj(dest)g Fl(is)h Fj(NULL)f Fl(or)h Fj(destLen)f
-Fl(is)g Fj(NULL)663 2150 y Fl(or)h Fj(blockSize100k)44
-b(<)k(1)30 b Fl(or)g Fj(blockSize100k)44 b(>)k(9)663
-2254 y Fl(or)30 b Fj(verbosity)45 b(<)j(0)30 b Fl(or)g
-Fj(verbosity)45 b(>)j(4)663 2357 y Fl(or)30 b Fj(workFactor)45
-b(<)j(0)30 b Fl(or)g Fj(workFactor)45 b(>)i(250)572 2461
-y(BZ_MEM_ERROR)663 2565 y Fl(if)29 b(insu\016cien)m(t)g(memory)h(is)f
-(a)m(v)-5 b(ailable)572 2669 y Fj(BZ_OUTBUFF_FULL)663
-2773 y Fl(if)29 b(the)i(size)f(of)g(the)h(compressed)f(data)h(exceeds)g
-Fj(*destLen)572 2876 y(BZ_OK)663 2980 y Fl(otherwise)150
-3349 y Ff(3.5.2)63 b Fe(BZ2_bzBuffToBuffDecompress)533
-3536 y Fj(int)47 b(BZ2_bzBuffToBuffDecompres)o(s)42 b(\()47
-b(char*)428 b(dest,)2108 3640 y(unsigned)46 b(int*)g(destLen,)2108
-3744 y(char*)428 b(source,)2108 3848 y(unsigned)46 b(int)94
-b(sourceLen,)2108 3951 y(int)524 b(small,)2108 4055 y(int)g(verbosity)
-46 b(\);)150 4212 y Fl(A)m(ttempts)24 b(to)g(decompress)f(the)g(data)g
-(in)f Fj(source[0)28 b(..)i(sourceLen-1])20 b Fl(in)m(to)j(the)g
-(destination)f(bu\013er,)150 4322 y Fj(dest[0)29 b(..)g(*destLen-1])p
-Fl(.)37 b(If)26 b(the)g(destination)g(bu\013er)f(is)h(big)f(enough,)j
-Fj(*destLen)c Fl(is)h(set)i(to)g(the)g(size)150 4431
-y(of)21 b(the)g(uncompressed)e(data,)24 b(and)c Fj(BZ_OK)f
-Fl(is)h(returned.)36 b(If)20 b(the)h(compressed)g(data)g(w)m(on't)h
-(\014t,)g Fj(*destLen)150 4541 y Fl(is)29 b(unc)m(hanged,)i(and)e
-Fj(BZ_OUTBUFF_FULL)e Fl(is)i(returned.)150 4698 y Fj(source)g
-Fl(is)g(assumed)h(to)h(hold)e(a)i(complete)f Fj(bzip2)f
-Fl(format)i(data)g(stream.)150 4807 y Fj(BZ2_bzBuffToBuffDecompre)o(ss)
-22 b Fl(tries)28 b(to)i(decompress)e(the)h(en)m(tiret)m(y)g(of)g(the)f
-(stream)h(in)m(to)g(the)f(out-)150 4917 y(put)i(bu\013er.)150
-5074 y(F)-8 b(or)31 b(the)g(meaning)e(of)i(parameters)g
-Fj(small)e Fl(and)g Fj(verbosity)p Fl(,)f(see)j Fj
-(BZ2_bzDecompressInit)p Fl(.)150 5230 y(Because)j(the)f(compression)e
-(ratio)i(of)g(the)g(compressed)f(data)h(cannot)g(b)s(e)f(kno)m(wn)g(in)
-g(adv)-5 b(ance,)34 b(there)150 5340 y(is)d(no)h(easy)g(w)m(a)m(y)h(to)
-f(guaran)m(tee)i(that)e(the)g(output)f(bu\013er)g(will)e(b)s(e)i(big)g
-(enough.)45 b(Y)-8 b(ou)32 b(ma)m(y)h(of)f(course)p eop
-%%Page: 28 29
-28 28 bop 150 -116 a Fl(Chapter)30 b(3:)41 b(Programming)29
-b(with)g Fj(libbzip2)1881 b Fl(28)150 299 y(mak)m(e)36
-b(arrangemen)m(ts)f(in)e(y)m(our)i(co)s(de)g(to)g(record)g(the)g(size)f
-(of)h(the)g(uncompressed)f(data,)i(but)e(suc)m(h)h(a)150
-408 y(mec)m(hanism)30 b(is)f(b)s(ey)m(ond)h(the)g(scop)s(e)h(of)f(this)
-g(library)-8 b(.)150 565 y Fj(BZ2_bzBuffToBuffDecompre)o(ss)25
-b Fl(will)k(not)j(write)e(data)j(at)f(or)f(b)s(ey)m(ond)g
-Fj(dest[*destLen])p Fl(,)d(ev)m(en)k(in)150 675 y(case)f(of)g(bu\013er)
-e(o)m(v)m(er\015o)m(w.)150 832 y(P)m(ossible)g(return)h(v)-5
-b(alues:)572 983 y Fj(BZ_CONFIG_ERROR)663 1087 y Fl(if)29
-b(the)i(library)d(has)i(b)s(een)f(mis-compiled)572 1190
-y Fj(BZ_PARAM_ERROR)663 1294 y Fl(if)g Fj(dest)g Fl(is)h
-Fj(NULL)f Fl(or)h Fj(destLen)f Fl(is)g Fj(NULL)663 1398
-y Fl(or)h Fj(small)46 b(!=)i(0)f(&&)g(small)g(!=)g(1)663
-1502 y Fl(or)30 b Fj(verbosity)45 b(<)j(0)30 b Fl(or)g
-Fj(verbosity)45 b(>)j(4)572 1605 y(BZ_MEM_ERROR)663 1709
-y Fl(if)29 b(insu\016cien)m(t)g(memory)h(is)f(a)m(v)-5
-b(ailable)572 1813 y Fj(BZ_OUTBUFF_FULL)663 1917 y Fl(if)29
-b(the)i(size)f(of)g(the)h(compressed)f(data)h(exceeds)g
-Fj(*destLen)572 2021 y(BZ_DATA_ERROR)663 2124 y Fl(if)e(a)i(data)g(in)m
-(tegrit)m(y)f(error)g(w)m(as)h(detected)h(in)d(the)h(compressed)g(data)
-572 2228 y Fj(BZ_DATA_ERROR_MAGIC)663 2332 y Fl(if)f(the)i(compressed)f
-(data)h(do)s(esn't)f(b)s(egin)f(with)g(the)i(righ)m(t)e(magic)i(b)m
-(ytes)572 2436 y Fj(BZ_UNEXPECTED_EOF)663 2539 y Fl(if)e(the)i
-(compressed)f(data)h(ends)e(unexp)s(ectedly)572 2643
-y Fj(BZ_OK)663 2747 y Fl(otherwise)150 3116 y Fk(3.6)68
-b Fd(zlib)43 b Fk(compatibilit)l(y)k(functions)150 3308
-y Fl(Y)-8 b(oshiok)j(a)33 b(Tsuneo)e(has)h(con)m(tributed)g(some)g
-(functions)f(to)i(giv)m(e)g(b)s(etter)f Fj(zlib)f Fl(compatibilit)m(y)
--8 b(.)45 b(These)150 3418 y(functions)36 b(are)i Fj(BZ2_bzopen)p
-Fl(,)e Fj(BZ2_bzread)p Fl(,)h Fj(BZ2_bzwrite)p Fl(,)f
-Fj(BZ2_bzflush)p Fl(,)h Fj(BZ2_bzclose)p Fl(,)f Fj(BZ2_)150
-3527 y(bzerror)23 b Fl(and)h Fj(BZ2_bzlibVersion)p Fl(.)34
-b(These)25 b(functions)e(are)j(not)f(\(y)m(et\))h(o\016cially)e(part)h
-(of)g(the)g(library)-8 b(.)150 3637 y(If)30 b(they)g(break,)h(y)m(ou)g
-(get)g(to)g(k)m(eep)g(all)f(the)g(pieces.)41 b(Nev)m(ertheless,)31
-b(I)f(think)f(they)i(w)m(ork)f(ok.)390 3788 y Fj(typedef)46
-b(void)g(BZFILE;)390 3995 y(const)g(char)h(*)g(BZ2_bzlibVersion)d(\()j
-(void)g(\);)150 4152 y Fl(Returns)29 b(a)i(string)f(indicating)e(the)i
-(library)e(v)m(ersion.)390 4303 y Fj(BZFILE)46 b(*)i(BZ2_bzopen)92
-b(\()48 b(const)e(char)h(*path,)f(const)g(char)h(*mode)f(\);)390
-4407 y(BZFILE)g(*)i(BZ2_bzdopen)c(\()k(int)381 b(fd,)190
-b(const)46 b(char)h(*mode)f(\);)150 4564 y Fl(Op)s(ens)19
-b(a)j Fj(.bz2)e Fl(\014le)g(for)g(reading)g(or)h(writing,)g(using)f
-(either)g(its)h(name)g(or)g(a)g(pre-existing)f(\014le)g(descriptor.)150
-4674 y(Analogous)30 b(to)i Fj(fopen)c Fl(and)i Fj(fdopen)p
-Fl(.)390 4825 y Fj(int)47 b(BZ2_bzread)93 b(\()47 b(BZFILE*)f(b,)h
-(void*)f(buf,)h(int)g(len)g(\);)390 4928 y(int)g(BZ2_bzwrite)e(\()i
-(BZFILE*)f(b,)h(void*)f(buf,)h(int)g(len)g(\);)150 5085
-y Fl(Reads/writes)30 b(data)h(from/to)g(a)g(previously)d(op)s(ened)i
-Fj(BZFILE)p Fl(.)39 b(Analogous)30 b(to)h Fj(fread)e
-Fl(and)h Fj(fwrite)p Fl(.)390 5236 y Fj(int)95 b(BZ2_bzflush)44
-b(\()k(BZFILE*)e(b)h(\);)390 5340 y(void)g(BZ2_bzclose)d(\()k(BZFILE*)e
-(b)h(\);)p eop
-%%Page: 29 30
-29 29 bop 150 -116 a Fl(Chapter)30 b(3:)41 b(Programming)29
-b(with)g Fj(libbzip2)1881 b Fl(29)150 299 y(Flushes/closes)27
-b(a)h Fj(BZFILE)p Fl(.)39 b Fj(BZ2_bzflush)24 b Fl(do)s(esn't)k
-(actually)f(do)h(an)m(ything.)39 b(Analogous)28 b(to)h
-Fj(fflush)150 408 y Fl(and)h Fj(fclose)p Fl(.)390 559
-y Fj(const)46 b(char)h(*)g(BZ2_bzerror)e(\()j(BZFILE)e(*b,)h(int)g
-(*errnum)e(\))150 716 y Fl(Returns)31 b(a)i(string)e(describing)f(the)i
-(more)g(recen)m(t)h(error)f(status)h(of)f Fj(b)p Fl(,)g(and)g(also)g
-(sets)h Fj(*errnum)d Fl(to)j(its)150 826 y(n)m(umerical)c(v)-5
-b(alue.)150 1242 y Fk(3.7)68 b(Using)46 b(the)f(library)g(in)g(a)g
-Fd(stdio)p Fk(-free)f(en)l(vironmen)l(t)150 1615 y Ff(3.7.1)63
-b(Getting)40 b(rid)h(of)g Fe(stdio)150 1807 y Fl(In)i(a)g(deeply)g(em)m
-(b)s(edded)f(application,)j(y)m(ou)f(migh)m(t)f(w)m(an)m(t)h(to)g(use)f
-(just)g(the)h(memory-to-memory)150 1917 y(functions.)39
-b(Y)-8 b(ou)30 b(can)f(do)g(this)g(con)m(v)m(enien)m(tly)g(b)m(y)g
-(compiling)e(the)j(library)d(with)h(prepro)s(cessor)g(sym)m(b)s(ol)150
-2026 y Fj(BZ_NO_STDIO)35 b Fl(de\014ned.)63 b(Doing)39
-b(this)e(giv)m(es)h(y)m(ou)h(a)f(library)e(con)m(taining)i(only)f(the)i
-(follo)m(wing)e(eigh)m(t)150 2136 y(functions:)150 2293
-y Fj(BZ2_bzCompressInit)p Fl(,)26 b Fj(BZ2_bzCompress)p
-Fl(,)g Fj(BZ2_bzCompressEnd)150 2402 y(BZ2_bzDecompressInit)p
-Fl(,)f Fj(BZ2_bzDecompress)p Fl(,)h Fj(BZ2_bzDecompressEnd)150
-2512 y(BZ2_bzBuffToBuffCompress)o Fl(,)f Fj(BZ2_bzBuffToBuffDecompre)o
-(ss)150 2669 y Fl(When)30 b(compiled)f(lik)m(e)h(this,)f(all)g
-(functions)g(will)f(ignore)i Fj(verbosity)e Fl(settings.)150
-3006 y Ff(3.7.2)63 b(Critical)40 b(error)h(handling)150
-3199 y Fj(libbzip2)20 b Fl(con)m(tains)j(a)g(n)m(um)m(b)s(er)f(of)g(in)
-m(ternal)g(assertion)g(c)m(hec)m(ks)i(whic)m(h)d(should,)i(needless)f
-(to)h(sa)m(y)-8 b(,)26 b(nev)m(er)150 3308 y(b)s(e)g(activ)-5
-b(ated.)40 b(Nev)m(ertheless,)28 b(if)d(an)i(assertion)f(should)e
-(fail,)i(b)s(eha)m(viour)f(dep)s(ends)f(on)j(whether)e(or)i(not)150
-3418 y(the)k(library)d(w)m(as)i(compiled)f(with)g Fj(BZ_NO_STDIO)e
-Fl(set.)150 3575 y(F)-8 b(or)31 b(a)g(normal)e(compile,)h(an)g
-(assertion)g(failure)f(yields)f(the)j(message)533 3726
-y Fj(bzip2/libbzip2:)44 b(internal)h(error)i(number)f(N.)533
-3829 y(This)h(is)g(a)g(bug)g(in)h(bzip2/libbzip2,)43
-b(1.0)k(of)g(21-Mar-2000.)533 3933 y(Please)f(report)g(it)i(to)f(me)g
-(at:)g(jseward@acm.org.)91 b(If)47 b(this)g(happened)533
-4037 y(when)g(you)g(were)f(using)h(some)f(program)g(which)h(uses)f
-(libbzip2)g(as)h(a)533 4141 y(component,)e(you)i(should)f(also)h
-(report)f(this)h(bug)f(to)i(the)f(author\(s\))533 4244
-y(of)g(that)g(program.)93 b(Please)46 b(make)h(an)g(effort)f(to)h
-(report)g(this)f(bug;)533 4348 y(timely)g(and)h(accurate)f(bug)h
-(reports)e(eventually)g(lead)i(to)g(higher)533 4452 y(quality)f
-(software.)93 b(Thanks.)h(Julian)46 b(Seward,)f(21)j(March)e(2000.)150
-4609 y Fl(where)30 b Fj(N)g Fl(is)f(some)i(error)f(co)s(de)h(n)m(um)m
-(b)s(er.)39 b Fj(exit\(3\))28 b Fl(is)i(then)g(called.)150
-4766 y(F)-8 b(or)31 b(a)g Fj(stdio)p Fl(-free)e(library)-8
-b(,)29 b(assertion)h(failures)e(result)i(in)f(a)i(call)e(to)i(a)g
-(function)e(declared)h(as:)533 4917 y Fj(extern)46 b(void)h
-(bz_internal_error)c(\()k(int)g(errcode)f(\);)150 5074
-y Fl(The)30 b(relev)-5 b(an)m(t)31 b(co)s(de)f(is)g(passed)f(as)i(a)g
-(parameter.)41 b(Y)-8 b(ou)31 b(should)d(supply)g(suc)m(h)i(a)h
-(function.)150 5230 y(In)g(either)g(case,)j(once)e(an)g(assertion)g
-(failure)e(has)h(o)s(ccurred,)h(an)m(y)g Fj(bz_stream)e
-Fl(records)h(in)m(v)m(olv)m(ed)h(can)150 5340 y(b)s(e)e(regarded)g(as)h
-(in)m(v)-5 b(alid.)38 b(Y)-8 b(ou)31 b(should)d(not)j(attempt)g(to)g
-(resume)f(normal)g(op)s(eration)f(with)g(them.)p eop
-%%Page: 30 31
-30 30 bop 150 -116 a Fl(Chapter)30 b(3:)41 b(Programming)29
-b(with)g Fj(libbzip2)1881 b Fl(30)150 299 y(Y)-8 b(ou)22
-b(ma)m(y)-8 b(,)25 b(of)d(course,)h(c)m(hange)g(critical)e(error)g
-(handling)e(to)j(suit)f(y)m(our)g(needs.)38 b(As)21 b(I)h(said)e(ab)s
-(o)m(v)m(e,)25 b(critical)150 408 y(errors)30 b(indicate)g(bugs)g(in)g
-(the)h(library)d(and)i(should)f(not)i(o)s(ccur.)42 b(All)29
-b Fj(")p Fl(normal)p Fj(")h Fl(error)g(situations)g(are)150
-518 y(indicated)f(via)h(error)g(return)f(co)s(des)i(from)f(functions,)f
-(and)g(can)i(b)s(e)f(reco)m(v)m(ered)i(from.)150 798
-y Fk(3.8)68 b(Making)45 b(a)g(Windo)l(ws)h(DLL)150 990
-y Fl(Ev)m(erything)30 b(related)g(to)h(Windo)m(ws)f(has)g(b)s(een)f
-(con)m(tributed)h(b)m(y)g(Y)-8 b(oshiok)j(a)31 b(Tsuneo)150
-1100 y(\()p Fj(QWF00133@niftyserve.or.jp)46 b Fl(/)52
-b Fj(tsuneo-y@is.aist-nara.ac.j)o(p)p Fl(\),)g(so)h(y)m(ou)f(should)f
-(send)150 1210 y(y)m(our)30 b(queries)g(to)h(him)e(\(but)h(p)s(erhaps)e
-(Cc:)41 b(me,)31 b Fj(jseward@acm.org)p Fl(\).)150 1366
-y(My)43 b(v)-5 b(ague)44 b(understanding)d(of)i(what)g(to)h(do)f(is:)65
-b(using)41 b(Visual)h(C)p Fj(++)g Fl(5.0,)48 b(op)s(en)42
-b(the)h(pro)5 b(ject)44 b(\014le)150 1476 y Fj(libbz2.dsp)p
-Fl(,)28 b(and)i(build.)37 b(That's)31 b(all.)150 1633
-y(If)41 b(y)m(ou)g(can't)h(op)s(en)e(the)h(pro)5 b(ject)42
-b(\014le)e(for)h(some)g(reason,)j(mak)m(e)e(a)g(new)e(one,)k(naming)c
-(these)i(\014les:)150 1742 y Fj(blocksort.c)p Fl(,)28
-b Fj(bzlib.c)p Fl(,)g Fj(compress.c)p Fl(,)g Fj(crctable.c)p
-Fl(,)g Fj(decompress.c)p Fl(,)f Fj(huffman.c)p Fl(,)150
-1852 y Fj(randtable.c)32 b Fl(and)j Fj(libbz2.def)p Fl(.)53
-b(Y)-8 b(ou)36 b(will)d(also)i(need)g(to)h(name)g(the)g(header)f
-(\014les)f Fj(bzlib.h)g Fl(and)150 1962 y Fj(bzlib_private.h)p
-Fl(.)150 2118 y(If)c(y)m(ou)h(don't)f(use)g(V)m(C)p Fj(++)p
-Fl(,)g(y)m(ou)h(ma)m(y)g(need)f(to)h(de\014ne)f(the)h(propro)s(cessor)e
-(sym)m(b)s(ol)g Fj(_WIN32)p Fl(.)150 2275 y(Finally)-8
-b(,)28 b Fj(dlltest.c)e Fl(is)h(a)i(sample)f(program)g(using)g(the)g
-(DLL.)h(It)g(has)f(a)h(pro)5 b(ject)29 b(\014le,)g Fj(dlltest.dsp)p
-Fl(.)150 2432 y(If)h(y)m(ou)h(just)e(w)m(an)m(t)j(a)e(mak)m(e\014le)h
-(for)f(Visual)f(C,)h(ha)m(v)m(e)i(a)e(lo)s(ok)g(at)i
-Fj(makefile.msc)p Fl(.)150 2589 y(Be)k(a)m(w)m(are)g(that)g(if)e(y)m
-(ou)h(compile)f Fj(bzip2)g Fl(itself)g(on)h(Win32,)h(y)m(ou)g(m)m(ust)f
-(set)g Fj(BZ_UNIX)e Fl(to)j(0)f(and)g Fj(BZ_)150 2698
-y(LCCWIN32)27 b Fl(to)j(1,)g(in)f(the)g(\014le)g Fj(bzip2.c)p
-Fl(,)e(b)s(efore)i(compiling.)39 b(Otherwise)28 b(the)h(resulting)f
-(binary)f(w)m(on't)150 2808 y(w)m(ork)j(correctly)-8
-b(.)150 2965 y(I)30 b(ha)m(v)m(en't)i(tried)d(an)m(y)i(of)g(this)e
-(stu\013)h(m)m(yself,)g(but)g(it)f(all)h(lo)s(oks)g(plausible.)p
-eop
-%%Page: 31 32
-31 31 bop 150 -116 a Fl(Chapter)30 b(4:)41 b(Miscellanea)2586
-b(31)150 299 y Fh(4)80 b(Miscellanea)150 583 y Fl(These)30
-b(are)h(just)f(some)g(random)g(though)m(ts)h(of)f(mine.)40
-b(Y)-8 b(our)30 b(mileage)h(ma)m(y)g(v)-5 b(ary)d(.)150
-884 y Fk(4.1)68 b(Limitations)47 b(of)e(the)g(compressed)g(\014le)h
-(format)150 1077 y Fj(bzip2-1.0)p Fl(,)e Fj(0.9.5)e Fl(and)g
-Fj(0.9.0)g Fl(use)h(exactly)h(the)f(same)h(\014le)e(format)i(as)f(the)h
-(previous)d(v)m(ersion,)150 1186 y Fj(bzip2-0.1)p Fl(.)75
-b(This)41 b(decision)g(w)m(as)i(made)g(in)e(the)i(in)m(terests)g(of)g
-(stabilit)m(y)-8 b(.)77 b(Creating)42 b(y)m(et)i(another)150
-1296 y(incompatible)21 b(compressed)i(\014le)f(format)i(w)m(ould)e
-(create)i(further)e(confusion)g(and)h(disruption)d(for)j(users.)150
-1453 y(Nev)m(ertheless,)31 b(this)e(is)g(not)h(a)g(painless)e
-(decision.)39 b(Dev)m(elopmen)m(t)31 b(w)m(ork)f(since)f(the)h(release)
-h(of)f Fj(bzip2-)150 1562 y(0.1)19 b Fl(in)g(August)i(1997)h(has)e(sho)
-m(wn)f(complexities)h(in)f(the)h(\014le)g(format)g(whic)m(h)f(slo)m(w)h
-(do)m(wn)g(decompression)150 1672 y(and,)30 b(in)f(retrosp)s(ect,)i
-(are)g(unnecessary)-8 b(.)40 b(These)31 b(are:)225 1829
-y Fi(\017)60 b Fl(The)20 b(run-length)g(enco)s(der,)i(whic)m(h)e(is)g
-(the)h(\014rst)f(of)h(the)g(compression)f(transformations,)i(is)e(en)m
-(tirely)330 1938 y(irrelev)-5 b(an)m(t.)63 b(The)38 b(original)e(purp)s
-(ose)g(w)m(as)j(to)g(protect)g(the)f(sorting)g(algorithm)f(from)g(the)i
-(v)m(ery)330 2048 y(w)m(orst)h(case)h(input:)58 b(a)41
-b(string)e(of)h(rep)s(eated)g(sym)m(b)s(ols.)68 b(But)40
-b(algorithm)f(steps)h(Q6a)h(and)e(Q6b)330 2157 y(in)30
-b(the)i(original)e(Burro)m(ws-Wheeler)i(tec)m(hnical)g(rep)s(ort)f
-(\(SR)m(C-124\))i(sho)m(w)f(ho)m(w)g(rep)s(eats)g(can)g(b)s(e)330
-2267 y(handled)c(without)i(di\016cult)m(y)f(in)g(blo)s(c)m(k)h
-(sorting.)225 2409 y Fi(\017)60 b Fl(The)30 b(randomisation)e(mec)m
-(hanism)i(do)s(esn't)g(really)f(need)h(to)g(b)s(e)g(there.)41
-b(Udi)29 b(Man)m(b)s(er)h(and)f(Gene)330 2518 y(My)m(ers)j(published)c
-(a)33 b(su\016x)e(arra)m(y)h(construction)f(algorithm)g(a)h(few)g(y)m
-(ears)h(bac)m(k,)g(whic)m(h)d(can)j(b)s(e)330 2628 y(emplo)m(y)m(ed)27
-b(to)h(sort)g(an)m(y)f(blo)s(c)m(k,)h(no)f(matter)h(ho)m(w)f(rep)s
-(etitiv)m(e,)h(in)d(O\(N)j(log)f(N\))h(time.)39 b(Subsequen)m(t)330
-2737 y(w)m(ork)25 b(b)m(y)f(Kunihik)m(o)f(Sadak)-5 b(ane)24
-b(has)h(pro)s(duced)e(a)i(deriv)-5 b(ativ)m(e)24 b(O\(N)h(\(log)g(N\))p
-Fj(^)p Fl(2\))h(algorithm)d(whic)m(h)330 2847 y(usually)28
-b(outp)s(erforms)h(the)i(Man)m(b)s(er-My)m(ers)g(algorithm.)330
-2988 y(I)g(could)g(ha)m(v)m(e)i(c)m(hanged)f(to)g(Sadak)-5
-b(ane's)32 b(algorithm,)f(but)g(I)g(\014nd)f(it)h(to)h(b)s(e)f(slo)m(w)
-m(er)h(than)f Fj(bzip2)p Fl('s)330 3098 y(existing)38
-b(algorithm)g(for)h(most)h(inputs,)f(and)g(the)g(randomisation)f(mec)m
-(hanism)g(protects)i(ade-)330 3208 y(quately)34 b(against)f(bad)g
-(cases.)52 b(I)33 b(didn't)f(think)g(it)i(w)m(as)g(a)g(go)s(o)s(d)f
-(tradeo\013)i(to)f(mak)m(e.)51 b(P)m(artly)34 b(this)330
-3317 y(is)39 b(due)h(to)h(the)f(fact)h(that)g(I)f(w)m(as)g(not)h(\015o)
-s(o)s(ded)e(with)g(email)g(complain)m(ts)g(ab)s(out)h
-Fj(bzip2-0.1)p Fl('s)330 3427 y(p)s(erformance)30 b(on)g(rep)s(etitiv)m
-(e)g(data,)h(so)g(p)s(erhaps)d(it)i(isn't)g(a)h(problem)d(for)j(real)f
-(inputs.)330 3568 y(Probably)i(the)h(b)s(est)g(long-term)g(solution,)g
-(and)g(the)g(one)h(I)f(ha)m(v)m(e)h(incorp)s(orated)e(in)m(to)i(0.9.5)h
-(and)330 3678 y(ab)s(o)m(v)m(e,)42 b(is)c(to)h(use)f(the)h(existing)f
-(sorting)g(algorithm)f(initially)-8 b(,)38 b(and)g(fall)f(bac)m(k)i(to)
-h(a)f(O\(N)f(\(log)330 3787 y(N\))p Fj(^)p Fl(2\))31
-b(algorithm)f(if)f(the)i(standard)e(algorithm)h(gets)h(in)m(to)f
-(di\016culties.)225 3929 y Fi(\017)60 b Fl(The)31 b(compressed)f
-(\014le)g(format)i(w)m(as)f(nev)m(er)h(designed)d(to)j(b)s(e)f(handled)
-e(b)m(y)i(a)g(library)-8 b(,)29 b(and)i(I)g(ha)m(v)m(e)330
-4039 y(had)d(to)i(jump)e(though)g(some)i(ho)s(ops)e(to)i(pro)s(duce)e
-(an)h(e\016cien)m(t)g(implemen)m(tation)f(of)h(decompres-)330
-4148 y(sion.)38 b(It's)26 b(a)h(bit)e(hairy)-8 b(.)38
-b(T)-8 b(ry)26 b(passing)f Fj(decompress.c)d Fl(through)k(the)g(C)f
-(prepro)s(cessor)g(and)h(y)m(ou'll)330 4258 y(see)32
-b(what)g(I)f(mean.)45 b(Muc)m(h)32 b(of)g(this)e(complexit)m(y)i(could)
-f(ha)m(v)m(e)i(b)s(een)e(a)m(v)m(oided)h(if)e(the)i(compressed)330
-4367 y(size)e(of)h(eac)m(h)g(blo)s(c)m(k)f(of)h(data)g(w)m(as)g
-(recorded)f(in)f(the)h(data)h(stream.)225 4509 y Fi(\017)60
-b Fl(An)30 b(Adler-32)g(c)m(hec)m(ksum,)i(rather)e(than)g(a)h(CR)m(C32)
-g(c)m(hec)m(ksum,)g(w)m(ould)e(b)s(e)h(faster)h(to)g(compute.)150
-4698 y(It)e(w)m(ould)f(b)s(e)g(fair)g(to)h(sa)m(y)h(that)g(the)f
-Fj(bzip2)e Fl(format)i(w)m(as)h(frozen)f(b)s(efore)f(I)h(prop)s(erly)d
-(and)j(fully)d(under-)150 4807 y(sto)s(o)s(d)k(the)h(p)s(erformance)e
-(consequences)i(of)g(doing)e(so.)150 4964 y(Impro)m(v)m(emen)m(ts)d
-(whic)m(h)e(I)i(w)m(as)g(able)f(to)h(incorp)s(orate)f(in)m(to)g(0.9.0,)
-k(despite)24 b(using)g(the)i(same)g(\014le)e(format,)150
-5074 y(are:)225 5230 y Fi(\017)60 b Fl(Single)30 b(arra)m(y)i(implemen)
-m(tation)e(of)h(the)h(in)m(v)m(erse)f(BWT.)h(This)e(signi\014can)m(tly)
-f(sp)s(eeds)i(up)f(decom-)330 5340 y(pression,)f(presumably)f(b)s
-(ecause)i(it)g(reduces)g(the)h(n)m(um)m(b)s(er)e(of)i(cac)m(he)h
-(misses.)p eop
-%%Page: 32 33
-32 32 bop 150 -116 a Fl(Chapter)30 b(4:)41 b(Miscellanea)2586
-b(32)225 299 y Fi(\017)60 b Fl(F)-8 b(aster)27 b(in)m(v)m(erse)e(MTF)h
-(transform)f(for)g(large)h(MTF)f(v)-5 b(alues.)39 b(The)25
-b(new)g(implemen)m(tation)f(is)g(based)330 408 y(on)30
-b(the)h(notion)f(of)g(sliding)e(blo)s(c)m(ks)h(of)i(v)-5
-b(alues.)225 544 y Fi(\017)60 b Fj(bzip2-0.9.0)24 b Fl(no)m(w)k(reads)f
-(and)f(writes)h(\014les)f(with)g Fj(fread)g Fl(and)h
-Fj(fwrite)p Fl(;)f(v)m(ersion)h(0.1)i(used)d Fj(putc)330
-653 y Fl(and)k Fj(getc)p Fl(.)39 b(Duh!)h(W)-8 b(ell,)31
-b(y)m(ou)f(liv)m(e)g(and)g(learn.)150 836 y(F)-8 b(urther)30
-b(ahead,)g(it)f(w)m(ould)g(b)s(e)g(nice)h(to)g(b)s(e)g(able)f(to)i(do)e
-(random)g(access)j(in)m(to)d(\014les.)40 b(This)28 b(will)f(require)150
-945 y(some)k(careful)e(design)h(of)g(compressed)g(\014le)g(formats.)150
-1227 y Fk(4.2)68 b(P)l(ortabilit)l(y)47 b(issues)150
-1419 y Fl(After)36 b(some)g(consideration,)g(I)f(ha)m(v)m(e)i(decided)d
-(not)i(to)g(use)g(GNU)g Fj(autoconf)d Fl(to)j(con\014gure)g(0.9.5)h(or)
-150 1529 y(1.0.)150 1686 y Fj(autoconf)p Fl(,)31 b(admirable)g(and)h(w)
-m(onderful)f(though)i(it)f(is,)h(mainly)d(assists)j(with)e(p)s
-(ortabilit)m(y)g(problems)150 1795 y(b)s(et)m(w)m(een)f(Unix-lik)m(e)d
-(platforms.)40 b(But)29 b Fj(bzip2)f Fl(do)s(esn't)h(ha)m(v)m(e)h(m)m
-(uc)m(h)f(in)f(the)h(w)m(a)m(y)h(of)g(p)s(ortabilit)m(y)d(prob-)150
-1905 y(lems)35 b(on)h(Unix;)j(most)d(of)g(the)h(di\016culties)d(app)s
-(ear)h(when)g(p)s(orting)g(to)i(the)f(Mac,)j(or)d(to)h(Microsoft's)150
-2015 y(op)s(erating)26 b(systems.)40 b Fj(autoconf)25
-b Fl(do)s(esn't)h(help)g(in)f(those)j(cases,)h(and)d(brings)f(in)g(a)j
-(whole)e(load)g(of)h(new)150 2124 y(complexit)m(y)-8
-b(.)150 2281 y(Most)28 b(p)s(eople)f(should)f(b)s(e)h(able)g(to)h
-(compile)e(the)i(library)d(and)i(program)h(under)e(Unix)g(straigh)m(t)i
-(out-of-)150 2391 y(the-b)s(o)m(x,)j(so)g(to)g(sp)s(eak,)f(esp)s
-(ecially)f(if)g(y)m(ou)i(ha)m(v)m(e)g(a)g(v)m(ersion)f(of)g(GNU)h(C)f
-(a)m(v)-5 b(ailable.)150 2547 y(There)32 b(are)h(a)g(couple)f(of)h
-Fj(__inline__)d Fl(directiv)m(es)i(in)f(the)i(co)s(de.)48
-b(GNU)33 b(C)f(\()p Fj(gcc)p Fl(\))g(should)f(b)s(e)h(able)g(to)150
-2657 y(handle)24 b(them.)39 b(If)25 b(y)m(ou're)i(not)e(using)g(GNU)h
-(C,)f(y)m(our)h(C)f(compiler)f(shouldn't)g(see)i(them)f(at)i(all.)38
-b(If)25 b(y)m(our)150 2767 y(compiler)k(do)s(es,)i(for)g(some)g
-(reason,)h(see)f(them)g(and)f(do)s(esn't)h(lik)m(e)f(them,)i(just)e
-Fj(#define)f(__inline__)150 2876 y Fl(to)37 b(b)s(e)f
-Fj(/*)30 b(*/)p Fl(.)58 b(One)36 b(easy)h(w)m(a)m(y)g(to)h(do)e(this)f
-(is)h(to)h(compile)e(with)g(the)i(\015ag)g Fj(-D__inline__=)p
-Fl(,)d(whic)m(h)150 2986 y(should)28 b(b)s(e)i(understo)s(o)s(d)f(b)m
-(y)h(most)h(Unix)e(compilers.)150 3143 y(If)35 b(y)m(ou)g(still)e(ha)m
-(v)m(e)j(di\016culties,)e(try)h(compiling)e(with)g(the)j(macro)f
-Fj(BZ_STRICT_ANSI)c Fl(de\014ned.)54 b(This)150 3252
-y(should)28 b(enable)i(y)m(ou)h(to)g(build)d(the)i(library)e(in)h(a)i
-(strictly)f(ANSI)g(complian)m(t)f(en)m(vironmen)m(t.)41
-b(Building)150 3362 y(the)25 b(program)f(itself)f(lik)m(e)g(this)h(is)f
-(dangerous)h(and)g(not)g(supp)s(orted,)g(since)g(y)m(ou)h(remo)m(v)m(e)
-g Fj(bzip2)p Fl('s)e(c)m(hec)m(ks)150 3471 y(against)30
-b(compressing)f(directories,)g(sym)m(b)s(olic)g(links,)f(devices,)i
-(and)f(other)h(not-really-a-\014le)g(en)m(tities.)150
-3581 y(This)f(could)g(cause)i(\014lesystem)f(corruption!)150
-3738 y(One)e(other)i(thing:)39 b(if)27 b(y)m(ou)j(create)g(a)f
-Fj(bzip2)f Fl(binary)f(for)i(public)d(distribution,)g(please)i(try)h
-(and)g(link)d(it)150 3847 y(statically)g(\()p Fj(gcc)k(-s)p
-Fl(\).)39 b(This)25 b(a)m(v)m(oids)i(all)f(sorts)h(of)g(library-v)m
-(ersion)d(issues)h(that)i(others)g(ma)m(y)g(encoun)m(ter)150
-3957 y(later)j(on.)150 4114 y(If)f(y)m(ou)g(build)e Fj(bzip2)h
-Fl(on)h(Win32,)h(y)m(ou)f(m)m(ust)g(set)h Fj(BZ_UNIX)e
-Fl(to)i(0)f(and)g Fj(BZ_LCCWIN32)d Fl(to)k(1,)g(in)e(the)i(\014le)150
-4223 y Fj(bzip2.c)p Fl(,)f(b)s(efore)h(compiling.)38
-b(Otherwise)29 b(the)i(resulting)d(binary)h(w)m(on't)i(w)m(ork)f
-(correctly)-8 b(.)150 4505 y Fk(4.3)68 b(Rep)t(orting)46
-b(bugs)150 4698 y Fl(I)25 b(tried)f(prett)m(y)i(hard)e(to)i(mak)m(e)g
-(sure)f Fj(bzip2)e Fl(is)i(bug)f(free,)j(b)s(oth)d(b)m(y)h(design)f
-(and)h(b)m(y)g(testing.)39 b(Hop)s(efully)150 4807 y(y)m(ou'll)29
-b(nev)m(er)i(need)f(to)h(read)g(this)e(section)h(for)h(real.)150
-4964 y(Nev)m(ertheless,)36 b(if)c Fj(bzip2)h Fl(dies)g(with)f(a)i
-(segmen)m(tation)h(fault,)g(a)f(bus)f(error)g(or)h(an)g(in)m(ternal)e
-(assertion)150 5074 y(failure,)i(it)h(will)d(ask)j(y)m(ou)g(to)g(email)
-f(me)h(a)g(bug)f(rep)s(ort.)54 b(Exp)s(erience)33 b(with)h(v)m(ersion)g
-(0.1)i(sho)m(ws)e(that)150 5183 y(almost)c(all)g(these)h(problems)d
-(can)j(b)s(e)f(traced)h(to)g(either)f(compiler)e(bugs)i(or)g(hardw)m
-(are)g(problems.)225 5340 y Fi(\017)60 b Fl(Recompile)22
-b(the)h(program)g(with)f(no)h(optimisation,)g(and)f(see)i(if)e(it)g(w)m
-(orks.)39 b(And/or)22 b(try)h(a)g(di\013eren)m(t)p eop
-%%Page: 33 34
-33 33 bop 150 -116 a Fl(Chapter)30 b(4:)41 b(Miscellanea)2586
-b(33)330 299 y(compiler.)77 b(I)43 b(heard)f(all)g(sorts)h(of)h
-(stories)e(ab)s(out)h(v)-5 b(arious)42 b(\015a)m(v)m(ours)h(of)h(GNU)f
-(C)g(\(and)g(other)330 408 y(compilers\))20 b(generating)i(bad)e(co)s
-(de)i(for)f Fj(bzip2)p Fl(,)h(and)f(I'v)m(e)h(run)e(across)i(t)m(w)m(o)
-g(suc)m(h)f(examples)g(m)m(yself.)330 606 y(2.7.X)35
-b(v)m(ersions)e(of)g(GNU)h(C)f(are)h(kno)m(wn)f(to)h(generate)h(bad)d
-(co)s(de)i(from)f(time)g(to)h(time,)g(at)g(high)330 716
-y(optimisation)20 b(lev)m(els.)37 b(If)21 b(y)m(ou)g(get)i(problems,)e
-(try)g(using)f(the)i(\015ags)f Fj(-O2)f(-fomit-frame-pointer)330
-825 y(-fno-strength-reduce)p Fl(.)35 b(Y)-8 b(ou)31 b(should)d(sp)s
-(eci\014cally)h Fc(not)j Fl(use)e Fj(-funroll-loops)p
-Fl(.)330 1023 y(Y)-8 b(ou)38 b(ma)m(y)g(notice)g(that)g(the)g(Mak)m
-(e\014le)g(runs)e(six)g(tests)i(as)g(part)f(of)h(the)g(build)c(pro)s
-(cess.)62 b(If)37 b(the)330 1132 y(program)43 b(passes)g(all)f(of)h
-(these,)k(it's)c(a)h(prett)m(y)f(go)s(o)s(d)g(\(but)g(not)g(100\045\))i
-(indication)c(that)j(the)330 1242 y(compiler)29 b(has)h(done)g(its)g
-(job)g(correctly)-8 b(.)225 1440 y Fi(\017)60 b Fl(If)33
-b Fj(bzip2)f Fl(crashes)i(randomly)-8 b(,)33 b(and)g(the)h(crashes)g
-(are)g(not)g(rep)s(eatable,)g(y)m(ou)g(ma)m(y)g(ha)m(v)m(e)h(a)f
-(\015aky)330 1549 y(memory)k(subsystem.)64 b Fj(bzip2)37
-b Fl(really)g(hammers)h(y)m(our)g(memory)g(hierarc)m(h)m(y)-8
-b(,)41 b(and)d(if)f(it's)h(a)h(bit)330 1659 y(marginal,)33
-b(y)m(ou)h(ma)m(y)g(get)h(these)f(problems.)49 b(Ditto)34
-b(if)f(y)m(our)h(disk)e(or)h(I/O)h(subsystem)e(is)h(slo)m(wly)330
-1768 y(failing.)39 b(Y)-8 b(up,)30 b(this)f(really)g(do)s(es)h(happ)s
-(en.)330 1966 y(T)-8 b(ry)28 b(using)f(a)i(di\013eren)m(t)f(mac)m(hine)
-g(of)h(the)g(same)f(t)m(yp)s(e,)i(and)e(see)h(if)e(y)m(ou)i(can)g(rep)s
-(eat)g(the)f(problem.)225 2163 y Fi(\017)60 b Fl(This)21
-b(isn't)i(really)f(a)h(bug,)i(but)d(...)39 b(If)23 b
-Fj(bzip2)f Fl(tells)g(y)m(ou)h(y)m(our)h(\014le)e(is)g(corrupted)h(on)g
-(decompression,)330 2273 y(and)29 b(y)m(ou)g(obtained)f(the)i(\014le)e
-(via)h(FTP)-8 b(,)29 b(there)h(is)e(a)h(p)s(ossibilit)m(y)d(that)k(y)m
-(ou)f(forgot)h(to)g(tell)e(FTP)h(to)330 2383 y(do)23
-b(a)g(binary)e(mo)s(de)i(transfer.)38 b(That)23 b(absolutely)f(will)e
-(cause)j(the)h(\014le)e(to)h(b)s(e)g(non-decompressible.)330
-2492 y(Y)-8 b(ou'll)30 b(ha)m(v)m(e)h(to)g(transfer)f(it)g(again.)150
-2737 y(If)i(y)m(ou'v)m(e)h(incorp)s(orated)e Fj(libbzip2)f
-Fl(in)m(to)i(y)m(our)g(o)m(wn)g(program)g(and)g(are)g(getting)h
-(problems,)e(please,)150 2847 y(please,)d(please,)h(c)m(hec)m(k)g(that)
-f(the)g(parameters)g(y)m(ou)g(are)g(passing)f(in)f(calls)h(to)h(the)g
-(library)-8 b(,)26 b(are)j(correct,)150 2956 y(and)e(in)f(accordance)k
-(with)c(what)i(the)g(do)s(cumen)m(tation)f(sa)m(ys)h(is)f(allo)m(w)m
-(able.)39 b(I)28 b(ha)m(v)m(e)h(tried)e(to)h(mak)m(e)h(the)150
-3066 y(library)f(robust)i(against)g(suc)m(h)g(problems,)f(but)h(I'm)g
-(sure)g(I)g(ha)m(v)m(en't)h(succeeded.)150 3223 y(Finally)-8
-b(,)32 b(if)g(the)h(ab)s(o)m(v)m(e)i(commen)m(ts)e(don't)g(help,)g(y)m
-(ou'll)f(ha)m(v)m(e)i(to)g(send)e(me)h(a)g(bug)g(rep)s(ort.)48
-b(No)m(w,)34 b(it's)150 3332 y(just)c(amazing)g(ho)m(w)h(man)m(y)f(p)s
-(eople)g(will)d(send)j(me)g(a)h(bug)f(rep)s(ort)g(sa)m(ying)g
-(something)g(lik)m(e)481 3483 y(bzip2)f(crashed)h(with)f(segmen)m
-(tation)j(fault)e(on)g(m)m(y)g(mac)m(hine)150 3640 y(and)h(absolutely)f
-(nothing)h(else.)44 b(Needless)32 b(to)g(sa)m(y)-8 b(,)33
-b(a)f(suc)m(h)f(a)h(rep)s(ort)f(is)g Fc(totally)-8 b(,)32
-b(utterly)-8 b(,)32 b(completely)150 3750 y(and)40 b(comprehensiv)m
-(ely)g(100\045)h(useless;)46 b(a)41 b(w)m(aste)g(of)g(y)m(our)g(time,)i
-(m)m(y)e(time,)i(and)e(net)g(bandwidth)p Fl(.)150 3859
-y(With)31 b(no)h(details)f(at)i(all,)e(there's)h(no)g(w)m(a)m(y)h(I)f
-(can)g(p)s(ossibly)d(b)s(egin)h(to)j(\014gure)e(out)i(what)e(the)i
-(problem)150 3969 y(is.)150 4126 y(The)d(rules)e(of)i(the)g(game)h
-(are:)41 b(facts,)32 b(facts,)f(facts.)41 b(Don't)31
-b(omit)f(them)g(b)s(ecause)g Fj(")p Fl(oh,)g(they)g(w)m(on't)h(b)s(e)
-150 4235 y(relev)-5 b(an)m(t)p Fj(")p Fl(.)41 b(A)m(t)31
-b(the)g(bare)f(minim)m(um:)481 4386 y(Mac)m(hine)h(t)m(yp)s(e.)61
-b(Op)s(erating)29 b(system)h(v)m(ersion.)481 4490 y(Exact)h(v)m(ersion)
-f(of)h Fj(bzip2)e Fl(\(do)h Fj(bzip2)47 b(-V)p Fl(\).)481
-4594 y(Exact)31 b(v)m(ersion)f(of)h(the)f(compiler)f(used.)481
-4698 y(Flags)i(passed)e(to)j(the)e(compiler.)150 4854
-y(Ho)m(w)m(ev)m(er,)i(the)d(most)h(imp)s(ortan)m(t)f(single)f(thing)g
-(that)i(will)d(help)h(me)h(is)f(the)i(\014le)e(that)i(y)m(ou)g(w)m(ere)
-g(trying)150 4964 y(to)f(compress)f(or)g(decompress)g(at)h(the)f(time)g
-(the)g(problem)f(happ)s(ened.)38 b(Without)28 b(that,)h(m)m(y)g(abilit)
-m(y)d(to)150 5074 y(do)k(an)m(ything)g(more)h(than)f(sp)s(eculate)g(ab)
-s(out)g(the)g(cause,)i(is)d(limited.)150 5230 y(Please)34
-b(remem)m(b)s(er)f(that)h(I)f(connect)i(to)f(the)g(In)m(ternet)g(with)e
-(a)i(mo)s(dem,)g(so)f(y)m(ou)h(should)e(con)m(tact)k(me)150
-5340 y(b)s(efore)30 b(mailing)e(me)j(h)m(uge)f(\014les.)p
-eop
-%%Page: 34 35
-34 34 bop 150 -116 a Fl(Chapter)30 b(4:)41 b(Miscellanea)2586
-b(34)150 299 y Fk(4.4)68 b(Did)45 b(y)l(ou)g(get)h(the)f(righ)l(t)h
-(pac)l(k)-7 b(age?)150 491 y Fj(bzip2)34 b Fl(is)h(a)h(resource)g(hog.)
-56 b(It)36 b(soaks)g(up)f(large)g(amoun)m(ts)h(of)g(CPU)f(cycles)h(and)
-f(memory)-8 b(.)57 b(Also,)36 b(it)150 601 y(giv)m(es)26
-b(v)m(ery)h(large)f(latencies.)39 b(In)25 b(the)h(w)m(orst)g(case,)i(y)
-m(ou)f(can)f(feed)g(man)m(y)g(megab)m(ytes)h(of)f(uncompressed)150
-711 y(data)45 b(in)m(to)e(the)i(library)c(b)s(efore)j(getting)g(an)m(y)
-g(compressed)g(output,)j(so)d(this)f(probably)f(rules)h(out)150
-820 y(applications)29 b(requiring)e(in)m(teractiv)m(e)32
-b(b)s(eha)m(viour.)150 977 y(These)38 b(aren't)h(faults)e(of)h(m)m(y)g
-(implemen)m(tation,)h(I)f(hop)s(e,)i(but)d(more)h(an)g(in)m(trinsic)e
-(prop)s(ert)m(y)h(of)i(the)150 1087 y(Burro)m(ws-Wheeler)30
-b(transform)g(\(unfortunately\).)40 b(Ma)m(yb)s(e)31
-b(this)e(isn't)h(what)g(y)m(ou)h(w)m(an)m(t.)150 1244
-y(If)h(y)m(ou)h(w)m(an)m(t)g(a)g(compressor)g(and/or)f(library)e(whic)m
-(h)h(is)h(faster,)i(uses)e(less)g(memory)g(but)g(gets)h(prett)m(y)150
-1353 y(go)s(o)s(d)e(compression,)g(and)g(has)h(minimal)c(latency)-8
-b(,)33 b(consider)e(Jean-loup)f(Gailly's)g(and)h(Mark)h(Adler's)150
-1463 y(w)m(ork,)f Fj(zlib-1.1.2)c Fl(and)j Fj(gzip-1.2.4)p
-Fl(.)38 b(Lo)s(ok)31 b(for)f(them)g(at)150 1620 y Fj
-(http://www.cdrom.com/pub)o(/inf)o(ozip)o(/zl)o(ib)24
-b Fl(and)30 b Fj(http://www.gzip.org)25 b Fl(resp)s(ectiv)m(ely)-8
-b(.)150 1776 y(F)g(or)32 b(something)f(faster)i(and)e(ligh)m(ter)f
-(still,)h(y)m(ou)g(migh)m(t)h(try)f(Markus)h(F)g(X)f(J)h(Ob)s(erh)m
-(umer's)d Fj(LZO)i Fl(real-)150 1886 y(time)f
-(compression/decompression)f(library)-8 b(,)28 b(at)150
-1996 y Fj(http://wildsau.idv.uni-l)o(inz.)o(ac.a)o(t/m)o(fx/l)o(zo.h)o
-(tml)o Fl(.)150 2152 y(If)38 b(y)m(ou)h(w)m(an)m(t)g(to)h(use)e(the)g
-Fj(bzip2)g Fl(algorithms)f(to)i(compress)f(small)g(blo)s(c)m(ks)f(of)i
-(data,)j(64k)d(b)m(ytes)g(or)150 2262 y(smaller,)i(for)e(example)g(on)h
-(an)f(on-the-\015y)h(disk)e(compressor,)k(y)m(ou'd)e(b)s(e)f(w)m(ell)g
-(advised)f(not)i(to)g(use)150 2372 y(this)i(library)-8
-b(.)77 b(Instead,)47 b(I'v)m(e)d(made)f(a)h(sp)s(ecial)e(library)f
-(tuned)h(for)h(that)h(kind)d(of)j(use.)79 b(It's)43 b(part)150
-2481 y(of)d Fj(e2compr-0.40)p Fl(,)f(an)g(on-the-\015y)h(disk)e
-(compressor)h(for)h(the)f(Lin)m(ux)f Fj(ext2)h Fl(\014lesystem.)67
-b(Lo)s(ok)40 b(at)150 2591 y Fj(http://www.netspace.net.)o(au/~)o(reit)
-o(er/)o(e2co)o(mpr)p Fl(.)150 2880 y Fk(4.5)68 b(T)-11
-b(esting)150 3072 y Fl(A)30 b(record)h(of)f(the)h(tests)g(I'v)m(e)g
-(done.)150 3229 y(First,)f(some)h(data)g(sets:)225 3386
-y Fi(\017)60 b Fl(B:)32 b(a)f(directory)f(con)m(taining)h(6001)i
-(\014les,)d(one)h(for)g(ev)m(ery)h(length)e(in)g(the)h(range)g(0)h(to)f
-(6000)i(b)m(ytes.)330 3496 y(The)d(\014les)f(con)m(tain)i(random)e(lo)m
-(w)m(ercase)j(letters.)41 b(18.7)32 b(megab)m(ytes.)225
-3633 y Fi(\017)60 b Fl(H:)36 b(m)m(y)f(home)h(directory)f(tree.)56
-b(Do)s(cumen)m(ts,)38 b(source)d(co)s(de,)i(mail)d(\014les,)i
-(compressed)f(data.)57 b(H)330 3743 y(con)m(tains)39
-b(B,)h(and)f(also)g(a)g(directory)g(of)g(\014les)f(designed)g(as)i(b)s
-(oundary)d(cases)j(for)f(the)g(sorting;)330 3853 y(mostly)30
-b(v)m(ery)h(rep)s(etitiv)m(e,)f(nast)m(y)h(\014les.)39
-b(565)32 b(megab)m(ytes.)225 3990 y Fi(\017)60 b Fl(A:)43
-b(directory)f(tree)i(holding)d(v)-5 b(arious)41 b(applications)g(built)
-g(from)h(source:)66 b Fj(egcs)p Fl(,)45 b Fj(gcc-2.8.1)p
-Fl(,)330 4100 y(KDE,)31 b(GTK,)f(Octa)m(v)m(e,)j(etc.)41
-b(2200)33 b(megab)m(ytes.)150 4285 y(The)i(tests)g(conducted)g(are)h
-(as)f(follo)m(ws.)54 b(Eac)m(h)36 b(test)g(means)f(compressing)f(\(a)h
-(cop)m(y)h(of)7 b(\))36 b(eac)m(h)g(\014le)e(in)150 4394
-y(the)d(data)g(set,)g(decompressing)e(it)h(and)g(comparing)f(it)h
-(against)h(the)g(original.)150 4551 y(First,)26 b(a)g(bunc)m(h)f(of)h
-(tests)h(with)d(blo)s(c)m(k)h(sizes)h(and)f(in)m(ternal)g(bu\013er)f
-(sizes)i(set)g(v)m(ery)g(small,)g(to)g(detect)i(an)m(y)150
-4661 y(problems)g(with)g(the)i(blo)s(c)m(king)f(and)g(bu\013ering)e
-(mec)m(hanisms.)40 b(This)28 b(required)g(mo)s(difying)f(the)j(source)
-150 4770 y(co)s(de)h(so)f(as)h(to)g(try)f(to)h(break)g(it.)199
-4927 y(1.)61 b(Data)32 b(set)f(H,)g(with)e(bu\013er)g(size)h(of)h(1)g
-(b)m(yte,)g(and)f(blo)s(c)m(k)g(size)g(of)g(23)i(b)m(ytes.)199
-5065 y(2.)61 b(Data)32 b(set)f(B,)g(bu\013er)e(sizes)h(1)h(b)m(yte,)g
-(blo)s(c)m(k)f(size)g(1)h(b)m(yte.)199 5202 y(3.)61 b(As)30
-b(\(2\))i(but)d(small-mo)s(de)g(decompression.)199 5340
-y(4.)61 b(As)30 b(\(2\))i(with)d(blo)s(c)m(k)h(size)g(2)h(b)m(ytes.)p
-eop
-%%Page: 35 36
-35 35 bop 150 -116 a Fl(Chapter)30 b(4:)41 b(Miscellanea)2586
-b(35)199 299 y(5.)61 b(As)30 b(\(2\))i(with)d(blo)s(c)m(k)h(size)g(3)h
-(b)m(ytes.)199 431 y(6.)61 b(As)30 b(\(2\))i(with)d(blo)s(c)m(k)h(size)
-g(4)h(b)m(ytes.)199 564 y(7.)61 b(As)30 b(\(2\))i(with)d(blo)s(c)m(k)h
-(size)g(5)h(b)m(ytes.)199 697 y(8.)61 b(As)30 b(\(2\))i(with)d(blo)s(c)
-m(k)h(size)g(6)h(b)m(ytes)g(and)e(small-mo)s(de)g(decompression.)199
-829 y(9.)61 b(H)30 b(with)g(bu\013er)f(size)h(of)h(1)f(b)m(yte,)i(but)d
-(normal)h(blo)s(c)m(k)g(size)g(\(up)f(to)j(900000)h(b)m(ytes\).)150
-1009 y(Then)c(some)i(tests)g(with)e(unmo)s(di\014ed)f(source)i(co)s
-(de.)199 1166 y(1.)61 b(H,)31 b(all)e(settings)h(normal.)199
-1299 y(2.)61 b(As)30 b(\(1\),)i(with)d(small-mo)s(de)g(decompress.)199
-1431 y(3.)61 b(H,)31 b(compress)f(with)f(\015ag)i Fj(-1)p
-Fl(.)199 1564 y(4.)61 b(H,)31 b(compress)f(with)f(\015ag)i
-Fj(-s)p Fl(,)f(decompress)g(with)f(\015ag)i Fj(-s)p Fl(.)199
-1697 y(5.)61 b(F)-8 b(orw)m(ards)33 b(compatibilit)m(y:)45
-b(H,)33 b Fj(bzip2-0.1pl2)d Fl(compressing,)j Fj(bzip2-0.9.5)d
-Fl(decompressing,)330 1806 y(all)f(settings)i(normal.)199
-1939 y(6.)61 b(Bac)m(kw)m(ards)23 b(compatibilit)m(y:)35
-b(H,)23 b Fj(bzip2-0.9.5)c Fl(compressing,)k Fj(bzip2-0.1pl2)c
-Fl(decompressing,)330 2048 y(all)29 b(settings)i(normal.)199
-2181 y(7.)61 b(Bigger)31 b(tests:)41 b(A,)31 b(all)e(settings)i
-(normal.)199 2314 y(8.)61 b(As)30 b(\(7\),)i(using)d(the)i(fallbac)m(k)
-e(\(Sadak)-5 b(ane-lik)m(e\))31 b(sorting)f(algorithm.)199
-2446 y(9.)61 b(As)30 b(\(8\),)i(compress)e(with)f(\015ag)i
-Fj(-1)p Fl(,)f(decompress)g(with)f(\015ag)i Fj(-s)p Fl(.)154
-2579 y(10.)61 b(H,)31 b(using)e(the)h(fallbac)m(k)g(sorting)g
-(algorithm.)154 2711 y(11.)61 b(F)-8 b(orw)m(ards)33
-b(compatibilit)m(y:)45 b(A,)33 b Fj(bzip2-0.1pl2)d Fl(compressing,)j
-Fj(bzip2-0.9.5)d Fl(decompressing,)330 2821 y(all)f(settings)i(normal.)
-154 2954 y(12.)61 b(Bac)m(kw)m(ards)23 b(compatibilit)m(y:)35
-b(A,)23 b Fj(bzip2-0.9.5)c Fl(compressing,)k Fj(bzip2-0.1pl2)c
-Fl(decompressing,)330 3063 y(all)29 b(settings)i(normal.)154
-3196 y(13.)61 b(Misc)39 b(test:)58 b(ab)s(out)39 b(400)h(megab)m(ytes)h
-(of)e Fj(.tar)f Fl(\014les)f(with)h Fj(bzip2)f Fl(compiled)h(with)f
-(Chec)m(k)m(er)j(\(a)330 3305 y(memory)30 b(access)i(error)e(detector,)
-i(lik)m(e)e(Purify\).)154 3438 y(14.)61 b(Misc)30 b(tests)h(to)g(mak)m
-(e)h(sure)d(it)h(builds)e(and)h(runs)g(ok)i(on)f(non-Lin)m(ux/x86)g
-(platforms.)150 3618 y(These)35 b(tests)h(w)m(ere)f(conducted)g(on)g(a)
-h(225)g(MHz)g(IDT)f(WinChip)d(mac)m(hine,)k(running)d(Lin)m(ux)g
-(2.0.36.)150 3728 y(They)d(represen)m(t)g(nearly)g(a)h(w)m(eek)g(of)f
-(con)m(tin)m(uous)g(computation.)41 b(All)29 b(tests)i(completed)f
-(successfully)-8 b(.)150 4003 y Fk(4.6)68 b(F)-11 b(urther)44
-b(reading)150 4196 y Fj(bzip2)28 b Fl(is)h(not)h(researc)m(h)g(w)m
-(ork,)g(in)e(the)i(sense)g(that)g(it)f(do)s(esn't)g(presen)m(t)h(an)m
-(y)g(new)f(ideas.)40 b(Rather,)30 b(it's)150 4306 y(an)g(engineering)f
-(exercise)i(based)f(on)g(existing)g(ideas.)150 4463 y(F)-8
-b(our)31 b(do)s(cumen)m(ts)f(describ)s(e)e(essen)m(tially)i(all)f(the)i
-(ideas)e(b)s(ehind)f Fj(bzip2)p Fl(:)390 4614 y Fj(Michael)46
-b(Burrows)g(and)h(D.)g(J.)g(Wheeler:)485 4717 y("A)h(block-sorting)c
-(lossless)h(data)i(compression)e(algorithm")533 4821
-y(10th)i(May)g(1994.)533 4925 y(Digital)f(SRC)h(Research)e(Report)i
-(124.)533 5029 y(ftp://ftp.digital.com/pub)o(/DEC)o(/SR)o(C/re)o(sear)o
-(ch-)o(repo)o(rts/)o(SRC)o(-124)o(.ps.)o(gz)533 5132
-y(If)g(you)g(have)g(trouble)f(finding)g(it,)g(try)h(searching)f(at)h
-(the)533 5236 y(New)g(Zealand)f(Digital)g(Library,)f
-(http://www.nzdl.org.)p eop
-%%Page: 36 37
-36 36 bop 150 -116 a Fl(Chapter)30 b(4:)41 b(Miscellanea)2586
-b(36)390 299 y Fj(Daniel)46 b(S.)h(Hirschberg)e(and)i(Debra)g(A.)g
-(LeLewer)485 403 y("Efficient)e(Decoding)h(of)h(Prefix)f(Codes")533
-506 y(Communications)e(of)j(the)g(ACM,)g(April)f(1990,)h(Vol)f(33,)h
-(Number)f(4.)533 610 y(You)h(might)f(be)i(able)e(to)h(get)g(an)h
-(electronic)d(copy)h(of)h(this)676 714 y(from)g(the)g(ACM)g(Digital)f
-(Library.)390 922 y(David)g(J.)i(Wheeler)533 1025 y(Program)e(bred3.c)g
-(and)h(accompanying)d(document)i(bred3.ps.)533 1129 y(This)h(contains)e
-(the)i(idea)g(behind)f(the)h(multi-table)e(Huffman)533
-1233 y(coding)h(scheme.)533 1337 y(ftp://ftp.cl.cam.ac.uk/us)o(ers/)o
-(djw)o(3/)390 1544 y(Jon)h(L.)g(Bentley)f(and)h(Robert)f(Sedgewick)485
-1648 y("Fast)h(Algorithms)e(for)i(Sorting)f(and)g(Searching)g(Strings")
-533 1752 y(Available)f(from)i(Sedgewick's)e(web)i(page,)533
-1856 y(www.cs.princeton.edu/~rs)150 2012 y Fl(The)29
-b(follo)m(wing)f(pap)s(er)g(giv)m(es)h(v)-5 b(aluable)28
-b(additional)g(insigh)m(ts)f(in)m(to)j(the)f(algorithm,)g(but)g(is)f
-(not)i(imme-)150 2122 y(diately)g(the)g(basis)f(of)i(an)m(y)g(co)s(de)f
-(used)g(in)f(bzip2.)390 2273 y Fj(Peter)46 b(Fenwick:)533
-2377 y(Block)h(Sorting)e(Text)i(Compression)533 2481
-y(Proceedings)e(of)i(the)g(19th)g(Australasian)d(Computer)i(Science)f
-(Conference,)629 2584 y(Melbourne,)g(Australia.)92 b(Jan)47
-b(31)g(-)h(Feb)f(2,)g(1996.)533 2688 y(ftp://ftp.cs.auckland.ac.)o
-(nz/p)o(ub/)o(pete)o(r-f/)o(ACS)o(C96p)o(aper)o(.ps)150
-2845 y Fl(Kunihik)m(o)28 b(Sadak)-5 b(ane's)31 b(sorting)e(algorithm,)h
-(men)m(tioned)g(ab)s(o)m(v)m(e,)i(is)d(a)m(v)-5 b(ailable)30
-b(from:)390 2996 y Fj(http://naomi.is.s.u-toky)o(o.ac)o(.jp/)o(~sa)o
-(da/p)o(aper)o(s/S)o(ada9)o(8b.p)o(s.g)o(z)150 3153 y
-Fl(The)41 b(Man)m(b)s(er-My)m(ers)g(su\016x)g(arra)m(y)g(construction)g
-(algorithm)f(is)g(describ)s(ed)f(in)h(a)i(pap)s(er)e(a)m(v)-5
-b(ailable)150 3262 y(from:)390 3413 y Fj(http://www.cs.arizona.ed)o
-(u/pe)o(ople)o(/ge)o(ne/P)o(APER)o(S/s)o(uffi)o(x.ps)150
-3570 y Fl(Finally)d(,)33 b(the)h(follo)m(wing)e(pap)s(er)h(do)s(cumen)m
-(ts)g(some)h(recen)m(t)h(in)m(v)m(estigations)e(I)h(made)f(in)m(to)h
-(the)g(p)s(erfor-)150 3680 y(mance)d(of)f(sorting)g(algorithms:)390
-3831 y Fj(Julian)46 b(Seward:)533 3935 y(On)h(the)g(Performance)e(of)i
-(BWT)g(Sorting)f(Algorithms)533 4038 y(Proceedings)f(of)i(the)g(IEEE)g
-(Data)f(Compression)f(Conference)g(2000)629 4142 y(Snowbird,)g(Utah.)94
-b(28-30)46 b(March)h(2000.)p eop
-%%Page: -1 38
--1 37 bop 3725 -116 a Fl(i)150 299 y Fh(T)-13 b(able)54
-b(of)g(Con)l(ten)l(ts)150 641 y Fk(1)135 b(In)l(tro)t(duction)15
-b Fb(.)20 b(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f
-(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)60
-b Fk(2)150 911 y(2)135 b(Ho)l(w)45 b(to)h(use)f Fd(bzip2)31
-b Fb(.)19 b(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g
-(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)78 b Fk(3)1047
-1048 y Fl(NAME)20 b Fa(.)c(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)50 b Fl(3)1047
-1157 y(SYNOPSIS)21 b Fa(.)13 b(.)i(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)g(.)g(.)g(.)h(.)f(.)g(.)50 b Fl(3)1047 1267 y(DESCRIPTION)10
-b Fa(.)j(.)i(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)
-g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)40
-b Fl(3)1047 1377 y(OPTIONS)16 b Fa(.)d(.)i(.)g(.)g(.)g(.)g(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)45 b Fl(4)1047
-1486 y(MEMOR)-8 b(Y)31 b(MANA)m(GEMENT)14 b Fa(.)j(.)e(.)g(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)44
-b Fl(6)1047 1596 y(RECO)m(VERING)30 b(D)m(A)-8 b(T)g(A)32
-b(FR)m(OM)f(D)m(AMA)m(GED)i(FILES)1256 1705 y Fa(.)15
-b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)g(.)g(.)g(.)g(.)g(.)57 b Fl(7)1047 1815 y(PERF)m(ORMANCE)30
-b(NOTES)9 b Fa(.)14 b(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)38 b Fl(7)1047 1924
-y(CA)-10 b(VEA)i(TS)10 b Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)40 b Fl(8)1047 2034
-y(A)m(UTHOR)23 b Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
-(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)g(.)g(.)g(.)g(.)g(.)g(.)53 b Fl(8)150 2276 y Fk(3)135
-b(Programming)46 b(with)f Fd(libbzip2)29 b Fb(.)16 b(.)j(.)h(.)f(.)h(.)
-f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)74 b Fk(9)449
-2413 y Fl(3.1)92 b(T)-8 b(op-lev)m(el)30 b(structure)24
-b Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h
-(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)g(.)g(.)g(.)54 b Fl(9)748 2523 y(3.1.1)93 b(Lo)m(w-lev)m(el)30
-b(summary)23 b Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)53
-b Fl(9)748 2633 y(3.1.2)93 b(High-lev)m(el)29 b(summary)12
-b Fa(.)i(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)41 b
-Fl(9)748 2742 y(3.1.3)93 b(Utilit)m(y)29 b(functions)g(summary)12
-b Fa(.)h(.)j(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)g(.)g(.)g(.)g(.)41 b Fl(10)449 2852 y(3.2)92 b(Error)29
-b(handling)18 b Fa(.)13 b(.)i(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f
-(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)48 b Fl(10)449
-2961 y(3.3)92 b(Lo)m(w-lev)m(el)31 b(in)m(terface)d Fa(.)15
-b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)57 b Fl(12)748 3071 y(3.3.1)93 b Fj(BZ2_bzCompressInit)21
-b Fa(.)9 b(.)15 b(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)50 b Fl(12)748
-3181 y(3.3.2)93 b Fj(BZ2_bzCompress)9 b Fa(.)h(.)15 b(.)g(.)g(.)g(.)g
-(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)g(.)g(.)g(.)g(.)g(.)g(.)38 b Fl(14)748 3290 y(3.3.3)93
-b Fj(BZ2_bzCompressEnd)23 b Fa(.)10 b(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g
-(.)52 b Fl(17)748 3400 y(3.3.4)93 b Fj(BZ2_bzDecompressInit)16
-b Fa(.)9 b(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h
-(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)45 b Fl(17)748 3509
-y(3.3.5)93 b Fj(BZ2_bzDecompress)21 b Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)g(.)g(.)55 b Fl(17)748 3619 y(3.3.6)93 b Fj(BZ2_bzDecompressEnd)18
-b Fa(.)10 b(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)48 b Fl(19)449
-3729 y(3.4)92 b(High-lev)m(el)30 b(in)m(terface)16 b
-Fa(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h
-(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)g(.)45 b Fl(19)748 3838 y(3.4.1)93 b Fj(BZ2_bzReadOpen)9
-b Fa(.)h(.)15 b(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)38
-b Fl(19)748 3948 y(3.4.2)93 b Fj(BZ2_bzRead)18 b Fa(.)12
-b(.)j(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)47
-b Fl(20)748 4057 y(3.4.3)93 b Fj(BZ2_bzReadGetUnused)18
-b Fa(.)10 b(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)48 b Fl(22)748
-4167 y(3.4.4)93 b Fj(BZ2_bzReadClose)23 b Fa(.)15 b(.)g(.)g(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)g(.)g(.)g(.)g(.)57 b Fl(22)748 4276 y(3.4.5)93 b
-Fj(BZ2_bzWriteOpen)23 b Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
-(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)57 b Fl(22)748 4386 y(3.4.6)93 b Fj(BZ2_bzWrite)16
-b Fa(.)11 b(.)k(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-45 b Fl(23)748 4496 y(3.4.7)93 b Fj(BZ2_bzWriteClose)21
-b Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)55 b Fl(23)748
-4605 y(3.4.8)93 b(Handling)28 b(em)m(b)s(edded)h(compressed)h(data)h
-(streams)17 b Fa(.)f(.)f(.)g(.)46 b Fl(24)748 4715 y(3.4.9)93
-b(Standard)29 b(\014le-reading/writing)e(co)s(de)22 b
-Fa(.)16 b(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)52
-b Fl(25)449 4824 y(3.5)92 b(Utilit)m(y)29 b(functions)f
-Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)g(.)g(.)g(.)g(.)59 b Fl(26)748 4934 y(3.5.1)93 b
-Fj(BZ2_bzBuffToBuffCompres)o(s)22 b Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)57 b Fl(26)748
-5044 y(3.5.2)93 b Fj(BZ2_bzBuffToBuffDecompr)o(ess)17
-b Fa(.)e(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-53 b Fl(27)449 5153 y(3.6)92 b Fj(zlib)29 b Fl(compatibilit)m(y)g
-(functions)23 b Fa(.)13 b(.)i(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h
-(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)52
-b Fl(28)449 5263 y(3.7)92 b(Using)30 b(the)g(library)e(in)h(a)i
-Fj(stdio)p Fl(-free)e(en)m(vironmen)m(t)23 b Fa(.)15
-b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)52 b Fl(29)p
-eop
-%%Page: -2 39
--2 38 bop 3699 -116 a Fl(ii)748 83 y(3.7.1)93 b(Getting)31
-b(rid)d(of)j Fj(stdio)20 b Fa(.)13 b(.)i(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)49
-b Fl(29)748 193 y(3.7.2)93 b(Critical)28 b(error)i(handling)22
-b Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)54 b Fl(29)449 302
-y(3.8)92 b(Making)30 b(a)h(Windo)m(ws)e(DLL)15 b Fa(.)h(.)f(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)44 b Fl(30)150 545
-y Fk(4)135 b(Miscellanea)11 b Fb(.)21 b(.)f(.)f(.)h(.)f(.)g(.)h(.)f(.)h
-(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)
-h(.)f(.)g(.)h(.)56 b Fk(31)449 682 y Fl(4.1)92 b(Limitations)29
-b(of)h(the)h(compressed)f(\014le)f(format)9 b Fa(.)15
-b(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)38
-b Fl(31)449 791 y(4.2)92 b(P)m(ortabilit)m(y)30 b(issues)14
-b Fa(.)f(.)j(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
-(.)g(.)h(.)f(.)g(.)43 b Fl(32)449 901 y(4.3)92 b(Rep)s(orting)29
-b(bugs)f Fa(.)15 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
-(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)58 b Fl(32)449 1010 y(4.4)92
-b(Did)29 b(y)m(ou)i(get)h(the)e(righ)m(t)g(pac)m(k)-5
-b(age?)22 b Fa(.)17 b(.)e(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h
-(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)51
-b Fl(34)449 1120 y(4.5)92 b(T)-8 b(esting)16 b Fa(.)f(.)g(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)45 b Fl(34)449 1230 y(4.6)92
-b(F)-8 b(urther)30 b(reading)22 b Fa(.)14 b(.)h(.)g(.)h(.)f(.)g(.)g(.)g
-(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
-g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)51
-b Fl(35)p eop
-%%Trailer
-end
-userdict /end-hook known{end-hook}if
-%%EOF
diff --git a/winsup/bz2lib/manual.texi b/winsup/bz2lib/manual.texi
deleted file mode 100644
index 336776ab8..000000000
--- a/winsup/bz2lib/manual.texi
+++ /dev/null
@@ -1,2215 +0,0 @@
-\input texinfo @c -*- Texinfo -*-
-@setfilename bzip2.info
-
-@ignore
-This file documents bzip2 version 1.0, and associated library
-libbzip2, written by Julian Seward (jseward@acm.org).
-
-Copyright (C) 1996-2000 Julian R Seward
-
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-are preserved on all copies.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for verbatim copies.
-@end ignore
-
-@ifinfo
-@format
-START-INFO-DIR-ENTRY
-* Bzip2: (bzip2). A program and library for data compression.
-END-INFO-DIR-ENTRY
-@end format
-
-@end ifinfo
-
-@iftex
-@c @finalout
-@settitle bzip2 and libbzip2
-@titlepage
-@title bzip2 and libbzip2
-@subtitle a program and library for data compression
-@subtitle copyright (C) 1996-2000 Julian Seward
-@subtitle version 1.0 of 21 March 2000
-@author Julian Seward
-
-@end titlepage
-
-@parindent 0mm
-@parskip 2mm
-
-@end iftex
-@node Top, Overview, (dir), (dir)
-
-This program, @code{bzip2},
-and associated library @code{libbzip2}, are
-Copyright (C) 1996-2000 Julian R Seward. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-@itemize @bullet
-@item
- Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-@item
- The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-@item
- Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-@item
- The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-@end itemize
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
-
-Julian Seward, Cambridge, UK.
-
-@code{jseward@@acm.org}
-
-@code{http://sourceware.cygnus.com/bzip2}
-
-@code{http://www.cacheprof.org}
-
-@code{http://www.muraroa.demon.co.uk}
-
-@code{bzip2}/@code{libbzip2} version 1.0 of 21 March 2000.
-
-PATENTS: To the best of my knowledge, @code{bzip2} does not use any patented
-algorithms. However, I do not have the resources available to carry out
-a full patent search. Therefore I cannot give any guarantee of the
-above statement.
-
-
-
-
-
-
-
-@node Overview, Implementation, Top, Top
-@chapter Introduction
-
-@code{bzip2} compresses files using the Burrows-Wheeler
-block-sorting text compression algorithm, and Huffman coding.
-Compression is generally considerably better than that
-achieved by more conventional LZ77/LZ78-based compressors,
-and approaches the performance of the PPM family of statistical compressors.
-
-@code{bzip2} is built on top of @code{libbzip2}, a flexible library
-for handling compressed data in the @code{bzip2} format. This manual
-describes both how to use the program and
-how to work with the library interface. Most of the
-manual is devoted to this library, not the program,
-which is good news if your interest is only in the program.
-
-Chapter 2 describes how to use @code{bzip2}; this is the only part
-you need to read if you just want to know how to operate the program.
-Chapter 3 describes the programming interfaces in detail, and
-Chapter 4 records some miscellaneous notes which I thought
-ought to be recorded somewhere.
-
-
-@chapter How to use @code{bzip2}
-
-This chapter contains a copy of the @code{bzip2} man page,
-and nothing else.
-
-@quotation
-
-@unnumberedsubsubsec NAME
-@itemize
-@item @code{bzip2}, @code{bunzip2}
-- a block-sorting file compressor, v1.0
-@item @code{bzcat}
-- decompresses files to stdout
-@item @code{bzip2recover}
-- recovers data from damaged bzip2 files
-@end itemize
-
-@unnumberedsubsubsec SYNOPSIS
-@itemize
-@item @code{bzip2} [ -cdfkqstvzVL123456789 ] [ filenames ... ]
-@item @code{bunzip2} [ -fkvsVL ] [ filenames ... ]
-@item @code{bzcat} [ -s ] [ filenames ... ]
-@item @code{bzip2recover} filename
-@end itemize
-
-@unnumberedsubsubsec DESCRIPTION
-
-@code{bzip2} compresses files using the Burrows-Wheeler block sorting
-text compression algorithm, and Huffman coding. Compression is
-generally considerably better than that achieved by more conventional
-LZ77/LZ78-based compressors, and approaches the performance of the PPM
-family of statistical compressors.
-
-The command-line options are deliberately very similar to those of GNU
-@code{gzip}, but they are not identical.
-
-@code{bzip2} expects a list of file names to accompany the command-line
-flags. Each file is replaced by a compressed version of itself, with
-the name @code{original_name.bz2}. Each compressed file has the same
-modification date, permissions, and, when possible, ownership as the
-corresponding original, so that these properties can be correctly
-restored at decompression time. File name handling is naive in the
-sense that there is no mechanism for preserving original file names,
-permissions, ownerships or dates in filesystems which lack these
-concepts, or have serious file name length restrictions, such as MS-DOS.
-
-@code{bzip2} and @code{bunzip2} will by default not overwrite existing
-files. If you want this to happen, specify the @code{-f} flag.
-
-If no file names are specified, @code{bzip2} compresses from standard
-input to standard output. In this case, @code{bzip2} will decline to
-write compressed output to a terminal, as this would be entirely
-incomprehensible and therefore pointless.
-
-@code{bunzip2} (or @code{bzip2 -d}) decompresses all
-specified files. Files which were not created by @code{bzip2}
-will be detected and ignored, and a warning issued.
-@code{bzip2} attempts to guess the filename for the decompressed file
-from that of the compressed file as follows:
-@itemize
-@item @code{filename.bz2 } becomes @code{filename}
-@item @code{filename.bz } becomes @code{filename}
-@item @code{filename.tbz2} becomes @code{filename.tar}
-@item @code{filename.tbz } becomes @code{filename.tar}
-@item @code{anyothername } becomes @code{anyothername.out}
-@end itemize
-If the file does not end in one of the recognised endings,
-@code{.bz2}, @code{.bz},
-@code{.tbz2} or @code{.tbz}, @code{bzip2} complains that it cannot
-guess the name of the original file, and uses the original name
-with @code{.out} appended.
-
-As with compression, supplying no
-filenames causes decompression from standard input to standard output.
-
-@code{bunzip2} will correctly decompress a file which is the
-concatenation of two or more compressed files. The result is the
-concatenation of the corresponding uncompressed files. Integrity
-testing (@code{-t}) of concatenated compressed files is also supported.
-
-You can also compress or decompress files to the standard output by
-giving the @code{-c} flag. Multiple files may be compressed and
-decompressed like this. The resulting outputs are fed sequentially to
-stdout. Compression of multiple files in this manner generates a stream
-containing multiple compressed file representations. Such a stream
-can be decompressed correctly only by @code{bzip2} version 0.9.0 or
-later. Earlier versions of @code{bzip2} will stop after decompressing
-the first file in the stream.
-
-@code{bzcat} (or @code{bzip2 -dc}) decompresses all specified files to
-the standard output.
-
-@code{bzip2} will read arguments from the environment variables
-@code{BZIP2} and @code{BZIP}, in that order, and will process them
-before any arguments read from the command line. This gives a
-convenient way to supply default arguments.
-
-Compression is always performed, even if the compressed file is slightly
-larger than the original. Files of less than about one hundred bytes
-tend to get larger, since the compression mechanism has a constant
-overhead in the region of 50 bytes. Random data (including the output
-of most file compressors) is coded at about 8.05 bits per byte, giving
-an expansion of around 0.5%.
-
-As a self-check for your protection, @code{bzip2} uses 32-bit CRCs to
-make sure that the decompressed version of a file is identical to the
-original. This guards against corruption of the compressed data, and
-against undetected bugs in @code{bzip2} (hopefully very unlikely). The
-chances of data corruption going undetected is microscopic, about one
-chance in four billion for each file processed. Be aware, though, that
-the check occurs upon decompression, so it can only tell you that
-something is wrong. It can't help you recover the original uncompressed
-data. You can use @code{bzip2recover} to try to recover data from
-damaged files.
-
-Return values: 0 for a normal exit, 1 for environmental problems (file
-not found, invalid flags, I/O errors, &c), 2 to indicate a corrupt
-compressed file, 3 for an internal consistency error (eg, bug) which
-caused @code{bzip2} to panic.
-
-
-@unnumberedsubsubsec OPTIONS
-@table @code
-@item -c --stdout
-Compress or decompress to standard output.
-@item -d --decompress
-Force decompression. @code{bzip2}, @code{bunzip2} and @code{bzcat} are
-really the same program, and the decision about what actions to take is
-done on the basis of which name is used. This flag overrides that
-mechanism, and forces bzip2 to decompress.
-@item -z --compress
-The complement to @code{-d}: forces compression, regardless of the
-invokation name.
-@item -t --test
-Check integrity of the specified file(s), but don't decompress them.
-This really performs a trial decompression and throws away the result.
-@item -f --force
-Force overwrite of output files. Normally, @code{bzip2} will not overwrite
-existing output files. Also forces @code{bzip2} to break hard links
-to files, which it otherwise wouldn't do.
-@item -k --keep
-Keep (don't delete) input files during compression
-or decompression.
-@item -s --small
-Reduce memory usage, for compression, decompression and testing. Files
-are decompressed and tested using a modified algorithm which only
-requires 2.5 bytes per block byte. This means any file can be
-decompressed in 2300k of memory, albeit at about half the normal speed.
-
-During compression, @code{-s} selects a block size of 200k, which limits
-memory use to around the same figure, at the expense of your compression
-ratio. In short, if your machine is low on memory (8 megabytes or
-less), use -s for everything. See MEMORY MANAGEMENT below.
-@item -q --quiet
-Suppress non-essential warning messages. Messages pertaining to
-I/O errors and other critical events will not be suppressed.
-@item -v --verbose
-Verbose mode -- show the compression ratio for each file processed.
-Further @code{-v}'s increase the verbosity level, spewing out lots of
-information which is primarily of interest for diagnostic purposes.
-@item -L --license -V --version
-Display the software version, license terms and conditions.
-@item -1 to -9
-Set the block size to 100 k, 200 k .. 900 k when compressing. Has no
-effect when decompressing. See MEMORY MANAGEMENT below.
-@item --
-Treats all subsequent arguments as file names, even if they start
-with a dash. This is so you can handle files with names beginning
-with a dash, for example: @code{bzip2 -- -myfilename}.
-@item --repetitive-fast
-@item --repetitive-best
-These flags are redundant in versions 0.9.5 and above. They provided
-some coarse control over the behaviour of the sorting algorithm in
-earlier versions, which was sometimes useful. 0.9.5 and above have an
-improved algorithm which renders these flags irrelevant.
-@end table
-
-
-@unnumberedsubsubsec MEMORY MANAGEMENT
-
-@code{bzip2} compresses large files in blocks. The block size affects
-both the compression ratio achieved, and the amount of memory needed for
-compression and decompression. The flags @code{-1} through @code{-9}
-specify the block size to be 100,000 bytes through 900,000 bytes (the
-default) respectively. At decompression time, the block size used for
-compression is read from the header of the compressed file, and
-@code{bunzip2} then allocates itself just enough memory to decompress
-the file. Since block sizes are stored in compressed files, it follows
-that the flags @code{-1} to @code{-9} are irrelevant to and so ignored
-during decompression.
-
-Compression and decompression requirements, in bytes, can be estimated
-as:
-@example
- Compression: 400k + ( 8 x block size )
-
- Decompression: 100k + ( 4 x block size ), or
- 100k + ( 2.5 x block size )
-@end example
-Larger block sizes give rapidly diminishing marginal returns. Most of
-the compression comes from the first two or three hundred k of block
-size, a fact worth bearing in mind when using @code{bzip2} on small machines.
-It is also important to appreciate that the decompression memory
-requirement is set at compression time by the choice of block size.
-
-For files compressed with the default 900k block size, @code{bunzip2}
-will require about 3700 kbytes to decompress. To support decompression
-of any file on a 4 megabyte machine, @code{bunzip2} has an option to
-decompress using approximately half this amount of memory, about 2300
-kbytes. Decompression speed is also halved, so you should use this
-option only where necessary. The relevant flag is @code{-s}.
-
-In general, try and use the largest block size memory constraints allow,
-since that maximises the compression achieved. Compression and
-decompression speed are virtually unaffected by block size.
-
-Another significant point applies to files which fit in a single block
--- that means most files you'd encounter using a large block size. The
-amount of real memory touched is proportional to the size of the file,
-since the file is smaller than a block. For example, compressing a file
-20,000 bytes long with the flag @code{-9} will cause the compressor to
-allocate around 7600k of memory, but only touch 400k + 20000 * 8 = 560
-kbytes of it. Similarly, the decompressor will allocate 3700k but only
-touch 100k + 20000 * 4 = 180 kbytes.
-
-Here is a table which summarises the maximum memory usage for different
-block sizes. Also recorded is the total compressed size for 14 files of
-the Calgary Text Compression Corpus totalling 3,141,622 bytes. This
-column gives some feel for how compression varies with block size.
-These figures tend to understate the advantage of larger block sizes for
-larger files, since the Corpus is dominated by smaller files.
-@example
- Compress Decompress Decompress Corpus
- Flag usage usage -s usage Size
-
- -1 1200k 500k 350k 914704
- -2 2000k 900k 600k 877703
- -3 2800k 1300k 850k 860338
- -4 3600k 1700k 1100k 846899
- -5 4400k 2100k 1350k 845160
- -6 5200k 2500k 1600k 838626
- -7 6100k 2900k 1850k 834096
- -8 6800k 3300k 2100k 828642
- -9 7600k 3700k 2350k 828642
-@end example
-
-@unnumberedsubsubsec RECOVERING DATA FROM DAMAGED FILES
-
-@code{bzip2} compresses files in blocks, usually 900kbytes long. Each
-block is handled independently. If a media or transmission error causes
-a multi-block @code{.bz2} file to become damaged, it may be possible to
-recover data from the undamaged blocks in the file.
-
-The compressed representation of each block is delimited by a 48-bit
-pattern, which makes it possible to find the block boundaries with
-reasonable certainty. Each block also carries its own 32-bit CRC, so
-damaged blocks can be distinguished from undamaged ones.
-
-@code{bzip2recover} is a simple program whose purpose is to search for
-blocks in @code{.bz2} files, and write each block out into its own
-@code{.bz2} file. You can then use @code{bzip2 -t} to test the
-integrity of the resulting files, and decompress those which are
-undamaged.
-
-@code{bzip2recover}
-takes a single argument, the name of the damaged file,
-and writes a number of files @code{rec0001file.bz2},
- @code{rec0002file.bz2}, etc, containing the extracted blocks.
- The output filenames are designed so that the use of
- wildcards in subsequent processing -- for example,
-@code{bzip2 -dc rec*file.bz2 > recovered_data} -- lists the files in
- the correct order.
-
-@code{bzip2recover} should be of most use dealing with large @code{.bz2}
- files, as these will contain many blocks. It is clearly
- futile to use it on damaged single-block files, since a
- damaged block cannot be recovered. If you wish to minimise
-any potential data loss through media or transmission errors,
-you might consider compressing with a smaller
- block size.
-
-
-@unnumberedsubsubsec PERFORMANCE NOTES
-
-The sorting phase of compression gathers together similar strings in the
-file. Because of this, files containing very long runs of repeated
-symbols, like "aabaabaabaab ..." (repeated several hundred times) may
-compress more slowly than normal. Versions 0.9.5 and above fare much
-better than previous versions in this respect. The ratio between
-worst-case and average-case compression time is in the region of 10:1.
-For previous versions, this figure was more like 100:1. You can use the
-@code{-vvvv} option to monitor progress in great detail, if you want.
-
-Decompression speed is unaffected by these phenomena.
-
-@code{bzip2} usually allocates several megabytes of memory to operate
-in, and then charges all over it in a fairly random fashion. This means
-that performance, both for compressing and decompressing, is largely
-determined by the speed at which your machine can service cache misses.
-Because of this, small changes to the code to reduce the miss rate have
-been observed to give disproportionately large performance improvements.
-I imagine @code{bzip2} will perform best on machines with very large
-caches.
-
-
-@unnumberedsubsubsec CAVEATS
-
-I/O error messages are not as helpful as they could be. @code{bzip2}
-tries hard to detect I/O errors and exit cleanly, but the details of
-what the problem is sometimes seem rather misleading.
-
-This manual page pertains to version 1.0 of @code{bzip2}. Compressed
-data created by this version is entirely forwards and backwards
-compatible with the previous public releases, versions 0.1pl2, 0.9.0 and
-0.9.5, but with the following exception: 0.9.0 and above can correctly
-decompress multiple concatenated compressed files. 0.1pl2 cannot do
-this; it will stop after decompressing just the first file in the
-stream.
-
-@code{bzip2recover} uses 32-bit integers to represent bit positions in
-compressed files, so it cannot handle compressed files more than 512
-megabytes long. This could easily be fixed.
-
-
-@unnumberedsubsubsec AUTHOR
-Julian Seward, @code{jseward@@acm.org}.
-
-The ideas embodied in @code{bzip2} are due to (at least) the following
-people: Michael Burrows and David Wheeler (for the block sorting
-transformation), David Wheeler (again, for the Huffman coder), Peter
-Fenwick (for the structured coding model in the original @code{bzip},
-and many refinements), and Alistair Moffat, Radford Neal and Ian Witten
-(for the arithmetic coder in the original @code{bzip}). I am much
-indebted for their help, support and advice. See the manual in the
-source distribution for pointers to sources of documentation. Christian
-von Roques encouraged me to look for faster sorting algorithms, so as to
-speed up compression. Bela Lubkin encouraged me to improve the
-worst-case compression performance. Many people sent patches, helped
-with portability problems, lent machines, gave advice and were generally
-helpful.
-
-@end quotation
-
-
-
-
-@chapter Programming with @code{libbzip2}
-
-This chapter describes the programming interface to @code{libbzip2}.
-
-For general background information, particularly about memory
-use and performance aspects, you'd be well advised to read Chapter 2
-as well.
-
-@section Top-level structure
-
-@code{libbzip2} is a flexible library for compressing and decompressing
-data in the @code{bzip2} data format. Although packaged as a single
-entity, it helps to regard the library as three separate parts: the low
-level interface, and the high level interface, and some utility
-functions.
-
-The structure of @code{libbzip2}'s interfaces is similar to
-that of Jean-loup Gailly's and Mark Adler's excellent @code{zlib}
-library.
-
-All externally visible symbols have names beginning @code{BZ2_}.
-This is new in version 1.0. The intention is to minimise pollution
-of the namespaces of library clients.
-
-@subsection Low-level summary
-
-This interface provides services for compressing and decompressing
-data in memory. There's no provision for dealing with files, streams
-or any other I/O mechanisms, just straight memory-to-memory work.
-In fact, this part of the library can be compiled without inclusion
-of @code{stdio.h}, which may be helpful for embedded applications.
-
-The low-level part of the library has no global variables and
-is therefore thread-safe.
-
-Six routines make up the low level interface:
-@code{BZ2_bzCompressInit}, @code{BZ2_bzCompress}, and @* @code{BZ2_bzCompressEnd}
-for compression,
-and a corresponding trio @code{BZ2_bzDecompressInit}, @* @code{BZ2_bzDecompress}
-and @code{BZ2_bzDecompressEnd} for decompression.
-The @code{*Init} functions allocate
-memory for compression/decompression and do other
-initialisations, whilst the @code{*End} functions close down operations
-and release memory.
-
-The real work is done by @code{BZ2_bzCompress} and @code{BZ2_bzDecompress}.
-These compress and decompress data from a user-supplied input buffer
-to a user-supplied output buffer. These buffers can be any size;
-arbitrary quantities of data are handled by making repeated calls
-to these functions. This is a flexible mechanism allowing a
-consumer-pull style of activity, or producer-push, or a mixture of
-both.
-
-
-
-@subsection High-level summary
-
-This interface provides some handy wrappers around the low-level
-interface to facilitate reading and writing @code{bzip2} format
-files (@code{.bz2} files). The routines provide hooks to facilitate
-reading files in which the @code{bzip2} data stream is embedded
-within some larger-scale file structure, or where there are
-multiple @code{bzip2} data streams concatenated end-to-end.
-
-For reading files, @code{BZ2_bzReadOpen}, @code{BZ2_bzRead},
-@code{BZ2_bzReadClose} and @* @code{BZ2_bzReadGetUnused} are supplied. For
-writing files, @code{BZ2_bzWriteOpen}, @code{BZ2_bzWrite} and
-@code{BZ2_bzWriteFinish} are available.
-
-As with the low-level library, no global variables are used
-so the library is per se thread-safe. However, if I/O errors
-occur whilst reading or writing the underlying compressed files,
-you may have to consult @code{errno} to determine the cause of
-the error. In that case, you'd need a C library which correctly
-supports @code{errno} in a multithreaded environment.
-
-To make the library a little simpler and more portable,
-@code{BZ2_bzReadOpen} and @code{BZ2_bzWriteOpen} require you to pass them file
-handles (@code{FILE*}s) which have previously been opened for reading or
-writing respectively. That avoids portability problems associated with
-file operations and file attributes, whilst not being much of an
-imposition on the programmer.
-
-
-
-@subsection Utility functions summary
-For very simple needs, @code{BZ2_bzBuffToBuffCompress} and
-@code{BZ2_bzBuffToBuffDecompress} are provided. These compress
-data in memory from one buffer to another buffer in a single
-function call. You should assess whether these functions
-fulfill your memory-to-memory compression/decompression
-requirements before investing effort in understanding the more
-general but more complex low-level interface.
-
-Yoshioka Tsuneo (@code{QWF00133@@niftyserve.or.jp} /
-@code{tsuneo-y@@is.aist-nara.ac.jp}) has contributed some functions to
-give better @code{zlib} compatibility. These functions are
-@code{BZ2_bzopen}, @code{BZ2_bzread}, @code{BZ2_bzwrite}, @code{BZ2_bzflush},
-@code{BZ2_bzclose},
-@code{BZ2_bzerror} and @code{BZ2_bzlibVersion}. You may find these functions
-more convenient for simple file reading and writing, than those in the
-high-level interface. These functions are not (yet) officially part of
-the library, and are minimally documented here. If they break, you
-get to keep all the pieces. I hope to document them properly when time
-permits.
-
-Yoshioka also contributed modifications to allow the library to be
-built as a Windows DLL.
-
-
-@section Error handling
-
-The library is designed to recover cleanly in all situations, including
-the worst-case situation of decompressing random data. I'm not
-100% sure that it can always do this, so you might want to add
-a signal handler to catch segmentation violations during decompression
-if you are feeling especially paranoid. I would be interested in
-hearing more about the robustness of the library to corrupted
-compressed data.
-
-Version 1.0 is much more robust in this respect than
-0.9.0 or 0.9.5. Investigations with Checker (a tool for
-detecting problems with memory management, similar to Purify)
-indicate that, at least for the few files I tested, all single-bit
-errors in the decompressed data are caught properly, with no
-segmentation faults, no reads of uninitialised data and no
-out of range reads or writes. So it's certainly much improved,
-although I wouldn't claim it to be totally bombproof.
-
-The file @code{bzlib.h} contains all definitions needed to use
-the library. In particular, you should definitely not include
-@code{bzlib_private.h}.
-
-In @code{bzlib.h}, the various return values are defined. The following
-list is not intended as an exhaustive description of the circumstances
-in which a given value may be returned -- those descriptions are given
-later. Rather, it is intended to convey the rough meaning of each
-return value. The first five actions are normal and not intended to
-denote an error situation.
-@table @code
-@item BZ_OK
-The requested action was completed successfully.
-@item BZ_RUN_OK
-@itemx BZ_FLUSH_OK
-@itemx BZ_FINISH_OK
-In @code{BZ2_bzCompress}, the requested flush/finish/nothing-special action
-was completed successfully.
-@item BZ_STREAM_END
-Compression of data was completed, or the logical stream end was
-detected during decompression.
-@end table
-
-The following return values indicate an error of some kind.
-@table @code
-@item BZ_CONFIG_ERROR
-Indicates that the library has been improperly compiled on your
-platform -- a major configuration error. Specifically, it means
-that @code{sizeof(char)}, @code{sizeof(short)} and @code{sizeof(int)}
-are not 1, 2 and 4 respectively, as they should be. Note that the
-library should still work properly on 64-bit platforms which follow
-the LP64 programming model -- that is, where @code{sizeof(long)}
-and @code{sizeof(void*)} are 8. Under LP64, @code{sizeof(int)} is
-still 4, so @code{libbzip2}, which doesn't use the @code{long} type,
-is OK.
-@item BZ_SEQUENCE_ERROR
-When using the library, it is important to call the functions in the
-correct sequence and with data structures (buffers etc) in the correct
-states. @code{libbzip2} checks as much as it can to ensure this is
-happening, and returns @code{BZ_SEQUENCE_ERROR} if not. Code which
-complies precisely with the function semantics, as detailed below,
-should never receive this value; such an event denotes buggy code
-which you should investigate.
-@item BZ_PARAM_ERROR
-Returned when a parameter to a function call is out of range
-or otherwise manifestly incorrect. As with @code{BZ_SEQUENCE_ERROR},
-this denotes a bug in the client code. The distinction between
-@code{BZ_PARAM_ERROR} and @code{BZ_SEQUENCE_ERROR} is a bit hazy, but still worth
-making.
-@item BZ_MEM_ERROR
-Returned when a request to allocate memory failed. Note that the
-quantity of memory needed to decompress a stream cannot be determined
-until the stream's header has been read. So @code{BZ2_bzDecompress} and
-@code{BZ2_bzRead} may return @code{BZ_MEM_ERROR} even though some of
-the compressed data has been read. The same is not true for
-compression; once @code{BZ2_bzCompressInit} or @code{BZ2_bzWriteOpen} have
-successfully completed, @code{BZ_MEM_ERROR} cannot occur.
-@item BZ_DATA_ERROR
-Returned when a data integrity error is detected during decompression.
-Most importantly, this means when stored and computed CRCs for the
-data do not match. This value is also returned upon detection of any
-other anomaly in the compressed data.
-@item BZ_DATA_ERROR_MAGIC
-As a special case of @code{BZ_DATA_ERROR}, it is sometimes useful to
-know when the compressed stream does not start with the correct
-magic bytes (@code{'B' 'Z' 'h'}).
-@item BZ_IO_ERROR
-Returned by @code{BZ2_bzRead} and @code{BZ2_bzWrite} when there is an error
-reading or writing in the compressed file, and by @code{BZ2_bzReadOpen}
-and @code{BZ2_bzWriteOpen} for attempts to use a file for which the
-error indicator (viz, @code{ferror(f)}) is set.
-On receipt of @code{BZ_IO_ERROR}, the caller should consult
-@code{errno} and/or @code{perror} to acquire operating-system
-specific information about the problem.
-@item BZ_UNEXPECTED_EOF
-Returned by @code{BZ2_bzRead} when the compressed file finishes
-before the logical end of stream is detected.
-@item BZ_OUTBUFF_FULL
-Returned by @code{BZ2_bzBuffToBuffCompress} and
-@code{BZ2_bzBuffToBuffDecompress} to indicate that the output data
-will not fit into the output buffer provided.
-@end table
-
-
-
-@section Low-level interface
-
-@subsection @code{BZ2_bzCompressInit}
-@example
-typedef
- struct @{
- char *next_in;
- unsigned int avail_in;
- unsigned int total_in_lo32;
- unsigned int total_in_hi32;
-
- char *next_out;
- unsigned int avail_out;
- unsigned int total_out_lo32;
- unsigned int total_out_hi32;
-
- void *state;
-
- void *(*bzalloc)(void *,int,int);
- void (*bzfree)(void *,void *);
- void *opaque;
- @}
- bz_stream;
-
-int BZ2_bzCompressInit ( bz_stream *strm,
- int blockSize100k,
- int verbosity,
- int workFactor );
-
-@end example
-
-Prepares for compression. The @code{bz_stream} structure
-holds all data pertaining to the compression activity.
-A @code{bz_stream} structure should be allocated and initialised
-prior to the call.
-The fields of @code{bz_stream}
-comprise the entirety of the user-visible data. @code{state}
-is a pointer to the private data structures required for compression.
-
-Custom memory allocators are supported, via fields @code{bzalloc},
-@code{bzfree},
-and @code{opaque}. The value
-@code{opaque} is passed to as the first argument to
-all calls to @code{bzalloc} and @code{bzfree}, but is
-otherwise ignored by the library.
-The call @code{bzalloc ( opaque, n, m )} is expected to return a
-pointer @code{p} to
-@code{n * m} bytes of memory, and @code{bzfree ( opaque, p )}
-should free
-that memory.
-
-If you don't want to use a custom memory allocator, set @code{bzalloc},
-@code{bzfree} and
-@code{opaque} to @code{NULL},
-and the library will then use the standard @code{malloc}/@code{free}
-routines.
-
-Before calling @code{BZ2_bzCompressInit}, fields @code{bzalloc},
-@code{bzfree} and @code{opaque} should
-be filled appropriately, as just described. Upon return, the internal
-state will have been allocated and initialised, and @code{total_in_lo32},
-@code{total_in_hi32}, @code{total_out_lo32} and
-@code{total_out_hi32} will have been set to zero.
-These four fields are used by the library
-to inform the caller of the total amount of data passed into and out of
-the library, respectively. You should not try to change them.
-As of version 1.0, 64-bit counts are maintained, even on 32-bit
-platforms, using the @code{_hi32} fields to store the upper 32 bits
-of the count. So, for example, the total amount of data in
-is @code{(total_in_hi32 << 32) + total_in_lo32}.
-
-Parameter @code{blockSize100k} specifies the block size to be used for
-compression. It should be a value between 1 and 9 inclusive, and the
-actual block size used is 100000 x this figure. 9 gives the best
-compression but takes most memory.
-
-Parameter @code{verbosity} should be set to a number between 0 and 4
-inclusive. 0 is silent, and greater numbers give increasingly verbose
-monitoring/debugging output. If the library has been compiled with
-@code{-DBZ_NO_STDIO}, no such output will appear for any verbosity
-setting.
-
-Parameter @code{workFactor} controls how the compression phase behaves
-when presented with worst case, highly repetitive, input data. If
-compression runs into difficulties caused by repetitive data, the
-library switches from the standard sorting algorithm to a fallback
-algorithm. The fallback is slower than the standard algorithm by
-perhaps a factor of three, but always behaves reasonably, no matter how
-bad the input.
-
-Lower values of @code{workFactor} reduce the amount of effort the
-standard algorithm will expend before resorting to the fallback. You
-should set this parameter carefully; too low, and many inputs will be
-handled by the fallback algorithm and so compress rather slowly, too
-high, and your average-to-worst case compression times can become very
-large. The default value of 30 gives reasonable behaviour over a wide
-range of circumstances.
-
-Allowable values range from 0 to 250 inclusive. 0 is a special case,
-equivalent to using the default value of 30.
-
-Note that the compressed output generated is the same regardless of
-whether or not the fallback algorithm is used.
-
-Be aware also that this parameter may disappear entirely in future
-versions of the library. In principle it should be possible to devise a
-good way to automatically choose which algorithm to use. Such a
-mechanism would render the parameter obsolete.
-
-Possible return values:
-@display
- @code{BZ_CONFIG_ERROR}
- if the library has been mis-compiled
- @code{BZ_PARAM_ERROR}
- if @code{strm} is @code{NULL}
- or @code{blockSize} < 1 or @code{blockSize} > 9
- or @code{verbosity} < 0 or @code{verbosity} > 4
- or @code{workFactor} < 0 or @code{workFactor} > 250
- @code{BZ_MEM_ERROR}
- if not enough memory is available
- @code{BZ_OK}
- otherwise
-@end display
-Allowable next actions:
-@display
- @code{BZ2_bzCompress}
- if @code{BZ_OK} is returned
- no specific action needed in case of error
-@end display
-
-@subsection @code{BZ2_bzCompress}
-@example
- int BZ2_bzCompress ( bz_stream *strm, int action );
-@end example
-Provides more input and/or output buffer space for the library. The
-caller maintains input and output buffers, and calls @code{BZ2_bzCompress} to
-transfer data between them.
-
-Before each call to @code{BZ2_bzCompress}, @code{next_in} should point at
-the data to be compressed, and @code{avail_in} should indicate how many
-bytes the library may read. @code{BZ2_bzCompress} updates @code{next_in},
-@code{avail_in} and @code{total_in} to reflect the number of bytes it
-has read.
-
-Similarly, @code{next_out} should point to a buffer in which the
-compressed data is to be placed, with @code{avail_out} indicating how
-much output space is available. @code{BZ2_bzCompress} updates
-@code{next_out}, @code{avail_out} and @code{total_out} to reflect the
-number of bytes output.
-
-You may provide and remove as little or as much data as you like on each
-call of @code{BZ2_bzCompress}. In the limit, it is acceptable to supply and
-remove data one byte at a time, although this would be terribly
-inefficient. You should always ensure that at least one byte of output
-space is available at each call.
-
-A second purpose of @code{BZ2_bzCompress} is to request a change of mode of the
-compressed stream.
-
-Conceptually, a compressed stream can be in one of four states: IDLE,
-RUNNING, FLUSHING and FINISHING. Before initialisation
-(@code{BZ2_bzCompressInit}) and after termination (@code{BZ2_bzCompressEnd}), a
-stream is regarded as IDLE.
-
-Upon initialisation (@code{BZ2_bzCompressInit}), the stream is placed in the
-RUNNING state. Subsequent calls to @code{BZ2_bzCompress} should pass
-@code{BZ_RUN} as the requested action; other actions are illegal and
-will result in @code{BZ_SEQUENCE_ERROR}.
-
-At some point, the calling program will have provided all the input data
-it wants to. It will then want to finish up -- in effect, asking the
-library to process any data it might have buffered internally. In this
-state, @code{BZ2_bzCompress} will no longer attempt to read data from
-@code{next_in}, but it will want to write data to @code{next_out}.
-Because the output buffer supplied by the user can be arbitrarily small,
-the finishing-up operation cannot necessarily be done with a single call
-of @code{BZ2_bzCompress}.
-
-Instead, the calling program passes @code{BZ_FINISH} as an action to
-@code{BZ2_bzCompress}. This changes the stream's state to FINISHING. Any
-remaining input (ie, @code{next_in[0 .. avail_in-1]}) is compressed and
-transferred to the output buffer. To do this, @code{BZ2_bzCompress} must be
-called repeatedly until all the output has been consumed. At that
-point, @code{BZ2_bzCompress} returns @code{BZ_STREAM_END}, and the stream's
-state is set back to IDLE. @code{BZ2_bzCompressEnd} should then be
-called.
-
-Just to make sure the calling program does not cheat, the library makes
-a note of @code{avail_in} at the time of the first call to
-@code{BZ2_bzCompress} which has @code{BZ_FINISH} as an action (ie, at the
-time the program has announced its intention to not supply any more
-input). By comparing this value with that of @code{avail_in} over
-subsequent calls to @code{BZ2_bzCompress}, the library can detect any
-attempts to slip in more data to compress. Any calls for which this is
-detected will return @code{BZ_SEQUENCE_ERROR}. This indicates a
-programming mistake which should be corrected.
-
-Instead of asking to finish, the calling program may ask
-@code{BZ2_bzCompress} to take all the remaining input, compress it and
-terminate the current (Burrows-Wheeler) compression block. This could
-be useful for error control purposes. The mechanism is analogous to
-that for finishing: call @code{BZ2_bzCompress} with an action of
-@code{BZ_FLUSH}, remove output data, and persist with the
-@code{BZ_FLUSH} action until the value @code{BZ_RUN} is returned. As
-with finishing, @code{BZ2_bzCompress} detects any attempt to provide more
-input data once the flush has begun.
-
-Once the flush is complete, the stream returns to the normal RUNNING
-state.
-
-This all sounds pretty complex, but isn't really. Here's a table
-which shows which actions are allowable in each state, what action
-will be taken, what the next state is, and what the non-error return
-values are. Note that you can't explicitly ask what state the
-stream is in, but nor do you need to -- it can be inferred from the
-values returned by @code{BZ2_bzCompress}.
-@display
-IDLE/@code{any}
- Illegal. IDLE state only exists after @code{BZ2_bzCompressEnd} or
- before @code{BZ2_bzCompressInit}.
- Return value = @code{BZ_SEQUENCE_ERROR}
-
-RUNNING/@code{BZ_RUN}
- Compress from @code{next_in} to @code{next_out} as much as possible.
- Next state = RUNNING
- Return value = @code{BZ_RUN_OK}
-
-RUNNING/@code{BZ_FLUSH}
- Remember current value of @code{next_in}. Compress from @code{next_in}
- to @code{next_out} as much as possible, but do not accept any more input.
- Next state = FLUSHING
- Return value = @code{BZ_FLUSH_OK}
-
-RUNNING/@code{BZ_FINISH}
- Remember current value of @code{next_in}. Compress from @code{next_in}
- to @code{next_out} as much as possible, but do not accept any more input.
- Next state = FINISHING
- Return value = @code{BZ_FINISH_OK}
-
-FLUSHING/@code{BZ_FLUSH}
- Compress from @code{next_in} to @code{next_out} as much as possible,
- but do not accept any more input.
- If all the existing input has been used up and all compressed
- output has been removed
- Next state = RUNNING; Return value = @code{BZ_RUN_OK}
- else
- Next state = FLUSHING; Return value = @code{BZ_FLUSH_OK}
-
-FLUSHING/other
- Illegal.
- Return value = @code{BZ_SEQUENCE_ERROR}
-
-FINISHING/@code{BZ_FINISH}
- Compress from @code{next_in} to @code{next_out} as much as possible,
- but to not accept any more input.
- If all the existing input has been used up and all compressed
- output has been removed
- Next state = IDLE; Return value = @code{BZ_STREAM_END}
- else
- Next state = FINISHING; Return value = @code{BZ_FINISHING}
-
-FINISHING/other
- Illegal.
- Return value = @code{BZ_SEQUENCE_ERROR}
-@end display
-
-That still looks complicated? Well, fair enough. The usual sequence
-of calls for compressing a load of data is:
-@itemize @bullet
-@item Get started with @code{BZ2_bzCompressInit}.
-@item Shovel data in and shlurp out its compressed form using zero or more
-calls of @code{BZ2_bzCompress} with action = @code{BZ_RUN}.
-@item Finish up.
-Repeatedly call @code{BZ2_bzCompress} with action = @code{BZ_FINISH},
-copying out the compressed output, until @code{BZ_STREAM_END} is returned.
-@item Close up and go home. Call @code{BZ2_bzCompressEnd}.
-@end itemize
-If the data you want to compress fits into your input buffer all
-at once, you can skip the calls of @code{BZ2_bzCompress ( ..., BZ_RUN )} and
-just do the @code{BZ2_bzCompress ( ..., BZ_FINISH )} calls.
-
-All required memory is allocated by @code{BZ2_bzCompressInit}. The
-compression library can accept any data at all (obviously). So you
-shouldn't get any error return values from the @code{BZ2_bzCompress} calls.
-If you do, they will be @code{BZ_SEQUENCE_ERROR}, and indicate a bug in
-your programming.
-
-Trivial other possible return values:
-@display
- @code{BZ_PARAM_ERROR}
- if @code{strm} is @code{NULL}, or @code{strm->s} is @code{NULL}
-@end display
-
-@subsection @code{BZ2_bzCompressEnd}
-@example
-int BZ2_bzCompressEnd ( bz_stream *strm );
-@end example
-Releases all memory associated with a compression stream.
-
-Possible return values:
-@display
- @code{BZ_PARAM_ERROR} if @code{strm} is @code{NULL} or @code{strm->s} is @code{NULL}
- @code{BZ_OK} otherwise
-@end display
-
-
-@subsection @code{BZ2_bzDecompressInit}
-@example
-int BZ2_bzDecompressInit ( bz_stream *strm, int verbosity, int small );
-@end example
-Prepares for decompression. As with @code{BZ2_bzCompressInit}, a
-@code{bz_stream} record should be allocated and initialised before the
-call. Fields @code{bzalloc}, @code{bzfree} and @code{opaque} should be
-set if a custom memory allocator is required, or made @code{NULL} for
-the normal @code{malloc}/@code{free} routines. Upon return, the internal
-state will have been initialised, and @code{total_in} and
-@code{total_out} will be zero.
-
-For the meaning of parameter @code{verbosity}, see @code{BZ2_bzCompressInit}.
-
-If @code{small} is nonzero, the library will use an alternative
-decompression algorithm which uses less memory but at the cost of
-decompressing more slowly (roughly speaking, half the speed, but the
-maximum memory requirement drops to around 2300k). See Chapter 2 for
-more information on memory management.
-
-Note that the amount of memory needed to decompress
-a stream cannot be determined until the stream's header has been read,
-so even if @code{BZ2_bzDecompressInit} succeeds, a subsequent
-@code{BZ2_bzDecompress} could fail with @code{BZ_MEM_ERROR}.
-
-Possible return values:
-@display
- @code{BZ_CONFIG_ERROR}
- if the library has been mis-compiled
- @code{BZ_PARAM_ERROR}
- if @code{(small != 0 && small != 1)}
- or @code{(verbosity < 0 || verbosity > 4)}
- @code{BZ_MEM_ERROR}
- if insufficient memory is available
-@end display
-
-Allowable next actions:
-@display
- @code{BZ2_bzDecompress}
- if @code{BZ_OK} was returned
- no specific action required in case of error
-@end display
-
-
-
-@subsection @code{BZ2_bzDecompress}
-@example
-int BZ2_bzDecompress ( bz_stream *strm );
-@end example
-Provides more input and/out output buffer space for the library. The
-caller maintains input and output buffers, and uses @code{BZ2_bzDecompress}
-to transfer data between them.
-
-Before each call to @code{BZ2_bzDecompress}, @code{next_in}
-should point at the compressed data,
-and @code{avail_in} should indicate how many bytes the library
-may read. @code{BZ2_bzDecompress} updates @code{next_in}, @code{avail_in}
-and @code{total_in}
-to reflect the number of bytes it has read.
-
-Similarly, @code{next_out} should point to a buffer in which the uncompressed
-output is to be placed, with @code{avail_out} indicating how much output space
-is available. @code{BZ2_bzCompress} updates @code{next_out},
-@code{avail_out} and @code{total_out} to reflect
-the number of bytes output.
-
-You may provide and remove as little or as much data as you like on
-each call of @code{BZ2_bzDecompress}.
-In the limit, it is acceptable to
-supply and remove data one byte at a time, although this would be
-terribly inefficient. You should always ensure that at least one
-byte of output space is available at each call.
-
-Use of @code{BZ2_bzDecompress} is simpler than @code{BZ2_bzCompress}.
-
-You should provide input and remove output as described above, and
-repeatedly call @code{BZ2_bzDecompress} until @code{BZ_STREAM_END} is
-returned. Appearance of @code{BZ_STREAM_END} denotes that
-@code{BZ2_bzDecompress} has detected the logical end of the compressed
-stream. @code{BZ2_bzDecompress} will not produce @code{BZ_STREAM_END} until
-all output data has been placed into the output buffer, so once
-@code{BZ_STREAM_END} appears, you are guaranteed to have available all
-the decompressed output, and @code{BZ2_bzDecompressEnd} can safely be
-called.
-
-If case of an error return value, you should call @code{BZ2_bzDecompressEnd}
-to clean up and release memory.
-
-Possible return values:
-@display
- @code{BZ_PARAM_ERROR}
- if @code{strm} is @code{NULL} or @code{strm->s} is @code{NULL}
- or @code{strm->avail_out < 1}
- @code{BZ_DATA_ERROR}
- if a data integrity error is detected in the compressed stream
- @code{BZ_DATA_ERROR_MAGIC}
- if the compressed stream doesn't begin with the right magic bytes
- @code{BZ_MEM_ERROR}
- if there wasn't enough memory available
- @code{BZ_STREAM_END}
- if the logical end of the data stream was detected and all
- output in has been consumed, eg @code{s->avail_out > 0}
- @code{BZ_OK}
- otherwise
-@end display
-Allowable next actions:
-@display
- @code{BZ2_bzDecompress}
- if @code{BZ_OK} was returned
- @code{BZ2_bzDecompressEnd}
- otherwise
-@end display
-
-
-@subsection @code{BZ2_bzDecompressEnd}
-@example
-int BZ2_bzDecompressEnd ( bz_stream *strm );
-@end example
-Releases all memory associated with a decompression stream.
-
-Possible return values:
-@display
- @code{BZ_PARAM_ERROR}
- if @code{strm} is @code{NULL} or @code{strm->s} is @code{NULL}
- @code{BZ_OK}
- otherwise
-@end display
-
-Allowable next actions:
-@display
- None.
-@end display
-
-
-@section High-level interface
-
-This interface provides functions for reading and writing
-@code{bzip2} format files. First, some general points.
-
-@itemize @bullet
-@item All of the functions take an @code{int*} first argument,
- @code{bzerror}.
- After each call, @code{bzerror} should be consulted first to determine
- the outcome of the call. If @code{bzerror} is @code{BZ_OK},
- the call completed
- successfully, and only then should the return value of the function
- (if any) be consulted. If @code{bzerror} is @code{BZ_IO_ERROR},
- there was an error
- reading/writing the underlying compressed file, and you should
- then consult @code{errno}/@code{perror} to determine the
- cause of the difficulty.
- @code{bzerror} may also be set to various other values; precise details are
- given on a per-function basis below.
-@item If @code{bzerror} indicates an error
- (ie, anything except @code{BZ_OK} and @code{BZ_STREAM_END}),
- you should immediately call @code{BZ2_bzReadClose} (or @code{BZ2_bzWriteClose},
- depending on whether you are attempting to read or to write)
- to free up all resources associated
- with the stream. Once an error has been indicated, behaviour of all calls
- except @code{BZ2_bzReadClose} (@code{BZ2_bzWriteClose}) is undefined.
- The implication is that (1) @code{bzerror} should
- be checked after each call, and (2) if @code{bzerror} indicates an error,
- @code{BZ2_bzReadClose} (@code{BZ2_bzWriteClose}) should then be called to clean up.
-@item The @code{FILE*} arguments passed to
- @code{BZ2_bzReadOpen}/@code{BZ2_bzWriteOpen}
- should be set to binary mode.
- Most Unix systems will do this by default, but other platforms,
- including Windows and Mac, will not. If you omit this, you may
- encounter problems when moving code to new platforms.
-@item Memory allocation requests are handled by
- @code{malloc}/@code{free}.
- At present
- there is no facility for user-defined memory allocators in the file I/O
- functions (could easily be added, though).
-@end itemize
-
-
-
-@subsection @code{BZ2_bzReadOpen}
-@example
- typedef void BZFILE;
-
- BZFILE *BZ2_bzReadOpen ( int *bzerror, FILE *f,
- int small, int verbosity,
- void *unused, int nUnused );
-@end example
-Prepare to read compressed data from file handle @code{f}. @code{f}
-should refer to a file which has been opened for reading, and for which
-the error indicator (@code{ferror(f)})is not set. If @code{small} is 1,
-the library will try to decompress using less memory, at the expense of
-speed.
-
-For reasons explained below, @code{BZ2_bzRead} will decompress the
-@code{nUnused} bytes starting at @code{unused}, before starting to read
-from the file @code{f}. At most @code{BZ_MAX_UNUSED} bytes may be
-supplied like this. If this facility is not required, you should pass
-@code{NULL} and @code{0} for @code{unused} and n@code{Unused}
-respectively.
-
-For the meaning of parameters @code{small} and @code{verbosity},
-see @code{BZ2_bzDecompressInit}.
-
-The amount of memory needed to decompress a file cannot be determined
-until the file's header has been read. So it is possible that
-@code{BZ2_bzReadOpen} returns @code{BZ_OK} but a subsequent call of
-@code{BZ2_bzRead} will return @code{BZ_MEM_ERROR}.
-
-Possible assignments to @code{bzerror}:
-@display
- @code{BZ_CONFIG_ERROR}
- if the library has been mis-compiled
- @code{BZ_PARAM_ERROR}
- if @code{f} is @code{NULL}
- or @code{small} is neither @code{0} nor @code{1}
- or @code{(unused == NULL && nUnused != 0)}
- or @code{(unused != NULL && !(0 <= nUnused <= BZ_MAX_UNUSED))}
- @code{BZ_IO_ERROR}
- if @code{ferror(f)} is nonzero
- @code{BZ_MEM_ERROR}
- if insufficient memory is available
- @code{BZ_OK}
- otherwise.
-@end display
-
-Possible return values:
-@display
- Pointer to an abstract @code{BZFILE}
- if @code{bzerror} is @code{BZ_OK}
- @code{NULL}
- otherwise
-@end display
-
-Allowable next actions:
-@display
- @code{BZ2_bzRead}
- if @code{bzerror} is @code{BZ_OK}
- @code{BZ2_bzClose}
- otherwise
-@end display
-
-
-@subsection @code{BZ2_bzRead}
-@example
- int BZ2_bzRead ( int *bzerror, BZFILE *b, void *buf, int len );
-@end example
-Reads up to @code{len} (uncompressed) bytes from the compressed file
-@code{b} into
-the buffer @code{buf}. If the read was successful,
-@code{bzerror} is set to @code{BZ_OK}
-and the number of bytes read is returned. If the logical end-of-stream
-was detected, @code{bzerror} will be set to @code{BZ_STREAM_END},
-and the number
-of bytes read is returned. All other @code{bzerror} values denote an error.
-
-@code{BZ2_bzRead} will supply @code{len} bytes,
-unless the logical stream end is detected
-or an error occurs. Because of this, it is possible to detect the
-stream end by observing when the number of bytes returned is
-less than the number
-requested. Nevertheless, this is regarded as inadvisable; you should
-instead check @code{bzerror} after every call and watch out for
-@code{BZ_STREAM_END}.
-
-Internally, @code{BZ2_bzRead} copies data from the compressed file in chunks
-of size @code{BZ_MAX_UNUSED} bytes
-before decompressing it. If the file contains more bytes than strictly
-needed to reach the logical end-of-stream, @code{BZ2_bzRead} will almost certainly
-read some of the trailing data before signalling @code{BZ_SEQUENCE_END}.
-To collect the read but unused data once @code{BZ_SEQUENCE_END} has
-appeared, call @code{BZ2_bzReadGetUnused} immediately before @code{BZ2_bzReadClose}.
-
-Possible assignments to @code{bzerror}:
-@display
- @code{BZ_PARAM_ERROR}
- if @code{b} is @code{NULL} or @code{buf} is @code{NULL} or @code{len < 0}
- @code{BZ_SEQUENCE_ERROR}
- if @code{b} was opened with @code{BZ2_bzWriteOpen}
- @code{BZ_IO_ERROR}
- if there is an error reading from the compressed file
- @code{BZ_UNEXPECTED_EOF}
- if the compressed file ended before the logical end-of-stream was detected
- @code{BZ_DATA_ERROR}
- if a data integrity error was detected in the compressed stream
- @code{BZ_DATA_ERROR_MAGIC}
- if the stream does not begin with the requisite header bytes (ie, is not
- a @code{bzip2} data file). This is really a special case of @code{BZ_DATA_ERROR}.
- @code{BZ_MEM_ERROR}
- if insufficient memory was available
- @code{BZ_STREAM_END}
- if the logical end of stream was detected.
- @code{BZ_OK}
- otherwise.
-@end display
-
-Possible return values:
-@display
- number of bytes read
- if @code{bzerror} is @code{BZ_OK} or @code{BZ_STREAM_END}
- undefined
- otherwise
-@end display
-
-Allowable next actions:
-@display
- collect data from @code{buf}, then @code{BZ2_bzRead} or @code{BZ2_bzReadClose}
- if @code{bzerror} is @code{BZ_OK}
- collect data from @code{buf}, then @code{BZ2_bzReadClose} or @code{BZ2_bzReadGetUnused}
- if @code{bzerror} is @code{BZ_SEQUENCE_END}
- @code{BZ2_bzReadClose}
- otherwise
-@end display
-
-
-
-@subsection @code{BZ2_bzReadGetUnused}
-@example
- void BZ2_bzReadGetUnused ( int* bzerror, BZFILE *b,
- void** unused, int* nUnused );
-@end example
-Returns data which was read from the compressed file but was not needed
-to get to the logical end-of-stream. @code{*unused} is set to the address
-of the data, and @code{*nUnused} to the number of bytes. @code{*nUnused} will
-be set to a value between @code{0} and @code{BZ_MAX_UNUSED} inclusive.
-
-This function may only be called once @code{BZ2_bzRead} has signalled
-@code{BZ_STREAM_END} but before @code{BZ2_bzReadClose}.
-
-Possible assignments to @code{bzerror}:
-@display
- @code{BZ_PARAM_ERROR}
- if @code{b} is @code{NULL}
- or @code{unused} is @code{NULL} or @code{nUnused} is @code{NULL}
- @code{BZ_SEQUENCE_ERROR}
- if @code{BZ_STREAM_END} has not been signalled
- or if @code{b} was opened with @code{BZ2_bzWriteOpen}
- @code{BZ_OK}
- otherwise
-@end display
-
-Allowable next actions:
-@display
- @code{BZ2_bzReadClose}
-@end display
-
-
-@subsection @code{BZ2_bzReadClose}
-@example
- void BZ2_bzReadClose ( int *bzerror, BZFILE *b );
-@end example
-Releases all memory pertaining to the compressed file @code{b}.
-@code{BZ2_bzReadClose} does not call @code{fclose} on the underlying file
-handle, so you should do that yourself if appropriate.
-@code{BZ2_bzReadClose} should be called to clean up after all error
-situations.
-
-Possible assignments to @code{bzerror}:
-@display
- @code{BZ_SEQUENCE_ERROR}
- if @code{b} was opened with @code{BZ2_bzOpenWrite}
- @code{BZ_OK}
- otherwise
-@end display
-
-Allowable next actions:
-@display
- none
-@end display
-
-
-
-@subsection @code{BZ2_bzWriteOpen}
-@example
- BZFILE *BZ2_bzWriteOpen ( int *bzerror, FILE *f,
- int blockSize100k, int verbosity,
- int workFactor );
-@end example
-Prepare to write compressed data to file handle @code{f}.
-@code{f} should refer to
-a file which has been opened for writing, and for which the error
-indicator (@code{ferror(f)})is not set.
-
-For the meaning of parameters @code{blockSize100k},
-@code{verbosity} and @code{workFactor}, see
-@* @code{BZ2_bzCompressInit}.
-
-All required memory is allocated at this stage, so if the call
-completes successfully, @code{BZ_MEM_ERROR} cannot be signalled by a
-subsequent call to @code{BZ2_bzWrite}.
-
-Possible assignments to @code{bzerror}:
-@display
- @code{BZ_CONFIG_ERROR}
- if the library has been mis-compiled
- @code{BZ_PARAM_ERROR}
- if @code{f} is @code{NULL}
- or @code{blockSize100k < 1} or @code{blockSize100k > 9}
- @code{BZ_IO_ERROR}
- if @code{ferror(f)} is nonzero
- @code{BZ_MEM_ERROR}
- if insufficient memory is available
- @code{BZ_OK}
- otherwise
-@end display
-
-Possible return values:
-@display
- Pointer to an abstract @code{BZFILE}
- if @code{bzerror} is @code{BZ_OK}
- @code{NULL}
- otherwise
-@end display
-
-Allowable next actions:
-@display
- @code{BZ2_bzWrite}
- if @code{bzerror} is @code{BZ_OK}
- (you could go directly to @code{BZ2_bzWriteClose}, but this would be pretty pointless)
- @code{BZ2_bzWriteClose}
- otherwise
-@end display
-
-
-
-@subsection @code{BZ2_bzWrite}
-@example
- void BZ2_bzWrite ( int *bzerror, BZFILE *b, void *buf, int len );
-@end example
-Absorbs @code{len} bytes from the buffer @code{buf}, eventually to be
-compressed and written to the file.
-
-Possible assignments to @code{bzerror}:
-@display
- @code{BZ_PARAM_ERROR}
- if @code{b} is @code{NULL} or @code{buf} is @code{NULL} or @code{len < 0}
- @code{BZ_SEQUENCE_ERROR}
- if b was opened with @code{BZ2_bzReadOpen}
- @code{BZ_IO_ERROR}
- if there is an error writing the compressed file.
- @code{BZ_OK}
- otherwise
-@end display
-
-
-
-
-@subsection @code{BZ2_bzWriteClose}
-@example
- void BZ2_bzWriteClose ( int *bzerror, BZFILE* f,
- int abandon,
- unsigned int* nbytes_in,
- unsigned int* nbytes_out );
-
- void BZ2_bzWriteClose64 ( int *bzerror, BZFILE* f,
- int abandon,
- unsigned int* nbytes_in_lo32,
- unsigned int* nbytes_in_hi32,
- unsigned int* nbytes_out_lo32,
- unsigned int* nbytes_out_hi32 );
-@end example
-
-Compresses and flushes to the compressed file all data so far supplied
-by @code{BZ2_bzWrite}. The logical end-of-stream markers are also written, so
-subsequent calls to @code{BZ2_bzWrite} are illegal. All memory associated
-with the compressed file @code{b} is released.
-@code{fflush} is called on the
-compressed file, but it is not @code{fclose}'d.
-
-If @code{BZ2_bzWriteClose} is called to clean up after an error, the only
-action is to release the memory. The library records the error codes
-issued by previous calls, so this situation will be detected
-automatically. There is no attempt to complete the compression
-operation, nor to @code{fflush} the compressed file. You can force this
-behaviour to happen even in the case of no error, by passing a nonzero
-value to @code{abandon}.
-
-If @code{nbytes_in} is non-null, @code{*nbytes_in} will be set to be the
-total volume of uncompressed data handled. Similarly, @code{nbytes_out}
-will be set to the total volume of compressed data written. For
-compatibility with older versions of the library, @code{BZ2_bzWriteClose}
-only yields the lower 32 bits of these counts. Use
-@code{BZ2_bzWriteClose64} if you want the full 64 bit counts. These
-two functions are otherwise absolutely identical.
-
-
-Possible assignments to @code{bzerror}:
-@display
- @code{BZ_SEQUENCE_ERROR}
- if @code{b} was opened with @code{BZ2_bzReadOpen}
- @code{BZ_IO_ERROR}
- if there is an error writing the compressed file
- @code{BZ_OK}
- otherwise
-@end display
-
-@subsection Handling embedded compressed data streams
-
-The high-level library facilitates use of
-@code{bzip2} data streams which form some part of a surrounding, larger
-data stream.
-@itemize @bullet
-@item For writing, the library takes an open file handle, writes
-compressed data to it, @code{fflush}es it but does not @code{fclose} it.
-The calling application can write its own data before and after the
-compressed data stream, using that same file handle.
-@item Reading is more complex, and the facilities are not as general
-as they could be since generality is hard to reconcile with efficiency.
-@code{BZ2_bzRead} reads from the compressed file in blocks of size
-@code{BZ_MAX_UNUSED} bytes, and in doing so probably will overshoot
-the logical end of compressed stream.
-To recover this data once decompression has
-ended, call @code{BZ2_bzReadGetUnused} after the last call of @code{BZ2_bzRead}
-(the one returning @code{BZ_STREAM_END}) but before calling
-@code{BZ2_bzReadClose}.
-@end itemize
-
-This mechanism makes it easy to decompress multiple @code{bzip2}
-streams placed end-to-end. As the end of one stream, when @code{BZ2_bzRead}
-returns @code{BZ_STREAM_END}, call @code{BZ2_bzReadGetUnused} to collect the
-unused data (copy it into your own buffer somewhere).
-That data forms the start of the next compressed stream.
-To start uncompressing that next stream, call @code{BZ2_bzReadOpen} again,
-feeding in the unused data via the @code{unused}/@code{nUnused}
-parameters.
-Keep doing this until @code{BZ_STREAM_END} return coincides with the
-physical end of file (@code{feof(f)}). In this situation
-@code{BZ2_bzReadGetUnused}
-will of course return no data.
-
-This should give some feel for how the high-level interface can be used.
-If you require extra flexibility, you'll have to bite the bullet and get
-to grips with the low-level interface.
-
-@subsection Standard file-reading/writing code
-Here's how you'd write data to a compressed file:
-@example @code
-FILE* f;
-BZFILE* b;
-int nBuf;
-char buf[ /* whatever size you like */ ];
-int bzerror;
-int nWritten;
-
-f = fopen ( "myfile.bz2", "w" );
-if (!f) @{
- /* handle error */
-@}
-b = BZ2_bzWriteOpen ( &bzerror, f, 9 );
-if (bzerror != BZ_OK) @{
- BZ2_bzWriteClose ( b );
- /* handle error */
-@}
-
-while ( /* condition */ ) @{
- /* get data to write into buf, and set nBuf appropriately */
- nWritten = BZ2_bzWrite ( &bzerror, b, buf, nBuf );
- if (bzerror == BZ_IO_ERROR) @{
- BZ2_bzWriteClose ( &bzerror, b );
- /* handle error */
- @}
-@}
-
-BZ2_bzWriteClose ( &bzerror, b );
-if (bzerror == BZ_IO_ERROR) @{
- /* handle error */
-@}
-@end example
-And to read from a compressed file:
-@example
-FILE* f;
-BZFILE* b;
-int nBuf;
-char buf[ /* whatever size you like */ ];
-int bzerror;
-int nWritten;
-
-f = fopen ( "myfile.bz2", "r" );
-if (!f) @{
- /* handle error */
-@}
-b = BZ2_bzReadOpen ( &bzerror, f, 0, NULL, 0 );
-if (bzerror != BZ_OK) @{
- BZ2_bzReadClose ( &bzerror, b );
- /* handle error */
-@}
-
-bzerror = BZ_OK;
-while (bzerror == BZ_OK && /* arbitrary other conditions */) @{
- nBuf = BZ2_bzRead ( &bzerror, b, buf, /* size of buf */ );
- if (bzerror == BZ_OK) @{
- /* do something with buf[0 .. nBuf-1] */
- @}
-@}
-if (bzerror != BZ_STREAM_END) @{
- BZ2_bzReadClose ( &bzerror, b );
- /* handle error */
-@} else @{
- BZ2_bzReadClose ( &bzerror );
-@}
-@end example
-
-
-
-@section Utility functions
-@subsection @code{BZ2_bzBuffToBuffCompress}
-@example
- int BZ2_bzBuffToBuffCompress( char* dest,
- unsigned int* destLen,
- char* source,
- unsigned int sourceLen,
- int blockSize100k,
- int verbosity,
- int workFactor );
-@end example
-Attempts to compress the data in @code{source[0 .. sourceLen-1]}
-into the destination buffer, @code{dest[0 .. *destLen-1]}.
-If the destination buffer is big enough, @code{*destLen} is
-set to the size of the compressed data, and @code{BZ_OK} is
-returned. If the compressed data won't fit, @code{*destLen}
-is unchanged, and @code{BZ_OUTBUFF_FULL} is returned.
-
-Compression in this manner is a one-shot event, done with a single call
-to this function. The resulting compressed data is a complete
-@code{bzip2} format data stream. There is no mechanism for making
-additional calls to provide extra input data. If you want that kind of
-mechanism, use the low-level interface.
-
-For the meaning of parameters @code{blockSize100k}, @code{verbosity}
-and @code{workFactor}, @* see @code{BZ2_bzCompressInit}.
-
-To guarantee that the compressed data will fit in its buffer, allocate
-an output buffer of size 1% larger than the uncompressed data, plus
-six hundred extra bytes.
-
-@code{BZ2_bzBuffToBuffDecompress} will not write data at or
-beyond @code{dest[*destLen]}, even in case of buffer overflow.
-
-Possible return values:
-@display
- @code{BZ_CONFIG_ERROR}
- if the library has been mis-compiled
- @code{BZ_PARAM_ERROR}
- if @code{dest} is @code{NULL} or @code{destLen} is @code{NULL}
- or @code{blockSize100k < 1} or @code{blockSize100k > 9}
- or @code{verbosity < 0} or @code{verbosity > 4}
- or @code{workFactor < 0} or @code{workFactor > 250}
- @code{BZ_MEM_ERROR}
- if insufficient memory is available
- @code{BZ_OUTBUFF_FULL}
- if the size of the compressed data exceeds @code{*destLen}
- @code{BZ_OK}
- otherwise
-@end display
-
-
-
-@subsection @code{BZ2_bzBuffToBuffDecompress}
-@example
- int BZ2_bzBuffToBuffDecompress ( char* dest,
- unsigned int* destLen,
- char* source,
- unsigned int sourceLen,
- int small,
- int verbosity );
-@end example
-Attempts to decompress the data in @code{source[0 .. sourceLen-1]}
-into the destination buffer, @code{dest[0 .. *destLen-1]}.
-If the destination buffer is big enough, @code{*destLen} is
-set to the size of the uncompressed data, and @code{BZ_OK} is
-returned. If the compressed data won't fit, @code{*destLen}
-is unchanged, and @code{BZ_OUTBUFF_FULL} is returned.
-
-@code{source} is assumed to hold a complete @code{bzip2} format
-data stream. @* @code{BZ2_bzBuffToBuffDecompress} tries to decompress
-the entirety of the stream into the output buffer.
-
-For the meaning of parameters @code{small} and @code{verbosity},
-see @code{BZ2_bzDecompressInit}.
-
-Because the compression ratio of the compressed data cannot be known in
-advance, there is no easy way to guarantee that the output buffer will
-be big enough. You may of course make arrangements in your code to
-record the size of the uncompressed data, but such a mechanism is beyond
-the scope of this library.
-
-@code{BZ2_bzBuffToBuffDecompress} will not write data at or
-beyond @code{dest[*destLen]}, even in case of buffer overflow.
-
-Possible return values:
-@display
- @code{BZ_CONFIG_ERROR}
- if the library has been mis-compiled
- @code{BZ_PARAM_ERROR}
- if @code{dest} is @code{NULL} or @code{destLen} is @code{NULL}
- or @code{small != 0 && small != 1}
- or @code{verbosity < 0} or @code{verbosity > 4}
- @code{BZ_MEM_ERROR}
- if insufficient memory is available
- @code{BZ_OUTBUFF_FULL}
- if the size of the compressed data exceeds @code{*destLen}
- @code{BZ_DATA_ERROR}
- if a data integrity error was detected in the compressed data
- @code{BZ_DATA_ERROR_MAGIC}
- if the compressed data doesn't begin with the right magic bytes
- @code{BZ_UNEXPECTED_EOF}
- if the compressed data ends unexpectedly
- @code{BZ_OK}
- otherwise
-@end display
-
-
-
-@section @code{zlib} compatibility functions
-Yoshioka Tsuneo has contributed some functions to
-give better @code{zlib} compatibility. These functions are
-@code{BZ2_bzopen}, @code{BZ2_bzread}, @code{BZ2_bzwrite}, @code{BZ2_bzflush},
-@code{BZ2_bzclose},
-@code{BZ2_bzerror} and @code{BZ2_bzlibVersion}.
-These functions are not (yet) officially part of
-the library. If they break, you get to keep all the pieces.
-Nevertheless, I think they work ok.
-@example
-typedef void BZFILE;
-
-const char * BZ2_bzlibVersion ( void );
-@end example
-Returns a string indicating the library version.
-@example
-BZFILE * BZ2_bzopen ( const char *path, const char *mode );
-BZFILE * BZ2_bzdopen ( int fd, const char *mode );
-@end example
-Opens a @code{.bz2} file for reading or writing, using either its name
-or a pre-existing file descriptor.
-Analogous to @code{fopen} and @code{fdopen}.
-@example
-int BZ2_bzread ( BZFILE* b, void* buf, int len );
-int BZ2_bzwrite ( BZFILE* b, void* buf, int len );
-@end example
-Reads/writes data from/to a previously opened @code{BZFILE}.
-Analogous to @code{fread} and @code{fwrite}.
-@example
-int BZ2_bzflush ( BZFILE* b );
-void BZ2_bzclose ( BZFILE* b );
-@end example
-Flushes/closes a @code{BZFILE}. @code{BZ2_bzflush} doesn't actually do
-anything. Analogous to @code{fflush} and @code{fclose}.
-
-@example
-const char * BZ2_bzerror ( BZFILE *b, int *errnum )
-@end example
-Returns a string describing the more recent error status of
-@code{b}, and also sets @code{*errnum} to its numerical value.
-
-
-@section Using the library in a @code{stdio}-free environment
-
-@subsection Getting rid of @code{stdio}
-
-In a deeply embedded application, you might want to use just
-the memory-to-memory functions. You can do this conveniently
-by compiling the library with preprocessor symbol @code{BZ_NO_STDIO}
-defined. Doing this gives you a library containing only the following
-eight functions:
-
-@code{BZ2_bzCompressInit}, @code{BZ2_bzCompress}, @code{BZ2_bzCompressEnd} @*
-@code{BZ2_bzDecompressInit}, @code{BZ2_bzDecompress}, @code{BZ2_bzDecompressEnd} @*
-@code{BZ2_bzBuffToBuffCompress}, @code{BZ2_bzBuffToBuffDecompress}
-
-When compiled like this, all functions will ignore @code{verbosity}
-settings.
-
-@subsection Critical error handling
-@code{libbzip2} contains a number of internal assertion checks which
-should, needless to say, never be activated. Nevertheless, if an
-assertion should fail, behaviour depends on whether or not the library
-was compiled with @code{BZ_NO_STDIO} set.
-
-For a normal compile, an assertion failure yields the message
-@example
- bzip2/libbzip2: internal error number N.
- This is a bug in bzip2/libbzip2, 1.0 of 21-Mar-2000.
- Please report it to me at: jseward@@acm.org. If this happened
- when you were using some program which uses libbzip2 as a
- component, you should also report this bug to the author(s)
- of that program. Please make an effort to report this bug;
- timely and accurate bug reports eventually lead to higher
- quality software. Thanks. Julian Seward, 21 March 2000.
-@end example
-where @code{N} is some error code number. @code{exit(3)}
-is then called.
-
-For a @code{stdio}-free library, assertion failures result
-in a call to a function declared as:
-@example
- extern void bz_internal_error ( int errcode );
-@end example
-The relevant code is passed as a parameter. You should supply
-such a function.
-
-In either case, once an assertion failure has occurred, any
-@code{bz_stream} records involved can be regarded as invalid.
-You should not attempt to resume normal operation with them.
-
-You may, of course, change critical error handling to suit
-your needs. As I said above, critical errors indicate bugs
-in the library and should not occur. All "normal" error
-situations are indicated via error return codes from functions,
-and can be recovered from.
-
-
-@section Making a Windows DLL
-Everything related to Windows has been contributed by Yoshioka Tsuneo
-@* (@code{QWF00133@@niftyserve.or.jp} /
-@code{tsuneo-y@@is.aist-nara.ac.jp}), so you should send your queries to
-him (but perhaps Cc: me, @code{jseward@@acm.org}).
-
-My vague understanding of what to do is: using Visual C++ 5.0,
-open the project file @code{libbz2.dsp}, and build. That's all.
-
-If you can't
-open the project file for some reason, make a new one, naming these files:
-@code{blocksort.c}, @code{bzlib.c}, @code{compress.c},
-@code{crctable.c}, @code{decompress.c}, @code{huffman.c}, @*
-@code{randtable.c} and @code{libbz2.def}. You will also need
-to name the header files @code{bzlib.h} and @code{bzlib_private.h}.
-
-If you don't use VC++, you may need to define the proprocessor symbol
-@code{_WIN32}.
-
-Finally, @code{dlltest.c} is a sample program using the DLL. It has a
-project file, @code{dlltest.dsp}.
-
-If you just want a makefile for Visual C, have a look at
-@code{makefile.msc}.
-
-Be aware that if you compile @code{bzip2} itself on Win32, you must set
-@code{BZ_UNIX} to 0 and @code{BZ_LCCWIN32} to 1, in the file
-@code{bzip2.c}, before compiling. Otherwise the resulting binary won't
-work correctly.
-
-I haven't tried any of this stuff myself, but it all looks plausible.
-
-
-
-@chapter Miscellanea
-
-These are just some random thoughts of mine. Your mileage may
-vary.
-
-@section Limitations of the compressed file format
-@code{bzip2-1.0}, @code{0.9.5} and @code{0.9.0}
-use exactly the same file format as the previous
-version, @code{bzip2-0.1}. This decision was made in the interests of
-stability. Creating yet another incompatible compressed file format
-would create further confusion and disruption for users.
-
-Nevertheless, this is not a painless decision. Development
-work since the release of @code{bzip2-0.1} in August 1997
-has shown complexities in the file format which slow down
-decompression and, in retrospect, are unnecessary. These are:
-@itemize @bullet
-@item The run-length encoder, which is the first of the
- compression transformations, is entirely irrelevant.
- The original purpose was to protect the sorting algorithm
- from the very worst case input: a string of repeated
- symbols. But algorithm steps Q6a and Q6b in the original
- Burrows-Wheeler technical report (SRC-124) show how
- repeats can be handled without difficulty in block
- sorting.
-@item The randomisation mechanism doesn't really need to be
- there. Udi Manber and Gene Myers published a suffix
- array construction algorithm a few years back, which
- can be employed to sort any block, no matter how
- repetitive, in O(N log N) time. Subsequent work by
- Kunihiko Sadakane has produced a derivative O(N (log N)^2)
- algorithm which usually outperforms the Manber-Myers
- algorithm.
-
- I could have changed to Sadakane's algorithm, but I find
- it to be slower than @code{bzip2}'s existing algorithm for
- most inputs, and the randomisation mechanism protects
- adequately against bad cases. I didn't think it was
- a good tradeoff to make. Partly this is due to the fact
- that I was not flooded with email complaints about
- @code{bzip2-0.1}'s performance on repetitive data, so
- perhaps it isn't a problem for real inputs.
-
- Probably the best long-term solution,
- and the one I have incorporated into 0.9.5 and above,
- is to use the existing sorting
- algorithm initially, and fall back to a O(N (log N)^2)
- algorithm if the standard algorithm gets into difficulties.
-@item The compressed file format was never designed to be
- handled by a library, and I have had to jump though
- some hoops to produce an efficient implementation of
- decompression. It's a bit hairy. Try passing
- @code{decompress.c} through the C preprocessor
- and you'll see what I mean. Much of this complexity
- could have been avoided if the compressed size of
- each block of data was recorded in the data stream.
-@item An Adler-32 checksum, rather than a CRC32 checksum,
- would be faster to compute.
-@end itemize
-It would be fair to say that the @code{bzip2} format was frozen
-before I properly and fully understood the performance
-consequences of doing so.
-
-Improvements which I was able to incorporate into
-0.9.0, despite using the same file format, are:
-@itemize @bullet
-@item Single array implementation of the inverse BWT. This
- significantly speeds up decompression, presumably
- because it reduces the number of cache misses.
-@item Faster inverse MTF transform for large MTF values. The
- new implementation is based on the notion of sliding blocks
- of values.
-@item @code{bzip2-0.9.0} now reads and writes files with @code{fread}
- and @code{fwrite}; version 0.1 used @code{putc} and @code{getc}.
- Duh! Well, you live and learn.
-
-@end itemize
-Further ahead, it would be nice
-to be able to do random access into files. This will
-require some careful design of compressed file formats.
-
-
-
-@section Portability issues
-After some consideration, I have decided not to use
-GNU @code{autoconf} to configure 0.9.5 or 1.0.
-
-@code{autoconf}, admirable and wonderful though it is,
-mainly assists with portability problems between Unix-like
-platforms. But @code{bzip2} doesn't have much in the way
-of portability problems on Unix; most of the difficulties appear
-when porting to the Mac, or to Microsoft's operating systems.
-@code{autoconf} doesn't help in those cases, and brings in a
-whole load of new complexity.
-
-Most people should be able to compile the library and program
-under Unix straight out-of-the-box, so to speak, especially
-if you have a version of GNU C available.
-
-There are a couple of @code{__inline__} directives in the code. GNU C
-(@code{gcc}) should be able to handle them. If you're not using
-GNU C, your C compiler shouldn't see them at all.
-If your compiler does, for some reason, see them and doesn't
-like them, just @code{#define} @code{__inline__} to be @code{/* */}. One
-easy way to do this is to compile with the flag @code{-D__inline__=},
-which should be understood by most Unix compilers.
-
-If you still have difficulties, try compiling with the macro
-@code{BZ_STRICT_ANSI} defined. This should enable you to build the
-library in a strictly ANSI compliant environment. Building the program
-itself like this is dangerous and not supported, since you remove
-@code{bzip2}'s checks against compressing directories, symbolic links,
-devices, and other not-really-a-file entities. This could cause
-filesystem corruption!
-
-One other thing: if you create a @code{bzip2} binary for public
-distribution, please try and link it statically (@code{gcc -s}). This
-avoids all sorts of library-version issues that others may encounter
-later on.
-
-If you build @code{bzip2} on Win32, you must set @code{BZ_UNIX} to 0 and
-@code{BZ_LCCWIN32} to 1, in the file @code{bzip2.c}, before compiling.
-Otherwise the resulting binary won't work correctly.
-
-
-
-@section Reporting bugs
-I tried pretty hard to make sure @code{bzip2} is
-bug free, both by design and by testing. Hopefully
-you'll never need to read this section for real.
-
-Nevertheless, if @code{bzip2} dies with a segmentation
-fault, a bus error or an internal assertion failure, it
-will ask you to email me a bug report. Experience with
-version 0.1 shows that almost all these problems can
-be traced to either compiler bugs or hardware problems.
-@itemize @bullet
-@item
-Recompile the program with no optimisation, and see if it
-works. And/or try a different compiler.
-I heard all sorts of stories about various flavours
-of GNU C (and other compilers) generating bad code for
-@code{bzip2}, and I've run across two such examples myself.
-
-2.7.X versions of GNU C are known to generate bad code from
-time to time, at high optimisation levels.
-If you get problems, try using the flags
-@code{-O2} @code{-fomit-frame-pointer} @code{-fno-strength-reduce}.
-You should specifically @emph{not} use @code{-funroll-loops}.
-
-You may notice that the Makefile runs six tests as part of
-the build process. If the program passes all of these, it's
-a pretty good (but not 100%) indication that the compiler has
-done its job correctly.
-@item
-If @code{bzip2} crashes randomly, and the crashes are not
-repeatable, you may have a flaky memory subsystem. @code{bzip2}
-really hammers your memory hierarchy, and if it's a bit marginal,
-you may get these problems. Ditto if your disk or I/O subsystem
-is slowly failing. Yup, this really does happen.
-
-Try using a different machine of the same type, and see if
-you can repeat the problem.
-@item This isn't really a bug, but ... If @code{bzip2} tells
-you your file is corrupted on decompression, and you
-obtained the file via FTP, there is a possibility that you
-forgot to tell FTP to do a binary mode transfer. That absolutely
-will cause the file to be non-decompressible. You'll have to transfer
-it again.
-@end itemize
-
-If you've incorporated @code{libbzip2} into your own program
-and are getting problems, please, please, please, check that the
-parameters you are passing in calls to the library, are
-correct, and in accordance with what the documentation says
-is allowable. I have tried to make the library robust against
-such problems, but I'm sure I haven't succeeded.
-
-Finally, if the above comments don't help, you'll have to send
-me a bug report. Now, it's just amazing how many people will
-send me a bug report saying something like
-@display
- bzip2 crashed with segmentation fault on my machine
-@end display
-and absolutely nothing else. Needless to say, a such a report
-is @emph{totally, utterly, completely and comprehensively 100% useless;
-a waste of your time, my time, and net bandwidth}.
-With no details at all, there's no way I can possibly begin
-to figure out what the problem is.
-
-The rules of the game are: facts, facts, facts. Don't omit
-them because "oh, they won't be relevant". At the bare
-minimum:
-@display
- Machine type. Operating system version.
- Exact version of @code{bzip2} (do @code{bzip2 -V}).
- Exact version of the compiler used.
- Flags passed to the compiler.
-@end display
-However, the most important single thing that will help me is
-the file that you were trying to compress or decompress at the
-time the problem happened. Without that, my ability to do anything
-more than speculate about the cause, is limited.
-
-Please remember that I connect to the Internet with a modem, so
-you should contact me before mailing me huge files.
-
-
-@section Did you get the right package?
-
-@code{bzip2} is a resource hog. It soaks up large amounts of CPU cycles
-and memory. Also, it gives very large latencies. In the worst case, you
-can feed many megabytes of uncompressed data into the library before
-getting any compressed output, so this probably rules out applications
-requiring interactive behaviour.
-
-These aren't faults of my implementation, I hope, but more
-an intrinsic property of the Burrows-Wheeler transform (unfortunately).
-Maybe this isn't what you want.
-
-If you want a compressor and/or library which is faster, uses less
-memory but gets pretty good compression, and has minimal latency,
-consider Jean-loup
-Gailly's and Mark Adler's work, @code{zlib-1.1.2} and
-@code{gzip-1.2.4}. Look for them at
-
-@code{http://www.cdrom.com/pub/infozip/zlib} and
-@code{http://www.gzip.org} respectively.
-
-For something faster and lighter still, you might try Markus F X J
-Oberhumer's @code{LZO} real-time compression/decompression library, at
-@* @code{http://wildsau.idv.uni-linz.ac.at/mfx/lzo.html}.
-
-If you want to use the @code{bzip2} algorithms to compress small blocks
-of data, 64k bytes or smaller, for example on an on-the-fly disk
-compressor, you'd be well advised not to use this library. Instead,
-I've made a special library tuned for that kind of use. It's part of
-@code{e2compr-0.40}, an on-the-fly disk compressor for the Linux
-@code{ext2} filesystem. Look at
-@code{http://www.netspace.net.au/~reiter/e2compr}.
-
-
-
-@section Testing
-
-A record of the tests I've done.
-
-First, some data sets:
-@itemize @bullet
-@item B: a directory containing 6001 files, one for every length in the
- range 0 to 6000 bytes. The files contain random lowercase
- letters. 18.7 megabytes.
-@item H: my home directory tree. Documents, source code, mail files,
- compressed data. H contains B, and also a directory of
- files designed as boundary cases for the sorting; mostly very
- repetitive, nasty files. 565 megabytes.
-@item A: directory tree holding various applications built from source:
- @code{egcs}, @code{gcc-2.8.1}, KDE, GTK, Octave, etc.
- 2200 megabytes.
-@end itemize
-The tests conducted are as follows. Each test means compressing
-(a copy of) each file in the data set, decompressing it and
-comparing it against the original.
-
-First, a bunch of tests with block sizes and internal buffer
-sizes set very small,
-to detect any problems with the
-blocking and buffering mechanisms.
-This required modifying the source code so as to try to
-break it.
-@enumerate
-@item Data set H, with
- buffer size of 1 byte, and block size of 23 bytes.
-@item Data set B, buffer sizes 1 byte, block size 1 byte.
-@item As (2) but small-mode decompression.
-@item As (2) with block size 2 bytes.
-@item As (2) with block size 3 bytes.
-@item As (2) with block size 4 bytes.
-@item As (2) with block size 5 bytes.
-@item As (2) with block size 6 bytes and small-mode decompression.
-@item H with buffer size of 1 byte, but normal block
- size (up to 900000 bytes).
-@end enumerate
-Then some tests with unmodified source code.
-@enumerate
-@item H, all settings normal.
-@item As (1), with small-mode decompress.
-@item H, compress with flag @code{-1}.
-@item H, compress with flag @code{-s}, decompress with flag @code{-s}.
-@item Forwards compatibility: H, @code{bzip2-0.1pl2} compressing,
- @code{bzip2-0.9.5} decompressing, all settings normal.
-@item Backwards compatibility: H, @code{bzip2-0.9.5} compressing,
- @code{bzip2-0.1pl2} decompressing, all settings normal.
-@item Bigger tests: A, all settings normal.
-@item As (7), using the fallback (Sadakane-like) sorting algorithm.
-@item As (8), compress with flag @code{-1}, decompress with flag
- @code{-s}.
-@item H, using the fallback sorting algorithm.
-@item Forwards compatibility: A, @code{bzip2-0.1pl2} compressing,
- @code{bzip2-0.9.5} decompressing, all settings normal.
-@item Backwards compatibility: A, @code{bzip2-0.9.5} compressing,
- @code{bzip2-0.1pl2} decompressing, all settings normal.
-@item Misc test: about 400 megabytes of @code{.tar} files with
- @code{bzip2} compiled with Checker (a memory access error
- detector, like Purify).
-@item Misc tests to make sure it builds and runs ok on non-Linux/x86
- platforms.
-@end enumerate
-These tests were conducted on a 225 MHz IDT WinChip machine, running
-Linux 2.0.36. They represent nearly a week of continuous computation.
-All tests completed successfully.
-
-
-@section Further reading
-@code{bzip2} is not research work, in the sense that it doesn't present
-any new ideas. Rather, it's an engineering exercise based on existing
-ideas.
-
-Four documents describe essentially all the ideas behind @code{bzip2}:
-@example
-Michael Burrows and D. J. Wheeler:
- "A block-sorting lossless data compression algorithm"
- 10th May 1994.
- Digital SRC Research Report 124.
- ftp://ftp.digital.com/pub/DEC/SRC/research-reports/SRC-124.ps.gz
- If you have trouble finding it, try searching at the
- New Zealand Digital Library, http://www.nzdl.org.
-
-Daniel S. Hirschberg and Debra A. LeLewer
- "Efficient Decoding of Prefix Codes"
- Communications of the ACM, April 1990, Vol 33, Number 4.
- You might be able to get an electronic copy of this
- from the ACM Digital Library.
-
-David J. Wheeler
- Program bred3.c and accompanying document bred3.ps.
- This contains the idea behind the multi-table Huffman
- coding scheme.
- ftp://ftp.cl.cam.ac.uk/users/djw3/
-
-Jon L. Bentley and Robert Sedgewick
- "Fast Algorithms for Sorting and Searching Strings"
- Available from Sedgewick's web page,
- www.cs.princeton.edu/~rs
-@end example
-The following paper gives valuable additional insights into the
-algorithm, but is not immediately the basis of any code
-used in bzip2.
-@example
-Peter Fenwick:
- Block Sorting Text Compression
- Proceedings of the 19th Australasian Computer Science Conference,
- Melbourne, Australia. Jan 31 - Feb 2, 1996.
- ftp://ftp.cs.auckland.ac.nz/pub/peter-f/ACSC96paper.ps
-@end example
-Kunihiko Sadakane's sorting algorithm, mentioned above,
-is available from:
-@example
-http://naomi.is.s.u-tokyo.ac.jp/~sada/papers/Sada98b.ps.gz
-@end example
-The Manber-Myers suffix array construction
-algorithm is described in a paper
-available from:
-@example
-http://www.cs.arizona.edu/people/gene/PAPERS/suffix.ps
-@end example
-Finally, the following paper documents some recent investigations
-I made into the performance of sorting algorithms:
-@example
-Julian Seward:
- On the Performance of BWT Sorting Algorithms
- Proceedings of the IEEE Data Compression Conference 2000
- Snowbird, Utah. 28-30 March 2000.
-@end example
-
-
-@contents
-
-@bye
-
diff --git a/winsup/bz2lib/manual_1.html b/winsup/bz2lib/manual_1.html
deleted file mode 100644
index 92ba7c6df..000000000
--- a/winsup/bz2lib/manual_1.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<HTML>
-<HEAD>
-<!-- This HTML file has been created by texi2html 1.54
- from manual.texi on 23 March 2000 -->
-
-<TITLE>bzip2 and libbzip2 - Introduction</TITLE>
-<link href="manual_2.html" rel=Next>
-<link href="manual_toc.html" rel=ToC>
-
-</HEAD>
-<BODY>
-<p>Go to the first, previous, <A HREF="manual_2.html">next</A>, <A HREF="manual_4.html">last</A> section, <A HREF="manual_toc.html">table of contents</A>.
-<P><HR><P>
-
-
-<H1><A NAME="SEC1" HREF="manual_toc.html#TOC1">Introduction</A></H1>
-
-<P>
-<CODE>bzip2</CODE> compresses files using the Burrows-Wheeler
-block-sorting text compression algorithm, and Huffman coding.
-Compression is generally considerably better than that
-achieved by more conventional LZ77/LZ78-based compressors,
-and approaches the performance of the PPM family of statistical compressors.
-
-</P>
-<P>
-<CODE>bzip2</CODE> is built on top of <CODE>libbzip2</CODE>, a flexible library
-for handling compressed data in the <CODE>bzip2</CODE> format. This manual
-describes both how to use the program and
-how to work with the library interface. Most of the
-manual is devoted to this library, not the program,
-which is good news if your interest is only in the program.
-
-</P>
-<P>
-Chapter 2 describes how to use <CODE>bzip2</CODE>; this is the only part
-you need to read if you just want to know how to operate the program.
-Chapter 3 describes the programming interfaces in detail, and
-Chapter 4 records some miscellaneous notes which I thought
-ought to be recorded somewhere.
-
-</P>
-
-<P><HR><P>
-<p>Go to the first, previous, <A HREF="manual_2.html">next</A>, <A HREF="manual_4.html">last</A> section, <A HREF="manual_toc.html">table of contents</A>.
-</BODY>
-</HTML>
diff --git a/winsup/bz2lib/manual_2.html b/winsup/bz2lib/manual_2.html
deleted file mode 100644
index 39453c42d..000000000
--- a/winsup/bz2lib/manual_2.html
+++ /dev/null
@@ -1,484 +0,0 @@
-<HTML>
-<HEAD>
-<!-- This HTML file has been created by texi2html 1.54
- from manual.texi on 23 March 2000 -->
-
-<TITLE>bzip2 and libbzip2 - How to use bzip2</TITLE>
-<link href="manual_3.html" rel=Next>
-<link href="manual_1.html" rel=Previous>
-<link href="manual_toc.html" rel=ToC>
-
-</HEAD>
-<BODY>
-<p>Go to the <A HREF="manual_1.html">first</A>, <A HREF="manual_1.html">previous</A>, <A HREF="manual_3.html">next</A>, <A HREF="manual_4.html">last</A> section, <A HREF="manual_toc.html">table of contents</A>.
-<P><HR><P>
-
-
-<H1><A NAME="SEC2" HREF="manual_toc.html#TOC2">How to use <CODE>bzip2</CODE></A></H1>
-
-<P>
-This chapter contains a copy of the <CODE>bzip2</CODE> man page,
-and nothing else.
-
-</P>
-
-<BLOCKQUOTE>
-
-
-
-<H4><A NAME="SEC3" HREF="manual_toc.html#TOC3">NAME</A></H4>
-
-<UL>
-<LI><CODE>bzip2</CODE>, <CODE>bunzip2</CODE>
-
-- a block-sorting file compressor, v1.0
-<LI><CODE>bzcat</CODE>
-
-- decompresses files to stdout
-<LI><CODE>bzip2recover</CODE>
-
-- recovers data from damaged bzip2 files
-</UL>
-
-
-
-<H4><A NAME="SEC4" HREF="manual_toc.html#TOC4">SYNOPSIS</A></H4>
-
-<UL>
-<LI><CODE>bzip2</CODE> [ -cdfkqstvzVL123456789 ] [ filenames ... ]
-
-<LI><CODE>bunzip2</CODE> [ -fkvsVL ] [ filenames ... ]
-
-<LI><CODE>bzcat</CODE> [ -s ] [ filenames ... ]
-
-<LI><CODE>bzip2recover</CODE> filename
-
-</UL>
-
-
-
-<H4><A NAME="SEC5" HREF="manual_toc.html#TOC5">DESCRIPTION</A></H4>
-
-<P>
-<CODE>bzip2</CODE> compresses files using the Burrows-Wheeler block sorting
-text compression algorithm, and Huffman coding. Compression is
-generally considerably better than that achieved by more conventional
-LZ77/LZ78-based compressors, and approaches the performance of the PPM
-family of statistical compressors.
-
-</P>
-<P>
-The command-line options are deliberately very similar to those of GNU
-<CODE>gzip</CODE>, but they are not identical.
-
-</P>
-<P>
-<CODE>bzip2</CODE> expects a list of file names to accompany the command-line
-flags. Each file is replaced by a compressed version of itself, with
-the name <CODE>original_name.bz2</CODE>. Each compressed file has the same
-modification date, permissions, and, when possible, ownership as the
-corresponding original, so that these properties can be correctly
-restored at decompression time. File name handling is naive in the
-sense that there is no mechanism for preserving original file names,
-permissions, ownerships or dates in filesystems which lack these
-concepts, or have serious file name length restrictions, such as MS-DOS.
-
-</P>
-<P>
-<CODE>bzip2</CODE> and <CODE>bunzip2</CODE> will by default not overwrite existing
-files. If you want this to happen, specify the <CODE>-f</CODE> flag.
-
-</P>
-<P>
-If no file names are specified, <CODE>bzip2</CODE> compresses from standard
-input to standard output. In this case, <CODE>bzip2</CODE> will decline to
-write compressed output to a terminal, as this would be entirely
-incomprehensible and therefore pointless.
-
-</P>
-<P>
-<CODE>bunzip2</CODE> (or <CODE>bzip2 -d</CODE>) decompresses all
-specified files. Files which were not created by <CODE>bzip2</CODE>
-will be detected and ignored, and a warning issued.
-<CODE>bzip2</CODE> attempts to guess the filename for the decompressed file
-from that of the compressed file as follows:
-
-<UL>
-<LI><CODE>filename.bz2 </CODE> becomes <CODE>filename</CODE>
-
-<LI><CODE>filename.bz </CODE> becomes <CODE>filename</CODE>
-
-<LI><CODE>filename.tbz2</CODE> becomes <CODE>filename.tar</CODE>
-
-<LI><CODE>filename.tbz </CODE> becomes <CODE>filename.tar</CODE>
-
-<LI><CODE>anyothername </CODE> becomes <CODE>anyothername.out</CODE>
-
-</UL>
-
-<P>
-If the file does not end in one of the recognised endings,
-<CODE>.bz2</CODE>, <CODE>.bz</CODE>,
-<CODE>.tbz2</CODE> or <CODE>.tbz</CODE>, <CODE>bzip2</CODE> complains that it cannot
-guess the name of the original file, and uses the original name
-with <CODE>.out</CODE> appended.
-
-</P>
-<P>
-As with compression, supplying no
-filenames causes decompression from standard input to standard output.
-
-</P>
-<P>
-<CODE>bunzip2</CODE> will correctly decompress a file which is the
-concatenation of two or more compressed files. The result is the
-concatenation of the corresponding uncompressed files. Integrity
-testing (<CODE>-t</CODE>) of concatenated compressed files is also supported.
-
-</P>
-<P>
-You can also compress or decompress files to the standard output by
-giving the <CODE>-c</CODE> flag. Multiple files may be compressed and
-decompressed like this. The resulting outputs are fed sequentially to
-stdout. Compression of multiple files in this manner generates a stream
-containing multiple compressed file representations. Such a stream
-can be decompressed correctly only by <CODE>bzip2</CODE> version 0.9.0 or
-later. Earlier versions of <CODE>bzip2</CODE> will stop after decompressing
-the first file in the stream.
-
-</P>
-<P>
-<CODE>bzcat</CODE> (or <CODE>bzip2 -dc</CODE>) decompresses all specified files to
-the standard output.
-
-</P>
-<P>
-<CODE>bzip2</CODE> will read arguments from the environment variables
-<CODE>BZIP2</CODE> and <CODE>BZIP</CODE>, in that order, and will process them
-before any arguments read from the command line. This gives a
-convenient way to supply default arguments.
-
-</P>
-<P>
-Compression is always performed, even if the compressed file is slightly
-larger than the original. Files of less than about one hundred bytes
-tend to get larger, since the compression mechanism has a constant
-overhead in the region of 50 bytes. Random data (including the output
-of most file compressors) is coded at about 8.05 bits per byte, giving
-an expansion of around 0.5%.
-
-</P>
-<P>
-As a self-check for your protection, <CODE>bzip2</CODE> uses 32-bit CRCs to
-make sure that the decompressed version of a file is identical to the
-original. This guards against corruption of the compressed data, and
-against undetected bugs in <CODE>bzip2</CODE> (hopefully very unlikely). The
-chances of data corruption going undetected is microscopic, about one
-chance in four billion for each file processed. Be aware, though, that
-the check occurs upon decompression, so it can only tell you that
-something is wrong. It can't help you recover the original uncompressed
-data. You can use <CODE>bzip2recover</CODE> to try to recover data from
-damaged files.
-
-</P>
-<P>
-Return values: 0 for a normal exit, 1 for environmental problems (file
-not found, invalid flags, I/O errors, &#38;c), 2 to indicate a corrupt
-compressed file, 3 for an internal consistency error (eg, bug) which
-caused <CODE>bzip2</CODE> to panic.
-
-</P>
-
-
-
-<H4><A NAME="SEC6" HREF="manual_toc.html#TOC6">OPTIONS</A></H4>
-<DL COMPACT>
-
-<DT><CODE>-c --stdout</CODE>
-<DD>
-Compress or decompress to standard output.
-<DT><CODE>-d --decompress</CODE>
-<DD>
-Force decompression. <CODE>bzip2</CODE>, <CODE>bunzip2</CODE> and <CODE>bzcat</CODE> are
-really the same program, and the decision about what actions to take is
-done on the basis of which name is used. This flag overrides that
-mechanism, and forces bzip2 to decompress.
-<DT><CODE>-z --compress</CODE>
-<DD>
-The complement to <CODE>-d</CODE>: forces compression, regardless of the
-invokation name.
-<DT><CODE>-t --test</CODE>
-<DD>
-Check integrity of the specified file(s), but don't decompress them.
-This really performs a trial decompression and throws away the result.
-<DT><CODE>-f --force</CODE>
-<DD>
-Force overwrite of output files. Normally, <CODE>bzip2</CODE> will not overwrite
-existing output files. Also forces <CODE>bzip2</CODE> to break hard links
-to files, which it otherwise wouldn't do.
-<DT><CODE>-k --keep</CODE>
-<DD>
-Keep (don't delete) input files during compression
-or decompression.
-<DT><CODE>-s --small</CODE>
-<DD>
-Reduce memory usage, for compression, decompression and testing. Files
-are decompressed and tested using a modified algorithm which only
-requires 2.5 bytes per block byte. This means any file can be
-decompressed in 2300k of memory, albeit at about half the normal speed.
-
-During compression, <CODE>-s</CODE> selects a block size of 200k, which limits
-memory use to around the same figure, at the expense of your compression
-ratio. In short, if your machine is low on memory (8 megabytes or
-less), use -s for everything. See MEMORY MANAGEMENT below.
-<DT><CODE>-q --quiet</CODE>
-<DD>
-Suppress non-essential warning messages. Messages pertaining to
-I/O errors and other critical events will not be suppressed.
-<DT><CODE>-v --verbose</CODE>
-<DD>
-Verbose mode -- show the compression ratio for each file processed.
-Further <CODE>-v</CODE>'s increase the verbosity level, spewing out lots of
-information which is primarily of interest for diagnostic purposes.
-<DT><CODE>-L --license -V --version</CODE>
-<DD>
-Display the software version, license terms and conditions.
-<DT><CODE>-1 to -9</CODE>
-<DD>
-Set the block size to 100 k, 200 k .. 900 k when compressing. Has no
-effect when decompressing. See MEMORY MANAGEMENT below.
-<DT><CODE>--</CODE>
-<DD>
-Treats all subsequent arguments as file names, even if they start
-with a dash. This is so you can handle files with names beginning
-with a dash, for example: <CODE>bzip2 -- -myfilename</CODE>.
-<DT><CODE>--repetitive-fast</CODE>
-<DD>
-<DT><CODE>--repetitive-best</CODE>
-<DD>
-These flags are redundant in versions 0.9.5 and above. They provided
-some coarse control over the behaviour of the sorting algorithm in
-earlier versions, which was sometimes useful. 0.9.5 and above have an
-improved algorithm which renders these flags irrelevant.
-</DL>
-
-
-
-<H4><A NAME="SEC7" HREF="manual_toc.html#TOC7">MEMORY MANAGEMENT</A></H4>
-
-<P>
-<CODE>bzip2</CODE> compresses large files in blocks. The block size affects
-both the compression ratio achieved, and the amount of memory needed for
-compression and decompression. The flags <CODE>-1</CODE> through <CODE>-9</CODE>
-specify the block size to be 100,000 bytes through 900,000 bytes (the
-default) respectively. At decompression time, the block size used for
-compression is read from the header of the compressed file, and
-<CODE>bunzip2</CODE> then allocates itself just enough memory to decompress
-the file. Since block sizes are stored in compressed files, it follows
-that the flags <CODE>-1</CODE> to <CODE>-9</CODE> are irrelevant to and so ignored
-during decompression.
-
-</P>
-<P>
-Compression and decompression requirements, in bytes, can be estimated
-as:
-
-<PRE>
- Compression: 400k + ( 8 x block size )
-
- Decompression: 100k + ( 4 x block size ), or
- 100k + ( 2.5 x block size )
-</PRE>
-
-<P>
-Larger block sizes give rapidly diminishing marginal returns. Most of
-the compression comes from the first two or three hundred k of block
-size, a fact worth bearing in mind when using <CODE>bzip2</CODE> on small machines.
-It is also important to appreciate that the decompression memory
-requirement is set at compression time by the choice of block size.
-
-</P>
-<P>
-For files compressed with the default 900k block size, <CODE>bunzip2</CODE>
-will require about 3700 kbytes to decompress. To support decompression
-of any file on a 4 megabyte machine, <CODE>bunzip2</CODE> has an option to
-decompress using approximately half this amount of memory, about 2300
-kbytes. Decompression speed is also halved, so you should use this
-option only where necessary. The relevant flag is <CODE>-s</CODE>.
-
-</P>
-<P>
-In general, try and use the largest block size memory constraints allow,
-since that maximises the compression achieved. Compression and
-decompression speed are virtually unaffected by block size.
-
-</P>
-<P>
-Another significant point applies to files which fit in a single block
--- that means most files you'd encounter using a large block size. The
-amount of real memory touched is proportional to the size of the file,
-since the file is smaller than a block. For example, compressing a file
-20,000 bytes long with the flag <CODE>-9</CODE> will cause the compressor to
-allocate around 7600k of memory, but only touch 400k + 20000 * 8 = 560
-kbytes of it. Similarly, the decompressor will allocate 3700k but only
-touch 100k + 20000 * 4 = 180 kbytes.
-
-</P>
-<P>
-Here is a table which summarises the maximum memory usage for different
-block sizes. Also recorded is the total compressed size for 14 files of
-the Calgary Text Compression Corpus totalling 3,141,622 bytes. This
-column gives some feel for how compression varies with block size.
-These figures tend to understate the advantage of larger block sizes for
-larger files, since the Corpus is dominated by smaller files.
-
-<PRE>
- Compress Decompress Decompress Corpus
- Flag usage usage -s usage Size
-
- -1 1200k 500k 350k 914704
- -2 2000k 900k 600k 877703
- -3 2800k 1300k 850k 860338
- -4 3600k 1700k 1100k 846899
- -5 4400k 2100k 1350k 845160
- -6 5200k 2500k 1600k 838626
- -7 6100k 2900k 1850k 834096
- -8 6800k 3300k 2100k 828642
- -9 7600k 3700k 2350k 828642
-</PRE>
-
-
-
-<H4><A NAME="SEC8" HREF="manual_toc.html#TOC8">RECOVERING DATA FROM DAMAGED FILES</A></H4>
-
-<P>
-<CODE>bzip2</CODE> compresses files in blocks, usually 900kbytes long. Each
-block is handled independently. If a media or transmission error causes
-a multi-block <CODE>.bz2</CODE> file to become damaged, it may be possible to
-recover data from the undamaged blocks in the file.
-
-</P>
-<P>
-The compressed representation of each block is delimited by a 48-bit
-pattern, which makes it possible to find the block boundaries with
-reasonable certainty. Each block also carries its own 32-bit CRC, so
-damaged blocks can be distinguished from undamaged ones.
-
-</P>
-<P>
-<CODE>bzip2recover</CODE> is a simple program whose purpose is to search for
-blocks in <CODE>.bz2</CODE> files, and write each block out into its own
-<CODE>.bz2</CODE> file. You can then use <CODE>bzip2 -t</CODE> to test the
-integrity of the resulting files, and decompress those which are
-undamaged.
-
-</P>
-<P>
-<CODE>bzip2recover</CODE>
-takes a single argument, the name of the damaged file,
-and writes a number of files <CODE>rec0001file.bz2</CODE>,
- <CODE>rec0002file.bz2</CODE>, etc, containing the extracted blocks.
- The output filenames are designed so that the use of
- wildcards in subsequent processing -- for example,
-<CODE>bzip2 -dc rec*file.bz2 &#62; recovered_data</CODE> -- lists the files in
- the correct order.
-
-</P>
-<P>
-<CODE>bzip2recover</CODE> should be of most use dealing with large <CODE>.bz2</CODE>
- files, as these will contain many blocks. It is clearly
- futile to use it on damaged single-block files, since a
- damaged block cannot be recovered. If you wish to minimise
-any potential data loss through media or transmission errors,
-you might consider compressing with a smaller
- block size.
-
-</P>
-
-
-
-<H4><A NAME="SEC9" HREF="manual_toc.html#TOC9">PERFORMANCE NOTES</A></H4>
-
-<P>
-The sorting phase of compression gathers together similar strings in the
-file. Because of this, files containing very long runs of repeated
-symbols, like "aabaabaabaab ..." (repeated several hundred times) may
-compress more slowly than normal. Versions 0.9.5 and above fare much
-better than previous versions in this respect. The ratio between
-worst-case and average-case compression time is in the region of 10:1.
-For previous versions, this figure was more like 100:1. You can use the
-<CODE>-vvvv</CODE> option to monitor progress in great detail, if you want.
-
-</P>
-<P>
-Decompression speed is unaffected by these phenomena.
-
-</P>
-<P>
-<CODE>bzip2</CODE> usually allocates several megabytes of memory to operate
-in, and then charges all over it in a fairly random fashion. This means
-that performance, both for compressing and decompressing, is largely
-determined by the speed at which your machine can service cache misses.
-Because of this, small changes to the code to reduce the miss rate have
-been observed to give disproportionately large performance improvements.
-I imagine <CODE>bzip2</CODE> will perform best on machines with very large
-caches.
-
-</P>
-
-
-
-<H4><A NAME="SEC10" HREF="manual_toc.html#TOC10">CAVEATS</A></H4>
-
-<P>
-I/O error messages are not as helpful as they could be. <CODE>bzip2</CODE>
-tries hard to detect I/O errors and exit cleanly, but the details of
-what the problem is sometimes seem rather misleading.
-
-</P>
-<P>
-This manual page pertains to version 1.0 of <CODE>bzip2</CODE>. Compressed
-data created by this version is entirely forwards and backwards
-compatible with the previous public releases, versions 0.1pl2, 0.9.0 and
-0.9.5, but with the following exception: 0.9.0 and above can correctly
-decompress multiple concatenated compressed files. 0.1pl2 cannot do
-this; it will stop after decompressing just the first file in the
-stream.
-
-</P>
-<P>
-<CODE>bzip2recover</CODE> uses 32-bit integers to represent bit positions in
-compressed files, so it cannot handle compressed files more than 512
-megabytes long. This could easily be fixed.
-
-</P>
-
-
-
-<H4><A NAME="SEC11" HREF="manual_toc.html#TOC11">AUTHOR</A></H4>
-<P>
-Julian Seward, <CODE>jseward@acm.org</CODE>.
-
-</P>
-<P>
-The ideas embodied in <CODE>bzip2</CODE> are due to (at least) the following
-people: Michael Burrows and David Wheeler (for the block sorting
-transformation), David Wheeler (again, for the Huffman coder), Peter
-Fenwick (for the structured coding model in the original <CODE>bzip</CODE>,
-and many refinements), and Alistair Moffat, Radford Neal and Ian Witten
-(for the arithmetic coder in the original <CODE>bzip</CODE>). I am much
-indebted for their help, support and advice. See the manual in the
-source distribution for pointers to sources of documentation. Christian
-von Roques encouraged me to look for faster sorting algorithms, so as to
-speed up compression. Bela Lubkin encouraged me to improve the
-worst-case compression performance. Many people sent patches, helped
-with portability problems, lent machines, gave advice and were generally
-helpful.
-
-</P>
-</BLOCKQUOTE>
-
-<P><HR><P>
-<p>Go to the <A HREF="manual_1.html">first</A>, <A HREF="manual_1.html">previous</A>, <A HREF="manual_3.html">next</A>, <A HREF="manual_4.html">last</A> section, <A HREF="manual_toc.html">table of contents</A>.
-</BODY>
-</HTML>
diff --git a/winsup/bz2lib/manual_3.html b/winsup/bz2lib/manual_3.html
deleted file mode 100644
index a8fa7e682..000000000
--- a/winsup/bz2lib/manual_3.html
+++ /dev/null
@@ -1,1773 +0,0 @@
-<HTML>
-<HEAD>
-<!-- This HTML file has been created by texi2html 1.54
- from manual.texi on 23 March 2000 -->
-
-<TITLE>bzip2 and libbzip2 - Programming with libbzip2</TITLE>
-<link href="manual_4.html" rel=Next>
-<link href="manual_2.html" rel=Previous>
-<link href="manual_toc.html" rel=ToC>
-
-</HEAD>
-<BODY>
-<p>Go to the <A HREF="manual_1.html">first</A>, <A HREF="manual_2.html">previous</A>, <A HREF="manual_4.html">next</A>, <A HREF="manual_4.html">last</A> section, <A HREF="manual_toc.html">table of contents</A>.
-<P><HR><P>
-
-
-<H1><A NAME="SEC12" HREF="manual_toc.html#TOC12">Programming with <CODE>libbzip2</CODE></A></H1>
-
-<P>
-This chapter describes the programming interface to <CODE>libbzip2</CODE>.
-
-</P>
-<P>
-For general background information, particularly about memory
-use and performance aspects, you'd be well advised to read Chapter 2
-as well.
-
-</P>
-
-
-<H2><A NAME="SEC13" HREF="manual_toc.html#TOC13">Top-level structure</A></H2>
-
-<P>
-<CODE>libbzip2</CODE> is a flexible library for compressing and decompressing
-data in the <CODE>bzip2</CODE> data format. Although packaged as a single
-entity, it helps to regard the library as three separate parts: the low
-level interface, and the high level interface, and some utility
-functions.
-
-</P>
-<P>
-The structure of <CODE>libbzip2</CODE>'s interfaces is similar to
-that of Jean-loup Gailly's and Mark Adler's excellent <CODE>zlib</CODE>
-library.
-
-</P>
-<P>
-All externally visible symbols have names beginning <CODE>BZ2_</CODE>.
-This is new in version 1.0. The intention is to minimise pollution
-of the namespaces of library clients.
-
-</P>
-
-
-<H3><A NAME="SEC14" HREF="manual_toc.html#TOC14">Low-level summary</A></H3>
-
-<P>
-This interface provides services for compressing and decompressing
-data in memory. There's no provision for dealing with files, streams
-or any other I/O mechanisms, just straight memory-to-memory work.
-In fact, this part of the library can be compiled without inclusion
-of <CODE>stdio.h</CODE>, which may be helpful for embedded applications.
-
-</P>
-<P>
-The low-level part of the library has no global variables and
-is therefore thread-safe.
-
-</P>
-<P>
-Six routines make up the low level interface:
-<CODE>BZ2_bzCompressInit</CODE>, <CODE>BZ2_bzCompress</CODE>, and <BR> <CODE>BZ2_bzCompressEnd</CODE>
-for compression,
-and a corresponding trio <CODE>BZ2_bzDecompressInit</CODE>, <BR> <CODE>BZ2_bzDecompress</CODE>
-and <CODE>BZ2_bzDecompressEnd</CODE> for decompression.
-The <CODE>*Init</CODE> functions allocate
-memory for compression/decompression and do other
-initialisations, whilst the <CODE>*End</CODE> functions close down operations
-and release memory.
-
-</P>
-<P>
-The real work is done by <CODE>BZ2_bzCompress</CODE> and <CODE>BZ2_bzDecompress</CODE>.
-These compress and decompress data from a user-supplied input buffer
-to a user-supplied output buffer. These buffers can be any size;
-arbitrary quantities of data are handled by making repeated calls
-to these functions. This is a flexible mechanism allowing a
-consumer-pull style of activity, or producer-push, or a mixture of
-both.
-
-</P>
-
-
-
-<H3><A NAME="SEC15" HREF="manual_toc.html#TOC15">High-level summary</A></H3>
-
-<P>
-This interface provides some handy wrappers around the low-level
-interface to facilitate reading and writing <CODE>bzip2</CODE> format
-files (<CODE>.bz2</CODE> files). The routines provide hooks to facilitate
-reading files in which the <CODE>bzip2</CODE> data stream is embedded
-within some larger-scale file structure, or where there are
-multiple <CODE>bzip2</CODE> data streams concatenated end-to-end.
-
-</P>
-<P>
-For reading files, <CODE>BZ2_bzReadOpen</CODE>, <CODE>BZ2_bzRead</CODE>,
-<CODE>BZ2_bzReadClose</CODE> and <BR> <CODE>BZ2_bzReadGetUnused</CODE> are supplied. For
-writing files, <CODE>BZ2_bzWriteOpen</CODE>, <CODE>BZ2_bzWrite</CODE> and
-<CODE>BZ2_bzWriteFinish</CODE> are available.
-
-</P>
-<P>
-As with the low-level library, no global variables are used
-so the library is per se thread-safe. However, if I/O errors
-occur whilst reading or writing the underlying compressed files,
-you may have to consult <CODE>errno</CODE> to determine the cause of
-the error. In that case, you'd need a C library which correctly
-supports <CODE>errno</CODE> in a multithreaded environment.
-
-</P>
-<P>
-To make the library a little simpler and more portable,
-<CODE>BZ2_bzReadOpen</CODE> and <CODE>BZ2_bzWriteOpen</CODE> require you to pass them file
-handles (<CODE>FILE*</CODE>s) which have previously been opened for reading or
-writing respectively. That avoids portability problems associated with
-file operations and file attributes, whilst not being much of an
-imposition on the programmer.
-
-</P>
-
-
-
-<H3><A NAME="SEC16" HREF="manual_toc.html#TOC16">Utility functions summary</A></H3>
-<P>
-For very simple needs, <CODE>BZ2_bzBuffToBuffCompress</CODE> and
-<CODE>BZ2_bzBuffToBuffDecompress</CODE> are provided. These compress
-data in memory from one buffer to another buffer in a single
-function call. You should assess whether these functions
-fulfill your memory-to-memory compression/decompression
-requirements before investing effort in understanding the more
-general but more complex low-level interface.
-
-</P>
-<P>
-Yoshioka Tsuneo (<CODE>QWF00133@niftyserve.or.jp</CODE> /
-<CODE>tsuneo-y@is.aist-nara.ac.jp</CODE>) has contributed some functions to
-give better <CODE>zlib</CODE> compatibility. These functions are
-<CODE>BZ2_bzopen</CODE>, <CODE>BZ2_bzread</CODE>, <CODE>BZ2_bzwrite</CODE>, <CODE>BZ2_bzflush</CODE>,
-<CODE>BZ2_bzclose</CODE>,
-<CODE>BZ2_bzerror</CODE> and <CODE>BZ2_bzlibVersion</CODE>. You may find these functions
-more convenient for simple file reading and writing, than those in the
-high-level interface. These functions are not (yet) officially part of
-the library, and are minimally documented here. If they break, you
-get to keep all the pieces. I hope to document them properly when time
-permits.
-
-</P>
-<P>
-Yoshioka also contributed modifications to allow the library to be
-built as a Windows DLL.
-
-</P>
-
-
-
-<H2><A NAME="SEC17" HREF="manual_toc.html#TOC17">Error handling</A></H2>
-
-<P>
-The library is designed to recover cleanly in all situations, including
-the worst-case situation of decompressing random data. I'm not
-100% sure that it can always do this, so you might want to add
-a signal handler to catch segmentation violations during decompression
-if you are feeling especially paranoid. I would be interested in
-hearing more about the robustness of the library to corrupted
-compressed data.
-
-</P>
-<P>
-Version 1.0 is much more robust in this respect than
-0.9.0 or 0.9.5. Investigations with Checker (a tool for
-detecting problems with memory management, similar to Purify)
-indicate that, at least for the few files I tested, all single-bit
-errors in the decompressed data are caught properly, with no
-segmentation faults, no reads of uninitialised data and no
-out of range reads or writes. So it's certainly much improved,
-although I wouldn't claim it to be totally bombproof.
-
-</P>
-<P>
-The file <CODE>bzlib.h</CODE> contains all definitions needed to use
-the library. In particular, you should definitely not include
-<CODE>bzlib_private.h</CODE>.
-
-</P>
-<P>
-In <CODE>bzlib.h</CODE>, the various return values are defined. The following
-list is not intended as an exhaustive description of the circumstances
-in which a given value may be returned -- those descriptions are given
-later. Rather, it is intended to convey the rough meaning of each
-return value. The first five actions are normal and not intended to
-denote an error situation.
-<DL COMPACT>
-
-<DT><CODE>BZ_OK</CODE>
-<DD>
-The requested action was completed successfully.
-<DT><CODE>BZ_RUN_OK</CODE>
-<DD>
-<DT><CODE>BZ_FLUSH_OK</CODE>
-<DD>
-<DT><CODE>BZ_FINISH_OK</CODE>
-<DD>
-In <CODE>BZ2_bzCompress</CODE>, the requested flush/finish/nothing-special action
-was completed successfully.
-<DT><CODE>BZ_STREAM_END</CODE>
-<DD>
-Compression of data was completed, or the logical stream end was
-detected during decompression.
-</DL>
-
-<P>
-The following return values indicate an error of some kind.
-<DL COMPACT>
-
-<DT><CODE>BZ_CONFIG_ERROR</CODE>
-<DD>
-Indicates that the library has been improperly compiled on your
-platform -- a major configuration error. Specifically, it means
-that <CODE>sizeof(char)</CODE>, <CODE>sizeof(short)</CODE> and <CODE>sizeof(int)</CODE>
-are not 1, 2 and 4 respectively, as they should be. Note that the
-library should still work properly on 64-bit platforms which follow
-the LP64 programming model -- that is, where <CODE>sizeof(long)</CODE>
-and <CODE>sizeof(void*)</CODE> are 8. Under LP64, <CODE>sizeof(int)</CODE> is
-still 4, so <CODE>libbzip2</CODE>, which doesn't use the <CODE>long</CODE> type,
-is OK.
-<DT><CODE>BZ_SEQUENCE_ERROR</CODE>
-<DD>
-When using the library, it is important to call the functions in the
-correct sequence and with data structures (buffers etc) in the correct
-states. <CODE>libbzip2</CODE> checks as much as it can to ensure this is
-happening, and returns <CODE>BZ_SEQUENCE_ERROR</CODE> if not. Code which
-complies precisely with the function semantics, as detailed below,
-should never receive this value; such an event denotes buggy code
-which you should investigate.
-<DT><CODE>BZ_PARAM_ERROR</CODE>
-<DD>
-Returned when a parameter to a function call is out of range
-or otherwise manifestly incorrect. As with <CODE>BZ_SEQUENCE_ERROR</CODE>,
-this denotes a bug in the client code. The distinction between
-<CODE>BZ_PARAM_ERROR</CODE> and <CODE>BZ_SEQUENCE_ERROR</CODE> is a bit hazy, but still worth
-making.
-<DT><CODE>BZ_MEM_ERROR</CODE>
-<DD>
-Returned when a request to allocate memory failed. Note that the
-quantity of memory needed to decompress a stream cannot be determined
-until the stream's header has been read. So <CODE>BZ2_bzDecompress</CODE> and
-<CODE>BZ2_bzRead</CODE> may return <CODE>BZ_MEM_ERROR</CODE> even though some of
-the compressed data has been read. The same is not true for
-compression; once <CODE>BZ2_bzCompressInit</CODE> or <CODE>BZ2_bzWriteOpen</CODE> have
-successfully completed, <CODE>BZ_MEM_ERROR</CODE> cannot occur.
-<DT><CODE>BZ_DATA_ERROR</CODE>
-<DD>
-Returned when a data integrity error is detected during decompression.
-Most importantly, this means when stored and computed CRCs for the
-data do not match. This value is also returned upon detection of any
-other anomaly in the compressed data.
-<DT><CODE>BZ_DATA_ERROR_MAGIC</CODE>
-<DD>
-As a special case of <CODE>BZ_DATA_ERROR</CODE>, it is sometimes useful to
-know when the compressed stream does not start with the correct
-magic bytes (<CODE>'B' 'Z' 'h'</CODE>).
-<DT><CODE>BZ_IO_ERROR</CODE>
-<DD>
-Returned by <CODE>BZ2_bzRead</CODE> and <CODE>BZ2_bzWrite</CODE> when there is an error
-reading or writing in the compressed file, and by <CODE>BZ2_bzReadOpen</CODE>
-and <CODE>BZ2_bzWriteOpen</CODE> for attempts to use a file for which the
-error indicator (viz, <CODE>ferror(f)</CODE>) is set.
-On receipt of <CODE>BZ_IO_ERROR</CODE>, the caller should consult
-<CODE>errno</CODE> and/or <CODE>perror</CODE> to acquire operating-system
-specific information about the problem.
-<DT><CODE>BZ_UNEXPECTED_EOF</CODE>
-<DD>
-Returned by <CODE>BZ2_bzRead</CODE> when the compressed file finishes
-before the logical end of stream is detected.
-<DT><CODE>BZ_OUTBUFF_FULL</CODE>
-<DD>
-Returned by <CODE>BZ2_bzBuffToBuffCompress</CODE> and
-<CODE>BZ2_bzBuffToBuffDecompress</CODE> to indicate that the output data
-will not fit into the output buffer provided.
-</DL>
-
-
-
-<H2><A NAME="SEC18" HREF="manual_toc.html#TOC18">Low-level interface</A></H2>
-
-
-
-<H3><A NAME="SEC19" HREF="manual_toc.html#TOC19"><CODE>BZ2_bzCompressInit</CODE></A></H3>
-
-<PRE>
-typedef
- struct {
- char *next_in;
- unsigned int avail_in;
- unsigned int total_in_lo32;
- unsigned int total_in_hi32;
-
- char *next_out;
- unsigned int avail_out;
- unsigned int total_out_lo32;
- unsigned int total_out_hi32;
-
- void *state;
-
- void *(*bzalloc)(void *,int,int);
- void (*bzfree)(void *,void *);
- void *opaque;
- }
- bz_stream;
-
-int BZ2_bzCompressInit ( bz_stream *strm,
- int blockSize100k,
- int verbosity,
- int workFactor );
-
-</PRE>
-
-<P>
-Prepares for compression. The <CODE>bz_stream</CODE> structure
-holds all data pertaining to the compression activity.
-A <CODE>bz_stream</CODE> structure should be allocated and initialised
-prior to the call.
-The fields of <CODE>bz_stream</CODE>
-comprise the entirety of the user-visible data. <CODE>state</CODE>
-is a pointer to the private data structures required for compression.
-
-</P>
-<P>
-Custom memory allocators are supported, via fields <CODE>bzalloc</CODE>,
-<CODE>bzfree</CODE>,
-and <CODE>opaque</CODE>. The value
-<CODE>opaque</CODE> is passed to as the first argument to
-all calls to <CODE>bzalloc</CODE> and <CODE>bzfree</CODE>, but is
-otherwise ignored by the library.
-The call <CODE>bzalloc ( opaque, n, m )</CODE> is expected to return a
-pointer <CODE>p</CODE> to
-<CODE>n * m</CODE> bytes of memory, and <CODE>bzfree ( opaque, p )</CODE>
-should free
-that memory.
-
-</P>
-<P>
-If you don't want to use a custom memory allocator, set <CODE>bzalloc</CODE>,
-<CODE>bzfree</CODE> and
-<CODE>opaque</CODE> to <CODE>NULL</CODE>,
-and the library will then use the standard <CODE>malloc</CODE>/<CODE>free</CODE>
-routines.
-
-</P>
-<P>
-Before calling <CODE>BZ2_bzCompressInit</CODE>, fields <CODE>bzalloc</CODE>,
-<CODE>bzfree</CODE> and <CODE>opaque</CODE> should
-be filled appropriately, as just described. Upon return, the internal
-state will have been allocated and initialised, and <CODE>total_in_lo32</CODE>,
-<CODE>total_in_hi32</CODE>, <CODE>total_out_lo32</CODE> and
-<CODE>total_out_hi32</CODE> will have been set to zero.
-These four fields are used by the library
-to inform the caller of the total amount of data passed into and out of
-the library, respectively. You should not try to change them.
-As of version 1.0, 64-bit counts are maintained, even on 32-bit
-platforms, using the <CODE>_hi32</CODE> fields to store the upper 32 bits
-of the count. So, for example, the total amount of data in
-is <CODE>(total_in_hi32 &#60;&#60; 32) + total_in_lo32</CODE>.
-
-</P>
-<P>
-Parameter <CODE>blockSize100k</CODE> specifies the block size to be used for
-compression. It should be a value between 1 and 9 inclusive, and the
-actual block size used is 100000 x this figure. 9 gives the best
-compression but takes most memory.
-
-</P>
-<P>
-Parameter <CODE>verbosity</CODE> should be set to a number between 0 and 4
-inclusive. 0 is silent, and greater numbers give increasingly verbose
-monitoring/debugging output. If the library has been compiled with
-<CODE>-DBZ_NO_STDIO</CODE>, no such output will appear for any verbosity
-setting.
-
-</P>
-<P>
-Parameter <CODE>workFactor</CODE> controls how the compression phase behaves
-when presented with worst case, highly repetitive, input data. If
-compression runs into difficulties caused by repetitive data, the
-library switches from the standard sorting algorithm to a fallback
-algorithm. The fallback is slower than the standard algorithm by
-perhaps a factor of three, but always behaves reasonably, no matter how
-bad the input.
-
-</P>
-<P>
-Lower values of <CODE>workFactor</CODE> reduce the amount of effort the
-standard algorithm will expend before resorting to the fallback. You
-should set this parameter carefully; too low, and many inputs will be
-handled by the fallback algorithm and so compress rather slowly, too
-high, and your average-to-worst case compression times can become very
-large. The default value of 30 gives reasonable behaviour over a wide
-range of circumstances.
-
-</P>
-<P>
-Allowable values range from 0 to 250 inclusive. 0 is a special case,
-equivalent to using the default value of 30.
-
-</P>
-<P>
-Note that the compressed output generated is the same regardless of
-whether or not the fallback algorithm is used.
-
-</P>
-<P>
-Be aware also that this parameter may disappear entirely in future
-versions of the library. In principle it should be possible to devise a
-good way to automatically choose which algorithm to use. Such a
-mechanism would render the parameter obsolete.
-
-</P>
-<P>
-Possible return values:
-
-<PRE>
- <CODE>BZ_CONFIG_ERROR</CODE>
- if the library has been mis-compiled
- <CODE>BZ_PARAM_ERROR</CODE>
- if <CODE>strm</CODE> is <CODE>NULL</CODE>
- or <CODE>blockSize</CODE> &#60; 1 or <CODE>blockSize</CODE> &#62; 9
- or <CODE>verbosity</CODE> &#60; 0 or <CODE>verbosity</CODE> &#62; 4
- or <CODE>workFactor</CODE> &#60; 0 or <CODE>workFactor</CODE> &#62; 250
- <CODE>BZ_MEM_ERROR</CODE>
- if not enough memory is available
- <CODE>BZ_OK</CODE>
- otherwise
-</PRE>
-
-<P>
-Allowable next actions:
-
-<PRE>
- <CODE>BZ2_bzCompress</CODE>
- if <CODE>BZ_OK</CODE> is returned
- no specific action needed in case of error
-</PRE>
-
-
-
-<H3><A NAME="SEC20" HREF="manual_toc.html#TOC20"><CODE>BZ2_bzCompress</CODE></A></H3>
-
-<PRE>
- int BZ2_bzCompress ( bz_stream *strm, int action );
-</PRE>
-
-<P>
-Provides more input and/or output buffer space for the library. The
-caller maintains input and output buffers, and calls <CODE>BZ2_bzCompress</CODE> to
-transfer data between them.
-
-</P>
-<P>
-Before each call to <CODE>BZ2_bzCompress</CODE>, <CODE>next_in</CODE> should point at
-the data to be compressed, and <CODE>avail_in</CODE> should indicate how many
-bytes the library may read. <CODE>BZ2_bzCompress</CODE> updates <CODE>next_in</CODE>,
-<CODE>avail_in</CODE> and <CODE>total_in</CODE> to reflect the number of bytes it
-has read.
-
-</P>
-<P>
-Similarly, <CODE>next_out</CODE> should point to a buffer in which the
-compressed data is to be placed, with <CODE>avail_out</CODE> indicating how
-much output space is available. <CODE>BZ2_bzCompress</CODE> updates
-<CODE>next_out</CODE>, <CODE>avail_out</CODE> and <CODE>total_out</CODE> to reflect the
-number of bytes output.
-
-</P>
-<P>
-You may provide and remove as little or as much data as you like on each
-call of <CODE>BZ2_bzCompress</CODE>. In the limit, it is acceptable to supply and
-remove data one byte at a time, although this would be terribly
-inefficient. You should always ensure that at least one byte of output
-space is available at each call.
-
-</P>
-<P>
-A second purpose of <CODE>BZ2_bzCompress</CODE> is to request a change of mode of the
-compressed stream.
-
-</P>
-<P>
-Conceptually, a compressed stream can be in one of four states: IDLE,
-RUNNING, FLUSHING and FINISHING. Before initialisation
-(<CODE>BZ2_bzCompressInit</CODE>) and after termination (<CODE>BZ2_bzCompressEnd</CODE>), a
-stream is regarded as IDLE.
-
-</P>
-<P>
-Upon initialisation (<CODE>BZ2_bzCompressInit</CODE>), the stream is placed in the
-RUNNING state. Subsequent calls to <CODE>BZ2_bzCompress</CODE> should pass
-<CODE>BZ_RUN</CODE> as the requested action; other actions are illegal and
-will result in <CODE>BZ_SEQUENCE_ERROR</CODE>.
-
-</P>
-<P>
-At some point, the calling program will have provided all the input data
-it wants to. It will then want to finish up -- in effect, asking the
-library to process any data it might have buffered internally. In this
-state, <CODE>BZ2_bzCompress</CODE> will no longer attempt to read data from
-<CODE>next_in</CODE>, but it will want to write data to <CODE>next_out</CODE>.
-Because the output buffer supplied by the user can be arbitrarily small,
-the finishing-up operation cannot necessarily be done with a single call
-of <CODE>BZ2_bzCompress</CODE>.
-
-</P>
-<P>
-Instead, the calling program passes <CODE>BZ_FINISH</CODE> as an action to
-<CODE>BZ2_bzCompress</CODE>. This changes the stream's state to FINISHING. Any
-remaining input (ie, <CODE>next_in[0 .. avail_in-1]</CODE>) is compressed and
-transferred to the output buffer. To do this, <CODE>BZ2_bzCompress</CODE> must be
-called repeatedly until all the output has been consumed. At that
-point, <CODE>BZ2_bzCompress</CODE> returns <CODE>BZ_STREAM_END</CODE>, and the stream's
-state is set back to IDLE. <CODE>BZ2_bzCompressEnd</CODE> should then be
-called.
-
-</P>
-<P>
-Just to make sure the calling program does not cheat, the library makes
-a note of <CODE>avail_in</CODE> at the time of the first call to
-<CODE>BZ2_bzCompress</CODE> which has <CODE>BZ_FINISH</CODE> as an action (ie, at the
-time the program has announced its intention to not supply any more
-input). By comparing this value with that of <CODE>avail_in</CODE> over
-subsequent calls to <CODE>BZ2_bzCompress</CODE>, the library can detect any
-attempts to slip in more data to compress. Any calls for which this is
-detected will return <CODE>BZ_SEQUENCE_ERROR</CODE>. This indicates a
-programming mistake which should be corrected.
-
-</P>
-<P>
-Instead of asking to finish, the calling program may ask
-<CODE>BZ2_bzCompress</CODE> to take all the remaining input, compress it and
-terminate the current (Burrows-Wheeler) compression block. This could
-be useful for error control purposes. The mechanism is analogous to
-that for finishing: call <CODE>BZ2_bzCompress</CODE> with an action of
-<CODE>BZ_FLUSH</CODE>, remove output data, and persist with the
-<CODE>BZ_FLUSH</CODE> action until the value <CODE>BZ_RUN</CODE> is returned. As
-with finishing, <CODE>BZ2_bzCompress</CODE> detects any attempt to provide more
-input data once the flush has begun.
-
-</P>
-<P>
-Once the flush is complete, the stream returns to the normal RUNNING
-state.
-
-</P>
-<P>
-This all sounds pretty complex, but isn't really. Here's a table
-which shows which actions are allowable in each state, what action
-will be taken, what the next state is, and what the non-error return
-values are. Note that you can't explicitly ask what state the
-stream is in, but nor do you need to -- it can be inferred from the
-values returned by <CODE>BZ2_bzCompress</CODE>.
-
-<PRE>
-IDLE/<CODE>any</CODE>
- Illegal. IDLE state only exists after <CODE>BZ2_bzCompressEnd</CODE> or
- before <CODE>BZ2_bzCompressInit</CODE>.
- Return value = <CODE>BZ_SEQUENCE_ERROR</CODE>
-
-RUNNING/<CODE>BZ_RUN</CODE>
- Compress from <CODE>next_in</CODE> to <CODE>next_out</CODE> as much as possible.
- Next state = RUNNING
- Return value = <CODE>BZ_RUN_OK</CODE>
-
-RUNNING/<CODE>BZ_FLUSH</CODE>
- Remember current value of <CODE>next_in</CODE>. Compress from <CODE>next_in</CODE>
- to <CODE>next_out</CODE> as much as possible, but do not accept any more input.
- Next state = FLUSHING
- Return value = <CODE>BZ_FLUSH_OK</CODE>
-
-RUNNING/<CODE>BZ_FINISH</CODE>
- Remember current value of <CODE>next_in</CODE>. Compress from <CODE>next_in</CODE>
- to <CODE>next_out</CODE> as much as possible, but do not accept any more input.
- Next state = FINISHING
- Return value = <CODE>BZ_FINISH_OK</CODE>
-
-FLUSHING/<CODE>BZ_FLUSH</CODE>
- Compress from <CODE>next_in</CODE> to <CODE>next_out</CODE> as much as possible,
- but do not accept any more input.
- If all the existing input has been used up and all compressed
- output has been removed
- Next state = RUNNING; Return value = <CODE>BZ_RUN_OK</CODE>
- else
- Next state = FLUSHING; Return value = <CODE>BZ_FLUSH_OK</CODE>
-
-FLUSHING/other
- Illegal.
- Return value = <CODE>BZ_SEQUENCE_ERROR</CODE>
-
-FINISHING/<CODE>BZ_FINISH</CODE>
- Compress from <CODE>next_in</CODE> to <CODE>next_out</CODE> as much as possible,
- but to not accept any more input.
- If all the existing input has been used up and all compressed
- output has been removed
- Next state = IDLE; Return value = <CODE>BZ_STREAM_END</CODE>
- else
- Next state = FINISHING; Return value = <CODE>BZ_FINISHING</CODE>
-
-FINISHING/other
- Illegal.
- Return value = <CODE>BZ_SEQUENCE_ERROR</CODE>
-</PRE>
-
-<P>
-That still looks complicated? Well, fair enough. The usual sequence
-of calls for compressing a load of data is:
-
-<UL>
-<LI>Get started with <CODE>BZ2_bzCompressInit</CODE>.
-
-<LI>Shovel data in and shlurp out its compressed form using zero or more
-
-calls of <CODE>BZ2_bzCompress</CODE> with action = <CODE>BZ_RUN</CODE>.
-<LI>Finish up.
-
-Repeatedly call <CODE>BZ2_bzCompress</CODE> with action = <CODE>BZ_FINISH</CODE>,
-copying out the compressed output, until <CODE>BZ_STREAM_END</CODE> is returned.
-<LI>Close up and go home. Call <CODE>BZ2_bzCompressEnd</CODE>.
-
-</UL>
-
-<P>
-If the data you want to compress fits into your input buffer all
-at once, you can skip the calls of <CODE>BZ2_bzCompress ( ..., BZ_RUN )</CODE> and
-just do the <CODE>BZ2_bzCompress ( ..., BZ_FINISH )</CODE> calls.
-
-</P>
-<P>
-All required memory is allocated by <CODE>BZ2_bzCompressInit</CODE>. The
-compression library can accept any data at all (obviously). So you
-shouldn't get any error return values from the <CODE>BZ2_bzCompress</CODE> calls.
-If you do, they will be <CODE>BZ_SEQUENCE_ERROR</CODE>, and indicate a bug in
-your programming.
-
-</P>
-<P>
-Trivial other possible return values:
-
-<PRE>
- <CODE>BZ_PARAM_ERROR</CODE>
- if <CODE>strm</CODE> is <CODE>NULL</CODE>, or <CODE>strm-&#62;s</CODE> is <CODE>NULL</CODE>
-</PRE>
-
-
-
-<H3><A NAME="SEC21" HREF="manual_toc.html#TOC21"><CODE>BZ2_bzCompressEnd</CODE></A></H3>
-
-<PRE>
-int BZ2_bzCompressEnd ( bz_stream *strm );
-</PRE>
-
-<P>
-Releases all memory associated with a compression stream.
-
-</P>
-<P>
-Possible return values:
-
-<PRE>
- <CODE>BZ_PARAM_ERROR</CODE> if <CODE>strm</CODE> is <CODE>NULL</CODE> or <CODE>strm-&#62;s</CODE> is <CODE>NULL</CODE>
- <CODE>BZ_OK</CODE> otherwise
-</PRE>
-
-
-
-<H3><A NAME="SEC22" HREF="manual_toc.html#TOC22"><CODE>BZ2_bzDecompressInit</CODE></A></H3>
-
-<PRE>
-int BZ2_bzDecompressInit ( bz_stream *strm, int verbosity, int small );
-</PRE>
-
-<P>
-Prepares for decompression. As with <CODE>BZ2_bzCompressInit</CODE>, a
-<CODE>bz_stream</CODE> record should be allocated and initialised before the
-call. Fields <CODE>bzalloc</CODE>, <CODE>bzfree</CODE> and <CODE>opaque</CODE> should be
-set if a custom memory allocator is required, or made <CODE>NULL</CODE> for
-the normal <CODE>malloc</CODE>/<CODE>free</CODE> routines. Upon return, the internal
-state will have been initialised, and <CODE>total_in</CODE> and
-<CODE>total_out</CODE> will be zero.
-
-</P>
-<P>
-For the meaning of parameter <CODE>verbosity</CODE>, see <CODE>BZ2_bzCompressInit</CODE>.
-
-</P>
-<P>
-If <CODE>small</CODE> is nonzero, the library will use an alternative
-decompression algorithm which uses less memory but at the cost of
-decompressing more slowly (roughly speaking, half the speed, but the
-maximum memory requirement drops to around 2300k). See Chapter 2 for
-more information on memory management.
-
-</P>
-<P>
-Note that the amount of memory needed to decompress
-a stream cannot be determined until the stream's header has been read,
-so even if <CODE>BZ2_bzDecompressInit</CODE> succeeds, a subsequent
-<CODE>BZ2_bzDecompress</CODE> could fail with <CODE>BZ_MEM_ERROR</CODE>.
-
-</P>
-<P>
-Possible return values:
-
-<PRE>
- <CODE>BZ_CONFIG_ERROR</CODE>
- if the library has been mis-compiled
- <CODE>BZ_PARAM_ERROR</CODE>
- if <CODE>(small != 0 &#38;&#38; small != 1)</CODE>
- or <CODE>(verbosity &#60; 0 || verbosity &#62; 4)</CODE>
- <CODE>BZ_MEM_ERROR</CODE>
- if insufficient memory is available
-</PRE>
-
-<P>
-Allowable next actions:
-
-<PRE>
- <CODE>BZ2_bzDecompress</CODE>
- if <CODE>BZ_OK</CODE> was returned
- no specific action required in case of error
-</PRE>
-
-<P>
-
-
-</P>
-
-
-<H3><A NAME="SEC23" HREF="manual_toc.html#TOC23"><CODE>BZ2_bzDecompress</CODE></A></H3>
-
-<PRE>
-int BZ2_bzDecompress ( bz_stream *strm );
-</PRE>
-
-<P>
-Provides more input and/out output buffer space for the library. The
-caller maintains input and output buffers, and uses <CODE>BZ2_bzDecompress</CODE>
-to transfer data between them.
-
-</P>
-<P>
-Before each call to <CODE>BZ2_bzDecompress</CODE>, <CODE>next_in</CODE>
-should point at the compressed data,
-and <CODE>avail_in</CODE> should indicate how many bytes the library
-may read. <CODE>BZ2_bzDecompress</CODE> updates <CODE>next_in</CODE>, <CODE>avail_in</CODE>
-and <CODE>total_in</CODE>
-to reflect the number of bytes it has read.
-
-</P>
-<P>
-Similarly, <CODE>next_out</CODE> should point to a buffer in which the uncompressed
-output is to be placed, with <CODE>avail_out</CODE> indicating how much output space
-is available. <CODE>BZ2_bzCompress</CODE> updates <CODE>next_out</CODE>,
-<CODE>avail_out</CODE> and <CODE>total_out</CODE> to reflect
-the number of bytes output.
-
-</P>
-<P>
-You may provide and remove as little or as much data as you like on
-each call of <CODE>BZ2_bzDecompress</CODE>.
-In the limit, it is acceptable to
-supply and remove data one byte at a time, although this would be
-terribly inefficient. You should always ensure that at least one
-byte of output space is available at each call.
-
-</P>
-<P>
-Use of <CODE>BZ2_bzDecompress</CODE> is simpler than <CODE>BZ2_bzCompress</CODE>.
-
-</P>
-<P>
-You should provide input and remove output as described above, and
-repeatedly call <CODE>BZ2_bzDecompress</CODE> until <CODE>BZ_STREAM_END</CODE> is
-returned. Appearance of <CODE>BZ_STREAM_END</CODE> denotes that
-<CODE>BZ2_bzDecompress</CODE> has detected the logical end of the compressed
-stream. <CODE>BZ2_bzDecompress</CODE> will not produce <CODE>BZ_STREAM_END</CODE> until
-all output data has been placed into the output buffer, so once
-<CODE>BZ_STREAM_END</CODE> appears, you are guaranteed to have available all
-the decompressed output, and <CODE>BZ2_bzDecompressEnd</CODE> can safely be
-called.
-
-</P>
-<P>
-If case of an error return value, you should call <CODE>BZ2_bzDecompressEnd</CODE>
-to clean up and release memory.
-
-</P>
-<P>
-Possible return values:
-
-<PRE>
- <CODE>BZ_PARAM_ERROR</CODE>
- if <CODE>strm</CODE> is <CODE>NULL</CODE> or <CODE>strm-&#62;s</CODE> is <CODE>NULL</CODE>
- or <CODE>strm-&#62;avail_out &#60; 1</CODE>
- <CODE>BZ_DATA_ERROR</CODE>
- if a data integrity error is detected in the compressed stream
- <CODE>BZ_DATA_ERROR_MAGIC</CODE>
- if the compressed stream doesn't begin with the right magic bytes
- <CODE>BZ_MEM_ERROR</CODE>
- if there wasn't enough memory available
- <CODE>BZ_STREAM_END</CODE>
- if the logical end of the data stream was detected and all
- output in has been consumed, eg <CODE>s-&#62;avail_out &#62; 0</CODE>
- <CODE>BZ_OK</CODE>
- otherwise
-</PRE>
-
-<P>
-Allowable next actions:
-
-<PRE>
- <CODE>BZ2_bzDecompress</CODE>
- if <CODE>BZ_OK</CODE> was returned
- <CODE>BZ2_bzDecompressEnd</CODE>
- otherwise
-</PRE>
-
-
-
-<H3><A NAME="SEC24" HREF="manual_toc.html#TOC24"><CODE>BZ2_bzDecompressEnd</CODE></A></H3>
-
-<PRE>
-int BZ2_bzDecompressEnd ( bz_stream *strm );
-</PRE>
-
-<P>
-Releases all memory associated with a decompression stream.
-
-</P>
-<P>
-Possible return values:
-
-<PRE>
- <CODE>BZ_PARAM_ERROR</CODE>
- if <CODE>strm</CODE> is <CODE>NULL</CODE> or <CODE>strm-&#62;s</CODE> is <CODE>NULL</CODE>
- <CODE>BZ_OK</CODE>
- otherwise
-</PRE>
-
-<P>
-Allowable next actions:
-
-<PRE>
- None.
-</PRE>
-
-
-
-<H2><A NAME="SEC25" HREF="manual_toc.html#TOC25">High-level interface</A></H2>
-
-<P>
-This interface provides functions for reading and writing
-<CODE>bzip2</CODE> format files. First, some general points.
-
-</P>
-
-<UL>
-<LI>All of the functions take an <CODE>int*</CODE> first argument,
-
- <CODE>bzerror</CODE>.
- After each call, <CODE>bzerror</CODE> should be consulted first to determine
- the outcome of the call. If <CODE>bzerror</CODE> is <CODE>BZ_OK</CODE>,
- the call completed
- successfully, and only then should the return value of the function
- (if any) be consulted. If <CODE>bzerror</CODE> is <CODE>BZ_IO_ERROR</CODE>,
- there was an error
- reading/writing the underlying compressed file, and you should
- then consult <CODE>errno</CODE>/<CODE>perror</CODE> to determine the
- cause of the difficulty.
- <CODE>bzerror</CODE> may also be set to various other values; precise details are
- given on a per-function basis below.
-<LI>If <CODE>bzerror</CODE> indicates an error
-
- (ie, anything except <CODE>BZ_OK</CODE> and <CODE>BZ_STREAM_END</CODE>),
- you should immediately call <CODE>BZ2_bzReadClose</CODE> (or <CODE>BZ2_bzWriteClose</CODE>,
- depending on whether you are attempting to read or to write)
- to free up all resources associated
- with the stream. Once an error has been indicated, behaviour of all calls
- except <CODE>BZ2_bzReadClose</CODE> (<CODE>BZ2_bzWriteClose</CODE>) is undefined.
- The implication is that (1) <CODE>bzerror</CODE> should
- be checked after each call, and (2) if <CODE>bzerror</CODE> indicates an error,
- <CODE>BZ2_bzReadClose</CODE> (<CODE>BZ2_bzWriteClose</CODE>) should then be called to clean up.
-<LI>The <CODE>FILE*</CODE> arguments passed to
-
- <CODE>BZ2_bzReadOpen</CODE>/<CODE>BZ2_bzWriteOpen</CODE>
- should be set to binary mode.
- Most Unix systems will do this by default, but other platforms,
- including Windows and Mac, will not. If you omit this, you may
- encounter problems when moving code to new platforms.
-<LI>Memory allocation requests are handled by
-
- <CODE>malloc</CODE>/<CODE>free</CODE>.
- At present
- there is no facility for user-defined memory allocators in the file I/O
- functions (could easily be added, though).
-</UL>
-
-
-
-<H3><A NAME="SEC26" HREF="manual_toc.html#TOC26"><CODE>BZ2_bzReadOpen</CODE></A></H3>
-
-<PRE>
- typedef void BZFILE;
-
- BZFILE *BZ2_bzReadOpen ( int *bzerror, FILE *f,
- int small, int verbosity,
- void *unused, int nUnused );
-</PRE>
-
-<P>
-Prepare to read compressed data from file handle <CODE>f</CODE>. <CODE>f</CODE>
-should refer to a file which has been opened for reading, and for which
-the error indicator (<CODE>ferror(f)</CODE>)is not set. If <CODE>small</CODE> is 1,
-the library will try to decompress using less memory, at the expense of
-speed.
-
-</P>
-<P>
-For reasons explained below, <CODE>BZ2_bzRead</CODE> will decompress the
-<CODE>nUnused</CODE> bytes starting at <CODE>unused</CODE>, before starting to read
-from the file <CODE>f</CODE>. At most <CODE>BZ_MAX_UNUSED</CODE> bytes may be
-supplied like this. If this facility is not required, you should pass
-<CODE>NULL</CODE> and <CODE>0</CODE> for <CODE>unused</CODE> and n<CODE>Unused</CODE>
-respectively.
-
-</P>
-<P>
-For the meaning of parameters <CODE>small</CODE> and <CODE>verbosity</CODE>,
-see <CODE>BZ2_bzDecompressInit</CODE>.
-
-</P>
-<P>
-The amount of memory needed to decompress a file cannot be determined
-until the file's header has been read. So it is possible that
-<CODE>BZ2_bzReadOpen</CODE> returns <CODE>BZ_OK</CODE> but a subsequent call of
-<CODE>BZ2_bzRead</CODE> will return <CODE>BZ_MEM_ERROR</CODE>.
-
-</P>
-<P>
-Possible assignments to <CODE>bzerror</CODE>:
-
-<PRE>
- <CODE>BZ_CONFIG_ERROR</CODE>
- if the library has been mis-compiled
- <CODE>BZ_PARAM_ERROR</CODE>
- if <CODE>f</CODE> is <CODE>NULL</CODE>
- or <CODE>small</CODE> is neither <CODE>0</CODE> nor <CODE>1</CODE>
- or <CODE>(unused == NULL &#38;&#38; nUnused != 0)</CODE>
- or <CODE>(unused != NULL &#38;&#38; !(0 &#60;= nUnused &#60;= BZ_MAX_UNUSED))</CODE>
- <CODE>BZ_IO_ERROR</CODE>
- if <CODE>ferror(f)</CODE> is nonzero
- <CODE>BZ_MEM_ERROR</CODE>
- if insufficient memory is available
- <CODE>BZ_OK</CODE>
- otherwise.
-</PRE>
-
-<P>
-Possible return values:
-
-<PRE>
- Pointer to an abstract <CODE>BZFILE</CODE>
- if <CODE>bzerror</CODE> is <CODE>BZ_OK</CODE>
- <CODE>NULL</CODE>
- otherwise
-</PRE>
-
-<P>
-Allowable next actions:
-
-<PRE>
- <CODE>BZ2_bzRead</CODE>
- if <CODE>bzerror</CODE> is <CODE>BZ_OK</CODE>
- <CODE>BZ2_bzClose</CODE>
- otherwise
-</PRE>
-
-
-
-<H3><A NAME="SEC27" HREF="manual_toc.html#TOC27"><CODE>BZ2_bzRead</CODE></A></H3>
-
-<PRE>
- int BZ2_bzRead ( int *bzerror, BZFILE *b, void *buf, int len );
-</PRE>
-
-<P>
-Reads up to <CODE>len</CODE> (uncompressed) bytes from the compressed file
-<CODE>b</CODE> into
-the buffer <CODE>buf</CODE>. If the read was successful,
-<CODE>bzerror</CODE> is set to <CODE>BZ_OK</CODE>
-and the number of bytes read is returned. If the logical end-of-stream
-was detected, <CODE>bzerror</CODE> will be set to <CODE>BZ_STREAM_END</CODE>,
-and the number
-of bytes read is returned. All other <CODE>bzerror</CODE> values denote an error.
-
-</P>
-<P>
-<CODE>BZ2_bzRead</CODE> will supply <CODE>len</CODE> bytes,
-unless the logical stream end is detected
-or an error occurs. Because of this, it is possible to detect the
-stream end by observing when the number of bytes returned is
-less than the number
-requested. Nevertheless, this is regarded as inadvisable; you should
-instead check <CODE>bzerror</CODE> after every call and watch out for
-<CODE>BZ_STREAM_END</CODE>.
-
-</P>
-<P>
-Internally, <CODE>BZ2_bzRead</CODE> copies data from the compressed file in chunks
-of size <CODE>BZ_MAX_UNUSED</CODE> bytes
-before decompressing it. If the file contains more bytes than strictly
-needed to reach the logical end-of-stream, <CODE>BZ2_bzRead</CODE> will almost certainly
-read some of the trailing data before signalling <CODE>BZ_SEQUENCE_END</CODE>.
-To collect the read but unused data once <CODE>BZ_SEQUENCE_END</CODE> has
-appeared, call <CODE>BZ2_bzReadGetUnused</CODE> immediately before <CODE>BZ2_bzReadClose</CODE>.
-
-</P>
-<P>
-Possible assignments to <CODE>bzerror</CODE>:
-
-<PRE>
- <CODE>BZ_PARAM_ERROR</CODE>
- if <CODE>b</CODE> is <CODE>NULL</CODE> or <CODE>buf</CODE> is <CODE>NULL</CODE> or <CODE>len &#60; 0</CODE>
- <CODE>BZ_SEQUENCE_ERROR</CODE>
- if <CODE>b</CODE> was opened with <CODE>BZ2_bzWriteOpen</CODE>
- <CODE>BZ_IO_ERROR</CODE>
- if there is an error reading from the compressed file
- <CODE>BZ_UNEXPECTED_EOF</CODE>
- if the compressed file ended before the logical end-of-stream was detected
- <CODE>BZ_DATA_ERROR</CODE>
- if a data integrity error was detected in the compressed stream
- <CODE>BZ_DATA_ERROR_MAGIC</CODE>
- if the stream does not begin with the requisite header bytes (ie, is not
- a <CODE>bzip2</CODE> data file). This is really a special case of <CODE>BZ_DATA_ERROR</CODE>.
- <CODE>BZ_MEM_ERROR</CODE>
- if insufficient memory was available
- <CODE>BZ_STREAM_END</CODE>
- if the logical end of stream was detected.
- <CODE>BZ_OK</CODE>
- otherwise.
-</PRE>
-
-<P>
-Possible return values:
-
-<PRE>
- number of bytes read
- if <CODE>bzerror</CODE> is <CODE>BZ_OK</CODE> or <CODE>BZ_STREAM_END</CODE>
- undefined
- otherwise
-</PRE>
-
-<P>
-Allowable next actions:
-
-<PRE>
- collect data from <CODE>buf</CODE>, then <CODE>BZ2_bzRead</CODE> or <CODE>BZ2_bzReadClose</CODE>
- if <CODE>bzerror</CODE> is <CODE>BZ_OK</CODE>
- collect data from <CODE>buf</CODE>, then <CODE>BZ2_bzReadClose</CODE> or <CODE>BZ2_bzReadGetUnused</CODE>
- if <CODE>bzerror</CODE> is <CODE>BZ_SEQUENCE_END</CODE>
- <CODE>BZ2_bzReadClose</CODE>
- otherwise
-</PRE>
-
-
-
-<H3><A NAME="SEC28" HREF="manual_toc.html#TOC28"><CODE>BZ2_bzReadGetUnused</CODE></A></H3>
-
-<PRE>
- void BZ2_bzReadGetUnused ( int* bzerror, BZFILE *b,
- void** unused, int* nUnused );
-</PRE>
-
-<P>
-Returns data which was read from the compressed file but was not needed
-to get to the logical end-of-stream. <CODE>*unused</CODE> is set to the address
-of the data, and <CODE>*nUnused</CODE> to the number of bytes. <CODE>*nUnused</CODE> will
-be set to a value between <CODE>0</CODE> and <CODE>BZ_MAX_UNUSED</CODE> inclusive.
-
-</P>
-<P>
-This function may only be called once <CODE>BZ2_bzRead</CODE> has signalled
-<CODE>BZ_STREAM_END</CODE> but before <CODE>BZ2_bzReadClose</CODE>.
-
-</P>
-<P>
-Possible assignments to <CODE>bzerror</CODE>:
-
-<PRE>
- <CODE>BZ_PARAM_ERROR</CODE>
- if <CODE>b</CODE> is <CODE>NULL</CODE>
- or <CODE>unused</CODE> is <CODE>NULL</CODE> or <CODE>nUnused</CODE> is <CODE>NULL</CODE>
- <CODE>BZ_SEQUENCE_ERROR</CODE>
- if <CODE>BZ_STREAM_END</CODE> has not been signalled
- or if <CODE>b</CODE> was opened with <CODE>BZ2_bzWriteOpen</CODE>
- <CODE>BZ_OK</CODE>
- otherwise
-</PRE>
-
-<P>
-Allowable next actions:
-
-<PRE>
- <CODE>BZ2_bzReadClose</CODE>
-</PRE>
-
-
-
-<H3><A NAME="SEC29" HREF="manual_toc.html#TOC29"><CODE>BZ2_bzReadClose</CODE></A></H3>
-
-<PRE>
- void BZ2_bzReadClose ( int *bzerror, BZFILE *b );
-</PRE>
-
-<P>
-Releases all memory pertaining to the compressed file <CODE>b</CODE>.
-<CODE>BZ2_bzReadClose</CODE> does not call <CODE>fclose</CODE> on the underlying file
-handle, so you should do that yourself if appropriate.
-<CODE>BZ2_bzReadClose</CODE> should be called to clean up after all error
-situations.
-
-</P>
-<P>
-Possible assignments to <CODE>bzerror</CODE>:
-
-<PRE>
- <CODE>BZ_SEQUENCE_ERROR</CODE>
- if <CODE>b</CODE> was opened with <CODE>BZ2_bzOpenWrite</CODE>
- <CODE>BZ_OK</CODE>
- otherwise
-</PRE>
-
-<P>
-Allowable next actions:
-
-<PRE>
- none
-</PRE>
-
-
-
-<H3><A NAME="SEC30" HREF="manual_toc.html#TOC30"><CODE>BZ2_bzWriteOpen</CODE></A></H3>
-
-<PRE>
- BZFILE *BZ2_bzWriteOpen ( int *bzerror, FILE *f,
- int blockSize100k, int verbosity,
- int workFactor );
-</PRE>
-
-<P>
-Prepare to write compressed data to file handle <CODE>f</CODE>.
-<CODE>f</CODE> should refer to
-a file which has been opened for writing, and for which the error
-indicator (<CODE>ferror(f)</CODE>)is not set.
-
-</P>
-<P>
-For the meaning of parameters <CODE>blockSize100k</CODE>,
-<CODE>verbosity</CODE> and <CODE>workFactor</CODE>, see
-<BR> <CODE>BZ2_bzCompressInit</CODE>.
-
-</P>
-<P>
-All required memory is allocated at this stage, so if the call
-completes successfully, <CODE>BZ_MEM_ERROR</CODE> cannot be signalled by a
-subsequent call to <CODE>BZ2_bzWrite</CODE>.
-
-</P>
-<P>
-Possible assignments to <CODE>bzerror</CODE>:
-
-<PRE>
- <CODE>BZ_CONFIG_ERROR</CODE>
- if the library has been mis-compiled
- <CODE>BZ_PARAM_ERROR</CODE>
- if <CODE>f</CODE> is <CODE>NULL</CODE>
- or <CODE>blockSize100k &#60; 1</CODE> or <CODE>blockSize100k &#62; 9</CODE>
- <CODE>BZ_IO_ERROR</CODE>
- if <CODE>ferror(f)</CODE> is nonzero
- <CODE>BZ_MEM_ERROR</CODE>
- if insufficient memory is available
- <CODE>BZ_OK</CODE>
- otherwise
-</PRE>
-
-<P>
-Possible return values:
-
-<PRE>
- Pointer to an abstract <CODE>BZFILE</CODE>
- if <CODE>bzerror</CODE> is <CODE>BZ_OK</CODE>
- <CODE>NULL</CODE>
- otherwise
-</PRE>
-
-<P>
-Allowable next actions:
-
-<PRE>
- <CODE>BZ2_bzWrite</CODE>
- if <CODE>bzerror</CODE> is <CODE>BZ_OK</CODE>
- (you could go directly to <CODE>BZ2_bzWriteClose</CODE>, but this would be pretty pointless)
- <CODE>BZ2_bzWriteClose</CODE>
- otherwise
-</PRE>
-
-
-
-<H3><A NAME="SEC31" HREF="manual_toc.html#TOC31"><CODE>BZ2_bzWrite</CODE></A></H3>
-
-<PRE>
- void BZ2_bzWrite ( int *bzerror, BZFILE *b, void *buf, int len );
-</PRE>
-
-<P>
-Absorbs <CODE>len</CODE> bytes from the buffer <CODE>buf</CODE>, eventually to be
-compressed and written to the file.
-
-</P>
-<P>
-Possible assignments to <CODE>bzerror</CODE>:
-
-<PRE>
- <CODE>BZ_PARAM_ERROR</CODE>
- if <CODE>b</CODE> is <CODE>NULL</CODE> or <CODE>buf</CODE> is <CODE>NULL</CODE> or <CODE>len &#60; 0</CODE>
- <CODE>BZ_SEQUENCE_ERROR</CODE>
- if b was opened with <CODE>BZ2_bzReadOpen</CODE>
- <CODE>BZ_IO_ERROR</CODE>
- if there is an error writing the compressed file.
- <CODE>BZ_OK</CODE>
- otherwise
-</PRE>
-
-
-
-<H3><A NAME="SEC32" HREF="manual_toc.html#TOC32"><CODE>BZ2_bzWriteClose</CODE></A></H3>
-
-<PRE>
- void BZ2_bzWriteClose ( int *bzerror, BZFILE* f,
- int abandon,
- unsigned int* nbytes_in,
- unsigned int* nbytes_out );
-
- void BZ2_bzWriteClose64 ( int *bzerror, BZFILE* f,
- int abandon,
- unsigned int* nbytes_in_lo32,
- unsigned int* nbytes_in_hi32,
- unsigned int* nbytes_out_lo32,
- unsigned int* nbytes_out_hi32 );
-</PRE>
-
-<P>
-Compresses and flushes to the compressed file all data so far supplied
-by <CODE>BZ2_bzWrite</CODE>. The logical end-of-stream markers are also written, so
-subsequent calls to <CODE>BZ2_bzWrite</CODE> are illegal. All memory associated
-with the compressed file <CODE>b</CODE> is released.
-<CODE>fflush</CODE> is called on the
-compressed file, but it is not <CODE>fclose</CODE>'d.
-
-</P>
-<P>
-If <CODE>BZ2_bzWriteClose</CODE> is called to clean up after an error, the only
-action is to release the memory. The library records the error codes
-issued by previous calls, so this situation will be detected
-automatically. There is no attempt to complete the compression
-operation, nor to <CODE>fflush</CODE> the compressed file. You can force this
-behaviour to happen even in the case of no error, by passing a nonzero
-value to <CODE>abandon</CODE>.
-
-</P>
-<P>
-If <CODE>nbytes_in</CODE> is non-null, <CODE>*nbytes_in</CODE> will be set to be the
-total volume of uncompressed data handled. Similarly, <CODE>nbytes_out</CODE>
-will be set to the total volume of compressed data written. For
-compatibility with older versions of the library, <CODE>BZ2_bzWriteClose</CODE>
-only yields the lower 32 bits of these counts. Use
-<CODE>BZ2_bzWriteClose64</CODE> if you want the full 64 bit counts. These
-two functions are otherwise absolutely identical.
-
-</P>
-
-<P>
-Possible assignments to <CODE>bzerror</CODE>:
-
-<PRE>
- <CODE>BZ_SEQUENCE_ERROR</CODE>
- if <CODE>b</CODE> was opened with <CODE>BZ2_bzReadOpen</CODE>
- <CODE>BZ_IO_ERROR</CODE>
- if there is an error writing the compressed file
- <CODE>BZ_OK</CODE>
- otherwise
-</PRE>
-
-
-
-<H3><A NAME="SEC33" HREF="manual_toc.html#TOC33">Handling embedded compressed data streams</A></H3>
-
-<P>
-The high-level library facilitates use of
-<CODE>bzip2</CODE> data streams which form some part of a surrounding, larger
-data stream.
-
-<UL>
-<LI>For writing, the library takes an open file handle, writes
-
-compressed data to it, <CODE>fflush</CODE>es it but does not <CODE>fclose</CODE> it.
-The calling application can write its own data before and after the
-compressed data stream, using that same file handle.
-<LI>Reading is more complex, and the facilities are not as general
-
-as they could be since generality is hard to reconcile with efficiency.
-<CODE>BZ2_bzRead</CODE> reads from the compressed file in blocks of size
-<CODE>BZ_MAX_UNUSED</CODE> bytes, and in doing so probably will overshoot
-the logical end of compressed stream.
-To recover this data once decompression has
-ended, call <CODE>BZ2_bzReadGetUnused</CODE> after the last call of <CODE>BZ2_bzRead</CODE>
-(the one returning <CODE>BZ_STREAM_END</CODE>) but before calling
-<CODE>BZ2_bzReadClose</CODE>.
-</UL>
-
-<P>
-This mechanism makes it easy to decompress multiple <CODE>bzip2</CODE>
-streams placed end-to-end. As the end of one stream, when <CODE>BZ2_bzRead</CODE>
-returns <CODE>BZ_STREAM_END</CODE>, call <CODE>BZ2_bzReadGetUnused</CODE> to collect the
-unused data (copy it into your own buffer somewhere).
-That data forms the start of the next compressed stream.
-To start uncompressing that next stream, call <CODE>BZ2_bzReadOpen</CODE> again,
-feeding in the unused data via the <CODE>unused</CODE>/<CODE>nUnused</CODE>
-parameters.
-Keep doing this until <CODE>BZ_STREAM_END</CODE> return coincides with the
-physical end of file (<CODE>feof(f)</CODE>). In this situation
-<CODE>BZ2_bzReadGetUnused</CODE>
-will of course return no data.
-
-</P>
-<P>
-This should give some feel for how the high-level interface can be used.
-If you require extra flexibility, you'll have to bite the bullet and get
-to grips with the low-level interface.
-
-</P>
-
-
-<H3><A NAME="SEC34" HREF="manual_toc.html#TOC34">Standard file-reading/writing code</A></H3>
-<P>
-Here's how you'd write data to a compressed file:
-
-<PRE>
-FILE* f;
-BZFILE* b;
-int nBuf;
-char buf[ /* whatever size you like */ ];
-int bzerror;
-int nWritten;
-
-f = fopen ( "myfile.bz2", "w" );
-if (!f) {
- /* handle error */
-}
-b = BZ2_bzWriteOpen ( &#38;bzerror, f, 9 );
-if (bzerror != BZ_OK) {
- BZ2_bzWriteClose ( b );
- /* handle error */
-}
-
-while ( /* condition */ ) {
- /* get data to write into buf, and set nBuf appropriately */
- nWritten = BZ2_bzWrite ( &#38;bzerror, b, buf, nBuf );
- if (bzerror == BZ_IO_ERROR) {
- BZ2_bzWriteClose ( &#38;bzerror, b );
- /* handle error */
- }
-}
-
-BZ2_bzWriteClose ( &#38;bzerror, b );
-if (bzerror == BZ_IO_ERROR) {
- /* handle error */
-}
-</PRE>
-
-<P>
-And to read from a compressed file:
-
-<PRE>
-FILE* f;
-BZFILE* b;
-int nBuf;
-char buf[ /* whatever size you like */ ];
-int bzerror;
-int nWritten;
-
-f = fopen ( "myfile.bz2", "r" );
-if (!f) {
- /* handle error */
-}
-b = BZ2_bzReadOpen ( &#38;bzerror, f, 0, NULL, 0 );
-if (bzerror != BZ_OK) {
- BZ2_bzReadClose ( &#38;bzerror, b );
- /* handle error */
-}
-
-bzerror = BZ_OK;
-while (bzerror == BZ_OK &#38;&#38; /* arbitrary other conditions */) {
- nBuf = BZ2_bzRead ( &#38;bzerror, b, buf, /* size of buf */ );
- if (bzerror == BZ_OK) {
- /* do something with buf[0 .. nBuf-1] */
- }
-}
-if (bzerror != BZ_STREAM_END) {
- BZ2_bzReadClose ( &#38;bzerror, b );
- /* handle error */
-} else {
- BZ2_bzReadClose ( &#38;bzerror );
-}
-</PRE>
-
-
-
-<H2><A NAME="SEC35" HREF="manual_toc.html#TOC35">Utility functions</A></H2>
-
-
-<H3><A NAME="SEC36" HREF="manual_toc.html#TOC36"><CODE>BZ2_bzBuffToBuffCompress</CODE></A></H3>
-
-<PRE>
- int BZ2_bzBuffToBuffCompress( char* dest,
- unsigned int* destLen,
- char* source,
- unsigned int sourceLen,
- int blockSize100k,
- int verbosity,
- int workFactor );
-</PRE>
-
-<P>
-Attempts to compress the data in <CODE>source[0 .. sourceLen-1]</CODE>
-into the destination buffer, <CODE>dest[0 .. *destLen-1]</CODE>.
-If the destination buffer is big enough, <CODE>*destLen</CODE> is
-set to the size of the compressed data, and <CODE>BZ_OK</CODE> is
-returned. If the compressed data won't fit, <CODE>*destLen</CODE>
-is unchanged, and <CODE>BZ_OUTBUFF_FULL</CODE> is returned.
-
-</P>
-<P>
-Compression in this manner is a one-shot event, done with a single call
-to this function. The resulting compressed data is a complete
-<CODE>bzip2</CODE> format data stream. There is no mechanism for making
-additional calls to provide extra input data. If you want that kind of
-mechanism, use the low-level interface.
-
-</P>
-<P>
-For the meaning of parameters <CODE>blockSize100k</CODE>, <CODE>verbosity</CODE>
-and <CODE>workFactor</CODE>, <BR> see <CODE>BZ2_bzCompressInit</CODE>.
-
-</P>
-<P>
-To guarantee that the compressed data will fit in its buffer, allocate
-an output buffer of size 1% larger than the uncompressed data, plus
-six hundred extra bytes.
-
-</P>
-<P>
-<CODE>BZ2_bzBuffToBuffDecompress</CODE> will not write data at or
-beyond <CODE>dest[*destLen]</CODE>, even in case of buffer overflow.
-
-</P>
-<P>
-Possible return values:
-
-<PRE>
- <CODE>BZ_CONFIG_ERROR</CODE>
- if the library has been mis-compiled
- <CODE>BZ_PARAM_ERROR</CODE>
- if <CODE>dest</CODE> is <CODE>NULL</CODE> or <CODE>destLen</CODE> is <CODE>NULL</CODE>
- or <CODE>blockSize100k &#60; 1</CODE> or <CODE>blockSize100k &#62; 9</CODE>
- or <CODE>verbosity &#60; 0</CODE> or <CODE>verbosity &#62; 4</CODE>
- or <CODE>workFactor &#60; 0</CODE> or <CODE>workFactor &#62; 250</CODE>
- <CODE>BZ_MEM_ERROR</CODE>
- if insufficient memory is available
- <CODE>BZ_OUTBUFF_FULL</CODE>
- if the size of the compressed data exceeds <CODE>*destLen</CODE>
- <CODE>BZ_OK</CODE>
- otherwise
-</PRE>
-
-
-
-<H3><A NAME="SEC37" HREF="manual_toc.html#TOC37"><CODE>BZ2_bzBuffToBuffDecompress</CODE></A></H3>
-
-<PRE>
- int BZ2_bzBuffToBuffDecompress ( char* dest,
- unsigned int* destLen,
- char* source,
- unsigned int sourceLen,
- int small,
- int verbosity );
-</PRE>
-
-<P>
-Attempts to decompress the data in <CODE>source[0 .. sourceLen-1]</CODE>
-into the destination buffer, <CODE>dest[0 .. *destLen-1]</CODE>.
-If the destination buffer is big enough, <CODE>*destLen</CODE> is
-set to the size of the uncompressed data, and <CODE>BZ_OK</CODE> is
-returned. If the compressed data won't fit, <CODE>*destLen</CODE>
-is unchanged, and <CODE>BZ_OUTBUFF_FULL</CODE> is returned.
-
-</P>
-<P>
-<CODE>source</CODE> is assumed to hold a complete <CODE>bzip2</CODE> format
-data stream. <BR> <CODE>BZ2_bzBuffToBuffDecompress</CODE> tries to decompress
-the entirety of the stream into the output buffer.
-
-</P>
-<P>
-For the meaning of parameters <CODE>small</CODE> and <CODE>verbosity</CODE>,
-see <CODE>BZ2_bzDecompressInit</CODE>.
-
-</P>
-<P>
-Because the compression ratio of the compressed data cannot be known in
-advance, there is no easy way to guarantee that the output buffer will
-be big enough. You may of course make arrangements in your code to
-record the size of the uncompressed data, but such a mechanism is beyond
-the scope of this library.
-
-</P>
-<P>
-<CODE>BZ2_bzBuffToBuffDecompress</CODE> will not write data at or
-beyond <CODE>dest[*destLen]</CODE>, even in case of buffer overflow.
-
-</P>
-<P>
-Possible return values:
-
-<PRE>
- <CODE>BZ_CONFIG_ERROR</CODE>
- if the library has been mis-compiled
- <CODE>BZ_PARAM_ERROR</CODE>
- if <CODE>dest</CODE> is <CODE>NULL</CODE> or <CODE>destLen</CODE> is <CODE>NULL</CODE>
- or <CODE>small != 0 &#38;&#38; small != 1</CODE>
- or <CODE>verbosity &#60; 0</CODE> or <CODE>verbosity &#62; 4</CODE>
- <CODE>BZ_MEM_ERROR</CODE>
- if insufficient memory is available
- <CODE>BZ_OUTBUFF_FULL</CODE>
- if the size of the compressed data exceeds <CODE>*destLen</CODE>
- <CODE>BZ_DATA_ERROR</CODE>
- if a data integrity error was detected in the compressed data
- <CODE>BZ_DATA_ERROR_MAGIC</CODE>
- if the compressed data doesn't begin with the right magic bytes
- <CODE>BZ_UNEXPECTED_EOF</CODE>
- if the compressed data ends unexpectedly
- <CODE>BZ_OK</CODE>
- otherwise
-</PRE>
-
-
-
-<H2><A NAME="SEC38" HREF="manual_toc.html#TOC38"><CODE>zlib</CODE> compatibility functions</A></H2>
-<P>
-Yoshioka Tsuneo has contributed some functions to
-give better <CODE>zlib</CODE> compatibility. These functions are
-<CODE>BZ2_bzopen</CODE>, <CODE>BZ2_bzread</CODE>, <CODE>BZ2_bzwrite</CODE>, <CODE>BZ2_bzflush</CODE>,
-<CODE>BZ2_bzclose</CODE>,
-<CODE>BZ2_bzerror</CODE> and <CODE>BZ2_bzlibVersion</CODE>.
-These functions are not (yet) officially part of
-the library. If they break, you get to keep all the pieces.
-Nevertheless, I think they work ok.
-
-<PRE>
-typedef void BZFILE;
-
-const char * BZ2_bzlibVersion ( void );
-</PRE>
-
-<P>
-Returns a string indicating the library version.
-
-<PRE>
-BZFILE * BZ2_bzopen ( const char *path, const char *mode );
-BZFILE * BZ2_bzdopen ( int fd, const char *mode );
-</PRE>
-
-<P>
-Opens a <CODE>.bz2</CODE> file for reading or writing, using either its name
-or a pre-existing file descriptor.
-Analogous to <CODE>fopen</CODE> and <CODE>fdopen</CODE>.
-
-<PRE>
-int BZ2_bzread ( BZFILE* b, void* buf, int len );
-int BZ2_bzwrite ( BZFILE* b, void* buf, int len );
-</PRE>
-
-<P>
-Reads/writes data from/to a previously opened <CODE>BZFILE</CODE>.
-Analogous to <CODE>fread</CODE> and <CODE>fwrite</CODE>.
-
-<PRE>
-int BZ2_bzflush ( BZFILE* b );
-void BZ2_bzclose ( BZFILE* b );
-</PRE>
-
-<P>
-Flushes/closes a <CODE>BZFILE</CODE>. <CODE>BZ2_bzflush</CODE> doesn't actually do
-anything. Analogous to <CODE>fflush</CODE> and <CODE>fclose</CODE>.
-
-</P>
-
-<PRE>
-const char * BZ2_bzerror ( BZFILE *b, int *errnum )
-</PRE>
-
-<P>
-Returns a string describing the more recent error status of
-<CODE>b</CODE>, and also sets <CODE>*errnum</CODE> to its numerical value.
-
-</P>
-
-
-
-<H2><A NAME="SEC39" HREF="manual_toc.html#TOC39">Using the library in a <CODE>stdio</CODE>-free environment</A></H2>
-
-
-
-<H3><A NAME="SEC40" HREF="manual_toc.html#TOC40">Getting rid of <CODE>stdio</CODE></A></H3>
-
-<P>
-In a deeply embedded application, you might want to use just
-the memory-to-memory functions. You can do this conveniently
-by compiling the library with preprocessor symbol <CODE>BZ_NO_STDIO</CODE>
-defined. Doing this gives you a library containing only the following
-eight functions:
-
-</P>
-<P>
-<CODE>BZ2_bzCompressInit</CODE>, <CODE>BZ2_bzCompress</CODE>, <CODE>BZ2_bzCompressEnd</CODE> <BR>
-<CODE>BZ2_bzDecompressInit</CODE>, <CODE>BZ2_bzDecompress</CODE>, <CODE>BZ2_bzDecompressEnd</CODE> <BR>
-<CODE>BZ2_bzBuffToBuffCompress</CODE>, <CODE>BZ2_bzBuffToBuffDecompress</CODE>
-
-</P>
-<P>
-When compiled like this, all functions will ignore <CODE>verbosity</CODE>
-settings.
-
-</P>
-
-
-<H3><A NAME="SEC41" HREF="manual_toc.html#TOC41">Critical error handling</A></H3>
-<P>
-<CODE>libbzip2</CODE> contains a number of internal assertion checks which
-should, needless to say, never be activated. Nevertheless, if an
-assertion should fail, behaviour depends on whether or not the library
-was compiled with <CODE>BZ_NO_STDIO</CODE> set.
-
-</P>
-<P>
-For a normal compile, an assertion failure yields the message
-
-<PRE>
- bzip2/libbzip2: internal error number N.
- This is a bug in bzip2/libbzip2, 1.0 of 21-Mar-2000.
- Please report it to me at: jseward@acm.org. If this happened
- when you were using some program which uses libbzip2 as a
- component, you should also report this bug to the author(s)
- of that program. Please make an effort to report this bug;
- timely and accurate bug reports eventually lead to higher
- quality software. Thanks. Julian Seward, 21 March 2000.
-</PRE>
-
-<P>
-where <CODE>N</CODE> is some error code number. <CODE>exit(3)</CODE>
-is then called.
-
-</P>
-<P>
-For a <CODE>stdio</CODE>-free library, assertion failures result
-in a call to a function declared as:
-
-<PRE>
- extern void bz_internal_error ( int errcode );
-</PRE>
-
-<P>
-The relevant code is passed as a parameter. You should supply
-such a function.
-
-</P>
-<P>
-In either case, once an assertion failure has occurred, any
-<CODE>bz_stream</CODE> records involved can be regarded as invalid.
-You should not attempt to resume normal operation with them.
-
-</P>
-<P>
-You may, of course, change critical error handling to suit
-your needs. As I said above, critical errors indicate bugs
-in the library and should not occur. All "normal" error
-situations are indicated via error return codes from functions,
-and can be recovered from.
-
-</P>
-
-
-
-<H2><A NAME="SEC42" HREF="manual_toc.html#TOC42">Making a Windows DLL</A></H2>
-<P>
-Everything related to Windows has been contributed by Yoshioka Tsuneo
-<BR> (<CODE>QWF00133@niftyserve.or.jp</CODE> /
-<CODE>tsuneo-y@is.aist-nara.ac.jp</CODE>), so you should send your queries to
-him (but perhaps Cc: me, <CODE>jseward@acm.org</CODE>).
-
-</P>
-<P>
-My vague understanding of what to do is: using Visual C++ 5.0,
-open the project file <CODE>libbz2.dsp</CODE>, and build. That's all.
-
-</P>
-<P>
-If you can't
-open the project file for some reason, make a new one, naming these files:
-<CODE>blocksort.c</CODE>, <CODE>bzlib.c</CODE>, <CODE>compress.c</CODE>,
-<CODE>crctable.c</CODE>, <CODE>decompress.c</CODE>, <CODE>huffman.c</CODE>, <BR>
-<CODE>randtable.c</CODE> and <CODE>libbz2.def</CODE>. You will also need
-to name the header files <CODE>bzlib.h</CODE> and <CODE>bzlib_private.h</CODE>.
-
-</P>
-<P>
-If you don't use VC++, you may need to define the proprocessor symbol
-<CODE>_WIN32</CODE>.
-
-</P>
-<P>
-Finally, <CODE>dlltest.c</CODE> is a sample program using the DLL. It has a
-project file, <CODE>dlltest.dsp</CODE>.
-
-</P>
-<P>
-If you just want a makefile for Visual C, have a look at
-<CODE>makefile.msc</CODE>.
-
-</P>
-<P>
-Be aware that if you compile <CODE>bzip2</CODE> itself on Win32, you must set
-<CODE>BZ_UNIX</CODE> to 0 and <CODE>BZ_LCCWIN32</CODE> to 1, in the file
-<CODE>bzip2.c</CODE>, before compiling. Otherwise the resulting binary won't
-work correctly.
-
-</P>
-<P>
-I haven't tried any of this stuff myself, but it all looks plausible.
-
-</P>
-
-<P><HR><P>
-<p>Go to the <A HREF="manual_1.html">first</A>, <A HREF="manual_2.html">previous</A>, <A HREF="manual_4.html">next</A>, <A HREF="manual_4.html">last</A> section, <A HREF="manual_toc.html">table of contents</A>.
-</BODY>
-</HTML>
diff --git a/winsup/bz2lib/manual_4.html b/winsup/bz2lib/manual_4.html
deleted file mode 100644
index 9ab7fb24f..000000000
--- a/winsup/bz2lib/manual_4.html
+++ /dev/null
@@ -1,528 +0,0 @@
-<HTML>
-<HEAD>
-<!-- This HTML file has been created by texi2html 1.54
- from manual.texi on 23 March 2000 -->
-
-<TITLE>bzip2 and libbzip2 - Miscellanea</TITLE>
-<link href="manual_3.html" rel=Previous>
-<link href="manual_toc.html" rel=ToC>
-
-</HEAD>
-<BODY>
-<p>Go to the <A HREF="manual_1.html">first</A>, <A HREF="manual_3.html">previous</A>, next, last section, <A HREF="manual_toc.html">table of contents</A>.
-<P><HR><P>
-
-
-<H1><A NAME="SEC43" HREF="manual_toc.html#TOC43">Miscellanea</A></H1>
-
-<P>
-These are just some random thoughts of mine. Your mileage may
-vary.
-
-</P>
-
-
-<H2><A NAME="SEC44" HREF="manual_toc.html#TOC44">Limitations of the compressed file format</A></H2>
-<P>
-<CODE>bzip2-1.0</CODE>, <CODE>0.9.5</CODE> and <CODE>0.9.0</CODE>
-use exactly the same file format as the previous
-version, <CODE>bzip2-0.1</CODE>. This decision was made in the interests of
-stability. Creating yet another incompatible compressed file format
-would create further confusion and disruption for users.
-
-</P>
-<P>
-Nevertheless, this is not a painless decision. Development
-work since the release of <CODE>bzip2-0.1</CODE> in August 1997
-has shown complexities in the file format which slow down
-decompression and, in retrospect, are unnecessary. These are:
-
-<UL>
-<LI>The run-length encoder, which is the first of the
-
- compression transformations, is entirely irrelevant.
- The original purpose was to protect the sorting algorithm
- from the very worst case input: a string of repeated
- symbols. But algorithm steps Q6a and Q6b in the original
- Burrows-Wheeler technical report (SRC-124) show how
- repeats can be handled without difficulty in block
- sorting.
-<LI>The randomisation mechanism doesn't really need to be
-
- there. Udi Manber and Gene Myers published a suffix
- array construction algorithm a few years back, which
- can be employed to sort any block, no matter how
- repetitive, in O(N log N) time. Subsequent work by
- Kunihiko Sadakane has produced a derivative O(N (log N)^2)
- algorithm which usually outperforms the Manber-Myers
- algorithm.
-
- I could have changed to Sadakane's algorithm, but I find
- it to be slower than <CODE>bzip2</CODE>'s existing algorithm for
- most inputs, and the randomisation mechanism protects
- adequately against bad cases. I didn't think it was
- a good tradeoff to make. Partly this is due to the fact
- that I was not flooded with email complaints about
- <CODE>bzip2-0.1</CODE>'s performance on repetitive data, so
- perhaps it isn't a problem for real inputs.
-
- Probably the best long-term solution,
- and the one I have incorporated into 0.9.5 and above,
- is to use the existing sorting
- algorithm initially, and fall back to a O(N (log N)^2)
- algorithm if the standard algorithm gets into difficulties.
-<LI>The compressed file format was never designed to be
-
- handled by a library, and I have had to jump though
- some hoops to produce an efficient implementation of
- decompression. It's a bit hairy. Try passing
- <CODE>decompress.c</CODE> through the C preprocessor
- and you'll see what I mean. Much of this complexity
- could have been avoided if the compressed size of
- each block of data was recorded in the data stream.
-<LI>An Adler-32 checksum, rather than a CRC32 checksum,
-
- would be faster to compute.
-</UL>
-
-<P>
-It would be fair to say that the <CODE>bzip2</CODE> format was frozen
-before I properly and fully understood the performance
-consequences of doing so.
-
-</P>
-<P>
-Improvements which I was able to incorporate into
-0.9.0, despite using the same file format, are:
-
-<UL>
-<LI>Single array implementation of the inverse BWT. This
-
- significantly speeds up decompression, presumably
- because it reduces the number of cache misses.
-<LI>Faster inverse MTF transform for large MTF values. The
-
- new implementation is based on the notion of sliding blocks
- of values.
-<LI><CODE>bzip2-0.9.0</CODE> now reads and writes files with <CODE>fread</CODE>
-
- and <CODE>fwrite</CODE>; version 0.1 used <CODE>putc</CODE> and <CODE>getc</CODE>.
- Duh! Well, you live and learn.
-
-</UL>
-
-<P>
-Further ahead, it would be nice
-to be able to do random access into files. This will
-require some careful design of compressed file formats.
-
-</P>
-
-
-
-<H2><A NAME="SEC45" HREF="manual_toc.html#TOC45">Portability issues</A></H2>
-<P>
-After some consideration, I have decided not to use
-GNU <CODE>autoconf</CODE> to configure 0.9.5 or 1.0.
-
-</P>
-<P>
-<CODE>autoconf</CODE>, admirable and wonderful though it is,
-mainly assists with portability problems between Unix-like
-platforms. But <CODE>bzip2</CODE> doesn't have much in the way
-of portability problems on Unix; most of the difficulties appear
-when porting to the Mac, or to Microsoft's operating systems.
-<CODE>autoconf</CODE> doesn't help in those cases, and brings in a
-whole load of new complexity.
-
-</P>
-<P>
-Most people should be able to compile the library and program
-under Unix straight out-of-the-box, so to speak, especially
-if you have a version of GNU C available.
-
-</P>
-<P>
-There are a couple of <CODE>__inline__</CODE> directives in the code. GNU C
-(<CODE>gcc</CODE>) should be able to handle them. If you're not using
-GNU C, your C compiler shouldn't see them at all.
-If your compiler does, for some reason, see them and doesn't
-like them, just <CODE>#define</CODE> <CODE>__inline__</CODE> to be <CODE>/* */</CODE>. One
-easy way to do this is to compile with the flag <CODE>-D__inline__=</CODE>,
-which should be understood by most Unix compilers.
-
-</P>
-<P>
-If you still have difficulties, try compiling with the macro
-<CODE>BZ_STRICT_ANSI</CODE> defined. This should enable you to build the
-library in a strictly ANSI compliant environment. Building the program
-itself like this is dangerous and not supported, since you remove
-<CODE>bzip2</CODE>'s checks against compressing directories, symbolic links,
-devices, and other not-really-a-file entities. This could cause
-filesystem corruption!
-
-</P>
-<P>
-One other thing: if you create a <CODE>bzip2</CODE> binary for public
-distribution, please try and link it statically (<CODE>gcc -s</CODE>). This
-avoids all sorts of library-version issues that others may encounter
-later on.
-
-</P>
-<P>
-If you build <CODE>bzip2</CODE> on Win32, you must set <CODE>BZ_UNIX</CODE> to 0 and
-<CODE>BZ_LCCWIN32</CODE> to 1, in the file <CODE>bzip2.c</CODE>, before compiling.
-Otherwise the resulting binary won't work correctly.
-
-</P>
-
-
-
-<H2><A NAME="SEC46" HREF="manual_toc.html#TOC46">Reporting bugs</A></H2>
-<P>
-I tried pretty hard to make sure <CODE>bzip2</CODE> is
-bug free, both by design and by testing. Hopefully
-you'll never need to read this section for real.
-
-</P>
-<P>
-Nevertheless, if <CODE>bzip2</CODE> dies with a segmentation
-fault, a bus error or an internal assertion failure, it
-will ask you to email me a bug report. Experience with
-version 0.1 shows that almost all these problems can
-be traced to either compiler bugs or hardware problems.
-
-<UL>
-<LI>
-
-Recompile the program with no optimisation, and see if it
-works. And/or try a different compiler.
-I heard all sorts of stories about various flavours
-of GNU C (and other compilers) generating bad code for
-<CODE>bzip2</CODE>, and I've run across two such examples myself.
-
-2.7.X versions of GNU C are known to generate bad code from
-time to time, at high optimisation levels.
-If you get problems, try using the flags
-<CODE>-O2</CODE> <CODE>-fomit-frame-pointer</CODE> <CODE>-fno-strength-reduce</CODE>.
-You should specifically <EM>not</EM> use <CODE>-funroll-loops</CODE>.
-
-You may notice that the Makefile runs six tests as part of
-the build process. If the program passes all of these, it's
-a pretty good (but not 100%) indication that the compiler has
-done its job correctly.
-<LI>
-
-If <CODE>bzip2</CODE> crashes randomly, and the crashes are not
-repeatable, you may have a flaky memory subsystem. <CODE>bzip2</CODE>
-really hammers your memory hierarchy, and if it's a bit marginal,
-you may get these problems. Ditto if your disk or I/O subsystem
-is slowly failing. Yup, this really does happen.
-
-Try using a different machine of the same type, and see if
-you can repeat the problem.
-<LI>This isn't really a bug, but ... If <CODE>bzip2</CODE> tells
-
-you your file is corrupted on decompression, and you
-obtained the file via FTP, there is a possibility that you
-forgot to tell FTP to do a binary mode transfer. That absolutely
-will cause the file to be non-decompressible. You'll have to transfer
-it again.
-</UL>
-
-<P>
-If you've incorporated <CODE>libbzip2</CODE> into your own program
-and are getting problems, please, please, please, check that the
-parameters you are passing in calls to the library, are
-correct, and in accordance with what the documentation says
-is allowable. I have tried to make the library robust against
-such problems, but I'm sure I haven't succeeded.
-
-</P>
-<P>
-Finally, if the above comments don't help, you'll have to send
-me a bug report. Now, it's just amazing how many people will
-send me a bug report saying something like
-
-<PRE>
- bzip2 crashed with segmentation fault on my machine
-</PRE>
-
-<P>
-and absolutely nothing else. Needless to say, a such a report
-is <EM>totally, utterly, completely and comprehensively 100% useless;
-a waste of your time, my time, and net bandwidth</EM>.
-With no details at all, there's no way I can possibly begin
-to figure out what the problem is.
-
-</P>
-<P>
-The rules of the game are: facts, facts, facts. Don't omit
-them because "oh, they won't be relevant". At the bare
-minimum:
-
-<PRE>
- Machine type. Operating system version.
- Exact version of <CODE>bzip2</CODE> (do <CODE>bzip2 -V</CODE>).
- Exact version of the compiler used.
- Flags passed to the compiler.
-</PRE>
-
-<P>
-However, the most important single thing that will help me is
-the file that you were trying to compress or decompress at the
-time the problem happened. Without that, my ability to do anything
-more than speculate about the cause, is limited.
-
-</P>
-<P>
-Please remember that I connect to the Internet with a modem, so
-you should contact me before mailing me huge files.
-
-</P>
-
-
-
-<H2><A NAME="SEC47" HREF="manual_toc.html#TOC47">Did you get the right package?</A></H2>
-
-<P>
-<CODE>bzip2</CODE> is a resource hog. It soaks up large amounts of CPU cycles
-and memory. Also, it gives very large latencies. In the worst case, you
-can feed many megabytes of uncompressed data into the library before
-getting any compressed output, so this probably rules out applications
-requiring interactive behaviour.
-
-</P>
-<P>
-These aren't faults of my implementation, I hope, but more
-an intrinsic property of the Burrows-Wheeler transform (unfortunately).
-Maybe this isn't what you want.
-
-</P>
-<P>
-If you want a compressor and/or library which is faster, uses less
-memory but gets pretty good compression, and has minimal latency,
-consider Jean-loup
-Gailly's and Mark Adler's work, <CODE>zlib-1.1.2</CODE> and
-<CODE>gzip-1.2.4</CODE>. Look for them at
-
-</P>
-<P>
-<CODE>http://www.cdrom.com/pub/infozip/zlib</CODE> and
-<CODE>http://www.gzip.org</CODE> respectively.
-
-</P>
-<P>
-For something faster and lighter still, you might try Markus F X J
-Oberhumer's <CODE>LZO</CODE> real-time compression/decompression library, at
-<BR> <CODE>http://wildsau.idv.uni-linz.ac.at/mfx/lzo.html</CODE>.
-
-</P>
-<P>
-If you want to use the <CODE>bzip2</CODE> algorithms to compress small blocks
-of data, 64k bytes or smaller, for example on an on-the-fly disk
-compressor, you'd be well advised not to use this library. Instead,
-I've made a special library tuned for that kind of use. It's part of
-<CODE>e2compr-0.40</CODE>, an on-the-fly disk compressor for the Linux
-<CODE>ext2</CODE> filesystem. Look at
-<CODE>http://www.netspace.net.au/~reiter/e2compr</CODE>.
-
-</P>
-
-
-
-<H2><A NAME="SEC48" HREF="manual_toc.html#TOC48">Testing</A></H2>
-
-<P>
-A record of the tests I've done.
-
-</P>
-<P>
-First, some data sets:
-
-<UL>
-<LI>B: a directory containing 6001 files, one for every length in the
-
- range 0 to 6000 bytes. The files contain random lowercase
- letters. 18.7 megabytes.
-<LI>H: my home directory tree. Documents, source code, mail files,
-
- compressed data. H contains B, and also a directory of
- files designed as boundary cases for the sorting; mostly very
- repetitive, nasty files. 565 megabytes.
-<LI>A: directory tree holding various applications built from source:
-
- <CODE>egcs</CODE>, <CODE>gcc-2.8.1</CODE>, KDE, GTK, Octave, etc.
- 2200 megabytes.
-</UL>
-
-<P>
-The tests conducted are as follows. Each test means compressing
-(a copy of) each file in the data set, decompressing it and
-comparing it against the original.
-
-</P>
-<P>
-First, a bunch of tests with block sizes and internal buffer
-sizes set very small,
-to detect any problems with the
-blocking and buffering mechanisms.
-This required modifying the source code so as to try to
-break it.
-
-<OL>
-<LI>Data set H, with
-
- buffer size of 1 byte, and block size of 23 bytes.
-<LI>Data set B, buffer sizes 1 byte, block size 1 byte.
-
-<LI>As (2) but small-mode decompression.
-
-<LI>As (2) with block size 2 bytes.
-
-<LI>As (2) with block size 3 bytes.
-
-<LI>As (2) with block size 4 bytes.
-
-<LI>As (2) with block size 5 bytes.
-
-<LI>As (2) with block size 6 bytes and small-mode decompression.
-
-<LI>H with buffer size of 1 byte, but normal block
-
- size (up to 900000 bytes).
-</OL>
-
-<P>
-Then some tests with unmodified source code.
-
-<OL>
-<LI>H, all settings normal.
-
-<LI>As (1), with small-mode decompress.
-
-<LI>H, compress with flag <CODE>-1</CODE>.
-
-<LI>H, compress with flag <CODE>-s</CODE>, decompress with flag <CODE>-s</CODE>.
-
-<LI>Forwards compatibility: H, <CODE>bzip2-0.1pl2</CODE> compressing,
-
- <CODE>bzip2-0.9.5</CODE> decompressing, all settings normal.
-<LI>Backwards compatibility: H, <CODE>bzip2-0.9.5</CODE> compressing,
-
- <CODE>bzip2-0.1pl2</CODE> decompressing, all settings normal.
-<LI>Bigger tests: A, all settings normal.
-
-<LI>As (7), using the fallback (Sadakane-like) sorting algorithm.
-
-<LI>As (8), compress with flag <CODE>-1</CODE>, decompress with flag
-
- <CODE>-s</CODE>.
-<LI>H, using the fallback sorting algorithm.
-
-<LI>Forwards compatibility: A, <CODE>bzip2-0.1pl2</CODE> compressing,
-
- <CODE>bzip2-0.9.5</CODE> decompressing, all settings normal.
-<LI>Backwards compatibility: A, <CODE>bzip2-0.9.5</CODE> compressing,
-
- <CODE>bzip2-0.1pl2</CODE> decompressing, all settings normal.
-<LI>Misc test: about 400 megabytes of <CODE>.tar</CODE> files with
-
- <CODE>bzip2</CODE> compiled with Checker (a memory access error
- detector, like Purify).
-<LI>Misc tests to make sure it builds and runs ok on non-Linux/x86
-
- platforms.
-</OL>
-
-<P>
-These tests were conducted on a 225 MHz IDT WinChip machine, running
-Linux 2.0.36. They represent nearly a week of continuous computation.
-All tests completed successfully.
-
-</P>
-
-
-
-<H2><A NAME="SEC49" HREF="manual_toc.html#TOC49">Further reading</A></H2>
-<P>
-<CODE>bzip2</CODE> is not research work, in the sense that it doesn't present
-any new ideas. Rather, it's an engineering exercise based on existing
-ideas.
-
-</P>
-<P>
-Four documents describe essentially all the ideas behind <CODE>bzip2</CODE>:
-
-<PRE>
-Michael Burrows and D. J. Wheeler:
- "A block-sorting lossless data compression algorithm"
- 10th May 1994.
- Digital SRC Research Report 124.
- ftp://ftp.digital.com/pub/DEC/SRC/research-reports/SRC-124.ps.gz
- If you have trouble finding it, try searching at the
- New Zealand Digital Library, http://www.nzdl.org.
-
-Daniel S. Hirschberg and Debra A. LeLewer
- "Efficient Decoding of Prefix Codes"
- Communications of the ACM, April 1990, Vol 33, Number 4.
- You might be able to get an electronic copy of this
- from the ACM Digital Library.
-
-David J. Wheeler
- Program bred3.c and accompanying document bred3.ps.
- This contains the idea behind the multi-table Huffman
- coding scheme.
- ftp://ftp.cl.cam.ac.uk/users/djw3/
-
-Jon L. Bentley and Robert Sedgewick
- "Fast Algorithms for Sorting and Searching Strings"
- Available from Sedgewick's web page,
- www.cs.princeton.edu/~rs
-</PRE>
-
-<P>
-The following paper gives valuable additional insights into the
-algorithm, but is not immediately the basis of any code
-used in bzip2.
-
-<PRE>
-Peter Fenwick:
- Block Sorting Text Compression
- Proceedings of the 19th Australasian Computer Science Conference,
- Melbourne, Australia. Jan 31 - Feb 2, 1996.
- ftp://ftp.cs.auckland.ac.nz/pub/peter-f/ACSC96paper.ps
-</PRE>
-
-<P>
-Kunihiko Sadakane's sorting algorithm, mentioned above,
-is available from:
-
-<PRE>
-http://naomi.is.s.u-tokyo.ac.jp/~sada/papers/Sada98b.ps.gz
-</PRE>
-
-<P>
-The Manber-Myers suffix array construction
-algorithm is described in a paper
-available from:
-
-<PRE>
-http://www.cs.arizona.edu/people/gene/PAPERS/suffix.ps
-</PRE>
-
-<P>
-Finally, the following paper documents some recent investigations
-I made into the performance of sorting algorithms:
-
-<PRE>
-Julian Seward:
- On the Performance of BWT Sorting Algorithms
- Proceedings of the IEEE Data Compression Conference 2000
- Snowbird, Utah. 28-30 March 2000.
-</PRE>
-
-<P><HR><P>
-<p>Go to the <A HREF="manual_1.html">first</A>, <A HREF="manual_3.html">previous</A>, next, last section, <A HREF="manual_toc.html">table of contents</A>.
-</BODY>
-</HTML>
diff --git a/winsup/bz2lib/manual_toc.html b/winsup/bz2lib/manual_toc.html
deleted file mode 100644
index d4132c435..000000000
--- a/winsup/bz2lib/manual_toc.html
+++ /dev/null
@@ -1,173 +0,0 @@
-<HTML>
-<HEAD>
-<!-- This HTML file has been created by texi2html 1.54
- from manual.texi on 23 March 2000 -->
-
-<TITLE>bzip2 and libbzip2 - Table of Contents</TITLE>
-
-</HEAD>
-<BODY>
-<H1>bzip2 and libbzip2</H1>
-<H2>a program and library for data compression</H2>
-<H2>copyright (C) 1996-2000 Julian Seward</H2>
-<H2>version 1.0 of 21 March 2000</H2>
-<ADDRESS>Julian Seward</ADDRESS>
-<P>
-<P><HR><P>
-
-<P>
-This program, <CODE>bzip2</CODE>,
-and associated library <CODE>libbzip2</CODE>, are
-Copyright (C) 1996-2000 Julian R Seward. All rights reserved.
-
-</P>
-<P>
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-<UL>
-<LI>
-
- Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-<LI>
-
- The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-<LI>
-
- Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-<LI>
-
- The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-</UL>
-
-<P>
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR "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 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.
-
-</P>
-<P>
-Julian Seward, Cambridge, UK.
-
-</P>
-<P>
-<CODE>jseward@acm.org</CODE>
-
-</P>
-<P>
-<CODE>http://sourceware.cygnus.com/bzip2</CODE>
-
-</P>
-<P>
-<CODE>http://www.cacheprof.org</CODE>
-
-</P>
-<P>
-<CODE>http://www.muraroa.demon.co.uk</CODE>
-
-</P>
-<P>
-<CODE>bzip2</CODE>/<CODE>libbzip2</CODE> version 1.0 of 21 March 2000.
-
-</P>
-<P>
-PATENTS: To the best of my knowledge, <CODE>bzip2</CODE> does not use any patented
-algorithms. However, I do not have the resources available to carry out
-a full patent search. Therefore I cannot give any guarantee of the
-above statement.
-
-</P>
-
-<UL>
-<LI><A NAME="TOC1" HREF="manual_1.html#SEC1">Introduction</A>
-<LI><A NAME="TOC2" HREF="manual_2.html#SEC2">How to use <CODE>bzip2</CODE></A>
-<UL>
-<UL>
-<UL>
-<LI><A NAME="TOC3" HREF="manual_2.html#SEC3">NAME</A>
-<LI><A NAME="TOC4" HREF="manual_2.html#SEC4">SYNOPSIS</A>
-<LI><A NAME="TOC5" HREF="manual_2.html#SEC5">DESCRIPTION</A>
-<LI><A NAME="TOC6" HREF="manual_2.html#SEC6">OPTIONS</A>
-<LI><A NAME="TOC7" HREF="manual_2.html#SEC7">MEMORY MANAGEMENT</A>
-<LI><A NAME="TOC8" HREF="manual_2.html#SEC8">RECOVERING DATA FROM DAMAGED FILES</A>
-<LI><A NAME="TOC9" HREF="manual_2.html#SEC9">PERFORMANCE NOTES</A>
-<LI><A NAME="TOC10" HREF="manual_2.html#SEC10">CAVEATS</A>
-<LI><A NAME="TOC11" HREF="manual_2.html#SEC11">AUTHOR</A>
-</UL>
-</UL>
-</UL>
-<LI><A NAME="TOC12" HREF="manual_3.html#SEC12">Programming with <CODE>libbzip2</CODE></A>
-<UL>
-<LI><A NAME="TOC13" HREF="manual_3.html#SEC13">Top-level structure</A>
-<UL>
-<LI><A NAME="TOC14" HREF="manual_3.html#SEC14">Low-level summary</A>
-<LI><A NAME="TOC15" HREF="manual_3.html#SEC15">High-level summary</A>
-<LI><A NAME="TOC16" HREF="manual_3.html#SEC16">Utility functions summary</A>
-</UL>
-<LI><A NAME="TOC17" HREF="manual_3.html#SEC17">Error handling</A>
-<LI><A NAME="TOC18" HREF="manual_3.html#SEC18">Low-level interface</A>
-<UL>
-<LI><A NAME="TOC19" HREF="manual_3.html#SEC19"><CODE>BZ2_bzCompressInit</CODE></A>
-<LI><A NAME="TOC20" HREF="manual_3.html#SEC20"><CODE>BZ2_bzCompress</CODE></A>
-<LI><A NAME="TOC21" HREF="manual_3.html#SEC21"><CODE>BZ2_bzCompressEnd</CODE></A>
-<LI><A NAME="TOC22" HREF="manual_3.html#SEC22"><CODE>BZ2_bzDecompressInit</CODE></A>
-<LI><A NAME="TOC23" HREF="manual_3.html#SEC23"><CODE>BZ2_bzDecompress</CODE></A>
-<LI><A NAME="TOC24" HREF="manual_3.html#SEC24"><CODE>BZ2_bzDecompressEnd</CODE></A>
-</UL>
-<LI><A NAME="TOC25" HREF="manual_3.html#SEC25">High-level interface</A>
-<UL>
-<LI><A NAME="TOC26" HREF="manual_3.html#SEC26"><CODE>BZ2_bzReadOpen</CODE></A>
-<LI><A NAME="TOC27" HREF="manual_3.html#SEC27"><CODE>BZ2_bzRead</CODE></A>
-<LI><A NAME="TOC28" HREF="manual_3.html#SEC28"><CODE>BZ2_bzReadGetUnused</CODE></A>
-<LI><A NAME="TOC29" HREF="manual_3.html#SEC29"><CODE>BZ2_bzReadClose</CODE></A>
-<LI><A NAME="TOC30" HREF="manual_3.html#SEC30"><CODE>BZ2_bzWriteOpen</CODE></A>
-<LI><A NAME="TOC31" HREF="manual_3.html#SEC31"><CODE>BZ2_bzWrite</CODE></A>
-<LI><A NAME="TOC32" HREF="manual_3.html#SEC32"><CODE>BZ2_bzWriteClose</CODE></A>
-<LI><A NAME="TOC33" HREF="manual_3.html#SEC33">Handling embedded compressed data streams</A>
-<LI><A NAME="TOC34" HREF="manual_3.html#SEC34">Standard file-reading/writing code</A>
-</UL>
-<LI><A NAME="TOC35" HREF="manual_3.html#SEC35">Utility functions</A>
-<UL>
-<LI><A NAME="TOC36" HREF="manual_3.html#SEC36"><CODE>BZ2_bzBuffToBuffCompress</CODE></A>
-<LI><A NAME="TOC37" HREF="manual_3.html#SEC37"><CODE>BZ2_bzBuffToBuffDecompress</CODE></A>
-</UL>
-<LI><A NAME="TOC38" HREF="manual_3.html#SEC38"><CODE>zlib</CODE> compatibility functions</A>
-<LI><A NAME="TOC39" HREF="manual_3.html#SEC39">Using the library in a <CODE>stdio</CODE>-free environment</A>
-<UL>
-<LI><A NAME="TOC40" HREF="manual_3.html#SEC40">Getting rid of <CODE>stdio</CODE></A>
-<LI><A NAME="TOC41" HREF="manual_3.html#SEC41">Critical error handling</A>
-</UL>
-<LI><A NAME="TOC42" HREF="manual_3.html#SEC42">Making a Windows DLL</A>
-</UL>
-<LI><A NAME="TOC43" HREF="manual_4.html#SEC43">Miscellanea</A>
-<UL>
-<LI><A NAME="TOC44" HREF="manual_4.html#SEC44">Limitations of the compressed file format</A>
-<LI><A NAME="TOC45" HREF="manual_4.html#SEC45">Portability issues</A>
-<LI><A NAME="TOC46" HREF="manual_4.html#SEC46">Reporting bugs</A>
-<LI><A NAME="TOC47" HREF="manual_4.html#SEC47">Did you get the right package?</A>
-<LI><A NAME="TOC48" HREF="manual_4.html#SEC48">Testing</A>
-<LI><A NAME="TOC49" HREF="manual_4.html#SEC49">Further reading</A>
-</UL>
-</UL>
-<P><HR><P>
-This document was generated on 23 March 2000 using the
-<A HREF="http://wwwcn.cern.ch/dci/texi2html/">texi2html</A>
-translator version 1.51a.</P>
-</BODY>
-</HTML>
diff --git a/winsup/bz2lib/randtable.c b/winsup/bz2lib/randtable.c
deleted file mode 100644
index 983089d46..000000000
--- a/winsup/bz2lib/randtable.c
+++ /dev/null
@@ -1,124 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Table for randomising repetitive blocks ---*/
-/*--- randtable.c ---*/
-/*-------------------------------------------------------------*/
-
-/*--
- This file is a part of bzip2 and/or libbzip2, a program and
- library for lossless, block-sorting data compression.
-
- Copyright (C) 1996-2000 Julian R Seward. 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. The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 3. Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-
- 4. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
-
- Julian Seward, Cambridge, UK.
- jseward@acm.org
- bzip2/libbzip2 version 1.0 of 21 March 2000
-
- This program is based on (at least) the work of:
- Mike Burrows
- David Wheeler
- Peter Fenwick
- Alistair Moffat
- Radford Neal
- Ian H. Witten
- Robert Sedgewick
- Jon L. Bentley
-
- For more information on these sources, see the manual.
---*/
-
-
-#include "bzlib_private.h"
-
-
-/*---------------------------------------------*/
-Int32 BZ2_rNums[512] = {
- 619, 720, 127, 481, 931, 816, 813, 233, 566, 247,
- 985, 724, 205, 454, 863, 491, 741, 242, 949, 214,
- 733, 859, 335, 708, 621, 574, 73, 654, 730, 472,
- 419, 436, 278, 496, 867, 210, 399, 680, 480, 51,
- 878, 465, 811, 169, 869, 675, 611, 697, 867, 561,
- 862, 687, 507, 283, 482, 129, 807, 591, 733, 623,
- 150, 238, 59, 379, 684, 877, 625, 169, 643, 105,
- 170, 607, 520, 932, 727, 476, 693, 425, 174, 647,
- 73, 122, 335, 530, 442, 853, 695, 249, 445, 515,
- 909, 545, 703, 919, 874, 474, 882, 500, 594, 612,
- 641, 801, 220, 162, 819, 984, 589, 513, 495, 799,
- 161, 604, 958, 533, 221, 400, 386, 867, 600, 782,
- 382, 596, 414, 171, 516, 375, 682, 485, 911, 276,
- 98, 553, 163, 354, 666, 933, 424, 341, 533, 870,
- 227, 730, 475, 186, 263, 647, 537, 686, 600, 224,
- 469, 68, 770, 919, 190, 373, 294, 822, 808, 206,
- 184, 943, 795, 384, 383, 461, 404, 758, 839, 887,
- 715, 67, 618, 276, 204, 918, 873, 777, 604, 560,
- 951, 160, 578, 722, 79, 804, 96, 409, 713, 940,
- 652, 934, 970, 447, 318, 353, 859, 672, 112, 785,
- 645, 863, 803, 350, 139, 93, 354, 99, 820, 908,
- 609, 772, 154, 274, 580, 184, 79, 626, 630, 742,
- 653, 282, 762, 623, 680, 81, 927, 626, 789, 125,
- 411, 521, 938, 300, 821, 78, 343, 175, 128, 250,
- 170, 774, 972, 275, 999, 639, 495, 78, 352, 126,
- 857, 956, 358, 619, 580, 124, 737, 594, 701, 612,
- 669, 112, 134, 694, 363, 992, 809, 743, 168, 974,
- 944, 375, 748, 52, 600, 747, 642, 182, 862, 81,
- 344, 805, 988, 739, 511, 655, 814, 334, 249, 515,
- 897, 955, 664, 981, 649, 113, 974, 459, 893, 228,
- 433, 837, 553, 268, 926, 240, 102, 654, 459, 51,
- 686, 754, 806, 760, 493, 403, 415, 394, 687, 700,
- 946, 670, 656, 610, 738, 392, 760, 799, 887, 653,
- 978, 321, 576, 617, 626, 502, 894, 679, 243, 440,
- 680, 879, 194, 572, 640, 724, 926, 56, 204, 700,
- 707, 151, 457, 449, 797, 195, 791, 558, 945, 679,
- 297, 59, 87, 824, 713, 663, 412, 693, 342, 606,
- 134, 108, 571, 364, 631, 212, 174, 643, 304, 329,
- 343, 97, 430, 751, 497, 314, 983, 374, 822, 928,
- 140, 206, 73, 263, 980, 736, 876, 478, 430, 305,
- 170, 514, 364, 692, 829, 82, 855, 953, 676, 246,
- 369, 970, 294, 750, 807, 827, 150, 790, 288, 923,
- 804, 378, 215, 828, 592, 281, 565, 555, 710, 82,
- 896, 831, 547, 261, 524, 462, 293, 465, 502, 56,
- 661, 821, 976, 991, 658, 869, 905, 758, 745, 193,
- 768, 550, 608, 933, 378, 286, 215, 979, 792, 961,
- 61, 688, 793, 644, 986, 403, 106, 366, 905, 644,
- 372, 567, 466, 434, 645, 210, 389, 550, 919, 135,
- 780, 773, 635, 389, 707, 100, 626, 958, 165, 504,
- 920, 176, 193, 713, 857, 265, 203, 50, 668, 108,
- 645, 990, 626, 197, 510, 357, 358, 850, 858, 364,
- 936, 638
-};
-
-
-/*-------------------------------------------------------------*/
-/*--- end randtable.c ---*/
-/*-------------------------------------------------------------*/
diff --git a/winsup/bz2lib/sample1.bz2 b/winsup/bz2lib/sample1.bz2
deleted file mode 100644
index 18dea6004..000000000
--- a/winsup/bz2lib/sample1.bz2
+++ /dev/null
Binary files differ
diff --git a/winsup/bz2lib/sample1.ref b/winsup/bz2lib/sample1.ref
deleted file mode 100644
index a56e52b77..000000000
--- a/winsup/bz2lib/sample1.ref
+++ /dev/null
Binary files differ
diff --git a/winsup/bz2lib/sample2.bz2 b/winsup/bz2lib/sample2.bz2
deleted file mode 100644
index d5a6160ba..000000000
--- a/winsup/bz2lib/sample2.bz2
+++ /dev/null
Binary files differ
diff --git a/winsup/bz2lib/sample2.ref b/winsup/bz2lib/sample2.ref
deleted file mode 100644
index 34af95839..000000000
--- a/winsup/bz2lib/sample2.ref
+++ /dev/null
Binary files differ
diff --git a/winsup/bz2lib/sample3.bz2 b/winsup/bz2lib/sample3.bz2
deleted file mode 100644
index d90cff920..000000000
--- a/winsup/bz2lib/sample3.bz2
+++ /dev/null
Binary files differ
diff --git a/winsup/bz2lib/sample3.ref b/winsup/bz2lib/sample3.ref
deleted file mode 100644
index 775a2f68e..000000000
--- a/winsup/bz2lib/sample3.ref
+++ /dev/null
@@ -1,30007 +0,0 @@
-This file is exceedingly boring. If you find yourself
-reading it, please (1) take it from me that you can safely
-guess what the rest of the file says, and (2) seek professional
-help.
-
-ps. there are no further sarcastic remarks in this file.
-
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
-ugh
diff --git a/winsup/bz2lib/spewG.c b/winsup/bz2lib/spewG.c
deleted file mode 100644
index 7934e7658..000000000
--- a/winsup/bz2lib/spewG.c
+++ /dev/null
@@ -1,39 +0,0 @@
-
-/* spew out a thoroughly gigantic file designed so that bzip2
- can compress it reasonably rapidly. This is to help test
- support for large files (> 2GB) in a reasonable amount of time.
- I suggest you use the undocumented --exponential option to
- bzip2 when compressing the resulting file; this saves a bit of
- time. Note: *don't* bother with --exponential when compressing
- Real Files; it'll just waste a lot of CPU time :-)
- (but is otherwise harmless).
-*/
-
-#define _FILE_OFFSET_BITS 64
-
-#include <stdio.h>
-#include <stdlib.h>
-
-/* The number of megabytes of junk to spew out (roughly) */
-#define MEGABYTES 5000
-
-#define N_BUF 1000000
-char buf[N_BUF];
-
-int main ( int argc, char** argv )
-{
- int ii, kk, p;
- srandom(1);
- setbuffer ( stdout, buf, N_BUF );
- for (kk = 0; kk < MEGABYTES * 515; kk+=3) {
- p = 25+random()%50;
- for (ii = 0; ii < p; ii++)
- printf ( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" );
- for (ii = 0; ii < p-1; ii++)
- printf ( "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" );
- for (ii = 0; ii < p+1; ii++)
- printf ( "ccccccccccccccccccccccccccccccccccccc" );
- }
- fflush(stdout);
- return 0;
-}
diff --git a/winsup/bz2lib/unzcrash.c b/winsup/bz2lib/unzcrash.c
deleted file mode 100644
index f0f17fcca..000000000
--- a/winsup/bz2lib/unzcrash.c
+++ /dev/null
@@ -1,126 +0,0 @@
-
-/* A test program written to test robustness to decompression of
- corrupted data. Usage is
- unzcrash filename
- and the program will read the specified file, compress it (in memory),
- and then repeatedly decompress it, each time with a different bit of
- the compressed data inverted, so as to test all possible one-bit errors.
- This should not cause any invalid memory accesses. If it does,
- I want to know about it!
-
- p.s. As you can see from the above description, the process is
- incredibly slow. A file of size eg 5KB will cause it to run for
- many hours.
-*/
-
-#include <stdio.h>
-#include <assert.h>
-#include "bzlib.h"
-
-#define M_BLOCK 1000000
-
-typedef unsigned char uchar;
-
-#define M_BLOCK_OUT (M_BLOCK + 1000000)
-uchar inbuf[M_BLOCK];
-uchar outbuf[M_BLOCK_OUT];
-uchar zbuf[M_BLOCK + 600 + (M_BLOCK / 100)];
-
-int nIn, nOut, nZ;
-
-static char *bzerrorstrings[] = {
- "OK"
- ,"SEQUENCE_ERROR"
- ,"PARAM_ERROR"
- ,"MEM_ERROR"
- ,"DATA_ERROR"
- ,"DATA_ERROR_MAGIC"
- ,"IO_ERROR"
- ,"UNEXPECTED_EOF"
- ,"OUTBUFF_FULL"
- ,"???" /* for future */
- ,"???" /* for future */
- ,"???" /* for future */
- ,"???" /* for future */
- ,"???" /* for future */
- ,"???" /* for future */
-};
-
-void flip_bit ( int bit )
-{
- int byteno = bit / 8;
- int bitno = bit % 8;
- uchar mask = 1 << bitno;
- //fprintf ( stderr, "(byte %d bit %d mask %d)",
- // byteno, bitno, (int)mask );
- zbuf[byteno] ^= mask;
-}
-
-int main ( int argc, char** argv )
-{
- FILE* f;
- int r;
- int bit;
- int i;
-
- if (argc != 2) {
- fprintf ( stderr, "usage: unzcrash filename\n" );
- return 1;
- }
-
- f = fopen ( argv[1], "r" );
- if (!f) {
- fprintf ( stderr, "unzcrash: can't open %s\n", argv[1] );
- return 1;
- }
-
- nIn = fread ( inbuf, 1, M_BLOCK, f );
- fprintf ( stderr, "%d bytes read\n", nIn );
-
- nZ = M_BLOCK;
- r = BZ2_bzBuffToBuffCompress (
- zbuf, &nZ, inbuf, nIn, 9, 0, 30 );
-
- assert (r == BZ_OK);
- fprintf ( stderr, "%d after compression\n", nZ );
-
- for (bit = 0; bit < nZ*8; bit++) {
- fprintf ( stderr, "bit %d ", bit );
- flip_bit ( bit );
- nOut = M_BLOCK_OUT;
- r = BZ2_bzBuffToBuffDecompress (
- outbuf, &nOut, zbuf, nZ, 0, 0 );
- fprintf ( stderr, " %d %s ", r, bzerrorstrings[-r] );
-
- if (r != BZ_OK) {
- fprintf ( stderr, "\n" );
- } else {
- if (nOut != nIn) {
- fprintf(stderr, "nIn/nOut mismatch %d %d\n", nIn, nOut );
- return 1;
- } else {
- for (i = 0; i < nOut; i++)
- if (inbuf[i] != outbuf[i]) {
- fprintf(stderr, "mismatch at %d\n", i );
- return 1;
- }
- if (i == nOut) fprintf(stderr, "really ok!\n" );
- }
- }
-
- flip_bit ( bit );
- }
-
-#if 0
- assert (nOut == nIn);
- for (i = 0; i < nOut; i++) {
- if (inbuf[i] != outbuf[i]) {
- fprintf ( stderr, "difference at %d !\n", i );
- return 1;
- }
- }
-#endif
-
- fprintf ( stderr, "all ok\n" );
- return 0;
-}
diff --git a/winsup/bz2lib/words0 b/winsup/bz2lib/words0
deleted file mode 100644
index 164a8ed28..000000000
--- a/winsup/bz2lib/words0
+++ /dev/null
@@ -1,5 +0,0 @@
-
-If compilation produces errors, or a large number of warnings,
-please read README.COMPILATION.PROBLEMS -- you might be able to
-adjust the flags in this Makefile to improve matters.
-
diff --git a/winsup/bz2lib/words1 b/winsup/bz2lib/words1
deleted file mode 100644
index 2e83de9f0..000000000
--- a/winsup/bz2lib/words1
+++ /dev/null
@@ -1,4 +0,0 @@
-
-Doing 6 tests (3 compress, 3 uncompress) ...
-If there's a problem, things might stop at this point.
-
diff --git a/winsup/bz2lib/words2 b/winsup/bz2lib/words2
deleted file mode 100644
index 203ee39c4..000000000
--- a/winsup/bz2lib/words2
+++ /dev/null
@@ -1,5 +0,0 @@
-
-Checking test results. If any of the four "cmp"s which follow
-report any differences, something is wrong. If you can't easily
-figure out what, please let me know (jseward@acm.org).
-
diff --git a/winsup/bz2lib/words3 b/winsup/bz2lib/words3
deleted file mode 100644
index 8486a84c8..000000000
--- a/winsup/bz2lib/words3
+++ /dev/null
@@ -1,23 +0,0 @@
-
-If you got this far and the "cmp"s didn't complain, it looks
-like you're in business.
-
-To install in /usr/bin, /usr/lib, /usr/man and /usr/include, type
- make install
-To install somewhere else, eg, /xxx/yyy/{bin,lib,man,include}, type
- make install PREFIX=/xxx/yyy
-If you are (justifiably) paranoid and want to see what 'make install'
-is going to do, you can first do
- make -n install or
- make -n install PREFIX=/xxx/yyy respectively.
-The -n instructs make to show the commands it would execute, but
-not actually execute them.
-
-Instructions for use are in the preformatted manual page, in the file
-bzip2.txt. For more detailed documentation, read the full manual.
-It is available in Postscript form (manual.ps) and HTML form
-(manual_toc.html).
-
-You can also do "bzip2 --help" to see some helpful information.
-"bzip2 -L" displays the software license.
-
diff --git a/winsup/configure b/winsup/configure
deleted file mode 100755
index 218c163ea..000000000
--- a/winsup/configure
+++ /dev/null
@@ -1,1332 +0,0 @@
-#! /bin/sh
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-
-# Defaults:
-ac_help=
-ac_default_prefix=/usr/local
-# Any additions from configure.in:
-
-# Initialize some variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
-exec_prefix=NONE
-host=NONE
-no_create=
-nonopt=NONE
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-target=NONE
-verbose=
-x_includes=NONE
-x_libraries=NONE
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
-ac_prev=
-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=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case "$ac_option" in
-
- -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 ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$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" ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir="$ac_optarg" ;;
-
- -disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_${ac_feature}='$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)
- # 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 << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --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
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host="$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" ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- 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)
- 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" ;;
-
- -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 ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
- exit 0 ;;
-
- -with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "with_${ac_package}='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=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" ;;
-
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
- ;;
-
- *)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
-
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
-do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
- esac
-done
-
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
-
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=Makefile.in
-
-# 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 its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
- 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
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
- else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
- fi
-fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
-else
- echo "creating cache $cache_file"
- > $cache_file
-fi
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
-
-
-
-
-
-
-
-
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-
-# Do some error checking and defaulting for the host and target type.
-# The inputs are:
-# configure --host=HOST --target=TARGET --build=BUILD NONOPT
-#
-# The rules are:
-# 1. You are not allowed to specify --host, --target, and nonopt at the
-# same time.
-# 2. Host defaults to nonopt.
-# 3. If nonopt is not specified, then host defaults to the current host,
-# as determined by config.guess.
-# 4. Target and build default to nonopt.
-# 5. If nonopt is not specified, then target and build default to host.
-
-# The aliases save the names the user supplied, while $host etc.
-# will get canonicalized.
-case $host---$target---$nonopt in
-NONE---*---* | *---NONE---* | *---*---NONE) ;;
-*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
-esac
-
-
-# Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:578: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
- case $nonopt in
- NONE)
- if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
- else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
- fi ;;
- *) host_alias=$nonopt ;;
- esac ;;
-esac
-
-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
-
-echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:599: checking target system type" >&5
-
-target_alias=$target
-case "$target_alias" in
-NONE)
- case $nonopt in
- NONE) target_alias=$host_alias ;;
- *) target_alias=$nonopt ;;
- esac ;;
-esac
-
-target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
-target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$target" 1>&6
-
-echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:617: checking build system type" >&5
-
-build_alias=$build
-case "$build_alias" in
-NONE)
- case $nonopt in
- NONE) build_alias=$host_alias ;;
- *) build_alias=$nonopt ;;
- esac ;;
-esac
-
-build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
-build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$build" 1>&6
-
-test "$host_alias" != "$target_alias" &&
- test "$program_prefix$program_suffix$program_transform_name" = \
- NONENONEs,x,x, &&
- program_prefix=${target_alias}-
-
-
-if test $host != $build; then
- ac_tool_prefix=${host_alias}-
-else
- ac_tool_prefix=
-fi
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:649: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="${ac_tool_prefix}gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_CC"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:681: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="gcc"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- CC="gcc"
-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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:717: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_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 $# -gt 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
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
- fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:766: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:775: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
-else
- ac_cv_prog_gcc=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:790: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
-else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-O2"
- fi
-else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
-fi
-
-# Extract the first word of "${ac_tool_prefix}g++", so it can be a program name with args.
-set dummy ${ac_tool_prefix}g++; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:820: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CXX"; then
- ac_cv_prog_CXX="$CXX" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CXX="${ac_tool_prefix}g++"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CXX="$ac_cv_prog_CXX"
-if test -n "$CXX"; then
- echo "$ac_t""$CXX" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_CXX"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "g++", so it can be a program name with args.
-set dummy g++; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:852: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CXX"; then
- ac_cv_prog_CXX="$CXX" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CXX="g++"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_CXX" && ac_cv_prog_CXX="g++"
-fi
-fi
-CXX="$ac_cv_prog_CXX"
-if test -n "$CXX"; then
- echo "$ac_t""$CXX" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- CXX="g++"
-fi
-fi
-
-if test -z "$CXX"; then
- # Extract the first word of "c++", so it can be a program name with args.
-set dummy c++; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:888: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CXX"; then
- ac_cv_prog_CXX="$CXX" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CXX="c++"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CXX="$ac_cv_prog_CXX"
-if test -n "$CXX"; then
- echo "$ac_t""$CXX" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-CXXFLAGS='$(CFLAGS)'
-
-
-SUBDIRS='cygwin'
-if test -d $srcdir/w32api; then
- SUBDIRS="w32api $SUBDIRS"
-else
- echo "*** missing w32api directory" 1>&2
- exit 1
-fi
-test -d $srcdir/mingw && SUBDIRS="$SUBDIRS mingw"
-
-case "$with_cross_host" in
- ""|*cygwin*)
- test -d $srcdir/bz2lib && SUBDIRS="$SUBDIRS bz2lib"
- test -d $srcdir/zlib && SUBDIRS="$SUBDIRS zlib"
- # test -d $srcdir/subauth && SUBDIRS="$SUBDIRS subauth"
- SUBDIRS="$SUBDIRS utils doc"
- ;;
-esac
-
-subdirs="$SUBDIRS"
-
-
-echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:942: checking whether ${MAKE-make} sets \${MAKE}" >&5
-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftestmake <<\EOF
-all:
- @echo 'ac_maketemp="${MAKE}"'
-EOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
-if test -n "$ac_maketemp"; then
- eval ac_cv_prog_make_${ac_make}_set=yes
-else
- eval ac_cv_prog_make_${ac_make}_set=no
-fi
-rm -f conftestmake
-fi
-if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- SET_MAKE=
-else
- echo "$ac_t""no" 1>&6
- SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-
-
-trap '' 1 2 15
-cat > confcache <<\EOF
-# 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. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# 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.
-(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
- if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
-fi
-
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
-s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
-s%\[%\\&%g
-s%\]%\\&%g
-s%\$%$$%g
-EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-rm -f conftest.defs
-
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
-
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
-# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
-# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
-
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
-do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
-done
-
-ac_given_srcdir=$srcdir
-
-trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@host@%$host%g
-s%@host_alias@%$host_alias%g
-s%@host_cpu@%$host_cpu%g
-s%@host_vendor@%$host_vendor%g
-s%@host_os@%$host_os%g
-s%@target@%$target%g
-s%@target_alias@%$target_alias%g
-s%@target_cpu@%$target_cpu%g
-s%@target_vendor@%$target_vendor%g
-s%@target_os@%$target_os%g
-s%@build@%$build%g
-s%@build_alias@%$build_alias%g
-s%@build_cpu@%$build_cpu%g
-s%@build_vendor@%$build_vendor%g
-s%@build_os@%$build_os%g
-s%@CC@%$CC%g
-s%@CXX@%$CXX%g
-s%@subdirs@%$subdirs%g
-s%@SET_MAKE@%$SET_MAKE%g
-s%@SUBDIRS@%$SUBDIRS%g
-
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
- else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
- fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
- else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
- fi
-done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
-fi
-EOF
-
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
- fi
-
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
-
-
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
- esac
-
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
-if test "$no_recursion" != yes; then
-
- # Remove --cache-file and --srcdir arguments so they do not pile up.
- ac_sub_configure_args=
- ac_prev=
- for ac_arg in $ac_configure_args; 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=*)
- ;;
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- ;;
- *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
- esac
- done
-
- for ac_config_dir in $SUBDIRS; do
-
- # Do not complain, so a configure script can configure whichever
- # parts of a large source tree are present.
- if test ! -d $srcdir/$ac_config_dir; then
- continue
- fi
-
- echo configuring in $ac_config_dir
-
- case "$srcdir" in
- .) ;;
- *)
- if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :;
- else
- { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; }
- fi
- ;;
- esac
-
- ac_popdir=`pwd`
- cd $ac_config_dir
-
- # A "../" for each directory in /$ac_config_dir.
- ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`
-
- case "$srcdir" in
- .) # No --srcdir option. We are building in place.
- ac_sub_srcdir=$srcdir ;;
- /*) # Absolute path.
- ac_sub_srcdir=$srcdir/$ac_config_dir ;;
- *) # Relative path.
- ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;;
- esac
-
- # Check for guested configure; otherwise get Cygnus style configure.
- if test -f $ac_sub_srcdir/configure; then
- ac_sub_configure=$ac_sub_srcdir/configure
- elif test -f $ac_sub_srcdir/configure.in; then
- ac_sub_configure=$ac_configure
- else
- echo "configure: warning: no configuration information is in $ac_config_dir" 1>&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 path.
- ac_sub_cache_file="$ac_dots$cache_file" ;;
- esac
-
- echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir"
- # The eval makes quoting arguments work.
- if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir
- then :
- else
- { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; }
- fi
- fi
-
- cd $ac_popdir
- done
-fi
-
diff --git a/winsup/configure.in b/winsup/configure.in
deleted file mode 100755
index 79d472b9e..000000000
--- a/winsup/configure.in
+++ /dev/null
@@ -1,92 +0,0 @@
-dnl Autoconf configure script for Cygwin.
-dnl Copyright 1996, 1997, 1998, 1999, 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.12)dnl
-AC_INIT(Makefile.in)
-
-dnl FIXME: We temporarily define our own version of AC_PROG_CC. This is
-dnl copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
-dnl are probably using a cross compiler, which will not be able to fully
-dnl link an executable. This should really be fixed in autoconf
-dnl itself.
-
-AC_DEFUN(LIB_AC_PROG_CC,
-[AC_BEFORE([$0], [AC_PROG_CPP])dnl
-AC_CHECK_TOOL(CC, gcc, gcc)
-if test -z "$CC"; then
- AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
- test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
-fi
-
-AC_PROG_CC_GNU
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-dnl Check whether -g works, even if CFLAGS is set, in case the package
-dnl plays around with CFLAGS (such as to build both debugging and
-dnl normal versions of a library), tasteless as that idea is.
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- AC_PROG_CC_G
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-O2"
- fi
-else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
-fi
-])
-
-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_PROG(CXX, c++, c++, , , )
- test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
-fi
-
-CXXFLAGS='$(CFLAGS)'
-])
-
-AC_CANONICAL_SYSTEM
-
-LIB_AC_PROG_CC
-LIB_AC_PROG_CXX
-
-SUBDIRS='cygwin'
-if test -d $srcdir/w32api; then
- SUBDIRS="w32api $SUBDIRS"
-else
- echo "*** missing w32api directory" 1>&2
- exit 1
-fi
-test -d $srcdir/mingw && SUBDIRS="$SUBDIRS mingw"
-
-case "$with_cross_host" in
- ""|*cygwin*)
- test -d $srcdir/bz2lib && SUBDIRS="$SUBDIRS bz2lib"
- test -d $srcdir/zlib && SUBDIRS="$SUBDIRS zlib"
- # test -d $srcdir/subauth && SUBDIRS="$SUBDIRS subauth"
- SUBDIRS="$SUBDIRS utils doc"
- ;;
-esac
-
-AC_CONFIG_SUBDIRS($SUBDIRS)
-
-AC_PROG_MAKE_SET
-
-AC_SUBST(SUBDIRS)
-AC_OUTPUT(Makefile)
diff --git a/winsup/cygserver/client.cc b/winsup/cygserver/client.cc
deleted file mode 100644
index 1df23ad9f..000000000
--- a/winsup/cygserver/client.cc
+++ /dev/null
@@ -1,207 +0,0 @@
-/* cygserver_client.cc
-
- Copyright 2001, 2002 Red Hat Inc.
-
- Written by Egor Duda <deo@logos-m.ru>
-
- 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__
-#undef __INSIDE_CYGWIN__
-#else
-#include "winsup.h"
-#endif
-
-#ifndef __INSIDE_CYGWIN__
-#define debug_printf printf
-#define api_fatal printf
-#include <stdio.h>
-#include <windows.h>
-#endif
-#include <sys/socket.h>
-#include <errno.h>
-#include <unistd.h>
-//#include "security.h"
-#include "cygwin/cygserver_transport.h"
-#include "cygwin/cygserver_transport_pipes.h"
-#include "cygwin/cygserver_transport_sockets.h"
-#include "cygwin/cygserver.h"
-
-/* 0 = untested, 1 = running, 2 = dead */
-int cygserver_running=CYGSERVER_UNKNOWN;
-/* on by default during development. For release, we probably want off by default */
-int allow_daemon = TRUE;
-
-client_request_get_version::client_request_get_version () : client_request (CYGSERVER_REQUEST_GET_VERSION, sizeof (version))
-{
- buffer = (char *)&version;
-}
-
-client_request_attach_tty::client_request_attach_tty () : client_request (CYGSERVER_REQUEST_ATTACH_TTY, sizeof (req))
-{
- buffer = (char *)&req;
- req.pid = 0;
- req.master_pid = 0;
- req.from_master = NULL;
- req.to_master = NULL;
-}
-
-client_request_attach_tty::client_request_attach_tty (DWORD npid, DWORD nmaster_pid, HANDLE nfrom_master, HANDLE nto_master) : client_request (CYGSERVER_REQUEST_ATTACH_TTY, sizeof (req))
-{
- buffer = (char *)&req;
- req.pid = npid;
- req.master_pid = nmaster_pid;
- req.from_master = nfrom_master;
- req.to_master = nto_master;
-}
-
-client_request_shutdown::client_request_shutdown () : client_request (CYGSERVER_REQUEST_SHUTDOWN, 0)
-{
- buffer = NULL;
-}
-
-client_request::client_request (cygserver_request_code id, ssize_t buffer_size) : header (id, buffer_size)
-{
-}
-
-client_request::~client_request ()
-{
-}
-
-client_request::operator class request_header ()
-{
- return header;
-}
-
-void
-client_request::send (transport_layer_base *conn)
-{
- if (!conn)
- return;
- debug_printf("this=%p, conn=%p\n",this, conn);
- ssize_t bytes_written, bytes_read;
- debug_printf("header.cb = %ld\n",header.cb);
- if ((bytes_written = conn->write ((char *)&header, sizeof (header)))
- != sizeof(header) || (header.cb &&
- (bytes_written = conn->write (buffer, header.cb)) != header.cb))
- {
- header.error_code = -1;
- debug_printf ("bytes written != request size\n");
- return;
- }
-
- debug_printf("Sent request, size (%ld)\n",bytes_written);
-
- if ((bytes_read = conn->read ((char *)&header, sizeof (header)))
- != sizeof (header) || (header.cb &&
- (bytes_read = conn->read (buffer, header.cb)) != header.cb))
- {
- header.error_code = -1;
- debug_printf("failed reading response \n");
- return;
- }
- debug_printf ("completed ok\n");
-}
-
-/* Oh, BTW: Fix the procedural basis and make this more intuitive. */
-
-int
-cygserver_request (client_request * req)
-{
- class transport_layer_base *transport;
-
- if (!req || allow_daemon != TRUE)
- return -1;
-
- /* dont' retry every request if the server's not there */
- if (cygserver_running==CYGSERVER_DEAD && req->header.req_id != CYGSERVER_REQUEST_GET_VERSION)
- return -1;
-
- transport = create_server_transport ();
-
- /* FIXME: have at most one connection per thread. use TLS to store the details */
- /* logic is:
- * if not tlskey->conn, new conn,
- * then; transport=conn;
- */
- if (!transport->connect ())
- {
- delete transport;
- return -1;
- }
-
- debug_printf ("connected to server %p\n", transport);
-
- req->send(transport);
-
- transport->close ();
-
- delete transport;
-
- return 0;
-}
-
-#if 0
-BOOL
-check_cygserver_available ()
-{
- BOOL ret_val = FALSE;
- HANDLE pipe = CreateFile (pipe_name,
- GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- &sec_all_nih,
- OPEN_EXISTING,
- 0,
- NULL);
- if (pipe != INVALID_HANDLE_VALUE || GetLastError () != ERROR_PIPE_BUSY)
- ret_val = TRUE;
-
- if (pipe && pipe != INVALID_HANDLE_VALUE)
- CloseHandle (pipe);
-
- return (ret_val);
-}
-#endif
-
-void
-cygserver_init ()
-{
- int rc;
- if (allow_daemon != TRUE)
- {
- cygserver_running = CYGSERVER_DEAD;
- return;
- }
-
- if (cygserver_running==CYGSERVER_OK)
- return;
-
- client_request_get_version *req =
- new client_request_get_version ();
-
- rc = cygserver_request (req);
- delete req;
- if (rc < 0)
- cygserver_running = CYGSERVER_DEAD;
- else if (rc > 0)
- api_fatal ("error connecting to cygwin server. error: %d", rc);
- else if (req->version.major != CYGWIN_SERVER_VERSION_MAJOR ||
- req->version.api != CYGWIN_SERVER_VERSION_API ||
- req->version.minor > CYGWIN_SERVER_VERSION_MINOR)
- api_fatal ("incompatible version of cygwin server.\n\
- 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,
- req->version.major,
- req->version.api,
- req->version.minor,
- req->version.patch);
- else
- cygserver_running = CYGSERVER_OK;
-}
diff --git a/winsup/cygserver/cygserver.cc b/winsup/cygserver/cygserver.cc
deleted file mode 100644
index af9cee93e..000000000
--- a/winsup/cygserver/cygserver.cc
+++ /dev/null
@@ -1,549 +0,0 @@
-/* cygserver.cc
-
- Copyright 2001, 2002 Red Hat Inc.
-
- Written by Egor Duda <deo@logos-m.ru>
-
- 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 <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <windows.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <signal.h>
-#include <stdlib.h>
-#include "wincap.h"
-#include "cygwin_version.h"
-
-#include "getopt.h"
-
-#include "cygwin/cygserver_transport.h"
-#include "cygwin/cygserver_transport_pipes.h"
-#include "cygwin/cygserver_transport_sockets.h"
-#include "threaded_queue.h"
-#include "cygwin/cygserver_process.h"
-#include "cygwin/cygserver.h"
-#include "cygserver_shm.h"
-
-/* for quieter operation, set to 0 */
-#define DEBUG 0
-#define debug_printf if (DEBUG) printf
-
-GENERIC_MAPPING access_mapping;
-static class transport_layer_base *transport;
-
-DWORD request_count = 0;
-
-BOOL
-setup_privileges ()
-{
- BOOL rc, ret_val;
- HANDLE hToken = NULL;
- TOKEN_PRIVILEGES sPrivileges;
-
- rc = OpenProcessToken (GetCurrentProcess() , TOKEN_ALL_ACCESS , &hToken) ;
- if (!rc)
- {
- printf ("error opening process token (%lu)\n", GetLastError ());
- ret_val = FALSE;
- goto out;
- }
- rc = LookupPrivilegeValue (NULL, SE_DEBUG_NAME, &sPrivileges.Privileges[0].Luid);
- if (!rc)
- {
- printf ("error getting prigilege luid (%lu)\n", 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)
- {
- printf ("error adjusting prigilege level. (%lu)\n", 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))
- {
- printf ("error getting handle(%u) to server (%lu)\n", (unsigned int)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))
- {
- printf ("error getting handle SD (%lu)\n", GetLastError ());
- goto out;
- }
-
- MapGenericMask (&access, &access_mapping);
-
- if (!AccessCheck (sd, from_process_token, access, &access_mapping,
- &ps, &ps_len, &access, &status))
- {
- printf ("error checking access rights (%lu)\n", GetLastError ());
- goto out;
- }
-
- if (!status)
- {
- printf ("access to object denied\n");
- goto out;
- }
-
- if (!DuplicateHandle (from_process, from_handle,
- to_process, to_handle_ptr,
- access, bInheritHandle, 0))
- {
- printf ("error getting handle to client (%lu)\n", GetLastError ());
- goto out;
- }
- debug_printf ("Duplicated %p to %p\n", from_handle, *to_handle_ptr);
-
- ret_val = 0;
-
-out:
- if (local_handle && from_process != GetCurrentProcess ())
- CloseHandle (local_handle);
-
- return (ret_val);
-}
-
-void
-client_request::serve (transport_layer_base *conn, class process_cache *cache)
-{
- printf ("*****************************************\n"
- "A call to the base client_request class has occured\n"
- "This indicates a mismatch in a virtual function definition somewhere\n");
- exit (1);
-}
-
-void
-client_request_attach_tty::serve(transport_layer_base *conn, class process_cache *cache)
-{
- HANDLE from_process_handle = NULL;
- HANDLE to_process_handle = NULL;
- HANDLE token_handle = NULL;
- DWORD rc;
-
- if (header.cb != sizeof (req))
- {
- header.error_code = EINVAL;
- return;
- }
-
- debug_printf ("pid %ld:(%p,%p) -> pid %ld\n", req.master_pid,
- req.from_master, req.to_master,
- req.pid);
-
- debug_printf ("opening process %ld\n", req.master_pid);
- from_process_handle = OpenProcess (PROCESS_DUP_HANDLE, FALSE, req.master_pid);
- debug_printf ("opening process %ld\n", req.pid);
- to_process_handle = OpenProcess (PROCESS_DUP_HANDLE, FALSE, req.pid);
- if (!from_process_handle || !to_process_handle)
- {
- printf ("error opening process (%lu)\n", GetLastError ());
- header.error_code = EACCES;
- goto out;
- }
-
- debug_printf ("Impersonating client\n");
- conn->impersonate_client ();
-
- debug_printf ("about to open thread token\n");
- rc = OpenThreadToken (GetCurrentThread (),
- TOKEN_QUERY,
- TRUE,
- &token_handle);
-
- debug_printf ("opened thread token, rc=%lu\n", rc);
- conn->revert_to_self ();
-
- if (!rc)
- {
- printf ("error opening thread token (%lu)\n", GetLastError ());
- header.error_code = EACCES;
- goto out;
- }
-
- if (check_and_dup_handle (from_process_handle, to_process_handle,
- token_handle,
- GENERIC_READ,
- req.from_master,
- &req.from_master, TRUE) != 0)
- {
- printf ("error duplicating from_master handle (%lu)\n", GetLastError ());
- header.error_code = EACCES;
- goto out;
- }
-
- if (req.to_master)
- {
- if (check_and_dup_handle (from_process_handle, to_process_handle,
- token_handle,
- GENERIC_WRITE,
- req.to_master,
- &req.to_master, TRUE) != 0)
- {
- printf ("error duplicating to_master handle (%lu)\n", GetLastError ());
- header.error_code = EACCES;
- goto out;
- }
- }
-
-#if DEBUG
- printf ("%ld -> %ld(%p,%p)\n", req.master_pid, req.pid,
- req.from_master, req.to_master);
-#endif
-
- header.error_code = 0;
-
-out:
- if (from_process_handle)
- CloseHandle (from_process_handle);
- if (to_process_handle)
- CloseHandle (to_process_handle);
- if (token_handle)
- CloseHandle (token_handle);
-}
-
-void
-client_request_get_version::serve(transport_layer_base *conn, class process_cache *cache)
-{
- if (header.cb != sizeof (version))
- {
- header.error_code = EINVAL;
- return;
- }
- header.error_code = 0;
- 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 *newconn, class process_cache *newcache);
- virtual void process ();
- private:
- char request_buffer [MAX_REQUEST_SIZE];
- transport_layer_base *conn;
- class process_cache *cache;
-};
-
-class server_process_param : public queue_process_param
-{
- public:
- transport_layer_base *transport;
- server_process_param () : queue_process_param (false) {};
-};
-
-class server_request_queue : public threaded_queue
-{
- public:
- class process_cache *cache;
- void process_requests (transport_layer_base *transport);
- virtual void add (transport_layer_base *conn);
-};
-class server_request_queue request_queue;
-
-static DWORD WINAPI
-request_loop (LPVOID LpParam)
-{
- class server_process_param *params = (server_process_param *) LpParam;
- class server_request_queue *queue = (server_request_queue *) params->queue;
- class transport_layer_base * transport = params->transport;
- while (queue->active)
- {
- transport_layer_base * new_conn = transport->accept ();
- /* 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
- */
- if (new_conn && queue->active)
- queue->add (new_conn);
- }
- return 0;
-}
-
-/* TODO: check we are not being asked to service a already serviced transport */
-void
-server_request_queue::process_requests (transport_layer_base *transport)
-{
- class server_process_param *params = new server_process_param;
- params->transport = transport;
- threaded_queue::process_requests (params, request_loop);
-}
-
-void
-client_request_shutdown::serve (transport_layer_base *conn, class process_cache *cache)
-{
- /* FIXME: link upwards, and then this becomes a trivial method call to
- * only shutdown _this queue_
- */
- /* tell the main thread to shutdown */
- request_queue.active=false;
-}
-
-server_request::server_request (transport_layer_base *newconn, class process_cache *newcache)
-{
- conn = newconn;
- cache = newcache;
-}
-
-void
-server_request::process ()
-{
- ssize_t bytes_read, bytes_written;
- struct request_header* req_ptr = (struct request_header*) &request_buffer;
- client_request *req = NULL;
- debug_printf ("about to read\n");
-
- bytes_read = conn->read (request_buffer, sizeof (struct request_header));
- if (bytes_read != sizeof (struct request_header))
- {
- printf ("error reading from connection (%lu)\n", GetLastError ());
- goto out;
- }
- debug_printf ("got header (%ld)\n", bytes_read);
-
- switch (req_ptr->req_id)
- {
- case CYGSERVER_REQUEST_GET_VERSION:
- req = new client_request_get_version (); break;
- case CYGSERVER_REQUEST_ATTACH_TTY:
- req = new client_request_attach_tty (); break;
- case CYGSERVER_REQUEST_SHUTDOWN:
- req = new client_request_shutdown (); break;
- case CYGSERVER_REQUEST_SHM_GET:
- req = new client_request_shm (); break;
- default:
- req = new client_request (CYGSERVER_REQUEST_INVALID, 0);
- req->header.error_code = ENOSYS;
- debug_printf ("Bad client request - returning ENOSYS\n");
- }
-
- if (req->header.cb != req_ptr->cb)
- {
- debug_printf ("Mismatch in request buffer sizes\n");
- goto out;
- }
-
- if (req->header.cb)
- {
-
- bytes_read = conn->read (req->buffer, req->header.cb);
- if (bytes_read != req->header.cb)
- {
- debug_printf ("error reading from connection (%lu)\n", GetLastError ());
- goto out;
- }
- debug_printf ("got body (%ld)\n",bytes_read);
- }
-
- /* this is not allowed to fail. We must return ENOSYS at a minimum to the client */
- req->serve (conn, cache);
-
- if ((bytes_written = conn->write ((char *)&req->header, sizeof (req->header)))
- != sizeof(req->header) || (req->header.cb &&
- (bytes_written = conn->write (req->buffer, req->header.cb)) != req->header.cb))
- {
- req->header.error_code = -1;
- printf ("error writing to connection (%lu)\n", GetLastError ());
- goto out;
- }
-
- debug_printf("Sent reply, size (%ld)\n",bytes_written);
- printf (".");
-
-out:
- conn->close ();
- delete conn;
- if (req)
- delete (req);
-}
-
-void
-server_request_queue::add (transport_layer_base *conn)
-{
- /* safe to not "Try" because workers don't hog this, they wait on the event
- */
- /* every derived ::add must enter the section! */
- EnterCriticalSection (&queuelock);
- if (!running)
- {
- conn->close ();
- delete conn;
- LeaveCriticalSection (&queuelock);
- return;
- }
- queue_request * listrequest = new server_request (conn, cache);
- threaded_queue::add (listrequest);
- LeaveCriticalSection (&queuelock);
-}
-
-void
-handle_signal (int signal)
-{
- /* any signal makes us die :} */
- /* FIXME: link upwards, and then this becomes a trivial method call to
- * only shutdown _this queue_
- */
- /* tell the main thread to shutdown */
- request_queue.active=false;
-}
-
-struct option longopts[] = {
- {"shutdown", no_argument, NULL, 's'},
- {0, no_argument, NULL, 0}
-};
-
-char opts[] = "s";
-
-int
-main (int argc, char **argv)
-{
- int shutdown=0;
- char i;
-
- while ((i = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
- switch (i)
- {
- case 's':
- shutdown = 1;
- break;
- default:
- break;
- /*NOTREACHED*/
- }
-
- wincap.init();
- if (wincap.has_security ())
- setup_privileges ();
- transport = create_server_transport ();
-
- if (shutdown)
- {
- if (!transport->connect())
- {
- printf ("couldn't establish connection with server\n");
- exit (1);
- }
- client_request_shutdown *request =
- new client_request_shutdown ();
- request->send (transport);
- transport->close();
- delete transport;
- delete request;
- exit(0);
- }
-
- char version[200];
- /* Cygwin dll release */
- snprintf (version, 200, "%d.%d.%d(%d.%d/%d/%d)-(%d.%d.%d.%d) %s",
- cygwin_version.dll_major / 1000,
- cygwin_version.dll_major % 1000,
- cygwin_version.dll_minor,
- cygwin_version.api_major,
- cygwin_version.api_minor,
- cygwin_version.shared_data,
- CYGWIN_SERVER_VERSION_MAJOR,
- CYGWIN_SERVER_VERSION_API,
- CYGWIN_SERVER_VERSION_MINOR,
- CYGWIN_SERVER_VERSION_PATCH,
- cygwin_version.mount_registry,
- cygwin_version.dll_build_date);
- setbuf (stdout, NULL);
- printf ("daemon version %s starting up", version);
- if (signal (SIGQUIT, handle_signal) == SIG_ERR)
- {
- printf ("\ncould not install signal handler (%d)- aborting startup\n", errno);
- exit (1);
- }
- printf (".");
- transport->listen ();
- printf (".");
- class process_cache cache (2);
- request_queue.initial_workers = 10;
- request_queue.cache = &cache;
- request_queue.create_workers ();
- printf (".");
- request_queue.process_requests (transport);
- printf (".");
- cache.create_workers ();
- printf (".");
- cache.process_requests ();
- printf (".complete\n");
- /* 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 (1 && request_queue.active)
- {
- sleep (1);
- }
- printf ("\nShutdown request recieved - new requests will be denied\n");
- request_queue.cleanup ();
- printf ("All pending requests processed\n");
- transport->close ();
- printf ("No longer accepting requests - cygwin will operate in daemonless mode\n");
- cache.cleanup ();
- printf ("All outstanding process-cache activities completed\n");
- printf ("daemon shutdown\n");
-}
diff --git a/winsup/cygserver/process.cc b/winsup/cygserver/process.cc
deleted file mode 100644
index dd13f37fb..000000000
--- a/winsup/cygserver/process.cc
+++ /dev/null
@@ -1,388 +0,0 @@
-/* cygserver_process.cc
-
- Copyright 2001, 2002 Red Hat Inc.
-
- Written by Robert Collins <rbtcollins@hotmail.com>
-
- 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 <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <windows.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include "wincap.h"
-#include <pthread.h>
-#include <threaded_queue.h>
-#include <cygwin/cygserver_process.h>
-
-#define debug_printf if (DEBUG) printf
-#define DEBUG 1
-
-/* the cache structures and classes are designed for one cache per server process.
- * To make multiple process caches, a redesign will be needed
- */
-
-/* process cache */
-process_cache::process_cache (unsigned int num_initial_workers):
-head (NULL)
-{
- /* there can only be one */
- InitializeCriticalSection (&cache_write_access);
- if ((cache_add_trigger = CreateEvent (NULL, FALSE, FALSE, NULL)) == NULL)
- {
- printf ("Failed to create cache add trigger (%lu), terminating\n",
- GetLastError ());
- exit (1);
- }
- initial_workers = num_initial_workers;
-}
-
-process_cache::~process_cache ()
-{
-}
-
-class process *
-process_cache::process (long pid)
-{
- class process *entry = head;
- /* TODO: make this more granular, so a search doesn't involve the write lock */
- EnterCriticalSection (&cache_write_access);
- if (!entry)
- {
- entry = new class process (pid);
- entry->next =
- (class process *) InterlockedExchangePointer (&head, entry);
- PulseEvent (cache_add_trigger);
- }
- else
- {
- while (entry->winpid != pid && entry->next)
- entry = entry->next;
- if (entry->winpid != pid)
- {
- class process *new_entry = new class process (pid);
- new_entry->next =
- (class process *) InterlockedExchangePointer (&entry->next,
- new_entry);
- entry = new_entry;
- PulseEvent (cache_add_trigger);
- }
- }
- LeaveCriticalSection (&cache_write_access);
- return entry;
-}
-
-static DWORD WINAPI
-request_loop (LPVOID LpParam)
-{
- class process_process_param *params = (process_process_param *) LpParam;
- return params->request_loop ();
-}
-
-void
-process_cache::process_requests ()
-{
- class process_process_param *params = new process_process_param;
- threaded_queue::process_requests (params, request_loop);
-}
-
-void
-process_cache::add_task (class process * theprocess)
-{
- /* safe to not "Try" because workers don't hog this, they wait on the event
- */
- /* every derived ::add must enter the section! */
- EnterCriticalSection (&queuelock);
- queue_request *listrequest = new process_cleanup (theprocess);
- threaded_queue::add (listrequest);
- LeaveCriticalSection (&queuelock);
-}
-
-/* NOT fully MT SAFE: must be called by only one thread in a program */
-void
-process_cache::remove_process (class process *theprocess)
-{
- class process *entry = head;
- /* unlink */
- EnterCriticalSection (&cache_write_access);
- if (entry == theprocess)
- {
- entry = (class process *) InterlockedExchangePointer (&head, theprocess->next);
- if (entry != theprocess)
- {
- printf ("Bug encountered, process cache corrupted\n");
- exit (1);
- }
- }
- else
- {
- while (entry->next && entry->next != theprocess)
- entry = entry->next;
- class process *temp = (class process *) InterlockedExchangePointer (&entry->next, theprocess->next);
- if (temp != theprocess)
- {
- printf ("Bug encountered, process cache corrupted\n");
- exit (1);
- }
- }
- LeaveCriticalSection (&cache_write_access);
- /* Process any cleanup tasks */
- add_task (theprocess);
-}
-
-/* copy <= max_copy HANDLEs to dest[], starting at an offset into _our list_ of
- * begin_at. (Ie begin_at = 5, the first copied handle is still written to dest[0]
- * NOTE: Thread safe, but not thread guaranteed - a newly added process may be missed.
- * Who cares - It'll get caught the next time.
- */
-int
-process_cache::handle_snapshot (HANDLE * hdest, class process ** edest,
- ssize_t max_copy, int begin_at)
-{
- /* TODO:? grab a delete-lock, to prevent deletes during this process ? */
- class process *entry = head;
- int count = begin_at;
- /* skip begin_at entries */
- while (entry && count)
- {
- if (entry->exit_code () == STILL_ACTIVE)
- count--;
- entry = entry->next;
- }
- /* hit the end of the list within begin_at entries */
- if (count)
- return 0;
- HANDLE *hto = hdest;
- class process **eto = edest;
- while (entry && count < max_copy)
- {
- /* hack */
- if (entry->exit_code () == STILL_ACTIVE)
- {
- *hto = entry->handle ();
- *eto = entry;
- count++;
- hto++;
- eto++;
- }
- entry = entry->next;
- }
- return count;
-}
-
-/* process's */
-/* global process crit section */
-static CRITICAL_SECTION process_access;
-static pthread_once_t process_init;
-
-void
-do_process_init (void)
-{
- InitializeCriticalSection (&process_access);
- /* we don't have a cache shutdown capability today */
-}
-
-process::process (long pid):
-winpid (pid), next (NULL), cleaning_up (0), head (NULL), _exit_status (STILL_ACTIVE)
-{
- pthread_once (&process_init, do_process_init);
- EnterCriticalSection (&process_access);
- thehandle = OpenProcess (PROCESS_ALL_ACCESS, FALSE, pid);
- if (!thehandle)
- {
- printf ("unable to obtain handle for new cache process %ld\n", pid);
- thehandle = INVALID_HANDLE_VALUE;
- }
- debug_printf ("Got handle %p for new cache process %ld\n", thehandle, pid);
- InitializeCriticalSection (&access);
- LeaveCriticalSection (&process_access);
-}
-
-process::~process ()
-{
- DeleteCriticalSection (&access);
-}
-
-HANDLE
-process::handle ()
-{
-// DWORD exitstate = exit_code ();
-// if (exitstate == STILL_ACTIVE)
- return thehandle;
-
- /* FIXME: call the cleanup list ? */
-
-// CloseHandle (thehandle);
-// debug_printf ("Process id %ld has terminated, attempting to open a new handle\n",
-// winpid);
-// thehandle = OpenProcess (PROCESS_ALL_ACCESS, FALSE, winpid);
-// debug_printf ("Got handle %p when refreshing cache process %ld\n", thehandle, winpid);
-// /* FIXME: what if OpenProcess fails ? */
-// if (thehandle)
-// {
-// _exit_status = STILL_ACTIVE;
-// exit_code ();
-// }
-// else
-// thehandle = INVALID_HANDLE_VALUE;
-// return thehandle;
-}
-
-DWORD process::exit_code ()
-{
- if (_exit_status != STILL_ACTIVE)
- return _exit_status;
- bool
- err = GetExitCodeProcess (thehandle, &_exit_status);
- if (!err)
- {
- debug_printf ("Failed to retrieve exit code (%ld)\n", GetLastError ());
- thehandle = INVALID_HANDLE_VALUE;
- return _exit_status;
- }
- else if (_exit_status == STILL_ACTIVE)
- return _exit_status;
- /* add new cleanup task etc etc ? */
- return _exit_status;
-}
-
-/* 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 ()
-{
- /* Serialize this */
- EnterCriticalSection (&access);
- InterlockedIncrement (&(long)cleaning_up);
- class cleanup_routine *entry = head;
- while (entry)
- {
- class cleanup_routine *temp;
- entry->cleanup (winpid);
- temp = entry->next;
- delete entry;
- entry = temp;
- }
- LeaveCriticalSection (&access);
-}
-
-bool
-process::add_cleanup_routine (class cleanup_routine *new_cleanup)
-{
- if (cleaning_up)
- return false;
- EnterCriticalSection (&access);
- /* check that we didn't block with ::cleanup ()
- * This rigmarole is to get around win9x's glaring missing TryEnterCriticalSection call
- * which would be a whole lot easier
- */
- if (cleaning_up)
- {
- LeaveCriticalSection (&access);
- return false;
- }
- new_cleanup->next = head;
- head = new_cleanup;
- LeaveCriticalSection (&access);
- return true;
-}
-
-/* process_cleanup */
-void
-process_cleanup::process ()
-{
- theprocess->cleanup ();
- delete theprocess;
-}
-
-/* process_process_param */
-DWORD
-process_process_param::request_loop ()
-{
- process_cache *cache = (process_cache *) queue;
- /* always malloc one, so there is no special case in the loop */
- ssize_t HandlesSize = 2;
- HANDLE *Handles = (HANDLE *) malloc (sizeof (HANDLE) * HandlesSize);
- process **Entries = (process **) malloc (sizeof (LPVOID) * HandlesSize);
- /* TODO: put [1] at the end as it will also get done if a process dies? */
- Handles[0] = interrupt;
- Handles[1] = cache->cache_add_trigger;
- while (cache->active && !shutdown)
- {
- int copied;
- copied = -1;
- int offset;
- offset = 1;
- int count;
- count = 2;
- while ((copied == HandlesSize - 2 - offset) || copied < 0)
- {
- /* we need more storage to cope with all the HANDLES */
- if (copied == HandlesSize - 2 - offset)
- {
- HANDLE *temp = (HANDLE *) realloc (Handles,
- sizeof (HANDLE) *
- HandlesSize + 10);
- if (!temp)
- {
- printf
- ("cannot allocate more storage for the handle array!\n");
- exit (1);
- }
- Handles = temp;
- process **ptemp = (process **) realloc (Entries,
- sizeof (LPVOID) *
- HandlesSize + 10);
- if (!ptemp)
- {
- printf
- ("cannot allocate more storage for the handle array!\n");
- exit (1);
- }
- Entries = ptemp;
- HandlesSize += 10;
- }
- offset += copied;
- copied =
- cache->handle_snapshot (&Handles[2], &Entries[2],
- HandlesSize - 2 - offset, offset);
- count += copied;
- }
- debug_printf ("waiting on %u objects\n", count);
- DWORD rc = WaitForMultipleObjects (count, Handles, FALSE, INFINITE);
- if (rc == WAIT_FAILED)
- {
- printf ("Could not wait on the process handles (%ld)!\n",
- GetLastError ());
- exit (1);
- }
- int objindex = rc - WAIT_OBJECT_0;
- if (objindex > 1 && objindex < count)
- {
- debug_printf ("Process %ld has left the building\n",
- Entries[objindex]->winpid);
- /* fire off the termination routines */
- cache->remove_process (Entries[objindex]);
- }
- else if (objindex >= 0 && objindex < 2)
- {
- /* 0 is shutdown - do nothing */
- /* 1 is a cache add event - just rebuild the object list */
- }
- else
- {
- printf
- ("unexpected return code from WaitForMultiple objects in process_process_param::request_loop\n");
- }
- }
- running = false;
- return 0;
-}
diff --git a/winsup/cygserver/shm.cc b/winsup/cygserver/shm.cc
deleted file mode 100644
index 1116bc809..000000000
--- a/winsup/cygserver/shm.cc
+++ /dev/null
@@ -1,665 +0,0 @@
-/* cygserver_shm.cc: Single unix specification IPC interface for Cygwin
-
-Copyright 2001, 2002 Red Hat, Inc.
-
-Originally written by Robert Collins <robert.collins@hotmail.com>
-
-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__
-#undef __INSIDE_CYGWIN__
-#else
-#include "winsup.h"
-#endif
-
-#ifndef __INSIDE_CYGWIN__
-#define DEBUG 0
-#define system_printf printf
-#define debug_printf if (DEBUG) printf
-#define api_fatal printf
-#include <stdio.h>
-#include <windows.h>
-#endif
-
-#include <sys/stat.h>
-#include <errno.h>
-#include "cygerrno.h"
-#include <unistd.h>
-#include "security.h"
-//#include "fhandler.h"
-//#include "dtable.h"
-//#include "cygheap.h"
-#include <stdio.h>
-//#include "thread.h"
-#ifndef __INSIDE_CYGWIN__
-#define __INSIDE_CYGWIN__
-#include <sys/shm.h>
-#undef __INSIDE_CYGWIN__
-#else
-#include <sys/shm.h>
-#endif
-//#include "perprocess.h"
-#include <threaded_queue.h>
-#include <cygwin/cygserver_process.h>
-#include "cygserver_shm.h"
-
-// FIXME IS THIS CORRECT
-/* Implementation notes: We use two shared memory regions per key:
- * One for the control structure, and one for the shared memory.
- * While this has a higher overhead tham a single shared area,
- * It allows more flexability. As the entire code is transparent to the user
- * We can merge these in the future should it be needed.
- * Also, IPC_PRIVATE keys create unique mappings each time. The shm_ids just
- * keep monotonically incrementing - system wide.
- */
-size_t
-getsystemallocgranularity ()
-{
- SYSTEM_INFO sysinfo;
- static size_t buffer_offset = 0;
- if (buffer_offset)
- return buffer_offset;
- GetSystemInfo (&sysinfo);
- buffer_offset = sysinfo.dwAllocationGranularity;
- return buffer_offset;
-}
-
-
-client_request_shm::client_request_shm ():client_request (CYGSERVER_REQUEST_SHM_GET,
- sizeof (parameters))
-{
- buffer = (char *) &parameters;
-}
-
-/* FIXME: If building on a 64-bit compiler, the address->int typecast will fail.
- * Solution: manually calculate the next id value
- */
-
-#if 0
-extern
-"C" void *
-shmat (int shmid, const void *shmaddr, int parameters.in.shmflg)
-{
- class shmid_ds *
- shm = (class shmid_ds *)
- shmid; //FIXME: verifyable object test
-
- if (shmaddr)
- {
- //FIXME: requested base address ?!
- set_errno (EINVAL);
- return (void *) -1;
- }
-
- void *
- rv =
- MapViewOfFile (shm->attachmap,
-
-
- (parameters.in.shmflg & SHM_RDONLY) ?
- FILE_MAP_READ : FILE_MAP_WRITE, 0,
- 0, 0);
-
- if (!rv)
- {
- //FIXME: translate GetLastError()
- set_errno (EACCES);
- return (void *) -1;
- }
-
-/* FIXME: this needs to be globally protected to prevent a mismatch betwen
- * attach count and attachees list
- */
-
- InterlockedIncrement (&shm->shm_nattch);
- _shmattach *
- attachnode =
- new
- _shmattach;
-
- attachnode->data = rv;
- attachnode->next =
- (_shmattach *) InterlockedExchangePointer ((LONG *) & shm->attachhead,
- (long int) attachnode);
- return rv;
-}
-#endif
-
-/* FIXME: evaluate getuid() and getgid() against the requested mode. Then
- * choose PAGE_READWRITE | PAGE_READONLY and FILE_MAP_WRITE | FILE_MAP_READ
- * appropriately
- */
-
-/* Test result from openbsd: shm ids are persistent cross process if a handle is left
- * open. This could lead to resource starvation: we're not copying that behaviour
- * unless we have to. (It will involve acygwin1.dll gloal shared list :[ ).
- */
-/* FIXME: shmid should be a verifyable object
- */
-
-/* FIXME: on NT we should check everything against the SD. On 95 we just emulate.
- */
-
-extern GENERIC_MAPPING
- access_mapping;
-
-extern 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);
-
-//FIXME: where should this live
-static shmnode *
- shm_head =
- NULL;
-//FIXME: ditto.
-static shmnode *
- deleted_head = NULL;
-/* must be long for InterlockedIncrement */
-static long
- new_id =
- 0;
-static long
- new_private_key =
- 0;
-
-static void
-delete_shmnode (shmnode **nodeptr)
-{
- shmnode *node = *nodeptr;
-
- // remove from the list
- if (node == shm_head)
- shm_head = shm_head->next;
- else
- {
- shmnode *tempnode = shm_head;
- while (tempnode && tempnode->next != node)
- tempnode = tempnode->next;
- if (tempnode)
- tempnode->next = node->next;
- // else log the unexpected !
- }
-
- // release the shared data view
- UnmapViewOfFile (node->shmds->mapptr);
- delete node->shmds;
- CloseHandle (node->filemap);
- CloseHandle (node->attachmap);
-
- // free the memory
- delete node;
- nodeptr = NULL;
-}
-
-void
-client_request_shm::serve (transport_layer_base * conn, process_cache * cache)
-{
-// DWORD sd_size = 4096;
-// char sd_buf[4096];
- PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR) parameters.in.sd_buf;
-// /* create a sd for our open requests based on shmflag & 0x01ff */
-// psd = alloc_sd (getuid (), getgid (), cygheap->user.logsrv (),
-// parameters.in.shmflg & 0x01ff, psd, &sd_size);
-
- HANDLE from_process_handle = NULL;
- HANDLE token_handle = NULL;
- DWORD rc;
-
- from_process_handle = cache->process (parameters.in.pid)->handle ();
- /* possible TODO: reduce the access on the handle before we use it */
- /* Note that unless we do this, we don't need to call CloseHandle - it's kept open
- * by the process cache until the process terminates.
- * We may need a refcount on the cache however...
- */
- if (!from_process_handle)
- {
- debug_printf ("error opening process (%lu)\n", GetLastError ());
- header.error_code = EACCES;
- return;
- }
-
- conn->impersonate_client ();
-
- rc = OpenThreadToken (GetCurrentThread (),
- TOKEN_QUERY, TRUE, &token_handle);
-
- conn->revert_to_self ();
-
- if (!rc)
- {
- debug_printf ("error opening thread token (%lu)\n", GetLastError ());
- header.error_code = EACCES;
- CloseHandle (from_process_handle);
- return;
- }
-
-
- /* we trust the clients request - we will be doing it as them, and
- * the worst they can do is open their own permissions
- */
-
-
- SECURITY_ATTRIBUTES sa;
- sa.nLength = sizeof (sa);
- sa.lpSecurityDescriptor = psd;
- sa.bInheritHandle = TRUE; /* the memory structures inherit ok */
-
- char *shmname = NULL, *shmaname = NULL;
- char stringbuf[29], stringbuf1[29];
-
- /* TODO: make this code block a function! */
- if (parameters.in.type == SHM_REATTACH)
- {
- /* just find and fill out the existing shm_id */
- shmnode *tempnode = shm_head;
- while (tempnode)
- {
- if (tempnode->shm_id == parameters.in.shm_id)
- {
- parameters.out.shm_id = tempnode->shm_id;
- parameters.out.key = tempnode->key;
- if (check_and_dup_handle
- (GetCurrentProcess (), from_process_handle, token_handle,
- DUPLICATE_SAME_ACCESS, tempnode->filemap,
- &parameters.out.filemap, TRUE) != 0)
- {
- debug_printf ("error duplicating filemap handle (%lu)\n",
- GetLastError ());
- header.error_code = EACCES;
- }
- if (check_and_dup_handle
- (GetCurrentProcess (), from_process_handle, token_handle,
- DUPLICATE_SAME_ACCESS, tempnode->attachmap,
- &parameters.out.attachmap, TRUE) != 0)
- {
- debug_printf ("error duplicating attachmap handle (%lu)\n",
- GetLastError ());
- header.error_code = EACCES;
- }
- CloseHandle (token_handle);
- return;
- }
- tempnode = tempnode->next;
- }
- header.error_code = EINVAL;
- CloseHandle (token_handle);
- return;
- }
-
- /* someone attached */
- /* someone can send shm_id's they don't have and currently we will increment those
- * attach counts. If someone wants to fix that, please go ahead.
- * The problem is that shm_get has nothing to do with the ability to attach. Attach
- * requires a permission check, which we get the OS to do in MapViewOfFile.
- */
- if (parameters.in.type == SHM_ATTACH)
- {
- shmnode *tempnode = shm_head;
- while (tempnode)
- {
- if (tempnode->shm_id == parameters.in.shm_id)
- {
- InterlockedIncrement (&tempnode->shmds->shm_nattch);
- header.error_code = 0;
- CloseHandle (token_handle);
- return;
- }
- tempnode = tempnode->next;
- }
- header.error_code = EINVAL;
- CloseHandle (token_handle);
- return;
- }
-
- /* Someone detached */
- if (parameters.in.type == SHM_DETACH)
- {
- shmnode *tempnode = shm_head;
- while (tempnode)
- {
- if (tempnode->shm_id == parameters.in.shm_id)
- {
- InterlockedDecrement (&tempnode->shmds->shm_nattch);
- header.error_code = 0;
- CloseHandle (token_handle);
- return;
- }
- tempnode = tempnode->next;
- }
- header.error_code = EINVAL;
- CloseHandle (token_handle);
- return;
- }
-
- /* Someone wants the ID removed. */
- if (parameters.in.type == SHM_DEL)
- {
- shmnode **tempnode = &shm_head;
- while (*tempnode)
- {
- if ((*tempnode)->shm_id == parameters.in.shm_id)
- {
- // unlink from the accessible node list
- shmnode *temp2 = *tempnode;
- *tempnode = temp2->next;
- // link into the deleted list
- temp2->next = deleted_head;
- deleted_head = temp2;
-
- // FIXME: when/where do we delete the handles?
- if (temp2->shmds->shm_nattch)
- {
- // FIXME: add to a pending queue?
- }
- else
- {
- delete_shmnode (&temp2);
- }
-
- header.error_code = 0;
- CloseHandle (token_handle);
- return;
- }
- tempnode = &(*tempnode)->next;
- }
- header.error_code = EINVAL;
- CloseHandle (token_handle);
- return;
- }
-
-
- if (parameters.in.type == SHM_CREATE)
- {
- /* FIXME: enter the checking for existing keys mutex. This mutex _must_ be system wide
- * to prevent races on shmget.
- */
-
- if (parameters.in.key == IPC_PRIVATE)
- {
- /* create the mapping name (CYGWINSHMKPRIVATE_0x01234567 */
- /* The K refers to Key, the actual mapped area has D */
- long private_key = (int) InterlockedIncrement (&new_private_key);
- snprintf (stringbuf, 29, "CYGWINSHMKPRIVATE_0x%0x", private_key);
- shmname = stringbuf;
- snprintf (stringbuf1, 29, "CYGWINSHMDPRIVATE_0x%0x", private_key);
- shmaname = stringbuf1;
- }
- else
- {
- /* create the mapping name (CYGWINSHMK0x0123456789abcdef */
- /* The K refers to Key, the actual mapped area has D */
-
- snprintf (stringbuf, 29, "CYGWINSHMK0x%0qx", parameters.in.key);
- shmname = stringbuf;
- snprintf (stringbuf1, 29, "CYGWINSHMD0x%0qx", parameters.in.key);
- shmaname = stringbuf1;
- debug_printf ("system id strings are \n%s\n%s\n", shmname,
- shmaname);
- debug_printf ("key input value is 0x%0qx\n", parameters.in.key);
- }
-
- /* attempt to open the key */
-
- /* get an existing key */
- /* On unix the same shmid identifier is returned on multiple calls to shm_get
- * with the same key and size. Different modes is a ?.
- */
-
-
-
- /* walk the list of known keys and return the id if found. remember, we are
- * authoritative...
- */
-
- shmnode *tempnode = shm_head;
- while (tempnode)
- {
- if (tempnode->key == parameters.in.key
- && parameters.in.key != IPC_PRIVATE)
- {
- // FIXME: free the mutex
- if (parameters.in.size
- && tempnode->shmds->shm_segsz < parameters.in.size)
- {
- header.error_code = EINVAL;
- CloseHandle (token_handle);
- return;
- }
- /* FIXME: can the same process call this twice without error ? test
- * on unix
- */
- if ((parameters.in.shmflg & IPC_CREAT)
- && (parameters.in.shmflg & IPC_EXCL))
- {
- header.error_code = EEXIST;
- debug_printf
- ("attempt to exclusively create already created shm_area with key 0x%0qx\n",
- parameters.in.key);
- // FIXME: free the mutex
- CloseHandle (token_handle);
- return;
- }
- // FIXME: do we need to other tests of the requested mode with the
- // tempnode->shm_id mode ? testcase on unix needed.
- // FIXME how do we do the security test? or
- // do we wait for shmat to bother with that?
- /* One possibly solution: impersonate the client, and then test we can
- * reopen the area. In fact we'll probably have to do that to get
- * handles back to them, alternatively just tell them the id, and then
- * let them attempt the open.
- */
- parameters.out.shm_id = tempnode->shm_id;
- if (check_and_dup_handle
- (GetCurrentProcess (), from_process_handle, token_handle,
- DUPLICATE_SAME_ACCESS, tempnode->filemap,
- &parameters.out.filemap, TRUE) != 0)
- {
- printf ("error duplicating filemap handle (%lu)\n",
- GetLastError ());
- header.error_code = EACCES;
-/*mutex*/
- CloseHandle (token_handle);
- return;
- }
- if (check_and_dup_handle
- (GetCurrentProcess (), from_process_handle, token_handle,
- DUPLICATE_SAME_ACCESS, tempnode->attachmap,
- &parameters.out.attachmap, TRUE) != 0)
- {
- printf ("error duplicating attachmap handle (%lu)\n",
- GetLastError ());
- header.error_code = EACCES;
-/*mutex*/
- CloseHandle (token_handle);
- return;
- }
-
- CloseHandle (token_handle);
- return;
- }
- tempnode = tempnode->next;
- }
- /* couldn't find a currently open shm area. */
-
- /* create one */
- /* do this as the client */
- conn->impersonate_client ();
- /* This may need sh_none... it's only a control structure */
- HANDLE filemap = CreateFileMapping (INVALID_HANDLE_VALUE, // system pagefile.
- &sa,
- PAGE_READWRITE, // protection
- 0x00000000,
- getsystemallocgranularity (),
- shmname // object name
- );
- int lasterr = GetLastError ();
- conn->revert_to_self ();
-
- if (filemap == NULL)
- {
- /* We failed to open the filemapping ? */
- system_printf ("failed to open file mapping: %lu\n",
- GetLastError ());
- // free the mutex
- // we can assume that it exists, and that it was an access problem.
- header.error_code = EACCES;
- CloseHandle (token_handle);
- return;
- }
-
- /* successfully opened the control region mapping */
- /* did we create it ? */
- int oldmapping = lasterr == ERROR_ALREADY_EXISTS;
- if (oldmapping)
- {
- /* should never happen - we are the global daemon! */
-#if 0
- if ((parameters.in.shmflg & IPC_CREAT)
- && (parameters.in.shmflg & IPC_EXCL))
-#endif
- {
- /* FIXME free mutex */
- CloseHandle (filemap);
- header.error_code = EEXIST;
- CloseHandle (token_handle);
- return;
- }
- }
-
- /* we created a new mapping */
- if (parameters.in.key != IPC_PRIVATE &&
- (parameters.in.shmflg & IPC_CREAT) == 0)
- {
- CloseHandle (filemap);
- /* FIXME free mutex */
- header.error_code = ENOENT;
- CloseHandle (token_handle);
- return;
- }
-
- conn->impersonate_client ();
- void *mapptr = MapViewOfFile (filemap, FILE_MAP_WRITE, 0, 0, 0);
- conn->revert_to_self ();
-
- if (!mapptr)
- {
- CloseHandle (filemap);
- //FIXME: close filemap and free the mutex
- /* we couldn't access the mapped area with the requested permissions */
- header.error_code = EACCES;
- CloseHandle (token_handle);
- return;
- }
-
- conn->impersonate_client ();
- /* Now get the user data */
- HANDLE attachmap = CreateFileMapping (INVALID_HANDLE_VALUE, // system pagefile
- &sa,
- PAGE_READWRITE, // protection (FIXME)
- 0x00000000,
- parameters.in.size +
- parameters.in.size %
- getsystemallocgranularity (),
- shmaname // object name
- );
- conn->revert_to_self ();
-
- if (attachmap == NULL)
- {
- system_printf ("failed to get shm attachmap\n");
- header.error_code = ENOMEM;
- UnmapViewOfFile (mapptr);
- CloseHandle (filemap);
- /* FIXME exit the mutex */
- CloseHandle (token_handle);
- return;
- }
-
- shmid_ds *shmtemp = new shmid_ds;
- if (!shmtemp)
- {
- system_printf ("failed to malloc shm node\n");
- header.error_code = ENOMEM;
- UnmapViewOfFile (mapptr);
- CloseHandle (filemap);
- CloseHandle (attachmap);
- /* FIXME exit mutex */
- CloseHandle (token_handle);
- return;
- }
-
- /* fill out the node data */
- shmtemp->shm_perm.cuid = getuid ();
- shmtemp->shm_perm.uid = shmtemp->shm_perm.cuid;
- shmtemp->shm_perm.cgid = getgid ();
- shmtemp->shm_perm.gid = shmtemp->shm_perm.cgid;
- shmtemp->shm_perm.mode = parameters.in.shmflg & 0x01ff;
- shmtemp->shm_lpid = 0;
- shmtemp->shm_nattch = 0;
- shmtemp->shm_atime = 0;
- shmtemp->shm_dtime = 0;
- shmtemp->shm_ctime = time (NULL);
- shmtemp->shm_segsz = parameters.in.size;
- *(shmid_ds *) mapptr = *shmtemp;
- shmtemp->mapptr = mapptr;
-
- /* no need for InterlockedExchange here, we're serialised by the global mutex */
- tempnode = new shmnode;
- tempnode->shmds = shmtemp;
- tempnode->shm_id = (int) InterlockedIncrement (&new_id);
- tempnode->key = parameters.in.key;
- tempnode->filemap = filemap;
- tempnode->attachmap = attachmap;
- tempnode->next = shm_head;
- shm_head = tempnode;
-
- /* we now have the area in the daemon list, opened.
-
- FIXME: leave the system wide shm mutex */
-
- parameters.out.shm_id = tempnode->shm_id;
- if (check_and_dup_handle (GetCurrentProcess (), from_process_handle,
- token_handle,
- DUPLICATE_SAME_ACCESS,
- tempnode->filemap, &parameters.out.filemap,
- TRUE) != 0)
- {
- printf ("error duplicating filemap handle (%lu)\n",
- GetLastError ());
- header.error_code = EACCES;
- CloseHandle (token_handle);
-/* mutex et al */
- return;
- }
- if (check_and_dup_handle (GetCurrentProcess (), from_process_handle,
- token_handle,
- DUPLICATE_SAME_ACCESS,
- tempnode->attachmap,
- &parameters.out.attachmap, TRUE) != 0)
- {
- printf ("error duplicating attachmap handle (%lu)\n",
- GetLastError ());
- header.error_code = EACCES;
- CloseHandle (from_process_handle);
- CloseHandle (token_handle);
-/* more cleanup... yay! */
- return;
- }
- CloseHandle (token_handle);
-
- return;
- }
-
- header.error_code = ENOSYS;
- CloseHandle (token_handle);
-
-
- return;
-}
diff --git a/winsup/cygserver/shm.h b/winsup/cygserver/shm.h
deleted file mode 100755
index f1dcaa53f..000000000
--- a/winsup/cygserver/shm.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* cygserver_shm.h
-
- Copyright 2001, 2002 Red Hat Inc.
- Written by Robert Collins <rbtcollins@hotmail.com>
-
-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 <sys/types.h>
-#include "cygwin/cygserver_transport.h"
-#include "cygwin/cygserver.h"
-
-#define SHM_CREATE 0
-#define SHM_REATTACH 1
-#define SHM_ATTACH 2
-#define SHM_DETACH 3
-#define SHM_DEL 4
-
-
-class client_request_shm : public client_request
-{
- public:
-#ifndef __INSIDE_CYGWIN__
- virtual void serve (transport_layer_base *conn, process_cache *cache);
-#endif
- client_request_shm (key_t, size_t, int, char psdbuf[4096], pid_t);
- client_request_shm ();
- client_request_shm (int, int, pid_t);
- client_request_shm (int, int);
- union {
- struct {int type; pid_t pid; int shm_id; key_t key; size_t size; int shmflg; char sd_buf[4096];} in;
- struct {int shm_id; HANDLE filemap; HANDLE attachmap; key_t key;} out;
- } parameters;
-};
-
-#ifndef __INSIDE_CYGWIN__
-class shm_cleanup : cleanup_routine
-{
-public:
- virtual void cleanup (long winpid);
-};
-#endif
-#if 0
-class _shmattach {
-public:
- void *data;
- class _shmattach *next;
-};
-
-class shmid_ds {
-public:
- struct ipc_perm shm_perm;
- size_t shm_segsz;
- pid_t shm_lpid;
- pid_t shm_cpid;
- shmatt_t shm_nattch;
- time_t shm_atime;
- time_t shm_dtime;
- time_t shm_ctime;
- HANDLE filemap;
- HANDLE attachmap;
- void *mapptr;
- class _shmattach *attachhead;
-};
-
-class shmnode {
-public:
- class shmid_ds * shmid;
- class shmnode *next;
- key_t key;
-};
-//....
-struct shmid_ds {
- struct ipc_perm shm_perm;
- size_t shm_segsz;
- pid_t shm_lpid;
- pid_t shm_cpid;
- shmatt_t shm_nattch;
- time_t shm_atime;
- time_t shm_dtime;
- time_t shm_ctime;
-};
-
-void *shmat(int, const void *, int);
-int shmctl(int, int, struct shmid_ds *);
-int shmdt(const void *);
-int shmget(key_t, size_t, int);
-
-#endif
diff --git a/winsup/cygserver/threaded_queue.cc b/winsup/cygserver/threaded_queue.cc
deleted file mode 100644
index 321fa1612..000000000
--- a/winsup/cygserver/threaded_queue.cc
+++ /dev/null
@@ -1,250 +0,0 @@
-/* threaded_queue.cc
-
- Copyright 2001, 2002 Red Hat Inc.
-
- Written by Robert Collins <rbtcollins@hotmail.com>
-
- 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 <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <windows.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include "wincap.h"
-#include "threaded_queue.h"
-#define DEBUG 1
-#define debug_printf if (DEBUG) printf
-
-/* threaded_queue */
-
-DWORD WINAPI
-worker_function (LPVOID LpParam)
-{
- class threaded_queue *queue = (class threaded_queue *) LpParam;
- class queue_request *request;
- /* FIXME use a threadsafe pop instead for speed? */
- while (queue->active)
- {
- EnterCriticalSection (&queue->queuelock);
- while (!queue->request && queue->active)
- {
- LeaveCriticalSection (&queue->queuelock);
- DWORD rc = WaitForSingleObject (queue->event, INFINITE);
- if (rc == WAIT_FAILED)
- {
- printf ("Wait for event failed\n");
- queue->running--;
- ExitThread (0);
- }
- EnterCriticalSection (&queue->queuelock);
- }
- if (!queue->active)
- {
- queue->running--;
- LeaveCriticalSection (&queue->queuelock);
- ExitThread (0);
- }
- /* not needed, but it is efficient */
- request =
- (class queue_request *) InterlockedExchangePointer (&queue->request,
- queue->request->
- next);
- LeaveCriticalSection (&queue->queuelock);
- request->process ();
- delete request;
- }
- queue->running--;
- ExitThread (0);
-}
-
-void
-threaded_queue::create_workers ()
-{
- InitializeCriticalSection (&queuelock);
- if ((event = CreateEvent (NULL, FALSE, FALSE, NULL)) == NULL)
- {
- printf ("Failed to create event queue (%lu), terminating\n",
- GetLastError ());
- exit (1);
- }
- active = true;
-
- /* FIXME: Use a stack pair and create threads on the fly whenever
- * we have to to service a request.
- */
- for (unsigned int i = 0; i < initial_workers; i++)
- {
- HANDLE hThread;
- DWORD tid;
- hThread = CreateThread (NULL, 0, worker_function, this, 0, &tid);
- if (hThread == NULL)
- {
- printf ("Failed to create thread (%lu), terminating\n",
- GetLastError ());
- exit (1);
- }
- CloseHandle (hThread);
- running++;
- }
-}
-
-void
-threaded_queue::cleanup ()
-{
- /* harvest the threads */
- active = false;
- /* kill the request processing loops */
- queue_process_param *reqloop;
- /* make sure we don't race with a incoming request creation */
- EnterCriticalSection (&queuelock);
- reqloop =
- (queue_process_param *) InterlockedExchangePointer (&process_head, NULL);
- while (reqloop)
- {
- queue_process_param *t = reqloop;
- reqloop = reqloop->next;
- delete t;
- }
- LeaveCriticalSection (&queuelock);
- if (!running)
- return;
- printf ("Waiting for current queue threads to terminate\n");
- for (int n = running; n; n--)
- PulseEvent (event);
- while (running)
- sleep (1);
- DeleteCriticalSection (&queuelock);
- CloseHandle (event);
-}
-
-/* FIXME: return success or failure */
-void
-threaded_queue::add (queue_request * therequest)
-{
- /* safe to not "Try" because workers don't hog this, they wait on the event
- */
- EnterCriticalSection (&queuelock);
- if (!running)
- {
- printf ("No worker threads to handle request!\n");
- }
- if (!request)
- request = therequest;
- else
- {
- /* add to the queue end. */
- queue_request *listrequest = request;
- while (listrequest->next)
- listrequest = listrequest->next;
- listrequest->next = therequest;
- }
- PulseEvent (event);
- LeaveCriticalSection (&queuelock);
-}
-
-/* FIXME: return success or failure rather than quitting */
-void
-threaded_queue::process_requests (queue_process_param * params,
- threaded_queue_thread_function *
- request_loop)
-{
- if (params->start (request_loop, this) == false)
- exit (1);
- params->next =
- (queue_process_param *) InterlockedExchangePointer (&process_head,
- params);
-}
-
-/* queue_process_param */
-/* How does a constructor return an error? */
-queue_process_param::queue_process_param (bool ninterruptible):running (false), shutdown (false),
-interruptible
-(ninterruptible)
-{
- if (!interruptible)
- return;
- debug_printf ("creating an interruptible processing thread\n");
- if ((interrupt = CreateEvent (NULL, FALSE, FALSE, NULL)) == NULL)
- {
- printf ("Failed to create interrupt event (%lu), terminating\n",
- GetLastError ());
- exit (1);
- }
-}
-
-queue_process_param::~queue_process_param ()
-{
- if (running)
- stop ();
- if (!interruptible)
- return;
- CloseHandle (interrupt);
-}
-
-bool
- queue_process_param::start (threaded_queue_thread_function * request_loop,
- threaded_queue * thequeue)
-{
- queue = thequeue;
- hThread = CreateThread (NULL, 0, request_loop, this, 0, &tid);
- if (hThread)
- {
- running = true;
- return true;
- }
- printf ("Failed to create thread (%lu), terminating\n", GetLastError ());
- return false;
-}
-
-void
-queue_process_param::stop ()
-{
- if (interruptible)
- {
- InterlockedExchange (&shutdown, true);
- PulseEvent (interrupt);
- /* Wait up to 50 ms for the thread to exit. If it doesn't _and_ we get
- * scheduled again, we print an error and exit. We _should_ loop or
- * try resignalling. We don't want to hand here though...
- */
- int n = 5;
- while (n-- && WaitForSingleObject (hThread, 1000) == WAIT_TIMEOUT);
- if (!n)
- {
- printf ("Process thread didn't shutdown cleanly after 200ms!\n");
- exit (1);
- }
- else
- running = false;
- }
- else
- {
- printf ("killing request loop thread %ld\n", tid);
- int rc;
- if (!(rc = TerminateThread (hThread, 0)))
- {
- printf ("error shutting down request loop worker thread\n");
- }
- running = false;
- }
- CloseHandle (hThread);
-}
-
-/* queue_request */
-queue_request::queue_request ():next (NULL)
-{
-}
-
-void
-queue_request::process (void)
-{
- printf ("\n**********************************************\n"
- "Oh no! we've hit the base queue_request process() function, and this indicates a coding\n"
- "fault !!!\n" "***********************************************\n");
-}
diff --git a/winsup/cygserver/transport.cc b/winsup/cygserver/transport.cc
deleted file mode 100644
index 01f044406..000000000
--- a/winsup/cygserver/transport.cc
+++ /dev/null
@@ -1,92 +0,0 @@
-/* cygserver_transport.cc
-
- Copyright 2001, 2002 Red Hat Inc.
-
- Written by Robert Collins <rbtcollins@hotmail.com>
-
- 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 <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <windows.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include "wincap.h"
-#include "cygwin/cygserver_transport.h"
-#include "cygwin/cygserver_transport_pipes.h"
-#include "cygwin/cygserver_transport_sockets.h"
-
-/* to allow this to link into cygwin and the .dll, a little magic is needed. */
-#ifndef __OUTSIDE_CYGWIN__
-#include "winsup.h"
-#else
-#define debug_printf printf
-#endif
-
-/* The factory */
-class transport_layer_base *create_server_transport()
-{
- transport_layer_base *temp;
- /* currently there is only the base class! */
- if (wincap.is_winnt ())
- temp = new transport_layer_pipes ();
- else
- temp = new transport_layer_sockets ();
- return temp;
-}
-
-
-transport_layer_base::transport_layer_base ()
-{
- /* should we throw an error of some sort ? */
-}
-
-void
-transport_layer_base::listen ()
-{
-}
-
-class transport_layer_base *
-transport_layer_base::accept ()
-{
- return NULL;
-}
-
-void
-transport_layer_base::close()
-{
-}
-
-ssize_t
-transport_layer_base::read (char *buf, size_t len)
-{
- return 0;
-}
-
-ssize_t
-transport_layer_base::write (char *buf, size_t len)
-{
- return 0;
-}
-
-bool
-transport_layer_base::connect ()
-{
- return false;
-}
-
-void
-transport_layer_base::impersonate_client ()
-{
-}
-
-void
-transport_layer_base::revert_to_self ()
-{
-}
diff --git a/winsup/cygserver/transport_pipes.cc b/winsup/cygserver/transport_pipes.cc
deleted file mode 100644
index f2221700f..000000000
--- a/winsup/cygserver/transport_pipes.cc
+++ /dev/null
@@ -1,210 +0,0 @@
-/* cygserver_transport_pipes.cc
-
- Copyright 2001, 2002 Red Hat Inc.
-
- Written by Robert Collins <rbtcollins@hotmail.com>
-
- 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 <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <windows.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include "wincap.h"
-#include "cygwin/cygserver_transport.h"
-#include "cygwin/cygserver_transport_pipes.h"
-
-/* to allow this to link into cygwin and the .dll, a little magic is needed. */
-#ifndef __OUTSIDE_CYGWIN__
-#include "winsup.h"
-#else
-#define DEBUG 0
-#define debug_printf if (DEBUG) printf
-#endif
-
-//SECURITY_DESCRIPTOR transport_layer_pipes::sd;
-//SECURITY_ATTRIBUTES transport_layer_pipes::sec_none_nih, transport_layer_pipes::sec_all_nih;
-//bool transport_layer_pipes::inited = false;
-
-transport_layer_pipes::transport_layer_pipes (HANDLE new_pipe)
-{
- inited = false; //FIXME: allow inited, sd, all_nih_.. to be static members
- pipe = new_pipe;
- if (inited != true)
- init_security();
-};
-
-transport_layer_pipes::transport_layer_pipes ()
-{
- inited = false;
- pipe = NULL;
- strcpy(pipe_name, "\\\\.\\pipe\\cygwin_lpc");
- if (inited != true)
- init_security();
-}
-
-void
-transport_layer_pipes::init_security()
-{
- /* FIXME: pthread_once or equivalent needed */
- InitializeSecurityDescriptor (&sd, SECURITY_DESCRIPTOR_REVISION);
- SetSecurityDescriptorDacl (&sd, TRUE, 0, FALSE);
-
- sec_none_nih.nLength = sec_all_nih.nLength = sizeof (SECURITY_ATTRIBUTES);
- sec_none_nih.bInheritHandle = sec_all_nih.bInheritHandle = FALSE;
- sec_none_nih.lpSecurityDescriptor = NULL;
- sec_all_nih.lpSecurityDescriptor = &sd;
- inited = true;
-}
-
-void
-transport_layer_pipes::listen ()
-{
- /* no-op */
-}
-
-class transport_layer_pipes *
-transport_layer_pipes::accept ()
-{
- if (pipe)
- {
- debug_printf ("Already have a pipe in this %p\n",this);
- return NULL;
- }
-
- pipe = CreateNamedPipe (pipe_name,
- PIPE_ACCESS_DUPLEX,
- PIPE_TYPE_BYTE | PIPE_WAIT,
- PIPE_UNLIMITED_INSTANCES,
- 0, 0, 1000,
- &sec_all_nih );
- if (pipe == INVALID_HANDLE_VALUE)
- {
- debug_printf ("error creating pipe (%lu)\n.", GetLastError ());
- return NULL;
- }
-
- if ( !ConnectNamedPipe ( pipe, NULL ) &&
- GetLastError () != ERROR_PIPE_CONNECTED)
- {
- printf ("error connecting to pipe (%lu)\n.", GetLastError ());
- CloseHandle (pipe);
- pipe = NULL;
- return NULL;
- }
-
- transport_layer_pipes *new_conn = new transport_layer_pipes (pipe);
- pipe = NULL;
-
- return new_conn;
-}
-
-void
-transport_layer_pipes::close()
-{
- debug_printf ("closing pipe %p\n", pipe);
- if (pipe && pipe != INVALID_HANDLE_VALUE)
- {
- FlushFileBuffers (pipe);
- DisconnectNamedPipe (pipe);
- CloseHandle (pipe);
- }
-}
-
-ssize_t
-transport_layer_pipes::read (char *buf, size_t len)
-{
- debug_printf ("reading from pipe %p\n", pipe);
- if (!pipe || pipe == INVALID_HANDLE_VALUE)
- return -1;
-
- DWORD bytes_read;
- DWORD rc = ReadFile (pipe, buf, len, &bytes_read, NULL);
- if (!rc)
- {
- debug_printf ("error reading from pipe (%lu)\n", GetLastError ());
- return -1;
- }
- return bytes_read;
-}
-
-ssize_t
-transport_layer_pipes::write (char *buf, size_t len)
-{
- debug_printf ("writing to pipe %p\n", pipe);
- DWORD bytes_written, rc;
- if (!pipe || pipe == INVALID_HANDLE_VALUE)
- return -1;
-
- rc = WriteFile (pipe, buf, len, &bytes_written, NULL);
- if (!rc)
- {
- debug_printf ("error writing to pipe (%lu)\n", GetLastError ());
- return -1;
- }
- return bytes_written;
-}
-
-bool
-transport_layer_pipes::connect ()
-{
- if (pipe && pipe != INVALID_HANDLE_VALUE)
- {
- debug_printf ("Already have a pipe in this %p\n",this);
- return false;
- }
-
- while (1)
- {
- pipe = CreateFile (pipe_name,
- GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- &sec_all_nih,
- OPEN_EXISTING,
- 0, NULL);
-
- if (pipe != INVALID_HANDLE_VALUE)
- /* got the pipe */
- return true;
-
- if (GetLastError () != ERROR_PIPE_BUSY)
- {
- debug_printf ("Error opening the pipe (%lu)\n", GetLastError ());
- pipe = NULL;
- return false;
- }
- if (!WaitNamedPipe (pipe_name, 20000))
- debug_printf ( "error connecting to server pipe after 20 seconds (%lu)\n", GetLastError () );
- /* We loop here, because the pipe exists but is busy. If it doesn't exist
- * the != ERROR_PIPE_BUSY will catch it.
- */
- }
-}
-
-void
-transport_layer_pipes::impersonate_client ()
-{
- debug_printf ("impersonating pipe %p\n", pipe);
- if (pipe && pipe != INVALID_HANDLE_VALUE)
- {
- BOOL rv = ImpersonateNamedPipeClient (pipe);
- if (!rv)
- debug_printf ("Failed to Impersonate the client, (%lu)\n", GetLastError ());
- }
- debug_printf("I am who you are\n");
-}
-
-void
-transport_layer_pipes::revert_to_self ()
-{
- RevertToSelf ();
- debug_printf("I am who I yam\n");
-}
-
diff --git a/winsup/cygserver/transport_sockets.cc b/winsup/cygserver/transport_sockets.cc
deleted file mode 100644
index a3a98b3e5..000000000
--- a/winsup/cygserver/transport_sockets.cc
+++ /dev/null
@@ -1,131 +0,0 @@
-/* cygserver_transport_sockets.cc
-
- Copyright 2001, 2002 Red Hat Inc.
-
- Written by Robert Collins <rbtcollins@hotmail.com>
-
- 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 <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <windows.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include "wincap.h"
-#include "cygwin/cygserver_transport.h"
-#include "cygwin/cygserver_transport_sockets.h"
-
-/* to allow this to link into cygwin and the .dll, a little magic is needed. */
-#ifndef __OUTSIDE_CYGWIN__
-#include "winsup.h"
-extern "C" int
-cygwin_socket (int af, int type, int protocol);
-extern "C" int
-cygwin_connect (int fd,
- const struct sockaddr *name,
- int namelen);
-extern "C" int
-cygwin_accept (int fd, struct sockaddr *peer, int *len);
-extern "C" int
-cygwin_listen (int fd, int backlog);
-extern "C" int
-cygwin_bind (int fd, const struct sockaddr *my_addr, int addrlen);
-
-#else
-#define cygwin_accept(A,B,C) ::accept(A,B,C)
-#define cygwin_socket(A,B,C) ::socket(A,B,C)
-#define cygwin_listen(A,B) ::listen(A,B)
-#define cygwin_bind(A,B,C) ::bind(A,B,C)
-#define cygwin_connect(A,B,C) ::connect(A,B,C)
-#define debug_printf printf
-#endif
-
-transport_layer_sockets::transport_layer_sockets (int newfd): fd(newfd)
-{
- /* This may not be needed in this constructor - it's only used
- * when creating a connection via bind or connect
- */
- sockdetails.sa_family = AF_UNIX;
- strcpy (sockdetails.sa_data, "/tmp/cygdaemo");
- sdlen = strlen(sockdetails.sa_data) + sizeof(sockdetails.sa_family);
-};
-
-transport_layer_sockets::transport_layer_sockets (): fd (-1)
-{
- sockdetails.sa_family = AF_UNIX;
- strcpy (sockdetails.sa_data, "/tmp/cygdaemo");
- sdlen = strlen(sockdetails.sa_data) + sizeof(sockdetails.sa_family);
-}
-
-void
-transport_layer_sockets::listen ()
-{
- /* we want a thread pool based approach. */
- if ((fd = cygwin_socket (AF_UNIX, SOCK_STREAM,0)) < 0)
- printf ("Socket not created error %d\n", errno);
- if (cygwin_bind(fd, &sockdetails, sdlen))
- printf ("Bind doesn't like you. Tsk Tsk. Bind said %d\n", errno);
- if (cygwin_listen(fd, 5) < 0)
- printf ("And the OS just isn't listening, all it says is %d\n", errno);
-}
-
-class transport_layer_sockets *
-transport_layer_sockets::accept ()
-{
- /* FIXME: check we have listened */
- int new_fd;
-
- if ((new_fd = cygwin_accept(fd, &sockdetails, &sdlen)) < 0)
- {
- printf ("Nup, could' accept. %d\n",errno);
- return NULL;
- }
-
- transport_layer_sockets *new_conn = new transport_layer_sockets (new_fd);
-
- return new_conn;
-
-}
-
-void
-transport_layer_sockets::close()
-{
- /* FIXME - are we open? */
- ::close (fd);
-}
-
-ssize_t
-transport_layer_sockets::read (char *buf, size_t len)
-{
- /* FIXME: are we open? */
- return ::read (fd, buf, len);
-}
-
-ssize_t
-transport_layer_sockets::write (char *buf, size_t len)
-{
- /* FIXME: are we open? */
- return ::write (fd, buf, len);
-}
-
-bool
-transport_layer_sockets::connect ()
-{
- /* are we already connected? */
- if (fd != -1)
- return false;
- fd = cygwin_socket (AF_UNIX, SOCK_STREAM, 0);
- if (cygwin_connect (fd, &sockdetails, sdlen) < 0)
- {
- debug_printf("client connect failure %d\n", errno);
- ::close (fd);
- return false;
- }
- return true;
-}
diff --git a/winsup/cygwin/CYGWIN_LICENSE b/winsup/cygwin/CYGWIN_LICENSE
deleted file mode 100644
index 53369a297..000000000
--- a/winsup/cygwin/CYGWIN_LICENSE
+++ /dev/null
@@ -1,38 +0,0 @@
---------------------------------------------------------------------------
-This program is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License (GPL) 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.
---------------------------------------------------------------------------
-
- *** NOTE ***
-
-In accordance with section 10 of the GPL, Red Hat permits programs whose
-sources are distributed under a license that complies with the Open
-Source definition to be linked with libcygwin.a without libcygwin.a
-itself causing the resulting program to be covered by the GNU GPL.
-
-This means that you can port an Open Source(tm) 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 DLL
-you must adhere to the terms of the GPL, i.e., you must provide sources
-for the cygwin DLL.
-
-See http://www.opensource.org/osd.html for the precise Open Source
-Definition referenced above.
-
-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/tools/cygwin/,
-or call 866-2REDHAT ext. 3007
-
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
deleted file mode 100644
index fcf4325e1..000000000
--- a/winsup/cygwin/ChangeLog
+++ /dev/null
@@ -1,2239 +0,0 @@
-2002-06-13 Nicholas S. Wourms <nwourms@netscape.net>
-
- * winver.rc: Add more words to copyright.
-
-2002-06-13 Corinna Vinschen <corinna@vinschen.de>
-
- * cygheap.cc (cygheap_user::set_name): Revert previous change.
- * environ.cc (spenv::retrieve): Check return value of call to
- cygheap->user.*from_cygheap().
-
-2002-06-13 Corinna Vinschen <corinna@vinschen.de>
-
- * cygheap.cc (cygheap_user::set_name): Remove setting homedrive and
- homepath to NULL.
- (cygheap_user::set_logsrv): Fix free'ing of plogsrv.
- * cygheap.h (cygheap_user::cygheap_user): Initialize homedrive and
- homepath to NULL.
-
-2002-06-13 Christopher Faylor <cgf@redhat.com>
-
- * security.cc (get_logon_server): Use strcasematch rather than
- strcasecmp.
-
-2002-06-12 Christopher Faylor <cgf@redhat.com>
-
- * path.cc (chdir): Minor cleanup.
-
-2002-06-12 Christopher Faylor <cgf@redhat.com>
-
- * environ.cc (build_env): Correctly fill out windows environment block
- with win32 paths rather than posix paths.
-
-2002-06-12 Christopher Faylor <cgf@redhat.com>
-
- * cygheap.cc (cygheap_user::set_name): Set homedrive and homepath to
- NULL on user name change.
- (cygheap_user::set_logsrv): Allocate enough space for leading \\ so
- that we can put this in the environment, if needed.
- * cygheap.h (homebodies): New enum.
- (cygheap_user::homedrive): New field.
- (cygheap_user::homepath): Ditto.
- (cygheap_user::env_logsrv): New method.
- (cygheap_user::env_homepath): New method.
- (cygheap_user::env_homedrive): New method.
- (cygheap_user::env_userprofile): New method.
- (cygheap_user::ontherange): New method.
- * environ.cc (envsize): Eliminate debugging argument.
- (environ_init): Assume that envc counts number of elments not total
- size.
- (spenv): New class.
- (spenvs): New array, renamed from forced_winenv_vars, using spenv.
- (spenv::retrieve): New method.
- (build_env): Rename from 'winenv' -- one stop shopping for building new
- environment blocks for both windows and "unix".
- * environ.h (build_env: Declare.
- (winenv): Delete declaration.
- (envsize): Ditto.
- * spawn.cc (spawn_guts): Use build_env to build windows and cygwin
- environment blocks.
- * uinfo.cc (internal_getlogin): Eliminate environment manipulation.
- Default to info from GetUserName if it exists. Move HOMEPATH and
- HOMEDRIVE stuff elsewhere. Move HOME setting elsewhere. Only set HOME
- environment variable in processes that are not parented by a cygwin
- process.
- (cygheap_user::ontherange): Define new method.
- (cygheap_user::env_logsrv): Ditto.
- (cygheap_user::env_homepath): Ditto.
- (cygheap_user::env_homedrive): Ditto.
- (cygheap_user::env_userprofile): Ditto.
-
-2002-06-11 Christopher Faylor <cgf@redhat.com>
-
- * spawn.cc (spawn_guts): More hToken removal cleanup.
-
-2002-06-09 Pierre Humblet <pierre.humblet@ieee.org>
-
- * spawn.cc (spawn_guts): Define sec_attribs and call sec_user_nih()
- only once.
-
-2002-06-10 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Ensure that -MD gets added to CFLAGS regardless of
- CFLAGS command-line setting.
-
- * cygwin.din: Export sexec* functions as function which returns ENOSYS
- (i.e., sexec* is deprecated).
- * dtable.cc (dtable::vfork_child_dup): Ensure that impersonation is
- restored even on failure.
- * exec.cc: Throughout, remove references to sexec* and _spawnve.
- * pinfo.h: Remove _spawnve declaration.
- * spawn.cc: Rename _spawnve to spawnve and use throughout.
- (spawn_guts): Eliminate hToken argument and processing of same. Just
- perform special actions if impersonating.
- (spawnve): Rename from _spawnve.
-
-2002-06-10 Christopher Faylor <cgf@redhat.com>
-
- * include/sys/strace.h (strace): Avoid use of constructor.
-
-2002-06-10 Christopher Faylor <cgf@redhat.com>
-
- * dcrt0.cc (dll_crt0_1): Initialize wincap and check for sanity before
- running global ctors.
- * wincap.h (wincap): Eliminate constructor. Default is to zero memory,
- anyway.
- * wincap.cc (wincap): Copy this on fork to avoid initialization in
- forked processes.
-
-2002-06-10 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.h (fhandler_socket::fixup_after_fork): Revert patch from
- 2002-06-04.
- * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Ditto.
- (fhandler_socket::dup): Ditto.
- * net.cc (fdsock): Make sockets explicitely noninheritable on NT.
-
-2002-06-09 Christopher Faylor <cgf@redhat.com>
-
- * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Correctly
- set number of links for directory, if appropriate.
-
-2002-06-10 Robert Collins <rbtcollins@hotmail.com>
-
- * thread.cc: Variation of a patch from Thomas Pffaf.
- (__pthread_detach): Cleanup thread object if the thread has terminated.
- (__pthread_join): Change order of error checks, and lock against
- join/detach/exit races.
- (__pthread_exit): Lock object against join/detach/exit races.
- (pthread::thread_init_wrapper): Ditto.
- (thread_init_wrapper): Rename to pthread::thread_init_wrapper.
- (pthread::create): Check that the mutex initialized correctly.
- (pthread::push_cleanup_handler): Lock against potential cancellation
- race. NB: this may not be required if pthread_cleanup_push is non-
- cancelable.
- * thread.h (pthread::mutex): New member.
- (thread_init_wrapper): Rename to pthread::thread_init_wrapper.
- (pthread::thread_init_wrapper_: New static member.
-
-2002-06-10 Robert Collins <rbtcollins@hotmail.com>
-
- * cygwin.din: Add _pthread_cleanup_push and _pthread_cleanup_pop.
- * pthread.cc: Change __pthread_self to pthread::self() thruoghout.
- (_pthread_cleanup_push): New function.
- (_pthread_cleanup_pop): Ditto.
- * thread.cc: Thanks to Thomas Pfaff for the pthread cleanup_push,_pop
- patch, this work is derived from that.
- Change __pthread_self to pthread::self() thruoghout.
- (__pthread_self): Rename to pthread::self.
- (pthread::self): New method.
- (pthread::pthread): Initialize new member.
- (pthread::push_cleanup_handler): New method.
- (pthread::pop_cleanup_handler): New method.
- (pthread::pop_all_cleanup_handlers): New method.
- (__pthread_exit): Pop all cleanup handlers.
- * thread.h (pthread::push_cleanup_handler): Declare.
- (pthread::pop_cleanup_handler): Ditto.
- (pthread::pop_all_cleanup_handlers): Ditto.
- (pthread::self): New static method.
- (__pthread_exit): Give C++ linkage.
- (__pthread_join): Ditto.
- (__pthread_detach): Ditto.
- (__pthread_self): Remove.
-
-2002-04-24 Thomas Pfaff <tpfaff@gmx.net>
-
- * include/pthread.h (__pthread_cleanup_handler): New structure.
- (pthread_cleanup_push): Rewritten.
- (pthread_cleanup_pop): Ditto.
- (_pthread_cleanup_push): New prototype.
- (_pthread_cleanup_pop): Ditto.
-
-2002-04-24 Thomas Pfaff <tpfaff@gmx.net>
-
- * thread.cc (thread_init_wrapper): Check if thread is already joined.
- (__pthread_join): Set joiner first.
- (__pthread_detach): Ditto.
-
-2002-06-10 Robert Collins <rbtcollins@hotmail.com>
-
- * cygserver_transport.cc (create_server_transport): Finish the split
- out of sockets code from transport_layer_base. Thanks to Nicholas
- Wourms and Conrad Scott for catching this.
-
-2002-06-08 Christopher Faylor <cgf@redhat.com>
-
- * pinfo.cc (pinfo_dummy): Initialize to correct size.
-
-2002-06-08 Christopher Faylor <cgf@redhat.com>
-
- * path.cc: Change MOUNT_AUTO to MOUNT_CYGDRIVE throughout.
- * shared_info.h (CURR_MOUNT_MAGIC): Update.
-
-2002-06-08 Christopher Faylor <cgf@redhat.com>
-
- * external.cc (cygwin_internal): Make v1 mount table access invalid.
- * path.cc (mount_info::init): Remove had_to_create_mount_areas initialization.
- (mount_info::from_registry): Remove v1 table import.
- (mount_info::read_v1_mounts): Eliminate.
- (mount_info::import_v1_mounts): Ditto.
- * shared_info.h (mount_info): Ditto for both of above.
- * sys/mount.h (MOUNT_DEVFS): New enum.
- (MOUNT_PROC): Ditto.
-
-2002-06-08 Christopher Faylor <cgf@redhat.com>
-
- * include/wchar.h: Define __need_size_t.
-
-2002-06-07 Christopher Faylor <cgf@redhat.com>
-
- * fhandler_socket.cc (fhandler_socket::fstat): Don't assume that socket
- is unix-domain socket.
-
-2002-06-07 Christopher Faylor <cgf@redhat.com>
-
- * times.cc (hires_ms::prime): Set init flag.
-
-2002-06-07 Conrad Scott <conrad.scott@dsl.pipex.com>
-
- * times.cc (hires_ms::prime): Adjust epoch of initime_us from 1601 to
- 1970.
-
-2002-06-06 Christopher Faylor <cgf@redhat.com>
-
- * autoload.cc (timeGetDevCaps): Define new autoload function.
- (timeGetTime): Ditto.
- (timeBeginPeriod): Ditto.
- (timeEndPeriod): Ditto.
- * hires.h (hires_base): New class. Renamed from hires.
- (hires_us): New class.
- (hires_ms): New class.
- * strace.cc (strace::microseconds): Use hires_us class.
- * times.cc (gettimeofday): Use hires-ms class.
- (hires_us::prime): Renamed from hires::prime.
- (hires_us::usecs): Renamed from hires:usecs.
- (hires_ms::prime): New method.
- (hires_ms::usecs): New method.
- (hires_ms::~hires_ms): New destructor.
-
-2002-06-06 Christopher Faylor <cgf@redhat.com>
-
- * autoload.cc (noload): Correctly save argument count register.
-
-2002-06-05 Conrad Scott <conrad.scott@dsl.pipex.com>
-
- * fhandler.cc (fhandler_base::fstat): Initialise tv_nsec member of
- st_atim, st_mtim, and st_ctim fields.
- * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Ditto.
- * fhandler_process.cc (fhandler_process::fstat): Ditto.
- * glob.c (stat32_to_STAT): Copy across the whole st_atim, st_mtime, and
- st_ctim fields.
- * syscalls.cc (stat64_to_stat32): Ditto.
- * times.cc (to_timestruc_t): New function.
- (time_as_timestruc_t): New function.
- * winsup.h: Add to_timestruc_t and time_as_timestruc_t functions.
- * include/cygwin/stat.h: Replace time_t with timestruc_t throughout for
- all file times, removing the st_spare1, st_spare2, and st_spare3 fields
- in the process. Add macros to access tv_sec fields by old names.
- * include/cygwin/types.h: Typedef timespec_t and timestruc_t as struct
- timespec.
-
-2002-06-03 Pierre Humblet <pierre.humblet@ieee.org>
-
- * sec_helper.cc (lookup_name): Suppress.
- * security.cc (alloc_sd): Remove logsrv argument.
- Remove two calls to lookup_name.
- (set_security_attribute): Remove logsrv argument.
- Remove logsrv argument in call to alloc_sd.
- (set_nt_attribute): Remove logsrv argument.
- Remove logsrv argument in call to set_security_attribute.
- (set_file_attribute): Remove logsrv argument.
- Remove logsrv argument in call to set_nt_attribute.
- (set_file_attribute): Remove logsrv argument.
- Remove logsrv argument in call to set_file_attribute.
- * syscalls.cc (chown_worker): Remove logserver argument in
- call to set_file_attribute.
- (chmod): Ditto.
- * shm.cc (shmget): Remove logsrv argument in call to alloc_sd.
- * uinfo.cc (internal_getlogin): Replace calls to
- lookup_name by call to LookupAccountName.
- * security.h: Remove logsrv in declarations of set_file_attribute
- and alloc_sd. Remove declaration of lookup_name.
-
-2002-06-05 Christopher Faylor <cgf@redhat.com>
-
- * child_info.h (CHILD_INFO_MAGIC): Oops. Revert previous change. gcc
- 3.1 bug?
-
-2002-06-05 Christopher Faylor <cgf@redhat.com>
-
- * child_info.h (CHILD_INFO_MAGIC): Update.
-
-2002-06-05 Christopher Faylor <cgf@redhat.com>
-
- * strace.cc (strace::hello): Set inited, when appropriate.
-
-2002-06-05 Christopher Faylor <cgf@redhat.com>
-
- * cygwin.din: Eliminate some newlib wrappers.
- * path.cc (get_devn): Only consider first 99 potential com devices.
- (get_device_number): Ditto.
- * times.cc (_times): Eliminate.
- (_times): Renamed from times().
-
-2002-06-05 Christopher Faylor <cgf@redhat.com>
-
- * dir.cc (rmdir): Streamline. Detect attempts to remove directories
- from "read-only" virtual devices. (Suggested by Pavel Tsekov)
- * syscalls.cc (unlink): Detect attempts to remove directories from
- "read-only" virtual devices. (From Pavel Tsekov)
-
-2002-06-05 Christopher Faylor <cgf@redhat.com>
-
- * dtable.cc (handle_to_fn): Check error return value from NtQueryObject
- first before seeing if name buffer is NULL.
-
- * grp.cc (read_etc_group): Fix gcc warning regarding snprintf format.
- * passwd.cc (read_etc_passwd): Ditto.
-
-2002-04-18 Thomas Pfaff <tpfaff@gmx.net>
-
- * thread.h (pthread::joiner): New member.
- * thread.cc (pthread::pthread): Initialize joiner to NULL
- (pthread::create): Increment of thread counter moved from
- __pthread_create to this location.
- (__pthread_create): Increment thread counter removed.
- (thread_init_wrapper): Set joiner to self when thread was created
- detached.
- (__pthread_exit): delete thread when it is detached and not
- joined.
- (__pthread_join): Check for deadlock and delete thread when it has
- terminated.
- (__pthread_detach): Set joiner to self when thread state
- changed to detached.
-
-2002-06-05 Corinna Vinschen <corinna@vinschen.de>
-
- * grp.cc (read_etc_group): When emulating nonexisting group file on
- NT systems, read primary group SID from process token. Use that info
- to create correct group entry. On error or on 9x systems fallback
- to emulating Administrators group as before.
- * passwd.cc (read_etc_passwd): When emulating nonexisting passwd file
- on NT systems, read user and primary group SID from process token.
- Use that info to create correct passwd entry. On error or on 9x
- systems fallback to emulating user with Administrator user id and
- Administrators group as before.
-
-2002-06-05 Corinna Vinschen <corinna@vinschen.de>
-
- * grp.cc (etc_group): Removed.
- (parse_grp): Make line parameter nonconst. Don't copy data into new
- allocated memory. Check for CR instead of LF to accomodate new
- read method.
- (add_grp_line): Make line parameter nonconst.
- (read_etc_group): Rearrange using new pwdgrp_read class.
- * passwd.cc (parse_pwd): Don't copy data into new allocated memory.
- Check for CR instead of LF to accomodate new read method.
- (read_etc_passwd): Rearrange using new pwdgrp_read class.
- * pwdgrp.h (pwdgrp_check::set_last_modified): Use different
- parameters.
- (class pwdgrp_read): New class for opening and reading passwd and
- group files.
-
-2002-06-04 Christopher Faylor <cgf@redhat.com>
-
- * dtable.cc (handle_to_fn): Attempt to handle "raw" accesses to remote
- shares.
- * path.cc (mount_info::conv_to_win32_path): Set flags to binary when
- mount entry is not found.
- (mount_info::set_flags_from_win32_path): Ditto.
-
-2002-06-04 Christopher Faylor <cgf@redhat.com>
-
- * dtable.cc (handle_to_fn): Correct placement and length of name
- buffer. (Suggested by Pavel Tsekov)
-
-2002-06-04 Christopher Faylor <cgf@redhat.com>
-
- Remove fcntl.h includes throughout.
- * fhandler.h: Move fcntl.h include here.
- (fhandler_base::set_flags): Accept supplied_bin argument. Make
- non-inlined.
- * dtable.cc (dtable::init_std_file_from_handle): Just use binmode from
- pc.
- (reset_to_open_binmode): Use set_flags.
- * cygwin.din (open): Avoid newlib wrapper.
- (read): Ditto.
- (unlink): Ditto.
- (write): Ditto.
- * fhandler.cc (fhandler_base::set_flags): Accept supplied_bin argument.
- Make binmode decisions here.
- (fhandler_base::open): Avoid using pc if it is NULL. Eliminate binmode
- logic. Just call set_flags with binmode argument.
- (fhandler_base::init): Call set_flags with binmode argument.
- * fhandler_clipboard.cc (fhandler_dev_clipboard::open): Ditto.
- * fhandler_console.cc (fhandler_console::open): Ditto.
- (fhandler_console::init): Force binary on open.
- * fhandler_disk_file.cc (fhandler_disk_file::open): Don't set binmode
- here. Let it happen in base class.
- * fhandler_dsp.cc (fhandler_dev_dsp::open): Force binmode open. Set
- return value appropriately if unable to open.
- * fhandler_proc.cc (fhandler_proc::open): Make sure flags are set
- before open_status.
- * fhandler_process.cc (fhandler_process::open): Ditto.
- * fhandler_registry.cc (fhandler_registry::open): Ditto.
- * fhandler_random.cc (fhandler_dev_random::fhandler_dev_random): Ditto.
- * fhandler_raw.cc (fhandler_dev_raw::open): Force O_BINARY by default.
- * fhandler_serial.cc (fhandler_serial::init): Ditto.
- * fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
- (fhandler_pty_master::open): Ditto.
- * fhandler_virtual.cc (fhandler_virtual::open): Ditto.
- * fhandler_windows.cc (fhandler_windows::open): Ditto.
- * fhandler_zero.cc (fhandler_dev_zero::open): Ditto.
- * net.cc (fdsock): Ditto.
- * path.cc (path_conv::check): Avoid checking for executable extension
- when directory. (Suggested by Pavel Tsekov)
- (set_flags): Set PATH_TEXT explicitly, when appropriate.
- (mount_info::conv_to_win32_path): Use set_flags() to set path flags.
- * path.h (PATH_TEXT): New enum.
- (path_conv::binmode): Return appropriate constant based on binmode.
- * pipe.cc (make_pipe): Set binmode to O_TEXT xor O_BINARY.
- * syscalls.cc (setmode_helper): Make debugging message a little
- clearer.
- (setmode): Set binmode via set_flags.
-
-2002-06-04 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.h (class fhandler_socket): Add private method
- fixup_after_fork (bool, HANDLE).
- * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Move
- functionality to new private method. Add closing parent socket
- if not called from dup(). Create method new calling private method
- with appropriate parameter.
- (fhandler_socket::fixup_after_exec): Call private method
- fixup_after_fork with appropriate parameter.
- (fhandler_socket::dup): Ditto.
-
-2002-06-04 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_dsp.cc (fhandler_dev_dsp::open): Set errno to EACCES if
- requested mode isn't supported.
-
-2002-06-03 Christopher Faylor <cgf@redhat.com>
-
- * fhandler.cc (fhandler_base::open): Don't set binmode if already set.
- Don't check for file. Files should already be set. Report on binary
- mode for debugging.
- (fhandler_base::fhandler_base): Don't set default binmode here. That's
- for later.
- * fhandler_console.cc (fhandler_console::output_tcsetattr): Don't set
- binmode, ever, for console.
- * fhandler_disk_file.cc (fhandler_disk_file::open): Always set the
- binary mode to the value derived from mount table.
- * path.cc (mount_info::conv_to_win32_path): Default to binmode if path
- does not translate into anything in the mount table.
-
-2002-06-03 Corinna Vinschen <corinna@vinschen.de>
-
- * external.cc (cygwin_internal): Add CW_EXTRACT_DOMAIN_AND_USER
- handling to call extract_nt_dom_user() from applications.
- * include/sys/cygwin.h (cygwin_getinfo_types): Add
- CW_EXTRACT_DOMAIN_AND_USER.
-
-2002-06-03 Corinna Vinschen <corinna@vinschen.de>
-
- * syscalls.cc (stat64_to_stat32): Transform st_dev correctly.
- (fstat64): Add evaluating st_ino and st_dev.
- (stat_worker): Evaluate st_dev as 32 bit value.
- * include/cygwin/stat.h: Use new dev_t definition throughout.
- * include/cygwin/types.h: Define __dev16_t and __dev32_t. Define
- dev_t according to __CYGWIN_USE_BIG_TYPES__ setting.
- * include/sys/sysmacros.h: Define major, minor and makedev
- according to __CYGWIN_USE_BIG_TYPES__ setting.
-
-2002-06-03 Pierre Humblet <pierre.humblet@ieee.org>
-
- * syscalls.cc (setegid32): Verify the correctness of the gid
- of the group returned by getgrgid32.
-
-2002-06-03 Pierre Humblet <pierre.humblet@ieee.org>
-
- * security.cc (lsa2wchar): Suppressed.
- (get_lsa_srv_inf): Suppressed.
- (get_logon_server_and_user_domain): Suppressed.
- (get_logon_server): Essentially new.
- (get_user_groups): Add "domain" argument. Only lookup the
- designated server and use "domain" in LookupAccountName.
- (is_group_member): Simplify the arguments.
- (get_user_local_groups): Simplify the arguments. Do only a
- local lookup. Use "BUILTIN" and local domain in LookupAccountName.
- (get_user_primary_group). Only lookup the designated server.
- (get_group_sidlist): Remove logonserver argument. Do not lookup
- any server for the SYSTEM account.
- (create_token): Delete logonserver and call to get_logon_server.
- Adjust arguments of get_group_sidlist, see above.
- * security.h: Delete declaration of get_logon_server_and_user_domain
- and add declaration of get_logon_server.
- * uinfo.cc (internal_get_login): Call get_logon_server instead of
- get_logon_server_and_user_domain.
-
-2002-06-02 Christopher Faylor <cgf@redhat.com>
-
- * dtable.cc (handle_to_fn): Use largest match for device. Correctly
- (?) deal with remote drive weirdness.
-
-2002-06-02 Christopher Faylor <cgf@redhat.com>
-
- * fhandler_disk_file.cc (fhandler_disk_file::fstat_by_name): Check
- specifically for non-existent file, first.
- (fhandler_disk_file::fstat): Perform fd open on files with funny
- characters.
-
-2002-06-02 Christopher January <chris@atomice.net>
-
- * fhandler_process.cc (fhandler_process::open): Set fileid.
-
-2002-06-02 Christopher Faylor <cgf@redhat.com>
-
- Remove unneeded sigproc.h includes throughout.
- * fhandler.h (fhandler_proc::fill_filebuf): Take a pinfo argument.
- * fhandler_proc.cc (fhandler_proc::get_proc_fhandler): Simplify search
- for given pid.
- (fhandler_proc::readdir): Assume that pid exists if it shows up in the
- winpid list.
- * fhandler_process.cc (fhandler_process::open): Simplify search for
- given pid. Call fill_filebuf with pinfo argument.
- (fhandler_process::fill_filebuf): Pass pinfo here and assume that it
- exists.
- * pinfo.h (pinfo::remember): Define differently if sigproc.h is not
- included.
-
-2002-06-02 Christopher Faylor <cgf@redhat.com>
-
- * dll_init.cc (dll_list::detach): Don't run destructor on exit.
-
-2002-06-01 Christopher Faylor <cgf@redhat.com>
-
- * fhandler.cc (fhandler_base::fstat): Move dev and ino calculation into
- caller.
- * syscalls.cc (stat_worker): Calculate dev and ino calculation here, if
- zero.
- * fhandler_proc.cc (fhandler_proc::fhandler_proc): Minor reorg for
- debugging.
- * fhandler_process.cc (fhandler_process::exists): Return 0 on
- nonexistence.
- (fhandler_process::fstat): Simplify pid logic.
- * fhandler_tape.cc (fhandler_dev_tape::fstat): Minor reformatting.
-
-2002-06-01 Christopher Faylor <cgf@redhat.com>
-
- * path.cc (chdir): Don't allow cd'ing to a non-directory virtual path.
-
-2002-05-31 Christopher Faylor <cgf@redhat.com>
-
- * fhandler_disk_file.cc (readdir): Move inode calculation into caller.
- (fhandler_cygdrive::readdir): Add "." and "..".
- * dir.cc (readdir): Move inode calculation here so that fhandler
- readdirs can benefit.
-
-2002-05-31 Christopher Faylor <cgf@redhat.com>
-
- * fhandler_console.cc (fhandler_console::open): Reinstate setting of
- flags.
-
- * dtable.cc (dtable::init_std_file_from_handle): Default to using
- binmode derived from path_conv, when required.
- * fhandler.h (fhandler_base::get_w_binary): Default to binmode if
- nothing else is specified.
- * fhandler.h (fhandler_base::get_r_binary): Ditto.
-
- * fhandler_disk_file.cc (fhandler_disk_file::fstat_by_handle): Work
- around g++ warning.
-
- * path.cc (path_conv::check): Remove a debugging statement.
-
-2002-05-31 Christopher Faylor <cgf@redhat.com>
-
- * fhandler_console.cc (fhandler_console::open): Always default to
- binmode.
- (fhandler_console::write_normal): Don't honor binmode setting. There
- is already a termios setting for this.
- (fhandler_console::init): Correct argument order in init call.
-
-2002-05-31 Christopher Faylor <cgf@redhat.com>
-
- * fhandler.cc (fhandler_base::open): Make default open mode == binmode.
- (fhandler_base::init): Set open flags based on derived binmode argument.
-
-2002-05-31 Christopher Faylor <cgf@redhat.com>
-
- * dll_init.cc (dll_list::init): Eliminate unneeded debugging statement.
-
-2002-05-31 Christopher Faylor <cgf@redhat.com>
-
- * fhandler_proc.cc (fhandler_proc::readdir): Set errno when no more
- files.
- * fhandler_process.cc (fhandler_process::readdir): Ditto.
- * fhandler_registry.cc (fhandler_registry::readdir): Ditto.
-
-2002-05-30 Christopher Faylor <cgf@redhat.com>
-
- * path.cc (path_conv::check): Set fileattr to INVALID_FILE_ATTRIBUTES
- for nonexistent virtual device path.
- (chdir): Set correct errno when attempt is made to cd to nonexistent
- virtual device path.
-
-2002-05-30 Christopher Faylor <cgf@redhat.com>
-
- * fhandler_disk_file.cc (fhandler_disk_file::fstat): Always call
- fstat_by_name if fd is not opened to allow fstat_by_name to properly
- set errno.
-
-2002-05-30 Corinna Vinschen <corinna@vinschen.de>
-
- * autoload.cc: Replace autoload statments for ZwXXX by NtXXX.
- Drop ZwQuerySystemInformation since NtQuerySystemInformation was
- already available.
- * fhandler_proc.cc (format_proc_uptime): Replace call to
- ZwQuerySystemInformation by call to NtQuerySystemInformation.
- (format_proc_stat): Ditto.
- * fhandler_process.cc (format_process_stat): Replace call to
- ZwQueryInformationProcess by call to NtQueryInformationProcess.
- (get_process_state): Ditto.
- (get_mem_values): Ditto. Replace call to ZwQueryVirtualMemory by
- call to NtQueryVirtualMemory.
- * ntdll.h: Cleanup. Drop ZwQuerySystemInformation since
- NtQuerySystemInformation was already available. Replace declarations
- of ZwXXX functions by declarations of NtXXX.
- * pinfo.cc (winpids::enumNT): Replace call to ZwQuerySystemInformation
- by call to NtQuerySystemInformation.
-
-2002-05-29 Christopher Faylor <cgf@redhat.com>
-
- * fhandler.cc (binmode): Default to binmode when mode is not known.
-
-2002-05-29 Christopher Faylor <cgf@redhat.com>
-
- * include/sys/cygwin.h (EXTERNAL_PINFO_VERSION): Reinstate.
- * external.cc (fillout_pinfo): Use it.
-
-2002-05-29 Corinna Vinschen <corinna@vinschen.de>
-
- * external.cc (fillout_pinfo): Use new version define.
- * include/sys/cygwin.h (external_pinfo): Define
- EXTERNAL_PINFO_VERSION_16_BIT and EXTERNAL_PINFO_VERSION_32_BIT
- instead of just EXTERNAL_PINFO_VERSION.
-
-2002-05-29 Christopher Faylor <cgf@redhat.com>
-
- * external.cc (fillout_pinfo): Set new version field in external_pinfo
- structure.
- * include/sys/cygwin.h (external_pinfo): Replace strace_file with
- version field.
-
-2002-05-29 Corinna Vinschen <corinna@vinschen.de>
-
- Change internal uid datatype from __uid16_t to __uid32_t
- throughout.
- * cygwin.din: Export new symbols getpwuid32, getpwuid_r32, getuid32,
- geteuid32, setuid32, seteuid32.
- * passwd.cc (getpwuid32): New function.
- (getpwuid_r32): Ditto.
- * syscalls.cc (seteuid32): Ditto.
- (setuid32): Ditto.
- * uinfo.cc (getuid32): Ditto.
- (geteuid32): Ditto.
- * winsup.h (uid16touid32): New macro, correct casting from __uid16_t
- to __uid32_t.
- (gid16togid32): Ditto fir gids.
- (getuid32): Declare.
- (geteuid32): Ditto.
- (getpwuid32): Ditto.
- * include/sys/cygwin.h (struct external_pinfo): Add members uid32 and
- gid32.
-
-2002-05-29 Corinna Vinschen <corinna@vinschen.de>
-
- * include/cygwin/socket.h: Protect some symbols against multiple
- definition.
- * include/netinet/ip.h: Ditto.
- * include/netinet/tcp.h: Ditto.
-
-2002-05-29 Wu Yongwei <adah@netstd.com>
-
- * include/netinet/ip.h: Replace by BSD derived version of the file.
- * include/netinet/tcp.h: Ditto.
- * include/netinet/udp.h: New file.
- * include/cygwin/ip.h: Remove.
-
-2002-05-29 Christopher Faylor <cgf@redhat.com>
-
- * dtable.cc (dtable::init_std_file_from_handle): Attempt stronger
- detection of invalid handle.
- (handle_to_fn): Detect pathological condition where NT resets the
- buffer pointer to NULL on an invalid handle.
-
-2002-05-28 Christopher Faylor <cgf@redhat.com>
-
- * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Properly
- check for whether we should be opening the file to search for #!
- characters. Set path_conv structure execability, too, when
- appropriate.
-
-2002-05-28 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (set_security_attribute): Call getegid32() instead of
- getegid().
- * include/cygwin/grp.h: Declare getegid32().
-
-2002-05-28 Corinna Vinschen <corinna@vinschen.de>
-
- Change internal gid datatype from __gid16_t to __gid32_t
- throughout.
- * cygwin.din: Export new symbols chown32, fchown32, getegid32,
- getgid32, getgrgid32, getgrnam32, getgroups32, initgroups32, lchown32,
- setgid32, setegid32, getgrent32.
- * grp.cc (grp32togrp16): New static function.
- (getgrgid32): New function.
- (getgrnam32): Ditto.
- (getgrent32): Ditto.
- (getgroups32): Change name of internal function from getgroups.
- (getgroups32): New function.
- (initgroups32): Ditto.
- * syscalls.cc (chown32): Ditto.
- (lchown32): Ditto.
- (fchown32): Ditto.
- (setegid32): Ditto.
- (setgid32): Ditto.
- * uinfo.cc (getgid32): Ditto.
- (getegid32): Ditto.
- * include/cygwin/grp.h: Remove declaration of getgrgid() and getgrnam().
- Declare getgrgid32() and getgrnam32() instead. Declare getgid32().
-
-2002-05-27 Christopher Faylor <cgf@redhat.com>
-
- * autoload.cc (noload): Properly mask low order word for determining
- number of bytes to pop.
-
-2002-05-27 Christopher Faylor <cgf@redhat.com>
-
- * fhandler_disk_file.cc (fhandler_disk_file::fstat): Minor logic
- cleanup.
-
-2002-05-27 Christopher Faylor <cgf@redhat.com>
-
- * autoload.cc (LoadFuncEx): Define via new LoadFuncEx2 macro.
- (LoadFuncEx2): Adapted from LoadFuncEx. Provides control of return
- value for nonexistent function.
- (NtQueryObject): Declare.
- (IsDebuggerPresent): Declare via LoadFuncEx2 and always return true if
- not available.
- * debug.h (being_debugged): Just rely on IsDebuggerPresent return
- value.
- * dtable.cc (handle_to_fn): New function.
- (dtable::init_std_file_from_handle): Attempt to derive std handle's
- name via handle_to_fn.
- (dtable::build_fhandler_from_name): Fill in what we can in path_conv
- structure when given a handle and path doesn't exist.
- * fhandler.cc (fhandler_base::open): Don't set the file pointer here.
- Use pc->exists () to determine if file exists rather than calling
- GetFileAttributes again.
- * fhandler.h (fhandler_base::exec_state_isknown): New method.
- (fhandler_base::fstat_helper): Add extra arguments to declaration.
- (fhandler_base::fstat_by_handle): Declare new method.
- (fhandler_base::fstat_by_name): Declare new method.
- * fhandler_disk_file (num_entries): Make __stdcall.
- (fhandler_base::fstat_by_handle): Define new method.
- (fhandler_base::fstat_by_name): Define new method.
- (fhandler_base:fstat): Call fstat_by_{handle,name} as appropriate.
- (fhandler_disk_file::fstat_helper): Accept extra arguments for filling
- out stat structure. Move handle or name specific stuff to new methods
- above.
- (fhandler_disk_file::open): Use real_path->exists rather than calling
- GetFileAttributes again.
- * ntdll.h (FILE_NAME_INFORMATION): Define new structure.
- (OBJECT_INFORMATION_CLASS): Partially define new enum.
- (OBJECT_NAME_INFORMATION): Define new structure.
- (NtQueryInformationFile): New declaration.
- (NtQueryObject): New declaration.
- * path.cc (path_conv::fillin): Define new method.
- * path.h (path_conv::fillin): Declare new method.
- (path_conv::drive_thpe): Rename from 'get_drive_type'.
- (path_conv::volser): Declare new method.
- (path_conv::volname): Declare new method.
- (path_conv::root_dir): Declare new method.
- * syscalls.cc (fstat64): Send real path_conv to fstat as second
- argument.
-
-2002-05-24 Pierre Humblet <pierre.humblet@ieee.org>
-
- * security.cc (lsa2str): New function.
- (get_priv_list): Call lsa2str instead of sys_wcstombs.
-
-2002-05-22 Pierre Humblet <pierre.humblet@ieee.org>
-
- * syscalls.cc (seteuid): Do not take allow_ntsec into account.
- Attempt to use an existing or new token even when the uid
- matches orig_uid, but the gid is not in the process token.
- Major reorganization after several incremental changes.
- (setegid): Do not take allow_ntsec into account. Minor
- reorganization after several incremental changes.
-
-2002-05-26 Christopher Faylor <cgf@redhat.com>
-
- * debug.h (being_debugged): New macro.
- * dtable.cc (dtable::extend): Use new macro.
- * exceptions.cc (try_to_debug): Ditto.
- * strace.cc (strace::hello): Only output debugging info when we think
- we're being debugged.
-
-2002-05-25 Robert Collins <rbtcollins@hotmail.com>
-
- * winsup.h: Remove duplicate declarations of malloc_lock and
- malloc_unlock.
-
-2002-05-24 Christopher Faylor <cgf@redhat.com>
-
- Remove unneeded sync.h, where appropriate, throughout.
- Remove unneeded heap.h, where appropriate, throughout.
- Remove unneeded exceptions.h, where appropriate, throughout.
- Remove unneeded perprocess.h, where appropriate, throughout.
-
-2002-05-22 Pierre Humblet <pierre.humblet@ieee.org>
-
- * security.cc (create_token): Call __sec_user() instead of
- sec_user() to remove dependence on allow_ntsec. Verify that
- the returned sd is non-null.
-
-2002-05-25 Robert Collins <rbtcollins@hotmail.com>
-
- * gmon.c (fake_sbrk): Correctly return -1 on failed malloc's.
-
-2002-05-24 Christopher Faylor <cgf@redhat.com>
-
- * dtable.cc (dtable::build_fhandler_from_name): Just pass posix path
- along to set_name via return_and_clear_normalized_path.
- (dtable::build_fhandler): New method with const char * argument.
- (dtable::reset_unix_path_name): Eliminate.
- (dtable::dup_worker): Use correct build_fhandler method.
- * mmap.cc (mmap_record::alloc_fh): Ditto.
- * dtable.h (dtable::build_fhandler): New method.
- (dtable::reset_unix_path_name): Eliminate.
- * fhandler.cc (fhandler_base::set_name): Assume that unix_name has
- already been cmalloced.
- (fhandler_base::reset_unix_path_name): Eliminate.
- (fhandler_base::~fhandler_base): Coercion for cfree.
- * fhandler.h (fhandler_base::unix_path_name): Make const char *.
- (fhandler_base::win32_path_name): Ditto.
- (fhandler_base::reset_unix_path_name): Eliminate.
- * fhandler_disk_file.cc (fhandler_cygdrive::set_drives): Accommodate
- const char *ness of win32_path_name.
- * fhandler_socket.cc (fhandler_socket::fstat): Accommodate new set_name
- requirements.
- * path.cc (path_conv::return_and_clear_normalized_path): New method.
- (path_conv::clear_normalized_path): Eliminate.
- (path_conv::~path_conv): Ditto.
- (path_conv::check): Accommodate new build_fhandler method.
- * path.h (path_conv::~path_conv): Eliminate.
- (path_conv::clear_normalized_path): Ditto.
- (path_conv::return_and_clear_normalized_path): Declare new method.
-
-2002-05-23 Christopher Faylor <cgf@redhat.com>
-
- * path.cc (path_conv::check): Make sure any trailing path component is
- part of potential normalized posix path.
-
-2002-05-23 Christopher Faylor <cgf@redhat.com>
-
- * smallprint.c (__small_vsprintf): Implement '%o' after all these
- years.
-
-2002-05-22 Christopher Faylor <cgf@redhat.com>
-
- * fhandler.h (fhandler_virtual::exists): Eliminate path argument.
- (fhandler_proc::exists): Ditto.
- (fhandler_registry::exists): Ditto.
- (fhandler_process::exists): Ditto.
- * fhandler_proc.cc (fhandler_proc::exists): Ditto. Use built-in name.
- * fhandler_process.cc (fhandler_process::exists): Ditto.
- (fstat): Ditto.
- * fhandler_registry.cc (fhandler_registry::exists): Ditto.
- (fhandler_registry::fstat): Ditto.
- * fhandler_virtual.cc (fhandler_virtual::opendir): Ditto.
- * path.cc (path_conv::check): Ditto. Add debugging.
-
-2002-05-22 Christopher Faylor <cgf@redhat.com>
-
- * syscalls.cc (dup): Always call dup2 for error handling.
-
-2002-05-22 Corinna Vinschen <corinna@vinschen.de>
-
- * include/cygwin/types.h: Revert previous patch.
-
-2002-05-22 Corinna Vinschen <corinna@vinschen.de>
-
- * include/cygwin/types.h: Define pthread stuff only if _POSIX_THREADS
- is defined.
-
-2002-05-19 Pierre Humblet <pierre.humblet@ieee.org>
-
- * security.cc (open_local_policy): Initialize lsa to
- INVALID_HANDLE_VALUE instead of NULL.
- (get_logon_server_and_user_domain): Test for INVALID_HANDLE_VALUE
- instead of NULL.
- (create_token): Both of the above.
-
-2002-05-18 Christopher Faylor <cgf@redhat.com>
-
- * fhandler_disk_file.cc (fhandler_disk_file::fstat): Make handling of
- nlink consistent for remote files.
-
-2002-05-18 Christopher Faylor <cgf@redhat.com>
-
- * path.cc (path_conv::check): Always set executable bit for executable
- extension.
-
-2002-05-17 Christopher Faylor <cgf@redhat.com>
-
- * fhandler.cc (fhandler_base::lseek): Avoid calling SetFilePointer with
- high order part of 64 bit address on OS's which do not support that
- kind of operation. Otherwise Windows 95 will become confused.
-
-2002-05-16 Pierre Humblet <pierre.humblet@ieee.org>
-
- * fhandler_raw.cc (fhandler_dev_raw::open): Replace set_errno()
- by __seterrno_from_win_error().
- * security.cc (open_local_policy): Ditto.
- (get_lsa_srv_inf): Ditto.
- (get_user_groups): Ditto.
- (get_user_primary_group): Ditto.
- (create_token): Ditto.
- (subauth): Ditto.
-
-2002-05-17 Corinna Vinschen <corinna@vinschen.de>
-
- * times.cc (utimes): Use FILE_WRITE_ATTRIBUTES even on 9x/Me when
- opening file for writing timestamp.
- * wincap.cc: Remove flag has_specific_access_rights.
- * wincap.h: Ditto.
-
-2002-05-13 Pierre Humblet <pierre.humblet@ieee.org>
-
- * syscalls.cc (seteuid): Set default dacl in process token.
- Replace in-line code by call to verify_token().
- (setegid): Reverse change from 2002-01-21. Add call to
- RevertToSelf and set primary group in impersonation token.
- * security.cc (create_token): Store pgrpsid in token security
- descriptor, except if it already appears in my_grps.
- Use sec_acl() in place of get_dacl().
- (verify_token): Create from code in seteuid(), with tighter checks.
- (get_dacl): Deleted.
- (get_group_sidlist): Add argument to indicate if pgrpsid is already
- in the groups.
- * security.h: Define verify_token().
- * autoload.cc: Load GetKernelObjectSecurity().
-
-2002-05-13 Mark Bradshaw <bradshaw@staff.crosswalk.com>
-
- * cygwin.din: Add strlcat and strlcpy.
- * include/cygwin/version.h: Increment API minor version number.
-
-2002-05-09 Pierre Humblet <pierre.humblet@ieee.org>
-
- * shared.cc (__sec_user): Split into sec_acl() and call orig_sid().
- (sec_acl): Create from part of __sec_user(), except creator/owner.
- * security.h: Define sec_acl() and MAX_DACL_LEN.
-
-2002-05-12 Christopher Faylor <cgf@redhat.com>
-
- * fhandler_disk_file.cc (fhandler_disk_file::open): Avoid using
- O_DIROPEN when OS doesn't support it. Return proper errno in that
- case.
-
-2002-05-12 Christopher Faylor <cgf@redhat.com>
-
- * syscalls.cc (_read): Change error to EBADF if attempt to read from a
- non-readable fd.
-
-2002-05-11 Christopher Faylor <cgf@redhat.com>
-
- * fhandler.h (executable_states): For now, make dont_care_if_executable
- equivalent to not_executable.
- * sys/mount.h: Define MOUNT_NOTEXEC.
- * path.h (fs_info): New class.
- (path_conv): Move fs-specific fields to new 'fs' structure.
- (path_conv::update_fs_info): Move to fs_info and rename to just 'update'.
- * path.cc (fs_info::update): Ditto. Return 'true' if successful.
- (fillout_mntent): Add ',noexec' to list of reported options.
-
-2002-05-11 Christopher Faylor <cgf@redhat.com>
-
- * fhandler_virtual.cc (fhandler_virtual::close): Quiet a compiler
- warning.
-
-2002-05-10 Christopher January <chris@atomice.net>
-
- * autoload.cc: Add dynamic load statements for
- 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'.
- * fhandler.h: Change type of bufalloc and filesize members of
- fhandler_virtual from int to size_t. Change type of position member
- from __off32_t to __off64_t. Add new fileid member to fhandler_virtual
- class. Make seekdir take an __off64_t argument. Make lseek take an
- __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add
- fill_filebuf method to fhandler_proc. Add fill_filebuf method to
- fhandler_registry. Add fill_filebuf method to fhandler_process. Add
- saved_pid and saved_p members to fhandler_process.
- * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'.
- (proc_fhandlers array): Ditto.
- (fhandler_proc::open): Use fill_filebuf to flesh out the file contents.
- (fhandler_proc::fill_filebuf): New method.
- (fhandler_proc::format_proc_meminfo): Ditto.
- (fhandler_proc::format_proc_stat): Ditto.
- (fhandler_proc::format_proc_uptime): Ditto.
- * fhandler_process.cc (process_listing): Add 'stat' and 'statm'.
- (fhandler_process::fstat): Find the _pinfo structure for the process
- named in the filename. Return ENOENT if the process is no longer
- around. Set the gid and uid fields of the stat structure.
- (fhandler_process::open): Store pid and pointer to _pinfo structure in
- saved_pid and saved_p respectively. Use fill_filebuf to flesh out file
- contents.
- (fhandler_proc::fill_filebuf): New method.
- (format_process_stat): New function.
- (format_process_status): Ditto.
- (format_process_statm): Ditto.
- (get_process_state): Ditto.
- (get_mem_values): Ditto.
- * fhandler_registry.cc (fhandler_registry::seekdir): Change argument
- type from __off32_t to __off64_t.
- (fhandler_registry::fill_filebuf): New method.
- * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type
- from __off32_t to __off64_t.
- (fhandler_virtual::lseek): Ditto.
- (fhandler_virtual::fill_filebuf): New method.
- (fhandler_virtual::fhandler_virtual): Initialise fileid to -1.
- * wincap.cc: Set flag has_process_io_counters appropriately.
- * wincap.h: Add flag has_process_io_counters.
-
-2002-05-09 Christopher Faylor <cgf@redhat.com>
-
- * syscalls.cc (_write): Change error to EBADF if attempt to write to a
- non-writeable fd.
-
-2002-05-08 Corinna Vinschen <corinna@vinschen.de>
-
- * cygheap.h (class cygheap_user): Add member `orig_psid'.
- Add method `orig_sid()'.
- * cygheap.cc (cygheap_user::set_sid): Maintain orig_psid.
-
-2002-04-28 Norbert Schulze <norbert.schulze@web.de>
-
- * localtime.cc (tzsetwall): Use wildabbr if generated timezone name
- length < 3.
-
-2002-05-05 Pierre Humblet <pierre.humblet@ieee.org>
-
- * spawn.cc (spawn_guts): Move call to set_process_privilege()
- to load_registry_hive().
- * registry.cc (load_registry_hive): ditto.
- * fork.cc (fork_parent): Call sec_user_nih() only once.
-
-2002-05-04 Christopher January <chris@atomice.net>
-
- * path.h (path_conv::path_conv): Initialise normalized_path to NULL.
-
-2002-05-03 Christopher Faylor <cgf@redhat.com>
-
- * net.cc (getdomainname): Change second argument of getdomainname to
- size_t.
-
-2002-05-03 Christopher January <chris@atomice.net>
-
- * fhandler_proc.cc (proc_listing): Add '.' and '..' to directory
- listing.
- (fhandler_proc::open): Change use of mode to flags. If the file does
- not exist already, fail with EROFS if O_CREAT flag is set. Change
- EROFS error to EACCES error when writing to a file. Use cmalloc to
- allocate memory for filebuf.
- (fhandler_proc::close): Use cfree to free filebuf.
- (fhandler_proc::get_proc_fhandler): Properly detect attempts to access
- unknown subdir.
- * fhandler_process.cc (process_listing): Add '.' and '..' to directory
- listing.
- (fhandler_process::open): Use cmalloc to allocate memory for filebuf.
- (fhandler_process::close): Use cfree to free filebuf.
- * fhandler_registry.cc (registry_listing): Add . and '..' to directory
- listing.
- (fhandler_registry::open): Move check for open for writing before
- open_key. Use cmalloc to allocate memory for filebuf.
- (fhandler_registry::close): Use cfree to free filebuf.
- (fhandler_registry::telldir): Use lower 16 bits of __d_position as
- position in directory.
- (fhandler_registry::seekdir): Ditto.
- * fhandler_virtual.cc (fhandler_virtual::write): Change EROFS error to
- EACCES error.
- (fhandler_virtual::open): Set the NOHANDLE flag.
- (fhandler_virtual::dup): Add call to fhandler_base::dup. Allocate
- child's filebuf using cmalloc. Copy filebuf from parent to child.
- (fhandler_virtual::close): Use cfree to free filebuf.
- (fhandler_virtual::~fhandler_virtual): Ditto.
- (from Chris Faylor <cgf@redhat.com>).
- (fhandler_registry::readdir): Add support for '.' and '..' files in
- subdirectories of /proc/registry.
- * path.cc (path_conv::check): Do not return ENOENT if a file is not
- found in /proc.
-
-2002-05-02 Christopher Faylor <cgf@redhat.com>
-
- * fhandler_proc.cc (fhandler_proc::fstat): Use fhandler name rather
- than path_conv name.
- (fhandler_proc::open): Ditto.
- * fhandler_process.cc (fhandler_process::fstat): Use fhandler name
- rather than path_conv name.
- (fhandler_process::open): Ditto.
- * fhandler_registry.cc (fhandler_registry::fstat): Use fhandler name
- rather than path_conv name.
- (fhandler_registry::open): Ditto.
- * path.cc (path_conv::check): Don't copy posix path when virtual.
- (mount_info::conv_to_win32_path): Don't zero string when isproc. Just
- derive normal windows path.
-
- * path.h (path_conv::clear_normalized_path): Declare new method.
- * path.cc (path_conv::clear_normalized_path): Define new method.
- * dtable.cc (build_fhandler_from_name): Clear normalized path when
- finished to conserve space.
-
-2002-05-02 Christopher Faylor <cgf@redhat.com>
-
- * fhandler_proc.cc (fhandler_proc::fstat): Prime with information from
- fhandler_base::fstat. Use defines rather than constants for permission
- settings.
-
-2002-04-30 Eric Blake <ebb9@email.byu.edu>
-
- * path.cc (hash_path_name): Improve hash function strength.
-
-2002-05-02 Robert Collins <rbtcollins@hotmail.com>
-
- * thread.cc (__pthread_cond_dowait): Fix a race on signalling from a
- thread woken by the same condition variable it's signalling on. Thanks
- to Michael Beach for the report and test case.
-
-2002-05-02 Christopher Faylor <cgf@redhat.com>
-
- * path.h (pathconv_arg): Add PC_POSIX.
- (path_conv): Add normalized_path field.
- * path.cc (path_conv::~path_conv): New destructor.
- (path_conv::check): Set normalized_path, where appropriate.
- * dtable.cc (build_fhandler_from_name): Use normalized path from
- path_conv.
- * syscalls.cc (chroot): Ditto.
-
- * cygheap.h: Remove path_prefix_p declaration.
-
-2002-02-26 Christopher January <chris@atomice.net>
- Christopher Faylor <cgf@redhat.com> (minor fixups)
-
- * Makefile.in: Add fhandler_proc.o, fhandler_registry.o,
- fhandler_process.o and fhandler_virtual.o.
- * dtable.cc (dtable::build_fhandler): Add entries for FH_PROC,
- FH_REGISTRY and FH_PROCESS. Set unix_name to the normalized posix
- path.
- * fhandler.h: Add constants for FH_PROC, FH_REGISTRY and FH_PROCESS.
- Add class declarations for fhandler_virtual, fhandler_proc,
- fhandler_registry and fhandler_virtual. Update fhandler_union
- accordingly.
- * fhandler_proc.cc: New file. Add implementation for fhandler_proc.
- * fhandler_virtual.cc: New file. Add implementation for
- fhandler_virtual.
- * fhandler_process.cc: New file. Add implementation for
- fhandler_process.
- * fhandler_registry.cc: New file. Add implementation for
- fhandler_registry.
- * path.cc (isproc): New macro.
- (isvirtual_dev): Ditto.
- * path.cc (path_conv::check): Add check for virtual devices.
- * path.cc (mount_info::conv_to_win32_path): Convert paths in /proc to
- empty Win32 paths.
- * path.cc (chdir): Replace check for FH_CYGDRIVE with more generic
- isvirtual_dev macro. Force setting of posix path for virtual
- fhandlers.
- * path.h (path_prefix_p): Declare.
-
-
-Wed May 1 16:06:02 2002 Jason Tishler <jason@tishler.net>
-
- * include/cygwin/types.h: Include <sys/sysmacros.h>.
-
-Wed Apr 17 11:27:04 2002 Jason Tishler <jason@tishler.net>
-
- * security.cc (get_lsa_srv_inf): Prevent extraneous backslashes for
- the NT Domain case.
-
-2002-04-12 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (cygwin_accept): Set socket type for accepted socket.
- (socketpair): Set socket type for both sockets.
-
-2002-04-12 Egor Duda <deo@logos-m.ru>
-
- * fhandler.h (class fhandler_socket): New member to store socket type.
- (fhandler_socket::get_socket_type): Access it.
- (fhandler_socket::set_socket_type): Ditto.
- * net.cc (cygwin_socket): Store socket type.
- (cygwin_connect): Disable security checks for connectionless sockets.
- (cygwin_accept): Ditto.
-
-2002-04-09 Mark Bradshaw <bradshaw@staff.crosswalk.com>
-
- * cygwin.din: Add strptime.
- * include/cygwin/version.h: Increment API version number.
-
-2002-04-09 Corinna Vinschen <corinna@vinschen.de>
-
- * fork.cc (fork_child): Call fixup_mmaps_after_fork() somewhat earlier.
-
-2002-04-09 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_base::open): Set read-only bit in
- file_attributes when adequate.
-
-2002-03-28 Christopher Faylor <cgf@redhat.com>
-
- * times.cc (gettimeofday): Fix typo in previous patch.
-
-2002-03-27 Wu Yongwei <adah@netstd.com>
-
- * times.cc (gettimeofday): Revert to setting timezone info if tz !=
- NULL.
-
-2002-03-21 Christopher Faylor <cgf@redhat.com>
-
- * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Always set
- st_[ug]id to value derived from get_file_attributes.
-
-2002-03-21 Christopher Faylor <cgf@redhat.com>
-
- * spawn.cc (find_exec): Return input if file not found.
-
-2002-03-19 Boris Schaeling <boriss@web.de>
-
- * poll.cc (poll): Add support for invalid descriptors.
-
-2002-03-15 Robert Collins <rbtcollins@hotmail.com>
-
- * fhandler.h (fhandler_termios::lseek): Override lseek.
- * fhandler_termios.cc (fhandler_termios::lseek): Implement this.
-
-2002-03-15 Christopher Faylor <cgf@redhat.com>
-
- * cygserver.cc: Include stdlib.h for exit declaration.
- * threaded_queue.cc: Ditto.
-
-2002-03-15 Christopher Faylor <cgf@redhat.com>
-
- * pinfo.cc (pinfo::init): Use PID_ALLPIDS flag to control when a
- redirected block should be marked as nonexistent.
- (winpids::add): Use PID_ALLPIDS when looking for all pids.
- * cygwin.h (PID_ALLPIDS): New enum element.
-
-2002-03-15 Corinna Vinschen <corinna@vinschen.de>
-
- * glob.c (stat32_to_STAT): New function.
- (g_lstat): Call user space functions always with 32 bit struct stat
- as a workaround.
- (g_stat): Ditto.
- * include/glob.h (struct glob): Don't prototype function pointers
- when compiling Cygwin.
-
-2002-03-14 Christopher Faylor <cgf@redhat.com>
-
- * pinfo.cc (pinfo::init): Properly handle execed process stub when
- PID_NOREDIR is specified.
-
-2002-03-13 Boris Schaeling <boriss@web.de>
-
- * poll.cc (poll): Remove variable open_fds. Rearrange and add code to
- fix settings of revents.
-
-2002-03-13 Corinna Vinschen <corinna@vinschen.de>
-
- * mmap.cc (mmap_record::map_map): Return -1 if VirtualProtect fails.
- (list::erase): New method with no argument. Erase latest record
- added.
- (mmap64): Fail if map_map() fails.
-
-2002-03-12 Corinna Vinschen <corinna@vinschen.de>
-
- * sysconf.cc (sysconf): Fix condition.
-
-2002-03-11 Corinna Vinschen <corinna@vinschen.de>
-
- * mmap.cc (msync): Check area given by addr and len for being a
- contigeous mmap'd region.
-
-2002-03-11 Corinna Vinschen <corinna@vinschen.de>
-
- * fork.cc (fork_child): Call fixup_mmaps_after_fork() before
- closing parent process handle. Call fixup_mmaps_after_fork()
- with parent process handle as parameter.
- * mmap.cc (mmap_record::access): New method.
- (fixup_mmaps_after_fork): Take process handle as parameter.
- In case of FILE_MAP_COPY access, copy valid memory regions to child.
- * pinfo.h (fixup_mmaps_after_fork): Change prototype accordingly.
-
-2002-03-07 Corinna Vinschen <corinna@vinschen.de>
-
- * autoload.cc (NetGetDCName): Add symbol.
- (NetServerEnum): Remove symbol.
- * security.cc (get_lsa_srv_inf): Call NetGetDCName() instead of
- NetServerEnum() since it's faster. Don't call it at all if machine
- is not a domain member.
-
-2002-03-06 Christopher Faylor <cgf@redhat.com>
-
- * path.cc (normalize_posix_path): Avoid runs of '.'s > 2.
-
-2002-03-05 Christopher Faylor <cgf@redhat.com>
-
- * errno.cc: Change EPERM associated text to "Operation not permitted"
- throughout.
-
-2002-03-05 Christopher Faylor <cgf@redhat.com>
-
- * fhandler_socket.cc (fhandler_socket::close): Respond to signals while
- looping, waiting for socket to close. Superstitiously clear last error
- when WSAEWOULDBLOCK.
-
-2002-03-05 Robert Collins <rbtcollins@hotmail.com>
-
- * cygserver_transport_pipes.cc (transport_layer_pipes::transport_layer_pipes):
- Always init - until static members work correctly.
- * shm.cc (shmget): Initialize the security descriptor - thanks Corinna!
- * include/sys/ipc.h: Make the ipc control constants partitioned off from the sem
- control constants.
-
-2002-03-04 Christian Lestrade <christian.lestrade@free.fr>
-
- * include/sys/termios.h: Define _POSIX_VDISABLE. Define CCEQ macro.
- * fhandler_termios.cc: Include <sys/termios.h>.
- (line_edit): Recognize disabled c_cc[] chars. Ignore VDISCARD when
- not in ICANON mode.
-
-2002-03-04 Dmitry Timoshkov <dmitry@baikal.ru>
-
- * syscalls.cc (truncate64): Use ftruncate64 directly to not lose
- upper 32 bits.
-
-2002-03-04 Robert Collins <rbtcollins@hotmail.com>
-
- * cygserver_shm.cc (delete_shmnode): New function.
- (client_request_shm::serve): Use it.
-
-2002-03-04 Robert Collins <rbtcollins@hotmail.com>
-
- * cygserver_shm.cc (client_request_shm::serve): Implement SHM_DETACH.
- * shm.cc (shmdt): Implement.
-
-2002-03-04 Robert Collins <rbtcollins@hotmail.com>
-
- * cygserver_shm.cc: Run indent.
- (deleted_head): New global for storing shm id's pending deletion.
- (client_request_shm::serve): Return ENOSYS for invalid request types.
- Implement SHM_DEL - delete a shm id.
- * cygserver_shm.h (SHM_DEL): New type value.
- * shm.cc (delete_inprocess_shmds): New function, does what it's name implies.
- (shmctl): Implement shm_rmid control type.
-
-2002-03-04 Robert Collins <rbtcollins@hotmail.com>
-
- * Makefile.in (install): Remove install-bin to allow make install to work.
-
-2002-03-03 Robert Collins <rbtcollins@hotmail.com>
-
- * shm.cc (shmat): Prevent a compile error.
- (shmdt): Set errno as this function is incomplete.
-
-2002-02-28 Christopher Faylor <cgf@redhat.com>
-
- * times.cc: Remove if 0'd code. Clean up slightly.
-
-2002-02-28 Robert Collins <rbtcollins@hotmail.com>
-
- * Merged cygwin_daemon into head minus the new shm and ipc exports.
-
-2002-02-28 Robert Collins <rbtcollins@hotmail.com>
-
- * fhandler_tty.cc (fhandler_tty_slave::open): More debugging.
- (fhandler_tty_slave::read): Fix printf type for the handle.
- * tty.cc (tty::common_init): Add a FIXME for security.
-
-2002-01-29 Robert Collins <rbtcollins@hotmail.com>
-
- * Makefile.in (OBJS): Remove duplicate localtime.o.
-
-2002-01-17 Robert Collins <rbtcollins@hotmail.com>
-
- * cygserver.cc (check_and_dup_handle): Consolidate the two variants for
- simplicity.
- Add Some basic debug output.
- (client_request_attach_tty::serve): Use the new debug_printf for clarity.
- Mark the duplicated handles as inheritable - fixup_after_fork() doesn't reopen
- tty's.
-
-2002-01-16 Robert Collins <rbtcollins@hotmail.com>
-
- * cygserver.cc (transport): Correct scope.
- (client_request_attach_tty::serve): Add more debug information.
- Fix erroneous use of transport instead of conn.
- * cygserver_transport_pipes.cc (transport_layer_pipes::close): More debug.
- (transport_layer_pipes::read): Ditto.
- (transport_layer_pipes::write): Ditto.
- (transport_layer_pipes::impersonate_client): Ditto.
-
-Mon Oct 8 7:41:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * cygserver.cc (server_request::process): Rename client_request_shm_get to
- client_request_shm.
- * cygserver_process.cc (process_cache::add): Rename to add_task.
- Use process_cleanup instead of process_request.
- (process_cache::remove_process): New method.
- (process::process): Initialize new members.
- (process::~process): New member.
- (process::cleanup): New method.
- (process::add_cleanup_routine): New method.
- (process_request::process): Rename to process_cleanup.
- Call the process object's cleanup method and then delete it.
- (process_process_param::request_loop): Remove the signalling process.
- * cygserver_shm.cc: Globally rename client_request_shm_get to client_request_shm.
- (client_request_shm_get::serve): Handle attach request counting.
- * cygserver_shm.h: Globally rename client_request_shm_get to client_request_shm.
- (class shm_cleanup): New class.
- * shm.cc: Globally rename client_request_shm_get to client_request_shm.
- (client_request_shm::client_request_shm): New constructor for attach requests.
- (shmat): Use it.
- * include/cygwin/cygserver_process.h (class process_request): Rename to
- process_cleanup.
- (class cleanup_routine): New class.
- (class process): New members and methods to allow calling back when the process
- terminates.
-
-Thu Oct 4 14:12:00 2001 Robert Collins <rbtcollins@hotmail.com>
- * cygserver.cc (request_loop): Make static.
- (main): Use new cache constructor syntax.
- Start cache worker threads.
- Cleanup the cache at shutdown.
- * cygserver_process.cc: Run indent.
- (process_cache::process_cache): Add a trigger to use when adding a process.
- (process_cache::process): Move process_entry to process.
- Insert at the end of the list.
- Trigger the request loop when new process's inserted.
- (process_cache::process_requests): Do it.
- (process_cache::add): New method.
- (process_cache::handle_snapshot): New method.
- (process::process): Merge in the process_entry fields.
- (process::handle): Make a stub function.
- (process::exit_code): New method.
- (process_request::process): New method.
- (process_process_param::request_loop): New method.
- * cygserver_shm.cc: New header dependency - threaded_queue.h.
- * threaded_queue.cc (threaded_queue::cleanup): Clearer messages.
- (queue_process_param::stop): Short spinlock on interruptible threads.
- * threaded_queue.h (class threaded_queue): New constructor.
- * include/cygwin/cygserver_process.h (process_request): New class.
- (process_entry): Remove.
- (process): Merge in process_entry.
- (process_cache): Inherit from threaded_queue.
-
-Tue Oct 2 23:24:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * cygserver.cc (class server_process_param): Use new constructor syntax.
- * cygserver_process.cc (process_cache::~process_cache): New function.
- * threaded_queue.cc: Define condition debug_printf.
- Run indent.
- (threaded_queue::cleanup): Move queue_process_param guts to a method.
- (threaded_queue::process_requests): Ditto.
- (queue_process_param::queue_process_param): New method.
- (queue_process_param::~queue_process_param): Ditto.
- (queue_process_param::start): Ditto.
- (queue_process_param::stop): Ditto.
- * threaded_queue.h (class queue_process_param): Add support for
- interruptible request loops.
- * cygwin/include/cygwin/cygserver_process.h (class process_cache): Add
- destructor.
-
-Tue Oct 2 23:24:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * cygserver_client.cc: New flag allow_daemon to disable the daemon completely.
- (cygserver_request): Check it.
- (cygserver_init): Ditto.
- * environ.cc (parse_thing): Add (no)daemon option.
-
-Tue Oct 2 23:00:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * shm.cc: Update to handle include changes from HEAD.
-
-Tue Oct 2 16:06:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * Makefile.in: Remove cygserver_shm.o from cygwin1.dll.
- Rename cygserver_shm_outside.o to cygserver_shm.o.
- * cygserver.cc (server_request::process): Use the new client_request
- constructor.
- * cygserver_client.cc: Remove the #ifdef's stubs for the server method
- within cygwin.
- (client_request_attach_tty::client_request_attach_tty): Use the new
- client_request constructor.
- (client_request_shutdown::client_request_shutdown): Ditto.
- (client_request::client_request): Ditto.
- * cygserver_shm.cc (client_request_shm_get::serve): Remove the
- #ifdef'd stub for in-cygwin builds.
- (client_request_shm_get::client_request_shm_get): Use the new
- client_request constructor, and remove the in-cygwin variants.
- * cygserver_shm.h (class client_request_shm_get): #ifndef test the
- serve method - it's only used in cygserver.
- * shm.cc (client_request_shm_get::client_request_shm_get): New function.
- * include/cygwin/cygserver.h (request_header): New constructor.
- (class client_request): Use it.
- New constructor accepting the header size.
- #ifndef test the server method - it's only used within cygserver.
- (client_request_get_version): #ifdef test the server method.
- (client_request_shutdown): Ditto.
- (client_request_attach_tty): Ditto.
-
-Tue Oct 2 9:57:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * Makefile.in: add threaded_queue.o to cygserver.exe.
- * cygserver.cc: Include threaded_queue.h
- (class server_request): Inherit from queue_request.
- (class server_process_param): Inherit from queue_process_param.
- (class server_request_queue): Inherit from threaded_queue.
- (request_loop): Adjust for new types.
- (server_request_queue::process_requests): Remove guts to
- threaded_queue::process_requests.
- (server_request::server_request): Adjust for new types.
- (worker_function): Delete.
- (server_request_queue::create_workers): Delete.
- (server_request_queue::cleanup): Delete.
- (server_request_queue::add): Move guts to threaded_queue::add.
- * threaded_queue.cc: New file.
- * threaded_queue.h: New file.
-
-Mon Oct 1 12:38:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * cygserver.cc (client_request::serve): New function.
- * cygserver_process.cc: Inlude <pthread.h> for pthread_once.
- (process_cache::process_cache): Initialise a crtiical section for write access.
- (process_cache::process): Use the critical section. Also add missing entries to
- the cache.
- (do_process_init): New function to initalise class process static variables.
- (process::process): Ensure that the process access critical section is
- initialised.
- (process::handle): Close the handle of old process's when they have terminated
- and we are returning the handle for a process with the same pid.
- * cygserver_shm.cc: Run indent.
- Include cygserver_process.h to allow process cache functionality.
- (client_request_shm_get::serve): New parameter for process cache support.
- Use the process cache, not OpenProcess to get a handle to the originating process.
- Fix a handle leak with token_handle.
- * cygserver_shm.h (class client_request_shm_get): Update ::serve for process
- cache support.
- * cygserver_transport_pipes.cc: Redefine debug_printf to be conditional on DEBUG.
- * include/cygwin/cygserver.h: Do not implement client_request::serve in the
- header.
- * include/cygwin/cygserver_process.h (class process_cache): Add a write access
- critical section to prevent races when requests from a multithreaded
- application arrive.
-
-Sun Sep 30 23:41:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * Makefile.in: Add cygserver_process.o to cygserver.exe.
- * cygserver.cc: Include signal.h and cygwin_version.h.
- Define debug_printf as a macro.
- Define DEBUG to a value.
- (client_request_attach_tty::serve): Add beginning of process cache support.
- Change from #ifdef DEBUG to work with new DEBUG style.
- (client_request_get_version::serve): Add beginning of process cache support.
- (class server_request): New prototype for support of process cache.
- (class queue_process_param): New class to allow request loop threading.
- (class server_request_queue): Add beginning of process cache support.
- Allow request loop threading.
- (request_loop): Thread function for request loops.
- (server_request_queue::process_requests): Initiator for threaded request loops.
- (client_request_shutdown::serve): Add beginning of process cache support.
- (server_request::server_request): Ditto.
- (server_request::process): Use debug_printf. Add beginning of process cache
- support.
- (server_request_queue::cleanup): Kill off any request loop threads.
- (server_request_queue::add): Add beginning of process cache support.
- (handle_signal): Trigger a shutdown.
- (main): Print out some useful info at startup - version, date time.
- Add process cache support.
- Spawn a separate thread for the transport request loop, thus allowing concurrent
- support for multiple transports.
- * cygserver_client.cc (client_request_get_version::serve): Add process cache
- support.
- (client_request_attach_tty::serve): Add process cache support.
- (client_request_shutdown::serve): Add process cache support.
- * cygsserver_process.cc: New file with the process cache support.
- * cygserver_shm.cc: Redefine debug_printf to allow conditional output.
- * cygwin.din: Export shmdt().
- * shm.cc: Run indent.
- Update FIXME's.
- (shmdt): New function.
- * include/cygwin/cygserver.h (class client_request): Add process cache support.
- (class client_request_get_version): Ditto.
- (class client_request_shutdown): Ditto.
- (class client_request_attach_tty): Ditto.
- * include/cygwin/cygserver_process.h: New header for process cache support.
-
-Sun Sep 30 8:52:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * include/cygwin/cygserver_transport.h: Add copyright header.
- * include/cygwin/cygserver_transport_pipes.h: Ditto.
- * include/cygwin/cygserver_transport_sockets.h: Ditto.
-
-Sat Sep 29 20:40:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * Makefile.in: Add cygserver_transport_sockets.o to DLL_OFILES.
- Add cygserver_transport_sockets_outside.o to cygserver.exe.
- * cygserver.cc: Include new include files.
- * cygserver_client.cc: Ditto.
- * cygserver_shm.h: No need to include <sys/socket.h> now.
- * cygerver_transport.cc: Include new include files.
- (transport_layer_base::transport_layer_base): Strip back to a stub.
- (transport_layer_base::listen): Ditto.
- (transport_layer_base::accept): Ditto.
- (transport_layer_base::close): Ditto.
- (transport_layer_base::read): Ditto.
- (transport_layer_base::write): Ditto.
- (transport_layer_base::connect): Ditto.
- * cygserver_transport_pipes.cc: Include new header
- "cygwin/cygserver_transport_pipes.h".
- * cygserver_transport_sockets.cc: New file.
- * dcrt0.cc: No need to include <sys/socket.h> now.
- * fhandler_tty.cc: Ditto.
- * tty.cc: Ditto.
- * include/cygwin/cygserver_transport.h: Strip the base class to a stub.
- Remove the cygserver_transport_pipes class.
- * include/cygwin/cygserver_transport_pipes.h: New file.
- * include/cygwin/cygserver_transport_sockets.h: New file.
-
-Tue Sep 25 16:22:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * autoload.cc: Add dynamic load statement for 'ImpersonateNamedPipeClient'.
- * Makefile.in: Add new object files, and build instructions for cygserver.exe.
- * cygwin.din: Export ftok, shmat, shmctl and shmget.
- * dcrt0.cc: Additional includes for cygserver support.
- (dll_crt0_1): Initialise the cygserver client.
- * fhandler.h (fhandler_tty): New method cygserver_attach_tty.
- * fhandler_tty.cc: Additional includes for cygserver support.
- (fhandler_tty_slave::open): Attempt to use the cygserver when obtaining
- handles from the parent process. On failure or 9x use the current method.
- (fhandler_tty_slave::cygserver_attach_tty): New function.
- * fork.cc (fork_child): Fixup shm memory mapped areas.
- * pinfo.h: Declare fixup_shms_after_fork().
- * security.h: Declare alloc_sd().
- * tty.cc: Additonal includes to support cygserver.
- (tty::common_init): Don't allow others to open us if the cygserver is running.
- * winsup.h: Declare cygserver_running.
- * cygserver.cc: New file.
- * cygserver_client.cc: New file.
- * cygserver_shm.cc: New file.
- * cygserver_shm.h: New file.
- * cygserver_transport.cc: New file.
- * cygserver_transport_pipes.cc: New file.
- * ipc.cc: New file.
- * shm.cc: New file.
- * include/cygwin/cygserver.h: New file.
- * include/cygwin/cygserver_transport.h: New file.
- * include/sys/ipc.h: New file.
- * include/sys/shm.h: New file.
-
-2002-02-28 Robert Collins <rbtcollins@hotmail.com>
-
- * thread.cc (semaphore::TryWait): Set errno as required by posix 1003.1.
- (__sem_wait): Ditto.
- (__sem_trywait): Ditto.
-
-2002-02-27 Christopher Faylor <cgf@redhat.com>
-
- * include/cygwin/version.h: Bump DLL minor number.
-
-2002-02-23 Corinna Vinschen <corinna@vinschen.de>
-
- * cygwin.din (fstat64): New symbol.
- (ftruncate64): Ditto.
- (lseek64): Ditto.
- (lstat64): Ditto.
- (mmap64): Ditto.
- (seekdir64): Ditto.
- (stat64): Ditto.
- (telldir64): Ditto.
- (truncate64): Ditto.
- * dir.cc (telldir64): New function.
- (telldir): Call telldir64().
- (seekdir64): New function.
- (seekdir): Call seekdir64().
- * fhandler.h: Redefine all methods using __off32_t to use __off64_t.
- * fhandler.cc: Use __off64_t and struct __stat64 throughout.
- * fhandler_clipboard.cc: Ditto.
- * fhandler_disk_file.cc: Ditto.
- * fhandler_dsp.cc: Ditto.
- * fhandler_floppy.cc: Ditto.
- * fhandler_mem.cc: Ditto.
- * fhandler_random.cc: Ditto.
- * fhandler_socket.cc: Ditto.
- * fhandler_tape.cc: Ditto.
- * fhandler_zero.cc: Ditto.
- * pipe.cc: Ditto.
- * glob.c: Ditto, call lstat64 and stat64 in Cygwin.
- * mmap.cc: Use __off64_t throughout.
- (mmap64): New function.
- * sec_acl.cc (acl_worker): Use struct __stat64, call stat64 and lstat64.
- * syscalls.cc (lseek64): New function.
- (stat64_to_stat32): Ditto.
- (fstat64): Ditto.
- (stat64): Ditto.
- (lstat64): Ditto.
- (ftruncate64): Ditto.
- (truncate64): Ditto.
- (_fstat): Call fstat64.
- (_stat): Call stat64.
- (cygwin_lstat): Rename to avoid declaration problem. Call lstat64.
- (stat_worker): Use struct __stat64.
- (access): Ditto.
- (ftruncate): Call ftruncate64.
- (truncate): Call truncate64.
- * wincap.cc: Set flag has_64bit_file_access appropriately.
- * wincap.h: Add flag has_64bit_file_access.
- * winsup.h (ILLEGAL_SEEK): Define as __off64_t.
- (stat_dev): Declare using struct __stat64.
- (stat_worker): Ditto.
- * include/cygwin/stat.h (struct __stat32): Define if compiling Cygwin.
- (struct __stat64): Ditto.
- (struct stat): Revert definition with explicitly sized datatypes.
- Eliminate sized field names.
- * include/cygwin/types.h (blksize_t): New type.
- (__blkcnt32_t): Ditto.
- (__blkcnt64_t): Ditto.
- (blkcnt_t): Ditto.
-
-2002-02-22 Christopher Faylor <cgf@redhat.com>
-
- * sync.h (new_muto): Just accept an argument which denotes the name of
- the muto. Use this argument to construct static storage.
- * cygheap.cc (cygheap_init): Reflect above change.
- * exceptions.cc (events_init): Ditto.
- * malloc.cc (malloc_init): Ditto.
- * path.cc (cwdstuff::init): Ditto.
- * cygheap.h (cwdstuff): Change name of lock element to make it less
- generic.
- * path.cc (cwdstuff::get_hash): Ditto.
- (cwdstuff::get_initial): Ditto.
- (cwdstuff::set): Ditto.
- (cwdstuff::get): Ditto.
- * sigproc.cc (proc_subproc): Ditto.
-
- * debug.cc (lock_debug): Change to method. Use method rather than
- macro throughout.
-
- * tty.h (tty_min::kill_pgrp): Declare new method.
- * fhandler_termios.cc (tty_min::kill_pgrp): New method.
- (fhandler_termios::line_edit): Use new method for killing process.
- * dcrt0.cc (do_exit): Ditto.
-
- * dtable.cc (dtable::get_debugger_info): New method for inheriting
- dtable info from a debugger.
- * tty.cc (tty_init): Attempt to grab file handle info from parent
- debugger, if appropriate.
-
- # dtable.cc (dtable::stdio_init): Make this a method.
- (dtable::init_std_file_from_handle): Don't set fd unless it's not open.
- (dtable::build_fhandler_from_name): Move name setting to
- dtable::build_fhandler.
- (dtable::build_fhandler): Add win32 name parameter.
- * dcrt0.cc (dll_crt0_1): Change to use dtable stdio_init.
- * dtable.h (dtable): Reflect build_fhandler parameter change.
- * mmap.cc (mmap_record::alloc_fh): Don't set name parameter in
- build_fhandler.
- * net.cc (fdsock): Remove set_name call since it is now handled by
- build_fhandler.
-
- * sigproc.cc (proc_subproc): Release muto as early as possible.
-
-2001-02-22 Corinna Vinschen <corinna@vinschen.de>
-
- * smallprint.c (rn): Allow long long values.
- (__small_vsprintf): Add 'D', 'U' and 'X' formats for long long
- parameters.
-
-2002-02-19 Christopher Faylor <cgf@redhat.com>
-
- * fhandler.cc (fhandler_base::puts_readahead): Remove default parameter
- setting. Newer gcc's complain about this.
- (fhandler_base::set_readahead_valid): Ditto.
- * fhandler_dsp.cc (Audio::open): Ditto.
- (fhandler_dev_dsp::open): Ditto.
-
-2002-02-19 Christopher Faylor <cgf@redhat.com>
-
- * fork.cc (fork_parent): Use sec_user_nih to control process/thread
- inheritance/permission.
- * spawn.cc (spawn_guts): Ditto.
- * security.cc (create_token): Initialize token so that it is not tested
- for bogus value later. Use sec_user to control process/thread
- creation.
- * security.h (__sec_user): Rename declaration from sec_user.
- (sec_user_nih): Declare here as inline function wrapper for __sec_user.
- (sec_user): Ditto.
- * sigproc.cc (czombies): Allocate a character array for zombies to
- avoid constructor overhead
- (extremely hackish, I know).
- (cpchildren): Ditto.
- (pchildren): New define.
- (zombies): Ditto.
- (getsem): Use sec_user_nih to control semaphore inheritance/permission.
-
-2002-02-16 Christopher Faylor <cgf@redhat.com>
-
- * times.cc (hires::prime): Restore thread priority on failure
- condition.
-
- * uinfo.cc (uinfo_init): Use more robust method for determining if
- process was invoked from a non-cygwin process.
-
- * sync.h (muto::init): Eliminate "inheritance" parameter.
- (new_muto): Reflect removal of parameter.
- * sync.cc (muto::init): Ditto.
- * cygheap.cc (cygheap_init): Ditto.
- * debug.cc (threadname_init): Ditto.
- * exceptions.cc (events_init): Ditto.
- * malloc.cc (malloc_init): Ditto.
- * path.cc (cwdstuff::init): Ditto.
- * sigproc.cc (sigproc_init): Ditto.
-
- * grp.cc (group_lock): Use different method for locking with static
- member.
- (read_etc_group): REALLY ensure that read lock mutex is released.
- * passwd.cc (passwd_lock): Use different method for locking with static
- member.
- (read_etc_passwd): REALLY ensure that read lock mutex is released.
-
- * shared.cc (sec_user): Correct reversed inheritance test.
-
-2002-02-15 Christopher Faylor <cgf@redhat.com>
-
- * hires.h (hires::usecs): Rename from utime. Accept an argument.
- * strace.cc (strace::microseconds): Use hires class for calculating
- times.
- * sync.h (new_muto): Use NO_COPY explicitly in declaration.
- * times.cc (gettimeofday): Reflect change in usecs argument.
- (hires::usecs): Ditto. Changed name from utime.
- * winsup.h (NO_COPY): Add nocommon attribute to force setting aside
- space for variable.
- * regcomp.c (REQUIRE): Add a void cast to bypass a warning.
-
-2002-02-15 Christopher Faylor <cgf@redhat.com>
-
- * hires.h: New file.
- * times.cc (gettimeofday): Use hires class for calculating current time.
- (hires::prime): New method.
- (hires::utime): Ditto.
-
-2002-02-14 Christopher Faylor <cgf@redhat.com>
-
- * include/sys/cygwin.h (cygwin_getinfo_types): New CW_STRACE_ACTIVE.
- * external.cc (cygwin_internal): Handle CW_STRACE_ACTIVE.
-
-2002-02-14 Christopher Faylor <cgf@redhat.com>
-
- * exceptions.cc (unused_sig_wrapper): Eliminate unused parameter to
- asm.
- * external.cc (cygwin_internal): Change CW_STRACE_ON to
- CW_STRACE_TOGGLE.
- * strace.cc (strace::hello): Toggle strace on and off.
- * sync.cc (muto::init): Renamed from constructor.
- * sync.h (muto::new): Delete.
- (muto::delete): Ditto.
- (new_muto): Simplify. Use muto.init for nearly everything.
- * uinfo.cc (uinfo_init): Avoid closing a NULL handle.
- * include/sys/cygwin.h (cygwin_getinfo_types): Rename CW_STRACE_OFF to
- CW_STRACE_TOGGLE. Delete CW_STRACE_OFF.
- * include/sys/strace.h (strace): Add "inited" field.
-
-2001-02-12 Corinna Vinschen <corinna@vinschen.de>
-
- * include/cygwin/acl.h: Fix definition of aclent_t.
-
-2002-02-10 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in (DLL_OFILES): Consolidate object files.
-
-2002-02-10 Corinna Vinschen <corinna@vinschen.de>
-
- * child_info.h, cygheap.h, fhandler_clipboard.cc, fhandler_dsp.cc,
- fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
- fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
- pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
- security.h, thread.h, uinfo.cc, include/cygwin/acl.h: Fix copyright.
-
-2002-02-10 Corinna Vinschen <corinna@vinschen.de>
-
- * child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
- fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
- fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
- fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
- pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
- security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h:
- Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
- off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
- INVALID_SEEK instead casting -1 to the appropriate type.
- * winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
- * include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
- types. Don't declare acl functions when compiling Cygwin.
- * include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
- correct types for internal usage.
-
-2002-02-10 Corinna Vinschen <corinna@vinschen.de>
-
- Patch suggested by Pierre A. Humblet <Pierre.Humblet@ieee.org>:
- * uinfo.cc (internal_getlogin): Try evaluating user by SID even if
- ntsec is off.
- (uinfo_init): Set primary group even if ntsec is off.
-
-2002-02-09 Corinna Vinschen <corinna@vinschen.de>
-
- * include/cygwin/grp.h: New file.
- * include/cygwin/stat.h: Ditto.
- * include/cygwin/types.h: Add definitions for __off32_t,
- __off64_t, off_t, __uid16_t, __uid32_t, uid_t, __gid16_t,
- __gid32_t and gid_t.
- * include/sys/cygwin.h: Use correct uid and gid types.
-
-2002-02-09 Corinna Vinschen <corinna@vinschen.de>
-
- * dtable.cc (dtable::dup2): Revert previous patch.
- * fhandler.h: Ditto.
- (fhandler_socket::recv): Define new method.
- (fhandler_socket::send): Ditto.
- * fhandler_socket.cc (fhandler_socket::recv): New method.
- (fhandler_socket::send): Ditto.
- (fhandler_socket::read): Call fhandler_socket::recv() now.
- (fhandler_socket::write): Call fhandler_socket::send() now.
- * net.cc (class wsock_event): Move definition to wsock_event.h.
- (fdsock): Revert previous patch.
- (cygwin_recv): Move implementation to fhandler_socket::recv().
- (cygwin_send): Move implementation to fhandler_socket::send().
- * wsock_event.h: New file.
-
-2002-02-06 Alexander Gottwald <Alexander.Gottwald@s1999.tuchemnitz.de>
-
- * net.cc (get_2k_ifconf): Create interface entries for tokenring cards.
-
-2002-02-08 Corinna Vinschen <corinna@vinschen.de>
-
- * dtable.cc (dtable::dup2): Store fd for fhandler_socket.
- * fhandler.h (fhandler_base::set_fd): New virtual method.
- (fhandler_base::get_fd): Ditto.
- (fhandler_socket::set_fd): Ditto.
- (fhandler_socket::get_fd): Ditto.
- * fhandler_socket.cc (fhandler_socket::read): Call cygwin_recv instead
- of native Winsock recv.
- (fhandler_socket::write): Call cygwin_send instead of native Winsock
- send.
- * net.cc (fdsock): Store fd in fhandler_socket.
-
-2002-02-07 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (cygwin_getsockname): Fix handling of NULL sun_path.
-
-2002-01-29 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (getdomainname): Fix registry key for 9x systems, too.
-
-2002-01-29 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (getdomainname): Fix registry key for NT systems.
-
-2002-01-28 Christopher Faylor <cgf@redhat.com>
-
- * external.cc (cygwin_internal): Initialize various internal settings
- if required to allow use of some things from user loaded DLL.
- (CW_STRACE_ON): Add new feature.
- (CW_CYGWIN_PID_TO_WINPID): Ditto.
- * pinfo.cc (set_myself): Call "strace.hello" to initiate possible
- strace session.
- (pinfo::init): Guard against dereferencing uninitialized myself.
- * sigproc.cc (wait_sig): Call strace.hello() when __SIGTRACE "signal"
- received.
- * strace.cc (strace::hello): New method.
- * wincap.cc (wincapc::init): Avoid initializing if already initialized.
- * wincap.h (wincapc::wincapc): New method.
- * include/sys/cygwin.h: Add new CW_ enums. Kludge typedefs of
- {g,u}id_t if required.
- * strace.h (strace::hello): Declare new method.
-
-2002-01-28 Earnie Boyd <earnie@users.sf.net>
-
- * include/sys/strace.h (_STRACE_ON): Define.
- (_STRACE_OFF): Ditto.
-
-2002-01-24 Christopher Faylor <cgf@redhat.com>
-
- * speclib: Ensure that temporary def file is removed.
-
-2002-01-23 Christopher Faylor <cgf@redhat.com>
-
- * speclib: Use rm -f to remove temp file just to quiet any potential
- warnings.
-
-2002-01-23 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (create_token): Use sec_user() to create
- SECURITY_ATTRIBUTES structure for primary token. Use
- MAXIMUM_ALLOWED access rights instead of TOKEN_ALL_ACCESS.
-
-2002-01-23 Corinna Vinschen <corinna@vinschen.de>
-
- * path.cc (symlink): Fix check for already existing file.
-
-2002-01-21 Christopher Faylor <cgf@redhat.com>
-
- * cygmagic: Suppress error output when figuring out if sum takes an
- option.
-
-2002-01-21 Christopher Faylor <cgf@redhat.com>
-
- * cygmagic: Attempt to figure out if sum takes an option.
-
-2002-01-21 DJ Delorie <dj@redhat.com>
-
- * Makefile.in (libpthread.a): Pass the assembler also.
- (libm.a): Ditto.
- (libc.a): Ditto.
- * speclib: Specify the assembler to dlltool.
-
-2002-01-21 Christopher Faylor <cgf@redhat.com>
-
- * include/cygwin/version.h: Bump DLL minor number.
-
-2002-01-21 Corinna Vinschen <corinna@vinschen.de>
-
- * grp.cc (getgrgid): Don't return default gid entry when ntsec is on.
- * syscalls.cc (setegid): Don't set primary group in process token.
-
-2002-01-21 Christopher Faylor <cgf@redhat.com>
-
- * speclib: Don't use /dev/null as DLL name. Just default to what's
- already in .def file.
-
-2002-01-21 Christopher Faylor <cgf@redhat.com>
-
- * exceptions.cc (sig_handle): Remove last vestiges of SA_NOCLDSTOP code
- which caused SIGCHLD to be ignored.
-
-2002-01-20 Christopher Faylor <cgf@redhat.com>
-
- * include/cygwin/version.h: Bump DLL minor number.
-
-2002-01-20 Christopher Faylor <cgf@redhat.com>
-
- * syscalls.cc (regfree): Make dll_export.
-
-2002-01-20 Christopher Faylor <cgf@redhat.com>
-
- * exceptions.cc (ctrl_c_handler): Convert windows pid to cygwin pid
- when detecting if we should actually handle CTRL-C.
-
-2002-01-19 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in (new-cygwin1.dll): Revert previous change. libsupc++.a
- is only available in libstdc++-v3.
-
-2002-01-19 Christopher Faylor <cgf@redhat.com>
-
- * exceptions.cc (sig_handle_tty_stop): Don't send SIGCHLD if parent
- doesn't want it.
- (sig_handle): Don't check for SA_NOCLDSTOP here. We don't have enough
- information.
-
-2002-01-19 Christopher Faylor <cgf@redhat.com>
-
- * include/cygwin/version.h: Bump DLL minor number.
-
-2002-01-19 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in (new-cygwin1.dll): Just use -lsupc++ for link.
- * sigproc.cc (proc_exists): Change existence criteria.
- * sync.h (new_muto): Add volatile to definition to avoid gcc
- optimization problems.
-
-2002-01-19 Corinna Vinschen <corinna@vinschen.de>
-
- * include/cygwin/version.h: Bump API minor version to 51.
-
-2002-01-19 Mark Bradshaw <bradshaw@staff.crosswalk.com>
-
- * cygwin.din: Add recvmsg and sendmsg.
- * net.cc: Add cygwin_recvmsg and cygwin_sendmsg.
- * /usr/include/sys/socket.h: Add recvmsg and sendmsg.
-
-2002-01-19 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (create_token): Close processes token handle as soon
- as it's not used anymore.
-
-2002-01-17 Corinna Vinschen <corinna@vinschen.de>
-
- * Makefile.in: Add fnmatch.o to DLL_OFILES.
- * cygwin.din: Add fnmatch export symbol.
- * fnmatch.c: New file.
- * include/fnmatch.h: Ditto.
- * include/cygwin/version.h: Bump API minor version to 50.
-
-2002-01-15 Corinna Vinschen <corinna@vinschen.de>
-
- * path.cc (fchdir): Call chdir with full windows path.
-
-2002-01-14 Corinna Vinschen <corinna@vinschen.de>
-
- * dir.cc: Use INVALID_FILE_ATTRIBUTES instead of "(DWORD) -1"
- for file attributes throughout.
- * fhandler.cc: Ditto.
- * fhandler_disk_file.cc: Ditto.
- * path.cc: Ditto.
- * path.h: Ditto.
- * syscalls.cc: Ditto.
- * times.cc (utimes): Use path_conv::isdir() instead of explicit
- GetFileAttributes() call.
-
-2002-01-13 Christopher Faylor <cgf@redhat.com>
-
- * dcrt0.cc (multiple_cygwin_problem): Clarify logic and make
- CYGWIN_MISMATCH_OK more powerful.
-
-2002-01-10 Christopher Faylor <cgf@redhat.com>
-
- * exceptions.cc (sig_handle): Accept a second argument indicating
- whether the signal came from this process or not.
- * sigproc.h: Reflect sig_handle arg change.
- * signal.cc (kill_pgrp): Add sigframe info.
- (abort): New function. Eliminates newlib function of same name.
- * sigproc.cc (wait_sig): Pass "signal from this process" value as arg
- 2.
-
-2002-01-10 Corinna Vinschen <corinna@vinschen.de>
-
- * syscalls.cc (pathconf): Guard _PC_PATH_MAX branch against invalid
- file parameter.
-
-2002-01-09 Christopher Faylor <cgf@redhat.com>
- Robert Collins <rbtcollins@hotmail.com>
-
- * exceptions.cc (early_stuff_init): Rename from misnamed
- set_console_handler.
- (ctrl_c_handler): Attempt to work around potential signal duplication
- during process startup.
- (sig_handle): Ignore SIGINT when we're just an "exec stub".
- * spawn.cc (spawn_guts): Store pid of spawned process in global for use
- by ctrl_c_handler.
- * dcrt0.cc (dll_crt0_1): Call renamed initialization function.
- * winsup.h: Reflect function name change.
-
-2002-01-08 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (cygwin_accept): Set sun_path for newly connected socket.
-
-2002-01-07 Ralf Habacker <Ralf.Habacker@freenet.de>
-
- * Makefile.in: Add uninstall target.
-
-2002-01-07 Christopher Faylor <cgf@redhat.com>
-
- * sigproc.cc (getsem): Clean up debugging output.
-
-2002-01-07 Christopher Faylor <cgf@redhat.com>
-
- * sigproc.cc (getsem): Set errno when unable to create own semaphore.
- Reorganize to make clearer that error should only come from initial
- creation of process semaphore.
-
-2002-01-06 Christopher Faylor <cgf@redhat.com>
-
- * dtable.cc (dtable::init_std_file_from_handle): Add some defensive
- code to invalid handle case.
-
-2002-01-06 Corinna Vinschen <corinna@vinschen.de>
-
- * ioctl.cc (ioctl): Make third argument optional.
- * include/sys/ioctl.h: Ditto in declaration.
- * dtable.cc (dtable::init_std_file_from_handle): Revert previous
- bogus patch.
- * window.cc (WndProc): Raise SIGURG instead of SIGIO in case of FD_OOB
- message.
-
-2002-01-05 Christopher Faylor <cgf@redhat.com>
-
- * dir.cc (opendir): Guarantee release of alloced fhandler structure on
- error.
-
-2002-01-05 Corinna Vinschen <corinna@vinschen.de>
-
- * exceptions.cc (sig_handle): Set default action for SIGURG to SIG_IGN.
-
-2002-01-05 Corinna Vinschen <corinna@vinschen.de>
-
- * dtable.cc (dtable::init_std_file_from_handle): Don't treat NULL
- handle as errorneous.
-
-2002-01-04 Christopher Faylor <cgf@redhat.com>
-
- * cygmagic: Change logic for equality test.
-
-2002-01-04 Christopher Faylor <cgf@redhat.com>
-
- * dir.cc (opendir): Don't attempt to call sub-opendir if ENOENT.
-
-2002-01-04 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc: Replace usage of AF_UNIX by Posix compliant AF_LOCAL
- throughout.
- (socketpair): Explicitly allow SOCK_STREAM and SOCK_DGRAM socket types
- in families AF_UNIX and AF_LOCAL. Explicitly allow PF_UNSPEC, PF_LOCAL
- and PF_INET protocols. Return error otherwise. Implement datagram
- socketpairs.
-
-2002-01-01 Christopher Faylor <cgf@redhat.com>
-
- * speclib: Remove temp files automatically.
-
-2002-01-01 Corinna Vinschen <corinna@vinschen.de>
- * fhandler.h (fhandler_socket::sun_path): New private member.
- (fhandler_socket::set_sun_path): New method.
- (fhandler_socket::get_sun_path): Ditto.
- * fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize
- sun_path to NULL.
- (fhandler_socket::~fhandler_socket): Free sun_path if needed.
- (fhandler_socket::set_sun_path): New method.
- * net.cc (cygwin_bind): Set sun_path to path of local socket file.
- (cygwin_getsockname): Add code to return correct sockaddr for unix
- domain sockets.
diff --git a/winsup/cygwin/ChangeLog-1995 b/winsup/cygwin/ChangeLog-1995
deleted file mode 100644
index 462a61336..000000000
--- a/winsup/cygwin/ChangeLog-1995
+++ /dev/null
@@ -1,177 +0,0 @@
-Mon Dec 18 16:44:38 1995 Jason Molenda (crash@phydeaux.cygnus.com)
-
- * configure.in (target_cpu): specify valid Intel x86 architectures
- explicitly.
-
-Mon Dec 18 15:04:29 1995 Jason Molenda (crash@phydeaux.cygnus.com)
-
- * sysdef/*.def: moved to sysdef/i386/.
-
-Mon Dec 18 15:00:56 1995 Jason Molenda (crash@phydeaux.cygnus.com)
-
- * configure.in: Set DLL_ENTRY and SYSDEF_DIR for i386 and powerpc.
- * configure: Regenerated with autoconf 2.7.
-
- * Makefile.in: Use DLL_ENTRY and SYSDEF_DIR.
-
-Sat Dec 16 18:36:44 1995 steve chamberlain <sac@slash.cygnus.com>
-
- Changed the way that file handles are inherited. Now
- all files are opened with the inheriting turned on, and they're
- closed when necessary.
-
- Changed the way that children are waited for. Now
- you can exec a non-gnuwin32 program and wait for its
- result.
-
- * Makefile.in: Turn off frame-pointer.
- * dcrt0.cc (environ_init): Lint.
- * dirsearch.cc (opendir): Use new path_conv mechanism.
- * exceptions.cc (ctrl_c_handler): Exit with correct status
- * exec.cc (file_exists): Moved to paths.cc
- (_execve): Moved most of the work into spawn.cc.
- * fhandler.cc (*): Much.
- * libccrt0.c (foo): Deleted.
- (cygwin_crt0): Lint.
- * path.cc (readlink): Initialize the SECURITY_ATTRIBUTES struct.
- * pipe.cc (pipe, dup*): Reorganized.
- * registry.cc (read_in): Create the key in CURRENT_USER.
- * wait.cc, spawn.cc (*): Much.
- * sysconf.cc (sysconf): Understand SC_PAGESIZE.
- * times.cc (utime): New function.
- * uname.cc (uname): Dig out more info.
-
-Wed Dec 13 05:54:55 1995 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * dcrt0.cc (environ_init): Cast alloca return to appropriate type.
- * spawn.cc (spawn_guts): Ditto.
-
- * strace.cc (__small_{v,}sprintf): Add appropriate prototypes.
-
- * exceptions.cc (_except_list): Only use segments for 386 systems.
- (__stack_trace): Add PowerPC support, and do nothing for systems
- that are not supported except print stack tracing is not yet
- support.
-
- * sdata.cc (import_term): Only use __attribute__((section)) on 386
- systems.
-
- * shared.cc (shared_init): Use MARK macro instead of calling mark
- directly with incorrect type arguments.
-
- * fhandler.cc (fhandler_dev_null::{read,write}): Use size_t in
- prototype, not unsigned int.
-
- * fork.cc (find_exec): Fix type errors.
- * path.cc (path_to_real_path_keep_rel): Ditto.
- * syscalls.h (PATH_TO_REAL_PATH): Ditto.
-
- * {longjmp,setjmp}.c: #ifdef i386 code.
-
- * include/wintypes.h (ExitProcess): Add
- __attribute__((__noreturn__)) so exit compiles without warnings.
-
-Tue Dec 12 18:25:05 1995 Jason Molenda (crash@phydeaux.cygnus.com)
-
- * include/wintypes.h (WINAPI): Only define WINAPI for x86 systems.
-
-Tue Dec 5 16:00:05 1995 Jason Molenda (crash@phydeaux.cygnus.com)
-
- * Makefile.in (all): Only build documentation for info target.
- Expect texi2html to not be found most of the time.
-
-Tue Dec 5 08:08:08 1995 steve chamberlain <sac@slash.cygnus.com>
-
- Release-B10
-
- * cygwin.dll (__assert, wait, spawnv, spawnvp): Deleted.
- * dcrt0.c: Quoting rewritten.
- * exec.cc (file_exists): Use new path_conv mechanism.
- (_execve): Close open child process handles.
- * fhandler.cc (fhandler_normal::open): Follow symlinks.
- (fhandler_normal::read): Keep track of logical file posision.
- (fhandler_normal::lseek): Seek in text files correctly.
- (fhandler_normal::fstat): Set IFLNK bit if its a symlink.
- (fhandler_normal::init): Maintain is_pipe.
- (fhandler_dev_null::fstat): New.
- (fhandler_dev_null::get_handle): Return INVALID_HANDLE.
- * fork.cc: Use new event mechanism.
- * libccrt0.cc: Keep track of _fmode variable.
- * misc.c (readlink): Delete.
- * path.cc (__path_to_real_path_1): Allow /d<letter> mechanism.
- (path_to_real_path_keep_rel): New
- (link_cookie:*): Support for symbolic links.
- * spawn.cc (spawn_guts): Quoting rewritten.
- * times.cc: New.
- * syscalls.cc (_stat_worker): New.
- (_stat, _lstat): Use _stat_worker.
- * sysconf.cc (sysconf): Support _SC_CLK_TCK.
-
-Tue Nov 28 15:29:38 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * loads of stuff. When I make < 100k of diffs in a day,
- the ChangeLog will be usefull.
-
-Tue Nov 21 18:01:39 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * Makefile.in: Build the doc.
- * exceptions.cc: lint.
- * fork.cc: lint.
- * shared.cc (shared_init): If MapViewOfFileEx fails, then try
- again, but get the OS to select the address (for win95)
- * strace.cc (__sysprintf): Print pid and state in hex.
- * syscalls.cc (_unlink): Translate path to realpath.
-
-Wed Nov 15 23:47:43 1995 Jason Molenda (crash@phydeaux.cygnus.com)
-
- * spawn.cc (_exit): set return value's lower byte to 0 by default.
-
- Tue Oct 3 10:23:14 1995 Anders Blomdell (anders.blomdell@control.lth.se)
-
- * spawn.cc (spawn_guts): quote doublequotes correctly
-
-Tue Nov 14 15:05:33 1995 Jason Molenda (crash@phydeaux.cygnus.com)
-
- * configure.in: comment out call to cfg-ml-com.in.
-
-Tue Oct 31 11:19:18 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * libcerr.cc: New file.
- * dcrt0.cc (environ_init): Initialize PATH and friends nicely.
- * exceptions.cc (ctrl_c_handler): Default case is to exit.
- * fork.cc (__suffixy, find_exec): translate between paths and
- real_paths.
- * shared.cc (shared_init): Hard wire shared memory at 0xa0000000.
- * syscalls.c (__path_to_real_path, real_path_to_path): Always
- translate '/' <> '\'
-
-Mon Oct 30 17:36:10 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * syscalls.cc (_rename): Fix for win95.
-
-Fri Oct 27 20:53:47 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * Everything changed.
-
-Thu Oct 19 10:47:52 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * registry.cc, uinfo.cc: New files.
- * crt0.c (*uinfo*, *_exe_suffix*): Delete.
- (dll_crt0): Call shared_init.
- * getlogin.c: deleted.
- * shared.cc: Fill in.
- * spawn.c (_spawn): Use __exe_suffix function.
- * syscalls.c (getuid, getgid): Moved into uinfo.cc
- * syscalls.h (*uinfo, __exe_suffix): Deleted
- * Makefile.in: Cope with target configury.
- * termios.c: Fix stub prototypes.
- * win.h: Deleted.
- * include/winadvapi.h: Fill in some REG prototypes.
-
-Thu Oct 19 10:47:52 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * Makefile.in: Cope with target configury.
-
-Wed Oct 18 15:34:49 1995 steve chamberlain <sac@slash.cygnus.com>
-
- * Moved from newlib.
diff --git a/winsup/cygwin/ChangeLog-1996 b/winsup/cygwin/ChangeLog-1996
deleted file mode 100644
index b0c88d97b..000000000
--- a/winsup/cygwin/ChangeLog-1996
+++ /dev/null
@@ -1,2031 +0,0 @@
-Mon Dec 23 13:35:27 1996 Jeremy Allison <jra@cygnus.com>
-
- * Makefile.in: Added $(srcdir)/../libstdc++/stl -I$(srcdir)/../libio
- to the include path. As mmap uses STL then this is needed
- to build the cross compiler. Also added mmap.o file.
- * cygwin.din: Added mmap, mprotect, msync, munmap.
- * dcrt0.cc: Added code to get the module pathname from
- a previously unused field in the u area so fork() calls
- don't have to search the path. Forwards compatible with
- earlier releases as they set this field to zero.
- * fork.cc: Added call to recreate_mmaps_after_fork() in
- child code. Ensures child has same view of mmap'ed areas
- as parent.
- * libccrt0.cc: (See dcrt0.cc change). Setup the module
- handle so fork can get the path name.
- * mmap.cc: New file. Implements mmap, mprotect, msync, munmap,
- recreate_mmaps_after_fork. Uses STL.
- * select.cc: Added code to set errno to EINVAL if select done
- on handles and sockets. Must fix this soon.
- * spawn.cc: Set new variable hmodule in u area to zero for child.
- * syscalls.cc: Added fsync functionality. No longer a dummy call.
- * winsup.h: Decremented internal_reserved array by one to add
- hmodule in u area. Added prototype for recreate_mmaps_after_fork().
- * include/sys/mman.h: Fixed include file for mmap calls.
-
-Tue Dec 17 16:20:52 1996 Geoffrey Noer <noer@cygnus.com>
-
- * syscalls.cc (_rename): fix code so we really do
- return -1 if _rename fails.
-
-Tue Dec 17 12:12:29 1996 Jeremy Allison <jra@cygnus.com>
-
- * fhandler.cc: Added Sergeys patch for FakeReadFile.
- * cygwin.din: Re-ordered network calls.
-
-Mon Dec 16 16:47:26 1996 Geoffrey Noer <noer@cygnus.com>
-
- * configure.in: remove AC_C_CROSS (now part of AC_PROG_CC)
- * utils/configure.in: ditto
- * configure: regenerate
- * utils/configure: regenerate
-
-Mon Dec 16 14:50:46 1996 Geoffrey Noer <noer@cygnus.com>
-
- * cygwin.din: export cygwin32_getsockopt
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * spawn.cc: don't assume all scripts should be run in
- bash -- run the shell specified after the #!
-
-Fri Dec 13 16:18:22 1996 Jeremy Allison <jra@cygnus.com>
-
- * path.cc: Added support for UNC paths.
-
-Fri Dec 13 10:56:21 1996 Jeremy Allison <jra@cygnus.com>
-
- * cygwin.din: Added h_errno, seteuid, _seteuid.
- * exceptions.cc: Made init_exceptions extern "C".
- * exceptions.h: Added cplusplus wrappers to enable this to
- be used from C.
- * net.cc: Added error numbers, fixed gethostbyaddr, added h_errno
- fixes.
- * stubs.cc: Added seteuid.
- * include/mywinsock.h: Added HOST error entries for DNS lookups.
-
-Tue Dec 10 15:38:46 1996 Geoffrey Noer <noer@cygnus.com>
-
- * version.h: bump CYGWIN_DLL_VERSION_MINOR to 4
-
- patch from Marcus Daniels <marcus@sysc.pdx.edu>:
- * fhandler.cc: add fhandler_dev_null::dup (fhandler_base *child)
- * fhandler.h: add matching header
-
- gnu-win32 beta 17.1 release made
-
-Thu Dec 5 14:03:08 1996 Geoffrey Noer <noer@cygnus.com>
-
- * select.cc: add missing end comment at about line 933.
- gnu-win32 beta 17 release made
-
-Wed Dec 4 15:53:11 1996 Geoffrey Noer <noer@cygnus.com>
-
- * version.h: increment minor dll number in conjunction
- with gnu-win32 beta 17 release
-
-Tue Dec 3 15:05:57 1996 Geoffrey Noer <noer@cygnus.com>
-
- * strsep.cc: new file containing Berkeley-copyrighted strsep
- code previously in misc.cc.
- * misc.cc: strsep moved to strsep.cc, stop including
- unistd.h, strings.h, sys/types.h, stddef.h, and stdarg.h
- * Makefile.in: appropriate adjustments to add strsep.cc
-
-Tue Dec 3 13:50:59 1996 Geoffrey Noer <noer@cygnus.com>
-
- * include/sys/copying.dj: new file whose presence is
- required by include/sys/file.h
-
-Tue Dec 3 13:37:27 1996 Geoffrey Noer <noer@cygnus.com>
-
- Throughout all Cygnus-developped source files: put all
- code under GPL
-
-Tue Dec 3 10:54:01 1996 Jeremy Allison <jra@cygnus.com>
-
- * fork.cc: Changed code to delete [] saved child_hinfo
- after allocate_pid called. Needed as child changes this
- value in the shared area when it de-linearizes fd array.
- Needed to stop race condition with earlier fix.
- * winsup.h: Changed definition of item in hinfo to be
- a char array rather than fhandler_console. Stops
- destructor being called when fork delete [] of
- hinfo array called.
- * hinfo.cc: Changes (casts) to support winsup.h changes.
-
-Mon Dec 2 17:22:13 1996 Geoffrey Noer <noer@cygnus.com>
-
- * include/utime.h: add ifdef _UTIME_U wrapper around header
-
-Mon Dec 2 15:45:46 1996 Jeremy Allison <jra@cygnus.com>
-
- * fork.cc: Fixed file descriptor resource leak in parent.
- * registry.cc: Removed fatal error if registry key cannot
- be opened. Causes errors in service code.
-
-Wed Nov 27 15:40:15 1996 Geoffrey Noer <noer@cygnus.com>
-
- * cygwin.din: for MS compatibility, also export functions
- as _funcname = funcname
- * include/netdb:
- * include/sys/socket.h:
- Do the equivalent thing for functions exported as cygwin32_funcname
-
-Wed Nov 27 15:14:30 1996 Geoffrey Noer <noer@cygnus.com>
-
- * cygwin.din: remove exported helper functions that shouldn't
- need to be exported (_read et al)
- * glob/Makefile.in: add SHELL definition
- * utils/Makefile.in: add SHELL definition
-
-Mon Nov 25 14:24:52 1996 Geoffrey Noer <noer@cygnus.com>
-
- * include/commdlg.h, ddeml.h, winadvapi.h, winbase.h, wincon.h,
- windef.h, windowsx.h, winerror.h, wingdi.h, winkernel.h, winnt.h,
- wintypes.h, winuser.h, winversion.h:
- Add MS-style header files back, each of which now includes our
- windows.h. This should allow compilation of Windows code
- that expects normal MS-named headers as long as the information
- is in our windows.h somewhere. The appropriate wrappers have
- been added to each file so windows.h isn't included more than
- once.
- * include/windows.h: add paranoia wrapper so it can be included
- more than once.
-
-Mon Nov 18 22:19:40 1996 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: change rules around so new-cygwin.dll is
- only rebuilt when necessary
- * spawn.cc: include <stdlib.h>
-
-Mon Nov 18 21:08:15 1996 Geoffrey Noer <noer@cygnus.com>
-
- * net.cc: remove extern "C"s that shouldn't be there
- (get_win95_ifconf, get_winnt_ifconf, get_if_flags)
- * syscalls.cc: remove extern "C"s from num_entries, _stat_worker
- * winsup.h: add extern "C"s for syscalls protos
-
-Mon Nov 18 20:35:39 1996 Geoffrey Noer <noer@cygnus.com>
-
- * winsup.h: include version.h
- * Makefile.in: remove dependencies involving version.h, but add
- version.h to winsup.h dependency line and also add others that
- should also be there.
- * dcrt0.cc:
- * libccrt0.cc:
- * registry.cc:
- * shared.cc: delete includes of version.h
-
-Mon Nov 18 20:16:37 1996 Geoffrey Noer <noer@cygnus.com>
-
- * stubs.c -> stubs.cc, add extern "C"s
- * uname.c -> uname.cc, add extern "C"s
- * console.cc: add extern "C"s, remove include windows.h
- since its already included in winsup.h
- * dirsearch.cc: add extern "C"s
- * fcntl.cc: add extern "C"s
- * winsup.h: remove LEAN_AND_MEAN define since that's no longer
- relevant with new windows headers, include version.h
- * malloc.cc: fix typos
-
-Mon Nov 18 18:02:31 1996 Geoffrey Noer <noer@cygnus.com>
-
- * grp.c renamed to grp.cc, add extern "C"s
- * misc.c renamed to misc.cc, add extern "C"s
-
-Mon Nov 18 16:08:26 1996 Geoffrey Noer <noer@cygnus.com>
-
- * syscalls.cc: extern "C"'d function calls
- * net.cc: extern "C"'d function calls, some respacing
- * hinfo.cc: extern "C"'d function calls, some respacing
- * syscalls.h: removed defines for MIN, errno, alloca(x),
- DEFAULT_GID/UID, NOT_OPEN_FD(fd), STD_RBITS et al,
- O_NOSYMLINK
- * winsup.h: added what was just deleted from syscalls.h
-
-Mon Nov 18 15:56:22 1996 Jeremy Allison <jra@cygnus.com>
-
- * cygwin.din: Added readv
- * syscalls.cc: Added readv code.
- * syscalls.h: Added readv prototype.
-
-Wed Nov 13 15:55:14 1996 Geoffrey Noer <noer@cygnus.com>
-
- * cygwin.din: added C++-related exports for stuff in
- libgcc.a (from new.o, tinfo.o, tinfo2.o, exception.o).
-
-Mon Nov 11 15:50:26 1996 Geoffrey Noer <noer@cygnus.com>
-
- * dcrt0.cc
- * dirsearch.cc
- * malloc.cc
- * passwd.cc
- * path.cc,
- * pinfo.cc
- * syslog.cc
- * utils/kill.cc
- * utils/cygwin.cc:
- need to #include <stdlib.h> which used to be included
- automatically in windows.h included by winsup.h.
- * shared.cc: UnmapViewOfFile takes a void *, not a
- const void *
- * malloc.cc: formatting fixes
-
-Fri Nov 8 17:31:55 1996 Jeremy Allison <jra@cygnus.com>
-
- * select.cc: Added fix for HANDLE select sent by
- Sergey Okhapkin.
- * fhandler.h: Changed dup to return int. Can now
- return error to dup2.
- * fhandler.cc: Changed dup to return error code.
- Corrected fhandler_console::close to return
- error code.
- * hinfo.cc (dup2): Check return code from
- fhandler->dup.
- * times.cc: Changed DST calculation as tm struct
- month starts at zero, NT wMonth starts at 1.
- * TODO: Added the things i'd like to do.
-
-Wed Nov 6 17:42:31 1996 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: Changed name of base file for cygwin.dll from
- base to cygwin.base. Changed name of exp file for cygwin.dll
- from win.exp to cygwin.exp. Updated dependency list, removing
- recently removed files like libcfork.cc, added missing files,
- and added all missing header dependencies. Small formatting
- fixes.
-
-Fri Nov 1 16:38:48 1996 Geoffrey Noer <noer@cygnus.com>
-
- * TODO: deleted old stuff from a long time ago, added some
- new stuff
-
- * added public domain disclaimers to all files missing them,
- reformatting of non-imported code to conform to GNU standards.
- Changes to:
- delqueue.h, exceptions.h, fcntl.cc, fhandler.h, grp.c,
- init.cc, ioctl.cc, key.cc, libcctype.c, libcerr.cc, libcmain.cc,
- misc.c, path.h, pold.c, resource.cc, smallprint.c, strerror.cc,
- syslog.cc, termios.cc, test.c, version.h, wait.cc
-
-Fri Nov 1 14:44:29 1996 Jeremy Allison <jra@cygnus.com>
-
- * fhandler.h: Added is_console() method needed by
- new select code.
- * fhandler.cc (fhandler_console::init): Added c_oflag setting
- dependent on bin parameter.
- * select.cc: Added code to implement select from console
- handles. Ignores keyup events and still blocks.
-
-Wed Oct 30 16:35:41 1996 Jeremy Allison <jra@cygnus.com>
-
- * fhandler.h: Removed fhandler_console_in, fhandler_console_out
- and integrated them both into fhandler_console. Added output_handle_
- so fhandler console has two handles.
- * fhandler.cc: Updated to support changes in fhandler.h. It is now
- possible to open("/dev/tty") and read/write to the same fd.
- * hinfo.cc(build_fhandler): Removed references to obsolete classes.
- * spawn.cc: Changed to get correct reference to output_handle_ for
- fhandler_console class.
- * console.cc: Changed to get output handle rather than input handle.
- * winsup.h: Changed definition of prototypes for functions changed
- in console.cc
-
-Wed Oct 30 13:05:33 1996 Geoffrey Noer <noer@cygnus.com>
-
- * include/custcntl.h
- * include/features.h
- * include/icmp.h
- * include/wchar.h
- * include/cygwin32/icmp.h
- * include/cygwin32/ip.h
- * include/cygwin32/sockios.h
- * include/cygwin32/types.h
- * include/cygwin32/uio.h
- * include/sys/ttychars.h
- Added comment with name of header to each so that these are no
- longer empty files (some unzip programs won't create
- zero-length files which is a problem for headers)
-
-Sun Oct 27 17:30:03 1996 Geoffrey Noer <noer@cygnus.com>
-
- * cygwin.din: also export "_execl = execl" and the same
- for _execle and _execlp
-
-Thu Oct 24 01:43:29 1996 Geoffrey Noer <noer@cygnus.com>
-
- * include/windows.h: rewritten to include headers from
- the include/Windows32 subdirectory
- * winsup.h: no longer define MAX_PATH here since it's defined
- in header files dragged in by windows.h
- * dirsearch.cc (readdir): change WIN32_FIND_DATAA to WIN32_FIND_DATA
- * libccrt0.cc: #include <stdlib.h>
- * syscalls.cc (_unlink): chmod file to be unlinked to be
- writable and try to delete it again if first delete failed
- with permission denied error (rm will now work on read-only files)
- (num_entries): change WIN32_FIND_DATAA to WIN32_FIND_DATA
- * include/commdlg.h: delete
- * include/ddeml.h: delete
- * include/winadvapi.h: delete
- * include/winbase.h: delete
- * include/wincon.h: delete
- * include/windef.h: delete
- * include/windowsx.h: delete
- * include/winerror.h: delete
- * include/wingdi.h: delete
- * include/winkernel.h: delete
- * include/winnt.h: delete
- * include/wintypes.h: delete
- * include/winuser.h: delete
- * include/winversion.h: delete
-
-Wed Oct 23 10:43:05 1996 Jeremy Allison <jra@cygnus.com>
-
- * dcrt0.cc (api_fatal): Changed locking clear of
- process table to unlocking clear. Needed as lock code calls
- api_fatal.
- * exceptions.cc: Added debug_printfs to follow exceptions in
- strace mode.
- * pinfo.cc: Added code to ensure fd table is cleared when new
- pid entry allocated. Fixed bug when process is terminated
- violently by TerminateProcess and leaves fd table non-zero.
- * termios.cc: Changed stubbed out syscalls to syscall_printf
- rather than small_printf. Stops annoying tcdrain message.
- * winsup.h: Made get_empty_pinfo call private to pinfo_list.
- Should never be called external to this class.
-
-Tue Oct 22 16:14:23 1996 Jeremy Allison <jra@cygnus.com>
-
- * hinfo.cc: Removed previous change. This is not the
- correct place to flush input events.
-
-Tue Oct 22 09:25:32 1996 Jeremy Allison <jra@cygnus.com>
-
- * dcrt0.cc: Fixed up exit code to clean up pinfo array.
- * exceptions.cc: Fixed up exit code to clean up pinfo array.
- * fork.cc: Tidied up access to inuse_p entry. Added flags
- to allow different states to be represented.
- * hinfo.cc: Added code to flush pending events if
- stdin is a console.
- * pinfo.cc (pinfo::record_death): Added code to clean
- the pinfo array if we are an exiting parent.
- * spawn.cc: Removed erroneous code to clean childs
- pinfo entry.
- * wait.cc: Changed WAIT_ERROR_RC to Win32 WAIT_FAILED.
- Tidied up access to pinfo array.
- * winsup.h: Added record_death_nolock to pinfo class.
- Added PID_XXX types for inuse_p.
-
-Tue Oct 22 01:26:52 1996 Geoffrey Noer <noer@cygnus.com>
-
- * include/Windows32/Base.h:
- * include/Windows32/Functions.h:
- * include/Windows32/Structures.h:
- * include/Windows32/UnicodeFunctions.h:
- Fixes to just commited changes
-
-Mon Oct 21 19:58:50 1996 Geoffrey Noer <noer@cygnus.com>
-
- * include/Windows32/ASCIIFunctions.h:
- * include/Windows32/Base.h:
- * include/Windows32/Defines.h:
- * include/Windows32/Functions.h:
- * include/Windows32/Structures.h:
- * include/Windows32/UnicodeFunctions.h:
-
- Add back items in old include files (commdlg.h, ddeml.h,
- shellapi.h, winadvapi.h, winbase.h, wincon.h, windef.h,
- windowsx.h, winerror.h, wingdi.h, winkernel.h, winnt.h,
- wintypes.h, winuser.h, winversion.h) which should now be able
- to be erased and windows.h modified to point to the new headers
- without anything nasty happening.
-
- * include/WINREADME: deleted
- * include/mywinsock.h: removed many blank lines
-
-Mon Oct 21 09:48:00 1996 Jeremy Allison <jra@cygnus.com>
-
- * select.cc: Re-written from scratch. Take account of
- the following cases. (1). All sockets [written&works]
- (2). Handles, sockets and always readies [written,not tested]
- (3). All handles [written,not tested]. (4). Handles & sockets
- with timeout [not yet written,returns -1]. Correctly blocks
- and doesn't spin cpu.
- * pinfo.cc: Changed to add global lock around pinfo array.
- * fork.cc: Changed to use global pinfo lock.
- * shared.cc: Fixed bug with fork()->exec()->exec() code.
- * net.cc: Removed select_init() call (no longer used).
- * spawn.cc: Implemented suggestion that spawn creates
- process suspended, then sets up it's dwProcessId entry
- in the shared pinfo array.
- * wait.cc: Changed to use global pinfo lock.
- * winsup.h: Added missing windows_95() call.
- * fhandler.h: Changed ifdefs to select new always_ready
- methods.
- * fhandler.cc (fhandler_console::write): Fixed bug
- where return of write_normal was being ignored.
- * dcrt0.cc: Added code to use global pinfo lock.
- Ensure that process records it's own death.
- * exceptions.cc: Added code to clear our entry in pinfo
- array when we are exiting. Should reduce dead processes in
- pinfo array.
- * include/winbase.h: Added MAXIMUM_WAIT_OBJECTS define.
-
-Mon Oct 21 00:52:17 1996 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: install headers from new Windows32 dir
-
-Sat Oct 19 00:47:58 1996 Geoffrey Noer <noer@cygnus.com>
-
- * include/Windows32/Base.h: change DWORD to unsigned int from
- unsigned long, change __WIN32__ checks to _WIN32, change
- // comments to /* */
-
-Fri Oct 18 17:33:07 1996 Geoffrey Noer <noer@cygnus.com>
-
- * include/Windows32/Defines.h: change INFINITE to 0xFFFFFFFF,
- add back definitions present in old winsup headers missing from
- this file (STATUS_WAIT_0 et al, CONTEXT stuff, FAR, PACKED,
- ASCIICHAR)
- * include/Windows32/Functions.h: change // comments to /* */
- * include/Windows32/Messages.h: add definitions for WM_NULL,
- WM_PENWINFIRST, WM_PENWINLAST
- * include/Windows32/Sockets.h: change __WIN32__ checks to _WIN32
- * include/Windows32/Structures.h: add ppc case for CONTEXT
- structure, change // comments to /* */
-
-Fri Oct 18 17:25:09 1996 Geoffrey Noer <noer@cygnus.com>
-
- * include/Windows32: new directory for Windows headers
- * include/Windows32/ASCIIFunctions.h:
- * include/Windows32/Base.h:
- * include/Windows32/Defines.h:
- * include/Windows32/Errors.h:
- * include/Windows32/Functions.h:
- * include/Windows32/Messages.h:
- * include/Windows32/Sockets.h:
- * include/Windows32/Structures.h:
- * include/Windows32/UnicodeFunctions.h:
- New Win32 headers from Scott Christley's windows32api-0.1.2 package
- with no local modifications.
-
-Wed Oct 16 17:16:33 1996 Geoffrey Noer <noer@cygnus.com>
-
- * key.cc: remove extra blank lines, change ASCIICHAR to AsciiChar
- * registry.cc: remove #include <winbase.h> since it's already
- included in windows.h
-
-Tue Oct 15 09:51:48 1996 Jeremy Allison <jra@cygnus.com>
-
- * fhandler.h: Many changes to support moving fhandler array out of
- shared area into locally allocated memory. Removed fhandler class,
- fhandler_base is now root of class tree. Re-arranged class definitions
- to make it clear what functions are virtual and can be overridden.
- Inlined may accessor functions.
- * fhandler.cc: Many changes to support moving fhandler array out of
- shared area into locally allocated memory. unix_path_name_ is now
- always set (all fhandler_base classes have a name).
- * hinfo.cc: Many changes to support moving fhandler array out of
- shared area into locally allocated memory. Added linearization and
- de-linearization functions.
- * net.cc(socket): Added code to keep name for fhandler_socket.
- * pinfo.cc : Changed allocation of fhandler_base array to be in local
- memory rather than in shared area. (modified functions are pinfo_init,
- pinfo_list::get_empty_pinfo, pinfo_list::allocate_pid,
- pinfo::record_death).
- * shared.cc: Added functions to copy fd area for spawned process.
- Changed name of shared area to include master version number of
- Cygwin32.
- * spawn.cc (spawn_guts): Added code to initialize new shared area
- for fds.
- * syscalls.cc: Changed all code depending on NOFILE to use
- getdtablesize(). Added internal setdtablesize() call for exec'ed
- processes.
- * syscalls.h: Added getdtablesize().
- * sysconf.cc (sysconf): Changed SC_OPEN_MAX to return getdtablesize().
- * winsup.h: Moved fhandler array out of shared area. Changed from
- fhandler to fhandler_base (new root of class tree).
- * include/mywinsock.h: Updated #endif to make end of
- __INSIDE_CYGWIN32__ clear.
- * include/winkernel.h: Added UnmapViewOfFile call.
-
-Mon Oct 14 14:59:16 1996 Geoffrey Noer <noer@cygnus.com>
-
- * sysdef/i386: replace all files with ones from Scott
- Christley's windows32api-0.1.2 package. Still need to
- integrate new headers.
-
-Mon Oct 14 13:41:14 1996 Geoffrey Noer <noer@cygnus.com>
-
- * syscalls.cc (_unlink): need to fchmod file to writable
- before attempting to delete. This change still needs more
- work (fchmod isn't written yet).
- * (fchmod): change comment
-
-Fri Oct 11 22:27:17 1996 Geoffrey Noer <noer@cygnus.com>
-
- * fhandler.cc, fhandler.h: minor fixes to console
- support functions (remove missed reference to gotarg2,
- definition in fhandler.h)
-
-Wed Oct 9 17:55:00 1996 Geoffrey Noer <noer@cygnus.com>
-
- * delqueue.cc: added copyright notice, reformatted file
-
- from sos@prospect.com.ru (Sergey Okhapkin):
- * fhandler.cc, fhandler.h: add/fix ansi/vt100 console support,
- and fix a tab bug
- (modified functions are fhandler_console_out::clear_screen,
- fhandler_console_out::clear_to_eol,
- fhandler_console_out::char_command,
- fhandler_console_out::write,
- FakeReadFile)
-
-Wed Oct 9 17:32:17 1996 Jeremy Allison <jra@cygnus.com>
-
- * times.cc: Swapped gmtime and localtime (they were
- incorrectly reversed).
- Added is_dst determination to them both.
- * misc.c: Added swab, ffs.
- * fcntl.cc(fcntl): Added capability for lock calls.
- * fhandler.h: Added lock method into fhandler class.
- * fhandler.cc: Added NT/Win95 semantics locks into ::lock
- made them pretend they are POSIX locks.
- * syscalls.cc (writev): Fixed return value bug.
- * net.cc: Added WSAEOPNOTSUPP error.
- * cygwin.din: Added ffs and swab.
- * include/strings.h: Added file (just include string.h).
- * include/winbase.h: Added defines LOCKFILE_FAIL_IMMEDIATELY
- and LOCKFILE_EXCLUSIVE_LOCK.
- * include/winerror.h: Added define ERROR_LOCK_FAILED.
-
-Thu Oct 3 16:19:23 1996 Jeremy Allison <jra@cygnus.com>
-
- * fhandler.h: Many changes - removed all public variables
- from classes, replaced with accessor functions. Renamed all
- class variables to add a trailing '_'. This makes reading
- and understanding which variables are class variables much simpler.
- Changed name member to unix_path_name_ and made dynamic rather
- than a fixed 31 byte buffer per entry.
- * fhandler.cc: Updated varable access for above.
- * fcntl.cc: Updated varable access for above.
- * hinfo.cc: Updated varable access for above.
- * spawn.cc: Updated varable access for above.
- * syscalls.cc: Added fsync (null call) and fchmod(null
- call at present).
- * net.cc: Added ioctls for SIOCGIFCONF and SIOCGIFFLAGS.
- Added ntohs, ntohl, static functions get_winnt_ifconf,
- get_win95_ifconf and get_if_flags.
- * include/cygwin32/if.h: Added structs for new ioctls.
- * include/cygwin32/socket.h: Added iovec include.
- * include/asm/socket.h: Added defines for above ioctls.
- * cygwin.din: Added ntohs, ntohl, fsync, fchmod.
-
-Wed Oct 2 17:34:21 1996 Geoffrey Noer <noer@cygnus.com>
-
- * utils/configure.in: add call to AC_CANONICAL_SYSTEM
- * utils/configure: regenerate
- * Makefile.in: build cygwin.dll as new-cygwin.dll and install as
- cygwin.dll to prevent confusion when building winsup natively
-
-Tue Oct 1 17:27:34 1996 Jeremy Allison (jra@cygnus.com)
-
- * include/regex.h: Added.
- * net.cc: Added WSAECONNRESET, WSAEPFNOSUPPORT to
- errmap array.
-
-Tue Oct 1 15:40:39 1996 Jeremy Allison (jra@cygnus.com)
-
- * fork.cc (cygwin_fork_helper1): Fixed resource leak of process
- handles, added cleanup code. Also fixed timout problem when child
- cannot be initialized.
- * dirsearch.cc (readdir): Changed comparison to explicitly check for
- INVALID_HANDLE_VALUE. Test < 0 fails with void *.
- * syscalls.cc (num_entries): Changed comparison to explicitly check for
- INVALID_HANDLE_VALUE. Test < 0 fails with void *.
- * cygwin.din: Added regcomp, regexec, regerror, regfree.
- * Makefile.in: Added EXTRA_OFILES containing ../librx/rx.o. Added
- comment to explain makefrag. Added ../newlib/libc/include to include
- path.
-
-Mon Sep 30 16:10:56 1996 Stu Grossman (grossman@critters.cygnus.com)
-
- * cygwin.din: Remove getopt and friends.
-
-Fri Sep 27 18:31:28 1996 Jeremy Allison <jra@cygnus.com>
-
- * dcrt0.cc (dll_crt_1): Moved initialization of _reent to correct
- position.
-
-Fri Sep 27 14:24:05 1996 Jeremy Allison <jra@cygnus.com>
-
- * dcrt0.cc (dll_crt_1): Fixed fork bug with _impure_ptr not being
- initialized correctly in a forked child. This should fix
- the bash echo in a sub-shell bug.
- * include/sys/uio.h: Created file. Contains definitions for writev
- * include/limits.h: Added IOV_MAX and SSIZE_MAX.
- * syscalls.cc: Added writev, changed read and write to return ssize_t.
- * syscalls.h: Added writev, changed read and write to return ssize_t.
- * cygwin.din: Added writev call.
-
-Wed Sep 20 13:09:00 1996 Jeremy Allison <jra@cygnus.com>
-
- * include/mntent.h: Added MOUNTED definition, needed by
- some code.
- * dcrt0.cc : Added __progname for getopt code.
- * misc.c: Added getw code.
- * cygwin.din: Added getopt, optarg, opterr, optind
- optopt, putw, getw calls.
-
-Fri Sep 20 03:03:17 1996 Geoffrey Noer <noer@cygnus.com>
-
- * select.cc: change long millisec to unsigned int,
- respaced file
-
- patch from Sergey Okhapkin <sos@prospect.com.ru>:
- * select.cc (polled): fix for select to get keyboard input
- working properly (check EventType != KEY_EVENT instead
- of checking for KeyEvent.AsciiChar == 0)
- * select.cc (cygwin32_select): make int i unsigned int so NULL is
- a valid timeout argument for loop
-
-Fri Sep 13 18:21:52 1996 Jeremy Allison <jra@cygnus.com>
-
- * fhandler.cc (fhandler_base::read): rewrite text mode read
-
-Fri Sep 13 14:58:17 1996 Geoffrey Noer <noer@cygnus.com>
-
- * exceptions.cc (call_handler): fix control-C not working
- problem by setting rethere variable before the old value is
- clobbered.
-
-Thu Sep 12 16:27:00 1996 Jeremy Allison <jra@cygnus.com>
-
- * syslog.cc (pass_handler) : Removed duplicate code
- in pass_handler::print(). Added get_win95_event_log_path()
- to facilitate moving to registry configuration.
-
-Thu Sep 12 12:56:00 1996 Jeremy Allison <jra@cygnus.com>
-
- * syslog.cc : Added real openlog, syslog, logmask, closelog
- calls. syslog logs to event log on NT, file on Win95.
- * include/winnt.h : added EVENTLOG_xx_TYPE definitions.
- * include/winadvapi.h : added ReportEventA, RegisterEventSourceA
- DeregisterEventSourceA declarations.
- * include/winkernel.h : added LockFile, UnlockFile, LockFileEx,
- UnlockFileEx declarations.
- * include/wintypes.h : added PSID typedef.
- * include/sys/syslog.h : added options flag definitions for openlog.
-
-Wed Sep 11 15:34:09 1996 Geoffrey Noer <noer@cygnus.com>
-
- * fhandler.cc (popen): delete stub in favor of newlib's
- (pclose): delete stub in favor of newlib's
-
-Tue Sep 10 17:20:56 1996 Geoffrey Noer <noer@cygnus.com>
-
- * configure.in: don't transform names (the only time this might
- be a good idea is for unix x cygwin32)
- * configure: regenerated with autoconf
-
-Tue Sep 10 17:20:56 1996 Geoffrey Noer <noer@cygnus.com>
-
- patch from Sergey Okhapkin <sos@prospect.com.ru>:
- * fhandler.cc (FakeReadFile): support arrow keys, stop treating
- bringing window to front as a key down (resulting in random
- characters being printed in bash).
-
-Mon Sep 9 19:09:36 1996 Geoffrey Noer <noer@cygnus.com>
-
- * syscalls.cc (system): fix system call
-
-Fri Sep 6 09:33:13 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * fhandler.h (fhandler_base): Make execable_p public char, not
- private signed char. Delete get_execable.
- * fhandler.cc (fhandler_base::get_execable): Renamed to
- check_execable_p.
- (fhandler_base::open): Restore symlink support.
- Set execable_p, symlink_p.
- (fhandler_base::fstat): Replace call to get_execable with reference
- to execable_p.
- (fhandler_base::fhandler_base): Set execable_p to 0.
- * path.h (symlink_check): Declare it.
- * path.cc (symlink_check): New function.
- (readlink): Call it.
- (symlink_follow): Likewise. New arg EXEC, callers updated.
- * syscalls.cc (_stat_worker): New arg CALLER, callers updated.
-
- * syscalls.cc: Delete all occurences of in/out and MARK.
-
-Thu Sep 5 18:51:01 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * fork.cc: Don't include <ctype.h>. Delete find_exec and support.
- * spawn.cc: Include <ctype.h>. Move find_exec and support here.
- (perhaps_suffix): New argument report_failure_p, callers updated.
- (find_exec_1): Use perhaps_suffix when scanning PATH.
- (spawn_guts): Replace code to translate posix to win32 path lists
- with calls to utility fns that do the job.
-
-Wed Sep 4 13:30:57 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * path.cc (readlink): Make more bulletproof.
-
-Wed Aug 28 16:44:24 1996 Geoffrey Noer <noer@cygnus.com>
-
- * syscalls.cc (system): use execlp
- * public release beta 16 made
-
-Tue Aug 27 09:58:14 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * version.h (CYGWIN_DLL_VERSION_MINOR): Bump up to 2.
-
-Mon Aug 26 15:12:44 1996 Geoffrey Noer <noer@cygnus.com>
-
- * syscalls.cc (system): added basic system() call.
-
-Mon Aug 26 13:46:30 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * cygwin.din (cygwin_fork_helper__FPvN30): Delete.
- (vfork,select): Add.
- * fork.cc (prepare_child): Delete, contents moved into
- cygwin_fork_helper1.
- (cygwin_fork_helper): Delete, contents moved into __fork.
- * winsup.h (cygwin_fork_helper): Delete.
-
- * path.cc: #include <fcntl.h>.
- (symlink,readlink): Reenable, rewrite.
- (symlink_follow): New function.
- * path.h (symlink): Delete.
- (SYMLINK_COOKIE, MAX_LINK_DEPTH): Define.
- (symlink_follow): Declare.
- * spawn.cc (spawn_guts): Rewrite symlink support.
-
- * syscalls.cc (_unlink): Make arg a const char *.
- * winsup.h (_unlink): Likewise.
-
- * spawn.cc (spawn_guts): Fix allocation of stack space for sh.exe path.
-
- * include/sys/errno.h: Deleted. Use newlib's.
-
-Fri Aug 23 16:00:00 1996 Jeremy Allison <jra@cygnus.com>
-
- * net.cc (getdomainname): Changed win95 code to open
- "System" key rather than "SYSTEM". I think the registry
- is case-sensitive.
-
-Thu Aug 22 17:04:09 1996 Geoffrey Noer <noer@cygnus.com>
-
- move fork into the dll:
- * libcfork.cc: deleted
- * fork.cc (vfork): used to be in libcfork.cc
- * (__fork): used to be in libcfork.cc
- * (fork): used to be in libcfork.cc
- * Makefile.in: don't build libcfork.cc any more
- * libccrt0.cc: set data_start, etc. from dll structure
- * winsup.h: add data_start, etc. to public vars in dll
- * cygwin.din: list fork
-
-Thu Aug 22 01:36:53 1996 Geoffrey Noer <noer@cygnus.com>
-
- * registry.cc: fix new registry code
- * syscalls.cc: make Windows95 check function extern "C"
-
-Wed Aug 21 16:15:47 1996 Geoffrey Noer <noer@cygnus.com>
-
- * cygwin.din: list vfork
- * dirsearch.cc: fix errno setting in readdir that caused
- diff to not function on directories
- * pipe.cc: reformatted
-
-Wed Aug 21 15:12:47 1996 Jeremy Allison <jra@cygnus.com>
-
- * net.cc (domainname): Changed getdomainname to get the
- information from the registry.
- * registry.h: Modified interface to reg_key.
- * registry.cc: Added open(),close() calls, made
- get/set string values return error indication, added trailing
- underscore to hkey member so it can be seen to
- be a class member.
- * include/winadvapi.h: Added KEY_READ and KEY write
- defines for registry access.
-
-Mon Aug 19 09:22:35 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * path.cc (split_path): New function.
- * path.h (split_path): Declare it.
- * cygwin.din (cygwin32_split_path): Export it.
-
- * include/winkernel.h (FILE_SHARE_DELETE): Define.
-
- * syscalls.cc (__do_global_[cd]tors], __main): Move from here.
- * dcrt0.cc: To here.
-
- * dcrt0.cc (recur): Restore (now that we know WHY it was needed).
- (dll_crt0_1): Probe forked child's stack out.
-
- * fork.cc (FORK_WAIT_TIMEOUT): Bump up to two minutes.
-
- * fork.cc (dump_jmp_buf): New function.
- (cygwin_fork_helper1): Call it.
- * dcrt0.cc (dll_crt0:1): Call it.
- * winsup.h (dump_jmp_buf): Declare it.
-
- * fork.cc (cygwin_fork_helper1): Reenable child suspend before
- stack copy code.
-
-Sat Aug 17 04:06:36 1996 Geoffrey Noer <noer@cygnus.com>
-
- * dirsearch.cc: reformatted, removed a couple of gotos
-
-Thu Aug 15 17:56:08 1996 Geoffrey Noer <noer@cygnus.com>
-
- * cygwin.din: added __eprintf, a newlib function needed by assert.
- * times.cc: swap gmtime and localtime (gmtime really was localtime
- and vice versa).
-
-Tue Aug 13 03:46:22 1996 Geoffrey Noer <noer@cygnus.com>
-
- * signal.cc: renamed all signal variables "sig",
- fixed signal range error checking in all relevant functions,
- (sigaddset): new
- (sigismember): new
- (sigfillset): new
- (sigemptyset): new
- * cygwin.din: added corresponding entries for new signal functions.
- * cygwin.h: added protos for them
- * fhandler.cc, fhandler.h: major reformat of code
- * net.cc (cygwin32_socket): call checkinit() at start to
- initialize WinSock in case it isn't already.
- * syscalls.cc (access): set errno appropriately when no
- write access
- * fcntl.cc: reformatting
-
-Sat Aug 10 16:30:14 1996 Geoffrey Noer <noer@cygnus.com>
-
- * signal.cc (_raise): rewrite to shorten code, corrected
- return values.
- * fcntl.cc, net.cc, signal.cc, stubs.c: reformatted, added
- public domain notice at the tops if they were missing.
-
-Fri Aug 9 18:19:12 1996 Geoffrey Noer <noer@cygnus.com>
-
- * syscalls.cc (_rename): return -1 if file to be renamed
- doesn't exist. Reformatted whole file.
- * fork.cc: increase timeout value to 60 sec from 30 sec
-
-Thu Aug 8 17:44:39 1996 Jim Wilson <wilson@cygnus.com>
-
- * config/i386/longjmp.c: Increment %eax if it is zero.
-
-Wed Aug 7 15:51:04 1996 Geoffrey Noer <noer@cygnus.com>
-
- * include/sys/mman.h: fixed defines for PROT_READ et al to
- match what's more normally there in unix
- * sysdef/i386/*: removed the extra underscores present in most
- of these files that shouldn't have been there
- * net.cc: cleaned up whitespace, formatting
-
-Tue Jul 16 12:43:16 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * libccrt0.cc (__version): Deleted, unused.
-
- * uname.c (uname): Print CYGWIN_DLL_VERSION is version field.
-
-Mon Jul 15 16:48:29 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * version.h (CYGWIN_DLL_VERSION_MINOR): Bump up to 1.
-
- Path handling clean up, pass 2 (use //<letter>, not /.<letter>.).
- * path.cc (SLASH_DRIVE_PREFIX_LEN): Delete.
- (slash_drive_to_win32_path): New function.
- (mount_info::posix_path_p): Delete support for $CYGWIN,
- always return 1.
- (path_conv::path_conv): Call slash_drive_to_win32_path.
- (mount_info::conv_to_win32_path): Renamed from
- posix_path_to_win32_path. All callers updated.
- (mount_info::conv_to_posix_path): Renamed from
- win32_path_to_posix_path. All callers updated.
- (normalize_posix_path): Keep two leading /'s (or \'s).
- (normalize_win32_path): Likewise.
- (conv_to_{win32,posix}_path): Renamed from
- {posix,win32}_path_to_{win32,posix}_path_keep_rel.
- (conv_to_full_{win32,posix}_path): Renamed from
- {posix,win32}_path_to_full_{win32,posix}_path.
- (posix_path_list_p): New function.
- (cygwin32_{unix,dos}_path_to_{dos,unix}_path_keep_rel): Delete.
- ({unix,dos}_path_to_{dos,unix}_path): Delete.
- ({win32,posix}_to_{posix,win32}_path_list_buf_size): Renamed from
- cygwin32_{win32,posix}_to_{posix,win32}_path_list_buf_size.
- ({win32,posix}_to_{posix,win32}_path_list): Renamed from
- cygwin32_{win32,posix}_to_{posix,win32}_path_list.
- (slash_drive_prefix_p): Recognize //<letter>, not /.<letter>.
- (build_slash_drive_prefix): Update.
- * path.h: Update.
- * cygwin.din ({dos,unix}_path_to_{unix,dos}_path): Delete.
- (cygwin32_{dos,unix}_path_to_{unix,dos}_path_keep_rel): Delete.
- (cygwin32_conv_to_{posix,win32}_path): Renamed from
- (cygwin32_{win32,posix}_path_to_{posix,win32}_path_keep_rel.
- (cygwin32_conv_to_full_{posix,win32}): New exports.
- (cygwin32_posix_path_list_p): New export.
- * dcrt0.cc (path_len): Delete.
- (PATH_ENV_BUF_SIZE): Delete.
- (conv_path_names): Delete all but PATH.
- (dll_crt0_1): Rewrite environment variable conversion code.
- * fork.cc (find_exec_1): Delete _SC_PATH_RULES support. Determine
- path delimiter by calling posix_path_list_p.
- * shared.cc (shared_info::initialize): Delete `path_rules'.
- * sysconf.cc (sysconf): Delete _SC_PATH_RULES.
- * winsup.h (shared_info): Delete `path_rules'.
-
- * fork.cc (cygwin_fork_helper1): Reset u->forkee after child has
- started.
-
- * pinfo.cc (pinfo::init_from_fork): Delete. Empty function.
- * fork.cc (cygwin_fork_helper1): Delete call to it.
-
- * utils/kill.cc (usage): New function.
- (main): Allow multiple pids to be passed. Call usage.
-
-Mon Jul 15 13:07:23 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * Makefile.in (install): If cross compiling, install the
- cygwin.dll file as $target_alias-cygwin.dll in the bin directory,
- instead of plain cygin.dll.
- Install the cygwin.dll file in the library directory as well.
-
- * configure.in: Test for cross compiling, and if cross compiling,
- transform name of cygwin.dll file in the binary directory.
-
- * configure: Regenerate.
-
- * utils/Makefile.in (Makefile): Rebuild Makefile if configure.in
- changes.
- (install): Use the toplevel install.sh to install the utilities,
- and transform the name if cross compiling.
-
- * utils/configure.in: Test for cross compiling, and if cross
- compiling, tranform mount, umount, ps, etc. Do not call
- AC_PROG_INSTALL anymore.
-
- * utils/configure: Regenerate.
-
-Fri Jul 12 16:25:09 1996 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: also make install in utils subdir so "mount"
- et al gets installed.
-
-Thu Jul 11 17:53:31 1996 Geoffrey Noer <noer@cygnus.com>
-
- * include/sys/param.h: fixed value of HZ (now 1000 instead of 100).
- caused bug that showed up as "time sleep 5" returning 50.
-
-Thu Jul 11 14:08:09 1996 Geoffrey Noer <noer@cygnus.com>
-
- * fhandler.cc: correct typo in comment
- * exceptions.cc: remove definition of sig_func_ptr, replace
- occurances with newlib-defined _sig_func_ptr.
-
-Wed Jul 10 19:12:18 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * version.h (CYGWIN_DLL_VERSION_{MAJOR,MINOR}): Bump up to 17.0.
- * winsup.h (class per_process): New members {public,internal}_reserved.
- (SIZEOF_PER_PROCESS): Define.
- * dcrt0.cc (dll_crt0_1): Add sanity check of per_process size.
- Don't call checkout for forkee.
- * libccrt0.cc (cygwin_crt0): Set magic_biscuit to sizeof per_process
- again.
-
- * utils/ps.cc (main): Print uid.
-
- * hinfo.h: Deleted. Contents moved to winsup.h.
- * Makefile.in (WINSUP_H): Update.
-
- * dcrt0.cc (u, environ): Moved here.
- * shared.cc: From here.
-
- * pinfo.cc (pinfo_init): Renamed from pinfo_init_per_process.
- All callers updated.
- * hinfo.cc (hmap_init): Renamed from hmap_init_per_process.
- All callers updated.
- * winsup.h (cygwin_parent_p): Renamed from invoked_by_cygwin_p.
- All uses updated.
-
- * fork.cc (prepare_child): Add debug message.
-
- * uinfo.cc (uinfo_init): Renamed from uinfo::init.
- All callers updated. Call getlogin instead of GetUserName.
- (getlogin): Call GetUserName.
- * winsup.h (class uinfo): Delete. Members uid,gid moved ...
- (class pinfo): To here. All uses updated.
- (class shared_info): Delete member `u'.
- * fork.cc (cygwin_fork_helper1): Set child's uid,gid.
-
- * pinfo.cc (pinfo::clearout): Reset strace_mask_ptr.
-
- * shared.cc (open_shared_file_map): Add debugging message.
-
-Fri Jul 5 15:36:48 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * exceptions.cc (sig_func_ptr): New typedef.
- (__stack_trace): Make i386 and ppc formats the same.
- (sigfunc): Use sig_func_ptr.
- (call_handler): Likewise. All callers updated.
- (__cygwin_exception_handler): Handle exceptions before dll has
- fully initialized. Only call dump_status once, like __stack_trace.
- (really_exit): Call _exit, not exit.
-
- * hinfo.cc: Add copyright.
- * uinfo.cc: Likewise.
-
- * passwd.c: Whitespace cleanup.
- (search_for): Make static.
-
- * pinfo.cc (pinfo_list::init): Delete call to clearout vec[0].
- (pinfo::clearout): Reset more fields.
- (pinfo_list::get_empty_pinfo): Delete printing of error messages
- if table is full.
-
- * shared.cc (open_shared_file_map): Mark shared map as not inherited.
-
- * signal.cc (signal): Delete (void *) coersion of result.
- (usleep): Convert microseconds to milliseconds. Delete second copy.
- (_raise): Use _sig_func_ptr.
-
- * syscalls.h: Delete #include mntent.h, sys/types.h, string.h,
- stdio.h, setjmp.h, stdlib.h, signal.h, sys/strace.h, unistd.h,
- ctype.h, fcntl.h.
- * winsup.h: #include sys/types.h, sys/strace.h, setjmp.h, signal.h,
- string.h, windows.h.
- * All necessary files updated.
-
- * winsup.h (class pinfo): Delete member localtime_buf.
- * times.cc (corelocaltime): Use static local for localtime_buf.
-
- * winsup.h (class pinfo): Rename the_pid to pid. All uses updated.
- Delete handle_valid_p, unused. Rename __sig_mask to sig_mask.
-
-Thu Jul 4 14:36:01 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * shared.h: Deleted. All files updated.
- * winsup.h: shared.h contents moved here.
- * Makefile.in (WINSUP_H): Update.
-
- * heap.cc: Renamed from pproc.cc.
- (heap_init): Renamed from per_process::init.
- In forkee initialization, ensure memory being reserved is at same
- address as parent's. Commit forkee memory in one chunk.
- (_sbrk): Moved here,
- * syscalls.cc (_sbrk): From here.
- * Makefile.in (DLL_OFILES): Update.
- * dcrt0.cc (dll_crt0_1): Call heap_init instead of u->init.
- * winsup.h (class per_process): Delete member `init'.
-
- * dcrt0.cc (recur): Delete.
- (dos_argv_to_unix_argv): Delete.
-
- * delqueue.cc: Delete #include of delqueue.h, winerror.h
- * winsup.h: #include delqueue.h.
-
- * exceptions.cc (ctrl_c_handler): Only require 13 ^c's to quit task.
-
- * fork.cc (fork_mutex,forkee_stopped,forker_stopped): New static
- globals, were in class_shared info.
- (fork_init,fork_terminate): New functions.
- (prepare_child,cygwin_fork_helper1): Update.
- (cygwin_fork_helper1): If fork disabled, return EAGAIN.
- Delete unnecessary resetting of forkee_stopped event.
- * winsup.h (fork_init,fork_terminate): Declare them.
- * dcrt0.cc (dll_crt0_1): Call fork_init.
- (_exit): Call fork_terminate.
- * shared.c (shared_info::initialize): Delete init of fork stuff.
-
- * shared.c (h): New static global, was in class shared_info.
- (shared_info::terminate): Delete, move contents into shared_terminate.
-
- * strace.cc (flush_p): New static global.
- (strace_init): Don't clobber u->strace_mask if _STRACE_INHERIT set.
- (__sys_printf): Only flush buffers if _STRACE_FLUSH.
- * include/sys/strace.h (_STRACE_FLUSH,_STRACE_INHERIT): Define.
- Reorganize bitmasks.
-
- * utils/ps.cc (main): Make output prettier.
-
-Wed Jul 3 12:30:24 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * utils/Makefile.in (mount,umount,ps,kill): Rewrite rules.
- (PROGS): Add cygwin.
- (cygwin): New target.
- (install): Install all of $(PROGS).
- * utils/cygwin.cc: New file.
-
- * pinfo.cc (pinfo_init_per_process): PID environment variable handling
- moved here. Delete setting of u->parent. Set strace_mask_ptr.
- Set invoked_by_cygwin_p appropriately.
- (vfork_init): Delete, unused.
- (pinfo::init_self): Delete setting of root_p.
- (pinfo::terminate): root_p renamed to invoked_by_cygwin_p.
- * winsup.h (class per_process): Delete initial_pid, no longer used.
- (class pinfo): Add strace_mask_ptr.
- * fork.cc (cygwin_fork_helper1): Update.
-
- * winsup.h (class per_process): Delete trace_file, trace_mutex.
- Rename estrace to strace_mask.
- (system_printf): Declare.
- * strace.cc (strace_init): Renamed from per_process::strace_init.
- Don't open trace file unless strace environment variable set.
- Open trace file with FILE_SHARE_READ so others can read trace file
- while tracing in progress. Print error if $strace too big.
- (strace_file, strace_mutex): New static globals.
- (__sys_printf): Don't do anything if strace file not opened.
- (system_printf): New function.
- * pproc.cc (per_process::init): Delete call to strace_init.
- * dcrt0 (dll_crt0_1): Call strace_init as soon as possible.
-
- * dcrt0 (dll_crt0_1): Delete local can_glob, use
- u->self->invoked_by_cygwin_p instead.
- Move PID environment variable handling into pinfo_init_per_process.
- Delete setting of u->self->in_bash.
- Delete watching for bash.
- * winsup.h (class pinfo): Delete in_bash.
-
- * exceptions.cc (*): Call system_printf, not __sys_printf.
-
- * shared.h (class shared_info): Delete pp, unused.
-
- * syscalls.cc (isatty): Replace ttyname with is_tty.
-
- * winsup.h (registry_init_once_only): Delete, unused.
- (stdout_handle,file_handle_from_fd): Likewise.
- (CHILD_P,child_p,ALL_FS,loadup_dll,cygwin_s): Likewise.
- (unmixedcaseify): Prototype moved to path.h.
- * path.h (unmixedcaseify): Declare.
-
- * fork.cc (FORK_WAIT_TIMEOUT, WAIT_ERROR_RC): Define.
- (find_exec_1): Don't search PATH if directory present (not only if
- absolute path). Search "." before searching PATH.
- (copy): Return boolean indicating success. All callers updated.
- (prepare_child): Simplify. Check return code of WaitForSingleObject.
- Don't wait an infinite amount of time.
- (cygwin_fork_helper1): Simplify.
- Check return code of WaitForSingleObject.
- Don't wait an infinite amount of time.
- Check return code of copy.
- Disable code to Suspend/Resume child thread a second time.
-
- * winsup.h (class per_process): Make initial_sp a char *.
- * libccrt0.cc (cygwin_crt0): Update.
-
- * path.cc (path_conv): If name too long, set path to bogus value.
-
- * include/winkernel.h (WriteProcessMemory): Fix prototype.
-
- * include/sys/strace.h: Add extern "C" ifdef __cplusplus.
- (_STRACE): Delete.
- * dirsearch.cc (rewinddir): Use syscall_printf.
-
-Tue Jul 2 14:44:18 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * wait.cc (WAIT_ERROR_RC): Use it instead of ALL_FS.
- (wait_found): New argument `options'. If GetExitCodeProcess fails,
- ensure `result' contains something reasonable.
- (wait_for_single): Check whether `c' is NULL before dereferencing it.
- (wait_for_any): Add some comments. Delete unnecessary gotos.
- (waitpid): Print message if called with intpid == 0.
-
-Sat Jun 29 10:49:28 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * dirsearch.cc (readdir): Clean up syscall tracing.
- Mixed case handling temporarily disabled.
-
-Wed Jun 26 11:54:27 1996 Jason Molenda (crash@godzilla.cygnus.co.jp)
-
- * Makefile.in (bindir, libdir, datadir, infodir, includedir):
- Use autoconf-set values.
- (docdir): Removed.
- (install-info): Add.
- * configure.in (AC_PREREQ): autoconf 2.5 or higher.
- * configure: Rebuilt.
- * glob/configure.in (AC_PREREQ): autoconf 2.5 or higher.
- * glob/configure: Rebuilt.
- * utils/Makefile.in (bindir, exec_prefix): Use autoconf-set values.
- * utils/configure.in (AC_PREREQ): autoconf 2.5 or higher.
- * utils/configure: Rebuilt.
-
-Tue Jun 25 17:48:56 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * include/sys/param.h (PATH_MAX,MAXPATHLEN): Change from 1024 to 259.
- (BIG_ENDIAN,LITTLE_ENDIAN,BYTE_ORDER): Define.
-
-Mon Jun 24 16:35:48 1996 Mark Eichin <eichin@cygnus.com>
-
- * fhandler.cc (read): Replace the old broken igncr code (which has
- been disabled for a while anyway) with code that checks for
- ENABLE_LINE_INPUT and replace only \r\n with \n.
-
-Mon Jun 24 00:12:22 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * dcrt0.cc (dll_crt0_1): Convert argv[0] to posix style if necessary.
-
-Sun Jun 23 17:21:41 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * version.h (CYGWIN_DLL_VERSION_MINOR): Bump up to 2.
-
- * fork.cc (perhaps_suffix): Simplify.
- (find_exec_1): Likewise. Always try appending .exe first.
- (cygwin_fork_helper1): Clean up (lots more needed still).
- Test for split heap before calling CreateProcess.
- No longer call find_exec, now done at start up.
- * dcrt0.cc (dll_crt0_1): Call find_exec to expand argv[0].
-
- * path.cc (conv_path_list_buf_size): New function.
- (cygwin32_{win32,posix}_to_{posix,win32}_path_list_buf_size): Ditto.
- (conv_path_list): Ditto.
- (cygwin32_{win32,posix}_to_{posix,win32}_path_list): Ditto.
- * cygwin.din: Export them.
-
- * misc.c (small_printf): Delete.
- (vhangup): Set errno.
-
- * syscalls.cc (isatty): Print syscall trace message even if error.
-
- * console.cc (*): Check return codes of win32 api calls.
-
- * syscalls.cc (chmod): Set errno of SetFileAttributes fails.
- Fix call to syscall_printf.
-
-Thu Jun 20 00:43:52 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * dcrt0.cc (dll_crt0_1): Save full program name.
- * fork.cc (cygwin_fork_helper1): Always call find_exec.
-
- * path.cc (normalize_{posix,win32}_path): Fix edge case handling.
- (path_conv::path_conv): Ensure path is \-ified if win32 path rules.
-
- * spawn.cc (spawn_guts): Set errno if CreateProcess fails.
-
-Wed Jun 19 00:18:03 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * path.h (PATH_RULES macros): Delete. Use ones in unistd.h.
- (enum path_rules_enum): Deleted. All uses updated.
- (path_conv): Rename member get_native to get_win32. All uses updated.
- (*win32_path*): Renamed from *native_path*.
- * path.cc (*win32_path*): Renamed from *native_path*.
- (mount_info::posix_path_p): Prepend '_' to PATH_RULES.
- Fix returning of cached value.
- (slash_drive_prefix_p, build_slash_drive_prefix): New functions.
- (mount_info::posix_path_to_win32_path): /.<letter>. is a drive spec.
- (path_conv::path_conv): Likewise.
- (mount_info::win32_path_to_posix_path): Convert unknown drives to
- /.<letter>. Normalize win32_path.
- (normalize_win32_path): New functions.
- (getcwd_inner): New arg `posix_p'. All callers updated.
- * shared.cc (shared_info::initialize): Prepend '_' to PATH_RULES.
- _PATH_RULES_NATIVE -> _PATH_RULES_WIN32.
- * spawn.cc (*win32_path*): Renamed from *native_path*.
- * dcrt0.cc: Likewise.
- * cygwin.din: Likewise.
-
- * Makefile.in (WINSUP_H): Add shared.h
-
- * smallprint.c (rn): Make static.
-
- * sysconf.cc: Renamed from sysconf.c.
- (sysconf): Support _SC_PATH_RULES.
-
- * screen.c: Deleted.
- * Makefile.in (DLL_OFILES): Delete screen.o.
-
- * fork.cc (cygwin_fork_helper): Don't pass 0 from longjmp to setjmp.
-
- * path.h (class mount_info): Update posix_path_to_native_path member.
- * path.cc (path_prefix_p): Rewrite.
- New arg `len'. All callers updated.
- (mount_info::binary_native_path_p): Call path_prefix_p.
- (path_conv::path_conv): Pass full_path to binary_native_path_p.
- (mount_info::posix_path_to_native_path): Delete arg keep_rel_p.
- New arg full_native_path. All callers updated. Don't call
- getcwd_inner if unnecessary. Rewrite relative path handling.
- (mount_info::native_path_to_posix_path): Call path_prefix_p.
- Call slashify on `pathbuf', not original argument.
-
- * syscalls.cc (chdir): Fix lifetime of converted path.
-
-Tue Jun 18 11:48:51 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * configure.in (EXE_LDFLAGS): Explicitly link with newlib if necessary.
- * configure: Regenerated.
- * Makefile.in (EXE_LDFLAGS): Define.
- (FLAGS_TO_PASS): Add EXE_LDFLAGS.
- (config.status): New target.
- (utils-all): Depend on $(LIBNAME).
- * utils/Makefile.in (EXE_LDFLAGS): Define.
- (mount,umount,ps,kill): Link with $(EXE_LDFLAGS).
-
- * version.h (CYGWIN_DLL_VERSION_MINOR): Bump up to 1.
-
-Mon Jun 17 18:29:54 1996 Doug Evans <dje@canuck.cygnus.com>
-
- Improve pathname handling, first pass.
- * path.h (symlink): Renamed from link_cookie.
- (class path_conv): New member error.
- (path_conv::get_native): Renamed from get_dos, all uses updated.
- (path_conv::get_binary): Delete.
- (mount_info::{mangle,reverse_mangle}): Delete.
- (mount_item::posix_path_to_native_path): Renamed from mangle.
- (mount_info::native_path_to_posix_path): Renamed from reverse_mangle.
- (path_rules_enum): Define.
- * path.cc: Temporarily disable mixed-case and symlink handling.
- (mount_info::posix_path_p): New function.
- (mount_info::binary_native_path_p): Renamed from binary_dos_path_p.
- (path_conv::path_conv): Handle native path rules.
- (mount_item::{mangle,reverse_mangle}): Delete.
- (mount_info::posix_path_to_native_path): Renamed from mangle.
- (mount_info::native_path_to_posix_path): Renamed from reverse_mangle.
- (mount_info::from_registry): Set nmounts. Use MAX_PATH.
- (mount_info::{add,del}_item): Rewrite.
- (slashify): Renamed from flip_slash.
- (getcwd_inner): Make static. Don't convert to posix path if using
- native path rules.
- (file_exists): Delete.
- (addmntent,hasmntopt): Delete.
- (mount): Only update registry if mount succeeded.
- (umount): Only update registry if umount succeeded.
- (normalize_posix_path): Renamed from normalize_path. Pass in cwd.
- (cygwin32_{posix,native}_path_to_{native,posix}_path_keep_rel): Renamed
- from ...{unix/dos}....
- * dcrt0.cc (dos_argv_to_unix_argv): #ifdef out.
- (dll_crt0_1): Don't call it.
- * fhandler.cc (fhandler_base::open): Temporarily disable symlinks.
- * shared.cc (open_shared_file_map): New function.
- (shared_init): Call it.
- (shared_info::initialize): Fetch `path_rules' from registry.
- * shared.h (inited): Make private.
- (path_rules): New member.
- * spawn.cc: #include "shared.h".
- (spawn_guts, env var translation): Don't translate path names if
- using native path rules.
- * syscalls.cc (symlink): Delete (moved to path.cc).
- * cygwin.din (dump__5pinfo): Delete.
- (cygwin32_{posix,native}_path_to_{native,posix}_path_keep_rel): Renamed
- from ...{unix/dos}....
-
- * smallout.cc: Delete.
- * sdata.cc: Delete.
- * shared.cc (u,s,environ): Define here.
- * Makefile.in (glob/libglob.a): Depend on glob/glob.c, glob/fnmatch.c.
- (utils-all): New target.
- (DLL_OFILES): Delete smallout.o, sdata.o.
- (Makefile): Depend on cygwin.din.
- (WINSUP_H): Depend on syscalls.h.
-
- * configure.in (AC_CONFIG_SUBDIRS): Add bin.
- (AC_PROG_INSTALL): Call.
- * configure: Regenerated.
- * utils/{Makefile.in,configure.in,configure}: New files.
- * utils/{kill.cc,mount.cc,ps.cc,umount.cc,termcap}: New files.
- * Makefile.in (UTILS_ALL): Define.
- (all): Depend on $(UTILS_ALL).
- (utils-all): New target.
-
- * dcrt0.cc (recur): Make no-op to see what happens.
- (globify): Don't call glob if unnecessary.
- Check return code from glob.
- (api_fatal): New function.
- * fhandler.cc (fhandler_base::read): Dump first few chars read.
- (fhandler_base::get_execable): New function.
- (fhandler_base::fstat): Use it.
- (fhandler_base::fhandler_base): Init execable_p.
- (fhandler_disk_file::fhandler_disk_file): Delete execable_p.
- (fhandler::{get,set}_execable_bit): Delete.
- (fhandler_disk_file::{get,set}_execable_bit): Delete.
- * fhandler.h (class fhandler): Delete {get,set}_execable_bit.
- (class fhandler_base): New member execable_p.
- New member fn get_execable.
- * fork.cc: Simplify/cleanup.
- (cygwin_fork_helper1): Use MAX_PATH, not MAXPATHLEN.
- * pinfo.cc (pinfo::dump): Delete.
- * pproc.cc (per_process::set_envname): Delete.
- * strace.cc (smallout::do_pline): Delete.
- * syscalls.h (readlink): Third arg is an int.
- * winsup.h (class pinfo, member progname): Use MAX_PATH.
- (class pinfo, member dump): Delete.
- (class smallout): Delete.
- (smallout): Delete.
- (class per_process, member set_envname): Delete.
- (file_exists): Delete.
- (api_fatal): Declare.
- * Makefile.in (LIB{C,CXX}FLAGS_FOR_TARGET): Delete, use {C,CXX}FLAGS.
- (FLAGS_TO_PASS): Define.
- (glob/libglob.a): Delete duplicate entry.
-
- * syscalls.cc (_sbrk): Update u->size when heap is grown.
-
- * hinfo.cc (hmap_init_per_process): Ensure stdout's handle != stderr's.
-
-Fri Jun 14 06:32:13 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * register.h, registry.cc: Whitespace cleanup.
-
-Thu Jun 13 20:57:28 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * Makefile.in (install): Install cygwin.dll in $(bindir).
-
-Tue Jun 11 13:46:17 1996 Geoffrey Noer <noer@cygnus.com>
-
- * fhandler.cc: lseek is now only binary mode, interpret control
- z characters as EOF when reading from a file. Reformatted some
- of the code (cleaned up line spacing, etc.)
-
-Tue Jun 11 09:50:09 1996 Jason Molenda (crash@kyriath.cygnus.com)
-
- * path.cc (nofinalslash): move it so it is next to its friends
- flip_slash and backslashify.
-
-Mon Jun 10 18:57:03 1996 Jason Molenda (crash@kyriath.cygnus.com)
-
- * path.cc (*): Pretty printing.
- (unix_path_to_dos_path_with_rel): use "dosnamein" and "unixnameout"
- instead of "path" & "real_path".
- (dos_path_to_unix_path_keep_rel): delete obsolete code.
- (mount_item::mangle): use "unixnamein" and "dosnameout" instead of
- "unixname" and "dosname".
- (mount_info::mangle): use "unixnamein" and "dosnameout". Remove
- obsolete code.
- * path.h (mount_item): Update prototypes, add comment.
- (mount_info): Update prototypes.
-
-Mon Jun 10 17:05:23 1996 Jason Molenda (crash@kyriath.cygnus.com)
-
- * path.cc (mount_item::reverse_mangle): Pretty printing,
- add a bit to the comment.
- (getcwd_inner): use MAX_PATH not MAXPATHLEN.
- (normalize_path): use MAX_PATH not MAXPATHLEN.
- (link_cookie::follow): use MAX_PATH not MAXPATHLEN.
-
-Mon Jun 10 15:36:32 1996 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: changed $(DOC) so it doesn't include html
- files; made a new info-html target that does the html
- versions of the docs. Since most customers don't have texi2html
- installed, the make shouldn't fail because of this.
- * configure: regenerated with autoconf 2.8
-
-Sun Jun 9 17:10:37 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * version.c: Deleted.
- * version.h: New file.
- * winsup.h (VERSION): Deleted.
- (class per_process): Add version_major, version_minor. Delete version.
- * registry.cc: #include "version.h".
- (reg_session::reg_session): Update.
- * libccrt0.cc: #include "version.h"
- (cygwin_crt0): Delete setting of version, set magic_biscuit to 0.
- Set version_major, version_minor.
- * dcrt0.cc: #include "version.h".
- (cygwin_dll_version_{major,minor}): New static locals.
- (dll_crt0_1): Rewrite app/dll compatibility test.
- * Makefile.in (LIBCOS): Delete version.o.
- (DLL_OFILES): Delete version.o.
- (dcrt0.o,libccrt0.o,registry.o): Depend on version.h.
-
- * exceptions.h: New file.
- * exceptions.cc: Massive cleanups (still lots more to go).
- #include "exceptions.h".
- (init_exceptions): Renamed from __init_exceptions. New argument of
- pointer to exception handler list entry.
- (init_exception_handler): Renamed from init_thread_exceptions.
- Rewrite based on info from Onno Hovers <onno@stack.urc.tue.nl>.
- (ppc descriptor_to_{function,gotattr}): Make static.
- (i386 __stack_trace): Fix test for top of stack.
- * dcrt0.cc: #include "exceptions.h".
- (dll_crt0_1): Exception handler list entry must live on stack.
- * winsup.h (class pinfo): Delete member myp.
- * syscalls.h (struct exception_list): Delete.
- (__really_exit, __init_exceptions): Delete.
- * Makefile.in (dcrt0.o,exceptions.o): Depend on exceptions.h.
-
-Fri Jun 7 17:49:28 1996 Jason Molenda (crash@phydeaux.cygnus.com)
-
- * dcrt0.cc (conv_path_names): Add GCC_EXEC_PREFIX.
-
-Fri Jun 7 14:38:05 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * Makefile.in (CC_FOR_TARGET,LD,DLLTOOL): Define.
- (AR,RANLIB): Set via configure.
- * configure.in (AR,LD,DLLTOOL): Set.
- (AC_PROG_RANLIB): Call.
- * configure: Regenerated.
-
-Thu Jun 6 12:11:23 1996 Kim Knuttila <krk@cygnus.com>
-
- * dcrt0.cc (dll_crt0_1): Removed reference to reent_data._next.
-
-Tue Jun 4 15:52:29 1996 Geoffrey Noer <noer@cygnus.com>
-
- * include/winkernel.h: fixed typo
-
-Tue May 28 13:08:25 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * syscalls.cc (_sbrk): Fix test of return value from VirtualAlloc.
- Delete lincr, make incr signed, and use only it. Misc. minor cleanup.
-
-Thu May 23 17:31:57 1996 Geoffrey Noer <noer@cygnus.com>
-
- sac diffs applied:
- * path.h: change MAXMOUNTS to 30 instead of 20
- * sysdef/i386/rpcndr.def: add "none" to end of file
- * fhandler.cc: fix memset call to say sizeof (*buf) instead
- of sizeof (buf).
- * include/winuser.h: define MDIS_ALLCHILDSTYLES
- * Makefile.in: entry to build glob/libglob.a:
-
-Thu May 23 10:38:43 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * fhandler.h (class fhandler_base): Make `name' private and shrink
- to 32 bytes.
- (set_name): Declare.
- * fhandler.cc (fhandler::set_name): New function.
- (fhander_base::open): Call it.
- (fhander_base::init): Call it.
- (fhandler_tty::ttyname): Call get_name instead of accessing `name'
- directly.
-
- * dcrt0.cc (dll_crt0_1): Call ExitProcess instead of exit if
- DLL and APP are out of sync.
-
-Thu May 16 03:07:18 1996 Mark Eichin <eichin@cygnus.com>
-
- * fhandler.cc (FakeReadFile): new function. Interface like
- ReadFile, only called from fhandler_console_in::read, calls
- ReadFile unless we're really reading from STD_INPUT_HANDLE and
- with ENABLE_LINE_INPUT turned off, in which case we use
- ReadConsoleInput instead. When using ReadConsoleInput, always read
- all available events, but only block if we don't get at least one
- actual character. This would be the place to implement FIONBIO on
- the console tty, which doesn't actually exist yet.
- (dbg_input_event): copied from select.cc, debugging code to show
- detail of what events we're actually getting.
- (ioctl): off-by-one on window size.
-
-Wed May 15 18:11:16 1996 Jim Wilson <wilson@chestnut.cygnus.com>
-
- * fhandler.h (class fhandler_base): Use MAXPATHLEN not 100 for size
- of array name.
-
-Wed May 15 11:14:46 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * fork.cc (cygwin_fork_helper1): More debugging printf's.
-
- * dcrt0.cc (num_ms_env_vars): Renamed from ms_env_arity.
- (build_argv): Renamed from fill.
- (compute_argc): Renamed from prepare.
- * libccrt0.cc (cygwin_statu): Make static.
- * pproc.cc (per_process::init): Move strace initialization from here,
- * strace.cc (per_process::strace_init): To here.
- Pass FILE_SHARE_WRITE to CreateFileA. Print error message if open
- of log file fails. Create mutex for trace messages.
- (__sys_printf): Always write to end of disk files. Use mutex.
- (d): Delete.
- * winsup.h (class per_process): Add strace_init. Reorganize.
- `run_ctors' renamed to `run_ctors_p'. New member `trace_mutex'.
- (d): Delete.
- (PATH_MAX): Delete.
-
- * Makefile.in: Add header file dependencies.
-
- * dcrt0.cc (_exit): Add debugging printf.
- * shared.h (class shared_info): Rename member mutex_a to fork_mutex.
- * fork.cc (cygwin_fork_helper1): Update.
- Return with error if process slot unavailable.
- Set errno and release fork_mutex if failed because of split heap.
- * shared.cc (shared_info::terminate): Update.
- (shared_info::initialize): Update.
-
-Tue May 14 14:59:32 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * fork.cc (cygwin_fork_helper1): Avoid SIGSEGV if allocate_pid fails.
-
- * pproc.cc (per_process::init): Fix test.
-
- * winsup.h (): Rename member `parent' to `ppid'.
- * fork.cc (prepare_child): Update.
- (cygwin_fork_helper1): Likewise.
- * hinfo.cc (hmap_init_per_process): Likewise.
- (hinfo_vec::dup_for_fork): Fix message.
- (hinfo_vec::dup2): Fix args to debug_printf. Delete extra printf's.
- * pinfo.cc (pinfo_init_per_process): Update.
- (pinfo::dump): Likewise.
- (pinfo::init_self): Likewise.
- * pproc.cc (per_process::init): Open strace file in append mode.
- * smallprintf.c (__small_vsprintf): Support %p.
- * syscalls.cc (getppid): Update.
- * wait.cc (wait_for_any): Likewise.
-
-Mon May 13 13:45:36 1996 Mark Eichin <eichin@cygnus.com>
-
- * fhandler.cc (ioctl): fix TIOCGWINSZ handling: (1) check the
- error return (2) if we're trying on STD_INPUT_HANDLE, substitute
- STD_OUTPUT_HANDLE since GetConsoleScreenBufferInfo only works on
- console output (3) check srWindow for the *screen* size, instead
- of checking dwSize for the scroll buffer size.
-
- * include/sys/errno.h (ECONNABORTED): add another errno value.
- * net.cc (errmap): add ECONNABORTED case.
-
- * fhandler.cc (fstat): clear the *entire* stat buf, not just the
- first four bytes.
-
-Fri May 10 17:59:09 1996 Mark Eichin <eichin@cygnus.com>
-
- * select.cc: change most debugging statements to select_printf.
- (dbg_input_event): new function, prints an INPUT_RECORD via select
- printf.
- (polled): Don't sleep around WaitForMultipleObjects; let it have a
- 10ms timeout until we have time to test it with 0. If
- WaitForMultipleObjects says that STD_INPUT_HANDLE has data, use
- PeekConsoleInput to scan the available events. If the first one is
- not a *bKeyDown* with a non-zero *AsciiChar* then use
- ReadConsoleInput to rip it off the queue, and pretend it wasn't
- there, so that later calls to read (and thus ReadFile) don't block
- because they can't find any *real* input. (This could be optimized
- later to check the whole queue, and if there are *no* real input
- events, nuke them all.)
-
- * include/sys/strace.h (_STRACE_SELECT, select_printf): new printf
- category, because select needs a *lot* of work. STRACE=256 to use it.
-
- * fhandler.cc (fhandler_console_in::init): IGNCR can't work
- without major changes to deal with the interaction with select
- (which shouldn't wake up if IGNCR causes the whole input to be
- deleted...) so don't make it the default.
- (fhandler_console_out::tcgetattr, fhandler_tty::tcgetattr): don't
- set IGNCR based on get_r_binary either.
-
-Wed May 8 20:20:05 1996 Mark Eichin <eichin@cygnus.com>
-
- * times.cc (__to_clock_t): must cast dwLowDateTime to *unsigned*
- before adding it -- otherwise we may subtract it!
- (to_time_t): same.
-
-Wed May 8 18:21:28 1996 Mark Eichin <eichin@cygnus.com>
-
- * times.cc (corelocaltime): new function. Basic localtime from
- newlib, with no conversions.
- (gmtime): just calls corelocaltime.
- (localtime): uses GetTimeZoneInformation, biases to standard time
- first, then uses DaylightDate and StandardDate to figure out if
- we're in DST -- and calls corelocaltime a second time with the
- rebiased seconds, if we are.
- (times): add debug_printf statements which work around apparent
- compiler bug and 7+ minute error.
-
- * select.cc: revert to <sac>'s changes of 4/20 which were
- accidentally backed out on 4/24.
-
-Tue May 7 05:29:42 1996 Mark Eichin <eichin@cygnus.com>
-
- * times.cc (__to_clock_t): subtract out FACTOR, the difference
- between 1601 and 1970, just like to_time_t() does.
-
-Tue May 7 01:55:06 1996 Mark Eichin <eichin@cygnus.com>
-
- * times.cc (gmtime): new function. Use GetTimeZoneInformation to
- compensate ahead before calling localtime (since the newlib
- version doesn't know what timezone we're in.)
- (localtime): use SECSPERMIN, not 60, to show that we know what
- we're talking about.
-
- * net.cc (errmap): add WSAEADDRINUSE, WSAECONNREFUSED mappings.
-
-Sun May 5 00:45:59 1996 Mark Eichin <eichin@cygnus.com>
-
- * include/sys/socket.h: add recvfrom macro and cygwin32_recvfrom
- declaration. Remove htons/htonl misdeclarations as they collide
- with the macros in asm/byteorder.h.
-
- * include/asm/byteorder.h: enable the ntohl/ntohs declarations so
- we at least get the macro versions when we optimize, even if the
- library hooks aren't there.
-
-Wed Apr 24 23:42:49 1996 Steve Chamberlain <sac@dilithium.transmeta.com>
-
- * winsup.h (pinfo, pinfo_list): Remove dummy item.
- * fork.cc (*): Revert changes of Apr 2.
-
-Sun Apr 21 17:00:14 1996 Steve Chamberlain <sac@slash.cygnus.com>
-
- * wait.cc (wait_for_any): Fix the wait heuristic.
-
-Sat Apr 20 13:22:03 1996 Steve Chamberlain <sac@slash.cygnus.com>
-
- * Makefile.in (.cc.o): Pass -fno-rtti.
- * dcrt0.cc (globify): A single match is ok.
- * exceptions.cc (i386 call_handler): optimize.
- * fhandler.cc (fhandler_console_in::read): Handle ICRNL right.
- (*:get_name *:always_ready): New.
- * select.cc: Understand that console output doesn't signal when it's
- ready.
-
-Fri Apr 12 14:49:34 1996 Doug Evans <dje@canuck.cygnus.com>
-
- * Makefile.in (glob/libglob.a): Pass -I so glob.c finds right dirent.h.
-
-Wed Apr 10 16:13:30 1996 steve chamberlain <sac@slash.cygnus.com>
-
- * Makefile.in (glob/libglob.a): Call glob makefile correctly.
- * winsup.h (pinfo, pinfo_list): Reorder elements to avoid
- alignment bug in PPC gcc.
-
-Tue Apr 9 17:23:57 1996 steve chamberlain <sac@slash.cygnus.com>
-
- * dcrt0.cc (globify): Expand command line wildcards if
- run from dos prompt.
-
- * exceptions.cc (386 call_handler): More fumblings.
- * fhandler.cc (fhandler_base::stat): Initialize ino.
- (fhandler_console::open): Fix test for RDONLY.
- (fhandler_tty::stat): Set ino.
- (fhandler_console_out::vt100 stuff): More.
- * fork.cc: Lint.
- * pinfo.cc (pinfo::init_self): Don't bother to DuplicateHandles
- to get process info.
- * signal.cc (usleep): Get correct order of magnitude.
- * spawn.cc (spawn_guts): Turn of exception handling in
- parent of thing which execs.
- * syscalls.cc (stat): Look for <file> and <file.exe>.
- * wait.cc (wait_for_any): Keep waiting if WaitForMultipleObject
- returns invalid result.
-
-Tue Apr 2 12:45:35 1996 steve chamberlain <sac@slash.cygnus.com>
-
- * dcrt0.cc (conv_path_names): Add HOME.
- (dll_crt0_1): Use u->self->head_sp.
- * exceptions.cc (i386 call_handler): Rewritten, now almost works
- on win95.
- * fhandler.cc (fhandler_base::open): Calculate namehash.
- (fhandler_base::fstat): ^ name hash with file index low.
- * fork.cc (*): forkee/forkerr events moved from sinfo
- into pinfo.
-
-Fri Mar 29 16:35:02 1996 steve chamberlain <sac@slash.cygnus.com>
-
- * libcmain.cc: New.
- * winsup.h: restore and myp moved from per_process to pinfo class.
- * dcrt0.cc (dll_crt0_1): Cope with move.
- * exceptions.cc (init_thread_exceptions): Ditto.
- * signal.cc (sigprocmask): Ditto.
- * fork.cc (cygwin_fork_helper1): Don't fork if split_heap_p.
- * pinfo.cc (pinfo::clearout): Zero split_heap_p.
- * syscalls.cc (_sbrk): Cope with not being able to
- allocate contiguous chunks.
-
-
-Tue Mar 26 09:14:32 1996 steve chamberlain <sac@slash.cygnus.com>
-
- * exceptions.cc (__cygwin_exception_handler): re-export.
-
-Fri Mar 22 16:49:29 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * cygwin.din (__stack_trace): Export.
- (__cygwin_exception_handler): Ditto.
-
- * exceptions.cc (i386 exception handling): Move under appropriate
- x86 #ifdefs. Use the macro HAVE_INIT_THREAD_EXCEPTIONS to be
- whatever a machine needs to do to initialize exceptions in this
- thread. Nop for the PowerPC right now.
- (__stack_trace): Make it a "C" function so there is no name
- mangling, and export it.
- (call_handler): Split by architecture before the function, rather
- than inside it. First stab at PowerPC exception handling.
- (__cygwin_exception_handler): Rename from ehandler3, and export
- it. Add more status -> signal mappings.
- (ctrl_c_handler, CTRL_LOGOFF_EVENT): Map to SIGHUP, not SIGQUIT.
- (__stack_trace): Split into separate machine dependent functions,
- rather than #ifdef'ing inside of a common function. Make the
- PowerPC messages clearer.
-
-Mon Mar 18 13:27:05 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * include/winkernel.h (CreateThread): Correctly declare function
- pointer argument.
-
- * misc.c (wprintf): Convert to use vprintf and fix warnings.
- (tgetent): Declare to return int to fix warnings.
- (vhangup): Declare to return int to fix warnings. Return -1 also.
-
- * include/winbase.h (UnhandledExceptionFilter): Declare.
-
-Tue Mar 12 12:56:28 1996 Doug Evans <dje@charmed.cygnus.com>
-
- * include/winkernel.h (FlushFileBuffers): Declare.
-
-Tue Mar 12 11:16:32 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * exceptions.cc (dump_status): Make columns line up for PowerPC.
- (call_handler): Right now, call exit(255) for the PowerPC.
-
- * strace.cc (__sys_printf): Call FlushFileBuffers after writing
- out the file to make sure it really gets flushed.
-
- * include/winkernel.h (PowerPC CONTEXT): Add fields returned if
- CONTEXT_DEBUG_REGISTERS is set.
-
-Sun Mar 10 15:31:17 1996 Steve Chamberlain <sac@slash.cygnus.com>
-
- * strerror.cc, syslog.cc, net.cc: New files.
- * cygwin.din: Add new net functions.
- * dcrt0.cc (dll_crt0_1): Fix call to build argv[0].
- * fhandler.cc (fhandler_base::open): Tidy.
- * fhandler.h: Add net classes.
- * hinfo.cc (hinfo_vec::build_fhandler): Add tape stuff.
- * path.cc (*::mangle, *::reverse_mangle): Fix.
- (mount_info::init): No trailing / now.
- * select.cc (*): Rewrite.
- * spawn.cc (spawn_guts): Fix leak.
- * syscalls.cc (_sbrk): Keep working until memory really fills up.
-
-Tue Feb 20 16:53:24 1996 Steve Chamberlain <sac@slash.cygnus.com>
-
- * dcrt0.cc (dll_crt0_1): Get version from the header.
- * fhandler.cc (CHUNK_SIZE): New.
- (fhandler_base::read, fhandler_base::write): CRLF conversion
- rewritten.
- path.cc (path_conv::path_conv): Initialize mixed, binary and silent.
- * smallprint.c (__small_vsprintf): Add 'c' option.
- * wait.cc (wait_found): Close child handles.
-
-Mon Feb 19 09:11:57 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * Makefile.in (real-headers): Eliminate real-headers dependency on
- mspatches/*.patch, since you can't be guaranteed that it exists.
-
-Fri Feb 16 14:24:47 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * exceptions.cc (dump_status): On the PowerPC, dump all of the
- integer registers.
-
- * uname.c (uname): Don't assume that the only two NT systems are
- i386 and PowerPC.
- * exceptions.cc (call_handler): Ditto.
- (dump_status): Ditto.
-
-Thu Feb 15 18:20:33 1996 Steve Chamberlain <sac@slash.cygnus.com>
-
- * cygwin.din (__empty): Add.
- * dcrt0.cc (dos_argv_to_unix_argv): New.
- (check, onetimecheck): New.
- * exceptions.cc (ehandler3): Always show backtrace
- if exception failed.
- * fhandler.cc (*::open): Removed dos_path argument.
- (fhandler_base::fstat): Use nFileIndexLow as the inode
- value.
- * hinfo.cc (init_std_file_from_handle): Don't default
- to binary.
- * paths.cc (*): Use new registry classes.
- * registry.cc (*): Rewritten.
- * syscalls.cc (open): Call fhandler->open without
- the dos filename arg.
-
-Sat Feb 10 08:18:45 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * configure.in (ALLOCA for powerpc): Add __allocate_stack.
-
-Wed Feb 7 16:41:18 1996 Steve Chamberlain <sac@slash.cygnus.com>
-
- Release-B13
-
- * malloc.cc (export_*): New. Changed the way that malloc
- stubs are used.
- * cygwin.din: Export the export_* stuff as malloc, realloc and free.
- * path.cc (link_cookie::create): Keep cookie filenames in unix
- format.
- (reverse_mangle): Clean up.
- (readlink): Ditto.
- (qfunc): Sort by name too.
- * spawn.cc (spawn_guts): Handle zero length arg.
- Only set errno when it's not 0.
- * Makefile.in: Build new doc.
- * fhandler.cc (fhandler_base::fstat): Round up block used.
- * path.cc (escape_char): Now it's ^.
- * syscalls.cc (errmap): ERROR_INVALID_NAME yields ENOENT.
- (chown): Returns 0.
- (sbrk): Clean up.
- (_unlink): Only try and DeleteFile once.
-
-Mon Feb 5 19:15:44 1996 Steve Chamberlain <sac@slash.cygnus.com>
-
- * dcrt0.cc (dll_crt0_1): Build env string into static buffer.
- * dirsearch.c (opendir): Stat on unix pathname.
- * paths.cc (*): Support for mixed case filenames.
-
-Sun Feb 4 15:55:58 1996 Steve Chamberlain <sac@slash.cygnus.com>
-
- * *.cc: Lint.
- (conv_path_names): New.
- (dll_crt0_1): Use conv_path_names list.
- * fctnl.cc (F_DUPFD): Look from the fd forward.
- * fhandler.cc (fhandler_base::open): Understand binary modes.
- (fhandler_console_in::init): Call tcsetattr with reasonable start
- values.
- * spawn.cc (spawn_guts): Use conv_path_names.
- (queue_file_deletion): Deleted.
- (unlink): Use new queue file stuff.
- * delqueue.cc, delqueue.h: New files.
- * shared.h: New file.
-
-Wed Jan 31 11:12:24 1996 Steve Chamberlain <sac@slash.cygnus.com>
-
- * crt0.cc: Hacks to probe out ppc stack.
- * exceptions.cc (ehander3): Don't use 386 context info on the ppc.
- * path.cc (mount_info::mangle): Turn /usi or /usp into /usr.
- * uname.c (uname): Change sysname and get ppc name right.
-
-Fri Jan 26 15:47:31 1996 Steve Chamberlain <sac@slash.cygnus.com>
-
- * pproc.cc (per_process::init): Cope when no memory is needed.
- * Makefile.in, configure.in: Cope with config directory.
- * setjmp.c, longjmp.c: Moved into config/i386.
- * config/ppc/setjmp.S, config/ppc/longjmp.S: New.
-
-Fri Jan 26 14:57:33 1996 Jason Molenda (crash@phydeaux.cygnus.com)
-
- * Makefile.in (DLL_OFILES): removed ppc-stub.o
- ppc-stub.c: Removed.
- configure: regenerated with autoconf 2.7.
-
-Fri Jan 26 11:18:07 1996 Kim Knuttila <krk@cygnus.com>
-
- * Makefile.in (DLL_OFILES): added ppc-stub.o
-
-Thu Jan 25 09:33:24 1996 Steve Chamberlain <sac@slash.cygnus.com>
-
- * malloc.cc (malloc, free, realloc): Hack for ppc.
-
-Wed Jan 24 20:22:42 1996 Steve Chamberlain <sac@slash.cygnus.com>
-
- * cygwin.dll (loadup_dll): Remove.
- * dcrt0.cc: lint.
- * fhandler.* (*): Move to new class structure.
- * hinfo.cc: Use new fhandler glue.
- * libcfork.cc: Cope with ppc naming convention.
-
-Mon Jan 22 10:33:53 1996 Steve Chamberlain <sac@slash.cygnus.com>
-
- * fhandler.h, hinfo.h: New files.
- * winsup.h: Split from here.
- * configure.in: Set i386 entry point correctly.
- * fhandler.cc (fhandler_normal:open): .com files
- are executable too.
- * hinfo.cc (init_std_file_from_handle): Inspect
- master_fmode_binary.
- * misc.cc (wcscmp, wcslen): New.
- * dcrt0.cc (probe): Change way a forkee's stack is allocated.
- * pproc.cc (per_process::init): Initialize using heap chunk.
- * shared.cc (shared_info::initialize): Initialize heap chunk.
- * syscalls.cc (_sbrk): If current chunk is used, allocate another.
- * wait.cc (wait_found): Fix exit code.
-
-Thu Jan 18 10:09:45 1996 Steve Chamberlain <sac@slash.cygnus.com>
-
- * fhandler.cc (fhandler_normal::open) Don't test a
- com port to see if it's executable.
- * configure.in, cygwin.din: More powerpc configury.
-
-Wed Jan 17 16:25:36 1996 Steve Chamberlain <sac@slash.cygnus.com>
-
- * configure.in, Makefile.in: Build powerpc stuff.
- * hinfo.cc (build_fhandler): Use new with placement.
- (fhandler::operator new): New.
-
-Wed Jan 3 18:18:57 1996 steve chamberlain <sac@slash.cygnus.com>
-
- * select.cc: New file.
- * Makefile.in: Cope with it.
-
-Tue Jan 2 08:58:58 1996 steve chamberlain <sac@slash.cygnus.com>
-
- * version.c: New file.
- * Makefile.in: Cope with it.
- * cygwin.def (setgrent, cuserid, setpgrp, mount, setmntent, endmntent, umount): New.
- * dcrt0.cc: Remove obsolete vfork stuff.
- (dll_crt0): Change way environ is built. Check that app is built
- with correct version of dll.
- * dirsearch.cc, exceptions.cc: Lint.
- * fhandler.cc: Lint. Most of termios.c moved into here.
- (fhandler_console:*): New.
- * hinfo.cc (hinfo_vec::init_std_file_from_handle): Open stdfiles as consoles
- if possible.
- * libccrt0.cc: Lint.
- * malloc.cc: More comments.
- * path.cc (*): Cope with mount handling.
- * registry.cc: Lint.
- (reg_session): New.
- * shared.cc: Lint.
- * signal.cc (usleep): New.
- * spawn.cc: Lint. Removed vfork stuff.
- * stubs.c (getmntent, endgrent): Deleted.
- * syscalls.c (__seterrno): Now takes arguments.
- * termios.c: Much moved info fhandler.c
- * times.cc (utime, utimes): New.
- * uinfo.c (cuserid): New.
diff --git a/winsup/cygwin/ChangeLog-1997 b/winsup/cygwin/ChangeLog-1997
deleted file mode 100644
index 7a5c0b3a4..000000000
--- a/winsup/cygwin/ChangeLog-1997
+++ /dev/null
@@ -1,2800 +0,0 @@
-Wed Dec 31 15:00:32 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * hinfo.cc (hinfo_vec::find_unused_handle): correct
- previous patch -- need to fix up vec[i].h pointers
-
-Wed Dec 31 14:13:22 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * regexp/Makefile.in (tooldir): New variable.
- (install): Install regexp.h.
-
-Tue Dec 30 19:52:46 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * net.cc (inet_netof): New function.
- (inet_makeaddr): New function.
- * cygwin.din: Export inet_netof and inet_makeaddr.
-
-Tue Dec 23 17:45:07 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * path.cc (current_directory_name): New static variable.
- (current_directory_posix_name): New static variable.
- (getcwd_inner): Cache the directory name.
- (chdir): Move here from syscalls.cc. Clear directory cache
- variables.
- * syscalls.cc (chdir): Remove; now in path.cc.
-
- * environ.cc (setenv): Add cast to avoid warning.
-
- * security.cc (get_file_attribute): Make file parameter a pointer
- to const char.
- (set_file_attribute): Likewise.
- * winsup.c (get_file_attribute): Update declaration.
- (set_file_attribute): Likewise.
-
- * path.cc (path_conv): Don't pass the root directory to
- symlink_check_one.
-
-Mon Dec 22 16:34:40 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * path.cc (realpath): Use path_conv to resolve symlinks.
-
- * path.cc (path_conv::path_conv): Rewrite completely to convert to
- win32 path first and then check for symlinks element by element.
- (symlink_check_one): New static function based on old
- symlink_check_worker, but without path conversion.
- (path_prefix_p): Move definition before all uses.
- (skip_n_slashes, symlink_expand, symlink_follow): Remove.
- (symlink_check_worker, symlink_check): Remove.
- (readlink): Rewrite to use new symlink_check_one.
- (unmixedcaseify, mixedcaseify): Comment out.
- * path.h (symlink_check, symlink_follow): Don't declare.
- * fhandler.cc (open): Don't pass O_NOSYMLINK to path_conv. Set
- errno from path_conv if it fails.
- * dirsearch.cc (opendir): Check errors from path_conv, and set
- errno appropriately.
- * times.cc (utimes): Likewise.
- * syscalls.cc (_unlink, _link, mkdir, rmdir, chdir): Likewise.
- (chmod, _rename): Likewise.
- (_stat_worker): Don't just pass nofollow to _open, but base
- whether to pass O_NOSYMLINK on whether nofollow is set.
- (lstat): Pass 1, not O_NOSYMLINK, to _stat_worker.
- * strerror.cc (strerror): Add ELOOP.
-
-Thu Dec 18 12:30:47 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * fhandler.h (class fhandler_base): Remove inline definitions of
- tcflush, tcsendbreak, tcdrain, tcflow, tcsetattr, tcgetattr,
- tcsetpgrp, and tcgetpgrp, so that we can set proper errno values.
- (class fhandler_tty): Add pgrp_ field, and virtual tcgetpgrp and
- tcsetpgrp functions.
- * fhandler.cc (fhandler_base::tcflush): New function.
- (fhandler_base::tcsendbreak): New function.
- (fhandler_base::tcdrain): New function.
- (fhandler_base::tcflow): New function.
- (fhandler_base::tcsetattr): New function.
- (fhandler_base::tcgetattr): New function.
- (fhandler_base::tcsetpgrp): New function.
- (fhandler_base::tcgetpgrp): New function.
- (fhandler_tty::fhandler_tty): Initialize pgrp_.
-
- * tty.cc (tcsetpgrp): Set errno correctly on failure.
-
- * include/sys/termios.h (CBAUD): Change to 037.
- (B57600, B115200): Change to values that can fit in a speed_t.
-
- * spawn.cc (spawn_guts): Set errno correctly if we can't find the
- executable.
-
-Mon Dec 15 16:40:07 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from msnyder@cygnus.com (Michael Snyder):
- * heap.cc (_sbrk): handle situation where newalloc < incr
-
-Mon Dec 15 16:40:07 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- Allow Cygwin32 to terminate process even when in a blocking
- winsock call.
- * exceptions.cc (call_handler): call to WSACancelBlockingCall()
- removed.
- (sighandle): call WSACleanup() before exiting the process to
- cancel blocking winsock calls.
- * include/mywinsock.h: add proto for WSACleanup().
-
-Mon Dec 15 16:40:07 1997 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: compile .cc files with -fno-exceptions to
- decrease dll size and increase execution speed a little.
-
-Mon Dec 15 16:40:07 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * tty.cc (do_input): Detect CTRL-T as a special case when
- STRACE_CACHE is active. Dumps the strace cache to disk.
- * console.cc (fhandler_console::read): Detect CTRL-T as a special
- case when STRACE_CACHE is active. Dumps the strace cache to disk.
-
-Sat Dec 13 15:12:53 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * fork.cc: Include <malloc.h>.
- (cygwin_fork_helper1): Call __malloc_copy after copying the stack
- and heap to the child.
-
-Thu Dec 11 15:14:40 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * sigproc.cc (proc_subproc): Remove over-enthusiastic test for
- process handling readiness or proc_wait will loop attempting to
- handle a dying subprocess when signal handlers are not ready.
- * fork.cc (cygwin_fork_helper1): Reorganize to ensure that a
- forked process is capable of receiving signals when fork()
- returns.
-
-Wed Dec 10 15:43:37 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * include/sys/termios.h (IXANY): Correct value.
- (PARMRK): Define again.
-
-Wed Dec 10 00:05:23 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * dcrt0.cc (dll_crt0_1): Move start time initialization to a more
- logical place (pinfo_init).
- (do_exit): Reorganize to attempt to solve races when a cygwin
- process occupies two windows pids (i.e., an execed process).
- * exceptions.cc (lock_cs): Fix erroneous WFSO logic.
- (sighandle): Use new method for determining if process was
- initiated via fork.
- (events_terminate): Do not close pinfo_mutex. Allow automatic
- close by ExitProcess to lengthen the time that the pinfo structure
- is locked, minimizing races between an exiting child and a
- potentially exiting parent.
- * hinfo.cc (hmap_init): Use new method for determining if process
- was initiated via fork.
- (hinfo_vec::de_linearize_fd_array): Fix a typo in a comment.
- * pinfo.cc (clearout): Remove this function. Handled in
- allocate_pid.
- (pinfo_init): Move start_time setting here from dll_crt0_1.
- Remove call to init_self in favor of adding three additional lines
- of code.
- (pinfo_list::operator []): Implement a very simple hashing
- scheme for pid lookup.
- (lpfu): New routine controlled by DEBUGGING conditional. When
- DEBUGGING is activated, lpfu returns more information about the
- state of a timed out pinfo_mutex.
- (pinfo_list::get_empty_pinfo): Remove function. Move
- functionality to allocate_pid.
- (allocate_pid): Implement a (very) simple hashing scheme for
- finding an available pid. Take advantage of reorganized pinfo
- structure to zero all pertinent fields with one memset.
- (pinfo::record_death_nolock): Don't bothering zeroing
- inconsequential stuff.
- (pinfo::record_death): Leave pinfo_mutex locked with the
- understanding that this function will be called just prior to
- exiting the process. This minimizes a race between a child which
- is exiting at nearly the same time as its parent.
- * sigproc.cc: Reformat function calls.
- (sigproc_init): Clear new PID_INITIALIZING flag to indicate that
- a (possibly execed) process is now capable of receiving signals.
- (sig_send): Be more defensive in determining if a signal can be
- sent to myself or suffer problems with execed processes.
- (sigproc_terminate): Wait for sig_proc to exit to ensure that
- all pending signals have been handled. Use new 'proc_terminate'
- function to terminate the subprocess handling thread.
- (allow_sig_dispatch): Don't bother blocking signals if signal
- handling isn't active in this process yet.
- (block_sig_dispatch): Don't bother blocking signals if signal
- handling isn't active in this process yet.
- (sig_proc): Use sig_loop_wait variable to control wait time for
- signal semaphores. Uncouples this wait from wait_subproc.
- Perform signal cleanup here on thread termination.
- (proc_exists): More accurate tests to determine if a process
- really exists.
- (proc_register): Remove this function in favor of a macro.
- (proc_subproc): More stringent test for being "ready" to process
- subprocesses. Add more common initialization to PROC_ADDCHILD.
- Remove PROC_EXIT in favor of a separate function.
- (proc_terminate): New function. Replaces PROC_EXIT functionality
- in proc_subproc. Terminates subproc handler thread.
- (stopped_or_terminated): use lock_pinfo_for_update when modifying
- child stopsig status or suffer a race.
- (wait_subproc): Save sig_proc thread handle away for
- synchronization when exiting. Set up 'i_am_alive' mutex inherited
- by childen. Child's inability to lock this mutex means that the
- parent is still alive and processing children. Use proc_loop_wait
- to control WFMO. Clean up events queue on thread exit.
- (zap_subproc): Clear out pinfo structure for a child.
- * sigproc.h: Remove PROC_EXIT constant. Remove obsolete
- proc_register declaration.
- (alive_parent): New macro to determine if a parent is still alive.
- * spawn.cc (spawn_guts): Fix a comment typo. Use proc_terminate
- to terminate all subprocess handling prior to an exec. Use new
- method for determining if this process was started via a fork.
- Attempt to clean up races between execed process, its parent, and
- the execed child.
- * winsup.h (pinfo): Add a new handle indicating that a parent is
- alive. This should be a foolproof way of determining if a parent
- has gone away so that a child will know whether to remove itself
- from the pinfo table.
- Reorganize the structure in such a way that items to be zeroed
- are grouped together at the beginning for more efficient zeroing
- in allocate_pid.
- Add a new PID_* constant.
- New lock_pinfo_for_update macro for use when debugging cygwin.
-
-Wed Dec 10 00:05:23 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- Change the way to inherit fd table on spawn/exec calls.
- Use STARTUPINFO structure to pass an fd table to a child process
- instead of shared memory area. This is undocumented, but is used
- by MSVC runtime. The desktop inheritance code added again,
- otherwise user32.dll will fail to initialize after sexec calls.
- * pinfo.cc (pinfo_init): delinearize fd array from STARTUPINFO
- structure instead of call to copy_shared_fd_table.
- * shared.cc (create_shared_fd_mapping_name): remove
- (create/copy_shared_fd_table): remove
- * spawn.cc (spawn_guts): use lp(cb)Reserved2 fields of STARTUPINFO
- to pass fd table to a child. Remove call to
- create_shared_fd_table. Inherit window station/desktop on sexec
- calls.
- * winsup.h: remove prototypes for create/copy_shared_fd_table.
-
-Fri Dec 5 18:57:42 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * kill.cc (main): Report error if kill() fails. Minor reformat.
- * ps.cc (main): Only use month/day in start time when starting
- time is > 24 hours in the past, not when it occurs yesterday.
-
-Fri Dec 5 15:54:41 1997 Geoffrey Noer <noer@cygnus.com>
-
- * fcntl.cc (_fcntl): reformat
- * fhandler.cc (fhandler_tty::open): new, need special open for
- ttys. In addition to calling fhandler_base::open, check
- flags to handle blocking vs. non-blocking I/O. Should
- initialize tty to standard state (9600 bits/sec - 8 - 1 with
- no flow control) but this code needs more work still. Ifdef
- out for now.
- (fhandler_tty::tcsendbreak): new
- (fhandler_tty::tcdrain): new
- (fhandler_tty::tcflow): new
- (fhandler_tty::tcsetattr): add support for action arg. Use
- a DCB struct to hold the values we will set. First call
- GetCommState to get the current state, then reassign values
- based on the contents of the termios struct. Handle the
- case where t->c_ospeed is set to B0, otherwise set state.BaudRate.
- Set all the other DCB struct values appropriately, based on
- the contents of the termios struct.
- (fhandler_tty::tcgetattr): do the inverse of tcsetattr.
- Call GetCommState to get the current state and use this to set
- the appropriate termios struct values.
- * termios.cc: reformat
- (tcsendbreak): implement -- add duration arg,
- call fhandler tcsendbreak as appropriate
- (tcdrain): implement -- call fhandler tcdrain as appropriate
- (tcflow): implement -- call fhandler tcflow as appropriate
- * fhandler.h: add new tc* protos
- * include/sys/termios.h: correct values of iflag bits,
- define CRTSXOFF and CRTSCTS, CBAUD, B57600 and B115200.
- Add protos for tc* functions.
-
-Wed Nov 26 17:06:17 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * spawn.cc (perhaps_suffix): resolve symlinks to .exes.
-
-Mon Nov 24 17:10:49 1997 Geoffrey Noer <noer@cygnus.com>
-
- * cygwin.din: remove crypt
- * syscalls.cc (crypt): remove crypt stub
-
-Sun Nov 23 17:34:42 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * spawn.cc (spawn_guts): save the path of the script itself,
- use the saved path while building the command line to execute.
-
-Thu Nov 20 22:58:23 1997 Geoffrey Noer <noer@cygnus.com>
-
- * stubs.cc: delete file, move unimplemented stubs to the
- files in which they would normally belong.
- * grp.cc (setgrent): implement (was in stubs.cc)
- * syscalls.cc: move regfree, mknod, setgid, set(e)uid, sync,
- crypt, and PPC __chkstk/_alloca/dll_entry stubs here from stubs.cc
- (sync): just return zero for now instead of -1
- (crypt): return -1 instead of 0
-
-Thu Nov 20 22:41:57 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * spawn.cc (spawn_guts): A premature close of the spawned filehandle
- was possible when reparenting an exited process. Fix this.
- * dcrt0.cc (do_exit): Only do minimal cleanup if "pid focus"
- has moved to another windows process or the other process will
- become confused.
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * sigproc.cc (getsem): set errno to EPERM if existing semaphore
- cannot be opened.
- (wait_subproc): allow access to signal semaphores to process's
- owner only except for SIGCHLD (needed for SIGCHLD delivery after
- sexecXX calls).
-
-Thu Nov 20 00:52:58 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * syscalls.cc (hash_path_name): Ignore trailing backslash when
- calculating pathname hash.
- * hinfo.cc (hinfo_vec::de_linearize_fd_array): Set use_tty
- if /dev/ttyn is detected in the shared_fd_table. Before this
- change, executing "set CYGWIN_TTY=1", "bash", "unset CYGWIN_TTY",
- "/bin/pwd" would result in pwd printing nothing because
- the de_linearize code would use the wrong fhandler_xxx when
- reading from the buffer inherited from the parent process.
- * cygwin.din: Add new ctermid function for export.
- * syscalls.cc (ctermid): New function
- * exceptions.cc (call_handler): If called during a P_OVERLAY
- spawn, merely set appropriate flags and return. The spawn
- code will then clean up and exit.
- * sigproc.cc (proc_exists): Reorganize to better detect defunct
- processes. Don't clean up pinfo if process has a parent since the
- parent should clean up eventually.
- * spawn.cc: New global exec_exit. Set by signal handler to
- value which should be used on exit from aborted spawn.
- (spawn_guts): Try harder to let the child terminate (if it is
- going to) before exiting on a signal. Remove obsolete code.
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * exec.cc (file_exists): Removed
- * spawn.cc (spawn_guts): call perhaps_suffix to convert filename
- to win32 form and to check file existance; prog variable
- removed, all references changed to real_path variable.
- Do not inherit parent's window station/desktop on sexecXX calls.
- They are no longer needed with the new signal handling.
- (_spawnve): extra file existance check removed
- * winsup.h: file_exists prototype removed
-
-Wed Nov 19 16:23:47 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * cygwin.din: add missing exports for random -- initstate
- and setstate (accessed by gawk among others?)
-
-Tue Nov 18 22:27:10 1997 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: Add spaces after colons in rules for make
-
-Mon Nov 17 22:35:25 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from proven@cygnus.com (Chris Provenzano):
- * Makefile.in: set SHELL = @SHELL@, set VPATH to only @srcdir@.
- Remove mingw from directories to build for now, adapt rules
- for building sysdef files without fancy VPATH
- * configure: regenerate
- * config/i386/makefrag: add rules to build setjmp/longjmp
- * regexp/Makefile.in: set SHELL = @SHELL@
- * regexp/configure: regenerate
- * utils/Makefile.in: set SHELL = @SHELL@
- * utils/configure: regenerate
-
-Mon Nov 17 18:36:50 1997 Geoffrey Noer <noer@rtl.cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * fhandler.cc (fhandler_disk_file::open): calls to symlink_XXX
- replaced with path_conv class calls.
- * path.cc (path_conv::path_conv): comments added, O_NOSYMLINK case
- added.
- * path.h (class path_conv): symlink_p, exec_p - new class members.
- * spawn.cc (spawn_guts): call path_conv instead of symlink_follow.
-
-Sun Nov 16 15:54:27 1997 Geoffrey Noer <noer@rtl.cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * dcrt0.cc (do_exit): Use new pinfo element in debug statement.
- * pinfo.cc (pinfo_init): Eliminate use of "PID" environment
- variable in favor of scanning the process table for a
- SpawnedProcessId field matching current windows process id.
- Should speed up spawned process startup slightly. Delay setting
- of dwProcessId until process is capable of processing signals
- since this field is used to build signal semaphores.
- * signal.cc (kill_worker): Perform a `proc_exists' on the pid
- in question if signal == 0. This will verify that the process
- actually exists and was not abnormally terminated.
- * sigproc.cc (sigproc_init): Initialize dwProcessId field after
- signal processing has been initialized.
- (sigproc_terminate): Remove events[0] close.
- (getsem): Use GetCurrentProcessId to find the windows pid since
- this dwProcessId field is not yet set up. Use proc_exists to
- determine if error should be printed on OpenSemaphore error.
- (proc_exists): New function. Makes more exhaustive test of
- process existence. Determines if process died without going
- through normal shutdown.
- (wait_subproc): Close wakeup event only on thread exit.
- * spawn.cc: Remove pExeced. Use new field in pinfo.
- (spawn_guts): Initialize dwSpawnedProcessId field.
- * utils/ps.cc (main): Perform a kill(pid, 0) on any pids that
- appear to be active. This will clear out pids that have died
- abnormally. 'ps -f' bypasses this.
- * winsup.h (class pinfo): Add dwSpawnedProcessId field.
-
-Sun Nov 16 15:54:27 1997 Geoffrey Noer <noer@rtl.cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * pinfo.cc ((pinfo_init): use dwProcessId for execed/spawned
- check, set subproc_ready event only if the process is exec'ed.
- * spawn.cc (spawn_guts): initialize hProcess and dwProcessId
- fields of pinfo on exec, keep progname field on spawn.
-
-Sun Nov 16 15:54:27 1997 Geoffrey Noer <noer@rtl.cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * dcrt0.cc: remove commented out code
- * spawn.cc: fix misapplied patch problem
-
-Sun Nov 16 15:54:27 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * fhandler.cc (fhandler_dev_null::open): Open Windows 'nul'
- device rather than "faking" a real open.
- (fhandler_dev_null::close): delete.
- (fhandler_dev_null::fstat): delete.
- (fhandler_dev_null::ioctl): delete.
- (fhandler_dev_null::read): delete.
- (fhandler_dev_null::write): delete.
- (fhandler_dev_null::lseek): delete.
- (fhandler_dev_null::dup): delete.
- * fhandler.h (class fhandler_base): delete above methods from
- class.
- * hinfo.cc (hinfo_vec::build_fhandler): Use new fhandler_dev_null
- class which opens 'nul' device. Treat /dev/null similarly to
- other Windows devices. This allows redirection of /dev/null to
- non-cygwin processes.
-
-Sun Nov 16 15:54:27 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * dcrt0.cc (do_exit): Use EXIT_* flags to determine how exit
- should proceed. Honor new EXIT_NOCLOSEALL to avoid
- close_all_files.
- * exceptions.cc (__cygwin32_exception_handler): Use new
- EXIT_SIGNAL define to indicate exiting due to signal.
- * signal.cc (sigprocmask): Slightly more defensive check against
- being called prior to complete cygwin setup.
- (_raise): Defensive check to guard against being called prior to
- complete cygwin setup.
- * sigproc.cc (stopped_or_terminated): Use new EXIT_SIGNAL define
- to detect exiting due to signal.
- * sigproc.h: Define flags to be used during exit process as
- EXIT_*.
- * spawn.cc (spawn_guts): Use EXIT_* constants to control how
- do_exit proceeds after _P_OVERLAY.
-
-Sun Nov 16 15:54:27 1997 Geoffrey Noer <noer@cygnus.com>
-
- * sysconf.cc (sysconf): return 1048576 for ARG_MAX until
- we figure out the right value (_POSIX_ARG_MAX is only 4K
- which is too small).
-
-Sun Nov 16 15:54:27 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * dcrt0.cc (dll_crt0_1): call winsock_init if neccesary.
- * fhandler.cc ((fhandler_socket::fhandler_socket): moved to net.cc
- * fhandler.h (class fhandler_socket): destructor prototype added.
- * fork.cc (cygwin_fork_helper1): set PID_SOCKETS_USED in the
- child's pinfo if parent has open socket descriptors; call
- winsock_init in child code if necessary.
- * net.cc: static variable winsock_init_p removed;
- number_of_sockets is new global variable containing number of
- opened sockets.
- (winsock_init): made global, save "winsock inited" flag in process
- state field.
- (cygwin32_winsock calls): condition for winsock initialisation
- changed
- (fhandler_socket::fhandler_socket): new, moved from fhandler.cc;
- increment number_of_sockets on constructor call.
- (fhandler_socket::~fhandler_socket): new. Decrement
- number_of_sockets on destructor call, check for negative value.
- (fhandler_socket::ioctl): check for winsock initialisation added.
- * spawn.cc (spawn_guts): handle PID_SOCKETS_USED in child's pinfo.
- * winsup.h: PID_SOCKETS_USED - new enum value; number_of_sockets
- and winsock_init() prototypes added.
-
-Wed Nov 12 23:02:34 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * exceptions.cc: Substitute do_exit for _exit as appropriate.
- do_exit allows full 32 bits of exit value. The upper 16 bits
- are used for special cygwin operations.
- * winsup.h: Change definition of do_exit to allow calling from
- signal handler.
- * dcrt0.cc (do_exit): Change to allow calling from signal handler
- in place of _exit. This is necessary to ensure that only cygwin
- internal applications can exit with the upper order 16 bits set
- to non-zero.
-
-Wed Nov 12 23:02:34 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * dcrt0.cc (do_exit): New function. Subsumes functionality of
- _exit but takes a DWORD argument. Changed to avoid some shutdown
- activities when called with REPARENTING bit set in argument. Also
- explicitly kills any executing non-cygwin subprocess from a
- spawn(P_OVERLAY)...
- (_exit): Use do_exit for exiting. Ensure that only low order 1
- bits of status are used or confusion will result if exiting with
- some higher order bits set.
- * exceptions.cc (set_process_mask): Reflect new method for
- sig_send to send signals to self.
- (handle_sigsuspend): Reflect new method for sig_send to send
- signals to self.
- * fork.cc: A handle name was changed in the pinfo structure to
- be more reflective of its use. Change forkee_stopped to
- subproc_ready everywhere.
- * pinfo.cc (pinfo::clearout): Change forkee_stopped to
- subproc_ready.
- (pinfo_init): Use PID_EXECED flag to determine if this process has
- been execed. If so, signal the remaining stub in the process
- which invoked us so that the stub can terminate and let us take
- over as this pid.
- * sigproc.cc (sig_send): Change method for determining if sending
- signals to myself. A NULL pointer means communicate with my
- signal handler. This is necessary to allow communication with
- our own signal processors after reparenting an execed process.
- Also, add an additional test to detect if a process goes away in
- the middle of attempting to send it a signal.
- (allow_sig_dispatch): Reflect new method for sig_send to send
- signals to self.
- (getsem): Use dwProcessId in names for signal semaphores. Allows
- communicating with both parts of a process that is temporarily
- "split in two" while execing.
- (sig_proc): Avoid printing an error if WAIT_FAILED and exiting
- anyway. Process requests even if loop_wait == 0.
- (proc_subproc): Defensive check for manipulating processes prior
- to initialization or after terminating sigproc.
- Use different check for subprocesses that have been reparented.
- Hopefully this will eliminate WFSO, error 6 problems.
- (wait_subproc): Only exit when loop_wait == 0 and not dealing with
- a process.
- * spawn.cc: Set up two global variables, used on exit when
- execing a non-cygwin process: hExeced - handle of non-cygwin
- process which is being waited for by a stub, pExeced - windows pid
- of the process.
- (spawn_guts): Reorganize to always (temporarily) wait for the new
- process when P_OVERLAY. If a cygwin process is invoked, then the
- wait will return when an event is signalled and the new process
- will be "reparented" in the ppid. If a non-cygwin process is
- invoked, wait until the process exits or a signal is received
- which terminates the process. In this case, the do_exit function
- will terminate the non-cygwin process.
- * winsup.h: Rename forkee_stopped to subproc_ready since this
- event now has a dual role which is better defined by this new
- name. Add a new flag (PID_EXECED) for process_state. Define a
- new function `do_exit' which operates similarly to _exit
- but takes > 16 quantities with the high order bit signifying
- different exit actions.
-
-Mon Nov 10 17:11:08 1997 Geoffrey Noer <noer@cygnus.com>
-
- * include/utime.h: remove (moved to newlib/libc/sys/cygwin32/sys)
- so as not to conflict with the one in newlib/libc/include.
-
-Mon Nov 10 15:11:42 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * exceptions.cc (__cygwin32_exception_handler): exit with
- "core dumped" exit code after writing "core" file.
-
-Mon Nov 10 15:11:42 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * console.cc: Add convenience macros and structures for handling
- scrolling.
- (fhandler_console::fillin_info): New function to fill in the `info'
- struct.
- (fhandler_console::scroll_screen): Change to scroll only the visible
- portion of the screen. Honor scroll regions more stringently.
- (fhandler_console::open): Use new fillin_info function.
- (fhandler_console::ioctl): Use new fillin_info function which
- automatically calculates screen size.
- (fhandler_console::clear_screen): Use new fillin_info function.
- Only clear visible portion of screen.
- (fhandler_console::cursor_set): Add a flag to indicate whether
- cursor positioning is absolute within buffer or is screen relative.
- Use new fillin_info function to get screen information.
- (fhandler_console::cursor_rel): Use new fillin_info function.
- Change for new cursor_set parameter.
- (fhandler_console::cursor_get): Use new fillin_info function.
- (fhandler_console::char_command): Use new fillin_info function
- where appropriate. Change for new cursor set parameter where
- appropriate. Scroll only visible portion of screen when required.
- * fhandler.h (class fhandler_console): Add fillin_info, change
- cursor_set to reflect additional argument.
-
-Mon Nov 10 15:11:42 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * dcrt0.cc (dll_crt0_1): Register process start time.
- * fork.cc (cygwin_fork_helper1): Register process start time.
- * utils/ps.cc (main): Report process start time.
- (start_time): New function to format time similarly to UNIX ps.
- A time from today shows as HH:MM, times from previous days just
- show the month and day.
- * winsup.h (class pinfo): Add start_time field.
-
-Mon Nov 10 11:54:27 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * include/Windows32/Defines.h (TIME_ZONE_ID_INVALID): Define.
- * times.cc (gettimeofday): The error return from
- GetTimeZoneInformation is TIME_ZONE_ID_INVALID, not
- TIME_ZONE_ID_UNKNOWN.
-
-Sun Nov 9 17:08:30 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * Makefile.in: add ../libiberty/strsignal.o
- * cygwin.din: add exports for strsignal, strtosigno
- * utils/kill.cc: changes to allow accepting signal name
- as argument
-
-Sun Nov 9 17:08:30 1997 Geoffrey Noer <noer@cygnus.com>
-
- * include/limits.h: define PATH_MAX here instead of
- include/sys/param.h, define _POSIX_NGROUPS_MAX as 0 not 1
- (system invariant value, not implementation-specific)
- * include/sys/param.h: remove PATH_MAX, change NOFILE from 64
- to 8192, delete PATHSIZE, remove safety wrapper around
- MAXHOSTNAMELEN, add comments
- * sysconf.cc (sysconf): return NGROUPS_MAX not zero,
- return _POSIX_SAVED_IDS not zero. Return _POSIX_CHILD_MAX
- not 4096. Return _POSIX_CHILD_MAX, not 8.
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * winsup.h: add proto for setdtablesize, define NOFILE_INIT
- and NOFILE_INCR
- * hinfo.cc (hmap_init, hinfo_vec::find_unused_handle): change to
- support virtually unlimited numbers of fds. Remove setdtablesize
- proto
- * syscalls.cc: initialize dtable_size to NOFILE_INIT instead of
- NOFILE
-
-Thu Nov 6 13:14:09 1997 Geoffrey Noer <noer@cygnus.com>
-
- * exceptions.cc (__cygwin32_exception_handler): don't
- print "In cygwin32_except_handler" for exceptions Cygwin32
- isn't going to handle. Print "(progname PID) Exception: <type>"
- to console. Redirect all detailed information including the
- stack trace to <progname>.core. This should reduce confusion
- about what's causing the exception (a lot of people would see "In
- cygwin32..." and think the problem was in Cygwin32 when most of
- the time it was in some other program).
- * syscalls.cc: add fixme
- * times.cc: add fixme
-
-Wed Nov 5 19:23:10 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * Makefile.in: force .c.os and .cc.os to be built in same
- directories as source
-
-Wed Nov 5 19:23:10 1997 Geoffrey Noer <noer@cygnus.com>
-
- * drct0.cc (dll_crt0_1): stop initializing winsock on process
- startup since that slows down startup time of all processes, even
- ones that don't end up making Winsock calls.
- * fork.cc (cygwin_fork_helper1): don't need to call uinfo_init
- or socket_checkinit after fork -- the appropriate functions will
- do the necessary initialization if they are ever called.
- * net.cc: init winsock_init_p to zero and make it static
- (all exported functions): call winsock_init before making
- any WinSock calls since this no longer happens in dcrt0.cc
- startup code. Only do this if !winsock_init_p.
- (winsock_init): checkinit renamed. Now just inits winsock
- without checking whether it has been already initialized.
- Make it static.
- * uinfo.cc (uinfo_init): after we call getpwnam, we know
- the passwd file has been read in so don't check initialization
- of it. However, we do need to read_etc_group() if group_in_memory
- isn't set.
- * passwd.cc: rename global i variable to pw_pos, rename
- passwd_in_memory to passwd_in_memory_p to match net.cc scheme.
- Add comments.
- (read_etc_passwd): make static
- (various): make sure to read_etc_passwd() if passwd_in_memory
- isn't set
- * grp.cc: add comments, rename idx global to grp_pos,
- rename group_in_memory to group_in_memory_p to match net.cc
- scheme, group_in_memory_p no longer static (needs to be accessed
- by uinfo_init)
- * winsup.h: remove proto for socket_checkinit since that's
- renamed and static within net.cc
-
-Tue Nov 4 01:02:20 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * signal.cc (sigprocmask): Newer versions of gcc will call
- sigprocmask when a builtin constructor is activated. If this
- happens prior to the setup of u->self, then a NULL dereference
- will occur. Guard against this.
-
-Mon Nov 3 17:00:45 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * hinfo.cc (hinfo_vec::build_fhandler): Open a console for
- /dev/tty when !use_tty.
-
-Thu Oct 30 10:28:15 1997 Tom Tromey <tromey@cygnus.com>
-
- * include/mapi.h: New file.
- * sysdef/i386/mapi32.def (MAPISendMail@20): New export.
-
-Thu Oct 30 15:08:13 1997 Geoffrey Noer <noer@cygnus.com>
-
- * times.cc: add comments listing standards funcs are defined in
- (dump_filetime): remove unused local func
- * net.cc (fail): remove local func, replace one reference with
- equivalent debug_printf, add standards comments, reformat a little
- (fhandler_socket::close): simplify handling of res
- (fhandler_socket::fstat): set ENOSYS (unimplemented)
- * stubs.cc: set ENOSYS in unimplemented funcs
- * uname.cc: add standards comment
- * ntea.cc: reformat
-
-Wed Oct 29 22:43:57 1997 Geoffrey Noer <noer@cygnus.com>
-
- * times.cc (settimeofday): set ENOSYS instead of EPERM
- since ENOSYS maps to "Function not implemented" which is the
- case here.
- * syscalls.cc (seterrno): on failure, set EACCES instead of EPERM
- which is better for the unknown error case
-
-Fri Oct 24 01:24:07 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from green@cygnus.com (Anthony Green):
- * dcrt0.cc: new host_dependent_constants object with a global
- instance of it which allows constants that are different in Win 95
- and NT to be saved here instead of having forks in the code and
- having to check the OS type each time. Add two constants for
- fhandler, one for sharing attributes and one for upper word value
- for locking files.
- (dll_crt0_1): call host_dependent init function
- * fhandler.cc (fhandler_base::open): use above object for
- setting shared attributes
- (fhandler_disk_file::lock): get upper word for locking from
- host_dependent_constants
- * winsup.h: define host_dependent_constants class and add extern
- for global instance of it
-
-Wed Oct 22 02:27:53 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * cygwin.din: Export getenv, putenv, setenv and unsetenv instead
- of cygwin32_ wrappers
- * dcrt0.cc: External variable environ removed
- (dll_crt0_1): strip executable's path on console title if
- environment variable CYGWIN_TITLE set to "strip", references to
- environ removed.
- * environ.cc: New file. Code derived from newlib sources.
- * exec.cc: include stdlib.h
- (execl, execv): new (derived from newlib sources).
- (sexecve): reference to environ removed.
- (sexecvpe): call getenv instead of cygwin32_getenv.
- * grp.cc: new static variable group_in_memory
- (read_etc_group): skip blank lines
- (getgrgid, getgrnam, getgrent): call read_etc_group when necessary.
- * misc.cc (cygwin32_getenv/putenv/setenv/unsetenv): remove
- wrappers.
- * passwd.cc: new static variable passwd_in_memory
- (read_etc_passwd): skip blank lines
- (search_for, getpwent): call read_etc_passwd when necessary.
- (setpwent): fixed incorrect initialization of i var.
- * pinfo.cc (pinfo_init): initialize uid with illegal value to
- force read of /etc/passwd and /etc/group.
- * spawn.cc: call getenv instead cygwin32_getenv
- (spawn_guts): force read of /etc/passwd and /etc/group on sexec
- calls.
- * uinfo.cc (uinfo_init): read /etc/passwd and /etc/group only if
- uid is undefined.
- * winsup.h: remove protos for environ, cygwin32_getenv,
- cygwin32_putenv
-
-Wed Oct 22 02:08:54 1997 Geoffrey Noer <noer@cygnus.com>
-
- * utils/aclocal.m4: new file. Define autoconf macros for
- determining whether we're compiling for the cygwin32 environment
- or not and determine the executable suffix
- * utils/configure.in: call AM_CYGWIN32 and AM_EXEEXT
- * utils/configure: regenerate
- * utils/Makefile.in: add $(exeext) after executable names so
- programs will be built with the .exe suffix
-
-Wed Oct 22 00:50:27 1997 Geoffrey Noer <noer@cygnus.com>
-
- Now that it is possible to use gdb using a stable
- cygwin.dll to debug a program using a newer, potentially buggy
- cygwin.dll, the strace mechanism will probably end up being
- used more and more for debugging timing/race-condition bugs that
- aren't easily exposed in a gdb session. The following changes
- make the strace facility better for debugging timing issues by
- storing the last few commands in a buffer instead of writing
- to disk each function call.
-
- patch from cgf@bbc.com (Chris Faylor):
- * dcrt0.cc (dll_crt0_1): Change to strace_init call to take
- an argument (for planned future registry changes).
- (_exit): Call strace_dump when appropriate. Add a debugging
- printf.
- * include/sys/strace.h: Add _STRACE_CACHE, _STRACE_EXITDUMP,
- strace_dump ().
- * strace.c (strace_init): Allow hexadecimal, octal setting of
- strace flags in environment variable. Handle new cache option.
- (strace_printf): Display number of seconds from last message.
- Handle _STRACE_CACHE.
- (strace_dump): New function. Dump cached messages to disk.
-
-Wed Oct 22 00:08:40 1997 Geoffrey Noer <noer@cygnus.com>
-
- * cygwin.din: export socket calls without cygwin32_ prefix
- * net.cc: remove unused herror function in favor of
- cygwin32_herror which is exported as herror
- * include/netdb.h: we are now exporting the socket calls without
- the cygwin32_ prefix so we don't need the nasty remapping in
- header files
- * include/arpa/inet.h: ditto
- * include/sys/socket.h: ditto
- * select.cc (select): make extern C
-
-Tue Oct 21 22:52:29 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * sigproc.cc (sigproc_terminate): Fix flawed attempt to signal
- any processes waiting for signal notification success when the
- process receiving the signal is terminating.
- (wait_subproc): Report on errors when opening the
- sync_proc_subproc mutex. Move initialization of events[0]
- "wakeup" signal prior to wait_subproc_inited or risk a (miniscule)
- chance for a reference to a NULL handle.
- * strace.cc (ta[]): Change WM_ASYNCIO entry to reflect previous
- changes to WM_ASYNCIO constant.
-
-Tue Oct 21 14:30:14 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * sigproc.cc (proc_subproc): fix minor error output problem
-
-Mon Oct 20 20:19:02 1997 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: change DLL_NAME to cygwin97r2.dll
-
-Mon Oct 20 20:16:47 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * window.cc (alarm): When there is a previous alarm() request
- with less than one second remaining, then the return from a call
- to alarm() is supposed to return 1.
-
-Mon Oct 20 20:16:47 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * Makefile.in: Add sigproc.o target. Add sigproc.h dependency
- where appropriate. Add -s to intermediate ld of cygwin.dll to
- speed up the process of building the .dll.
- * dcrt0.cc: Add new sigproc.h include.
- (dll_crt0_1): Replace window_init with sigproc_init for
- initialization of signal/sub process handling. Change to use new
- process_state field in pinfo.
- (_exit): Remove spurious debugging statement. Terminate sigproc
- processing. Remove signal blocking obviated by previous signal
- termination. Remove SIGCHLD notification of parent as it is now
- handled automatically in the parent.
- (api_fatal): Terminate sigproc processing.
- * exceptions.cc: Add new sigproc.h include. Change name of
- ourhThread.
- (ctrl_c_handler): Change to static as this is no longer called
- outside of this module.
- (lock_cs): Change to a function which will optionally grab new
- signal dispatch mutex. Don't wait forever for cs mutex.
- (unlock_cs): Change to a function which will optionally release
- new signal dispatch mutex.
- (init_exceptions): Detect errors from SetConsoleCtrlHandler.
- Initialize new sig_dispatch mutex. This mutex is used to
- control dispatching to a function on signal receipt.
- (sig_dispatch_pending): New function. Called from signal
- processing thread to dispatch pending signals.
- (set_process_mask): Block signal dispatch during setting of new
- mask, if possible. Contact signal thread to dispatch pending
- signals.
- (handle_sigsuspend): New function. Attempts to implement a
- sigsuspend which will not lose signal notification. Called from
- sigsuspend.
- (call_handler): Use sigproc_printf where appropriate.
- (ctrl_c_handler): Use _raise to invoke the correct signal.
- (sighandle): New function. Subsumes most of ctrl_c_handler.
- Change to mark as suspended signals which would dispatch for which
- the sig_dispatch mutex is unavailable. Use sigproc_printf where
- appropriate.
- (events_init): Remove application_stopped mutex made obsolete by
- new sigproc handling.
- (events_terminate): Remove application_stopped mutex made
- obsolete by new sigproc handling.
- * fork.cc: Add new sigproc.h include.
- (cygwin_fork_helper1): Use process_state field in pinfo (replaces
- inuse_p). Call proc_register to add a new subproc to sigproc
- handling. Call sigproc_init for new subprocess. Remove obsolete
- window_init.
- * heap.cc (_sbrk): Use process_state field in pinfo (replaces
- split_heap_p).
- * hinfo.cc (hmap_init): Use process_state field in pinfo (replaces
- cygwin_parent_p).
- * include/sys/strace.h: Add tracing for signal/subprocesses.
- * init.cc: Add new sigproc.h include. Add waitq_storage global
- for new sigproc handling.
- (dll_entry): Add initialization, destruction of structures needed
- by new sigproc handling.
- * net.cc (fhandler_socket::ioctl): Use gethwnd() function to find
- hwnd of hidden window.
- * pinfo.cc: Add new sigproc.h include.
- (pinfo::clearout): Use process_state field in pinfo (replaces
- split_heap_p). Explicitly initialize various handles to NULL.
- (pinfo_init): Use process_state field in pinfo (replaces
- cygwin_parent_p).
- (pinfo_list::operator): Use process_state field in pinfo (replaces
- inuse_p).
- (pinfo_list::alocate_pid): Initialize process_state field.
- (pinfo::init_self): Remove obsolete initialization of hProcess.
- (pinfo::record_death_nolock): Changes for new sigproc handling.
- (pinfo::record_death): Move bulk of this code to sigproc.cc.
- (pinfo::terminate): Remove function made obsolete by sigproc
- handling.
- (pinfo::init_from_exec): Use process_state field (replaces
- inuse_p).
- * signal.cc: Add new sigproc.h include.
- (kill_worker): Call new sig_send function to send signals to
- cygwin processes.
- (_kill): Use process_state field in pinfo (replaces inuse_p).
- (sigsuspend): Call handle_sigsuspend in exceptions.cc to handle
- sigsuspend in a non-raceable way.
- * sigproc.cc: New signal/subprocess handling module. Replaces
- SendMessage method for signals with a method using semaphores.
- Also detects changes in the state of child processes.
- * sigproc.h: New header file defining constants and functions for
- signal/subprocess handling.
- * spawn.cc: Add new sigproc.h include. Clean up trailing spaces.
- (spawn_guts): Reorganize to use new sigproc handling.
- Use new pinfo process_state field (replaces inuse_p).
- * syscalls.cc (_read): Use new pinfo process_state field (replaces
- inuse_p).
- (_write): ditto.
- * tty.cc (tty_init): Use new pinfo process_state field (replaces
- cygwin_parent_p).
- * utils/ps.cc (main): Use new pinfo process_state field (replaces
- inuse_p). Detect "zombie" processes similarly to UNIX ps.
- * wait.cc: Add required includes.
- (wait_found): Function obsoleted by new sigproc handling.
- (wait4): Reorganize to use new sigproc handling.
- * window.cc: Changes for new sigproc handling.
- (WndProc): Remove SIGNAL handling obsoleted by new sigproc
- handling. Use static window handle since the field has been
- removed from pinfo. Use _raise where appropriate to send signals.
- (Winmain): Replace global window handle with static since the
- field has been removed from pinfo.
- (window_init): Remove obsolete function.
- (gethwnd): New function to allocate hidden window on demand rather
- than at startup.
- (window_terminate): Kill hidden window only if allocated.
- (setitimer): Use gethwnd function to retrieve hidden window
- handle.
- * winsup.h: Remove stuff made obsolete by sigproc handling. Move
- some constants to new sigproc.h header file. Remove inuse_p,
- cygin_parent_p, split_heap_p. Replace with a single process_state
- field. Define bit fields for process_state in an enum for easier
- debugging.
-
-Mon Oct 20 19:17:33 1997 Geoffrey Noer <noer@cygnus.com>
-
- * sysdef/i386/winserve.def: remove ancient version of cygwin.din
- * include/sgtty.h: remove since Cygwin32's tty handling doesn't
- support bsd syntax/semantics
- * include/sys/termios.h: change winsize struct to include
- ws_xpixel and ws_ypixel members
- * cygwin.din: remove export of ScreenCols, ScreenGetCursor,
- ScreenRows, ScreenSetCursor, get_pid__5pinfo, getkey, _getkey,
- kbhit, _kbhit, __small_printf = small_printf__FPCce
- * key.cc: remove. Similar functionality exists in ncurses
- which can be compiled for Cygwin32
- * console.cc (ScreenCols, ScreenGetCursor, ScreenSetCursor,
- ScreenRows): delete and delete SCREEN_ROWS/COLS defines
- * pold.c: remove old pipe-related code that's no longer used
- * include/regex.h: remove, it's not a part of cygwin.dll
- * syscalls.cc: started to add comments including standards
- information
- (truncate): new
- (ftruncate): length is an off_t, not a size_t. Add missing
- return value to debug printf
- * syscalls.h: ftruncate length is an off_t, add proto for truncate
-
- patch from cgf@bbc.com (Chris Faylor):
- * console.cc (fhandler_console::write): Recognize '@' as a valid
- character to follow a '\e[' sequence or get 'Bad escape' errors.
-
-Wed Oct 15 18:44:25 1997 Geoffrey Noer <noer@cygnus.com>
-
- * cygwin.din: restore __main as an export
-
-Mon Oct 13 18:41:09 1997 Geoffrey Noer <noer@cygnus.com>
-
- * cygwin.din: revert renaming of __assert since that's
- actually what it's supposed to be called
- * assert.cc: ditto
-
-Fri Oct 10 19:25:49 1997 Tom Tromey <tromey@cygnus.com>
-
- * include/Windows32/Base.h: Moved typedefs of CHAR, SHORT, etc,
- before all other uses in file.
-
-Fri Oct 10 17:50:12 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * include/Windows32/Base.h: Only typedef CHAR, SHORT, and LONG if
- VOID is not defined
-
-Thu Oct 9 00:46:40 1997 Geoffrey Noer <noer@cygnus.com>
-
- * cygwin.din: remove all libgcc.a exports. They don't
- belong here since libgcc.a doesn't really relate to the
- purpose of cygwin.dll, and (to make things worse) the contents
- change over time.
- * assert.cc: rename __assert to __cygwin32_assert
- * exceptions.cc: rename __stack_trace to __cygwin32_stack_trace,
- __cygwin_except_handler to __cygwin32_except_handler
- * version.h: increment major and minor numbers
-
-Tue Oct 7 12:52:25 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * dcrt0.cc (_exit): under Win 95, don't send SIGCHLD
- unless special env variable is set. This works around a
- problem where exiting a process can hang under Win 95.
-
-Mon Oct 6 23:41:34 1997 Geoffrey Noer <noer@cygnus.com>
-
- * regexp: new directory containing free regexp code by
- Henry Spencer. Taken from the most recent release of NetBSD.
- Write configure.in and Makefile.in, based on files from
- winsup/utils.
- * Makefile.in: build regexp directory and include objs in
- cygwin.dll.
- * stubs.cc: remove all reg* stubs except for regfree which
- isn't provided by above code.
-
-Mon Oct 6 13:35:48 1997 Geoffrey Noer <noer@cygnus.com>
-
- * dcrt0.cc: remove asm idata3 terminator, now that ld is fixed
- such that this is no longer necessary.
- * libccrt0.cc: ditto
-
-Mon Oct 6 13:14:00 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * spawn.cc (spawn_guts): return child's PID on
- spawn (_P_NOWAIT,...) instead of child's handle.
- (cwait): rewritten as a wrapper to waitpid.
-
-Mon Oct 6 13:02:01 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * net.cc (socketpair): new
- * cygwin.din: add socketpair export
-
-Mon Oct 6 13:01:51 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * dcrt0.cc: Remove obsolete call to fork_terminate.
- * exceptions.cc: Respace, remove extraneous trailing whitespace.
- Change critical section to mutex since there are supposedly
- multi-processor problems with critical sections under NT.
- Use "lock_cs" and "unlock_cs" macros to lock/unlock critical
- regions.
- (init_exceptions): Change critical section initialization to mutex
- initialization.
- (set_process_mask): Use locking macros to control access to
- sig_mask.
- (ctrl_c_handler): Use lock_cs/unlock_cs to control access.
- (events_init): Use standard cygname function to create names for
- shareable objects.
- (events_init): Close cs mutex.
- * fork.cc: Use event flags which are specific to the child being
- forked. This prevents one process from prematurely activating
- another. It also makes fork slightly more thread-safe.
- (fork_init): Remove event initialization.
- (fork_terminate): Remove function.
- (cygwin_fork_helper1): Initialize events on a per-fork basis.
- Events are inherited in child's pinfo structure.
- Remove child->hThread initialization as it not needed. Use
- pi.hThread where child->hThread is used.
- Work around Windows 95 bug where a WaitForSingleObjects will
- sometimes return ERROR_INVALID_HANDLE when it is resumed after
- a suspend.
- * pinfo.cc: Remove references to hThread field whereever it occurs.
- * strace.cc: Use standard cygname function to create name for
- strace_mutex. Prevents confusion between different .dll versions.
- * wait.cc (wait_found): Remove reference to hThread.
- * winsup.h (class pinfo): Remove reference to hThread. Add
- per-process fork control event handles.
- * include/limits.h: Increase NGROUPS_MAX from 0 to 1 to reflect
- recent change to getgroups.
-
-Mon Oct 6 11:06:22 1997 Geoffrey Noer <noer@cygnus.com>
-
- Oops. ../libio refers to objdir and is not the same
- as $(srcdir)/../libio.
-
-Thu Oct 2 23:12:19 1997 Geoffrey Noer <noer@cygnus.com>
-
- Revert patches to sources applied after Sept 16. Removed
- relevant portions of ChangeLog entries. Some of those changes
- may reappear later (removing the entries makes this log easier
- to understand).
-
-Thu Oct 2 15:34:03 1997 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: remove hardcoding of SHELL to /bin/sh, remove
- ../libio from INCLUDES since $(srcdir)/../libio is already
- included.
- * glob/Makefile.in: remove hardcoding of SHELL to /bin/sh
-
-Mon Sep 29 14:06:24 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * cygwin.din: add exports for rcmd, rresvport, rexec
- * net.cc (cygwin32_rcmd): new
- (cygwin32_rresvport): new
- (cygwin32_rexec): new
- * include/mywinsock.h: add protos for Winsock calls associated
- with functions called by the above.
-
-Mon Sep 29 13:26:24 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * grp.cc (getgrent): Change overlooked comment to reflect new
- behavior.
-
-Thu Sep 25 18:35:49 1997 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: remove debugdll defs since the shared memory
- overlap problem is solved by the timestamp addition of Sept 23
- * version.h: rework explanations of version numbers
-
-Thu Sep 25 16:21:49 1997 Geoffrey Noer <noer@cygnus.com>
-
- * spawn.cc: add missing cast to debug printf
-
-Thu Sep 25 16:14:17 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * path.cc (conv_to_win32_path): Call backslashify on a win32
- path.
-
-Tue Sep 23 17:58:17 1997 Geoffrey Noer <noer@cygnus.com>
-
- Fixes for things that were causing compile-time warnings:
- * exec.cc (_execve): add missing const to args to match def
- of execve in newlib which this calls.
- (sexecve): add missing const to def
- (sexeclpe): don't need to cast argv in sexecvpe call
- (sexecvpe): add missing const to def
- * winsup.h: correct _execve proto, add protos for login/logout
- * syscalls.h: correct sexecve, sexecvpe protos
- * include/Windows32/Base.h: NULL should be defined differently
- for C++
- * init.cc: respacing
-
-Tue Sep 23 17:05:50 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * dcrt0.cc (dll_crt0_1): don't use alloca for allocating storage
- for environment blocks because setenv() uses realloc!
-
-Tue Sep 23 17:05:50 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * Makefile.in (LD_STUFF): Add datestamp.o after DLL_OFILES.
- (datestamp.o): New target. datestamp.c is generated whenever .o
- files change. It creates a file containing a "date stamp"
- which is used by the function "cygname" to create named
- shared memory, events, mutexes, and semaphores used by
- cygwin.dll. The unique datestamp allows multiple loading of
- different cygwin.dll's even when they have incompatible use
- of shared memory areas.
- * init.cc (dll_entry): Create the name string used by cygname
- from the name of the invoking .dll + the datestamp of the
- .dll from the auto-generated datestamp.c
- * misc.cc (cygname): New function. Creates a standard Cygnus
- shared resource name given a prefix, a name (e.g., pinfo_mutex),
- and a numeric suffix (e.g., a pid). Replaces custom code in
- several files. Uses cygwin_dlldate from datestamp.c to construct
- names that are unique for a given cygwin load.
- * shared.cc (open_shared_file_map): Use standard cygname function
- to create names for sharable objects. Use static handle 'h'
- so that it can be closed later by shared_terminate.
- (shared_terminate): Guard against calling CloseHandle with a
- NULL handle.
- (create_shared_fd_mapping_name): Use cygname function to generate
- the name for the "fd_map".
-
-Tue Sep 16 23:34:36 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * fcntl.cc (_fcntl): correct errno value (EBADF instead of
- EBADFD).
-
-Tue Sep 16 17:22:28 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * include/Windows32/Defines.h: add missing defines needed
- for NTEA usage.
- * ntea.cc: remove them from here
- * syscalls.cc (_link): call CreateFile with FILE_WRITE_ATTRIBUTES
- flag instead of GENERIC_WRITE
-
-Tue Sep 16 17:22:28 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * pinfo.cc (pinfo_init): Fix a NULL pointer dereference when PID
- environment variable contains garbage.
-
-Thu Sep 11 16:51:40 1997 Geoffrey Noer <noer@cygnus.com>
-
- * syscalls.cc (ftruncate): read file pointer location at
- beginning of function and restore it at the end
-
-Thu Sep 11 15:35:10 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * path.cc (backslashify): Don't turn a single trailing slash into
- a double trailing slash.
-
-Wed Sep 10 11:40:55 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * include/Windows32/Structures.h: Add PACKED to PRINTDLG.
- * include/Windows32/Functions.h: Add STDCALL to a few function
- declarations.
-
-Tue Sep 9 02:12:18 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * syscalls.cc (_link): Implement hard links under NT with NTFS
- using the backup API. Default to copying the file (what we did
- before).
-
-Mon Sep 8 20:19:09 1997 Geoffrey Noer <noer@cygnus.com>
-
- Merge in the following changes:
-
- Thu Aug 21 13:30:12 1997 Ian Lance Taylor <ian@cygnus.com>
- * assert.cc: New file.
- * Makefile.in (DLL_OFILES): Add assert.o.
- (assert.o): New target.
- * pinfo.cc (cygwin32_winpid_to_pid): New C function.
- * cygwin.din: Add cygwin32_winpid_to_pid.
- * include/sys/cygwin.h: Include <sys/types.h>.
- (cygwin32_winpid_to_pid): Declare.
- * pinfo.cc (pinfo_init): Add debug_printf showing pid and pgid.
-
- Wed Aug 20 13:24:30 1997 Ian Lance Taylor <ian@cygnus.com>
- * spawn.cc (env_sort): New static function.
- (spawn_guts): Sort the environment before passing it to
- CreateProcess.
- * exceptions.cc (exit_already): New file static variable.
- (__cygwin_exception_handler): If exit_already is set, just
- return. If we get an exception we don't recognize, let the next
- exception handler handle it. Just ignore the INVALID_HANDLE
- exception.
- (really_exit): Remove file static exit_already variable; use the
- global one.
- (events_terminate): Set exit_already.
- * include/Windows32/Defines.h (EXCEPTION_INVALID_HANDLE): Define.
- (STATUS_INVALID_HANDLE): Define.
- * include/Windows32/Functions.h: Declare some shell functions.
-
-Mon Sep 8 17:40:46 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * dcrt0.cc (_exit): Kill the foreground process group on session
- leader exit only if job control is in progress.
- * exceptions.cc (ctrl_c_handler): protect the code with critical
- section. This helps stability under Win 95.
- * include/sys/strace.h: add new wm_printf macro
- * signal.cc (kill_worker): window message number changed (window
- messages WM_USER-WM_USER+0x100 reserved for common controls on
- windows95). Debug print added.
- * spawn.cc (spawn_guts): removed unneeded flag DETACHED_PROCESS.
- * strace.cc: defines for SIGNAL and ASYNCIO messages added.
- * tty.cc (create_tty_master): initialize speed fields of termios
- structure.
- (fhandler_pty_master::open): likewise.
- * window.cc (WndProc): debug print added, window message number
- changed.
- * winsup.h: WM_ASYNCIO number changed.
-
-Mon Sep 8 16:40:46 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * fhandler.h: set_w_binary/set_r_binary now defined to
- return void
- * grp.cc (getgroups): always return an array of length 1 where
- the element is the user's gid.
- * pinfo.cc (pinfo_init): verify that we haven't exceeded the
- maximum number of processes
- (pinfo_list::allocate_pid): ditto
- * include/Windows32/Functions.h: add noreturn attrib to ExitProcess
- * include/sys/strace.h: change strace defs so strace-related
- printfs will automatically add __FUNCTION__: to the beginning,
- rename __sys_printf to strace_printf.
- * *.cc: remove function names from debug printfs in favor of the
- new scheme where they are automatically added, change __sys_printf
- references (now strace_printf).
- * smallprint.c (__small_vsprintf): new function displayer code
- to support the above changes
-
-Wed Sep 3 12:44:45 1997 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: split subdir_do into subdir_dobefore and
- subdir_doafter to reflect whether the subdir in question
- should be built before or after the top level is built
- (e.g. glob needs to be built before libcygwin.a but libcygwin.a
- needs to be built before utils).
-
-Thu Aug 28 12:09:39 1997 Geoffrey Noer <noer@cygnus.com>
-
- * configure.in: when setting up EXE_LDFLAGS, correct the
- location of crt0.o to ../../newlib since EXE_LDFLAGS is used
- by Cygwin32 subdirectories where newlib is two directories up
- instead of one.
- * configure: regenerate with autoconf
-
-Thu Aug 28 00:13:11 1997 Geoffrey Noer <noer@cygnus.com>
-
- Replace all licensing-related headers in all Cygnus-owned
- files. Instead of listing terms at the top of each file, now
- we simply refer to:
- * CYGWIN32_LICENSE: new file listing Cygwin32 licensing terms
-
-Wed Aug 27 17:40:16 1997 Geoffrey Noer <noer@cygnus.com>
-
- * cygwin.din: export random, srandom
-
-Wed Aug 20 16:56:39 1997 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: remove unused winsock-related build rules
- that were commented out, minor comment changes, remove
- test.exe build rule.
-
-Wed Aug 20 14:45:17 1997 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: link cygwin.dll with -lm -lgcc -lc -lgcc instead
- of -lc -lm -lm -lgcc so lgcc finds abort(). Add definitions that
- will eventually be used to build a cygwindebug.dll used by gdb
- so gdb can debug a buggy cygwin.dll. Change some variable names
- to have underscores in them (DLL_NAME, LIB_NAME, DEF_FILE, etc.).
- Comment out text.exe build rule.
-
-Tue Aug 19 20:41:51 1997 Geoffrey Noer <noer@cygnus.com>
-
- * dcrt0.cc: respace, modify some comments slightly
-
-Tue Aug 19 16:17:57 1997 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: include ../libiberty/random.o, stop including
- librx since it is LGPL'd code.
- * stubs.cc: add stubs for regcomp, regexec, regerror, regfree
- * dcrt0.cc (dll_crt0_1): default to not support tty/pty devs,
- default to not displaying the running process in the title bar.
-
-Fri Aug 15 18:23:43 1997 Rob Savoye <rob@cygnus.com>
-
- Add mingw directory for the minimalist cygwin environment.
- See mingw/ChangeLog for changes specific to that directory
-
- * configure.in: Add mingw to AC_CONFIG_SUBDIR.
- * configure: Regenerated from autoconf 2.12 with Cygnus patches.
- * Makefile.in: Use subdir_do which uses the value of $SUBDIRS
- rather than having seperate target for each directory.
- * glob/Makefile.in: Add a phony target for install.
- * configure.in: Add mingw to AC_CONFIG_SUBDIR.
-
-Fri Aug 15 01:12:19 1997 Geoffrey Noer <noer@cygnus.com>
-
- * times.cc: add missing extern "C"s around exported functions
-
-Thu Aug 14 17:00:32 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * console.cc (fhandler_console::input_tcsetattr): clear iflag_ and
- lflag_ when tty support enabled.
- (FakeReadFile): do not interrupt read when tty support enabled.
- Do not reset signal_arrived event.
- * cygwin.din: add exports - cf(g)set(i)ospeed, login, logout, ttyslot
- * dcrt0.cc (_exit): kill orphaned childs with SIGHUP and SIGCONT
- on group leader exit, kill foreground process group on session
- leader exit.
- * dirsearch.cc (closedir): check for FindFirst() was called
- * exceptions.cc: include mywinsock.h.
- (call_handler): call WSACancelBlockingCall to try to interrupt
- blocking winsock call, do PulseEvent() instead of SetEvent().
- (ctrl_c_handler): clear pending SIGCONT on stop signals, clear all
- pending stop signals on SIGCONT, suspend the thread before resuming
- to avoid W95 bug, process pending signals on SIGCONT, add signals to
- pending if the process is stopped.
- * fcntl.cc (fcntl): some code rearrangement to always do debug printfs
- on call exit.
- * hinfo.cc: include stdio.h
- (hinfo_vec::build_fhandler): always add ttynum to tty's filename
- (hinfo_vec::dup2): fix return value initialization and errno setting.
- * include/netdb.h: typedef for sig_t removed
- * include/sys/termios.h: octal constants changed to hexadecimals
- to simplify debugging.
- * misc.cc: include unistd.h and utmp.h
- (login): new
- (logout): new
- * pinfo.cc (lock_pinfo_for_update): debug printf added
- (pinfo::record_death): mark processes as orphaned on group leader
- exit.
- * select.cc (cygwin32_select): ResetEvent() removed
- * signal.cc: unneeded ResetEvents removed
- (_kill): ignore stop signals from a member of orphaned process group,
- kill self process the last on group kill.
- (sigaction): reset pending SIGCHLD when the disposition is set to
- default.
- * spawn.cc (spawn_guts): ResetEvent removed
- (cwait): do not interrupt the call
- * strerror.cc: include stdio.h, reenable disabled cases, remove
- duplicated cases, return decimal error value in the default case.
- * syscalls.cc (setsid): set process group id to process id when setsid
- called.
- (setpgid): check for negative pgid
- * syslog.cc (syslog): %m macro support added
- * termios.cc (cfg(s)eti(o)speed): new fuctions needed to support
- NIST PCTS requirements.
- * tty.cc: include utmp.h.
- (ttyslot): new
- (tty_list::terminate): fill in utmp on tty master exit
- (tty_list::allocate_tty): check for tty master pocess alive
- (create_tty_master): fill in utmp
- (do_input): restart tty output on interrupt
- (fhandler_tty_slave::fhndler_tty_slave): ttynum logic moved to
- build_fhandler.
- (fhandler_tty_slave::open): set tty's session id to sid of the calling
- process.
- (fhandler_tty_slave::write): check for TOSTOP bit
- (fhandler_tty_slave::fstat): allow access to tty to everyone
- (fhandler_tty_slave::ioctl): check for TOSTOP bit
- * tty.h: ttyslot prototype added
- * wait.cc (wait4): check for valid value of option argument added
- * winsup.h: define PID_ORPHANED, move tty_list array to the end
- of shared area.
-
-Thu Aug 14 11:42:59 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * path.cc (slash_unc_prefix_p): Correct check of path[3]. Permit
- numbers after the host name.
-
- * include/Windows32/Defines.h: Correct value for SM_CMETRICS,
- SM_CXDRAG, SM_CYDRAG, SM_CXEDGE, SM_CYEDGE, SM_CXFIXEDFRAME,
- SM_CYFIXEDFRAME, and add SM_MOUSEWHEELPRESENT.
-
-Wed Aug 13 20:11:52 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * fork.cc (cygwin_fork_helper1): If we don't have a console, pass
- DETACHED_PROCESS to CreateProcess.
- * spawn.cc (spawn_guts): Likewise.
-
-Tue Aug 12 19:51:32 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * include/Windows32/Structures.h (IMAGE_DOS_HEADER): Remove
- dos_message and nt_signature fields; they aren't present in the
- Windows header file.
-
-Wed Aug 6 16:27:13 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * include/Windows32/Structures.h: Define LPMEASUREITEMSTRUCT as a
- pointer to MEASUREITEMSTRUCT.
-
- * syscalls.cc (_stat_worker): In directory case, only set
- STD_WBITS in st_mode if FILE_ATTRIBUTE_READONLY is clear.
- (access): Remove special case for directory.
-
- * include/Windows32/Defines.h (HKEY_DYN_DATA): Define.
- (REG_FULL_RESOURCE_DESCRIPTOR): Define.
- (REG_RESOURCE_REQUIREMENTS_LIST): Define.
-
-Mon Aug 4 21:15:05 1997 Andrew Cagney <cagney@b1.cygnus.com>
-
- * glob/Makefile.in: Add include of newlib/libc/sys/cygwin32 to
- explicit .c.o rule so that dirent.h is found.
-
-Thu Jul 24 02:14:24 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * cygwin.din: fpathconf, initgroups - new exports
- * console.cc: new static variable CONSOLE_SCREEN_BUFFER_INFO info
- (fhandler_console::scroll_screen): local variable info removed
- (fhandler_console::open): likewise
- (fhandler_console::ioctl): likewise
- (fhandler_console::clear_screen): likewise
- (fhandler_console::cursor_set): likewise
- (fhandler_console::cursor_rel): likewise
- (fhandler_console::cursor_get): likewise
- (fhandler_console::write_normal): fixed scroll region bug, termcap
- "cs" entry works now
- * dcrt0.cc (dll_crt0_1): set file API to use OEM charset, convert
- command line from ANSI to OEM charset.
- (_exit): clear stopsig value on process exit
- * exceptions.cc (call_handler): add one millisecond delay before
- SetEvent()
- (ctrl_c_handler): clear pending stop signals on SIGCONT, do not send
- SIGCHLD to parent on process resuming; some debug printfs added; do
- not call _exit() in a context of signal handling thread (would cause
- more harm than good); fixed a bug with SA_NOCLDSTOP flag.
- * fhandler.cc (fhandler_base::open): use full win32 path name to
- generate inode number namehash instead of unix filename.
- * fork.cc (cygwin_fork_helper1): block all signals while child and
- parent are in fork() code
- * grp.cc (initgroups): new stub added
- * include/limits.h: new posix defines added
- * include/sys/termios.h: typedef speed_t as unsigned char
- * path.cc (mount_info::conv_to_posix_path) bugfix
- * pinfo.cc (pinfo_list::operator []): PID_NOT_IN_USE check added
- (pinfo::record_death): set child's ppid to 1 on parent exit
- * signal.cc (sleep): correct return value if sleep call was
- interrupted
- (_kill): correct return value if killed pid was not found.
- (sigaction): correct return value on handling non-handlable
- signals, clear pending ignored signals
- (sigsuspend): sigsuspend call should always return -1 and set errno
- to EINTR.
- * spawn.cc: respace
- * syscalls.cc: map ERROR_NO_DATA to EPIPE instead of ENODATA
- (isatty): fixed return value
- (fpathconf): new
- (pathconf): rewritten
- (ttyname): fixed return value
- * sysconf.cc (sysconf): misc fixes
- * termios.cc (tcsendbreak): corrected errno set
- (tcdrain): likewise
- (tcflush): likewise
- (tcflow): likewise
- (tcsetattr): likewise
- (tcgetattr): likewise
- (tcgetpgrp): likewise
- (tcsetpgrp): likewise
- * tty.cc (fhandler_tty_slave::ioctl): TCGETA/TCSETA support added
- * wait.cc (_wait): wait() syscall should do not terminate if
- a child is stopped.
- (wait4): wait calls should wait childs only; fixed a bug with
- nprocinfo count; fixed signal handling.
-
-Thu Jul 24 02:10:25 1997 Geoffrey Noer <noer@cygnus.com>
-
- * uname.cc: uname now outputs Cygwin32_NT or Cygwin32_95
- instead of Cygwin32/NT or Cygwin32/95.
-
-Thu Jul 24 02:10:25 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * cygwin.din: sexecve, sexecl, sexecle, sexeclp, sexeclpe,
- sexecv, sexecp, sexecvpe - new exports
- * exceptions.cc (ctrl_c_handler): do not raise SIGHUP on
- CTRL_LOGOFF_EVENT to prevent termination of cygwin application
- run as NT service on user logoff, raise SIGHUP instead of SIGQUIT
- on system shutdown, clear stopped status in inuse_p on SIGCONT,
- set stopped status on stop signals, call _exit() on process
- termination in a context of signal thread to terminate while
- in a blocking win32 syscall.
- * exec.cc: include unistd.h and ctype.h.
- (_execve): code moved to sexecve, call sexecve with a NULL hToken
- handle.
- (sexecve): new, check path, argv[0] and envp to null values,
- pass nToken handle to spawn_guts().
- (sexecl): new (code derived from spawn family of functions in
- spawn.cc)
- (sexecle): new
- (sexeclp): new
- (sexeclpe): new
- (sexecv): new
- (sexecp): new
- (strccopy): new
- (sexecvpe): new
- * fhandler.cc (fhandler_base::fstat): add STD_RBITS and STD_WBITS
- to st_mode of non-file handles.
- (fhandler_dev_floppy::open): clear O_TRUNC bit.
- (fhandler_dev_tape::open): likewise
- * fhandler.h (fhandler_pty_master): new member pktmode (flag to
- indicate pty's packet mode)
- * fork.cc (cygwin_fork_helper1): call uinfo_init () in a child code
- to read /etc/passwd, /etc/group into memory.
- * hinfo.cc (hinfo_vec::build_fhandler): check socket names for right
- inheritance on exec().
- * include/Windows32/Defines.h: fixed a typo in LPSTR_TEXTCALLBACKA
- definition
- * include/Windows32/Functions.h: added prototype for
- ImpersonateLoggedOnUser() API call.
- * net.cc (cygwin32_socket): duplicate socket handle as inheritable
- to avoid Windows95 socket inheritance bug, close the original socket.
- (cygwin32_accept): likewise.
- * path.cc (mount_info::conv_to_win32_path): do not add trailing
- backslash to UNC device names like "\\.\a:", "\\.\tape0:" etc.
- * pinfo.cc (pinfo::record_death_nolock) set PID_WAITING_FOR_PARENT
- bit to inuse_p instead of assignment - inuse_p is a bit set now.
- (pinfo::record_death): check PID_WAITING_FOR_PARENT bit instead of
- comparison.
- * select.cc (fd_pipe_map::convert_to_unix_fdset): deal with pipe
- errors.
- (pipethread): likewise
- * shared.cc (create_shared_fd_table): allow any process to access
- shared arg, needed for sexec() family implementation
- * signal.cc (kill_worker): fixed a typo in debug printf
- * spawn.cc (spawn_guts): new hToken argument (security token of
- logged on user for sexec() calls implementation), added checks for
- zero prog_arg and argv[0], if hToken is not NULL run
- CreateProcessAsUser() on the current window station/desktop, or
- just CreateProcess() otherwise, close hToken after the process is
- created.
- (_spawnve): pass NULL hToken to spawn_guts().
- * syscalls.cc (_read): set process's read status while in a read call
- (_write): set process's write status while in a write call
- (stat_worker): if GetFileAttributes() fails, try to call fstat to
- support raw devices
- * syscalls.h: include windows.h, added sexec() family functions
- prototypes.
- * sysdef/i386/kernel32.def: ImpersonateLoggedOnUser - new export
- * tty.cc: tty attachment logic changed - tty_list::count field
- counts now number of tty opens, but not a number of processes,
- attached to a tty.
- (tty_init): do not call attach_tty() in a exec'ed process
- (attach_tty): correct return value if !use_tty.
- (tty::init): initialize pgid and hwnd fields.
- (tty_list::terminate): clearout tty on master exit.
- (tty_list::allocate_tty): fixed a bug in a tty allocation.
- (fhandler_tty_master::init): on NT allow any process to open
- tty-master process for handle duplication, create synchronisation
- events with a world-wide access, initialize winsize structure with
- a default values.
- (fhandler_tty_slave::open): if a tty doesn't have process group set,
- set it to a process group of current process.
- (fhandler_tty_slave::write): added missed \n to debug print, tty
- write synchronization moved to a more correct place.
- (fhandler_tty_slave::read): Sleep time changed for conformance with
- other sleeps.
- (fhandler_tty_slave::tcsetattr): synchronization added
- (fhandler_tty_slave::ioctl): initialize arg.winsize with a tty-stored
- value, copy the result of ioctl call to winsize.
- (fhandler_pty_master::fstat): small fix
- (fhandler_pty_master::open): on NT allow any process to open
- pty-master process for handle duplication, initialize winsize
- structure with a default values.
- (fhandler_pty_master::read): check for pipe errors, changes to support
- packet mode
- (fhandler_pty_master::ioctl): rewritten, no longer a stub.
- (fhandler_pty_master::linearize/de_linearize): save/restore pktmode
- value.
- * tty.h (class tty): winsize - new member
- * utils/ps.cc: show process status just after tty number field
- * winsup.h: defines for new bits in inuse_p added, spawn_guts()
- prototype changed.
-
-Thu Jul 24 02:10:25 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * Makefile.in: Add tty.o to link and dependency lists, add
- tty.h to headers list
- * console.cc (fhandler_console::open): save open call flags
- (fhandler_console::input_tcsetattr): clear all console modes if
- tty support enabled
- (FakeReadFile): restart read on signal delivering, changed CTRL
- macro to CONTROL to avoid conflict with sys/termios.h, copy as
- much as possible chars to output buffer instead of call to
- undo_input after every char to prevent timeouts problem.
- * cygwin.din: srandom, ptsname, grantpt, unlockpt - new exports.
- * dcrt0.cc: include tty.h, new use_tty global variable.
- (dll_crt0_1): call events_init() on application startup, set
- use_tty to FALSE if CYGWIN_NOTTY environment variable is defined,
- do not change console title if CYGWIN_NOTITLE environment
- variable set, call tty_init().
- (_exit): call tty_terminate(), events_terminate() and others
- in the right order. All modifications of console title are
- mutexed to allow tty code to obtain console window handle right.
- * exceptions.cc (exception_init): initialization of signal_arrived
- event moved to events_init().
- (call_handler): raise signal arrived event after resuming main
- thread.
- (__cygwin_exception_handler): raise signal instead of calling
- ctrl_c_handler, because exception handler is called in a context
- of the thread, caused exception, and SuspendThread in call_handler
- blocks itself :-)
- (ctrl_c_handler): clear stopsig on SIGCONT delivery, call
- ResumeThread until suspend count > 1, notify parent about child's
- status changed. Care about handling SIGCONT signal. On stop
- signals release vital mutexes used by stopped thread, save
- signal number for wait(WUNTRACED) calls, notify parent about child's
- status change. Do not stop processes running without job control
- (when pgid == 0). Ensure that main thread is unblocked before
- call _exit().
- (events_init): new
- (events_terminate): new
- * fcntl.cc (_fcntl): use saved open flags on F_GETFL/F_SETFL instead
- of game with access_ variable. Is this variable longer needed?
- * fhandler.cc (fhandler_base::linearize/de_linearize): save/restore
- openflags_ variable.
- (fhandler_base::open): save file open flags.
- * fhandler.h (fhandler_base): new openflags_ member, new member
- functions get_flags/set_flags, new virtual functions ptsname,
- dup_for_fork, tcget(set)pgrp
- (fhandler_pipe): remove always_write/except_ready because pipes
- are always write ready (not true...) and selectable on read.
- new classes fhandler_tty_slave, fhandler_pty_master,
- fhandler_tty_master
- * fork.cc (cygwin_fork_helper1): inherit control tty number on fork,
- call tty_init on child startup.
- * hinfo.cc: include stdlib.h and ctype.h.
- (hmap_init): take care on exec'ed processes.
- (init_std_file_from_handle): open /dev/tty for standard handles if
- tty usage enabled.
- (build_fhandler): check for tty slave and pty master devices.
- * include/exceptions.h: exception handler returns "int" (exception
- handling code), not "void".
- * include/termios.h: new defines, struct winsize must contain
- ws_xpixel and ws_ypixel members (commented now to avoid
- incompabilities with existing binaries. Should be uncommented in
- next release.
- * net.cc (gethostbyaddr): corrected return value
- * passwd.cc (parse): remove trailing newline from password
- lines (user's shell was reported with trailing newline before).
- * pinfo.cc (lock_pinfo_for_update): open mutex code moved to
- events_init() in exceptions.cc.
- (destroy_pinfo_lock): removed, pinfo_mutex is now closed in
- events_terminate() in exceptions.cc.
- (init_self): the initial value for pgid must be 0 (no job-controlled
- process).
- * select.cc: all debug_printf's changed to select_printf.
- (fd_pipe_map): new class to implement (polling...) select on pipes.
- (pipethread): new
- (cygwin32_select): comment out socket only case since generic
- code (select on different types of handles) works for sockets too
- but is interruptable. The case for always_ready_used is used now
- and for polling select (zero timevalue). Changes to support
- select on pipes.
- * shared.cc (shared_info::initialize): initialize tty table.
- * signal.cc (sleep/usleep/sigsuspend/pause): signal_arrived moved
- from u area to dll's address space, signal_arrived is manual reset
- event now.
- (_raise): implemented as kill (self, sig).
- (kill_worker): new. Use SendMessage instead of PostMessage to avoid
- some timing problems.
- * spawn.cc: include tty.h.
- (spawn_guts) call close_all_files() on exec, call tty_terminate()
- before process exit. Some changes due to moving signal_arrived to
- dll's address space.
- (_spawnve): inherit control tty number on spawn.
- * syscalls.cc (close_all_files): reenabled. The code is ok after
- all! The troubles were due to incorrect usage on exec() calls.
- (setsid): no longer a stub
- (ptsname): new
- * termios.cc: all syscall_printf's changed to termios_printf.
- (tcget(set)pgrp): rewritten, no longer a stub.
- * times.cc (utimes): It looks like Win32 does not allow changing
- times of directories, so just return success in this case.
- * tty.cc: new file
- (tty_init): new
- (tty_terminate): new
- (attach_tty): new
- (detach_tty): new
- (tty::init): new
- (tty_list::terminate): new
- (tty_list::connect_tty): new
- (tty_list::free_tty): new
- (tty_list::init): new
- (tty_list::allocate_tty): new
- (fhandler_tty_master::fhandler_tty_master): new
- (create_tty_master): new
- (fhandler_tty_master::init): new
- (doecho): new
- (do_input): new
- (process_input): new
- (do_output): new
- (process_output): new
- (process_ioctl): new
- (fhandler_tty_slave::fhandler_tty_slave): new
- (fhandler_tty_slave::open): new
- (fhandler_tty_slave::init): new
- (fhandler_tty_slave::close): new
- (fhandler_tty_slave::write): new
- (fhandler_tty_slave::read): new
- (fhandler_tty_slave::linearize): new
- (fhandler_tty_slave::de_linearize): new
- (fhandler_tty_slave::dup): new
- (fhandler_tty_slave::dup_for_fork): new
- (fhandler_tty_slave::fstat): new
- (fhandler_tty_slave::tcgetattr): new
- (fhandler_tty_slave::tcsetattr): new
- (fhandler_tty_slave::tcflush): new
- (fhandler_tty_slave::tcsetpgrp): new
- (fhandler_tty_slave::tcgetpgrp): new
- (fhandler_tty_slave::send_ioctl_request): new
- (fhandler_tty_slave::ioctl): new
- (fhandler_pty_master::fhandler_pty_master): new
- (fhandler_pty_master::fstat): new
- (fhandler_pty_master::open): new
- (fhandler_pty_master::close): new
- (fhandler_pty_master::write): new
- (fhandler_pty_master::read): new
- (fhandler_pty_master::tcgetattr): new
- (fhandler_pty_master::tcsetattr): new
- (fhandler_pty_master::tcflush): new
- (fhandler_pty_master::ioctl): new
- (fhandler_pty_master::ptsname): new
- (fhandler_pty_master::linearize): new
- (fhandler_pty_master::de_linearize): new
- (fhandler_pty_master::dup_for_fork): new
- (grantpt): new
- (unlockpt): new
- * tty.h: new
- * utils/ps.cc: display process's control tty number.
- * wait.cc (wait_for_single): removed.
- (wait_for_any): all code moved to wait4().
- (wait4): rescan process table on child status changes, support for
- WUNTRACED flag, avoid time races on child exit, correct return
- value on timeout.
- * window.cc: misc changes to wait creation of process's hidden
- window to avoid race conditions on multiprocessor systems.
- * winsup.h: misc changes to support all of the above.
-
-Thu Jul 24 02:10:25 1997 Geoffrey Noer <noer@cygnus.com>
-
- * net.cc (cygwin32_shutdown): New implementation to replace
- stub previously present
-
-Tue Jul 22 14:59:22 1997 Geoffrey Noer <noer@cygnus.com>
-
- * cygwin.din: remove random, srandom
- * Makefile.in: remove random/srandom-related lines
-
-Tue Jul 22 14:10:32 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * path.cc (realpath): New C function.
- * cygwin.din: Export realpath.
-
- * cygwin.din: Export srandom.
-
-Wed Jul 9 12:26:03 1997 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: libiberty random.o ends up in winsup, link
- in that obj for now
-
-Tue Jul 8 14:02:41 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * libcmain.cc (main): Pass wShowWindow field from startup info to
- WinMain.
-
-Mon Jul 7 17:47:48 1997 Geoffrey Noer <noer@cygnus.com>
-
- * path.cc: respace, reword comments
- * times.cc (utimes): add FIXME
-
-Tue Jun 24 18:31:27 1997 Geoffrey Noer <noer@cygnus.com>
-
- * winsup.h: adjust protos to reflect the above, add enum os_type
- which contains {winNT, win95, win32s, unknown}
- * security.cc (is_nt): Delete
- * syscalls.cc (windows_95): Delete
- (get_os_type): New local function which returns os_type. Replaces
- windows_95() and is_nt().
-
- * fhandler.cc: Reformat. Call get_os_type() instead of
- windows_95() and/or is_nt(), reorder so NT cases are first.
- * mmap.cc: ditto
- * net.cc: ditto
- * syscalls.cc: ditto
- * syslog.cc: ditto
-
- * uname.cc (uname): call get_os_type to fill new our_os local
- variable, check that when filling out utsname struct, default
- to i386 when we can't find out the specific Intel processor
- variant.
- * fhandler.cc (get_file_owner): remove doit variable
- (get_file_group): ditto
- * mmap.cc: extern "C" individual functions instead of wrapper
- around most of file.
- * misc.cc: minor reformat
- * heap.cc (_sbrk): split a = b = c statement into two to
- make code clearer and avoid invalid C++ casting warning during
- compile.
- * path.cc (symlink_follow): initialize syml_p and exec_p to zero
- * select.cc: respace
- (selectthread): cast first arg of WINSOCK_FD_SET
- * ntea.cc (NTReadEARaw): add missing casts in front of malloc calls
- * utils/mount.cc: remove mixed option since that hasn't been
- supported for quite some time
-
-Sun Jun 22 17:27:03 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * include/windows.h: If RC_INVOKED is defined, don't include
- limits.h, stdarg.h, Structures.h, Functions.h or Sockets.h, and
- don't typedef BOOL.
- * include/Windows32/Base.h: Don't do any typedefs if RC_INVOKED is
- defined.
-
- * include/Windows32/Sockets.h (MAXHOSTNAMELEN): Don't define if
- already defined.
- * include/sys/param.h (MAXHOSTNAMELEN): Likewise.
-
-Fri Jun 20 11:06:09 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * include/sys/wait.h: correct operator precidence bug
- in WIFSIGNALED
-
-Thu Jun 19 12:58:45 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- Handle unblocked pending signals on sig_mask changes
- * exceptions.cc (return_handler): renamed to set_process_mask
- (set_process_mask): new; use to set process mask instead of direct
- u->self->sig_mask manipulations.
- * winsup.h: rename return_handler proto to set_process_mask
- * signal.cc: throughout file, call set_process_mask() instead of
- direct manipulations of u->self->sig_mask.
- (pause): new
- * cygwin.din: add pause() export
- * syscalls.cc (system): correct return value
-
-Wed Jun 18 22:01:56 1997 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: add $(srcdir)/../newlib/libc/sys/cygwin32 to
- the list of includes since that's where sys/dirent.h is
- supposed to live
- * include/sys/dirent.h: moved to newlib/libc/sys/cygwin32/sys
-
-Wed Jun 18 13:56:47 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * signal.cc (sigsuspend): deal with pending unblocked signals
- * winsup.h: add proto for return_handler (sigset_t)
-
-Wed Jun 18 02:02:13 1997 Geoffrey Noer <noer@cygnus.com>
-
- respaced console.cc, fhandler.cc, syscalls.cc, pinfo.cc,
- fork.cc, spawn.cc
-
-Tue Jun 17 14:57:09 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * cygwin.din: add getpgid, killpg exports, delete duplicate
- random export
- * fork.cc (cygwin_fork_helper1): inherit pgid and sid on fork
- * misc.cc (cygwin32_*env): save environ value in __cygwin_environ
- too. Is __cygwin_environ variable really neccessary? Why not
- export cygwin.dll's environ variable with "__cygwin_environ" name?
- * pinfo.cc (pinfo::init_self): initialize pgid and sid
- * signal.cc (kill_worker): new
- (_kill): rewritten to support process groups
- (killpg): new
- * spawn.cc (_spawnwe): inherit pgid and sid on spawn family calls
- * stubs.cc (setpgrp, getpgrp): remove stubs
- * syscalls.cc (setpgid, getpgid, setpgrp, getpgrp): new
- * termios.cc (setpgid): remove stub
- * utils/ps.cc (main): add pgid to output, change output
- format
- * wait.cc (wait_for_any): add intpid argument, arrays ctable and
- ptable have now fixed MAXIMUM_WAIT_OBJECTS size to avoid extra
- scan of process table, changes for process groups support.
- (wait4): misc changes to support process groups
- * winsup.h (pinfo class): add new variables pgid, sid.
- Define __cygwin_environ.
-
-Mon Jun 16 18:30:21 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * spawn.cc (spawn_guts): set child->hProcess and child->hThread,
- CloseHandle on pi.hThread at end of spawn_guts instead of right
- after starting the child process,
- _P_WAIT needs to be handled separately from _P_OVERLAY
-
-Sun Jun 15 23:51:10 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * cygwin.din: remove setenv/getenv-related exports,
- export cygwin32_ equivalents
- * exec.cc: check ?
- * misc.cc (cygwin32_getenv): new
- (cygwin32_putenv): new
- cygwin32_setenv): new
- (cygwin32_unsetenv): new
- * spawn.cc: call cygwin32_getenv instead of getenv,
- call spawn with *u->envptr instead of environ
- * winsup.h: define **environ as extern, define *cygwin32_getenv
-
-Sun Jun 15 20:51:09 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * Makefile.in: add ../libiberty/random.o to EXTRA_OFILES
- * cygwin.din: remove exports of tgetent and _tgetent, added random
- * exception.cc (exceptions_init): make OurThread handle
- noniherittable, remove unused buf array.
- (return_handler): add restmask argument (sig_mask value before
- calling signal handler)
- (call_handler): save sig_mask in user's stack before calling signal
- handler, change PulseEvent() call to SetEvent() -- there were
- losses of signal_arrived events if main thread was not in wait
- state.
- (ctrl_c_handler): add support for SIGIO signal.
- * fhandler.cc (fhandler_base::linearize/delinearize):
- save/restore async_ flag
- (fhandler_base::fhandler_base): clear async_ flag
- * fhandler.h: add async_ as new variable in fhandler_base,
- add get_async/set_async functions
- * misc.cc (tgetent): remove stub
- * net.cc (fhandler_socket::write): raise SIGPIPE if write to
- disconnected socket.
- (cygwin32_accept): check the result of find_unused_handle() before
- accept() call, set errno if no more file descriptors available.
- (fhandler_socket::ioctl): add support for async I/O on sockets
- * pinfo.cc (pinfo::clearout): clear sig_pending mask
- * syscalls.cc (readv, writev): rewrite
- * window.cc (WndProc): add support for async I/O
- * winsup.h: define WM_ASYNCIO
-
-Mon Jun 9 18:51:09 1997 Geoffrey Noer <noer@cygnus.com>
-
- * include/winsock.h: fix protection wrapper name
-
-Fri Jun 6 12:41:09 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * include/Windows32/Defines.h: Define CommonDlgExtendedError
- return values (CDERR_*, PDERR_*, CFERR_*, FNERR_*). Define
- TEXTMETRIC tmPitchAndFamily values (TMPF_*).
-
- * include/dlgs.h: New file; just includes windows.h.
- * include/cderr.h: Likewise.
-
- * libcmain.cc (main): Don't pass the program name to WinMain.
-
- * cygwin.din: Export strlwr and strupr.
-
- * include/winreg.h: New file; just includes windows.h.
- * include/winsock.h: New file; just includes windows.h and
- Windows32/Sockets.h.
- * include/Windows32/Sockets.h: Don't define u_char, et. al. if
- _SYS_TYPES_H is defined. Undefine fd_set if it is defined.
-
- * include/Windows32/Functions.h: Define MoveMemory, FillMemory,
- and ZeroMemory as macros.
-
- * times.cc (_timezone, _daylight, _tzname): New global variables.
- (tzset): New function.
- * cygwin.din: Don't set _timezone to timezone. Export tzset and
- _tzset. Export _timezone, _daylight, and _tzname.
-
- * dcrt0.cc (__cygwin_environ): New global variable.
- (dll_crt0_1): Set __cygwin_environ to environ.
- * cygwin.din: Export __cygwin_environ.
-
-Thu Jun 5 17:52:02 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * times.cc (gettimeofday): Check return values and set tz_dsttime
- correctly.
-
-Wed Jun 4 00:04:33 1997 Geoffrey Noer <noer@cygnus.com>
-
- * fhandler.cc (fhandler_pipe::lseek): new virtual function
- * fhandler.h: add lseek to fhandler_pipe class
-
-Tue Jun 3 19:20:47 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * include/Windows32/Defines.h (IMAGE_DOS_SIGNATURE): Define.
- (IMAGE_NT_SIGNATURE): Define.
- * include/Windows32/Structures.h (IMAGE_DOS_HEADER): Define.
-
-Tue Jun 3 13:05:26 1997 Geoffrey Noer <noer@cygnus.com>
-
- * console.cc: respace
- * fhandler.h: add virtual off_t lseek to fhandler_socket and
- fhandler_tty defs, respacing
-
-Mon Jun 3 12:21:20 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * cygwin.din: export wait3, wait4
- * dcrt0.cc (_exit): call fill_rusage
- * exceptions.cc (ctrl_c_handler): increment rusage_self.ru_nsignals++
- * fhandler.cc (fhandler_pipe::fhandler_pipe): new stub
- * fhandler.h: add fhandler_pipe class
- * hinfo.cc (hinfo_vec::build_fhandler): call
- GetNumberOfConsoleInputEvents instead of GetConsoleScreenBufferInfo,
- handle fhandler_pipe class
- * pinfo.cc: include sys/resource.h,
- (pinfo::clearout): erase memory associated with rusage_self
- and rusage_children
- * resource.cc (getrusage): rewrite
- (add_timeval): new helper function
- (add_rusage): new helper function
- (fill_rusage): new helper function
- * shared.cc (create_shared_fd_table): pass file mapping handle to
- children letting them close it
- * spawn.cc (spawn_guts): call fill_rusage and add_rusage as
- appropriate
- (cwait): ditto
- * times.cc (__to_clock_t): add flag arg which says whether or not
- to substract FACTOR from total
- (times): also fill in tms_cstime and tms_cutime, add flag arg to
- __to_clock_t calls
- (totimeval): add extra flag passed on to __to_clock_t
- (gettimeofday): add extra flag passed on to totimeval
- * wait.cc (wait_for_single): add extra rusage arg, change
- wait_found calls to account for extra arg
- (wait_for_any): ditto
- (_wait): call wait4 instead of waitpid
- (wait_found): add rusage arg, deal with it calling add_rusage as
- appropriate
- (wait_pid): now just calls wait4
- (wait4): was wait_pid but adds extra rusage arg and deals with it
- (wait3): new, calls wait4
- * winsup.h: include sys/resource.h, add rusage_self and
- rusage_children to pinfo class, fix totimeval proto, add protos
- for fill_rusage and add_rusage
- * passwd.cc: include termios.h
- (getpass): new
- * stubs.cc (getpass): delete old stub
-
-Tue Jun 3 14:51:47 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * times.cc (ftime): New function.
- * cygwin.din: Export ftime.
-
-Mon Jun 2 14:34:00 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * include/limits.h: NGROUPS_MAX should be 0
- * include/asm/socket.h: add missing additional options
- including SO_SNDBUF, SO_RCVBUF, et al
- * include/sys/wait.h: include sys/resource.h, add protos for
- wait3() and wait4().
-
-Mon Jun 2 15:26:35 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * utils/configure.in: Call AC_PROG_INSTALL.
- * utils/configure: Rebuild.
-
-Mon Jun 2 11:44:14 1997 Geoffrey Noer <noer@cygnus.com>
-
- * grp.cc (getgroups): new
- * cygwin.din: export getgroups
-
-Fri May 30 16:47:38 1997 Geoffrey Noer <noer@cygnus.com>
-
- * uname.cc (uname): completely rewrite, using more of the
- SYSTEM_INFO struct to figure out information (now x86 type is
- set correctly in Windows 95.
- * version.h: increment CYGWIN_DLL_VERSION_MINOR
- * include/Windows32/Structures.h: SYSTEM_INFO struct's first
- member is dwOemId, not dwOemID according to MS docs
-
-Fri May 30 16:47:38 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * window.cc: new file
- * Makefile.in: add window.cc to lists of source, object files,
- and dependencies.
- * console.cc: include <stdlib.h>, scroll_screen() added to
- fhandler_console class,
- add support for default screen attributes,
- (open): set default_color on tty open
- (linearize/delinearize): pass default_color to the child process
- (clear_screen): fix Win95-specific bug, add support for
- default_color.
- (clear_to_eol): remove
- (fhandler_console::fhandler_console): set default_color to
- white on black
- (char_command): add invisible screen attribute, misc changes
- (FakeReadFile): do not convert AltGr-char to ESC-char sequence
- to support international keyboards.
- * cygwin.din: export setitimer, getitimer
- * dcrt0.cc (dll_crt0_1): add call to window_init(), uppercase
- environment vars only if started by a win32 process.
- (_exit): add call to window_terminate()
- * fhandler.cc: add mode argument to open() calls,
- (fhandler_base::open): do not check for symlink in path_conv
- calls, calls to set/get_file_attribute() instead of NTRead/WriteEA.
- (fhandler_base::fstat): use get_file_attribute if possible
- (fhandler_disk_file::open): remove unneeded unixattr checks
- * fhandler.h: changes to support above.
- * fork.cc (cygwin_fork_helper_1): pass umask value to the child,
- call window_init() in child
- * ntea.cc: enable EA calls, add FILE_FLAG_BACKUP_SEMANTICS
- to CreateFile calls to support EA of directories.
- * path.cc (symlink): add mode argument to _open call, remove
- unneeded stuff
- (symlink_check_worker): add checks for "system" attribute and EA.
- * security.cc (get/set_file_attribute): new. Calls EA code now,
- placeholders for NTFS security support.
- * signal.cc (alarm): remove in favor of new implementation in
- window.cc
- (RemoteThread): remove
- (_kill): use window messages to emulate signals on both NT and Win95
- * spawn.cc (spawn_guts): call window_terminate on exec()
- (cwait): correct return result code
- (_spawnve): add umask inheritance, some bug fixes
- * syscalls.cc (_open): add mode argument, umask support
- (umask): rewritten
- (chmod): try to set file attributes, set system bit on symlinks
- (stat_worker): fix nlinks of directories, add mode argument
- to _open() call.
- * syscalls.h: add mode argument to _open() prototype
- * winsup.h: changes to support above
-
-Tue May 27 12:22:19 1997 Geoffrey Noer <noer@cygnus.com>
-
- * times.cc (gettimeofday): return 0 on success instead of 1
- (utimes): init res to 0
-
-Wed May 21 11:29:24 1997 Geoffrey Noer <noer@cygnus.com>
-
- * include/limits.h: define NGROUPS_MAX
-
-Tue May 20 14:13:59 1997 Geoffrey Noer <noer@cygnus.com>
-
- * passwd.cc: rename function setpwend to setpwent (typo)
- * cygwin.din: ditto, also remove name__C9type_info from
- exports list.
-
-Wed May 14 17:38:39 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * signal.cc (sleep): call WaitForSingleObject instead of Sleep
- (usleep): ditto
-
-Wed May 7 15:34:07 1997 Geoffrey Noer <noer@cygnus.com>
-
- Public gnu-win32 beta 18 release made
-
-Sun May 4 15:34:07 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from Mikey <jeffdb@netzone.com>:
- * console.cc (FakeReadFile): FlushConsoleInputBuffer if
- flags & ENABLE_LINE_INPUT and then return ReadFile
-
-Fri May 2 10:53:10 1997 Geoffrey Noer <noer@cygnus.com>
-
- * signal.cc: make exported functions extern "C"
- * include/cygwin32/socket.h: replace values assigned to
- IP_ definitions with ones suitable for use with WinSock.
- * cygwin.din: add exports for sigpending, sigsuspend, remove
- exports for __9type_infoPCc and before__9type_infoRC9type_info
- * winsup.h: remove signal-related protos from winsup.h in favor
- of newlib/libc/include/sys/signal.h
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * signal.cc: (sigpending) new
- (sigsuspend): new
- * utils/termcap: replace with one from Linux
-
-Tue Apr 29 19:03:29 1997 Geoffrey Noer <noer@cygnus.com>
-
- * utils/ps.cc: print Win32 pid as unsigned int so Windows 95
- pids don't show up as negative values
-
-Tue Apr 29 17:20:57 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * spawn.cc (spawn_guts): allocate new cygwin PID for a child
- created with spawn(!_P_OVERLAY)
-
-Tue Apr 29 13:24:59 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * console.cc: assorted console fixes
- * select.cc (fd_socket_map::convert_to_unix_fdset): only
- do full debug_printf if used_ valid
- * exceptions.cc: correct constants used for checking size of
- stack (should be negated)
- * fhandler.cc (fhandler_base::open): fix syscall_printf typo
-
- patch from marcus@cathcart.sysc.pdx.edu (Marcus Daniels):
- * include/sys/mman.h: define MAP_ANON MAP_ANONYMOUS (typo fix)
-
-Mon Apr 28 15:19:44 1997 Geoffrey Noer <noer@cygnus.com>
-
- * cygwin.din: remove libgcc2.a internal functions
-
-Mon Apr 28 14:57:04 1997 Michael Meissner <meissner@cygnus.com>
-
- * cygwin.din (before__9type_infoRC9type_info): Remove, the
- type_info::before(type_info const &) function no longer seems to
- exist.
-
-Mon Apr 28 14:19:44 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * console.cc (undo_input): new
- (scroll_screen): new
- (fhandler_console::output_tcsetattr): fix debug printf
- (fhandler_console::input_tcsetattr): no longer call set_w_binary
- (fhandler_console::cursor_get): fix base_chars
- (fhandler_console::char_command): make savex, savey globals,
- add char buf, add code to handle clears better, many other
- additions
- (fhandler_console::write_normal): assorted fixes
- (fhandler_console::write): move screen scroll code to
- scroll_screen(), support Reset Linux terminal, Restore cursor
- position, Save cursor position, Skip orig_colors
- (FakeReadFile): enlarge keytable to include shift/control/alt
- values
- Command set still missing set pelette, character sets, and
- UTF codes.
-
-Mon Apr 28 12:19:44 1997 Geoffrey Noer <noer@cygnus.com>
-
- * fhandler.cc (fhandler_base::open): only include
- FILE_SHARE_DELETE in shared when running NT (Win 95 doesn't
- support it).
-
-Thu Apr 24 18:57:21 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from Jeremy Allison <jra@cygnus.com>:
- Correct problem caused by setting /dev/null fd to -1 which is
- same as INVALID_HANDLE_VALUE.
- * fhandler.h: set DEV_NULL_HANDLE_VALUE to -2
- * fhandler.cc (fhandler_dev_null::open): set handle to
- DEV_NULL_HANDLE_VALUE instead of INVALID_HANDLE_VALUE
- * hinfo.cc (hinfo_vec::build_fhandler): add case for
- handle == (HANDLE) DEV_NULL_HANDLE_VALUE
-
-Thu Apr 24 15:12:13 1997 Geoffrey Noer <noer@cygnus.com>
-
- * fhandler.cc (fhandler_base::write): catch return of raw_write
- and return -1 if it failed
-
-Thu Apr 24 10:42:01 1997 Geoffrey Noer <noer@cygnus.com>
-
- path.cc (symlink): restore chmod call for now since the NTEA code
- isn't quite up to the task yet.
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * exceptions.cc (ctrl_c_handler): corrections to Apr 18 patch
- * fhandler.cc: ditto
- * dcrt0.cc (dll_crt0_1): move console title setting code,
- set up default signal handlers
- * fork.cc (cygwin_fork_helper1): also set child->sigs and
- child->sig_mask
- * spawn.cc (spawn_guts): if mode _P_OVERLAY, set up child
- signal handlers.
-
-Mon Apr 21 22:29:49 1997 Geoffrey Noer <noer@cygnus.com>
-
- * include/Windows32/ASCIIFunctions.h: remove old def of
- GetEnvironmentStringsA, add new one based on def from Functions.h
- * include/Windows32/Functions.h: define GetEnvironmentStrings as
- GetEnvironmentStringsA when not unicode, remove definition of
- GetEnvironmentStrings in favor of ones in ASCIIFunctions.h and
- UnicodeFunctions.h
- * include/Windows32/Defines.h: add missing XTYP_ definitions,
- change value of XTYPF_NOBLOCK to 0x0002 from 0x2
- * include/Windows32/Sockets.h: comment out redefinitions of
- errno.h-type constants since MS doesn't define them and we
- have our own in errno.h
-
-Fri Apr 18 10:40:30 1997 Geoffrey Noer <noer@cygnus.com>
-
- * include/Windows32/Structures.h: add typedefs for
- LPDLGITEMTEMPLATE, PDLGITEMTEMPLATE.
- * include/Windows32/Defines.h: define FW_REGULAR FW_NORMAL
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * exceptions.cc (ctrl_c_handler): do not reset signal
- handler to SIG_DFL while processing the signal, instead
- block the signal while handler executes.
- * signal.cc (_raise): fixes related to the above
-
-Thu Apr 17 23:50:50 1997 Geoffrey Noer <noer@cygnus.com>
-
- * path.h: increase path length in mount table to MAX_PATH
- in size instad of 30. This will increase cygwin.dll memory
- usage by 20K. We need to remove static allocations from
- path code.
-
-Thu Apr 17 10:11:50 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * exceptions.cc (ctrl_c_handler): CTRL_CLOSE_EVENT should
- generate SIGHUP instead of SIGQUIT
- * signal.cc (_raise): rewrite
-
-Wed Apr 16 10:42:46 1997 Geoffrey Noer <noer@cygnus.com>
-
- * version.h: increment CYGWIN_DLL_VERSION_MINOR
- * syscalls.cc (system): use spawnvp instead of fork/exec
- * ntea.cc: make all functions return false for now; they
- were causing an obscene performance hit
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * console.cc (FakeReadFile): patch to support EINTR, EIO
- * exceptions.cc: add support for return_handler, remove
- control-C counter
- (return_handler): new
- (ctrl_c_handler): handle SIGCHLD, other assorted fixes
- * fhandler.cc (fstat): reset errno to 0
- * passwd.cc (search_for): correct location of a debug printf
- * select.cc: patches to handle signals better, respacing
- * signal.cc (_raise): misc fixes
- (_kill): call OpenProcess with PROCESS_ALL_ACCESS instead of
- PROCESS_TERMINATE
- * spawn.cc: more signal fixes
- * syscalls.cc: add two new errors to errmap[]
- (_stat_worker): fill out buf struct when stating directories
- * wait.cc (wait_for_single): use INFINITE instead of large value
- for timeouts
- (wait_for_any): init nprocinfo to 1, not 0, other small fixes
- * winsup.h: add signal_arrived to per_process class, reduce
- amount of reserved space, add sig_pending to pinfo class
-
-Tue Apr 15 17:01:34 1997 Geoffrey Noer <noer@cygnus.com>
-
- * utils/mkpasswd.c: change default shell to /bin/sh
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * utils/kill.cc: support sending numbered signals using
- signal code instead of just calling TerminateProcess
-
-Tue Apr 15 15:24:55 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * utils/Makefile.in (INSTALL): Set to @INSTALL@.
- (INSTALL_PROGRAM): Set to @INSTALL_PROGRAM@.
- (INSTALL_DATA): Set to @INSTALL_DATA@.
- (INSTALL_XFORM): Remove.
- (install): Depend upon installdirs. Use $(program_transform_name)
- directly, rather than using $(INSTALL_XFORM).
- (installdirs): New target.
-
-Mon Apr 14 16:32:05 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * utils/Makefile.in (INSTALL): Change install.sh to install-sh.
-
-Mon Apr 14 12:33:22 1997 Geoffrey Noer <noer@cygnus.com>
-
- * registry.cc: change key name to "Cygnus Solutions" instead
- of "Cygnus Support"
- * security.cc: don't include windows.h, already in winsup.h
- * Makefile.in: add dependencies section entries for security.cc
- and ntea.cc
-
-Fri Apr 11 00:03:49 1997 Geoffrey Noer <noer@cygnus.com>
-
- * dcrt0.cc: add harmless cast to FreeEnvironmentStrings call
- * registry.cc: added more presumed-harmless casts
- * shared.cc: and another, and respacing
- * utils/Makefile.in: don't need to link with -lkernel32 since it's
- included automatically
- * fhandler.cc: fhandler_console and FakeReadFile moved to
- console.cc, stop including sys/stat.h, sys/param.h, sys/types.h,
- stdio.h, ctype.h, pwd.h, grp.h, stdlib.h
- reordered/respaced code so now we have all of fhandler_base, then
- all of fhandler_disk_file, then all of fhandler_tty, etc...
- (fhandler_base::ioctl): delete unused switch statement
- * console.cc: added fhandler_console and FakeReadFile from
- fhandler.cc, add includes necessary for this code
- * grp.cc, Makefile.in: fix copyright dates
- * ntea.cc: include string.h
-
-Thu Apr 10 22:00:43 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * path.cc (symlink): do NTWriteEA instead of chmod using same
- flags
-
-Thu Apr 10 17:36:43 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from gunther.ebert@ixos-leipzig.de (Gunther Ebert):
- * Makefile.in: add libnetapi32.a to DLL_IMPORTS list, build security.o
- * fhandler.cc (get_file_owner): new
- (get_file_group): new
- (fhandler_base::fstat): do another path_conv and check for error,
- use get_file_owner and get_file_group to set buf->st_uid and
- buf->st_gid
- * fhandler.h: add protos for get_file_owner() and get_file_group()
- * grp.cc (add_grp_line): new helper function
- (read_etc_group): new helper function
- (getgrgid): rewritten, no longer a stub
- (getgrnam): rewritten, no longer a stub
- (endgrent): rewritten, no longer a stub
- (getgrent): rewritten, no longer a stub
- * include/Windows32/ASCIIFunctions.h, include/Windows32/Base.h,
- include/Windows32/Functions.h, include/Windows32/Defines.h,
- include/Windows32/Structures.h, include/Windows32/UnicodeFunctions.h:
- misc security/uid-related additions
- * passwd.cc (add_pwd_line): new
- (read_etc_passwd): new
- (search_for): rewrite
- (setpwend): rewritten, no longer a stub
- (getpwent): rewritten, no longer a stub
- (endpwent): rewritten, no longer a stub
- * security.cc: new file
- (get_world_sid): new
- (world_full_access): new
- (get_id_from_sid): new
- (is_nt): new
- * stubs.cc (endgrent): remove
- (getgrent): remove
- * syscalls.cc (rel2abssd): new
- (set_process_privileges): new
- (chown): now implemented for real for NT, still a stub in Win95
- (_stat_worker): use get_file_owner and get_file_group to set
- buf->st_uid and buf->st_gid
- * uinfo.cc: add protos for read_etc_passwd, read_etc_group
- (uinfo_init): call read_etc_passwd(), read_etc_group()
- * utils/Makefile.in: build mkpasswd, mkgroup
- * utils/mkgroup.c: new, use to make an /etc/group file
- * utils/mkpasswd.c: new, use to make an /etc/passwd file
- * winsup.h: add protos for is_nt(), get_id_from_sid()
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * Makefile.in: build ntea.o
- * dcrt0.cc (dll_crt0_1): move console title code here from spawn_guts
- * exceptions.cc (ctrl_c_handler): small signal fixes, prepare
- things so we can eventually reset the signal handler to SIG_DFL
- * fhandler.cc (fhandler_disk_file::open): first check for EA info
- about exec/symlink status before doing it the hard way
- (fhandler_make_pipe): u->self->hmap.build_fhandler takes extra arg
- (fhandler_base::open): make use of NTEA
- * fhandler.h: remove init_std_file_from_handle, build_fhandler
- protos
- * hinfo.cc: include mywinsock.h and sys/socket.h, define
- __INSIDE_CYGWIN_NET__, __INSIDE_CYGWIN32__
- (hinfo_vec::build_fhandler): takes an additional handle arg,
- call GetConsoleScreenBufferInfo with it to see if are
- fhandler_console, call GetCommState with it to see if we're
- an fhandler_tty, call getpeername with it to see if we wamt
- fhandler_socket. Old determining methods still work too.
- * path.cc (symlink): chmod file to ((S_IFLNK) | (STD_RBITS) |
- (STD_WBITS) | (STD_XBITS)) permissions
- * select.cc: include stdio.h
- (cygwin32_select): fix typo (missing an &),
- assorted fixes for mixed socket/handles case
- * shared.cc (create_shared_fd_table): set sa.bInheritHandle to 1
- to support reparenting
- * signal.cc (_kill): add FIXME, cleanup return codes
- * spawn.cc (spawn_guts): remove console title code, add code
- to support reparenting of child processes
- * syscalls.cc: add new third arg to hmap.build_fhandler calls
- (chmod): make use of NTWriteEA
- * ntea.cc: new file, NTEA handling routines
- * times.cc: fix value of NSPERSEC
- (utimes): fix return value
- * wait.cc: changes to support reparenting, change INFINITE to
- constant 500 to avoid "blocking win32 syscalls and signals"
- problem
- * winsup.h: add NTReadEA, NTWriteEA protos, define REPARENTING,
- fix build_fhandler proto to add new arg, add handles hrProcess and
- hrThread
-
-Tue Apr 9 00:25:33 1997 Geoffrey Noer <noer@cygnus.com>
-
- * libcerr.cc: remove fixed size of sys_errlist array, figure out
- sys_nerr from the sizeof the array rather than hard coding it.
- * shared.cc (open_shared_file_map): add typecast
- * signal.cc (_kill): SIGKILL should avoid exception handler
- * fork.cc (cygwin_fork_helper1): don't call ExitProcess with a
- negative arg on recreate_mmaps_after_fork failure
- * include/Windows32/Defines.h: define VER_PLATFORM_WIN32_WINDOWS
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * dcrt0.cc: move reent_data from private address space to cygwin.dll
- * fork.cc: copy parent's reent_data to the child
- * cygwin.din: export reent_data
- * winsup.h: add as public struct _reent reent_save to pinfo class
-
- another patch from sos@prospect.com.ru (Sergey Okhapkin):
- * winsup.h: add ctrl_c_handler prototype
- * exceptions.cc (init_exceptions): don't use u->self->hThread
- since for a spawned process, this contains thread id of parent
- Win32 process, not the child's. Instead use GetCurrent* funcs
- to get thread handle.
- (ctrl_c_handler): add more signal support, especially for kill
- * signal.cc (_kill): more signal support, using CreateRemoteThread
- under NT. Win95 only supports SIGKILL since it doesn't have this
- call.
- * syscalls.cc (windows_95): first version check should be an &
- of 0x80000000 instead of 0x8000000
- (close_all_files): hmap[i] doesn't always exist, for now comment
- out code
-
- patch from marcus@sysc.pdx.edu (Marcus Daniels):
- * path.cc (skip_n_slashes): new local function
- (symlink_check_worker): new local function, used to be symlink_check
- (symlink_check): calls symlink_check_worker and returns
- whether path is a symlink or not.
- (symlink_expand): new local function, expand a symlink into
- a file or directory path using symlink_check_worker
- (path_conv::path_conv): takes extra follow_mode arg
- (symlink_follow): call symlink_expand
- * fhandler.cc, syscalls.cc: fix path_conv references
- * path.h: fix path_conv prototype
-
-Mon Mar 24 19:44:28 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * select.cc: fix Feb 19 patch to select
- * syscalls.cc: add statfs() and fstatfs() calls
- * include/sys/vfs.h: new header file to support these
- * cygwin.din: add them to dll export list
-
-Tue Mar 18 18:10:24 1997 Geoffrey Noer <noer@cygnus.com>
-
- * dcrt0.cc: change idata3 asm section to have five null fields
- instead of eight to conform to how MS does this section.
-
-Sun Mar 9 13:10:55 1997 Geoffrey Noer <noer@cygnus.com>
-
- * include/sys/resource.h: add missing struct members to rusage struct
- * resource.cc: added setting of missing fields, mostly to 0 until
- we investigate how to set correct values.
-
-Wed Feb 19 17:44:06 1997 Jeremy Allison <jra@cygnus.com>
-
- * select.cc: Added fixes from sos@prospect.com.ru (Sergey Okhapkin)
- to implement blocking select on sockets/handles. This isn't
- the way I finally want to do this, but I won't get chance
- to do the re-write for a month or two so...
- * include/Windows32/Defines.h: Added defines for NT ACL
- stuff.
-
-Tue Feb 18 12:28:11 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * fhandler.cc: support reverse index escapes in console code
-
-Fri Feb 14 18:55:01 1997 Jeremy Allison <jra@cygnus.com>
-
- * path.cc: Fixed normalize_posix_path() so that double slashes
- are removed, except for those starting a UNC path. The command
- ls .///////FILE_IN_DIRECTORY works now.
-
-Thu Feb 13 14:06:04 1997 Geoffrey Noer <noer@cygnus.com>
-
- * path.cc: remove SLASH_P define and
- * winsup.h: define it here instead
- patch from scottk@utig.ig.utexas.edu (Scott Kempf):
- dirsearch.cc (opendir): fix problem with accessing "/"
-
-Mon Feb 10 13:57:11 1997 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * misc.cc: replace nice () stub with Win32 implementation
- * spawn.cc
- * fork.cc: use priority returned by GetPriorityClass
-
-Wed Feb 5 16:56:23 1997 Geoffrey Noer <noer@cygnus.com>
-
- * fhandler.cc, syscalls.cc: minor reformat
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * spawn.cc: set console title to reflect what's running
- * winsup.h: TITLESIZE define added
-
-Mon Feb 3 16:53:10 1997 Geoffrey Noer <noer@cygnus.com>
-
- * fhandler.h: fix typo
- * fhandler.cc: check_execable_p should only take one arg now
-
-Mon Feb 3 16:16:39 1997 Jeremy Allison <jra@cygnus.com>
-
- * fhandler.cc: Removed open_helper, turned it into
- fhandler_base::open and added fhandler_disk_file::open. More
- correct C++.
- fhandler_disk_file: Moved check_execable_p into fhandler_disk_file.
- tty ports are now closed correctly.
- * fhandler.h: Changes to support the above.
-
-Fri Jan 31 19:14:34 1997 Geoffrey Noer <noer@cygnus.com>
-
- * fhandler.cc (fhandler_base::open_helper): new function
- containing the common open() code. symlink and executable
- status defaults to 0.
- (fhandler_tty::open): new function that calls
- fhandler_base::open_helper
- (fhandler_base::open): remove common code now in open_helper,
- leaving symlink checking and executable checking
- * fhandler.h: changes for the above, open_helper is protected
-
-Thu Jan 30 15:23:15 1997 Geoffrey Noer <noer@cygnus.com>
-
- * hinfo.cc: also treat com3 and com4 as special files
- * spawn.cc (spawn_guts): check return of WaitForSingleObject
- in _P_WAIT case, some reformatting
-
-Tue Jan 28 10:46:16 1997 Jeremy Allison <jra@cygnus.com>
-
- * net.cc: Added errors "WSAEINVAL", "WSAEFAULT" as these
- can be returned for net calls.
- * fhandler.cc: Added FILE_SHARE_DELETE to open share modes.
- Much closer to POSIX on NT now (ignored on '95).
-
-Fri Jan 17 13:32:26 1997 Geoffrey Noer <noer@cygnus.com>
-
- * configure.in:
- * utils/configure.in: define LIB_AC_PROG_CC to get around
- autoconf 1.12 problem. Invoke it instead of AC_PROG_CC.
- * configure:
- * utils/configure: regenerate
-
-Thu Jan 16 12:35:41 1997 Geoffrey Noer <noer@cygnus.com>
-
- * mmap.cc: added missing copyright notice
-
-Tue Jan 14 12:51:12 1997 Jeremy Allison <jra@cygnus.com>
-
- * cygwin.din: Added get_osfhandle, cwait and all the
- spawn functions.
- * exec.cc: Added include of process.h. Changed call to
- spawn_guts to add extra parameter.
- * libcerr.cc: Added extra error messages. Ensured
- messages start at zero.
- * spawn.cc: Changed spawn_guts to do wait and nowait
- calls. Added all spawn functions.
- * syscalls.cc: Added get_osfhandle.
- * winsup.h: Removed incorrect spawn definitions,
- corrected prototypes for spawn_guts and file_exists
- calls.
- * include/io.h: New file. Added for get_osfhandle.
-
-Thu Jan 9 14:20:01 1997 Jeremy Allison <jra@cygnus.com>
-
- * exceptions.h: Moved from winsup to winsup/include.
- * include/mywinsock.h: Added getprotobynumber and
- getservbyport.
- * Makefile.in: Moved exceptions.h dependency.
- * cygwin.din: Added cygwin32_getprotobynumber and
- cygwin32_getservbyport.
- * net.cc: Added cygwin32_getprotobynumber and
- cygwin32_getservbyport.
-
-Wed Jan 8 14:15:35 1997 Jeremy Allison <jra@cygnus.com>
-
- * fhandler.cc: Fix from Scott Kempf (scottk@rimu.ig.utexas.edu)
- to ensure creation_disposition is set correctly in open.
-
-Fri Jan 3 12:10:22 1997 Jeremy Allison <jra@cygnus.com>
-
- * fork.cc: Added parameter to recreate_mmaps_after_fork
- in child, and added set_child_mmap_ptr() call in parent.
- Needed as cygwin.dll statics are not copied accros a fork.
- * mmap.cc: Added parameter to recreate_mmaps_after_fork,
- added set_child_mmap_ptr() call.
- * winsup.h: Added mmap_ptr to pinfo struct. Removed obsolete
- comments.
- * Makefile.in: Added -I../libio, needed to rebuild source
- using STL. Also added -nostdinc++ on recommendation of
- Mike Stump (mrs@cygnus.com).
-
-Thu Jan 2 17:23:10 1997 Jeremy Allison <jra@cygnus.com>
-
- * dcrt0.cc: Added a call to initialize winsock on app
- init.
- * fork.cc: Added call so child initializes winsock before
- returning from the fork. This makes many network daemons
- run correctly that did not before (apache soon...).
- * net.cc: Removed calls to checkinit, this is now done on
- app startup. Renamed checkinit to socket_checkinit and
- removed static scope.
- * winsup.h: Added prototype for socket_checkinit().
-
-Thu Jan 2 12:25:06 1997 Jeremy Allison <jra@cygnus.com>
-
- * dcrt0.cc (api_fatal): Check that u and u->self are
- not zero before indirecting through them.
- * fork.cc: Changed security descriptor for fork
- mutexes to allow access by all.
- * pinfo.cc: Changed security descriptor for shared
- area to allow access by all.
- * shared.cc: Added get_null_sd() call to return
- security descriptor allowing access by all. Needed
- when a cygwin32 service is running and also interactive
- cygwin32 apps by the current logged in user.
- * winsup.h: Added prototype for get_null_sd().
diff --git a/winsup/cygwin/ChangeLog-1998 b/winsup/cygwin/ChangeLog-1998
deleted file mode 100644
index aa657e01e..000000000
--- a/winsup/cygwin/ChangeLog-1998
+++ /dev/null
@@ -1,4490 +0,0 @@
-Thu Dec 31 16:50:32 1998 DJ Delorie <dj@cygnus.com>
-
- * mmap.cc: replaced all references to libstdc++ templates with
- inline classes to remove build dependency on libstdc++
-
-Thu Dec 31 00:02:40 1998 Geoffrey Noer <noer@cygnus.com>
-
- * sysdef/uuid.def: remove useless stub.
- * sysdef/oldnames.def: ditto.
- * sysdef/largeint.def: ditto.
- * sysdef/rpcndr.def: ditto.
-
-Wed Dec 30 20:33:09 1998 Geoffrey Noer <noer@cygnus.com>
-
- * utils/cygcheck.cc: clean up misc. warnings relating to
- signed vs. unsigned, char * vs. const char *, etc...
-
-Wed Dec 30 21:41:25 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (do_exit): Remove previous dwProcessId
- change as it presumes too much knowledge about signalling
- in the wrong place in the code.
- * sigproc.cc (sigproc_terminate): Move the dwProcessId
- assignment here but only do it when it is necessary or
- programs will die abnormally.
- * fhandler.h: Add raw_write method to fhandler_serial.
- * fhandler_serial.cc (raw_write): New method. Accommodates
- overlapped I/O that now must be used with serial.
- * utils/kill.cc (main): Allow `0' signal. Just checks
- for existence of process.
-
-Wed Dec 30 00:01:18 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/cygwin/version.h: bump API_MINOR to 8 to mark
- recently exported _ctype_, _sys_errlist, _sys_nerr. Briefly
- describe all API_MINOR changes to date.
-
-Wed Dec 30 01:31:34 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (do_exit): Set myself->dwProcessId so that
- some exit routines will not falsely believe that this
- process has been execed.
- * select.cc (peek_serial): Remove debugging statements.
- * sigproc.cc (sigproc_terminate): Detect state where
- myself->dwProcessId == 0 as indicative of not being
- an exec stub.
-
-Tue Dec 29 21:13:33 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (alloc_stack_hard_way): Fix a couple of thinkos
- in calculating size of the new stack. Just use the size
- passed from the parent.
- (dll_crt0_1): Set up new frame pointers here, if appropriate.
- * fork.cc (fork): Move frame pointer setup into dll_crt0_1.
-
-Tue Dec 29 12:57:38 1998 Geoffrey Noer <noer@cygnus.com>
-
- * utils/mkpasswd.c: Include wchar.h.
- * utils/mkgroup.c: Ditto.
-
-Tue Dec 29 12:53:23 1998 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: remove dep for libcerr.o
-
-Mon Dec 28 22:02:15 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h: Make fhandler_serial io_status public since
- select needs it. Add 'saw_error' field to select_record so
- that select can detect error conditions.
- * fhandler_serial.cc (fhandler_serial::raw_read): Detect
- "operation aborted" error and retry. This seems to indicate
- an attempt to retry an overlapped operation.
- * select.cc (select_stuff::wait): Honor saw_error field when
- appropriate.
- (peek_serial): Rewrite to operate similarly to
- fhandler_serial::raw_read.
- * include/sys/termios.h: CBAUD mask was still not right.
-
-Mon Dec 28 09:09:27 1998 Christopher Faylor <cgf@cygnus.com>
-
- * libcerr.cc: Make obsolete. Move into errno.cc
- * libctype.c: Make obsolete. Use newlib table.
- * Makefile.in: Remove obsolete entries from LIBCOS. Define
- __INSIDE_CYGWIN__ explicitly for .c -> .o compilation.
- * cygwin.din: New exports: _ctype_, _sys_errlist, _sys_nerr.
- * errno.cc: Move _sys_errlist and _sys_nerr here.
- * dlfcn.cc: Reorganize includes to put ctype.h after winsup.h
- so that __INSIDE_CYGWIN__ will be defined for use in ctype.h.
- * fhandler_console.cc: Ditto.
- * fhandler_tty.cc: Ditto.
- * path.cc: Ditto.
- * spawn.cc: Ditto.
-
-Sat Dec 26 00:20:48 1998 Christopher Faylor <cgf@cygnus.com>
-
- patch from Corinna Vinschen <corinna.vinschen@cityweb.de>:
- * include/Windows32/CommonFunction.h: Added proto for
- NetUserChangePassword().
-
-Thu Dec 24 16:15:40 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (dll_crt0_1): Add more debugging output.
- * ioctl.cc (ioctl): Can't use TC[GS]ET ioctls for pty master as
- it conflicts with TIOCPKT.
- * passwd.cc (passwd): Bypass tc[gs]etattr call in favor of appropriate
- method or conversion confusion will result due to attempts to
- appropriately convert to old-style termios structures in tc[gs]etattr.
- * strace.cc (strace_vsprintf): Define t explicitly.
- * termios.cc (tcsetattr): Reorganize to allow meaningful debugging
- output.
- (tcgetattr): Ditto.
-
-Wed Dec 23 15:02:11 1998 Christopher Faylor <cgf@cygnus.com>
-
- * winsup.h: Reorganize include order to allow thread-safe build.
-
-Wed Dec 23 11:45:33 1998 DJ Delorie <dj@cygnus.com>
-
- * strace.cc (strace_microseconds): new function; returns elapsed
- time in microseconds, using performance counters if available.
- (strace_vsprintf): print timestamps and deltas as microseconds,
- not seconds.
-
-Wed Dec 23 11:35:02 1998 DJ Delorie <dj@cygnus.com>
-
- * times.cc (__to_clock_t): Change return value to unsigned long
- long to prevent overflow.
-
-Tue Dec 22 19:37:55 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h: Reflect fhandler_*::init argument reordering.
- Add dup and init methods to fhandler_serial.
- * fhandler.cc (fhandler_base::init): Reorder arguments to mirror
- open().
- * fhandler_console.cc (fhandler_console::init): Ditto. Initialize
- using fhandler_base rather than fhandler_serial as console is
- now being slowly uncouple from fhandler_serial.
- * fhandler_serial.cc (fhandler_serial::fhandler_serial): Set size
- of data structure or suffer strange behavior on exec().
- (raw_read): Add debugging output.
- (fhandler_serial::init): New method.
- (fhandler_serial::open): Detect call from init method and avoid
- calling fhandler_base::open. Don't worry about non-blocking reads
- since they are now handled correctly by _read().
- (fhandler_serial::tcsetattr): Honor ICANON in a kludgey sort of way.
- (fhandler_serial::tcgetattr): Ditto.
- (fhandler_serial::dup): New method. Ensures duplication of all
- elements of fhandler_serial class.
- * fhandler_tty.cc (fhandler_tty_master::init): Reflect init argument
- reordering.
- (fhandler_tty_slave::init): Ditto.
- * hinfo.cc (hinfo::init_std_file_from_handle): Remove unnecessary
- argument.
- (hinfo_init): Reflect change to init_std_file_from_handle.
- (cygwin_attach_handle_to_fd): Use more appropriate types for
- arguments.
- (hinfo::build_fhandler): Add some slop to allocated buffer just
- for paranoia's sake.
- (hinfo::dup2): Avoid dereferencing a NULL pointer when oldfd==newfd.
- * pipe.cc (make_pipe): Reflect init argument change.
- * shared.h: Another immigrant from winsup.h
- * winsup.h: Reflect change to init_std_file_from_handle. Relocate
- a declaration to shared.h so that it can be used in fhandler.h.
- * include/sys/cygwin.h: Reflect change to cygwin_attach_handle_to_fd.
-
-Mon Dec 21 16:22:48 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.cc (fhandler_base::open): Detect serial device as a special
- case requiring an overlapped open.
- * fhandler.h (fhandler_serial): Add several methods. Add new 'fixup after
- fork required' field.
- * fhandler_serial.cc (raw_read): Rewrite to come closer to handling VMIN
- VTIME parameters and to allow EINTR.
- (fhandler_serial::open): Initialize overlapped event here. Make error
- messages more explicit.
- (fhandler_serial::close): Close status event.
- (fhandler_serial::tcsetattr): Store vtime_ as milliseconds. Attempt to
- handle VMIN > 0, VTIME == 0 better.
- (fhandler_serial::fixup_after_fork): Initialize a new event handle after
- a fork.
- (fhandler_serial::de_linearize): Ditto.
- * hinfo.cc (hinfo::fixup_after_fork): Call fork fixer upper if close_on_exec
- of need_fork_fixup set.
-
-Sun Dec 20 16:05:25 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/shellapi.h: replace with stub that includes windows.h
- like similar headers already do.
- * scandir.cc (scandir): add parens around assignment used as truth
- value.
-
-Sat Dec 19 00:42:44 1998 Christopher Faylor <cgf@cygnus.com>
-
- * thread.cc: Fix copyright info.
- * thread.h: Ditto.
- * libcmain.cc: gcc is now more picky about requiring a type
- for main(), so add one.
- * include/pthread.h: Add attribution for net contributor.
-
-Fri Dec 18 19:21:30 1998 Geoffrey Noer <noer@cygnus.com>
-
- * pthread.cc: fix copyright header.
- * shared.h: ditto.
-
-Fri Dec 18 19:21:30 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from Corinna Vinschen <corinna.vinschen@cityweb.de>:
- * cygwin.din: export scandir and alphasort.
- * Makefile.in: add scandir.o to deps
- * scandir.cc: New file with scandir and alphasort implementations.
- * include/cygwin/version.h: bump API_MINOR to 7.
-
-Fri Dec 18 16:44:07 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/pthread.h: clean up, remove C++-style comments,
- remove pthread_getsequence_np proto.
-
-Fri Dec 18 15:26:33 1998 Christopher Faylor <cgf@cygnus.com>
-
- Throughout, prepend cygwin_ to functions that are exported
- as cygwin_* which previously needed to be aliased.
-
- * path.cc (cygwin_conv_to_win32_path): Resolve symbolic links.
- Return success or failure value.
- (cygwin_conv_to_full_win32_path): Ditto.
- (cygwin_conv_to_posix_path): Return success or failure value.
- (cygwin_win32_to_posix_path_list): Ditto.
- (cygwin_posix_to_win32_path_list): Ditto.
- * shared.h: New include file that incorporates parts of
- winsup.h, fhandler_tty.h, path.h, and delqueue.h.
- * Makefile.in: Remove old include files.
- * cygwin.din: cygwin_* aliases are no longer required.
- * libccrt0.cc: Store api_minor in per_process structure.
- * select.cc: Change meaning of second argument to ready_for_read
- to indicate whether read_ahead should be ignored.
- * fhandler.h: Reflect change in second argument to ready_for_read.
- * syscalls.cc (_read): Ditto.
- * termios.cc: Throughout, detect attempt to use old style termios
- structure and convert as appropriate.
- * ioctl.cc (ioctl): Detect use of ioctl requiring termios field
- and call appropriate tc[gs]et* function to handle it.
- * fhandler_console.cc (fhandler_console::ioctl): Remove TC* calls
- that are now handled in main ioctl.
- * fhandler_tty.cc (fhandler_tty_slave::ioctl): Ditto.
- * include/cygwin/version.h: Added TERMIOS defines. Bump API_MINOR
- to 6.
- * include/sys/cygwin.h: Reflect change in return value for some
- cygwin_conv_* calls.
- * include/sys/termios.h: Reformat slightly. Add conversion macros
- for dealing with old style termios structure.
- * include/pthread.h: add
-
-Fri Dec 18 15:03:33 1998 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Cleanup pthread usage.
-
-Fri Dec 18 14:35:59 1998 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Remove obsolete header dependency for
- thread-safe build.
-
-Fri Dec 18 14:16:04 1998 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (sig_handle): Avoid suspending top-level
- processes.
- * trace.cc: Remove unneeded include.
-
-Thu Dec 17 19:19:53 1998 Geoffrey Noer <noer@cygnus.com>
-
- * cygwin.din: remove pthread_getsequence_np, _reent_clib
-
-Thu Dec 17 16:48:15 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/cygwin/version.h: correct two typos in comments
-
-Thu Dec 17 19:11:31 1998 Christopher Faylor <cgf@cygnus.com>
-
- patch from Corinna Vinschen <corinna.vinschen@cityweb.de>:
- * include/Windows32/Defines.h: Add values for using Windows
- function `DeviceIoControl()'.
-
-Thu Dec 17 18:00:34 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (dll_crt0_1): exception_list is not a struct.
- * debug.cc (thread_stub): Ditto.
-
-Thu Dec 17 08:24:37 1998 Christopher Faylor <cgf@cygnus.com>
-
- * cygwin.din: Remove leading underscores from pthread functions.
- * include/cygwin/version.h: Bump DLL major version to 21, DLL minor
- version to 0, and API_MINOR to 5.
-
-Wed Dec 16 22:54:16 1998 Christopher Faylor <cgf@cygnus.com>
-
- Merge in thread-safe branch changes.
-
-Wed Dec 16 22:54:16 1998 Christopher Faylor <cgf@cygnus.com>
-
- * pthread.cc: Include winsup.h.
-
-Wed Dec 16 22:54:16 1998 Christopher Faylor <cgf@cygnus.com>
-
- * thread.cc: Reformat.
- * pthread.cc: New file.
- * cygwin.din: Add pthread interface functions
-
-Wed Dec 16 22:54:16 1998 Christopher Faylor <cgf@cygnus.com>
-
- * configure.in: Add some --enable options.
- * configure: Regenerate.
- * Makefile.in: Reorganize CFLAGS to recognize new --enable options.
-
-Wed Dec 16 22:54:16 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fork.cc (stack_base): Store slightly different information
- in child_info_fork structure for later use in alloc_stack_hard_way.
- (fork): Set frame pointer information if stack has been reallocated.
- * dcrt0.cc (alloc_stack_hard_way): Reflect change in
- child_info_fork structure.
- (dll_crt0_1): Make thread initializers "static" and NO_COPY or death
- of the main thread causes death of other threads.
- * winsup.h (child_info_fork): Change structure.
-
-Wed Dec 16 22:54:16 1998 Christopher Faylor <cgf@cygnus.com>
-
- * thread.h: Remove extraneous declaration.
- * include/sys/strace.h: Make a new thread_printf function
- for use by new thread-safe code.
- * thread.cc: Use thread_printf throughout.
-
-Wed Dec 16 22:54:16 1998 Christopher Faylor <cgf@cygnus.com>
-
- patch from Marco Fuykschot (marco@ddi.nl)
- * Throughout sources add locking control for preliminary
- thread-safe cygwin operation.
-
-Wed Dec 16 22:54:16 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (getprogname): Should be a static.
- (alloc_stack): Extend to allow forking from another
- thread.
- (alloc_stack_hard_way): New function used by alloc_stack.
- (dll_crt0_1); Don't pass parameters since stack may be
- "funny". Use statics instead. Move fork/spawn checking
- into dll_crt0.
- (dll_crt0): Do fork spawn checking here. alloc_stack()
- will call dll_crt0_1 if forked from a non-main thread.
- * fork.cc (stack_base): New function determines base
- (and other values) of this thread's stack.
- (fork): Use new PROC_FORK1 method for forking. Provides
- more data to forkee. Use stack_base to set stack
- values.
- * winsup.h (child_info_fork): Changes for PROC_FORK1.
-
-Wed Dec 16 16:15:29 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/shellapi.h: fix typo in DragQueryPoint proto.
-
-Mon Dec 14 12:37:43 1998 Geoffrey Noer <noer@cygnus.com>
-
- * net.cc: minor respacing
- (get_ifconf): new local function, combines get_winnt_ifconf and
- get_win95_ifconf.
- (get_win95_ifconf): delete
- (get_winnt_ifconf): delete
- (fhandler_socket::ioctl): adjust ifconf calls in light of above,
- check returned value for safety.
- * include/cygwin/version.h: bump CYGWIN_VERSION_API_MINOR to 4
- in honor of newly supported socket ioctls.
-
- patch from Corinna Vinschen <corinna.vinschen@cityweb.de>:
- * include/asm/socket.h: Added defines for ioctl() calls
- SIOCGIFADDR, SIOCGIFBRDADDR and SIOCGIFNETMASK.
- * net.cc (get_winnt_ifconf): Check the registry entries
- instead of just calling get_win95_ifconf(). Added what argument
- to support the new ioctl() calls.
- (get_win95_ifconf): Check the Windows 9x registry entries as
- described by Tim Newsham.
- (fhandler_socket::ioctl): Support the ioctl() commands
- SIOCGIFADDR, SIOCGIFBRDADDR and SIOCGIFNETMASK.
- (get_if_flags): Check for a down interface.
-
-Wed Dec 9 18:11:31 1998 Geoffrey Noer <noer@cygnus.com>
-
- * fhandler.cc (fhandler_disk_file::open): check for shell scripts
- regardless of Win32 OS type.
-
-Sun Dec 6 19:38:11 1998 Christopher Faylor <cgf@cygnus.com>
-
- patch from Corinna Vinschen <corinna.vinschen@cityweb.de>:
- * fhandler_console.cc (fhandler_console::tcgetattr): Fix typo.
- ISIG should be ored with c_lflag.
-
-Tue Dec 1 16:28:56 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/utmp.h: delete, moved to newlib/libc/sys/cygwin/sys.
-
-Thu Dec 3 15:41:51 1998 Geoffrey Noer <noer@cygnus.com>
-
- Released 20.1 update.
-
-Thu Dec 3 22:24:18 1998 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (set_process_mask): Add `sync' parameter
- to control whether signals should be synched on exit.
- (handle_sigsuspend): Provide second argument to set_process_mask -
- don't sync.
- (call_handler): Ditto for asm handler.
- * signal.cc (sigprocmask): Ensure that signals are synchronized
- by calling set_process_mask with sync == 1.
- * sigproc.cc (__release_signal_mutex): Third argument is not
- strictly a BOOL, so change it.
- * sigproc.h: Reflect above parameter changes.
-
-Thu Dec 3 15:30:44 1998 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (peek_console): Work around NT bug that
- caused strange behavior with ReadFile after this
- function was invoked.
-
-Tue Dec 1 14:43:35 1998 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (sigproc_init): Set maintid and signal_mutex early
- to avoid races in wait_sig initialization.
- (__get_signal_mutex): Improve debug output.
- (__release_signal_mutex): Ditto.
- * spawn.cc (spawn_guts): Allocate more space for string when building
- up from #! and absolute path is not known. Otherwise weird stuff
- like infinite recursion or unknown file errors occur.
-
-Tue Dec 1 08:34:18 1998 Christopher Faylor <cgf@cygnus.com>
-
- * mkvers.sh: Accommodate lack of timezone in date output so that
- year shows up correctly.
-
-Mon Nov 30 14:30:51 1998 Jeff Johnston <jjohnstn@cygnus.com>
-
- * times.cc (times): Altered function so that on non-Windows-NT systems
- it does not use the GetProcessTimes() API which is not supported.
-
-Mon Nov 30 00:38:54 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc: Fix incorrect use of struct on exception_list
- typedef.
- * debug.cc (thread_stub): Ditto.
- * dll_init.cc: Ditto.
- * include/Windows32/Structures.h: Correct typo where
- typedef SYSTEM_POWER_STATUS was being used as a struct.
-
-Sun Nov 29 22:03:17 1998 Christopher Faylor <cgf@cygnus.com>
-
- patch from Corinna Vinschen <corinna.vinschen@cityweb.de>:
- * fhandler_console.cc (fhandler_console::ioctl):
- Added ioctl commands TCGETA, TCSETA, TCSETAW, TCSETAF.
-
-Fri Nov 27 22:30:58 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h: Set aside NOEINTR bit. When this is set
- cygwin will not allow the read on this device to be
- interrupted by a signal.
- * pipe (_pipe): Set NOEINTR bit for read end of pipes
- created using this method. The vague rationale for this
- is that these pipes are supposed to be more like Windows
- pipes than UNIX pipes.
- * syscalls.cc (_pipe): Honor NOEINTR flag.
- * getopt.c: Clean up some gcc warnings.
- * libcerr.c: Ditto.
-
-Fri Nov 27 21:56:03 1998 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (SIG_NONMASKABLE): Update for new signal
- mask method.
- (handle_sigsuspend): Release of signal mutex must be
- synchronous -- the signal must be delivered before the
- function returns. Otherwise, there will be races in
- the caller code.
- * sigproc.cc (sigproc_terminate): Minor cleanup.
-
-Thu Nov 26 20:26:17 1998 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (call_handler): Attempt to work around
- potential race when setting signal_arrived. This
- particularly affects sigsuspend.
- (handle_sigsuspend): Reset signal_arrived prior to
- grabbing the mutex. This should reduce the probability
- of a race.
- * sigproc.cc (sig_send): Don't reset signal_arrived in
- the SIGSUSPEND case since this could introduce a race.
-
-Thu Nov 26 12:19:16 1998 Christopher Faylor <cgf@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * select.cc (MAKEready): Don't wait for signal prior to
- testing for read. That introduces an unnecessary delay.
-
-Wed Nov 25 23:03:47 1998 Christopher Faylor <cgf@cygnus.com>
-
- * winsup.h: Make `isdirsep' an alias for SLASH_P.
- Implement isabspath convenience macro.
- Change sigprotect to a macro since it appears to
- be impossible to send __FILE__ type macros to a
- constructor. Change use of sig_protect throughout.
- * dcrt0.cc (dll_crt0_1): Use new path macro.
- * dlfcn.cc (get_full_path_of_dll): Ditto.
- * path.cc (path_conv::path_conv): Ditto.
- (normalize_posix_path): Ditto.
- (slashify): Ditto.
- (backslashify): Ditto.
- * syscalls.cc (num_entries): Ditto.
- * lock.cc: Redefine lock methods to pass debug info to
- {get,release}_signal_mutex.
- * environ.cc (environ_init): Correct strncmp test for
- TERM=, otherwise it's impossible to set TERM.
- * exceptions.cc: Eliminate lock_cs and unlock_cs macros.
- Use {get,release}_signal_mutex throughout.
- (signal_init): Don't initialize signal_mutex here.
- (set_process_mask): Remove vestiges of old mutex code.
- (handle_sigsuspend): Ditto.
- (call_handler): Move signal_arrived SetEvent back here.
- It was being triggered too often before.
- Detect when the signal thread is exiting.
- (sig_handle): Remove inappropriate SetEvent(signal_arrived).
- (events_terminate): Move close of signal_mutex elsewhere.
- * glob.cc: Increase "MAXPATHLEN" size for arguments that
- are not necessarily pathnames.
- * pinfo.cc (lpfu): Lower timeout for reporting possible
- problem with INFINITE wait.
- * sigproc.cc (wake_wait_subproc): Make this a macro with
- no arguments so that its use in the code is a little
- clearer.
- (proc_terminate): Eliminate signal blocking here since
- this should already be handled by the caller.
- (sigproc_init): It makes sense to initialize signal_mutex
- here, so do so.
- (__allow_sig_dispatch): Rename. Take debugging arguments.
- Pass arguments on to release_signal_mutex.
- (__block_sig_dispatch): Rename. Take debugging arguments.
- Pass arguments on to get_signal_mutex. Detect signal
- thread exiting confition.
- (__get_signal_mutex): Take debugging arguments. Maintain
- a stack of nested mutex calls for later display in
- __release_signal_mutex. Detect signal thread exit
- condition. Don't bother with locking if signal thread is
- executing or if just an exec stub.
- (__release_signal_mutex): Don't bother with locking if signal
- thread is executing or if just an exec stub.
- * sigproc.h: Reflect renamed functions above. Provide
- wrappers to pass in diagnostic information.
- * spawn.cc (spawn_guts): More fixes to deal with nested
- #! and to properly report posix argv[0] when invoked as a
- script.
-
-Wed Nov 25 12:41:12 1998 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Reinstate libwinspool.a/winspool.drv creation.
-
-Tue Nov 24 18:48:56 1998 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: add CFLAGS_COMMON and CFLAGS_CONFIG to CFLAGS
- and CXXFLAGS in FLAGS_TO_PASS.
-
- * include/sys/select.h: new file with select proto. Avoid
- potential conflict with Winsock inclusion by Cygwin internals.
- * include/sys/socket.h: remove select proto.
- * winsup.h: define __INSIDE_CYGWIN__. Include windows.h after
- Unix include files.
- * include/mywinsock.h: delete file
- * include/Windows32/Sockets.h: add ndef __INSIDE_CYGWIN__s
- around portions that conflict with Unix definitions. This
- yields what used to be mywinsock.h which is a blend of Unix
- sockets and Winsock needed by Cygwin internals.
- * exceptions.cc: define Win32_Winsock to include
- Windows32/Sockets.h. No longer define __INSIDE_CYGWIN__.
- * hinfo.cc: ditto
- * net.cc: ditto
- * select.cc: ditto
-
- * include/exceptions.h: change wrapper define to _EXCEPTIONS_H.
- * include/sys/resource.h: move includes outside __cplusplus check.
- * include/sys/wait.h: ditto.
-
-Sun Nov 22 23:33:19 1998 Geoffrey Noer <noer@cygnus.com>
-
- * sigproc.cc (__release_signal_mutex): revert Nov 3d change.
-
-Sun Nov 22 17:04:44 1998 Christopher Faylor <cgf@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * regexp/Makefile.in: Add additional bits necessary to
- allow correct installation of include file.
-
-Fri Nov 20 17:04:48 1998 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Set "Warn about writable strings" option in CFLAGS.
- * fhandler_tty.h: Fix for writable strings detection.
- * grp.cc (add_grp_line): Ditto.
- * mkvers.sh: Ditto.
- * path.h: Ditto.
- * registry.cc: (reg_key::reg_key): Ditto.
- * smallprint.c (__small_vsprintf): Ditto.
- * tty.cc (tty::get_event): Ditto.
- * winsup.h: Give up on read_ready_thread. Move sig_protect
- here since it needs to use information set up after the sigproc.h
- include.
- * dcrt0.cc: Ditto.
- * debug.cc (WFSO): New function. Used to ensure that
- function shows up on stack trace.
- (WFMO): Ditto.
- * debug.h: Define the above.
- * exceptions.cc (ctrl_c_handler): Record last signal
- for signal handler.
- * select.cc (MAKEready): New macro for constructing
- fhandler_*::ready_for_read function.
- (fhandler_*::ready_for_read): Use macro to construct this
- method throughout.
- * sigproc.cc (sig_send): Work around race on process termination
- where the event being waited for may disappear.
- (sigproc_terminate): #ifdef code here that attempted to deal with
- the above condition in sig_send.
- * sigproc.h: Move sig_protect to winsup.h.
- * spawn.cc (perhaps_suffix): Don't return pointer into an
- automatic variable.
- (find_exec): Always point known_suffix to something.
- * syscalls.cc (read_handler): Refine debug output.
- (read_ready_thread): Delete.
- (_read): Eliminate use of read_ready_thread. Call ready_for_read
- directly as appropriate.
-
-Thu Nov 19 15:26:40 1998 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: remove -Wunused since that's already in -Wall
- * dlfcn.cc (check_path_access): rename winenv arg to mywinenv
- * path.cc (symlink): change save_errno var to saved_errno
- * spawn.cc (find_exec): rename winenv arg to mywinenv
- (spawn_guts): rename sigprotect handle to starting_here
- * winsup.h: remove trailing comma from process_state flags
- enum
- * utils/aclocal.m4: regenerate
- * utils/configure: regenerate
-
-Thu Nov 19 11:16:38 1998 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Use correct libpthread.a target when
- thread-safe is enabled.
-
-Thu Nov 19 10:49:27 1998 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (path_conv): Correct error reporting.
-
-Wed Nov 18 20:07:50 1998 Geoffrey Noer <noer@cygnus.com>
-
- * utils/Makefile.in: remove termcap file install rule
-
-Wed Nov 18 18:14:18 1998 Geoffrey Noer <noer@cygnus.com>
-
- More minor cleanup:
- * environ.cc (winenv): don't define len twice.
- * fork.cc (sync_with_parent): should NOT use rc since
- this is a macro and that could have interfered with rc in
- the calling function. Renamed to psync_rc.
- * fhandler_serial.cc (fhandler_serial::open): change
- access to myaccess since it shadows global decl.
- * hinfo.cc: ditto throughout
- * path.cc: ditto throughout
- (path_conv::path_conv): change error to err.
-
-Wed Nov 18 16:17:58 1998 Geoffrey Noer <noer@cygnus.com>
-
- * profil.c: include stdio.h
- (print_prof): comment out unused func
- (profile_ctl): should return an int
-
-Wed Nov 18 16:17:58 1998 Geoffrey Noer <noer@cygnus.com>
-
- * utils/ps.cc: include sys/cygwin.h, make pname buf
- MAXPATH in size.
-
- patch from Corinna Vinschen <corinna.vinschen@cityweb.de>:
- * utils/ps.cc (main): converting windows paths to posix
- paths in output.
-
-Wed Nov 18 15:34:46 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/wchar.h: include stddef.h.
-
-Wed Nov 18 17:39:15 1998 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (environ_init): Fix incorrect TERM= detection.
-
-Tue Nov 17 17:28:09 1998 Geoffrey Noer <noer@cygnus.com>
-
- * gcrt0.c: include stdlib.h, add proto for monstartup.
-
-Tue Nov 17 16:47:42 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/wchar.h: add protos for wcslen and wcscmp.
- * syscalls.cc: minor reformat.
-
-Tue Nov 17 15:38:45 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.cc (fhandler_base::fhandler_base): Default non-disk
- devices to binary mode.
- * fhandler.h: Reformat slightly.
-
-Tue Nov 17 11:19:23 1998 Christopher Faylor <cgf@cygnus.com>
-
- * external.cc (fillout_pinfo): Copy progname using strcpy to
- save on time.
- * path.h: Add new enums for more fine-grained control
- of path_conv.
- * dir.cc (opendir): Use enum argument to path_conv.
- (mkdir): Ditto.
- (rmdir): Ditto.
- * dlfcn.cc (get_full_path_of_dll): Ditto.
- * fhandler.h: Add new set_readahead_valid to set actual
- readahead.
- * fhandler.cc (raw_read): Remove extraneous variable.
- (fhandler_base::read): Rework to allow readahead when
- not text mode.
- (fhandler_disk_file::fstat): get_symlink_p() only returns
- true/false now.
- (fhandler_disk_file::fhandler_disk_file): Use enum argument
- to path_conv.
- (fhandler_disk_file::open): Ditto.
- * spawn.cc (perhaps_suffix): Ditto.
- * syscalls.cc (_unlink): Ditto.
- (_link): Ditto.
- (stat_worker): Ditto.
- (_rename): Ditto.
- * fhandler_serial.cc (fhandler_serial::open): Always reset timeouts.
- * path.cc (path_conv::path_conv): Honor new enum arguments.
- Specifically, use SYMLINK_CONTENTS for readlink interface.
- (readlink): Use SYMLINK_CONTENTS argument to path_conv.
- * select.cc: Rework serial support which has apparently never
- worked.
-
-Mon Nov 16 16:15:20 1998 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: FLAGS_TO_PASS should pass CFLAGS and CXXFLAGS
- not ALL_CFLAGS and ALL_CXXFLAGS. Rework handling of CFLAGS
- variables to remove duplication and make it possible to
- build mingw directory.
-
-Mon Nov 16 09:40:21 1998 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (_open): Use new macro to check for
- NULL or empty pathname and return appropriate error.
- * path.cc (check_null_empty_path*): Move macro to
- path.h.
- * path.h: Move macros here.
-
-Sun Nov 15 20:23:10 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/cygwin/version.h: bump API_MINOR to 3 to mark
- addition of dll_noncygwin_dllcrt0 to exports list.
-
-Sun Nov 15 23:05:21 1998 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (check_null_empty_path): New macro.
- (check_null_empty_path_errno): Ditto.
- (path_conv::path_conv): Check for NULL and empty
- path names here and set appropriate error.
- (conv_to_win32_path): Ditto.
- (conv_to_full_win32_path): Ditto.
- (conv_to_posix_path): Ditto.
- (conv_to_full_posix_path): Ditto.
- (mount_info::conv_wo_win32_path): Back out previous
- change.
- (mount_info::conv_to_posix_path): Ditto.
-
-Sun Nov 15 19:29:19 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/limits.h: define CHILD_MAX to be 63.
- * sysconf.cc (sysconf): return CHILD_MAX when asked for
- instead of _POSIX_CHILD_MAX.
-
-Sun Nov 15 18:25:22 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from Mumit Khan <khan@xraylith.wisc.edu>:
- * path.cc (mount_info::conv_to_posix_path): Handle NULL and
- empty pathnames.
- (mount_info::conv_to_win32_path): Likewise.
-
-Sun Nov 15 18:09:06 1998 Geoffrey Noer <noer@cygnus.com>
-
- * cygwin.din: export dll_noncygwin_dllcrt0.
- * {libccrt0.cc, winsup.h}: minor reformat.
-
-Sat Nov 14 22:14:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (environ_init): Use sizeof for string lengths
- rather than hard-coded values.
-
- patch from Mumit Khan <khan@xraylith.wisc.edu>:
- * dll_init.cc (dll_foreign_dllcrt0): Rename to
- dll_noncygwin_dllcrt0.
- * winsup.h: Ditto.
- * include/cygwin/cygwin_dll.h: Ditto.
-
-Sat Nov 14 14:09:33 1998 Christopher Faylor <cgf@cygnus.com>
-
- * hinfo.cc (hinfo::de_linearize_fd_array): Reset first fd
- for open to zero after an exec.
-
-Sat Nov 14 01:29:23 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fork.cc (fork): No need for intermediate jmp_buf variable.
-
- patch from Mumit Khan <khan@xraylith.wisc.edu>:
- * libccrt0.cc (cygwin_attach_foreign_dll): New function.
- * dll_init.cc (dll_foreign_dllcrt0): New function to initialize
- DLLs loaded by non-cygwin apps.
- (dll_dllcrt0_1): Initialize process table entry.
- (dll_dllcrt0): Revert last change to do partial initialization.
- * winsup.h (dll_foreign_dllcrt0): Prototype.
- * include/cygwin/cygwin_dll.h (_cygwin_foreign_dll_entry): New
- entry point that does partial initialization for non-cygwin apps.
-
-Fri Nov 13 16:17:28 1998 Geoffrey Noer <noer@cygnus.com>
-
- Assorted -Wall cleanup:
- * utils/mount.cc (show_mounts): remove unused var i.
- * utils/cygcheck.cc (dll_info): comment out unused var ofs.
- (dump_sysinfo): return a void, not an int. Comment out unused
- var len in two places. Add parens around assignment used as
- truth value.
- * utils/kill.cc (main): remove unused var i
- * utils/mkpasswd: include <ctype.h> and <stdlib.h>.
- (enum_users): remove unused var rc.
- (enum_local_groups): ditto.
- * utils/ps.cc (main): Add parens around assignments used as
- truth values.
- * utils/mkgroup.c: include <ctype.h> and <stdlib.h>.
- (enum_groups): return void, not int. Remove unused var rc.
- * gmon.c: include <stdio.h> and <unistd.h>.
- (_mcleanup): remove unused vars buf and profdir.
-
-Fri Nov 13 16:17:28 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from Corinna Vinschen <corinna.vinschen@cityweb.de>:
- * include/sys/sysmacros.h: new file, define major, minor, makedev
-
-Fri Nov 13 17:03:52 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc: Reflect a variable name change.
- * fhandler.h: *::ready_for read takes an additional argument.
- * fhandler_console.cc (get_non_ascii_key): New function derived
- from fhandler_console::read1.
- (fhandler_console::read1): Use new function.
- * select.cc (*::ready_for_read): Add new "nonblocking" argument.
- (peek_console): Be more diligent in detecting when a usable
- character has been entered or false positives will be returned.
- (fhandler_tty_common::ready_for_read): Detect attempt to perform
- a "background" read.
- * syscalls.cc (read_handler): Remove code for dealing with slow
- devices. Just deal with non-blocking here.
- (read_ready_thread): Renamed function. Rewritten to only detect
- when an fd has data ready to be read. Actual reads happen in
- the main thread.
- (_read): Rely on read_handler to read data for everything. Use
- the read_ready_thread to indicate when data is ready to be read.
- Gut the read_thread_info class since it no longer needs to return
- much information.
- * winsup.h: Reflect above changes to read_thread_info. Rename
- to read_ready_thread_info.
-
-Fri Nov 13 15:09:26 1998 Christopher Faylor <cgf@cygnus.com>
-
- patch from Corinna Vinschen <corinna.vinschen@cityweb.de> and
- Ron Parker <rdparker@butlermfg.org>:
- * path.cc (mount_info::conv_to_win32_path): Refined recognition of
- UNC devices.
-
-Fri Nov 13 12:37:00 1998 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Fix a typo.
-
-Fri Nov 13 10:59:43 1998 DJ Delorie <dj@cygnus.com>
-
- * Makefile.in: "make" uses new "ld -shared" by default internally.
-
-Fri Nov 13 00:58:38 1998 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (find_exec): Make sure that return value is correct
- in all cases. Document.
- * fhandler.h (fhandler_tty_common): Give unit number to constructor.
- * fhandler_tty.cc (fhandler_tty_slave::fhandler_tty_slave): Give
- unit number to descriptor. Create correct UNIX path name for
- tty so that ttyname() will work correctly.
- * select.cc (fhandler_tty_common::ready_for_read): Don't worry
- about read_for_read since the tty read routines are already
- interruptible.
- * syscalls.cc (_read): Reset read thread events on signal.
-
- patch from Mumit Khan <khan@xraylith.wisc.edu>:
- * dlfcn.cc (ctype.h): Include.
- (check_access): Document.
- (check_path_access): Document.
- (get_full_path_to_dll): Rework to handle general filenames and
- symlinks.
-
-Thu Nov 12 17:01:52 1998 DJ Delorie <dj@cygnus.com>
-
- * Makefile.in (shared): "make shared" uses the new "ld -shared"
- * cygwin.din: add LIBRARY and BASE tags for "ld -shared"
-
-Wed Nov 11 17:16:17 1998 Christopher Faylor <cgf@cygnus.com>
-
- * configure.in: Add --enable options for various cygwin defines
- including preliminary thread-safe defines.
- * configure: Regenerate
- * Makefile.in: Honor new --enable options.
- * glob.h: Move BSD defines to sys/cdefs.h.
- * include/sys/cdefs.h: Move __P definition here.
-
-Wed Nov 11 14:00:45 1998 DJ Delorie <dj@cygnus.com>
-
- * cygwin.din (getpwnam): remove duplicates
-
-Tue Nov 10 18:27:09 1998 Geoffrey Noer <noer@cygnus.com>
-
- * utils/aclocal.m4: regenerate with aclocal
- * utils/configure.in: don't call AM_CYGWIN32
- * utils/configure: regenerate
-
-Tue Nov 10 15:56:03 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from Gary V. Vaughan <gvaughan@oranda.demon.co.uk>:
- * dlfcn.cc (dlopen): return an introspective handle to the
- current module if name arg is NULL. The Single UNIX
- Specification, Version 2 has this as a requirement.
-
-Mon Nov 9 16:29:27 1998 Geoffrey Noer <noer@cygnus.com>
-
- * errno.cc (strerror): all errnos in
- newlib/libc/include/sys/errno.h are now listed here.
-
-Mon Nov 9 16:29:27 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/cygwin/version.h: up DLL version, bump API_MINOR to 2
- to mark following change.
-
- patch from Mumit Khan <khan@xraylith.wisc.edu>:
- * cygwin.din: add exports for some of the newlib bessel
- functions (j1, jn, y1, yn).
-
-Mon Nov 9 15:10:06 1998 Geoffrey Noer <noer@cygnus.com>
-
- * syscalls.cc (_link): rewrite FIXME.
-
-Mon Nov 9 14:51:03 1998 Geoffrey Noer <noer@cygnus.com>
-
- * errno.cc (strerror): add string for EDEADLOCK.
-
- patch from Corinna Vinschen <corinna.vinschen@cityweb.de>:
- * errno.cc (errmap[]): add END_OF_MEDIA and additional Win32
- error codes.
-
-Sun Nov 8 21:28:01 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h: fhandler_pipe cannot be is_slow under
- Windows9[58]. There is no way to check for EOF on a pipe
- without performing a read on that system.
- * syscalls.cc (read_handler): Don't check for ready_for_read
- unless this is a "slow" device.
- * winsup.h: Reorganize to accomdate fhandler.h requirement
- for os_type.
-
-Sat Nov 7 23:27:05 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h (fhandler_console): Add a new function declaration.
- * fhandler_console.cc (fhandler_console::read1): New function
- renamed from console_read to allow use of class fields.
- Detect readahead situation when doing line buffering and
- buffer does not contain \n.
- (fhandler_console::read): Reflect function name change.
- * select.cc (cygwin_select): Changes for better handling
- of < 1000 usec timeouts.
- (select_stuff::wait): Perform a poll on timeout to
- set any fd's that may have become active.
- (peek_pipe): More debugging. Honor write_ready if set.
- (peek_console): Can't always use WaitForSingleObject.
- Detect readahead conditions set in fhandler_console::read1.
- Honor write_ready if set.
- (peek_windows): Honor write_ready if set.
- * times.cc (__to_clock_t): Return clock_t value.
- (times): Add some debugging printfs.
-
-Fri Nov 6 20:15:20 1998 Christopher Faylor <cgf@cygnus.com>
-
- patch from Corinna Vinschen <corinna.vinschen@cityweb.de>:
- * spawn.cc (spawn_guts): find_exec() argument mismatch
- resulted in inability to run !# scripts which did not
- begin with '/'.
-
-Tue Nov 3 16:12:59 1998 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (handle_exceptions): Don't wait for signal
- completion.
- (ctrl_c_handler): Ditto.
- * fhandler.h (fhandler_*): Declare new ready_for_read functions.
- * select.cc: Reorganize all methods into a peek_*, a poll_*,
- and a fhandler_*::ready_for_read. This is to allow the _read
- function to query the state of an fd without starting a thread.
- * signal.cc (kill_worker): If sending a signal from a non-main thread
- don't wait for completion.
- * sigproc.h (myself_nowait_nonmain): New define for use by sig_send.
- * sigproc.cc (sig_send): Honor myself_nowait_nonmain. Don't wait
- if not in main thread.
- (__release_signal_mutex): Revert to calling ReleaseMutex only
- once or mutex is released prematurely.
- * syscalls.cc (read_handler): Use new ready_for_read method to
- determine if an fd has data for reading. This function optionally
- blocks until there is data to read.
- (read_helper): Add debugging statement.
- (_read): Move signal_arrived reset to before sig_protect to avoid
- a race. Force read_handler thread to longjmp back to read_handler
- function on signal.
-
-Tue Nov 3 12:18:31 1998 DJ Delorie <dj@cygnus.com>
-
- * utils/cygcheck.cc (dump_sysinfo): Note when not finding a
- program (like cpp) on the path is a good thing.
-
-Tue Nov 3 01:26:08 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from Kazuhiro Fujieda <fujieda@jaist.ac.jp>:
- * environ.cc (environ_init): correct size arg to parse_options
-
-Mon Nov 2 21:40:32 1998 Christopher Faylor <cgf@cygnus.com>
-
- * regexp/regexp.c (regatom): Respond to compiler warning.
-
-Mon Nov 2 21:36:48 1998 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (handle_exceptions): cygwin should not
- print exception information if the exception is trapped
- via signal().
- Also use consistent timings for lock_cs() throughout.
-
-Mon Nov 2 16:46:28 1998 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: For now, also include newlib/libc/sys/cygwin.
- Eventually will stop including newlib/libc/sys/cygwin32.
-
-Mon Nov 2 19:38:30 1998 Christopher Faylor <cgf@cygnus.com>
-
- patch from Corinna Vinschen <corinna.vinschen@cityweb.de>:
- * syscall.cc (gethostname): function deleted
- * net.cc (gethostname): new function 'gethostname' which
- first calls wsock32::gethostname and only if it fails,
- calls GetComputerNameA.
-
-Wed Oct 28 17:57:53 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/cygwin/version.h: up DLL version to 20.0 in honor
- of new Net release.
-
-Wed Oct 28 17:57:53 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from Mumit Khan <khan@xraylith.wisc.edu>:
- * dll_init.cc (doGlobalCTORS): Fix invocation order.
- (doGlobalDTORS): Likewise.
-
-Wed Oct 28 17:57:53 1998 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: add include/exceptions.h to dll_init.cc deps.
-
- patch from Mumit Khan <khan@xraylith.wisc.edu>:
- * dll_init.cc (exceptions.h): Include.
- (dll_dllcrt0_1): New function to initialize Cygwin DLL guts
- properly when a non-Cygwin app uses the Cygwin DLL.
- (dll_dllcrt0): Call dll_dllcrt0_1 when user_data is NULL.
-
-Tue Oct 27 17:35:00 1998 Geoffrey Noer <noer@cygnus.com>
-
- * syslog.cc: drop "32" from CYGWIN32_LOG_NAME
-
-Tue Oct 27 16:09:09 1998 DJ Delorie <dj@cygnus.com>
-
- * utils/cygcheck.cc (usage): cygwhich->cygcheck
-
-Mon Oct 26 17:47:10 1998 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: fix deps for dll_entry.o and dll_main.o,
- add dep for glob.o.
-
- patch from Mumit Khan <khan@xraylith.wisc.edu>:
- * dll_entry.cc: New file for user DLL entry point.
- * dll_main.cc: New file for user DLL main.
- * Makefile.in (LIBCOS): Add dll_entry.o and dll_main.o.
-
-Mon Oct 26 13:47:10 1998 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: add back install of include/net which was
- removed by accident.
-
-Mon Oct 26 15:25:22 1998 Christopher Faylor <cgf@cygnus.com>
-
- * strace.cc (get_strace_mutex): Don't reset last windows
- error.
- (strace_printf): Preserve last windows error.
-
-Mon Oct 26 11:01:46 1998 Christopher Faylor <cgf@cygnus.com>
-
- * uname.cc (uname): Remove slash from system name.
-
-Mon Oct 26 02:11:44 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/asm/byteorder.h: add missing __cplusplus wrapper.
-
-Mon Oct 26 00:46:33 1998 Christopher Faylor <cgf@cygnus.com>
-
- * uname.cc (uname): Remove space from the system name.
-
-Sun Oct 25 23:47:56 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_console.cc (console_read): Several typos caused flaky
- behavior when \r or \n detected under ENABLE_LINE_INPUT. Also ignore
- first \n detected under ENABLE_LINE_INPUT if it isn't preceded by a \r.
- This avoids problems when switching from "raw" mode into "cooked mode.
-
-Sun Oct 25 12:28:21 1998 Geoffrey Noer <noer@cygnus.com>
-
- * cygwin.din: remove unnecessary __cygwin32_stack_trace and
- __cygwin_stack_trace exports.
-
-Sat Oct 24 21:18:46 1998 Christopher Faylor <cgf@cygnus.com>
-
- patch from Corinna Vinschen <corinna.vinschen@cityweb.de>:
- * path.cc (symlink): Standard protection for symlink should
- be 0777.
- * syscalls.cc (num_entries): Calculated links for directory
- entry should only include directories.
-
-Sat Oct 24 20:51:08 1998 Christopher Faylor <cgf@cygnus.com>
-
- * mkvers.sh: Modify check for CVS/Tag to work around ash bug.
- * sigproc.cc (wait_sig): Fix detection of non-blockable signals.
-
-Fri Oct 23 18:24:43 1998 Geoffrey Noer <noer@cygnus.com>
-
- * environ.cc: CYGWIN32 environment variable is now called CYGWIN
- * window.cc: lose "32" in Cygwin32WndClass
- * syslog.cc: lose "32" in WIN95_EVENT_LOG_PATH and
- CYGWIN32_LOG_NAME.
-
-Fri Oct 23 16:32:59 1998 Geoffrey Noer <noer@cygnus.com>
-
- * utils/cygcheck.cc: reformat, add copyright notice
-
-Fri Oct 23 18:15:28 1998 DJ Delorie <dj@cygnus.com>
-
- * utils/cygcheck.cc: new file
- * utils/Makefile.in: build cygcheck.exe
-
-Fri Oct 23 16:48:41 1998 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (signals_init): Add error to api_fatal.
- (events_init): Ditto. Collapse printfs into one.
- (winsock_init): Ditto.
- * net.cc (winsock_init): Remove "Cygwin" from error message.
-
-Fri Oct 23 13:48:10 1998 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: install include/cygwin headers, losing the "32".
- * include/cygwin32: remove
-
-Fri Oct 23 14:36:31 1998 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (environ_init): Avoid reallocating environ array.
- * exec.cc: Increase number of arguments to 1024 throughout.
- * fhandler.cc (fhandler_disk_file::open): Revert to checking
- a file for '#!' to find out if it is executable but add
- extra check for NTEA which, if set, eliminates the need for
- the read.
- * sigproc.cc (sigproc_terminate): Close hwait_sig and set it
- to NULL prior to closing other handles since this flags some
- routines that the process is going down.
-
-Fri Oct 23 00:31:27 1998 Geoffrey Noer <noer@cygnus.com>
-
- * utils/*: remove "32"s from cygwin32_foo function calls
-
-Fri Oct 23 00:24:27 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/cygwin/version.h: increment CYGWIN_VERSION_DLL_MINOR
- and CYGWIN_VERSION_API_MINOR since I'm changing the API in a
- meaningful but backwards-compatible fashion.
-
- * exceptions.cc: strip "32" from cygwin32_exception_handler
- debug printfs
-
- * net.cc: strip "32" from all net functions
- * select.cc, syscalls.cc, winsup.h: lose "32" from cygwin32_select
- * cygwin.din: adjust for these changes (no backwards
- compatability issues here).
-
- * cygwin.din: rename all cygwin32_foo functions, aliasing as
- cygwin_foo for backwards compat. for now but intend to lose them
- at a later date.
- * include/sys/cygwin.h: copy all cygwin32_ protos and make them
- usable without the "32". We will remove the cygwin32_ ones at a
- later date.
- * external.cc, external.h: lose "32" from cygwin32_internal
- * shared.cc, winsup.h: lose "32" in cygwin32_getshared
- * path.cc, path.h: lose "32" in cygwin32_foo comments
- * dll_init.cc: lose "32" in cygwin32_detach_dll
- * hinfo.cc: lose "32" in cygwin32_attach_handle_to_fd
- * libccrt0.cc: lose "32" in refs to cygwin32_attach_dll
- * pinfo.cc: lose "32" in cygwin32_winpid_to_pid
-
- * include/cygwin32: remove all files except cygwin32_dll.h which
- some people may already be including. Aim to remove this
- remaining file at a later date.
- * include/cygwin: move all include/cygwin32 files here.
- * cygwin/cygwin_dll.h: change protos to reflect loss of "32"s
- * include/net/if.h, include/netinet/in.h, include/netinet/ip.h,
- include/netinet/ip_icmp.h, include/asm/socket.h:
- include/sys/socket.h: include the headers in include/cygwin
- * Makefile.in, winsup.h: fix references to
- include/cygwin32/version.h
-
- * libcctype.c, smallprint.c, test.c: lose "32" in Cygwin32 refs in
- comments
- * include/dlfcn.h, include/exceptions.h, include/mapi.h,
- include/winsock.h, include/mywinsock.h: ditto
- * config/*: ditto
- * profil.c: ditto, and respace
-
-Thu Oct 22 22:52:40 1998 Geoffrey Noer <noer@cygnus.com>
-
- * net.cc, exceptions.cc, hinfo.cc, select.cc,
- include/mywinsock.h: rename __INSIDE_CYGWIN32__ to
- __INSIDE_CYGWIN__
-
-Thu Oct 22 17:39:06 1998 Geoffrey Noer <noer@cygnus.com>
-
- First round of Cygwin32 -> Cygwin renaming. In all files,
- rename Cygwin32 to Cygwin in comments.
- * CYGWIN32_LICENSE: delete and
- * CYGWIN_LICENSE: add it back under this name
-
-Thu Oct 22 20:10:24 1998 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc: Eliminate cs mutex. Just use signal_mutex
- throughout. Rename sig_dispatch_mutex to signal_mutex throughout.
- (lock_cs): Rewrite to be a front-end for get_signal_mutex.
- (unlock_cs): Rewrite to be a front-end for release_signal_mutex.
- (set_process_mask): Synchronize signals after resetting mask.
- * sigproc.cc (release_signal_mutex): Report on success or
- failure of signal_mutex release.
- * include/Windows32/Defines.h (FILE_FLAG_WRITE_THROUGH): Make
- unsigned to avoid a compiler warning.
-
-Thu Oct 22 14:23:49 1998 Geoffrey Noer <noer@cygnus.com>
-
- * utils/Makefile.in: disable building cygwin.exe.
-
-Thu Oct 22 14:16:10 1998 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (sig_handle): Minimize life of cs lock during
- handling of signals to reduce the potential for a race.
-
-Thu Oct 22 10:23:19 1998 Christopher Faylor <cgf@cygnus.com>
-
- * include/sys/strace.h: Minor addition from threadsafe-branch.
-
-Thu Oct 22 09:03:18 1998 Christopher Faylor <cgf@cygnus.com>
-
- * debug.cc (close_handle): Error condition needs a return value.
- * environ.cc (parse_thing): char pointers should all be constant.
- (add): Ditto.
- * heap.cc (heap_init): Provide a little more information in
- fatal printf. Use api_fatal to print errors.
- * sigproc.cc (sigproc_terminate): Move code executed on
- thread termination here from wait_sig since this function
- may actually be executing in the signal thread.
- * strace.cc (strace_open): Argument should be const.
- (strace_init): Ditto.
- * winsup.h: Ditto.
- * include/cygwin32/version.h: Note that original shared memory
- version was 0 for 98r2.
-
-Wed Oct 21 08:41:39 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (__api_fatal): Remove "cygwin" identifier.
- * fhandler.cc (fhandler_disk_file::open): Set symlink flag
- appropriately for previous change.
- * shared.cc (shared_name): Initialize static buffer to
- (hopefully) force it into NO_COPY segment.
- * mkvers.sh: Reorganize, add cvs tag detection, and output
- cygwin "info" defines.
-
-Tue Oct 20 18:42:50 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/cygwin32/version.h: rewrite versioning comments,
- updating for new scheme but keeping historical information.
-
-Mon Oct 19 23:45:24 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/windows.h: remove Objective-C BOOL ifdef, now taken
- care of within the include/Windows32 header files.
- * fhandler_console.cc: fix KeyEvent references in light of
- changes to the KeyEvent struct in the Windows32 headers.
-
- Update include/Windows32 header files. Changes from
- Mumit Khan <khan@xraylith.wisc.edu>, Corinna Vinschen
- <corinna.vinschen@cityweb.de>, and me.
- * include/Windows32/CommonFunctions.h: new file, contents from
- Functions.h.
- * include/Windows32/*.h: Misc updates.
-
-Mon Oct 19 20:26:15 1998 Christopher Faylor <cgf@cygnus.com>
-
- * debug.cc: Throughout, avoid calling *_printf while lock
- is active. Previous lock count was not thread-safe.
- * fhandler_console.cc (console_read): Avoid sending a
- \r to caller if ENABLE_LINE_INPUT.
- (fhandler_console::read): Rely on console_read to handle
- \r\n conversion.
-
-Mon Oct 19 12:10:09 1998 Christopher Faylor <cgf@cygnus.com>
-
- * mkvers.sh: Use more portable constructs to allow running
- this with /bin/sh, bash, and ksh.
-
-Mon Oct 19 11:19:58 1998 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (mount_info::from_registry): Missed "b15.0" part
- for writing mount information back to registry.
- (mount_info::init): Remove obsolete stuff.
-
-Mon Oct 19 10:42:17 1998 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Avoid newer GNU make construction when building
- version.cc.
-
-Mon Oct 19 00:09:06 1998 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: invoke mkvers.sh with $(SHELL)
-
-Sun Oct 18 15:19:17 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.cc (set_name): Accept unit argument for generating
- win32_name.
- (fhandler_base::fhandler_base): Ditto.
- (fhandler_dev_floppy::fhandler_dev_floppy): Ditto.
- (fhandler_dev_tape::fhandler_dev_tape): Ditto.
- (fstat): Set symlink bit only if symlink_p is positive.
- * fhandler.h: Reflect unit argument changes.
- * fhandler_serial.cc (fhandler_serial::fhandler_serial): Accept
- unit argument for generating win32_name.
- * hinfo.cc (hinfo::build_fhandler): Pass unit argument to constructor
- where apropriate.
- * path.cc (path_conv::path_conv): Set symlink_p to a positive
- value if !nofollow, negative otherwise.
- (windows_device_names): Can't default to \dev\comx. \dev part
- doesn't work.
- (get_device_number): Accept just "comN" for backwards compatibility.
-
-Sat Oct 17 01:58:15 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (globify): Fix problem with argument corruption
- due to use of pointer freed by realloc.
-
-Sat Oct 17 00:10:53 1998 Christopher Faylor <cgf@cygnus.com>
-
- Change NOT_OPEN_FD to dtable.not_open throughout.
- * Makefile.in: Change .dll name to cygwin1.dll. Increment
- the '1' when there are API/shared memory changes. Make
- version.cc file every time .dll is linked. Remove datestamp
- stuff.
- * mkvers.sh: New file. Creates version.cc.
- * cygwin.din: Export setdtablesize.
- * dcrt0.cc: Remove obsolete version variables.
- (build_argv): Use issep() macro rather than isspace since
- isspace includes whitespace that the shell does not consider
- a command separator.
- (check_sanity_and_sync): Use new cygwin version defines and
- structures for compatibility checking.
- (dll_crt0_1): Ditto.
- (__api_fatal): Renamed from api_fatal. Now always called from
- macro which tacks program name to beginning of fmt. Increase
- size of buffer.
- * environ.cc (regopt): Use new reg_key class constructor
- functionality.
- * net.cc (getdomainname): Ditto.
- * path.cc (read_mounts): Ditto.
- (mount_info::from_registry): Ditto.
- (mount_info::to_registry): Ditto.
- (hash_path_name): No need for this to be a "C" function.
- * external.cc (cygwin32_internal): Export version info strings.
- * external.h: Add CW_GETVERSIONINFO.
- * fhandler.cc (fhandler_base::write): Eliminate use of MIN macro.
- * init.cc (set_dllname): Obsolete function. Handled in version.cc.
- (dll_entry): Remove reference to set_dllname.
- * libccrt0.cc (this_proc): Renamed from cygwin_statu.
- (cygwin_crt0_common): Record api version in this_proc.
- * mmap.cc (recreate_mmaps_after_fork): No need for this to be
- a "C" function.
- * syscalls.cc (close_all_files): Ditto.
- * pinfo.cc (lock_pinfo_for_update): Eliminate a compiler warning.
- * registry.cc: Eliminate reg_session class. Augment reg_key to handle
- functionality of reg_session.
- * registry.h: Ditto.
- * shared.cc (shared_name): No need for this to be a "C" function.
- Use new cygwin version structure.
- (shared_info::initialize): Use new reg_key class constructor
- functionality.
- * smallprint.c (__small_vsprintf): Accept %P as a format specifier.
- Signifies the program name.
- * spawn.cc (spawn_guts): Quote *all* of the stuff the dcrt0.c considers
- special.
- * tty.cc (tty::inuse_event_exists): Remove debugging printf. It results
- in too much output to strace log.
- * uinfo.cc: Add a needed include.
- * uname.cc (uname): Use new cygwin version structure to fill in utsname
- fields.
- * winsup.h: Regroup into sections. Add new version structure.
- * include/utmp.h: Move login/logout function declarations here.
- * include/cygwin32/version.h: Define new CYGWIN version/info
- stuff here.
-
-Fri Oct 16 00:13:35 1998 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: enable building mingw subdir by default
-
-Thu Oct 15 12:01:08 1998 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (spawn_guts): Set all security attributes
- for CreateProcess so that sexec will work properly.
-
-Thu Oct 15 08:49:12 1998 Christopher Faylor <cgf@cygnus.com>
-
- * hinfo.cc (hinfo::dup2): Avoid a null pointer dereference
- in a debugging printf.
-
-Wed Oct 14 18:06:51 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from Corinna Vinschen <corinna.vinschen@cityweb.de>:
- * fhandler_console.cc (fhandler_console::dup): reset
- default_color since the console fhandler forgets its default
- colorizing when it's `dup'ed.
- (fhandler_console::fhandler_console): remove unnecessary
- erasing in constructor of fhandler_console.
-
-Mon Oct 12 22:20:59 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fcntl.cc (fcntl): According to the "Single UNIX Specification",
- F_DUPFD should *not* close its argument. Revert to previous
- behavior.
- * hinfo.cc (dup2): Guard against closing target fd too early.
- * pinfo.cc: Always initialize myself to a dummy value so that
- myself != NULL checks are avoided.
- * include/sys/strace.h (strace): Remove NULL check for myself.
- * dcrt0.cc (api_fatal): Ditto.
- * exceptions.cc (handle_exceptions): Ditto.
- * signal.cc (sigprocmask): Ditto.
- (_raise): Ditto.
- * strace.cc (get_strace_mutex): Ditto.
-
-Mon Oct 12 15:19:47 1998 DJ Delorie <dj@cygnus.com>
-
- * utils/ps.cc (main): use const char *pname
-
-Fri Oct 9 12:32:23 1998 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (getw): Simplify.
-
-Thu Oct 8 23:09:34 1998 Geoffrey Noer <noer@cygnus.com>
-
- * times.cc: add missing syscall_printfs to time functions,
- slight reformatting.
-
-Thu Oct 8 21:56:37 1998 DJ Delorie <dj@cygnus.com>
-
- * hinfo.cc (cygwin32_attach_handle_to_fd): allow to pass -1
- for dup() simulation; return allocated fd.
- * pinfo.cc (lock_pinfo_for_update): if the mutex is broken,
- fail instead of looping. If you do loop, don't use 100% CPU.
-
-Thu Oct 8 18:33:02 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc: Add another per-thread object for strace.
- (quoted): Fix misconception of method used to quote
- quotes.
- (globify): Optionally output arguments.
- (build_argv): Ditto.
- (dll_crt0_1): Fix typo in line reassignment.
- * debug.cc (class locker): Avoid calling lock multiple times.
- * exceptions.cc (call_handler): Set strace recursion flag
- to zero when invoking a signal handler.
- * fcntl.cc (_fcntl): F_DUPFD should close its argument.
- * fork.cc (fork): Move determination of parent process to
- a safer place.
- * sigproc.cc (get_sig_dispatch_mutex): Rename. Use macro
- interface to provide the name of the caller for strace output.
- (release_sig_dispatch_mutex): Ditto.
- * sigproc.h: Define *_dispatch_mutex wrappers.
- * strace.cc (strace_printf): Use new per-thread object to
- guard against recursion.
- * winsup.h: Define per_thread_strace_protect. Redo per_thread
- base class for a little more clarity.
-
-Wed Oct 7 22:30:43 1998 Geoffrey Noer <noer@cygnus.com>
-
- * fhandler_tty.h: up NTTYs from 16 to 128
-
-Wed Oct 7 09:15:55 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_console.cc (console_read): Distinguish between
- 0 byte return from CTRL-C and EOF condition.
-
-Tue Oct 6 22:31:44 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (build_argv): Rewrite. Now: 1) allocates argv on
- the fly, 2) inserts '@' files as they are found, 3) uses
- sh-style quoting using either " or ' which may be embedded
- in an argument.
- (insert_file): Don't scan command line. Accept already
- parsed arguments from build_argv.
- (quoted): New function for parsing quoted strings.
- (globify): Don't scan argv list. Accept element from
- build_argv which will be tacked to end of argv as it
- is being built. Extend quoting options to allow
- tilde, braces, and quotes.
- (dcrt0_dll_1): Simplify argv processing. Just call
- build_argv, which handles everything.
-
-Tue Oct 6 11:04:43 1998 Christopher Faylor <cgf@cygnus.com>
-
- Change Create[A-Z]* calls throughout to use sec_none_nih
- to avoid subprocesses accidentally inheriting handles.
- * grp.cc: Hold group structures in group_buf rather than
- an image of the /etc/group file.
- (parse_grp): New function to parse a group line into a
- struct group.
- (add_grp_line): Use parse_grp to add line from /etc/group
- into internal cache.
- (read_etc_group): Avoid redundant feof call. Set up
- default group.
- (getgrgid): Just return appropriate entry from group_buf
- rather than reparsing internal representation.
- (getgrnam): Ditto.
- (getgrent): Ditto.
- * hinfo.cc (hinfo::select_*): Set errno value when attempt
- is made to use an unopened fd.
- * passwd.cc: Hold passwd structures in passwd_buf rather than
- an image of the /etc/passwd file.
- (parse_pw): New function to parse a passwd line into a
- struct passwd.
- (add_pw_line): Use parse_pw to add line from /etc/passwd
- into internal cache.
- (read_etc_passwd): Avoid redundant feof call.
- (search_for): Just scan passwd_buf for matching entries.
- (getpwent): Just return appropriate entry from passwd_buf
- rather than reparsing internal representation.
-
-Mon Oct 5 18:06:31 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from Corinna Vinschen <corinna.vinschen@cityweb.de>:
- * sysdef/kernel32.def: add missing GetDiskFreeSpaceEx lines
-
-Sat Oct 3 23:52:23 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (si): Initialize so that NO_COPY will work.
- * debug.cc (class locker): Fix previous change. Critical
- sections are still required, so protect them if operating
- in main thread to avoid signal problems.
- Make any previously static use of locker global since that
- appears to be the only foolproof way of marking the variable
- NO_COPY. Rename these variables to something that is not
- likely to be collided with.
- * exceptions.cc (call_handler): Signal arrival of a dispatched
- signal here and wait a long time for the mutex before giving
- up. Should increase performance slightly.
- * sigproc.cc (maintid): New external symbol.
- * sigproc.cc (maintid): Make this global since it is used
- in other places now.
- (sig_dispatch_pending): Don't wait for wait_sig to complete
- if there are no pending signals. Avoids a race and should
- be faster.
- (wait_sig): Don't set signal_arrived event here. Do it in
- call_handler.
- * strace.cc (strace_printf): Remove previous recursion check
- since it is not signal safe.
- * syscalls.cc (_read): Remove duplicate CreateEvent typo.
-
-Fri Oct 2 09:54:42 1998 DJ Delorie <dj@cygnus.com>
-
- * strace.cc (strace_printf): protect against recursion
-
-Thu Oct 1 17:08:47 1998 Geoffrey Noer <noer@cygnus.com>
-
- * utils/ps.cc (main): add more detailed usage printfs
-
-Thu Oct 1 11:05:16 1998 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Fix typo in debug.o dependency.
- * debug.cc (class locker): Give up on using critical sections
- since they are not safe to use in the main thread due to signals.
-
-Wed Sep 30 22:34:42 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fork.cc (fork): Close parent's parent_alive handle
- if there is one or suffer a handle leak.
- * syscalls.cc (_read): Make all events no access and
- non-inheritable or suffer potential handle leak.
- * windows.cc (gethwnd): Ditto.
-
-Wed Sep 30 17:22:29 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/io.h: add missing setmode proto
-
-Tue Sep 29 23:33:11 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_tty.cc (fhandler_pty_master::close): Make sure
- both sides of both pipes associated with a tty master are
- closed or suffer handle leaks.
-
-Tue Sep 29 16:55:00 1998 Geoffrey Noer <noer@cygnus.com>
-
- * path.cc (mount_info::init): remove default mounts for
- raw devices.
- * utils/mount.cc (reset_mounts): ditto
- (main, usage): new -f flag disables warning messages about
- missing mount point directories. Two new flags, disabled for
- now: -c will create missing mount point directory, -g will
- select adding the mount point to the global registry location.
- * include/sys/mount.h: add MOUNT_GLOBAL define, for future use.
-
-Tue Sep 29 14:20:30 1998 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (exception): Use %p to denote some hex
- values.
- * winsup.h (read_info): Add jmp_buf to structure. Required
- for syscalls.cc change below.
-
-Mon Sep 28 19:36:41 1998 Syd Polk <spolk@cygnus.com>
-
- * include/{tchar.h, direct.h}: Added so that
- tcl8.1a2 can be compiled with cygwin.
-
-Mon Sep 28 19:36:41 1998 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (thread_reset): Yet another method for
- handling interruptible reads.
- (_read): Use thread_reset to reset reads after a signal.
-
-Sun Sep 27 21:11:46 1998 Christopher Faylor <cgf@cygnus.com>
-
- * cygwin.din: New alias for __cygwin32_stack_trace.
- * debug.cc (find_handle): Avoid leaving function without
- unlocking.
- (newh): Ditto.
- * exceptions.cc (__cygwin32_stack_trace): Rename to just
- `stack'. Shortens stack trace output.
- (exception): Use %p to distinguish register values.
- * fhandler_console.cc (fhandler_console::init): Remove
- debugging sig_protect.
- * init.cc (dll_entry): Move definition to avoid a
- compiler warning.
- * path.cc (mount_info::conv_to_win32_path): Detect
- case of root directory when setting win32 relative
- path.
- (mount): Remove obsolete label.
- * syscalls.cc (thread_sync): New function for exiting
- the read helper thread.
- (_read): Use new method for exiting the read helper
- thread.
-
-Sun Sep 27 11:25:06 1998 Christopher Faylor <cgf@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * delqueue.cc (delqueue_list::process_queue): Clear queue
- entry if file cannot be deleted for a reason other than
- sharing violation.
-
-Fri Sep 25 08:52:50 1998 Christopher Faylor <cgf@cygnus.com>
-
- * debug.cc: locker variables should all be static.
- * syscalls.cc (_read): Call ForceCloseHandle on
- thread handle since it is protected.
-
-Thu Sep 24 18:59:25 1998 Geoffrey Noer <noer@cygnus.com>
-
- * path.cc (mount): don't verify that path is an existing
- directory. Instead
- * utils/mount.cc: verify that path is an existing directory
- and print warning if it's not. Still do the mount.
-
-Thu Sep 24 11:45:04 1998 Christopher Faylor <cgf@cygnus.com>
-
- * debug.cc: locker class variables must be NO_COPY since
- they contain data that should not be precisely duplicated
- after a fork. This hopefully fixes a "SIGSEGV" problem.
- * select.cc (peek_pipe): Pipes apparently should set both
- "read" and "exception" flags on EOF.
-
-Wed Sep 23 18:26:31 1998 DJ Delorie <dj@cygnus.com>
-
- * doc/doctool.c (main): typo checking for --help
-
-Wed Sep 23 17:46:06 1998 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (symlink_check_one): Try much harder to ensure that
- CloseHandle is called on the file which was opened to check
- for a symlink. Avoid obsolete check for NULL buf.
-
-Wed Sep 23 17:11:50 1998 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (_read): Close thread handle or suffer a leak.
- * dir.cc (opendir): Simplify logic.
- (readdir): Ditto. Close handle explicitly when hit end
- of files.
- (rewinddir): Close directory handle or suffer leak.
- (closedir): Simplify logic.
-
-Wed Sep 23 14:42:12 1998 Christopher Faylor <cgf@cygnus.com>
-
- patch from DJ Delorie <dj@cygnus.com>:
- * path.cc (symlink_check_one): Don't re-define res or symlinks
- will be undetectable.
-
-Wed Sep 23 12:02:39 1998 Christopher Faylor <cgf@cygnus.com>
-
- * Change calls to api_fatal throughout to avoid need for \n
- (see below).
- Adapt some *_printf()/ExitProcess combinations to use api_fatal.
- * winsup.h (SIGTOMASK): Generate signal mask correctly for
- programs linked with newer cygwins.
- * dcrt0.cc (check_sanity_and_check): Set subtract constant for
- signal mask calculation based on whether binary was linked with
- "older" or "newer" cygwin.
- (do_global_ctors): Accept a second argument indicating whether
- the ctors should always be run. Necessary in forked processes
- for cygwin constructors which may do more than just allocate memory.
- (checkout): Remove obsolete function.
- (dll_crt0_1): Remove obsolete function call. Call do_global_ctors
- with second argument TRUE.
- (api_fatal): Change to a print-style function, allowing arguments.
- Always emit a "\n" after a message.
- (__main): Do not force running of constructors in forked processes.
- * exceptions.cc (call_handler): Simplify arguments passed to this
- function. Eliminate potential race by setting signal masks here.
- (sig_handle): Just calculate current sigaction pointer once.
- Change call_handler arguments.
- * fhandler_console.cc (fhandler_console::write_normal): Output
- unknown characters to screen.
- (fhandler_console::write): Make signal protection synchronous.
- * fork.cc (fork): Reorganize slightly to eliminate a compiler warning.
- * init.cc (dll_entry): Temporarily remove freeing of waitq_storage
- on thread detach until a more robust scheme is developed.
- * signal.cc (signal): Make signal protection synchronous.
- (sigaction): Ditto.
- * sigproc.cc (get_sig_dispatch_mutex): More debug info.
- (release_sig_dispatch_mutex): Work around potential bug in windows
- with double allocation of a mutex when WaitForSingleObject is
- interrupted. Save errno here only if about to call sig_send
- where it may be changed.
- (wait_sig): Remove unnecessary sig_sign stuff. Add some debugging
- output.
- * termios.cc (tcflow): Signal protection.
- (tcgetattr): Ditto.
- (tcsetattr): Make signal protection synchronous.
- * winsup.h: Add new extern for SIGTOMASK macro. Use it in SIGTOMASK
- macro. Move errno stuff to end so that it can benefit from previous
- declarations.
- * configure.in: Move AC_CANONICAL_SYSTEM up a little to avoid having
- configure generate some code (like the check for host type) twice.
- * configure: Regenerate.
-
-Wed Sep 23 11:49:55 1998 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (symlink_check_one): Fix handle leak resulting
- from open of file to check for symlink magic. Suggested
- by Corinna Vinschen <corinna.vinschen@cityweb.de> .
-
-Wed Sep 23 08:33:26 1998 Christopher Faylor <cgf@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * fhandler_tty.cc (process_ioctl): Use console handle
- for ioctl operations.
-
-Tue Sep 22 23:58:20 1998 Geoffrey Noer <noer@cygnus.com>
-
- based on patch from sos@prospect.com.ru (Sergey Okhapkin):
- * utils/ps.cc (main): rewrite ps to give it more options,
- including a, e, f, l, and u.
-
-Tue Sep 22 15:18:41 1998 Geoffrey Noer <noer@cygnus.com>
-
- * path.cc (umount): remove initial system_printf
- (mount): stat path, verify that it's an existing directory,
- otherwise fail.
- (strncasematch, strcasematch): return 0 instead of FALSE
- * utils/mount.cc (reset_mounts): reset / to System drive,
- not C: as was done in the old days.
-
-Mon Sep 21 18:18:18 1998 Geoffrey Noer <noer@cygnus.com>
-
- * path.cc (mount, umount, setmntent, getmntent, endmntent):
- make extern "C"
-
-Mon Sep 21 20:37:16 1998 DJ Delorie <dj@cygnus.com>
-
- * doc/configure.in: don't try to find cc until we can correctly
- configure it for a native cc in a cross build.
-
-Mon Sep 21 17:17:14 1998 Geoffrey Noer <noer@cygnus.com>
-
- * fhandler.cc (fhandler_disk_file::check_execable_p):
- don't check for .shc since that's non-standard. Check for
- .exe first.
-
-Mon Sep 21 14:57:50 1998 Geoffrey Noer <noer@cygnus.com>
-
- * doc/Makefile.in: reference -db2html in case docbook
- tools aren't installed.
-
-Mon Sep 21 14:43:40 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from DJ Delorie <dj@cygnus.com>:
- * doc/doctool.c (scan_file): correct off by one error in
- malloc
-
-Mon Sep 21 14:28:38 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h (select_record): Clear memory in constructor.
-
-Mon Sep 21 08:49:22 1998 Christopher Faylor <cgf@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * select.h: Use unsigned int to hold count in fd_set
- structure or suffer alignment problems.
- (WINSOCK_FD_ZERO): Back out previous change as it
- is no longer needed due to the above.
-
-Sat Sep 19 22:58:18 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_console.cc (console_read): Keep looping in
- ENABLE_LINE_INPUT mode when no characters are read.
- This apparently means that a CTRL-C has been hit.
- * select.cc (select_record::operator new): Remove.
- (setlect_stuff::~select_stuff): Use delete to remove
- record.
- (pipe_cleanup): Remove unneeded statement.
- (poll_socket): Add debugging statement.
- (start_thread_socket): Add debugging statements.
- * fhandler.h: Remove new operator from select_record.
- * select.h: Make WINSOCK_FD_ZERO more aggressive.
- * sigproc.cc (allow_sig_dispatch): Use new errno
- saving method.
- * syscalls.cc (_read): Reorganize stack freeing
- code to avoid overhead when it's not needed and
- to actually decommit stack memory.
-
-Sat Sep 19 19:16:32 1998 Christopher Faylor <cgf@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * select.cc (socket_cleanup): Avoid using a pointer
- after it has been deleted.
-
-Fri Sep 18 13:57:37 1998 Christopher Faylor <cgf@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * Makefile.in: Really remove extra slash in INCLUDES.
- Previous change didn't work.
- pipe.cc (make_pipe): set close-on-exec flag for non-inheritable
- pipes.
-
-Thu Sep 17 15:26:14 1998 Christopher Faylor <cgf@cygnus.com>
-
- * doc/Makefile.in: Add dummy install target.
-
-Thu Sep 17 12:30:49 1998 Christopher Faylor <cgf@cygnus.com>
-
- * winsup.h (per_thread*): New classes for storing and
- manipulating per_thread information.
- (threadstuff): New array of per_thread objects which are
- manipulated after a fork.
- (read_helper_thread_info): read() thread local storage.
- (waitq_storage): wait() thread local storage.
- * debug.cc (class locker): New class for generic locking
- of debug table manipulation. Use this throughout for
- locking access to thread/debug tables.
- (debug_init): Remove in favor of automatic constructor.
- * debug.h: Ditto.
- * fork.cc (fork): Iterate through threadstuff looking
- for thread information to clear out. Should solve some
- problems for Windows 95/98.
- * init.cc (dll_entry): Remove thread storage initialization.
- Use per_thread class for DLL_THREAD_DETEACH.
- * sigproc.cc: Use system_printf rather than alert_printf
- throughout since system_printf now has the same functionality.
- (sigproc_init): Use method to initialize per-thread storage.
- * sigproc.h: Remove waitq_storage declaration.
- * syscalls.cc (_read): Use per_thread class to manipulate
- per-thread information.
- * wait.cc (wait4): Ditto.
-
-Wed Sep 16 12:58:49 1998 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.c (_read): Lower timeout for signal detection after
- EOF on device. Should fix recent configure performance problems.
- * Makefile.in: Extend clean target into regexp directory.
-
-Wed Sep 16 11:44:14 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.cc (fhandler_base::set_name): Honor no_free_names().
- (fhandler_base::linearize): Remove unneeded check for NULL
- get_win32_name().
- (fhandler_disk_file::fhandler_disk_file): Set path names
- to a standard constant. They should eventually be filled
- out by fhandler_disk_file::open.
- (fhandler_disk_file::open): Detect if win32_path_name_ is
- a dummy path. Fill it out from real_path, if so.
- * hinfo.cc (hinfo::init_std_file_from_handle): Improve debugging
- statement.
- (hinfo::linearize_fd_array): Remove unneeded check for NULL
- get*_name ().
- * path.cc (path_conv::path_conv): Correct problem with
- symlinks found at places like E:\.
-
-Wed Sep 16 02:25:33 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * fhandler.cc (fhandler_disk_file::open): fix typo.
-
-Tue Sep 15 23:52:44 1998 Christopher Faylor <cgf@cygnus.com>
-
- * winsup.h: Remove side effects from SLASH_P.
-
-Tue Sep 15 18:36:08 1998 Ben Elliston <bje@cygnus.com>
-
- * sysdef/kernel32.def: Add definition for the Win32 API function
- `TryEnterCriticalSection'.
-
-Tue Sep 15 12:26:48 1998 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Remove extra slash in INCLUDES.
- * hinfo.cc (hinfo::dup2): Always clear close-on-exec
- flag for duplicated handle (problem and fix determined
- by Sergey Okhapkin, sos@prospect.com.ru).
- * fhandler.cc (fhandler_base::set_name): Avoid use of empty
- path names.
- (fhandler_base::raw_read): Show error code on failure.
- (fhandler_base::linearize): Avoid copying NULL names.
- (fhandler_base::open): Use NULL detection in small_printf.
- (fhandler_base::dup): Move set_close_on_exec_flag to dup2
- so it is caught in all cases.
- (fhandler_disk_file::fhandler_disk_file): Set "no free names"
- flag.
- (fhandler_disk_file::open): Clear "no free names" flag since
- names have been allocated to the fhandler structure at this point.
- * fhandler.h (set_no_free_names): Newconditional "no free names"
- function.
- * hinfo.cc (hinfo::dup2): Clear close on exec here.
- (hinfo::linearize_fd_array): Avoid copying NULL names.
- * path.cc (normalize_posix_path): Avoid copying trailing slash
- if root.
- (nofinalslash): Rename variable.
- * path.h: Add flag for future use.
- * regexp/regerror.c: Avoid including RCS strings in product.
- * regexp/regsub.c: Ditto.
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * select.cc (thread_pipe): Sleep for 10ms on every iteration.
- (start_thread_pipe): Set the handle in the select structure
- so that it will be properly identified in select_stuff::wait.
-
-Tue Sep 15 12:28:30 1998 DJ Delorie <dj@cygnus.com>
-
- * added documentation and doctool.c
-
-Tue Sep 15 08:37:26 1998 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Fix LIBGCC definition for native builds.
- Remove CFCOMMON in favor of configure solution.
- * configure.in: Default CXXFLAGS to be == CFLAGS.
- * configure: regenerate.
-
-Sun Sep 13 19:52:04 1998 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: include ../libio when building
-
-Sun Sep 13 19:30:58 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/cygwin32/version.h: bump version minor now that
- we've merged in all that new code...
-
-Sun Sep 13 21:34:33 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (do_global_ctors): Reverse call order
- of constructors thanks to insight from Mumit Khan
- (hkan@xraylith.wisc.edu).
- (do_global_dtors): Reflect above change: invoke destructors
- in the proper order.
- * smallprint.c (__small_vsprintf): Gracefully detect a
- null pointer for '%s' format.
- * syscalls.cc (_read): Set correct flags to retrieve stack
- information or suffer sporadic failures due to uninitialized
- flag.
- * regexp/regexp.c: Comment out RCS string. This provides
- no useful information in the .dll.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- Merge in experimental-980602 branch changes.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (symlink_check_one): known_suffix needs to be
- determined here in some cases, so deal with it here.
- (path_conv::path_conv): More effort needed to propagate
- the known_suffix back to caller in every case.
- (has_suffix): Return suffix found.
- (readlink): Avoid two passes through symlink_check_one.
- * spawn.cc (find_exec): Propagate known_suffix from
- perhaps_suffix back to caller, if appropriate.
- (spawn_guts): Use suffix returned from find_exec to
- determine if file should be scanned as a script when
- a #! file is found. Avoids a duplicate call to
- perhaps_suffix.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * path.h (suffix_info): New struct for dealing with standard
- suffix (.exe, .bat, etc.) information.
- (path_conv): Constructor now takes a suffix_info argument.
- (std_suffixes) Standard array of suffixes to consider "special".
- * path.cc (path_conv): Constructor now takes a suffix_info
- argument. Record any known suffix in path_conv known_suffix
- field.
- (has_suffix): New function for determining if a path already
- has a known suffix.
- (next_suffix): New function for returning the next suffix from
- a list of suffixes.
- (symlink_check_one): Take an optional suffix_info argument
- for suffixes to consider or tack on.
- * spawn.cc (std_suffixes): Standard list of executable suffixes.
- (perhaps_suffix): Pass std_suffixes to path_conv. Use
- new known_suffix field in path_conv to determine if a
- suffix has been detected.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- Substitute new str{,n}casematch for strcasecmp throughout.
- This implementation is faster since it only tests equality.
-
- Change fhandler*::open throughout to return true/false
- since the pointer returned was never used for anything.
-
- * Use strcasestr throughout for case insensitive matches for
- filenames.
- * Makefile.in: Use GNU make construct for determining gcc lib.
- * dcrt0.cc (check_sanity_and_sync): Make error message more
- explicit.
- * debug.h: Better defines for dummy functions when !DEBUGGING.
- * fhandler.cc (fhandler_base::fstat): Don't bother zeroing buf
- here since it is always done in the caller.
- (fhandler_base::~fhandler_base): Recognize cases where *_path_name_
- should not be freed.
- (fhandler_disk_file::open): Split into two functions. First
- function performs a path_conv and does testing on same. This
- calls new fhandler_disk_file::open with path_conv data. New
- function is called by stat_worker to avoid extra path tests and
- mallocs.
- Also, fix long standing off-by-one typo looking for #! magic.
- Also, reapply test for != WinNT when checking files for magic.
- Otherwise there is a tremendous slowdown in file opening, especially
- for stat().
- * fhandler.h: Add support for setting/detecting when *_path_name
- should not be freed.
- Add new fhandler_disk_file::open declaration.
- * hinfo.cc (digits): Remove obsolete function.
- (hinfo::build_fhandler): Add default name for FH_DISK.
- * path.cc (path_prefix_p_): Don't check beyond len1 for leading
- slash. Responsible for reported performance problems?
- (path_conv::path_conv): Ensure that fileattr is filled out
- correctly in all cases. Return immediately when a file
- is detected in !follow_mode.
- (nofinalslash): Simplify.
- (strncasematch): New function similar to strncasecmp except
- that it only checks for =/!= and benchmarks faster than same.
- (strcasematch): Ditto, re. strcasecmp.
- (strcasestr): New function which does a case-insensitive strstr.
- Needed for filename matching.
- * smallprint.c (__small_vsprintf): Fix off-by-one in %.ns processing.
- * spawn.cc (exe_exts): Make global for eventual use by other modules.
- * syscalls.cc (_fstat): Zero buf prior to use.
- (stat_worker): Rename from _stat_worker. Reorganize to minimize
- mallocs and path name conversions. Should now perform only one
- path conversion and 0 malloc/frees.
- * winsup.h: Declare new functions.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- Clean up error messages throughout using new strace_printf
- options.
- * smallprint.c (__small_vsprintf): Add %E option for printing
- error code. Understand %.n syntax.
- * strace.cc (strace_vsprintf): Common routine for formatting
- strace output. Default to always ending with \n unless
- string ends with \b.
- (strace_write): Common routine for writing to strace output.
- (strace_printf): Use above two routines.
- (system_printf): Ditto.
- * path.cc (path_conv): Scan path to be converted from right
- to left for efficiency. Implement extension searching
- which is passed from spawn to symlink_check_one to minimize
- overhead.
- (symlink_check_one): Check extensions for existence for use
- with spawn.
- (readlink): Accommodate changes to symlink_check_one.
- * spawn.cc (perhaps_suffix): Use new extension checking
- capabilities of path_conv.
- (find_exec_1): Delete.
- (find_exec): Generalize to allow searching on any PATH like
- environment variable.
- * dllfcn.cc (check_path_access): Use find_exec to find a path.
- This also ensures that paths are in Windows format which was
- not the case before.
- * environ.cc (conv_envvars): Add LD_LIBRARY_PATH.
- * fork.cc (fork): Clean up dll loading slightly.
- * Makefile.in: Turn on compiler warnings.
- * winsup.h (save_errno): New class for saving errno from
- being clobbered.
- * include/sys/strace.h: Make system_printf a macro similar
- to strace_printf_wrapper.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (sig_send): Attempt to work around Windows strangeness
- when thread interrupted while waiting for completion event.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc: Remove debugging function DELETEME ().
- * fhandler.cc (fhandler_base::fstat): Respond to compiler warning.
- * signal.cc (sleep): Reset signal_arrived event before using it or
- we could wake up immediately.
- (usleep): Ditto.
- (pause): Ditto.
- * spawn.cc (spawn_guts): Ditto. Respond to compiler warning.
- * sigproc.cc (sig_send): More debugging info.
- (sig_dispatch_mutex): Only ping wait_sig when needed.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (socket_cleanup): Close thread handle or suffer
- handle leak.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (verify_true): New function.
- (fhandler_socket::select_*): Use verify_true for verification
- function to avoid multiple calls to socket select.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (select_stuff::wait): Scan entire list of fds
- when WFMO wakes up.
- (set_bits): Add some strace debugging output.
- (thread_socket): Ditto.
- (verify_ok): Return result of set_bits rather than always 1.
- (start_thread_socket): Set the handle in the select structure
- so that it will be properly identified in select_stuff::wait.
- (fhandler_windows::select_read): Verification routine should
- be `poll_windows'.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc: Change some sigproc_printfs to only occur when
- #ifdef DEBUGGING.
- * spawn.cc (perhaps_suffix): Search for (PROG is the pathname to
- the executable file) PROG.exe, PROG.com, PROG.bat, PROG.cmd, and
- PROG and return extension found or NULL if no matching file.
- (spawn_guts): If the file name of the executable ends in either
- .exe, .com, .bat, or .cmd we assume that it is not a script file
- and therefore do not open the file to determine if it is.
- Fix "wait_failed" error when exec() called and non-cygwin parent.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dir.cc (rmdir): Set correct errno when non-empty directory and
- Windows9x.
- * pipe.cc (pipe): Use binary mode by default for pipes.
- * syscalls.cc (_read): Wait for terminated thread to exit before
- clearing its stack memory.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * hinfo.cc (hinfo::fixup_after_fork): Start initial fd search
- to zero forked processes so that a close(0)/dup(fd) will work.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_windows::set_close_on_exec: Deal with possible
- NULL handle.
- (fhandler_windows::fixup_after_fork): Ditto.
- * select.cc (select_stuff:wait): Handle return from
- MsgWaitForMultipleObjects correctly for windows case.
- * sigproc.cc (sig_send): Reset completion event for main thread.
- * syscalls.cc (_read): Better handling of stack free condition.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (call_handler): Exit earlier if just running
- in an exec'ed stub since the stub may own the sig_dispatch mutex,
- but we still want to exit.
- * select.cc (select_stuff::wait): Fix check for window activity
- from MsgWaitForMultipleObjects. Handle infinite wait correctly.
- (poll_windows): Add debugging output.
- * spawn.cc (spawn_guts): Protect against signals interrupting
- at an inopportune moment.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (select_stuff:test_and_set): Take appropriate action
- when a select record uses a window_handle.
- (fhandler_windows::select_read): Set handle and windows_handle
- appropriately.
- (fhandler_windows::select_write): Ditto.
- (fhandler_windows::select_except): Ditto.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (cygwin32_select): Need to reset signal_arrived before
- testing it or suffer loop.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fork.cc (resume_child): Give up on SuspendThread synchronization
- and use subproc_ready/forker_finished events.
- (sync_with_parent): Ditto.
- * sigproc.cc (wait_sig): Make sigcomplete_main manual reset to
- allow handling of nested interrupts.
- (wait_sig): Fix stupid typo on exit that would cause a
- loop to run for a long time. Are exits faster now?
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (unlock_cs): Leave decision to release
- sig_dispatch_mutex to the caller.
- (set_process_mask): Call release_sig_dispatch_mutex explicitly
- if needed.
- (handle_sigsuspend): unlock_cs no longer takes an argument.
- (call_handler): Try to acquire the strace mutex prior to
- suspending the main thread to ensure that the mutex is always
- released.
- (sig_handle): Call release_sig_dispatch_mutex explicitly.
- * fhandler_console.cc (fhandler_console::write): Protect against
- signals while writing.
- * signal.cc (signal): Protect against signal dispatch.
- (sigaction): Ditto.
- * sigproc.cc (sig_dispatch_pending): Return status no longer needed.
- (sig_send): Assume pending_signals if sending signal to self.
- (allow_sig_dispatch): Accept synchronize argument to control whether
- to wait for wait_sig to do its thing.
- (release_sig_dispatch_mutex): Just awaken wait_sig loop and wait
- for acknowledgement if waitfor is TRUE.
- (wait_sig): Don't ever zero pending_signals to avoid a possible race.
- Set pending_signals for blocked signals, too.
- * sigproc.h: Add __SIGFLUSH signal.
- (class sig_protect): Allow destructor to wait for signal dispatch,
- or not given constructor argument.
- * strace.cc (get_strace_mutex): Renamed from waitfor_strace_mutex.
- (release_strace_mutex): External function for use by call_handler.
- This replaces raw calls to ReleaseMutex throughout.
- * syscalls.cc (_read): Use sig_protect to protect against signals.
- Other cosmetic cleanups.
- (_close): Protect function with sig_protect.
- * termios.cc (tcsetattr): Protect function with sig_protect.
-
-Thu Sep 10 21:09:51 1998 DJ Delorie <dj@cygnus.com>
-
- * syscalls.cc (_read): typo in matching printf format to args.
-
- * fhandler.cc (write): Switch to the Microsoft/DJGPP way of
- writing out text files: pass \r but prepend \r to \n.
- (read): Don't collapse multiple \r's.
-
- * delqueue.cc: rewritten for speed. Don't check *every* entry in
- the list if we know the list is empty, plus check for duplicates.
- * delqueue.h: ditto.
- * path.cc (path_conv): If a path component is missing, short-
- circuit the symlink check.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h: Reorder fhandler status field so that device is
- in lower bits. This allows gcc to optimize access to the device.
- * hinfo.cc: Inline not_open().
- * winsup.h: Inline hinfo::not_open(). Make hinfo::[] operator a
- simple array reference.
- * strace.cc: Change strace() to a macro.
- * include/sys/strace.h: Ditto.
- * syscalls.cc (read_handler): New function. Called directly from
- _read for "non-slow" devices or via read_handler for slow devices.
- (_read): Use read_handler for reading.
- (read_helper): Ditto.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (do_exit): Don't ignore signals if reparenting.
- Besides being a race, this screws up the process which is
- actually executing.
- * fork.cc (fork): Don't create a new process group when
- forking or subprocesses won't respond to CTRL-C.
- * syscalls.cc (_read): Ensure correct setting of EINTR errno.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fork.cc (sync_with_child): Consider it a success if the child
- has set the subproc_ready signal regardless of whether it has
- exited or not.
- * init.cc (dll_entry): Set read_helper_thread_info stuff to 0
- on dll initialization. Windows 95 seems to keep garbage here,
- despite documentation to the contrary.
- * syscalls.cc (_read): Report on errors to create read_helper
- events.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (compute_argc): Limit debug_printf string argument size
- or suffer a buffer overrun.
- (do_exit): Add debugging statement.
- * exceptions.cc (call_handler): Remove extraneous sigproc_printf.
- Consolidate signal_arrived event with sig_was_dispatched.
- (events_terminate): Consolidate signal_arrived event with
- sig_was_dispatched.
- * fhandler.h: Rename a field to something more mnemonic.
- * fhandler_tty.cc: Throughout: Only set up fhandler_tty_master when
- actually using ttys. Change tty_master `f' field to `console'.
- * tty.cc: Ditto.
- * fork.cc (sync_with_child): Add more information to "child died"
- error.
- * hinfo.cc (hinfo::build_fhandler): Call tty master constructor
- when appropriate.
- * select.cc (select_stuff::wait): Consolidate signal_arrived event
- with sig_was_dispatched.
- * sigproc.h: Ditto.
- * syscalls.cc (_read): Ditto.
- * winsup.h: Ditto.
- * sigproc.cc: Ditto, throughout.
- (block_sig_dispatch): Don't reset signal_arrived. Causes races.
- * spawn.cc (spawn_guts): Limit debug_printf string argument size
- or suffer a buffer overrun.
- * include/sys/strace.h: Implement strace_minimal for very minimal
- output which, hopefully, will not affect the behavior of traced
- programs as much.
-
-Thu Sep 10 21:09:51 1998 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: build libwinspool.a with the dll name winspool.drv
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (build_argv): Remove verbose debug_printf.
- (dll_crt0_1): Use shared data handle passed in from parent process
- when appropriate. Remove extraneous debug_printf.
- * environ.cc (getwinenv): New function. Returns (possibly cached)
- native version of an environment variable.
- (win_env::add_cache): Add cached version of posix and win env
- variables to local table.
- (posify): Modify for use with native caching.
- (setenv): Convert special environment variables to native here,
- when they are set.
- (struct parse_thing): Simplify struct.
- (struct parse_things): Extend table to accommodate "envcache"
- setting.
- (parse_options): Add "envcache" option to control whether special
- environment variables are cached. Simplify handling of remembered
- parameters.
- (winenv): Modify for use with getwinenv.
- * exceptions.cc (unlock_cs): release_sig_dispatch takes an argument
- now.
- (set_process_mask): unlock_cs now wakens wait_sig when appropriate.
- (handle_sigsuspend): Reorganize to take advantage of new behavior
- of release_sig_dispatch_mutex and hopefully avoid a race.
- (handle_sig): Avoid waking wait_sig if we couldn't get the dispatch
- mutex.
- * exec.cc (strccpy): Change to modify second argument to point
- to position where "parse" stopped so that it doesn't have to be
- recalculated by the caller.
- (sexecvpe): Use find_exec () to find program to run. If you've
- got a function for this, you might as well use it.
- * fhandler_tty.cc (fhandler_pty_master::process_input_to_slave):
- Report on signal being sent in termios_printf. Use kill_pgrp
- interface.
- * fork.cc (fork_copy): Just copy everything at once rather than
- in individual pieces.
- (fork): Potentially move up sbrk() when DEBUGGING so that parent
- and child heaps are in sync. Pass cygwin_shared_h to child.
- * path.cc (path_conv::path_conv): Make sure that a file is not
- a symlink when returning immediately.
- * sigproc.cc (sig_dispatch_pending): Return TRUE if signals were
- pending.
- (sigproc_init): Move sig_was_dispatched initialization here so
- that it will always be available to other functions which rely
- on it. Otherwise these functions would have to wait for wait_sig
- to complete its initialization.
- (sig_send): Rework SIGSUSPEND handling.
- (release_sig_dispatch_mutex): Wait for signal to be dispatched
- after releasing mutex if argument is TRUE.
- (wait_sig): Remove sig_was_dispatched initialization from here.
- * sigproc.h: release_sig_dispatch takes an argument.
- * spawn.cc (perhaps_suffix): Take an optional argument indicating
- whether the path has already been converted to win32.
- (find_exec_1): Use getwinenv to get windows version of PATH. Use
- windows version of individual directories to avoid posix lookups.
- (spawn_guts): Call strace_dump here to cause strace output to
- be slightly more synced when using strace caching.
- (spawnvpe): Use find_exec () to find program to run. If you've
- got a function for this, you might as well use it.
- * syscalls.cc (_read): Only block signals for "slow" devices.
- * winsup.h: Changes needed for previous checkin and getwinenv.
-
-Thu Sep 10 21:09:51 1998 DJ Delorie <dj@cygnus.com>
-
- * path.cc (path_conv): bug fix when path ends in slash
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.cc (fhandler_base::set_name): Use fhandler
- method for determining native name. Avoid path_conv
- when possible.
- (fhandler_disk_file::get_native): New function, returns
- windows name of disk file.
- * fhandler.h: Add get_native() method to fhandler_*
- classes.
- * fhandler_serial.cc (fhandler_serial::get_native): Return
- windows name of serial port.
- * fhandler_tty.cc (fhandler_tty_master::init): Use consistent
- name for tty master.
- * fork.cc (fork_copy): Experimental change to avoid loop.
- * grp.cc (add_grp_line): Use realloc to extend group buffer.
- * hinfo.cc (hinfo::release): fd object should be deleted,
- not freed or suffer a memory leak.
- (init_std_file_from_handle): Reset first_fd_for_open to
- signal that std* locations have been opened. Avoids use
- of these locations prior to full dtable setup.
- * passwd.cc (add_pwd_line): Use realloc to extend passwd buffer.
- * path.cc (path_conv::path_conv): Avoid checking for symlinks on
- network shares. Check for existence of file prior to taking
- it apart for symlink checking (this needs more work).
- (windows_device_names): Make global.
- (get_device_number): Detect tty master.
- * sigproc.cc (wait_sig): Maintain a flag which indicates when
- signals are queued due to the wait_sig's inability to get a
- sig_dispatch mutex.
- (sig_dispatch_pending): Don't wake up the wait_sig thread if
- unless there are signals queued (see above) or force argument.
- (allow_sig_dispatch): Only wait for signal dispatch if something
- is queued.
- * sigproc.h: allow_sig_dispatch takes a (defaulted) argument now.
- * syscalls.cc (_open): Use default hinfo::find_unused_handle call.
- * net.cc: Ditto, throughout.
- * pipe.cc: Ditto.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (do_exit): Ignore user initiated signals here.
- * fhandler.cc (fhandler_disk_file::open): Detect error condition
- on fhandler_base::open.
- * fhandler_console.cc (undo_input): Respond to compiler warnings.
- * grp.cc (getgrgid): Ditto.
- * times.cc (_tzname): Ditto.
- * fhandler_tty.cc (fhandler_Tty_slave::open): Cosmetic changes.
- * fork.cc: Clean up debugging output.
- * pinfo.cc (pinfo_init): Set pgid and sid to different values
- initially. Let user program set sid appropriately if it is
- to be the owner of a tty.
- * sigproc.cc (allow_sig_dispatch): Try harder to detect when we
- should wait for a signal dispatch.
- * strace.cc (strace_open): Revert to previous mutex behavior.
- * include/sys/strace.h: Ditto.
- * syscalls.cc (_open): Detect error from fhandler open.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- Global changes:
- Store win32 name in fhandler structure to avoid multiple translations.
- Support close_on_exec at the Win32 level for all but sockets.
- Respond to gcc warnings.
- Use single fstat() call for devices.
- *::set_close_on_exec modified.
- * dir.cc (opendir): Use win32 name in stat to speed things
- up a little.
- * debug.cc: New file. Provides routines for extra debugging
- when -DDEBUGGING is specified.
- * debug.h: New file. Definitions for debug.cc.
- * exceptions.cc (signals_init): Break out signal initialization
- from exceptions.
- (dump_status): Add thread name to stack dump output.
- (handle_exceptions): Renamed.
- (set_process_mask): Don't ever mask non-maskable signals.
- (ctrl_c_handler): Preliminary change to allow propagation of
- cygwin signals back to gdb.
- (sig_handle): Call do_exit directly from signal thread rather than
- attempting to redirect the main thread.
- * fhandler.cc (set_name): Store win32 name in fhandler structure.
- (*::open) name field is extraneous now. Use get_win32_name () to
- retrieve stored win32 name.
- (fhandler_base::fstat): Default to performing fstat on a device.
- (fhandler_disk_file::fstat): Renamed from fhandler_base::fstat.
- Operate only on disk files.
- (fhandler_base::set_close_on_exec_flag): New function sets flag
- without touching the handle.
- (fhandler_base::~fhandler_base): Free unix/win32 path names.
- (fhandler_disk_file::close): Only call delqueue.process_queue from
- this function since disk files are the only things that can
- be unlinked, currently.
- (fhandler_dev_null::open): Delete.
- (set_inheritence): New function. Set handle inheritence.
- (fhandler_*::fork_fixup): New functions. Inherit fhandler data
- after a fork.
- fhandler.h: *::set_output_handle - new method.
- Setup methods for use by select().
- fork.cc (fork): Call fixup_after_fork in child to inherit
- handles marked as non-inheritable on CreateProcess.
- hinfo.cc (hinfo::build_fhandler): Use new function to detect
- devices.
- (dup_for_exec): Delete obsolete function.
- (hinfo::dup2): Remove extraneous tests.
- (hinfo::select_*): Interfaces into select().
- (hinfo::release): Free fd in dtable.
- (hinfo::fixup_after_fork): New function. Inherit close-on-exec
- handles from parent after fork.
- path.cc (mount_info::posix_path_p): Make inline.
- (path_conv::path_conv): Short circuit when path resolves to a device.
- (digits): Move here from hinfo.cc.
- (windows_device_names): Win32 names for Cygwin devices.
- (get_device_number): New function. Return devie number given device
- name.
- (win32_device_name): New function. Decode a windows device name
- and an optional "unit".
- (mount_info::conv_to_win32_path): Short circuit when path resolves to
- a device.
- * path.h: add device and unit fields to path_conv class.
- * select.cc: Rewrite for more structure, more OO.
- * sigproc.cc: (get_sig_dispatch_mutex): New function.
- (release_sig_dispatch_mutex): New function.
- * sigproc.h: sig_protect class. Automatic protection from signals
- when used.
- * syscalls.cc (stat_dev): New function.
- (stat_worker): Short-circuit when a cygwin device is detected.
- * utils/ps.cc: Don't lock_pinfo when -f. Compress format to fit
- more on a line.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (dll_crt0_1): Register name for main thread.
- * exceptions.cc (dump_status): Add thread name to diagnostic output.
- (__cygwin32_exception_handler): Rename to handle_exceptions. Avoid
- creating a .core file.
- * exec.cc (sexecve): Reflect spawn_guts argument change.
- * fhandler_tty.cc (fhandler_tty_master::init): Use makethread to
- create a new thread.
- * select.cc: Create pipe/socket threads each time select is called.
- Use thread termination as indication of fd readiness.
- * sigproc.cc (sigproc_init): Use makethread to create a new thread.
- (wait_sig): Simplify default signal call slightly.
- * spawn.cc (spawn_guts): Accept child pinfo pointer rather than
- pid. Reorganize so that common initialization is handled once.
- * strace.cc: Set strace_mutex to NULL initially to catch CreateMutex
- errors.
- * window.cc (gethwnd): Use makethread to create a new thread.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Add debug.o target.
- * cygwin.din: Separate pipe from _pipe.
- * dcrt0.cc (alloc_stack): New, more precise method for allocating
- stack space after a fork.
- (dll_crt0_1): Use new child_proc_info class to retrieve information
- from possible parent process. Remove #ifdef erroneously checked in.
- Remove extraneous syscall_printf.
- * exceptions.cc (signals_init): New function.
- * fhandler.cc (fhandler_make_pipe): Move to pipe.cc.
- * fhandler.h (fhandler_base): New = operator preserves unix_path_name_.
- * fhandler_tty.cc: Strip some tty functions from here into tty.cc.
- * fork.cc: Remove obsolete ifdefs. Reorganize, streamline with new
- fork.
- * hinfo.cc: Speed up build_fhandler.
- * libccrt0.cc: Remove obsolete ifdefs.
- * pinfo.cc (pinfo_init): Simplified by new fork/spawn info passing
- method.
- * pipe.cc (make_pipe): Moved from fhandler.cc. Handles MS-style
- _pipe.
- (pipe): Use new arguments to make_pipe.
- (_pipe): New MS-compatible function.
- * shared.cc: cygwin_shared_h make global so that it can be inherited
- via new fork/spawn info passing method.
- (open_shared_file_map): Detect if shared info is already set up from
- fork/spawn.
- * sigproc.cc (sigproc_init): Initialize signals with signals_init here.
- Use new fork/spawn info passing method.
- * spawn.cc (spawn_guts): Pass information in a structure to spawned
- process. Identify structure type with a "magic number".
- * strace.cc (strace_printf): Only print program full path spec once
- to save space and clutter. Preserve any windows error.
- * syscalls.cc (_open): Detect and avoid error return from
- build_fhandler.
- * tty.cc: Accept some non-fhandler functions formerly found in
- fhandler_tty.cc
- * winsup.h (pinfo): Remove some fields obsoleted by new fork/spawn
- info passing method.
- (child_info*): New classes for passing information to forked/spawned
- process.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Add debug.o target.
- * console.cc (fhandler_console::char_command): Fix failed merge.
- * dcrt0.cc (alloc_stack): New, more precise method for allocating
- stack space after a fork.
- (dll_crt0_1): Use new child_proc_info class to retrieve information
- from possible parent process. Remove #ifdef erroneously checked in.
- Remove extraneous syscall_printf.
-
-Thu Sep 10 21:09:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- Global changes:
- Replace pinfo hmap entry with "dtable" reference.
- Replace cygwin_shared .t field with '.tty' and allow indexing via
- tty into this array.
- Make fhandler_ constructors set the size of the structure into any
- created class.
- Change fhandler settings into a bit mask. Use methods to access.
- Record device type in fhandler class.
- Remove old linearize/de_linearize code in favor of newer method
- uses more bullet-proof method for determing device type of inherited
- files.
- Protect various important handles from closing when operating
- under -DDEBUGGING.
- * dcrt0.cc (do_global_ctors): Renamed, made static and reused
- for calling from dll_crt0_1 to initialize cygwin.dll constructors.
- (do_global_dtors): Renamed.
- (dll_crt0_1): mark noreturn. Use new do_global_ctors function.
- Call debug_init to initialize features turned on by -DDEBUGGING.
- Call dtable_init to initialize dtable, hinfo_init to initialize
- standard fds.
- (dll_crt0): Mark noreturn. Move constructor calls to dll_crt0_1.
- (__main): Use new do_global_ctors ().
- Remove OLDWAY and _PPC_ conditionals.
- * environ.cc (environ_init): Use appropriate strace printf.
- * exceptions.cc (set_process_mask): Don't ever mask out unmaskable
- signals.
- * init.cc (dll_entry): Initialize storage for read_helper.
- * pinfo.cc (init_from_exec): Delete obsolete function.
- * sigproc.cc (sig_send): Implement myself_nowait to allow
- sending a signal to myself without waiting for synchronization.
- (wait_sig): Change method for determining whether signal should
- be examined slightly.
- * strace.cc (strace_printf): Add ability to report on thread from
- which message originated.
- (threadname): New function
- * syscalls.cc (read_helper): New function. Invoked in separate thread
- from _read.
- (_read): Use a separate thread for reads that can be interrupted
- with a TerminateThread(). Allows EINTR.
- (setdtablesize): Use new method for extending the size. Callable
- from anywhere.
- (getdtablesize): Use new method for getting the current dtable size.
- * tty.cc: Remove use count in favor of a method which checks tty
- availability via an event. Some code cleanup.
- (tty::inuse): New function for determining if a tty is
- in use by any process.
- (tty_list::terminate): Use new method for determining if a tty is in
- use. Should avoid hangs waiting for non-existent processes to
- free up a tty.
- (tty::common_init): Common initialization for tty/pty master.
- (fhandler_tty_master::init): New function.
- (do_output): Use new method for determining if a tty is in use.
- (fhandler_pty_master::open): Use comon initialization code.
- (fhandler_pty_master::ptsname): static buffer is ok now.
- * tty.h: Reflect inuse changes and tty.cc cleanup.
- * winsup.h: Include debug.h for use when -DDEBUGGING. Remove
- stuff previously here which was conditionally compiled with -DDEBUGGING.
- (hinfo_vec): Rename to hinfo. Maintain argv style list of pointers
- to open fds. Add methods to deal with above changes.
- (pinfo): Removals due to above changes.
- (shared_info): Rename t to tty.
- Add common defines to extern "C" section.
-
-Wed Sep 9 22:24:50 1998 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (path_prefix_p_): Rewrite to avoid false match
- against root when remote path or \\x style disk device.
- * include/sys/strace.h: Implement new macro for use by
- malloc_printf which does not default to "on" if STRACE=1.
- This avoids massive strace logs.
-
-Tue Sep 8 11:31:42 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (dll_crt0_1): Remove ill-advised ifdef NEEDOEM.
-
-Thu Sep 3 17:54:18 1998 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Speed up dll links.
- * path.cc (chdir): Fix previous change.
-
-Mon Aug 31 12:23:33 1998 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (chdir): Protect free from potential signal race.
-
-Fri Aug 28 15:59:27 1998 Geoffrey Noer <noer@cygnus.com>
-
- * dlfcn.h: delete, move it
- * include/dlfcn.h: here
-
-Thu Aug 27 14:20:38 1998 Christopher Faylor <cgf@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * path.cc (path_conv::path_conv): remove trailing backslash from
- full win32 name, otherwise the last component of the path isn't
- checked for symlink.
-
-Wed Aug 26 14:15:22 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h (fhandler_base): Make set_name() public and implement
- clear_name() to accommodate dup2.
- * hinfo.cc (dup2): Previous change exposed problem with dup2.
- Same unix_path_name_ ptr was being used in two separate fds.
- Fix this.
-
-Wed Aug 26 12:10:27 1998 Christopher Faylor <cgf@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * malloc.cc: Use malloc_printf throughout.
- * path.cc (getcwd_inner): Allocate buffer with realloc to
- avoid a memory leak.
- * syscalls.cc (_close): delete unix_path_name_ explicitly since
- destructor is never called.
- * include/sys/strace.h: Add strace_malloc stuff.
-
-Mon Aug 24 15:45:59 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/sys/ioctl.h: variable names in protos should start
- with two leading underscores.
- * include/sys/mman.h: ditto.
- * include/sys/mount.h: ditto.
- * include/sys/resource.h: ditto.
- * include/sys/smallprint.h: ditto.
- * include/sys/socket.h: ditto.
- * include/sys/strace.h: ditto.
- * include/sys/vfs.h: ditto.
- * include/sys/wait.h: ditto.
- * include/mntent.h: ditto.
-
-Tue Aug 18 17:00:20 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from Trevor Yann (TYann@vet.com.au):
- * uname.cc (uname): report processor type for win98
-
-Tue Aug 18 16:09:13 1998 Christopher Faylor <cgf@cygnus.com>
-
- * fork.cc (cygwin_fork_helper1): Start initial fd search
- to zero forked processes so that a close(0)/dup(fd) will work.
-
-Mon Aug 17 16:58:09 1998 Christopher Faylor <cgf@cygnus.com>
-
- * winsup.h (hinfo): Remember initial fd to start searching
- for new fds. This avoid assigning std/in/out/err to
- files opened early in initialization.
- (hinfo_vec::find_unused_handle): New default way to search
- for a new handle. Avoids using std/in/out/err until the
- proper time in the initialization.
- * fhandler.cc (fhandler_make_pipe): Use default method for
- finding unused handle.
- * net.cc: Ditto throughout.
- * pipe.cc (dup): Ditto.
- * syscalls.cc (_open): Ditto.
- * hinfo.cc (hinfo_vec::init_std_file): Set initial fd for open
- search to include std/in/out/err.
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * spawn.cc (perhaps_suffix): Use translated win32 path when
- determining if a .exe extension should be added or suffer adding
- a .exe extension twice.
-
-Mon Aug 10 15:08:49 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/cygwin32/version.h: up minor version number
-
-Mon Aug 10 07:04:13 1998 DJ Delorie <dj@cygnus.com>
-
- * delqueue.cc: rewritten for speed. Don't check *every* entry in
- the list if we know the list is empty, plus check for duplicates.
- * delqueue.h: ditto.
-
-Sat Aug 8 14:03:52 1998 Eric Bachalo <ebachalo@cygnus.com>
-
- * spawn.cc (perhaps_suffix): If report_failure_p is non-zero this
- function will search for (PROG is the pathname to the executable
- file) PROG.exe, PROG, PROG.com, PROG.bat, and PROG.cmd and return
- either the full path name if found or NULL if not.
- (spawn_guts): If the file name of the executable end in either
- .exe, .com, .bat, or .cmd we assume that it is not a script file
- and therefore do not open the file to determine if it is.
-
-Thu Aug 6 22:25:38 1998 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (path_conv): If a path component is missing, short-
- circuit the symlink check. Bug fix for case where path ends
- in a slash.
- (path_conv::path_conv): Make sure that a file is not
- a symlink when returning immediately. Avoid checking for
- symlinks on network shares. Check for existence of file prior
- to taking it apart for symlink checking (this needs more work).
-
-Sun Aug 2 19:17:59 1998 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (cleanup_pipe_thread): Cleanup thread handle or suffer
- handle leak.
- (cleanup_socket_thread): Ditto.
- * sigproc.cc (proc_subproc): Make wait thread manual reset to
- solve problem with nested waits not waiting correctly.
- * fhandler_tty (fhandler_tty_slave::open): Don't create the output
- mutex, just open it. If it can't be opened, its an error.
-
-Wed Jul 29 12:08:19 1998 Eric Bachalo <ebachalo@loony.cygnus.com>
-
- * include/Windows32/Defines.h: Added Virtual-Key Code defines
- for the Win95 keys - VK_LWIN, VK_RWIN, and VK_APPS.
-
-Tue Jul 21 14:47:59 1998 DJ Delorie <dj@cygnus.com>
-
- * path.cc (path_prefix_p): optimize calls by comparing first
- characters inline.
- (path_conv): optimize by not checking both foo and foo/ for
- symbolic links.
-
-Tue Jul 21 14:39:03 1998 Christopher Faylor <cgf@cygnus.com>
-
- * pinfo.cc (pinfo_init): Set myself->sid to 1 so that
- a program started up outside of cygwin will not trump
- other opens of ttys. Fixes problem with pgid change below.
-
-Tue Jul 21 12:59:21 1998 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (chdir): Force chdir to disk device to go to the root
- directory.
-
-Tue Jul 21 09:32:23 1998 Christopher Faylor <cgf@cygnus.com>
-
- * pinfo.cc (pinfo_init): 0 is a very bad value for a default pgid.
-
-Fri Jul 16 15:09:50 1998 Stan Cox <scox@cygnus.com>
-
- * (gcrt0.c, gmon.c, profil.c, mcount.c, gmon.h, profil.h,
- config/i386/profile.h): New files for gprof cygwin support.
- Some code contributed by Tim Newsham for Secure Networks, Inc.
- * Makefile.in (LIBGMON_A, GMON_START, GMON_OFILES): New for gprof.
-
-Mon Jul 13 19:29:00 1998 Eric Bachalo <ebachalo@loony.cygnus.com>
-
- * dcrt0.cc (insert_files): Now both -@file and @file work as
- command line file insertion options.
- * fhandler_serial.cc (fhandler_serial::open): Enabled RTS Control
- Line by default to make full handshaking cables work for the
- D10V board. (CDB.fRtsControl)
- (fhandler_serial::tcsetattr): same as above
-
-Wed Jul 8 15:53:35 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (dll_crt0_1): Avoid redundant strace_printf.
-
-Wed Jul 8 15:05:10 1998 DJ Delorie <dj@cygnus.com>
-
- * fhandler.cc (fhandler_base::lseek): Note lseek so that next
- write() can check for the Win95 "gap" bug.
- (fhandler_base::write): If Win95 and lseek past eof
- followed by write, use WriteFile to force the "gap" to be filled
- with zeros rather than left to the "undefined" data Win32 specifies.
- (fhandler_base::fhandler_base): initialize check_win95_lseek_bug_.
- * fhandler.h (class fhandler_base): Add check_win95_lseek_bug_
- for bug: when seek past EOF and write, win95 fills with random
- data (security hole).
-
-Thu Jul 2 10:45:15 1998 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (winenv): Be more paranoid when restoring special
- win32 environment variables beginning with '='.
-
-Thu Jul 2 09:19:32 1998 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc: Previous change was not rigorous enough.
- Track environment variables to convert in a structure which
- records the correct function for converting the environment
- variable from/to POSIX format.
- (isspecial): New function.
- (parse_options): Use template to initialize parse array.
- (posify): Use new conversion function.
- (winenv): Ditto. Also restore special win32 environment variables
- beginning with '='.
- * path.cc (conv_path_list): Source argument should be const.
- (win32_to_posix_path_list): Ditto.
- (posix_to_win32_path_list): Ditto.
- * path.h: Reflect changes to path.cc.
-
-Tue Jun 30 14:00:32 1998 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (winenv): Avoid converting environment variables to
- windows style if they begin with something like a 'C:'.
-
-Sun Jun 28 20:59:16 1998 Christopher Faylor <cgf@cygnus.com>
-
- * include/Windows32/Structures.h (MINMAXINFO): Add a missing
- *LP...
-
-Thu Jun 25 10:45:38 1998 Christopher Faylor <cgf@cygnus.com>
-
- * signal.cc (sigpending): Stop from always reporting pending signals
- when no signals are actually pending.
-
-Tue Jun 23 15:38:45 1998 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Add a new target.
- * cygwin.din: Add cygwin32_internal interface.
- * dcrt0.cc (dll_crt0_1): Don't call main if no main set. Allows
- initialization from a .dll.
- * utils/ps.cc: Use new internal/external interface to cygwin to
- provide an unchanging interface to some cygwin internals.
- * external.h: Preliminary stab at an interface to cygwin32 for
- getting at the "naughty bits".
- * external.cc: External interfaces to some cygwin internal stuff.
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * exceptions.cc (sig_handle): When abnormally terminating,
- close_all_files in signal thread context to prevent socket hangs.
-
-Thu Jun 18 15:17:06 1998 Christopher Faylor <cgf@cygnus.com>
-
- * pinfo.cc (pinfo_list::allocate_pid): Wrap pids at SHRT_MAX
- or ash complains.
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * window.cc (WndProc): Always kill timer before starting up
- a new one or eventually suffer a timer proliferation.
-
-Mon Jun 15 09:40:30 1998 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc: Cosmetic change.
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * syscalls.cc (system): Ignore SIGINT, SIGQUIT and SIGCHLD while
- in a system() call.
-
-Thu Jun 11 18:37:02 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/sys/syslog.h: add missing LOG_LOCALn bits
-
-Tue Jun 9 22:29:26 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dll_init.cc (DllNameIterator::operator const char* ()): Add
- a missing \n to a *_printf.
- * fhandler_tty.cc (fhandler_tty_slave::dup): Ditto.
- (fhandler_tty_slave::ioctl): Ditto.
- * errno.cc (errmap): Add an unrepresented windows error.
- Simplify table.
-
-Tue Jun 9 17:21:44 1998 Christopher Faylor <cgf@cygnus.com>
-
- * errno.cc (errmap): Make sure that errmap array is
- terminated with a NULL or suffer a SIGSEGV.
-
-Tue Jun 9 10:30:02 1998 Christopher Faylor <cgf@cygnus.com>
-
- Change `sprintf' to `__small_sprintf' throughout cygwin.
- * cygwin.din: Don't export exception handler.
- * exceptions.cc (__cygwin32_exception_handler): Rename to
- handle_exceptions. Make static. Redo core file generation
- slightly so that __small_sprintf can be used.
- (call_handler): Remove use of `rethere' in asm code. Don't
- probe stack as this is potentially dangerous unless done
- meticulously.
- * select.cc (select): Redo to create thread whenever needed
- for pipe/socket. Thread termination denotes fd readiness.
-
-Mon Jun 8 14:31:11 1998 Christopher Faylor <cgf@cygnus.com>
-
- * hinfo.cc (set_std_handle): New function to set windows
- "standard" handles from cygwin handles.
- (hinfo_vec::dup2): Set windows standard handle if appropriate.
- * syscalls.cc (_open): Set windows standard handle if appropriate.
-
-Sun Jun 7 16:34:00 1998 Christopher Faylor <cgf@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * fhandler_console.cc (fhandler_console::scroll_screen): Add a
- workaround for Win95 ScrollConsoleScreenBuffer bug which allowed
- scrolling to work correctly in both directions.
- (fhandler_console::char_command): Simulate underscore with cyan
- instead of magenta like on a real linux console.
-
-Sat Jun 6 00:01:18 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc: Remove obsolete PPC and OLDWAY defines.
- * exceptions.cc: Remove obsolete PPC defines.
-
-Fri Jun 5 22:18:01 1998 Christopher Faylor <cgf@cygnus.com>
-
- * utils/Makefile.in: install should build products if necessary.
-
-Fri Jun 5 17:47:11 1998 Geoffrey Noer <noer@cygnus.com>
-
- * errno.cc (seterrno): shouldn't & against 0xff since there
- are error codes above 255.
-
-Fri Jun 5 14:35:36 1998 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (ctrl_c_handler): Ignore CTRL_LOGOFF_EVENT or
- everybody gets signalled when a user logs off. Allow program
- to clean up when receiving a CTRL_CLOSE_EVENT or CTRL_SHUTDOWN_EVENT.
- * spawn.cc (_spawnve): Delete hmap.vec from created child since
- it just gets overwritten in the child anyway.
- * pinfo.cc (lpfu): u -> user_data.
-
-Thu Jun 4 22:45:12 1998 Geoffrey Noer <noer@cygnus.com>
-
- * mmap.cc (mprotect): 3rd arg to VirtualProtect call should
- be new_prot, not prot. Also, fix check for PROT_NONE (==,
- not &).
-
-Wed Jun 3 16:37:43 1998 Geoffrey Noer <noer@cygnus.com>
-
- * exceptions.cc: Fix typo in comment
- (ctrl_c_handler): Add comments, return FALSE on CTRL_CLOSE_EVENT,
- CTRL_LOGOFF_EVENT, and CTRL_SHUTDOWN_EVENT events. Otherwise,
- we handle the console event ourselves, send a SIGINT, and return
- TRUE.
-
-Wed Jun 3 14:36:08 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * path.cc (conv_to_win32_path, conv_to_full_win32_path): resolve
- symlinks before converting.
-
-Wed Jun 3 02:11:23 1998 Geoffrey Noer <noer@cygnus.com>
-
- * exceptions.cc (ctrl_c_handler): return zero when a
- CTRL_LOGOFF_EVENT occurs.
-
-Wed Jun 3 01:01:17 1998 Geoffrey Noer <noer@cygnus.com>
-
- Reorganize fhandler-related file layout.
- * Makefile.in: Remove console.o, add fhandler_console.o. Add
- fhandler_serial.o. Remove tty.o, add fhandler_tty.o.
- * fhandler_console.cc: Was console.cc.
- * console.cc: Delete.
- * fhandler_serial.cc: Was code in fhandler.cc.
- * fhandler.cc: Delete fhandler_serial routines.
- * fhandler.h: Fix comments describing fhandler file layout.
- * fhandler_tty.cc: Was code in tty.cc.
- * tty.h: Delete.
- * fhandler_tty.h: Was tty.h.
- * tty.cc: Delete code moved to fhandler_tty.cc.
- * winsup.h: Include fhandler_tty.h instead of tty.h.
-
-Tue Jun 2 23:34:42 1998 Geoffrey Noer <noer@cygnus.com>
-
- Don't need processor-specific sysdef directories:
- * sysdef/powerpc: remove all files
- * sysdef/i386: move all files to top of sysdef directory
- * configure.in: stop setting processor-specific sysdef variable
- * configure: regenerate
- * Makefile.in: build .a files from top-level sysdef files.
-
-Tue Jun 2 16:52:18 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from lhall@rfk.com (Larry Hall):
- * console.cc (fhandler_console::fhandler_console): call
- fillin_info() to check if console attributes have already been
- set. If so, set the default foreground color to be the default
- for the console, otherwise set it to white.
- (fhandler_console::char_command): use the default color to set fg,
- bg, and bold for all cases.
-
-Mon Jun 1 14:05:01 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dir.cc (writable_directory): Avoid a malloc.
- (opendir): Convert to fully qualified path spec. Use inode from
- stat as hash instead of recalculating.
- (readdir): Try hard to generate the same inode for filenames
- as inodes returned from stat(). Handle '.' and '..' inodes
- differently than normal files. Note that '..' will still fail
- in certain pathological conditions.
- * fhandler.cc (fstat): Preserve errno around path conversion.
- * path.cc (path_conf::path_conv): Add an extra argument signifying
- whether caller wants a fully qualified Windows spec.
- (get_current_directory_name): New function. Retrieves current
- directory name into internal buffer.
- (getcwd_inner): Reorganize. Use get_current_directory_name()
- to retrieve a (possibly cached) directory name.
- (hash_path_name): Move function here from syscalls.cc. Rewrite to
- deal (simplistically) with non-absolute path specs. Use
- get_current_directory_name to absolutize path.
- * path.h: Reflect additional argument for path_conv.
- * select.cc (cygwin32_select): Remove newline from select_printf().
- * syscalls.cc (hash_path_name): Move to path.cc.
- (stat_worker): Always use full path spec so that inodes are
- calculated correctly.
- * uinfo.cc (getlogin): Make extern "C".
- * include/sys/resource.h: Put extern "C" around this file.
-
-Mon Jun 1 13:16:03 1998 Christopher Faylor <cgf@cygnus.com>
-
- * console.cc: Comment out small_printfs which issue errors
- on things like invalid escape sequences. This is very much
- unlike a normal terminal, or even like linux which console.cc
- purports to emulate.
- (console_read): Renamed from FakeReadConsole. Streamline
- slightly.
- (fhandler_console::read): Ditto.
-
-Fri May 29 22:41:18 1998 Geoffrey Noer <noer@cygnus.com>
-
- * hinfo.cc: Include unistd.h, not fcntl.h.
-
-Fri May 29 21:38:10 1998 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (mount_info::binary_win32_path_p): Don't allow
- the root mount to replace a //drive or //host specification.
-
-Fri May 29 08:20:28 1998 Geoffrey Noer <noer@cygnus.com>
-
- * winsup.h: Remove exports section in favor of external
- include files. Fix some comments.
- * {console.cc, fcntl.cc, pipe.cc}: Include unistd.h.
- * dcrt0.cc (__main): Make extern "C".
- * strace.cc: Include time.h.
- * wait.cc (_wait): Make extern "C".
- * version.h: Bump minor version to 3 in honor of /dev/windows
- support.
-
-Fri May 29 03:11:28 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * Makefile.in: Add fhandler_windows.o target
- * fhandler.h: Include <sys/ioctl.h>. fhandler_windows: new
- fhandler class that handles access to Windows message queue.
- (fhandler_base::is_windows): new virtual member function
- * fhandler_windows.cc: New file, fhandler_windows class
- implementation.
- * hinfo.cc (hinfo_vec::build_fhandler): build fhandler_windows
- class for "/dev/windows". Include <sys/ioctl.h>.
- * select.cc: New fd_windows_map class
- (fd_windows_map::convert_to_unix_fdset): New, check for Windows
- messages in a queue.
- (cygwin32_select): check for windows fd is passed to select call,
- increase size of harray by one to support windows pseudo-handle,
- do MsgWaitForMultipleObjects if windows fd passed to select call.
-
-Thu May 28 18:22:24 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * utils/cygpath.cc: New file.
- * utils/Makefile.in (PROGS): Add cygpath$(EXEEXT).
- (cygpath$(EXEEXT)): Ne target.
-
- * include/sys/cygwin.h: Declare more path conversion functions.
-
-Thu May 28 15:56:26 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/sys/ioctl.h: need to include <sys/cdefs.h>
- * syscalls.h: remove ioctl proto
-
-Wed May 27 01:34:06 1998 Geoffrey Noer <noer@cygnus.com>
-
- * cygwin.din: add sethostent/endhostent exports
- * net.cc (sethostent, endhostent): new stubs
-
-Fri May 22 17:31:50 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/cygwin32/in.h: correct typo in IPPORT_WHOIS define
-
-Fri May 22 17:00:48 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/sys/ioctl.h: add ioctl proto
-
-Wed May 20 18:52:31 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/sys/param.h: delete, file overlaps with newlib's.
- Move it to newlib/libc/sys/cygwin32/sys where such files
- are supposed to go.
-
-Wed May 20 18:20:35 1998 Geoffrey Noer <noer@cygnus.com>
-
- * select.cc (auto_del_fd_set_map::auto_del_fd_set_map): correct
- C++ problem -- can't use parens in call to new.
-
-Wed May 20 17:03:25 1998 Geoffrey Noer <noer@cygnus.com>
-
- based on patch from newsham@lava.net (Tim Newsham):
- * select.cc: FIXMEs added/adjusted
- (select_sleep): new static select helper function
- (cleanup_sockthread): ditto
- (cleanup_pipethread): ditto
- (cygwin32_select): remove degenerate goto in favor of calling
- select_sleep, call cleanup_sockthread and cleanup_pipethread
- instead of previously duplicated code.
-
-Wed May 20 02:21:37 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from Christopher Faylor <cgf@cygnus.com>
- * fhandler.cc (fhandler_serial::raw_read): When
- vmin_ == 0, vtime_ > 0, don't force only one char at a time
- to be read.
- (fhandler_serial::tcsetattr): set to.ReadIntervalTimeout
- and to.ReadTotalTimeoutMultiplier appropriately so reads
- will time out properly when vmin_ == 0, vtime_ > 0.
-
-Tue May 19 09:05:46 1998 Christopher Faylor <cgf@cygnus.com>
-
- * init.cc (set_dllname): Use consistent "cygwin32" name for dll
- if the name of the dll is actually cygwin. This will allow
- better interoperability between dlls which have been renamed,
- i.e., cygwindevo.dll -> cygwin98r1.dll.
-
-Mon May 18 22:39:35 1998 Christopher Faylor <cgf@cygnus.com>
-
- * winsup.h: Remove sig* undefs since this is now done in newlib.
- Define SIGTOMASK define for use by signal mask operations.
- * exceptions.cc (__cygwin32_exception_handler): Use SIGTOMASK.
- (sig_handle): Ditto
- * signal.cc (sigpending): Ditto.
- (sigaddset): Use SIGTOMASK. Disallow signal 0.
- (sigdelset): Ditto.
- (sigismember): Ditto.
- * strace.cc (strace_printf): It is possible for strace_mutex to
- be an invalid handle. Open the mutex if so. Call ReleaseMutex
- until exhausted since a signal may have interrupted an strace_printf.
- (strace_dump): Call ReleaseMutex until exhausted.
- * tty.cc (do_output): Remove strace printf to avoid filling up strace
- output.
- (fhandler_tty_slave::read): Use SIGTOMASK.
-
-Mon May 18 09:11:38 1998 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (dll_crt0_1): Clear errno before calling main.
-
-Thu May 14 00:37:01 1998 Geoffrey Noer <noer@cygnus.com>
-
- * dcrt0.cc: add comments, reformatting
-
-Wed May 13 17:47:23 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * times.cc (to_time_t): prevent stat from returning incorrect
- file modification time (one second less) on fat partitions due
- to round-up error.
-
-Wed May 13 16:03:07 1998 Geoffrey Noer <noer@cygnus.com>
-
- * select.cc: add comments, FIXMEs, respace, delete old
- sockets-only case that was previously commented out.
- (cygwin32_select): in case where handles and sockets are
- set, don't check that always_ready_used is zero (that case is
- covered before).
- * syscalls.cc: delete unused file_queue struct.
-
-Tue May 12 18:36:25 1998 Geoffrey Noer <noer@cygnus.com>
-
- * syscalls.cc (get_os_type): add FIXME
-
-Tue May 5 14:02:12 1998 Christopher Faylor <cgf@cygnus.com>
-
- Throughout Cygwin replace use of "sa" SECURITY_ATTRIBUTE variables
- with appropriate global variables.
- * shared.cc (shared_init): Initialize global security attribute
- variables for use in various places around cygwin.
- * fork.cc (fork_init): Remove. Functionality replaced by above.
- * dcrt0.cc (dll_crt0_1): Remove obsolete fork_init() call.
-
-Sat May 2 17:40:51 1998 Christopher Faylor <cgf@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * tty.cc (create_tty_master): Fill in ut_host utmp field with
- local host name instead of "local" to avoid "who" command timeouts.
-
-Fri May 1 22:38:20 1998 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc: Add a global to control com port reset behavior.
- (parse_options): Recognize "reset_com" as a CYGWIN32 option.
- * fhandler.cc (fhandler_serial::raw_read): Handle vmin and vtime
- more like UNIX.
- (fhandler_serial::open): Revive code to reset com port on open.
- Only reset the port if reset_com global is not set and if this
- function is being called explicitly by open.
- (fhandler_serial::tcsetattr): Make CRTSCTS flow control more
- like UNIX -- it should turn on hardware handshaking in both
- directions. Handle vmin and vtime in a manner more consistent
- with UNIX.
- (fhandler_serial::tcgetattr): Reflect CRTSCTS changes above when
- reporting this state.
- * include/sys/termios.h: Move CRTSCTS and CRTSXOFF (sic) into
- 16 bits or they will never be capable of being set.
-
-Thu Apr 30 15:05:45 1998 Christopher Faylor <cgf@cygnus.com>
-
- * console.cc (fhandler_console::init): If resetting stdin,
- make sure to reset the ConsoleCtrlHandler.
- * exceptions.cc (set_console_handler): New function broken out
- of init_exceptions(). Sets the function responsible for handling
- CTRL-C.
- (init_exceptions): Snipped out set_console_handler.
-
-Thu Apr 30 14:11:30 1998 Christopher Faylor <cgf@cygnus.com>
-
- * include/sys/cygwin.h: Remove cygnus-specific declaration.
- * winsup.h: Move cygnus-specific cygwin32_attach_handle_to_fd
- declaration here. This function may eventually be replaced by
- an osf_* function.
-
-Tue Apr 28 17:07:46 1998 Geoffrey Noer <noer@cygnus.com>
-
- * passwd.cc (parse, getpass): remove unneeded uses of NO_COPY
- * grp.cc (getgrgid, getgrnam): ditto
-
-Tue Apr 28 16:18:03 1998 Geoffrey Noer <noer@cygnus.com>
-
- * version.h: bump minor version to 2
- * errno.cc: add FIXME
-
-Wed Apr 22 15:43:56 1998 Geoffrey Noer <noer@cygnus.com>
-
- * syscalls.cc (cygname): delete
- * shared.cc (shared_name): new, was cygname
- * strace.cc, exceptions.cc, sigproc.cc, shared.cc: fix
- cygname references in light of above
-
-Wed Apr 22 14:12:09 1998 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (fd_set_map::remove_pair_by_handle): minor optimization
- * strace.cc (strace_printf): change format for consistency
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * dcrt0.cc (dll_crt0): Call global constructors explicitly
- * tty.cc (create_tty_master): Remove code which attempted to
- invoke tty constructor
-
-Tue Apr 21 16:18:27 1998 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (ucenv): inline
- (posify): Ditto
- (environ_init): remove obsolete function use
- * path.cc (symlink_check_one): Set errno here where appropriate.
- (readlink): Rely on errno set by symlink_check_one rather than
- defaulting to EINVAL. Should fix problems with RCS.
-
-Tue Apr 21 15:36:41 1998 Christopher Faylor <cgf@cygnus.com>
-
- * Implement a NOSTRACE preprocessor define to allow building
- Cygwin32 without any STRACE code.
- * configure.in: Add entries for architecture specific programs
- to allow easier cross-compile builds
- * configure: Ditto
- * Makefile.in: Ditto
- * console.cc (fhandler_console::char_command): Fix two problems
- with cursor position report: 1) it reported position relative
- to beginning of buffer rather than beginning of screen, 2) it
- reported y, x in reversed order
- * dcrt0.cc: Remove NO_COPY from variables that don't need it.
- Remove variables obsoleted by NO_COPY.
- (dll_crt0_1): strace settings are now inherited. Don't try
- to initialize strace early. Remove initialization of variables
- which are now handled automatically by NO_COPY. Set error mode
- for Cygwin32 to fail on critical errors rather than popping up
- a dialog box.
- * spawn.cc (spawn_guts): Always use default error mode when
- spawning a new process. Move error message to more generally
- useful location. Terminate signal handling in a cygwin parent
- process or two processes will be handling signals.
- (_spawnve): Inherit strace stuff
- * exceptions.cc (events_init): Provide more information on
- "Catastrophic failure". Change error message wording slightly.
- * fork.cc: Remove obsolete structure
- (cygwin_fork_helper1): Remove use of obsolete structure. Inherit
- strace settings in child processes.
- * sigproc.cc (sigproc_init): Set wait_sig priority immediately
- after thread creation.
- * smallprint.c: Remove unneeded include
- * strace.cc: Reorganize to handle NOSTRACE
- (strace_open): Use strace entries in pinfo structure which are
- now inherited
- (strace_dump): ditto
- (strace_init): preprocessor define STRACE_HHMMSS causes strace
- output to use alternate log file format.
- (strace_printf): ditto
- * syscalls.cc (access): Remove SetErrorMode in favor of global
- cygwin32 setting in dll_crt0_1.
- * fhandler.cc: Handle NOSTRACE
- * tty.cc: Ditto
- * window.cc: Ditto
- * include/sys/strace.h: Ditto
- * winsup.h: Move strace_file handle from per_process to pinfo so
- that it can be inherited. Remove obsolete pinfo entry.
-
-Tue Apr 21 14:30:52 1998 Christopher Faylor <cgf@cygnus.com>
-
- * hinfo.cc (cygwin32_attach_handle_to_fd): New function
- * include/sys/cygwin.h: Ditto.
- * cygwin.din: Export new cygwin-specific function
-
-Tue Apr 21 02:32:08 1998 Geoffrey Noer <noer@cygnus.com>
-
- * syscalls.cc: comment out file_queue struct that doesn't
- seem to be used for anything anymore. Don't need to include
- stdarg.h or sys/socket.h. Include utmp.h. Minor respacing.
- Move all functions from misc.cc here.
- (_read): change strace debug printf function name to _read
- (logout): rename success to res
- * misc.cc: delete file
- * Makefile.in: adjust for above change
-
-Tue Apr 21 01:45:05 1998 Geoffrey Noer <noer@cygnus.com>
-
- * dir.cc: new file for directory-related functions, was
- dirsearch.cc.
- (mkdir, rmdir, writable_directory): move here from syscalls.cc,
- writable_directory no longer static
- * dirsearch.cc: delete file
- * winsup.h: add proto for writable_directory.
- * errno.cc: new file for errno-related functions, move errmap
- struct here from syscalls.cc
- (seterrno): move from syscalls.cc
- (strerror): move from strerror.cc
- * strerror.cc: delete file
- * syscalls.cc: delete everything moved to any of the above files
- * Makefile.in: adjustments for above
-
-Thu Apr 17 16:43:23 1998 Geoffrey Noer <noer@cygnus.com>
-
- * termios.cc: add comments, add extern "C" in front of exported
- calls, move debugging local functions to end of file
- * winsup.h: remove fork_terminate proto for function that is no
- longer with us. Add strccpy proto.
- * spawn.cc (_spawnve): make static
- (strccpy): remove in favor of identical function in exec.cc
- * exec.cc (strccpy): no longer static
-
- patch from newsham@lava.net (Tim Newsham):
- * select.cc (cygwin32_select): fix off by one error, stop
- using memcpy to copy memory over itself
-
-Thu Apr 16 16:23:00 1998 Geoffrey Noer <noer@cygnus.com>
-
- * net.cc: respace, put all fhandler_socket functions together
- (getsockopt): fix case statement bug resulting in faulty strace
- output
- (setsockopt): ditto
- * shared.cc: throughout, rename global h to cygwin_shared_h
- * strerror.cc: make error global a local variable
- * fhandler.h: add comments, add virtual function always_read_ready
- to fhandler_serial which should return zero to allow non-blocking
- serial I/O.
- * Makefile.in: select.cc should depend on select.h
-
-Wed Apr 15 16:14:01 1998 Geoffrey Noer <noer@cygnus.com>
-
- * select.h: new file, containing macros used by select.cc.
- * select.cc: remove them from here, include select.h
-
-Wed Apr 15 15:23:55 1998 Geoffrey Noer <noer@cygnus.com>
-
- * ntea.cc (NTReadEARaw): mark as static, don't check allow_ntea
- since this is only accessed by functions that have already checked
- it.
-
-Tue Apr 14 14:07:54 1998 Geoffrey Noer <noer@cygnus.com>
-
- * cygwin.din: export truncate call
-
-Mon Apr 13 23:15:13 1998 Geoffrey Noer <noer@cygnus.com>
-
- Throughout Cygwin32, rename *u for per_process data *user_data.
- Likewise, rename *s for shared memory data *cygwin_shared.
- Respace where necessary.
- * registry.cc: minor respace
- * registry.h: ditto
- * net.cc: ditto
- * fhandler.cc (fhandler_base::read): don't redeclare int len
- * syslog.cc: add FIXME, reformatting, remove extern "C" around
- whole file, add before exported functions
- (syslog): rename second cp char pointer cp2
- (setlogmask): comment out unused function
-
-Mon Apr 13 17:55:43 1998 Geoffrey Noer <noer@cygnus.com>
-
- * environ.cc (parse_options): add "ntea" setting to CYGWIN32
- env variable. Setting determines whether NTEA is used or not.
- * ntea.cc: Add allow_ntea global which is inited to FALSE.
- Now instead of immediately returning FALSE, make all
- functions check allow_ntea variable and use or not use NTEA
- based on its value.
- * ps.cc (main): widen Win32_pid field by one to better handle
- Win 95 pids.
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * shared.cc (shared_info::initialize): increase default
- heap_chunk_size to 128 mb to get around the problem that
- Cygwin32 still can't cope with a split heap properly.
-
-Wed Apr 8 18:04:07 1998 Geoffrey Noer <noer@cygnus.com>
-
- * net.cc (cygwin32_bind, cygwin32_getsockname, cygwin32_listen,
- cygwin32_shutdown): if should check sock, not s.
-
-Wed Apr 8 15:00:46 1998 Geoffrey Noer <noer@cygnus.com>
-
- Eliminate warnings revealed by -Wshadow -Wall:
- * console.cc (FakeReadFile): fix aggregate with partly bracketed
- initializer (add missing brackets).
- * tty.cc (fhandler_tty_slave::close): remove unused variable tty
- (fhandler_tty_slave::dup): ditto
- (fhandler_tty_slave::send_ioctl_request): ditto
-
-Wed Apr 8 03:04:11 1998 Geoffrey Noer <noer@cygnus.com>
-
- Eliminate warnings revealed by -Wshadow -Wall:
- * console.cc (FakeReadFile): change variable name index to
- modifier_index.
- (fhandler_console::read): remove second definition of flags
- * dcrt0.cc (build_argv): rename s to start, e to end
- (insert_files): reformat, add parens around assign used as truth
- value, make i a DWORD, remove dup def of i.
- * dlfcn.cc (set_dl_error): rename s to str
- (checkAccess): rename to check_access
- (checkPathAccess): rename to check_path_access
- (getFullPathOfDll): rename to get_full_path_of_dll, don't
- redeclare len
- * dll_init.cc (DllList::detachDll): rename index to dll_index
- * fork.cc (cygwin_fork_helper1): rename index to dll_index,
- reformat slightly, rename res in dll load section to loadres,
- don't redeclare rc two additional times
- (dump_jmp_buf): rename s to sbuf
- * grp.cc (initgroups): rename group arg to grp
- * hinfo.cc (digits): rename s to str
- (hinfo_vec::build_fhandler): rename first buf variable to
- buf_info, the second to buff.
- (hinfo_vec::linearize_fd_array): cast sizeof return to int,
- declare i in for loop
- (hinfo_vec::de_linearize_fd_array): declare i in for loop
- * misc.cc (nice): rename pri to priority, index to curr
- (cygname): rename s to str
- (login): rename tty to currtty
- (logout) put missing parens around arg to sizeof calls
- * net.cc (DuplicateSocket): rename function to duplicate_socket,
- rename s arg to sock
- (fhandler_socket::fhandler_socket): rename s arg to sock
- (socketpair): rename sin to sock_in
- (cygwin32_rexec): rename passwd arg to password
- * passwd.cc (parse): rename stat array to tmpbuf
- * resource.cc (fill_rusage): rename creation to creation_time,
- exit to exit_time, kernel to kernel_time, user to user_time
- (getrusage): rename rusage arg to rusage_in
- * sigproc.cc (proc_terminate): move i declaration outside of
- loop, get rid of extra declaration
- (getsem): rename s to str
- (proc_strace): declare i at top of function, remove extra two
- declarations of it later
- * smallprint.c: include ctype.h for isalnum proto
- (__small_vsprintf): put parens around assign used as truth value
- * spawn.cc (spawn_guts): rename both s variables to str, remove
- redeclarations of i
- * strace.cc (mark): rename s arg to str
- * syscalls.cc (chown): remove unused vars group, passwd
- (access): rename s to st
- (ctermid): rename s to str
- * termios.cc (cfsetospeed, cfsetispeed): rename s to speed
- * times.cc (times): rename creation to creation_time,
- exit to exit_time, kernel to kernel_time, user to user_time
- (time_t_to_filetime, timeval_to_filetime): rename time to time_in
- * tty.cc (create_tty_master): rename utmp variable our_utmp
- (fhandler_tty_master::init): rename ttynum arg ttynum_in
-
-Tue Apr 7 17:18:05 1998 Geoffrey Noer <noer@cygnus.com>
-
- * syscalls.cc (seterrno): add FIXME
- * path.cc (symlink_check_one): change comment wording
-
- patch from Tom Tromey (tromey@cygnus.com)
- * syscalls.cc (access): Call SetErrorMode to turn off critical
- errors dialog.
-
- patch from Mikey (jeffdb@netzone.com):
- * fhandler.cc (fhandler_disk_file::open): under Win95, set
- S_IXOTH|S_IXGRP|S_IXGRP if the first two bytes of a file contain
- a '#!'.
- (fhandler_disk_file::check_execable_p): consider shell scripts
- execable
-
-Mon Apr 6 20:55:06 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/sys/cygwin.h: add protos for cygwin32 path conversion
- functions.
-
-Wed Apr 1 16:12:58 1998 Geoffrey Noer <noer@cygnus.com>
-
- * {fhandler.cc, fhandler.h, hinfo.cc, console.cc}: Rename
- fhandler_tty class to fhandler_serial
-
-Tue Mar 31 16:27:36 1998 Geoffrey Noer <noer@cygnus.com>
-
- * ntea.cc: temporarily disable reading/writing NTEA information
- due to the large penalty incurred on NT fat partitions.
-
-Fri Mar 27 13:35:30 1998 Geoffrey Noer <noer@cygnus.com>
-
- * environ.cc (parse_options): change struct to union to avoid
- references to uninitialized fields.
-
-Thu Mar 26 19:03:00 1998 Eric Bachalo <ebachalo@cygnus.com>
-
- * dcrt0.cc (insert_files): added this function to replace
- -@file in the command line with the contents of the file
- (dll_crt0_1): calls insert_files before building argv
-
-Wed Mar 25 15:25:26 1998 Geoffrey Noer <noer@cygnus.com>
-
- And more:
- * {fhandler.cc, fhandler.h, tty.cc, net.cc, console.cc}: make
- ioctl calls' cmd arg unsigned, ditto for access arg of init calls.
- * console.cc (fhandler_console::fillin_info): add parens around
- assignment used as truth value.
- (FakeReadFile): make copied_chars a size_t
- (fhandler_console::read): make i in loop unsigned
- * environ.cc (setenv): make l_value unsigned, add parens around
- assignments used as truth values.
- * exceptions.cc (call_handler): supposed to return an int and
- wasn't at the end of control flow. Now returns 1 there.
- * fhandler.h (~fhandler_base): destructor should be marked virtual
- * misc.cc (login): add parens around assignment used as truth
- value.
- * net.cc: cast INVALID_SOCKET to int in comparisons
- (fhandler_socket::ioctl): remove int cast to FIONBIO since cmd
- is now unsigned
- (get_win95_ifconf): add cast to signed vs unsigned int comparison.
- * ntea.cc (NTReadEA): add cast to signed vs unsigned int
- comparison.
- * path.cc (getcwd_inner): make len a size_t
- * pinfo.cc (cygwin32_winpid_to_pid): add comment
- * select.cc (cygwin32_select): make wait_ret an int
- * signal.cc (kill_worker): add parens around assignments used as
- truth values.
- * sigproc.cc (wait_sig): make rc a DWORD
- (sig_send): add parens around assignment used as truth value.
- * strace.cc: make inqueue global a static DWORD
- * tty.cc (do_output): add cast to signed vs unsigned int
- comparison.
- (fhandler_pty_master::open): remove unused handle nh
-
-Tue Mar 24 18:03:59 1998 Geoffrey Noer <noer@cygnus.com>
-
- More spring cleaning:
- * net.cc: move LOAD macro definition out of winsock_init,
- correction to make it valid ANSI C++.
- * grp.cc (read_etc_group): pass default line directly to
- add_grp_line call
-
-Mon Mar 23 19:21:00 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Christopher Faylor):
- * spawn.cc (spawn_guts): Don't call close_all_files if a cygwin
- process has been spawned. Otherwise, we close tty handles twice.
-
-Fri Mar 20 23:01:24 1998 Geoffrey Noer <noer@cygnus.com>
-
- * pinfo.cc (pinfo_list::init): Initialize next_pid to PBASE.
- (pinfo_list::operator []): Now index is given by pid mod size().
- (pinfo_list::allocate_pid): Allow more pid numbers than spaces in
- the process table. Pids now can range from PBASE (1000) to
- INT_MAX. At that point they wrap to 1000 again. For speed, use
- modular arithmetic to map pids into table.
- * winsup.h: move PBASE to pinfo.cc, rename next_pid_index to
- next_pid
- * utils/ps.cc (main): reorg of what's printed where, listing pid
- first.
-
-Thu Mar 19 15:05:07 1998 Geoffrey Noer <noer@cygnus.com>
-
- * winsup.h: Change section name in NO_COPY definition. We were
- using a .data$nocopy section to avoid copying certain data on
- fork. The linker used to include this between __data_start__ and
- __data_end__, but that broke building the cygwin32 dll. The fix
- is to rename the section ".data_cygwin_nocopy" and explictly
- include it after __data_end__.
-
-Wed Mar 18 15:03:51 1998 Geoffrey Noer <noer@cygnus.com>
-
- * tty.h: fix ttyslot proto; it returns an int
- * glob.h: fix glob proto; it returns an int
-
-Mon Mar 16 16:16:40 1998 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: stop installing the dll in the lib directory as
- well as the bindir.
- * environ.cc (parse_options): don't need to call malloc
-
-Mon Mar 16 11:56:23 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Christopher Faylor):
- * tty.cc (fhandler_tty_slave::dup): Don't set flags to 0. Flags
- have already been set in wrapper.
- * net.cc: Rename `s' variable which shadows global `s'.
- * termios.cc: ditto
- * time.cc: ditto
-
-Tue Mar 10 15:54:04 1998 Geoffrey Noer <noer@cygnus.com>
-
- * version.h: up CYGWIN_DLL_VERSION_MINOR
-
-Tue Mar 10 15:41:29 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Christopher Faylor):
- * spawn.cc (spawn_guts): Make argument handling after `#! pgm'
- handle spaces similarly to UNIX. Close "linearized" file handles
- when a non-cygwin32 binary is executed or suffer hangs on exit.
- Reorganize lpReserved2 buffer to avoid conflicts with Microsoft
- usage which resulted in incorrect stdin/stdout operation with
- programs compiled using MSVC.
- * pinfo.cc (pinfo_init): Accommodate change to lpReserved2
- organization.
-
-Mon Mar 9 19:27:17 1998 Geoffrey Noer <noer@cygnus.com>
-
- * syscalls.cc (_open): modify to take a variable number of
- arguments to match newlib's fcntl.h.
- * environ.cc (parse_options): rewrite struct known to conform
- to ANSI standards. Can't statically initialize, so do so
- dynamically at the beginning of the function instead.
-
- patch from jeffdb@netzone.com (Mikey):
- * dcrt0.cc (build_argv, compute_argc): need to escape quotes
-
-Sat Feb 28 16:41:54 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * fhandler.cc (fhandler_base::init): call set_flags based on
- access arg.
- * net.cc: include fcntl.h
- (fhandler_socket::fhandler_socket): made sockets O_RDWR
-
-Thu Feb 26 23:41:54 1998 Geoffrey Noer <noer@cygnus.com>
-
- Beta 19 release made.
-
-Sun Feb 22 23:46:31 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * Makefile.in: Do not link cygwinb19.dll with libwsock32.a
- * exceptions.cc: add proto for i_WSACleanup.
- (sig_handle): call *i_WSACleanup if winsock was inited.
- * hinfo.cc: add proto for i_getpeername.
- (hinfo_vec::build_fhandler): call *i_getpeername if winsock
- was inited
- * net.cc: wsock32, i_wsockimports - new globals. Throughout
- file, call winsock functions via indirect pointers.
- (winsock_init): dynamically load wsock32.dll and resolve addresses
- of exports.
- (cygwin32_rcmd, cygwin32_rexec, cygwin32_rresvport): resolve
- addresses of exports.
- * select.cc: add protos for i___WSAFDIsSet, i_WSAGetLastError,
- i_select, i_socket, i_closesocket. WINSOCK_FD_ISSET changed to
- use indirect pointer. Direct winsock calls changed to indirect.
- (cygwin32_select): initialize winsock before calling select in
- degenerate case.
- * winsup.h: remove protos for ScreenRows, ScreenCols,
- ScreenGetCursor, ScreenSetCursor.
-
-Sun Feb 22 17:44:55 1998 Geoffrey Noer <noer@cygnus.com>
-
- * environ.cc (parse_options): comment out -- no longer
- compiles with egcs. Will rewrite/enable later.
-
-Sun Feb 22 13:49:10 1998 Geoffrey Noer <noer@cygnus.com>
-
- * syscalls.h: remove protos for _open, _read, _write since
- they are in newlib headers that are already included
- * syscalls.cc (_read): return int, not ssize_t
- (_write): ditto
-
-Sat Feb 21 14:21:17 1998 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: rename dll to cygwindevo.dll
-
-Sat Feb 21 01:33:56 1998 Geoffrey Noer <noer@cygnus.com>
-
- * cygwin.din: remove dup definition of endpwent
-
-Thu Feb 19 14:20:21 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/cygwin32/cygwin_dll.h: Correct protection wrapper
-
-Tue Feb 17 20:21:24 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/Windows32/Structures.h: tagBITMAPFILEHEADER should
- be packed.
-
-Tue Feb 17 19:34:41 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Christopher Faylor):
- * cygwin.din: export sigpause
- * signal.cc (sigpause): New "compatibility interface" to
- sigsuspend function. Used currently by inetutils.
-
-Tue Feb 17 11:43:27 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * tty.h (class tty): Add slave_opened field.
- * tty.cc (fhandler_tty_master::init): Initialize slave_opened.
- (do_output): Only return with EOF if the slave has been opened.
- (fhandler_tty_slave::open): Set slave_opened.
- (fhandler_pty_master::open): Initialize slave_opened.
-
- * tty.cc (fhandler_pty_master::read): Change type of n to DWORD.
- If there are no characters to read, and the descriptor is in
- nonblocking mode, just return EGAIN.
-
-Mon Feb 16 15:11:25 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * tty.h (class tty): Remove handle_pid and slave_handles fields.
- (class tty_list): Add getcount method.
- * tty.cc (tty::init): Initialize input_handle and output_handle.
- (tty_list::free_tty): If we just freed the last reference to this
- tty, close input_handle and output_handle.
- (fhandler_tty_master::init): Don't initialize handle_pid and
- slave_handles.
- (do_output): Instead of just calling ReadFile, loop using
- PeekNamedPipe and check whether the tty has been closed. Return 0
- on EOF and -1 on error.
- (process_output): Only print debugging error message if error
- occurs in do_output.
- (fhandler_tty_slave::open): Always duplicate handles from master.
- Never close handles in source. Don't change slave_handles.
- (fhandler_tty_slave::close): Don't change slave_handles, and don't
- close tty handles.
- (fhandler_tty_slave::linearize): Call attach_tty.
- (fhandler_tty_slave::de_linearize): Don't call attach_tty.
- (fhandler_tty_slave::dup): Don't increment slave handles.
- (fhandler_pty_master::open): Don't initialize handle_pid and
- slave_handles.
- (fhandler_pty_master::close): Don't check slave_handles, and don't
- close tty handles.
- (fhandler_pty_master::read): Handle EOF return value from
- do_output.
- (fhandler_pty_master::linearize): Call attach_tty.
- (fhandler_pty_master::de_linearize): Don't call attach_tty.
-
- * fork.cc (cygwin_fork_helper1): Copy strace_mask from parent to
- child.
-
-Thu Feb 12 20:33:57 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Christopher Faylor):
- * utils/cygwin.cc: Modify -s option to use new strace_mask entry
- in pinfo. Prepare for future ability to specify an strace file.
-
-Thu Feb 12 11:57:26 1998 Geoffrey Noer <noer@cygnus.com>
-
- * grp.cc (read_etc_group): add a default /etc/group in memory
- if /etc/group isn't found
- (getgrnam): return NULL if requested group isn't found instead
- of returning a default group
-
-Wed Feb 11 15:59:10 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * strace.cc (strace_open): do not close u->strace_file if it
- points to stderr.
- * malloc.cc (malloc_init): do not check for application's malloc
- in a forkee, this breaks memory coherency in a forkee and forker.
- use_internal_malloc flag now copies on fork.
-
-Tue Feb 10 18:11:30 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Christopher Faylor)
- Throughout sources, mark statics and globals as NO_COPY where
- appropriate.
- * fork.cc (cygwin_fork_helper1): Remove #if 0 around fork_copy of
- cygwin data/bss. Remove __malloc_copy since it is no longer
- necessary.
-
-Tue Feb 10 15:30:19 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Christopher Faylor)
- * console.cc (fhandler_console::write): Implement xterm style
- escape sequences for setting title in the console title bar.
- * fhandler.h: Define constants for console title escape sequence.
-
-Tue Feb 10 14:16:17 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/a.out.h: remove junk chars introduced by mailer
- when this header was sent to us
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * libccrt0.cc: rename cygwin_attach_dll to cygwin32_attach_dll
-
- patch from cgf@bbc.com (Christopher Faylor):
- * environ.cc: fix off by one problem
-
-Mon Feb 9 14:56:00 1998 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: add registry.h to environ.o deps
-
-Mon Feb 9 14:42:24 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * Makefile.in (DLL_OFILES): Rename dllinit.o to dll_init.o.
-
- * tty.cc (fhandler_tty_slave::close): Don't close the tty handles
- if the slave and the master are the same process.
-
- * path.cc (read_mounts): Change key parameter to reference, to
- avoiding running the destructor.
-
-Mon Feb 9 13:53:50 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Christopher Faylor):
- Moves all environment manipulation into environ.cc.
- Switches to CYGWIN32 for settings:
- set CYGWIN32=[no]title [no]strip_title [no]binmode [no]glob
- strace=mask:cache,file [no]tty
- (set STRACE=whatever is still honored).
- Propagates tty settings to all subprocesses regardless of
- unsetting of environment variable.
- Moves strace mask into pinfo structure for easier future
- manipulation by external program. Moves strace_file into the
- vacated position for automatic use in forked processes.
- Propagates old title to execed processes so that they can
- correctly restore the correct title when they exit.
- * console.cc: Use PID_USETTY setting in process_state so that
- tty state can be easily inherited.
- (set_console_title): New function to set console title.
- * syscalls.cc: Use PID_USETTY setting in process_state so that
- tty state can be easily inherited.
- * tty.cc: Ditto.
- * hinfo.cc: Ditto.
- (hinfo_vec::de_linearize_fd_array): Return last location in buffer
- for further potential processing.
- * dcrt0.cc: Add global variables for control of glob and title,
- set by environ_init. Mark some variables as NO_COPY.
- Remove routines and variables for dealing with environment.
- (dll_crt0_1): Move environment initialization into separate
- function. Honor 'noglob' CYGWIN32 setting.
- * environ.cc (environ_init): New function to initialize the
- environ table. Also scans for CYGWIN32 environment variable,
- setting appropriate values.
- (ucenv): New function. Upper cases an environment variable.
- (parse_options): New function. Parse CYGWIN_* environment
- variable.
- (posify): New function. Convert a Windows env path spec to
- cygwin.
- (env_sort): New function. Sort an environ block.
- (winenv): New function. Returns a windows style environment
- block.
- * fhandler.cc (fhandler_base::read): Reflect change to location of
- strace_mask.
- * fork.cc (cygwin_fork_helper1): Remove save/restore of some
- settings since this is automatic now with new dll data copy. Save
- PID_USETTY setting in child process_state.
- * strace.h: Cosmetic change.
- * pinfo.cc (pinfo_init): Call environ_init here since it may
- affect further processing in this function. Use old console title
- from "parent" process if execed process. Reflect change to
- location of strace_mask.
- * spawn.cc (spawn_guts): Remove environment manipulation code.
- Use new winenv function call instead. Save old title in block of
- memory copied to newly execed process if title is being displayed.
- * strace.cc: Changes to reflect new location for strace_mask and
- strace_file. These are now automatically inherited on fork.
- * winsup.h: Move strace_mask into pinfo to allow possible
- manipulation by other processes. Put u->strace_file in uptr
- structure so that it will be automatically duplicated on fork,
- removing the necessity of initializing strace in a forked
- process. Add functions/variables associated with environment
- manipulation and console title setting.
-
-Mon Feb 9 03:06:56 1998 Geoffrey Noer <noer@cygnus.com>
-
- Extensive reformatting in new files from next patch.
- Rename dllinit.h file to dll_init.h and likewise for dll_init.cc.
- Rename cygwin_detach_dll to cygwin32_detach_dll throughout.
- Similarly, rename cygwin_attach_dll and _cygwin_dll_entry.
- And rename sanityAndSyncCheck to check_sanity_and_sync.
- Also:
- * dll_init.h: don't include winsup.h
- * dll_init.cc: include winsup.h here instead
- * dlfcn.cc: include winsup.h, don't include windows.h
- * cygwin.din: rename cygwin_detach_dll to cygwin32_detach_dll.
-
- patch from giac@dalim.de (Philippe Giacinti):
- Copy data areas of cygwin-compiled dlls on fork(),
- implement dlopen/dlsym/dlclose/dlerror calls.
- * Makefile.in: add dlfcn.o and dllinit.o to DLL_OFILES, add
- dllinit.h dependencies
- * cygwin.din: dll_dllcrt0, cygwin_detach_dll, dlopen, dlclose,
- dlsym, dlerror, dlfork -- new exports.
- * dcrt0.cc: include dllinit.h, mark u pointer as NO_COPY.
- (sanityAndSyncCheck): new, code moved from dll_crt0_1.
- Initialize all linked dlls before calling main().
- * dlfcn.cc: new file.
- * dllinit.cc: new file.
- * dllinit.h: new file.
- * exceptions.cc: mark some variables with NO_COPY.
- * fork.cc: include dllinit.h; declare cygwin.dll data/bss
- start/end.
- (cygwin_fork_helper1): copy data/bss of cygwin.dll itself to child
- process (the code is disabled now); copy data areas of
- linked/loaded dlls (if any); free loaded dll list on cleanup.
- * include/cygwin32/cygwin_dll.h: new file.
- * include/dlfcn.h: new file.
- * libccrt0.cc (cygwin_crt0_common): new, code derived from
- cygwin_crt0, MainFunc parameter added.
- (cygwin_crt0): call cygwin_crt0_common.
- (cygwin_attach_dll): new.
- * shared.cc: mark some data as NO_COPY
- * strace.cc: mark some data as NO_COPY
- * winsup.h: add dll_dllcrt0 proto, NO_COPY macro.
-
-Sun Feb 8 17:51:26 1998 Geoffrey Noer <noer@cygnus.com>
-
- * getopt.c: new. Import Berkeley getopt code modified for use
- in Cygnus' kerberos implementation (including the writing of
- getopt_long by Chris Provenzano (proven@cygnus.com)) then modified
- a bit more to get it working in Cygwin32. Although we were
- going to remove getopt, it appears that too many programs would
- need fixing to remove it completely. Whether getopt should be
- included in Cygwin32 should be decided at a later time.
- * include/getopt.h: new. Import Berkeley getopt.h.
- * Makefile.in: add getopt.o to LIBCOS
- * utils/Makefile.in: remove include of ../../include since
- getopt.h is now in winsup/include, also revert recent change
- of addition of GETOPT_OBJS.
-
-Fri Feb 6 16:28:19 1998 Geoffrey Noer <noer@cygnus.com>
-
- * cygwin.din: remove set_new_handler and cygwin_set_attributes
- exports
- * version.h: up major version number
- * Makefile.in: rename dll to cygwinb19.dll
- * syscalls.cc (cygwin_set_attributes): axe
-
-Thu Feb 5 18:28:37 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/Windows32/Functions.h: add protos for
- DdeCmpStringHandles and DdeCreateDataHandle
- * Makefile.in: stop including ../libiberty/getopt* since
- we aren't exporting or using them
- * utils/Makefile.in: add new variable for libiberty getopt objs
- which is linked in for cygwin.exe
-
-Thu Feb 5 17:59:12 1998 Geoffrey Noer <noer@cygnus.com>
-
- syscalls.cc: move ppc dll_entry asm code to...
- dcrt0.cc: ...here
-
- Import new globbing code from NetBSD 1.3
- * glob: delete subdirectory
- * glob.c: new file
- * glob.h: new file
- * Makefile.in: remove glob from submakes, remove glob/libglob.a
- from DLL_IMPORTS, fix dcrt0 glob.h dependency
- * configure.in: don't configure glob subdirectory
- * configure: regenerate
- * dcrt0.cc: include glob.h, not glob/glob.h.
- (globify): don't call glob with GLOB_NOESCAPE which isn't a valid
- flag with this glob
-
-Wed Feb 4 16:14:13 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- Allow system administrator to enter into the HKLM registry tree
- a predefined mount table inherittable by all cygwin users. The
- predefined mounts are non-mandatory so the user's mount table has
- a higher priority than the default one. Cygwin reads HKLM tree
- in read-only mode.
- * path.cc (read_mounts): new, code derived from
- mount_info::from_registry().
- (mount_info::from_registry): call read_mounts from user's table,
- then from system-wide mount table.
- * registry.cc (reg_session::reg_session): key and access arguments
- added.
- (reg_key::init): access argument added.
- (reg_key::reg_key): access argument added.
- * registry.h (class reg_key): init prototype changed, default
- argument of reg_key added.
- (class reg_session): default arguments of constructor added.
-
-Wed Feb 4 15:38:59 1998 Geoffrey Noer <noer@cygnus.com>
-
- * include/a.out.h: new coff header file
-
-Wed Feb 4 01:55:18 1998 Geoffrey Noer <noer@cygnus.com>
-
- * uinfo.cc: define DEFAULT_UID/GID here
- * winsup.h: removed DEFAULT_UID/GID defs and unused
- set_console_title proto. Did some major reorganizing,
- and a little reformatting, commenting.
-
-Tue Feb 3 23:59:23 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- Replace u->self and this_procinfo () with new `myself' pointer
- wherever appropriate. Also replace get_pid() calls with a
- simple ->pid reference.
-
-Mon Feb 2 12:34:49 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from sos@prospect.com.ru (Sergey Okhapkin):
- * console.cc (FakeReadFile): limit bytes to read to 30000 due to
- Win NT 4.0 SP3 bug. Kill foreground process group with SIGWINCH
- on console buffer size change if tty support enabled.
- * include/sys/termios.h: define more constants.
- * tty.cc (fhandler_pty_master::ioctl): kill foreground process
- group with SIGWINCH on window resizing.
-
-Mon Feb 2 12:14:49 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * dcrt0.cc (dll_crt0_1): Initialize u->self here, early in a
- forked process so the correct pid is used in strace output and so
- signals do not end up being erroneously sent to the parent.
- * exceptions.cc: Make a global variable static. Some minor
- optimizations.
- (call_handler): Make sure that the signal mask is restored when
- sig_dispatch mutex is unavailable.
- Reorder asm statements to prevent clobbering of flags register by
- preceding ors or risk random inexplicable behavior when returning
- from a signal handler.
- * fork.cc (cygwin_fork_helper1): Put setjmp restore in child's
- pinfo. Have the child figure out its pid earlier in the
- initialization process. Don't print a "child failed" error if the
- child failed during initialization due to a CTRL-C. This is still
- not quite right (see comment).
- * sigproc.cc (sig_send): Remove unlock/lock_pinfo or suffer
- consistent hangs in zsh. Make {allow,block}_sig_dispatch globally
- available.
- (wait_sig): Fix problem where blocked signals would still be
- processed if queued. Add debugging SIGNOQUEUE conditional to turn
- off signal queueing, making cygwin more like traditional UNIX.
- * sigproc.h: Add {allow,block}_sig_dispatch functions.
-
-Mon Jan 26 17:33:57 1998 Geoffrey Noer <noer@cygnus.com>
-
- * path.cc (mount_info::init): don't hardcode C: as the default
- slash mount. Instead, use the drive letter that the OS is loaded
- on.
-
-Mon Jan 26 13:33:57 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * fork.cc (cygwin_fork_helper): Move setting PID_INITIALIZING
- process_state here to avoid erroneously setting it permanently
- via proc_register().
- * pinfo.cc (pinfo_init): Delay notifying "parent" when execing
- until this process is ready to receive signals or risk a race
- condition if exec parent calls sigproc_terminate prior to
- the child exec.
- * sigproc.cc (proc_subproc): Don't set PID_INITIALIZING here.
- It is too late in the process creation.
- (sig_send): Reset sigsuspend mutex prior to use to avoid a race.
- (wait_sig): Create sigsuspend mutex as an auto reset to attempt
- to avoid a race condition. Notify parent that this process is
- ready if we were execed (code moved from pinfo_init). Change
- PulseEvents to SetEvents to avoid races
- * spawn.cc (spawn_guts): Move setting PID_INITIALIZING
- process_state here to help avoid race.
-
-Fri Jan 23 12:31:37 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * malloc.cc (malloc_critical_section): New static variable.
- (malloc_init): New function.
- (__malloc_lock, __malloc_unlock): New functions.
- * winsup.h (malloc_init): Declare.
- * heap.cc (heap_init): Call malloc_init.
-
-Thu Jan 22 18:46:40 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * tty.h (class tty): Change slave_handles to int.
- * tty.cc (fhandler_tty_slave::open): Check for invalid tty
- handles. If this is the first slave, set slave_handles to 2;
- otherwise, increment slave_handles.
- (fhandler_tty_slave::close): Only close the tty handles if the
- slave_handles field drops to 1.
- (fhandler_tty_slave::write): Add a debugging message if WriteFile
- fails.
- (fhandler_tty_slave::dup): Set ttynum of new fhandler. Increment
- slave_handles if appropriate.
- (fhandler_pty_master::close): Only close the tty handles if the
- tty is no longer allocated.
-
- * tty.h (class tty): Add handle_pid and slave_handles fields.
- * tty.cc (attach_tty): Call connect_tty even if use_tty is not
- set.
- (detach_tty): Don't check use_tty.
- (fhandler_tty_master::init): Initialize handle_pid and
- slave_handles of tty.
- (do_input): Treat \r as end of line character.
- (do_output): Only set output_done_event if it is not NULL.
- (fhandler_tty_slave::open): Don't worry if we can't open
- output_done_event. Check slave_handles field of tty to decide
- from where to duplicate the handles. Call detach_tty on error.
- If we are now the owner of the slave handles, mark the tty
- appropriately.
- (fhandler_tty_slave::close): Only close output_done_event if it is
- not NULL. Check for errors from CloseHandle. Close the tty
- handles if we own them.
- (fhandler_tty_slave::write): Only wait for output_done_event if it
- is not NULL.
- (fhandler_tty_slave::read): If nobody owns the tty, return EOF.
- (fhandler_tty_slave::dup): Attach the tty. Don't duplicate
- output_done_event if it is NULL. Detach the tty on error.
- (fhandler_pty_master::open): Initialize handle_pid and
- slave_handles of tty. Don't create output_done_event.
- (fhandler_pty_master::close): Only close output_done_event if it
- is not NULL. Check for errors from CloseHandle. Only close the
- tty handles if we own them.
- (fhandler_pty_master::read): Only set output_done_event if it is
- not NULL.
- * hinfo.cc (de_linearize_fd_array): Don't set use_tty just because
- we find a tty to delinearize.
-
-Wed Jan 21 21:58:27 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * sigproc.cc: Changes in wait_sig/sig_send semaphore/event
- signaling to attempt to eliminate races.
-
-Tue Jan 20 16:11:05 1998 Geoffrey Noer <noer@cygnus.com>
-
- Remove last remnants of the mixed case handling support.
- * path.cc (path_conv::path_conv): remove mixed_p init
- (mount_info::from_registry): don't check for fmixed
- (mount_info::to_registry): ditto
- (mount_item::getmntent): when setting ret.mnt_opts, only consider
- text vs binary flag
- (mount_item::init): remove init of mixed
- * path.h: remove mixed_p, mixed from path_conv class. Remove
- unmixedcaseify proto.
- * include/sys/mount.h: comment out MOUNT_MIXED define, protect
- header against multiple inclusion
-
- A little header file cleanup. Mostly to protect headers against
- multiple inclusion. Some aren't strictly speaking necessary but...
- * include/sys/cygwin.h: protect header against multiple inclusion
- * include/sys/smallprint.h: ditto, also add cplusplus wrapper
- * include/sys/strace.h: comment last endif
- * include/cygwin32/in.h: change _LINUX_IN_H protect defines
- to _CYGWIN32_IN_H
- * include/arpa/inet.h: protect header against multiple inclusion
- * include/asm/types.h: ditto
- * include/net/if.h: ditto
- * include/netinet/ip.h: ditto
- * include/netinet/ip_icmp.h: ditto
- * include/netinet/in.h: ditto, remove commented out real header
- file
- * include/fcntl.h: protect header against multiple inclusion
- * include/memory.h: ditto
- * include/mntent.h: ditto
- * include/strings.h: ditto
- * include/syslog.h: ditto
- * include/termio.h: ditto
-
-Tue Jan 20 12:51:59 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * strace.cc (strace_stderr): New static variable.
- (strace_init): Set strace_stderr.
- (system_printf): If not strace_stderr, use debug_printf to put the
- message in a trace file.
-
- * fhandler.h (fhandler_pty_master): Add neednl_ field.
- * tty.h (RESTART_OUTPUT_EVENT): Change to be different from
- IOCTL_DONE_EVENT.
- * tty.cc (fhandler_tty_master::init): Initialize neednl_.
- (do_output): Handle a length of one by using neednl_ to record an
- expansion of \n to \r\n which doesn't fit. Never expand \r to
- \r\n. Correct order of \r\n.
- (fhandler_tty_slave::open): Improve error handling. Use
- DUPLICATE_CLOSE_SOURCE to close the pipes in the master process.
- (fhandler_tty_slave::dup): Duplicate the handles, rather than
- calling fhandler_tty_slave::open.
- (fhandler_pty_master::open): Initialize neednl_.
- (fhandler_pty_master::read): Return EOF for ERROR_BROKEN_PIPE,
- rather than error. Set errno correctly.
- * hinfo.cc (digits): New static function.
- (build_fhandler): Always accept /dev/ptmx and /dev/ttyDDD, even if
- use_tty is not set. use_tty now only controls the interpretation
- of /dev/tty.
-
-Mon Jan 19 14:49:45 1998 Geoffrey Noer <noer@cygnus.com>
-
- * sigproc.cc (sig_send): lock_pinfo_for_update during this
- function
-
-Fri Jan 16 18:09:59 1998 Geoffrey Noer <noer@cygnus.com>
-
- * sigproc.cc (sigproc_init): if we can't create a signal
- thread or can't create sync_proc_subproc mutex, fail with
- an api_fatal call rather than just returning
-
-Fri Jan 16 18:08:49 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- Changed signal handling to use one semaphore and one shared
- memory array which is manipulated via Interlocked*() functions.
- * exceptions.cc (lock_cs): Comment. Report on error.
- (unlock_cs): Add debugging statement.
- (sig_dispatch_pending): Remove obsolete function.
- (set_process_mask): Adapt to new signal method.
- (call_handler): Clear wait()ing threads here while main thread is
- suspended to avoid timing screwups. Avoid calling the handler if
- can't get dispatch mutex (code moved from sig_handle). Return
- status of acquiring the sig_dispatch mutex.
- (sighandle): Adapt to new signal method. Reorganize to *always*
- honor sig_dispatch mutex or suffer deadlock on fatal signals when
- someone else has the mutex and we're attempting to cleanup.
- (events_init): Reflect change in cygname() arguments.
- * fork.cc (stack_dummy): New function. Returns address of
- argument to determine bounds for eventual stack copy.
- (cygwin_fork_helper1): Call subproc_init to start up subproc
- thread if it is not alreay started. Ensure that signals are
- blocked while forked process is initializing. Change method of
- calculation for lower stack bounds to slightly more foolproof
- method. Preserve some global settings in forked process.
- * misc.cc (cygname): Remove an unused argument.
- * pinfo.cc (pinfo_list::allocate_pid): Add a useful debugging
- statement.
- * shared.cc (open_shared_file_map): Reflect change in cygname()
- arguments.
- * signal.cc (kill_pgrp): Avoid killing dead processes. Don't
- kill processes in my pgrp if not also in my ctty.
- (sigaction): Adapt to new signal method.
- (sigpending): Adapt to new signal method.
- * sigproc.cc: Many changes to adapt to new signal method. Also
- delay waits for thread initialization until the thread needs to be
- contacted.
- * sigproc.h: Ditto.
- * spawn.cc (spawn_guts): Fix potential off-by-one error(?) in
- transcribing the argument list and add paranoid code to detect
- future overruns. Change priority to highest so that waiting
- process will clear out quickly.
- (_spawnve): Call subproc_init() to start up subproc thread if is
- not already started.
- * strace.cc (strace_printf): Increase size of internal buffer so
- that long argument lists printed from spawn_guts do not overrun it
- so easily.
- * wait.cc (wait4): Set status flag to -1 prior to exit. This will
- cause previous wait that was interrupted by a signal which
- dispatched to another wait to return the correct error value.
- * winsup.h (pinfo): Add _sigtodo array for new signal method.
- Remove obsolete field. Reflect change in cygname arguments.
-
-Thu Jan 15 13:07:07 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * syscalls.cc (mkdir): Don't permit the directory to be created if
- the parent directory is not writable.
-
- * syscalls.cc (fchmod): Call chmod with the path name, rather than
- just returning zero.
-
- * syscalls.cc (writable_directory): New static function.
- (_unlink): Don't permit the file to be removed if the directory is
- not writable.
- (rename): Don't permit the rename if either the source or
- destination directory is not writable.
-
- * syscalls.cc (chown): Set username and groupname lengths to UNLEN
- + 1, rather than 100. If getpwuid fails, try to look up the real
- user name to see if it is the same. Don't report an error if
- there is no security mapping.
-
-Wed Jan 14 15:34:20 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * syscalls.cc (setegid): New function which just returns ENOSYS.
- (chroot): Likewise.
- * cygwin.din: Export setegid, _setegid, chroot, and _chroot.
-
- * syscalls.cc (setmode): Rename from _setmode. Change to return
- the old mode. Remove old setmode function.
- * cygwin.din: Make _setmode an alias for setmode.
-
-Wed Jan 14 14:46:00 1998 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: don't strip cygwin.dll by default
- * winsup.h: minor reformatting, removed/reworded some comments
-
-Mon Jan 12 13:53:03 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- Speed up cygwin pid calculation by staying in the range
- 1000 through (1000 + PSIZE - 1).
- * pinfo.cc (pinfo_list::init): Change to reflect new pid
- calculation method.
- (pinfo_list::operator []): Ditto.
- (pinfo_list::allocate_pid): Ditto.
- * winsup.h (pinfo): Move pid and ppid into non-zeroed region since
- they are always set by allocate_pid.
- (pinfo_list): Change pid_base to next_pid_index to reflect new pid
- calculation method.
- (PBASE): New constant for new pid calcuation method.
-
-Sat Jan 10 12:06:38 1998 Geoffrey Noer <noer@cygnus.com>
-
- * syscalls.cc (process_deletion_queue): remove wrapper function
- (close_all_files): call s->delqueue.process_queue instead of
- going through wrapper.
- * fhandler.cc (fhandler_base::close): call
- s->delqueue.process_queue instead of using above wrapper.
- * winsup.h: remove process_deletion_queue proto
- * delqueue.h: up MAX_DELQUEUES_PENDING to 100 for now. Rename
- v to dqueue for clarity.
- * delqueue.cc: v renamed to dqueue throughout. Add FIXME
- describing why this whole delqueue system needs rewriting.
-
-Fri Jan 9 13:18:44 1998 Geoffrey Noer <noer@cygnus.com>
-
- Remove some historical baggage:
- * syscalls.cc (cygwin_set_attributes): remove commented-out code,
- add FIXME since this function should go away next time an
- incompatible change to cygwin.din is made. Stop including
- include/sys/cygwin.h.
- * include/sys/cygwin.h: remove cygwin_set_attributes proto.
- Remove CYGWIN_FMODE_ALL_BINARY define.
- * hinfo (hinfo_vec::init_std_file_from_handle): remove old
- commented-out code
- * path.cc (unmixedcaseify): delete commented-out function
- (mixedcaseify): ditto
- * strerror.cc (strerror): delete commented-out code section
-
-Tue Jan 6 18:51:40 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- Conform to POSIX method for sending SIGHUP to stopped processes.
- * dcrt0.cc (do_exit): Use new kill_pgrp function to kill orphaned
- children on group leader exit iff the children are stopped (per
- POSIX).
- * signal.cc (kill_worker): Negative signal now means to send
- a SIGCONT after the signal, to wake up the target process.
- (_kill): Break out pgrp handling into separate function.
- (kill_pgrp): New function pulled from _kill to send signals
- to processes in a given pgrp.
-
-Tue Jan 6 14:37:43 1998 Geoffrey Noer <noer@cygnus.com>
-
- patch from cgf@bbc.com (Chris Faylor):
- * fhandler.cc (fhandler_base::open): include
- FILE_FLAG_BACKUP_SEMANTICS in file_attributes when file is
- a directory. Allows opening of directory as a file. Allows
- use of handle to perform some operations on both directories and
- files.
- (fhandler_base::fstat): Loop when attempting to get volume serial
- number. Works around an apparent Windows NT 3.51 bug.
- * times.cc (utimes): use FILE_FLAG_BACKUP_SEMANTICS flag
- to allow accessing directory times (may only work under NT;
- until now it didn't work under either OS).
- * winsup.h: Add O_DIROPEN constant.
-
-Mon Jan 5 19:18:01 1998 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: make winsup.h depend on winsup.h in accordance
- with below
-
- patch from cgf@bbc.com (Chris Faylor):
- * {*.cc, *.h}: Remove include files already present in winsup.h.
- Change empty function parameter lists to (void) where appropriate.
-
- * fork.cc: Clean up include files. Minor change to CreateProcess
- parameter list.
- * signal.cc: Remove ifdef'ed stuff.
- * smallprint.c: Add a necessary include file.
- * winsup.h: Add a common include file. Add a function declaration
- for kill_pgrp.
-
-Mon Jan 5 18:30:37 1998 Geoffrey Noer <noer@cygnus.com>
-
- Fix spoofing of directory inodes.
- * syscalls.cc (hash_path_name): instead of initializing the
- hash to zero, take the value of the initial hash as a new
- argument.
- (_stat_worker): fix up hash_path_name reference in light of above
- * dirsearch.cc (opendir): initialize dir->__d_dirhash to the
- hash of the full directory name so readdir can make use of it.
- (readdir): compute d_ino by combining the directory hash
- calculated by opendir with the hash of the filename.
- * fhandler.cc: fix up hash_path_name reference in light of above
-
- * winsup.h: remove unnecessary protos for getkey, kbhit. Adjust
- hash_path_name proto.
diff --git a/winsup/cygwin/ChangeLog-1999 b/winsup/cygwin/ChangeLog-1999
deleted file mode 100644
index f2da41f51..000000000
--- a/winsup/cygwin/ChangeLog-1999
+++ /dev/null
@@ -1,3562 +0,0 @@
-Sat Dec 25 12:46:25 1999 Christopher Faylor <cgf@cygnus.com>
-
- * dlfcn.cc (dlsym): Use correct HANDLE type for GetProcAddress.
- (dlclose): Ditto for FreeLibrary.
- * fhandler_windows.cc (fhandler_windows::set_close_on_exec): Properly
- coerce arguments to set_inheritance.
- (fhandler_windows::fixup_after_fork): Ditto for fork_fixup.
- * libcmain.cc (main): Simplify.
- * select.cc (peek_windows): Properly coerce argument to PeekMessage.
-
-Sat Dec 25 12:30:25 1999 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Eliminate unneeded .y SUFFIX.
- * dcrt0.cc (__api_fatal): Make "C".
- (do_global_ctors): Make __stdcall.
- (getprogname): Ditto.
- (insert_file): Ditto.
- (globify): Ditto.
- (build_argv): Ditto.
- (do_exit): Ditto.
- * debug.cc (regthread): Ditto.
- (makethread): Ditto.
- (threadname): Ditto.
- (find_handle): Ditto.
- (handle_list): Ditto.
- (add_handle): Ditto.
- * debug.h: Reflect changes to __stdcall.
- * shared.h: Ditto.
- * winsup.h: Ditto.
-
-Sat Dec 25 12:09:10 1999 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * path.cc (symlink): Don't return error if target is a symlink to a
- nonexistent file.
-
-1999-12-23 DJ Delorie <dj@cygnus.com
-
- * Makefile.in: add support for "make check"
- * shared.cc: if $CYGWIN_TESTING is set, use a private shared area
- * cygrun.c: new, used to isolate dll-in-test
- * testsuite/*: new, rudimentary testsuite framework
-
-Wed Dec 22 01:05:44 1999 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (globify): Properly handle embedded tildes in variable
- names. Treat a c:\foo style path spec as "special", i.e., don't
- interpret the backslashes as quoting characters.
-
-Fri Dec 17 10:49:13 1999 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (symlink): Return error if the target exists.
-
-Thu Dec 16 22:36:45 1999 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc: Change method for accessing com in windows_device_names to
- allow > 2 com ports.
-
-Thu Dec 16 00:49:30 1999 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Only build winver.o and version.o when required.
-
-Sat Dec 11 11:06:45 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * path.cc (path_conv::path_conv): Ensure that a trailing slash is added
- to "x:" specifications.
-
-Fri Dec 10 20:22:41 1999 Christopher Faylor <cgf@cygnus.com>
-
- * debug.cc (WFSO): Make __stdcall.
- (WFMO): Ditto.
- * debug.h: Reflect above changes.
- * exceptions.cc (sig_set_errno): Set errno to be in effect after a
- signal handler.
- (handle_sigsuspend): Use set_sig_errno to ensure that the correct errno
- is set after a signal handler.
- (interrupt_now): Accommodate default errno field in stack.
- (intterupt_on_return): Ditto.
- (sigreturn): Pop, test, and possibly restore saved errno on return from
- signal handler.
- * fhandler_console.cc (fhandler_console::read): Set errno to be in
- effect after a signal handler.
- * fhandler_serial.cc (fhandler_serial::raw_read): Ditto.
- * select.cc (cygwin_select): Ditto.
- (select_stuff:wait): Ditto.
- (peek_serial): Ditto.
- * syscalls.cc (_read): Ditto.
- * wait.cc (wait4): Ditto.
- * winsup.h (signal_dispatch): Add "saved_errno" field.
-
-Thu Dec 9 23:35:45 1999 Christopher Faylor <cgf@cygnus.com>
-
- * debug.cc (threadname_init): Use new_muto macro to set up a static
- buffer for a muto.
- (debug_init): Ditto.
- (WFSO): Reinstate wrapper for WaitForSingleObject.
- (WFMO): Reinstate wrapper for WaitForMultipleObject.
- * debug.h: Declare the above two wrappers.
- * exceptions.cc (events_init): Use new_muto macro to set up a static
- buffer for a muto.
- * sigproc.cc (sigproc_init): Ditto.
- * sync.cc (muto::acquire): Don't bump waiters if we already own the
- muto.
- * sync.h (new): New operator.
- (delete): Ditto.
- (new_muto): New macro.
-
-Dec 08 23:50:00 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (get_nt_attribute): Add debug output. Correct behaviour
- in case of NULL ACL.
- * syscalls.cc (stat_worker): Allow remote drives to get stat info from
- fh.fstat().
- * include/winnt.h: Add defines for W2K ACL control flags.
- * include/cygwin/socket.h: Add missing PF_NETBIOS.
-
-Wed Dec 8 23:06:07 1999 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Ensure that winver.o is a dependency for building the
- dll.
- * mkvers.sh: Attempt to call windres in a fashion that accommodates
- older and newer versions.
- * winver.c: Reorganize slightly to accommodate older versions of
- windres.
- * fhandler.cc (fhandler_disk_file::fstat): Avoid using Windows "inodes"
- on disks which do not support them.
-
-Tue Dec 7 21:15:11 1999 Christopher Faylor <cgf@cygnus.com>
-
- * dll_init.cc (DllList::forkeeLoadDlls): Reverse order of Free/Load
- Library calls to ensure that references are resolved.
- * path.cc (mount_info::conv_to_win32_path): Ensure that returned
- windows paths are always normalized regardless of whether they were in
- windows format to begin with.
-
-Tue Dec 7 08:48:22 1999 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (parse_options): Properly detect end of known array.
-
-Mon Dec 6 22:32:04 1999 Christopher Faylor <cgf@cygnus.com>
-
- * mkvers.sh: Generate winver.o from winver.rc and various other things
- from include/cygwin/version.h
- * winver.rc: New file (adapted from donation by Mumit Khan
- <khan@xraylith.wisc.edu>).
- * configure.in: Find windres.
- * configure: Regenerate.
- * Makefile.in: Link winver.o into cygwin1.dll.
-
-Mon Dec 6 13:04:47 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * init.cc (dynamically_loaded): New global variable.
- (dll_entry): Use.
- * winsup.h (dynamically_loaded): Declare.
- * dcrt0.cc (do_global_ctors): Likewise.
- (set_os_type): Make static again.
- (dll_crt0_1): Handle dynamically_loaded case.
- * dll_init.cc (dll_dllcrt0_1): Delete.
- (dll_dllcrt0): Handle dynamically_loaded case.
- (dll_noncygwin_dllcrt0): Mark obsolescent.
- * libccrt0.cc (cygwin_attach_noncygwin_dll): Delete.
- * pinfo.cc (pinfo_init): Don't inherit parent fds if dynamically
- loaded.
- * include/cygwin/cygwin_dll.h (cygwin_attach_noncygwin_dll): Delete
- prototype.
- (_cygwin_noncygwin_dll_entry): Mark obsolescent.
-
-Mon Dec 6 11:09:41 1999 Christopher Faylor <cgf@cygnus.com>
-
- * configure.in: Make threadsafe the default.
- * configure: regenerate.
- * utils/strace.cc: Fix a compiler warning.
-
-Sun Dec 5 15:49:43 1999 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (parse_options): Reinstate unions in parse_things, to
- save space.
-
-Fri Dec 3 22:52:05 1999 Christopher Faylor <cgf@cygnus.com>
-
- Implement new signal-handling scheme which ensures that a program will
- not be interrupted while in a system or cygwin DLL.
- * Makefile.in: Add sync.o and dll_ofiles target.
- * dcrt0.cc (alloc_stack_hard_way): Add more defensive code to ensure
- that the stack is really grown.
- (alloc_stack): Ditto.
- (dll_crt0_1): Reorganize some initialization routines to ensure that
- they occur after the heap has been initialized.
- * debug.cc: Use muto for locks. Eliminate attempts to avoid being
- interrupted by signals.
- (threadname_init): New function.
- (debug_init): Ditto.
- * debug.h: Declare debug_init and threadname_init.
- * exceptions.cc (stack_info::stack_info): Don't check for previous use
- of get().
- (handle_sigsuspend): Simply using new signal-handling scheme.
- (interruptible): New function. Determines if PC should be interrupted.
- (interrupt_now): New function. Causes immediate signal dispatch.
- (interrupt_on_return): New function. Causes signal dispatch on return
- from cygwin or system routine.
- (call_handler): Simplify to use new signal-handling scheme.
- (set_process_mask): Use mask_sync muto to synchronize setting of
- process signal mask.
- (sig_handle_tty_stop): New function. Called when have to stop process
- now.
- (sig_handle): Simplify to use new signal-handling scheme.
- (set_process_mask): Ditto.
- (events_init): Allocate mask_sync muto.
- (unused_sig_wrapper): New function. Encapsulates assembly language
- signal handling support.
- * fhandler.h (class select_stuff): Accommodate new signal-handling
- scheme.
- * fhandler_console.cc (fhandler_console): Simplify to use new
- signal-handling scheme.
- * fhandler_serial.cc (fhandler_serial::raw_read): Ditto.
- * fhandler_termios.cc (bg_check): Ditto.
- * fhandler_tty.cc (process_input): Ditto.
- (fhandler_tty_slave::open): Ditto.
- (fhandler_tty_slave::send_ioctl_request): Ditto.
- * fork.cc: Ditto.
- * path.cc (chdir): Ditto.
- * select.cc: Ditto, throughout.
- * shared.h: Eliminate unneeded signal enum.
- * signal.cc (signal): Simplify to use new signal-handling scheme.
- (sleep): Ditto.
- (usleep): Ditto.
- (sigprocmask): Ditto.
- (sigaction): Ditto.
- (pause): Use handle_sigsuspend to pause for signal.
- * sigproc.cc: Change signal_arrived handle to global_signal_arrived
- class. Change various mutex handles to mutos.
- (proc_subproc): Simplify to use new signal-handling scheme. Use muto
- for locking.
- (get_proc_lock): Ditto.
- (proc_terminate): Ditto.
- (sig_dispatch_pending): Make a "C" function. Return status of pending
- signals.
- (sigproc_init): Initialize global_signal_arrived. Simplify to use new
- signal-handling scheme. Initialize sync_proc_subproc muto.
- (sig_send): Eliminate __SIGSUSPEND considerations. Simplify to use new
- signal-handling scheme.
- (__allow_sig_dispatch): Delete.
- (__block_sig_dispatch): Delete.
- (__get_signal_mutex): Delete.
- (__release_signal_mutex): Delete.
- (__have_signal_mutex): Delete.
- (wait_sig): Simplify to use new signal-handling scheme.
- * sigproc.h: Implement signal_arrived classes.
- * smallprint.c (__small_vsprintf): Avoid printing a leading '*' in
- function name with %F format.
- * spawn.cc (spawn_guts): Simplify to use new signal-handling scheme.
- (iscmd): Don't consider a filename to be a "command" unless it contains
- a ':'.
- * syscalls.cc (_read): Ditto.
- (_open): Ditto.
- (_close): Ditto.
- * termios.cc (tcsendbreak): Ditto.
- (tcdrain): Ditto.
- (tcflush): Ditto.
- (tcflow): Ditto.
- (tcsetattr): Ditto.
- (tcgetattr): Ditto.
- * winsup.h: Reorganize include files. Add preliminary __sig_protect
- implementation.
- * cygwin/version.h: Bump current version to 1.1.0.
-
-Thu Dec 2 22:19:40 1999 Christopher Faylor <cgf@cygnus.com>
-
- * sync.cc (muto::muto): Use an event rather than a semaphore for wait
- synchronization.
- (muto::acquire): Rewrite to use an event and try to remove races.
- (muto::release): Ditto.
-
-1999-12-02 DJ Delorie <dj@cygnus.com>
-
- * environ.cc (parse_options): switch to a static initializer;
- templates are sensitive to g++ bugs.
-
-Fri Nov 26 12:04:23 1999 Christopher Faylor <cgf@cygnus.com>
-
- * net.cc (cygwin_bind): Ensure that non-Unix domain socket operations
- return success correctly.
-
-Wed Nov 24 21:37:58 1999 Christopher Faylor <cgf@cygnus.com>
-
- * net.cc (cygwin_bind): Guard against incorrectly setting res to zero
- when there is an error condition.
-
-Tue Nov 23 17:49:55 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.cc (fhandler_base::fhandler_base): Use better initialization
- scheme.
- * fork.cc (stack_base): Eliminate unneeded asm stuff.
- * select.cc: Sprinkle in some comments.
- * include/winnt.h: Add more CONTEXT.
-
-Nov 23 20:51:00 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (cygwin_bind): Use struct sockaddr_un in AF_UNIX code. Set
- errno to ENAMETOOLONG if length of pathname exceeds limit in AF_UNIX
- code. Sets errno to EADDRINUSE in AF_UNIX code if file system socket
- object already exists.
- * syscalls.cc (setsid): Set errno to EPERM if current process is
- already process group leader.
- * uinfo.cc (internal_getlogin): Rearrange for better debug output. Set
- pi->psid to NULL if SID can't be determined.
- * include/cygwin/socket.h: Add AF_LOCAL and PF_LOCAL
- (same as AF_UNIX) for POSIX compatibility.
- * include/sys/un.h: Add UNIX_PATH_LEN define. Added SUN_LEN macro for
- POSIX compatibility.
-
-Sun Nov 21 22:55:04 1999 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (parse_options): Return immediately after dealing with
- NULL argument. Don't try to process it.
-
-Tue Nov 16 23:29:17 1999 Christopher Faylor <cgf@cygnus.com>
-
- * signal.cc (kill_worker): Guard against NULL dereference when thread
- safe.
-
-Sat Oct 30 00:59:38 1999 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Some general cleanup.
- * smallprint.c (__small_vsprintf): Accommodate new format for
- __PRETTY_FUNCTION__.
-
-Wed Oct 27 16:13:36 1999 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (mount_info::from_registry): Don't allow the same posix path
- into the mount table more than once.
- * utils/mount.cc (main): Add some orthogonality to the options.
-
-Tue Oct 26 21:55:49 1999 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (environ_init): Turn off ntsec by default.
-
-Wed Oct 27 00:14:11 1999 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * fhandler.cc (fhandler_base::lseek): Take readahead into account.
-
-Tue Oct 26 16:46:54 1999 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (_unlink): Return EISDIR when attempting to unlink a
- directory.
-
-Mon Oct 25 18:05:23 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.cc (fhandler_base::read): Fix previous fix.
-
-Mon Oct 25 13:46:44 1999 Christopher Faylor <cgf@cygnus.com>
-
- * dll_init.cc (add): Avoid allocating name for "LINK"ed DLLs.
- (DllList::forkeeLoadDlls): Only reload DLLs if they have been
- dlopen'ed.
- * grp.cc (parse_grp): Assign gr_mem when it is determined.
-
-Sun Oct 24 21:55:48 1999 Christopher Faylor <cgf@cygnus.com>
-
- * dll_init.cc (struct dll): Add module name.
- (add): Add additional 'name' parameter for recording in dll structure.
- (reserve_upto): New function.
- (release_upto): Ditto.
- (DllList::forkeeLoadedDlls): Ditto.
- (DllList::forkeeStartLoadDlls): Remove.
- (DllList::forkeeEndLoadedDlls): Ditto.
- (DllNameIterator::*): Eliminate class.
- (LinkedDllNameIterator::*): Ditto.
- * dll_init.h: Reflect above changes.
- * fork.cc (fork): Don't generate a list of dlls to load in the parent.
- Let the child do it. Use new DllList::forkeeLoadDlls to load DLLs.
- * smallprint.c (__small_vsprintf): No need for a sign on a Win32 error.
- (small_printf): Move function here from strace().
- * strace.cc (small_printf): Move to smallprint.c
- * include/sys/strace.h: Always declare small_printf.
-
-Sun Oct 24 02:22:13 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.cc (fhandler_base::read): Work around C bug.
-
-Tue Oct 19 22:10:21 1999 Christopher Faylor <cgf@cygnus.com>
-
- * dll_init.cc: Add some external symbols to allow thread-safe
- compilation.
-
-Tue Oct 19 21:09:42 1999 Christopher Faylor <cgf@cygnus.com>
-
- Make minor changes throughout to accommodate new gcc merge.
- * Makefile.in: Remvoe -fpermissive option when compiling using g++.
- * dcrt0.cc (noload): Mark as "unused" to avoid a compiler warning.
- * exceptions.cc (sigreturn): Make this "extern" since it essentially
- *is* extern.
- * fork.cc (sync_with_parent): Modify to cause the macro to be
- considered void.
- * heap.cc (sbrk): Remove debugging code.
- * passwd.cc (getpass): Don't use fprintf to print the prompt.
- * path.cc (mount_info::conv_to_win32_path): Accommodate compiler
- warning.
- * select.cc (cygwin_select): Experimental version of select which
- handles fd_sets with non-standard FD_SETSIZE.
- (select_stuff::wait): Ditto.
- * termios.cc (tcgetattr): Avoid a compiler warning.
- (cftospeed): Ditto.
- (cftispeed): Ditto.
- * uinfo.cc (netapi32_init): Ditto.
- * winsup.h (api_fatal): Simplify and avoid a compiler warning.
- * include/sys/strace.h (system_printf): Ditto.
- (strace_printf_wrap): Modify to cause the macro to be considered void.
- (strace_printf_wrap1): Ditto.
-
-1999-10-19 DJ Delorie <dj@cygnus.com>
-
- * Makefile.in (.cc.o): add -fpermissive to avoid g++'s conformance
- madness.
- * environ.cc (_findenv): rename to my_findenv to avoid newlib
- prototype.
- * syscalls.cc (logout): remove braces around _PATH_UTMP
-
-Sat Oct 16 22:53:02 1999 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (mount_info::cygdrive_posix_path): Properly terminate string
- after Oct 11 change below.
-
-Fri Oct 15 23:02:39 1999 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (stack_info): Reimplement stack handling routines in
- new stack_info class.
- (stack_info::brute_force): Just fill out the same structure as
- StackWalk.
- (stack_info::walk): Just fill out stack info.
- (stack): Use stack_info class stuff to iterate over and display the
- stack.
-
-Fri Oct 15 00:32:13 1999 Christopher Faylor <cgf@cygnus.com>
-
- * include/cygwin/version.h: Bump some versions.
-
-Oct 5 11:45:00 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * dcrt0.cc (dll_crt0_1): Delete calls to get_WHOEVER_sid. Move call to
- uinfo_init() to the end of the function.
- * fhandler.cc (get_file_owner): Substitute call to get_id_from_sid()
- with call to get_uid_from_sid().
- (get_file_group): Substitute call to get_id_from_sid() with call to
- get_gid_from_sid().
- * fork.cc (fork): Copy new pinfo members to child.
- * grp.cc (parse_grp): Rewritten. Saves gr_passwd and all user names in
- gr_mem.
- (read_etc_group): Variable `group_sem' avoids endless loop.
- * passwd.cc (read_etc_passwd): Variable `passwd_sem' avoids endless
- loop.
- * security.cc (get_sid): New function to generate SID from int values.
- (get_ssid): New function to generate SID from string.
- (get_pw_sid): New function to generate SID from pw_gecos entry.
- (get_gr_sid): New function to generate SID from gr_passwd entry.
- (get_admin_sid): Rewritten to avoid using heap space.
- (get_system_sid): Ditto.
- (get_creator_owner_sid): Ditto.
- (get_world_sid): Ditto.
- (get_id_from_sid): Try to read SIDs from /etc/passwd or /etc/group
- files before using RID or Lookup... function.
- (legal_sid_type): New function.
- (lookup_name): Rewritten to use the logon server info, if any.
- (alloc_sd): Try to use SID from /etc/passwd and /etc/group files before
- call to lookup_name().
- (alloc_sd): New parameter for logon server.
- (set_nt_attribute): Ditto.
- (set_file_attribute): Ditto.
- * shared.cc (sec_user): If SID is saved in myself, use it instead of
- calling lookup_name().
- * shared.h: struct pinfo got extended user information.
- * spawn.cc (spawn_guts): method for forcing reread /etc files changed.
- (_spawnve): Copy new pinfo members to child.
- * syscalls.cc (chown): Change call to set_file_attribute().
- (chmod): Ditto.
- * uinfo.cc (internal_getlogin): New function.
- (uinfo_init): Calls internal_getlogin() now.
- (getlogin): Uses myself->username now.
- * winsup.h: extern HANDLE netapi32_handle; Change prototypes for
- set_file_attribute(), lookup_name(), get_id_from_sid(). New inline
- functions get_uid_from_sid() and get_gid_from_sid().
- * utils/mkgroup.c: Adapt to the new ntsec features.
- * utils/mkpasswd.c: Ditto.
-
-Thu Oct 14 23:46:03 1999 Christopher Faylor <cgf@cygnus.com>
-
- Replace calls to GetCurrentProcess() with hMainProc throughout.
- * autoload.h: Implement LoadDLLinitnow() function to force the loading
- of a DLL.
- * cygwin.din: Export cygwin_stackdump.
- * dcrt0.cc (dll_crt0): Set up hMainProc and hMainThread here.
- * dll_init.cc (dll_dllcrt0_1): Ditto.
- * environ.cc (parse_options): New "oldstack" option for forcing the use
- of the old stack walking code.
- * exceptions.cc (signals_init): Remove.
- (err_printf): Remove. Use small_printf throughout.
- (sfta): New helper function for StackWalk.
- (sgmb): Ditto.
- (stack_brute_force): Renamed from old stack walk function. Now uses
- frame pointer from context handler.
- (stack_walk): New function. Uses Windows API to walk the stack.
- (stack): Reimplement to attempt to load imagehlp.dll. If this succeeds
- use stack_walk() to display stack info, otherwise use
- stack_brute_force.
- (cygwin_stackdump): Temporary (?) function for displaying a stack dump
- from the called location.
- (stackdump): Accept new parameters for passing to stack().
- (handle_exceptions): Call stackdump with new parameters needed to walk
- the stack.
- * fhandler.cc (fhandler_base::read): Fix potential buffer overrun. Fix
- end of buffer problems when \r is not followed by a \n.
- (fhandler_base::lseek): Avoid flushing read ahead when not moving the
- file pointer.
- * fhandler_termios.cc (fhandler_termios::set_ctty): Add a debugging
- statement.
- * sigproc.cc (sigproc_init): Eliminate obsolete signals_init function.
- * winsup.h: Add some declarations.
-
-Wed Oct 13 09:02:32 1999 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * path.cc (readlink): Return errno correctly when it can't find the
- target symlink.
-
-Tue Oct 12 13:02:08 1999 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (setsid): Only reset sid/pgid when NOT process group
- leader.
- * tty.cc (tty_list::allocate_tty): Don't set sid to myself. The first
- tty open should do that.
-
-Mon Oct 11 23:13:29 1999 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (noload): Issue appropriate Windows error.
- * fhandler_termios.cc (fhandler_termios::ctty): Don't automatically set
- sid, etc., unless the current pid associated with the tty's sid does
- not exist.
- * path.cc (mount_info::cygdrive_posix_path): Avoid copying beyond the
- end of buffer or suffer garbage.
- * pinfo.cc (pinfo_init): Restore sid behavior of a year ago. The sid
- should be the same as the pid to be equivalent to UNIX.
- (pinfo_list::operator []): Add more bounds checking.
-
-Sun Oct 10 14:08:30 1999 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (select): Return error if n > FD_SETSIZE. This is a
- temporary fix.
-
-Sun Oct 10 13:56:14 1999 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (iscygdrive_device): Be more precise in detecting when a
- "cygdrive" device. This should allow 'mkdir -p' to work correctly.
-
-Fri Oct 08 08:55:31 1999 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * path.cc (symlink_check_one): set errno to EINVAL on socket files
- same as normal files.
-
-1999-10-06 DJ Delorie <dj@cygnus.com>
-
- * include/oaidl.h (IDispatch.GetIDsOfNames): Use DISPID* not DISPID
-
-1999-10-06 DJ Delorie <dj@cygnus.com>
-
- * exceptions.cc (err_printf): new function; print to stderr
- without strace's clutter. The stacktrace functions use this, so
- the stacktrace files should be cleaner.
- (exception): Print segment registers also
- (stack): include a peek at the function's arguments
-
-Tue Oct 5 16:33:17 1999 Christopher Faylor <cgf@cygnus.com>
-
- * hinfo.cc (hinfo::extend): Eliminate inappropriate test for boundary
- condition.
-
-1999-10-04 DJ Delorie <dj@cygnus.com>
-
- * config/i386/longjmp.c: don't restore %fs (Paul Sokolovsky
- <paul-ml@is.lg.ua>)
-
-1999-10-04 DJ Delorie <dj@cygnus.com>
-
- * localtime.c (tzsetwall): Handle Asian Windows strings correctly
- (from Kazuhiro Fujieda <fujieda@jaist.ac.jp>).
-
-Sat Oct 2 23:00:00 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * include/lm*.h: Correct multiple problems in lan manager
- header files.
-
-Sun Oct 3 14:29:53 1999 Christopher Faylor <cgf@cygnus.com>
-
- * sysdef/imagehlp.def: New file. Definitions for imagehlp.dll.
- * include/imagehlp.h: Ditto.
- * include/winbase.h: YA missing structure.
-
-Fri Oct 1 11:16:00 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (alloc_sd): Correct setting of FILE_DELETE_CHILD.
- (get_file_attribute): Read ntea attributes only if ntsec is disabled.
- * syscalls.cc (_unlink): Don't queue file into delqueue if DeleteFile
- returns ERROR_ACCESS_DENIED.
-
-1999-09-30 Mumit Khan <khan@xraylith.wisc.edu>
-
- * init.cc (dll_entry): Remove static_load case.
- * dcrt0.c (set_os_type): Make it externally visible.
- * dll_init.cc (dll_dllcrt0_1): Update noncygwin initialization for
- post-b20.1 code.
-
-1999-09-30 DJ Delorie <dj@cygnus.com>
-
- * times.cc: declare _timezone and _daylight properly
-
-Wed Sep 29 23:57:40 1999 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (do_exit): Remove EXIT_SIGNAL mask when exiting. It is not
- correct given changes to really_exit.
- * select.cc (peek_serial): Work around apparent Windows bug.
-
-1999-09-29 Norbert Schulze <Norbert.Schulze@rhein-neckar.de>
-
- * times.cc (timezone): revert 'return TZ if set' patch.
- * times.cc (timezone): uses now tzset() and _timezone.
- * times.cc (gettimeofday): ditto.
- * localtime.c (tzsetwall): no negative minutes if offset is negativ.
- * localtime.c (tzsetwall): minutes place holder was missing if
- minutes == 0 and seconds !=0 (h:0:s).
- * localtime.c (tzsetwall): if timezone has no daylight saving
- (tz.StandardDate.wMonth==0) generate no daylight saving parameters.
-
-Sat Sep 25 15:11:04 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_termios.cc (fhandler_termios::bg_check): Accept a new
- argument to control whether we should worry about blocking signals.
- * fhandler.h: Ditto.
- * syscalls.cc (read_handler): Accept a new argument for passing to
- bg_check.
- (read): Inform read_handler if signals are blocked or not.
- * termios.cc: Throughout, reorganize to always block signals before
- calling bg_check.
-
-Sat Sep 25 13:36:06 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h (fhandler_termios::line_edit): Add an extra argument.
- * fhandler_serial.cc (fhandler_serial::open): Maintain consisten
- fAbortOnError state.
- * fhandler_termios.cc (fhandler_termios::line_edit): Use new
- "always_accept" argument to control whether input_done is set
- regardless of canonical state.
- * fork.cc (vfork): Duplicate "parent's" fd table.
- * hinfo.cc (hinfo::dup_worker): New method.
- (dup2): Use new dup_worker method.
- (hinfo::fixup_after_fork): Lock dtable prior to operating on it.
- (hinfo::vfork_child_dup): New method. Duplicates dtable for vfork.
- (hinfo::vfork_parent_restore): New method. Restores dtable when vfork
- exits.
- * net.cc (set_winsock_errno): Make global.
- * pipe.cc (pipe): Default mode to binary unless *explicitly* set to
- text.
- * select.cc (set_bits): Test that {read,write,except}_selected are
- active before setting a bit.
- (peek_pipe): Short circuit tests if we're not checking for readable
- or "except"able handles.
- (thread_socket): Use read check for exitsock as old method relied on
- undocumented, unreliable behavior.
- (start_thread_socket): Perform more setup on exitsock to improve thread
- exit signalling.
- (socket_cleanup): Connect to the exitsock to force thread_socket thread
- exit.
- * winsup.h (hinfo): Add preliminary vfork stuff.
- * include/winsock.h: Add shutdown() how types.
- * include/sys/socket.h: Add socketpair declaration.
-
-1999-09-22 DJ Delorie <dj@cygnus.com>
-
- * syscalls.cc (chown): never return ENOSYS - just pretend it
- works.
-
-Wed Sep 22 00:47:56 1999 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (MAKEready): Need to initialize 'fd' or open tests in
- peek fail.
-
-Mon Sep 20 17:07:37 1999 Christopher Faylor <cgf@cygnus.com>
-
- * smallprint.c (__small_vsprintf): Fix '%+' handling.
-
-Thu Sep 16 21:48:13 1999 Christopher Faylor <cgf@cygnus.com>
-
- * utils/cygcheck.cc (dump_sysinfo): Deal with a new compiler error.
- * utils/strace.cc (make_command_line): Change to a void * argument, as
- is required for SetConsoleCtrlHandler.
-
-Thu Sep 16 20:47:12 1999 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (__api_fatal): Rearrange slightly.
- * fhandler.h (set_ctty): Change to void.
- * fhandler_termios.cc (fhandler_termios::set_ctty): Ditto.
- * select.cc (thread_pipe): Change to a void * argument, as is required
- for thread functions.
- (thread_socket): Ditto.
- (thread_serial): Ditto.
- * include/winbase.h: Mark ExitProcess as noexit.
-
-Thu Sep 16 18:32:12 1999 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (ctrl_c_handler): Make WINAPI, as required by
- SetConsoleCtrlHandler.
-
-Thu Sep 16 17:48:05 1999 Christopher Faylor <cgf@cygnus.com>
-
- * debug.cc (thread_stub): Make WINAPI, as required by CreateThread.
- * fhandler_tty.cc (process_input): Ditto.
- (process_output): Ditto.
- (process_ioctl): Ditto.
- * select.cc (thread_pipe): Ditto.
- (thread_serial): Ditto.
- (thread_socket): Ditto.
- * sigproc.cc (wait_proc): Ditto.
- (wait_sig): Ditto.
- * window.cc (winMain): Ditto.
-
-Wed Sep 15 20:58:37 1999 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (call_handler): Let fatal signals through regardless of
- signal_mutex.
- * fhandler.h (fhandler_base): Make bg_check virtual.
- (fhandler_termios::bg_check): Eliminate the second argument.
- * fhandler_console.cc (fhandler_console::ioctl): Check for background
- operation.
- * fhandler_termios.cc (fhandler_termios::bg_check): Eliminate the
- second argument. A negative arg 1 means the same thing.
- * ioctl.cc (ioctl): Add debugging output.
- * syscalls.cc (_write): Eliminate second argument to bg_check.
- * termios.cc (tcsendbreak): Check for background operation.
- (tcdrain): Ditto.
- (tcflush): Ditto.
- (tcflow): Ditto.
- (tcsetattr): Reorganize on similar lines to above routine.
-
-Wed Sep 15 15:25:04 1999 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (peek_pipe): Only set read_ready if bg_check returns <= 0.
- (peek_console): Ditto. Correct PeekConsole conditional so that the for
- loop breaks eventually.
-
-Wed Sep 15 00:21:40 1999 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (set_console_handler): Allocate security stuff here
- since it is needed earlier in the process now. Allocate a shared event
- for use in synchronizing CTRL-C events that happen while the process is
- still initializing.
- (ctrl_c_handler): Use the above event to synchronize with the cygwin
- startup process, waiting for the signal thread to come alive before
- trying to send a signal.
- (signals_init): Don't call set_console_handler() here, since it is now
- handled much earlier in cygwin initialization.
- * shared.cc (shared_init): Move out security setup.
- * sigproc.cc (wait_sig): Activate the console_handler_thread_waiter so
- that any waiting thread which is handling ctrl-c's will wake up and
- send a signal, if appropriate.
-
-Tue Sep 14 23:49:39 1999 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (ctrl_c_handler): Handle ctrl-c events ourself, using
- the "UNIX way".
- * fhandler_console (tty_list::get_tty): New function.
- * shared.h: Add some additional things to tty_min class for handling
- ctrl-c.
-
-1999-09-14 DJ Delorie <dj@cygnus.com>
-
- * dir.cc (rmdir): return ENOTDIR for regular files on 9x
-
-Tue Sep 14 00:01:59 1999 Christopher Faylor <cgf@cygnus.com>
-
- * debug.h (ForceCloseHandle2): New macro.
- * fhandler.cc (set_inheritance): Accept name of handle as optional
- third argument. Use this in ForceCloseHandle2/ProtecHandle2.
- * fhandler.h: Implement bg_check() method.
- * fhandler_console.cc (get_tty_stuff): Initialize more tty stuff.
- (fhandler_console::read): Check for background read.
- * fhandler_termios.cc (fhandler_termios::bg_check): New function.
- Performs appropriate action given background read or write.
- * fhandler_tty.cc (fhandler_tty_slave::write): Replace background check
- code with new method.
- (fhandler_tty_slave::read): Ditto.
- (fhandler_tty_common::set_close_on_exec): Pass output_mutex name to
- set_inheritance.
- * select.cc: Throughout check that the fd is still open before polling.
- (peek_pipe): Check for background read.
- (peek_console): Ditto.
- * shared.h: Move ntty from tty into tty_min.
- * syscalls.cc (read_handler): Check for background read.
- (_write): Check for background write.
-
-Sat Sep 11 16:24:21 1999 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (iscygdrive_device): New macro.
- (mount_info::conv_to_win32_path): Only attempt "cygdrive" translation
- when passed /cygdrive/something.
- (mount_info::write_cygdrive_info_to_registry): Store in-memory copy of
- cygdrive prefix automatically.
- (mount_info::read_cygdrive_info_from_registry): Reorganize for new
- write_cygdrive_info_to_registry functionality.
- (mount): Ditto.
-
-Fri Sep 10 15:44:11 1999 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (pathconf): Make first arg 'const'.
-
-1999-09-10 DJ Delorie <dj@cygnus.com>
-
- * exec.cc (_execve): check for an empty environment
-
-Wed Sep 8 10:24:12 1999 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (dll_crt0_1): Generalize test for initial zeroes in
- exec/fork block.
- * fhandler.cc (fhandler_disk_file::open): Don't attempt #! detection on
- non-disk files.
- * fhandler.h: Use generic status bit set/clear macros. Use bitmask for
- fhandler_termios state.
- * fhandler_console.cc: Rename "tty_stuff" to more descriptive
- "shared_console_info".
- (fhandler_console::read): Reset console state before a read if
- appropriate.
- (fhandler_console::open): Improve check for setting console state.
- (fhandler_console::fixup_after_fork): Ditto.
- (set_console_state_for_spawn): New function.
- * fhandler_termios.cc (fhandler_termios::tcinit): Use new method for
- determining if initialized.
- * fhandler_tty.cc (fhandler_tty::init_console): Avoid sending handle to
- init or it will be closed.
- * fork.cc (per_thread::set): Make this method non-inline, temporarily.
- * select.cc (peek_console): Call set_input_state to ensure that the
- console is in the correct state.
- * shared.h (child_info): Make zero element an array for future
- tweaking.
- (tty_min): Change initialized element to a bit field. Define bit field
- macros for manipulating it.
- * sigproc.cc (wait_sig): Wake up every half second in a (vain?) attempt
- to work around Windows 98 hanging problem.
- (wait_subproc): Ditto.
- * spawn.cc (spawn_guts): Use new "set_console_state_for_spawn" prior to
- starting a process.
- * winsup.h: Define generic macros for manipulating a method's status
- field.
- (per_thread): Move inline method to fork.
-
-Mon Sep 6 13:36:34 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_tty.cc (fhandler_tty_master::init_console): Remove retrieval
- of stderr handle since it is not required for correct init operation.
- * hinfo.cc (hinfo_init): Reorganize to accommodate potential closing of
- console handles by fhandler_console::init.
- (init_std_file_from_handle): Set standard handle as appropriate.
- (hinfo::de_linearize_fd_arry): Ditto.
- * fhandler_console.cc (fhandler_console::init): Conditionally close
- handle only if it is valid.
-
-Sun Sep 5 22:43:21 1999 Christopher Faylor <cgf@cygnus.com>
-
- * utils/cygcheck.cc: Make sure that GetDiskFreeSpaceExA is defined as a
- __stdcall function or the stack will suffer. For now, don't sort mount
- output as more work copying the individual mntent elements is required.
-
-Sat Sep 4 19:01:00 1999 Christopher Faylor <cgf@cygnus.com>
-
- * include/glob.h: Ensure that glob*() functions can be properly accessed by
- programs using the DLL.
-
-Sat Sep 4 18:49:04 1999 Christopher Faylor <cgf@cygnus.com>
-
- * heap.cc (heap_init): Tweak debugging output.
- * sigproc.cc (sig_send): Catch obvious impossible values from
- GetLastError.
-
-Sat Sep 4 18:43:49 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_tty.cc (fhandler_tty_slave::open): Protect against signal
- dispatch.
- (fhandler_tty_slave::write): Only wait a fixed amount of time to
- receive a an output_done_event.
- (fhandler_tty_slave::tcflush): Protect against signal dispatch.
-
-Sat Sep 4 18:30:42 1999 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (handle_sig): Temporarily remove OutputDebugString. It
- seemed to be causing sporadic hangs.
- (call_handler): Save and restore di and si.
- (sigreturn): Ditto.
-
-Fri Sep 3 23:07:44 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_termios.cc (fhandler_termios::line_edit): Properly deal with
- sending characters to slave when !iscanon.
-
-Fri Sep 3 18:15:00 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_raw.cc (fhandler_dev_raw::fstat): Add S_ISCHR to mode bits.
- * fhandler_tape.cc (fhandler_dev_tape::fstat): Erase setting of S_ISCHR
- since it's set in fhandler_dev_raw::fstat now.
-
-Thu Sep 2 22:11:03 1999 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (mount_info::conv_to_win32_path): Fix problem with
- calculating relative path at root.
-
-Wed Sep 1 23:24:43 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.cc (fhandler_base::fhandler_base): Don't use default binmode
- for console.
-
-Wed Sep 1 20:51:05 1999 Christopher Faylor <cgf@cygnus.com>
-
- * smallprint.c (__small_vsprintf): Allow field width argument with 'l'
- modifier. Consolidate processing of field width.
- * uname.cc (uname): Eliminate space in "release" field.
-
-Tue Aug 24 10:46:24 1999 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * fhandler_console.cc (write_normal): Write '\n' corresponding to
- DWN if the cursor is out of the window.
-
-Wed Aug 25 22:16:46 1999 Christopher Faylor <cgf@cygnus.com>
-
- * smallprint.c (rn): Deal with positive as well as negative signs.
- (__small_vprintf): Handle '+', 'l', and '%' format types.
-
-Wed Aug 25 00:38:49 1999 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (dll_crt0_1): Zero heap information in user_data to
- work around mutant startup code.
-
-Tue Aug 24 00:03:22 1999 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (sig_send): One more end-of-process race detection.
-
-Mon Aug 23 21:37:07 1999 Christopher Faylor <cgf@cygnus.com>
-
- Throughout, remove malloc.h.
- * debug.cc: Initialize handle list so that it will not be copied on
- fork.
- * exceptions.cc (_sigreturn): Zero windows error on exit. It's
- meaningless after a signal dispatch.
- * fhandler_console.cc (fhandler_console::de_linearize): Improve error
- messages.
- * shared.h: Increment fork magic number.
- * sigproc.cc (sigproc_terminate): Close all handles prior to calling
- proc_terminate if running in signal thread.
- (sig_send): Eliminate bogus ResetEvent on a semaphore. Add code for
- potentially dealing with problems when this code is interrupted via a
- signal dispatch.
- * times.cc (timezone): Use __small_sprintf.
- * uname.cc (uname): Ditto. Also use strcpy instead of sprintf where
- appropriate.
-
-1999-08-23 DJ Delorie <dj@envy.delorie.com>
-
- * localtime.c: export timezone, daylight, tzname as _*
- * times.cc: don't export timezone, daylight, tzname
- (timezone): return TZ if set.
- (cygwin_tzset): not needed.
-
-Thu Aug 19 13:46:47 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fork.cc (fork): Remove pinfo lock. It is in allocate_pid, now.
- * spawn.cc (_spawnve): Ditto.
- * pinfo.cc (pinfo_init): Ditto.
- (lock_pinfo_for_update): Impreove debug output.
- (pinfo_list::allocate_pid): Lock pinfo mutex here.
-
-1999-08-19 DJ Delorie <dj@cygnus.com>
-
- * Makefile.in (tooldir): If we're building natively, drop the
- $(target_alias) on include and lib's install (i.e. /usr/include
- instead of /usr/include/i686-cygwin).
-
-Thu Aug 19 01:11:25 1999 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (sig_send): Avoid a race with proc thread when executing
- due to a signal.
-
-Wed Aug 18 16:37:59 1999 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * fhandler_console (fhandler_console::fillin_info): Avoid setting
- scroll_region.Bottom when it is not known.
- (fhandler_console::write_normal): Add various fixes for console
- scrolling.
-
-Wed Aug 18 16:18:22 1999 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc: Add more precise end-of-process detection.
-
-Wed Aug 18 00:03:47 1999 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (sig_send): Work around apparent Windows bug which
- occasionally results in bogus error messages when a signal is
- dispatched.
-
-1999-08-17 DJ Delorie <dj@cygnus.com>
-
- * localtime.c (tzsetwall): Deduce TZ more accurately.
-
-Tue Aug 17 18:00:03 1999 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (peek_pipe): Correct detection of process group for
- backgrounded processes.
-
-Tue Aug 17 10:24:49 1999 Christopher Faylor <cgf@cygnus.com>
-
- * include/winnt.h: Fix typo in IMAGE_FIRST_SECTION definition.
-
-Sun Aug 15 19:11:49 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * gcrt0.c (__eprol): Avoid namespace pollution.
- (_monstartup): Turn into a constructor function and prevent multiple
- invocations.
-
-Mon Aug 16 10:03:00 Corinna Vinschen <corinna@vinschen.de>
-
- * utils/mkgroup.c: Correct call to LookupAccountSid for retrieval of
- 'None'.
-
-Mon Aug 16 00:24:29 1999 Christopher Faylor <cgf@cygnus.com>
-
- * debug.cc (locker): Improve signal mutex locking.
- * exceptions.cc (sig_handle): Pass STOP signals to call_handler to
- ensure honoring of signal_mutex.
- (call_handler): Move STOP code here after acquistion of signal_mutex.
- * fhandler_tty.cc (fhandler_tty_common::__acquire_output_mutex): Track
- lockers for debugging.
- (fhandler_tty_common::__release_output_mutex): Ditto.
- (fhandler_slave::write): Fix faulty signal blocking code.
- * fork.cc (fork_copy): Remove ancient if 0.
- (fork): Conditionalize "FORKDEBUG" under DEBUGGING.
- * sigproc.cc (proc_terminate): Reduce pinfo lock time.
- (sigproc_terminate): Set sig_loop_wait after getting signal_mutex.
- (__get_signal_mutex): Reorganize for less strace output when not
- DEBUGGING.
- (__release_signal_mutex): Ditto. Reorganize case where !sig_loop_wait.
- (have_signal_mutex): Returns true if current thread has the mutex.
- * wait.cc (wait4): Change debugging message.
-
-Sat Aug 14 0:10:00 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_base::raw_read): Set correct errno from Win32
- error when ReadFile fails.
- (fhandler_base::raw_write): In case of ERROR_DISK_FULL, return
- bytes_written only if bytes_written > 0.
- * errno.cc: Map ERROR_DISK_FULL to ENOSPC.
-
-Fri Aug 13 14:22:12 1999 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (peek_pipe): Honor ignra argument.
-
-Fri Aug 13 00:45:00 1999 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (spawn_guts): Ensure that hExeced is set to proper state
- when parent has exited.
-
-Thu Aug 12 14:09:30 1999 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (getsem): Fix typo which prevented sending signals to
- other processes.
-
-Wed Aug 11 22:06:33 1999 Christopher Faylor <cgf@cygnus.com>
-
- * cygwin.din: Export glob and globfree.
- * glob.h: Move to include.
- * Makefile.in: Correct glob.h dependencies.
-
-Wed Aug 11 19:41:04 1999 Sergey Okhapkin <sos@prospect.com.ru>
-
- * fhandler.cc (fhandler_disk_file::fstat): Check if the file is unix
- domain socket.
- (fhandler_disk_file::open): Call set_socket_p().
- * fhandler.h: Add new fhandler type flags (FH_LOCAL, FH_FIFO).
- (fhandler_base): get/set_socket_p - new member functions.
- (fhandler_socket::addr_family): Add new member, currently unused.
- (fhandler_socket::get/set_addr_family): Add new functions to access
- addr_family.
- * include/sys/un.h: New file.
- * net.cc: Include <sys/un.h>
- (cygwin_socket): Always create socket of AF_INET family, store
- argument's family.
- (get_inet_addr): New static function. Converts AF_UNIX requests into
- corresponding AF_INET requests.
- (cygwin_sendto): Use get_inet_addr().
- (cygwin_connect): Likewise.
- (cygwin_accept): Check for sockaddr length.
- (cygwin_bind): Implement AF_UNIX.
- * path.h (PATH_SOCKET): Add new enum value.
- (path_conv::issocket): Add new member function.
- (SOCKET_COOKIE): Add new define.
- * syscalls.cc (chmod): Mark socket files with system file attribute.
-
-Wed Aug 11 17:22:46 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * utils/mkgroup.c (main): Generate "None" group when
- invoked via mkgroup -l.
-
-Tue Aug 10 21:30:31 1999 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (peek_pipe): Handle type ahead where appropriate.
- * sigproc.cc (proc_can_be_signalled): Revert to previous method for
- determining signalability.
- (getsem): Move PID_INITIALIZING test here.
- * wait.cc (wait4): Improve debug output slightly.
-
-Mon Aug 9 23:27:44 1999 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (do_exit): Add additional check for valid hExeced.
- * exceptions.cc (call_handler): Implement a raceless way to track
- pending_signals.
- * signal.cc (kill_worker): Make calls from non-main threads synchronous
- or signals from a tty thread don't work right.
- * sigproc.cc (sig_send): Localize pending_signals assignment to only
- the wait_sig thread.
- (__get_signal_mutex): Don't attempt to grab a mutex if signal_mutex
- hasn't been assigned yet. Add more strace debugging information when
- -DDEBUGGING.
- (__release_signal_mutex): Don't attempt to release a mutex if
- signal_mutex hasn't been assigned yet. Add more strace debugging
- output.
- (wait_sig): Attempt to eliminate race in setting of pending_signals.
- * spawn.cc (spawn_guts): Set hExeced to INVALID_HANDLE_VALUE so that it
- will be obvious when a process is actually just an execed stub.
- * strace.cc (strace_vsprintf): Output a "!" after the pid when
- executing in an execed stub.
-
-Mon Aug 9 17:17:13 1999 Christopher Faylor <cgf@cygnus.com>
-
- Throughout, eliminate in() and out() macros.
- * winsup.h (tty_attached): Accept an argument indicating the pinfo
- structure to query.
- * exceptions.cc (really_exit): Cosmetic change.
- * external.cc (fillout_pinfo): Use queried pinfo structure for
- determining tty number, not *our* number.
- * net.cc: More workarounds.
- * path.cc (get_device_number): Supply argument to tty_attached.
- * syscalls.cc (ctermid): Ditto.
- * strace.cc (strace_dump): Remove.
- * include/sys/strace.h: Eliminate obsolete stuff.
-
-Sun Aug 8 22:54:45 1999 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (call_handler): Process all signals on return from a
- signal dispatch.
- * sigproc.cc (proc_can_be_signalled): Guard against waiting too long
- when exiting.
- (proc_exists): Don't report an exited process as "existing".
- (proc_terminate): Close handle prior to testing for existence so that
- proc_exists will not always return TRUE. Eliminate use of zap_subproc.
- (stopped_or_terminated): Eliminate use of zap_subproc.
- (zap_subproc): Delete.
-
-Sun Aug 8 22:17:36 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_tty.cc (fhandler_tty_master::init): hThread must remain
- open. Previous change to close it was wrong.
-
-Sun Aug 8 20:35:33 1999 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc: Initalize NO_COPY variables.
- * pinfo.cc (record_death): Don't be so insistent about getting
- the pinfo lock.
- * sigproc.cc (proc_terminate): Tighten the region protected by
- the pinfo lock.
- * spawn.cc (spawn_guts): Eliminate the pinfo lock when reparenting
- as it is no longer required.
- (_spawnve): Tighten the region protected by the pinfo lock.
-
-Sun Aug 8 18:26:51 1999 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (sig_send): Add more unfortunate guards against a
- system call being interrupted by a signal dispatch.
-
-Sat Aug 7 15:38:42 1999 Christopher Faylor <cgf@cygnus.com>
-
- * security.cc (get_admin_sid): Ensure that returned buf is not copied
- on a fork.
- (get_system_sid): Ditto.
- (get_create_owner_sid): Ditto.
- (get_world_sid): Ditto.
-
-Sat Aug 7 15:17:25 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_tty.cc (process_input): Reset signal_arrived event prior to
- calling console read as this is now a requirement for functions which
- detect signal_arrived.
- (fhandler_tty_master::write): Allow signals to operate prior to raising
- SIGTTOU.
- (fhandler_tty_master::read): Allow signals to operate prior to raising
- SIGTTIN.
- * select.cc (peek_pipe): Detect attempt to read from tty not in our
- process group as a "read_ready" event.
- * include/shellapi.h: Add missing defines.
- * utils/ps.cc: Output windows pid as unsigned for Windows 9x.
-
-Sat Aug 7 14:30:00 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (get_creator_owner_sid): New function.
- * shared.cc (sec_user): calls `get_creator_owner_sid' in creation
- of the security attributes structure additionally.
-
-Fri Aug 6 13:04:40 1999 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (spawn_guts): Allow failure from OpenProcess. The parent
- may have exited due to 7/31 change.
-
-Thu Aug 5 22:54:07 1999 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (wait_for_me): Break out as a common function to check
- that the current process is ready to handle signals.
- (proc_can_be_signalled): Treat myself differently.
-
-Thu Aug 5 21:24:20 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_console.cc (fhandler_console): Don't call tcinit here.
- (fhandler_console::read): Don't reset signal_arrived here.
- * syscalls.cc (_read): Set it here instead.
- * fhandler_termios.cc (fhandler_termios::line_edit): Only call
- accept_input when input is ready. Ignore iscanon in this case.
- * fhandler_tty.cc (fhandler_tty_slave::init): Don't call tcinit here.
-
-Thu Aug 5 16:02:25 1999 Christopher Faylor <cgf@cygnus.com>
-
- * strace.cc (handle_output_debug_string): Ignore errors reading
- from child memory as they seem to occur due to a process exiting.
- (close_handle): New, defensive code.
-
-Thu Aug 5 13:32:43 1999 Christopher Faylor <cgf@cygnus.com>
-
- * strace.cc (remove_handle): New function.
- (add_child): Speed up slightly.
- (proc_child): Use output of remove_child in CloseHandle.
-
-Thu Aug 5 12:38:50 1999 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (dll_crt0_1): Don't protect subproc_ready if it is NULL.
- (do_exit): Avoid calling close_all_files if exiting from exec stub.
- * net.cc: Reorganize to work around some compiler bugs.
- * spawn.cc (spawn_guts): Set hExeced only after child stuff has been
- completely initialized.
- * syscalls.cc (_open): Protect against signals.
- * utils/strace.cc (warn): New function.
- (add_child): Issue warning when can't duplicate child process handle.
-
-Wed Aug 4 21:35:28 1999 Christopher Faylor <cgf@cygnus.com>
-
- * psapi.h: New file.
-
-Thu Aug 4 10:28:00 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc: Eliminate MALLOC_CHECK calls.
- (lookup_name): New function simplifies the retrieval of user and group
- names.
- (alloc_sd): Call `lookup_name' instead of `LookupAccountName'.
- * shared.cc (sec_user): Call `lookup_name' instead of
- `LookupAccountName'. Eliminate 'free' call on stack space.
- * winsup.h: Declare `lookup_name'.
-
-Wed Aug 4 16:24:02 1999 Christopher Faylor <cgf@cygnus.com>
-
- * a.out.h: Fix cut and paste from mime email typos.
-
-Mon Aug 2 19:08:48 1999 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Fix utils dependency. Make clean more assertive.
- * path.cc (mount_info::conv_to_win32_path): Fill in correct destination
- when a device name is detected.
- * syscalls.cc (chown): Always succeed when referencing a cygwin device.
- (chmod): Ditto.
- * net.cc (get_ifconf): Eliminate holdover from previous change.
-
-Mon Aug 2 13:07:44 1999 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (do_global_ctors): Remove previous change. It was just
- wrong.
-
-Sun Aug 1 23:21:28 1999 Christopher Faylor <cgf@cygnus.com>
-
- Throughout rename 'slave_alive' handle to 'inuse'.
- * shared.h: Implement tty_attached() macro to determine when an actual
- tty is associated with the process.
- (class tty): Add some methods for manipulating an "inuse" event that is
- common to both master and slave parts of a tty.
- * dcrt0.cc (do_exit): Use tty_attached() to determine if signal should
- be sent to process group.
- * external.cc (fillout_pinfo): Return -1 if tty is not attached (i.e,
- attached to a console).
- * fhandler.h: Move more stuff into fhandler_tty_common and out from sub
- classes.
- * fhandler_console.cc (fhandler_console::read): Send SIGWINCH signal to
- *correct* process group.
- (fhandler_console::open): Fix incorrect argument ordering in set_ctty.
- (fhandler_console::de_linearize): Remove unneeded handle resets.
- * fhandler_tty.cc (fhandler_tty_slave::open): Fix incorrect argument
- ordering in set_ctty. Use tty create_inuse method to create inuse
- event.
- (fhandler_tty_slave::close): Delete.
- (fhandler_tty_slave::dup): Delete.
- (fhandler_tty_slave::write): Minor cleanup of flow of control.
- (fhandler_tty_common::dup): Subsume fhandler_tty_slave dup method.
- (fhandler_pty_master::fhandler_pty_master): Zero inuse field.
- (fhandler_pty_master::open): Set inuse field.
- (fhandler_tty_common::close): New, superclass method.
- (fhandler_tty_common::set_close_on_exec): Handle inuse field.
- (fhandler_tty_common::fixup_after_fork): Ditto.
- (fhandler_tty_slave::set_close_on_exec): Delete.
- (fhandler_tty_slave::fixup_after_fork): Delete.
- * path.cc (get_device_number): Use tty_attached() to figure out
- /dev/tty.
- * select.cc (peek_console): Send SIGWINCH signal to *correct* process
- group.
- * tty.cc (tty::master_alive): New method.
- (tty::create_inuse): New method.
-
-Sun Aug 1 16:23:22 1999 Christopher Faylor <cgf@cygnus.com>
-
- * net.cc (get_ifconf): Use alloca for temporary buffer.
-
-Sun Aug 1 01:38:20 1999 Christopher Faylor <cgf@cygnus.com>
-
- Modify de_linearize methods throughout to set unix and msdos path
- names.
- * dcrt0.cc (do_exit): Only remove shared memory when we're done with
- it.
- * exceptions.cc (try_to_debug): Move static variable outside of the
- function so that it can more easily be set with gdb.
- * fhandler_console.cc (fhandler_console::open): Handles are typically
- hexadecimal in debugging output.
- (fhandler_console::open): Do not open inherit console handles by
- default.
- (fhandler_console::dup): Just use open method to "duplicate" a console
- handle.
- (fhandler_console::fixup_after_fork): Do *not* close handles here since
- they have not been inherited.
- (fhandler_console::de_linearize): Ditto.
- * utils/strace.cc (create_child): Correct debugging flags when not
- tracking forked processes.
-
-Sat Jul 31 20:10:58 1999 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (do_global_ctors): Ensure that ctors are not called more
- than once per session.
- * fork.cc (fork): Use sig_protect to protect against signals during
- fork.
- * pinfo.cc (lpfu): Show windows pid in debugging message as this is
- generally more useful.
- * pinfo.cc (unlock_pinfo): Issue an error if ReleaseMutex fails.
- (pinfo::record_death): Actually unlock pinfo on exit rather than allow
- ExitProcess to do this since ExitProcess can sometimes take a *long*
- time.
- * spawn.cc (spawn_guts): Ensure that pinfo is always unlocked.
-
-Thu Jul 29 23:43:24 1999 Christopher Faylor <cgf@cygnus.com>
-
- Throughout, consolidate pgid processing for console and tty into
- fhandler_termios and tty_min.
- * debug.h: Make WF?O functions the defaults for dealing with Waits.
- These functions attempt to work around signal interrupt problems.
- * debug.cc: Ditto.
- * exceptions.cc (call_handler): Don't wait a long time for second
- attempt to get signal mutex.
- * fhandler_console.cc (fhandler_console::open): Set the "controlling
- tty".
- * fhandler_termios.cc: Move the ctty and pgid functions here.
- (fhandler_termios::line_edit): Fix debug output.
- * fhandler_tty.cc (fhandler_tty_slave_write): Use sig_protect to
- protect against output_mutex deadlock.
- * fork.cc (get_vfork_val): Conditionalize with NEWVFORK.
- * syscalls.cc (setsid): Add debugging output.
- (setpgid): Reorganize and add debugging output.
- * tty.cc (tty::init): Use a method to clear the sid.
-
-Thu Jul 29 23:42:53 1999 Christopher Faylor <cgf@cygnus.com>
-
- Patch from Egor Duda <deo@logos-m.ru>:
- * grp.cc (read_etc_group): Use a default /etc/group entry when one
- doesn't exist.
- (getgrgid): Ditto.
- * passwd.cc (read_etc_passwd): Use a default /etc/passwd entry when one
- doesn't exist.
- (search_for): Ditto.
- * uinfo.cc (read_etc_group): Remove some defines.
- * winsup.h: Move them here.
-
-1999-07-29 Bernd Schmidt <bernds@cygnus.co.uk>
-
- * Makefile.in (SUBDIRS_AFTER): Build mingw before utils.
- * utils/Makefile.in (MINGW_LDFLAGS): Add "-B../mingw/"
-
-
-Tue Jul 27 23:31:28 1999 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc: Add experimental vfork_storage initialization.
- (do_exit): Ditto.
- * exec.cc: Use _spawnve throughout as a common interface for execing a
- program.
- * fork.cc (vfork): Add beginnings of true vfork support.
- * path.cc (sort_by_posix_name): Remove special casing of zero length
- names since they should now be eliminated earlier on.
- (sort_by_native_name): Ditto.
- (mount_info::del_item): Remove hole from mount table specifically, here
- or suffer weird behavior. Suggested by Andrew Dalgleish
- <andrewd@axonet.com.au>.
- * shared.cc: Make SHAREDVER "unsigned" to avoid a compiler warning.
- * spawn.cc : Accommodate additional argument to _spawnve, throughout.
- (_spawnve): Make this a global function and take an hToken argument so
- that it can be used by sexecve. Accommodate experimental vfork
- functionality.
- * winsup.h: Add initial support for per-thread vfork stuff.
- * include/cygwin/version.h: Bump shared memory version number.
-
-Mon Jul 26 20:59:58 1999 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (sort_by_posix_name): Report two zero length strings as being
- equal or suffer an infinite loop.
- (sort_by_native_name): Ditto.
- * shared.cc (shared_info::initialize): Refuse to use a different DLL's
- shared memory.
- * shared.h: Fix mask for child_info sanity test.
-
-Sun Jul 18 16:30:31 1999 Christopher Faylor <cgf@cygnus.com>
-
- * security.cc: Various changes from Corinna.
-
-Sat Jul 17 22:33:45 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fork.cc (fork): Change DuplicateHandle slightly.
- * security.cc (get_nt_attribute): Ignore error return from
- set_process_privileges.
- (set_nt_attribute): Ditto.
-
-Sat Jul 17 00:45:34 1999 Christopher Faylor <cgf@cygnus.com>
-
- * debug.h: Fix ForceCloseHandle1 in non-debug case.
-
-Fri Jul 16 23:47:31 1999 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (proc_can_be_signalled): Accommodate different flavors of
- myself.
- * include/ddeml.h: Add missing struct.
- * include/wingdi.h: Add missing defines.
-
-Fri Jul 16 23:01:30 1999 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Attempt to cope when srcdir is a relative pathname.
- * fork.cc (fork): Pass handle to parent process to fixup_after_fork.
- Eliminate excess unlock_pinfos.
- * hinfo.cc (hinfo::fixup_after_fork): Use inherited parent handle
- rather than try to open the parent process explicitly.
- * pinfo.cc (record_death): Cosmetic change.
- * sigproc.cc (wait_sig): Add a debugging statement.
- * winsup.h: Reflect change of argument for fixup_after_fork.
-
-Fri Jul 16 11:07:55 1999 Christopher Faylor <cgf@cygnus.com>
-
- * shared.h: Eliminate record_death_nolock. Just pass an argument to
- record_death.
- * pinfo.cc (record_death_nolock): Ditto.
- * dcrt0.cc (__api_fatal): Use record_death with FALSE argument rather
- than record_death_nolock.
- * exceptions.cc (really_exit): Ditto.
- * fork.cc (fork): Remove debugging statement.
-
-Wed Jul 14 22:08:52 1999 Christopher Faylor <cgf@cygnus.com>
-
- Throughout, make parent_alive a local variable. Rename 'alive_parent'
- to 'my_parent_is_alive'.
- * autoload.h: Improve the description of the autoload mechanism.
- * dcrt0.cc: Define parent_alive here.
- (dll_crt0_1): When debugging, rotect handles inherited from fork/exec.
- Force signal thread to finish initializing prior to calling main.
- (dll_crt0): Reorganize child_info stuff to allow common initialization.
- Accept parent_alive handle from invoker and ensure that this is not
- inherited by other processes.
- (do_exit): Ensure that exit_state is not duplicated by a fork.
- (__api_fatal): Call 'try_to_debug' directly.
- * debug.cc: Increase the size of the handle list.
- (threadname): Add an optional argument to control locking.
- * exceptions.cc (error_start_init): Make this a "C" function.
- (try_to_debug): Ditto. Also, use Sleep rather than pause and loop so
- that gdb can get in to interrupt things.
- (sig_handle):
- * external.cc (fillout_pinfo): Reorganize slightly and plan for the
- future.
- * fhandler.h: Add an argument to show the name of the handle for error
- messages to fork_fixup.
- * fhandler.cc (fhandler_base::fork_fixup): Ditto.
- (set_inheriting): Rename a variable for clarity.
- (fhandler_base::fixup_after_fork): Pass in the name of the handle to
- fork_fixup.
- * fhandler_tty (fhandler_tty_common:fixup_after_fork): Ditto.
- (fhandler_tty_slave:fixup_after_fork): Ditto.
- (fhandler_tty_master:fixup_after_fork): Ditto.
- * fhandler_windows.cc (fhandler_windows::fixup_after_fork): Ditto.
- * fhandler_console.cc (fhandler_console::open): Specifically open
- console with ENABLE_PROCESSED_INPUT.
- * fork.cc (sync_with_child): Call abort when DEBUGGING and there's an
- error.
- (resume_child): Ditto. Also, allow an ERROR_INVALID_HANDLE error if it
- can't be duplicated as they seem to occur occasionally when the parent
- copies the stack.
- (fork): Use init_child_info to initialize structure passed to child.
- Remove start time setting in favor of common function. Don't mess with
- parent's parent_alive.
- * heap.cc (sbrk): Simply code slightly.
- * hinfo.cc (hinfo::dup2): Improve error handling.
- * pinfo.cc (set_myself): Set start time here since it is called by
- everything which sets myself.
- (pinfo_init): Remove start_time setting in favor of common function.
- * shared.h (pinfo): Reorganize so that signal stuff falls into section
- of pinfo which is automatically zeroed when a new pid is initialized.
- (PROC_MAGIC): Increment to detect cygwin1.dll's memory passing
- disparities.
- * sigproc.cc (proc_alive): Make this a function. Wait for target pid
- to initialize.
- (my_parent_is_alive): Rename from alive_parent.
- (proc_can_be_signalled): Renamed from proc_alive macro.
- (proc_exits): Use proc_can_be_signaleed().
- (proc_subproc): Don't put parent_alive in child.
- (proc_terminate): Close hwait_subproc in a race-safe way. Ditto
- sync_proc_subproc.
- (sigproc_terminate): Always terminate proc_subproc thread first or it
- may try to use signal thread as it is going away. Wait for signal
- thread to exit.
- (sig_send): Use proc_can_be_signalled().
- (init_child_info): New function. Initializes memory block passed by
- spawn/fork.
- (mutex_stack): Add thread name field.
- (sig_wait): Set active state after all handles have been set up and
- before protecting the handles. Use ForceCloseHandle to close
- subproc_ready as it is now protected. Close signal_mutex here.
- * sigproc.h: Accommodate alive_parent rename.
- * spawn.cc Use init_child_info to initilize memory block passed to
- subprocess.
- * strace.cc (__system_printf): Write to screen before writing to strace
- log. Only write to strace log if we're actually stracing.
- * winsup.h: Declare the 'action on error' functions.
- * utils/Makefile.in: (Patch from Egor Duda <deo@logos-m.ru>) Compile
- strace using -mno-cygwin.
- * utils/strace.cc: Allow ingw concession from Egor Duda. Attempt to
- allow CTRL-C when stracing.
-
-Thu Jul 14 0:39:00 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (alloc_sd): Delete special handling of uid/gid 513.
-
-Thu Jul 13 15:01:00 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (get_file_owner): Fix typo.
- * path.cc (path_conv::path_conv) : Change `return' to `goto end' in
- case of SYMLINK_IGNORE is set.
-
-Mon Jul 5 21:33:00 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (WriteSD): Doesn't set errno if BackupWrite()
- returns ERROR_INVALID_SECURITY_DESCR (which happens on FAT).
-
-Sat Jul 10 13:17:20 1999 Christopher Faylor <cgf@cygnus.com>
-
- * utils/strace.cc (error): Actually output error message.
- (add_child): Duplicate inherited child process handle with all of the
- privileges that we need.
-
-Fri Jul 9 01:37:23 1999 Geoffrey Noer <noer@cygnus.com>
-
- * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 14
- in honor of snprintf and vnsprintf additions.
-
-Fri Jul 9 00:04:03 1999 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (path_conv::path_conv): Correct buffer overflow condition.
- * fhandler_console.cc (fhandler_console::open): *Need* to enable
- processed input or CTRL-C won't stop anything unless it's at a prompt.
- (fhandler_console::input_tcsetattr): Ditto.
-
-Thu Jul 8 18:27:49 1999 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Add malloc debugging options.
- * dcrt0.cc (api_fatal): Call abort when debugging so that the debugger
- will pop up.
- * debug.cc (close_handle): Unlock in pathological case.
- * fhandler_console.cc (fhandler_console::read): Always respond to
- windows size changes.
- (fhandler_console::open): Always set things to ~ENABLE_PROCESSED_INPUT
- so that we can control INTR character. Don't set pgid here.
- (fhandler_console::input_tcsetattr): Turn on windows event so that we
- can see screen resizes.
- (fhandler_console::init): Don't set pgid here.
- * fhandler_termios (fhandler_termios::tcinit): Set pgid here.
- * fhandler.h: Fix set_has_acls method return.
- * utils/strace.h: Pass CTRL-Cs to child process.
-
-Wed Jul 7 23:59:50 1999 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Improve dependencies.
- * autoload.h: Work around "function unused" messages for autoload init
- functions.
- * configure.in: Use CHECK_TOOL to find CC so that it will get the
- proper host alias.
- * configure: Regenerate.
- * dcrt0.cc (do_exit): Minor reorganization of termination function
- calls.
- * debug.cc (close_handle): Issue an error when an attempt is makde to
- close a handle with a name different from the one used to record it
- previously.
- * debug.h: Implement new macros for storing arbitrary handle names.
- * exceptions.cc (handle_signal): Terminate the main thread when exiting
- due to signal in signal thread.
- * fhandler.h: Add an extra 'fd' argument to all ready_for_read methods.
- * select.cc: Ditto, throughout.
- * fhandler_console (get_tty_stuff): Protect the tty_stuff handle here.
- * fhandler_termios.cc (fhandler_termios::line_edit): Accommodate fd
- argument to ready_for_read.
- * fhandler_tty.cc (fhandler_tty_master::init): Close an unneeded thread
- handle.
- * fork.cc (fork): Use standard name when protecting process handle.
- * spawn.cc (spawn_guts): Ditto.
- * shared.cc (open_shared_file_map): Protect cygwin_shared handle here.
- * sigproc.cc: Throughout, close child process handle using standard
- name.
- * syscalls.cc (read_handler): Check that fd is still open prior to
- performing an operation. Supply fd argument for ready_for_read.
- * (_read): Supply fd argument for read_for_read.
- * tty.cc (tty_list::terminate): Close unneeded handles as tty is
- closing down.
- (tty_list::allocate): Protect against signals.
-
-Mon Jul 5 14:52:40 1999 Christopher Faylor <cgf@cygnus.com>
-
- * cygwin.din: Export new snprintf and vnsprintf functions courtesy of
- Egor Duda <deo@logos-m.ru>.
-
-Sun Jul 4 23:54:43 1999 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (sigbegin): New function. Called prior to dispatching
- to signal handler.
- (sigreturn): New function. Called after signal handler returns.
- (set_process_mask): Make stdcall.
- (call_handler): Remove sigwrap asm stuff in favor of new
- sigbegin/sigreturn scheme.
- * winsup.h: Change set_process_mask declaration.
-
-Sun Jul 4 22:00:14 1999 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (stat_worker): Previous change to check for extension
- found dots not in the filename part. Fix this.
-
-Sat Jul 3 23:22:55 1999 Christopher Faylor <cgf@cygnus.com>
-
- * include/wincon.h: Add some missing defines.
- * environ.cc: Remove extern which is now in winsup.h.
- * fhandler.cc (get_file_owner): Rename argument. Test for allow_ntsec.
- (get_file_group): Ditto.
- (fhandler_disk_file::fstat): Use new method inode checking.
- * fhandler.h: Rename a method.
- * security.cc (set_file_attribute): Take an additional argument to
- determine if ntsec security setting should be used.
- * dir.cc (mkdir): Pass acl info to set_file_attribute.
- * syscalls.cc (chown): Ditto.
- (chmod): Ditto.
- * winsup.h: Define allow_ntsec here.
-
-Sat Jul 3 15:09:34 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.cc (fhandler_disk_file:;fstat): Move check of disk volume to
- path_conv. Use new methods for determining if file system is ACL
- capable.
- (fhandler_disk_file::open): Set "has acls" flag here.
- * fhandler.h: Store acl information in fhandler base class.
- * path.cc (path_conv): Set acl information on successful return.
- * path.h: Add acl info to path_conv class.
- * security.cc (get_file_attribute): Set ENOSYS if can't get extended
- attributes.
- * syscalls.cc (chown): Pass acl information from path_conv to
- get_file_attributes.
- (chmod): Ditto.
- (stat_worker): Ditto.
- * uinfo.cc: Make all exported functions extern "C".
- * winsup.h: Add rootdir() declaration.
-
-Fri Jul 2 15:13:08 1999 Christopher Faylor <cgf@cygnus.com>
-
- * autoload.h: New file.
-
-Thu Jul 1 23:16:34 1999 Christopher Faylor <cgf@cygnus.com>
-
- * net.cc (cygwin_gethostname): Use new win32_gethostname to
- disambiguate between cygwin and winsock version.
- * tty.cc (creat_tty_master): Disambiguate by using cygwin_gethostname
- to find the hostname.
- * winsup.h: Declare cygwin_gethostname.
-
-Thu Jul 1 22:36:31 1999 Christopher Faylor <cgf@cygnus.com>
-
- Throughout, remove check for winsock initialization and indirect
- references to winsock functions in favor of new dynamic DLL loading
- method.
-
- * Makefile.in: Remove unneeded libraries.
- * cygwin.din: Make gethostname == cygwin_gethostname like other network
- functions.
- * dcrt0.cc: Implement new "autoload" functionality for loading DLLs and
- functions as they are needed. Add autoload functions for user32.dll.
- (cygwin_dll_func_load): New function.
- (dll_crt0): Issue a fatal error message if attempt to mix different
- version DLLs is detected.
- (api_fatal): Correct inexplicable use of buf + 8 when printing error
- message into a buffer.
- * fhandler.h: Cosmetic fixes.
- * fhandler_tty.cc (fhandler_tty::close): Temporarily "if 0" out code
- which sends EOF pulse to children. This should only happen when last
- parent fd closes.
- * heap.cc (sbrk): Implement new sbrk mechanism which returns memory to
- Windows when top of heap decreases beyond a page boundary.
- (getpagesize): New function.
- * fork.cc (fork): Save new heap values in stuff passed to child.
- * hinfo.cc (hinfo::build_fhandler): Don't do any checking on a handle
- if the handle is NULL. Assume that it is a disk file.
- * net.cc: Redo winsock functions to use dynamic loading scheme.
- * shared.cc (shared_info::initialize): Cosmetic change.
- * shared.h: Change magic number for memory block sent to child
- processes. Accommodate new heap information in child_info.
- * sigproc.cc (sig_dispatch_pending): Remove some memory debugging checks.
- (__release_signal_mutex): Ditto.
- * syscalls.cc (stat_worker): Don't attempt the .exe hack unless the
- previous attempt to open the file resulted in an "ERROR_FILE_NOT_FOUND"
- and the file did not already contain an extension.
- * times.cc: Initialize static NO_COPY variables throughout or they will
- not actually be NO_COPY.
- * winsup.h: Rename heap fields in per_process to accommodate new sbrk.
- Eliminate winsock stuff invalidated by dynamic loading change.
- * include/winsock.h: Make this file C++ safe.
-
-Sun Jun 27 17:07:34 1999 Christopher Faylor <cgf@cygnus.com>
-
- * debug.h: Don't define MALLOC_DEBUG by default.
- * fhandler.cc (fhandler_base::set_name): Always set names to NULL. Add
- more slop to end of win32_path_name.
- (fhandler_base::de_linearize): Set names to NULL. They'll be assigned
- by the caller.
- (fhandler_disk_file::get_native): Delete.
- * fhandler.h: Ditto.
- * hinfo.cc (hinfo::de_linearize_fd_array): Set path names after the
- structure has been "delinearized".
- * malloc.cc: Add debugging versions of malloc functions.
- * syscalls.cc (stat_worker): Eliminate static buffer for thread safety.
-
-Wed Jun 23 22:53:00 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_disk_file::fstat): If get_file_attribute()
- signals a nonexistant acl, fstat sets default attributes now.
-
-Wed Jun 23 10:22:56 1999 Geoffrey Noer <noer@cygnus.com>
-
- * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 13.
-
-Wed Jun 23 10:39:07 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * cygwin.din (gamma, gammaf, lgamma, lgammaf): Export.
- (j0,j0f,j1,j1f,jn,jnf): Export underscore versions as well.
-
-Mon Jun 21 21:34:06 1999 Christopher Faylor <cgf@cygnus.com>
-
- Sprinkle MALLOC_CHECK macro throughout. When turned on, this will give
- a slightly better idea of where memory corruption occurs. Add slightly
- modified versions of "error_start" code from Egor Duda
- <deo@logos-m.ru>.
- * Makefile.in: Add `utils' target.
- * dcrt0.cc (do_exit): Attempt to detect loop conditions where do_exit
- is called reentrantly and avoid the previously executed code in this
- case.
- * debug.h: Define MALLOC_CHECK macro for use with malloc debugging.
- * environ.cc (environ_init): Add more slop at end of environ string
- just to work around buggy programs.
- (parse_options): Add error_start option to control core dumping or gdb
- invocation.
- * exceptions.cc (stackdump): New function. Dumps stack to stderr.
- (error_start_init): New function. Initialize action on "core dumping"
- error.
- (handle_exceptions.cc): Use stackdump command to dump stack. Call
- try_to_debug.
- (set_process_mask): Must be __stdcall or compiler get's confused.
- (sig_handle): Detect SIGQUIT and SIGABRT. Do a "stackdump" for these.
- * fhandler.cc (get_file_owner): Add an argument to determine if
- function should check for NT security.
- (get_file_group): Ditto.
- (fhandler_base::set_name): Don't free "fhandler_disk_dummy_name" path
- names.
- (rootdir): New function, pulled from the pages of syscalls.cc.
- Determines the root dir of a given path.
- (fhandler_disk_file::fstat): Get volume information of file in question
- to determine if inodes are permanent and acls are available. This
- replaces previous WinNT test.
- (fhandler_base::~fhandler_base): free "fhandler_disk_dummy_name" path
- names.
- * fhandler.h: Change get_file_* declarations.
- * fhandler_console.cc: Back out most of scroll fixes from April 17.
- They caused weird scrolling behavior.
- * fhandler_tty.cc (fhandler_pty_master::accept_input): Add debugging
- message.
- * security.cc (get_file_attribute): Add additional "check for ACL"
- argument.
- * path.cc (symlink_check_one): Use new argument to get_file_attribute.
- * sigproc.cc (wait_subproc): Don't exit wait loop if WaitForMultipleObject
- returns an error. Instead, loop for a while in case this is an expected
- error.
- * sigproc.h: Remove __stdcall from set_process_mask.
- * spawn.cc (linebuf): Use initializers to set initial values.
- (linebuf::append): Be defensive and ensure that enough space is
- allocated for the new argument.
- (linebuf::prepend): Ditto.
- (spawn_guts): Correct logic which broke up program argument in a #!
- script.
- * syscalls.cc (chown): Use new argument to get_file_attribute.
- (chmod): Use new argument to get_file_owner and get_file_group.
- (stat_worker): Ditto.
- (statfs): Break out code that determined the root directory of a given
- path. Use new rootdir function instead.
- * winsup.h: Reflect new get_file_attribute argument.
- * include/sys/strace.h: Add "NOTALL" flag so that voluminous debugging
- output can be avoided.
- * utils/strace.cc: Honor NOTALL flag. Run at a higher priority.
-
-Mon Jun 14 18:33:08 1999 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.c (stat_worker): Consolidate calls to fh.fstat for both
- directories and normal files.
- * fhandler_tty.cc (fhandler_pty_master::close): Ensure that an "EOF
- pulse" is sent to any executing child processes.
- * path.cc (symlink_check_one): Check for ':\n' as well as '#!' to
- determine if a file is executable.
-
-Mon Jun 14 16:04:00 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_tty.cc (fhandler_pty_master::accept_input): Set read_retval
- prior to performing a write to avoid a potential race condition.
- * fhandler_termios.cc (fhandler_termios::line_edit): Don't set
- read_retval here. It has to be set in an fhandler_tty accept_input.
- * select.cc (peek_pipe): Fix typo which caused read_selected to be
- tested twice rather than except_selected.
- * shared.h (class tty_min): Remove read_retval from here.
- (class tty) Put it here.
-
-Mon Jun 14 13:08:58 1999 Christopher Faylor <cgf@cygnus.com>
-
- * utils/Makefile.in: Consolidate and simplify.
-
-Mon Jun 14 12:43:32 1999 Christopher Faylor <cgf@cygnus.com>
-
- Throughout, remove reliance on strace_* fields in pinfo class. Use
- global instead. Remove STRACE_DUMP and STRACE_CACHE logic.
- * pinfo.cc (set_myself): New function.
- * dcrt0.cc (dll_crt0_1): Use the new function.
- * environ.cc (parse_options): Remove strace environment variable logic.
- (environ_init): Ditto.
- * exceptions.cc (call_handler): Remove strace mutex considerations.
- * fhandler_termios (fhandler_termios::line_edit): Remove STRACE_CACHE
- logic.
- * localtime.cc: Define 'lint' to eliminate warnings.
- * smallprint.c (__small_vsprintf): Remove text formatting of windowss
- errors. This is now done in the 'strace' program.
- * strace.cc: Define 'strace_active' variable to control whether strace
- should be carried out.
- (strace_open): Delete.
- (strace_init): Delete.
- (get_strace_mutex): Delete.
- (release_strace_mutex): Delete.
- (strace_vsprintf): Preserve last error.
- (strace_write): Communicate with strace program using
- OutputDebugString.
- (strace_dump): Delete.
- (mark): Gut.
- * winsup.h: Remove a declaration. Add a new one.
- * include/sys/strace.h: Modify to accommodate new strace scheme.
- * utils/Makefile.in: Build strace.exe
- * utils/strace.cc: New file.
-
-Sat Jun 12 22:22:00 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_disk_file::fstat): Must compute i-node numbers
- via `get_namehash' for Windows 9x.
-
-Sat Jun 12 10:54:00 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_base::read): Returns correct value
- if raw_read fails.
- * fhandler_raw.cc: More trace output.
- * fhandler_floppy.cc: Ditto.
- * fhandler_tape.cc: Ditto.
-
-Thu Jun 10 14:01:05 1999 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.c (handle_exceptions): Use ".stackdump"
- extension instead of ".core".
- * path.cc (mount_info::read_mounts): Prescan the mount lists
- for /cygdrive stuff to delete rather than attempting to
- delete it in the main "add mount loop".
- (mount_item::getmntent): Fix "system"/"user" determination.
- * winsup.h: Use void methods in thread classes where
- appropriate.
-
-Wed Jun 9 23:16:04 1999 Christopher Faylor <cgf@cygnus.com>
-
- * mkvers.sh: Issue error if can't find version information.
-
-1999-06-09 DJ Delorie <dj@cygnus.com>
-
- * localtime.c: new file; public domain timezone handling routines.
- * tz_posixrules.h: new file; POSIX default timezone data
- * times.cc: comment out localtime, gmtime, replace tzset with
- cygwin_tzset
- * Makefile.in: add localtime.c
-
-Wed Jun 9 00:49:04 1999 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (spawn_guts): Correctly handle #! processing when line
- ends with white space. Also correctly handle scripts that do not
- begin with #!.
-
-Mon Jun 7 17:04:36 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_console.cc (fhandler_console::open): Need to initialize
- tc here, too.
- (fhandler_console::init): Initialize tc earlier.
-
-Mon Jun 7 00:02:51 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h (fhandler_termios): Move tc initialization
- into init method, etc.
- (fhandler_tty_common): Ditto.
- * fhandler_console.cc (fhandler_console::fhandler_console):
- Move tc initialization to init method.
- (fhandler_console::init): Initialize tc stuff here.
- (fhandler_console::dup): Ditto.
- (fhandler_console::fixup_after_fork): Ditto.
- (fhandler_console::de_linearize): Ditto.
- * fhandler_termios (tcinit): Rename constructor.
- Accept force argument to force termios initialization.
- * fhandler_tty.cc (fhandler_tty_master::init): Move tc initialization
- to common_init.
- (fhandler_tty_common::dup): Use tcinit () to initialize tc field.
- * tty.cc (tty::common_init): Ditto.
-
-Sun Jun 6 22:19:09 1999 Christopher Faylor <cgf@cygnus.com>
-
- * tty.cc (tty_list::terminate): Add \n to output message.
- (tty::init): Clear slave_opened field or we can't reopen
- ttys.
-
-Fri Jun 4 23:58:17 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_tty.cc (fhandler_tty_slave::open): Reorganize
- slightly to avoid a race with get_ttyp()->was_opened.
-
-1999-06-04 DJ Delorie <dj@cygnus.com>
-
- * times.cc (totimeval): scale sub properly.
- (gettimeofday): don't bias by timezone.
-
-Thu Jun 3 13:24:17 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h (fhandler_tty_common): Add two new methods.
- * fhandler_tty.cc: Use new {acquire,release}_output_mutex
- methods throughout for output_mutex.
- (fhandler_tty_common::__acquire_output_mutex): New method.
- (fhandler_tty_common::__release_output_mutex): New method.
- * shared.h (get_output_mutex): Rename to open_output_mutex.
-
-Wed Jun 2 16:06:26 1999 Geoffrey Noer <noer@cygnus.com>
-
- * utils/mkpasswd.c (main): account for long int args to printfs.
-
-Wed Jun 2 16:08:08 1999 Christopher Faylor <cgf@cygnus.com>
-
- * smallprint.c (__small_vsprintf): Conditionalize display of
- textual messages under CYGWIN_TEXT_ERROR.
- * ntea.cc: Remove debugging code.
-
-Wed Jun 2 16:04:00 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * dcrt0.cc (dll_crt0_1): Call the functions `get_admin_sid',
- `get_system_sid' and `get_world_sid' before heap initialization
- to avoid heap fragmentation.
- * security.cc (get_nt_attribute): Don't allocate memory
- anymore. All memory is taken from stack.
- (set_nt_attribute): Ditto.
- (alloc_sd): Ditto. Change parameters to get a pointer to a
- preallocated security descriptor and a pointer to it's length.
- * shared.cc (sec_user): Don't allocate memory anymore. All
- memory is taken from stack. Change parameters to receive a
- pointer to a preallocated security buffer.
- * shared.h: Change prototype for `sec_user' and `sec_user_nih'.
- * sigproc.cc (getsem): Change call to `sec_user'. Additonally
- buffer for `sec_user'.
- * spawn.cc (spawn_guts): Ditto.
- Change all error output in function `sec_user' and in module
- `security.cc' from error text to error number output.
-
-Tue Jun 2 21:54:21 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (get_if_flags): Change the UP and RUNNING state
- of disconnected RAS interfaces to true.
-
-Thu Jun 1 22:47:00 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (get_system_sid): New function to create
- a SID for the well known group of local system.
- (alloc_sd): New function.
- (alloc_sd): Give ALL permissions to `system'.
- * shared.cc (sec_user): Give ALL permissions to `system'.
- (sec_user): Provide additionalparameter for a second SID.
- This is used for `CreateProcessAsUser' call.
- (sec_user_nih): Ditto.
- * shared.h: Change prototypes for `sec_user' and
- `sec_user_nih'.
- * spawn.cc (spawn_guts): Now using `sec_user' in
- `CreateProcessAsUser' call, if ntsec is set.
-
-Thu Jun 1 14:17:00 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * utils/mkpasswd.c: Change to output native names of
- well known groups `Everyone' (SID 0) and `system' (SID 18).
- * utils/mkgroup.c: Ditto plus output of native name of
- well known group `None' (SID 513).
-
-Mon May 31 22:10:57 1999 Christopher Faylor <cgf@cygnus.com>
-
- * path.h: Use bit mask flags in path_conv to save exec,
- symlink, binary status. Use methods to access and set
- these flags.
- * fhandler.cc: Use methods to access path_conv flags
- throughout.
- * path.cc: (symlink-check_one): Accept a bitmask flags
- variable to accommodate path_conv changes.
- (path_conv::path_conv): Propagate path_flags from mount
- table to path_conv class. Avoid walking the mount table
- twice to find "binary" info.
- (mount_info::conv_to_win32_path): Accept additional flags
- argument. Don't add trailing slash if not required.
- Fill out both paths when cygdrive.
- (mount_info::cygdrive_win32_path): Change debugging output
- slightly.
- (mount_info::set_flags_from_win32_path): Generalize from
- mount_info::binary_win32_path_p.
- (mount_item::getmntent): Honor MOUNT_EXEC flag.
- * shared.h: Add new method to mount_info class.
- * include/sys/mount.h: Add a comment.
- * utils/mount.cc: Accept -x to force a mountpoint to default
- to executable permission. Rename automount stuff to cygdrive.
-
-Mon May 31 19:00:00 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * environ.cc (environ_init): Set ntsec option by default
- if running under NT.
- * security.cc (set_nt_attribute): Delete superfluoues code.
- * shared.cc (sec_user): Don't set owner in created security
- descriptor.
- * sigproc.cc (getsem): Use `sec_user' instead of `sec_user_nih'.
- * spawn.cc (spawn_guts): Set security attribute of
- `CreateProcess' to `sec_user' if ntsec is set, `sec_all_nih'
- otherwise.
-
-Mon May 31 19:27:36 1999 Christopher Faylor <cgf@cygnus.com>
-
- Throughout, change "automount" to cygdrive.
- Throughout, change mount flags from signed to unsigned.
-
- * path.cc (iscygdrive): New macro.
- (normalize_posix_path): Tack a '/' on the end of constructed
- path only if there isn't one there already.
- (mount_info::init): Simplify slightly.
- (mount_info::conv_to_win32_path): Don't search for automount
- stuff in the mount table. Instead special case the cygdrive
- handling so that it will always be acceptable to use /cygdrive
- regardless of other mounts.
- (mount_info::cygdrive_posix_path): Rename from
- build_automount_mountpoint_path. Fully build a posix path
- given inputs.
- (mount_info::cygdrive_win32_path): New function.
- (mount_info::conv_to_posix_path): Precalculate the length
- of the pathbuf for multiple uses. Just use cygdrive_posix_path
- to derive a /cygdrive/x/foo style path.
- (mount_info::read_mounts): Don't read /cygdrive/x mounts from
- the registry. Delete them.
- (mount_info::from_registry): Read cygdrive info earlier for
- subsequent use by other mount routines.
- (mount_info::add_reg_mount): Cosmetic changes.
- (mount_info::read_cygdrive_info_from_registry): Always add
- trailing slash to cygdrive. Precalculate the length of the
- cygdrive.
- (mount_item::getmntent): Cosmetic changes.
- (mount): Return EINVAL on attempt to add a mount point which
- begins with the current cygdrive.
- * path.h: Remove unused script_p from path_conv class.
- * shared.h: Add cygdrive_length to mount_list. Add new
- cygdrive_win32_path method.
- * include/sys/mount.h: Use enums for MOUNT_ constants.
-
-1999-05-29 Keith Seitz <keiths@cygnus.com>
-
- * errno.cc (errmap): Map ERROR_NEGATIVE_SEEK to EINVAL.
-
-Fri May 28 21:43:56 1999 Christopher Faylor <cgf@cygnus.com>
-
- * times.cc (to_time_t): Rewrite slightly to avoid compiler
- overoptimization.
-
-Fri May 28 21:10:33 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * sigproc.cc (getsem): Set security attribute of process
- semaphore to `sec_user_nih()', if ntsec is set, `sec_none_nih'
- otherwise.
-
-Wed May 26 22:56:51 1999 Christopher Faylor <cgf@cygnus.com>
-
- Rename inuse_event and inuse_event_exists to "slave_alive"
- throughout.
- * shared.h: Eliminate inuse_event. Replace with a boolean.
- Elminate slave_opened.
- Add some function declarations used by new methods.
- * fhandler_tty.cc (fhandler_pty_master::hit_eof): Use better
- method for determining EOF for pty master.
- (fhandler_tty_slave::open): Use method to acquire output_mutex.
- Always create "inuse_event". Delete call to slave_opened.
- (fhandler_tty_slave::write): Reorganize debugging output
- slightly.
- (fhandler_tty_master::close): Eliminate reference to inuse_event.
- * tty.cc (tty_list::terminate): Eliminate call to slave_opened.
- (tty_list::connect_tty): Use new exists() method to find out if
- a tty exists.
- (tty_list::allocate_tty): Rename argument for clarity. Use
- new exists method to determine tty existence.
- (tty::inuse): Delete.
- (tty::init): Remove reference to inuse_event.
- (tty::common_init): Ditto.
- (tty::slave_opened): Delete.
- * winsup.h: Move some function declarations to shared.h.
-
-Mon May 24 22:10:34 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (WriteSD): Don't set errno, if BackupWrite()
- returns ERROR_NOT_SUPPORTED.
- * security.cc (set_nt_attribute): Change condition for
- calling LookupAccountName() with domain name again.
- * shared.cc (sec_user): Ditto.
-
-Mon May 24 22:10:34 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * include/winnt.h: Temporary erased definitions of QuadPart
- in LARGE_INTEGER and ULARGE_INTEGER.
- * security.cc (set_nt_attribute): Set standard attributes so
- that reading and writing attributes for user and administrators
- isn't hindered.
-
-Mon May 24 22:10:34 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (ReadSD): New function.
- * security.cc (WriteSD): Ditto.
- * security.cc (get_admin_sid): Moved from shared.cc.
- * security.cc (set_process_privileges): Moved from syscalls.cc,
- shortened, changed return typ to int. Sets errno now.
- * security.cc (set_file_attributes): Return type changed to int.
- * security.cc (get_file_attributes): Ditto.
- * security.cc (set_nt_attributes): Ditto. Cares for setting
- of S_ISVTX now.
- * security.cc (get_nt_attributes): Ditto.
- * syscalls.cc (rel2abssd): #if 0'ed.
- * syscalls.cc (set_process_privileges): Moved to security.cc.
- * syscalls.cc (chown): Rewritten.
- * syscalls.cc (chmod): Change call order of the functions
- set_file_attributes() and SetFileAttributesA().
- * fhandler.cc (fhandler_base::fstat): Change check for
- return value of get_file_attributes().
- * ntea.cc (NTReadEA): returns TRUE now, if allow_ntea is unset.
- * ntea.cc (NTWriteEA): returns TRUE now, if allow_ntea is unset.
- * shared.cc (get_admin_sid): Moved to security.cc.
- * path.cc (symlink_check_one): Change check for return value
- of get_file_attributes().
-
-Mon May 24 22:10:34 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (get_world_sid): Rewrite.
- * security.cc (world_full_access): Delete.
- * grp.cc: Use gid 0 as default gid.
- * grp.cc (read_etc_group): Look for account name of world group.
- * fhandler.cc (fhandler_base::open): Call `set_file_attribute'
- only in case of disk file.
-
-Mon May 24 22:10:34 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (get_file_attribute): Patched incorrect test
- for symlink.
- * security.cc (set_file_attribute): ditto.
-
-Mon May 24 22:10:34 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc: Special handling for user and/or administrators
- permissions to write (extended) attributes.
-
-Mon May 24 22:10:34 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc: Don't allow 513(none) as user or group.
-
-Mon May 24 22:10:34 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc: new functions `set_nt_attribute()', `get_nt_attribute()'
- and `set_file_attribute()' with additional parameters `uid' and `gid',
- to support real NT security.
- * winsup.h: Prototype for `set_file_attribute()' with four
- parameters.
- * dir.cc (mkdir): Calls `set_file_attribute()' now.
- * syscalls.cc (chown): ditto.
- * syscalls.cc (chmod): ditto, with correct uid/gid.
-
-Mon May 24 22:10:34 1999 Corinna Vinschen <corinna@vinschen.de>
-
- * shared.cc: New function `get_admin_sid()' to get a SID
- of the administrators group or of administrator.
- New functions `sec_user()' and `sec_user_nih()' to get
- SECURITY_ATTRIBUTES with all permissions for the user and
- the administtrator group.
- * shared.h: Prototypes for the above new functions `sec_user()'
- and `sec_user_nih()'.
- * sigproc.cc (getsem): Create process semaphore with
- permissions set by `sec_user()'.
-
-Mon May 24 20:29:29 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_console.cc (fhandler_console::output_tcsetattr):
- ONLRET was erroneously used in place of ONLCR.
- (fhandler_console::read): Honor get_r_no_interrupt () so
- that interrupts don't screw up tty reading.
- * fhandler.h: Add some methods to fhandler_tty_master.
- * fhandler_termios.cc (fhandler_termios::fhandler_termios):
- ONLRET was erroneously used in place of ONLCR.
- * fhandler_tty.cc (fhandler_tty_master::init): Associating
- console capabilities with the tty capabilities is a bad
- idea. Go back to using the console's own.
- (fhandler_tty_master::fixup_after_fork): New method.
- (fhandler_tty_master::de_linearize): New method.
- (fhandler_tty_master::init_console): New method.
-
-Mon May 24 09:58:02 1999 Christopher Faylor <cgf@cygnus.com>
-
- * include/rapi.h: Add some more definitions.
-
-Sat May 22 21:45:01 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * scandir.cc (scandir): Handle errno correctly. Do preallocation to
- reduce realloc calls.
- (alphasort): Use strcoll, not strcmp.
-
-Sat May 22 19:03:47 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * dll_init.cc (DllList::recordDll): Forkee must reload dlopened
- DLLs. Also use strcasematch, not strcmp to compare file name.
-
-Wed May 19 14:38:57 1999 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (linebuf::prepend): Fix possible reference to
- uninitialized memory.
- * winsup.h: Remove WINSUP_NO_CLASS_DEFS workaround.
- * libccrt0.cc: Ditto.
- * utils/cygwin.cc: Ditto.
- * utils/mount.cc: Ditto.
- * utils/ps.cc: Ditto.
-
-Sun May 16 17:22:50 1999 Christopher Faylor <cgf@cygnus.com>
-
- * include/winnt.h: Revert the previous reversion. The problem
- with this include file was completely misdiagnosed.
-
-Sun May 16 16:05:07 1999 Christopher Faylor <cgf@cygnus.com>
-
- * sysdef/rapi.def: New definition file for RAPI.DLL.
- * include/rapi.h: Preliminary RAPI declarations.
-
-Sun May 16 15:37:15 1999 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Remove more obsolete code.
-
-Fri May 14 19:30:53 1999 Christopher Faylor <cgf@cygnus.com>
-
- * include/winbase.h: Change conditional to correctly refer
- to UNDER_CE rather than UNICODE.
- * include/winnt.h: Update MIPS and SHx CONTEXT definitions.
-
-Tue May 11 21:19:59 1999 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (call_handler): Restore previously removed
- 'leave' command as its absence causes programs to crash. It
- should never have been deleted.
-
-Tue May 11 12:04:02 1999 Norbert Schulze <Norbert.Schulze@rhein-neckar.de>
-
- * times.cc (timezone): Properly adjust for daylight savings time.
- (gettimeofday): Ditto.
- (localtime): Ditto.
- (tzset): Ditto.
-
-Mon May 10 23:31:36 1999 Christopher Faylor <cgf@cygnus.com>
-
- * include/winnt.h: Revert to previous version. There are problems
- with the previous checkin.
- * fhandler_console.cc (fhandler_console::de_linearize): Add defensive
- code to ensure that console handles are opened correctly.
-
-Sun May 9 22:31:31 1999 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Forgot to remove a reference to the deleted targets
- below.
-
-Fri May 7 17:28:12 1999 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Remove obsolete code.
- * exceptions.cc (set_process_mask): Make this a __stdcall.
- * sigproc.h: Fix declaration of set_process_mask.
- * include/winnls.h: Add new code page defines.
- * include/winnt.h: Various fixes from Anders Norlander
- <anorland@hem2.passagen.se>.
-
-Tue May 4 22:20:05 1999 Christopher Faylor <cgf@cygnus.com>
-
- * include/winnt.h: Fix CONTEXT pointer typedefs.
-
-Mon May 3 11:32:32 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * smallprint.c (__small_vsprintf): Display textual messages
- for "%E" format type.
- * dlfcn.cc (set_dl_error): Lose the "Win32 ".
-
-Sun May 2 12:22:17 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * utils/Makefile.in (EXE_LDFLAGS): Provide default.
-
-1999-04-30 DJ Delorie <dj@cygnus.com>
-
- * winsup.h (WINSUP_NO_CLASS_DEFS): if defined, don't include class
- definitions (work around gcc bug)
- * libccrt0.cc (WINSUP_NO_CLASS_DEFS): define
- * utils/cygwin.cc (WINSUP_NO_CLASS_DEFS): define
- * utils/mount.cc (WINSUP_NO_CLASS_DEFS): define
- * utils/ps.cc (WINSUP_NO_CLASS_DEFS): define
-
-Thu Apr 29 13:55:57 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * shared.h (read_mounts): Change prototype to accept a reference
- to reg_key, not a copy.
- * path.cc (read_mounts): Likewise.
-
-Thu Apr 29 11:06:37 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * configure.in (EXE_LDFLAGS): Always add newlib if part of the
- build tree.
- * configure: Regenerate.
-
- * utils/Makefile.in (INCLUDES): Add newlib include directories.
- (LDFLAGS): Replace this with
- (ALL_LDFLAGS): this to avoid being overridden from higher level
- Makefiles.
-
-Wed Apr 28 17:01:12 1999 Christopher Faylor <cgf@cygnus.com>
-
- * include/winnt.h: Add some handheld support.
- * shared.cc (open_shared): Don't call OpenFileMapping with
- a null name pointer. If the name is NULL it can't be opened.
-
-Fri Apr 23 00:28:38 1999 Christopher Faylor <cgf@cygnus.com>
-
- * winsup.h: Always clear memory in thread .create method or
- suffer uninitialized pointers, etc.
-
-Wed Apr 21 03:56:54 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_console.cc (fhandler_console::fhandler_console):
- Set fork_fixup flag to ensure that shared info is duplicated.
- (get_tty_stuff): Ensure that tty_stuff is initialized.
- (fhandler_console::fixup_after_fork): Really force tc and
- tty_stuff initialization. Close console handles or suffer
- handle leak. (needs to be fixed)
- (fhandler_console::de_linearize): Force tc and tty_stuff
- initialization.
-
-Mon Apr 19 14:54:46 1999 Geoffrey Noer <noer@cygnus.com>
-
- * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 12.
-
-Sat Apr 17 15:35:34 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_console (fhandler_console::fixup_after_fork): Make sure
- that new shared memory for console is initialized.
- (fhandler_console::scroll_screen): Set region bottom correctly.
- (fhandler_console::write_normal): Fix win95 problem where attribute
- was propagated to scrolled region.
- * include/wingdi.h: Fix GOBJENUMPROC prototype.
-
-Wed Apr 7 20:00:00 1999 John Fortin (fortinj@ibm.net)
-
- * pthread.cc (pthread_suspend): New function.
- (pthread_continue): Ditto.
- * include/pthread.h: added pthread_suspend and pthread_continue
- prototypes.
- * cygwin.din: added above functions.
- * thread.h: Add 'bool suspended' to class MTitem. Prototype
- __pthread_suspend __pthread_continue.
- * thread.cc (__pthread_suspend): New function.
- (__pthread_continue): New function.
-
-Sun Apr 4 23:00:00 1999 John Fortin (fortinj@ibm.net)
-
- * pthread.cc (pthread_join): New function.
- (pthread_detach): New function.
- * include/pthread.h: added pthread_join and pthread_detach prototypes.
- * cygwin.din: added above functions for exports.
- * thread.h: Added char joinable to MTitem class. Add void *
- return_ptr to ThreadItem class to receive pointer from pthread_exit
- and pthread_join. Add __pthread_join and __pthread_detach prototypes.
- * thread.cc: Change thread_init_wrapper to set item->return_ptr=ret
- and comment out item->used = false. Need to look at this more.
- (__pthread_join): New function.
- (__pthread_detach): New function.
- (__pthread_exit): Implement ( was NOT_IMP ).
- * thread.cc (MTinterface::FindNextUnused) : Use joinable != 'Y' as
- an additional conditional. We may need to use this info in
- pthread_join.
-
-Mon Apr 5 23:09:06 1999 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (do_exit): Change a variable name to minimize confusion.
- * fhandler.h (fhandler_tty): Remove ttyp field in favor of get_ttyp
- method.
- * fhandler_tty.cc: Use get_ttyp () method to retrieve pointer to
- tty device throughout.
- (fhandler_tty_master::init): Point console tc at tty's tc so
- that they share the same termios structure.
- * select.cc (fhandler_tty_common::ready_for_read): Use get_ttyp
- method.
- * tty.cc (tty::common_init): Ditto.
-
-Mon Apr 5 00:22:30 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_console.cc (fhandler_console::char_command): Make
- setting of scrolling region cause the cursor to be placed at
- the beginning of the scrolling region.
- * thread.cc (__pthread_kill): Defend against item->sigs being
- uninitialized.
- (__pthread_sigmask): Defened against item->sigs being uninitialized.
-
-Wed Mar 31 22:52:18 1999 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (dll_crt0): Restore pointer to shared console
- terminfo structure. This allows subprocesses to set
- sticky console attributes.
- * fhandler_console.cc (get_tty_styff): New function. Returns
- pointer to shared console terminfo structure, allocating shared
- memory if required.
- (fhandler_console::fhandler_console): Use get_tty_stuff().
- (fhandler_console::de_linearize): Ditto.
- * fork.cc (fork): Save shared console handle for export to
- subprocesses.
- * spawn.cc (spawn_guts): Ditto.
- * shared.cc (open_shared_file_map): Rewrite to use generic
- open_shared() function.
- (open_shared): New function. Generic shared memory open
- used by console and cygwin shared memory.
- * shared.h: Define new stuff used by above.
-
-Wed Mar 31 01:46:23 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h (fhandler_tty): Set tc = ttyp.
- * fhandler_tty.cc (fhandler_tty_master::init): Ditto.
- (fhandler_tty_common::dup): Ditto.
- * tty.cc (tty::common_init): Ditto.
-
-Wed Mar 31 01:43:06 1999 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (mount_info::conv_to_win32_path): Reorganize to
- correctly handle //x syntax.
-
-Tue Mar 30 14:42:05 1999 Christopher Faylor <cgf@cygnus.com>
-
- * strace.cc (strace_vsprintf): Fix incorrect buffer reference.
-
-Mon Mar 29 22:46:16 1999 Christopher Faylor <cgf@cygnus.com>
-
- * debug.cc (__lock): Return value for gcc bug workaround.
- (__unlock): Ditto.
- * fhandler_tty.cc (fhandler_tty_master::init): Remove extraneous
- console initialization. Set termios to sensical values before
- initializing the console.
- (fhandler_tty_slave): Add some debugging output.
- * strace.cc: Conditionalize stuff not required by STRACE_HHMMSS.
- (strace_vsprintf): Remove dependency on time() for STRACE_HHMMSS.
-
-Mon Mar 29 10:50:00 Corinna Vinschen <corinna.vinschen@cityweb.de>
-
- * utils/passwd.c (GetPW): Correct cast in call to `NetUserGetInfo'.
-
-Sun Mar 28 16:54:57 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h: Remove tty_stuff field from fhandler_console
- class. Use global instead to allow all console opens to
- use same settings.
- * fhandler_console.cc: Add new global.
- (fhandler_console::tcgetattr): Use new global for initialization.
- (fhandler_console::de_linearize): Ditto.
- * fhandler_termios.cc (fhandler_termios::fhandler_termios): Don't
- reinitialize an already initialized termios. Do not honor
- CYGWIN=binmode for console output. It's too confusing.
- * shared.h: Add `initialized' field to tty_min.
-
-Sun Mar 28 01:55:32 1999 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (path_prefix_p_): Add defensive code.
- (slash_drive_prefix_p): Use macro to detect whether a character
- is a path separator.
- (mount_info::conv_to_win32_path): Rewrite to correctly handle
- relative paths.
- * strace.cc (strace_printf): Remove extraneous save of LastError.
- * winsup.h (per_thread): Return TlsSetValue value. This seems
- to work around a g++ bug.
-
-Thu Mar 25 13:00:00 Corinna Vinschen <corinna.vinschen@cityweb.de>
-
- * fhandler_raw.cc (fhandler_dev_raw::dup): New method.
- * fhandler_tape.cc (fhandler_dev_tape::dup(): Ditto.
- * fhandler.h: Added prototypes for the formentioned methods.
-
-Wed Mar 24 23:00:00 Corinna Vinschen <corinna.vinschen@cityweb.de>
-
- * fhandler_raw.cc (fhandler_dev_raw::linearize):
- Only calling base class implementation now.
- * fhandler_raw.cc (fhandler_dev_raw::de_linearize):
- Only calling base class implementation and allocating devbuf now.
- * fhandler_tape.cc (fhandler_dev_tape::linearize): Erased.
- * fhandler_tape.cc (fhandler_dev_tape::de_linearize): Erased.
- * fhandler_tape.cc (fhandler_dev_tape::fhandler_dev_tape):
- Additional call to `set_cb()'.
- * fhandler_floppy.cc (fhandler_dev_floppy::fhandler_dev_floppy):
- Ditto.
- * fhandler.h: Erased prototypes for linearize and de_linearize
- methods of class fhandler_dev_tape.
-
-Thu Mar 25 14:05:57 1999 Christopher Faylor <cgf@cygnus.com>
-
- * signal.cc (pause): Make sure that signal has been dispatched
- prior to pause returning.
-
-Wed Mar 24 20:04:21 1999 Christopher Faylor <cgf@cygnus.com>
-
- Change get_input_handle to get_io_handle throughout.
- Change output_handle_ to output_handle throughout.
- Use sys/termios.h only where needed.
- * Makefile.in: Add new object.
- * fhandler.cc (fhandler_base::puts_readahead): New function.
- Adds a string to the read ahead buffer.
- (fhandler_base::put_readahead): New function. Adds a character
- to the read ahead buffer.
- (fhandler_base::get_readahead): New function. Gets a character
- from the read ahead buffer.
- (fhandler_base::peek_readahead): New function. Returns character
- at beginning or end of read ahead buffer.
- (fhandler_base::set_readahead_valid): Augmented from fhandler.h.
- (fhandler_base::eat_readahead): Eat a character from the read
- ahead buffer.
- (fhandler_base::de_linearize): Reset read ahead info.
- (fhandler_base::read): Honor new read ahead mechanism.
- (fhandler_base::fhandler_base): Don't set binmode to default
- if it has already been explicitly set.
- * fhandler.h: Add *BINSET flags to track whether the binary
- mode has been turned on or off explicitly.
- (fhandler_base): Add elements for new read ahead method. Remove
- old `readahead_'.
- (fhandler_termios): New base class.
- (fhandler_console): Use fhandler_termios base class.
- Add new de_linearize method.
- (fhandler_tty_common): Rewrite to use fhandler_termios base class.
- (fhandler_pty_master): Ditto.
- (fhandler_tty_master): Ditto.
- * fhandler_console (fhandler_console::read): Rewrite to use functions
- from fhandler_termios and read ahead for line editing.
- (fhandler_console::read1): Remove.
- (fhandler_console::open): Interruptible I/O is now handled in the
- read function. Mark this.
- (fhandler_console::output_tcsetattr): Use ONLRET to control
- binary behavior since it is more closely analgous.
- (fhandler_console::input_tcsetattr): Don't set console flags if
- there is no change or Windows 95 will eat input.
- (fhandler_console::tcsetattr): Use ONLRET to control binary behavior
- since it is more closely analgous.
- (fhandler_console::fhandler_console): Accommodate fhandler_termios
- base class.
- (fhandler_console::init): Ditto.
- (fhandler_console::igncr_enabled): Ditto.
- (fhandler_console::char_command): Use new read ahead method.
- (fhandler_console::de_linearize): New function.
- * fhandler_serial.cc: Need additional include.
- * fhandler_tty.cc (fhandler_tty_master::fhandler_tty_master):
- Accommodate fhandler_termios base class.
- (fhandler_tty_master::init): Ditto.
- (fhandler_tty_master::accept_input): New function. Sends
- (possibly line-edited) input to slave.
- (process_input): Use line editing capabilities of fhandler_termios
- base class when processing input.
- (fhandler_tty_slave::open): Accommodate fhandler_termios base class.
- (fhandler_tty_slave::tcgetattr): Ditto.
- (fhandler_tty_slave::ioctl): Ditto.
- (fhandler_pty_master::fhandler_pty_master): Ditto.
- (fhandler_pty_master::read): Ditto.
- (fhandler_tty_slave::dup): Be more paranoid about setting output
- handle in case of error.
- * fhandler_tty.h: Accommodate new tty_min base class in tty class.
- * hinfo.cc (hinfo::build_fhandler): Send tty 'unit' to constructor.
- * select.cc (peek_console): Send resize event to window regardless
- of tty setting. Eliminate ReadFile kludge.
- * shared.h (tty_min): Rename termios field to avoid conflict.
- * tty.cc (create_tty_master): Send tty number to build_fhandler.
- (tty::common_init): Remove termios initialization. It's handled
- via fhandler_termios, now.
- * fhandler_termios: New file. Contains methods for dealing with
- fhandler_termios class.
-
-Wed Mar 24 19:22:04 1999 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (call_handler): Reorder to work around
- gcc bug.
-
-Sun Mar 21 21:26:43 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_serial.cc (fhandler_serial::raw_read): Protect
- against uninitialized variable. Output debug info if
- ClearCommError fails. Clear overlapped I/O on error or
- signal.
- (fhandler_serial::tcflow): Output debug info at start of
- routine.
- (fhandler_serial::tcsetattr): Add more debugging output.
- Avoid re-setting parameters if there has been no change.
- Setting parameters via SetCommState seems to cause loss of
- input on Windows 9[58].
-
-Wed Mar 17 12:56:25 1999 Geoffrey Noer <noer@cygnus.com>
-
- * include/winbase.h: Fix AllocateAndInitializeSid proto.
-
-Tue Mar 16 21:55:12 1999 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (handle_exceptions): Always wait for sig_send
- to exit or races can result.
-
-Tue Mar 16 13:04:34 1999 Geoffrey Noer <noer@cygnus.com>
-
- * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 11.
-
-Tue Mar 16 15:44:10 1999 Christopher Faylor <cgf@cygnus.com>
-
- * cygwin.din: Export telldir/seekdir.
-
-Tue Mar 16 13:50:51 1999 Corinna Vinschen <corinna.vinschen@cityweb.de>
-
- * dir.cc: Change unused struct member __d_find_first_called to
- __d_position for use in new functions.
- (telldir): New function. Returns current position in DIR stream.
- (seekdir): New function. Seeks to new position in DIR stream.
-
-Mon Mar 15 19:17:23 1999 Geoffrey Noer <noer@cygnus.com>
-
- * sysdef/comctl32.def: Add InitCommonControlsEx.
-
-Mon Mar 15 19:45:10 1999 Christopher Faylor <cgf@cygnus.com>
-
- * dir.cc (mkdir): Remove final slash from a directory if
- appropriate or windwows won't create the directory.
- * errno.cc: Change text for EAGAIN to something a little
- more sensical.
- * exceptions.cc (call_handler): Add a debug message.
- * fhandler.cc (fhandler_base::open): Don't attempt to set
- the position of a com device.
- * fhandler_serial.cc (fhandler_serial::raw_read): Reset
- overlapped event if not armed. Don't attempt to find out
- if characters are available if vmin_.
- (fhandler_serial::raw_write): Clear pending I/O when
- necessary.
- (fhandler_serial::open): Set comm state to current rather
- than zeroing.
- (fhandler_serial::tcflush): Don't use "queue" as a flag.
- TCI* defines are not bit masks.
- * select.cc (peek_serial): Add debugging output.
- * sigproc.cc (wait_sig): Minor cleanup.
- * path.cc (nofinalslash): Make global.
- * winsup.h: Ditto.
-
-Mon Mar 15 16:31:29 1999 Geoffrey Noer <noer@cygnus.com>
-
- * include/winnt.h: Add RID defs/protos from MSDN docs.
- (SECURITY_*_RID, DOMAIN_*_RID*, etc.)
- * include/richedit.h: Add missing SCF_* defines.
- * include/commctrl.h: Add missing PBM_ defines, PBRANGE struct.
-
-Mon Mar 15 12:54:48 1999 Geoffrey Noer <noer@cygnus.com>
-
- * Makefile.in: Don't install include/Windows32 since it doesn't
- exist any more.
- * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 10.
-
-1999-03-12 DJ Delorie <dj@cygnus.com>
-
- * net.cc (gethostbyname): support a.b.c.d notation internally,
- in case there's no DNS at least partial support is there.
-
-Thu Mar 11 21:27:41 1999 Jeff Johnston <jjohnstn@cygnus.com>
-
- * cygwin.din: Added references to new fast-math routines.
-
-Wed Mar 10 19:22:46 1999 Geoffrey Noer <noer@cygnus.com>
-
- * include/commdlg.h: Add missing PageSetupDlg defines.
-
-Tue Mar 9 14:28:14 1999 Geoffrey Noer <noer@cygnus.com>
-
- * include/*.h: Switch Win32 API header file set to the one written
- by Anders Norlander <anorland@hem2.passagen.se>. Headers now
- fit the standard Win32 API header layout and are more complete.
- These correspond to Anders' headers, version 0.1.5. Please read
- sysdef/README for more information.
- * include/Windows32/*.h: Delete in favor of above definitions.
-
- Changes to support the above:
- * fhandler_console.cc (fhandler_console::char_command): Add newly
- needed cast to DWORD *.
- * fhandler_serial.cc (fhandler_serial::raw_read): Make n, minchars
- DWORDs.
- * fhandler_tty.cc: Include limits.h.
- (fhandler_pty_master::doecho): Second arg is now DWORD.
- (fhandler_pty_master::process_input_to_sl): Make n, written DWORD.
- (fhandler_pty_master::process_slave_outpu): Make n DWORD.
- (fhandler_tty_slave::close): Make towrite, n DWORDs.
- (fhandler_tty_slave::write): Make n DWORD.
- * fhandler.h: Adjust fhandler_pty_master::doecho proto.
- * hinfo.cc: Include file reordering.
- * malloc.cc: Ditto.
- * net.cc: Ditto.
- * fhandler_tape.cc (get_ll): Need to reference .u in
- LARGE_INTEGER usages.
- * ntea.cc: Ditto.
- * pinfo.cc: Include limits.h.
- * spawn.cc: Ditto.
- * uinfo.cc: Ditto.
- * uname.cc (uname): sysinfo struct now has anon union.
- Adjust sprintf for dwProcessorType being a long now.
- * syscalls.cc: Include limits.h and lmcons.h. Throughout,
- reference .u in LARGE_INTEGER usages.
- (logout): Make rd a DWORD.
-
- * utils/mkgroup.c: Always include lmaccess.h and lmapibuf.h.
- Include stdio.h.
- (enum_groups): Adjust for longs in fprintfs.
- (main): Ditto.
- * utils/mkpasswd.c: Include lmaccess.h and lmapibuf.h.
- (enum_users): Adjust for longs in fprintfs.
- (main): Ditto.
- (enum_local_groups): Ditto.
- * utils/passwd.c: Remove many Win32 API defines now in new
- Win32 headers. Include lmaccess.h, lmerr.h, lmcons.h,
- lmapibuf.h.
- (PrintPW): Adjust for longs in fprintfs.
-
-Wed Mar 3 21:14:45 1999 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (environ_init): Fix off-by-one error in initial
- environment allocation.
- * fhandler_serial.cc (fhandler_serial::tcflush): Use different
- method for flushing since serial handles are now opened for
- overlapped I/O.
- * select.cc (cygwin_select): Make degenerate case interruptible.
- * sigproc.cc (proc_exists): Recognize all kinds of myself pointers
- as "existing".
-
-Tue Feb 16 23:00:48 1999 Christopher Faylor <cgf@cygnus.com>
-
- * include/Windows32/Functions.h: Correct two #ifndefs that were
- switched.
-
-Mon Feb 15 22:41:54 1999 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (spawn_guts): Fix incorrect arg length when
- constructing new arguments for #!.
-
-Fri Feb 12 13:25:50 1999 Drew Moseley <dmoseley@cygnus.com>
-
- * Makefile.in (install-info): Test for file existence before installing.
-
-Fri Feb 12 13:17:49 1999 Corinna Vinschen <corinna.vinschen@cityweb.de>
-
- * fhandler.cc (fhandler_disk_file::fstat): Handles directories,
- returns unique i-node number.
- * syscalls.cc (stat_worker): On WinNT, stat_worker calls
- fhandler_disk_file::fstat for directories, too.
-
-1999-02-10 DJ Delorie <dj@cygnus.com>
-
- * doc/doctool.c (scan_directory): check for opendir failing,
- add closedir.
-
-Tue Feb 9 13:02:25 1999 Geoffrey Noer <noer@cygnus.com>
-
- * utils/mount.cc: Add fixme.
- * doc/doctool.c: Correct typo in comment.
-
-Mon Feb 8 17:29:58 1999 Christopher Faylor <cgf@cygnus.com>
-
- * include/Windows32/UnicodeFunctions.h: Fix incorrect use of
- BOOL -> WINBOOL.
- * Windows32/ASCIIFunctions.h: Ditto.
-
-Fri Feb 5 09:38:25 1999 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (mount_info::add_item): Ensure that drive names
- are added using X: notation.
-
-Thu Feb 4 00:28:58 1999 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (path_prefix_p_): Recognize ':' as a path separator.
- (mount_info::conv_to_posix_path): Detect case where a '/' has
- to be added to a path being constructed.
- (realpath): Ensure that the full path name is returned.
-
-Wed Feb 3 22:57:42 1999 Christopher Faylor <cgf@cygnus.com>
-
- * shared.h (mount_info): Add two separate arrays to track
- reverse sorting of win32/posix paths.
- * path.cc (sort_by_posix_name): New function. Sorts by
- posix path.
- (sort_by_native_name): Rename from sort_by_name.
- (mount_info::conv_to_win32_path): Use native sort order
- when iterating through mount table.
- (mount_info::binary_win32_path_p): Ditto.
- (mount_info::getmntent): Ditto.
- (mount_info::conv_to_posix_path): Use posix sort order
- when iterating through mount table.
- (sort): Use two arrays to track sorting of mount table.
- (mount_info::add_item): Simplify slightly.
-
-Wed Feb 3 15:17:54 1999 Christopher Faylor <cgf@cygnus.com>
-
- * cygwin.din: Remove DATA attribute which was erroneously
- added to __errno.
-
-Tue Feb 2 23:10:18 1999 Geoffrey Noer <noer@cygnus.com>
-
- * path.cc: Fix comment regarding UNC paths in mount table.
- (mount_info::conv_to_win32_path): Add back code to handle
- //<drive> paths for now. The plan is still to remove it again at
- a later date.
- (mount_info::slash_drive_to_win32_path): New. Convert a //<drive>
- path to a Win32 path. Bring back from among the recently departed
- path functions.
- * shared.h: Add mount_info proto for slash_drive_to_win32_path.
-
-Tue Feb 2 22:52:43 1999 Geoffrey Noer <noer@cygnus.com>
-
- * include/lmaccess.h: Add stub.
- * include/shlobj.h: Add stub.
-
-Tue Feb 2 22:34:06 1999 Christopher Faylor <cgf@cygnus.com>
-
- * shared.h: Change magic number associated with fork/exec
- information as a temporary measure to eliminate strange
- core dumps with multiple versions of cygwin1.dll.
-
-1999-02-02 Brendan Kehoe <brendan@cygnus.com>
-
- * Makefile.in (readme.txt): Add missing -I$(srcdir)/doc.
-
-Tue Feb 2 01:10:31 1999 Geoffrey Noer <noer@cygnus.com>
-
- * sysdef/*: Replace all files with new ones by Anders
- Norlander <anorland@hem2.passagen.se>. Please read sysdef/README
- for more information.
-
-Mon Feb 1 14:55:11 1999 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (sort_by_name): Sort based on length of native_path
- to ensure maximal match when converting from native -> UNIX.
- * cygwin.din: Make more data variables DATA.
-
-Mon Feb 1 13:31:43 1999 Geoffrey Noer <noer@cygnus.com>
-
- * fhandler_tape.cc: Change all fhandler_tape private functions
- to be named foo_bar_baz-style instead of FooBarBaz. Add some
- parens around logical ors/ands for clarity. Respace.
- * fhandler.h: Change protos here in light of above.
-
-Thu Jan 28 11:00:00 Corinna Vinschen <corinna.vinschen@cityweb.de>
-
- * errno.cc: Support for Windows errors ERROR_CRC and ERROR_NO_READY
- and for error ENOMEDIUM.
-
-Wed Jan 27 01:05:39 1999 Christopher Faylor <cgf@cygnus.com>
-
- * dir.cc (rmdir): Correct errno setting when attempting to rmdir
- a non-directory.
-
-Tue Jan 26 17:36:12 1999 Geoffrey Noer <noer@cygnus.com>
-
- * registry.cc (reg_key::build_reg): Add FIXME.
-
-Tue Jan 26 01:30:48 1999 Geoffrey Noer <noer@cygnus.com>
-
- * path.cc (mount_info::from_registry): Import old v1 mounts
- only if current mount layout doesn't exist yet in both user
- and system areas (when had_to_create_mount_areas == 2).
- (mount_info::import_v1_mounts): New, was upgrade_v1_mounts.
- (mount_info::from_v1_registry): Add missing comma in reg_key
- creation call.
- (mount_info::init): Init had_to_create_mount_areas to zero.
- * external.cc (cygwin_internal): Fix reference to
- upgrade_v1_mounts.
- * shared.h: Change upgrade_v1_mounts proto to import_v1_mounts.
- Add new had_to_create_mount_areas variable in mount_info class.
- * registry.cc (reg_key::build_reg): Increment
- had_to_create_mount_areas whenever we create a new mount area.
-
- * include/sys/mount.h: Don't define MOUNT_EXEC until we actually
- implement this functionality.
-
- * utils/mount.cc (do_mount): Print warning messages after the
- actual mount attempt so we don't see warnings when mount fails.
- (usage): Change name of --upgrade-old-mounts flag to
- --import-old-mounts.
- (main): Ditto.
-
-Mon Jan 25 23:56:50 1999 Geoffrey Noer <noer@cygnus.com>
-
- * errno.cc (seterrno_from_win_error): New. Given a Windows
- error code, set errno accordingly.
- (seterrno): Just call seterrno_from_win_error with the
- error code returned by a call to GetLastError.
- * winsup.h: Define __seterrno_from_win_error.
- * path.cc: Clean up more function description comments.
- (mount_info::add_reg_mount): Don't need res, just return the
- right values.
- (del_reg_mount): Return int, not void. If we're deleting a
- system mount, set errno to EACCES and return -1 if we don't
- have a valid key handle. If mount delete fails, set errno
- accordingly and return -1. Otherwise, return zero for success.
- (cygwin_umount): Delete mount from registry first, only remove
- from internal table if successful.
- * shared.h: Make del_reg_mount proto return int.
-
-Mon Jan 25 22:40:15 1999 Geoffrey Noer <noer@cygnus.com>
-
- * path.cc (mount_info::mount_slash): Add mount to registry
- first, only add to internal table if successful.
- (mount_info::conv_to_posix_path): Ditto.
- (mount): Ditto.
- (mount_info::add_reg_mount): Return int, not void. If we're
- writing a system mount, first check if we have a valid key handle.
- If we don't, set errno to EACCES and return -1. Otherwise return
- zero for success.
- * shared.h: Make add_reg_mount proto return int.
-
-Mon Jan 25 20:40:26 1999 Geoffrey Noer <noer@cygnus.com>
-
- * path.cc (mount_info::init): Don't read automount info here.
- (mount_info::from_registry): Read it here instead. Also, read
- system registry info in KEY_READ mode.
- (mount_info::read_mounts): Read mount info with KEY_READ access
- permissions.
-
-Mon Jan 25 19:12:31 1999 Geoffrey Noer <noer@cygnus.com>
-
- * path.cc: Improve several function description comments.
- (mount_info::init): Read automount information from the
- registry before potentially automounting slash.
- (mount_info::conv_to_posix_path): Create automount with
- automount_flags flags.
- (mount): Now flags is more than just a toggle so we
- must check it in a different manner. And simply check
- MOUNT_AUTO as the indicator. If we want to change the
- automount_prefix, also change automount_flags as appropriate.
- Fix args to syscall_printf.
- (write_automount_info_to_registry): New. Was
- write_automount_prefix_to_registry.
- (read_automount_info_from_registry): New. Was
- read_automount_prefix_from_registry.
- * shared.h: Adjust protos for function renames just mentioned.
- * include/sys/mount.h: Delete MOUNT_CHANGE_AUTOMOUNT_PREFIX
- since we don't really need it.
- * utils.cc (mount): Pass MOUNT_AUTO as indicator of desire to
- change automount prefix.
- (show_mounts): Change spacing so there's room for "system,auto"
- in Type column.
-
-Mon Jan 25 13:17:40 1999 Geoffrey Noer <noer@cygnus.com>
-
- * path.cc: Change all references from "automount root" to
- "automount prefix", avoiding potential nomenclature confusion
- with the root of the file system.
- (read_automount_prefix_from_registry): New. Was
- read_automount_root_from_registry.
- (read_automount_prefix_from_registry): New. Was
- read_automount_root_from_registry. Also read the default
- flags for automounts from registry at the same time.
- (write_automount_prefix_to_registry): New. Was
- write_automount_root_to_registry. Also set automount flags
- in registry using new auto_flags arg.
- (mount): Add flags arg to write_automount_prefix_to_registry call.
- * shared.h: Add automount_flags variable to mount_info class.
- Adjust protos for function renames listed above.
-
- * include/sys/mount.h: Comment out MOUNT_MIXED and MOUNT_SILENT
- whose values could be reused now that we're using a new mount
- layout. Change MOUNT_CHANGE_AUTOROOT to
- MOUNT_CHANGE_AUTOMOUNT_PREFIX.
-
- * utils/mount.cc (change_automount_prefix): New. Was
- change_automount_root. Add new flags argument so it's possible
- to change the default automount flags.
- (main): Option name change from --change-automount-root to
- --change-automount-prefix.
- (usage): Update in light of option changes.
- * utils/umount.cc (remove_all_automounts): Also need to check
- for mnt_type looking like "system,auto" now that it's possible
- for automounts to be located in the system registry.
-
-Mon Jan 25 08:59:04 1999 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (linebuf::add): Ensure that there is always
- enough space for line being added. Always null terminate.
- (linebuf::prepend): Ditto.
-
-Sat Jan 23 01:30:16 1999 Geoffrey Noer <noer@cygnus.com>
-
- Make mount.exe able to upgrade mounts:
- * external.cc: Fix file description.
- (cygwin_internal): Handle CW_READ_V1_MOUNT_TABLES case, in
- which case call upgrade_v1_mounts to upgrade old registry
- area mounts.
- * external.h: Add CW_READ_V1_MOUNT_TABLES to enum.
- * shared.h: Make upgrade_v1_mounts public.
-
- * utils/mount.cc: Include winsup.h, external.h, undef errno since
- it's defined by winsup.h.
- (usage): Add --upgrade-old-mounts option to usage info.
- (main): Handle --upgrade-old-mounts flag by calling
- cygwin_internal with the right constant.
-
-Sat Jan 23 00:40:17 1999 Geoffrey Noer <noer@cygnus.com>
-
- First pass at mount table backwards compatibility with v1
- mounts:
- * path.cc (mount_info::from_registry): For now, upgrade from
- old v1 mount registry area if nmounts==0 after reading new mount
- areas.
- (mount_info::read_v1_mounts): New function. Given a regkey, read
- the mounts in the old v1 registry layout corresponding to the key.
- A "which" arg tells us which registry we're reading so that we
- can include MOUNT_SYSTEM when reading old system mounts.
- (mount_info::from_v1_registry): New function. Retrieve old v1
- mount table area mounts.
- (mount_info::upgrade_v1_mounts): New function. Retrieve old
- v1 mounts, add them to the current registry mount location.
- (mount_info::to_registry): New function. For every mount in
- the internal mount table, add it to the correct registry.
- * shared.h: Add protos for new mount_info functions --
- from_v1_registry, read_v1_mounts, upgrade_v1_mounts, to_registry.
- Don't need class name in protos for
- build_automount_mountpoint_path, write_automount_root_to_registry,
- and read_automount_root_from_registry.
-
-Fri Jan 22 22:45:07 1999 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (spawn_guts): Arg 2 missing from special case
- command/cmd handling.
-
-Fri Jan 22 22:40:32 1998 Corinna Vinschen <corinna.vinsche@cityweb.de>
-
- * fhandler_raw.cc (fhandler_dev_raw::raw_read): bytes_to_read
- corrected to multiple of 512 bytes instead of multiple to
- devbufsiz. Insert break on ReadFile returned 0 Bytes.
-
-Fri Jan 22 15:50:49 1999 Christopher Faylor <cgf@cygnus.com>
-
- * mkvers.sh: Fix handling of CVS tag output.
- * errno.cc: Mark exported data as __declspec(dllexport).
- * times.cc: Ditto.
- * fhandler.cc (fhandler_base::open): Yet another stab
- at correcting handling of binmode/textmode ramifications.
- * path.cc (hash_path_name): Make /. == '' for purposes
- of generating a hash.
-
-Fri Jan 22 11:45:28 1999 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (slash_unc_prefix_p): Generalize to allow
- either type of slash.
- (mount_info::add_item): Don't disallow UNC specs in
- the mount table.
- * utils/Makefile.in: Always use current stub library.
-
-Fri Jan 22 08:52:36 1999 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (regopt): Use correct registry key for Program
- Options given new mount layout.
- * cygwin.din: export __mb_cur_max from newlib.
-
-Thu Jan 21 16:52:20 1999 Geoffrey Noer <noer@cygnus.com>
-
- * path.cc (cygwin_split_path): Adjust two FIXMEs.
- (mount_info::write_automount_root_to_registry): Return int,
- 0 on success, -1 if path is problematic.
- (mount): Check return of write_automount_root_to_registry
- and act appropriately. Do syscall_printf when adjusting automount
- as well as regular mount.
- * shared.h: mount_info::write_automount_root_to_registry now
- returns an int.
- * utils/mount.cc (main): don't sanity-check automount path
- here, instead let the DLL take care of that.
-
-Thu Jan 21 17:12:26 1999 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (spawn_guts): Rewrite argument handling for
- cleaner, one-pass operation.
- (linebuf::add): New method for adding arguments to end
- of the argument list.
- (linebuf::prepend): New method for pushing arguments on
- the front of the argument list.
-
-Wed Jan 20 19:06:30 1999 Geoffrey Noer <noer@cygnus.com>
-
- * path.cc (mount_info::mount_slash): only call add_reg_mount if
- add_item succeeded.
- (mount_info::add_item): Fail if native path doesn't start with
- <drive letter>: or if posix path doesn't start with a slash.
-
-Wed Jan 20 19:06:30 1999 Geoffrey Noer <noer@cygnus.com>
-
- * fhandler_raw.cc: Correct copyright date, reformat.
- * fhandler_floppy.cc: Ditto.
- * fhandler_tape.cc: Ditto.
-
-Wed Jan 20 17:54:02 1999 Geoffrey Noer <noer@cygnus.com>
-
- Remove //<drive>/ support. Add support for automounts in
- user registry area.
- * path.cc: Rewrite, reformat docs at top in light of removing
- //<drive>/ support and new automount support. Add more function
- description comments.
- (slash_drive_prefix_p): Remove function.
- (build_slash_drive_prefix): Ditto.
- (slash_drive_to_win32_path): Ditto.
- (mount_info::init): After everything else, read the automount_root
- by calling read_automount_root_from_registry().
- (mount_info::mount_slash): Automount slash with MOUNT_AUTO.
- (mount_info::conv_to_win32_path): Remove //<drive>/ support code.
- (mount_info::build_automount_mountpoint_path): Construct the name
- of an automount POSIX path, given automount_root and the Win32
- path that needs to be automounted.
- (mount_info::conv_to_posix_path): Automount missing drive letter
- and call conv_to_posix_path again if path isn't covered by the
- mount table but starts with "<letter>:".
- (mount_info::read_automount_root_from_registry): New function.
- Read in the value of automount_root from the current_user
- registry mount area. If there isn't one, use default of
- "/cygdrive" and write that to the registry by calling
- write_automount_root_to_registry().
- (write_automount_root_to_registry): Write a value of
- automount_root to the user registry area.
- (mount_info::del_item): Add new flags arg to specify which
- registry to delete the mount from.
- (mount_info::del_reg_mount): Ditto.
- (mount_item::getmntent): Use mount_info mnt_foo strings to store
- strings passed back in the mntent struct. Otherwise if you
- delete a mount item while using getmntent, the pointer may
- change on the user. Add ",auto" to mnt_type if MOUNT_AUTO flag is
- set.
- (mount): Add support to set auto_root to path if flags is set
- to the special MOUNT_CHANGE_AUTOROOT flag otherwise do the normal
- thing.
- (umount): Call cygwin_umount with flags value of 0.
- (cygwin_umount): New exported function. Same as umount but
- takes an additional flag argument that specifies which registry
- area from which umount should remove the mount point.
- * cygwin.din: Export the cygwin_umount call.
- * shared.h (mount_info): Add public automount_root string.
- Add public proto for write_automount_root_to_registry().
- Add private protos for build_automount_mountpoint_path() and
- read_automount_root_from_registry(). Add flags arg to del_item
- and del_reg_mount protos. Add strings used by getmntent et al
- including mnt_type, mnt_opts, mnt_fsname, mnt_dir. (Can't just
- pass back pointers to mount paths because they may change as
- a result of a umount call.
-
- * include/sys/mount.h: Add new MOUNT_AUTO and
- MOUNT_CHANGE_AUTOROOT flags. Add proto for cygwin_umount
- function.
- * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 9.
-
- * utils/mount.cc: Change missing_dir_warning flag to force
- and init to FALSE instead of TRUE. Throughout swap names and
- setting as appropriate. Include errno.h.
- (usage): Remove info about --reset. Add info for new
- --change-automount-root option.
- (main): Don't check the --reset flag. Call change_automount_root
- if invoked with --change-automount-root. Only call do_mount
- if !mount_already_exists unless force flag is TRUE. Otherwise
- fail.
- (mount_already_exists): New helper function. Returns 1
- if the mount point of the same registry location is already
- mounted.
- (reset_mounts): Remove function.
- (change_automount_root): New function that changes the
- automount root in the registry via Cygwin by passing the new
- path to mount() with the special MOUNT_CHANGE_AUTOROOT flag.
- * utils/umount.cc: Add progname, set to argv[0]. Include string.h.
- (usage): New function to print out usage info.
- (main): Loop through argcs. Handle new flags to remove all mounts
- of a specific type including --remove-all-mounts,
- --remove-user-mounts, --remove-system-mounts, and
- --remove-auto-mounts. New flag to specify removing a system
- mount. Call cygwin_umount instead of umount, providing flags
- as appropriate.
- (remove_all_mounts): New function. Remove all mounts in
- both tables.
- (remove_all_automounts): Remove all mounts marked auto.
- (remove_all_user_mounts): Remove all user mounts, including auto
- mounts.
- (remove_all_system_mounts): Remove all system mounts.
-
- * registry.cc (reg_key::get_string): Fix description comment.
- * strace.cc: Minor reformatting.
-
-Wed Jan 20 17:49:20 1999 DJ Delorie <dj@cygnus.com>
-
- * fhandler.cc (raw_write): Make sure that a disk full error
- is properly signalled.
- (fhandler_base::open): Only tapes are read/write, cd-roms may be
- read-only (from Corinna).
-
-Wed Jan 20 10:46:48 Corinna Vinschen <corinna.vinschen@cityweb.de>
-
- [applied by DJ Delorie <dj@cygnus.com>]
-
- * fhandler_raw.cc (fhandler_dev_raw::writebuf): Writes only
- as much bytes as needed, instead of full buffer size.
-
- * fhandler_tape.cc (fhandler_dev_tape::close): Corrected error
- handling in case of error while writing buffer content to dev.
-
- * fhandler_floppy.cc (fhandler_dev_floppy::close): Ditto.
-
- * fhandler_tape.cc (fhandler_dev_tape::writebuf): Delete function
-
- * fhandler_floppy.cc (fhandler_dev_floppy::writebuf): Ditto.
-
- Patch suggested by Ron Parker <rdparker@butlermfg.org>
- * path.cc (mount_info::conv_to_win32_path): Change the
- recognition of UNC devices, to support also paths of type
- `\\.\UNC\'.
-
- * fhandler_tape.cc (fhandler_dev_tape::close): Fixed rewind
- to block 1 instead of block 0 on rewind tapes in case of
- uncaught signal (e.g. Ctrl-C).
-
- * path.cc (get_raw_device_number): New static function,
- checks path for windows raw device.
-
- * path.cc (get_device_number): Change for recognition of
- windows raw device paths by calling `get_raw_device_number()'.
-
- * path.h: Change prototype for `get_device_number()'.
-
- * Makefile.in: Added file 'fhandler_raw.o' to dependencies.
-
- * include/cygwin/rdevio.h: New file to support ioctl commands
- on random access raw devices. At the time only get/set buffersize
- for raw_read/raw_write.
-
- * fhandler.h: Change class hierarchy. 'fhandler_dev_floppy'
- and 'fhandler_dev_tape' are now derived classes of
- 'fhandler_dev_raw', which is derived from 'fhandler_base'.
-
- * fhandler_raw.cc: New file for implementation of class
- 'fhandler_dev_raw' which is now base class for support of
- mass storage raw devices.
-
- * fhandler_dev_tape.cc: Rewritten.
-
- * fhandler_dev_floppy.cc: Rewritten. Now supporting correct
- lseek (seeking only to positions on 512 byte boundaries,
- like supported from WinNT).
-
- * Makefile.in: Added file 'fhandler_floppy.o' to dependencies.
-
- * fhandler_floppy.cc: New file to support raw devices
- including multi volume operations.
-
- * fhandler.cc: Delete 'fhandler_dev_floppy' implementation.
-
- * fhandler.h: Extend class fhandler_dev_floppy.
-
- * fhandler_tape.cc: Rewrite for correct support
- of multi volume operations. Supports Setmarks now.
-
- * fhandler.h: Add private method `clear()' to class
- fhandler_dev_tape.
-
- * Makefile.in: Add file 'fhandler_tape.o' to dependencies.
-
- * path.cc (mount_info::conv_to_win32_path): Change the
- recognition of UNC devices, to support devices, which
- are not partitions, too.
-
- * fhandler.h: Extend struct 'fhandler_dev_tape' for tape support.
- Add method 'fstat' to fhandler_dev_floppy to get S_ISBLK().
-
- * fhandler.cc (fhandler_base::open): In any case 'access_' has to
- be GENERIC_READ | GENERIC_WRITE for tapes, to allow tape control.
- No 'SetFilePointer' for tapes.
-
- * fhandler_tape.cc: New file to support rewind (/dev/stX) and
- norewind (/dev/nstX) tapes. Supports ioctl() calls, described
- in...
-
- * include/sys/mtio.h, include/cygwin/mtio.h: New header files
- for tape support.
-
-Sat Jan 16 21:59:36 1999 Geoffrey Noer <noer@cygnus.com>
-
- * registry.h: Delete; move contents into shared.h except for
- posix_path_p() routine which disappears.
- * {Makefile.in, environ.cc, net.cc, path.cc, registry.cc,
- shared.cc}: No longer include registry.h.
- * dcrt0.cc (dll_crt0_1): don't check posix_path_p()
-
- * include/mntent.h (struct mntent): Drop const from strings.
- * include/sys/mount.h: Change MOUNT_GLOBAL flag that nobody has
- used yet to MOUNT_SYSTEM. Add MOUNT_EXEC flag.
- * include/cygwin/version.h: Bump CYGWIN_VERSION_MOUNT_REGISTRY to
- 2. Change CYGWIN_INFO_CYGWIN_REGISTRY_NAME to "Cygwin".
- Change CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME to "mounts v2".
-
- * registry.cc (reg_key::reg_key): Default key doesn't end in
- "mounts" any more.
- (reg_key::kill): Return error code from RegDeleteKeyA.
- * path.cc: Reformat, reorder functionality, add comments
- throughout.
- (mount_info::init): Automount slash if it's not already mounted.
- (mount_info::mount_slash): New private helper function.
- (mount_info::binary_win32_path_p): Check flags to determine
- if mount is binary or not, not binary_p.
- (mount_info::read_mounts): Remove unneeded access argument. Use
- RegEnumKeyEx to enumerate mount points in current registry
- location where each key name returned is a posix_path mount
- location. Use a subkey reg_key to read the posix_path's
- corresponding native_path and flags.
- (mount_info::from_registry): Access HKEY_LOCAL_MACHINE registry
- with full access privs (which will fail if not administrator).
- Fix registry path used to initialize HKEY_LOCAL_MACHINE reg_key.
- (mount_info::to_registry): Delete function. Replaced by
- add_reg_mount.
- (mount_info::add_reg_mount): New function which adds a specified
- mount point to the registry.
- (mount_info::del_reg_mount): New function which deletes the
- posix_path argument from the highest priority registry table it
- can (first user, than system-wide).
- (sort_by_name): If the two posix_paths are the same, then
- differentiate between them looking at MOUNT_SYSTEM in their flags.
- (mount_info::add_item): Also make sure that neither path is NULL.
- Never claim mount point is busy: replace an existing posix_path
- as long as it came from the same registry location.
- (mount_info::del_item): Also make sure that neither path is NULL.
- (mount_item::getmntent): Use mnt_type field to store user vs.
- system registry location string. Cast all strings to char *.
- Handle flags instead of binary_p. Change names of strings
- returned in mnt_opts field.
- (mount_item::init): Set flags, instead of dealing with binary_p
- and silent_p.
- (mount): Call add_reg_mount instead of to_registry.
- (umount): Call del_reg_mount instead of to_registry.
- (path_conv::path_conv): Remove reference to silent_p.
- * path.h (path_conv): Remove silent_p.
-
- * utils/mount.cc: Add -s to usage (was a commented-out -g).
- Or in MOUNT_SYSTEM if -s flag given. Add similar commented-out
- support for future MOUNT_EXEC flag that will be added with -e.
- (reset_mounts): Automount slash with zero for flags, not
- MOUNT_SILENT which we no longer use for anything.
- * utils/umount.cc: Also print out usage if the first argument
- starts with a dash.
-
-Fri Jan 15 11:27:51 1999 DJ Delorie <dj@cygnus.com>
-
- * strace.cc: add macros to protect against buffer overruns
- (strace_printf): increase buffer from 6000 to 1000 to build devo
- * include/sys/strace.h: allow -DNOSTRACE again
-
-Fri Jan 15 11:27:51 1999 DJ Delorie <dj@cygnus.com>
-
- * dcrt0.cc (alloc_stack): add 16384 to work around Win95 page
- fault during builds
- * fork.cc (fork): try various things to avoid page faults during
- win95 builds.
-
-Fri Jan 15 11:18:23 1999 DJ Delorie <dj@cygnus.com>
-
- * fhandler.cc (raw_write): check for disk full.
-
-Fri Jan 15 11:18:23 1999 DJ Delorie <dj@cygnus.com>
-
- * init.cc (dll_entry): if the DLL is being LoadLibrary'd,
- initialize some things.
- * heap.cc (_sbrk): detect uninitialized heap and initialize
- * dcrt0.cc (user_data): initialize to something useful.
- (do_global_ctors): make global for init.cc
-
-Thu Jan 14 02:16:44 1999 Geoffrey Noer <noer@cygnus.com>
-
- * dll_init.cc: Add missing FIXME in comment.
- * fhandler_console: Ditto.
-
-Thu Jan 14 00:53:25 1999 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (iscmd): New function.
- (spawn_guts): Treat command /c and cmd /c as special
- cases. Don't quote arguments to these programs if
- there are exactly three arguments.
- * dcrt0.cc (dll_crt0_1): Initialize exceptions prior
- to fork to allow forked processes to "dump core".
- * errno.cc (seterrno): No need for this to be extern "C".
- * winsup.h: Ditto.
-
-Wed Jan 13 19:06:08 1999 Geoffrey Noer <noer@cygnus.com>
-
- * registry.cc: Add comments corresponding to various reg_key
- functions, minor reformatting.
- (reg_key::reg_key): Delete already-commented-out function
-
-Wed Jan 13 15:41:34 1999 DJ Delorie <dj@cygnus.com>
-
- * errno.cc (_sys_errlist): Add "extern" to work around new gcc
- restrictions.
-
-Mon Jan 11 14:56:27 1999 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (spawn_guts): Fix problem with #! and relative
- directories.
-
-Mon Jan 11 09:00:29 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_console.cc (fhandler_console::read1): Handle EOF as a
- specific case.
-
-Sun Jan 10 23:44:22 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h: Define __fmode for convenience. Use throughout.
- * environ.cc (parse_options): Use O_TEXT when nobinmode.
- * fhandler.cc (fhandler_base::open): Don't honor __fmode
- when disk file. Default to O_TEXT if no mode is specified.
- (fhandler_base::fhandler_base): Don't honor __fmode when disk
- file. Otherwise default to O_BINARY.
- * pipe.cc (make_pipe): Default to O_BINARY if no mode specified.
-
-Sat Jan 9 20:58:34 1999 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Correct previously messed up patch.
- * thread.h: Add back a needed include.
- * sigproc.cc (sigproc_init): Work around problem with older
- compilers.
- * wait.cc (wait4): Ditto.
- * winsup.h (per_thread_waitq): Ditto.
- * include/Windows32/CommonFunctions.h: Temporary change to
- work around problems with older compilers.
-
-Fri Jan 8 12:53:53 1999 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (parse_options): Add "forkchunk" debug setting.
- Takes a value which is used to limit the size of individual memory
- copies in a fork.
- * fork.cc (fork_copy): Rewrite slightly to allow copying of
- individual chunks of memory rather than all in one gulp.
- Controlled by chunksize global variable.
-
-Thu Jan 7 22:02:18 1999 Christopher Faylor <cgf@cygnus.com>
-
- patch from Corinna Vinschen <corinna.vinschen@cityweb.de>:
- * utils/passwd.c: New file.
- * utils/Makefile.in: Add dependencies for passwd.
- * syscalls.cc (chmod): Change permission checking in case
- of readonly test.
- (stat_dev): Change default permission bits to allow writing
- for all users.
- (chown): Retry LookupAccountName with username set to domain\\username,
- if returned SID-Type is not SidTypeUser.
-
-
-Thu Jan 7 17:50:49 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.cc (fhandler_base::set_name): Fix bug which
- disallowed '%' in a file name.
-
-Thu Jan 7 00:21:41 1999 Geoffrey Noer <noer@cygnus.com>
-
- * path.cc: Add comments.
- * path.h: Correct file description comment.
-
-Tue Jan 5 16:07:15 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_serial.cc (fhandler_serial::raw_read): Be more defensive
- about not calling problematic functions when the overlapped I/O is
- armed. Reset the overlapped event prior to calling read or suffer
- an "operation aborted".
- * select.cc (peek_serial): Ditto.
-
-Mon Jan 4 15:16:22 1999 Geoffrey Noer <noer@cygnus.com>
-
- Eliminate warnings:
- * utils/mount.cc (show_mounts): make format a const char *.
- * utils/ps.cc (main): make literal strings const char *s.
- * utils/cygpath.cc (long_options): cast literal strings to char *s.
- (main):
-
-Sun Jan 3 20:46:12 1999 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (peek_console): Remove #if 0 around NT code workaround.
-
-Sat Jan 2 00:04:01 1999 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Remove include directories made obsolete by
- recent changes to mmap.cc. Also remove libraries that appear
- to be unnecessary for linking.
- * mkvers.sh: Put contents of .snapshot-date, if available, into
- the DLL.
-
-Fri Jan 1 22:44:49 1999 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h (fhandler_serial): Add flag to track state of
- overlapped serial I/O. Add overlapped_setup method for common
- setup of overlapped structure.
- * fhandler_serial.cc (fhandler_serial::overlapped_setup): New
- method. Sets up the overlapped structure for overlapped serial I/O.
- (fhandler_serial::raw_read): Use overlapped_armed flag to avoid
- calling functions which perform overlapped operations if overlapped
- I/O is in already progress. This should only be the case if a
- previous operation was interrupted or select has detected serial I/O.
- (fhandler_serial::open): Use overlapped_setup.
- (fhandler_serial::fixup_after_fork): Ditto.
- (fhandler_serial::de_linearize): Ditto.
- (fhandler_serial::dup): Ditto.
- (fhandler_serial::tcsetattr): Fix typo which caused IGNPAR
- to be ignored.
- * hinfo.cc (hinfo::select_read): Set saw_error to zero explicitly
- to avoid spurious reporting of select errors.
- (hinfo::select_write): Ditto.
- (hinfo::select_except): Ditto.
- * select.cc (peek_serial): Use overlapped_armed to avoid calling
- functions which perform overlapped operations if overlapped I/O
- is already in progress.
diff --git a/winsup/cygwin/ChangeLog-2000 b/winsup/cygwin/ChangeLog-2000
deleted file mode 100644
index 54494e610..000000000
--- a/winsup/cygwin/ChangeLog-2000
+++ /dev/null
@@ -1,4150 +0,0 @@
-Tue Dec 27 1:08:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * cygwin.din: Add symbols for `getrlimit' and `setrlimit'.
- * exceptions.cc (stackdump): Avoid creating stackdump when
- `rlim_core' is 0.
- * resource.cc: New global variable `rlim_core'.
- (getrlimit): New function.
- (setrlimit): Ditto.
- include/cygwin/version.h: Bump minor API version to 32 due to
- adding `getrlimit' and `setrlimit'.
- include/sys/resource.h: Add defines, types and prototypes for
- `getrlimit' and `setrlimit'.
-
-Mon Dec 25 22:18:42 2000 Christopher Faylor <cgf@cygnus.com>
-
- * autoload.h: Make DLL initializers global to avoid inlining.
- * exceptions.cc (interrupt_setup): Reorganize arguments to allow use of
- regparm.
- (interrupt_now): Ditto.
- (interrupt_on_return): Ditto.
- (call_handler): Ditto.
-
-Mon Dec 25 13:36:44 2000 Christopher Faylor <cgf@cygnus.com>
-
- * include/cygwin/version.h: Bump DLL minor version number to 8.
-
-Wed Dec 20 13:37:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * autoload.cc: Add load statement for SetSecurityDescriptorControl.
- * security.cc (alloc_sd): Always set SE_DACL_PROTECTED flag on
- Win2K and higher.
-
-Wed Dec 20 01:02:13 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (reset_signal_arrived): Make global to avoid inlining.
-
-Wed Dec 20 00:57:10 2000 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_serial.cc (fhandler_serial::raw_read): Always find number of
- bytes ready to be read whether overlapped_armed or not.
-
-Tue Dec 19 21:39:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * syscalls.cc (remove): New function, overriding the newlib
- implementation.
-
-Tue Dec 19 16:26:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * environ.cc (struct parse_thing): Add entry for new CYGWIN option
- `smbntsec'.
- * path.cc (path_conv::check): Check path for being a remote path.
- If so and `allow_smbntsec' is set to FALSE, set has_acls to FALSE.
- * security.cc: Add global definition for `allow_smbntsec'.
- * security.h: Add extern declaration for `allow_smbntsec'.
- * fhandler.cc (fhandler_disk_file::open): Eliminate extern declaration
- of `allow_ntsec'.
- * syscalls.cc: Ditto.
-
-Fri Dec 15 18:54:42 2000 Bradley A. Town <townba@pobox.com>
-
- * fhandler_console.cc (read): Add support for xterm-style mouse event
- reporting.
- (fhandler_console::char_command): Honor mouse events.
- (fhandler_console::open): Enable mouse input events.
- (fhandler_console::input_tcsetattr): Ditto.
- * select.cc (peek_console): Add check for mouse events.
-
-Fri Dec 15 17:23:17 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (normalize_posix_path): Calculate path name length overruns
- more dynamically.
- (normalize_win32_path): Ditto.
- * Makefile.in: Avoid scanning the directory twice for *.d files.
-
-Thu Dec 14 23:37:51 2000 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h (fhandler_console): Add additional argument to
- char_command method.
- * fhandler_console.cc (fhandler_console::read): Revert previously
- misapplied patch.
- (fhandler_console::char_command): Add a second argument.
- (fhandler_console::write): Recognize when a '?' is found after a
- <esc>[.
-
-Tue Dec 5 17:06:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (cygwin_rexec): Eliminate superfluous call to
- `set_socket_inheritance'.
- * include/sys/socket.h: Add SUS defines for option values to `shutdown'.
-
-Sun Dec 10 17:19:04 2000 Christopher Faylor <cgf@cygnus.com>
-
- * include/sysexits: New file.
-
-2000-12-09 Egor Duda <deo@logos-m.ru>
-
- * autoload.cc: Autoload CharToOemA.
- * dcrt0.cc (dll_crt0_1): Translate command line to OEM if current
- codepage is OEM.
- * environ.cc: Add new option 'codepage' to CYGWIN environment variable.
- * fhandler_clipboard.cc (fhandler_clipboard::read): Read clipboard in
- OEM mode if current codepage is OEM.
- * fhandler_console.cc (fhandler_console::read): Only translate console
- input if current codepage is ANSI.
- * fhandler_console.cc (fhandler_console::write_normal): Translate
- output data if current codepage is ANSI.
- * pinfo.cc (codepage_init): New function. Setup current codepage from
- CYGWIN environment variable and set codepage for file APIs.
- * security.cc (read_sd): Translate file name to it if current codepage
- is OEM.
- * winsup.h: (sys_wcstombs,sys_mbstowcs): Use current codepage for
- translations between multibyte and widechar string and vice versa.
-
-Sat Dec 9 16:29:45 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (normalize_win32_path): Check for explicit use of two slashes
- at the beginning of a path. These should be treated specially
- regardless of whether they are UNC paths or old-style //a paths. Avoid
- adding cwd to a path if the path already begins with '/'.
-
-Fri Dec 8 22:21:01 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (normalize_win32_path): Reorganize logic to accommodate
- chroot. Always check for MAX_PATH overrun. Avoid adding one too many
- backslashes when src path begins with a slash. From Corinna Vinschen.
- * winsup.h: Force demangling for dll_crt0 for newer compilers.
-
-Thu Dec 7 12:10:00 2000 Edward M. Lee <tailbert@yahoo.com>
-
- * cygwin.din: Declare strtok_r for the import lib. Already in the DLL.
-
-Wed Dec 6 15:39:18 2000 Earnie Boyd <earnie_boyd@yahoo.com>
-
- * include/sys/uio.h (readv): Correct prototype.
- (writev): Ditto.
-
-Tue Dec 5 17:06:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * include/sys/uio.h: Include <sys/cdefs.h>. Use __BEGIN_DECL and
- __END_DECL.
- Add declarations for `readv' and `writev'.
-
-Mon Dec 4 20:49:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * Makefile.in: Change `-nostartfiles' to `-nostdlib' to avoid
- automatic linking with default libraries when linking new-cygwin1.dll.
- Link with libgcc.a and libstdc++.a explicitly.
-
-Sun Dec 3 01:20:25 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (normalize_win32_path): Handle UNC paths better.
- (slash_unc_prefix_p): Allow backslash UNC paths.
-
-Sun Dec 3 00:20:25 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Remove some extra cruft.
-
-Sun Dec 3 00:13:26 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Use CXX to build the DLL.
- * configure.in: Find correct c++ compiler.
- * configure: Regenerate.
- * path.cc (normalize_posix_path): Put correct drive at beginning of \foo style paths.
- (chdir): Don't send non-posix path to cygcwd.set.
-
-Sat Dec 2 22:26:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (get_inet_addr ): Close AF_UNIX socket file after reading.
-
-Wed Nov 29 18:25:53 2000 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * cygheap.cc (chgheap_root::operator =): Check root dir properly.
-
-Thu Nov 29 18:11:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (cygwin_inet_aton): Return nonzero if the address
- is valid, zero if not according to Linux man page.
-
-Mon Nov 27 21:09:50 2000 Kelley Cook <kelley.cook@home.com>
-
- * mmap.cc (munmap): Check that mmap and munmap length match.
-
-Tue Nov 28 18:08:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_disk_file::open): Check for buggy CreateFile
- condition.
- * path.cc (path_conv::check): Get file system type in call to
- GetVolumeInformation to check for file systems with buggy CreateFile.
- * path.h (enum path_types): Add PATH_HASBUGGYOPEN.
- (class path_conv): Add methods `has_buggy_open' and
- `set_has_buggy_open'.
-
-Sun Nov 26 16:26:14 2000 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.cc (is_at_eof): New function.
- (fhandler_base::raw_read): Detect special case where last error ==
- ERROR_NOACCESS but the file is at EOF. Most UNIXes do not consider
- this to be an error.
-
-Sun Nov 26 14:37:29 2000 Christopher Faylor <cgf@cygnus.com>
-
- * include/cygwin/version.h: Bump DLL minor version number to 7.
-
-Sat Nov 25 11:27:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * include/cygwin/version.h: Bump minor API version due to adding
- inet_aton.
-
-Sat Nov 25 11:07:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (cygwin_inet_aton): New function.
- * cygwin.din: Export cygwin_inet_aton as inet_aton.
-
-Sat Nov 25 01:57:42 2000 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * path.cc (mount_info::read_cygdrive_info_from_registry): Read system
- cygdrive prefix with KEY_READ.
- (mount_info::get_cygdrive_info): Ditto.
-
-Wed Nov 22 11:18:02 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: new-temp.a -> new-templib.a
-
-Mon Nov 20 17:04:43 2000 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (spawn_guts): Quoting was still wrong. Keep trying to
- fix it.
-
-Mon Nov 20 14:26:38 2000 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (spawn_guts): YA tweak for dealing with arcane rules of
- quoting in "normal" Microsoft programs.
- * child_info.h: Bump fork magic number.
- * include/sys/mount.h: Add an entry for mixed mode.
-
-Fri Nov 17 12:28:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * path.cc (normalize_posix_path): Special care for root directory
- in case of files beginning with a dot.
-
-Fri Nov 17 12:28:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * syslog.cc (syslog): Add users SID to NT syslog entry.
-
-Thu Nov 16 15:59:58 2000 Bradley A. Town <townba@pobox.com>
-
- * fhandler_console.cc: New member variable `dwBufferSize' for `info'.
- (fillin_info): Set `dwBufferSize' to the size of the console buffer.
- (clear_screen): Use width of console buffer to calculate how many
- spaces to clear.
-
-Thu Nov 16 15:24:45 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Make import library creation 'make -j2' friendly.
-
-Thu Nov 16 10:28:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * uinfo.cc (uinfo_init): Call `cygwin_set_impersonation_token' to
- reset `cygheap->user.token' to INVALID_HANDLE_VALUE.
-
-Thu Nov 16 00:18:15 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (interrupt_setup): Don't set signal mask here or races
- occur with main thread. Set it in sigdelayed instead.
- (sigreturn): Reflect change in stack order of ebp and flags.
- (sigdelayed): Set stack frame correctly. Call set_process_mask here
- with flags for last trapped signal.
- (signal_dispatch): Add newmask.
- * sigproc.cc (wait_sig): Eliminate ill-considered attempt to halt
- looping signal processors.
- * perthread.h (signal_dispatch): Add newmask field.
-
-Wed Nov 15 22:08:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * uinfo.cc (internal_getlogin): Change parameter list to reflect
- that `token' is member of cygheap_user now.
- (uinfo_init): Use modified internal_getlogin.
- * syscalls.cc (seteuid): Ditto.
-
-Wed Nov 15 21:56:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * cygheap.h: Move `token' and `impersonated' from class _pinfo
- to class cygheap_user.
- * pinfo.h: Ditto.
- * fork.cc (fork_child): Change usage of `token' and `impersonated'
- accordingly.
- (fork_parent): Ditto.
- * security.cc (cygwin_set_impersonation_token): Ditto.
- * sigproc.cc (proc_subproc): Ditto.
- * spawn.cc (spawn_guts): Ditto.
- * syscalls.cc (seteuid): Ditto.
- * uinfo.cc (uinfo_init): Ditto.
-
-Wed Nov 15 9:59:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * spawn.cc (spawn_guts): Revert patch to ignore chroot settings
- on creating native Win32 environment.
-
-Wed Nov 15 01:44:37 2000 Christopher Faylor <cgf@cygnus.com>
-
- * fork.cc (slow_pid_reuse): Off-by-one.
-
-Wed Nov 15 01:20:24 2000 Christopher Faylor <cgf@cygnus.com>
-
- Throughout use myself->ppid_handle rather than parent_alive.
- * child_info.h (child_info): Eliminate parent_alive.
- * dcrt0.cc (dll_crt0_1): Call fork_init for debugging pid creation.
- * fork.cc (fork_child): Reflect change to fixup_mmaps_after_fork
- arguments.
- (slow_pid_reuse): New function to grab last 'n' pids to prevent pid
- reuse.
- (fork_parent): Move last_fork_proc into slow_pid_reuse.
- fork_pids debugging. Eliminate unnecessary call to set_child_mmap_ptr.
- (fork_init): New debugging function.
- * mmap.cc (fixup_mmaps_after_fork): Renamed from
- recreate_mmaps_after_fork. Rely on copied data after a fork.
- (set_child_mmap_ptr): Eliminate.
- * pinfo.h (_pinfo): Eliminate parent_alive, mmap_ptr and reflect above
- changes.
- * spawn.cc (spawn_guts): Eliminate vestiges of "old way" of sending new
- hProc to parent process.
-
-Wed Nov 15 0:51:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * cygheap.cc (cygheap_root::cygheap_root): New function.
- (cygheap_root::~cygheap_root): Ditto.
- (cygheap_root::operator=): Ditto.
- (cygheap_user::~cygheap_user): Ditto.
- (cygheap_user::set_name): Ditto.
- (cygheap_user::set_logsrv): Ditto.
- (cygheap_user::set_domain): Ditto.
- (cygheap_user::set_sid): Ditto.
- * cygheap.h (cygheap_root): New class.
- (cygheap_user): Ditto.
- (init_cygheap): Change type of `root' member to cygheap_root.
- Add `user' member.
- * dir.cc (opendir): Use new `cygheap_root' class.
- * dcrt0.cc (dll_crt0_1): Use new `cygheap_user' class.
- * fork.cc (fork_parent): Ditto.
- * grp.cc (getgroups): Ditto.
- * passwd.cc (search_for): Ditto.
- * path.cc: Use new `cygheap_root' class throughout.
- * pinfo.h (_pinfo): Remove `use_psid'. Move `username', `psid',
- `logsrv', `domain', `orig_{uid,gid}' and `real_{uid,gid}' to
- cygheap_user class.
- * security.cc: Use new `cygheap_user' class throughout.
- * shared.cc (sec_user): Ditto.
- * sigproc.cc (proc_subproc): Remove copy statements for user
- related information moved to `cygheap_user' class.
- * spawn.cc (spawn_guts): Invalidate current chroot settings
- when creating Windows environment. Use new `cygheap_user' class.
- * syscalls.cc: Use new `cygheap_user' class throughout.
- * uinfo.cc: Ditto.
- (internal_getlogin): Change parameters to reflect the
- move of user information to cygheap.
-
-Tue Nov 14 17:05:00 2000 Eric Fifer <efifer@dircon.co.uk>
-
- * dir.cc (rewinddir): Always set __d_position = 0, so next
- call to readdir() will restart the directory scan.
-
-Tue Nov 14 00:51:28 2000 Christopher Faylor <cgf@cygnus.com>
-
- * cygheap.h (init_cygheap): New struct holding values that live in the
- Cygwin heap.
- * child_info.h (child_info): Change pointer type of cygheap to
- init_cygheap.
- * cygheap.cc (init_cheap): Point cygheap_max after contents of cygheap.
- Move some stuff into cygheap.h.
- * dir.cc (opendir): Change to use root and rootlen in cygheap rather
- than in myself.
- (mkdir): Change to use umask in cygheap rather than in myself.
- * path.cc: Ditto, throughout.
- * syscalls.cc (_open): Ditto. Change to use umask in cygheap rather
- than in myself.
- (chroot): Change to allocate root dir on the cygwin heap.
- (umask): Change to use umask in cygheap rather than in myself.
- (cygwin_bind): Ditto.
- * sigproc.cc (proc_subproc): Don't copy umask or root stuff as this
- happens automatically now.
- * pinfo.h (_pinfo): Migrate stuff out of here and into init_cheap.
- * dcrt0.cc (dll_crt0_1): Call cygheap_init later in startup for first
- cygwin process.
-
-Sun Nov 12 23:01:35 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (get_device_number): Allow /dev/ttySn to designate a com
- port.
-
-Sat Nov 11 23:55:19 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.h: Add __attribute__ ((regparm(x))) to commonly used functions.
- * pinfo.h: Ditto.
- * sigproc.h: Ditto.
- * sync.h: Ditto.
-
-Fri Nov 10 13:48:44 2000 Bradley A. Town <townba@pobox.com>
-
- * dcrt0.cc: New global variable `ignore_case_with_glob'.
- (dll_crt0_1): Disable case-insensitive globbing before calling `main'.
- * environ.cc (glob_init): New static function to set or clear
- `ignore_case_with_glob'.
- (known): Changed "glob" entry to call `glob_init'.
- * glob.c (match): Use case-insensitive globbing if needed.
-
-Thu Nov 9 14:30:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * dir.cc (readdir): Avoid reading from the beginning when
- readdir is called after a previous call has returned NULL.
-
-Wed Nov 8 21:00:31 2000 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (peek_pipe): Deal with pending newline in pty_master.
-
-Wed Nov 8 15:35:32 2000 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (_addenv): malloc space for setenv if cygwin1.dll is used
- in conjunction with older binaries.
- (environ_init): Ditto.
-
-Wed Nov 8 08:49:27 2000 Jason Tishler <jt@dothill.com>
-
- * external.cc (get_cygdrive_info): New function.
- * external.cc (get_cygdrive_prefixes): Change to use get_cygdrive_info
- but toss the user and system flags.
- * external.cc (cygwin_internal): Add new CW_GET_CYGDRIVE_INFO case.
- * path.cc (mount_info::get_cygdrive_prefixes): Remove method.
- * path.cc (mount_info::get_cygdrive_info): New method. Actually,
- get_cygdrive_info is really an enhanced version of
- get_cygdrive_prefixes renamed to get_cygdrive_info that also gets the
- user and system flags.
- * shared_info.h (get_cygdrive_prefixes): Remove method.
- * shared_info.h (get_cygdrive_info): New method.
- * include/cygwin/version.h: Bump minor API version due to adding
- CW_GET_CYGDRIVE_INFO to cygwin_internal.
- * include/sys/cygwin.h (cygwin_getinfo_types): Add
- CW_GET_CYGDRIVE_INFO.
-
-Tue Nov 7 20:58:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * autoload.cc: Add autoload statement for `WSASetLastError'.
- * net.cc (cygwin_connect): Change error code to WSAEINPROGRESS
- when connect returns WSAEWOULDBLOCK.
-
-Mon Nov 6 15:11:57 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (sigthread::init): Reinstitute sigthread lock as a critical
- section.
- (dll_crt0_1): Move sigthread lock initialization to earlier in startup.
- * exceptions.cc (interrupt_on_return): Remove previous kludgy attempt
- to detect an invalid frame.
- (call_handler): Eliminate inner for loop. Grab signal critical section
- lock where appropriate.
- * sigproc.cc (proc_subproc): Restore uid setting.
- * sigproc.h (sigthread): Reinstitute sigthread lock as a critical
- section.
- (sigframe): Grab the sigthread lock before clearing frame to avoid
- having the signal thread use an invalid frame.
-
-Mon Nov 6 11:11:42 2000 Jason Tishler <jt@dothill.com>
-
- * path.cc (mount_info::read_cygdrive_info_from_registry): Use
- CYGWIN_INFO_CYGDRIVE_PREFIX, CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX, and
- CYGWIN_INFO_CYGDRIVE_FLAGS.
- * path.cc (mount_info::write_cygdrive_info_to_registry): Use
- CYGWIN_INFO_CYGDRIVE_PREFIX and CYGWIN_INFO_CYGDRIVE_FLAGS.
- * path.cc (mount_info::remove_cygdrive_info_from_registry): Ditto.
- * path.cc (mount_info::get_cygdrive_prefixes): Use
- CYGWIN_INFO_CYGDRIVE_PREFIX.
- * include/cygwin/version.h: Add CYGWIN_INFO_CYGDRIVE_FLAGS,
- CYGWIN_INFO_CYGDRIVE_PREFIX, and CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX.
-
-Mon Nov 6 11:10:44 2000 Jason Tishler <jt@dothill.com>
-
- * errno.cc (strerror): Change EAGAIN case to return "Resource
- temporarily unavailable" instead of "No more processes".
-
-Mon Nov 6 01:04:35 2000 Christopher Faylor <cgf@cygnus.com>
-
- * child_info.h (child_info): Add pppid_handle for closing the parent's
- parent handle.
- * dcrt0.cc (_dll_crt0): Close parent's parent handle when spawned or
- forked.
- * debug.cc (add_handle): Correct erroneous reference to handle
- structure when printing warning.
- * exceptions.cc (interrupt_now): Always return 1.
- (interrupt_on_return): Accept a sigthread argument. Check to see if
- this argument has been trashed prior to setting up the stack return.
- (call_handler): Add a loop around attempts to dispatch signals to
- detect case where interrupt_on_return fails.
- (_sigdelayed): Set up a temporary frame pointer prior to calling stuff
- that could trigger an interrupt or the stack walking code will be very
- confused.
- * fork.cc (fork_parent): Move a lot of the setup of the child process
- into proc_subproc.
- * spawn.cc (spawn_guts): Ditto. Use ppid_handle to contact logical
- parent when reparenting execed process.
- * pinfo.h (_pinfo): Remember the logical handle of the parent process.
- * sigproc.cc (proc_subproc): Record most stuff necessary for the _pinfo
- structure that is inferrable from myself when adding children.
- (wait_sig): Always set 'pending_signals' flag when about to kick off
- the signal scanning loop. Reset it only if there are no pending
- signals.
-
-Sun Nov 5 13:46:23 2000 Christopher Faylor <cgf@cygnus.com>
-
- * pinfo (wait_subproc): Son of neverending debug tweaking.
-
-Sun Nov 5 11:45:15 2000 Christopher Faylor <cgf@cygnus.com>
-
- * pinfo (wait_subproc): Neverending debug tweaking.
-
-Sun Nov 5 01:34:51 2000 Christopher Faylor <cgf@cygnus.com>
-
- * pinfo.cc (winpids:add): New method.
- (winpids::enumNT): New method renamed from EnumProcessesNT.
- Use add method to add elements to the lists.
- (winpids::enum9x): New method renamed from EnumProcesses9x.
- Use add method to add elements to the lists.
- (winpids::enum_init): Accept 'winpid' parameter to control whether
- to add all windows pids to the list.
- (winpids::release): New method.
- * pinfo.h (winpids): Reflect above changes.
- * signal.cc (kill_pgrp): Ditto.
- * external.cc (fillout_pinfo): Ditto.
-
-Sat Nov 4 22:07:03 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (handle_sigsuspend): Record frame here for signalling.
- (set_process_mask): Ditto.
-
-Sat Nov 4 14:24:10 2000 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (wait_subproc): Still more debugging cleanup.
-
-Sat Nov 4 00:51:38 2000 Christopher Faylor <cgf@cygnus.com>
-
- * pinfo.cc (EnumProcessesNT): Avoid 0 pids.
- (EnumProcesses9x): Ditto.
- * sigproc.cc (remove_child): Eliminate.
- (proc_subproc): Move remove_child stuff here.
- (wait_subproc): Synchronize with proc_subproc when error occurs. Add
- more debugging info.
- * sigproc.h (procstuff): Add an entry.
- * spawn.cc (spawn_guts): Add sigframe here.
-
-Fri Nov 3 20:07:14 2000 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (wait_subproc): Refine debug output.
-
-Thu Nov 2 23:01:20 2000 Christopher Faylor <cgf@cygnus.com>
-
- * pinfo.cc (pinfo::init): Reverse order of setting status and pid info
- in an execed process to avoid a race.
- * sigproc.cc (wait_subproc): Print more info when a WFSO error occurs.
- * automode.c: New file.
- * syscalls.cc (close_all_files): Streamline slightly.
- * cygheap.cc (ccalloc): Clear *entire* allocated array.
-
-Thu Nov 2 01:58:03 2000 Christopher Faylor <cgf@cygnus.com>
-
- * ntdll.h: Remove IO_COUNTERS definition since it is now in winnt.h.
-
-Thu Nov 2 00:10:23 2000 Christopher Faylor <cgf@cygnus.com>
-
- * pinfo.cc (EnumProcessesNT): New function. Eliminates dependence on
- psapi.h.
- (EnumProcesses9x): Rename from EnumProcessesW95. Change arguments to
- be more useful for cygwin.
- (winpids::init): Accommodate argument changes.
- (enum_init): Ditto.
- * pinfo.h (winpids): Make pidlist dynamically extendable by storing it
- as a pointer and remembering the size.
- * ntdll.h: Add extra definitions needed for EnumProcessesNT. Reformat
- via 'indent'.
-
-Wed Nov 1 21:08:23 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (interruptible): Remove obsolete tests.
- (sigreturn): Construct pseudo-frame-pointer so that signal handler can
- figure out where to put return address when signals are coming in
- quickly.
- * path.cc (cwdstuff::get): Allow length 0 buffer length when buffer
- when NULL.
-
-Tue Oct 31 18:12:56 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.h (has_exec_chars): Standard function for checking for
- executable magic numbers.
- * path.cc (symlink_info::check): Use the above function.
- * fhandler.cc (fhandler_disk_file::open): Ditto.
-
-Tue Oct 31 17:57:52 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (_readlink): Return ENOENT when file does not exist.
-
-Tue Oct 31 23:35:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.h (fhandler_dev_raw): Add method `fixup_after_exec'.
-
-Tue Oct 31 22:39:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.h (fhandler_dev_raw): Add definition for method
- `fixup_after_fork'.
- * fhandler_raw.cc (fhandler_dev_raw::fhandler_dev_raw): Add
- `set_need_fixup_after_fork' call.
- (fhandler_dev_raw::~fhandler_dev_raw): Revert to user space
- allocation.
- (fhandler_dev_raw::open): Ditto.
- (fhandler_dev_raw::dup): Ditto. Reset buffer pointer.
- (fhandler_dev_raw::fixup_after_fork): New function.
- * fhandler_tape.cc (fhandler_dev_tape::open): Revert to user space
- memory allocation.
- (fhandler_dev_tape::ioctl): Ditto. Change behaviour on MTSETBLK when
- new size is 1.
-
-Tue Oct 31 20:56:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_tape.cc (fhandler_dev_tape::open): Fix memory allocation.
- Use Cygwin heap instead of user heap.
- (fhandler_dev_tape::ioctl): Ditto.
-
-Tue Oct 31 12:00:06 2000 Christopher Faylor <cgf@cygnus.com>
-
- * pinfo.cc (enum_init): Don't suffer silently if we can't load the
- process enumerators.
-
-Mon Oct 30 16:54:26 2000 Christopher Faylor <cgf@cygnus.com>
-
- * signal.cc (kill_pgrp): Revert 25-Oct change.
- (kill_worker): Ditto.
-
-Sun Oct 29 20:52:31 2000 Christopher Faylor <cgf@cygnus.com>
-
- * include/cygwin/version.h: Bump DLL minor version number to 6.
-
-Sat Oct 28 01:39:53 2000 Christopher Faylor <cgf@cygnus.com>
-
- * configure.in: Eliminate subdir stuff.
- * configure: Regenerate.
- * include/getopt.h (option): Make name field 'const'.
-
-Fri Oct 27 20:51:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * autoload.cc: New file keeping all autoload stuff.
- * Makefile.in: Add autoload.o to dependencies.
- * dcrt0.cc: Move all autoload stuff to autoload.cc.
- * fhandler_mem.cc: Ditto.
- * net.cc: Ditto.
- * uinfo.cc: Ditto.
-
-Fri Oct 27 11:37:20 2000 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (wait_sig): Add braces to avoid confusion.
-
-Fri Oct 27 11:48:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_socket.cc: New file.
- * Makefile.in: Add fhandler_socket.o to dependencies.
- * fhandler.h: Change comment.
- * net.cc Move all fhandler_socket methods to fhandler_socket.cc.
- * winsup.h: Add declaration for `ws2_32_handle'.
-
-Thu Oct 26 11:51:59 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * dtable.cc (dtable::release): Check for socket. Change
- cnt_need_fixup_before accordingly.
- (dtable::dup2): Ditto.
- (dtable::fixup_before_fork): New method.
- (dtable::fixup_before_exec): Ditto.
- * dtable.h (class dtable): Add member `cnt_need_fixup_before'. Add
- definition for methods `dec_need_fixup_before', `inc_need_fixup_before',
- `need_fixup_before', `fixup_before_exec' and `fixup_before_fork'.
- * fhandler.h (class fhandler_base): Slight rearrangements. Add
- definitions for methods `fixup_before_fork_exec'.
- (class fhandler_socket): Eliminate superfluous constructor.
- Add member `prot_info_ptr'. Add destructor. Add definitions for
- methods `dup', `fixup_before_fork_exec', `fixup_after_fork' and
- `fixup_after_exec'.
- * fork.cc (fork_parent): Care for file types which need a fixup
- before fork. Start child in suspended state then.
- * net.cc: New global variable `ws2_32_handle' and `wsadata'.
- (fdsock): Check for Winsock version. Call `set_socket_inheritance'
- only if Winsock version < 2.0. Care for `need_fixup' count in fdtab.
- (cygwin_socket): Eliminate call to `set_socket_inheritance'.
- (cygwin_accept): Ditto.
- (cygwin_rcmd): Ditto.
- (cygwin_rresvport): Ditto.
- (cygwin_rexec): Ditto.
- (socketpair): Ditto.
- (fhandler_socket::fhandler_socket): Set `need_fork_fixup'. Allocate
- space for the WSAPROTOCOL_INFOA struct used in fixup.
- (fhandler_socket::~fhandler_socket): New destructor.
- (fhandler_socket::fixup_before_fork_exec): New method.
- (fhandler_socket::fixup_after_fork): Ditto.
- (fhandler_socket::dup): Ditto.
- (wsock_init): New static function.
- (LoadDLLinitfunc (wsock32)): Rearranged.
- (LoadDLLinitfunc (ws2_32)): New function.
- (dummy_autoload): Add autoload statemants for `WSADuplicateSocketA'
- and `WSASocketA'.
- * spawn.cc (spawn_guts): Care for file types which need a fixup
- before exec. Start child in suspended state then.
-
-Wed Oct 25 20:49:59 2000 Christopher Faylor <cgf@cygnus.com>
-
- * signal.cc (kill_pgrp): Don't limit sending of signals to stopped
- processes when sig < 0.
- (kill_worker): Only send SIGCONT to stopped processes when sendSIGCONT.
-
-Wed Oct 25 13:56:39 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (sig_handle): Just make sure that wait_sig loops when
- receiving a SIGCONT. Don't block waiting for completion that will
- never occur.
-
-Wed Oct 25 09:59:14 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dtable.cc (dtable::fixup_after_exec): Use variable rather than
- constantly indexing into fds array.
- (dtable::fixup_after_fork): Ditto.
-
-Wed Oct 25 10:43:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_base::fcntl): Treat O_NONBLOCK and OLD_O_NDELAY
- as exactly the same. If one is set, both are set.
- * net.cc (fhandler_socket::fcntl): Ditto.
-
-Tue Oct 24 23:58:35 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (do_exit): Remove debugging statement.
-
-Tue Oct 24 23:45:09 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (do_exit): Don't bother looking for pgrp children to send
- SIGHUP if process has never created any children.
- * fork.cc (fork): Set flag indicating that there is another process
- with our process group.
- * spawn.cc (spawn_guts): Ditto.
- * pinfo.h (set_has_pgid_children): New methods for setting when process
- has children in its process group.
- * syscalls.cc (setpgid): Clear has_gid_children if pgid changes.
-
-Tue Oct 24 20:38:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * ntdll.h: New file.
- * fhandler_mem.cc: Move ntdll.dll specific definitions and
- declarations to ntdll.h.
- * sysconf.cc (sysconf): Add support for _SC_NPROCESSORS_CONF,
- _SC_NPROCESSORS_ONLN, _SC_PHYS_PAGES and _SC_AVPHYS_PAGES.
-
-Tue Oct 24 20:00:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_base::fcntl): Behave properly when passed
- previous version of O_NDELAY.
- * syscalls.cc: Move OLD_O_NDELAY to winsup.h.
- * winsup.h: Define OLD_O_NDELAY now.
-
-Mon Oct 23 21:47:55 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (signal_exit): Kill any executing child process if
- we're dying.
- * path.h: Remove unneeded extern.
- * spawn.cc (std_suffixes): Make static. Don't set dwProcessId here
- since it makes the process unsignalable. Set strace flag that this is
- an execed process stub.
- * strace.cc (strace::vsprntf): Use strace flag to indicate when to
- visually flag that this is an exec stub.
- * include/sys/strace.h (strace): Add 'execing' flag.
-
-Mon Oct 23 16:43:33 2000 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (proc_subproc): Don't send a false positive if WNOHANG and
- no processes are available for waiting.
-
-Mon Oct 23 22:27:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_base::fcntl): Setting flags in F_SETFL
- branch according to Linux documentation.
-
-Mon Oct 23 21:43:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fcntl.cc (_fcntl): Rearrange as wrapper function. Move all
- functionality except F_DUPFD to fhandler classes.
- * fhandler.cc (fhandler_base::fcntl): New method.
- * net.cc (fhandler_socket::fcntl): Ditto.
- * fhandler.h (class fhandler_base): Add method prototype for fcntl().
- (class fhandler_socket): Ditto.
-
-Mon Oct 23 12:44:35 2000 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (proc_subproc): Correctly handle flags for WNOHANG case.
-
-Mon Oct 23 10:00:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc: Eliminate C++ comments throughout.
-
-Sun Oct 22 23:33:00 2000 Christopher Faylor <cgf@cygnus.com>
-
- * fork.cc (fork): Set sigframe here, since it can pause for a
- considerable amount of time.
- * environ.cc (_addenv): Add debugging.
- * fhandler.cc: Eliminate unneeded include.
- * smallprint.c: Ditto.
-
-Sun Oct 22 12:07:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * pinfo.cc (pinfo_init): Eliminate call to `set_process_privileges'.
- * security.cc (write_sd): Call `set_process_privileges' on the first
- call to `write_sd'.
- (set_process_privileges): Eliminate adjusting SE_BACKUP_NAME privilege.
-
-Sat Oct 21 16:57:23 2000 Christopher Faylor <cgf@cygnus.com>
-
- * pinfo.cc (pinfo::init): Make PID_EXECED signal creation as well as
- PID_IN_USE.
-
-Sat Oct 21 01:52:54 2000 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (spawn_guts): Don't do the reparenting step if we notice
- that the child has exited prior to sending the subprocess_ready signal
- (?).
-
-Sat Oct 21 00:46:36 2000 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h (fhandler_console): Remove tcsetpgrp.
- * fhandler_console.cc (fhandler_console::tcsetpgrp): Eliminate.
- * fork.cc (fork_parent): Avoid returning same pid twice in a row
- regardless of OS.
- * pinfo.cc (pinfo::init): Rename create argument to flags and treat it
- as such.
- * signal.cc (set_sigcatchers): New function.
- (signal): Use set_sigcatchers to increment or decrement sigcatcher
- tracker.
- (sigaction): Ditto. Add debugging output.
- * spawn.cc (spawn_guts): Always quote first argv[0] argument when it's
- a COMSPEC shell.
-
-2000-10-20 DJ Delorie <dj@redhat.com>
-
- * times.cc (to_time_t): pass zero time as epoch
- * fhandler.cc (fstat): copy atime/ctime from mtime if they're zero
-
-Thu Oct 19 23:31:41 2000 Christopher Faylor <cgf@cygnus.com>
-
- * external.cc (fillout_pinfo): Pass PID_NOREDIR flag to pinfo init to
- avoid finding execed processes twice.
- * signal.cc (kill_pgrp): Ditto.
- * spawn.cc (spawn_guts): Avoid passing first argument to CreateProcess
- when running a windows shell so that CreateProcess will locate the
- shell. Reorganize so that correct error is returned when CreateProcess
- fails.
-
-Thu Oct 19 13:55:31 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (sigthread::init): Correct overzealous ifdef.
- * exceptions.cc (call_handler): Avoid calling sigthread acquire lock.
- * sigproc.h (sigthread): Comment out lock for now.
- * sync.cc (muto::acquire): Add a minor optimization.
-
-2000-10-18 DJ Delorie <dj@redhat.com>
-
- * Makefile.in: add miscfuncs.cc
- * miscfuncs.cc: new, miscellaneous functions
- * winsup.h: define table-driven tolower/toupper
- * environ.cc: use them
- * fhandler_console.cc: ditto
- * fhandler_termios: ditto
- * path.cc: ditto
- (strncasematch, strcasematch, strcasestr): move to miscfuncs.cc
-
-Wed Oct 18 20:50:27 2000 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.h (sigthread): Eliminate locking for now since per thread
- signalling is not available.
- * dcrt0.cc (sigthread::init): Ditto.
- (dll_crt0_1): Move set_process_privileges call (temporarily?) to
- pinfo_init.
- (pinfo_init): Only call set_process_privileges when allow_ntsec.
-
-2000-10-18 DJ Delorie <dj@redhat.com>
-
- * dcrt0.cc (dll_crt0_1): init cygcwd before forkee branch
-
- * environ.cc (conv_start_chars): Cache a table of "first
- characters" for environment variables needing conversion.
- (getwinenv): Use it.
- (environ_init): Create it, also check first chars for TERM and
- CYGWIN.
-
- * path.cc: Use lookup table for case insensitive comparisons.
-
-Wed Oct 18 00:48:49 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (call_handler): Make signal pending if sigsave.sig is
- still active.
- * syscalls.cc (_read): Don't clear errno.
- * sigproc.cc (wait_sig): Don't scan the waiting process list after a
- SIGCHLD if there are no zombies to reap.
- * winsup.h: Use __builtin_strcmp.
- * environ.cc (posify): Don't initialize len unless it is required
- (from DJ Delorie <dj@redhat.com>).
-
-Tue Oct 17 14:50:31 2000 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (proc_subproc): Remove unneeded test for correct process
- in PROC_ADDCHILD. Return 0 when terminated child has just been
- reparented.
- (wait_subproc): Only send SIGCHLD when proc_subproc returns != 0.
- * strace.cc (strace::vsprntf): Only strip .exe extension from program
- name.
-
-2000-10-16 Charles Wilson <cwilson@ece.gatech.edu>
-
- * fhandler_clipboard.cc: new file
- * Makefile.in: include fhandler_clipboard.o in DLL_OFILES list.
- * fhandler.h: add FH_CLIPBOARD to the devices enum.
- (fhandler_dev_clipboard): new
- * path.cc (windows_device_names): add "\\dev\\clipboard"
- (get_device_number): check for "clipboard"
- * dcrt0.cc: declare a few more functions from winuser.h
- * dtable.cc (dtable::build_fhandler): check for FH_CLIPBOARD in
- switch().
-
-Mon Oct 16 21:36:57 2000 Christopher Faylor <cgf@cygnus.com>
-
- * debug.cc (add_handle): Issue warning on attempts to add the same
- handle more than once.
- * fhandler_tty.cc (fhandler_tty_slave::open): Protect some handles.
- (fhandler_tty_common::close): Use proper name when closing handles.
- (fhandler_pty_master::close): Don't close to_slave or from_slave since
- they've already been closed earlier in the function.
- * sigproc.cc (proc_subproc): Don't protect vchild->hProcess. Expect
- that the caller will do this, instead.
- * tty.cc (tty_list::terminate): Use proper name when closing handles.
- (tty::make_pipes): Protect some handles.
-
-Mon Oct 16 18:37:22 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Remove some obsolete stuff.
- * dcrt0.cc (dll_crt0_1): Call signal_fixup_after_exec where appropriate.
- Set myself->uid from parent version.
- Just use ThreadItem Init method. Close or store hexec_proc as appropriate.
- (_dll_crt0): Store user_data->forkee here so that proper tests can be made
- subsequently.
- (do_exit): Remove hExeced stuff.
- * environ.cc (environ_init): Accept environ count as well as environ pointer.
- * environ.h: Reflect above change.
- * pinfo.cc (pinfo_init): Ditto. Accept environ count.
- (fixup_in_spawned_child): Remove.
- * spawn.cc (spawn_guts): Move signal code to dll_crt0_1. Don't suspend
- execing process since it is no longer necessary. Store envc.
- * exceptions.cc (signal_fixup_after_exec): New function.
- (call_handler): Remove hExeced test.
- * child_info.h (cygheap_exec_info): Store envc as well as envp.
- (child_info_spawn): Store hexec_proc so that it can be closed in child.
- * path.cc (normalize_posix_path): Avoid intermediate use of temporary cwd buf.
- (normalize_win32_path): Ditto.
- (cwdstuff::get_initial): Always set lock.
- * sigproc.h: Remove hExeced.
- * strace.cc (strace::vsprntf): Modify to accommodate for lack of hExeced.
- * thread.cc (MTinterface::Init): Merge Init1 and ClearReent into this method.
- (MTinterface::Init1): Eliminate.
- (MTinterface::ClearReent): Eliminate.
- * thread.h: Reflect above changes.
- * include/sys/strace.h (strace): Make microseconds() public.
-
-Sun Oct 15 21:54:52 2000 Christopher Faylor <cgf@cygnus.com>
-
- Make various functions 'regparm', throughout.
- * pinfo.h (_pinfo): Inline simple signal manipulation functions.
- Requires inclusion of thread.h which was removed from .cc files, where
- appropriate. throughout.
- * pinfo.cc: Eliminate signal manipulation functions.
- (_pinfo::exit): Calculate total rusage for exiting process here.
- * cygheap.cc (size2bucket): Eliminate.
- (init_buckets): Ditto.
- (_cmalloc): Calculate size and bits in a loop rather than going through
- a function call.
- (_crealloc): Use stored array index to calculate allocated size.
- * spawn.cc (spawn_guts): Use _pinfo exit method to exit, calculating
- cpu usage.
-
-Sat Oct 14 21:24:16 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (set_console_handler): Don't allocate
- console_handler_thread_waiter. It is obsolete.
- (ctrl_c_handler): Don't use console_handler_thread_waiter.
- * path.cc (hash_path_name): Fix handling of relative names. Make case
- insensitive.
- * path.h (suffix_info): Use initializers.
- * pinfo.h (_pinfo): Avoid initializers for null case.
- * resource.cc (fill_rusage): Zero rest of rusage structure.
- * security.cc (set_process_privileges): Don't reopen parent process.
- Just use hMainProc.
- * signal.cc (signal): Track when a signal handler has been used.
- (sigaction): Ditto.
- * sigproc.cc (pchildren): Use default initializer.
- (zombies): Ditto.
- (sigproc_terminate): Avoid closing handles that will be closed on exit
- anyway.
- (wait_sig): Send signal to "parent" on EXECing, not FORKing.
- (wait_subproc): Send SIGCHLD here rather than in proc_wait to avoid
- potential muto conflicts.
- * sigproc.h (sigthread): Don't initialize to zero. It's the default.
- * spawn.cc (spawn_guts): Fill in resources from exec parent prior to
- termination.
- * sync.h (muto): Don't initialize to zero.
- * syscalls.cc (close_all_files): Use one lock around entire loop and
- call fhandler close/release stuff directly.
- (_read): Don't use ready_for_read if there are not signal handlers
- active.
-
-Sat Oct 14 12:24:24 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (dll_crt0_1): Fix display of "title".
- (do_exit): Use pinfo exit method to exit.
- (__api_fatal): Ditto.
- * exceptions.cc (signal_exit): Ditto.
- * fork.cc (fork_child): Remove debugging stuff. Use pinfo_fixup_after
- fork in place of exec_fixup_after_fork.
- * pinfo.cc (pinfo_fixup_after_fork): New method.
- (pinfo_fixup_in_spawned_child): Ditto.
- (_pinfo::exit): New method.
- (_pinfo::init): Remove recursion. Detect pathological case where pinfo
- structure already exists for new pid.
- * pinfo.h (_pinfo): Reorganize slightly. Add new method and new
- function declarations.
- * sigproc.cc (proc_exists): Previous simplification was a little to
- simple. Try harder to detect if a process exists.
- (proc_terminate): Use PID_EXITED setting to determine if process is
- still around.
- (WFSO): Remove debugging statement.
- (WFMO): Ditto.
- * spawn.cc (exec_fixup_after_fork): Eliminate.
- (spawn_guts): Always set old_title to NULL. Is it really needed? Move
- hexec_proc to pinfo.cc. Call pinfo_fixup_in_spawned_child to eliminate
- handle link after a spawn.
- * include/sys/cygwin.h: Remove PID_NOT_IN_USE. Add PID_EXITED.
-
-Sat Oct 14 10:54:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * cygwin.din: Add symbol hstrerror.
- * net.cc: Change meaning of member `s' of struct host_errmap.
- (set_host_errno): Fix error in loop condition.
- (hstrerror): Ditto.
- (herror): Add appropriate functionality.
- * include/netdb.h: Add declaration of hstrerror.
- * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 29.
-
-Sat Oct 14 01:45:25 2000 Christopher Faylor <cgf@cygnus.com>
-
- * cygheap.cc (cygheap_fixup_in_child): Don't page round cygheap copied
- from parent.
- * dcrt0.cc (do_exit): Don't cleanup pinfo on exit. That happens
- automatically now.
- * exceptions.cc (signal_exit): Ditto.
- * fork.cc (fork_parent): Use stack_here value passed in from fork().
- (fork): Figure out top of stack here and pass it to fork_parent.
- * pinfo.cc (_pinfo::record_death): Eliminate.
- * pinfo.h (_pinfo): Ditto.
- * sigproc.cc (proc_exists): Simplify.
- (proc_terminate): Ditto.
- (remove_zombie): Don't cleanup pinfo stuff.
- (wait_sig): Send subproc_ready signal whether execed or spawned.
- * spawn.cc (spawn_guts): Always create subproc_ready event. Use it for
- both exec and spawn.
- (_spawnve): Send proper mode to spawn_guts when mode != _P_OVERLAY.
-
-Thu Oct 12 23:11:05 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dtable.cc (dtable::fixup_after_fork): Revert thinko below.
- * pinfo.cc (set_myself): Show pid in initial strace line.
-
-Thu Oct 12 17:58:03 2000 Christopher Faylor <cgf@cygnus.com>
-
- * child_info: Bump child_info "version".
- (child_info): Move some fields from child_info_spawn to here.
- * cygheap.cc: Make cygheap pointers NOCOPY.
- * dcrt0.cc (dll_crt0_1): Copy cygwin heap here regardless of whether
- we've been forked or execed.
- * dtable.cc (dtable::fixup_after_fork): Just release close-on-exec fds.
- * exceptions.cc (stackdump): Respond to C warning.
- * fork.cc: Reorganize to minimize stack copying.
- (fork_child): New function.
- (fork_parent): Ditto.
- (sync_with_child): Don't suspend the forkee.
- (sync_with_parent): Ditto. Make into a function.
- * heap.cc (heap_init): Add some debugging output.
- * path.cc (path_conv::check): Add an assertion.
- (has_suffix): Ditto.
- * security.cc (get_pw_sid): Defend against NULL.
- * sigproc.cc (proc_subproc): Fix debugging output.
- (wait_sig): Ditto.
- * strace.cc: Make statics NO_COPY throughout.
- (strace::vsprntf): Defend against NULL.
-
-Thu Oct 12 00:25:29 2000 Christopher Faylor <cgf@cygnus.com>
-
- * errno.cc (seterrno_from_win_error): Fix debugging output.
- * fhandler.cc (fhandler_base::fstat): Move to inline method in
- fhandler.h.
- (fhandler_base::set_io_handle): Ditto.
- * fhandler.h (fhandler_base): Make some methods inline.
- * fhandler_console.cc (fhandler_console::write_normal): Make buffer
- larger.
- * sigproc.h (sigframe::sigframe): Actually use set ebp parameter
- correctly.
- * spawn.cc (spawn_guts): Set dwProcessId when exec'ing. Just exit
- immediately after reparenting.
- * syscalls.cc: Sprinkle sigframe stuff throughout.
- * wait.cc (wait4): Set signal frame here.
-
-Tue Oct 10 19:54:06 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (__api_fatal): Don't rely on small_printf to display errors.
- Always display problems to the console, if possible.
-
-Tue Oct 10 15:21:10 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (cwdstuff::get): Set EINVAL when length is zero.
-
-Mon Oct 9 14:07:04 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (mount_info::cygdrive_posix_path): Handle e:foo construction
- correctly.
-
-Mon Oct 9 16:44:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_mem.cc (fhandler_dev_mem::fhandler_dev_mem):
- Fix debug output.
-
-Mon Oct 9 15:58:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_mem.cc: Eliminate unused include statements.
- (fhandler_dev_mem::fhandler_dev_mem): Check for 9X/ME.
-
-Mon Oct 9 15:11:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.h (fhandler_dev_mem): Erase member `init_phase' and
- member function `init'.
- * fhandler_mem.cc: Add typedefs for NT internal data types
- `SYSTEM_INFORMATION_CLASS' and `SYSTEM_BASIC_INFORMATION'.
- Add prototype for `NtQuerySystemInformation' function.
- (fhandler_dev_mem::fhandler_dev_mem): Takes over initialization task
- from `init'. Use `NtQuerySystemInformation' function to evaluate the
- size of physical memory instead of interval search.
- (fhandler_dev_mem::init): Eliminated.
- (fhandler_dev_mem::open): Don't call `init'.
- (fhandler_dev_mem::read): Eliminate check for `init_phase'.
- (dummy_autoload): Add load statement for `NtQuerySystemInformation'.
-
-Sun Oct 8 22:38:40 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dtable.cc (set_std_handle): Use std_consts array to control
- SetStdHandle settings.
- (dtable::fixup_after_fork): Ditto.
- * exceptions.cc (set_sig_errno): Remove some debugging output.
- * path.cc (path_conv::check): Don't OR need_directory with flags sent
- to symlink_info::check.
- (symlink_info::check): Use PATH_ALL_EXEC to determine when a file is
- executable.
- * path.h (path_types): Add PATH_ALL_EXEC.
- (isexec): Use PATH_ALL_EXEC so that cygexec types will be considered
- executable.
- * pinfo.h (_pinfo): Add a process handle that is kept open throughout
- the life of a cygwin pid.
- * sigproc.cc (proc_exists): Remove hopefully obsolete stuff.
- (proc_subproc): Set up process handle that is kept open throughout the
- life of a cygwin pid. Reorganize PROC_WAIT stuff to use common code.
- (proc_terminate): Close pid lifetime process handle.
- (checkstate): Cleanup.
- (stopped_or_terminated): Move zombie cleanup.
- (remove_zombie): To here.
- * spawn.cc (spawn_guts): Reorganize reparenting code for 1247th time.
-
-Sat Oct 7 13:59:15 2000 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h (fhandler_base): Remove obsolete _rpos and _rsize
- elements.
- * fhandler.cc (fhandler_base::open): Ditto.
- * fhandler.cc (fhandler_base::fhandler_base): Ditto.
- (fhandler_base::read): Ditto. Add more debugging output. Don't issue
- a \r when \r\n detected.
- * pipe.cc (make_pipe): Streamline slightly. Make debug output more
- interesting.
- * strace.cc (strace::vsprintf): Use __progname where appropriate to
- distinguish strace output when exec'ing.
-
-Sat Oct 7 19:25:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.h (fhandler_dev_mem): Add methods mmap, munmap and msync.
- Add `unit' member.
- * fhandler_mem.cc (fhandler_dev_mem): Initialize `unit' as well.
- (init): Care for differences between /dev/mem, /dev/kmem (not
- implemented yet) and /dev/port.
- (open): Change debug message to reflect the device.
- (mmap): New function.
- (munmap): Ditto.
- (msync): Ditto.
- (fstat): Use unit when setting st_dev in stat structure.
- * mmap.cc (mmap): Handle MAP_ANONYMOUS flag.
- Change error handling slightly.
- * path.cc (get_device_number): Handle /dev/port.
-
-Fri Oct 6 23:21:29 2000 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (_read): Behave properly when passed previous version of
- O_NDELAY. Fix up debugging output.
-
-Thu Oct 5 20:34:48 2000 Christopher Faylor <cgf@cygnus.com>
-
- * net.cc (set_socket_inheritance): Rename from duplicate_socket. Use
- NT specific call when appropriate.
- (__set_winsock_errno): Rename from set_winsock_errno. Accept function
- and line as arguments.
- * path.cc (path_conv::check): Continue the neverending battle to make
- cygwin properly understand that path specs ending in a slash require
- that the path refer to a directory. Windows does not do this by
- default.
- (symlink_info::check): Remove ENOTDIR test. Move it to
- path_conv::check.
- * path.h: Remove obsolete constant.
- * winsup.h (set_winsock_errno): New macro.
-
-Thu Oct 5 14:58:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.h: Add mmap(), munmap() and msync() to fhandler_base
- and fhandler_disk_file.
- * mmem.cc (mmap): Eliminated device dependent implementation details.
- These are moved to the appropriate fhandler class.
- (munmap): Ditto.
- (msync): Ditto.
- (fhandler_base::mmap): New method.
- (fhandler_base::munmap): Ditto.
- (fhandler_base::msync): Ditto.
- (fhandler_disk_file::mmap): Ditto.
- (fhandler_disk_file::munmap): Ditto.
- (fhandler_disk_file::msync): Ditto.
-
-Thu Oct 5 01:52:43 2000 Christopher Faylor <cgf@cygnus.com>
-
- * net.cc: General cleanup.
- (fdsock): Return pointer to created fhandler_socket.
- (cygwin_socket): Use pointer returned by fdsock. Return correct errno
- when fd < 0.
-
-Thu Oct 5 00:48:40 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (interruptible): Add extra debugging.
- * sigproc.h (wait_sig): Fill in frame pointer, by default, prior to
- calling or suffer confusion due to September 7 change below.
-
-Wed Oct 4 23:10:27 2000 Christopher Faylor <cgf@cygnus.com>
-
- * include/netinet/tcp.h: Remove winsock.h include.
- * include/sys/cygwin.h: Move windows specific reference within
- conditional.
-
-Thu Oct 5 1:13:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * include/sys/mman.h: Add missing MAP_FAILED macro.
-
-Wed Oct 4 18:48:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.h (fhandler_dev_mem): Add method `init'. Add members
- `mem_size' and `init_phase'.
- * fhandler_mem.cc (init): New function to figure out the size of
- the physical memory.
- (open): Add checking for illegal flags. Change usage of access mode.
- (write): Add intended functionality.
- (read): Add parameter checking. Eliminate page size constant. Use
- getpagesize() instead. Don't touch errno and don't create debug output
- while init() is running.
- (lseek): Add bounds checking. Fix SEEK_END.
- (fstat): Eliminate page size constant. Use getpagesize() instead.
- (dup): Add intended functionality.
-
-Mon Oct 2 22:15:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * dcrt0.cc: Add LoadDLLFunc statement for RegEnumValueA().
- * net.cc: Change comments related to get_ifconf.
- (get_2k_ifconf): Eliminate `type' variable. Eliminate `sa' parameter.
- (get_nt_ifconf): Ditto.
- (get_9x_ifconf): Ditto. Rewritten.
- (get_ifconf): Change calls to OS specific functions.
-
-Mon Oct 2 15:15:01 2000 Christopher Faylor <cgf@cygnus.com>
-
- * signal.cc (sigaction): Allow new action == oldaction.
-
-Mon Oct 2 11:05:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_mem.cc: Load ntdll functions via autoload method.
- (load_ntdll_funcs): Eliminated.
-
-Sun Oct 1 16:36:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_mem.cc (load_ntdll_funcs): Add missing __stdcall qualifiers.
-
-Sun Oct 1 22:20:39 2000 Christopher Faylor <cgf@cygnus.com>
-
- * cygheap.cc (cygheap_init): Born again function.
- (_cmalloc): Reorganize to accommodate muto locking.
- (_cfree): Use muto lock to avoid multi-thread problems.
- * cygheap.h (incygheap): Just use cygheap_max to find upper cygwin heap
- bounds.
- * dcrt0.cc (dll_crt0_1): Reinstitute cygheap_init call.
- * path.cc (getcwd): Just return cwdstuff::get result, allowing correct
- handling of negative length.
- (cwdstuff::get): Malloc a buffer if one is not available.
-
-Sun Oct 1 2:56:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * Makefile.in: Add fhandler_mem.o to the dependencies.
- * dtable.cc (dtable::build_fhandler): Add case for FH_MEM.
- * fhandler.h: Add FH_MEM device type. Add class fhandler_dev_mem.
- * fhandler_mem.cc: New file. Implementation of class fhandler_dev_mem.
- * path.cc: Add /dev/mem to windows_device_names.
- (get_device_number): Add FH_MEM type.
-
-Sat Sep 30 00:43:42 2000 Christopher Faylor <cgf@cygnus.com>
-
- * cygheap.cc (init_cheap): Set aside space for heap walk pointer.
- (_csbrk): Make logic for detecting when to alloc cognizant of
- initialization condition.
- (_cmalloc): Use a structure to hold bucket size and heap chain pointer.
- Store pointer to next freed block in bucket size location so that it
- will be easy to see if a block is allocated.
- (_cfree): Store pointer to next freed block in bucket size location.
- (_crealloc): Use macro to retrieve bucket size.
- (cygheap_init): Eliminate.
- (cygheap_fixup_in_child): Add second argument to determine if we were
- execed or not. In execed case, walk the heap, cleaning up any orphaned
- blocks.
- * cygheap.h: Add a "MAX" value to cygheap_types. Remove cygheap_init
- declaration. Accommodate new argument to cygheap_fixup_in child.
- * fork.cc (fork): Accommodate extra argument to cygheap_fixup_in_child.
- * dcrt0.cc (dll_crt0_1): Ditto. Remove call to cygheap_init.
-
-Fri Sep 29 21:49:27 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (symlink_info::check): Set executable bit for a file if the
- first two characters are 'MZ' to mirror spawn_guts check.
-
-Sat Sep 30 03:34:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * winsup.h: Add `winME' to os_type symbols.
- * dcrt0.cc (set_os_type): Identify Windows ME systems.
- * (host_dependent_constants::init): Care for winME.
- * uname.cc (uname): Ditto.
-
-Thu Sep 28 01:46:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (get_ifconf): Code cleanup. Split. Call os dependent
- subfunctions instead.
- (get_9x_ifconf): New function for 9X systems, called by get_ifconf.
- (get_nt_ifconf): New function for NT systems, called by get_ifconf.
- (get_2k_ifconf): New function for W2K systems, called by get_ifconf.
-
-Wed Sep 27 01:10:07 2000 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (spawn_guts): Attempt to accommodate archaic windows quoting
- mechanism when dealing with '\' and '"'.
-
-Mon Sep 25 20:47:04 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (quoted): Fix problem where ' quoted strings were skipped.
- * fhandler.h (fhandler_socket::~fhandler_socket): Delete declaration.
- * net.cc: Remove unnecessary "number_of_sockets" usage.
- (fhandler_socket::fhandler_socket): Ditto.
- (fhandler_socket::~fhandler_socket): Delete definition.
- * spawn.cc (spawn_guts): Force first argument passed to CreateProcess
- as a command line to be windows style.
-
-2000-09-25 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (av::dup_maybe): Make function void rather than void *.
- * environ.cc (environ_init): Remember to reparse CYGWIN if envp is
- supplied.
- * heap.cc (_sbrk): Remember frame for signal handling.
- * syscalls.cc (read_handler): Eliminate.
- (_read): Move read_handler code here. Reorganize for one path through
- 'ready_for_read'.
-
-Tue Sep 19 09:46:36 2000 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (spawn_guts): Use actual program argument passed in for
- argv[0] as originally suggested by Kazuhiro Fujieda
- <fujieda@jaist.ac.jp>.
-
-Mon Sep 18 23:17:19 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.h: Create new input path flag PATH_NEEDDIR.
- * path.cc (path::check): Detect trailing slash before converting to
- windows path. Tell symlink_info::check to check for directory if one is
- found.
- (symlink_info::check): Set errno when path is not a directory if
- pflags & PATH_NEEDDIR.
-
-Mon Sep 18 19:44:08 2000 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_tty.cc (fhandler_tty_slave::write): Correct typo which
- caused resetting of windows error to ERROR_IO_DEVICE to be ignored.
-
-Mon Sep 18 17:15:37 2000 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * path.cc (mount_info::read_mounts): Don't delete mount entries of
- which mount points have the cygdrive prefix.
- * (mount_info::add_reg_mount): Properly catch errors on registry
- operations.
- * (mount_info::write_cygdrive_info_to_registry): Ditto.
- * (mount_info::del_reg_mount): Cosmetic changes to be consistent
- with other methods.
- * (mount_info::add_item): Check arguments more precisely.
- Increment nmounts only when registry operations succeed.
-
-Sun Sep 17 22:18:39 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (interruptible): Return 0 if given an address in
- uncommitted memory.
-
-2000-09-16 Egor Duda <deo@logos-m.ru>
-
- * signal.cc (sleep): If interrupted by signal, return the
- requested time minus the time actually slept.
-
-Fri Sep 15 22:30:40 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (handle_exceptions): Just "core dump" if SIGSEGV in
- signal thread.
- * external.cc (fillout_pinfo): Fix compiler warning.
- * sigproc.h: Eliminate special asm naming for sig_dispatch_pending.
- * sigproc.cc (sig_send): Remove debugging statements.
-
-Wed Sep 13 14:56:47 2000 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (av): Hide 'calloced' field and limit cstrduping to class
- methods only.
- (spawn_guts): Use methods for manipulating most newargv stuff.
-
-2000-09-13 Egor Duda <deo@logos-m.ru>
-
- * child_info.h (child_info_spawn::~child_info_spawn): Avoid
- memory leaks in cygheap.
- * spawn.cc (spawn_guts): Ditto.
-
-Wed Sep 13 14:28:03 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (quoted): Return next character after a quoted string when
- not doing special quote processing. Also ensure that non-NULL is
- returned in all circumstances.
-
-Wed Sep 13 10:26:16 2000 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (spawn_guts): Ensure that argv[0] is correctly set to the
- full path when a script is detected. Suggested by Kazuhiro Fujieda
- <fujieda@jaist.ac.jp>.
-
-Tue Sep 12 22:33:30 2000 Christopher Faylor <cgf@cygnus.com>
-
- * external.cc (fillout_pinfo): Handle explicit pids correctly.
-
-Tue Sep 12 14:37:32 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (normalize_posix_path): Fix more slashdot madness.
-
-Tue Sep 12 12:29:29 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Make clean target remove *.d.
-
-Mon Sep 11 13:19:15 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (normalize_posix_path): Correctly deal with a "." parameter.
-
-Sun Sep 10 20:23:35 2000 Christopher Faylor <cgf@cygnus.com>
-
- * cygheap.cc (init_cheap): Just use any old address for the cygwin
- heap.
- * exceptions.cc (signal_exit): Don't terminate the main thread. Just
- try to exit in this thread really quickly.
- * signal.cc (kill_pgrp): Fix typo which caused pinfo structure to be
- assigned incorrectly.
-
-Sun Sep 10 12:40:49 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (dll_crt0_1): Initialize thread and debug stuff before
- handling exec/fork.
- * dtable.cc (dtable::fixup_after_exec): Always clear out the read ahead
- buffer whether closing or adjusting.
- * path.cc (chdir): Avoid a compiler warning.
-
-Sat Sep 9 23:29:17 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (chdir): Use the full path for cwd_win32. Consider attempts
- to chdir to strings of dots > 2 to be an error. Pass 'dir' argument to
- cygcwd.set.
- (cwdstuff::set): Need to treat arguments from chdir differently.
- * path.h (cwdstuff): Add an argument to set.
-
-Fri Sep 8 11:50:09 2000 Christopher Faylor <cgf@cygnus.com>
-
- * lib/_cygwin_crt0_common.cc: Add missing header files.
-
-Thu Sep 7 23:07:21 2000 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.h (sigframe::set): Eliminate second argument. Default bp to
- current frame pointer rather than using this within the function, which
- is unstable when this method is not inlined.
- * net.cc: Eliminate use of second argument to sigframe.set throughout.
- * select.cc (cygwin_select): Ditto.
- * sigproc.cc (sig_send): Ditto.
-
-Thu Sep 7 22:45:16 2000 Christopher Faylor <cgf@cygnus.com>
-
- Break out more header info into separate files. Use appropriate
- header files throughout.
- * shared.h: Remove.
- * cygwin_version.h: New file.
- * delqueue.h: New file.
- * environ.h: New file.
- * host_dependent.h: New file.
- * perprocess.h: New file.
- * registry.h: New file.
- * security.h: New file.
-
-Thu Sep 7 12:14:43 2000 Christopher Faylor <cgf@cygnus.com>
-
- Split out tty and shared_info stuff into their own headers and use
- throughout. Include sys/termios.h for files which need it.
- * tty.h: New file.
- * shared_info.h: New file.
- * fhandler.h: Move inline methods that rely on tty stuff to
- fhandler_console.cc.
- * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Set
- output_done_event immediately after reading data to speed up tty output
- processing.
- (process_output): Set write_error to errno or zero.
- (fhandler_tty_slave::write): Check previous write error prior to
- writing to slave end of pipe. This allows tty output to be slightly
- less synchronous.
- * fhandler_console.cc (fhandler_console::tcsetpgrp): Moved here from
- fhandler.h.
- (fhandler_console::set_input_state): Ditto.
-
-Wed Sep 6 21:11:13 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (signal_exit): Reset all mutos owned by the main
- thread.
- * fhandler.h: Define *_output_mutex macros for serializing tty output.
- (fhandler_termios): Remove restart_output_event. Define dummy output
- mutex methods.
- (fhandler_pty_master): Remove unneeded fixup_after_fork method.
- * fhandler_termios.cc (fhandler_termios::line_edit): Acquire
- output_mutex when CTRL-S is hit. Release it on CTRL-Q.
- * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Remove
- inappropriate OutputStopped test here. Just use the output mutex.
- (fhandler_pty_master::fhandler_pty_master): Remove obsolete reference
- to restart_output_event.
- (fhandler_tty_common::close): Ditto.
- (fhandler_pty_master::set_close_on_exec): Ditto.
- (fhandler_pty_master::fixup_after_fork): Delete.
- * tty.cc (tty::common_init): Ditto.
- * sync.cc (muto::reset): New method.
- * sync.h: Declare above method.
-
-Wed Sep 6 16:56:38 2000 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc: Add include file for proper definitions.
- * spawn.cc: Ditto.
- * winsup.h: Define cfree to avoid newlib pollution.
-
-Wed Sep 6 14:11:51 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in (CFLAGS): Ensure that -MD is always added even when
- CFLAGS is overwritten.
-
-Wed Sep 6 02:40:12 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (cwdstuff::get_initial): Keep caching alive.
- (mount_info::conv_to_win32_path): Fill out relative path in failing
- case.
-
-Tue Sep 5 21:36:15 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (normalize_posix_path): Deal with error return from cygcwd.get.
- (normalize_win32_path): Ditto.
- (mount_info::conv_to_win32_path): Ditto.
- (cwdstuff::get): Set buf to NULL on error.
-
-Tue Sep 5 17:49:34 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (readlink): 'max' should be a 'min' or we'll suffer
- buffer overflow.
-
-Mon Sep 4 22:53:58 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (cwd_win32): Eliminate.
- (cwd_posix): Eliminate.
- (cwd_hash): Eliminate.
- (cwdstuff::init): Rename from cwd_init.
- (cwdstuff::fixup_after_exec): Rename from cwd_fixup_after_exec.
- (cwdstuff::get): Rename from get_cwd_inner.
- (normalize_posix_path): Eliminate cwd argument. Just calculate when
- necessary.
- (normalize_win32_path): Ditto.
- (mount_info::conv_to_win32_path): Eliminate cwd retrieval here.
- (mount_info::conv_to_posix_path): Ditto.
- (hash_path_name): Accommodate additional methods in cwdstuff.
- (get_cwd_win32): Eliminate.
- (getcwd): Use cwdstuff methods. Properly handle case where buf == NULL
- and len < 0.
- (cwdstuff::get_hash): New method.
- (cwdstuff::get_initial): New method.
- (cwdstuff::set): New method.
- (cwdstuff::get): New method.
- (cwdstuff::copy): New method.
- * path.h: Move cwdstuff struct here. Add a bunch of stuff to cwdstuff.
- Make cygcwd an extern.
- * spawn.cc (spawn_guts): Use copy method to get copies of cwd info to
- pass to execed process.
- * dcrt0.cc (dll_crt0_1): Use cygcwd methods for cwd initialization.
-
-2000-09-03 Egor Duda <deo@logos-m.ru>
-
- * path.cc (readlink): Check if buffer length is positive.
- Truncate output to buffer length. Don't terminate buffer
- with '\0'.
-
-Sun Sep 3 00:38:40 2000 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (environ_init): Don't free the new environment table after
- we've just copied stuff to it.
-
-Sun Sep 3 00:07:32 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Add cygheap.o.
- * child_info.h: Add specific exec class.
- * cygheap.h: New file. Contains declarations for cygwin heap.
- * cygheap.cc: New file. Implements cygwin heap functions.
- * dcrt0.cc (quoted): Simplify due to new method for passing arguments
- between cygwin programs.
- (alloc_stack_hard_way): Attempt to handle overlapped stack.
- (dll_crt0_1): Move child_info processing here. Accommodate new method
- for passing arguments between cygwin programs. Initialize cygwin heap.
- Establish __argc and __argv variables.
- (_dll_crt0): Move most of child_info processing to dll_crt0_1.
- (cygwin_dll_init): Remove duplication.
- * dtable.cc (dtable::extend): Allocate dtable using cygwin heap.
- (dtable::build_fhandler): Ditto for fhandler type being constructed.
- (dtable::dup_worker): Free new fhandler from cygwin heap on error.
- (dtable::select_*): Don't assume that this == fdtab.
- (dtable::linearize_fd_array): Delete.
- (dtable::delinearize_fd_array): Delete.
- (dtable::fixup_after_exec): New file.
- (dtable::vfork_child_dup): Use cygwin heap.
- (dtable::vfork_parent_restore): Ditto.
- * dtable.h: Remove obsolete methods. Add new method.
- * environ.cc (posify): Eliminate already_posix parameter and logic.
- (envsize): New function.
- (_addenv): Use envsize.
- (environ_init): Accept an argument pointing to an existing environment
- list. If supplied, allocate space for this in the the program's heap.
- * fhandler.cc (fhandler_base::operator =): Move here from fhandler.h.
- Use cygwin heap to allocate filenames.
- (fhandler_base::set_name): Allocate/free names from cygwin heap.
- (fhandler_base::linearize): Delete.
- (fhandler_base::de_linearize): Delete.
- (fhandler_base::operator delete): Free from cygwin heap.
- (fhandler_base::~fhandler_base): Ditto.
- * fhandler.h: Accommodate elimination of *linearize and other changes
- above.
- * fhandler_console.cc (fhandler_console::fixup_after_exec): Rename from
- de_linearize.
- * heap.h: New file.
- * fhandler_tty.cc (fhandler_tty_slave::fhandler_tty_slave): Use cygwin
- heap for name. fhandler_tty::fixup_after_exec): Rename from
- de_linearize.
- * fork.cc (fork): Call cygheap_fixup_in_child.
- * heap.cc: Use declarations in heap.h.
- * malloc.cc: Sprinkle assertions throughout to catch attempts to
- free/realloc something from the cygwin heap.
- * path.cc: Throughout, eliminate use of per-thread cache for cwd. Use
- cwd_* functions rather than cwd_* variables to access cwd_win32 and
- cwd_posix.
- (cwd_win32): New function.
- (cwd_posix): New function.
- (cwd_hash): New function.
- (cwd_fixup_after_exec): New function.
- * path.h: Accommodate path.cc changes.
- * pinfo.cc (pinfo_init): Accept a pointer to an environment table.
- Pass this to environ_init. Eliminate old 'title' tests.
- * pinfo.h: Accommodate above change in argument.
- * spawn.cc (struct av): New method for building argv list.
- (av::unshift): New method.
- (spawn_guts): Allocate everything that the child process needs in the
- cygwin heap and pass a pointer to this to the child. Build argv list
- using new method. Eliminate delinearize stuff.
- * thread.h: Eliminate _cwd_win32 and _cwd_posix buffers.
- * winsup.h: Eliminate obsolete functions. Add envsize() declaration.
-
-2000-09-02 Egor Duda <deo@logos-m.ru>
-
- * Makefile.in: Remove "make check" support. It is now in
- winsup/Makefile.in.
-
-Fri Sep 1 21:17:03 2000 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (mychild): New function.
- (proc_subproc): Use mychild() to determine if a specific pid is valid
- for wait()ing.
-
-Fri Sep 1 16:57:44 2000 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (sigproc_init): Create wait_sig_inited without auto-reset
- to avoid potential races.
- (init_child_info): Avoid unneeded test.
-
-Fri Sep 1 16:51:26 2000 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (proc_info): Rename proc_exists which takes a pid to
- "pid_exists".
- * shared.h: Split out "child_info" stuff into a new header file and
- use where necessary.
- Declare pid_exists.
- * child_info.h: New file.
-
-Thu Aug 31 16:06:21 2000 Christopher Faylor <cgf@cygnus.com>
-
- * errno.cc (set_errno_from_win_error): Actually use arguments to
- strace_printf.
-
-2000-08-30 DJ Delorie <dj@redhat.com>
-
- * times.cc (gettimeofday): use GetSystemTimeAsFileTime to avoid a
- conversion
- (FACTOR): correct value
- (genf): set milliseconds to zero, DOW to 4.
-
-2000-08-29 Egor Duda <deo@logos-m.ru>
-
- * grp.cc (getgroups): fail with EINVAL if array is not large
- enough to hold all supplementary group IDs.
-
-Mon Aug 28 22:03:21 2000 Christopher Faylor <cgf@cygnus.com>
-
- * signal.cc (_raise): New function.
- * exceptions.cc (unused_sig_wrapper): Remove _raise.
- * sigproc.h (class sigframe): Default frames to skip to zero or suffer
- from exuberant optimization.
- * fhandler_tty.cc (fhandler_tty::write): Set appropriate errno when
- WriteFile to pipe fails.
-
-Fri Aug 25 23:44:48 2000 Christopher Faylor <cgf@cygnus.com>
-
- * pinfo.h (pinfo): Un-inline release.
- * pinfo.cc (pinfo::release): Move here from pinfo.h.
- * sigproc.cc (proc_terminate): Remove bogus 'pinfo child' which caused
- strange destruction of random regions of memory when destructor was
- invoked.
-
-Fri Aug 25 21:25:32 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (dll_crt0_1): Move set_os_type.
- (_dll_crt0): To here.
- (cygwin_dll_init): And here.
- * external.cc (fillout_pinfo): Use more foolproof method for scanning
- for pids.
- * pinfo.cc (set_myself): Eliminate myself_identity.init.
- * sigproc.cc (wait_sig): Do it here instead to reduce the amount of
- time where there could potentially be two processes with the same pid.
- * spawn.cc (spawn_guts): Eliminate duplicate initialization.
- * include/sys/cygwin.h: Mark unused PID_* elements.
-
-Fri Aug 25 21:49:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * exec.cc (_execve): Change definition according to declaration in
- newlib/libc/include/sys/unistd.h.
-
-Thu Aug 24 22:17:19 2000 Christopher Faylor <cgf@cygnus.com>
-
- * external.cc (cygwin_internal): Add CW_INIT_EXCEPTIONS to allow cygwin
- exception handling on threads not created by cygwin.
- * sigproc.cc (proc_terminate): Don't release pinfo structs since we are
- exiting.
- * include/sys/cygwin.h: Add CW_INIT_EXCEPTIONS.
-
-Thu Aug 24 17:16:14 2000 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (cygwin_select): Correct logic for "always_ready" fds or
- when there is no wait specified.
- * syslog.cc (pass_handler::set_message): Zero the buffer prior to
- setting it.
-
-2000-08-24 Egor Duda <deo@logos-m.ru>
-
- * include/cygwin/core_dump.h: New file, contains structures used in
- cygwin core core files.
- * include/sys/procfs.h: New file, needed to autoconfigure cygwin core
- dumps support in bfd.
-
-Thu Aug 24 13:50:15 2000 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (parse_thing): nobinmode should force O_TEXT.
- (regopt): Use correct path to find LOCAL_MACHINE registry options.
- * fhandler.cc (fhandler_base::open): Set binary mode only when binmode
- == O_BINARY.
- * pipe.cc (pipe): Pipe handling should rely on binmode not _fmode now
- that the two are different.
-
-Thu Aug 24 13:21:09 2000 Christopher Faylor <cgf@cygnus.com>
-
- * include/sys/cygwin.h (strace_printf_wrap): Force printing when
- _STRACE_SYSTEM.
- (strace_printf_wrap1): Ditto.
-
-Thu Aug 24 12:30:17 2000 Christopher Faylor <cgf@cygnus.com>
-
- * debug.h: Allow some debug defines for use in header files.
-
-Wed Aug 23 23:00:24 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (dll_crt0_1): Move exception list and constructor stuff
- earlier in the process. Use new second argument to set_myself.
- (cygwin_dll_init): Initialize exception list and constructor stuff
- here.
- (_dll_crt0): And here. Also, deal with inherited pinfo shared memory
- region from parent.
- * pinfo.cc (set_myself): Accept a second argument signifying the a
- shared memory region, passed from an execing parent.
- (pinfo_init): Ditto.
- * pinfo.h: Ditto.
- * shared.h (child_info): Add a handle field to pass to child.
- * spawn.cc (spawn_guts): Create a shared handle to pass to an execed
- child.
- * winsup.h: Remove extraneous declaration.
-
-Wed Aug 23 10:51:57 2000 Christopher Faylor <cgf@cygnus.com>
-
- * include/sys/cygwin.h: Protect class definitions.
-
-Tue Aug 22 13:57:36 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (symlink_info::check): Clear error on each iteration of
- extension check.
-
-Tue Aug 22 11:23:59 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Don't include '.d' file if there are none generated yet.
-
-Tue Aug 22 11:08:11 2000 Christopher Faylor <cgf@cygnus.com>
-
- * include/sys/cygwin.h: Declare some thread classes.
- * include/mntent.h: Avoid declaring functions.
-
-Tue Aug 22 01:08:01 2000 Christopher Faylor <cgf@cygnus.com>
-
- * winsup.h: Eliminate inclusion of most of the cygwin .h files. Use .h
- files only in sources which require them.
- * Makefile.in: Generate dependencies with -MD option.
-
-Mon Aug 21 23:49:05 2000 Christopher Faylor <cgf@cygnus.com>
-
- * cygerrno.h: New file. Use this throughout whenever errno
- manipulation is required.
- * errno.cc: Use DWORD to hold Windows errors.
- (geterrno_from_win_error): New function.
- (seterrno_from_win_error): Use geterrno_from_win_error to convert
- supplied windows error (suggested by Corinna Vinschen).
- * path.cc (symlink_info): Add error element.
- * path.cc (path_conv::check): Remove errno setting. Use new
- symlink_info errno element to set path_conv error, where appropriate.
- (symlink_info::check): Set error element rather than attempting to
- manipulate errno. Add more checks for trailing / and /.. even though
- they are currently useless. Avoid setting EINVAL.
-
-Mon Aug 21 23:49:05 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * path.cc (normalize_posix_path): Correct check for trailing /.
-
-2000-08-21 DJ Delorie <dj@redhat.com>
-
- * include/cygwin/cygwin_dll.h (DECLARE_CYGWIN_DLL): hinstance,
- not handle.
-
-Fri Aug 18 11:11:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * dtable.cc (dtable::dup2): Extend fdtab if newfd is out of current
- allocated bounds.
-
-Sat Aug 12 01:47:28 2000 Christopher Faylor <cgf@cygnus.com>
-
- * mkvers.sh: Properly trap exit removal of temp file. Remove debugging
- statement.
-
-Sat Aug 12 01:37:56 2000 Christopher Faylor <cgf@cygnus.com>
-
- * poll.cc: Make winsup.h the first include file, re 2000-08-02 change.
-
-Sat Aug 12 01:33:12 2000 Christopher Faylor <cgf@cygnus.com>
-
- * winsup.h: Split out dtable definitions into separate header file.
- * dtable.h: New file.
- * sigproc.h: Eliminate pinfo.h usage here. Use it in source files that
- need it.
-
-Sat Aug 12 01:08:11 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Use dtable.o rather than hinfo.o.
-
-Sat Aug 12 00:47:11 2000 Christopher Faylor <cgf@cygnus.com>
-
- Rename hinfo -> dtable. Name the former dtable array 'fdtab'.
-
-Fri Aug 11 14:47:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * poll.cc: Allow any descriptor and any number of descriptors.
- Allocate fd_set struct sdynamically.
-
-Fri Aug 11 14:47:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * poll.cc: Add bounds checking for file descriptors. Return POLLNVAL
- if fd is invalid. Return POLLERR for each valid fd if cygwin_select
- returned with error.
- include/sys/poll.h: Change POLLERR comment according to above change.
-
-Thu Aug 10 21:54:29 2000 Christopher Faylor <cgf@cygnus.com>
-
- * syslog.cc (syslog): Use a less malloc-intensive method for allocating
- the buffer. Also fix a buffer overrun.
-
-Thu Aug 10 15:31:39 2000 Christopher Faylor <cgf@cygnus.com>
-
- * winsup.h: Change strchr inline for strange gcc problem.
- * select.cc (select_stuff::wait): Bounds check w4 array.
-
-Thu Aug 10 15:17:53 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dir.cc (readdir): Ensure that errno is *only* set when we've run out
- of filenames.
- * fhandler.cc (fhandler_disk_file::fstat): Use modern method for saving
- errno, making it effective for the whole function.
-
-Tue Aug 8 22:25:39 2000 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (allocfd_set): Zero allocated fd_set.
- (cygwin_select): Move fd_set copying logic from ::wait to here. Use
- common return through sell.poll.
- (select_stuff::wait): Just return success or failure and let caller
- fill in fd_set.
- * pinfo.h (pinfo): Eliminate self-referential pointer to sidbuf since
- pinfo structure exists at random locations now.
- * fork.cc (fork): Use 'use_psid' element to control when the psid is
- relevant.
- * shared.cc (sec_user): Ditto.
- * spawn.cc (spawn_guts): Ditto.
- * uinfo.cc (internal_getlogin): Ditto.
- * syscall.cc (seteuid): Ditto. Set use_psid element.
-
-Tue Aug 8 13:20:00 2000 Bob Wilson <bwilson@tensilica.com>
-
- * fhandler_serial.cc (tcsendbreak): "sleeptime" argument to usleep()
- must be in units of microseconds, not milliseconds.
-
-Mon Aug 7 00:11:35 2000 Christopher Faylor <cgf@cygnus.com>
-
- * include/cygwin/cygwin_dll.h: Remove extraneous (and incorrect)
- declarations.
-
-Fri Aug 4 00:00:46 2000 Christopher Faylor <cgf@cygnus.com>
-
- * hinfo.cc (hinfo::find_unused_handle): Just check for table entry ==
- NULL since we are already bounds checked by default.
- * thread.cc (ResourceLocks::Lock): Streamline this function since it is
- called a lot.
- (ReleaseResourceLock): Ditto.
-
-Thu Aug 3 20:44:39 2000 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (fhandler_console::select_read): Call set_cursor_maybe
- since select may block and cursor may not be visible.
- * select.cc (fhandler_console::select_write): Ditto.
- * select.cc (fhandler_console::select_except): Ditto.
-
-Thu Aug 3 09:01:14 2000 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Set
- length field correctly when "need_nl".
-
-Wed Aug 2 22:58:07 2000 Christopher Faylor <cgf@cygnus.com>
-
- * fork.cc (vfork): Store complete stack frame in vfork_save structure
- for later recovery.
- * spawn.cc (spawn_guts): Reorganize slightly to consolidate handling
- when there is a CreateProcess error.
- (_spawnve): Only longjmp back to vfork handling when a process has been
- successfuly started.
- * winsup.h (vfork_save): Extend to include frame info. Remove obsolete
- cpplus conditionals.
-
-Wed Aug 2 15:14:51 2000 Christopher Faylor <cgf@cygnus.com>
-
- * strace.cc (strace::prntf): Make second argument the function name,
- rather than use special format options.
- (strace::vprntf): Ditto.
- (getfunc): New function.
- * include/sys/strace.h: Reflect above changes.
- * smallprint.c (__small_vsprintf): Eliminate '%F' formatting.
- * pinfo.cc (set_myself): Modify for new strace::prntf parameter.
- * errno.cc (seterrno_from_win_error): Ditto.
- * fhandler_tty.cc (fhandler_tty_common::__acquire_output_mutex): Ditto.
- * fhandler_tty.cc (fhandler_tty_common::__release_output_mutex): Ditto.
-
-Wed Aug 2 13:20:04 2000 Christopher Faylor <cgf@cygnus.com>
-
- * regexp/regexp.c: Add winsup.h.
-
-2000-08-02 DJ Delorie <dj@redhat.com>
-
- * winsup.h: take out protections of environ, errno, allow C use
- * *.cc: put winsup.h before other headers (for __INSIDE_CYGWIN__);
- use cur_environ() instead of just environ
- * times.cc: remove import protections
- * glob.c: add winsup.h
- * localtime.c: ditto
- * smallprint.c: ditto
- * Makefile.in: don't __INSIDE_CYGWIN__ as it messes up profiling.
-
-Wed Aug 2 11:22:53 2000 Christopher Faylor <cgf@cygnus.com>
-
- * include/sys/strace.h: Fix strace definition.
-
-Tue Aug 1 23:37:08 2000 Christopher Faylor <cgf@cygnus.com>
-
- * strace.h: Add kludgy workarounds to avoid using deprecated methods
- for variable argument macros when possible.
- * sigproc.cc: Throughout, use sigproc_printf rather than sip_printf.
- * strace.cc (strace::prntf): Remove 'active' check, since callers are
- supposed to ensure this.
- (__system_printf): Remove. Subsumed by strace::prntf.
- * winsup.h: Define "NEW_MACRO_VARARGS" to indicate when to use new
- macro varargs capability.
-
-Sun Jul 30 13:54:35 2000 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_console.cc: Remove VK_DIVIDE detection.
- (get_nonascii_key): Simplify previous patch to return ascii char if it
- is non-zero. Add a second "temporary buffer" argument to help with
- thread safety.
- * select.cc (peek_console): Pass a temporary buffer argument to
- get_nonascii_key.
-
-Sat Jul 29 14:32:12 2000 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_console.cc: Add VK_DIVIDE detection. Return virtual keycode
- if it is not detected and it is less than ' '.
-
-Sat Jul 29 13:33:49 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (chdir): Avoid trailing dot calculation when chdir == '/'
- or we end up with an empty string.
-
-Sat Jul 29 12:11:33 2000 Christopher Faylor <cgf@cygnus.com>
-
- * include/cygwin/version.h: Bump DLL minor version number to 5 due
- to all of the changes below.
-
-Sat Jul 29 12:01:32 2000 Christopher Faylor <cgf@cygnus.com>
-
- Redefine process structure to avoid a fixed size table. Redefine
- pinfo/_pinfo classes. Use these throughout.
- * dcrt0.cc (dll_crt0_1): Accommodate set_myself argument change.
- (__api_fatal): Accommodate _pinfo::record_death argument change.
- * exceptions.cc (really_exit): Ditto.
- (sig_handle_tty_stop): Use pinfo constructor to access process info.
- (events_init): Don't create pinfo_mutex since it is no longer required.
- * external.cc (fillout_pinfo): Use winpids class to iterate over all
- system pids.
- (cygwin_internal): lock_pinfo_for_update and unlock_pinfo are now
- noops.
- * fhandler_termios.cc (fhandler_termios::set_ctty): Use pinfo
- constructor to access process info.
- * fork.cc (fork): Reorganize to initialize child info after the child
- has started since that is when we know the child's winpid, which is
- necessary to allocate the pinfo shared memory.
- * mmap.cc (recreate_mmaps_after_fork): Change arg type to _pinfo.
- * pinfo.cc: Rename pinfo methods to _pinfo throughout. Eliminate
- pinfo_list stuff.
- (set_myself): Accept a pid argument now. Call pinfo initializer to
- initialize myself. Detect when this is an "execed" process and create
- an "indirect" pid block.
- (pinfo_init): Accommodate set_myself arg change.
- (procinfo): Remove.
- (pinfo::lock_pinfo): Remove.
- (pinfo::unlock_pinfo): Remove.
- (pinfo::init): New method. Allocates shared memory space for process
- pinfo structure.
- (pinfo::record_death): Don't call locking functions.
- (cygwin_winpid_to_pid): Simplify by using new pinfo constructor.
- (EnumProcessesW95): New function for iterating over processes on
- Windows 95.
- (winpids::winpids): New constructor for winpids class. Sets up a list
- of process ids.
- (enum_init): Initialize w95/wnt pid enumerators.
- * shared.cc (shared-info::initialize): Remove pid initialization.
- * shared.h: Move pinfo stuff into pinfo.h.
- (class shared_info): Remove pinfo_list element.
- * signal.cc (kill_worker): Use pinfo constructor to access process
- info.
- (kill_pgrp): Ditto. Use winpids methods to access list of processes.
- * sigproc.cc: Throughout, modify to use _pinfo where appropriate.
- (proc_exists (pid_t)): New function. Determines if a process exists
- based on the pid.
- (proc_exists (_pinfo *p): Use new proc_exists function above.
- (proc_subproc): Copy pinfo stuff around rather than _pinfo pointers.
- Try to be careful about releasing shared memory when we don't need it
- anymore. Remove pinfo locks.
- (remove_zombies): Remove pinfo memory when zombie is going away.
- * sigproc.h: Reflect _pinfo/pinfo changes in sigproc.cc.
- * spawn.cc (spawn_guts): Eliminate pinfo *child argument. Reorganize
- to only initialize child pinfo after process has been started and we
- know the windows pid.
- (_spawnve): Reflect spawn_guts changes.
- * syscalls.cc (setpgid): Use pinfo constructor to access process info.
- (getpgid): Ditto.
- (internal_getlogin): Use _pinfo.
- * winsup.h: Eliminate pinfo_mutex. Eliminate spawn_guts declaration
- since it is static now. Reflect set_myself argument change.
- * include/sys/cygwin.h: Add some PID_* enums to accommodate new pinfo
- stuff.
-
-Sat Jul 29 12:13:27 2000 Christopher Faylor <cgf@cygnus.com>
-
- * include/cygwin/version.h: Update minor version for cygdrive changes
- below.
-
-Sat Jul 29 11:59:29 2000 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (parse_thing): Make binmode a DWORD.
- * hinfo.cc (hinfo::init_std_file_from_handle): Use 'binmode' to
- determine default open mode.
- * winsup.h: Declare binmode.
-
-Sat Jul 29 00:16:35 2000 Christopher Faylor <cgf@cygnus.com>
-
- * include/cygwin/cygwin_dll.h: Update for modern compilers.
- * lib/cygwin_crt0.c: Inexplicably need to define alloca for newer
- compilers.
- * fhandler.h (fhandler_console): Add new method.
- * fhandler.cc (fhandler_console::set_cursor_maybe): New method.
- (fhandler_console::read): Set cursor if it has moved to make it
- visible.
-
-Thu Jul 27 22:54:28 2000 Jason Tishler <jt@dothill.com>
-
- * dcrt0.cc (dummy_autoload): Add load statement for RegDeleteValueA.
- * external.cc (get_cygdrive_prefixes): New function.
- (cygwin_internal): Add CW_GET_CYGDRIVE_PREFIXES case.
- * path.cc (mount_info::read_cygdrive_info_from_registry): Read system
- cygdrive prefix if user one is undefined.
- (mount_info::write_cygdrive_info_to_registry): Write cygdrive prefix to
- the appropriate registry hive. Overwrite in-memory copy of cygdrive,
- if appropriate.
- (mount_info::remove_cygdrive_info_from_registry): New method.
- (mount_info::get_cygdrive_prefixes): New method.
- (cygwin_umount): Remove cygdrive prefix, if appropriate.
- * registry.cc (reg_key::killvalue): New method.
- * shared.h (class reg_key): Add killvalue,
- remove_cygdrive_info_to_registry, and get_cygdrive_prefixes
- declarations.
- * include/sys/cygwin.h (cygwin_getinfo_types): Add
- CW_GET_CYGDRIVE_PREFIXES.
-
-Thu Jul 27 23:33:32 2000 Christopher Faylor <cgf@cygnus.com>
-
- * include/cygwin/version.h: Bump DLL minor version number to 4.
-
-2000-07-27 DJ Delorie <dj@redhat.com>
-
- * testsuite/winsup.api/winsup.exp: ignore stdout by default
- * testsuite/winsup.api/crlf.c: non-verbose by default
-
- * winsup.h: prune out windows headers we don't normally need
- * assert.cc: add wingdi.h and winuser.h
- * fhandler_console.cc: ditto
- * fhandler_windows.cc: ditto
- * select.cc: ditto
- * spawn.cc: ditto
- * strace.cc: ditto
- * tty.cc: ditto
- * window.cc: ditto
- * hinfo.cc: add winsock.h
- * syscalls.cc: add winnls.h
- * uinfo.cc: ditto
-
-Thu Jul 27 10:24:36 2000 Egor Duda <deo@logos-m.ru>
-
- * fhandler.cc (fhandler_disk_file::fstat): Allow block calculation to
- succeed for files >= 2GB and <= 4GB.
-
-Wed Jul 26 16:05:04 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (signal_exit): Renamed from "really_exit". Always sets
- EXIT_SIGNAL bit and reorganizes exit value for backwards cygwin
- handling.
- (handle_exceptions): Call signal_exit. Set "core dumped" bit.
- (sig_handle): Call signal_exit. Set "core dumped" bit appropriately.
-
-Wed Jul 26 20:44:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * environ.cc (posify): Revert previous patch.
- (_addenv): Remove check_null_empty_path from here.
- (putenv): Call check_nullempty_path.
- (setenv): Call check_nullempty_path for name as well here.
- Don't report an error if value is empty string.
- (environ_init): Revert usage of newp.
-
-Wed Jul 26 14:32:38 2000 Egor Duda <deo@logos-m.ru>
-
- * syscalls.cc (stat_worker): Make stat return correct st_blocks for
- files with size bigger than 2Gb and less than 4Gb
-
-Wed Jul 26 17:43:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (lookup_name): Search on local machine first if
- myself->domain is not empty.
-
-2000-07-26 DJ Delorie <dj@cygnus.com>
-
- * fhandler_console.cc (fhandler_console::read): Explicitly set cursor
- to make it visible while waiting in WaitForMultipleObjects.
-
-Wed Jul 26 10:59:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * passwd.cc: Change name of passwd_in_memory_p to passwd_state.
- Change type to enum. Change storage class to static. Adjust comments.
- (read_etc_passwd): Set passwd_state to different values when loaded
- from file in contrast to being emulated.
- (search_for): Return default passwd entry if passwd is emulated or
- it's a request for the current user. Otherwise return NULL.
-
-Tue Jul 25 21:50:42 2000 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (statfs): Use path_conv method to convert input path.
-
-Tue Jul 25 21:40:51 2000 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (_link): Avoid extraneous call to
- cygwin_conv_to_win32_path.
-
-Tue Jul 25 21:11:15 2000 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (_addenv): New function. Subsumes functionality of
- putenv/setenv. Does not allocate space for putenv case.
- (putenv): Use _addenv to add a value to the environment.
- (setenv): Ditto.
- (environ_init): Don't malloc space for each entry in the environment
- table. Just use the space from GetEnvironmentStrings.
- (posify): Don't free the src argument since it is no longer malloced.
-
-Mon Jul 24 21:10:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * syscalls.cc (_link): Corrected previous patch.
-
-Mon Jul 24 13:26:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.h (class fhandler_dev_random): Add members for managing
- pseudo randomness.
- * fhandler_random.cc: Rearrange. Use pseudo random number generator
- as entropy source if system entropy isn't available and if device is
- used as /dev/urandom. Allow initializing device by calling write().
-
-Sun Jul 23 23:11:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.h: Add comment.
-
-Sun Jul 23 20:00:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.h (class fhandler_dev_raw): Add private member `varblkop'
- to be set when variable blocksize mode is on.
- * fhandler_raw.cc: Eliminate `\n' from trace output.
- (clear): Set `varblkop' to 0.
- (dup): Copy varblkop as well.
- (writebuf): Care for variable blocksize.
- (open): Ditto.
- (raw_read): Ditto.
- (raw_write): Ditto.
- * fhandler_tape.cc (open): Ditto.
- (ioctl): Ditto. Some cleanups.
-
-Sat Jul 22 18:40:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- Patch suggested by Kazuhiro Fujieda <fujieda@jaist.ac.jp>.
- * winsup.h: Add new macros sys_wcstombs and sys_mbstowcs.
- * syscalls.cc (_link): Replace calls to mbstowcs by call to
- sys_mbstowcs.
- * uinfo.cc (internal_getlogin): Replace calls to wcstombs and
- mbstowcs by calls to sys_wcstombs and sys_mbstowcs. Replace
- usage of constants by meaningful defines. Use result of
- GetSystemDirectory for HOMEPATH and HOMEDRIVE as a last resort.
-
-Fri Jul 21 21:33:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * spawn.cc (span_guts): Retrieve security attributes before setting
- psid to NULL.
-
-Fri Jul 21 12:03:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (acl_worker): Use stat_suffixes in call to path_conv
- just as in `stat_worker'.
-
-Wed Jul 19 22:24:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * spawn.cc (spawn_guts): Don't restore impersonation in case
- of _P_OVERLAY. Clean up slightly. Accommodate comments.
-
-Wed Jul 19 22:11:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * shared.h (class pinfo): New members `root' and `rootlen'.
- * syscalls.cc (chroot): Set new root for process.
- * path.cc (getcwd_inner): Add parameter to force use of
- new root from chroot() call.
- (ischrootpath): New macro.
- (normalize_posix_path): Care for changed root dir.
- (normalize_win32_path): Ditto.
- (getcwd_inner): Ditto.
- (chdir): Eliminate trailing path component consisting
- entirely of dots.
- * fork.cc (fork): Copy pinfo members regarding chroot().
- * spawn.cc (_spawnve): Ditto.
- * dir.cc (opendir): Don't use computed win32 path if
- chroot() took place.
-
-Mon Jul 17 22:21:34 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dll_init.cc (dll_list::alloc): Fix debugging output.
-
-Mon Jul 17 14:57:53 2000 Christopher Faylor <cgf@cygnus.com>
-
- Throughout, eliminate third argument to path_conv and use new PC_*
- constants for second argument.
- * dcrt0.cc (dll_crt0_1): Reorganize to allow more initialization prior
- to returning due to dynamic loading.
- * path.h: Generalize SYMLINK_* constants to PC_*.
- (path_conv): Create a new method. Fold third argument into second.
- * dll_init.cc (dll_list::alloc): Try harder to find space to allocate
- dll struct.
- (dll_dllcrt0): Don't check sanity if we've already called dll_crt0.
- * path.cc (path_conv::check): Don't check for a null or empty path
- unless specifically told with a flag setting.
- (check_null_empty_path): New function, adapted from macro.
- * syscalls.cc (_rename): Use already-determined file attributes rather
- than checking again.
- * lib/cygwin/cygwin_attach.dll.c (cygwin_attach_dll): Use a static
- per_process structure since this is apparently supposed to be zeroed.
- * lib/cygwin_crt0.c (cygwin_crt0): Zero per_process structure sent to
- older DLLs.
-
-Mon Jul 17 19:39:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- Patch suggested by Eric Fifer <EFifer@sanwaint.com>
- * poll.cc (poll): Fix erroneous negations.
-
-Mon Jul 17 17:56:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * environ.cc (setenv): Use __cygwin_environ instead of
- environ after reallocating environment space.
-
-Sun Jul 16 20:23:21 2000 Christopher Faylor <cgf@cygnus.com>
-
- * _cygwin_crt0_common.cc: Undef 'environ' or suffer compiler error.
-
-Sun Jul 16 16:03:00 2000 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc: Use new definition of "environ" throughout.
- (environ_init): Explicitly initialize __cygwin_environ.
- (cur_environ): New function. Detects when user has updated
- their environment.
- * exec.cc: Use 'environ' define throughout rather than __cygwin_environ.
- * spawn.cc: Ditto.
- * winsup.h: Declare cur_environ, main_environ, environ.
-
-Sun Jul 16 13:23:04 2000 Christopher Faylor <cgf@cygnus.com>
-
- * acconfig.h: Add support for NEWVFORK.
- * config.h.in: Ditto.
- * configure.in: Add --enable-vfork option.
- * configure: Regenerate.
- * dcrt0.cc (quoted): Detect and fix up quoted backslashes.
- * sigproc.cc (proc_subproc): Correctly name handle of newly added child
- process to avoid erroneous debugging messages about closing the wrong
- handle.
-
-Sun Jul 16 02:30:09 2000 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (spawn_guts): Use \ for quoting '"'.
- * dcrt0.cc (quoted): Understand \ quoting for '"'.
-
-Sun Jul 16 00:32:58 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (build_argv): Strip quotes from argv[0] since it should
- never be globified.
-
-Sat Jul 15 00:32:41 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dll_init.cc (dll_list::alloc): Round correctly. Use VirtualAlloc
- since shared file mapping is unnecessary.
- (dll_list::detach): Release memory via VirtualFree since there we no
- longer use shared file mapping.
-
-Fri Jul 14 22:40:22 2000 Christopher Faylor <cgf@cygnus.com>
-
- * hinfo.cc (hinfo::linearize_fd_array): Make max_used_fd an int so that
- we can detect when there are no fds to pass.
- * dcrt0.cc (host_dependent_constants::init): Revert Sat Mar 18 01:32:04
- 2000 change.
- (dll_crt0_1): Set "cygwin_finished_initializing" flag.
- (dll_crt0): Don't perform memcpy if uptr is already set to internal
- structure.
- (_dll_crt0): Remember location of programs envptr.
- * dll_init.h (per_module, dll, dll_list): Revamp.
- * dll_init.cc: Revamp. Use new classes.
- * fork.cc (fork): Use new revamped dll, dll_list, and per_module stuff.
- * environ.cc: Use __cygwin_environ throughout rather than the
- user_data->envptr.
- * exec.cc: Ditto.
- * spawn.cc: Ditto.
- * winsup.h: Declare update_envptrs, cygwin_finished_initializing.
- * lib/_cygwin_crt0_common.cc (_cygwin_crt0_common): Revert previous
- change.
- * lib/cygwin_attach_dll.cc (cygwin_attach_dll): Always pass in own
- per_process structure or we end up overwriting information from the
- main program.
-
-Wed Jul 12 00:46:00 2000 Christopher Faylor <cgf@cygnus.com>
-
- * debug.cc (thread_stub): Use impure_ptr in place of reent_data.
- * dll_init.cc (dll_dllcrt0): Replace erroneous use of local symbol with
- correct __cygwin_user_data->impure_ptr.
-
-Wed Jul 12 00:01:03 2000 Christopher Faylor <cgf@cygnus.com>
-
- * lib/_cygwin_crt0_common.cc (_cygwin_crt0_common): Don't reset
- environ if already set.
-
-Mon Jul 10 19:07:03 2000 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_console.cc (fhandler_console::read): Unicode interface
- to ReadConsoleInput only exists on W2K, so use workaround from
- Kazuhiro Fujieda <fujieda@jaist.ac.jp>.
-
-Mon Jul 10 11:30:00 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in (install): Install textmode.o as well as binmode.o.
- * fhandler_console.cc (fhandler_console::read): Use UNICODE when
- reading from the console and translate to ASCII from that.
-
-Sun Jul 9 21:52:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * spawn.cc (spawn_guts): Close handle `hToken' only if it's not
- copied from myself->token.
- * syscalls.cc (seteuid): Replace CopySid by memcpy which is foolproof
- here.
-
-Sun Jul 9 01:19:06 2000 Christopher Faylor <cgf@cygnus.com>
-
- * cygwin.din: Export _getmode and getmode to allow querying of binary
- state of an fd.
- * external.cc (cygwin_internal): Add handling of perfile_table setting.
- * fhandler.cc (perfile_table): New global.
- (fhandler_base::get_default_fmode): New method to return a file's
- default mode based on its name.
- (fhandler_base::open): Use get_default_mode method to determine a
- file's mode. Record file mode in file flags.
- * fhandler.h (fhandler_base): Declare get_default_fmode
- * syscalls.cc (getmode): New function.
- * sys/cygwin.h (__cygwin_perfile): New structure.
- (cygwin_getinfo_types): Move outside of WINVER conditional.
- (per_process): Move inside of WINVER conditional.
-
-Sat Jul 8 00:15:01 2000 Christopher Faylor <cgf@cygnus.com>
-
- * external.cc (cygwin_internal): Export __cygwin_user_data.
- * include/sys/cygwin.h: Allow definition of per_process even when not
- compiling with C++.
- (cygwin_getinfo_types): Add CW_USER_DATA.
- * lib/_cygwin_crt0_common.cc (_cygwin_crt0_common): Get
- __cygwin_user_data pointer from cygwin_internal. If it doesn't exist,
- return failure. Use either this pointer or passed in pointer
- throughout. Clear forkee.
- * lib/crt0.h: Accommodate argument changes to _cygwin_crt0_common.
- * lib/cygwin_attach_dll.c (cygwin_attach_dll): Reorganize to allow use
- of newer binaries with older DLLs. Detect older DLLs when
- _cygwin_crt0_common returns 0 and allocate space for a per_process
- structure on the stack.
- * lib/cygwin_crt0.c (cygwin_crt0): Ditto.
-
-Fri Jul 7 10:31:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * include/sys/cygwin.h: Hide internal data types in per_process
- when not __INSIDE_CYGWIN__.
-
-Wed Jul 5 18:56:58 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (__cygwin_user_data): Initialize.
- (dll_crt0_1): Eliminate user_data initialization.
- (dll_crt0): Set up impure_ptr_ptr for older executables.
- (cygwin_dll_init): Eliminate user_data initializations.
- (__api_fatal): Don't check for user_data initialization.
- * dll_init.cc (struct dll): Store entire contents of per_process rather
- than just a pointer.
- (add): Ditto.
- (initOneDll): Don't check for user_data initialization.
- (DllList::recordDll): Store contents of per_process argument.
- (DllList::detachDll): Pass address of per_process field.
- (DllList::initAll): Ditto.
- (DllList::doGlobalDestructorsOfDlls): Ditto.
- (DllListIterator::operator *): Ditto.
- (dll_dllcrt0): Default to __cygwin_user_data if arg is NULL.
- * include/sys/cygwin.h: Reorganize per_process to eliminate obsolete
- fields and accommodate new way of initializing.
- * lib/_cygwin_crt0_common: Initialize _impure_ptr from
- __cygwin_user_data.impure_ptr.
-
-2000-07-04 Vadim Egorov <egorovv@mailandnews.com>
-
- * exceptions.cc (try_to_debug): Prevent recursive spawning of JIT
- debugger. Treat special event from debugger as command to continue.
-
-Mon Jul 4 19:29:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * poll.cc (poll): Zero out `open_fds' as well.
-
-Mon Jul 4 1:22:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * include/cygwin/version.h: Bump API minor version to 24.
-
-2000-07-04 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * security.cc (read_sd): Eliminate OemToChar.
-
-Mon Jul 4 18:57:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * poll.cc: New file. Implement `poll' system call.
- * include/poll.h: Ditto.
- * include/sys/poll.h: Ditto.
- * Makefile.in: Add poll.o as dependency.
- * cygwin.din: Add poll and _poll symbols.
-
-2000-07-04 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * dcrt0.cc (dll_crt0_1): Eliminate SetFileApisToOEM and CharToOem.
- * (dummy_autoload): Add functions used in fhandler_console.
- * fhandler_console.cc (fhandler_console::read): Use ENCHANCED_KEY flag
- to distinguish extended keys. Translate an input character from the
- OEM code page to the ANSI code page.
- * (fhandler_console::write_normal): Translate output characters from
- the ANSI code page to the OEM code page.
- * syscalls.cc (_link): Use MultiByteToWideChar instead of OemToCharW.
-
-Mon Jul 3 16:09:16 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (stack_info::walk): Use method to find offset.
- (handle_exceptions): Be more assertive in finding ebp for use under
- W2K. Create a dummy stack frame for cases where program is dying and a
- stack dump is being output.
- (sig_handle): Fill out a GetThreadContext for use with a user-generated
- "core dump".
-
-Mon Jul 3 10:53:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * include/cygwin/socket.h: Remove SOCK_PACKET define since it's
- not supported by Windows sockets.
-
-Sun Jul 2 21:50:48 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (user32_init): Add primitive guard against concurrent
- attempts to call this function. Also add temporary debugging code to
- display a message if the function is called multiple times.
- (api32_init): Ditto.
-
-Sun Jul 2 10:39:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * winsup.h: Define MAX_SID_LEN and new MAX_HOST_NAME.
- * fork.cc (fork): Use above defines instead of numerical constants.
- * shared.cc (sec_user): Ditto.
- * shared.h (class pinfo): Ditto.
- * syscall.cc (seteuid): Ditto.
- * spawn.cc (_spawnve): Ditto. Eliminate conditional.
- (spawn_guts): Set child->uid = USHRT_MAX when user context will be
- changed in child process.
- * uinfo.cc (uinfo_init): Check for myself->uid instead of myself->psid
- to avoid reloading of /etc/passwd on process startup if ntsec is off.
- Use above defines instead of numerical constants.
- * security.cc: Move define for MAX_SID_LEN to winsup.h.
-
-Sun Jul 2 1:57:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * uinfo.cc (uinfo_init): Eliminate calls to read_etc_group()
- and read_etc_passwd().
-
-2000-06-28 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * assert.cc (__assert): Reduce dependency on newlib.
- * exec.cc: Eliminate unnecessary inclusion of ctype.h.
- * glob.c: Ditto.
- * hinfo.cc: Ditto.
- * init.cc: Ditto.
- * strace.cc: Ditto.
- * tty.cc: Ditto.
- * grp.cc (parse_grp): Eliminate atoi.
- * passwd.cc (grab_int): Ditto.
- * grp.cc (getgroups): Eliminate str{n,}casecmp.
- * path.cc (get_raw_device_number): Ditto.
- * path.cc (sort_by_native_name): Ditto.
- * spawn.cc (iscmd): Ditto.
- * uinfo.cc (internal_getlogin): Ditto.
-
-Sat Jul 1 11:43:32 2000 Christopher Faylor <cgf@cygnus.com>
-
- * binmode.c (cygwin_premain0): Fix erroneous clearing of bit.
- * textmode.c (cygwin_premain0): Ditto.
-
-Sat Jul 1 00:24:04 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (_dll_crt0): Renamed from dll_crt0 ().
- * winsup.h: Accommodate above change.
- * cygwin.din: Ditto.
- * lib/cygwin_crt0.c: Ditto.
-
-Fri Jun 30 23:21:40 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Use variables rather than configure constructs where
- appropriate.
- (LIBCOS): Find additional stub library stuff in their own subdirectory.
- * dcrt0.cc: Convert user_data pointer to static __cygwin_user_data
- area.
- (do_global_ctors): Check magic_bisquit for initialization.
- (dll_crt0_1): First group of premain functions prior to fd
- initialization. Run second group before calling main.
- (dll_crt0 ()): New function, called from new initialization code.
- (dll_crt0 (per_process *uptr)): Call new dll_crt0 () function on
- initialization.
- * debug.cc (thread_stub): Initialize bottom of stack with per-thread
- info.
- * environ.cc (parse_thing): Use binmode global to control
- CYGWIN=binmode behavior.
- * fhandler.cc (fhandler_base::open): Allow explicit setting of __fmode
- to O_BINARY or O_TEXT to override disk mount settings.
- * libcmain.cc: Move to lib subdirectory.
- * libccrt0.cc: Ditto.
- * dll_main.cc: Ditto.
- * dll_entry.cc: Ditto.
- * getopt.c: Ditto.
- * thread.cc (thread_init_wrapper): Call ExitThread explicitly rather
- than returning, as a preliminary step towards placing per thread info
- at the bottom of the stack.
- * winsup.h: Move per_process class to include/sys/cygwin.h. Declare
- new dll_crt0().
- * include/cygwin/version.h: Bump API minor version.
- * binmode.c: New file.
- * textmode.c: Ditto.
- * perthread.h: Ditto.
- * lib/_cygwin_crt0_common.cc: Ditto.
- * lib/crt0.h: Ditto.
- * lib/cygwin_attach_dll.c: Ditto.
- * lib/cygwin_crt0.c: Ditto.
- * lib/dll_entry.cc: Ditto.
- * lib/dll_main.cc: Ditto.
- * lib/getopt.c: Ditto.
- * lib/libcmain.c: Ditto.
- * lib/premain0.c: Ditto.
- * lib/premain1.c: Ditto.
- * lib/premain2.c: Ditto.
- * lib/premain3.c: Ditto.
-
-Wed Jun 28 19:36:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * syscalls.cc (seteuid): Initialize pi.token before calling
- internal_getlogin().
- * uinfo.cc (internal_getlogin): Use impersonation token instead
- of process token in case of active impersonation. Add some comments.
- (uinfo_init): Initializing myself->token and myself->impersonated
- before calling internal_getlogin(). Add some comments.
-
-Mon Jun 26 18:32:41 2000 Christopher Faylor <cgf@cygnus.com>
-
- * windows.cc (setitimer): Round up when < 1000 usecs.
-
-Mon Jun 26 17:34:54 2000 Christopher Faylor <cgf@cygnus.com>
-
- * hinfo.cc (hinfo::dup2): Eliminate compiler warning.
-
-Mon Jun 26 11:25:29 2000 Christopher Faylor <cgf@cygnus.com>
-
- * hinfo.cc (hinfo::dup2): Guard against out of bounds newfd.
-
-Sat Jun 24 23:43:06 2000 Christopher Faylor <cgf@cygnus.com>
-
- * grp.cc (read_etc_group): Open file in text mode.
- * pwd.cc (read_etc_passwd): Ditto.
- * shared.h: Bump PROC_MAGIC.
-
-Sat Jun 24 19:30:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fork.cc (fork): Fix error in copying SID pointer.
- * spawn.cc (_spawnve): Ditto.
- * passwd.cc: Remove static from `passwd_in_memory_p'.
- (read_etc_passwd): Remove static.
- * uinfo.cc: Move global declaration of `read_etc_group' and
- `group_in_memory_p' into `uinfo_init'.
- (internal_getlogin): Try to get SID from current process first.
- (uinfo_init): Don't set uid and gid if `myself' has a valid SID.
- Only load /etc/passwd and /etc/group in that case.
-
-Sat Jun 24 12:29:59 2000 Christopher Faylor <cgf@cygnus.com>
-
- * shared.cc (shared_info::initialize): Improve error message clarity.
- * mkvers.sh: Eliminate debugging output.
-
-Thu Jun 22 17:50:59 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Autogenerate cygwin.def when appropriate.
- * include/sys/cygwin.h: Correct prototype.
-
-Thu Jun 22 17:05:04 2000 Christopher Faylor <cgf@cygnus.com>
-
- * include/sys/cygwin.h: Don't define parts of this file that rely on
- Windows headers unless the Windows header was previously included.
-
-Thu Jun 22 20:45:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * registry.cc (load_registry_hive): Use HKEY_USERS when checking
- for existing user hive.
- Use MAX_PATH instead of numerical constant for array size.
- Use return code of RegLoadKeyA instead of GetLastError for error output.
-
-Thu Jun 22 14:27:04 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Add new-libcygwin.a back to all_host target.
-
-Wed Jun 21 14:32:42 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Add *.def to clean operation.
-
-Wed Jun 21 13:18:23 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Add *.exe to clean operation.
-
-Wed Jun 21 01:02:38 2000 Christopher Faylor <cgf@cygnus.com>
-
- * mkvers.sh: Fix sed usage for older seds.
-
-Tue Jun 20 20:46:28 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Don't touch winver_stamp if mkvers.sh was unsuccessful.
-
-Tue Jun 20 17:41:30 2000 Christopher Faylor <cgf@cygnus.com>
-
- * mkvers.sh: Fix problem with handling of CVS tags causing .rc syntax
- errors.
-
-Tue Jun 20 13:38:12 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Change to build the DLL during a cross-compiler build.
-
-Mon Jun 19 20:46:33 2000 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (socket_cleanup): Shutdown I/O on dummy sockets prior to
- closing them.
-
-Mon Jun 19 19:35:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * dcrt0.cc: Add load statements for `GetSidIdentifierAuthority'
- and `RegLoadKeyA'.
- * registry.cc (get_registry_hive_path): New function.
- (load_registry_hive): Ditto.
- * security.cc (convert_sid_to_string_sid): New function.
- (get_ssid): Renamed to `convert_string_sid_to_sid'.
- (get_pw_sid): Call `convert_string_sid_to_sid' instead of `get_ssid'.
- (get_gr_sid): Ditto.
- (get_admin_sid): Ditto.
- (get_system_sid): Ditto.
- (get_creator_owner_sid): Ditto.
- (get_world_sid): Ditto.
- * shared.h: New prototypes for `get_registry_hive_path' and
- `load_registry_hive'.
- * spawn.cc (spawn_guts): Set child->psid to NULL to force calling
- `internal_getlogin' from child process in case of changing user context.
- Call `load_registry_hive' in case of changing user context.
- (_spawnve): Copy user infos only if user context remains the same.
- * uinfo.cc: Add load statement for `NetUserGetInfo'.
- Remove load statement for `NetGetDCName'.
- (internal_getlogin): Rewrite to speed up process startup
- and to correct user environment in case user context changes.
- (uinfo_init): Call internal_getlogin only if myself->psid is NULL,
- that is user context changes.
- * winsup.h: Add prototypes for `convert_sid_to_string_sid',
- `convert_string_sid_to_sid' and `get_pw_sid'.
-
-Sun Jun 18 13:42:50 2000 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h (set_name): Don't use 'unix' as name since this is defined
- by gcc now.
- * fhandler.cc (set_name): Ditto.
-
-2000-06-17 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * winsup.h (isabspath): Don't report `C:foo' as an absolute path.
-
-Sat Jun 17 13:51:48 2000 Christopher Faylor <cgf@cygnus.com>
-
- * configure.in: Detect "cross-hosting" situation and set appropriate
- variables in Makefile to avoid building excess stuff.
- * configure: Regenerate.
- * Makefile.in: Accommodate above change.
-
-Sat Jun 17 19:52:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * pinfo.cc (pinfo_init): Revert previous patch.
-
-Sat Jun 17 13:29:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * pinfo.cc (pinfo_init): Add missing initializers.
- * uinfo.cc (internal_getlogin): Request domain infos only
- when ntsec is ON.
-
-Fri Jun 16 19:27:27 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Just use library files from this tree when building
- cygrun.exe.
- * path.cc (chdir): Don't set cache to offending chdir. Change comment
- to reflect current reality.
-
-Fri Jun 16 20:55:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * cygwin.din: Define symbols for `cygwin_logon_user' and
- `cygwin_set_impersonation_token'.
- * dcrt0.cc (dll_crt0_1): Eliminate superfluous conditional
- statements.
- Add load statements for `ImpersonateLoggedOnUser', `LogonUserA'
- and `RevertToSelf'.
- * fork.cc (fork): Care for correct impersonation of parent
- and child process.
- * security.cc (cygwin_set_impersonation_token): New function.
- (cygwin_logon_user): Ditto.
- shared.h (class pinfo): New members `orig_uid', `orig_gid',
- `real_uid' nad `real_gid'.
- spawn.cc (spawn_guts): Care for impersonation when starting
- child process in a different user context.
- * syscalls.cc (setgid): Call `setegid' now. Set real_gid.
- (setuid): Call `seteuid' now. Set real_uid.
- (seteuid): Functionality moved from setuid to here. Care for
- correct impersonation.
- (setegid): Functionality moved from setgid to here.
- * uinfo.cc (uinfo_init): Initialization of additional pinfo
- members.
- (getuid): Return real uid.
- (getgid): Return real gid.
- (geteuid): Return effective uid.
- (getegid): Return effective gid.
- include/sys/cygwin.h: Add prototypes for `cygwin_logon_user' and
- `cygwin_set_impersonation_token'.
- include/cygwin/version.h: Bump API minor version to 22.
-
-Thu Jun 15 15:43:50 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (normalize_posix_path): Convert path to POSIX if it seems to
- be a Windows path.
-
-2000-06-15 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * path.cc (mount_info::add_item): Eliminate a trailing backslash
- included in a native path starting with '//[A-Za-z]/...'.
- * path.cc (mount_info::del_item): Accept a native path as its target.
-
-Wed Jun 14 23:47:19 2000 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (conv_envvars): Detect and convert all environment
- variables used by libiberty's choose-temp.c
-
-Tue Jun 13 12:41:41 2000 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * path.cc (mount_info::add_item): The previous patch can't handle
- the case of overwriting a mount entry.
-
-Tue Jun 13 00:17:04 2000 Christopher Faylor <cgf@cygnus.com>
-
- * thread.h: Shorten "current_directory" variables to "cwd_*"
- throughout.
- * path.cc: Ditto.
- (normalize_posix_path): Add some extra debugging info.
- (chdir): Ditto. Store chdir'ed posix and MS-DOS directory names in
- "cache" here rather than trying to derive them later.
-
-Sun Jun 11 15:57:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_random.cc (read): Call CryptAquireContext with
- CRYPT_VERIFYCONTEXT.
-
-Thu Jun 8 22:49:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * path.cc (path_conv::check): Erase two lines checked in
- by mistake.
-
-Thu Jun 8 15:53:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_disk_file::open): Check for directory
- to set O_DIROPEN on directories anyway.
-
-2000-06-07 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * path.cc (mount_info::init): Eliminate the mount_slash feature.
- (mount_slash): Eliminated.
- (mount_info::read_mounts): Eliminate looking up existing entries. The
- loop for deleting cygpath entries is done only when such entries exist.
- (mount_info::from_registry): Eliminate sorting.
- (mount_info::add_item): Call add_reg_mount if necessary. Check nmounts
- more precisely. Use strcasematch in looking up existing entries.
- (mount_info::del_item): Call del_reg_mount if necessary. Use
- strcasematch. Use memmove instead of memcpy.
- (mount_info::import_v1_registry): Everything is done in this method.
- (mount_info::to_registry): Eliminated.
- (mount_info::from_v1_registry): Eliminated.
- (cygwin_umount): Simply call del_item.
- * shared.h: Modify the declaration of add_item and del_item. Remove the
- declaration of from_v1_registry.
-
-Wed Jun 7 23:56:10 2000 Christopher Faylor <cgf@cygnus.com>
-
- * include/cygwin/version.h: Bump DLL minor version number to 3.
-
-2000-06-07 DJ Delorie <dj@cygnus.com>
-
- * cygwin.din: add cygwin_dll_init
- * dcrt0.cc (cygwin_dll_init): new
- (dll_crt0_1): short circuit if manually loaded
- * path.cc (mount_info::init): don't init if manually loaded
-
-Wed Jun 7 13:47:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * include/netinet/in_systm.h: New file.
- * include/cygwin/in_systm.h: Ditto.
-
-Thu Jun 1 01:55:45 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc: Remove unneeded include.
- * dcrt0.cc: Wrap LoadDLLfunc stuff in dummy function.
- * init.cc: Ditto.
- * uinfo.cc: Ditto.
-
-2000-05-31 DJ Delorie <dj@cygnus.com>
-
- * include/cygwin/version.h: use decimal, NOT octal
-
-Wed May 31 16:40:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_disk_file::open): Check for executable
- even if ntsec is on if filesystem doesn't support ACLs.
-
-Wed May 31 15:57:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * dcrt0.cc: Use LoadDLLfuncEx for loading Crypto API functions
- with parameter `notimp' set to 1.
-
-Tue May 30 16:58:33 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (mount_info::conv_to_win32_path): Previous patch was too
- aggressive in adding a trailing slash.
-
-Mon May 29 20:31:01 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Remove libadvapi32.a.
- * autoload.h: Add additional field to autoload block for handling
- unimplemented functions.
- (LoadDLLfuncEx): New function which accepts additional parameter for
- controlling unimplemented function behavior.
- (LoadDLLfunc): Use LoadDLLfuncEx.
- * dcrt0.cc: Use new arguments for LoadDLLfunc. Add advapi32 routines.
- (noload): Rewrite in assembler. Handle new unimplemented function
- type.
- * exceptions.cc: Eliminate another vestige of StackWalk stuff.
- * net.cc: Use new arguments for LoadDLLfunc.
- * uinfo.cc: Ditto.
-
-Mon May 29 20:18:47 2000 Christopher Faylor <cgf@cygnus.com>
-
- * config.h.in: Remove obsolete define.
- * path.h (isdrive): New macro.
- * dcrt0.cc (globify): Use new macro to determine if a string refers to
- an MS-DOS drive.
- * environ.cc (winenv): Ditto.
- * spawn.cc (find_exec): Ditto.
- * path.cc (get_raw_device_number): Ditto.
- (mount_info::conv_to_posix_path): Ditto.
- (chdir): Ditto.
- (cygwin_posix_path_list_p): Ditto.
- (cygwin_split_path): Ditto.
- (path_conv::check): Move tmp_buf to beginning of function since it can
- be used earlier in the loop. Use tmp_buf rather than 'root' to hold
- root information.
- (mount_info::conv_to_win32_path): Add trailing slash to end of mount
- path when it translates to a drive. Add defensive code to avoid
- writing beyond the end of 'dst'.
-
-Sat May 27 15:57:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_random.cc (read): Use CRYPT_MACHINE_KEYSET in
- call to CryptAcquireContext() to serve users that did not
- log in interactively.
-
-Fri May 26 11:16:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * errno.cc (errmap): Map ERROR_BAD_NET_NAME to errno ENOSHARE.
-
-Fri May 26 02:23:35 2000 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.h (sigframe::set): Accept a default frame pointer.
- * sigproc.cc (sig_send): Use passed in frame pointer, if appropriate.
-
-Thu May 25 17:44:25 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dir.cc (rmdir): Use file attributes that have already been discovered
- by path_conv.
-
-2000-05-25 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * dir.cc (rmdir): Correct the manner in checking the target directory.
-
-Wed May 24 21:59:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * dir.cc (writable_directory): Comment out previous code,
- return always 1 for now.
- (mkdir): Call set_file_attribute explicitely with S_IFDIR mode bit.
- * syscalls.cc (chown_worker): Ditto.
- (chmod): Ditto.
- * security.cc (get_nt_attribute): Fix error in debug output.
- Never set FILE_DELETE_CHILD for files.
- Construct appropriate inherit attribute according to file type.
-
-2000-05-23 DJ Delorie <dj@cygnus.com>
-
- * syscalls.cc (_cygwin_istext_for_stdio): New, for newlib
- * include/cygwin/version.h: Bump API number for detect old
- programs using old getc/putc macros
-
-2000-05-23 DJ Delorie <dj@cygnus.com>
-
- * dir.cc (writable_directory): handle root directories
-
-Tue May 23 10:09:26 2000 Christopher Faylor <cgf@cygnus.com>
-
- * uname.cc (uname): Use a "s" to denote a snapshot to avoid confusion
- with the number "5".
-
-Tue May 23 10:01:07 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (mount_info::conv_to_posix_path): Avoid putting a trailing
- slash on a directory name when the ms-dos path spec is a root directory
- of a device.
- * registry.cc (reg_key::build_reg): Set 'key_is_invalid' flag rather
- than using an INVALID_HANDLE_KEY.
- (reg_key::get_int): Test for key validity before performing registry
- operations.
- (reg_key::set_int): Ditto.
- (reg_key::get_string): Ditto.
- (reg_key::set_string): Ditto.
- (reg_key::kill): Ditto.
- (reg_key::~reg_key): Ditto.
-
-Tue May 23 01:13:33 2000 Christopher Faylor <cgf@cygnus.com>
-
- * mkvers.sh: Use snapshot date as build date since it is more
- interesting.
- * uname.cc (uname): Detect if this is a snapshot build and add an "S"
- to the version number. Report the snapshot date as the release date.
-
-Mon May 22 17:11:25 2000 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (regopt): Scan HKLM if HKCU scan fails.
-
-Mon May 16 23:39:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * dir.cc (rmdir): Care for misleading error messages
- when trying to remove a directory on a samba share.
- Eliminate superfluous else branch.
- * syscalls.cc (_rename): Additional check for ERROR_FILE_EXISTS
- if MoveFile fails.
-
-Sun May 21 20:51:44 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (dll_crt0_1): Move uinfo_init call to before sigproc_init to
- avoid a race.
- (noload): Add an extra argument for debugging.
- * uinfo.cc (uinfo_init): Eliminate test for multiple calls.
- (getlogin): Assume that uinfo_init has already been called.
-
-Sat May 20 01:34:57 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (interruptible): Add an argument to control whether
- function just checks for validity. Flag module handle == 0 as
- noninterrupible.
- (call_handler): Always acquire and release ebp lock. Loop for only a
- fixed amount of time attempting to grab mutos and find an interruptible
- PC.
-
-2000-05-19 DJ Delorie <dj@cygnus.com>
-
- * syscalls.cc (setmode): change mode of any matching FILE* also.
-
-Thu May 18 17:28:19 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Remove external.h dependency.
- * dcrt0.cc (sigthread::init): Move here from sigproc.h.
- * sigproc.h (sigthread): Move init to dcrt0.cc.
-
-Thu May 18 01:28:02 2000 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (thread_pipe): Add paranoid check to ensure thread
- termination.
- * external.cc: Eliminate obsolete include.
- * getopt.c (getopt_long): Fix compiler warning.
- * shared.h: Moved PID_ definitions to include/sys/cygwin so that they
- can be used by external programs.
- * include/sys/cygwin.h: Move external definitions here. Include
- sys/resource.h to avoid having to do this everywhere.
-
-Thu May 18 01:04:02 2000 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.h (sigframe): Don't set frame info unless tid matches this
- thread id.
-
-Wed May 17 23:13:32 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (dll_crt0_1): Initialize mainthread stuff here before
- anything needs it.
- * sigproc.cc (sigproc_init): Move mainthread initialization out of
- here.
- * sigproc.h (sigthread): Add init() method.
- (sigframe): Don't try to initialize muto.
- * sync.cc: Undef WaitForSingleObject to avoid recursion.
-
-2000-05-17 DJ Delorie <dj@cygnus.com>
-
- * testsuite/winsup.api/crlf.c: New
- * testsuite/winsup.api/iospeed.c: New
-
-Wed May 17 01:05:52 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (mount_info::cygdrive_posix_path): Don't add trailing slash
- if referring to something like c:\.
- * dcrt0.cc (dll_crt0_1): Move uinfo initialization prior to sig_send
- initialization to give signal thread a chance to finish.
- * debug.cc (WFSO): Move to sigproc.cc
- (WFMO): Ditto.
- * exceptions.cc (interruptible): Allocate slightly more space for
- directory just for paranoia's sake.
- (call_handler): Eliminate nonmain argument. Determine if main thread
- has set a frame pointer and use it if so.
- (sig_handle): Eliminate nonmain argument.
- * net.cc: Record frame information in appropriate routines throughout.
- * select.cc (select): Ditto.
- * sigproc.cc: Use sigthread structure to record mainthread id
- throughout.
- (sig_send): Record frame information for signal handler.
- (wait_sig): Reflect argument change in sig_handle.
- (WFSO): Move here and record frame information for signal handler.
- (WFMO): Ditto.
- * sigproc.h: Implement new "sigthread" class. Implement "sigframe"
- class for manipulating signal frame info.
- * thread.cc (__pthread_kill): Use standard _kill() function rather than
- calling sig_send directly.
- * winsup.h: Eliminate ebp element from signal_dispatch class.
-
-Tue May 16 23:39:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- Patch suggested by John Rowley <wjr@bgs.ac.uk>
- * fhandler_tape.cc (fhandler_dev_tape::ioctl): Check
- for filemark feature on MTWEOF operation.
-
-Tue May 16 11:49:13 2000 Christopher Faylor <cgf@cygnus.com>
-
- * include/cygwin/in.h (AF_INET6): Use correct in6_addr struct.
-
-Mon May 15 00:35:35 2000 Christopher Faylor <cgf@cygnus.com>
-
- * include/cygwin/version.h: Bump DLL minor version number to 2.
-
-Sun May 14 23:41:24 2000 Christopher Faylor <cgf@cygnus.com>
-
- * shared.h: Bump PROC_MAGIC.
- * include/cygwin/version.h: Bump API minor to accommodate two recent
- exports.
-
-2000-05-13 Mumit Khan <khan@xraylith.wisc.edu>
-
- * include/cygwin/socket.h (AF_INET6): Use same value as winsock2.
-
-2000-05-12 Mumit Khan <khan@xraylith.wisc.edu>
-
- * include/cygwin/in.h (struct in6_addr): Fix spelling.
- * include/cygwin/socket.h (AF_INET6, PF_INET6): Define macros.
- (AF_MAX, PF_MAX): Bump to 32 to leave room for future expansion.
-
-Fri May 12 21:35:54 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (build_argv): Remove unneeded variable.
- * select.cc (peek_pipe): Don't check for "ready" if it's already set.
- (peek_console): Ditto.
- (peek_serial): Ditto.
- (peek_socket): Ditto.
- (peek_windows): Ditto.
-
-Fri May 12 20:31:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_raw.cc (write_file, read_file): New wrapper functions
- for WriteFile and ReadFile to get rid of ERROR_MEDIA_CHANGED
- and ERROR_BUS_RESET in case of first access to tape.
- (fhandler_dev_raw::raw_write): Use write_file instead of WriteFile.
- (fhandler_dev_raw::raw_read): Use read_file instead of ReadFile.
-
-Fri May 12 01:04:57 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in (DLL_OFILES): Sort.
- * fhandler_tty.cc (fhandler_tty_slave::send_ioctl_request): Eliminate.
- (fhandler_tty_slave::ioctl): Rewrite to avoid races.
-
-2000-05-11 Mumit Khan <khan@xraylith.wisc.edu>
-
- * mmap.cc (list::erase): Increment loop counter.
- (map::erase): Likewise.
-
-Thu May 11 00:54:00 2000 Charles Wilson <cwilson@ece.gatech.edu>
-
- * cygwin.din: insure that regsub() is included in
- cygwin1.dll
-
-Tue May 9 18:59:41 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Use appropriate VARIABLE to refer to cygwin.def in load
- line.
-
-Thu May 9 23:53:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_base::puts_readahead): Change
- while condition to disallow wild runs.
-
-Thu May 9 15:24:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- Patch suggested by <lha@stacken.kth.se>
- * window.cc (setitimer): Check for overflow condition
- in tv_sec.
-
-Thu May 9 0:47:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- Patch suggested by Eric Fifer <EFifer@sanwaint.com>
- * errno.cc: Change mapping of ERROR_BAD_PATHNAME to ENOENT.
-
-Thu May 9 0:47:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * path.cc (symlink::info): Treat non readable files
- as normal non symlink files.
-
-2000-05-08 Paul K. Fisher <pfisher@plexware.com>
-
- * include/pthread.h (pthread_detach): Add missing prototype.
- (pthread_join): same.
-
-2000-05-08 DJ Delorie <dj@cygnus.com>
-
- * fhandler.cc (lock): use signed math to allow checking ranges
- properly.
-
-Sat May 6 23:22:25 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (insert_file): Eliminate unused parameter.
- (build_argv): Ditto.
- * exceptions.cc (stack): Eliminate unused parameters.
- (stackdump): Ditto.
- (cygwin_stackdump): Reflect above changes.
- (sig_handle): Ditto.
- * fhandler.cc (fhandler_base::set_inheritance): Use kludge to avoid
- unused parameter warning.
-
-2000-05-06 Mumit Khan <khan@xraylith.wisc.edu>
-
- * include/wchar.h (wcscmp, wcslen): Fix prototypes.
- * syscalls.cc (wcslen, wcscmp): Adjust.
-
-Fri May 5 23:32:07 2000 Christopher Faylor <cgf@cygnus.com>
-
- * errno.cc (errmap): Correct DIRECTORY mapping to ENOTDIR.
-
-2000-05-04 Mumit Khan <khan@xraylith.wisc.edu>
-
- * Makefile.in (install): Install profile startup and library.
-
-Wed May 3 21:54:11 2000 Christopher Faylor <cgf@cygnus.com>
-
- * configure.in: Use -gstabs+ as compile debug option. This seems to
- promote better handling of symbols.
- * configure: Regenerate.
- * delqueue.cc (delqueue_list::process_queue): Allow ERROR_ACCESS_DENIED
- to indicate that a file is being shared under Windows 95.
- * syscalls.cc (_unlink): Use full path name. Take special action for
- Windows 95. Assume that an ERROR_ACCESS_DENIED indicates a sharing
- violation unless it's on a remote drive. Punt if there is an
- ERROR_ACCESS_DENIED on a remote drive.
-
-Wed May 3 18:07:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * errno.cc (errmap): Map ERROR_BAD_NETPATH to new errno ENOSHARE.
- (_sys_errlist): Add entry for ENOSHARE.
- (strerror): Add case for ENOSHARE.
- * syscalls.cc (stat_worker): Check for errno ENOSHARE.
-
-Wed May 3 17:28:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * Makefile.in: Add dependencies for fhandler_random.o
- * fhandler.h: Add device type FH_RANDOM. Add class
- fhandler_dev_random.
- * fhandler_random.cc: New file. Implementation of
- fhandler_dev_random.
- * hinfo.cc (build_fhandler): Add case for FH_RANDOM.
- * path.cc: Add device names for random devices to
- windows_device_names.
- (get_device_number): Add if branch for random devices.
- (win32_device_name): Add device name generation for
- random devices.
- winsup.h: Include <wincrypt.h>.
-
-2000-05-02 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * path.cc (mount_info::conv_to_win32_path): Previous patch
- failed to set flags on a win32 path.
-
-Tue May 2 11:34:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (read_sd): Return 1 on success because we
- can't rely on the returned SD size from GetFileSecurity.
-
-Tue May 2 2:22:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * dcrt0.cc: Add dynamic load code for `OemToCharA' from user32.dll.
- * security.cc (read_sd): Call `OemToCharA' to make
- `GetFileSecurity' happy on filenames with umlauts.
-
-Wed Apr 26 23:23:23 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (normalize_win32_path): Don't add a trailing slash when one
- already exists.
- (mount_info::conv_to_win32_path): Use existing code for dealing with
- relative path names when input is already a win32 path.
-
-2000-04-26 DJ Delorie <dj@cygnus.com>
-
- * Makefile.in (install): install regexp.h
-
-Wed Apr 26 16:20:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * syscalls.cc (stat_worker): Previous patch could succeed
- in stating a non-existant file.
-
-Wed Apr 26 01:07:16 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (interruptible): Allocate slightly more space for
- directory name check. Windows 95 seems to null-terminate the directory
- otherwise.
- (interrupt_on_return): Issue a fatal error if we can't find the
- caller's stack.
-
-Tue Apr 25 16:50:54 2000 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (find_exec): Accept a path_conv argument rather than a
- buffer so that the caller can find things out about a translated path.
- (perhaps_suffix): Ditto.
- (spawn_guts): Allocate path_conv stuff here so that we can find out
- stuff about the translated path (this is work in progress).
- * environ.cc (environ_init): Accept an as-yet unused argument
- indicating whether we were invoked from a cygwin parent or not.
- (winenv): Ditto.
- (posify): Accept an argument indicating whether the path has already
- been translated.
- * dlfcn.cc (check_access): Provide a path_conv buffer to find_exec.
- * exec.cc (sexecvpe): Ditto.
- * path.cc (path_conv::check): Rename from path_conv::path_conv.
- (mount_item::getmntent): Recognize "Cygwin executable" bit.
- (symlink_info::check): Remove debugging statements.
- * path.h (class path_conv): Add iscygexec method. Rewrite constructor
- to call "check" method to allow multiple operations on a path_conv
- variable.
- * pinfo.cc (pinfo_init): Pass argument to environ_init.
- * shared.h: Bump PROC_MAGIC.
- * winsup.h: Reflect above changes to function arguments.
- * include/sys/mount.h: Add MOUNT_CYGWIN_EXEC type.
-
-Thu Apr 25 21:35:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * syscalls.cc (stat_worker): Previous patch failed to stat
- each drives root dir on 9X.
-
-Thu Apr 25 16:37:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_disk_file::open): Check for allow_ntsec
- when determining exec flag.
- * path.cc (symlink_info::check): Remove call to get_file_attribute().
- * security.cc (read_sd): Rename, ditto for variables to conform
- to common naming convention. Use GetFileSecurity() instead of
- BackupRead() to avoid permission problems when reading ACLs.
- (write_sd): Same renaming as for read_sd().
- (alloc_sd): Change default permissions according to Linux permissions
- for group and world when write permission is set.
- * syscalls.cc (stat_worker): Avoid different permission problems
- when requesting file informations.
-
-Thu Apr 25 10:50:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc: Avoid a warning in declaration inet_network.
-
-Mon Apr 24 17:38:25 2000 Thorsten Otto <t.otto@germanynet.de>
-
- * fhandler_console.cc (fhandler_console::read): Detect extended keycode
- information for Windows 9x so that function keys will work correctly.
-
-2000-04-24 Vadim Egorov <egorovv@mailandnews.com>
-
- * net.cc (cygwin_inet_network): new function.
- * cygwin.din (inet_network): new export
-
-Fri Apr 21 10:37:08 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (normalize_posix_path): Previous two patches were still
- incorrect so rewrite this function to deal with trailing dots.
- (mount_info::conv_to_win32_path): Just check for '/' where appropriate.
- Eliminate nofinalslash call since it is handled in normalize_posix_path
- now.
-
-Thu Apr 20 17:32:42 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (handle_exceptions): Search further for stack info to
- accommodate Windows 95.
-
-Thu Apr 20 16:39:18 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (normalize_posix_path): Previous change failed to take root
- access into account.
-
-Thu Apr 20 11:26:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * syscalls.cc (_link): Check new link path for trailing dot.
-
-Thu Apr 20 00:32:03 2000 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h (fhandler_base::hclose): New virtual method.
- (fhandler_base::set_inheritance): Make this a method so that we can use
- the appropriate close methods.
- * fhandler.cc (fhandler_base::set_inheritance): Ditto.
- * path.cc (normalize_posix_path): Eliminate /. trailing path
- component.
-
-Wed Apr 20 0:19:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * syscalls.cc (setuid): Allow switching user context after
- successful call to ImpersonateLogedOnUser (NT only).
- (setgid): Ditto.
- (seteuid): Call setuid.
- (setegid): Call setgid.
-
-Wed Apr 19 22:00:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * uinfo.cc (internal_getlogin): Use NetGetDCName() instead
- of NetGetAnyDCName().
-
-Mon Apr 17 12:08:47 2000 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * syscalls.cc (_rename): Try MoveFile() at first before
- MoveFileEx(..., MOVEFILE_REPLACE_EXISTING).
-
-Tue Apr 18 19:15:29 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (globify): Don't use \ quoting when apparently quoting a DOS
- path spec, even within a quoted string.
-
-Sun Apr 16 18:54:21 2000 Christopher Faylor <cgf@cygnus.com>
-
- * init.cc (dll_entry): Use better check for determining when to set
- thread specific stuff.
- * syscalls.cc (_unlink): Continue with chmod'ing file even if
- DELETE_ON_CLOSE succeeds, if file still exists.
-
-Fri Apr 14 23:51:15 2000 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_console.cc (keytable): Add support for keypad 5 key, which
- MS seems to think is equivalent to VK_CLEAR.
- * debug.cc (thread_stub): Eliminate initialization of reent stuff.
- * init.cc (dll_entry): Move it here.
-
-Thu Apr 13 18:32:26 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (insert_file): Avoid freeing previously allocated argument
- list.
- * path.cc (symlink_info::check): Rename from symlink_check_one. Use
- new symlink_info struct for communication.
- (path_conv::path_conv): Use symlink_info structure for communication
- with symlink_info::check. Fix typo which resulted in symbolic links
- always being resolved.
- (readlink): Use stat_suffixes array when resolving a link.
- * syscalls.cc (stat_suffixes): Make global.
-
-Thu Apr 13 20:50:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * include/cygwin/version.h: Bump minor api to reflect export change.
-
-Thu Apr 13 8:48:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * path.cc (conv_to_win32_path): Detect a win32 path
- if path contains backslashes.
- * cygwin.din: Add symbol for `lacl'.
- * security.cc (ReadSD): Add debug output.
- (acl_worker): New static function.
- (acl): Call acl_worker now.
- (lacl): New function.
- (facl): Call acl_worker now.
- * include/cygwin/acl.h: Add prototype for `lacl'.
-
-Wed Apr 12 18:48:33 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (path_conv::path_conv): Ensure that suffix is correctly
- copied to path when we've found a symlink but aren't following
- symlinks.
-
-Sat Apr 8 00:46:14 2000 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.cc (fhandler_disk_file::fstat): Allocate enough space for
- root dir determination or overflow an array.
-
-Sat Apr 8 00:08:53 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (sigsave): Copy on fork so that we can restore correct
- behavior in forked process.
- (interruptible): Flag as interruptible when running in main process
- module.
- (interrupt_setup): Save return address and address of return address.
- (signal_fixup_after_fork): New function. Uses above two values to
- restore proper behavior to forked process.
- (interrupt_on_return): Pass return address address to interupt_setup.
- (interrupt_now): Pass NULL for return address address to
- interrupt_setup.
- * fork.cc (fork): Call signal_fixup_after_fork.
- * shared.h: Lint cleanups.
- * winsup.h: Ditto.
-
-Mon Apr 3 14:10:44 2000 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h (select_stuff): Eliminate use of 'total'.
- * select.cc (cygwin_select): Ditto.
- (select_stuff::wait): Use maximum size for w4 rather than calculating
- what will fit.
-
-Mon Apr 03 13:58:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * grp.cc (parse_grp): Save empty array instead of
- NULL in gr_mem if no supplementary group is given.
-
-Sun Apr 02 16:02:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * syscalls.cc (chown_worker): Use previous uid/gid if
- new uid/gid is -1.
-
-Fry Mar 31 22:55:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * syscalls.cc (chown_worker): New static function with
- chown functionality.
- (chown): Call chown_worker with SYMLINK_FOLLOW.
- (fchown): New function. Call chown_worker with SYMLINK_FOLLOW.
- (lchown): New function. Call chown_worker with SYMLINK_IGNORE.
- * cygwin.din: Add symbols for fchown, lchown.
-
-Fry Mar 31 11:18:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * path.cc (symlink): Call `set_file_attribute()' and
- `SetFileAttributeA()' instead of `chmod()' to set
- uid/gid correct.
-
-Wed Mar 29 22:49:56 2000 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h (select_record): Explicitly zero elements of this class.
- (select_stuff): Ditto.
- * select.cc (cygwin_select): Eliminate memset zero of sel.
-
-Tue Mar 28 16:45:42 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Use default rules when compiling cygrun.o.
- * dcrt0.cc (host_dependent_constants::init): Limit non-NT platforms to
- 32K chunks when copying regions during a fork.
- * path.cc (symlink_check_one): Add temporary debugging output.
- Simplify PATH_EXEC test.
- * syscalls.cc (stat_suffixes): Null terminate this list.
-
-Sat Mar 25 20:46:39 2000 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (symlink_check_one): Recognize symlink settings from the
- mount table.
- * path.h: Make PATH_SYMLINK an alias for MOUNT_SYMLINK.
- * syscalls.cc (stat_worker): Use extension search mechanism in
- path_conv to look for .exe rather than trying to special case it here.
- * mount.h: Make MOUNT_SYMLINK a real option.
-
-Sat Mar 25 00:22:32 2000 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc: Add TMPDIR to the list of environment variables which are
- converted to POSIX format.
- * sigproc.cc (proc_terminate): Don't attempt to delete when a muto
- pointer is NULL.
-
-Sun Mar 19 12:01:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * syscalls.cc (stat_worker): Set st_nlink to 1 on remote drives.
-
-Sat Mar 18 23:04:27 2000 Christopher Faylor <cgf@cygnus.com>
-
- * times.cc: Fix extern declarations for variables that are exported but
- used by this modules.
-
-Sat Mar 18 01:32:04 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (host_dependent_constants::init): Eliminate DELETE flag
- from shared constant.
-
-Sat Mar 18 01:24:25 2000 Christopher Faylor <cgf@cygnus.com>
-
- * delqueue.cc (delqueue_list::queue_file): Add some debugging.
- * path.h (class path_conv): Add a char * operator for the most common
- case.
- * syscalls.cc (_unlink): Rewrite to use FILE_FLAG_DELETE_ON_CLOSE when
- possible (i.e., on NT).
-
-Fri Mar 17 18:16:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- Patch suggested by Eric Fifer <EFifer@sanwaint.com>
- * fhandler.cc (fhandler_base::open): Call set_file_attribute()
- only if a file is really created.
-
-Thu Mar 16 14:15:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (set_process_privileges): Remove `static'.
- (get_nt_attribute): Returns uid and gid additionally. Remove call
- to set_process_privileges().
- (get_file_attribute): Returns uid and gid additionally. Don't
- call ntea if ntsec is ON.
- (set_nt_attribute): Remove call to set_process_privileges().
- Don't call ntea if ntsec is ON.
- (acl): Remove call to set_process_privileges().
- * dcrt0.cc (dll_crt0_1): Call set_process_privileges().
- * winsup.h: New prototype for set_process_privileges(),
- changed prototype for get_file_attribute().
- * fhandler.cc (get_file_owner): Discard function.
- (get_file_group): Ditto.
- (fhandler_disk_file::fstat): Discard calls to get_file_owner() and
- get_file_group().
- * path.cc (path_conv::path_conv): New debugging output for result
- of GetVolumeInformation().
- (mount_info::conv_to_win32_path): Call backslashify() with pathbuf
- instead of src_path.
- * syscalls.cc (chown): Reformat slightly.
- (chmod): Replace get_file_owner() and get_file_group() calls
- by a call to get_file_attribute(). Discard local variable has_acls.
- Reformat slightly.
- (stat_worker): Root dir check now done by a call to rootdir().
- Don't call num_entries() on remote drives.
- Discard local variable has_acls.
-
-Wed Mar 15 20:38:06 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * errno.cc: Map ERROR_NOACCESS to EFAULT.
-
-Wed Mar 15 14:25:38 2000 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (spawn_guts): Restore dependency on signal_arrived. It's
- needed to wake up the WaitForSingleObject.
-
-Tue Mar 14 23:41:16 2000 Christopher Faylor <cgf@cygnus.com>
-
- Pipe changes throughout suggested by Eric Fifer <EFifer@sanwaint.com>
- * debug.cc (threadname_init): Pass name of lock as arg 2 of new_muto.
- * malloc.cc (malloc_init): Ditto.
- * sigproc.cc (sigproc_init): Ditto.
- * exceptions.cc (events_init): Ditto.
- (call_handler): Eliminate special case for hExeced. Report locked
- thread in debugging output.
- * fhandler.cc (fhandker_pipe::fhandler_pipe): Propagate device type to
- base class.
- * fhandler.h (fhandler_pipe): Ditto.
- * hinfo.cc (hinfo::build_fhandler): Pass specific type of pipe to
- constructor.
- * spawn.cc (spawn_guts): Eliminate dependency on signal when waiting
- for subprocess.
- * strace.cc: Remove obsolete #ifdef.
- * sync.cc (muto::muto): Save the name of the muto.
- (muto:~muto): Also release the muto.
- * sync.h: Add a muto name field.
- * select.cc (peek_pipe): Avoid doing a PeekNamedPipe on the write end
- of a pipe.
-
-Sun Mar 12 01:14:33 2000 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.cc (fhandler_base::get_readahead_into_buffer): New function.
- * fhandler.h: Declare new function. Add extra argument to
- process_slave_output.
- * fhandler_console.cc (fhandler_console::read): Move read ahead code to
- new function.
- * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Move
- common code here.
- (fhandler_tty_slave::read): Understand readahead.
- (fhandler_pty_master::read): Move code to process_slave_output.
- * select.cc (peek_pipe): Avoid performing certain checks when non-read
- and on inappropriate fh types.
-
-Sat Mar 11 22:47:43 2000 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_console.cc (fhandler_console::read): Don't even think about
- breaking on interrupt if executing in a "cygwin" thread.
- * fhandler_tty.cc (fhandler_pty_master::process_slave_output):
- Streamline, simplify code.
- * sigproc.cc (sig_send): Remove debugging statement.
-
-Fri Mar 10 13:20:50 2000 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc: Set wait_sig priority to normal.
-
-Fri Mar 10 13:03:06 2000 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (wait_sig): Add addtional debugging output.
-
-Thu Mar 9 15:25:01 2000 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc: Eliminate oldstack CYGWIN option.
- * exceptions.cc (sfta): Eliminate obsolete function.
- (sgmb): Eliminate obsolete function.
- (class stack_info): Remove MS method for walking the stack.
- (stack_info::init): Just initialize required fields.
- (stack_info::brute_force): Rename to stack_info::walk.
- (handle_exceptions): Pass derived frame pointer to sig_send.
- (interrupt_setup): Clear saved frame pointer here.
- (interrupt_on_return): thestack is no longer a pointer.
- (call_handler): Accept a flag to indicate when a signal was sent from
- other than the main thread. Use saved frame pointer for determining
- where to place signal handler call.
- (sig_handle): Accept "nonmain" argument. Pass it to call_handler.
- * fhandler_tty.cc (fhandler_tty_common::__acquire_output_mutex): Change
- debugging output slightly.
- * (fhandler_tty_common::__release_output_mutex): Ditto.
- (fhandler_tty_slave::read): Fix a comment, remove a goto.
- * sigproc.cc (sig_send): Accept an optional frame pointer argument for
- use when suspending the main process. sigcomplete_main is an autoreset
- event now. Save frame pointer for non-main operation.
- (wait_sig): Make sigcomplete_main an autoreset event. Eliminate
- NOSIGQUEUE. Pass rc to sig_handle to signify if this was a nonmain
- process.
- * sigproc.h: Reflect change to sig_send argument.
- * syscalls.cc (swab): Eliminate swab function since it is now available
- in newlib.
- * winsup.h (signal_dispatch): Change CONTEXT cx to DWORD ebp.
-
-Tue Mar 7 13:31:10 2000 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (sig_send): Eliminate sync_sig_send synchronization since
- it didn't seem to affect the "bash hangs" problem.
-
-Tue Mar 7 13:17:56 2000 Christopher Faylor <cgf@cygnus.com>
-
- * mcount.c: Remove strace.h include.
-
-Tue Mar 7 00:29:34 2000 Christopher Faylor <cgf@cygnus.com>
-
- Throughout use strace class in place of individual functions and
- variables.
- * cygwin.din: Eliminate _strace_wm.
- * sigproc.cc (wait_sig): Temporarily add more debugging output.
- * include/cygwin/version.h: Bump minor api to reflect export change.
-
-Sun Mar 5 01:17:05 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (call_handler): Streamline to use only one call to
- ResumeThread.
- * sigproc.cc (sig_send): Use a muto around the ReleaseSemaphore.
- Remove priority setting since it didn't solve anything.
-
-Tue Feb 29 00:46:09 2000 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (sig_send): Temporarily set priority to highest while
- sending a signal.
-
-Mon Feb 28 11:23:29 2000 Christopher Faylor <cgf@cygnus.com>
-
- * pinfo.cc (set_myself): Add build date to strace output.
-
-Mon Feb 28 11:17:30 2000 Eric Fifer <EFifer@sanwaint.com>
-
- * sigproc.cc (proc_subproc): Only clear wait event when not attending
- to a signal.
-
-Mon Feb 28 00:08:09 2000 Christopher Faylor <cgf@cygnus.com>
-
- * configure.in: Remove --enable-strace-hhmmss option.
- * configure: Regenerate.
-
-Sun Feb 27 23:11:57 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (set_os_type): Record OS name string.
- (getprogname): Eliminate obsolete function.
- (dll_crt0_1): Move initial strace initialization output to set_myself.
- * exceptions.cc (interruptible): Add debugging output.
- (interrupt_setup): New function.
- (interrupt_now): Use interrupt_setup to set up common interrupt handler
- stuff.
- (interrupt_on_return): Ditto.
- (call_handler): Move signal_arrived arm and clear threads to region
- where signalled thread is suspended or suffer races.
- * pinfo.cc (set_myself): Output interesting information when strace is
- first initialized. Initialize progname here.
- * sigproc.cc (sig_dispatch_pending): Modify to ensure that flush signal
- are sent synchronously.
- * strace.cc (strace_vsprintf): Move code into strace program.
- * uname.cc (uname): Use 'osname' global to construct cygwin name +
- Windows type + version.
-
-Fri Feb 25 19:26:42 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (interruptible): Make a little more structured.
- (call_handler): Allow signals to be sent even if signalled thread is
- stopped. Change order of signal_arrived arming/waiting threads
- clearing to eliminate a race.
- (reset_signal_arrived): New helper function.
- * malloc.cc (malloc_init): Use mutos so that signal handler can keep
- track of who owns the lock.
- (__malloc_lock): Ditto.
- (__malloc_unlock): Ditto.
- * sync.h (new_muto): Actually use a muto for the "buffer".
- * Makefile.in: Fix a dependency.
-
-2000-02-25 DJ Delorie <dj@cygnus.com>
-
- * Makefile.in: fix "make check" support and cygrun.
-
-Thu Feb 24 15:56:00 2000 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.c (_read): Clear errno before doing any read operation.
-
-Thu Feb 24 14:45:06 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (call_handler): Use new muto linked list to look for
- all potential mutos owned by suspended thread. Clear waiting threads
- while thread is stopped.
- (proc_subproc): Clarify debugging output.
- * sync.h (class muto): Add 'next' field.
- (new_muto): Keep linked list alive.
-
-Thu Feb 24 00:59:15 2000 Christopher Faylor <cgf@cygnus.com>
-
- Fix final round of gcc warnings relating to unused parameters.
- * debug.cc (iscygthread): New function.
- * debug.h: Declare it.
- * exceptions.cc (set_process_mask): Flush pending signals.
- (handle_sigsuspend): No need to flush pending signals.
- (call_handler): Refine previous tests of muto ownership. Only clear
- wait()'s when we have definitely responded to a signal.
- * fhandler_console.cc (fhandler_console::read): Don't set EINTR if
- executing in a "cygwin" thread.
- * sigproc.cc (proc_subproc): Use second argument to control whether
- CLEARWAIT actually sets "signalled" flag.
- * sync.h (muto): Add 'unstable' method.
-
-Wed Feb 23 21:59:44 2000 Christopher Faylor <cgf@cygnus.com>
-
- * hinfo.cc (hinfo::extend): Clean up debugging output.
-
-Wed Feb 23 21:34:58 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (interruptible): Change method for determining if
- something is interruptible.
- (call_handler): Avoid suspending a thread if it owns a muto. Only set
- signal_arrived if the thread was actually interrupted.
- (events_init): Initialize module information needed by interruptible().
- * init.cc (dll_entry): Record module handle of main for use by
- interruptible().
- (proc_subproc): Reorganize handling of terminated child so that the
- bulk of the processing comes from the signal thread.
- (wait_sig): Force processing of waiting threads if SIGCHLD is not
- processed.
-
-Tue Feb 22 23:06:01 2000 Christopher Faylor <cgf@cygnus.com>
-
- Respond to more g++ warnings relating to initializing structures.
-
-Mon Feb 21 18:36:37 2000 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.cc (set_inheritance): Revert previous patch which got rid of
- 'name' parameter.
-
-Mon Feb 21 00:19:40 2000 Christopher Faylor <cgf@cygnus.com>
-
- Respond to a multitude of new g++ warnings.
-
-Sun Feb 20 22:10:21 2000 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (getwinenv): Make __stdcall.
- (winenv): Ditto.
- * malloc.cc (strdup): New function. Occludes newlib version.
- (_strdup_r): Ditto.
- * winsup.h: Reflect above __stdcall changes.
-
-Sun Feb 20 21:31:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_disk_file::fstat): Modify get_file_attribute
- return value if FILE_ATTRIBUTE_READONLY is set.
-
-Thu Feb 17 11:00:23 2000 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (environ_init): Cosmetic change.
-
-Mon Feb 7 16:50:44 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: cygrun needs libshell32.a.
-
-Sun Feb 6 22:17:58 2000 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (proc_subproc): Simplify case for when a child process is
- stopped since new signal handler ensures the desired behavior.
-
-Sun Feb 6 21:52:33 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Fix install target so that directories will be created
- when necessary.
-
-Sun Feb 6 18:12:17 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: exceptions.cc should depend on autoload.h.
- * exceptions.cc: Undef DECLSPEC_IMPORT prior to including imagehlp.h to
- avoid defining StackWalk as "import".
- (call_handler): Minor optimizations.
- (sig_handle_tty_stop): Fix typo in previous checkin.
- * sigproc.cc (sigproc_init): Ditto, for signal_arrived initialization.
-
-Sat Feb 5 15:37:37 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (isquote): Convert to inline function.
-
-Sat Feb 5 00:26:01 2000 Christopher Faylor <cgf@cygnus.com>
-
- Throughout, rename global_signal_arrived to signal_arrived.
- Throughout, eliminate use of arm_signals and __signal_arrived.
- Throughout, revert to use of simple call to WaitForSingleObject or
- WaitForMultipleObjects.
- * debug.h: Eliminate obsolete function declaration.
- * exceptions.cc (sigWaitForSingleObject): Eliminate obsolete function
- definition.
- * fhandler.h: Reflect change to select_stuff wait method.
- * fhandler_tape.cc (get_ll): Accommodate new w32api LARGE_INTEGER
- definition.
- * ntea.c (NTReadEARaw): Ditto.
- (NTWriteEA): Ditto.
- * security.cc (ReadSD): Ditto.
- (WriteSD): Ditto.
- * syscalls.cc (_link): Ditto.
- * uname.cc (uname): Eliminate PPC switch.
-
-2000-02-01 Salvador Eduardo Tropea <salvador@inti.gov.ar>
-
- * include/io.h: add return type to setmode()
-
-2000-01-27 DJ Delorie <dj@cygnus.com>
-
- * include/netdb.h (h_errno): change __imp_ to dllimport
- * cygwin.din (reent_data): add DATA
-
-Thu Jan 27 01:07:14 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (call_handler): Add debugging output.
- * select.cc (MAKEready): Arm signals earlier.
- * sigproc.cc (__signal_arrived:arm): Move debugging version of this
- method here.
- (__signal_arrived::release): Ditto.
- * sigproc.h: Recognize debugging versions of above two methods.
- (arm_signals::WaitForMultipleObjects): Don't release signal lock unless
- signal arrived.
- (arm_signals::WaitForMultipleSingleObject): Ditto.
- (arm_signals::MsgWaitForMultipleObjects): Ditto.
-
-Thu Jan 27 00:19:26 2000 Christopher Faylor <cgf@cygnus.com>
-
- * sync.h (new_muto): Workaround change in gcc behavior.
-
-Wed Jan 26 12:57:13 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Ensure that all required libraries are built prior
- to linking cygrun.exe.
-
-Tue Jan 25 21:26:57 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (sig_handle): Crudely work around potential problem
- when main thread has a lock but is killed by a fatal signal.
- * fhandler_tty.cc (fhandler_pty_master::write): Don't perform line
- editing on the pty master (so why do we need the second argument to
- line_edit, then?)
- * thread.cc: Reformat to GNU standards.
-
-2000-01-11 DJ Delorie <dj@cygnus.com>
-
- * ROADMAP: new
-
-2000-01-11 DJ Delorie <dj@cygnus.com>
-
- * fhandler_zero.cc: new, emulate /dev/zero
- * testsuite/winsup.api/devzero.c: new, test /dev/zero
- * Makefile.in: build fhandler_zero.o
- * fhandler.h: add support for /dev/zero
- * hinfo.cc: ditto
- * path.cc: ditto
-
-2000-01-11 DJ Delorie <dj@cygnus.com>
-
- * mmap.cc (mmap): MSDN says *one* of FILE_MAP_*, fix flags for
- MAP_PRIVATE.
-
-Mon Jan 10 01:11:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (acl_access): New function.
- * syscalls.cc (access): Call acl_access if ntsec is on.
-
-Mon Jan 10 01:11:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (get_file_owner): Use of ReadSD() instead of
- GetFileSecurity().
- (get_file_group): Ditto.
-
-Sun Jan 9 15:43:07 2000 Christopher Faylor <cgf@cygnus.com>
-
- * debug.cc (struct thread_start): Add a flag to determine whether a
- field is in use. Eliminate thread_start_ix since it was not
- thread-safe.
- (thread_stub): Use notavail flag to control whether the entry in
- start_buf can be reused.
- (makethread): Ditto.
-
-Sun Jan 9 20:18:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (alloc_sd): Rearrange order of ACE creation.
- (setacl): Optimize creation of ACEs related to inheritance. Code
- cleanup.
- (aclcheck): Disable check for existance of DEF_)CLASS_OBJ.
-
-Sat Jan 8 18:42:32 2000 Christopher Faylor <cgf@cygnus.com>
-
- * mkvers.h: Reorg fix.
-
-Sat Jan 8 20:00:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * cygwin.din: Add new acl API calls.
- * grp.cc (getgroups): Change to work for any username.
- * security.cc (get_id_from_sid): Change to work with acl API.
- (is_grp_member): New function.
- (get_nt_attribute): Rewritten.
- (add_access_allowed_ace): New function.
- (add_access_denied_ace): Ditto.
- (alloc_sd): Rewritten.
- (setacl): New function.
- (getace): Ditto.
- (searchace): Ditto.
- (getacl): Ditto.
- (acl): Ditto.
- (facl): Ditto.
- (aclcheck): Ditto.
- (acecmp): Ditto.
- (aclsort): Ditto.
- (acltomode): Ditto.
- (aclfrommode): Ditto.
- (acltopbits): Ditto.
- (aclfrompbits): Ditto.
- (permtostr): Ditto.
- (acltotext): Ditto.
- (permfromstr): Ditto.
- (aclfromtext): Ditto.
- * syscalls.cc (access): Set errno again when needed.
- * include/cygwin/acl.h: New file.
- * include/sys/acl.h: Ditto.
-
-Sat Jan 8 14:46:19 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Add cygwin DLL specific CFLAGS define.
-
-Fri Jan 7 21:01:57 2000 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (interrupt_on_return): Properly coerce assignment of
- sigsave.func.
-
-2000-01-07 Mumit Khan <khan@xraylith.wisc.edu>
-
- * acconfig.h: New file.
- * configure.in Add check for memset builtin.
- (AC_CONFIG_HEADER): Use.
- (STRACE_HHMMSS): Define instead of substituting.
- (_MT_SAFE): Likewise.
- (_CYG_THREAD_FAILSAFE): Likewise.
- (DEBUGGING): Likewise.
- (MT_SAFE): Substitute as a yes/no variable.
- * Makefile.in: Remove DEBUGGING, STRACE_HHMMSS, and THREAD_FAILSAFE
- variables and add DEFS. Update usage of MT_SAFE to reflect yes/no
- values. Add config.h to winsup.h dependency.
- (CFLAGS_CONFIG): Update.
- (INCLUDES): Prepend `-I.'.
- * utils/Makefile.in (INCLUDES): Likewise.
- * winsup.h: Conditionally include config.h.
- * thread.cc: Likewise.
- * config.h.in: Generate new file.
- * configure: Regenerate.
-
-
-Fri Jan 7 16:21:01 2000 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (dll_crt0): Allow signal handling for dynamically loaded
- case.
-
-Thu Jan 6 00:30:12 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * path.cc (symlink_check_one): Initialize local variable `unixattr'
- before calling `get_file_attribute'.
- * syscalls.cc (chown): Ditto.
- * security.cc (get_nt_attribute): Eliminate attribute copying from
- world to user/group in case of missing ACEs.
- (alloc_sd): Set special rights for administrators group only if it's
- neither owner nor group.
- * utils/mkpasswd.c: Create entry for local group administrators (SID
- 544).
-
-Thu Jan 6 00:21:31 2000 Christopher Faylor <cgf@cygnus.com>
-
- Change function calls to __stdcall throughout.
- * exceptions.cc (handle_exceptions): Probe stack for return address to
- use with new signal method. Fill out sigsave.cx with this information.
- (call_handler): Use sigsave.cx if it is available, rather than trying
- to find the context of the main thread.
- (interrupt_on_return): Use address of context rather than
- pass-by-reference.
- (interrupt_now): Ditto.
-
-Thu Jan 6 00:21:31 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * grp.cc (getgroups): Return supplementary groups now.
- * include/limits.h: Define NGROUP_MAX as 16 now.
diff --git a/winsup/cygwin/ChangeLog-2001 b/winsup/cygwin/ChangeLog-2001
deleted file mode 100644
index 140b2a9e9..000000000
--- a/winsup/cygwin/ChangeLog-2001
+++ /dev/null
@@ -1,5337 +0,0 @@
-2001-12-31 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Strip path when installing library.
-
-2001-12-30 Christopher Faylor <cgf@redhat.com>
-
- * include/getopt.h: Fix define.
-
-2001-12-30 Christopher Faylor <cgf@redhat.com>
- Ralf Habacker <Ralf.Habacker@freenet.de>
-
- * speclib: New file.
- * Makefile.in: Create library versions of automode.o, textmode.o, and
- binmode.o for easier use on command line. Create libpthread.a, libm.a,
- and libc.a with subsets of exports found in libcygwin.a.
-
-2001-12-30 Ralf Habacker <Ralf.Habacker@freenet.de>
-
- * cygmagic: Eliminate unneeded use of 'tr' and 'bc'.
-
-2001-12-30 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (open_local_policy): Use POLICY_EXECUTE instead of
- enumerating user rights.
-
-2001-12-29 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (open_local_policy): Initialize lsa handle to NULL.
- Request only needed access rights in call to LsaOpenPolicy().
- (create_token): Check for NULL lsa pointer.
-
-2001-12-28 Corinna Vinschen <corinna@vinschen.de>
-
- * cygwin.din: Add symbols for endutent(), getutent(), getutid(),
- getutline(), setutent() and utmpname().
- * syscalls.cc (setutent): New function.
- (endutent): Ditto.
- (utmpname): Ditto.
- (getutent): Ditto.
- (getutid): Ditto.
- (getutline): Ditto.
- * include/cygwin/version.h: Bump API minor version.
-
-2001-12-26 Christopher Faylor <cgf@redhat.com>
-
- * cygmagic: Add define name to warning.
- * dcrt0.cc (_dll_crt0): Check for changes in child_info size.
- (multiple_cygwin_problem): Avoid "proc" errors when testing. Just
- assume new cygwin proc.
- * shared_info.h (mount_info): Add 'cb' element for sanity checks.
- (shared_info): Ditto.
- * child_info.h (child_info): Add fhandler_union_size element for sanity
- checking.
- * shared.cc (open_shared): Detect shared region size mismatch between
- parent and child.
- (shared_info::initialize): Detect shared region size mismatch with
- expectation.
- (memory_Init): Ditto.
- * sigproc.cc (init_child_info): Correctly set cb in passed structure.
- * shared.cc (open_shared):
-
-2001-12-26 Christopher Faylor <cgf@redhat.com>
-
- * include/getopt.h: Protect a declaratin.
-
-2001-12-26 Robert Collins <rbtcollins@hotmail.com>
-
- * thread.cc (pthread_cond::Signal): Use a separate flag for signal
- detection and broadcast semantics.
- (__pthread_cond_dowait): Ditto.
- * thread.h (pthread_cond): New flag for testing when a waiter has
- woken.
-
-2001-12-26 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Quote arguments to shell scripts.
- (clean): Remove new *_magic.h autogenerated files.
-
-2001-12-25 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Autogenerate some header files which provide magic
- numbers. Force dependencies for files which depend on autogenerated
- headers to ensure that they are always built.
- * child_info.h (child_info): Add new fields to accommodate new magic
- number header stuff.
- * dcrt0.cc: Rely on "child_info_magic.h" to ensure that correct
- child_info magic numbers are used.
- (dll_crt0_1): Temporarily remove _cygwin_testing_magic test.
- (_dll_crt0): Do more testing on magic numbers from fork_info structure.
- Call "multiple_cygwin_problem" where appropriate.
- (multiple_cygwin_problem): Rename from multiple_cygwin_die. Issue a
- warning or die, as appropriate based on cygwin version/magic number
- mismatch.
- * pinfo.cc (pinfo::exit): Don't attempt to dereference `this' if it
- doesn't exist. This can happen when a fatal error occurs early in
- process initialization.
- * shared.cc: Rely on "shared_info_magic.h" to accommodate that new
- magic number header stuff.
- (shared_info::initialize): Use new magic number stuff, for shared
- region.
- (memory_init): Ditto, for mount table.
- * shared_info.h: Accomodate new magic number stuff for shared region
- and mount table.
- * sigproc.cc: Rely on "child_info_magic.h" to accommodate new magic
- number header stuff.
- (init_child_info): Initialize new fields in child_info) to accomodate
- magic numbers.
- * winsup.h: Rename multiple_cygwin_die to multiple_cygwin_problem.
- * include/cygwin/version.h: Define macros for manipulating version
- magic.
- * cygmagic: New shell script for generating magic numbers.
-
-2001-12-20 Christopher Faylor <cgf@redhat.com>
-
- * include/cygwin/version.h: Bump API minor version for below changes.
-
-2001-12-19 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in (VPATH): Add regex directory.
- (NM): new variable.
- (OBSOLETE_FUNCTIONS): Ditto.
- (NEW_FUNCTIONS): Ditto.
- (install-headers): Install regex.h.
- (install-man): New target.
- (install): Use new target.
- (DLL_OFILES): Add v8_reg* stuff.
- (new-cygwin1.dll): Eliminate stamp-cygwin-lib creation.
- (libcygwin.a): Remove obsolete functions from import lib. Add new functions.
- * configure.in: Detect 'nm' tool.
- * configure: Regenerate.
- * cygwin.din: Export posix_reg* functions. Eliminate export of v8 reg* functions.
- This is now handled in object files themselves.
- * regex/*: New files.
- * regexp/v8_*.c: New files, renamed from non v8_ equivalents.
-
-2001-12-17 Corinna Vinschen <corinna@vinschen.de>
-
- * include/getopt.h: Don't define getopt_long() and friends when
- included through unistd.h.
-
-2001-12-17 Christopher Faylor <cgf@redhat.com>
-
- * dtable.cc (dtable::init_std_file_from_handle): Avoid initializing
- using an invalid handle.
-
-2001-12-16 David Billinghurst <David.Billinghurst@riotinto.com>
-
- * include/limits.h: Define LLONG_MIN, LLONG_MAX, ULLONG_MAX.
-
-2001-12-11 Christopher Faylor <cgf@redhat.com>
-
- * include/getopt.h: Add HAVE_DECL_GETOPT to save pain elsewhere.
-
-2001-12-10 Christopher Faylor <cgf@redhat.com>
-
- * fhandler.h (fhandler_serial::ev): New class member.
- * fhandler_serial.cc (fhandler_serial::raw_read): Use class member for
- event status.
- * select.cc (peek_serial): Ditto.
-
-2001-12-07 Christopher Faylor <cgf@redhat.com>
-
- * path.cc (path_conv::check): Use full path name for determining
- attributes when /cygdrive/x/foo.
-
-2001-12-06 Christopher Faylor <cgf@redhat.com>
-
- * path.cc (path_conv::check): Reset FH_CYGDRIVE if iterating through
- path.
-
-2001-12-06 Christopher Faylor <cgf@redhat.com>
-
- * path.cc (path_conv::check): Don't complain if /dev/x/foo when x
- doesn't exist.
- (mount_info::conv_to_win32_path): Keep translating when a /cygdrive is
- found. Don't attempt to translate to a device name when devn ==
- FH_CYGDRIVE.
- (cygwin_conv_to_win32_path): Set buffer to empty on error.
- (cygwin_conv_to_full_win32_path): Ditto.
-
- * window.cc: Include unistd.h to verify definitions.
-
-2001-12-05 Christopher Faylor <cgf@redhat.com>
-
- * dir.cc (opendir): Detect error return from build_fhandler_from_name.
-
-2001-12-04 David Rothenberger <daveroth@acm.org>
-
- * net.cc (cygwin_getsockopt): Dereference optlen pointer when passing
- to __check_null_invalid_struct_errno.
-
-2001-12-03 Christopher Faylor <cgf@redhat.com>
-
- * net.cc (cygwin_getsockopt): Allow NULL optval.
- (cygwin_setsockopt): Ditto.
- (cygwin_recvfrom): Allow NULL from.
-
- * path.cc (mount_info::read_cygdrive_info_from_registry): Don't write
- cygdrive to registry if it doesn't exist.
-
-2001-12-03 Christopher Faylor <cgf@redhat.com>
-
- * path.cc (mount_info::conv_to_win32_path): Avoid returning error if
- cygdrive == '/'.
- (mount_info::cygdrive_win32_path): Return 0 if invalid cygdrive path.
-
-2001-11-30 Christopher Faylor <cgf@redhat.com>
-
- * debug.cc (makethread): Eliminate unneeded function call.
- * miscfuncs.cc (tls_ix): Predefine.
- * perthread.h (set_reent): Eliminate.
- (get_reent): Ditto.
- * winbase.h (my_tlsalloc): Use global stack base pointer. Set newly
- allocated location to NULL.
- (my_tlssetvalue): Use global stack base pointer.
- (my_tlsgetvalue): Ditto.
-
-2001-11-27 Christopher Faylor <cgf@redhat.com>
-
- * winsup.h: Reorganize to avoid use of experimental stuff.
- * shortcut.cc: Move winsup.h first in include order.
-
-2001-11-27 Christopher Faylor <cgf@redhat.com>
-
- * cygwin.din (ualarm): New export.
- * dcrt0.cc (_dll_crt0): Add experimental tls storage declaration.
- (dll_crt0): Ditto.
- * debug.cc (thread_stub): Ditto.
- * thread.cc: Minor cleanup.
- (__pthread_create): Add experimental tls storage declaration.
- * miscfuncs.cc: Define tls index.
- * winsup.h: Declare experimental tls storage.
-
- * window.cc (alarm): Use old timer return from setitimer.
- (ualarm): New function. From Alexandr V. Shutko.
-
-2001-11-26 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in (libcygwin.a): Use ar commands to build libcygwin.a since
- adding an archive doesn't work the way we want it to.
-
-2001-11-24 Christopher Faylor <cgf@redhat.com>
-
- * fhandler_disk_file.cc (fhandler_cygdrive::readdir): Avoid reporting
- inaccessible drives.
-
-2001-11-24 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (cygwin_hstrerror): Allow s == NULL.
- (cygwin_rcmd): Add parameter checking.
- (cygwin_rexec): Ditto.
-
-2001-11-24 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (cygwin_inet_ntoa): Add parameter checking.
- (cygwin_inet_network): Return INADDR_NONE instead of 0 in case of
- EFAULT.
- (cygwin_hstrerror): Add parameter checking.
- (cygwin_rresvport): Ditto.
- (socketpair): Ditto.
- * winsup.h (check_null_str): Add extern declaration.
-
-2001-11-24 Christopher Faylor <cgf@redhat.com>
-
- * path.cc (path_conv::check): Tighten FH_CYGDRIVE check to avoid
- matching trailing component, like other devices.
-
-2001-11-24 Christopher Faylor <cgf@redhat.com>
-
- * autoload.cc (IsDebuggerPresent): Make conditional load since it is
- not available everywhere.
-
- * path.cc (mount_info::conv_to_win32_path): Only consider /cygdrive to
- be FH_CYGDRIVE, not /cygdrive/x.
-
-2001-11-24 Christopher Faylor <cgf@redhat.com>
-
- * net.cc (inet_makeaddr): Revert previous change.
-
-2001-11-23 Christopher Faylor <cgf@redhat.com>
-
- * path.cc (chdir): Allow 'cd /cygdrive'.
-
-2001-11-23 Christopher Faylor <cgf@redhat.com>
-
- * dtable.cc (dtable::vfork_parent_restore): Add debugging statement.
-
- * exceptions.cc (try_to_debug): Spin only as long as we don't have a
- debugger attached.
-
- * fhandler.h (fhandler_base::set_nohandle): New method.
- (fhandler_base::get_nohandle): New method.
- * fhandler.cc (fhandler_base::dup): Avoid duplicating handle if there
- is no handle.
- * fhandler_disk_file.cc (fhandler_disk_file::opendir): Set nohandle
- flag on dummy fd.
-
-2001-11-23 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Make intermediate library for eventual inclusion in
- libcygwin.a
-
- * fhandler.h (fhandler_pipe::fhandler_pipe): Remove default argument
- setting since it is no longer used.
-
- * miscfuncs.cc (check_null_str): New function.
- (check_null_str_errno): Ditto.
- * net.cc: Add defensive buffer checking throughout.
- (cygwin_sendto): Protect against invalid fd.
- (cygwin_recvfrom): Ditto.
- (cygwin_getpeername): Ditto.
- (cygwin_recv): Ditto.
- (cygwin_send): Ditto.
- * winsup.h: Declare a new function.
-
-2001-11-23 Corinna Vinschen <corinna@vinschen.de>
-
- * select.cc (set_bits): Fix conditional for setting fd in exceptfds.
- * dtable.cc (dtable::build_fhandler): Create fhandler_pipe using
- correct device type.
- * path.cc (get_devn): Set correct pipe device type from device name.
-
-2001-11-22 Christopher Faylor <cgf@redhat.com>
-
- * path.cc (conv_path_list): Fix wild indexing into path due to
- conflicting methods for setting src pointer.
-
- * dir.cc (opendir): Only pass path_conv argument to opendir, since name
- is already part of the fhandler.
- * dtable.cc (dtable::build_fhandler): Accomodate new FH_CYGDRIVE type.
- * fhandler.cc (fhandler_base::opendir): Nuke name argument.
- * fhandler.h: Add FH_CYGDRIVE to "device" enum.
- (fhandler_base::opendir): Nuke name argument.
- (fhandler_disk_file::opendir): Ditto.
- (fhandler_disk_file::fhandler_disk_file): Declare new method which
- passes devtype through.
- (fhandler_cygdrive): Add elements for tracking drives.
- (fhandler_cygdrive::set_drives): Declare new method.
- (fhandler_cygdrive::iscygdrive_root): Declare new method.
- (fhandler_cygdrive::opendir): Declare new method.
- (fhandler_cygdrive::readdir): Declare new method.
- (fhandler_cygdrive::telldir): Declare new method.
- (fhandler_cygdrive::seekdir): Declare new method.
- (fhandler_cygdrive::rewinddir): Declare new method.
- (fhandler_cygdrive::closedir): Declare new method.
- (fhandler_cygdrive::fstat): Declare new method.
- * fhandler_disk_file.cc (fhandler_disk_file::fhandler_disk_file):
- Define new method which passes devtype through.
- (fhandler_disk_file::open): Tweak debug output.
- (fhandler_disk_file::opendir): Nuke first argument. Use info from
- path_conv and class rather than calling fstat.
- (fhandler_cygdrive::set_drives): New method.
- (fhandler_cygdrive::iscygdrive_root): New method.
- (fhandler_cygdrive::opendir): New method.
- (fhandler_cygdrive::readdir): New method.
- (fhandler_cygdrive::telldir): New method.
- (fhandler_cygdrive::seekdir): New method.
- (fhandler_cygdrive::rewinddir): New method.
- (fhandler_cygdrive::closedir): New method.
- (fhandler_cygdrive::fstat): New method.
- * path.cc (iscygdrive_device): Assume cygdriveness is already verified.
- (path_conv::check): Treat FH_CYGDRIVE "method" as a special case,
- setting file attributes as needed.
- (mount_info::conv_to_win32_path): Allow stand-alone /cygdrive, meaning
- "the directory which contains all of the drives on the system".
- (fillout_mntent): Use cyg_tolower for conversions.
- (mount_info::cygdrive_win32_path): Replace unused argument with unit
- number.
- * shared_info.h (mount_info::cygdrive_win32_path): Reflect argument
- change.
-
-2001-11-21 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in (DLL_OFILES): Add fhandler_disk_file.o.
- * cygheap.h (cygheap_fdnew::operator =): New operator.
- * dir.cc: Add invalid struct checking throughout. Use methods for all
- directory manipulation throughout.
- * fhandler.cc: Move fhandler_disk_file stuff to own file.
- (fhandler_base::opendir): New method.
- (fhandler_base::readdir): New method.
- (fhandler_base::telldir): New method.
- (fhandler_base::seekdir): New method.
- (fhandler_base::rewinddir): New method.
- (fhandler_base::closedir): New method.
- * fhandler_disk_file.cc: New file.
- * fhandler.h (fhandler_base): Declare new virtual methods.
- (fhandler_disk_file): Ditto.
- (fhandler_cygdrive): New class.
-
- * path.cc (conv_path_list): Use strccpy to break apart path.
-
-2001-11-17 Nick Duffek <nick@duffek.com>
-
- * path.cc (conv_path_list): Copy source paths before modifying them.
-
-2001-11-17 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_raw.cc (fhandler_dev_raw::clear): Don't reset unit.
- * fhandler_tape.cc (fhandler_dev_tape::fhandler_dev_tape): Add debug
- output.
-
-2001-11-15 Egor Duda <deo@logos-m.ru>
-
- * include/pthread.h (PTHREAD_COND_INITIALIZER): Define.
- * thread.cc (__pthread_cond_destroy): Add support for
- PTHREAD_COND_INITIALIZER.
- (__pthread_cond_init): Ditto.
- (__pthread_cond_broadcast): Ditto.
- (__pthread_cond_signal): Ditto.
- (__pthread_cond_dowait): Ditto.
- (__pthread_mutex_init): Handle PTHREAD_MUTEX_INITIALIZER correctly,
- don't return error when it's passed as parameter.
- * winsup.h (check_null_invalid_struct): Call correct function.
-
-2001-11-14 Christopher Faylor <cgf@redhat.com>
-
- * exceptions.cc: Add stdlib.h include for alloca declaration.
- * poll.cc: Ditto.
- * termios.cc: Ditto.
-
-2001-11-14 Christopher Faylor <cgf@redhat.com>
-
- * syscalls.cc (_write): Only allow zero length when fd is valid.
-
-2001-11-14 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_disk_file::fstat): Add setting access time
- and creation time to last modification time for files on filesystems
- not supporting multiple timestamps.
- (fhandler_disk_file::fstat_helper): Set access time and creation
- time in incoming Windows structure instead of in stat buf to avoid
- incorrectly overwriting Epoch timestamp.
-
-2001-11-14 Corinna Vinschen <corinna@vinschen.de>
-
- * winsup.h: Remove alloca definition since it's now defined through
- inclusion of stdlib.h.
- * lib/cygwin_crt0.c: Ditto.
-
-2001-11-13 Christopher Faylor <cgf@redhat.com>
-
- * syscalls.cc (_write): Allow zero length as per SUSv2.
-
-2001-11-13 Corinna Vinschen <corinna@vinschen.de>
-
- * dir.cc (mkdir): Add HIDDEN file attribute if file has leading dot
- and HIDDEN_DOT_FILES is defined.
- * fhandler.cc (fhandler_base::open): Ditto.
- * path.cc (symlink): Ditto.
- * syscalls.cc (_rename): Ditto and remove HIDDEN file attribute if
- new filename does not begin with a dot.
-
-2001-11-12 Christopher Faylor <cgf@redhat.com>
-
- * fhandler_console.cc (fhandler_console::read): Revert 2001-10-23
- change to only honor keydown events.
-
-2001-11-11 Christopher Faylor <cgf@redhat.com>
-
- * include/cygwin/version.h: Bump version to 1.3.6.
-
-2001-11-10 Christopher Faylor <cgf@redhat.com>
-
- * dtable.cc (dtable::build_fhandler): Don't increment console fd count
- if new operation fails. Increment fork_fixup field here.
- (dtable::dup2): Don't increment fork_fixup field here.
- * net.cc (fdsock): Ditto.
-
-2001-11-08 Corinna Vinschen <corinna@vinschen.de>
-
- * select.cc: Set errno using set_sig_errno() throughout.
- * signal.cc (signal): Always set SA_RESTART flag.
- * syscalls.cc (_read): Revert previous patch.
-
-2001-11-08 Corinna Vinschen <corinna@vinschen.de>
-
- * select.cc (fhandler_tty_slave::ready_for_read): Return 0 on EBADF.
- * syscalls.cc (_read): If ready_for_read() failed, save errno from
- being overwritten by signal handler call.
-
-2001-11-07 Corinna Vinschen <corinna@vinschen.de>
-
- * lib/getopt.c (getopt_internal): Reset optind to 1 only if optreset
- is not set.
-
-2001-11-06 Christopher Faylor <cgf@redhat.com>
-
- * select.cc (fhandler_tty_slave::ready_for_read): Correct inverted
- not_open test.
-
-2001-11-05 Christopher Faylor <cgf@redhat.com>
-
- * include/cygwin/version.h: Bump version to 1.3.5.
-
-2001-11-05 Corinna Vinschen <corinna@vinschen.de>
-
- * mmap.cc (mmap_record::find_empty): Add input parameter check.
-
-2001-11-04 Christopher Faylor <cgf@redhat.com>
-
- * dtable.cc (dtable::build_fhandler): Fix debug_printf to avoid SEGV
- due to incorrect parameter placement.
-
-2001-11-04 Christopher Faylor <cgf@redhat.com>
-
- * fhandler.h (fhandler_pipe::broken_pipe): Renamed from saweof.
- (fhandler_pipe::set_eof): Reflect above change.
- * pipe.cc (fhandler_pipe::fhandler_pipe): Ditto.
- (fhandler_pipe::read): Ditto.
- (fhandler_pipe::hiteof): Ditto.
-
-2001-11-04 Christopher Faylor <cgf@redhat.com>
-
- * pipe.cc (fhandler_pipe::read): Narrow eof return to just the "broken
- pipe" test.
-
-2001-11-04 Christopher Faylor <cgf@redhat.com>
-
- * select.cc: Add more comments throughout. Use bool 'true' where
- appropriate throughout.
- (fhandler_socket::select_read): Remove duplicate setting for *_ready
- which inadvertently overrode previous, correct setting.
- (fhandler_socket::select_write): Ditto.
-
-2001-11-03 Christopher Faylor <cgf@redhat.com>
-
- * select.cc (verify_console): New function.
- (verify_windows): Ditto.
- (fhandler_console::select_read): Really do need to verify that there is
- something to read.
- (fhandler_console::select_windows): Ditto.
-
-2001-11-03 Christopher Faylor <cgf@redhat.com>
-
- * fhandler.h (fhandler_base::ready_for_read): Remove unused argument.
- (fhandler_tty_slave::ready_for_read): Ditto.
- (select_record): Remove poll, initialize peek.
- * select.cc: Remove all poll functions, throughout. Change second
- argument of peek_* functions to 'bool' throughout. Specifically
- initialize *_ready variables throughout.
- (select_stuff::poll): Subsume previous poll functionality.
- (peek_pipe): Don't grab guard mutex when in select loop.
- select()/read() is racy by design so there is no need to worry about a
- race in select().
- (fhandler_base::ready_for_read): Remove unused argument.
- (fhandler_tty_slave::ready_for_read): Ditto.
- * syscalls.cc (_read): Eliminate third argument in ready_for_read call.
-
-2001-11-03 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (get_supplementary_group_sidlist): New function.
- (get_group_sidlist): Call get_supplementary_group_sidlist() to
- retrieve list of supplementary groups SIDs from /etc/group and
- add them to the user's group list.
-
-2001-11-03 Christopher Faylor <cgf@redhat.com>
-
- * fhandler.cc (fhandler_base::read): Return just read ahead characters
- if slow device.
- * fhandler.h (fhandler_base::set_eof): New virtual method.
- (fhandler_pipe::set_eof): New method.
- * pipe.cc (fhandler_pipe::fhandler_pipe): Clear saweof flag.
- (fhandler_pipe::read): Return immediately if hit eof.
- (fhandler_pipe::hit_eof): Return true if saweof flag is set.
- * select.cc (peek_pipe): Don't call PeekNamedPipe if we couldn't grab
- the guard mutex.
-
-2001-11-02 Egor Duda <deo@logos-m.ru>
-
- * dll_init.h (class dll_list): Reorder functions to avoid compiler
- "can't inline" warnings.
- * security.h (class cygsid): Ditto.
- * sigproc.cc (get_proc_lock): Ditto.
- * sigproc.h (class sigframe): Ditto.
- * sync.h (class muto): Ditto.
-
-2001-11-02 Christopher Faylor <cgf@redhat.com>
-
- * fhandler.h (fhandler_base::get_guard): Actually MAKE virtual as
- previously indicated.
- * pipe.cc (make_pipe): Remove extraneous set_errno.
- * syscalls.cc (_open): Ditto.
- * select.cc (peek_pipe): Need to check that there is still something to
- read from the pipe after acquiring the mutex since another
- process/thread could have eaten the input before we got to acquiring
- the lock. (Thanks to Nick Duffek for this inspiration.)
-
-2001-11-01 Christopher Faylor <cgf@redhat.com>
-
- * fhandler.h: Change Windows 'BOOL's to c++ 'bool's for all variables.
- * select.cc (fhandler_base::ready_for_read): Set read_ready to zero
- prior to testing it or it will be uninitialized.
-
- * Makefile.in (CFLAGS): Move setting to Makefile.common.
-
-2001-11-01 Christopher Faylor <cgf@redhat.com>
-
- * cygheap.h (cygheap_fdmanip::isopen): Set appropriate errno if fd not
- open.
- * select.cc (fhandler_base::ready_for_read): Release an open guard
- mutex when exiting with an error condition.
- * syscalls.cc (_read): Check frequently for closed fd as a kludge until
- something better is invented.
-
-2001-11-01 Christopher Faylor <cgf@redhat.com>
-
- * dtable.cc (dtable::build_fhandler): Issue internal error on unknown
- device.
- * fhandler.cc (fhandler_base::close): Show both name and handle in
- debugging output.
-
- * fhandler.h (fhandler_base::get_guard): New virtual method.
- (fhandler_pipe::get_guard): New method.
- (fhandler_socket::ready_for_read): Delete declaration.
- (fhandler_pipe::ready_for_read): Ditto.
- (fhandler_serial::ready_for_read): Ditto.
- (fhandler_console::ready_for_read): Ditto.
- (fhandler_tty_common::ready_for_read): Ditto.
- (fhandler_windows::ready_for_read): Ditto.
- (struct select_record::peek): Declare new method.
- * select.cc (MAKEready): Delete.
- (peek_pipe): Use get_guard method to retrieve potential guard mutex
- handle.
- (fhandler_base::ready_for_read): Rewrite as generic ready-for-read
- handler. Should only be called for "slow" devices.
- (fhandler_socket::ready_for_read): Delete definition.
- (fhandler_pipe::ready_for_read): Ditto.
- (fhandler_serial::ready_for_read): Ditto.
- (fhandler_console::ready_for_read): Ditto.
- (fhandler_tty_common::ready_for_read): Ditto.
- (fhandler_windows::ready_for_read): Ditto.
- (fhandler_pipe::select_read): Fill in new peek record in select_record
- structure.
- (fhandler_console::select_read): Ditto.
- (fhandler_tty_common::select_read): Ditto.
- (fhandler_serial::select_read): Ditto.
- (fhandler_socket::select_read): Ditto.
- (fhandler_socket::select_read): Ditto.
- (fhandler_tty_slave::ready_for_read): Check for tty not open. Set
- errnos appropriately.
- * syscalls.cc (_read): Allow ready_for_read to set errno.
-
- * pinfo.cc (pinfo::init): Return spawn/NO_WAIT process as valid if it
- is initializing.
- * sigproc.cc (getsem): Adjust wait for process to initialize downward
- to avoid huge waits.
-
-2001-10-31 Christopher Faylor <cgf@redhat.com>
-
- * environ.cc: Set reset_com to false to mimic linux behavior more
- closely.
-
-2001-10-31 Corinna Vinschen <corinna@vinschen.de>
-
- * dtable.cc (dtable::vfork_child_dup): Revert impersonation
- before duplicating fhandler.
-
-2001-10-30 Christopher Faylor <cgf@redhat.com>
-
- * exceptions.cc (signal_exit): Weight the odds against the main thread
- running when signal thread is exiting.
-
-2001-10-30 Christopher Faylor <cgf@redhat.com>
-
- * sigproc.cc (sigproc_terminate): Don't signal main thread when exiting.
- * sigproc.h (sigframe): Decorate some methods with `inline'.
- (new_muto): Coerce pointer to new to void *.
-
-2001-10-30 Christopher Faylor <cgf@redhat.com>
-
- * fhandler.cc (fhandler_base::fork_fixup): Pass old handle to
- setclexec_pid.
-
-2001-10-30 Christopher Faylor <cgf@redhat.com>
-
- * cygheap.h (cygheap_fdmanip::cygheap_fdmanip): Clear fh.
- (cygheap_fdmanip::isopen): New method.
- * syscalls.cc (_read): Avoid accessing closed fd.
-
- * path.h (fe_types): New enum.
- (path_conv::set_path): New method.
- (find_exec): Change null_if_not_found argument to something more
- generic.
- * spawn.cc (find_exec): Default to returning the POSIX path rather than
- the windows path, unless instructed otherwise.
- (spawn_guts): Force call to find_exec to use native paths.
- * dlfcn.cc (check_path_access): Accommodate new find_exec arguments.
- * environ.h (win_env::get_posix): New method.
-
-2001-10-30 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_socket.cc (fhandler_socket::close): Add error handling.
-
-2001-10-30 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_socket.cc (fhandler_socket::dup): Revert previous change.
-
-2001-10-30 Christopher Faylor <cgf@redhat.com>
-
- * dtable.cc (dtable::dup2): Add some debugging. Use methods from
- passed in class rather than cygheap->fdtab.
- * fhandler_socket.cc (fhandler_socket::fixup_before_fork_exec): Add
- more debugging output.
- (fhandler_socket::dup): Allocate new space for prot_info_ptr for
- duplicated entry.
- (fhandler_socket::close): Loop closesocket() as long as WSAEWOULDBLOCK
- is returned.
- * syscalls.cc (stat_worker): Always delete fh if it has been created.
-
-2001-10-29 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (is_group_member): Call NetLocalGroupGetMembers() for
- local machine only.
- (get_user_local_groups): Ditto for NetLocalGroupEnum().
-
-2001-10-29 Christopher Faylor <cgf@redhat.com>
-
- * fhandler.cc (fhandler_base::set_name): Set namehash here to catch
- name changes.
- (fhandler_base::open): Remove namehash setting.
- (fhandler_base::fstat): Subtract 1 from arbitrary time setting to avoid
- strange ls -l granularity problem.
-
-2001-10-29 Christopher Faylor <cgf@redhat.com>
-
- * select.cc (MAKEready): Remove extraneous select_read.
-
-2001-10-29 Corinna Vinschen <corinna@vinschen.de>
-
- * uinfo.cc (internal_getlogin): Set environment variable $HOME
- from either /etc/passwd or $HOMEDRIVE/$HOMEPATH if necessary.
-
-2001-10-29 Christopher Faylor <cgf@redhat.com>
-
- * fhandler.h (fhandler_serial::fhandler_serial): Change to only accept
- unit argument.
- * fhandler_serial.cc (fhandler_serial::fhandler_serial): Ditto.
- (fhandler_serial::open): Avoid else when previous clause is a return().
- * path.cc (get_devn): Alias /dev/ttyS0 -> /dev/com1, etc.
- (get_device_number): Reallow standalone "com1" as a valid name for
- /dev/com1.
-
-2001-10-26 Christopher Faylor <cgf@redhat.com>
-
- * select.cc (MAKEready): Check for read_ready in loop since select_read
- could set it.
- (peek_socket): Check ready/write/except specifically since they could
- have been set even prior to peek_socket call.
-
-2001-10-24 Christopher Faylor <cgf@redhat.com>
-
- * shared_info.h (MOUNT_VERSION): Change to a smaller, still arbitrary
- number.
- * shared.cc (open_shared): Accept a number to denote the shared memory
- region.
- (memory_init): Use shared memory version as part of the object name of
- the shared region. Ditto for the mount table.
- * path.cc (CYGWIN_REGNAME): New define used in place of
- CYGWIN_INFO_CYGWIN_REGISTRY_NAME throughout.
- * external.cc (cygwin_internal): Implement CW_[GS]ET_CYGWIN_REGISTRY_NAME.
- * cygheap.h (init_cygheap::cygwin_regname): New element.
-
-2001-10-23 Christopher Faylor <cgf@redhat.com>
-
- Ensure that all fhandler_*::read definitions are __stdcall throughout.
- * fhandler.cc (fhandler_base::set_inheritance): Be more defensive in
- debugging code.
- * fhandler.h: Adjust regparms throughout to reflect passing 'this'
- parameter.
- * fhandler_console.cc (fhandler_console::read): Remove unneeded test.
- Only honor "key down" events.
- * miscfuncs.cc (strcasestr): Reorganize for efficient code use.
- (check_null_empty_str_errno): Ditto.
- (__check_null_invalid_struct_errno): Ditto.
- (__check_invalid_read_ptr_errno): Ditto.
- * syscalls.cc (_read): Return 0 when length == 0, as per Single UNIX
- Specification.
-
-2001-10-22 Christopher Faylor <cgf@redhat.com>
-
- * debug.cc (set_errno): Return value of errno that was set, just like
- the macro.
- (setclexec_pid): Replace old handle with new handle.
- * debug.h: Reflect change in arguments for setclexec_pid.
- * fhandler.cc (fhandler_base::set_inheritance): Ditto.
- (fhandler_base::fork_fixup): Ditto.
- * cygerrno.h: Reflect return value change for set_errno.
-
-2001-10-22 Christopher Faylor <cgf@redhat.com>
-
- Remove 'cb' parameter and modify fhandler_* constructors throughout.
- * dtable.cc (dtable::build_fhandler): Remove debugging output which
- uses 'cb'.
- * exec.cc (execvp): New function.
- (execvpe): Ditto.
- * fhandler.cc (fhandler_base::fhandler_base): Use constructor
- initialization.
- * fhandler.h (fhandler_tty_common::fhandler_tty_common): Ditto.
- * fhandler_clipboard.cc (fhandler_dev_clipboard::fhandler_dev_clipboard):
- Ditto.
- * fhandler_console.cc (fhandler_console::fhandler_console): Ditto.
- * fhandler_raw.cc (fhandler_dev_raw::fhandler_dev_raw): Ditto.
- * fhandler_serial.cc (fhandler_serial::fhandler_serial): Ditto.
- * fhandler_tty.cc (fhandler_tty_master::fhandler_tty_master): Ditto.
- (fhandler_tty_slave::fhandler_tty_slave): Ditto.
- (fhandler_pty_master::fhandler_pty_master): Ditto.
- * fhandler_windows.cc (fhandler_windows::fhandler_windows): Ditto.
-
-2001-10-22 Corinna Vinschen <corinna@vinschen.de>
-
- Patch suggested by Ian Ray <ian.ray@nokia.com>:
- * syscalls.cc (seteuid): Unset environment variables HOMEDRIVE and
- HOMEPATH before calling internal_getlogin().
- * uinfo.cc (internal_getlogin): Use default HOMEPATH and HOMEDRIVE
- from environment if both are present, else query NetUserGetInfo().
-
-2001-10-22 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (get_2k_ifconf): Change multiple IP address naming scheme
- to Linux style.
-
-Sun Oct 21 19:04:37 2001 Alexander Gottwald <ago@informatik.tu-chemnitz.de>
-
- * net.cc (get_2k_ifconf): Added support for multiple IP addresses on
- one interface.
-
-2001-10-22 Corinna Vinschen <corinna@vinschen.de>
-
- * miscfuncs.cc (__check_invalid_read_ptr_errno): Return error, if any.
-
-2001-10-21 Christopher Faylor <cgf@redhat.com>
-
- * resource.cc (fill_rusage): Perform paranoid zero structure passed to
- GetProcessMemoryInfo.
-
-2001-10-22 Robert Collins <rbtcollins@hotmail.com>
-
- * autoload.cc: Autoload GetProcessMemoryInfo.
- * resource.cc (fill_rusage): Calculate ru_maxrss and ru_majflt entries.
- (Bug report on this from Guido Serassio in the squid project).
- This requires including psapi.h.
-
-2001-10-20 Christopher Faylor <cgf@redhat.com>
-
- * dll_init.cc (dll_list::alloc): Increase retry count to 1000.
-
-2001-10-20 Christopher Faylor <cgf@redhat.com>
-
- * miscfuncs.cc (__check_invalid_read_ptr_errno): New function.
- * syscalls.c (_write): Validate that write buffer is accessible for
- reading, not writing.
- * winsup.h: Declare new function, increase regparmization of check_*
- functions.
-
-2001-10-19 Corinna Vinschen <corinna@vinschen.de>
-
- * path.cc (getcwd): Allow len == 0 when buf == NULL.
-
-2001-10-18 Christopher Faylor <cgf@redhat.com>
-
- * syscalls.cc (_read): Validate input pointer.
- (_write): Ditto.
- (system): Ditto.
-
-2001-10-16 Frederic Devernay <Frederic.Devernay@sophia.inria.fr>
-
- * poll.cc (poll): Call cygwin_select() if any fd is valid.
-
-2001-10-16 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_raw.cc (fhandler_dev_raw::open): Eliminate compatibility
- code since no Win32 device names are used anymore.
- * fhandler_tape.cc (fhandler_dev_tape::tape_set_blocksize): Allow
- 0 as blocksize to indicate variable blocksize.
- * path.cc (win32_device_name): Generate NT internal device names
- using upper/lower case names for readability.
- Generate \DosDevices\<letter>: device name for mount table
- compatibility devices.
-
-2001-10-16 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_tape.cc (fhandler_dev_tape::tape_status): Report
- EOTWarningZoneSize in get->mt_eotwarningzonesize.
- * include/cygwin/mtio.h: Define DEFTAPE.
- (struct mtget): Add member `mt_eotwarningzonesize'. Add a comment.
- * include/cygwin/version.h: Bump API minor version to 47.
-
-2001-10-16 Christopher Faylor <cgf@redhat.com>
-
- * fhandler.cc (fhandler_base::fork_fixup): Guard against compiler
- warning.
-
-2001-10-16 Corinna Vinschen <corinna@vinschen.de>
-
- * autoload.cc: Add load statement for `NtOpenFile'.
- * fhandler.h (fhandler_dev_raw::get_unit): New method.
- (fhandler_dev_tape::norewind): Eliminate.
- (fhandler_dev_tape::is_rewind_device): New method.
- * fhandler_raw.cc (fhandler_dev_raw::open): Open new
- fixed device name devices using NT internal method.
- Keep calling fhandler_base::open() for old mount table
- device mapping compatibility devices.
- (fhandler_dev_raw::fstat): Eliminate. Settings are done
- by fhandler_base::fstat() already.
- * fhandler_tape.cc: Remove `norewind' usage throughout.
- * ntdll.h: Define FILE_SYNCHRONOUS_IO_NONALERT.
- Define struct _IO_STATUS_BLOCK.
- Declare NtOpenFile().
- * path.cc (get_raw_device_number): Add new approach for
- using fixed device names.
- (win32_device_name): Ditto.
- (get_device_number): Ditto. Require POSIX path to begin
- with "/dev/".
- (mount_info::conv_to_win32_path): Call win32_device_name()
- instead of get_device_number() after evaluating mount points
- to allow changing the win32 destination path again.
- * security.cc (str2buf2uni): Remove `static' to be able to
- call function from fhandler_dev_raw::open().
- * wincap.cc: Set flag has_raw_devices appropriately.
- * wincap.h: Add flag has_raw_devices.
-
-2001-10-16 Christopher Faylor <cgf@redhat.com>
-
- * cygheap.h (cygheap_fdget::cygheap_fdget): Remove debugging operation
- from set_errno.
-
-2001-10-16 Christopher Faylor <cgf@redhat.com>
-
- * mmap.cc (mmap): Assign 'fh' from cygheap_fdget. Use 'fh' everywhere.
-
-2001-10-15 Christopher Faylor <cgf@redhat.com>
-
- * cygerrno.h (set_errno): Define more informative version of this
- function for debugging.
- (__set_errno): Declare when DEBUGGING.
- * cygheap.h (cygheap_fdget::cygheap_fdget): Add a flag to control when
- errno is set.
- * debug.cc (__set_errno): New function.
- * fcntl.cc (_fcntl): Fix so that correct fd is used for second argument
- to dup2.
- * syscalls.cc (_cygwin_istext_for_stdio): Don't set errno here when
- using cygheap_fdget.
-
-2001-10-15 Christopher Faylor <cgf@redhat.com>
-
- * fhandler.cc (fhandler_base::fork_fixup): Don't protect handle.
-
- * dlfcn.cc: Fix to confirm to coding standards.
-
- Reorganize includes throughout to accommodate new cygheap.h usage.
- * cygheap.h (cygheap_fdmanip): New class: simplifies locking and
- retrieval of fds from cygheap->fdtab.
- (cygheap_fdget): Ditto.
- (cygheap_fdnew): Ditto.
- * fcntl.cc (_fcntl): Use new method to lock fdtab and retrieve info.
- * ioctl.cc (ioctl): Ditto.
- * mmap.cc (mmap): Ditto.
- * net.cc: Ditto, throughout.
- * passwd.cc (getpass): Ditto.
- * path.cc (fchdir): Ditto.
- * pipe.cc (make_pipe): Ditto.
- * sec_acl.cc (facl): Ditto.
- * syscalls.cc: Ditto, throughout.
- * termios.cc: Ditto, throughout.
-
-2001-10-15 Corinna Vinschen <corinna@vinschen.de>
-
- * uname.cc (uname): Use `wProcessorLevel' unless OS sets it wrong.
- Use `dwProcessorType' then instead.
- * wincap.cc: Set flag has_valid_processorlevel appropriately.
- * wincap.h: Add flag has_valid_processorlevel.
-
-2001-10-14 Christopher Faylor <cgf@redhat.com>
-
- * dtable.cc (dtable::build_fhandler_from_name): Use PC_FULL to
- determine path name.
- * path.cc (fchdir): Remove rel -> abs path conversion.
-
-Sun Oct 14 08:10:12 2001 Gary R. Van Sickle
-
- * fork.cc (fork_parent): Correct the "unable to allocate
- forker_finished event" error message. It named the wrong event before.
-
-2001-10-13 Christopher Faylor <cgf@redhat.com>
-
- * autoload.cc (load_wsock32): Declare dummy function to force loading
- of winsock.
- * fhandler.cc (fhandler_base::set_inheritance): Make debugging output
- more verbose.
- * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Force loading
- of winsock32 if winsock2 not available.
- * net.cc (set_socket_inheritance): Use DuplicateHandle in all cases to
- set inheritance correctly.
- (fdsock): Use winsock2_active macro to determine when to set socket
- inheritance. Remove fdtab resource locking since this function should
- already be protected.
- (cygwin_accept): Simplify logic. Ensure that fdtab unlock is not
- called inappropriately.
- (cygwin_rcmd): Use fdtab locking.
- (cygwin_rresvport): Ditto.
- (cygwin_rexec): Ditto.
- * select.cc (peek_socket): Set errno appropriately if winsock select
- fails.
-
-2001-10-13 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * winsup.h: Declare check_pty_fds.
- * syscalls.cc (check_pty_fds): Rename from check_ttys_fds. Also check
- pty master.
- (setsid): Use check_pty_fds.
- * dtable.cc (dtable::dec_console_fds): Add check on pty fds.
-
-2001-10-13 Ralf Habacker <Ralf.Habacker@freenet.de>
-
- * fhandler_dsp.cc (fhandler_dsp::ioctl): Return 0 for successful
- SNDCTL_DSP_GETBLKSIZE operation.
-
-2001-10-13 Christopher Faylor <cgf@redhat.com>
-
- Remove obsolete 'name' arg from fhandler_* constructors throughout.
- * winsup.h (winsock_active): New macro.
- (winsock2_active): Ditto.
- * autoload.cc (wsock_init): Use new macros to decide if winsock or
- winsock2 is loaded.
- (nonexist_wsock32): Dummy function to force winsock load.
- (nonexist_ws2_32): Dummy function to force winsock2 load.
- * fhandler.h (fhandler_socket::fstat): Declare new method. Currently
- unused.
- * fhandler_socket.cc (fhandler_socket::fixup_before_fork_exec): Check
- that winsock2 is active before trying WSADuplicateSocketA.
- (fhandler_socket::fixup_after_fork): Add extra check for
- winsock2_active. Otherwise use iffy procedures for Windows 95.
- (fhandler_socket::fixup_after_exec): Add debugging.
- (fhandler_socket::dup): Add debugging.
- (fhandler_socket::fstat): New method.
- (fhandler_socket::set_close_on_exec): Attempt to perform iffy stuff on
- Windows 95.
-
- * errno.cc (_sys_nerr): Work around compiler strangeness.
-
- * pinfo.cc (winpids::add): Add extra element at end of allocated array
- for setting to NULL.
- (winpids::enumNT): Ditto.
- (winpids::init): Don't modify pidlist if it hasn't been allocated
- (possibly due to malloc problem).
-
-2001-10-12 Christopher Faylor <cgf@redhat.com>
-
- * autoload.cc (wsock_init): Reorganize slightly to accommodate a new
- compiler.
-
-2001-10-11 Egor Duda <deo@logos-m.ru>
-
- * net.cc (cygwin_sendto): Use correct socket address when sending
- data to AF_UNIX socket.
-
-Wed Oct 10 16:10:41 2001 Alexander Gottwald <ago@informatik.tu-chemnitz.de>
-
- * net.cc (get_95_ifconf): Using other registry values pointing to
- correct networkdevice identification for Windows95.
-
-Tue Oct 9 22:22:45 2001 Christopher Faylor <cgf@cygnus.com>
-
- Throughout, rename PROC_FORK1 to PROC_FORK.
- * child_info.h: Rename PROC_* to _PROC_*. Define PROC_* with
- additional testing magic. Eliminate old PROC_FORK and rename
- PROC_FORK1 to PROC_FORK.
- * dcrt0.cc (_cygwin_testing_magic): New variable. Added to magic
- number in proc_info.
- (alloc_stack): Eliminate old PROC_FORK test.
- (dll_crt0_1): Ditto. Use _PROC_* enums for test. Subtract
- _cygwin_testing_magic from child_proc_info->type so that normal cygwin
- programs invoked by test suite programs do not consider themselves to
- be in a cygwin environment.
- (_dll_crt0): Ditto. Move environment checks to initial_env function to
- conserve on stack space.
- (initial_env): New function. Checks for testing and debugging
- environment variables.
- * init.cc (cygwin_hmodule): Move declaration.
- * winsup.h: Declare variables used for cygwin testing.
-
-Tue Oct 9 19:17:53 2001 Christopher Faylor <cgf@cygnus.com>
-
- * uinfo.cc (internal_getlogin): Reorganize slightly to minimize work in
- default condition.
-
-Tue Oct 9 18:53:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_disk_file::open): Add missing case clash check.
-
-Mon Oct 8 01:47:27 2001 Christopher Faylor <cgf@cygnus.com>
-
- * dtable.cc (dtable::build_fhandler): Allocate correct amount for given
- fhandler class.
- * fhandler.h (fhandler_union): Properly define rather than relying on
- fhandler_console being "big enough".
-
-Mon Oct 8 00:25:18 2001 Christopher Faylor <cgf@cygnus.com>
-
- * external.cc (fillout_pinfo): Reset counter whenever we initialize the
- pid list.
-
-Sun Oct 7 17:16:05 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (normalize_posix_path): Don't eat a '.' after a '\\' since it
- has special meaning on NT.
-
- * syscalls.cc (access): Use stat_worker.
-
-Fri Oct 5 21:01:14 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.cc (fhandler_base::fork_fixup): Protect dup'ed handle and
- record it as non-inheritable for debugging purposes in case there is a
- subsequent fork or exec.
- * fhandler_tty.cc (fhandler_tty_common::fixup_after_fork): Allow
- fork_fixup to call ProtectHandle.
-
-Fri Oct 5 14:22:47 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (get_raw_device_number): Correct length arguments for
- wdeveqn.
-
-Fri Oct 5 11:05:32 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (getcwd): Allow NULL first argument.
-
-Fri Oct 5 00:31:35 2001 Christopher Faylor <cgf@cygnus.com>
-
- * heap.h (inheap): Check for NULL.
-
-Thu Oct 4 23:17:49 2001 Christopher Faylor <cgf@cygnus.com>
-
- Add second path_conv * argument to fstat()s throughout.
- * fhandler.h: Change read and fstat to regparm/stdcall throughout.
- (fhandler_base::fstat): Just declare. Don't define.
- (fhandler_disk_file::fstat_helper): Declare.
- * fhandler.cc (fhandler_base::fstat): Move here from fhandler.h, adapt
- from former stat_dev().
- (fhandler_disk_file::fstat): Move most of the disk-file-specific logic
- from stat_worker to here. Use fstat_helper to derive final fstat
- output.
- (fhandler_disk_file::fstat_helper): New method, renamed from former
- fstat method.
- (num_entries): Moved here from syscalls.cc.
- * fhandler_mem.cc (fhandler_dev_mem::fstat): Use base class to
- initialize most stuff. Invert has_physical_mem_access test for
- establishing permissions.
- * fhandler_raw.cc (fhandler_dev_raw::fstat): Eliminate unneed test and
- memory clearing. Use base class to initialize most stuff.
- * syscalls.cc (stat_dev): Eliminate.
- (stat_worker): Simply call fstat method to generate fstat output. Move
- all device specific code to appropriate fstats.
-
- * dir.cc (opendir): Pass correct arg to stat_worker to allow following
- symlinks.
-
-Thu Oct 4 21:37:57 2001 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (perhaps_suffix): Return NULL on non-existence of file as
- well as "directoryness". Previous code modified on 2001/09/30 actually
- had an arguable bug which was unmasked by the change on that day.
-
-Thu Oct 4 20:52:42 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (path_conv::check): Return ENOTDIR when leading device and
- trailing component.
-
-Thu Oct 4 18:49:23 2001 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (stat_worker): Make global. Accept path_conv parameter
- for passing information back to caller.
- * winsup.h: Declare stat_worker.
- * dir.cc (opendir): Use stat_worker rather than stat and pass path_conv
- parameter to stat_worker for later inspection.
-
-2001-10-04 Karellen (karellen@boreworms.com)
-
- * syslog.cc (syslog): Teach syslog about syslog priorities other than
- LOG_ERR, LOG_WARNING and LOG_INFO
-
-Thu Oct 4 15:50:03 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (path_conv::check): Don't perform file system or rootdir
- checks on devices.
-
-Wed Oct 3 19:40:36 2001 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (dll_crt0_1): Don't close hexec_proc if it is NULL.
-
- * fork.cc (vfork): Add debugging statements.
-
- * path.cc (get_device_number): Make static. Rewrite to inspect both unix
- and windows paths.
- (get_raw_device_number): Just check for parts of raw device that we
- care about.
- (get_devn): New function, pulled from get_device_number.
- (win32_device_name): Accommodate arg changes to get_device_number.
- (mount_info::get_device_number): Call get_device_number on translated
- Windows path.
-
- * spawn.cc (spawn_guts): Don't treat P_VFORK differently from P_NOWAIT.
- Add handle to child's shared region to child so that it will be
- preserved if the parent goes away.
- * fhandler.h: Throughout, simplify to one open method for all fhandler
- classes, requiring a path_conv first element.
- * fhandler.cc (fhandler_base::open): Remove obsolete method.
- Generalize to require path_conv * as first argument.
- (fhandler_disk_file::open): Remove obsolete method.
- (fhandler_disk_file::open): Use path_conv pointer rather than
- reference.
- * fhandler_clipboard.cc (fhandler_dev_clipboard::dup): Use new open
- method.
- (fhandler_dev_clipboard::open): Accommodate new argument for open
- methods.
- * fhandler_console.cc (fhandler_console::open): Ditto.
- (fhandler_console::dup): Use new open method.
- (fhandler_console::fixup_after_fork): Ditto.
- (fhandler_console::fixup_after_exec): Ditto.
- * fhandler_dsp.cc (fhandler_dev_dsp::open): Accommodate new argument for
- open methods.
- * fhandler_floppy.cc (fhandler_dev_floppy::open): Ditto.
- * fhandler_mem.cc (fhandler_dev_mem::open): Ditto.
- * fhandler_random (fhandler_dev_random::open): Ditto.
- * fhandler_raw.cc (fhandler_dev_raw::open): Ditto.
- * fhandler_serial.cc (fhandler_serial::open): Ditto.
- * fhandler_tape.cc (fhandler_dev_tape::open): Ditto.
- * fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
- (fhandler_pty_master::open): Ditto.
- * fhandler_windows.cc (fhandler_windows::open): Ditto.
- * fhandler_zero.cc (fhandler_dev_zero::open): Ditto.
- * fhandler_socket.cc (fhandler_socket::set_connect_secret): Accommodate
- new argument for open methods.
- * syscalls.cc (_open): Ditto.
- (stat_worker): Ditto.
-
-Tue Oct 2 23:49:18 2001 Christopher Faylor <cgf@cygnus.com>
-
- * cygheap.cc (cfree): Remove malloc debugging probe.
- * dlmalloc.c (errprint): Remove abort() call which causes interesting
- error message printing to abort prematurely.
- * environ.cc: Sprinkle MALLOC_CHECKs liberally throughout.
- (_addenv): Allocate two empty elements at end of environ to
- (apparently) work around problems with some buggy applications.
- (winenv): Avoid calling alloca if no forced environment variable is
- present.
-
- * exceptions.cc (open_stackdumpfile): Don't print "Dumping stack trace
- to..." when running in a cygwin environment (i.e., the parent is a
- cygwin process).
-
- * dtable.cc (dtable::init_std_file_from_handle): Move device type
- detection code from build_fhandler here since it is only used by this
- function.
- (dtable::build_fhandler_from_name): New method. Renamed from
- dtable::build_fhandler.
- (dtable::build_fhandler): Use build_fhandler_from_name.
- (cygwin_attach_handle_to_fd): Ditto.
- * syscalls.cc (_open): Ditto.
- (stat_worker): Ditto.
- * dtable.h (dtable::build_fhandler_from_name): Rename declaration from
- dtable::build_fhandler.
-
-Mon Oct 1 16:52:23 2001 Christopher Faylor <cgf@cygnus.com>
-
- * dtable.h (dtable::build_fhandler): Make path_conv parameter
- non-optional.
- (dtable::init_std_file_from_handle): Eliminate name parameter.
- * dtable.cc (stdio_init): Don't pass bogus name to
- init_std_file_from_handle. The function will figure out the name
- itself.
- (dtable::init_std_file_from_handle): Eliminate name parameter. Assume
- that we're always called with an appropriate fd. Pass name as NULL if
- we can't simply figure it out from context.
- (cygwin_attach_handle_to_fd): Pass path_conv argument to
- build_fhandler.
- (dtable::build_fhandler): Make path_conv argument mandatory. Eliminate
- specific call to get_device_number. With unknown device names, set
- name from handle context for parsing by path_conv.
- (dtable::build_fhandler): Pass path_conv argument to build_fhandler.
- * path.h (path_conv::set_isdisk): Set disk device type.
- (path_conv::is_device): Don't consider FH_DISK a "device".
- * syscalls.cc (_open): Pass path_conv argument by reference.
- (stat_worker): Ditto.
- (_rename): Use path_conv operators. Add bounds to DeleteFile/MoveFile
- for loop.
-
-Mon Oct 1 14:25:00 2001 Charles Wilson <cwilson@ece.gatech.edu>
-
- * cygwin.din: export strtoll and strtoull
-
-Sun Sep 30 22:51:41 2001 Christopher Faylor <cgf@cygnus.com>
-
- Add "path.h" include throughout, where needed. Use new path_conv
- methods and operators to simplify testing for directory and attributes,
- throughout.
- * path.h (path_conv::exists): New method.
- (path_conv::has_attribute): Ditto.
- (path_conv::isdir): Ditto.
- (path_conv::DWORD &): New operator.
- (path_conv::int &): Ditto.
- * dir.cc (rmdir): Eliminate a goto.
- * dtable.cc (dtable::build_fhandler): Accept opt and suffix info for
- path_conv.check. Return fh == NULL on path_conv error. Pass unit to
- set_name as appropriate.
- (dtable::reset_unix_path_name): New method.
- * dtable.h (dtable): Declare new method. Reflect arg changes to
- build_fhandler.
- * fhandler.cc (fhandler_disk_dummy_name): Eliminate.
- (fhandler_base::set_name): Expect paths to be NULL. Build
- unix_path_name from win32_path_name when it is a device.
- (fhandler_base::reset_unix_path_name): New method.
- (fhandler_base::raw_read): Report EISDIR when ERROR_INVALID_FUNCTION
- or ERROR_INVALID_PARAMETER and reading a directory.
- (fhandler_disk_file::fstat): Don't call stat_dev since we should now
- never be calling fhandler_disk_file methods with devices.
- (fhandler_base::fhandler_base): Clear {unix,win32}_path_name.
- (fhandler_base::~fhandler_base): Always free {unix,win32}_path_name.
- (fhandler_disk_file::fhandler_disk_file): Remove set_no_free_names
- kludge.
- (fhandler_disk_file::open): Ditto.
- * fhandler.h (fhandler_base::no_free_names): Eliminate.
- (fhandler_base::set_no_free_names): Ditto.
- * fhandler_tty.cc (fhandler_tty_slave::fhandler_tty_slave): Don't set
- unix_path_name here.
- * path.cc (fchdir): Lock fd table throughout. Use new
- dtable::reset_unix_path_name method to reset path.
- * syscalls.cc (stat_worker): Reorganize to always call fstat method.
- Pass path_conv method to fhandler_*::open.
- (chroot): Elminate a goto.
-
-Sun Sep 30 17:37:43 2001 Christopher Faylor <cgf@cygnus.com>
-
- * environ.cc (winenv): Allocate exact amount of space needed for forced
- windows environment variable rather than just using MAX_PATH.
-
-Sun Sep 30 17:10:18 2001 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Depend on stamp to ensure rebuilding. Remove stamp file
- when we've just built the DLL.
-
-Mon Oct 1 00:34:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * thread.cc (pthread_cond_dowait): Hopefully eliminate a race on multiple thread
- wakeups.
-
-Sat Sep 29 18:26:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * pthread.cc (pthread_cond_timedwait): Deleted - exported from thread.cc.
- (pthread_cond_wait): Deleted - exported from thread.cc.
- * thread.cc (pthread_cond::BroadCast): Update to use the new syntax for
- verifyable_object_isvalid ().
- (pthread_cond::Signal): Ditto. Also attempt to fix the lost signal race
- with pthread_cond::TimedWait().
- (check_valid_pointer): Change definiton to void const *.
- (verifyable_object_isvalid): Add new parameter to allow identification of
- static initializers, and return a enum rather than magic numbers.
- (__pthread_create): Ditto.
- (__pthread_cleanup): Ditto.
- (__pthread_attr_init): Ditto.
- (__pthread_attr_getinheritsched): Ditto.
- (__pthread_attr_getschedparam): Ditto.
- (__pthread_attr_getschedpolicy): Ditto.
- (__pthread_attr_getscope): Ditto.
- (__pthread_attr_setdetachstate): Ditto.
- (__pthread_attr_getdetachstate): Ditto.
- (__pthread_attr_setinheritsched): Ditto.
- (__pthread_attr_setschedparam): Ditto.
- (__pthread_attr_setschedpolicy): Ditto.
- (__pthread_attr_setscope): Ditto.
- (__pthread_attr_setstacksize): Ditto.
- (__pthread_attr_getstacksize): Ditto.
- (__pthread_attr_destroy): Ditto.
- (__pthread_join): Ditto.
- (__pthread_detach): Ditto.
- (__pthread_suspend): Ditto.
- (__pthread_continue): Ditto.
- (__pthread_getschedparam): Ditto.
- (__pthread_getsequence_np): Ditto.
- (__pthread_key_create): Ditto.
- (__pthread_key_delete): Ditto.
- (__pthread_setschedparam): Ditto.
- (__pthread_setspecific): Ditto.
- (__pthread_getspecific): Ditto.
- (__pthread_cond_destroy): Ditto.
- (__pthread_cond_init): Ditto.
- (__pthread_cond_broadcast): Ditto.
- (__pthread_cond_signal): Ditto.
- (__pthread_condattr_init): Ditto.
- (__pthread_condattr_getpshared): Ditto.
- (__pthread_condattr_setpshared): Ditto.
- (__pthread_condattr_destroy): Ditto.
- (__pthread_kill): Ditto.
- (__pthread_mutex_init): Ditto.
- (__pthread_mutex_getprioceiling): Ditto.
- (__pthread_mutex_lock): Ditto.
- (__pthread_mutex_trylock): Ditto.
- (__pthread_mutex_unlock): Ditto.
- (__pthread_mutex_destroy): Ditto.
- (__pthread_mutex_setprioceiling): Ditto.
- (__pthread_mutexattr_getprotocol): Ditto.
- (__pthread_mutexattr_getpshared): Ditto.
- (__pthread_mutexattr_gettype): Ditto.
- (__pthread_mutexattr_init): Ditto.
- (__pthread_mutexattr_destroy): Ditto.
- (__pthread_mutexattr_setprotocol): Ditto.
- (__pthread_mutexattr_setprioceiling): Ditto.
- (__pthread_mutexattr_getprioceiling): Ditto.
- (__pthread_mutexattr_setpshared): Ditto.
- (__pthread_mutexattr_settype): Ditto.
- (__sem_init): Ditto.
- (__sem_destroy): Ditto.
- (__sem_wait): Ditto.
- (__sem_trywait): Ditto.
- (__sem_post): Ditto.
- (__pthread_cond_dowait): New function, contains core logic from
- __pthread_cond_wait and __pthread_cond_timedwait. Decrement (*cond)->waiting
- before reentering the cond access mutex to allow detection of lost signals.
- (__pthread_cond_timedwait): Rename to pthread_cond_timedwait, and call
- __pthread_cond_dowait after calculating the wait length.
- (__pthread_cond_wait): Rename to pthread_cond_wait, and call
- __pthread_cond_dowait.
- * thread.h: New enum for use with verifyable_object_isvalid.
- Remove the extern exporting of __pthread_cond_timedwait and __pthread_cond_wait.
-
-Fri Sep 28 21:18:50 2001 Christopher Faylor <cgf@cygnus.com>
-
- * pipe.cc (fhandler_pipe::fixup_after_fork): New method.
- * fhandler.h (fhandler_pipe::fixup_after_fork): Declare new method.
-
-Fri Sep 28 03:23:04 2001 Christopher Faylor <cgf@cygnus.com>
-
- * passwd.cc (read_etc_passwd): Bother with unlocking when not
- in cygwin initialization.
- * grp.cc (read_etc_group): Ditto.
-
-Fri Sep 28 02:57:03 2001 Christopher Faylor <cgf@cygnus.com>
-
- * passwd.cc (read_etc_passwd): Don't bother with locking when
- in cygwin initialization since there is only one thread.
- * grp.cc (read_etc_group): Ditto.
-
-Fri Sep 28 01:50:09 2001 Christopher Faylor <cgf@cygnus.com>
-
- * pipe.cc (fhandler_pipe::hit_eof): Return correct value when there is
- no EOF event available.
-
-Sat Sep 28 00:34:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * mmap.cc (mmap): Move setting the access after evaluating fd.
- Remove useless comment. Explain copy-on-write problem of 9x
- more detailed. Don't set access to FILE_MAP_COPY on 9x only
- when anonymous mapping is requested.
- (fhandler_disk_file::mmap): Remove useless device check.
- Add debug output.
-
-Fri Sep 27 07:35:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * Makefile.in: Only stamp winver_stamp on success.
-
-Wed Sep 26 16:02:35 2001 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (peek_pipe): REALLY only grab mutex when we actually got
- something from the pipe.
-
-Tue Sep 25 21:25:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * thread.cc (pthread_cond::BroadCast): Use address with verifyable_object_isvalid().
- (pthread_cond::Signal): Ditto.
- (__pthread_create): Ditto.
- (__pthread_cleanup): Ditto.
- (__pthread_attr_init): Ditto.
- (__pthread_attr_getinheritsched): Ditto.
- (__pthread_attr_getschedparam): Ditto.
- (__pthread_attr_getschedpolicy): Ditto.
- (__pthread_attr_getscope): Ditto.
- (__pthread_attr_setdetachstate): Ditto.
- (__pthread_attr_getdetachstate): Ditto.
- (__pthread_attr_setinheritsched): Ditto.
- (__pthread_attr_setschedparam): Ditto.
- (__pthread_attr_setschedpolicy): Ditto.
- (__pthread_attr_setscope): Ditto.
- (__pthread_attr_setstacksize): Ditto.
- (__pthread_attr_getstacksize): Ditto.
- (__pthread_attr_destroy): Ditto.
- (__pthread_join): Ditto.
- (__pthread_detach): Ditto.
- (__pthread_suspend): Ditto.
- (__pthread_continue): Ditto.
- (__pthread_getschedparam): Ditto.
- (__pthread_getsequence_np): Ditto.
- (__pthread_key_create): Ditto.
- (__pthread_key_delete): Ditto.
- (__pthread_setschedparam): Ditto.
- (__pthread_setspecific): Ditto.
- (__pthread_getspecific): Ditto.
- (__pthread_cond_destroy): Ditto.
- (__pthread_cond_init): Ditto.
- (__pthread_cond_broadcast): Ditto.
- (__pthread_cond_signal): Ditto.
- (__pthread_cond_timedwait): Ditto.
- (__pthread_cond_wait): Ditto.
- (__pthread_condattr_init): Ditto.
- (__pthread_condattr_getpshared): Ditto.
- (__pthread_condattr_setpshared): Ditto.
- (__pthread_condattr_destroy): Ditto.
- (__pthread_kill): Ditto.
- (__pthread_mutex_init): Ditto.
- (__pthread_mutex_getprioceiling): Ditto.
- (__pthread_mutex_lock): Ditto.
- (__pthread_mutex_trylock): Ditto.
- (__pthread_mutex_unlock): Ditto.
- (__pthread_mutex_destroy): Ditto.
- (__pthread_mutex_setprioceiling): Ditto.
- (__pthread_mutexattr_getprotocol): Ditto.
- (__pthread_mutexattr_getpshared): Ditto.
- (__pthread_mutexattr_gettype): Ditto.
- (__pthread_mutexattr_init): Ditto.
- (__pthread_mutexattr_destroy): Ditto.
- (__pthread_mutexattr_setprotocol): Ditto.
- (__pthread_mutexattr_setprioceiling): Ditto.
- (__pthread_mutexattr_getprioceiling): Ditto.
- (__pthread_mutexattr_setpshared): Ditto.
- (__pthread_mutexattr_settype): Ditto.
- (__sem_init): Ditto.
- (__sem_destroy): Ditto.
- (__sem_wait): Ditto.
- (__sem_trywait): Ditto.
- (__sem_post): Ditto.
- (verifyable_object_isvalid): Recieve a pointer to a pointer for verification.
- (__pthread_mutexattr_getprotocol): Fix typo in magic number.
- (__pthread_mutexattr_getpshared): Ditto.
- (__pthread_mutexattr_gettype): Ditto.
- * thread.h (verifyable_object_isvalid): Change prototype to recieve a pointer to a
- pointer for verification.
- * include/pthread.h: Fix typo for __cleanup_routine_type typedef. (Contrib from Net).
-
-Tue Sep 25 02:09:42 2001 Christopher Faylor <cgf@redhat.com>
-
- * select.cc (fhandler_tty_common::ready_for_read): Rewrite to correctly
- call peek_pipe.
-
-Mon Sep 24 18:46:39 2001 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (peek_pipe): Only grab mutex when we actually got something
- from the pipe.
-
-Mon Sep 24 17:41:03 2001 Christopher Faylor <cgf@redhat.com>
-
- * fhandler.h (fhandler_pipe::hit_eof): New method.
- (writepipe_exists): New class element.
- (orig_pid): Ditto.
- (id): Ditto.
- (is_slow): Eliminate.
- * pipe.cc (fhandler_pipe::set_close_on_exec): Set inheritance on
- writepipe_exists, if it exists.
- (fhandler_pipe::hit_eof): New method, modelled after tty.
- (fhandler_pipe::dup): Duplicate writepipe_exists, if it exists.
- (make_pipe): Set up a dummy event for pipes on windows 9x. The
- nonexistence of this event means that the write side of the
- pipe has closed.
- (_dup): Move to syscalls.cc
- (_dup2): Ditto.
-
- * dtable.cc (dtable::build_fhandler): Fill out set_names here, if
- appropriate.
- * syscalls.cc (_open): Call set_names in build_fhandler.
-
-Sun Sep 23 16:55:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * syscalls.cc (_open): Set name in fhandler object after successful
- creation.
- (stat_dev): Set device type to block device in FH_FLOPPY case.
-
-Sun Sep 23 11:15:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * dtable.cc (dtable::build_fhandler): Initialize unit when using
- optional path_conv argument.
-
-Sat Sep 22 17:33:45 2001 Christopher Faylor <cgf@cygnus.com>
- Corinna Vinschen <corinna@vinschen.de>
-
- * dtable.cc (dtable::build_fhandler): Accept an optional path_conv
- argument. If available, use this to calculate path name and device
- number.
- * dtable.h (dtable): Reflect above change.
- * fhandler.h (fhandler_base): Declare virtual method which accepts
- path_conv rather than path string as first argument.
- * fhandler.cc (fhandler_base::open): Define above new method.
- * syscalls.cc (_open): Set aside a path_conv variable for use in
- build_fhandler and subsequent call to open.
-
-Sat Sep 22 12:44:57 2001 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (setup_handler): Always relinquish lock after we've
- interrupted.
- * fhandler.cc: Move pipe methods to pipe.cc.
- * fhandler.h (fhandler_pipe): Add new methods.
- * fork.cc (sync_with_parent): Make error messages more informative.
- * pipe.cc (fhandler_pipe::fhandler_pipe): Move here from fhandler.cc.
- (fhandler_pipe::lseek): Ditto.
- (fhandler_pipe::set_close_on_exec): New method.
- (fhandler_pipe::read): Ditto.
- (fhandler_pipe::close): Ditto.
- (fhandler_pipe::dup): Ditto.
- (make_pipe): Create the guard mutex on the read side of the pipe.
- * select.cc (peek_pipe): Use guard_mutex to discover if we have the
- right to read on this pipe.
- (fhandler_pipe::readh_for_read): Pass the read pipe guard mutex to
- peek_pipe.
- * syscalls.cc (_read): Always detect signal catchers, for now.
-
- * debug.cc (makethread): Eliminate hack to make thread inheritable.
- * sigproc.cc (subproc_init): Don't use hack to make thread inheritable.
-
-Thu Sep 20 16:48:44 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.cc (fhandler_base::set_inheritance): Just use
- DUPLICATE_CLOSE_SOURCE to change inheritance. Eliminate all other
- logic dealing with closed handles.
- * fhandler.h (fhandler_base::set_inheritance): Reflect above change.
- * fhandler_tty.cc (fhandler_tty_common::set_close_on_exec): Ditto.
-
-Thu Sep 20 13:34:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_socket.cc (fhandler_socket::fixup_after_exec): Close
- socket only when not using Winsock2.
-
-Thu Sep 20 13:20:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.h (fhandler_socket::fixup_after_exec): Remove inline
- implementation.
- (fhandler_dev_raw::fixup_after_exec): Ditto.
- * fhandler_raw.cc (fhandler_dev_raw::fixup_after_fork): Don't
- duplicate buffer on fork to avoid memory leak.
- (fhandler_dev_raw::fixup_after_exec): New implementation equal to
- former fixup_after_fork() implementation.
- * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Do
- nothing when not using Winsock2.
- (fhandler_socket::fixup_after_exec): New implementation.
- (fhandler_socket::set_close_on_exec): Never call set_inheritance().
-
-Thu Sep 20 9:55:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_base::set_inheritance): If available,
- use SetHandleInformation() to set inheritance.
- * wincap.cc: Set flag has_set_handle_information_on_console_handles
- appropriately.
- * wincap.h: Add flag has_set_handle_information_on_console_handles.
-
-Wed Sep 19 12:24:09 2001 Christopher Faylor <cgf@cygnus.com>
-
- * lib/getopt.c (__progname): Don't declare if not compiling for cygwin.
-
-Wed Sep 19 18:07:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * lib/getopt.c (getopt_long): Avoid compiler warning.
-
-Wed Sep 19 11:52:42 2001 Christopher Faylor <cgf@cygnus.com>
-
- * lib/getopt.c: Use __progname==__argv[0] when not compiling for cygwin.
-
- * scandir.cc (scandir): Use correct default when compar == NULL.
-
-Wed Sep 19 17:49:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_socket.cc (fhandler_socket::fhandler_socket): Revert
- memory allocation to use cmalloc again.
-
-Tue Sep 18 21:04:26 2001 Christopher Faylor <cgf@cygnus.com>
-
- * cygwin.din (__argv): Export.
- (__argc): Ditto.
- (__progname): Ditto.
- * include/getopt.h (getopt_long): constify arguments.
- * lib/getopt.c: Import new file from NetBSD.
-
-Tue Sep 18 18:21:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * mmap.cc (mmap): Don't reuse anonymous memory in MAP_FIXED case.
-
-Mon Sep 17 17:29:25 2001 Christopher Faylor <cgf@cygnus.com>
-
- * include/io.h: Add access declaration.
-
-Mon Sep 17 14:04:27 2001 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (rmdir): Set cwd to some other location if attempting to
- rmdir current working directory.
-
-Sun Sep 16 23:04:31 2001 Christopher Faylor <cgf@cygnus.com>
-
- * dtable.h (not_open): Assure inline.
- * fhandler.h (operator []): Make const.
-
-Sun Sep 16 23:02:57 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * sync.cc (muto::~muto): Fix typo which stopped muto event handle from
- ever being closed.
-
-2001-09-16 Egor Duda <deo@logos-m.ru>
-
- * path.cc (symlink): Check arguments for validity.
- (getcwd): Ditto.
- * syscalls.cc (ftruncate): Ditto.
- * times.cc (times): Ditto.
- * uname.cc (uname): Ditto.
-
-Sat Sep 15 22:54:49 2001 Christopher Faylor <cgf@cygnus.com>
-
- * net.cc (dup_servent_ptr): Detect old Windows 95 misaligned structure
- and realign appropriately.
-
-Sat Sep 15 00:28:40 2001 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Generate libcygwin.a during the link pass rather than as
- a separate dlltool step.
- * dcrt0.cc (_dll_crt0): pppid_handle could be NULL. Don't close it if
- so.
-
-Fri Sep 14 20:48:18 2001 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (dll_crt0_1): Create vfork main storage here so that it can
- be queried in waitsig later.
- * sigproc.cc (wait_sig): Don't deliver a signal if in a vfork.
- * sigproc.h (sigframe::init): New method.
- (sigframe): Use init.
- * perthread.h: Declare main_vfork.
- * fork.cc (vfork): Deliver all signals on parent return from vfork.
-
-Fri Sep 14 10:21:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * dcrt0.cc (_dll_crt0()): Don't call wincap.init() here.
-
-Fri Sep 14 00:37:54 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fork.cc (vfork): Avoid recursive vforks.
-
-Fri Sep 14 00:18:52 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h (fhandler_pipe::is_slow): Return true only if pipes are
- reliable (i.e., not Win9x).
- * wincap.cc: Make statics NO_COPY to avoid fork overhead.
-
-Thu Sep 13 23:01:00 2001 Christopher Faylor <cgf@cygnus.com>
-
- * grp.cc (read_etc_group): Just reuse group_buf storage for subsequent
- reread of /etc/group.
- * passwd.cc (read_etc_passwd): Just reuse passwd_buf storage for
- subsequent reread of /etc/passwd.
-
-Thu Sep 13 20:46:05 2001 Christopher Faylor <cgf@cygnus.com>
-
- * cygheap.cc (dup_now): New function.
- (cygheap_setup_for_child): Accept new argument controlling whether to
- delay copying of cygheap to shared memory region.
- (cygheap_setup_for_child_cleanup): Accept new arguments controlling
- whether to copy cygheap at this point.
- * cygheap.h: Reflect above changes.
- * fork.cc (fork_parent): Break copying of cygheap into two parts when
- fork_fixup is required so that the child can see the parent's changes.
- (vfork): Do stack cleanup prior to forcing a fork error.
- * spawn.cc (spawn_guts): Ditto.
-
-Thu Sep 13 17:14:59 2001 Christopher Faylor <cgf@cygnus.com>
-
- * cygheap.cc (ccalloc): Pass correct length to creturn so that
- cygheap_max is correctly calculated.
-
-Wed Sep 12 21:06:38 2001 Christopher Faylor <cgf@cygnus.com>
-
- * sync.cc (muto::acquire): Fix while/if typo.
-
-Wed Sep 12 23:06:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * wincap.cc (wincapc::init): Simplify W2K/XP case.
-
-Wed Sep 12 23:02:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * wincap.cc (wincapc::init): Set os name to "NT" on XP, too.
-
-Wed Sep 12 19:00:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * Makefile.in: Build wincap.o.
- * wincap.cc: New file.
- * wincap.h: Ditto.
- * autoload.cc: Add dynamic load statement for `CreateHardLinkA'.
- * dcrt0.cc (os_being_run): Eliminated.
- (osname): Ditto.
- (iswinnt): Ditto.
- (set_os_type): Ditto.
- (dll_crt0_1): Call wincap.init() instead of set_os_type().
- (_dll_crt0): Ditto.
- * environ.cc (set_chunksize): New function.
- (parse_thing): `forkchunk' setting now invokes function `set_chunksize'.
- * fork.cc (chunksize): Eliminated. Moved to be member of wincap.
- * host_dependent.h: Removed.
- * syscalls.cc (_link): Try using `CreateHardLinkA' first, if available.
- * cygheap.cc, dcrt0.cc, delqueue.cc, dir.cc,
- environ.cc, fhandler.cc, fhandler.h, fhandler_console.cc,
- fhandler_mem.cc, fork.cc, mmap.cc, net.cc, pinfo.cc, pinfo.h,
- security.cc, syscalls.cc, sysconf.cc, syslog.cc, thread.cc,
- times.cc, tty.cc, uinfo.cc, uname.cc, winsup.h: Use new wincap
- capability check throughout.
- * winsup.h: Include wincap.h. Eliminate extern declarations of
- `os_being_run' and `iswinnt'. Eliminate `os_type" definition.
- * include/cygwin/version.h: Bump version to 1.3.4.
-
-Wed Sep 12 01:03:36 2001 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (call_signal_handler_now): Add additional guard against
- inappropriately calling signal handler.
- * syscalls.cc (_read): Reset errno if not exiting due to signal.
-
-Wed Sep 12 13:03:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * autoload.cc (LoadDLLfuncEx): Auto load TryEnterCriticalSection - it's
- an NT only call.
- * thread.cc (pthread_cond::TimedWait): Use critical sections for NT.
- (pthread_cond::fixup_after_fork): Don't detect bad apps.
- (pthread_mutex::pthread_mutex): Use critical sections for NT.
- (pthread_mutex::~pthread_mutex): Ditto.
- (pthread_mutex::Lock): Ditto.
- (pthread_mutex::TryLock): Ditto.
- (pthread_mutex::UnLock): Ditto.
- (pthread_mutex::fixup_after_fork): Ditto. Also do not detect bad apps.
- (__pthread_mutex_trylock): Move WIN32 specific test into the class
- method.
- (__pthread_mutex_destroy): Prevent dereferencing passed pointer without
- valid address.
- * thread.h (pthread_mutex): Use critical sections for NT.
-
-Tue Sep 11 21:55:37 2001 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.h (sigframe::unregister): Return true/false whether this
- frame is capable of responding to signals.
- * exceptions.cc (sigframe::call_signal_handler): Don't call signal
- handler if it is not armed for this thread.
-
-Tue Sep 11 11:23:10 2001 Christopher Faylor <cgf@cygnus.com>
-
- * cygwin.din: Remove cygwin_getshared.
- * shared.cc: Ditto.
- * include/cygwin/version.h: Bump API minor number.
-
-Tue Sep 11 11:14:11 2001 Dmitry Timoshkov <dmitry@baikal.ru>
-
- * dtable.cc (dtable::build_fhandler): Fix incorrect test for socket.
-
-Tue Sep 11 21:22:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * thread.cc (pthread_cond::~pthread_cond): Fix incorrect use of
- InterlockExchangePointer.
- (pthread_mutex::~pthread_mutex): Ditto.
- (semaphore::~semaphore): Ditto.
-
-Tue Sep 11 18:15:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * dcrt0.cc (cygwin_finished_initializing): Copy _mtinterf on fork.
- * fork.cc (fork_child): Fixup thread-related structures after fork.
- * thread.cc (MTinterface::Init): Initialise the new mutex, condition
- and semaphore lists.
- (MTinterface::fixup_after_fork): Iterate through each list and fixup
- the objects.
- (pthread_cond::pthread_cond): Add this to the condition list.
- (pthread_cond::~pthread_cond): Remove this from the condition list.
- (pthread_cond::fixup_after_fork): Recreate as best we can the pre-fork
- state.
- (pthread_mutex::pthread_mutex): Add this to the mutex list.
- (pthread_mutex::~pthread_mutex): Remove this from the mutex list.
- (pthread_mutex::fixup_after_fork): Recreate as best we can the pre-fork
- state.
- (semaphore::semaphore): Store the initial value, and add this to the
- semaphore list.
- (semaphore::~semaphore): Remove this from the semaphore list.
- (semaphore::Post): Increment the current semaphore value.
- (semaphore::TryWait): Decrement the current semaphore value.
- (semaphore::Wait): Ditto.
- (semaphore::fixup_after_fork): Recreate the pre-fork state as best we
- can.
- * thread.h (pthread_mutex): New members to allow fixup_after_fork.
- (pthread_cond): Ditto.
- (semaphore): Ditto.
- (MTinterface): New list heads for tracking conds and semaphores.
-
-Sun Sep 9 22:11:27 2001 Christopher Faylor <cgf@cygnus.com>
-
- * dtable.cc (dtable::fixup_after_fork): Use SetStdHandle appropriately
- on inherited fds.
-
-Sun Sep 9 20:09:11 2001 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.cc (NZOMBIES): Reduce substantially to minimize memory use.
-
-Mon Sep 10 08:28:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * thread.h (MT_Interface): Remove pshared mutex array. Add a
- threadsafe list for mutex tracking (for fixup after fork).
- * thread.cc (MTInterface::Init): Remove pshared mutex array.
- (pthread_mutex::pthread_mutex): Remove pshared mutex functionality.
- Fail with EINVAL on attempts to use pshared functionality.
- (__pthread_mutex_getpshared): Remove.
- (__pthread_cond_timedwait): Remove pshared mutex functionality.
- (__pthread_cond_wait): Ditto.
- (__pthread_mutex_init): Ditto.
- (__pthread_mutex_getprioceiling): Ditto.
- (__pthread_mutex_lock): Ditto.
- (__pthread_mutex_trylock): Ditto.
- (__pthread_mutex_unlock): Ditto.
- (__pthread_mutex_destroy): Ditto.
- (__pthread_mutex_setprioceiling): Ditto.
- (__pthread_mutexattr_setpshared): Ditto.
-
-Sun Sep 9 23:09:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * pwdgrp.h (pwdgrp_check::set_last_modified): Call GetFileTime()
- instead of GetFileInformationByHandle().
-
-Sun Sep 9 15:59:53 2001 Christopher Faylor <cgf@cygnus.com>
-
- * heap.h (inheap): Rewrite macro to accommodate removal of brk macros
- below.
-
-Sun Sep 9 15:02:44 2001 Christopher Faylor <cgf@cygnus.com>
-
- * cygheap.cc (cygheap_fixup_in_child): Clear cygheap->base so that heap
- is not forced to start at the same place in execed process.
- * heap.cc: Remove brk* macros for clarity throughout.
- * heap.h: Ditto.
- * shared.cc (shared_info::initialize): Move heap_chunk test into
- heap_chunk_size().
- (heap_chunk_size): Check for chunk size here. Don't go to registry if
- heap_chunk_in_mb is already set.
-
- * smallprint.c (console_printf): Add Windows 95 concessions.
-
-Sun Sep 9 13:01:06 2001 Christopher Faylor <cgf@cygnus.com>
-
- * child_info.h (PROC_MAGIC): Bump magic number.
-
-Sun Sep 9 18:36:00 2001 Corinna Vinschen <corinna@vinschen.de>
- Christopher Faylor <cgf@cygnus.com>
-
- * cygheap.cc (init_cygheap::etc_changed): New method to signal
- a change in /etc.
- * cygheap.h (struct init_cygheap): Add member `etc_changed_h'
- and method `etc_changed'.
- * grp.cc (enum grp_state): Eliminate.
- (class grp_check): Ditto.
- (group_state): Define as `class pwdgrp_check'.
- (parse_grp): Remeber path and modification time of /etc/group file.
- * passwd.cc (enum_pwd_state): Eliminate.
- (class pwd_check): Ditto.
- (passwd_state): Define as `class pwdgrp_check'.
- (read_etc_passwd): Remember path and modification time of /etc/passwd
- file.
- * pwdgrp.h: New file.
- (enum pwdgrp_state): Substitutes `pwd_state' and `grp_state'.
- (class pwdgrp_check): Substitutes `pwd_check' and `grp_check'.
-
-Sun Sep 9 14:31:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * include/cygwin/version.h: Bump API minor version to 45 according
- to adding the gamm*_r functions.
-
-Sat Sep 8 23:32:18 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fork.cc (fork_parent): Stop malloc activity while fork is in control
- of the heap.
- * sigproc.cc (NZOMBIES): Rename from ZOMBIEMAX for clarity.
- (zombies): Revert to original behavior. Allocating zombie array
- resulted in performance hit.
- * winsup.h: Declare malloc lock routines.
-
-Fri Sep 7 21:35:35 2001 Christopher Faylor <cgf@cygnus.com>
-
- * cygwin.din: Add gamm*_r function exports.
-
-Fri Sep 7 17:11:11 2001 Christopher Faylor <cgf@cygnus.com>
-
- * cygheap.h (init_cygheap): Move heap pointers here.
- * include/sys/cygwin.h (perprocess): Remove heap pointers.
- * dcrt0.cc (__cygwin_user_data): Reflect obsolete perprocess stuff.
- (_dll_crt0): Don't initialize heap pointers.
- (cygwin_dll_init): Ditto.
- (release_upto): Use heap pointers from cygheap.
- * heap.h: Ditto.
- * fork.cc (fork_parent): Ditto. Don't set heap pointers in ch.
- (fork_child): Remove obsolete sigproc_fixup_after_fork.
- * shared.cc (memory_init): Reorganize so that cygheap initialization is
- called prior to regular heap since regular heap uses cygheap now.
- * sigproc.cc (proc_subproc): Eliminate zombies allocation.
- (sigproc_init): Move zombies alloation here. Don't free up array on
- fork, just reuse it.
- (sigproc_fixup_after_fork): Eliminate.
- * sigproc.h: Ditto.
- * include/cygwin/version.h: Reflect change to perprocess structure.
-
-Fri Sep 7 10:53:34 2001 Jason Tishler <jason@tishler.net>
-
- * poll.cc (poll): Change implementation to only call select() when no
- invalid file descriptors are specified.
-
-Fri Sep 7 10:27:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * include/limits.h: Define PIPE_BUF.
- * syscalls.cc (fpathconf): Use PIPE_BUF instead of numerical constant.
- (pathconf): Ditto.
-
-Thu Sep 6 20:04:05 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_socket.cc (fhandler_socket::fhandler_socket): Ensure that
- prot_info_ptr is zeroed for later use.
-
-Thu Sep 6 14:03:49 2001 Christopher Faylor <cgf@cygnus.com>
-
- * cygheap.cc (cygheap_fixup_in_child): Don't consider a NULL bucket as
- a candidate for deletion. It is actually the end of a linked list
- chain.
-
- * exceptions.cc (open_stackdumpfile): Default to "unknown" program name
- if myself->progname hasn't been filled out yet.
-
-Thu Sep 6 01:16:44 2001 Christopher Faylor <cgf@cygnus.com>
-
- Move appropriate variables to NO_COPY segment, throughout.
-
-Thu Sep 6 00:40:35 2001 Christopher Faylor <cgf@cygnus.com>
-
- Remove initialization of static or global values to zero, throughout.
- This just needlessly grows the size of the DLL.
- * tty.cc (tty::alive): Make inuse handle non-inheriting on open, just
- for thread safety.
-
-Wed Sep 5 23:36:03 2001 Christopher Faylor <cgf@cygnus.com>
-
- * cygheap.h (init_cygheap): Move bucket array here from cygheap.cc.
- * cygheap.cc: Throughout use bucket array from cygheap.
-
- * sigproc.cc (proc_subproc): Dynamically allocate zombie buffer to save
- DLL space.
- (sigproc_fixup_after_fork): Free zombie array after a fork.
- * sigproc.h (sigproc_fixup_after_fork): Declare.
-
-2001-09-06 Egor Duda <deo@logos-m.ru>
-
- * dir.cc (mkdir): Expand buffer for security descriptor to 4K to avoid
- stack corruption.
- * fhandler.cc (fhandler_base::open): Ditto.
- * path.cc (symlink): Ditto.
-
-Wed Sep 5 21:35:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * winver.rc: Change copyright to include 2001.
-
-Wed Sep 5 12:12:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_floppy.cc (fhandler_floppy::lseek): Remove iswinnt check.
-
-Wed Sep 5 11:34:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_socket.cc (fhandler_socket::close): Change 2MSL value
- according to MSDN.
-
-Wed Sep 5 10:14:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (cygwin_connect): Add WSAEALREADY and WSAEINVAL handling
- for non-blocking sockets.
-
-Tue Sep 4 22:42:13 2001 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (ctrl_c_handler): Only send SIGINT when we have a
- controlling terminal and we are the head of the process group.
-
-Tue Sep 4 16:48:14 2001 Christopher Faylor <cgf@cygnus.com>
-
- * thread.cc (InterlockedExchangePointer): Don't define if it already
- exists.
-
-Tue Sep 4 22:14:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * uname.cc (uname): Eliminate os specific retrieving of x86
- processor type.
-
-2001-09-04 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * fhandler_console.cc (fhandler_console::char_command): Save the cursor
- position relative to the top of the window.
- * fhandler_cc (fhandler_console::write): Ditto.
-
-Mon Sep 3 21:06:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * dir.cc (opendir): Write version information to __d_dirent->d_version.
-
-Mon Sep 3 18:34:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * cygwin.din: Add `dirfd'.
- * dir.cc (dirfd): New function.
- (opendir): Open a directory file descriptor and save it in
- __d_dirent->d_fd.
- (closedir): Close directory file descriptor.
- * include/cygwin/version.h: Bump API minor version to 44.
-
-Sun Sep 2 22:09:31 2001 Christopher Faylor <cgf@cygnus.com>
-
- * child_info.h: Modify magic number.
- * dcrt0.cc (_cygwin_testing): Define.
- (_dll_crt0): Set _cygwin_testing if CYGWIN_TESTING environment variable
- exists. Don't issue "conflicting versions" error if _cygwin_testing is
- true.
- * shared.cc (shared_name): Use _cygwin_testing global rather than
- testing the environment.
- * syscalls.cc (_write): Remove debugging info.
-
-Sat Sep 1 01:37:13 2001 Christopher Faylor <cgf@cygnus.com>
-
- * tty.cc (tty::create_inuse): Eliminate unneeded argument.
- * tty.h: Reflect above change.
- * fhandler_tty.cc: Reflect argument reduction in tty::create_inuse,
- throughout. Always make inuse inheritable.
-
-Sat Sep 1 01:10:07 2001 Christopher Faylor <cgf@cygnus.com>
-
- * debug.cc (mark_closed): Rename from debug_mark_closed and make
- static.
- (setclexec_pid): New function for marking saved handle as
- close-on-exec.
- (delete_handle): New function.
- (debug_fixup_after_fork): New function.
- * debug.h: Declare new functions, remove obsolete ones.
- * fork.cc (debug_fixup_after_fork): Call to cleanup close-on-exec
- handles.
-
- * fhandler.cc (fhandler_disk_file::close): Minor reorg.
- (fhandler_base::set_inheritance): Set flag appropriately for debugging
- when close-on-exec so forked process can delete closed handles.
- * tty.h (open_output_mutex): Eliminate unneeded argument.
- (open_input_mutex): Ditto.
- * fhandler_tty.cc (fhandler_tty_slave::open): reflect open_*_mutex
- argument changes.
- * fhandler.h (fhandler_socket): Make saw_shutdown_* functions type
- bool.
- * tty.cc (tty::get_event): Eliminate unneeded argument.
- (tty::common_init): Reflect change to get_event. Events should always
- be inherited.
-
-Fri Aug 31 21:39:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (create_token): Change initialization of `exp' to comply
- with new LARGE_INTEGER definition in winnt.h.
-
-Fri Aug 31 13:58:51 2001 Christopher Faylor <cgf@cygnus.com>
-
- * cygwin.sc: Revert to previous NO_COPY behavior.
- * winsup.h: Ditto.
- * sigproc.cc: Ditto.
- * autoload.cc: Ditto.
-
-Fri Aug 31 00:56:26 2001 Christopher Faylor <cgf@cygnus.com>
-
- * cygwin.sc: New file -- linker script for building cygwin DLL.
- * Makefile.in: Use linker script to control location of cygheap.
- * cygheap.cc (buckets): Make static.
- (init_cheap): Remove special iswinnt handling. Allocate cygheap at a
- fixed location. Display more info when allocation fails.
- (cygheap_fixup_in_child): Try harder to move cygheap to correct
- location. Display more info when allocation fails.
- * fhandler.h (fhandler_socket): Add macros for tracking socket shutdown
- state.
- * net.cc (cygwin_shutdown): Set appropriate shutdown value for future
- use.
- * select.cc (select_stuff::cleanup): New method.
- (cygwin_select): Call cleanup explicitly to avoid a race.
- (select_stuff:~select_stuff): Call cleanup chain via cleanup method.
- (fhandler_socket::select_read): Set *_ready when shutdown has been
- called on the socket.
- (fhandler_socket::select_write): Ditto.
- (fhandler_socket::select_except): Ditto.
-
- * winsup.h: Move NO_COPY to "COMMON" section.
- * autoload.cc (wsock_started): Avoid initializing NO_COPY value.
- * sigproc.cc: Remove initialization from NO_COPY variables.
- (sigproc_init): Initialize sig_loop_wait here, rather than via
- initialization.
- (subproc_init): Initialize proc_loop_wait here, rather than via
- initialization.
-
-Thu Aug 30 10:19:00 2001 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (select_read): Add setting read_ready flag.
- (select_write): Add setting write_ready flag.
-
-Wed Aug 29 00:40:42 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (path_conv::check): Avoid splitting off leading '/' in path
- component when building a symlink.
-
-Wed Aug 29 0:45:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * resource.cc (getrlimit): Return actual values on RLIMIT_STACK.
-
-Tue Aug 28 16:37:17 2001 Christopher Faylor <cgf@cygnus.com>
-
- * dir.cc (rmdir): Report ENOENT when file doesn't exist rather than
- ENOTDIR.
-
-Mon Aug 27 11:58:19 2001 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (cygwin_select): Ensure that arguments are zeroed on
- timeout.
- (select_stuff::wait): Ditto.
-
-2001-08-24 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * syscalls.cc (check_tty_fds): New function. Check whether there is a
- fd referring to pty slave.
- (setsid): Don't detach console if the process has a pty slave.
-
-Fri Aug 24 8:54:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (free_addr_list): Add define for symmetry.
- (free_hostent_ptr): Use free_addr_list to free h_addr_list element.
-
-Thu Aug 23 16:00:09 2001 Jason Tishler <jason@tishler.net>
-
- * net.cc (dup_addr_list): New static function.
- (dup_hostent_ptr): Use dup_addr_list instead of dup_char_list in order
- to handle embedded null characters.
-
-Wed Aug 22 22:23:14 2001 Christopher Faylor <cgf@cygnus.com>
-
- * dtable.cc (dtable::dup2): Allow extension of fd table by dup2.
- * syscalls.cc: Minor code cleanup.
- (fpathconf): Check for bad fd before doing anything else.
- * termios.cc (tcsetattr): Don't convert to new termios if bad fd.
- (tcgetattr): Minor debugging tweak.
-
-Wed Aug 22 23:41:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (cygwin_inet_ntoa): Rearrange previous patch to use
- thread local buffer space when compiled thread safe.
- (cygwin_getprotobyname): Ditto.
- (cygwin_getprotobynumber): Ditto.
- (cygwin_getservbyname): Ditto.
- (cygwin_getservbyport): Ditto.
- (cygwin_gethostbyname): Ditto.
- (cygwin_gethostbyaddr): Ditto. Move near to cygwin_gethostbyname.
- * thread.h (struct _winsup_t): Add pointers for above used buffer space.
- * passwd.cc (getpwduid): Remove initializing passwd.
- (setpwent): Ditto.
- (endpwent): Ditto.
- (setpassent): Ditto.
-
-Wed Aug 22 13:41:09 2001 Christopher Faylor <cgf@cygnus.com>
-
- * smallprint.c (console_printf): New function.
- * dcrt0.cc (dll_crt0_1): Use console_printf for debugging output.
- * debug.cc (debug_mark_closed): New function.
- (close_handle): Use debug_mark_closed.
- * debug.h: Declare new functions.
- * dtable.cc (dtable::build_fhandler): Remove unneeded extern.
- * spawn.cc: Cosmetic changes.
- * winsup.h: Define NO_COPY for C files, too. Declare a global.
-
-Wed Aug 22 17:31:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (free_char_list): New static function.
- (dup_char_list): Ditto.
- (free_protoent_ptr): Ditto.
- (dup_protoent_ptr): Ditto.
- (free_servent_ptr): Ditto.
- (dup_servent_ptr): Ditto.
- (free_hostent_ptr): Ditto.
- (dup_hostent_ptr): Ditto.
- (cygwin_inet_ntoa): Use local static buffer to allow propagating of
- the result to child processes.
- (cygwin_getprotobyname): Ditto.
- (cygwin_getprotobynumber): Ditto.
- (cygwin_getservbyname): Ditto.
- (cygwin_getservbyport): Ditto.
- (cygwin_gethostbyname): Ditto.
- (cygwin_gethostbyaddr): Ditto.
-
-Mon Aug 20 11:56:19 2001 Christopher Faylor <cgf@cygnus.com>
-
- * cygheap.cc (init_cheap): Allocate cygheap in shared memory for Windows NT.
-
-Thu Aug 16 09:38:59 2001 Jason Tishler <jason@tishler.net>
-
- * fhandler_socket.cc (fhandler_socket::create_secret_event): Relax
- security of secret_event so AF_UNIX socket clients can connect to
- servers even if running under a different user account.
- (fhandler_socket::check_peer_secret_event): Ditto.
-
-Thu Aug 16 16:26:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * resource.cc (getrlimit): Return getdtablesize () as current limit
- on RLIMIT_NOFILE.
- * syscalls.cc (getdtablesize): Return OPEN_MAX if current dtable size
- is less than OPEN_MAX, the current dtable size otherwise.
- * sysconf.cc (sysconf): Return getdtablesize () on _SC_OPEN_MAX.
-
-Thu Aug 16 16:17:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * resource.cc (getrlimit): Return OPEN_MAX as current limit
- on RLIMIT_NOFILE.
- * syscalls.cc (getdtablesize): Return OPEN_MAX.
- * sysconf.cc (sysconf): Return OPEN_MAX on _SC_OPEN_MAX.
- * include/limits.h (OPEN_MAX): Define as 256.
-
-Wed Aug 15 12:43:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * times.cc (utimes): Revert previous change. Just open the
- file using FILE_WRITE_ATTRIBUTES instead of GENERIC_WRITE
- on NT/W2K.
-
-Wed Aug 15 12:18:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (set_nt_attribute): Return always -1 in case of
- a failure.
- * times.cc (utimes): On NTFS with ntsec ON, change the file's
- security descriptor temporarily to acquire write access if
- opening the file failed.
-
-Wed Aug 15 9:42:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_base::is_nonblocking): New method.
- (fhandler_base::set_nonblocking): Ditto.
- * fhandler.h (fhandler_base): Declare new methods `is_nonblocking' and
- `set_nonblocking'.
- * fhandler_socket.cc (fhandler_socket::ioctl): Use `set_nonblocking'.
- * fhandler_tty.cc (fhandler_pty_master::process_slave_output):
- Use `is_nonblocking'.
- (fhandler_tty_slave::read): Ditto.
- (fhandler_tty_slave::ioctl): Use `set_nonblocking'.
- (fhandler_pty_master::ioctl): Ditto.
- * net.cc (cygwin_sendto): Fallback to winsock 1 functionality
- in case of nonblocking IO.
- (cygwin_recvfrom): Ditto.
- (cygwin_recv): Ditto.
- (cygwin_send): Ditto.
- * syscalls.cc (_read): Use `is_nonblocking'.
-
-Tue Aug 14 11:05:26 2001 Christopher Faylor <cgf@cygnus.com>
-
- * include/cygwin/version.h: Bump API version.
-
-2001-08-14 Egor Duda <deo@logos-m.ru>
-
- * spawn.cc (spawn_guts): Enable appropriate privilege before
- loading user's registry hive.
-
-Mon Aug 13 22:34:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_base::fcntl): Use new O_NONBLOCK_MASK define.
- * fhandler.h: Move definitions of O_NOSYMLINK, O_DIROPEN and
- OLD_O_NDELAY from winsup.h to here. Add O_NONBLOCK_MASK define.
- * fhandler_socket.cc (fhandler_socket::close): Add hack to allow
- a graceful shutdown even if shutdown() hasn't been called by the
- application. Add debug output.
- (fhandler_socket::ioctl): Set fhandler's NONBLOCK flag according
- to FIONBIO setting.
- (fhandler_socket::fcntl): Use new O_NONBLOCK_MASK define. Actually
- set `request' before using it.
- * fhandler_tty.cc: Use new O_NONBLOCK_MASK define throughout.
- (fhandler_tty_slave::ioctl): Set fhandler's NONBLOCK flag according
- to FIONBIO setting.
- (fhandler_pty_master::ioctl): Ditto.
- * net.cc (wsock_event::prepare): Compare WSACreateEvent return code
- with `WSA_INVALID_EVENT' according to MSDN.
- * syscalls.cc (_read): Use new O_NONBLOCK_MASK define.
-
-Wed Aug 8 15:24:59 2001 Christopher Faylor <cgf@cygnus.com>
-
- * include/wchar.h: Define __need_wint_t.
-
-Wed Aug 8 11:46:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (alloc_sd): Revert to setting inheritance attribute for
- permissions given to directories. Never set inheritance on NULL ACE.
-
-Tue Aug 7 18:11:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (alloc_sd): Don't set FILE_DELETE_CHILD for group
- if S_ISVTX attribute is given.
- * dir.cc (mkdir): Allow immediate setting of S_ISUID, S_ISGID and
- S_ISVTX attribute.
- * syscalls.cc (_open): Ditto.
-
-Tue Aug 7 16:24:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * dir.cc (mkdir): Set security attributes correctly for
- CreateDirectoryA () call if ntsec is on. Don't call
- set_file_attributes () then.
- * fhandler.cc (fhandler_base::open): Ditto for CreateFileA () call.
- * path.cc (symlink): Ditto.
- * security.cc (set_security_attribute): New function.
- * security.h: Add declaration for `allow_ntea' and
- `set_security_attribute'.
-
-Tue Aug 7 10:54:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * grp.cc (class grp_check): New class. Make `group_state'
- a member of class grp_check.
- (read_etc_group): Free former allocated memory on reread.
- * passwd.cc (class pwd_check): New class Make `passwd_state'
- a member of class pwd_check.
- (read_etc_passwd): Free former allocated memory on reread.
-
-Tue Aug 7 01:13:58 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_console.cc (get_tty_stuff): Don't initialize shared memory
- console area if it is already initialized.
-
- * fhandler_termios.cc (fhandler_termios::tcsetpgrp): Augment debugging
- info.
-
-Mon Aug 6 19:58:43 2001 Christopher Faylor <cgf@cygnus.com>
-
- * cygheap.cc (cygheap_root::set): Avoid treating '/' specially.
-
- * fhandler.cc (fhandler_base::fcntl): Only set specific O_NDELAY style
- flag passed in from application.
- * fhandler_socket.cc (fhandler_socket::fcntl): Ditto.
- * fhandler.h: Set constant for future use.
- * winsup.h: Define OLD_O_NDELAY only for old programs.
- * include/cygwin/version.h: Define
- CYGWIN_VERSION_CHECK_FOR_OLD_O_NONBLOCK.
-
-Sat Aug 4 16:52:03 2001 Christopher Faylor <cgf@cygnus.com>
-
- Throughout, change check for running under Windows NT to 'iswinnt'.
- * dcrt0.cc (set_os_type): Set 'iswinnt' appropriately.
- * cygheap.cc (init_cheap): Revert to using VirtualAlloc for allocating
- cygheap.
- (cygheap_setup_for_child_cleanup): New function. Standard function to
- call after calling CreateProcess to cleanup cygheap info passed to
- child.
- (cygheap_fixup_in_child): Copy cygheap from shared memory into
- allocated space under Windows 9x or if can't relocate shared space
- under NT.
- * cygheap.h: Declare new function.
- * spawn.cc (spawn_guts): Use cygheap_fixup_in_child.
- * fork.cc (fork_parent): Ditto.
- * winsup.h: Declare iswinnt.
-
-2001-08-04 Egor Duda <deo@logos-m.ru>
-
- * dtable.cc (dtable::release): Avoid messing with console when
- closing socket.
-
-Fri Aug 3 14:02:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (cygwin_accept): Allow NULL peer and len parameters.
- * include/cygwin/socket.h: Define socklen_t as int.
-
-Fri Aug 3 13:04:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * path.cc (fchdir): Set the fhandler's path to absolute value to ensure
- changing to the correct directory even if the fhandler originally
- points to a relative path.
-
-Thu Aug 2 17:59:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (set_file_attribute): Clean up. Don't call
- `set_nt_attribute' when ntsec isn't set.
-
-Sat Jul 28 22:30:55 2001 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (alloc_stack_hard_way): Make half-hearted attempt to deal
- with growing stack under Windows 95.
-
-Fri Jul 27 12:36:07 2001 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Add install-lib and install-headers.
-
-Fri Jul 27 12:28:12 2001 Christopher Faylor <cgf@cygnus.com>
-
- * cygwin.din: Export sys_errlist, sys_nerr.
- * include/cygwin/version.h: Bump minor version number.
-
-Fri 27 Jul 2001 10:29:00 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (get_user_primary_group): Fix compiler warning.
- (alloc_sd): Add DELETE permission for user when S_IWUSR is given.
-
-Thu Jul 26 16:43:39 2001 Pieter de Visser <pieterdv@knoware.nl>
-
- * thread.cc (__pthread_equal): Invert return value so that true is
- returned when threads are equal.
-
-Thu Jul 26 15:50:38 2001 Charles Wilson <cwilson@ece.gatech.edu>
- Christopher Faylor <cgf@cygnus.com>
-
- * cygwin.din: Export __signgam.
- * include/cygwin/version.h: Bump minor version number.
-
-Thu Jul 26 15:19:50 2001 Christopher Faylor <cgf@cygnus.com>
-
- Throughout, reorganize header file inclusion to put security.h prior to
- fhandler.h.
- * fhandler.h (fhandler_base::get_inheritance): New method.
- * fhandler_socket.cc (fhandler_socket::create_secret_event): Use proper
- close-on-exec inheritance when creating.
- (fhandler_socket::check_peer_secret_event): Create handle as
- non-inheritable.
-
-2001-07-25 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * syscalls.cc (setsid): Detach process from its console if the current
- controlling tty is the console and already closed.
- * dtable.h (class dtable): Add members to count descriptors referring
- to the console.
- * dtable.cc (dtable::dec_console_fds): New function to detach process
- from its console.
- (dtable::release): Decrement the counter of console descriptors.
- (dtable::build_fhandler): Increment it.
- * exception.cc (ctrl_c_handler): Send SIGTERM to myself when catch
- CTRL_SHUTDOWN_EVENT.
-
-Tue 24 Jul 2001 02:28:00 PM Trevor Forbes <t4bs@hotmail.com>
-
- * thread.cc (verifyable_object_isvalid): Don't validate
- PTHREAD_MUTEX_INITIALIZER pointer as it will cause an exception
- in IsBadWritePtr() when running GDB.
-
-Wed 25 Jul 2001 23:46:00 Corinna Vinschen <corinna@vinschen.de>
-
- * localtime.c: Changed whole file to become C++ clean. Rename to
- localtime.cc.
- * localtime.cc (tzload): Preserve errno.
-
-Fri 20 Jul 2001 11:15:50 PM EDT Christopher Faylor <cgf@cygnus.com>
-
- * cygheap.cc (cygheap_fixup_in_child): Attempt Win95 workaround.
- * dtable.cc (dtable::dup_worker): Add debugging output.
- (dtable::vfork_child_dup): Correctly set close_on_exec.
- * fhandler.cc (fhandler_base::fork_fixup): Don't mess with handle if
- there is no need to get it from the parent.
- * fhandler_tty.cc (fhandler_tty_common::close): Add debugging output.
-
-Fri 20 Jul 2001 09:15:00 Mark Bradshaw <bradshaw@staff.crosswalk.com>
-
- * dir.cc (readdir): Protect FindNextFileA against INVALID_HANDLE_VALUE.
-
-Wed 18 Jul 2001 01:00:47 PM EDT Christopher Faylor <cgf@cygnus.com>
-
- * cygheap.cc (_cmalloc): Use correct constants for size calculation.
- * dcrt0.cc (dll_crt0_1): Move uid initialization earlier.
- * fork.cc (fork_parent): Move cygheap_setup_in_child to just prior to
- CreateProcess so that all contents of cygheap are copied.
- * spawn.cc (spawn_guts): Ditto.
-
-Wed 18 Jul 2001 12:54:17 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (get_user_groups): Call Net function with NULL server
- name under specific error conditions.
- (is_group_member): Ditto.
- (get_user_local_groups): Ditto.
- (get_user_primary_group): Ditto.
-
-Wed 18 Jul 2001 11:56:00 Corinna Vinschen <corinna@vinschen.de>
-
- * syscalls.cc (_unlink): Explicitly check for non-existant file.
-
-Tue 17 Jul 2001 10:19:00 Corinna Vinschen <corinna@vinschen.de>
-
- * delqueue.h: Remove obsolete file.
-
-Mon 16 Jul 2001 10:47:17 PM EDT Christopher Faylor <cgf@cygnus.com>
-
- * child_info.h: Bump magic number.
- (class child_info): Add an element.
- * cygheap.cc (init_cheap): Allocate cygwin heap in shared memory area.
- (cygheap_fixup_in_child): Map cygwin heap, passed from parent via
- shared memory into correct address.
- (cygheap_setup_for_child): New function.
- * cygheap.h: Declare new functions.
- * dcrt0.cc (dll_crt0_1): Accommodate new cygheap_fixup_in_child
- arguments. Avoid protecting subproc_ready unless it is spawn/nowait.
- * fork.cc (fork_parent): Use new cygheap_setup_for_child function to
- setup cygwin heap info. Close passed cygheap shared memory handle.
- * spawn.cc (spawn_guts): Ditto. Also, reorganize to avoid
- synchronization between parent and child in non-P_OVERLAY case.
- * sigproc.cc (wait_sig): Only signal subproc_ready when execing.
-
-Mon 16 Jul 2001 15:21:00 Corinna Vinschen <corinna@vinschen.de>
-
- * grp.cc: Add missing Copyright date 2001.
-
-Mon 16 Jul 2001 00:11:00 Corinna Vinschen <corinna@vinschen.de>
-
- Change well_known_admin_sid to well_known_admins_sid throughout.
- * sec_acl.cc (setacl): Never set DELETE permission. Set
- FILE_DELETE_CHILD only on readable and executable directories.
- * sec_helper.cc: Add constructor for `well_known_null_sid'.
- * security.cc (get_nt_attribute): Set S_ISVTX for directories if
- FILE_WRITE_DATA and FILE_EXECUTE but not FILE_DELETE_CHILD is set.
- Add evaluation of S_ISVTX, S_ISGID and S_ISUID from NULL ACE.
- (alloc_sd): Never set DELETE permission. Set FILE_DELETE_CHILD
- only on readable and executable directories.
- Add creation of NULL ACE for S_ISVTX, S_ISGID and S_ISUID permissions.
- * security.h: Add extern declaration for `well_known_null_sid'.
-
-Fri 13 Jul 2001 08:08:49 PM EDT Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (stat_worker): Simplify previous change.
-
-Fri Jul 13 13:13:09 2001 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (_unlink): Correct (?) logic which determines when
- to report an access violation and when to queue file for eventual
- deletion.
- (stat_worker): Check for invalid buf argument.
-
-Tue Jul 10 23:01:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * mmap.cc (fhandler_disk_file::mmap): Try to open file mappings
- by a unified name when running under 9x/ME. If that failes, create
- the file mapping using the unified name.
-
-Mon Jul 9 10:43:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * uinfo.cc (internal_getlogin): Add pointer check.
-
-Mon Jul 9 10:05:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (alloc_sd): Don't set inheritance attribute for
- permissions given to directories.
-
-Thu Jun 28 22:19:08 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_dsp.cc (fhandler_dev_dsp::ioctl): Return 0 for success.
-
-Wed Jun 27 22:19:07 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (path_conv::check): Add signal protection here since
- retrieving info about remote shares can take some time.
-
-Wed Jun 27 23:30:00 2001 Robert Collins <rbtcollins@hotmail.com>
- Christopher Faylor <cgf@cygnus.com>
-
- Change check_null_empty_path* to check_null_empty_str* throughout.
- * path.h (check_null_empty_str_errno): Convert to a function prototype.
- * path.cc (check_null_empty_str): Move to miscfuncs.cc.
- * miscfuncs.cc (check_null_empty_str_errno): New function.
- (__check_null_invalid_struct): Ditto.
- (__check_null_invalid_struct_errno): Ditto.
- (check_null_empty_str): Change from VirtualQuery to IsBadWritePtr.
- * thread.cc (check_valid_pointer): Ditto.
- * resource.cc (getrlimit): Use check_null_invalid_struct macro for
- checking validity of pointer.
- (setrlimit): Ditto.
-
-Tue Jun 26 16:59:16 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.cc (fhandler_disk_file::fstat): Don't rely on exactly 3
- characters being read for executable test since we could be checking
- for less than that.
- * syscalls.cc (stat_worker): Try opening the file the "correct" way
- first so that #! processing can potentially happen. If that fails,
- then use "query open" method.
-
- * spawn.cc (spawn_guts): Delay processing of signal until after we've
- notified parent about reparenting.
-
-Tue Jun 26 10:47:24 2001 Christopher Faylor <cgf@cygnus.com>
-
- * mmap.cc: Clean up *ResourceLock calls throughout.
-
-Tue Jun 26 22:10:00 2001 Robert Collins rbtcollins@hotmail.com
-
- * thread.cc (pthread_cond::TimedWait): Check for WAIT_TIMEOUT as well
- as WAIT_ABANDONED.
- (__pthread_cond_timedwait): Calculate a relative wait from the abstime
- parameter.
-
-Sun Jun 24 17:38:19 2001 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (interrupt_setup): Move actions from setup_handler to
- here.
- (setup_handler): Move actions after a successful interrupt to
- interrupt_setup.
- * fork.cc (vfork): Augment debugging output.
- * sigproc.cc (proc_subproc): Ditto.
- * spawn.cc (spawn_guts): Ditto. Correctly fill out progname when spawn
- NO_WAIT. Call signal handler when a signal arrives.
- * sigproc.h: Declare a function.
-
-Fri Jun 22 16:50:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.h class fhandler_socket): Declare new method
- `set_close_on_exec'.
- * fhandler_socket.cc (fhandler_socket::set_close_on_exec):
- New method.
-
-Fri Jun 22 16:12:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_tape.cc (fhandler_dev_tape::tape_erase): Set size
- parameter to value expected by GetTapeParameters().
-
-Thu Jun 21 22:01:39 2001 Marius Gedminas <mgedmin@delfi.lt>
-
- * fhandler_console.cc (fhandler_console::read): Detect AltGr more
- robustly on WinNT.
-
-2001-06-22 Robert Collins <rbbtcollins@hotmail.com>
-
- * thread.cc (__pthread_cond_timedwait): Lock the waiting mutex before
- the condition protect mutex to avoid deadlocking. (Found by Greg Smith).
- (__pthread_cond_wait): Ditto.
-
-2001-06-30 Egor Duda <deo@logos-m.ru>
-
- * fhandler.cc (fhandler_base::open): Work around windows bug when
- CreateFile() with dwDesiredAccess == 0 called on remote share returns
- valid handle even if file doesn't exist.
-
-2001-06-20 Egor Duda <deo@logos-m.ru>
-
- * fhandler_socket.cc (fhandler_socket::signal_secret_event): New
- function.
- * fhandler.h: Declare it.
- * fhandler_socket.cc (fhandler_socket::create_secret_event): Don't
- signal secret event immediately.
- (fhandler_socket::check_peer_secret_event): Do it after peer event
- was opened.
- * net.cc (cygwin_connect): Or if socket is non-blocking.
- (cygwin_accept): Ditto.
-
-Mon Jun 18 17:09:25 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_tty.cc (fhandler_tty_slave::init): Revert 2001-06-16 change.
-
- * fork.cc (fork_copy): Print more debugging info.
- (fork_parent): Change order of arguments to accomdate buggy gcc.
- (fork): Ditto.
-
-Sun Jun 17 18:54:46 2001 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (_unlink): Reorganize to try harder to delete file with
- DeleteFile and to recover more gracefully if FILE_FLAG_DELETE_ON_CLOSE
- doesn't work properly.
-
-Sat Jun 16 13:06:49 2001 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (sig_handle_tty_stop): Reset PID_STOPPED if not
- actually stopping.
- * fhandler_console.cc (fhandler_console::fixup_after_fork): Don't set
- controlling terminal if just inheriting a handle.
- (fhandler_console::fixup_after_exec): Ditto.
- * fhandler_tty.cc (fhandler_tty_slave::init): Ditto.
- * signal.cc (kill_worker): Set appropriate errno if proc_exists
- determines that process does not really exist.
-
-Fri Jun 15 14:34:19 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (path_conv::check): Deal more robustly with foo/ behavior.
-
-Fri Jun 15 11:15:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_tape.cc (fhandler_dev_tape::tape_status): Set size
- parameter to value expected by GetTapeParameters().
-
-Thu Jun 14 20:19:46 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.cc (fhandler_disk_file::fstat): Properly set executable bits
- for directory when !ntsec && !ntea. Also move common code prior to
- call to get_attributes.
-
-Fri June 15 09:25:00 Robert Collins <rbtcollins@hotmail.com>
-
- * thread.cc (pthread_cond::Signal): Release the condition access
- variable correctly.
-
-2001-06-14 Egor Duda <deo@logos-m.ru>
-
- * fhandler.cc (fhandler_base::open): Set win32 access flags to 0, when
- requested.
- * fhandler.h: New status flag FH_QUERYOPEN.
- (fhandler::get_query_open): New function.
- (fhandler::set_query_open): Ditto.
- * syscalls.cc (stat_worker): Request query-only open mode.
-
-2001-06-12 Egor Duda <deo@logos-m.ru>
-
- * environ.cc (set_file_api_mode): New function. Move setting
- of file APIs mode (OEM/ANSI) here.
- (codepage_init): From here.
- * winsup.h (set_file_api_mode): Declare it.
- * fork.cc (fork_child): Set file APIs mode in forkee.
-
-Mon Jun 11 14:19:49 2001 Christopher Faylor <cgf@cygnus.com>
-
- * pinfo.cc: Use autoloaded ToolHelp functions throughout for Win9x.
- * autoload.cc: Autoload ToolHelp functions.
-
- * sigproc.cc (proc_subproc): Incorporate SIGCHLD == SIG_IGN special
- handling of zombie processes. Ensure that zombie processes which are
- at the end of the zombie array are properly cleaned up.
-
-Mon Jun 11 11:18:56 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (chdir): Fix call to path_conv constructor so that it REALLY
- doesn't check for the null/non-empty path.
-
-Sun Jun 10 23:34:09 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (path_conv::update_fs_info): Don't consider remote drives to
- be NTFS. Set root_dir before invoking GetDriveType (from Kazuhiro
- Fujieda <fujieda@jaist.ac.jp>). Eliminate extra checks for rootdir.
-
-Sun Jun 10 20:19:47 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (chdir): Pre-check path for validity before eating trailing
- space. Then, ensure that path_conv doesn't check the path for validity
- again.
-
-Sun Jun 10 12:56:00 2001 Christopher Faylor <cgf@redhat.com>
-
- * exceptions.cc (sigdelayed): Ensure that signal is cleared as
- the last operation or suffer races.
- * sigproc.cc (proc_subproc): Deal with zombie array overflow.
-
-Sun Jun 10 11:56:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * cygwin.din: Add fchdir symbols.
- * path.cc (chdir): Guard against invalid parameter.
- (fchdir): New function.
- * include/cygwin/version.h: Bump API minor version to 40.
- * uinfo.cc (internal_getlogin): Remove unused variable.
-
-Sat Jun 9 23:20:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * syscalls.cc (seteuid): Set environment variables USERNAME and
- USERDOMAIN before impersonation to workaround a LookupAccountSid()
- misbehaviour.
- * uinfo.cc (internal_getlogin): Revert most of the previous change.
- Don't set environment variables USERNAME and USERDOMAIN. That's
- the job of seteuid() now. Try to get logon server from Lsa
- only if logon server isn't already known.
-
-Thu Jun 7 15:54:32 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * thread.cc (pthread_cond::Broadcast): Don't print error messages on
- invalid mutexs - user programs are allowed to call
- pthread_cond_broadcast like that.
- (__pthread_cond_timedwait): Initialise themutex properly.
- (__pthread_cond_wait): Initialise themutex properly.
-
-Tue Jun 5 19:56:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_console.cc (fhandler_console::dup): Allocate space for
- savebuf on Cygwin heap.
- (fhandler_console::char_command): Ditto. Use correct values for size.
-
-2001-06-05 Egor Duda <deo@logos-m.ru>
-
- * security.h (NTWriteEA): Change prototype.
- * ntea.cc (NTReadEA): Don't check for global ntea setting, now
- it's caller responsibility.
- (NTWriteEA): Ditto.
- * security.cc (get_file_attribute): Read attribute from EA only
- if 'ntea' is enabled.
- (set_file_attribute): Ditto.
- * path.h: (class path_conv): Add members to store file system
- information.
- (path_conv::get_drive_type): New function.
- * syscalls.cc (stat_worker): Use it.
- * path.cc (path_conv::update_fs_info): New functions.
- (path_conv::check): Get file system information from device where
- file resides. On NTFS, try to read symlink contents from EA.
- (get_symlink_ea): New function.
- (set_symlink_ea): Ditto.
- (symlink): Store symlink in extended attribute, if possible.
-
-Tue Jun 5 11:18:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_disk_file::fstat): Always reset file position
- to original value after checking for executable magic.
-
-Mon Jun 4 16:21:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * cygheap.h (cygheap_user::cygheap_user): Initialize token to
- INVALID_HANDLE_VALUE.
- * uinfo.cc (uinfo_init): Close token handle if needed.
-
-Sun Jun 3 20:52:13 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (normalize_posix_path): Revert .. check removed by previous
- changes.
- * cygheap.h: Temporarily declare path_prefix_p here.
-
-Mon Jun 4 0:14:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (wsock_event): Add destructor.
-
-Sun Jun 3 09:49:55 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * dlfcn.cc (dlclose): Do not call FreeLibrary if the symbol to close
- was obtained by dlopen(NULL,...).
-
-Sat Jun 2 23:11:52 2001 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (sleep): Try to be a little more accomodating of signal
- arrival. Ensure that the signal handler is called.
-
-Sat Jun 2 14:07:28 2001 Christopher Faylor <cgf@cygnus.com>
-
- * cygheap.cc (cygheap_root::cygheap_root): Remove constructor.
- (cygheap_root::~cygheap_root): Remove destructor.
- (cygheap_root::operator =): Remove.
- (cygheap_root::set): New method.
- * cygheap.h (cygheap_root): Reflect above changes. Store root info in
- mount-like structure.
- (cygheap_root:posix_ok): New method.
- (cygheap_root::ischroot_native): Ditto.
- (cygheap_root::unchroot): Ditto.
- (cygheap_root::exists): Ditto.
- (cygheap_root::posix_length): Ditto.
- (cygheap_root::posix_path): Ditto.
- (cygheap_root::native_length): Ditto.
- (cygheap_root::native_path): Ditto.
- * dir.cc (opendir): Remove special chroot test.
- * path.cc (path_prefix_p): Remove front end.
- (normalize_posix_path): Reorganize chroot tests to accommodate new
- convention of allowing paths using posix chroot prefix.
- (path_conv::check): Pass a "already ran normalize" option to
- conv_to_win32_path. Return if there is an error from this function.
- (mount_info::conv_to_win32_path): Add extra argument. Don't call
- normalize_posix_path if caller has already done so. Substitute chroot
- setting, if any, for root translation. Add chroot checking to final
- output step.
- * shared_info (mount_info): Accommodate additional argument to
- conv_to_win32_path.
- * syscalls.cc (chroot): Store both normalized posix path and native
- path in chroot.
-
-Fri Jun 1 10:57:19 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (chdir): Really make sure that isspace gets only an unsigned
- char.
-
-Fri Jun 1 13:45:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * syscalls.cc (_rename): Handle the case that `foo' is renamed to
- `bar' while `bar.lnk' is an existing shortcut-symlink.
-
-Thu May 31 15:57:57 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.cc (fhandler_disk_file::fstat): Avoid clearing S_IFMT bits
- since we've already pre-cleared everything anyway.
-
-Wed May 30 23:51:32 2001 Earnie Boyd <earnie_boyd@yahoo.com>
-
- * path.cc (chdir): Always send unsigned chars to isspace since newlib's
- isspace doesn't deal well with "negative" chars.
-
-Wed May 30 23:51:32 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.cc (fhandler_disk_file::open): Propagate remote status of
- file garnered from path_conv. Move #! checking to fstat.
- (fhandler_disk_file::fstat): Reorganize st_mode setting to eliminate
- duplication. Move check for #! here from fhandler::open.
-
- * fhandler.h (fhandler_base::isremote): New method.
- (fhandler_base::set_isremote): Ditto.
- (fhandler_base::set_execable_p): Also record "don't care if executable
- state".
- (fhandler_base::dont_care_if_execable): New method.
- * path.cc (path_conv::check): Clear new flags. Appropriately set
- vol_flags, drive_type, and is_remote_drive.
- * path.h: Add new flags and methods for manipulating them.
- * syscalls.cc (_unlink): Use isremote() to determine if a path is
- remote rather than calling GetDriveType.
- (stat_worker): Ditto.
- * security.cc (get_file_attribute): Or attribute with result of
- NTReadEA to be consistent with get_nt_attribute.
-
-Tue May 29 19:02:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * sec_helper.cc (cygsid::getfrompw): Change parameter to `const'.
- (cygsid::getfromgr): Ditto.
- * security.cc: Use `sys_mbstowcs' and `sys_wcstombs' throughout.
- (extract_nt_dom_user): Try to get user and domain from SID in
- pw->pw_gecos first.
- * security.h (class cygsid): Change parameter of getfrompw() and
- getfromgr() to `const'.
- * uinfo.cc (internal_getlogin): Change order for evaluating user
- information in winNT case. Drop usage of NetWkstaUserGetInfo().
-
-Mon May 28 21:34:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * shortcut.c (check_shortcut): Treat only Cygwin shortcuts as symlinks.
-
-Fri May 25 11:07:07 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (symlink_info::check): Correctly set 'ext_tacked_on'. Use
- this to determine if user specified 'foo.lnk' explicitly. Reorganize
- slightly to get rid of one goto.
-
-Fri May 25 10:15:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * path.cc (symlink_info::check): Add a check to return correctly
- if incoming `*.lnk' file is not a symlink.
-
-Thu May 24 15:46:50 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (slash_drive_prefix_p): Remove.
- (mount_info::slash_drive_to_win32_path): Ditto.
- (mount_info::conv_to_win32_path): Remove slash drive prefix check.
- (mount_info::add_item): Ditto.
- (mount_info::del_item): Ditto.
- * shared_info.h (mount_info): Remove slash_drive_to_win32_path
- declaration.
-
-Thu May 24 01:17:33 2001 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (handle_exceptions): Bump repeat count for debugging
- kick out.
-
- * fhandler.h (fhandler_dev_dsp): Add a fixup_after_exec.
- * fhandler_dsp.cc (class Audio): Add TOT_BLOCK_SIZE to enum.
- (operator new): New.
- (bigwavebuffer): Declare using TOT_BLOCK_SIZE to avoid buffer overruns.
- (Audio::Audio): Optimize slightly.
- (fhandler_dev_dsp::open): Allocate s_audio using static buffer.
- (fhandler_dev_dsp::fixup_after_exec): New function. Ditto.
-
-Wed May 23 17:45:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * syscalls.cc (seteuid): Restrict overriding external provided
- user tokens to ntsec. Don't test external tokens for primary
- group to evaluate if it should be overridden. Restrict creating
- internal tokens to ntsec.
-
-Wed May 23 10:11:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * syscalls.cc (chown_worker): Don't check for ENOSYS.
-
-Tue May 22 12:20:07 2001 Christopher Faylor <cgf@cygnus.com>
-
- * signal.cc (sleep): Protect with sigframe.
-
-Tue May 22 17:58:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (get_file_attribute): Don't set errno.
-
-Mon May 21 15:08:00 2001 Christopher Faylor <cgf@cygnus.com>
-
- * configure.in: Allow --enable-newvfork to turn NEWVFORK on and off.
- * configure: Regenerate.
-
-Mon May 21 11:46:01 2001 Christopher Faylor <cgf@cygnus.com>
-
- * include/cygwin/version.h: Bump minor version number.
-
-Sun May 20 13:26:25 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_dsp.cc: Reformat to GNU standards.
- (s_audio): Change to a pointer throughout.
- (fhandler_dev_dsp::open): Initialize s_audio, if required.
-
-Sat May 19 23:40:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * autoload.cc: Add load statements for `LookupAccountNameW',
- `LsaClose', `LsaEnumerateAccountRights', `LsaFreeMemory',
- `LsaOpenPolicy', `LsaQueryInformationPolicy', `NetLocalGroupEnum',
- `NetLocalGroupGetMembers', `NetServerEnum', `NetUserGetGroups' and
- `NtCreateToken'.
- * ntdll.h: Add declaration for `NtCreateToken'.
- * sec_helper.cc: Add `well_known_local_sid', `well_known_dialup_sid',
- `well_known_network_sid', `well_known_batch_sid',
- `well_known_interactive_sid', `well_known_service_sid' and
- `well_known_authenticated_users_sid'.
- (cygsid::string): Define as const method.
- (cygsid::get_sid): Set psid to NO_SID on error.
- (cygsid::getfromstr): Ditto.
- (cygsid::getfrompw): Simplify.
- (cygsid::getfromgr): Check for gr == NULL.
- (legal_sid_type): Move to security.h.
- (set_process_privilege): Return -1 on error, otherwise 0 or 1 related
- to previous privilege setting.
- * security.cc (extract_nt_dom_user): Remove `static'.
- (lsa2wchar): New function.
- (open_local_policy): Ditto.
- (close_local_policy): Ditto.
- (get_lsa_srv_inf): Ditto.
- (get_logon_server): Ditto.
- (get_logon_server_and_user_domain): Ditto.
- (get_user_groups): Ditto.
- (is_group_member): Ditto.
- (get_user_local_groups): Ditto.
- (sid_in_token_groups): Ditto.
- (get_user_primary_group): Ditto.
- (get_group_sidlist): Ditto.
- (get_system_priv_list): Ditto.
- (get_priv_list): Ditto.
- (get_dacl): Ditto.
- (create_token): Ditto.
- (subauth): Return immediately if SE_TCB_NAME can't be assigned.
- Change all return statements in case of error to jumps to `out'
- label. Add `out' label to support cleanup.
- * security.h: Add extern declarations for `well_known_local_sid',
- `well_known_dialup_sid', `well_known_network_sid',
- `well_known_batch_sid', `well_known_interactive_sid',
- `well_known_service_sid' and `well_known_authenticated_users_sid'.
- Add extern declarations for functions `create_token',
- `extract_nt_dom_user' and `get_logon_server_and_user_domain'.
- (class cygsid): Add method `assign'. Change operator= to call new
- `assign' method. Add `debug_print' method.
- (class cygsidlist): New class.
- (legal_sid_type): Moved from sec_helper.cc to here.
- * spawn.cc (spawn_guts) Revert reversion of previous patch.
- Call `RevertToSelf' and `ImpersonateLoggedOnUser' instead of `seteuid'
- again.
- * syscalls.cc (seteuid): Rearranged. Call `create_token' now when
- needed. Call `subauth' if `create_token' fails. Try setting token
- owner and primary group only if token was not explicitely created
- by `create_token'.
- * uinfo.cc (internal_getlogin): Try harder to generate correct user
- information. Especially don't trust return value of `GetUserName'.
-
-Sat May 19 21:16:07 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fork.cc (fork_parent): Move atforkprepare call here.
- (fork): From here.
-
-Sat May 19 18:35:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * autoload.cc: Add missing load statement for `CancelIo'.
-
-Sat May 19 01:22:43 2001 Christopher Faylor <cgf@cygnus.com>
-
- * grp.cc (read_etc_group): Don't copy mutex on fork.
- * pwd.cc (read_etc_passwd): Ditto.
- * autoload.cc (LoadDLLfuncEx): Use LoadDLLprime to initialize DLL
- specific area.
-
-Fri May 18 10:31:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (wsock_event::wait): Explicitely cancel IO when a signal
- arrived to avoid data loss. Fallback to blocking IO when canceling
- fails.
-
-Thu May 17 15:29:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (cygwin_set_impersonation_token): Never destroy
- previous token object.
- (subauth): Create token source with well defined identifier.
-
-Wed May 16 23:27:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * uinfo.cc (uinfo_init): Just set user token to INVALID_HANDLE_VALUE.
- Token value is already invalid at that point.
-
-Wed May 16 21:34:00 2001 Fred Yankowski <fred@ontosys.com>
-
- * net.cc (errmap): Add missing mapping from WSAEINTR to EINTR.
-
-Wed May 16 09:20:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * sec_helper.cc (legal_sid_type): Fix conditional. Change to
- inline function.
-
-Wed May 16 01:01:48 2001 Christopher Faylor <cgf@cygnus.com>
-
- * autoload.h: Eliminate.
- * autoload.cc: Pull in autoload.h. Eliminate many macros. Rewrite to
- avoid necessity of initialization routines. Just use a standard one.
- (wsock_init): New function. Moved from net.cc.
- * net.cc (wsock_init): Move to autoload.cc.
- (wsadata): Make global.
- * dtable.cc (dtable::build_fhandler): Use more reliable method for
- checking if net stuff has been loaded.
-
-Tue May 15 19:52:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * fork.cc (fork): Eliminate superfluous call to getuid().
- * security.h: New define `NO_SID'. Remove declarations of functions
- moved to methods into class cygsid.
- (class cygsid): Declare new methods `getfromstr', `get_sid',
- `getfrompw', `getfromgr', `get_rid', `get_uid', `get_gid', `string'
- and new constructors and operators =, == and !=.
- Declare new global cygsids `well_known_XXX_sid' substituting the
- corresponding `get_XXX_sid' functions. Remove declarations of
- these functions.
- * sec_helper.cc (well_known_admin_sid): New global variable.
- (well_known_system_sid): Ditto
- (well_known_creator_owner_sid): Ditto
- (well_known_world_sid): Ditto
- (cygsid::string): New method, substituting `convert_sid_to_string_sid'.
- (cygsid::get_sid): New method, substituting `get_sid'.
- (cygsid::getfromstr): New method, substituting
- `convert_string_sid_to_sid'.
- (cygsid::getfrompw): New method, substituting `get_pw_sid'.
- (cygsid::getfromgr): New method, substituting `get_gr_sid'.
- (cygsid::get_id): New method, substituting `get_id_from_sid'.
- (get_admin_sid): Eliminated.
- (get_system_sid): Ditto.
- (get_creator_owner_sid): Ditto.
- (get_world_sid): Ditto.
- * grp.cc: Use new cygsid methods and well known sids throughout.
- * registry.cc: Ditto.
- * sec_acl.cc: Ditto.
- * security.cc: Ditto.
- * shared.cc: Ditto.
- * syscalls.cc (seteuid): Ditto. Eliminate redundant conditional.
- * uinfo.cc (internal_getlogin): Ditto.
- * spawn.cc (spawn_guts) Revert previous patch.
-
-Tue May 15 10:20:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler_socket.cc (fhandler_socket::ioctl): Convert s_addr
- field to host byte order before comparing with INADDR_LOOPBACK.
-
-Tue May 15 9:03:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * autoload.cc: Add autoload statements for ws2_32 functions
- `WSACloseEvent', `WSACreateEvent', `WSAGetOverlappedResult',
- `WSARecv', `WSARecvFrom', `WSASend', `WSASendTo' and `WSASetEvent',
- `WSAWaitForMultipleEvents'.
- * net.cc: Define wsock_evt.
- (wsock_event): New class.
- (cygwin_sendto): Use overlapped socket io if available.
- (cygwin_recvfrom): Ditto.
- (cygwin_recv): Ditto.
- (cygwin_send): Ditto.
- * security.cc (subauth): Set Win32 error to 0 to safely ask for the
- error code of dynamically loaded function `LsaRegisterLogonProcess'.
-
-Mon May 14 15:37:29 2001 Christopher Faylor <cgf@cygnus.com>
-
- * errno.cc (_sys_errlist): Add missing commas.
-
-Mon May 14 16:13:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (subauth): Check if Secur32.dll could be loaded.
-
-Sun May 13 22:49:04 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (path_conv::check): Revert allow_ntsec check so that volume
- info is always retrieved and isdisk setting is properly set.
-
-Sun May 13 14:02:36 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_tty.cc (fhandler_tty_common::dup): Preserve O_NOCTTY when
- duping a filehandle.
-
-Sat May 12 18:19:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * dir.cc (rmdir): Rearrange slightly to allow removing directories
- even when R/O attribute is set.
-
-Fri May 11 16:53:38 2001 Christopher Faylor <cgf@cygnus.com>
-
- * external.cc (fillout_pinfo): Use correct pids.
- * path.cc (mount_info::conv_to_win32_path): Correct test for whether to
- include a slash.
-
-Fri May 11 01:04:17 2001 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (handle_exceptions): Don't print message when executing
- from a cygwin program.
-
-2001-05-10 Egor Duda <deo@logos-m.ru>
- Christopher Faylor <cgf@redhat.com>
-
- * environ.cc (winenv): Always add SYSTEMDRIVE and SYSYEMROOT to
- win32-style environment if they don't already exist.
-
-2001-05-10 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * path.cc (mount_info::conv_to_win32_path): Treat UNC paths the same as
- paths including `:' or `\'.
-
-Wed May 9 14:46:32 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h (fhandler_termios::echo_erase): Declare new method.
- * fhandler_termios.cc (fhandler_termios::echo_erase): New method for
- echoing erase characters.
- (fhandler_termios::line_edit): Check the echo flag before echoing
- control characters (from Kazuhiro Fujieda <fujieda@jaist.ac.jp>).
-
-Wed May 9 10:43:30 2001 Christopher Faylor <cgf@cygnus.com>
-
- * include/pthread.h: Remove C++ comment.
-
-Tue May 8 11:09:59 2001 Christopher Faylor <cgf@cygnus.com>
-
- * cygheap.cc (_cfree): Add regparm attribute.
- (_crealloc): Ditto.
-
- * dcrt0.cc (dll_crt0_1): Default to always checking for executable for now.
-
- * dtable.cc (dtable::not_open): Move method.
- * dtable.h (dtable): Here.
-
- * exceptions.cc (ctrl_c_handler): Don't expect process group leader to
- handle a signal if it doesn't exist.
-
- * fhandler.h (fhandler_base): Make openflags protected.
-
- * localtime.c (tzsetwall): Check for __CYGWIN__ as well as __WIN32__.
-
- * path.cc (path_conv::check): Add some comments. Change strcat to assignment.
-
- * lib/_cygwin_S_IEXEC.cc (_cygwin_bob__): Eliminate.
-
- * fhandler_tty.cc (fhandler_console::dup): Set controlling terminal if necessary.
- * fhandler_tty.cc (fhandler_tty_slave::dup): Ditto.
-
-Mon May 7 21:33:17 2001 Christopher Faylor <cgf@cygnus.com>
-
- * include/sys/file.h: Revert special X_OK usage. Just make it a
- constant.
-
-Sun May 6 17:05:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * thread.h (pthread_cond): New element cond_access to allow atomic
- broadcasts.
- * thread.cc (pthread_cond::pthread_cond): Initialise cond_access.
- (pthread_cond::~pthread_cond): Destroy cond_access.
- (pthread_cond::Broadcast): Use cond_access.
- (pthread_cond::Signal): Use cond_access.
- (pthread_cond_wait): Use cond_access.
- (pthread_cond_timedwait): Use cond_access.
-
-Sun May 6 11:55:40 2001 Christopher Faylor <cgf@cygnus.com>
-
- * string.h (cygwin_strchr): Make 'static inline' so that things will
- still work when optimized.
-
-Sat May 5 01:04:11 2001 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (handle_exceptions): Vastly increase test for exception
- loop guard variable.
-
-Fri May 4 22:23:33 2001 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (stack_info): Add some controls.
- (stack_info::init): Add extra arguments to control method of
- initialization.. If we have a known good frame, set things up so that
- this frame is not skipped the first time through. Record whether
- caller cares about arguments or not.
- (stack_info::walk): Don't store arguments if they're unwanted.
- (stackdump): Add isexception parameter for use when called by exception
- handler.
- (cygwin_stackdump): Accommodate extra argument to stackdump.
- (handle_exceptions): Ditto.
- (sig_handle): Ditto.
- (interrupt_on_return): Accommodate extra arguments to stack walk
- initialization.
-
-Fri May 4 21:05:20 2001 Christopher Faylor <cgf@cygnus.com>
-
- * localtime.c: Revert exclusion of windows.h.
-
-Fri May 4 17:03:16 2001 Christopher Faylor <cgf@cygnus.com>
-
- * string.h: Fix last-minute typo.
-
-Fri May 4 16:49:34 2001 Christopher Faylor <cgf@cygnus.com>
-
- * pinfo.h: Correctly set __SIGOFFSET.
-
- * path.cc (hash_path_name): Avoid calling library functions for simple
- copying of characters.
-
- * shortcut.c: Use WIN32_LEAN_AND_MEAN.
- * smallprint.c: Ditto.
-
- * environ.cc (getwinenv): Minor clarity fix.
-
- * localtime.c: No need to include windows.h
-
- * string.h: New file.
-
-Fri May 4 16:37:30 2001 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (ctrl_c_handler): Always send signal to process if it
- has no tty.
-
-2001-05-04 Egor Duda <deo@logos-m.ru>
-
- * fhandler_socket.cc (set_connect_secret): Use /dev/urandom to
- generate secret cookie.
-
-Thu May 3 16:37:55 2001 Christopher Faylor <cgf@cygnus.com>
-
- * include/pthread.h (pthread_cleanup_push): Eliminate space preceding
- arguments.
- (pthread_cleanup_pop): Ditto.
-
-Thu May 3 18:16:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (wsock_init): Rename `was_in_progress' to `wsock_started'
- for clearness.
-
-Thu May 3 10:44:16 2001 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (handle_exceptions): Break out of "loop" if the
- debugger doesn't seem to be attaching to our process.
-
-Wed May 2 20:18:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * autoload.cc: Use new definition of LoadDLLinitfunc throughout.
- Redefine wrapper for wsock32.dll and ws2_32.dll.
- (std_dll_init): New function.
- * autoload.h: Rename LoadDLLinitfunc to LoadDLLinitfuncdef.
- Add new defines LoadDLLinitfunc and LoadDLLstdfunc.
- * net.cc (wsock_init): Add guard variable handling. Take care
- to call WSAStartup only once. Load WSAStartup without using
- autoload wrapper to eliminate recursion. Eliminate FIONBIO
- and srandom stuff.
-
-Tue May 1 01:26:15 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (mount_info::conv_to_win32_path): More path tweaking.
-
-Tue May 1 00:34:46 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (mount_info::conv_to_win32_path): Fix debugging output to
- avoid a SIGSEGV. Avoid double backslashes in middle of filename.
-
-Mon Apr 30 21:51:14 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (mkrelpath): New function.
- (mount_info::conv_to_win32_path): Eliminate now-unneeded relative path
- name arg and processing.
- (path_conv::check): Accommodate relative path names again. Accommodate
- one extra argument in mount_info::conv_to_win32_path. Tack trailing
- slash on end of relative path as a side effect, like before.
- * shared_info.h (mount_info::conv_to_win32_path): Reflect new argument
- ordering.
-
-Mon Apr 30 22:09:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * autoload.cc: Add LoadDLLinitfunc for secur32.dll.
- Add LoadDLLfuncEx statements for AllocateLocallyUniqueId@4,
- DuplicateTokenEx@24, LsaNtStatusToWinError@4,
- LsaDeregisterLogonProcess@4, LsaFreeReturnBuffer@4,
- LsaLogonUser@56, LsaLookupAuthenticationPackage@12,
- LsaRegisterLogonProcess@12,
- * environ.cc: Add extern declaration for `subauth_id'.
- (subauth_id_init): New function for setting `subauth_id'.
- (struct parse_thing): Add entry for `subauth_id'.
- * fork.cc (fork_parent): Call `RevertToSelf' and
- `ImpersonateLoggedOnUser' instead of `seteuid'.
- * security.cc: Define global variable `subauth_id'.
- (extract_nt_dom_user): New function.
- (cygwin_logon_user): Call `extract_nt_dom_user' now.
- (str2lsa): New static function.
- (str2buf2lsa): Ditto.
- (str2buf2uni): Ditto.
- (subauth): Ditto.
- * security.h: Add prototype for `subauth'.
- * spawn.cc (spawn_guts): Use cygheap->user.token only if impersonated.
- Use `cygsid' type. Remove impersonation before allowing access to
- workstation/desktop to everyone. Call `RevertToSelf' and
- `ImpersonateLoggedOnUser' instead of `seteuid'.
- * syscalls.cc (seteuid): Rearranged to allow using subauthentication
- to retrieve user tokens when needed.
-
-Mon Apr 30 20:26:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * uinfo.cc (internal_getlogin): Formatting change.
-
-Mon Apr 30 19:58:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * grp.cc: Eliminate MAX_DOMAIN_NAME define.
- (read_etc_group): Substitute MAX_DOMAIN_NAME by
- INTERNET_MAX_HOST_NAME_LENGTH.
- * passwd.cc (parse_pwd): Don't force pw_name to be lower case.
- * sec_helper.cc: Substitute MAX_USER_NAME by UNLEN,
- MAX_COMPUTERNAME_LENGTH by INTERNET_MAX_HOST_NAME_LENGTH throughout.
- (lookup_name): Slight cleanup.
- * security.cc (alloc_sd): Substitute MAX_USER_NAME by UNLEN.
- * security.h: Define DEFAULT_UID as DOMAIN_USER_RID_ADMIN and
- DEFAULT_GID as DOMAIN_ALIAS_RID_ADMINS.
- * shared.cc (memory_init): Substitute MAX_USER_NAME by UNLEN.
- * thread.h: Ditto.
- * uinfo.cc (internal_getlogin): Substitute MAX_USER_NAME by UNLEN.
- Substitute MAX_COMPUTERNAME_LENGTH and MAX_HOST_NAME by
- INTERNET_MAX_HOST_NAME_LENGTH.
- * winsup.h: Include lmcons.h. Eliminate MAX_USER_NAME and
- MAX_HOST_NAME. Move DEFAULT_UID and DEFAULT_GID to security.h.
-
-Mon Apr 30 12:35:40 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (path_conv::check): Don't use path_flags when converting to
- MS-DOS syntax unless parsing tail of path component. Stop parsing path
- when we reach the 'root' of the path. Correctly copy tail to path
- component.
-
-Sun Apr 29 22:28:06 2001 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (INIT_EXCEPTION_HANDLER): Eliminate.
- (init_exceptions): Just use init_exception_handler.
- (open_stackdumpfile): New function.
- (stack_info::first_time): Eliminate.
- (stack_info::init): Set up fields to avoid "first_time" consideration.
- (stack_info::walk): Remove "first_time" consideration.
- (stackdump): Change arguments to accept initial frame pointer and open
- stack file flag.
- (stack): Eliminate.
- (cygwin_stackdump): Use stackdump() rather than stack().
- (try_to_debug): Remove all synchronization logic. Just keep looping in
- exception handler until debugger notices us. Return 1 if successfully
- started debugger.
- (handle_exceptions): Just return if we know that we're debugging.
- Reorganize to avoid creating a stackdump file if we are starting a
- debugger. Return from exception handler if debugger started
- successfully.
- (sig_handle): Create a stackdump only if debugger wasn't started.
- * winsup.h (try_to_debug): Add an argument.
-
-Sun Apr 29 21:41:25 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (symlink_info::check): Remove extra arguments, move
- functionality back to path_conv::check. Clear symlink bit from pflags
- argument before detecting if this is a symlink.
- (path_conv::check): Convert posix path here instead of
- symlink_info::check. Only grab volflags when using ntsec.
- (symlink_info::check_case): Just replace appropriate part of input
- path.
-
-Sat Apr 28 19:36:13 2001 Christopher Faylor <cgf@cygnus.com>
-
- Throughout, change 'tty_attached' to 'real_tty_attached', for clarity.
- Throughout, change 'OutputStopped' to 'output_stopped', for
- consistency.
- * dtable.cc (stdio_init): Set controlling tty if not set by stdio
- opens.
- * exceptions.cc (ctrl_c_handler): Avoid special pgid checking if no tty
- is associated with the process.
- (Suggested by Tim Baker <dbaker@direct.ca>)
- * external.cc (fillout_pinfo): Return actual tty number for ctty.
- * fhandler_console.cc (get_tty_stuff): Set ctty when shared memory is
- allocated. Accept flags input from open().
- (set_console_ctty): New function.
- (fhandler_console::open): Pass flags to get_tty_stuff and rely on this
- function to set the ctty, if appropriate.
- * fhandler_termios.cc (fhandler_termios::set_ctty): Move to tty_min
- class.
- * fhandler_tty.cc (fhandler_tty_slave::open): Use tc field to access
- set_ctty().
- * tty.h (TTY_CONSOLE): Move to include/sys/cygwin.h.
- (tty_min): Add set_ctty class here.
- * include/sys/cygwin.h (TTY_CONSOLE): New home here.
-
- * path.cc (symlink_info): Make contents an actual buffer. Pass more
- flags to case_check.
- (path_conv::check): Reorganize to do parsing based on posix path rather
- than native path.
- (symlink_info::check): Expect posix path as input. Translate to native
- path here. Accept path_conv flags. Stop parsing if not a symlink
- regardless of whether previous path was a symlink.
-
-2001-04-27 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * thread.cc (thread_init_wrapper): Use _REENT_INIT to initialize the
- reent structure of newlib.
-
-Fri Apr 27 14:02:24 2001 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.h (sig_send): Add exception parameter to sig_send.
- * sigproc.cc (sig_send): Ditto. Use it when setting frame info.
- * exceptions.cc (handle_exceptions): Use exception flag when calling
- sig_send.
-
-2001-04-27 Egor Duda <deo@logos-m.ru>
-
- * tty.cc (tty::make_pipes): Set to_slave pipe mode to nonblocking.
- * fhandler_tty.cc (fhandler_pty_master::accept_input): If pipe buffer
- is full, give slave a chance to read data.
-
-2001-04-26 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * security.cc (alloc_sd): Add unrelated ACCESS_ALLOWED_ACE behind
- the `everyone' ACE.
-
-Wed Apr 25 15:07:37 2001 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.h [sigthread]: Add exception field.
- [sigframe::~sigframe]: Clear exception field.
- [sigframe::set]: Set exception field from caller.
- * sigproc.cc (sig_send): Set exception field when frame pointer is
- passed in.
- * exceptions.cc (interrupt_on_return): Always treat exception as
- interruptible.
-
-2001-04-25 Egor Duda <deo@logos-m.ru>
-
- * cygwin.din: Export asctime_r, ctime_r, gmtime_r, localtime_r
- * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 39
-
-Wed Apr 25 10:57:36 2001 Christopher Faylor <cgf@cygnus.com>
-
- * include/cygwin/version.h: Bump minor version number.
- * childinfo.h: Bump child structure magic number.
-
-2001-04-25 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * uinfo.cc (internal_getlogin): Return pointer to struct passwd.
- (uinfo_init): Accommodate the above change.
- * syscalls.cc (seteuid): Ditto.
-
-Tue Apr 25 11:08:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * autoload.cc: Add LoadDLLfunc statements for SetTokenInformation@16.
- * cygheap.cc: Include security.h.
- * grp.cc (internal_getgrent): New function.
- (getgroups): Rearranged using `internal_getgrent' and the new
- `cygsid' class.
- * passwd.cc (internal_getpwent): New function.
- * sec_acl.cc: Use new `cygsid' class throughout.
- (acl_access): Use `internal_getgrent' instead of `getgrent'.
- * sec_helper.cc: Use new `cygsid' class throughout.
- (get_id_from_sid): Use `internal_getgrent' instead of `getgrent'.
- Use `internal_getpwent' instead of `getpwent'.
- * security.cc: Use new `cygsid' class throughout.
- * security.h: Move `MAX_SID_LEN' from winsup.h to here.
- Add extern declarations for `internal_getgrent' and `internal_getpwent'.
- (class cygsid): New class.
- * shared.cc (sec_user): Use new `cygsid' class.
- * syscalls.cc (seteuid): Try to set owner to user and primary group to
- current group in impersonation token before performing impersonation.
- (setegid): Try to set primary group in process token to the new group
- if ntsec is on.
- * uinfo.cc (internal_getlogin): Use new `cygsid' class.
- Try to set owner to user and primary group to current group in process
- token if the process has been started from a non cygwin process.
- (uinfo_init): Set primary group only if the process has been started
- from a non cygwin process.
- * winsup.h: Move define for `MAX_SID_LEN' to security.h.
-
-Mon Apr 16 23:20:00 2001 Andy Younger <andylyounger@hotmail.com>
-
- * fhandler_dsp.cc: Improved handling of 8 bit playback modes.
- Put in mock support for SNDCTL_DSP_SETFRAGMENT.
-
-Tue Apr 24 23:51:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * passwd.cc (getpwnam_r): Add pw_passwd handling as well.
- (getpwuid_r): Ditto.
-
-Tue Apr 24 23:43:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * passwd.cc (getpwnam_r): Use correct offsets into buffer.
- Copy pw_gecos field as well.
- (getpwuid_r): Ditto.
-
-2001-04-24 Egor Duda <deo@logos-m.ru>
-
- * dlmalloc.c: New file. Port of Doug Lea's malloc
- * dlmalloc.h: Ditto.
- * Makefile.in: Add support for MALLOC_DEBUG
- * config.h.in: Ditto.
- * winsup.h: Ditto.
- * configure.in: Add --enable-malloc-debugging option.
- * configure: Regenerate.
- * debug.h: Include declarations for debugging malloc.
- * tty.cc (grantpt): Fix definition.
- (unlockpt): Ditto.
-
-Mon Apr 23 22:00:29 2001 Christopher Faylor <cgf@cygnus.com>
-
- Remove trailing underscore from fhandler_base and friends, throughout.
- * fhandler.h (fhandler_base::set_open_status): New method. Stores
- original open status.
- (fhandler_base::get_open_status): New method. Retrieves original open
- status.
- (fhandler_base::reset_to_open_binmode): New method.
- * fhandler.cc (fhandler_base::open): Save open status.
- (fhandler_base::init): Ditto.
- * fhandler_clipboard.cc (fhandler_clipboard::open): Ditto.
- * fhandler_console.cc (fhandler_console::open): Ditto.
- * fhandler_dsp.cc (fhandler_dsp::open): Ditto.
- * fhandler_dev_mem.cc (fhandler_dev_mem::open): Ditto.
- * fhandler_dev_random.cc (fhandler_dev_random::open): Ditto.
- * fhandler_serial.cc (fhandler_serial::open): Ditto.
- * fhandler_tty_slave.cc (fhandler_tty_slave::open): Ditto.
- * fhandler_tty_master.cc (fhandler_tty_master::open): Ditto.
- * fhandler_dev_zero.cc (fhandler_dev_zero::open): Ditto.
- * syscalls.cc (setmode): Rework so that 0 mode value causes reversion
- to open state.
-
- * fhandler_tty_slave.cc (fhandler_tty_slave::read): Use correct
- multiplier when converting from deciseconds to milliseconds.
-
-Mon Apr 23 13:28:35 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.h (fhandler_base::clear_r_binary): New method.
- (fhandler_base::clear_w_binary): New method.
- * syscalls.cc (setmode): Accept 0 as mode value. Resets text/binary
- behavior for fd to default.
-
-Mon Apr 23 12:46:07 2001 Christopher Faylor <cgf@cygnus.com>
-
- * net.cc [errmap]: Add '0' condition.
- (find_winsock_errno): Don't translate no error to EPERM.
-
-Sun Apr 22 20:48:24 2001 Christopher Faylor <cgf@cygnus.com>
-
- * include/cygwin/version.h: Bump Cygwin version and API version.
-
-Mon Apr 23 9:27:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * thread.cc (MTinterface::Init): Always initialise per process variables.
-
-Sun Apr 22 19:18:18 2001 Christopher Faylor <cgf@cygnus.com>
-
- * features.h: Reinstate as wrapper for sys/features.h.
-
-Mon Apr 23 0:10:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (alloc_sd): Reformat comment.
- * shared.cc: Drop function declarations already in security.h.
-
-Sun Apr 22 12:17:57 2001 Christopher Faylor <cgf@cygnus.com>
-
- * shortcut.c (check_shortcut): Close input file handle before
- returning.
- * path.cc (check_sysfile): Ditto.
- (symlink_info::check): Rely on opened file handle being closed by
- symlink checking routines. Set ext_tacked_on when .lnk is detected.
-
-Sat Apr 21 19:26:05 2001 Christopher Faylor <cgf@cygnus.com>
-
- * thread.cc (MTinterface::Init): Remove accidentally checked in code.
-
-Sun Apr 22 00:22:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * passwd.cc (getpwuid): Check for thread cancellation.
- (getpwuid_r): Ditto.
- (getpwname): Ditto.
- (getpwnam_r): Ditto.
- * thread.h (pthread_mutex): New constructors for pshared operation.
- (MTinterface): Associative array for pshared mutex's.
- * thread.cc (MTinterface::Init): Initailize pshared mutex array.
- (pthread_cond::BroadCast): Implementation notes.
- (pthread_cond::TimedWait): Remove use of SignalObjectAndWait on non-NT systems.
- (pthread_mutex::pthread_mutex(unsigned short)): New function.
- (pthread_mutex::pthread_mutex (pthread_mutex_t *, pthread_mutexattr *)):New function.
- (pthread_mutex::pthread_mutex(pthread_mutexattr *)): Fail on pshared mutex's.
- (__pthread_mutex_getpshared): New function.
- (__pthread_join): Check for thread cancellation.
- (__pthread_cond_timedwait): Support pshared mutex's.
- (__pthread_cond_wait): Ditto.
- (__pthread_condattr_setpshared): Error on PROCESS_SHARED requests.
- (__pthread_mutex_init): Support pshared mutex's.
- (__pthread_mutex_getprioceiling): Ditto.
- (__pthread_mutex_lock): Ditto.
- (__pthread_mutex_trylock): Ditto.
- (__pthread_mutex_unlock): Ditto.
- (__pthread_mutex_destroy): Ditto.
- (__pthread_mutex_setprioceiling): Ditto.
- (__pthread_mutexattr_setpshared): Support PTHREAD_PROCESS_PSHARED requests.
-
-Fri Apr 20 19:38:29 2001 Christopher Faylor <cgf@cygnus.com>
-
- * cygwin.din: Add *scanf and *scan_r functions.
-
-Fri Apr 20 22:25:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * security.cc (set_process_privileges): Swap out.
- * sec_helper.cc (set_process_privilege): Rename from
- `set_process_privileges'. Takes the privilege to enable or disable
- as parameter now.
- * security.h: Add prototype for `set_process_privileges'.
-
-2001-04-19 Egor Duda <deo@logos-m.ru>
-
- * path.cc (path_conv::check): Always initialize member variables.
-
-Fri Apr 20 12:27:49 2001 Christopher Faylor <cgf@cygnus.com>
-
- * include/sys/file.h: More cleanup for X_OK.
-
-Fri Apr 20 11:48:45 2001 Christopher Faylor <cgf@cygnus.com>
-
- * include/sys/file.h: Move X_OK protection earlier.
-
- * dtable.cc (dtable::vfork_child_fixup): Avoid closing already closed
- handles.
-
-Fri Apr 20 16:29:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * grp.cc (getgroups): Change so that SIDs get compared instead
- of strings to SIDs.
-
-Fri Apr 20 14:50:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * Makefile.in: Add object files `sec_helper.cc' and `sec_acl.cc'.
- * security.cc: Swap out several functions.
- * sec_acl.cc: New file. Move Sun compatibel ACL functions from
- `security.cc' to here.
- * sec_helper.cc: New file. Move security helper functions from
- `security.cc' to here.
- * security.h: Changed to accommodate the above changes.
-
-Fri Apr 20 14:12:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * grp.cc: Replace `group_in_memory_p' by `group_state'.
- Eliminate group_sem throughout.
- (enum grp_state): New enumeration type.
- (read_etc_group): Make race safe.
- * security.cc: Eliminate group_sem throughout.
-
-Thu Apr 19 9:40:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * mmap.cc (mmap): Drop usage of the same memory area if the same
- region of the same file is mapped twice.
-
-Wed Apr 18 16:53:54 2001 Christopher Faylor <cgf@cygnus.com>
-
- Throughout, change fdtab references to cygheap->fdtab.
- * child_info.h (cygheap_exec_info): Eliminate special fdtab stuff.
- * spawn.cc (spawn_guts): Ditto.
- * cygheap.cc (cygheap_init): Initialize fdtab, if appropriate.
- * cygheap.h (CYGHEAPSIZE): Include size of init_cygheap.
- (_cmalloc_entry): Include fdtab here.
- * dtable.h (dtable): Declare/define new methods.
- * dtable.cc (dtable::vfork_child_fixup): New method.
- (dtable::fixup_after_exec): Remove unneeded extra arguments.
- * dcrt0.cc (dll_crt0_1): Ditto.
-
- * environ.cc (getwinenv): Use case sensitive comparison.
- (winenv): Make a copy of environment cache to avoid realloc problems
- when duplicate environment variables exist in the environment. (From
- Egor Duda)
-
- * net.cc (cygwin_socket): Revert Apr 14 change.
-
- * include/sys/file.h: Protect against previous X_OK definition.
-
-Tue Apr 17 12:18:28 2001 Christopher Faylor <cgf@cygnus.com>
-
- * passwd.cc: Eliminate passwd_sem throughout.
- * security.cc: Ditto.
-
-Tue Apr 17 12:18:28 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * cygwin.din: Export New functions.
- * passwd.cc (read_etc_passwd): Make race safe.
- (getpwuid_r): New function.
- (getpwnam_r): New function.
-
-2001-04-18 Egor Duda <deo@logos-m.ru>
-
- * grp.cc (getgroups): Avoid crash if passwd field if /etc/group is
- empty.
-
-Tue Apr 17 19:05:44 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.h (path_conv::add_ext_from_sym): Declare.
- * path.cc (path_conv::add_ext_from_sym): Convert to pure inline method.
-
-Tue Apr 17 18:50:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * path.cc (windows_device_names): Add missing NULL element.
-
-Tue Apr 17 12:14:54 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (windows_device_names): Move dsp to proper location.
-
-Tue Apr 17 13:44:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * path.cc (path_conv::check): Set case_clash even if pcheck_case
- is set to PCHECK_ADJUST when a case clash is given for the last
- component in path.
- (symlink_info::case_check): Ditto.
- * syscalls.cc (_rename): Avoid overwriting an already existing file
- if a case clash is given even if pcheck_case is set to PCHECK_ADJUST.
-
-Tue Apr 17 2:07:07 2001 Christopher Faylor <cgf@cygnus.com>
-
- * config.h.in: Turn off VFORK again.
-
-Mon Apr 16 23:45:24 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.h (cwdstuff): Move class.
- * cygheap.h (cwdstuff): To here.
- (init_cygheap): Add cwd field.
- * child_info.h (cygheap_exec_info): Eliminate cwd stuff.
- (child_info_spawn): Ditto.
- * dcrt0.cc (dll_crt0_1): Remove cygcwd.fixup_after_exec call. Convert
- cygcwd reference to cygheap->cwd.
- * path.cc: Ditto, throughout.
- (cwdstuff::copy): Eliminate.
- (cwdstuff::fixup_after_exec): Ditto.
- * spawn.cc (spawn_guts): Eliminate call to cygcwd.copy.
-
- * fhandler.h (FH_OSS_DSP): Move into "fast" device category.
-
-Mon Apr 16 19:19:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * mmap.cc: Move fh_paging_file from some functions to be
- a global static variable.
- (class mmap_record): Add `devtype_' member to remember
- the device type of the file. Add declaration for methods
- `get_device', `alloc_fh' and `free_fh'.
- (mmap_record::mmap_record): Initialize `devtype_' correctly.
- (mmap_record::alloc_fh): New method.
- (mmap_record::free_fh): Ditto.
- (munmap): Use new mmap_record::alloc_fh and mmap_record::free_fh
- methods to create a correct fhandler.
- (msync): Ditto.
- (fixup_mmaps_after_fork): Ditto.
-
-Mon Apr 16 16:01:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * grp.cc (getgroups): If `allow_ntsec' is set, use the process token
- information to evaluate the groups list.
-
-Mon Apr 16 00:08:02 2001 Christopher Faylor <cgf@cygnus.com>
-
- * features.h: Remove this file as it is now being supplied by newlib.
-
-Sun Apr 15 23:23:29 2001 Christopher Faylor <cgf@cygnus.com>
-
- * autoload.cc: Add winmm functions needed by fhandler_dsp.cc.
-
-Sun Apr 15 22:53:52 2001 Andy Younger <andylyounger@hotmail.com>
-
- * fhandler_dsp.cc: New file. Implements OSS like /dev/dsp.
- * include/sys/soundcard.h: New file. User land includes for OSS
- /dev/dsp.
- * fhandler.h: Add new class fhandler_dev_dsp and a FH_OSS_DSP
- definition.
- * dtable.cc (dtable::build_fhandler): Allow creation of the /dev/dsp
- device.
- * path.cc (windows_device_names): Add /dev/dsp into list of device
- names.
- * Makefile.in (DLL_OFILES): Add fhandler_dsp.o.
-
-Sun Apr 15 16:36:27 2001 Christopher Faylor <cgf@cygnus.com>
-
- * uname.c (uname): Default n in in86 to 6 if Windows returns > 6.
-
-Sun Apr 15 15:56:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * path.cc (add_ext_from_sym): Redefine to call `add_ext_from_sym_'.
- (add_ext_from_sym_): New inline function.
-
-Sat Apr 14 19:23:52 2001 Christopher Faylor <cgf@cygnus.com>
-
- * config.h.in: Turn on VFORK by default.
-
-Sat Apr 14 18:04:35 2001 Christopher Faylor <cgf@cygnus.com>
-
- * net.cc (cygwin_socket): Set SO_LINGER to small value so closed UNIX
- domain sockets will not stay around.
-
-Sat Apr 14 18:01:43 2001 Pierre A. Humblet <Pierre.Humblet@ieee.org>
-
- * select.cc (socket_cleanup): Set SO_LINGER to small value so closed
- dummy sockets do not stay around. Use correct value for second argument
- to shutdown.
-
-Sat Apr 14 17:04:00 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * thread.h (MTinterface): Add threadcount.
- * thread.cc (MTinterface::Init): Set threadcount to 1.
- (__pthread_create): Increment threadcount.
- (__pthread_exit): Decrement threadcount and call exit() from the last thread.
-
-Fri Apr 13 11:34:24 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * fork.cc (fork_child): Call the __pthread_atforkchild function.
- (fork_parent): Call the __pthread_atforkparent function.
- * cygwin.din: Export pthread_atfork.
- * thread.h (callback): New class.
- (MTinterface): Use it.
- * thread.cc (__pthread_atforkprepare): New function.
- (__pthread_atforkparent): New function.
- (__pthread_atforkchild): New function.
- (__pthread_atfork): New function.
- * pthread.cc (pthread_atfork): New function.
-
-Fri Apr 13 9:52:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * path.cc (add_ext_from_sym): New define evaluating `known'suffix'.
- (path_conv::check): Use add_ext_from_sym throughout.
-
-Thu Apr 12 23:19:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * dir.cc (mkdir): Check for case clash.
- * environ.cc: Add extern declaration for `pcheck_case'.
- (check_case_init): New function.
- (struct parse_thing): Add "check_case" option.
- * errno.cc (_sys_nerrlist): Add text for ECASECLASH.
- (strerror): Add case branch for ECASECLASH.
- * fhandler.cc (fhandler_disk_file::open): Check for case clash.
- * path.cc: Add global variable `pcheck_case'.
- (struct symlink_info): Add member `case_clash' and method `case_check'.
- (path_prefix_p_): Call `pathnmatch' instead of `strncasematch'.
- (pathnmatch): New funtion.
- (pathmatch): Ditto.
- (path_conv::check): Add handling for case checking.
- (symlink): Check for case clash.
- (symlink_info::check): Add parameter for case checking.
- Handle case checking.
- (symlink_info::case_check): New method.
- (chdir): Don't use unconverted path if pcheck_case==PCHECK_STRICT.
- * path.h: Add extern declarations for `pathmatch' and
- `pathnmatch'.
- (enum case_checking): New enumeration type describing
- the case checking behaviour of path conversion routines.
- (class path_conv): Add member `case_clash'.
- * syscalls.cc (_link): Check for case clash.
-
-Thu Apr 12 12:49:53 2001 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (mkfifo): New function stub.
-
-2001-04-12 Robert Collins <rbtcollins@hotmail.com>
-
- * configure.in: Remove PTH_ALLOW.
- * cygwin.din: Remove @PTH_ALLOW@ prefixes to pthread functions. Add
- new pthread exports.
- * pthread.cc: New wrapper functions for the above new exports.
- * sched.cc (valid_sched_parameters): New function.
- (sched_setparam): Use it.
- (sched_set_thread_priority): New function. Used by pthread_sched*.
- * thread.cc (pthread_key_destructor::InsertAfter): New function.
- (pthread_key_destructor::UnlinkNext): New function.
- (pthread_key_destructor::Next): New function.
- (pthread_key_destructor_list::Insert): New function.
- (pthread_key_destructor_list::Remove): New function.
- (pthread_key_destructor_list::Pop): New function.
- (pthread_key_destructor::pthread_key_destructor): New function.
- (pthread_key_destructor_list::IterateNull): New function.
- (MTinterface::Init): Initialise new member.
- (pthread::pthread): Initialise new members.
- (pthread::create): Copy new attributes. Set the new thread priority.
- (pthread_attr::pthread_attr): Initialise new members.
- (pthread_key::pthread_key): Setup destructor function.
- (pthread_key::~pthread_key): Remove destructor function.
- (pthread_mutexattr::pthread_mutexattr): New function.
- (pthread_mutexattr::~pthread_mutexattr): New function.
- (__pthread_once): New function.
- (__pthread_cleanup): New function.
- (__pthread_cancel): New function.
- (__pthread_setcancelstate): New function.
- (__pthread_setcanceltype): New function.
- (__pthread_testcancel): New function.
- (__pthread_attr_getinheritsched): New function.
- (__pthread_attr_getschedparam): New function.
- (__pthread_attr_getschedpolicy): New function.
- (__pthread_attr_getscope): New function.
- (__pthread_attr_setinheritsched): New function.
- (__pthread_attr_setschedparam): New function.
- (__pthread_attr_setschedpolicy): New function.
- (__pthread_attr_setscope): New function.
- (__pthread_exit): Call any key destructors on thread exit.
- (__pthread_join): Use the embedded attr values.
- (__pthread_detach): Use the embedded attr values.
- (__pthread_getconcurrency): New function.
- (__pthread_getschedparam): New function.
- (__pthread_key_create): Pass the destructor on object creation.
- (__pthread_key_delete): Correct incorrect prototype.
- (__pthread_setconcurrency): New function.
- (__pthread_setschedparam): New function.
- (__pthread_cond_timedwait): Support static mutex initialisers.
- (__pthread_cond_wait): Ditto.
- (__pthread_mutex_getprioceiling): New function.
- (__pthread_mutex_lock): Support static mutex initialisers.
- (__pthread_mutex_trylock): Ditto.
- (__pthread_mutex_unlock): Ditto.
- (__pthread_mutex_destroy): Ditto.
- (__pthread_mutex_setprioceiling): New function.
- (__pthread_mutexattr_getprotocol): New function.
- (__pthread_mutexattr_getpshared): New function.
- (__pthread_mutexattr_gettype): New function.
- (__pthread_mutexattr_init): New function.
- (__pthread_mutexattr_destroy): New function.
- (__pthread_mutexattr_setprotocol): New function.
- (__pthread_mutexattr_setprioceiling): New function.
- (__pthread_mutexattr_getprioceiling): New function.
- (__pthread_mutexattr_setpshared): New function.
- (__pthread_mutexattr_settype): New function. Remove stubs for non
- MT_SAFE compilation.
- * thread.h: Remove duplicate #defines. Add prototypes for new
- functions in thread.cc.
- (pthread_key_destructor): New class.
- (pthread_key_destructor_list): New class.
- (pthread_attr): Add new members.
- (pthread): Remove members that are duplicated in the pthread_attr
- class.
- (pthread_mutex_attr): Add new members.
- (pthread_once): New class.
- * include/pthread.h: Add prototypes for new functions exported from
- cygwin1.dll. Remove typedefs.
- * include/sched.h: Add prototypes for new functions in sched.cc.
- * include/cygwin/types.h: Add typedefs from pthread.h
-
-Tue Apr 10 22:02:53 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (struct symlink_info): Add extn and ext_tacked_on fields.
- (path_conv::check): Only tack on extension if a known one didn't
- already exist.
- (suffix_scan::has): Return pointer to known extension.
- (symlink_info::check): Record location of extension, if any.
-
-2001-04-09 Egor Duda <deo@logos-m.ru>
-
- * fhandler.h (class fhandler_socket): Add members and methods to
- support secure connections on AF_UNIX sockets.
- * fhandler_socket.cc (fhandler_socket::set_connect_secret): New method.
- (fhandler_socket::get_connect_secret): Ditto.
- (fhandler_socket::create_secret_event): Ditto.
- (fhandler_socket::close_secret_event): Ditto.
- (fhandler_socket::check_peer_secret_event): Ditto.
- (fhandler_socket::fixup_after_fork): Duplicate secret event to child.
- (fhandler_socket::dup): Copy address family.
- (fhandler_socket::close): Close secret event.
- * net.cc (get_inet_addr): Read secret cookie.
- (cygwin_connect): Check if peer knows secret cookie value.
- (cygwin_accept): Ditto. Copy address family to newly created socket.
- (cygwin_bind): Generate and write secret cookie.
- (wsock_init): Initialize random number generator.
-
-Sun Apr 8 20:40:58 2001 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Put -lgcc last in list of libraries, since stdc++
- library needs it.
- * cygwin.din: Remove obsolete "__empty" export.
- * exceptions.cc (call_signal_handler_now): Force inclusion of function
- even when -finline-functions is specified.
- * sigproc.h: Remove obsolete call_signal_handler declaration.
-
-Sun Apr 8 20:36:55 2001 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
-
- * fhandler_console.cc (cp_get_internal): New function.
- (cp_convert): New function.
- (con_to_str): New function.
- (str_to_con): New function.
- (fhandler_console::read): Replace OemToCharBuff with con_to_str.
- (fhandler_console::write_normal): Replace CharToOemBuff with str_to_con.
-
-Thu Apr 5 22:41:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * syscalls.cc (stat_worker): Fix conditional which still allowed
- successful stat'ing of non-existant files.
-
-Wed Apr 4 10:37:44 2001 Christopher Faylor <cgf@cygnus.com>
-
- * child_info.h: Bump magic number for fork/exec/spawn.
-
-Tue Apr 3 20:06:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * errno.cc (errmap): Map ERROR_FILE_INVALID to ENXIO.
-
-Mon Apr 2 22:48:58 2001 Christopher Faylor <cgf@cygnus.com>
-
- * cygrun.c (main): Fix compiler warning.
- * gmon.c (_mcleanup): Ditto.
- * profil.c (profile_off): Ditto.
-
- * net.cc (find_winsock_errno): New function.
- (__set_winsock_errno): Use find_winsock_errno.
- (cygwin_setsockopt): Detect SO_ERROR for debugging.
- (cygwin_getsockopt): Ditto. Translate error when getsockopt returns
- SO_ERROR.
- * winsup.h: regparmize __set_winsock_errno.
- * include/sys/strace.h: Document that strace functions can't use
- regparm.
-
-2001-04-02 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * fhandler.cc (fhandler_disk_file::open): Avoid checking a magic
- number of a directory.
-
-Mon Apr 2 00:24:08 2001 Christopher Faylor <cgf@cygnus.com>
-
- * shared_info.h (mount_info): Remove mnt_ elements.
- * thread.h (struct _winsup_t): Add mnt_ elements.
- * path.cc (fillout_mntent): Use mnt_ elements from reent_winsup ().
-
-Sun Apr 1 20:10:34 2001 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (sigframe::call_signal_handler): Return value of
- call_signal_handler_now.
- * sigproc.h (sigframe): Use constructor.
- * syscalls.cc (_read): Correct errno test prior to calling signal
- handler.
-
-Sun Apr 1 00:38:06 2001 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (sigframe::call_signal_handler): Move outside of "C"
- block or some compilers will complain.
-
-Sun Apr 1 00:24:14 2001 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (call_signal_handler_now): Rename from
- call_signal_handler to avoid C++ confusion.
-
-Sun Apr 1 00:08:15 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (fillout_mntent): Always remove drive root directories from
- future consideration by "/cygdrive" reporting.
- (cygdrive_getmnt): Avoid reporting removable drives or drives with no
- media mounted.
-
-Sat Mar 31 21:56:19 2001 Christopher Faylor <cgf@cygnus.com>
-
- * thread.h (struct _winsup_t): Remove obsolete elements. Add
- available_drives element.
- * path.cc (mount_info::getmntent): Report "/cygdrive" drives when
- mounted drives are exhausted.
- (fillout_mntent): New function.
- (mount_item::getmntent): Use fillout_mntent.
- (cygdrives_mntent): New function. Returns next available "/cygdrive".
- (setmntent): Initialize available "/cygdrives".
- * syscalls.cc: Remove some if 0'ed code.
- * times.cc (timezone): Use more descriptive variable name.
-
-Sat Mar 31 18:59:52 2001 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.h (class sigframe): Implement 'unregister()' method.
- (sigframe::~sigframe): Use unregister method.
- (sigframe::call_signal_handler): Declare new method.
- * exceptions.cc (sigframe::call_signal_handler): New method.
- Unregisters current sigframe before calling signal handler.
- (setup_handler): Clear waiting threads prior to arming signal_arrived.
- * syscalls.cc (_read): Change goto to loop. Recalculate sigframe
- inside of loop so that constructor is called when appropriate.
- * wait.cc (wait4): Ditto.
-
- * signal.cc: Change "sig" to "signal" in debugging messages throughout.
- * sigproc.cc: Ditto.
-
-Sat Mar 31 17:12:08 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_serial.cc (fhandler_serial::raw_write): Close protected
- handles with ForceCloseHandle or suffer spurious warnings.
-
-Sat Mar 31 16:23:32 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler.cc (fhandler_base::read): Remove special handling of CTRL-Z.
-
-Sat Mar 31 11:09:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.h (class fhandler_console): Add members `insert_mode'.
- * fhandler_console.cc (fhandler_console::dup): Duplicate `insert_mode'.
- (fhandler_console::fhandler_console): Initialize `insert_mode'.
- (fhandler_console::char_command): Add terminal capabilities
- "enter insert mode" = \E[4h and "exit insert mode" = \E[4l.
- Care for insert mode on terminal capability "repeat char" = \E[x;yb.
- (fhandler_console::write_normal): Care for insert mode before writing
- to the console.
- (array keytable): Add keymapping for modified cursor and control
- block keys (xterm like).
-
-Fri Mar 30 13:02:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.h (class fhandler_console): Add members `savebufsiz' and
- `savebuf' to allow save/restore of screen.
- * fhandler_console.cc (fhandler_console::dup): Duplicate `savebufsiz'
- and `savebuf'.
- (fhandler_console::fhandler_console): Initialize `savebufsiz' and
- `savebuf'.
- (fhandler_console::char_command): Add terminal capabilities
- "save screen content" = \E[?47h and "restore screen content" = \E[?47l.
-
-Wed Mar 28 19:28:50 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (chdir): Eat trailing whitespace on input path.
-
-Tue Mar 27 22:38:42 2001 Christopher Faylor <cgf@cygnus.com>
-
- * lib/_cygwin_S_IEXEC.c: Remove "const" from globals or they never seem
- to be defined. Wrap definitions in extern "C". Include winsup.h to
- assure proper definitions.
-
- * dcrt0.cc (dll_crt0_1): Call stdio_init after premain run so that
- binmode.o, etc., will control default stdio settings.
- * dtable.cc (dtable::init_std_file_from_handle): Allow __fmode to force
- binmode/textmode settings. Default pipes to binmode.
-
-Tue Mar 27 11:31:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * mmap.cc (mmap): Fix conditional for previous patch.
-
-Mon Mar 26 18:48:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * mmap.cc (mmap): Outflank copy-on-write problem on 9x by
- setting access mode to FILE_MAP_READ when read access is requested.
-
-Sun Mar 25 20:12:21 2001 Christopher Faylor <cgf@cygnus.com>
-
- * dlfcn.cc (check_access): Eliminate.
- (check_path_access): Use passed in path_conv buf.
- (get_full_path_of_dll): Use passed in name buf to avoid a static. Rip
- out most of the path checking since LoadLibrary will do all of this
- automatically.
- (dlopen): Set errno when appropriate (may not be compliant?).
- * environ.cc (posify): Don't pass in "native" path if it seems to
- actually be posix.
-
-Thursday Mar 22 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * fhandler.h (fhandler_dev_clipboard): Extend to support writing.
- * fhandler_clipboard.cc (fhandler_dev_clipboard::fhandler_dev_clipboard):
- Initialize new fields. Open clipboard here.
- (fhandler_dev_clipboard::dup): New method.
- (fhandler_dev_clipboard::open): Accommodate new fields. Register
- clipboard here, if appropriate.
- (set_clipboard): New function. Moves buffer to clipboard.
- (fhandler_dev_clipboard::write): Truly implement clipboard writing.
- (fhandler_dev_clipboard::read): Reimplement to allow successive reads.
- (fhandler_dev_clipboard::lseek): Truly implement seeks in clipboard.
- (fhandler_dev_clipboard::close): Clear out new fields. Support
- sequential reads and sequential writes. Support for binary data via a
- native clipboard format.
-
-2001-03-22 Egor Duda <deo@logos-m.ru>
-
- * fhandler_console.cc (fhandler_console::set_default_attr): Update
- console color attributes on tty reset.
-
-Wed Mar 21 22:12:36 2001 Christopher Faylor <cgf@cygnus.com>
-
- * autoload.cc (kernel32_init): New function for kernel32 autoload
- initialization.
- (SignalObjectAndWait): Add conditional load of this function when it is
- available.
-
-2001-03-21 Robert Collins <rbtcollins@hotmail.com>
-
- * sched.cc: New file. Implement sched*.
- * include/sched.h: New file. User land includes for sched*.
- * Makefile.in: Add sched.o
- * cygwin.din: Add exports for sched*.
-
-Tue Mar 20 14:48:46 2001 Christopher Faylor <cgf@cygnus.com>
-
- * dtable.cc: Guard against new winsock.h/winsock2.h warnings when
- mixing winsock*.h and sys/types.h.
- * fhandler_socket.cc: Ditto.
- * net.cc: Ditto.
- * select.cc: Ditto.
- * exceptions.cc: Remove unneeded define.
-
-Mon Mar 19 17:43:29 2001 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (interruptible): Update debugging output.
- (setup_handler): Ensure that wait_sig loop wakes up when we punt on
- sending a signal.
- * poll.cc (poll): Add signal guard here.
-
-2001-03-19 Egor Duda <deo@logos-m.ru>
-
- * tty.h (tty::create_inuse): Add new parameter to allow non-
- inheritable 'inuse' events.
- * tty.cc (tty::create_inuse): Use new parameter.
- * fhandler_tty.cc (fhandler_tty_master::init): Ditto.
- * fhandler_tty.cc (fhandler_pty_master::open): Ditto.
- * fhandler_tty.cc (fhandler_tty_master::init): Create master_alive
- event.
- * tty.cc (tty_list::terminate): Close master_alive event.
- * fhandler_tty.cc (fhandler_tty_common::close): Send EOF to slaves
- when master side is closed.
-
-Mon Mar 19 14:32:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * mmap.cc (map::get_list_by_fd): Avoid calling `get_namehash' when
- file descriptor is -1.
-
-Sat Mar 17 18:30:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * syscalls.cc (check_posix_perm): New static function.
- (fpathconf): Add _PC_POSIX_PERMISSIONS and _PC_POSIX_SECURITY
- support.
- (pathconf): Ditto.
- * include/cygwin/version.h: Bump API minor number to 37.
-
-2001-03-18 Egor Duda <deo@logos-m.ru>
-
- * fhandler.h (fhandler_tty_slave): Declare new methods.
- * select.cc (fhandler_tty_slave::select_read): New method.
- * select.cc (fhandler_tty_slave::ready_for_read): Ditto.
- * select.cc (verify_tty_slave): New function.
- * fhandler_termios.cc (fhandler_termios::line_edit): Empty input
- buffer on signal.
- * fhandler_tty.cc (fhandler_tty_slave::read): Check for input data
- after reading from pipe. Reset event if input pipe is empty.
- * tty.h (class tty): Allow creating events with manual reset.
- * tty.cc (tty::get_event): Use manual_reset flag.
- * tty.cc (tty::common_init): Create input_available_event with
- manual reset.
-
-Sat Mar 17 21:48:03 2001 Christopher Faylor <cgf@cygnus.com>
-
- * external.cc (fillout_pinfo): Match windows pid, as well as cygwin pid
- when passed in pid. Don't prematurely break when searching for a pid.
-
- * thread.h (_winsup_t): Eliminate unneeded field.
-
-Sat Mar 17 20:46:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (get_95_ifconf): Use strcasematch instead of strcasecmp.
- * syscalls.cc (_unlink): Ditto.
- (_rename): Ditto.
-
-Sat Mar 17 12:43:15 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (suffix_scan::next): Avoid searching for foo.lnk twice when
- input is "foo".
-
-Sat Mar 17 18:10:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * net.cc (cygwin_socket): Set protocol to 0 when address family is
- AF_UNIX to avoid WSAEPROTONOSUPPORT error.
-
-Sat Mar 17 09:51:32 2001 Mathew Brozowski <brozow@tavve.com>
-
- * net.cc (cygwin_socket): Pass protocol parameter to socket call.
-
-Sat Mar 17 02:05:38 2001 Christopher Faylor <cgf@cygnus.com>
-
- * dir.cc (readdir): Use strcasematch for consistency.
- * path.cc (symlink_info): Eliminate known_suffix.
- (path_conv::check): Always copy ext_here to end of buffer, if found.
- (suffix_scan): Eliminate ext_here, add suffixes_start.
- (suffix_scan::has): Eliminate an argument. Reorganize. Always return
- pointer to end of input path.
- (suffix_scan::next): Take a second pass through the suffix list looking
- for .lnk.
- (symlink_info::check): Eliminate known_suffix usage.
-
-Sat Mar 17 00:10:52 2001 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (stat_dev): Give devices full read/write by default.
-
-Saturday Mar 17 3:45 2001 Robert Collins <rbtcollins@hotmail.com>
-
- * thread.cc (MTinterface::CreateCond): Check for null attr pointer.
-
-Fri Mar 16 21:13:23 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_termios.cc (fhandler_termios::line_edit): Don't accept input
- when a signal is sent or we'll end up in an EOF/signal race.
-
-Fri Mar 16 20:25:40 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc: Translate scan states from defines to enums.
- (suffix_scan): Rename state to nextstate for clarity.
- (lnk_match): Change to allow multiple states to indicate that a .lnk
- has been matched.
- (suffix_scan::has): Eliminate a goto. Handle .lnk as a special case,
- since a .lnk may also need to be tacked on the end of a .lnk.
- (suffix_scan::next): Don't increment next state. Set it specifically.
- Recognize new .lnk states.
-
-Saturday Mar 17 01:19 2001 Robert Collins rbtcollins@hotmail.com
-
- * cygwin.din: Export the new functions.
- * pthread.cc (pthread_cond_*): Add wrapper functions that call
- __pthread_cond* functions.
- * thread.cc (__pthread_cond_*): Implement the pthread_cond* functions.
- * thread.h: Add new class entries and prototypes for __pthread_cond*
- functions.
- * include/pthread.h: user land header prototypes for pthread_cond*
- functions and related defines.
-
-Wed Mar 14 16:30:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * environ.cc (parse_options): Use strtok_r instead of strtok.
- * security.cc (convert_string_sid_to_sid): Ditto.
- (aclfromtext): Ditto. Fix buffer usage.
-
-Wed Mar 14 10:11:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * path.cc (lnk_suffixes): Remove.
- (class suffix_scan): Add `lnk_state' flag.
- (suffix_scan::lnk_match): Return state of `lnk_state' now.
- (suffix_scan::has): Changed behaviour if file has `.lnk' suffix.
- (suffix_scan::next): Set `lnk_state' where appropriate.
- (symlink_info::check): Fix a wrong `break'.
- * syscalls.cc (chown_worker): Change debug statement to reflect
- lchown fix.
- (lchown): Call chown_worker with `PC_SYM_NOFOLLOW' instead of
- `PC_SYM_IGNORE'.
-
-Tue Mar 13 13:52:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_disk_file::fstat): Add correct modes to
- symlinks when stat'ing on FAT or FAT32 file systems.
-
-2001-03-12 Egor Duda <deo@logos-m.ru>
-
- * fhandler.h (fhandler_termios::fixup_after_exec): New function.
- * fhandler_termios.cc (fhandler_termios::fixup_after_fork): New
- function. Fixup output handle.
- * fhandler_tty.cc (fhandler_tty_common::fixup_after_fork): Output
- handle is now fixed up in fhandler_termios::fixup_after_fork().
-
-2001-03-12 Egor Duda <deo@logos-m.ru>
-
- * fhandler.h (fhandler_termios::fhandler_termios): Enable fixup
- after fork.
- * fhandler_console.cc (fhandler_console::fhandler_console): Fixup
- after fork is now enabled in the base class constructor.
-
-Mon Mar 12 11:19:41 2001 Christopher Faylor <cgf@cygnus.com>
-
- * mkvers.sh: Include config.h so that DEBUGGING is correctly defined.
-
-Mon Mar 12 09:47:55 2001 Christopher Faylor <cgf@cygnus.com>
-
- * spawn.cc (spawn_guts): Don't set EXIT_REPARENTING if parent process
- is not a cygwin process (suggested by Jason Gouger
- <cygwin@jason-gouger.com>).
-
-Sun Mar 11 16:00:58 2001 Christopher Faylor <cgf@cygnus.com>
-
- * child_info.h: Bump magic number for fork/exec/spawn.
-
-Sat Mar 10 20:54:47 2001 Christopher Faylor <cgf@cygnus.com>
-
- * autoload.cc (noload): Use proper method for multiline strings or
- newer gcc's complain.
- * exceptions.cc (unused_sig_wrapper): Ditto.
- * fhandler.h (fhandler_base): Make get_io_handle and friends return
- self.
- * fhandler_tty.cc (fhandler_pty_common::close_on_exec): Accommodate
- DEBUGGING flag to avoid spurious warnings when inheritance is set.
-
-Sat Mar 10 16:52:12 2001 Christopher Faylor <cgf@cygnus.com>
-
- * shortcut.c (PATH_ALL_EXEC): Add parentheses to avoid a compiler
- warning.
-
- * exceptions.cc (setup_handler): Clarify debugging message.
- * sigproc.cc (proc_subproc): Remove PROC_CHILDSTOPPED test. It is
- handled by normal PROC_CLEARWAIT case.
- (wait_sig): Eliminate "dispatched" tracking. Remove __SIGCHILDSTOPPED
- test. Decrement counter again before jumping out of
- InterlockedDecrement loop so that subsequent InterlockedIncrement will
- keep the counter at the correctly decremented value and also detect
- when there are pending signals.
- * sigproc.h: Remove __SIGCHILDSTOPPED element.
- (procstuff): Remove PROC_CHILDSTOPPED element.
-
-Sat Mar 10 15:22:44 2001 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (_rename): Set errno to ENOENT when an old path doesn't
- exist (from Kazuhiro Fujieda <fujieda@jaist.ac.jp>). Also set EACCES
- when directory is not writable.
-
-Wed Mar 7 15:49:47 2001 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (_read): Change definition to return ssize_t to be
- consistent with read.
- (_write): Change definition to return ssize_t to be consistent with
- write.
-
-Wed Mar 7 01:08:21 2001 Christopher Faylor <cgf@cygnus.com>
-
- * sigproc.h (sigthread): Declare new methods. Create new winapi_lock
- field.
- (sigframe:;set): Call get_winapi_lock after frame is set so that signal
- handler thread knows not to call SuspendThread.
- (sigframe::~sigframe): Release winapi_lock.
- * exceptions.cc (sigthread::get_winapi_lock): New method.
- (sigthread::release_winapi_lock): New method.
- (setup_handler): Use get_winapi_lock to ensure that signalled thread is
- not blocked in a Windows API.
-
- * path.h (path_types): Avoid broken GCC warning.
-
-Tue Mar 6 14:02:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * path.cc (suffix_scan::has): Change order of conditionals
- to allow checking for .lnk suffixes even if in_suffixes is empty.
-
-Tue Mar 6 13:02:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * autoload.c (cygwin_premain0): Add missing parameter.
- * binmode.c (cygwin_premain0): Ditto.
- * textmode.c (cygwin_premain0): Ditto.
-
-Tue Mar 6 12:04:00 2001 Jason Tiller <jtiller@sjm.com>
-
- * auto_load.cc: Add "GetKeyboardLayout" entry in the list of
- Win32 User32.DLL exports to provide.
- * fhandler.h (class fhandler_console): Add meta_mask private
- member to remember which keystroke modifiers should generate
- META.
- * fhandler_console.cc (fhandler_console::read): Modify code that
- tests a keystroke for a META-escaped key to use the 'meta_mask'
- variable.
- (fhandler_console::fhandler_console): Add definition for
- variable "meta_mask" used to determine if a keystroke should be
- preceded by META in the client console stream. Set meta_mask
- based on whether or not user's keyboard language is English -
- non-English keyboards pass AltGr (right <ALT>) unmolested,
- whereas English keyboards now interpret left- and right-<ALT>
- as META.
-
-Mon Mar 5 20:15:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * include/a.out.h: Add copyright hint.
- * include/fcntl.h: Ditto.
- * include/lastlog.h: Ditto.
- * include/memory.h: Ditto.
- * include/mntent.h: Ditto.
- * include/paths.h: Ditto.
- * include/poll.h: Ditto.
- * include/syslog.h: Ditto.
- * include/termio.h: Ditto.
- * include/tzfile.h: Ditto.
- * include/arpa/inet.h: Ditto.
- * include/asm/byteorder.h: Ditto.
- * include/asm/socket.h: Ditto.
- * include/asm/types.h: Ditto.
- * include/cygwin/if.h: Ditto.
- * include/cygwin/mtio.h: Ditto.
- * include/cygwin/rdevio.h: Ditto.
- * include/cygwin/socket.h: Ditto.
- * include/net/if.h: Ditto.
- * include/netinet/in.h: Ditto.
- * include/netinet/in_systm.h: Ditto.
- * include/netinet/ip.h: Ditto.
- * include/netinet/ip_icmp.h: Ditto.
- * include/netinet/tcp.h: Ditto.
- * include/sys/cdefs.h: Ditto.
- * include/sys/cygwin.h: Ditto.
- * include/sys/ioctl.h: Ditto.
- * include/sys/mman.h: Ditto.
- * include/sys/mount.h: Ditto.
- * include/sys/mtio.h: Ditto.
- * include/sys/procfs.h: Ditto.
- * include/sys/resource.h: Ditto.
- * include/sys/smallprint.h: Ditto.
- * include/sys/socket.h: Ditto.
- * include/sys/strace.h: Ditto.
- * include/sys/syslog.h: Ditto.
- * include/sys/sysmacros.h: Ditto.
- * include/sys/termio.h: Ditto.
- * include/sys/termios.h: Ditto.
- * include/sys/uio.h: Ditto.
- * include/sys/un.h: Ditto.
- * include/sys/utsname.h: Ditto.
- * include/sys/vfs.h: Ditto.
- * include/sys/wait.h: Ditto.
- * regexp/regerror.c: Ditto.
- * regexp/regexp.h: Ditto.
- * regexp/regmagic.h: Ditto.
-
-Mon Mar 5 01:25:03 2001 Christopher Faylor <cgf@cygnus.com>
-
- * dlopen.c (dlopen): Return NULL when name is NULL (suggested by
- chrisiasci@aol.com).
-
- * cygwin.din: Add a new, internally used export -
- _check_for_executable.
- * dcrt0.cc (dll_crt0_1): Set _check_for_executable for older binaries.
- Pass user_data to premain functions.
- * fhandler.cc (fhandler_disk_file::open): Only check for executable if
- the linked program is interested in the executable bit.
- (fhandler_disk_file::check_execable_p): Delete.
- * fhandler.h (executable_states): New enumeration of various states of
- executable bit caring.
- (fhandler_base::set_execable_p): New method.
-
- * fhandler_termios.cc (fhandler_termios::line_edit): Flag when a signal
- has been sent to the tty. Return -1 when this is so.
- * fhandler_console.cc (fhandler_console::read): Return -1 when signal
- sending character encountered.
-
- * path.cc (path_conv::check): Record when path refers to a disk device.
- Move executable extension check here.
- (check_sysfile): Accommodate new EXEC path states.
- (has_suffix): Remove.
- (next_suffix): Remove.
- (class suffix_scan): New clas.
- (suffix_scan::has): New method.
- (suffix_scan:next): New method.
- (symlink_info::check): Use suffix_scan method to control for scanning
- for suffixes.
- * path.h (path_conv::exec_state): New method.
- * perprocess.h: Make "C" friendly.
- * include/cygwin/version.h: Define CYGWIN_VERSION_CHECK_FOR_S_IEXEC.
- Bump CYGWIN_VERSION_API_MINOR.
- * include/sys/cygwin.h: Change premain declarations.
-
- * winsup.h: Move __cplusplus test to after builtin defines.
-
-2001-03-04 Egor Duda <deo@logos-m.ru>
-
- * fhandler.h (class fhandler_tty_common): New mutex and event to
- syncronize input on master tty with slave tty.
- * fhandler_tty.cc (fhandler_pty_master::accept_input): Use them to
- syncronize with slave.
- * fhandler_tty.cc (fhandler_tty_slave::read): Use input mutex and
- event to syncronize with master. Do not limit amount of data read
- from master to vmin value. Interrupt on signal and return already
- read data, if any.
- * fhandler_tty.cc (fhandler_tty_slave::open): Handle input mutex and
- event.
- * fhandler_tty.cc (fhandler_tty_common::close): Ditto.
- * fhandler_tty.cc (fhandler_tty_common::set_close_on_exec): Ditto.
- * fhandler_tty.cc (fhandler_tty_common::fixup_after_fork): Ditto.
- * fhandler_tty.cc (fhandler_tty_common::dup): Ditto.
- * tty.h (tty::open_input_mutex): New function.
- * tty.cc (tty::common_init): Create input mutex and event.
-
-Fri Mar 2 13:32:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * dir.cc (readdir): Fix creating path in symlink check.
-
-Fri Mar 2 12:33:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * dir.cc (readdir): Fix shortcut==symlink condition.
- * environ.cc: Add extern decl for `allow_winsymlinks'.
- (struct parse_thing): Add entry for `[no]winsymlinks'.
- * path.cc (symlink): Change to be able to create both,
- symlink==shortcut and symlink==systemfile, dependent of
- the setting of `allow_winsymlinks'.
- * security.cc (cygwin_logon_user): Add debug output.
- * shortcut.c: Add defines from path.h.
- (has_exec_chars): Copy from path.h.
- (check_shortcut): Check for executable file condition if not a
- shortcut.
-
-Thu Mar 1 21:06:07 2001 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (sig_handle_tty_stop): Ignore attempts to suspend a
- process if started by non-cygwin parent.
-
-Thu Mar 1 20:48:11 2001 Christopher Faylor <cgf@cygnus.com>
-
- * select.cc (peek_console): Don't report read_ready on mouse events
- unless we are looking for mouse events.
- * fhandler.h (fhandler_console::mouse_aware): New method.
-
-Wed Feb 28 15:10:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * uinfo.cc: Eliminate `#include <wchar.h>'.
-
-2001-02-28 Egor Duda <deo@logos-m.ru>
-
- * fhandler_floppy.cc (fhandler_dev_floppy::lseek): Determine
- drive geometry or partition size to allow seeking from the end of
- raw floppy device. Don't allow positioning past the end of media or
- to offsets bigger then max off_t.
-
-2001-02-27 Egor Duda <deo@logos-m.ru>
-
- * fhandler.h (class fhandler_console): Make all variables that
- describe "state" of console to be members of fhandler_console.
- default_color is now the color which is set when console recieves
- reset command.
- * fhandler_console.cc (fhandler_console::fhandler_console): Turn
- mouse handling and raw keyboard mode off by default. Initialize
- state information.
- * fhandler.cc (fhandler_console::set_raw_win32_keyboard_mode): New
- function.
- * fhandler_console.cc (fhandler_console::set_default_attr): New
- function. Reset console attributes to default values.
- * fhandler_console.cc (fhandler_console::open): Reset attributes.
- * fhandler_console.cc (fhandler_console::get_win32_attr): New function.
- Calculate win32-style console attribute based on terminal attributes.
- * fhandler_console.cc (fhandler_console::set_cursor_maybe): Use
- member variable.
- * fhandler_console.cc (fhandler_console::read): If in raw-win32
- keyboard mode, encode win32 keyboard events in \033{x;y;z;t;u;wK
- sequences.
- * fhandler_console.cc (fhandler_console::dup): Copy all state
- information to the dup()ed handle.
- * fhandler_console.cc (fhandler_console::scroll_screen): Use current
- fill-in attribute.
- * fhandler_console.cc (fhandler_console::clear_screen): Ditto.
- * fhandler_console.cc (fhandler_console::char_command): Check if we
- saw '?' symbol by member variable. Set terminal attributes on \033[Xm
- commands. \033[24m - turn off underline mode, \033[27m - turn off
- reverse mode, \033[39m - restore default foreground color.
- \033[49m - restore default background color. \033[2000h - turn on raw
- keyboard mode, \033[2000l - turn off raw keyboard mode.
- * fhandler_console.cc (fhandler_console::write): Set attribues to
- default values on reset command.
-
-2001-02-26 Mike Simons <msimons@moria.simons-clan.com>
-
- * times.cc (settimeofday): Replace function stub with working code.
-
-Mon Feb 26 10:42:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * strace.cc (strace::vprntf): Move prntf functionality to this function
- adding an va_list interface to strace.
- (strace::printf): Calls strace::vprntf now.
- (strace_printf): New function providing an extern "C" interface to
- trace output.
- * include/sys/strace.h: Make plain C clean.
- (class strace): Add `vprntf' method.
-
-Mon Feb 26 0:10:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * shortcut.c: Remove #include <sys/strace.h>.
-
-Sun Feb 25 10:32:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * path.cc (symlink): Add a ".lnk" suffix regardless. Add a comment.
-
-Sun Feb 25 10:18:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * shortcut.c (check_shortcut): Change symlink condition.
-
-Fri Feb 23 10:42:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * mmap.cc (fhandler_disk_file::mmap): Use `addr' correctly.
- * fhandler_mem.cc (fhandler_dev_mem::mmap): Ditto.
-
-Thu Feb 22 17:09:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * path.cc (symlink): Keep relative paths relative in the DOS
- path inside of a shortcut. If that's impossible or the target
- path is already absolute save an absolute path.
-
-Thu Feb 22 15:33:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * cygerrno.h: Revert previous patch.
- * errno.cc: Ditto.
- * dir.cc: Eliminate `dir_suffixes'.
- (opendir): Remove usage of `dir_suffixes'.
- (rmdir): Ditto.
- * fhandler.cc (fhandler_disk_file::open): Remove usage of
- `inner_suffixes'.
- * path.cc: Rename `inner_suffixes' to `lnk_suffixes'.
- (path_conv::check): Remove usage of `inner_suffixes'.
- (symlink): Ditto.
- (symlink_info::check): Handle checking for `.lnk' in path_conv
- exclusively here.
- (chdir): Remove usage of `dir_suffixes'.
- * shortcut.c: Eliminate debug_printf lines.
- (check_shortcut): Don't set error except on failing ReadFile.
- * spawn.cc: Remove ".lnk" from `std_suffixes'.
- * syscalls.cc (_unlink): Remove usage of `inner_suffixes'.
- Remove ".lnk" from `stat_suffixes'.
- (_rename): Add check for renaming a symlink to keep the ".lnk"
- suffix after renaming.
-
-Thu Feb 22 13:38:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * shortcut.c: New file. Provides a C interface to reading of
- Windows shortcuts to avoid compiler flag `-fvtable-thunks'.
- * shortcut.h: Ditto.
- * Makefile.in: Add shortcut.o to DLL_OFILES.
- * cygerrno.h: Provide a C interface to `geterrno_from_win_error' for
- using in shortcut.c.
- * errno.cc (geterrno_from_win_error): Define as extern "C".
- * path.cc (struct symlink_info): Remove methods `check_shortcut' and
- `check_sysfile'.
- (shortcut_header): Move to shortcut.c.
- (shortcut_initalized): Ditto.
- (create_shortcut_header): Ditto.
- (cmp_shortcut_header): Ditto.
- (symlink_info::check_shortcut): Ditto. Reorganize as a plain C function.
- (symlink_info::check_sysfile): Redefine as a global function using the
- same parameter list as `check_shortcut' for clearness.
- (symlink_info::check): Change parameter list for calls to
- `check_shortcut' and `check_sysfile'.
-
-Thu Feb 22 12:04:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_disk_file::open): Use `inner_suffixes' when
- resolving real_path.
- * path.cc (symlink): Ditto for win32_topath.
-
-Wed Feb 21 22:41:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * Makefile.in: Add `-lshell32 -luuid' to link pass for new-cygwin1.dll.
- * autoload.cc: Add LoadDLLinitfunc for ole32.dll.
- Add LoadDLLfuncEx statements for CoInitialize@4, CoUninitialize@0
- and CoCreateInstance@20.
- * dir.cc (dir_suffixes): New datastructure.
- (readdir): Check for R/O *.lnk files to hide the suffix.
- (opendir): Use `dir_suffixes' in path conversion.
- (rmdir): Ditto.
- * fhandler.cc (fhandler_disk_file::fstat): Add S_IFLNK flag
- before calling `get_file_attribute'. Take FILE_ATTRIBUTE_READONLY
- into account only if the file is no symlink.
- * path.cc (inner_suffixes): New datastructure.
- (SYMLINKATTR): Eliminated.
- (path_conv::check): Use `inner_suffixes' on inner path components.
- (shortcut_header): New global static variable.
- (shortcut_initalized): Ditto.
- (create_shortcut_header): New function.
- (cmp_shortcut_header): Ditto.
- (symlink): Create symlinks by creating windows shortcuts. Preserve
- the old code.
- (symlink_info::check_shortcut): New method.
- (symlink_info::check_sysfile): Ditto.
- (symlink_info::check): Check for shortcuts. Move code reading
- old system attribute symlinks into symlink_info::check_sysfile().
- (chdir): Use `dir_suffixes' in path conversion.
- * security.cc (get_file_attribute): Check for S_IFLNK flag.
- Force 0777 permissions then.
- * spawn.cc (std_suffixes): Add ".lnk" suffix.
- * syscalls.cc (_unlink): Use `inner_suffixes' in path conversion.
- Check for shortcut symlinks to eliminate R/O attribute before
- calling DeleteFile().
- (stat_suffixes): Add ".lnk" suffix.
- (stat_worker): Force 0777 permissions if file is a symlink.
-
-2001-02-21 Egor Duda <deo@logos-m.ru>
-
- * sigproc.cc (getsem): Make semaphore always non-inheritable.
-
-Mon Feb 19 22:25:53 2001 Christopher Faylor <cgf@cygnus.com>
-
- * dcrt0.cc (locale_init): Remove.
-
-2001-02-15 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * cygwin.din: Export rand48 functions.
- * thread.cc (MTinterface::Init): Remove the initialization of
- `reent_data'.
- * dcrt0.cc: Add the initalizer to the declaration of `reent_data'.
- * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 35.
-
-2001-02-16 Egor Duda <deo@logos-m.ru>
-
- * signal.cc (signal): Prohibit setting handlers for SIGKILL and
- SIGSTOP
- * signal.cc (sigaction): Ditto
- * syscalls.cc (_lseek): Return EINVAL on invalid input
-
-Wed Feb 14 14:54:40 2001 Christophe Iasci <chrisiasci@aol.com>
-
- * dlfcn.cc (dlopen): Do not call LoadLibrary with a NULL pointer, when
- the library is not found
-
-2001-02-14 Egor Duda <deo@logos-m.ru>
-
- * fhandler_console.cc (fhandler_console::char_command): Ignore unknown
- rendition codes in \033[xx;yym control sequences
-
-Fri Feb 9 23:19:01 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fork.cc (fork_parent): Return EAGAIN when can't record pid.
- * pinfo.h (pinfo::remember): Return value of call to proc_subproc.
- * sigproc.cc (proc_subproc): Return error if can't record pid.
-
-Fri Feb 9 12:17:27 2001 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (mknod): Add valid parameters.
-
-Thu Feb 8 22:09:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * mmap.cc (mmap): Check for reusing a mapping only on MAP_SHARED
- and on MAP_PRIVATE|MAP_ANON in the special case of offset 0.
-
-Thu Feb 8 21:57:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * mmap.cc (class list): Add member `hash'.
- (list::list): Initialize `hash'.
- (list::get_list_by_fd): Use filepath hash value to get the correct
- mapping list if it's not an anonymous mapping.
- (map::add_list): Initialize `hash' with filepath hash value.
- (mmap): Check for reusing a mapping only on MAP_SHARED.
-
-Wed Feb 7 18:47:36 2001 Christopher Faylor <cgf@cygnus.com>
-
- * signal.cc (killpg): Correct first argument.
-
-Wed Feb 7 22:22:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * autoload.cc: Add LoadDLLinitfunc for iphlpapi.dll.
- Add LoadDLLfuncEx statements for GetIfTable@12 and GetIpAddrTable@12.
- * fhandler_socket.cc (fhandler_socket::ioctl): Move variable
- definitions to the beginning of the function to allow better debugging.
- Add handling for SIOCGIFHWADDR, SIOCGIFMETRIC and SIOCGIFMTU.
- * net.cc: Include iphlpapi.h.
- (get_2k_ifconf): Rewritten. Uses IP Helper API now.
- (get_nt_ifconf): Add handling for SIOCGIFHWADDR, SIOCGIFMETRIC
- and SIOCGIFMTU.
- (get_95_ifconf): Ditto. Renamed from `get_9x_ifconf'.
- (get_ifconf): Name loopback `lo' instead of `lo0' as in Linux.
- Add handling for SIOCGIFHWADDR, SIOCGIFMETRIC and SIOCGIFMTU.
- Call `get_95_ifconf' only on Windows 95, `get_nt_ifconf' only
- on Windows NT < Service Pack 3, `get_2k_ifconf otherwise.
- * include/asm/socket.h: Add defines for SIOCGIFHWADDR, SIOCGIFMETRIC
- and SIOCGIFMTU.
- * include/cygwin/if.h: Add `ifr_hwaddr', `ifr_metric' and `ifr_mtu'.
- (struct ifreq): Add `ifru_hwaddr'.
-
-Tue Feb 6 15:04:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * syscalls.cc (stat_worker): Add a check for the special case when
- a process creates a file using mode 000 using ntsec.
-
-Mon Feb 5 17:00:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.cc (fhandler_base::open): Always add GENERIC_READ access
- when opening raw disk devices.
- * fhandler_floppy.cc (fhandler_dev_floppy::lseek): Implement bytewise
- access.
- * fhandler_raw.cc (fhandler_dev_raw::open): Always open raw disk device
- binary.
- (fhandler_dev_raw::raw_write): Don't drop read buffer content when
- writing after read.
-
-Mon Feb 5 13:30:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * mmap.cc (mmap_record::fixup_map): New method to duplicate
- the memory protection in a just forked child.
- (mmap): Realign gran_len to page boundary only on anonymous
- mapping before saving in the mmap_record.
- (munmap): Cleanup code.
- (msync): Ditto.
- (fixup_mmaps_after_fork): Ditto. Call mmap_record::fixup_map now.
-
-Thu Feb 1 23:08:29 2001 Christopher Faylor <cgf@cygnus.com>
-
- * cygheap.cc (creturn): Correctly calculate cygheap_max.
-
-Wed Jan 31 10:04:58 2001 Christopher Faylor <cgf@cygnus.com>
-
- * shared.cc (shared_info::initialize): Reduce size of heap.
-
-Wed Jan 31 13:22:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * include/sys/resource.h: Fix typo.
-
-Wed Jan 31 13:20:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * include/sys/resource.h: Add RLIMIT_NLIMITS and RLIM_NLIMITS.
-
-Tue Jan 30 18:15:23 2001 Christopher Faylor <cgf@cygnus.com>
-
- * include/cygwin/version.h: Bump version to 1.3.0.
-
-Tue Jan 30 8:55:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * pinfo.cc (pinfo::init): Use INVALID_HANDLE_VALUE instead of
- explicit cast (HANDLE) 0xffffffff.
- * shared.cc (open_shared): Ditto.
-
-Mon Jan 29 17:15:22 2001 Bill Hegardt <bill@troyxcd.com>
-
- * fhandler_serial.cc (raw_write): Use local copy of OVERLAPPED
- structure instead of shared structure to fix a race condition between
- read/write.
-
-Mon Jan 29 14:30:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * mmap.cc (mmap): Remove obsolete check for MAP_SHARED|MAP_ANON as
- being invalid.
-
-Mon Jan 29 10:23:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * mmap.cc (mmap_record::find_empty): Fix loop condition.
-
-Sun Jan 28 19:40:40 2001 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (_link): Make sure that newpath does not exist. Set
- errno if it does.
-
-Sun Jan 28 19:29:08 2001 Christopher Faylor <cgf@cygnus.com>
-
- * cygheap.cc (init_cheap): Don't specify a load address for the heap.
- It doesn't work on #!*& Windows 9x.
- (cygheap_init): Move GetUserName to memory_init.
- * dcrt0.cc (dll_crt0_1): Call new memory_init functin, eliminate call
- to heap_init.
- * heap.cc (heap_init): Improve error output.
- * heap.h: Correct some declarations.
- * shared.cc (mount_table_init): Remove.
- (memory_init): Renamed from shared_init. Reorganize to accommodate
- strange Windows 9x problems with cygheap/heap interaction.
- * shared_info.h: Rename shared_init to memory_init.
-
-Sun Jan 28 01:25:33 2001 Christopher Faylor <cgf@cygnus.com>
-
- * include/cygwin/version.h: Bump API version.
-
-Sun Jan 28 01:18:22 2001 Christopher Faylor <cgf@cygnus.com>
-
- * cygheap.cc (init_cheap): Move username initialization.
- (cygheap_init): Here.
- * shared_info.h (mount_info): Add a sys_mount_table_counter field.
- (shared_info): Ditto.
- * path.cc (mount_info::conv_to_win32_path): Check that our mount table
- is in sync with the system mount table and reinitialize it if not.
- (mount_info::add_reg_mount): Bump sys_mount_table counters if the
- system mount table changes.
- (mount_info::del_reg_mount): Ditto.
- (mount_info::write_cygdrive_info_to_registry): Ditto.
- (mount_info::remove_cygdrive_info_from_registry): Ditto.
-
-Sun Jan 28 00:28:30 2001 Christopher Faylor <cgf@cygnus.com>
-
- Throughout, change 'cygwin_shared.mount' to 'mount_table'.
- * child_info.h (child_info): Move shared_h, console_h to cygheap. Add
- mount_h.
- * cygheap.h (init_cygheap): Add shared_h, console_h.
- * cygheap.cc (init_cheap): Initialize heap at a fixed location after
- the shared memory regions. Initialize cygheap->user name here.
- * dcrt0.cc (dll_crt0_1): Call getpagesize () to initialize constants.
- Remove cygheap_init since it is done in shared_init now.
- (_dll_crt0): Initialize mount_h, remove shared_h and console_h
- initialization.
- * fhandler_console.cc (console_shared_h): Eliminate.
- (get_tty_stuff): Use cygheap->console_h rather than console_shared_h.
- * heap.cc (heap_init): Use page size constant calculated earlier in
- initialization.
- * shared.cc: Eliminate cygwin_shared_h. Add cygwin_mount_h.
- (mount_table_init): New function for initializing a user mount table.
- (open_shared_file_map): Use constant for shared memory region.
- Initialize cygheap and mount table here.
- (open_shared): Improve debugging output.
- (shared_info::initialize): Eliminate call to mount.init.
- (shared_terminate): Use cygheap->shared_h. Close cygwin_mount_h.
- (open_shared_file_map): Eliminate.
- * shared_info.h (mount_info): Add a version field.
- (shared_align_past): New macro for calculating location for shared
- memory regions.
- * sigproc.cc (init_child_info): Eliminate shared_h, console_h.
- * spawn.cc (spawn_guts): Pass on cygwin_mount_h iff not a different
- user.
- * syscalls.cc (system_info): New global holding system memory defaults.
- (getpagesize): Use system_info.
- * uinfo.cc (internal_getlogin): Only fill in user name if nonexistent.
- * winsup.h: Declare system_info.
-
- * passwd.cc (read_etc_passwd): Use cygheap->user.name () rather than
- retrieving the name again.
-
-Sat Jan 27 10:18:02 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.cc (path_conv::check): Detect when path has symlinks.
- (symlink_info::check): Remove debugging stuff.
- (chdir): Use posix'ized win32 path if cd'ed to a path using symlinks.
-
-Fri Jan 26 21:20:28 2001 Christopher Faylor <cgf@cygnus.com>
-
- * exceptions.cc (sigreturn): Call any pending signals prior to
- resetting the signal mask so that stacked signals behave correctly.
- (sigdelayed): Avoid a race where a signal could end up calling an
- incorrect signal handler if two signals come in close together.
-
-Tue Jan 23 21:56:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * mmap.cc (fhandler_disk_file::mmap): Call CreateFileMapping with
- len != 0 only when performing an anonymous mapping.
-
-Mon Jan 22 15:35:28 2001 Christopher Faylor <cgf@cygnus.com>
-
- * path.h: Add a new constant.
- * syscalls.cc (_read): Oscillate errno check.
-
-Mon Jan 22 15:27:12 2001 Christopher Faylor <cgf@cygnus.com>
-
- * include/cygwin/version.h: Bump API to reflect setlogmask.
-
-Sun Jan 21 22:40:25 2001 Jason Tishler <jt@dothill.com>
-
- * cygwin.din: Add export for setlogmask().
- * syslog.cc (setlogmask): New function.
-
-Thu Jan 18 10:27:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * resource.cc (setrlimit): Support RLIMIT_NOFILE.
-
-Wed Jan 17 23:23:12 2001 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (setdtablesize): Call with amount to increment not total
- amount. Return success or failure error code.
-
-Wed Jan 17 09:47:13 2001 Christopher Faylor <cgf@cygnus.com>
-
- * autoload.cc (LoadDLLinitfunc): Remove debugging statement.
-
- * exceptions.cc (sig_handle_tty_stop): Move setting of PID_STOPPED to
- earlier in interrupt.
- (interrupt_setup): i.e., here.
- (sig_handle): Don't queue multiple SIGSTOPS.
- * fhandler.h (bg_check_types): Enumerate return value of bg_check for
- clarity.
- * signal.cc (kill_pgrp): Minor cleanup.
- * fhandler_termios.cc (fhandler_termios::bg_check): Use enumerated type
- for function return. Don't raise signal if a signal is already queued.
- * fhandler_console.cc (fhandler_console::read): Use enumerated return
- type for bg_check.
- * select.cc: Ditto, throughout.
- * read.cc: Ditto, throughout.
- * termios.cc: Ditto, throughout.
- (_read): YA interrupt detect simplification.
- * wait.cc (wait4): Ditto.
-
-Wed Jan 17 10:56:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * cygheap.cc (cygheap_user::~cygheap_user): Temporarily
- disable free'ing memory.
-
-Tue Jan 16 18:01:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * mmap.cc (mmap): Initialize fh to avoid compiler warnings.
-
-Mon Jan 15 21:07:00 2001 Christopher Faylor <cgf@cygnus.com>
-
- * wait.cc (wait4): Rename variable for consistency. Allow restartable
- signal behavior.
-
-Mon Jan 15 23:15:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * mmap.cc (mmap): Add more parameter checking. Change error output
- in case of EINVAL. Treat mmapping /dev/zero like MAP_ANONYMOUS.
-
-Mon Jan 15 20:34:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * mmap.cc: include <unistd.h>. Define some bit operations for
- the new page map.
- (mmap_record): Change type of base_address_ to caddr_t.
- Add map_map_ member. Add several methods to manipulate map_map_.
- (mmap_record::alloc_map): New method.
- (mmap_record::free_map): Ditto.
- (mmap_record::find_empty): Ditto.
- (mmap_record::map_map): Ditto.
- (mmap_record::unmap_map): Ditto.
- (list::add_record): Change return type to `mmap_record *'.
- Allocate page map.
- (list::match): New method.
- (mmap): Partly rewritten to take care for the new page map. Add some
- parameter checking.
- (munmap): Ditto.
-
-Mon Jan 15 13:50:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * heap.cc (heap_init): Fix extern declaration of getpagesize.
- * syscalls.cc (getpagesize): Fix another typo.
-
-Mon Jan 15 12:48:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * syscalls.cc (getpagesize): Save pagesize in global variable to
- avoid calling GetSystemInfo too often.
- * heap.cc (getpagesize): Eliminate.
- (heap_init): Use getpagesize function from syscalls.cc.
-
-Mon Jan 15 11:56:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * sysconf.cc (sysconf): return `getpagesize ()' on _SC_PAGESIZE
- request to avoid implementing the same twice.
-
-Sun Jan 14 14:07:50 2001 Christopher Faylor <cgf@cygnus.com>
-
- * syscalls.cc (_read): Use more lightweight method for determining if
- read has been interrupted by a signal.
-
-Fri Jan 12 00:35:15 2001 Christopher Faylor <cgf@cygnus.com>
-
- * debug.h: Add regparm attributes to some functions.
-
- * signal.cc (sigaction): Don't treat SIGCONT specially.
-
- * exceptions.cc (interrupt_setup): Save sa_flags of interrupted signal
- for later use.
- (sig_handler): Default any stopping signal to SIGSTOP.
- (call_signal_handler): New function.
- (sigdelayed0): New function.
- * sigproc.cc (sigproc_init): Initialize SIGSTOP sigaction for special
- behavior.
- * sigproc.h: Define call_signal_handler.
- * syscalls.cc (_read): Allow restartable signal behavior.
-
-Thu Jan 11 13:17:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * fhandler.h (fhandler_base): New method `fixup_mmap_after_fork'.
- (fhandler_disk_file: Ditto.
- (fhandler_dev_mem): Ditto.
- * fhandler_mem.cc (fhandler_dev_mem::open): Set OBJ_INHERIT attribute
- for device\physicalmemory handle.
- (fhandler_dev_mem::mmap): Ditto.
- * fhandler_mem.cc (fhandler_dev_mem::fixup_mmap_after_fork): New
- method.
- * mmap.cc (mmap_record): Add private `fdesc_' member. Change
- constructor accordingly.
- (get_fd): New method.
- (mmap): Use new mmap_record constructor.
- (fhandler_base::fixup_mmap_after_fork): New method.
- (fhandler_disk_file::fixup_mmap_after_fork): Ditto.
- (fixup_mmaps_after_fork): Call `fixup_mmap_after_fork' of appropriate
- fhandler class.
-
-Wed Jan 10 22:08:30 2001 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * sigproc.cc (wait_sig): Allow SIGCONT when stopped.
-
-Tue Jan 9 16:55:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- Patch suggested by René Møller Fonseca <fonseca@mip.sdu.dk>
- * include/sys/socket.h: Change prototype to have 2nd parameter `const'.
- * net.cc (cygwin_bind): Change 2nd parameter to `const'.
-
-Sun Jan 7 22:59:37 2001 Christopher Faylor <cgf@cygnus.com>
-
- * pinfo.cc (codepage_init): Move function.
- * environ.cc (codepage_init): To here.
- * exceptoins.cc (SIG_NONMASKABLE): Remove SIGCONT from consideration
- since it is supposed to be maskable.
- * signal.cc (sigaction): Ditto.
- * sigproc.cc (wait_sig): Ditto.
- * winsup.h: Eliminate global declaration of codepage_init.
-
-Thu Jan 5 9:33:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * resource.cc (getrlimit): Set errno on EFAULT instead of returning
- it.
- (setrlimit): Ditto.
-
-Thu Jan 5 3:38:00 2001 David Sainty <David.Sainty@optimation.co.nz>
-
- * resource.cc (setrlimit): Prevent failing with an error when the
- operation would not have changed anything.
-
-Thu Jan 4 10:29:54 2001 Earnie Boyd <earnie_boyd@yahoo.com>
-
- * thread.cc: Need LONG_MAX definition.
-
-Wed Jan 3 13:47:23 2001 Christopher Faylor <cgf@cygnus.com>
-
- * thread.cc (MTinterface::CreateSemaphore): Correctly set semaphore
- max.
-
-Wed Jan 3 09:44:51 2001 Christopher Faylor <cgf@cygnus.com>
-
- * fhandler_console.cc (fhandler_console::read): Restore missing test
- for code page before doing OemToCharBuff.
-
-Wed Jan 3 09:20:20 2001 Jason Tishler <jt@dothill.com>
-
- * include/cygwin/version.h: Fix typo in CYGWIN_VERSION_DLL_COMBINED
- macro.
diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in
deleted file mode 100644
index d10bdf2b5..000000000
--- a/winsup/cygwin/Makefile.in
+++ /dev/null
@@ -1,346 +0,0 @@
-# Makefile.in for Cygwin.
-# Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 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:=.
-
-CONFIG_DIR:=$(srcdir)/config/@CONFIG_DIR@
-VPATH:=$(srcdir):$(CONFIG_DIR):$(srcdir)/regex:$(srcdir)/regexp:$(srcdir)/lib
-
-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@
-
-#
-# --enable options from configure
-#
-MT_SAFE:=@MT_SAFE@
-DEFS:=@DEFS@
-
-CC:=@CC@
-# FIXME: Which is it, CC or CC_FOR_TARGET?
-CC_FOR_TARGET:=$(CC)
-CFLAGS:=@CFLAGS@
-override CFLAGS+=-MMD -fbuiltin
-CXX:=@CXX@
-CXXFLAGS:=@CXXFLAGS@
-
-# For linking mount, etc. crt0.o isn't accessable in a fresh build.
-EXE_LDFLAGS:=@EXE_LDFLAGS@
-
-AR:=@AR@
-AR_FLAGS:=qv
-RANLIB:=@RANLIB@
-LD:=@LD@
-DLLTOOL:=@DLLTOOL@
-WINDRES:=@WINDRES@
-AS:=@AS@
-NM:=@NM@
-LDSCRIPT:=cygwin.sc
-
-#
-# Include common definitions for winsup directory
-#
-include $(srcdir)/../Makefile.common
-
-INSTALL_DATA:=$(SHELL) $(updir1)/install-sh -c
-
-@SET_MAKE@
-
-# Setup the testing framework, if you have one
-EXPECT = `if [ -f $${rootme}/../../expect/expect$(EXEEXT) ] ; then \
- echo $${rootme}/../../expect/expect$(EXEEXT) ; \
- else echo expect ; fi`
-
-RUNTEST = `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \
- echo $${srcdir}/../dejagnu/runtest ; \
- else echo runtest; fi`
-RUNTESTFLAGS =
-
-# Parameters used in building the cygwin.dll.
-# We build as new-cygwin.dll and rename at install time to overcome
-# native rebuilding issues (we don't want the build tools to see a partially
-# built cygwin.dll and attempt to use it instead of the old one).
-
-DLL_NAME:=cygwin1.dll
-LIB_NAME:=libcygwin.a
-DEF_FILE:=cygwin.def
-DLL_ENTRY:=@DLL_ENTRY@
-
-LIBGMON_A:=libgmon.a
-GMON_START:=gcrt0.o
-
-# Some things want these from libc, but they have their own static
-# data which apps can get to, which is a pain in the dll, so we
-# include them directly into the library.
-
-LIBCOS:=${sort ${addsuffix .o,${basename ${notdir ${wildcard $(srcdir)/lib/*.c}}}} \
- ${addsuffix .o,${basename ${notdir ${wildcard $(srcdir)/lib/*.cc}}}}}
-
-# Build all source files in the config directory
-
-EXTRA_DLL_OFILES:=${addsuffix .o,${basename ${notdir ${wildcard $(CONFIG_DIR)/*.c}}}}
-
-EXTRA_OFILES=$(bupdir1)/libiberty/random.o $(bupdir1)/libiberty/strsignal.o
-
-MALLOC_OFILES=@MALLOC_OFILES@
-
-DLL_IMPORTS:=$(w32api_lib)/libkernel32.a
-
-# Please maintain this list in sorted order, with maximum files per 80 col line
-DLL_OFILES:=assert.o autoload.o cygheap.o cygserver_client.o cygserver_transport.o \
- cygserver_transport_pipes.o cygserver_transport_sockets.o dcrt0.o debug.o \
- delqueue.o dir.o dlfcn.o dll_init.o dtable.o environ.o errno.o exceptions.o \
- exec.o external.o fcntl.o fhandler.o fhandler_clipboard.o fhandler_console.o \
- fhandler_disk_file.o fhandler_dsp.o fhandler_floppy.o fhandler_mem.o \
- fhandler_proc.o fhandler_process.o fhandler_random.o fhandler_raw.o \
- fhandler_registry.o fhandler_serial.o fhandler_socket.o \
- fhandler_tape.o fhandler_termios.o fhandler_tty.o fhandler_virtual.o \
- fhandler_windows.o fhandler_zero.o fnmatch.o fork.o glob.o grp.o \
- heap.o init.o ioctl.o ipc.o localtime.o malloc.o miscfuncs.o mmap.o \
- net.o ntea.o passwd.o path.o pinfo.o pipe.o poll.o pthread.o regcomp.o \
- regerror.o regexec.o regfree.o registry.o resource.o scandir.o sched.o \
- sec_acl.o sec_helper.o security.o select.o shared.o shm.o shortcut.o \
- signal.o sigproc.o smallprint.o spawn.o strace.o strsep.o sync.o \
- syscalls.o sysconf.o syslog.o termios.o thread.o times.o tty.o uinfo.o \
- uname.o v8_regexp.o v8_regerror.o v8_regsub.o wait.o wincap.o window.o \
- $(EXTRA_DLL_OFILES) $(EXTRA_OFILES) $(MALLOC_OFILES) $(MT_SAFE_OBJECTS)
-
-GMON_OFILES:=gmon.o mcount.o profil.o
-
-OBSOLETE_FUNCTIONS:=regcomp regerror regexec regfree regsub
-NEW_FUNCTIONS:=regcomp posix_regcomp \
- regerror posix_regerror \
- regexec posix_regexec \
- regfree posix_regfree
-
-PWD:=${shell pwd}
-SUBLIBS:=libpthread.a $(PWD)/libm.a libc.a
-EXTRALIBS:=libautomode.a libbinmode.a libtextmode.a
-INSTOBJS:=automode.o binmode.o textmode.o
-TARGET_LIBS:=$(LIB_NAME) $(SUBLIBS) $(GMON_START) $(LIBGMON_A) $(SUBLIBS) $(INSTOBJS) $(EXTRALIBS)
-.PHONY: all force dll_ofiles install all_target install_target all_host install_host \
- install install-libs install-headers
-
-.SUFFIXES:
-.SUFFIXES: .c .cc .def .a .o .d
-
-all_host=@all_host@
-install_host=@install_host@
-
-all: all_target $(all_host)
-
-all_target: $(TARGET_LIBS) cygserver.exe
-
-all_host: new-$(LIB_NAME) cygrun.exe
-
-force:
-
-install: install-libs install-headers install-man install_target \
- $(install_host) $(install_target)
-
-uninstall: uninstall-libs uninstall-headers uninstall-man
-
-install-libs: $(TARGET_LIBS)
- $(INSTALL_DATA) new-$(DLL_NAME) $(bindir)/$(DLL_NAME); \
- for i in $^; do \
- $(INSTALL_DATA) $$i $(tooldir)/lib/`basename $$i` ; \
- done
-
-install-headers:
- cd $(srcdir); \
- for sub in `find include -name '[a-z]*' -type d -print | sort`; do \
- for i in $$sub/*.h ; do \
- $(INSTALL_DATA) $$i $(tooldir)/$$sub/`basename $$i` ; \
- done ; \
- done ; \
- $(INSTALL_DATA) regex/regex.h $(tooldir)/include/regex.h
-
-install-man:
- cd $(srcdir); \
- for i in `find . -type f -name '*.2'`; do \
- $(INSTALL_DATA) $$i $(tooldir)/man/man2/`basename $$i` ; \
- done; \
- for i in `find . -type f -name '*.3'`; do \
- $(INSTALL_DATA) $$i $(tooldir)/man/man3/`basename $$i` ; \
- done; \
- for i in `find . -type f -name '*.5'`; do \
- $(INSTALL_DATA) $$i $(tooldir)/man/man5/`basename $$i` ; \
- done; \
- for i in `find . -type f -name '*.7'`; do \
- $(INSTALL_DATA) $$i $(tooldir)/man/man7/`basename $$i` ; \
- done
-
-install_target: cygserver.exe
- $(INSTALL_PROGRAM) cygserver.exe $(bindir)/cygserver.exe
-
-install_host:
-
-
-uninstall-libs: $(TARGET_LIBS)
- rm -f $(bindir)/$(DLL_NAME); \
- for i in $^; do \
- rm -f $(tooldir)/lib/$$i ; \
- done
-
-uninstall-headers:
- cd $(srcdir); \
- for sub in `find include -name '[a-z]*' -type d -print | sort`; do \
- for i in $$sub/*.h ; do \
- rm -f $(tooldir)/$$sub/`basename $$i` ; \
- done ; \
- done ; \
- rm -f $(tooldir)/include/regex.h
-
-uninstall-man:
- cd $(srcdir); \
- for i in `find . -type f -name '*.2'`; do \
- rm -f $(tooldir)/man/man2/`basename $$i` ; \
- done; \
- for i in `find . -type f -name '*.3'`; do \
- rm -f $(tooldir)/man/man3/`basename $$i` ; \
- done; \
- for i in `find . -type f -name '*.5'`; do \
- rm -f $(tooldir)/man/man5/`basename $$i` ; \
- done; \
- for i in `find . -type f -name '*.7'`; do \
- rm -f $(tooldir)/man/man7/`basename $$i` ; \
- done
-
-clean:
- -rm -f *.o *.dll *.a *.exp junk *.base version.cc regexp/*.o winver_stamp *.exe *.d *stamp* *_magic.h
-
-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 cygwin.dll
-new-$(DLL_NAME): $(LDSCRIPT) $(DLL_OFILES) $(DEF_FILE) $(DLL_IMPORTS) $(LIBC) $(LIBM) Makefile winver_stamp
- $(CXX) $(CXXFLAGS) -nostdlib -Wl,-T$(firstword $^) -Wl,--out-implib,cygdll.a -shared -o $@ \
- -e $(DLL_ENTRY) $(DEF_FILE) $(DLL_OFILES) version.o winver.o \
- $(DLL_IMPORTS) $(MALLOC_OBJ) $(LIBM) $(LIBC) \
- -lstdc++ -lgcc -lshell32 -luuid
-
-# Rule to build libcygwin.a
-$(LIB_NAME): rmsym newsym new-$(DLL_NAME) $(LIBCOS)
- /bin/sh ${word 1,$^} ./cygdll.a "$(NM)" "$(AR)" "$(RANLIB)" $(OBSOLETE_FUNCTIONS) || exit 0
- /bin/sh ${word 2,$^} ./cygdll.a "$(AS)" "$(AR)" "$(RANLIB)" $(NEW_FUNCTIONS) || exit 0
- (echo create $(LIB_NAME); echo addmod $(LIBCOS); echo addlib cygdll.a; echo save) | $(AR) -M
-
-# Rule to make stub library used by testsuite
-# dependency set to $(LIB_NAME) to accommodate make -j2.
-# Otherwise dlltool gets confused. cgf (11-16-2000)
-new-$(LIB_NAME): $(LIB_NAME)
- $(DLLTOOL) --as=$(AS) --dllname new-$(DLL_NAME) --def $(DEF_FILE) --output-lib new-templib.a
- $(AR) rcv new-templib.a $(LIBCOS)
- mv new-templib.a new-$(LIB_NAME)
-
-dll_ofiles: $(DLL_OFILES)
-
-$(LIBGMON_A): $(GMON_OFILES) $(GMON_START)
- $(AR) rcv $(LIBGMON_A) $(GMON_OFILES)
-
-version.cc winver.o: winver_stamp
- @ :
-
-shared_info_magic.h: cygmagic shared_info.h
- /bin/sh ${word 1,$^} $@ "$(CC) -x c" ${word 2,$^} MOUNT_MAGIC 'class mount_info' SHARED_MAGIC 'class shared_info'
-
-child_info_magic.h: cygmagic child_info.h
- /bin/sh ${word 1,$^} $@ "$(CC) -x c" ${word 2,$^} CHILD_INFO_MAGIC 'class child_info'
-
-dcrt0.o sigproc.o: child_info_magic.h
-
-shared.o: shared_info_magic.h
-
-libpthread.a: speclib cygwin.def pthread.o thread.o
- /bin/sh ${word 1, $^} $@ "${NM}" "${DLLTOOL}" "${AS}" ${wordlist 2, 99, $^}
-
-$(PWD)/libm.a: speclib cygwin.def $(LIBM)
- /bin/sh ${word 1, $^} $@ "${NM}" "${DLLTOOL}" "${AS}" ${wordlist 2, 99, $^}
-
-$(PWD)/libc.a: speclib cygwin.def $(PWD)/libm.a libpthread.a
- /bin/sh ${word 1, $^} -v $@ "${NM}" "${DLLTOOL}" "${AS}" ${wordlist 2, 99, $^}
-
-lib%.a: %.o
- $(AR) cru $@ $?
-
-winver_stamp: mkvers.sh include/cygwin/version.h winver.rc $(DLL_OFILES)
- @echo "Making version.o and winver.o";\
- $(SHELL) ${word 1,$^} ${word 2,$^} ${word 3,$^} $(WINDRES) && \
- $(COMPILE_CXX) -o version.o version.cc && \
- touch $@
-
-cygrun.exe : cygrun.o $(LIB_NAME) $(w32api_lib)/libuser32.a \
- $(w32api_lib)/libshell32.a $(w32api_lib)/libkernel32.a
- $(CC) -nodefaultlibs -o $@ $^
-
-cygserver_transport_outside.o: cygserver_transport.cc
- $(COMPILE_CXX) -D__OUTSIDE_CYGWIN__ -o $@ $<
-
-cygserver_transport_pipes_outside.o: cygserver_transport_pipes.cc
- $(COMPILE_CXX) -D__OUTSIDE_CYGWIN__ -o $@ $<
-
-cygserver_transport_sockets_outside.o: cygserver_transport_sockets.cc
- $(COMPILE_CXX) -D__OUTSIDE_CYGWIN__ -o $@ $<
-
-cygserver_client_outside.o: cygserver_client.cc
- $(COMPILE_CXX) -D__OUTSIDE_CYGWIN__ -o $@ $<
-
-cygserver_shm.o: cygserver_shm.cc
- $(COMPILE_CXX) -D__OUTSIDE_CYGWIN__ -o $@ $<
-
-cygserver.exe: cygserver.o cygserver_shm.o cygserver_transport_outside.o cygserver_transport_pipes_outside.o cygserver_transport_sockets_outside.o cygserver_client_outside.o cygserver_process.o threaded_queue.o wincap.o version.o smallprint.o
- $(CXX) -o $@ $^
-#ifdef VERBOSE
-# $(CXX) $(MINGW_CXXFLAGS) -o $@ ${wordlist 1,3,$^} -B$(mingw_build)/ $(MINGW_LDFLAGS)
-#else
-# @echo $(CXX) -o $@ ${wordlist 1,3,$^} ${filter-out -B%, $(MINGW_CXXFLAGS) $(MINGW_LDFLAGS)};\
-# $(CXX) $(MINGW_CXXFLAGS) -o $@ ${wordlist 1,3,$^} -B$(mingw_build)/ $(MINGW_LDFLAGS)
-#endif
-
-#
-
-Makefile: cygwin.din
-
-$(DEF_FILE): cygwin.din config.status
- $(SHELL) config.status
-
-winsup.h: config.h
-
-deps:=${wildcard *.d}
-ifneq (,$(deps))
-include $(deps)
-endif
diff --git a/winsup/cygwin/ROADMAP b/winsup/cygwin/ROADMAP
deleted file mode 100644
index fd0387d59..000000000
--- a/winsup/cygwin/ROADMAP
+++ /dev/null
@@ -1,129 +0,0 @@
-
- WINSUP ROADMAP
-
-The purpose of this document is to give the briefest overview of how
-the various parts of cygwin work together and where everything can be
-found. The intended audience is people developing the cygwin dll
-itself. Comments to dj@cygnus.com.
-
-=== cygwin1.dll source files
-
-- overhead
-.h winsup autoload debug external shared sync
-.cc assert dcrt0 debug external init ntea registry security
- shared smallprint strace sync
-.din cygwin
-.rc winver
-.sgml external shared
-
-- processes
-.h sigproc
-.cc exec fork pinfo resource signal sigproc spawn wait
-
-- signals
-.cc exceptions window
-
-- files and I/O
-.h delqueue fhandler path select
-.cc delqueue dir fhandler* dtable path pipe select tty
-.sgml dtable path
-
-- common unix functions
-.h dll_init tz_posixrules
-.cc dlfcn dll_init environ errno fcntl flog grp ioctl localtime
- malloc passwd scandir strsep syscalls sysconf syslog termios
-.c longjmp setjmp
-.sgml dll_init
-
-- unix emulation
-.cc heap mmap net times unifo uname
-
-
---- if MT_SAFE
-.h thread
-.cc pthread thread
-
---- from other places
-regex/*
-../libiberty/{random,strsignal}
-../newlib/* (libc)
-
-=== libcygwin.a source files
-
-libccrt0.cc
-libcmain.cc
-dll_entry.cc
-dll_main.cc
-getopt.c
-
-=== gmon (profiling, -pg)
-
-gcrt0.c
-gmon.c gmon.h
-mcount.c
-profil.c profil.h
-
-=== entry points
-
-- normal cygwin program
-
-newlib/libc/sys/cygwin/crt0.c has mainCRTStartup() and calls cygwin_crt0()
-
-libccrt0.cc has cygwin_crt0() and calls dll_crt0()
-
-dcrt0.cc - has dll_crt0()
-
-Note: dll_init.cc has nothing to do with initializing the cygwin dll.
-It initializes the dlls you have dl_open'd.
-
-- cygwin-built dll
-
-dll_entry.cc - has a macro for wrapping your dll startup function
- (equivalent of DllMain()) in such a way that you get your
- cygwin environment set up automatically when your dll is
- loaded.
-
-dll_main.cc - has empty DllMain() in case you don't have your own
-
-- manually loading cygwin1.dll
-
-init.cc - has dll_entry() which is called by the OS when the dll is
- loaded. It doesn't do much except note if you linked
- cygwin1.dll or are manually loading it.
-
-=== About "fhandlers"
-
-An fhandler is a file type handler. This is where the unix device
-emulation happens.
-
-dtable.cc maps posix file descriptors to a table of file handlers (type
-fhandler) in the dll. It's mostly concerned with managing the table
-of descriptors (open, dup, fork, select). Most of the posix I/O
-system calls (syscalls.cc) use the fdtab table to call the right
-fhandler directly.
-
-fhandler.cc is the base class; specific types are derived as
-appropriate (see fhandler.h). dtable.cc is in charge of selecting and
-creating a suitable fhandler when you open a file. path.cc handles
-emulated files in /dev (like /dev/null) by returning an FH_* value
-from get_device_number (which dtable.cc calls in dtable::build_fhandler).
-
-Note: if you're looking for read() and write(), they call _read() and
-_write() in syscalls.cc. The non-underscored ones are in
-newlib/libc/syscalls and just call the underscored ones.
-
-=== How "fork" works
-
-It all starts in fork() in fork.cc.
-
-Set up a pid in the shared memory area for the new child. Use
-setjmp() to capture state. First time (parent), set up some stuff and
-use CreateProcess to run a second copy of the same executable. The
-second copy will note in the shared memory area that it's a fork, and
-do the longjmp. They sync up and the parent copies all it's program
-memory to the child's address space. There's also code to reload
-dlls, map shared memory and mmap'd files, etc.
-
-Handling the special startup for the child is done in dcrt0.cc in many
-places. This case is triggered by a special StartupInfo structure
-that's passed from the parent to the child in CreateProcessA.
diff --git a/winsup/cygwin/acconfig.h b/winsup/cygwin/acconfig.h
deleted file mode 100644
index c187c0be3..000000000
--- a/winsup/cygwin/acconfig.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* Define if DEBUGGING support is requested. */
-#undef DEBUGGING
-
-/* Define if building "extra" thread-safe Cygwin DLL. */
-#undef _CYG_THREAD_FAILSAFE
-
-/* Define if GCC supports builtin memset. */
-#undef HAVE_BUILTIN_MEMSET
-
-/* Define if building thread-safe Cygwin DLL. */
-#undef _MT_SAFE
-
-/* Define if using new vfork functionality. */
-#undef NEWVFORK
diff --git a/winsup/cygwin/ansi.sgml b/winsup/cygwin/ansi.sgml
deleted file mode 100644
index d6a41ab31..000000000
--- a/winsup/cygwin/ansi.sgml
+++ /dev/null
@@ -1,59 +0,0 @@
-<sect1 id="std-ansi">
-<title>Compatibility with ANSI</title>
-
-<para>The following functions are compatible with ANSI:</para>
-
-<sect2><title>stdio</title><para>
-
-clearerr, fclose, feof, ferror, fflush, fgetc, fgetpos, fgets, fopen,
-fprintf, fputc, fputs, fread, freopen, fscanf, fseek, fsetpos, ftell,
-fwrite, getc, getchar, gets, perror, printf, putc, putchar, puts,
-remove, rename, rewind, scanf, setbuf, setvbuf, sprintf, sscanf,
-tmpfile, tmpnam, vfprintf, ungetc, vprintf, vsprintf,
-
-</para></sect2>
-<sect2><title>string</title><para>
-
-memchr, memcmp, memcpy, memmove, memset, strcat, strchr, strcmp,
-strcoll, strcpy, strcspn, strerror, strlen, strncat, strncmp, strncpy,
-strpbrk, strrchr, strspn, strstr, strtok, strxfrm
-
-</para></sect2>
-<sect2><title>stdlib</title><para>
-
-abort, abs, assert, atexit, atof, atoi, atol, bsearch, calloc, div,
-exit, free, getenv, labs, ldiv, longjmp, malloc, mblen, mbstowcs,
-mbtowc, qsort, rand, realloc, setjmp, srand, strtod, strtol, strtoul,
-system, wcstombs, wctomb
-
-</para></sect2>
-<sect2><title>time</title><para>
-
-asctime, gmtime, localtime, time, clock, ctime, difftime, mktime,
-strftime
-
-</para></sect2>
-<sect2><title>signals</title><para>
-
-raise, signal
-
-</para></sect2>
-<sect2><title>ctype</title><para>
-
-isalnum, isalpha, iscntrl, isdigit, isgraph, islower, isprint,
-ispunct, isspace, isupper, isxdigit, tolower, toupper
-
-</para></sect2>
-<sect2><title>math</title><para>
-
-acos, asin, atan, atan2, ceil, cos, cosh, exp, fabs, floor, fmod,
-frexp, ldexp, log, log10, modf, pow, sin, sinh, sqrt, tan, tanh
-
-</para></sect2>
-<sect2><title>misc</title><para>
-
-localeconv, setlocale, va_arg, va_end, va_start
-
-</para></sect2>
-
-</sect1> \ No newline at end of file
diff --git a/winsup/cygwin/assert.cc b/winsup/cygwin/assert.cc
deleted file mode 100644
index 4c5a3b08f..000000000
--- a/winsup/cygwin/assert.cc
+++ /dev/null
@@ -1,52 +0,0 @@
-/* assert.cc: Handle the assert macro for WIN32.
-
- Copyright 1997, 1998, 2000, 2001 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 "winsup.h"
-#include "security.h"
-#include <wingdi.h>
-#include <winuser.h>
-
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-/* This function is called when the assert macro fails. This will
- override the function of the same name in newlib. */
-
-extern "C" void
-__assert (const char *file, int line, const char *failedexpr)
-{
- HANDLE h;
-
- /* If we don't have a console in a Windows program, then bring up a
- message box for the assertion failure. */
-
- h = CreateFileA ("CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE, &sec_none_nih,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- if (h == INVALID_HANDLE_VALUE || h == 0)
- {
- char *buf;
-
- buf = (char *) alloca (100 + strlen (failedexpr));
- __small_sprintf (buf, "Failed assertion\n\t%s\nat line %d of file %s",
- failedexpr, line, file);
- MessageBox (NULL, buf, NULL, MB_OK | MB_ICONERROR | MB_TASKMODAL);
- }
- else
- {
- CloseHandle (h);
- small_printf ("assertion \"%s\" failed: file \"%s\", line %d\n",
- failedexpr, file, line);
- }
-
- abort (); // FIXME: Someday this should work.
-
- /* NOTREACHED */
-}
diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc
deleted file mode 100644
index 9bae17deb..000000000
--- a/winsup/cygwin/autoload.cc
+++ /dev/null
@@ -1,511 +0,0 @@
-/* autoload.cc: all dynamic load stuff.
-
- Copyright 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. */
-
-#include "winsup.h"
-#define USE_SYS_TYPES_FD_SET
-#include <winsock2.h>
-
-/* Macro for defining "auto-load" functions.
- * Note that this is self-modifying code *gasp*.
- * The first invocation of a routine will trigger the loading of
- * the DLL. This will then be followed by the discovery of
- * the procedure's entry point, which is placed into the location
- * pointed to by the stack pointer. This code then changes
- * the "call" operand which invoked it to a "jmp" which will
- * transfer directly to the DLL function on the next invocation.
- *
- * Subsequent calls to routines whose transfer address has not been
- * determined will skip the "load the dll" step, starting at the
- * "discovery of the entry point" step.
- *
- * So, immediately following the the call to one of the above routines
- * we have:
- * DLL info (4 bytes) Pointer to a block of information concerning
- * the DLL (see below).
- * DLL args (4 bytes) The number of arguments pushed on the stack by
- * the call. If this is an odd value then this
- * is a flag that non-existence of this function
- * is not a fatal error
- * func name (n bytes) asciz string containing the name of the function
- * to be loaded.
- *
- * The DLL info block consists of the following
- * load_state (4 bytes) Pointer to a word containing the routine used
- * to eventually invoke the function. Initially
- * points to an init function which loads the
- * DLL, gets the process's load address,
- * changes the contents here to point to the
- * function address, and changes the call *(%eax)
- * to a jmp func. If the initialization has been
- * done, only the load part is done.
- * DLL handle (4 bytes) The handle to use when loading the DLL.
- * DLL locker (4 bytes) Word to use to avoid multi-thread access during
- * initialization.
- * extra init (4 bytes) Extra initialization function.
- * DLL name (n bytes) asciz string containing the name of the DLL.
- */
-
-/* LoadDLLprime is used to prime the DLL info information, providing an
- additional initialization routine to call prior to calling the first
- function. */
-#define LoadDLLprime(dllname, init_also) __asm__ (" \n\
- .section ." #dllname "_info,\"w\" \n\
- .linkonce \n\
- .long std_dll_init \n\
- .long 0 \n\
- .long -1 \n\
- .long " #init_also " \n\
- .asciz \"" #dllname "\" \n\
- .text \n\
-");
-
-/* Create a "decorated" name */
-#define mangle(name, n) #name "@" #n
-
-/* Standard DLL load macro. Invokes a fatal warning if the function isn't
- found. */
-#define LoadDLLfunc(name, n, dllname) LoadDLLfuncEx (name, n, dllname, 0)
-#define LoadDLLfuncEx(name, n, dllname, notimp) LoadDLLfuncEx2(name, n, dllname, notimp, 0)
-
-/* Main DLL setup stuff. */
-#define LoadDLLfuncEx2(name, n, dllname, notimp, err) \
- LoadDLLprime (dllname, dll_func_load) \
- __asm__ (" \n\
- .section ." #dllname "_text,\"wx\" \n\
- .global _" mangle (name, n) " \n\
- .global _win32_" mangle (name, n) " \n\
- .align 8 \n\
-_" mangle (name, n) ": \n\
-_win32_" mangle (name, n) ": \n\
- movl (1f),%eax \n\
- call *(%eax) \n\
-1:.long ." #dllname "_info \n\
- .long (" #n "+" #notimp ") | " #err "<<16 \n\
- .asciz \"" #name "\" \n\
- .text \n\
-");
-
-/* DLL loader helper functions used during initialization. */
-
-/* The function which finds the address, given the name and overwrites
- the call so that future invocations go straight to the function in
- the DLL. */
-extern "C" void dll_func_load () __asm__ ("dll_func_load");
-
-/* Called by the primary initialization function "init_std_dll" to
- setup the stack and eliminate future calls to init_std_dll for other
- functions from this DLL. */
-extern "C" void dll_chain () __asm__ ("dll_chain");
-
-/* called by the secondary initialization function to call dll_func_load. */
-extern "C" void dll_chain1 () __asm__ ("dll_chain1");
-
-extern "C" {
-
-/* FIXME: This is not thread-safe? */
-__asm__ (" \n\
-msg1: \n\
- .ascii \"couldn't dynamically determine load address for '%s' (handle %p), %E\\0\"\n\
- \n\
- .align 32 \n\
-noload: \n\
- popl %edx # Get the address of the information block\n\
- movl 4(%edx),%eax # Should we 'ignore' the lack \n\
- test $1,%eax # of this function? \n\
- jz 1f # Nope. \n\
- decl %eax # Yes. This is the # of bytes + 1 \n\
- popl %edx # Caller's caller \n\
- movl %eax,%ebx # For manipulation \n\
- andl $0xffff,%eax # Only want lower word \n\
- addl %eax,%esp # Pop off bytes \n\
- pushl %ebx # Save for later \n\
- movl $127,%eax # ERROR_PROC_NOT_FOUND \n\
- pushl %eax # First argument \n\
- call _SetLastError@4 # Set it \n\
- popl %eax # Get back argument \n\
- shrl $16,%eax # return value in high order word \n\
- jmp *%edx # Return \n\
-1: \n\
- movl (%edx),%eax # Handle value \n\
- pushl 4(%eax) \n\
- leal 8(%edx),%eax # Location of name of function \n\
- push %eax \n\
- push $msg1 # The message \n\
- call ___api_fatal # Print message. Never returns \n\
- \n\
- .globl dll_func_load \n\
-dll_func_load: \n\
- movl (%esp),%eax # 'Return address' contains load info \n\
- addl $8,%eax # Address of name of function to load \n\
- pushl %eax # Second argument \n\
- movl -8(%eax),%eax # Where handle lives \n\
- movl 4(%eax),%eax # Address of Handle to DLL \n\
- pushl %eax # Handle to DLL \n\
- call _GetProcAddress@8# Load it \n\
- test %eax,%eax # Success? \n\
- jne gotit # Yes \n\
- jmp noload # Issue an error or return \n\
-gotit: \n\
- popl %ecx # Pointer to 'return address' \n\
- movb $0xe9,-7(%ecx) # Turn preceding call to a jmp *%eax \n\
- movl %eax,%edx # Save \n\
- subl %ecx,%eax # Make it relative \n\
- addl $2,%eax # Tweak \n\
- movl %eax,-6(%ecx) # Move relative address after jump \n\
- jmp *%edx # Jump to actual function \n\
- \n\
- .global dll_chain \n\
-dll_chain: \n\
- pushl %eax # Restore 'return address' \n\
- movl (%eax),%eax # Get address of DLL info block \n\
- movl $dll_func_load,(%eax) # Just load func now \n\
- jmp *%edx # Jump to next init function \n\
- \n\
-dll_chain1: \n\
- pushl %eax # Restore 'return address' \n\
- jmp *%edx # Jump to next init function \n\
-");
-
-/* C representations of the two info blocks described above.
- FIXME: These structures confuse gdb for some reason. GDB can print
- the whole structure but has problems with the name field? */
-struct dll_info
-{
- DWORD load_state;
- HANDLE handle;
- LONG here;
- void (*init) ();
- char name[];
-};
-
-struct func_info
-{
- struct dll_info *dll;
- LONG decoration;
- char name[];
-};
-
-/* Mechanism for setting up info for passing to dll_chain routines. */
-union retchain
-{
- struct {long high; long low;};
- long long ll;
-};
-
-/* The standard DLL initialization routine. */
-static long long std_dll_init () __asm__ ("std_dll_init") __attribute__ ((unused));
-static long long
-std_dll_init ()
-{
- HANDLE h;
- struct func_info *func = (struct func_info *) __builtin_return_address (0);
- struct dll_info *dll = func->dll;
- retchain ret;
-
- if (InterlockedIncrement (&dll->here))
- do
- {
- InterlockedDecrement (&dll->here);
- Sleep (0);
- }
- while (InterlockedIncrement (&dll->here));
- else if (!dll->handle)
- {
- if ((h = LoadLibrary (dll->name)) != NULL)
- dll->handle = h;
- else if (!(func->decoration & 1))
- api_fatal ("could not load %s, %E", dll->name);
- else
- dll->handle = INVALID_HANDLE_VALUE;
- }
-
- InterlockedDecrement (&dll->here);
-
- /* Kludge alert. Redirects the return address to dll_chain. */
- __asm__ __volatile__ (" \n\
- movl $dll_chain,4(%ebp) \n\
- ");
-
- /* Set "arguments for dll_chain. */
- ret.low = (long) dll->init;
- ret.high = (long) func;
- return ret.ll;
-}
-
-/* Initialization function for winsock stuff. */
-static long long wsock_init () __asm__ ("wsock_init") __attribute__ ((unused, regparm(1)));
-bool NO_COPY wsock_started = 0;
-static long long
-wsock_init ()
-{
- static LONG NO_COPY here = -1L;
- struct func_info *func = (struct func_info *) __builtin_return_address (0);
- struct dll_info *dll = func->dll;
-
- __asm__ (" \n\
- .section .ws2_32_info \n\
- .equ _ws2_32_handle,.ws2_32_info + 4 \n\
- .global _ws2_32_handle \n\
- .section .wsock32_info \n\
- .equ _wsock32_handle,.wsock32_info + 4 \n\
- .global _wsock32_handle \n\
- .text \n\
- ");
-
- while (InterlockedIncrement (&here))
- {
- InterlockedDecrement (&here);
- Sleep (0);
- }
-
- if (!wsock_started && (winsock_active || winsock2_active))
- {
- /* Don't use autoload to load WSAStartup to eliminate recursion. */
- int (*wsastartup) (int, WSADATA *);
-
- wsastartup = (int (*)(int, WSADATA *))
- GetProcAddress ((HMODULE) (dll->handle), "WSAStartup");
- if (wsastartup)
- {
- int res = wsastartup ((2<<8) | 2, &wsadata);
-
- debug_printf ("res %d", res);
- debug_printf ("wVersion %d", wsadata.wVersion);
- debug_printf ("wHighVersion %d", wsadata.wHighVersion);
- debug_printf ("szDescription %s", wsadata.szDescription);
- debug_printf ("szSystemStatus %s", wsadata.szSystemStatus);
- debug_printf ("iMaxSockets %d", wsadata.iMaxSockets);
- debug_printf ("iMaxUdpDg %d", wsadata.iMaxUdpDg);
- debug_printf ("lpVendorInfo %d", wsadata.lpVendorInfo);
-
- wsock_started = 1;
- }
- }
-
- InterlockedDecrement (&here);
-
- /* Kludge alert. Redirects the return address to dll_chain1. */
- __asm__ __volatile__ (" \n\
- movl $dll_chain1,4(%ebp) \n\
- ");
-
- volatile retchain ret;
- /* Set "arguments for dll_chain1. */
- ret.low = (long) dll_func_load;
- ret.high = (long) func;
- return ret.ll;
-}
-
-LoadDLLprime (wsock32, wsock_init)
-LoadDLLprime (ws2_32, wsock_init)
-
-LoadDLLfunc (AddAccessAllowedAce, 16, advapi32)
-LoadDLLfunc (AddAccessDeniedAce, 16, advapi32)
-LoadDLLfunc (AddAce, 20, advapi32)
-LoadDLLfunc (AdjustTokenPrivileges, 24, advapi32)
-LoadDLLfuncEx (AllocateLocallyUniqueId, 4, advapi32, 1)
-LoadDLLfunc (CopySid, 12, advapi32)
-LoadDLLfunc (CreateProcessAsUserA, 44, advapi32)
-LoadDLLfuncEx (CryptAcquireContextA, 20, advapi32, 1)
-LoadDLLfuncEx (CryptGenRandom, 12, advapi32, 1)
-LoadDLLfuncEx (CryptReleaseContext, 8, advapi32, 1)
-LoadDLLfunc (DeregisterEventSource, 4, advapi32)
-LoadDLLfuncEx (DuplicateTokenEx, 24, advapi32, 1)
-LoadDLLfunc (EqualSid, 8, advapi32)
-LoadDLLfunc (GetAce, 12, advapi32)
-LoadDLLfunc (GetFileSecurityA, 20, advapi32)
-LoadDLLfunc (GetKernelObjectSecurity, 20, advapi32)
-LoadDLLfunc (GetLengthSid, 4, advapi32)
-LoadDLLfunc (GetSecurityDescriptorDacl, 16, advapi32)
-LoadDLLfunc (GetSecurityDescriptorGroup, 12, advapi32)
-LoadDLLfunc (GetSecurityDescriptorOwner, 12, advapi32)
-LoadDLLfunc (GetSidIdentifierAuthority, 4, advapi32)
-LoadDLLfunc (GetSidSubAuthority, 8, advapi32)
-LoadDLLfunc (GetSidSubAuthorityCount, 4, advapi32)
-LoadDLLfunc (GetTokenInformation, 20, advapi32)
-LoadDLLfunc (GetUserNameA, 8, advapi32)
-LoadDLLfunc (ImpersonateLoggedOnUser, 4, advapi32)
-LoadDLLfunc (ImpersonateNamedPipeClient, 4, advapi32)
-LoadDLLfunc (InitializeAcl, 12, advapi32)
-LoadDLLfunc (InitializeSecurityDescriptor, 8, advapi32)
-LoadDLLfunc (InitializeSid, 12, advapi32)
-LoadDLLfunc (IsValidSid, 4, advapi32)
-LoadDLLfunc (LogonUserA, 24, advapi32)
-LoadDLLfunc (LookupAccountNameA, 28, advapi32)
-LoadDLLfunc (LookupAccountNameW, 28, advapi32)
-LoadDLLfunc (LookupAccountSidA, 28, advapi32)
-LoadDLLfunc (LookupPrivilegeValueA, 12, advapi32)
-LoadDLLfunc (LsaClose, 4, advapi32)
-LoadDLLfunc (LsaEnumerateAccountRights, 16, advapi32)
-LoadDLLfunc (LsaFreeMemory, 4, advapi32)
-LoadDLLfunc (LsaNtStatusToWinError, 4, advapi32)
-LoadDLLfunc (LsaOpenPolicy, 16, advapi32)
-LoadDLLfunc (LsaQueryInformationPolicy, 12, advapi32)
-LoadDLLfunc (MakeSelfRelativeSD, 12, advapi32)
-LoadDLLfunc (OpenProcessToken, 12, advapi32)
-LoadDLLfunc (RegCloseKey, 4, advapi32)
-LoadDLLfunc (RegCreateKeyExA, 36, advapi32)
-LoadDLLfunc (RegDeleteKeyA, 8, advapi32)
-LoadDLLfunc (RegDeleteValueA, 8, advapi32)
-LoadDLLfunc (RegLoadKeyA, 12, advapi32)
-LoadDLLfunc (RegEnumKeyExA, 32, advapi32)
-LoadDLLfunc (RegEnumValueA, 32, advapi32)
-LoadDLLfunc (RegOpenKeyExA, 20, advapi32)
-LoadDLLfunc (RegQueryValueExA, 24, advapi32)
-LoadDLLfunc (RegSetValueExA, 24, advapi32)
-LoadDLLfunc (RegisterEventSourceA, 8, advapi32)
-LoadDLLfunc (ReportEventA, 36, advapi32)
-LoadDLLfunc (RevertToSelf, 0, advapi32)
-LoadDLLfunc (SetKernelObjectSecurity, 12, advapi32)
-LoadDLLfunc (SetSecurityDescriptorControl, 12, advapi32)
-LoadDLLfunc (SetSecurityDescriptorDacl, 16, advapi32)
-LoadDLLfunc (SetSecurityDescriptorGroup, 12, advapi32)
-LoadDLLfunc (SetSecurityDescriptorOwner, 12, advapi32)
-LoadDLLfunc (SetTokenInformation, 16, advapi32)
-
-LoadDLLfunc (NetApiBufferFree, 4, netapi32)
-LoadDLLfunc (NetGetDCName, 12, netapi32)
-LoadDLLfunc (NetLocalGroupEnum, 28, netapi32)
-LoadDLLfunc (NetLocalGroupGetMembers, 32, netapi32)
-LoadDLLfunc (NetUserGetGroups, 28, netapi32)
-LoadDLLfunc (NetUserGetInfo, 16, netapi32)
-LoadDLLfunc (NetWkstaUserGetInfo, 12, netapi32)
-
-LoadDLLfuncEx (NtCreateToken, 52, ntdll, 1)
-LoadDLLfuncEx (NtMapViewOfSection, 40, ntdll, 1)
-LoadDLLfuncEx (NtOpenFile, 24, ntdll, 1)
-LoadDLLfuncEx (NtOpenSection, 12, ntdll, 1)
-LoadDLLfuncEx (NtQueryInformationFile, 20, ntdll, 1)
-LoadDLLfuncEx (NtQueryInformationProcess, 20, ntdll, 1)
-LoadDLLfuncEx2 (NtQueryObject, 20, ntdll, 1, 1)
-LoadDLLfuncEx (NtQuerySystemInformation, 16, ntdll, 1)
-LoadDLLfuncEx (NtQueryVirtualMemory, 24, ntdll, 1)
-LoadDLLfuncEx (NtUnmapViewOfSection, 8, ntdll, 1)
-LoadDLLfuncEx (RtlInitUnicodeString, 8, ntdll, 1)
-LoadDLLfuncEx (RtlNtStatusToDosError, 4, ntdll, 1)
-
-LoadDLLfuncEx (GetProcessMemoryInfo, 12, psapi, 1)
-
-LoadDLLfuncEx (LsaDeregisterLogonProcess, 4, secur32, 1)
-LoadDLLfuncEx (LsaFreeReturnBuffer, 4, secur32, 1)
-LoadDLLfuncEx (LsaLogonUser, 56, secur32, 1)
-LoadDLLfuncEx (LsaLookupAuthenticationPackage, 12, secur32, 1)
-LoadDLLfuncEx (LsaRegisterLogonProcess, 12, secur32, 1)
-
-LoadDLLfunc (CharToOemA, 8, user32)
-LoadDLLfunc (CharToOemBuffA, 12, user32)
-LoadDLLfunc (CloseClipboard, 0, user32)
-LoadDLLfunc (CreateWindowExA, 48, user32)
-LoadDLLfunc (DefWindowProcA, 16, user32)
-LoadDLLfunc (DispatchMessageA, 4, user32)
-LoadDLLfunc (EmptyClipboard, 0, user32)
-LoadDLLfunc (FindWindowA, 8, user32)
-LoadDLLfunc (GetClipboardData, 4, user32)
-LoadDLLfunc (GetKeyboardLayout, 4, user32)
-LoadDLLfunc (GetMessageA, 16, user32)
-LoadDLLfunc (GetPriorityClipboardFormat, 8, user32)
-LoadDLLfunc (GetProcessWindowStation, 0, user32)
-LoadDLLfunc (GetThreadDesktop, 4, user32)
-LoadDLLfunc (GetUserObjectInformationA, 20, user32)
-LoadDLLfunc (KillTimer, 8, user32)
-LoadDLLfunc (MessageBoxA, 16, user32)
-LoadDLLfunc (MsgWaitForMultipleObjects, 20, user32)
-LoadDLLfunc (OemToCharBuffA, 12, user32)
-LoadDLLfunc (OpenClipboard, 4, user32)
-LoadDLLfunc (PeekMessageA, 20, user32)
-LoadDLLfunc (PostMessageA, 16, user32)
-LoadDLLfunc (PostQuitMessage, 4, user32)
-LoadDLLfunc (RegisterClassA, 4, user32)
-LoadDLLfunc (RegisterClipboardFormatA, 4, user32)
-LoadDLLfunc (SendMessageA, 16, user32)
-LoadDLLfunc (SetClipboardData, 8, user32)
-LoadDLLfunc (SetTimer, 16, user32)
-LoadDLLfunc (SetUserObjectSecurity, 12, user32)
-
-LoadDLLfuncEx (load_wsock32, 0, wsock32, 1) // non-existent function forces wsock32 load
-LoadDLLfunc (WSAAsyncSelect, 16, wsock32)
-LoadDLLfunc (WSACleanup, 0, wsock32)
-LoadDLLfunc (WSAGetLastError, 0, wsock32)
-LoadDLLfunc (WSASetLastError, 4, wsock32)
-// LoadDLLfunc (WSAStartup, 8, wsock32)
-LoadDLLfunc (__WSAFDIsSet, 8, wsock32)
-LoadDLLfunc (accept, 12, wsock32)
-LoadDLLfunc (bind, 12, wsock32)
-LoadDLLfunc (closesocket, 4, wsock32)
-LoadDLLfunc (connect, 12, wsock32)
-LoadDLLfunc (gethostbyaddr, 12, wsock32)
-LoadDLLfunc (gethostbyname, 4, wsock32)
-LoadDLLfunc (gethostname, 8, wsock32)
-LoadDLLfunc (getpeername, 12, wsock32)
-LoadDLLfunc (getprotobyname, 4, wsock32)
-LoadDLLfunc (getprotobynumber, 4, wsock32)
-LoadDLLfunc (getservbyname, 8, wsock32)
-LoadDLLfunc (getservbyport, 8, wsock32)
-LoadDLLfunc (getsockname, 12, wsock32)
-LoadDLLfunc (getsockopt, 20, wsock32)
-LoadDLLfunc (inet_addr, 4, wsock32)
-LoadDLLfunc (inet_network, 4, wsock32)
-LoadDLLfunc (inet_ntoa, 4, wsock32)
-LoadDLLfunc (ioctlsocket, 12, wsock32)
-LoadDLLfunc (listen, 8, wsock32)
-LoadDLLfunc (rcmd, 24, wsock32)
-LoadDLLfunc (recv, 16, wsock32)
-LoadDLLfunc (recvfrom, 24, wsock32)
-LoadDLLfunc (rexec, 24, wsock32)
-LoadDLLfunc (rresvport, 4, wsock32)
-LoadDLLfunc (select, 20, wsock32)
-LoadDLLfunc (send, 16, wsock32)
-LoadDLLfunc (sendto, 24, wsock32)
-LoadDLLfunc (setsockopt, 20, wsock32)
-LoadDLLfunc (shutdown, 8, wsock32)
-LoadDLLfunc (socket, 12, wsock32)
-
-LoadDLLfuncEx (WSACloseEvent, 4, ws2_32, 1)
-LoadDLLfuncEx (WSACreateEvent, 0, ws2_32, 1)
-LoadDLLfuncEx (WSADuplicateSocketA, 12, ws2_32, 1)
-LoadDLLfuncEx (WSAGetOverlappedResult, 20, ws2_32, 1)
-LoadDLLfuncEx (WSARecv, 28, ws2_32, 1)
-LoadDLLfuncEx (WSARecvFrom, 36, ws2_32, 1)
-LoadDLLfuncEx (WSASend, 28, ws2_32, 1)
-LoadDLLfuncEx (WSASendTo, 36, ws2_32, 1)
-LoadDLLfuncEx (WSASetEvent, 4, ws2_32, 1)
-LoadDLLfuncEx (WSASocketA, 24, ws2_32, 1)
-LoadDLLfuncEx (WSAWaitForMultipleEvents, 20, ws2_32, 1)
-
-LoadDLLfuncEx (GetIfTable, 12, iphlpapi, 1)
-LoadDLLfuncEx (GetIpAddrTable, 12, iphlpapi, 1)
-
-LoadDLLfunc (CoInitialize, 4, ole32)
-LoadDLLfunc (CoUninitialize, 0, ole32)
-LoadDLLfunc (CoCreateInstance, 20, ole32)
-
-LoadDLLfuncEx (CancelIo, 4, kernel32, 1)
-LoadDLLfuncEx (CreateHardLinkA, 12, kernel32, 1)
-LoadDLLfuncEx (CreateToolhelp32Snapshot, 8, kernel32, 1)
-LoadDLLfuncEx2 (IsDebuggerPresent, 0, kernel32, 1, 1)
-LoadDLLfuncEx (Process32First, 8, kernel32, 1)
-LoadDLLfuncEx (Process32Next, 8, kernel32, 1)
-LoadDLLfuncEx (SignalObjectAndWait, 16, kernel32, 1)
-LoadDLLfunc (TryEnterCriticalSection, 4, kernel32)
-
-LoadDLLfuncEx (waveOutGetNumDevs, 0, winmm, 1)
-LoadDLLfuncEx (waveOutOpen, 24, winmm, 1)
-LoadDLLfuncEx (waveOutReset, 4, winmm, 1)
-LoadDLLfuncEx (waveOutClose, 4, winmm, 1)
-LoadDLLfuncEx (waveOutGetVolume, 8, winmm, 1)
-LoadDLLfuncEx (waveOutSetVolume, 8, winmm, 1)
-LoadDLLfuncEx (waveOutUnprepareHeader, 12, winmm, 1)
-LoadDLLfuncEx (waveOutPrepareHeader, 12, winmm, 1)
-LoadDLLfuncEx (waveOutWrite, 12, winmm, 1)
-LoadDLLfuncEx (timeGetDevCaps, 8, winmm, 1)
-LoadDLLfuncEx (timeGetTime, 0, winmm, 1)
-LoadDLLfuncEx (timeBeginPeriod, 4, winmm, 1)
-LoadDLLfuncEx (timeEndPeriod, 4, winmm, 1)
-}
diff --git a/winsup/cygwin/automode.c b/winsup/cygwin/automode.c
deleted file mode 100644
index f7cddfeec..000000000
--- a/winsup/cygwin/automode.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* automode.c
-
- Copyright 2000 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 <windows.h>
-#include <sys/fcntl.h>
-#include <sys/cygwin.h>
-
-extern int _fmode;
-void
-cygwin_premain0 (int argc, char **argv, struct per_process *myself)
-{
- static struct __cygwin_perfile pf[] =
- {
- {"", O_RDONLY | O_TEXT},
- {"", O_WRONLY | O_BINARY},
- {NULL, 0}
- };
- cygwin_internal (CW_PERFILE, pf);
-}
diff --git a/winsup/cygwin/binmode.c b/winsup/cygwin/binmode.c
deleted file mode 100644
index 50efff46f..000000000
--- a/winsup/cygwin/binmode.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* binmode.c
-
- Copyright 2000 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 <windows.h>
-#include <sys/fcntl.h>
-#include <sys/cygwin.h>
-
-extern int _fmode;
-void
-cygwin_premain0 (int argc, char **argv, struct per_process *myself)
-{
- _fmode &= ~_O_TEXT;
- _fmode |= _O_BINARY;
-}
diff --git a/winsup/cygwin/child_info.h b/winsup/cygwin/child_info.h
deleted file mode 100644
index fdfaa28ca..000000000
--- a/winsup/cygwin/child_info.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* childinfo.h: shared child info for cygwin
-
- Copyright 2000, 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. */
-
-#include <setjmp.h>
-
-enum
-{
- _PROC_EXEC,
- _PROC_SPAWN,
- _PROC_FORK
-};
-
-#define OPROC_MAGIC_MASK 0xff00ff00
-#define OPROC_MAGIC_GENERIC 0xaf00f000
-
-#define PROC_MAGIC_GENERIC 0xaf00fa00
-
-#define PROC_EXEC (_PROC_EXEC)
-#define PROC_SPAWN (_PROC_SPAWN)
-#define PROC_FORK (_PROC_FORK)
-
-#define EXEC_MAGIC_SIZE sizeof(child_info)
-
-#define CURR_CHILD_INFO_MAGIC 0x8b3c
-
-/* NOTE: Do not make gratuitous changes to the names or organization of the
- below class. The layout is checksummed to determine compatibility between
- different cygwin versions. */
-class child_info
-{
-public:
- DWORD zero[4]; // must be zeroed
- DWORD cb; // size of this record
- DWORD intro; // improbable string
- unsigned short magic; // magic number unique to child_info
- unsigned short type; // type of record, exec, spawn, fork
- int cygpid; // cygwin pid of child process
- HANDLE subproc_ready; // used for synchronization with parent
- HANDLE mount_h;
- HANDLE parent;
- HANDLE pppid_handle;
- init_cygheap *cygheap;
- void *cygheap_max;
- HANDLE cygheap_h;
- unsigned fhandler_union_cb;
-};
-
-class child_info_fork: public child_info
-{
-public:
- HANDLE forker_finished;// for synchronization with child
- DWORD stacksize; // size of parent stack
- void *heaptop;
- void *heapbase;
- void *heapptr;
- jmp_buf jmp; // where child will jump to
- void *stacktop; // location of top of parent stack
- void *stackbottom; // location of bottom of parent stack
-};
-
-class fhandler_base;
-
-class cygheap_exec_info
-{
-public:
- __uid32_t uid;
- char *old_title;
- int argc;
- char **argv;
- int envc;
- char **envp;
- HANDLE myself_pinfo;
-};
-
-class child_info_spawn: public child_info
-{
-public:
- cygheap_exec_info *moreinfo;
- HANDLE hexec_proc;
-
- child_info_spawn (): moreinfo (NULL) {}
- ~child_info_spawn ()
- {
- if (parent)
- CloseHandle (parent);
- if (moreinfo)
- {
- if (moreinfo->old_title)
- cfree (moreinfo->old_title);
- if (moreinfo->envp)
- {
- for (char **e = moreinfo->envp; *e; e++)
- cfree (*e);
- cfree (moreinfo->envp);
- }
- CloseHandle (moreinfo->myself_pinfo);
- cfree (moreinfo);
- }
- }
-};
-
-void __stdcall init_child_info (DWORD, child_info *, int, HANDLE);
-
-extern child_info_fork *child_proc_info;
diff --git a/winsup/cygwin/config.h.in b/winsup/cygwin/config.h.in
deleted file mode 100644
index 8a961b33c..000000000
--- a/winsup/cygwin/config.h.in
+++ /dev/null
@@ -1,41 +0,0 @@
-/* config.h.in. Generated automatically from configure.in by autoheader. */
-
-/* Define if using alloca.c. */
-#undef C_ALLOCA
-
-/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
- This function is required for alloca.c support on those systems. */
-#undef CRAY_STACKSEG_END
-
-/* Define if you have alloca, as a function or macro. */
-#undef HAVE_ALLOCA
-
-/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
-#undef HAVE_ALLOCA_H
-
-/* If using the C implementation of alloca, define if you know the
- direction of stack growth for your system; otherwise it will be
- automatically deduced at run-time.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown
- */
-#undef STACK_DIRECTION
-
-/* Define if DEBUGGING support is requested. */
-#undef DEBUGGING
-
-/* Define if MALLOC_DEBUGGING support is requested. */
-#undef MALLOC_DEBUG
-
-/* Define if building "extra" thread-safe Cygwin DLL. */
-#undef _CYG_THREAD_FAILSAFE
-
-/* Define if GCC supports builtin memset. */
-#undef HAVE_BUILTIN_MEMSET
-
-/* Define if building thread-safe Cygwin DLL. */
-#undef _MT_SAFE
-
-/* Define if using new vfork functionality. */
-#undef NEWVFORK
diff --git a/winsup/cygwin/config/i386/longjmp.c b/winsup/cygwin/config/i386/longjmp.c
deleted file mode 100644
index 62c52aaa0..000000000
--- a/winsup/cygwin/config/i386/longjmp.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* longjmp.c
-
- Copyright 1996, 1998, 1999, 2000, 2001 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 __i386__
-#if 1
-asm (" .globl _longjmp \n"
-"_longjmp: \n"
-" pushl %ebp \n"
-" movl %esp,%ebp \n"
-" movl 8(%ebp),%edi \n"
-" movl 12(%ebp),%eax \n"
-" testl %eax,%eax \n"
-" jne 0f \n"
-" incl %eax \n"
-"0: \n"
-" movl %eax,0(%edi) \n"
-" movl 24(%edi),%ebp \n"
-" pushfl \n"
-" popl %ebx \n"
-" movw 42(%edi),%ax \n"
-" movw %ax,%ss \n"
-" movl 28(%edi),%esp \n"
-" pushl 32(%edi) \n"
-" pushl %ebx \n"
-" movw 36(%edi),%ax \n"
-" movw %ax,%es \n"
-#if 0
-/* fs is a system register in windows; don't muck with it */
-" movw 38(%edi),%ax \n"
-" movw %ax,%fs \n"
-#endif
-" movw 40(%edi),%ax \n"
-" movw %ax,%gs \n"
-" movl 0(%edi),%eax \n"
-" movl 4(%edi),%ebx \n"
-" movl 8(%edi),%ecx \n"
-" movl 12(%edi),%edx \n"
-" movl 16(%edi),%esi \n"
-" movl 20(%edi),%edi \n"
-" popfl \n"
-" ret \n");
-#endif
-
-#endif /* __i386__ */
diff --git a/winsup/cygwin/config/i386/makefrag b/winsup/cygwin/config/i386/makefrag
deleted file mode 100644
index c7f6b2d17..000000000
--- a/winsup/cygwin/config/i386/makefrag
+++ /dev/null
@@ -1,17 +0,0 @@
-# makefrag: included by the main Cygwin Makefile.in
-
-# Copyright 1996, 1998, 1999, 2001 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.
-
-EXTRA_DLL_OFILES=setjmp.o longjmp.o
-
-setjmp.o:config/i386/setjmp.c
- $(CC) -c $(ALL_CFLAGS) $<
-
-longjmp.o:config/i386/longjmp.c
- $(CC) -c $(ALL_CFLAGS) $<
diff --git a/winsup/cygwin/config/i386/profile.h b/winsup/cygwin/config/i386/profile.h
deleted file mode 100644
index ad5f625d0..000000000
--- a/winsup/cygwin/config/i386/profile.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $NetBSD: profile.h,v 1.6 1995/03/28 18:17:08 jtc Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)profile.h 8.1 (Berkeley) 6/11/93
- */
-
-#define _MCOUNT_DECL static inline void _mcount
-
-#define MCOUNT \
-void \
-mcount() \
-{ \
- int selfpc, frompcindex; \
- /* \
- * find the return address for mcount, \
- * and the return address for mcount's caller. \
- * \
- * selfpc = pc pushed by mcount call \
- */ \
- __asm("movl 4(%%ebp),%0" : "=r" (selfpc)); \
- /* \
- * frompcindex = pc pushed by call into self. \
- */ \
- __asm("movl (%%ebp),%0;movl 4(%0),%0" : "=r" (frompcindex)); \
- _mcount(frompcindex, selfpc); \
-}
-
diff --git a/winsup/cygwin/config/i386/setjmp.c b/winsup/cygwin/config/i386/setjmp.c
deleted file mode 100644
index 9104c2c83..000000000
--- a/winsup/cygwin/config/i386/setjmp.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* setjmp.c
-
- Copyright 1996, 1998, 1999, 2000, 2001 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 __i386__
-
-#if 1
-asm(" .globl _setjmp \n"
-"_setjmp: \n"
-" pushl %ebp \n"
-" movl %esp,%ebp \n"
-" pushl %edi \n"
-" movl 8(%ebp),%edi \n"
-" movl %eax,0(%edi) \n"
-" movl %ebx,4(%edi) \n"
-" movl %ecx,8(%edi) \n"
-" movl %edx,12(%edi) \n"
-" movl %esi,16(%edi) \n"
-" movl -4(%ebp),%eax \n"
-" movl %eax,20(%edi) \n"
-" movl 0(%ebp),%eax \n"
-" movl %eax,24(%edi) \n"
-" movl %esp,%eax \n"
-" addl $12,%eax \n"
-" movl %eax,28(%edi) \n"
-" movl 4(%ebp),%eax \n"
-" movl %eax,32(%edi) \n"
-" movw %es, %ax \n"
-" movw %ax, 36(%edi) \n"
-" movw %fs, %ax \n"
-" movw %ax, 38(%edi) \n"
-" movw %gs, %ax \n"
-" movw %ax, 40(%edi) \n"
-" movw %ss, %ax \n"
-" movw %ax, 42(%edi) \n"
-" popl %edi \n"
-" movl $0,%eax \n"
-" leave \n"
-" ret \n");
-#endif
-
-#endif /* __i386__ */
diff --git a/winsup/cygwin/configure b/winsup/cygwin/configure
deleted file mode 100755
index 3f41211fb..000000000
--- a/winsup/cygwin/configure
+++ /dev/null
@@ -1,2416 +0,0 @@
-#! /bin/sh
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-
-# Defaults:
-ac_help=
-ac_default_prefix=/usr/local
-# Any additions from configure.in:
-ac_help="$ac_help
- --enable-threadsafe=[runtime] Build a cygwin DLL which is thread safe"
-ac_help="$ac_help
- --enable-extra-threadsafe-checking Build a cygwin DLL which is thread safe with extra consistency checking"
-ac_help="$ac_help
- --enable-debugging Build a cygwin DLL which has more consistency checking for debugging"
-ac_help="$ac_help
- --enable-malloc-debugging Build a cygwin DLL with heap sanity checking (this is very slow, use only if you have heap corruption problems)"
-ac_help="$ac_help
- --enable-vfork Build a cygwin DLL which uses experimental vfork code"
-
-# Initialize some variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
-exec_prefix=NONE
-host=NONE
-no_create=
-nonopt=NONE
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-target=NONE
-verbose=
-x_includes=NONE
-x_libraries=NONE
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
-ac_prev=
-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=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case "$ac_option" in
-
- -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 ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$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" ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir="$ac_optarg" ;;
-
- -disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_${ac_feature}='$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)
- # 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 << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --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
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host="$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" ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- 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)
- 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" ;;
-
- -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 ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
- exit 0 ;;
-
- -with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "with_${ac_package}='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=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" ;;
-
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
- ;;
-
- *)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
-
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
-do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
- esac
-done
-
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
-
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=init.cc
-
-# 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 its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
- 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
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
- else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
- fi
-fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
-else
- echo "creating cache $cache_file"
- > $cache_file
-fi
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
-
-
-
-
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-# 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
-# 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"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:568: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/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
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
-
-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. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL="$ac_install_sh"
- fi
-fi
-echo "$ac_t""$INSTALL" 1>&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_PROGRAM}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-
-
-
-
-
-
-
-# Do some error checking and defaulting for the host and target type.
-# The inputs are:
-# configure --host=HOST --target=TARGET --build=BUILD NONOPT
-#
-# The rules are:
-# 1. You are not allowed to specify --host, --target, and nonopt at the
-# same time.
-# 2. Host defaults to nonopt.
-# 3. If nonopt is not specified, then host defaults to the current host,
-# as determined by config.guess.
-# 4. Target and build default to nonopt.
-# 5. If nonopt is not specified, then target and build default to host.
-
-# The aliases save the names the user supplied, while $host etc.
-# will get canonicalized.
-case $host---$target---$nonopt in
-NONE---*---* | *---NONE---* | *---*---NONE) ;;
-*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
-esac
-
-
-# Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:654: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
- case $nonopt in
- NONE)
- if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
- else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
- fi ;;
- *) host_alias=$nonopt ;;
- esac ;;
-esac
-
-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
-
-echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:675: checking target system type" >&5
-
-target_alias=$target
-case "$target_alias" in
-NONE)
- case $nonopt in
- NONE) target_alias=$host_alias ;;
- *) target_alias=$nonopt ;;
- esac ;;
-esac
-
-target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
-target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$target" 1>&6
-
-echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:693: checking build system type" >&5
-
-build_alias=$build
-case "$build_alias" in
-NONE)
- case $nonopt in
- NONE) build_alias=$host_alias ;;
- *) build_alias=$nonopt ;;
- esac ;;
-esac
-
-build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
-build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$build" 1>&6
-
-test "$host_alias" != "$target_alias" &&
- test "$program_prefix$program_suffix$program_transform_name" = \
- NONENONEs,x,x, &&
- program_prefix=${target_alias}-
-
-
-if test $host != $build; then
- ac_tool_prefix=${host_alias}-
-else
- ac_tool_prefix=
-fi
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:725: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="${ac_tool_prefix}gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_CC"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:757: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="gcc"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- CC="gcc"
-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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:793: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_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 $# -gt 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
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
- fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:842: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:851: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
-else
- ac_cv_prog_gcc=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:866: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
-else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
- CFLAGS="-gstabs+ -O2"
- else
- CFLAGS="-O2"
- fi
-else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
-fi
-
-# Extract the first word of "${ac_tool_prefix}g++", so it can be a program name with args.
-set dummy ${ac_tool_prefix}g++; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:896: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CXX"; then
- ac_cv_prog_CXX="$CXX" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CXX="${ac_tool_prefix}g++"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CXX="$ac_cv_prog_CXX"
-if test -n "$CXX"; then
- echo "$ac_t""$CXX" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_CXX"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "g++", so it can be a program name with args.
-set dummy g++; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:928: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CXX"; then
- ac_cv_prog_CXX="$CXX" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CXX="g++"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_CXX" && ac_cv_prog_CXX="g++"
-fi
-fi
-CXX="$ac_cv_prog_CXX"
-if test -n "$CXX"; then
- echo "$ac_t""$CXX" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- CXX="g++"
-fi
-fi
-
-if test -z "$CXX"; then
- # Extract the first word of "c++", so it can be a program name with args.
-set dummy c++; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:964: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CXX"; then
- ac_cv_prog_CXX="$CXX" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CXX="c++"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CXX="$ac_cv_prog_CXX"
-if test -n "$CXX"; then
- echo "$ac_t""$CXX" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-CXXFLAGS='$(CFLAGS)'
-
-
-case "$with_cross_host" in
- ""|*cygwin*)
- all_host="all_host"
- install_host="install_host"
- ;;
- *)
- all_host=
- install_host=
- ;;
-esac
-
-
-
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1013: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$AR"; then
- ac_cv_prog_AR="$AR" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_AR="${ac_tool_prefix}ar"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-AR="$ac_cv_prog_AR"
-if test -n "$AR"; then
- echo "$ac_t""$AR" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_AR"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "ar", so it can be a program name with args.
-set dummy ar; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1045: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$AR"; then
- ac_cv_prog_AR="$AR" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_AR="ar"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
-fi
-fi
-AR="$ac_cv_prog_AR"
-if test -n "$AR"; then
- echo "$ac_t""$AR" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- AR="ar"
-fi
-fi
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1080: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$AS"; then
- ac_cv_prog_AS="$AS" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_AS="${ac_tool_prefix}as"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-AS="$ac_cv_prog_AS"
-if test -n "$AS"; then
- echo "$ac_t""$AS" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_AS"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "as", so it can be a program name with args.
-set dummy as; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1112: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$AS"; then
- ac_cv_prog_AS="$AS" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_AS="as"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="as"
-fi
-fi
-AS="$ac_cv_prog_AS"
-if test -n "$AS"; then
- echo "$ac_t""$AS" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- AS="as"
-fi
-fi
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1147: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_RANLIB"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1179: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB="ranlib"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- RANLIB="ranlib"
-fi
-fi
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1214: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$LD"; then
- ac_cv_prog_LD="$LD" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_LD="${ac_tool_prefix}ld"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-LD="$ac_cv_prog_LD"
-if test -n "$LD"; then
- echo "$ac_t""$LD" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_LD"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "ld", so it can be a program name with args.
-set dummy ld; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1246: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$LD"; then
- ac_cv_prog_LD="$LD" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_LD="ld"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_LD" && ac_cv_prog_LD="ld"
-fi
-fi
-LD="$ac_cv_prog_LD"
-if test -n "$LD"; then
- echo "$ac_t""$LD" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- LD="ld"
-fi
-fi
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1281: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$NM"; then
- ac_cv_prog_NM="$NM" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_NM="${ac_tool_prefix}nm"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-NM="$ac_cv_prog_NM"
-if test -n "$NM"; then
- echo "$ac_t""$NM" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_NM"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "nm", so it can be a program name with args.
-set dummy nm; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1313: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$NM"; then
- ac_cv_prog_NM="$NM" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_NM="nm"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_NM" && ac_cv_prog_NM="nm"
-fi
-fi
-NM="$ac_cv_prog_NM"
-if test -n "$NM"; then
- echo "$ac_t""$NM" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- NM="nm"
-fi
-fi
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1348: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$DLLTOOL"; then
- ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-DLLTOOL="$ac_cv_prog_DLLTOOL"
-if test -n "$DLLTOOL"; then
- echo "$ac_t""$DLLTOOL" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_DLLTOOL"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "dlltool", so it can be a program name with args.
-set dummy dlltool; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1380: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$DLLTOOL"; then
- ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_DLLTOOL="dlltool"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="dlltool"
-fi
-fi
-DLLTOOL="$ac_cv_prog_DLLTOOL"
-if test -n "$DLLTOOL"; then
- echo "$ac_t""$DLLTOOL" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- DLLTOOL="dlltool"
-fi
-fi
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1415: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$WINDRES"; then
- ac_cv_prog_WINDRES="$WINDRES" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_WINDRES="${ac_tool_prefix}windres"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-WINDRES="$ac_cv_prog_WINDRES"
-if test -n "$WINDRES"; then
- echo "$ac_t""$WINDRES" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_WINDRES"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "windres", so it can be a program name with args.
-set dummy windres; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1447: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$WINDRES"; then
- ac_cv_prog_WINDRES="$WINDRES" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_WINDRES="windres"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_WINDRES" && ac_cv_prog_WINDRES="windres"
-fi
-fi
-WINDRES="$ac_cv_prog_WINDRES"
-if test -n "$WINDRES"; then
- echo "$ac_t""$WINDRES" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- WINDRES="windres"
-fi
-fi
-
-
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1481: checking how to run the C preprocessor" >&5
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- # This must be in double quotes, not single quotes, because CPP may get
- # substituted into the Makefile and "${CC-cc}" will confuse make.
- CPP="${CC-cc} -E"
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp.
- cat > conftest.$ac_ext <<EOF
-#line 1496 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1502: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -E -traditional-cpp"
- cat > conftest.$ac_ext <<EOF
-#line 1513 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1519: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -nologo -E"
- cat > conftest.$ac_ext <<EOF
-#line 1530 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1536: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP=/lib/cpp
-fi
-rm -f conftest*
-fi
-rm -f conftest*
-fi
-rm -f conftest*
- ac_cv_prog_CPP="$CPP"
-fi
- CPP="$ac_cv_prog_CPP"
-else
- ac_cv_prog_CPP="$CPP"
-fi
-echo "$ac_t""$CPP" 1>&6
-
-# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
-# for constant arguments. Useless!
-echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:1563: checking for working alloca.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1568 "configure"
-#include "confdefs.h"
-#include <alloca.h>
-int main() {
-char *p = alloca(2 * sizeof(int));
-; return 0; }
-EOF
-if { (eval echo configure:1575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- ac_cv_header_alloca_h=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_alloca_h=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
-if test $ac_cv_header_alloca_h = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_ALLOCA_H 1
-EOF
-
-fi
-
-echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:1596: checking for alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1601 "configure"
-#include "confdefs.h"
-
-#ifdef __GNUC__
-# define alloca __builtin_alloca
-#else
-# ifdef _MSC_VER
-# include <malloc.h>
-# define alloca _alloca
-# else
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# ifdef _AIX
- #pragma alloca
-# else
-# ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-# endif
-# endif
-# endif
-# endif
-#endif
-
-int main() {
-char *p = (char *) alloca(1);
-; return 0; }
-EOF
-if { (eval echo configure:1629: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- ac_cv_func_alloca_works=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_func_alloca_works=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
-if test $ac_cv_func_alloca_works = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_ALLOCA 1
-EOF
-
-fi
-
-if test $ac_cv_func_alloca_works = no; then
- # The SVR3 libPW and SVR4 libucb both contain incompatible functions
- # that cause trouble. Some versions do not even contain alloca or
- # contain a buggy version. If you still want to use their alloca,
- # use ar to extract alloca.o from them instead of compiling alloca.c.
- ALLOCA=alloca.${ac_objext}
- cat >> confdefs.h <<\EOF
-#define C_ALLOCA 1
-EOF
-
-
-echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:1661: checking whether alloca needs Cray hooks" >&5
-if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1666 "configure"
-#include "confdefs.h"
-#if defined(CRAY) && ! defined(CRAY2)
-webecray
-#else
-wenotbecray
-#endif
-
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "webecray" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_os_cray=yes
-else
- rm -rf conftest*
- ac_cv_os_cray=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_os_cray" 1>&6
-if test $ac_cv_os_cray = yes; then
-for ac_func in _getb67 GETB67 getb67; do
- echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1691: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1696 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:1719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<EOF
-#define CRAY_STACKSEG_END $ac_func
-EOF
-
- break
-else
- echo "$ac_t""no" 1>&6
-fi
-
-done
-fi
-
-echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:1746: checking stack direction for C alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- ac_cv_c_stack_direction=0
-else
- cat > conftest.$ac_ext <<EOF
-#line 1754 "configure"
-#include "confdefs.h"
-find_stack_direction ()
-{
- static char *addr = 0;
- auto char dummy;
- if (addr == 0)
- {
- addr = &dummy;
- return find_stack_direction ();
- }
- else
- return (&dummy > addr) ? 1 : -1;
-}
-main ()
-{
- exit (find_stack_direction() < 0);
-}
-EOF
-if { (eval echo configure:1773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- ac_cv_c_stack_direction=1
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_c_stack_direction=-1
-fi
-rm -fr conftest*
-fi
-
-fi
-
-echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
-cat >> confdefs.h <<EOF
-#define STACK_DIRECTION $ac_cv_c_stack_direction
-EOF
-
-fi
-
-echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1795: checking whether ${MAKE-make} sets \${MAKE}" >&5
-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftestmake <<\EOF
-all:
- @echo 'ac_maketemp="${MAKE}"'
-EOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
-if test -n "$ac_maketemp"; then
- eval ac_cv_prog_make_${ac_make}_set=yes
-else
- eval ac_cv_prog_make_${ac_make}_set=no
-fi
-rm -f conftestmake
-fi
-if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- SET_MAKE=
-else
- echo "$ac_t""no" 1>&6
- SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-
-# Test for builtin mem* functions.
-
-ac_ext=C
-# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cxx_cross
-
-cat > conftest.$ac_ext <<EOF
-#line 1832 "configure"
-#include "confdefs.h"
-
-#include <string.h>
-void foo(char *s, int c, size_t n)
-{
- __builtin_memset(s, c, n);
-}
-
-int main() {
-
-; return 0; }
-EOF
-if { (eval echo configure:1845: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- use_builtin_memset=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- use_builtin_memset=no
-fi
-rm -f conftest*
-if test $use_builtin_memset = "yes"; then
- cat >> confdefs.h <<\EOF
-#define HAVE_BUILTIN_MEMSET 1
-EOF
-
-fi
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-
-mt_safe_val=1
-MT_SAFE=yes
-
-# Check whether --enable-threadsafe or --disable-threadsafe was given.
-if test "${enable_threadsafe+set}" = set; then
- enableval="$enable_threadsafe"
- case "${enableval}" in
-yes)
- ;;
-runtime)
- mt_safe_val=2
- MT_SAFE=yes
- ;;
-no)
- mt_safe_val=0
- MT_SAFE=no
- ;;
-esac
-
-fi
-
-
-# Check whether --enable-extra-threadsafe-checking or --disable-extra-threadsafe-checking was given.
-if test "${enable_extra_threadsafe_checking+set}" = set; then
- enableval="$enable_extra_threadsafe_checking"
- case "${enableval}" in
-yes)
- mt_safe_val=1
- MT_SAFE=yes
- cat >> confdefs.h <<\EOF
-#define _CYG_THREAD_FAILSAFE 1
-EOF
-
- ;;
-no)
- ;;
-esac
-
-fi
-
-
-if test "$MT_SAFE" = "yes"; then
- cat >> confdefs.h <<EOF
-#define _MT_SAFE $mt_safe_val
-EOF
-
-fi
-
-
-
-# Check whether --enable-debugging or --disable-debugging was given.
-if test "${enable_debugging+set}" = set; then
- enableval="$enable_debugging"
- case "${enableval}" in
-yes) cat >> confdefs.h <<\EOF
-#define DEBUGGING 1
-EOF
- ;;
-no) ;;
-esac
-
-fi
-
-
-MALLOC_OFILES=
-# Check whether --enable-malloc-debugging or --disable-malloc-debugging was given.
-if test "${enable_malloc_debugging+set}" = set; then
- enableval="$enable_malloc_debugging"
- case "${enableval}" in
-yes) cat >> confdefs.h <<\EOF
-#define MALLOC_DEBUG 1
-EOF
-
- MALLOC_OFILES=dlmalloc.o
- ;;
-no) ;;
-esac
-
-fi
-
-
-# Check whether --enable-vfork or --disable-vfork was given.
-if test "${enable_vfork+set}" = set; then
- enableval="$enable_vfork"
- vfork="${enableval}"
-]
-fi
-
-
-case "$vfork" in
-no) ;;
-yes|*) cat >> confdefs.h <<EOF
-#define NEWVFORK 1
-EOF
- ;;
-esac
-
-
-
-
-echo $ac_n "checking if newlib is part of the build tree""... $ac_c" 1>&6
-echo "configure:1970: checking if newlib is part of the build tree" >&5
-
-EXE_LDFLAGS=
-if test -d ../newlib
-then
- echo "$ac_t""yes" 1>&6
- EXE_LDFLAGS="-B../../newlib/ -B../"
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test x"$EXE_LDFLAGS" = x
-then
- echo $ac_n "checking if installed newlib needed""... $ac_c" 1>&6
-echo "configure:1985: checking if installed newlib needed" >&5
- cat > conftest.$ac_ext <<EOF
-#line 1987 "configure"
-#include "confdefs.h"
-
-int main() {
-/* main already defined */
-
-; return 0; }
-EOF
-if { (eval echo configure:1995: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- echo "$ac_t""no" 1>&6
-
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- echo "$ac_t""yes" 1>&6
- echo "configure: warning: newlib not found - utility .exe's may not link" 1>&2
-fi
-rm -f conftest*
-fi
-
-
-case "$target_cpu" in
- i386|i486|i586|i686) DLL_ENTRY="_dll_entry@12"
- DEF_DLL_ENTRY="dll_entry@12"
- ALLOCA="_alloca"
- CONFIG_DIR="i386" ;;
- powerpc*) DLL_ENTRY="dll_entry"
- DEF_DLL_ENTRY="dll_entry"
- ALLOCA=" __allocate_stack"
- CONFIG_DIR="ppc" ;;
- *) { echo "configure: error: Invalid target processor \"$target_cpu\"" 1>&2; exit 1; } ;;
-esac
-
-
-
-
-
-
-trap '' 1 2 15
-cat > confcache <<\EOF
-# 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. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# 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.
-(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
- if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
-fi
-
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
-DEFS=-DHAVE_CONFIG_H
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
-
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
-# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
-# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
-
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
-do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
-done
-
-ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
-
-trap 'rm -fr `echo "Makefile cygwin.def:cygwin.din config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
-s%@INSTALL_DATA@%$INSTALL_DATA%g
-s%@host@%$host%g
-s%@host_alias@%$host_alias%g
-s%@host_cpu@%$host_cpu%g
-s%@host_vendor@%$host_vendor%g
-s%@host_os@%$host_os%g
-s%@target@%$target%g
-s%@target_alias@%$target_alias%g
-s%@target_cpu@%$target_cpu%g
-s%@target_vendor@%$target_vendor%g
-s%@target_os@%$target_os%g
-s%@build@%$build%g
-s%@build_alias@%$build_alias%g
-s%@build_cpu@%$build_cpu%g
-s%@build_vendor@%$build_vendor%g
-s%@build_os@%$build_os%g
-s%@CC@%$CC%g
-s%@CXX@%$CXX%g
-s%@all_host@%$all_host%g
-s%@install_host@%$install_host%g
-s%@AR@%$AR%g
-s%@AS@%$AS%g
-s%@RANLIB@%$RANLIB%g
-s%@LD@%$LD%g
-s%@NM@%$NM%g
-s%@DLLTOOL@%$DLLTOOL%g
-s%@WINDRES@%$WINDRES%g
-s%@CPP@%$CPP%g
-s%@ALLOCA@%$ALLOCA%g
-s%@SET_MAKE@%$SET_MAKE%g
-s%@MT_SAFE@%$MT_SAFE%g
-s%@EXE_LDFLAGS@%$EXE_LDFLAGS%g
-s%@MALLOC_OFILES@%$MALLOC_OFILES%g
-s%@DLL_ENTRY@%$DLL_ENTRY%g
-s%@DEF_DLL_ENTRY@%$DEF_DLL_ENTRY%g
-s%@CONFIG_DIR@%$CONFIG_DIR%g
-
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
- else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
- fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
- else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
- fi
-done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
-fi
-EOF
-
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"Makefile cygwin.def:cygwin.din"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
- fi
-
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
-
- case "$ac_given_INSTALL" in
- [/$]*) INSTALL="$ac_given_INSTALL" ;;
- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
- esac
-
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
- esac
-
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-s%@INSTALL@%$INSTALL%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
-# NAME is the cpp macro being defined and VALUE is the value it is being given.
-#
-# ac_d sets the value in "#define NAME VALUE" lines.
-ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
-ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
-ac_dC='\3'
-ac_dD='%g'
-# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
-ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_uB='\([ ]\)%\1#\2define\3'
-ac_uC=' '
-ac_uD='\4%g'
-# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_eB='$%\1#\2define\3'
-ac_eC=' '
-ac_eD='%g'
-
-if test "${CONFIG_HEADERS+set}" != set; then
-EOF
-cat >> $CONFIG_STATUS <<EOF
- CONFIG_HEADERS="config.h"
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-fi
-for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- echo creating $ac_file
-
- rm -f conftest.frag conftest.in conftest.out
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- cat $ac_file_inputs > conftest.in
-
-EOF
-
-# Transform confdefs.h into a sed script conftest.vals that substitutes
-# the proper values into config.h.in to produce config.h. And first:
-# Protect against being on the right side of a sed subst in config.status.
-# Protect against being in an unquoted here document in config.status.
-rm -f conftest.vals
-cat > conftest.hdr <<\EOF
-s/[\\&%]/\\&/g
-s%[\\$`]%\\&%g
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
-s%ac_d%ac_u%gp
-s%ac_u%ac_e%gp
-EOF
-sed -n -f conftest.hdr confdefs.h > conftest.vals
-rm -f conftest.hdr
-
-# This sed command replaces #undef with comments. This is necessary, for
-# example, in the case of _POSIX_SOURCE, which is predefined and required
-# on some systems where configure will not decide to define it.
-cat >> conftest.vals <<\EOF
-s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
-EOF
-
-# Break up conftest.vals because some shells have a limit on
-# the size of here documents, and old seds have small limits too.
-
-rm -f conftest.tail
-while :
-do
- ac_lines=`grep -c . conftest.vals`
- # grep -c gives empty output for an empty file on some AIX systems.
- if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
- # Write a limited-size here document to conftest.frag.
- echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
- sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
- echo 'CEOF
- sed -f conftest.frag conftest.in > conftest.out
- rm -f conftest.in
- mv conftest.out conftest.in
-' >> $CONFIG_STATUS
- sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
- rm -f conftest.vals
- mv conftest.tail conftest.vals
-done
-rm -f conftest.vals
-
-cat >> $CONFIG_STATUS <<\EOF
- rm -f conftest.frag conftest.h
- echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
- cat conftest.in >> conftest.h
- rm -f conftest.in
- if cmp -s $ac_file conftest.h 2>/dev/null; then
- echo "$ac_file is unchanged"
- rm -f conftest.h
- else
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- fi
- rm -f $ac_file
- mv conftest.h $ac_file
- fi
-fi; done
-
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
-
diff --git a/winsup/cygwin/configure.in b/winsup/cygwin/configure.in
deleted file mode 100644
index 3934992a7..000000000
--- a/winsup/cygwin/configure.in
+++ /dev/null
@@ -1,257 +0,0 @@
-dnl Autoconf configure script for Cygwin.
-dnl Copyright 1996, 1997, 1998, 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
-dnl Process this file with autoconf to produce a configure script.
-
-AC_PREREQ(2.12)dnl
-AC_INIT(init.cc)
-AC_CONFIG_HEADER(config.h)
-
-AC_PROG_INSTALL
-
-dnl FIXME: We temporarily define our own version of AC_PROG_CC. This is
-dnl copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
-dnl are probably using a cross compiler, which will not be able to fully
-dnl link an executable. This should really be fixed in autoconf
-dnl itself.
-
-AC_DEFUN(LIB_AC_PROG_CC,
-[AC_BEFORE([$0], [AC_PROG_CPP])dnl
-AC_CHECK_TOOL(CC, gcc, gcc)
-if test -z "$CC"; then
- AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
- test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
-fi
-
-AC_PROG_CC_GNU
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-dnl Check whether -g works, even if CFLAGS is set, in case the package
-dnl plays around with CFLAGS (such as to build both debugging and
-dnl normal versions of a library), tasteless as that idea is.
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- AC_PROG_CC_G
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
- CFLAGS="-gstabs+ -O2"
- else
- CFLAGS="-O2"
- fi
-else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
-fi
-])
-
-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_PROG(CXX, c++, c++, , , )
- test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
-fi
-
-CXXFLAGS='$(CFLAGS)'
-])
-
-AC_CANONICAL_SYSTEM
-
-LIB_AC_PROG_CC
-LIB_AC_PROG_CXX
-
-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)
-dnl AC_SUBST(AR)
-AC_CHECK_TOOL(AS, as, as)
-dnl C_SUBST(AS)
-AC_CHECK_TOOL(RANLIB, ranlib, ranlib)
-dnl C_SUBST(RANLIB)
-AC_CHECK_TOOL(LD, ld, ld)
-dnl C_SUBST(LD)
-AC_CHECK_TOOL(NM, nm, nm)
-dnl C_SUBST(NM)
-AC_CHECK_TOOL(DLLTOOL, dlltool, dlltool)
-dnl C_SUBST(DLLTOOL)
-AC_CHECK_TOOL(WINDRES, windres, windres)
-dnl C_SUBST(WINDRES)
-
-AC_ALLOCA
-AC_PROG_MAKE_SET
-
-dnl check whether gcc supports __builtin_memset.
-# Test for builtin mem* functions.
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
-AC_TRY_COMPILE([
-#include <string.h>
-void foo(char *s, int c, size_t n)
-{
- __builtin_memset(s, c, n);
-}
-], [ ],
-use_builtin_memset=yes, use_builtin_memset=no)
-if test $use_builtin_memset = "yes"; then
- AC_DEFINE(HAVE_BUILTIN_MEMSET)
-fi
-AC_LANG_RESTORE
-
-dnl set default mt safeness and then process the options.
-mt_safe_val=1
-MT_SAFE=yes
-
-AC_ARG_ENABLE(threadsafe,
-[ --enable-threadsafe=[runtime] Build a cygwin DLL which is thread safe],
-[case "${enableval}" in
-yes)
- dnl default.
- ;;
-runtime)
- mt_safe_val=2
- MT_SAFE=yes
- ;;
-no)
- mt_safe_val=0
- MT_SAFE=no
- ;;
-esac
-])
-
-AC_ARG_ENABLE(extra-threadsafe-checking,
-[ --enable-extra-threadsafe-checking Build a cygwin DLL which is thread safe with extra consistency checking],
-[case "${enableval}" in
-yes)
- mt_safe_val=1
- MT_SAFE=yes
- AC_DEFINE(_CYG_THREAD_FAILSAFE)
- ;;
-no)
- dnl Don't do anything here to avoid overriding --enable-threadsafe.
- ;;
-esac
-])
-
-if test "$MT_SAFE" = "yes"; then
- AC_DEFINE_UNQUOTED(_MT_SAFE,$mt_safe_val)
-fi
-
-dnl Makefile uses MT_SAFE, so we subst as well as defining it.
-AC_SUBST(MT_SAFE)
-
-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
-])
-
-MALLOC_OFILES=
-AC_ARG_ENABLE(malloc-debugging,
-[ --enable-malloc-debugging Build a cygwin DLL with heap sanity checking (this is very slow, use only if you have heap corruption problems)],
-[case "${enableval}" in
-yes) AC_DEFINE(MALLOC_DEBUG)
- MALLOC_OFILES=dlmalloc.o
- ;;
-no) ;;
-esac
-])
-
-AC_ARG_ENABLE(vfork,
-[ --enable-vfork Build a cygwin DLL which uses experimental vfork code],
-vfork="${enableval}"
-])
-
-case "$vfork" in
-no) ;;
-yes|*) AC_DEFINE_UNQUOTED(NEWVFORK) ;;
-esac
-
-dnl The only time we might want to transform the install names
-dnl is for unix x cygwin. Otherwise we don't. For now we don't
-dnl transform names.
-
-dnl if test "x$cross_compiling" = "xno" -a ; then
-dnl if test "x$program_transform_name" = "xs,x,x,"; then
-dnl program_transform_name=""
-dnl fi
-dnl if test "x$program_transform_name" = "x"; then
-dnl program_transform_name="s,^,$target_alias-,"
-dnl else
-dnl program_transform_name="$program_transform_name -e s,^,$target_alias-,"
-dnl fi
-dnl fi
-
-dnl
-dnl If newlib is part of build tree, always set EXE_LDFLAGS to point to
-dnl it; this is important in cases where the installed newlib is perhaps
-dnl not compatible. Check and warn for installed newlib only if it's not
-dnl part of the build tree.
-dnl
-
-AC_MSG_CHECKING([if newlib is part of the build tree])
-
-EXE_LDFLAGS=
-if test -d ../newlib
-then
- AC_MSG_RESULT(yes)
- EXE_LDFLAGS="-B../../newlib/ -B../"
-else
- AC_MSG_RESULT(no)
-fi
- AC_SUBST(EXE_LDFLAGS)
-
-if test x"$EXE_LDFLAGS" = x
-then
- AC_MSG_CHECKING([if installed newlib needed])
- AC_TRY_LINK(,
- [/* main already defined */]
- ,
- AC_MSG_RESULT(no)
- ,
- AC_MSG_RESULT(yes)
- AC_MSG_WARN(newlib not found - utility .exe's may not link))
-fi
-AC_SUBST(EXE_LDFLAGS)
-
-case "$target_cpu" in
- i386|i486|i586|i686) DLL_ENTRY="_dll_entry@12"
- DEF_DLL_ENTRY="dll_entry@12"
- ALLOCA="_alloca"
- CONFIG_DIR="i386" ;;
- powerpc*) DLL_ENTRY="dll_entry"
- DEF_DLL_ENTRY="dll_entry"
- ALLOCA=" __allocate_stack"
- CONFIG_DIR="ppc" ;;
- *) AC_MSG_ERROR(Invalid target processor \"$target_cpu\") ;;
-esac
-
-AC_SUBST(MALLOC_OFILES)
-AC_SUBST(DLL_ENTRY)
-AC_SUBST(DEF_DLL_ENTRY)
-AC_SUBST(ALLOCA)
-AC_SUBST(CONFIG_DIR)
-AC_OUTPUT(Makefile cygwin.def:cygwin.din)
-
diff --git a/winsup/cygwin/cygerrno.h b/winsup/cygwin/cygerrno.h
deleted file mode 100644
index 0c1513f25..000000000
--- a/winsup/cygwin/cygerrno.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* cygerrno.h: main Cygwin header file.
-
- Copyright 2000 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. */
-
-void __stdcall seterrno_from_win_error (const char *file, int line, DWORD code) __attribute__ ((regparm(3)));
-void __stdcall seterrno (const char *, int line) __attribute__ ((regparm(2)));
-int __stdcall geterrno_from_win_error (DWORD code, int deferrno) __attribute__ ((regparm(2)));
-
-#define __seterrno() seterrno (__FILE__, __LINE__)
-#define __seterrno_from_win_error(val) seterrno_from_win_error (__FILE__, __LINE__, val)
-
-#ifndef DEBUGGING
-#define set_errno(val) (_impure_ptr->_errno = (val))
-#else
-int __stdcall __set_errno (const char *ln, int ln, int val) __attribute ((regparm(3)));
-#define set_errno(val) __set_errno (__PRETTY_FUNCTION__, __LINE__, (val))
-#endif
-#define get_errno() (_impure_ptr->_errno)
-extern "C" void __stdcall set_sig_errno (int e);
-
-class save_errno
- {
- int saved;
- public:
- save_errno () {saved = get_errno ();}
- save_errno (int what) {saved = get_errno (); set_errno (what); }
- void set (int what) {set_errno (what); saved = what;}
- void reset () {saved = get_errno ();}
- ~save_errno () {set_errno (saved);}
- };
-
-extern const char *__sp_fn;
-extern int __sp_ln;
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
deleted file mode 100644
index 723fde2ff..000000000
--- a/winsup/cygwin/cygheap.cc
+++ /dev/null
@@ -1,498 +0,0 @@
-/* cygheap.cc: Cygwin heap manager.
-
- Copyright 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. */
-
-#include "winsup.h"
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-#include <stdlib.h>
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygerrno.h"
-#include "cygheap.h"
-#include "child_info.h"
-#include "heap.h"
-#include "sync.h"
-#include "shared_info.h"
-
-init_cygheap NO_COPY *cygheap;
-void NO_COPY *cygheap_max = NULL;
-
-static NO_COPY muto *cygheap_protect = NULL;
-
-struct cygheap_entry
- {
- int type;
- struct cygheap_entry *next;
- char data[0];
- };
-
-#define NBUCKETS (sizeof (cygheap->buckets) / sizeof (cygheap->buckets[0]))
-#define N0 ((_cmalloc_entry *) NULL)
-#define to_cmalloc(s) ((_cmalloc_entry *) (((char *) (s)) - (int) (N0->data)))
-
-#define CFMAP_OPTIONS (SEC_RESERVE | PAGE_READWRITE)
-#define MVMAP_OPTIONS (FILE_MAP_WRITE)
-
-extern "C" {
-static void __stdcall _cfree (void *ptr) __attribute__((regparm(1)));
-extern void *_cygheap_start;
-}
-
-inline static void
-init_cheap ()
-{
- cygheap = (init_cygheap *) VirtualAlloc ((void *) &_cygheap_start, CYGHEAPSIZE, MEM_RESERVE, PAGE_NOACCESS);
- if (!cygheap)
- {
- MEMORY_BASIC_INFORMATION m;
- if (!VirtualQuery ((LPCVOID) &_cygheap_start, &m, sizeof m))
- system_printf ("couldn't get memory info, %E");
- small_printf ("AllocationBase %p, BaseAddress %p, RegionSize %p, State %p\n",
- m.AllocationBase, m.BaseAddress, m.RegionSize, m.State);
- api_fatal ("Couldn't reserve space for cygwin's heap, %E");
- }
- cygheap_max = cygheap + 1;
-}
-
-static void dup_now (void *, child_info *, unsigned) __attribute__ ((regparm(3)));
-static void
-dup_now (void *newcygheap, child_info *ci, unsigned n)
-{
- if (!VirtualAlloc (newcygheap, n, MEM_COMMIT, PAGE_READWRITE))
- api_fatal ("couldn't allocate new cygwin heap for child, %E");
- memcpy (newcygheap, cygheap, n);
-}
-
-void *__stdcall
-cygheap_setup_for_child (child_info *ci, bool dup_later)
-{
- void *newcygheap;
- cygheap_protect->acquire ();
- unsigned n = (char *) cygheap_max - (char *) cygheap;
- ci->cygheap_h = CreateFileMapping (INVALID_HANDLE_VALUE, &sec_none,
- CFMAP_OPTIONS, 0, CYGHEAPSIZE, NULL);
- newcygheap = MapViewOfFileEx (ci->cygheap_h, MVMAP_OPTIONS, 0, 0, 0, NULL);
- ProtectHandle1 (ci->cygheap_h, passed_cygheap_h);
- if (!dup_later)
- dup_now (newcygheap, ci, n);
- cygheap_protect->release ();
- ci->cygheap = cygheap;
- ci->cygheap_max = cygheap_max;
- return newcygheap;
-}
-
-void __stdcall
-cygheap_setup_for_child_cleanup (void *newcygheap, child_info *ci,
- bool dup_it_now)
-{
- if (dup_it_now)
- {
- /* NOTE: There is an assumption here that cygheap_max has not changed
- between the time that cygheap_setup_for_child was called and now.
- Make sure that this is a correct assumption. */
- cygheap_protect->acquire ();
- dup_now (newcygheap, ci, (char *) cygheap_max - (char *) cygheap);
- cygheap_protect->release ();
- }
- UnmapViewOfFile (newcygheap);
- ForceCloseHandle1 (ci->cygheap_h, passed_cygheap_h);
-}
-
-/* Called by fork or spawn to reallocate cygwin heap */
-void __stdcall
-cygheap_fixup_in_child (child_info *ci, bool execed)
-{
- cygheap = ci->cygheap;
- cygheap_max = ci->cygheap_max;
- void *addr = !wincap.map_view_of_file_ex_sucks () ? cygheap : NULL;
- void *newaddr;
-
- newaddr = MapViewOfFileEx (ci->cygheap_h, MVMAP_OPTIONS, 0, 0, 0, addr);
- if (newaddr != cygheap)
- {
- if (!newaddr)
- newaddr = MapViewOfFileEx (ci->cygheap_h, MVMAP_OPTIONS, 0, 0, 0, NULL);
- DWORD n = (DWORD) cygheap_max - (DWORD) cygheap;
- /* Reserve cygwin heap in same spot as parent */
- if (!VirtualAlloc (cygheap, CYGHEAPSIZE, MEM_RESERVE, PAGE_NOACCESS))
- {
- MEMORY_BASIC_INFORMATION m;
- memset (&m, 0, sizeof m);
- if (!VirtualQuery ((LPCVOID) cygheap, &m, sizeof m))
- system_printf ("couldn't get memory info, %E");
-
- small_printf ("m.AllocationBase %p, m.BaseAddress %p, m.RegionSize %p, m.State %p\n",
- m.AllocationBase, m.BaseAddress, m.RegionSize, m.State);
- api_fatal ("Couldn't reserve space for cygwin's heap (%p <%p>) in child, %E", cygheap, newaddr);
- }
-
- /* Allocate same amount of memory as parent */
- if (!VirtualAlloc (cygheap, n, MEM_COMMIT, PAGE_READWRITE))
- api_fatal ("Couldn't allocate space for child's heap %p, size %d, %E",
- cygheap, n);
- memcpy (cygheap, newaddr, n);
- UnmapViewOfFile (newaddr);
- }
-
- ForceCloseHandle1 (ci->cygheap_h, passed_cygheap_h);
-
- cygheap_init ();
-
- if (execed)
- {
- cygheap->heapbase = NULL; /* We can allocate the heap anywhere */
- /* Walk the allocated memory chain looking for orphaned memory from
- previous execs */
- for (_cmalloc_entry *rvc = cygheap->chain; rvc; rvc = rvc->prev)
- {
- cygheap_entry *ce = (cygheap_entry *) rvc->data;
- if (!rvc->ptr || rvc->b >= NBUCKETS || ce->type <= HEAP_1_START)
- continue;
- else if (ce->type < HEAP_1_MAX)
- ce->type += HEAP_1_MAX; /* Mark for freeing after next exec */
- else
- _cfree (ce); /* Marked by parent for freeing in child */
- }
- }
-}
-
-#define pagetrunc(x) ((void *) (((DWORD) (x)) & ~(4096 - 1)))
-
-static void *__stdcall
-_csbrk (int sbs)
-{
- void *lastheap;
- bool needalloc;
-
- if (cygheap)
- needalloc = 0;
- else
- {
- init_cheap ();
- needalloc = 1;
- }
-
- lastheap = cygheap_max;
- (char *) cygheap_max += sbs;
- void *heapalign = (void *) pagetrunc (lastheap);
-
- if (!needalloc)
- needalloc = sbs && ((heapalign == lastheap) || heapalign != pagetrunc (cygheap_max));
- if (needalloc && !VirtualAlloc (lastheap, (DWORD) sbs ?: 1, MEM_COMMIT, PAGE_READWRITE))
- api_fatal ("couldn't commit memory for cygwin heap, %E");
-
- return lastheap;
-}
-
-extern "C" void __stdcall
-cygheap_init ()
-{
- new_muto (cygheap_protect);
- _csbrk (0);
- if (!cygheap->fdtab)
- cygheap->fdtab.init ();
-}
-
-/* Copyright (C) 1997, 2000 DJ Delorie */
-
-static void *_cmalloc (int size) __attribute ((regparm(1)));
-static void *__stdcall _crealloc (void *ptr, int size) __attribute ((regparm(2)));
-
-static void *__stdcall
-_cmalloc (int size)
-{
- _cmalloc_entry *rvc;
- unsigned b, sz;
-
- /* Calculate "bit bucket" and size as a power of two. */
- for (b = 3, sz = 8; sz && sz < (size + sizeof (_cmalloc_entry));
- b++, sz <<= 1)
- continue;
-
- cygheap_protect->acquire ();
- if (cygheap->buckets[b])
- {
- rvc = (_cmalloc_entry *) cygheap->buckets[b];
- cygheap->buckets[b] = rvc->ptr;
- rvc->b = b;
- }
- else
- {
- size = sz + sizeof (_cmalloc_entry);
- rvc = (_cmalloc_entry *) _csbrk (size);
-
- rvc->b = b;
- rvc->prev = cygheap->chain;
- cygheap->chain = rvc;
- }
- cygheap_protect->release ();
- return rvc->data;
-}
-
-static void __stdcall
-_cfree (void *ptr)
-{
- cygheap_protect->acquire ();
- _cmalloc_entry *rvc = to_cmalloc (ptr);
- DWORD b = rvc->b;
- rvc->ptr = cygheap->buckets[b];
- cygheap->buckets[b] = (char *) rvc;
- cygheap_protect->release ();
-}
-
-static void *__stdcall _crealloc (void *ptr, int size) __attribute__((regparm(2)));
-static void *__stdcall
-_crealloc (void *ptr, int size)
-{
- void *newptr;
- if (ptr == NULL)
- newptr = _cmalloc (size);
- else
- {
- int oldsize = 1 << to_cmalloc (ptr)->b;
- if (size <= oldsize)
- return ptr;
- newptr = _cmalloc (size);
- memcpy (newptr, ptr, oldsize);
- _cfree (ptr);
- }
- return newptr;
-}
-
-/* End Copyright (C) 1997 DJ Delorie */
-
-#define sizeof_cygheap(n) ((n) + sizeof(cygheap_entry))
-
-#define N ((cygheap_entry *) NULL)
-#define tocygheap(s) ((cygheap_entry *) (((char *) (s)) - (int) (N->data)))
-
-inline static void *
-creturn (cygheap_types x, cygheap_entry * c, int len)
-{
- if (!c)
- {
- __seterrno ();
- return NULL;
- }
- c->type = x;
- char *cend = ((char *) c + sizeof (*c) + len);
- if (cygheap_max < cend)
- cygheap_max = cend;
- MALLOC_CHECK;
- return (void *) c->data;
-}
-
-extern "C" void *__stdcall
-cmalloc (cygheap_types x, DWORD n)
-{
- cygheap_entry *c;
- MALLOC_CHECK;
- c = (cygheap_entry *) _cmalloc (sizeof_cygheap (n));
- if (!c)
- system_printf ("cmalloc returned NULL");
- return creturn (x, c, n);
-}
-
-extern "C" void *__stdcall
-crealloc (void *s, DWORD n)
-{
- MALLOC_CHECK;
- if (s == NULL)
- return cmalloc (HEAP_STR, n); // kludge
-
- assert (!inheap (s));
- cygheap_entry *c = tocygheap (s);
- cygheap_types t = (cygheap_types) c->type;
- c = (cygheap_entry *) _crealloc (c, sizeof_cygheap (n));
- if (!c)
- system_printf ("crealloc returned NULL");
- return creturn (t, c, n);
-}
-
-extern "C" void __stdcall
-cfree (void *s)
-{
- assert (!inheap (s));
- (void) _cfree (tocygheap (s));
- MALLOC_CHECK;
-}
-
-extern "C" void *__stdcall
-ccalloc (cygheap_types x, DWORD n, DWORD size)
-{
- cygheap_entry *c;
- MALLOC_CHECK;
- n *= size;
- c = (cygheap_entry *) _cmalloc (sizeof_cygheap (n));
- if (c)
- memset (c->data, 0, n);
- if (!c)
- system_printf ("ccalloc returned NULL");
- return creturn (x, c, n);
-}
-
-extern "C" char *__stdcall
-cstrdup (const char *s)
-{
- MALLOC_CHECK;
- char *p = (char *) cmalloc (HEAP_STR, strlen (s) + 1);
- if (!p)
- return NULL;
- strcpy (p, s);
- MALLOC_CHECK;
- return p;
-}
-
-extern "C" char *__stdcall
-cstrdup1 (const char *s)
-{
- MALLOC_CHECK;
- char *p = (char *) cmalloc (HEAP_1_STR, strlen (s) + 1);
- if (!p)
- return NULL;
- strcpy (p, s);
- MALLOC_CHECK;
- return p;
-}
-
-bool
-init_cygheap::etc_changed ()
-{
- bool res = 0;
-
- if (!etc_changed_h)
- {
- path_conv pwd ("/etc");
- etc_changed_h = FindFirstChangeNotification (pwd, FALSE,
- FILE_NOTIFY_CHANGE_LAST_WRITE);
- if (etc_changed_h == INVALID_HANDLE_VALUE)
- system_printf ("Can't open /etc for checking, %E", (char *) pwd,
- etc_changed_h);
- else if (!DuplicateHandle (hMainProc, etc_changed_h, hMainProc,
- &etc_changed_h, 0, TRUE,
- DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
- {
- system_printf ("Can't inherit /etc handle, %E", (char *) pwd,
- etc_changed_h);
- etc_changed_h = INVALID_HANDLE_VALUE;
- }
- }
-
- if (etc_changed_h != INVALID_HANDLE_VALUE
- && WaitForSingleObject (etc_changed_h, 0) == WAIT_OBJECT_0)
- {
- (void) FindNextChangeNotification (etc_changed_h);
- res = 1;
- }
-
- return res;
-}
-
-void
-cygheap_root::set (const char *posix, const char *native)
-{
- if (*posix == '/' && posix[1] == '\0')
- {
- if (m)
- {
- cfree (m);
- m = NULL;
- }
- return;
- }
- if (!m)
- m = (struct cygheap_root_mount_info *) ccalloc (HEAP_MOUNT, 1, sizeof (*m));
- strcpy (m->posix_path, posix);
- m->posix_pathlen = strlen (posix);
- if (m->posix_pathlen >= 1 && m->posix_path[m->posix_pathlen - 1] == '/')
- m->posix_path[--m->posix_pathlen] = '\0';
-
- strcpy (m->native_path, native);
- m->native_pathlen = strlen (native);
- if (m->native_pathlen >= 1 && m->native_path[m->native_pathlen - 1] == '\\')
- m->native_path[--m->native_pathlen] = '\0';
-}
-
-cygheap_user::~cygheap_user ()
-{
-#if 0
- if (pname)
- cfree (pname);
- if (plogsrv)
- cfree (plogsrv - 2);
- if (pdomain)
- cfree (pdomain);
- if (psid)
- cfree (psid);
-#endif
-}
-
-void
-cygheap_user::set_name (const char *new_name)
-{
- if (pname)
- cfree (pname);
- pname = cstrdup (new_name ? new_name : "");
- homedrive = NULL;
- homepath = NULL;
-}
-
-void
-cygheap_user::set_logsrv (const char *new_logsrv)
-{
- if (plogsrv)
- cfree (plogsrv - 2);
- if (!new_logsrv || !*new_logsrv)
- plogsrv = NULL;
- else
- {
- plogsrv = (char *) cmalloc (HEAP_STR, strlen (new_logsrv) + 3) + 2;
- strcpy (plogsrv, new_logsrv);
- }
-}
-
-void
-cygheap_user::set_domain (const char *new_domain)
-{
- if (pdomain)
- cfree (pdomain);
- pdomain = (new_domain && *new_domain) ? cstrdup (new_domain) : NULL;
-}
-
-BOOL
-cygheap_user::set_sid (PSID new_sid)
-{
- if (!new_sid)
- {
- if (psid)
- cfree (psid);
- if (orig_psid)
- cfree (orig_psid);
- psid = NULL;
- orig_psid = NULL;
- return TRUE;
- }
- else
- {
- if (!psid)
- {
- if (!orig_psid)
- {
- orig_psid = cmalloc (HEAP_STR, MAX_SID_LEN);
- CopySid (MAX_SID_LEN, orig_psid, new_sid);
- }
- psid = cmalloc (HEAP_STR, MAX_SID_LEN);
- }
- return CopySid (MAX_SID_LEN, psid, new_sid);
- }
-}
diff --git a/winsup/cygwin/cygheap.h b/winsup/cygwin/cygheap.h
deleted file mode 100644
index 71c00aca8..000000000
--- a/winsup/cygwin/cygheap.h
+++ /dev/null
@@ -1,292 +0,0 @@
-/* cygheap.h: Cygwin heap manager.
-
- Copyright 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. */
-
-#undef cfree
-
-enum cygheap_types
-{
- HEAP_FHANDLER,
- HEAP_STR,
- HEAP_ARGV,
- HEAP_BUF,
- HEAP_MOUNT,
- HEAP_1_START,
- HEAP_1_STR,
- HEAP_1_ARGV,
- HEAP_1_BUF,
- HEAP_1_EXEC,
- HEAP_1_MAX = 100
-};
-
-#define incygheap(s) (cygheap && ((char *) (s) >= (char *) cygheap) && ((char *) (s) <= ((char *) cygheap_max)))
-
-struct _cmalloc_entry
-{
- union
- {
- DWORD b;
- char *ptr;
- };
- struct _cmalloc_entry *prev;
- char data[0];
-};
-
-struct cygheap_root_mount_info
-{
- char posix_path[MAX_PATH];
- unsigned posix_pathlen;
- char native_path[MAX_PATH];
- unsigned native_pathlen;
-};
-
-/* CGF: FIXME This doesn't belong here */
-
-class cygheap_root
-{
- /* Root directory information.
- This is used after a chroot is called. */
- struct cygheap_root_mount_info *m;
-
-public:
- bool posix_ok (const char *path)
- {
- if (!m)
- return 1;
- return path_prefix_p (m->posix_path, path, m->posix_pathlen);
- }
- bool ischroot_native (const char *path)
- {
- if (!m)
- return 1;
- return strncasematch (m->native_path, path, m->native_pathlen)
- && (path[m->native_pathlen] == '\\' || !path[m->native_pathlen]);
- }
- const char *unchroot (const char *path)
- {
- if (!m)
- return path;
- const char *p = path + m->posix_pathlen;
- if (!*p)
- p = "/";
- return p;
- }
- bool exists () {return !!m;}
- void set (const char *posix, const char *native);
- size_t posix_length () const { return m->posix_pathlen; }
- const char *posix_path () const { return m->posix_path; }
- size_t native_length () const { return m->native_pathlen; }
- const char *native_path () const { return m->native_path; }
-};
-
-enum homebodies
-{
- CH_HOMEDRIVE,
- CH_HOMEPATH,
- CH_HOME
-};
-
-struct passwd;
-class cygheap_user
-{
- /* Extendend user information.
- The information is derived from the internal_getlogin call
- when on a NT system. */
- char *pname; /* user's name */
- char *plogsrv; /* Logon server, may be FQDN */
- char *pdomain; /* Logon domain of the user */
- char *homedrive; /* User's home drive */
- char *homepath; /* User's home path */
- PSID psid; /* buffer for user's SID */
- PSID orig_psid; /* Remains intact even after impersonation */
-public:
- __uid32_t orig_uid; /* Remains intact even after impersonation */
- __gid32_t orig_gid; /* Ditto */
- __uid32_t real_uid; /* Remains intact on seteuid, replaced by setuid */
- __gid32_t real_gid; /* Ditto */
-
- /* token is needed if set(e)uid should be called. It can be set by a call
- to `set_impersonation_token()'. */
- HANDLE token;
- BOOL impersonated;
-
- cygheap_user () : pname (NULL), plogsrv (NULL), pdomain (NULL),
- homedrive (NULL), homepath (NULL),
- psid (NULL), token (INVALID_HANDLE_VALUE) {}
- ~cygheap_user ();
-
- void set_name (const char *new_name);
- const char *name () const { return pname; }
-
- void set_logsrv (const char *new_logsrv);
- const char *logsrv () const { return plogsrv; }
-
- const char *env_logsrv ();
- const char *env_homepath ();
- const char *env_homedrive ();
- const char *env_userprofile ();
-
- void set_domain (const char *new_domain);
- const char *domain () const { return pdomain; }
-
- BOOL set_sid (PSID new_sid);
- PSID sid () const { return psid; }
- PSID orig_sid () const { return orig_psid; }
-
- void operator =(cygheap_user &user)
- {
- set_name (user.name ());
- set_logsrv (user.logsrv ());
- set_domain (user.domain ());
- set_sid (user.sid ());
- }
- const char *ontherange (homebodies what, struct passwd * = NULL);
-};
-
-/* cwd cache stuff. */
-
-class muto;
-
-struct cwdstuff
-{
- char *posix;
- char *win32;
- DWORD hash;
- muto *cwd_lock;
- char *get (char *buf, int need_posix = 1, int with_chroot = 0, unsigned ulen = MAX_PATH);
- DWORD get_hash ();
- void init ();
- void fixup_after_exec (char *win32, char *posix, DWORD hash);
- bool get_initial ();
- void set (const char *win32_cwd, const char *posix_cwd = NULL);
-};
-
-struct init_cygheap
-{
- _cmalloc_entry *chain;
- char *buckets[32];
- struct /* User heap stuff. */
- {
- void *heapbase;
- void *heapptr;
- void *heaptop;
- };
- cygheap_root root;
- cygheap_user user;
- mode_t umask;
- HANDLE shared_h;
- HANDLE console_h;
- HANDLE etc_changed_h;
- char *cygwin_regname;
- cwdstuff cwd;
- dtable fdtab;
-
- bool etc_changed ();
-};
-
-#define CYGHEAPSIZE (sizeof (init_cygheap) + (4000 * sizeof (fhandler_union)) + (2 * 65536))
-
-extern init_cygheap *cygheap;
-extern void *cygheap_max;
-
-class cygheap_fdmanip
-{
- protected:
- int fd;
- fhandler_base **fh;
- bool locked;
- public:
- cygheap_fdmanip (): fh (NULL) {}
- virtual ~cygheap_fdmanip ()
- {
- if (locked)
- ReleaseResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "cygheap_fdmanip");
- }
- void release ()
- {
- cygheap->fdtab.release (fd);
- }
- operator int &() {return fd;}
- operator fhandler_base* &() {return *fh;}
- void operator = (fhandler_base *fh) {*this->fh = fh;}
- fhandler_base *operator -> () const {return *fh;}
- bool isopen () const
- {
- if (*fh)
- return true;
- set_errno (EBADF);
- return false;
- }
-};
-
-class cygheap_fdnew : public cygheap_fdmanip
-{
- public:
- cygheap_fdnew (int seed_fd = -1, bool lockit = true)
- {
- if (lockit)
- SetResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "cygheap_fdnew");
- if (seed_fd < 0)
- fd = cygheap->fdtab.find_unused_handle ();
- else
- fd = cygheap->fdtab.find_unused_handle (seed_fd + 1);
- if (fd >= 0)
- {
- locked = lockit;
- fh = cygheap->fdtab + fd;
- }
- else
- {
- set_errno (EMFILE);
- if (lockit)
- ReleaseResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "cygheap_fdnew");
- locked = false;
- }
- }
- void operator = (fhandler_base *fh) {*this->fh = fh;}
-};
-
-class cygheap_fdget : public cygheap_fdmanip
-{
- public:
- cygheap_fdget (int fd, bool lockit = false, bool do_set_errno = true)
- {
- if (lockit)
- SetResourceLock (LOCK_FD_LIST, READ_LOCK, "cygheap_fdget");
- if (fd >= 0 && fd < (int) cygheap->fdtab.size
- && *(fh = cygheap->fdtab + fd) != NULL)
- {
- this->fd = fd;
- locked = lockit;
- }
- else
- {
- this->fd = -1;
- if (do_set_errno)
- set_errno (EBADF);
- if (lockit)
- ReleaseResourceLock (LOCK_FD_LIST, READ_LOCK, "cygheap_fdget");
- locked = false;
- }
- }
-};
-
-class child_info;
-void *__stdcall cygheap_setup_for_child (child_info *ci, bool dup_later) __attribute__ ((regparm(2)));
-void __stdcall cygheap_setup_for_child_cleanup (void *, child_info *, bool) __attribute__ ((regparm(3)));
-void __stdcall cygheap_fixup_in_child (child_info *, bool);
-extern "C" {
-void __stdcall cfree (void *) __attribute__ ((regparm(1)));
-void *__stdcall cmalloc (cygheap_types, DWORD) __attribute__ ((regparm(2)));
-void *__stdcall crealloc (void *, DWORD) __attribute__ ((regparm(2)));
-void *__stdcall ccalloc (cygheap_types, DWORD, DWORD) __attribute__ ((regparm(3)));
-char *__stdcall cstrdup (const char *) __attribute__ ((regparm(1)));
-char *__stdcall cstrdup1 (const char *) __attribute__ ((regparm(1)));
-void __stdcall cygheap_init ();
-}
diff --git a/winsup/cygwin/cygmagic b/winsup/cygwin/cygmagic
deleted file mode 100755
index 387593878..000000000
--- a/winsup/cygwin/cygmagic
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-# cygmagic - Generate "magic numbers" from a structure.
-#
-# Copyright 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.
-
-file_magic=$1; shift
-gcc=$1; shift
-file=$1; shift
-trap "rm -f /tmp/$$.magic" 0 1 2 15
-cat <<EOF > $file_magic
-/* autogenerated - do not edit */
-#include "$file"
-EOF
-if sum -r /dev/null >/dev/null 2>&1; then
- sumit(){ sum -r $*; }
-else
- sumit(){ sum $*; }
-fi
-
-while [ -n "$1" ]; do
- define=$1; shift
- struct=$1; shift
- sum=`$gcc -E $file | sed -n "/^$struct/,/^};/p" | sed -e 's/[ ]//g' -e '/^$/d' | sumit | awk '{printf "0x%x", $1}'`
- echo "#define $define $sum"
- curr=`sed -n "s/^#[ ]*define CURR_$define[ ][ ]*\([^ ][^ ]*\)/\1/p" $file`
- [ "$curr" != "$sum" ] && echo "*** WARNING WARNING WARNING WARNING WARNING ***
-*** $file: magic number for $define changed old $curr != new $sum
-*** WARNING WARNING WARNING WARNING WARNING ***" 1>&2
-done >> $file_magic
-exit 0
diff --git a/winsup/cygwin/cygrun.c b/winsup/cygwin/cygrun.c
deleted file mode 100644
index 6380bf818..000000000
--- a/winsup/cygwin/cygrun.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* cygrun.c: testsuite support program
-
- Copyright 1999, 2000, 2001 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 <stdio.h>
-#include <windows.h>
-#include <stdlib.h>
-
-int
-main(int argc, char **argv)
-{
- STARTUPINFO sa;
- PROCESS_INFORMATION pi;
- DWORD ec = 1;
-
- if (argc < 2)
- {
- fprintf(stderr, "Usage: cygrun [program]\n");
- exit (0);
- }
-
- putenv("CYGWIN_TESTING=1");
- SetEnvironmentVariable("CYGWIN_TESTING", "1");
-
- 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);
- return ec;
-}
diff --git a/winsup/cygwin/cygserver.cc b/winsup/cygwin/cygserver.cc
deleted file mode 100755
index af9cee93e..000000000
--- a/winsup/cygwin/cygserver.cc
+++ /dev/null
@@ -1,549 +0,0 @@
-/* cygserver.cc
-
- Copyright 2001, 2002 Red Hat Inc.
-
- Written by Egor Duda <deo@logos-m.ru>
-
- 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 <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <windows.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <signal.h>
-#include <stdlib.h>
-#include "wincap.h"
-#include "cygwin_version.h"
-
-#include "getopt.h"
-
-#include "cygwin/cygserver_transport.h"
-#include "cygwin/cygserver_transport_pipes.h"
-#include "cygwin/cygserver_transport_sockets.h"
-#include "threaded_queue.h"
-#include "cygwin/cygserver_process.h"
-#include "cygwin/cygserver.h"
-#include "cygserver_shm.h"
-
-/* for quieter operation, set to 0 */
-#define DEBUG 0
-#define debug_printf if (DEBUG) printf
-
-GENERIC_MAPPING access_mapping;
-static class transport_layer_base *transport;
-
-DWORD request_count = 0;
-
-BOOL
-setup_privileges ()
-{
- BOOL rc, ret_val;
- HANDLE hToken = NULL;
- TOKEN_PRIVILEGES sPrivileges;
-
- rc = OpenProcessToken (GetCurrentProcess() , TOKEN_ALL_ACCESS , &hToken) ;
- if (!rc)
- {
- printf ("error opening process token (%lu)\n", GetLastError ());
- ret_val = FALSE;
- goto out;
- }
- rc = LookupPrivilegeValue (NULL, SE_DEBUG_NAME, &sPrivileges.Privileges[0].Luid);
- if (!rc)
- {
- printf ("error getting prigilege luid (%lu)\n", 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)
- {
- printf ("error adjusting prigilege level. (%lu)\n", 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))
- {
- printf ("error getting handle(%u) to server (%lu)\n", (unsigned int)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))
- {
- printf ("error getting handle SD (%lu)\n", GetLastError ());
- goto out;
- }
-
- MapGenericMask (&access, &access_mapping);
-
- if (!AccessCheck (sd, from_process_token, access, &access_mapping,
- &ps, &ps_len, &access, &status))
- {
- printf ("error checking access rights (%lu)\n", GetLastError ());
- goto out;
- }
-
- if (!status)
- {
- printf ("access to object denied\n");
- goto out;
- }
-
- if (!DuplicateHandle (from_process, from_handle,
- to_process, to_handle_ptr,
- access, bInheritHandle, 0))
- {
- printf ("error getting handle to client (%lu)\n", GetLastError ());
- goto out;
- }
- debug_printf ("Duplicated %p to %p\n", from_handle, *to_handle_ptr);
-
- ret_val = 0;
-
-out:
- if (local_handle && from_process != GetCurrentProcess ())
- CloseHandle (local_handle);
-
- return (ret_val);
-}
-
-void
-client_request::serve (transport_layer_base *conn, class process_cache *cache)
-{
- printf ("*****************************************\n"
- "A call to the base client_request class has occured\n"
- "This indicates a mismatch in a virtual function definition somewhere\n");
- exit (1);
-}
-
-void
-client_request_attach_tty::serve(transport_layer_base *conn, class process_cache *cache)
-{
- HANDLE from_process_handle = NULL;
- HANDLE to_process_handle = NULL;
- HANDLE token_handle = NULL;
- DWORD rc;
-
- if (header.cb != sizeof (req))
- {
- header.error_code = EINVAL;
- return;
- }
-
- debug_printf ("pid %ld:(%p,%p) -> pid %ld\n", req.master_pid,
- req.from_master, req.to_master,
- req.pid);
-
- debug_printf ("opening process %ld\n", req.master_pid);
- from_process_handle = OpenProcess (PROCESS_DUP_HANDLE, FALSE, req.master_pid);
- debug_printf ("opening process %ld\n", req.pid);
- to_process_handle = OpenProcess (PROCESS_DUP_HANDLE, FALSE, req.pid);
- if (!from_process_handle || !to_process_handle)
- {
- printf ("error opening process (%lu)\n", GetLastError ());
- header.error_code = EACCES;
- goto out;
- }
-
- debug_printf ("Impersonating client\n");
- conn->impersonate_client ();
-
- debug_printf ("about to open thread token\n");
- rc = OpenThreadToken (GetCurrentThread (),
- TOKEN_QUERY,
- TRUE,
- &token_handle);
-
- debug_printf ("opened thread token, rc=%lu\n", rc);
- conn->revert_to_self ();
-
- if (!rc)
- {
- printf ("error opening thread token (%lu)\n", GetLastError ());
- header.error_code = EACCES;
- goto out;
- }
-
- if (check_and_dup_handle (from_process_handle, to_process_handle,
- token_handle,
- GENERIC_READ,
- req.from_master,
- &req.from_master, TRUE) != 0)
- {
- printf ("error duplicating from_master handle (%lu)\n", GetLastError ());
- header.error_code = EACCES;
- goto out;
- }
-
- if (req.to_master)
- {
- if (check_and_dup_handle (from_process_handle, to_process_handle,
- token_handle,
- GENERIC_WRITE,
- req.to_master,
- &req.to_master, TRUE) != 0)
- {
- printf ("error duplicating to_master handle (%lu)\n", GetLastError ());
- header.error_code = EACCES;
- goto out;
- }
- }
-
-#if DEBUG
- printf ("%ld -> %ld(%p,%p)\n", req.master_pid, req.pid,
- req.from_master, req.to_master);
-#endif
-
- header.error_code = 0;
-
-out:
- if (from_process_handle)
- CloseHandle (from_process_handle);
- if (to_process_handle)
- CloseHandle (to_process_handle);
- if (token_handle)
- CloseHandle (token_handle);
-}
-
-void
-client_request_get_version::serve(transport_layer_base *conn, class process_cache *cache)
-{
- if (header.cb != sizeof (version))
- {
- header.error_code = EINVAL;
- return;
- }
- header.error_code = 0;
- 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 *newconn, class process_cache *newcache);
- virtual void process ();
- private:
- char request_buffer [MAX_REQUEST_SIZE];
- transport_layer_base *conn;
- class process_cache *cache;
-};
-
-class server_process_param : public queue_process_param
-{
- public:
- transport_layer_base *transport;
- server_process_param () : queue_process_param (false) {};
-};
-
-class server_request_queue : public threaded_queue
-{
- public:
- class process_cache *cache;
- void process_requests (transport_layer_base *transport);
- virtual void add (transport_layer_base *conn);
-};
-class server_request_queue request_queue;
-
-static DWORD WINAPI
-request_loop (LPVOID LpParam)
-{
- class server_process_param *params = (server_process_param *) LpParam;
- class server_request_queue *queue = (server_request_queue *) params->queue;
- class transport_layer_base * transport = params->transport;
- while (queue->active)
- {
- transport_layer_base * new_conn = transport->accept ();
- /* 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
- */
- if (new_conn && queue->active)
- queue->add (new_conn);
- }
- return 0;
-}
-
-/* TODO: check we are not being asked to service a already serviced transport */
-void
-server_request_queue::process_requests (transport_layer_base *transport)
-{
- class server_process_param *params = new server_process_param;
- params->transport = transport;
- threaded_queue::process_requests (params, request_loop);
-}
-
-void
-client_request_shutdown::serve (transport_layer_base *conn, class process_cache *cache)
-{
- /* FIXME: link upwards, and then this becomes a trivial method call to
- * only shutdown _this queue_
- */
- /* tell the main thread to shutdown */
- request_queue.active=false;
-}
-
-server_request::server_request (transport_layer_base *newconn, class process_cache *newcache)
-{
- conn = newconn;
- cache = newcache;
-}
-
-void
-server_request::process ()
-{
- ssize_t bytes_read, bytes_written;
- struct request_header* req_ptr = (struct request_header*) &request_buffer;
- client_request *req = NULL;
- debug_printf ("about to read\n");
-
- bytes_read = conn->read (request_buffer, sizeof (struct request_header));
- if (bytes_read != sizeof (struct request_header))
- {
- printf ("error reading from connection (%lu)\n", GetLastError ());
- goto out;
- }
- debug_printf ("got header (%ld)\n", bytes_read);
-
- switch (req_ptr->req_id)
- {
- case CYGSERVER_REQUEST_GET_VERSION:
- req = new client_request_get_version (); break;
- case CYGSERVER_REQUEST_ATTACH_TTY:
- req = new client_request_attach_tty (); break;
- case CYGSERVER_REQUEST_SHUTDOWN:
- req = new client_request_shutdown (); break;
- case CYGSERVER_REQUEST_SHM_GET:
- req = new client_request_shm (); break;
- default:
- req = new client_request (CYGSERVER_REQUEST_INVALID, 0);
- req->header.error_code = ENOSYS;
- debug_printf ("Bad client request - returning ENOSYS\n");
- }
-
- if (req->header.cb != req_ptr->cb)
- {
- debug_printf ("Mismatch in request buffer sizes\n");
- goto out;
- }
-
- if (req->header.cb)
- {
-
- bytes_read = conn->read (req->buffer, req->header.cb);
- if (bytes_read != req->header.cb)
- {
- debug_printf ("error reading from connection (%lu)\n", GetLastError ());
- goto out;
- }
- debug_printf ("got body (%ld)\n",bytes_read);
- }
-
- /* this is not allowed to fail. We must return ENOSYS at a minimum to the client */
- req->serve (conn, cache);
-
- if ((bytes_written = conn->write ((char *)&req->header, sizeof (req->header)))
- != sizeof(req->header) || (req->header.cb &&
- (bytes_written = conn->write (req->buffer, req->header.cb)) != req->header.cb))
- {
- req->header.error_code = -1;
- printf ("error writing to connection (%lu)\n", GetLastError ());
- goto out;
- }
-
- debug_printf("Sent reply, size (%ld)\n",bytes_written);
- printf (".");
-
-out:
- conn->close ();
- delete conn;
- if (req)
- delete (req);
-}
-
-void
-server_request_queue::add (transport_layer_base *conn)
-{
- /* safe to not "Try" because workers don't hog this, they wait on the event
- */
- /* every derived ::add must enter the section! */
- EnterCriticalSection (&queuelock);
- if (!running)
- {
- conn->close ();
- delete conn;
- LeaveCriticalSection (&queuelock);
- return;
- }
- queue_request * listrequest = new server_request (conn, cache);
- threaded_queue::add (listrequest);
- LeaveCriticalSection (&queuelock);
-}
-
-void
-handle_signal (int signal)
-{
- /* any signal makes us die :} */
- /* FIXME: link upwards, and then this becomes a trivial method call to
- * only shutdown _this queue_
- */
- /* tell the main thread to shutdown */
- request_queue.active=false;
-}
-
-struct option longopts[] = {
- {"shutdown", no_argument, NULL, 's'},
- {0, no_argument, NULL, 0}
-};
-
-char opts[] = "s";
-
-int
-main (int argc, char **argv)
-{
- int shutdown=0;
- char i;
-
- while ((i = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
- switch (i)
- {
- case 's':
- shutdown = 1;
- break;
- default:
- break;
- /*NOTREACHED*/
- }
-
- wincap.init();
- if (wincap.has_security ())
- setup_privileges ();
- transport = create_server_transport ();
-
- if (shutdown)
- {
- if (!transport->connect())
- {
- printf ("couldn't establish connection with server\n");
- exit (1);
- }
- client_request_shutdown *request =
- new client_request_shutdown ();
- request->send (transport);
- transport->close();
- delete transport;
- delete request;
- exit(0);
- }
-
- char version[200];
- /* Cygwin dll release */
- snprintf (version, 200, "%d.%d.%d(%d.%d/%d/%d)-(%d.%d.%d.%d) %s",
- cygwin_version.dll_major / 1000,
- cygwin_version.dll_major % 1000,
- cygwin_version.dll_minor,
- cygwin_version.api_major,
- cygwin_version.api_minor,
- cygwin_version.shared_data,
- CYGWIN_SERVER_VERSION_MAJOR,
- CYGWIN_SERVER_VERSION_API,
- CYGWIN_SERVER_VERSION_MINOR,
- CYGWIN_SERVER_VERSION_PATCH,
- cygwin_version.mount_registry,
- cygwin_version.dll_build_date);
- setbuf (stdout, NULL);
- printf ("daemon version %s starting up", version);
- if (signal (SIGQUIT, handle_signal) == SIG_ERR)
- {
- printf ("\ncould not install signal handler (%d)- aborting startup\n", errno);
- exit (1);
- }
- printf (".");
- transport->listen ();
- printf (".");
- class process_cache cache (2);
- request_queue.initial_workers = 10;
- request_queue.cache = &cache;
- request_queue.create_workers ();
- printf (".");
- request_queue.process_requests (transport);
- printf (".");
- cache.create_workers ();
- printf (".");
- cache.process_requests ();
- printf (".complete\n");
- /* 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 (1 && request_queue.active)
- {
- sleep (1);
- }
- printf ("\nShutdown request recieved - new requests will be denied\n");
- request_queue.cleanup ();
- printf ("All pending requests processed\n");
- transport->close ();
- printf ("No longer accepting requests - cygwin will operate in daemonless mode\n");
- cache.cleanup ();
- printf ("All outstanding process-cache activities completed\n");
- printf ("daemon shutdown\n");
-}
diff --git a/winsup/cygwin/cygserver_client.cc b/winsup/cygwin/cygserver_client.cc
deleted file mode 100755
index 1df23ad9f..000000000
--- a/winsup/cygwin/cygserver_client.cc
+++ /dev/null
@@ -1,207 +0,0 @@
-/* cygserver_client.cc
-
- Copyright 2001, 2002 Red Hat Inc.
-
- Written by Egor Duda <deo@logos-m.ru>
-
- 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__
-#undef __INSIDE_CYGWIN__
-#else
-#include "winsup.h"
-#endif
-
-#ifndef __INSIDE_CYGWIN__
-#define debug_printf printf
-#define api_fatal printf
-#include <stdio.h>
-#include <windows.h>
-#endif
-#include <sys/socket.h>
-#include <errno.h>
-#include <unistd.h>
-//#include "security.h"
-#include "cygwin/cygserver_transport.h"
-#include "cygwin/cygserver_transport_pipes.h"
-#include "cygwin/cygserver_transport_sockets.h"
-#include "cygwin/cygserver.h"
-
-/* 0 = untested, 1 = running, 2 = dead */
-int cygserver_running=CYGSERVER_UNKNOWN;
-/* on by default during development. For release, we probably want off by default */
-int allow_daemon = TRUE;
-
-client_request_get_version::client_request_get_version () : client_request (CYGSERVER_REQUEST_GET_VERSION, sizeof (version))
-{
- buffer = (char *)&version;
-}
-
-client_request_attach_tty::client_request_attach_tty () : client_request (CYGSERVER_REQUEST_ATTACH_TTY, sizeof (req))
-{
- buffer = (char *)&req;
- req.pid = 0;
- req.master_pid = 0;
- req.from_master = NULL;
- req.to_master = NULL;
-}
-
-client_request_attach_tty::client_request_attach_tty (DWORD npid, DWORD nmaster_pid, HANDLE nfrom_master, HANDLE nto_master) : client_request (CYGSERVER_REQUEST_ATTACH_TTY, sizeof (req))
-{
- buffer = (char *)&req;
- req.pid = npid;
- req.master_pid = nmaster_pid;
- req.from_master = nfrom_master;
- req.to_master = nto_master;
-}
-
-client_request_shutdown::client_request_shutdown () : client_request (CYGSERVER_REQUEST_SHUTDOWN, 0)
-{
- buffer = NULL;
-}
-
-client_request::client_request (cygserver_request_code id, ssize_t buffer_size) : header (id, buffer_size)
-{
-}
-
-client_request::~client_request ()
-{
-}
-
-client_request::operator class request_header ()
-{
- return header;
-}
-
-void
-client_request::send (transport_layer_base *conn)
-{
- if (!conn)
- return;
- debug_printf("this=%p, conn=%p\n",this, conn);
- ssize_t bytes_written, bytes_read;
- debug_printf("header.cb = %ld\n",header.cb);
- if ((bytes_written = conn->write ((char *)&header, sizeof (header)))
- != sizeof(header) || (header.cb &&
- (bytes_written = conn->write (buffer, header.cb)) != header.cb))
- {
- header.error_code = -1;
- debug_printf ("bytes written != request size\n");
- return;
- }
-
- debug_printf("Sent request, size (%ld)\n",bytes_written);
-
- if ((bytes_read = conn->read ((char *)&header, sizeof (header)))
- != sizeof (header) || (header.cb &&
- (bytes_read = conn->read (buffer, header.cb)) != header.cb))
- {
- header.error_code = -1;
- debug_printf("failed reading response \n");
- return;
- }
- debug_printf ("completed ok\n");
-}
-
-/* Oh, BTW: Fix the procedural basis and make this more intuitive. */
-
-int
-cygserver_request (client_request * req)
-{
- class transport_layer_base *transport;
-
- if (!req || allow_daemon != TRUE)
- return -1;
-
- /* dont' retry every request if the server's not there */
- if (cygserver_running==CYGSERVER_DEAD && req->header.req_id != CYGSERVER_REQUEST_GET_VERSION)
- return -1;
-
- transport = create_server_transport ();
-
- /* FIXME: have at most one connection per thread. use TLS to store the details */
- /* logic is:
- * if not tlskey->conn, new conn,
- * then; transport=conn;
- */
- if (!transport->connect ())
- {
- delete transport;
- return -1;
- }
-
- debug_printf ("connected to server %p\n", transport);
-
- req->send(transport);
-
- transport->close ();
-
- delete transport;
-
- return 0;
-}
-
-#if 0
-BOOL
-check_cygserver_available ()
-{
- BOOL ret_val = FALSE;
- HANDLE pipe = CreateFile (pipe_name,
- GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- &sec_all_nih,
- OPEN_EXISTING,
- 0,
- NULL);
- if (pipe != INVALID_HANDLE_VALUE || GetLastError () != ERROR_PIPE_BUSY)
- ret_val = TRUE;
-
- if (pipe && pipe != INVALID_HANDLE_VALUE)
- CloseHandle (pipe);
-
- return (ret_val);
-}
-#endif
-
-void
-cygserver_init ()
-{
- int rc;
- if (allow_daemon != TRUE)
- {
- cygserver_running = CYGSERVER_DEAD;
- return;
- }
-
- if (cygserver_running==CYGSERVER_OK)
- return;
-
- client_request_get_version *req =
- new client_request_get_version ();
-
- rc = cygserver_request (req);
- delete req;
- if (rc < 0)
- cygserver_running = CYGSERVER_DEAD;
- else if (rc > 0)
- api_fatal ("error connecting to cygwin server. error: %d", rc);
- else if (req->version.major != CYGWIN_SERVER_VERSION_MAJOR ||
- req->version.api != CYGWIN_SERVER_VERSION_API ||
- req->version.minor > CYGWIN_SERVER_VERSION_MINOR)
- api_fatal ("incompatible version of cygwin server.\n\
- 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,
- req->version.major,
- req->version.api,
- req->version.minor,
- req->version.patch);
- else
- cygserver_running = CYGSERVER_OK;
-}
diff --git a/winsup/cygwin/cygserver_process.cc b/winsup/cygwin/cygserver_process.cc
deleted file mode 100755
index dd13f37fb..000000000
--- a/winsup/cygwin/cygserver_process.cc
+++ /dev/null
@@ -1,388 +0,0 @@
-/* cygserver_process.cc
-
- Copyright 2001, 2002 Red Hat Inc.
-
- Written by Robert Collins <rbtcollins@hotmail.com>
-
- 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 <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <windows.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include "wincap.h"
-#include <pthread.h>
-#include <threaded_queue.h>
-#include <cygwin/cygserver_process.h>
-
-#define debug_printf if (DEBUG) printf
-#define DEBUG 1
-
-/* the cache structures and classes are designed for one cache per server process.
- * To make multiple process caches, a redesign will be needed
- */
-
-/* process cache */
-process_cache::process_cache (unsigned int num_initial_workers):
-head (NULL)
-{
- /* there can only be one */
- InitializeCriticalSection (&cache_write_access);
- if ((cache_add_trigger = CreateEvent (NULL, FALSE, FALSE, NULL)) == NULL)
- {
- printf ("Failed to create cache add trigger (%lu), terminating\n",
- GetLastError ());
- exit (1);
- }
- initial_workers = num_initial_workers;
-}
-
-process_cache::~process_cache ()
-{
-}
-
-class process *
-process_cache::process (long pid)
-{
- class process *entry = head;
- /* TODO: make this more granular, so a search doesn't involve the write lock */
- EnterCriticalSection (&cache_write_access);
- if (!entry)
- {
- entry = new class process (pid);
- entry->next =
- (class process *) InterlockedExchangePointer (&head, entry);
- PulseEvent (cache_add_trigger);
- }
- else
- {
- while (entry->winpid != pid && entry->next)
- entry = entry->next;
- if (entry->winpid != pid)
- {
- class process *new_entry = new class process (pid);
- new_entry->next =
- (class process *) InterlockedExchangePointer (&entry->next,
- new_entry);
- entry = new_entry;
- PulseEvent (cache_add_trigger);
- }
- }
- LeaveCriticalSection (&cache_write_access);
- return entry;
-}
-
-static DWORD WINAPI
-request_loop (LPVOID LpParam)
-{
- class process_process_param *params = (process_process_param *) LpParam;
- return params->request_loop ();
-}
-
-void
-process_cache::process_requests ()
-{
- class process_process_param *params = new process_process_param;
- threaded_queue::process_requests (params, request_loop);
-}
-
-void
-process_cache::add_task (class process * theprocess)
-{
- /* safe to not "Try" because workers don't hog this, they wait on the event
- */
- /* every derived ::add must enter the section! */
- EnterCriticalSection (&queuelock);
- queue_request *listrequest = new process_cleanup (theprocess);
- threaded_queue::add (listrequest);
- LeaveCriticalSection (&queuelock);
-}
-
-/* NOT fully MT SAFE: must be called by only one thread in a program */
-void
-process_cache::remove_process (class process *theprocess)
-{
- class process *entry = head;
- /* unlink */
- EnterCriticalSection (&cache_write_access);
- if (entry == theprocess)
- {
- entry = (class process *) InterlockedExchangePointer (&head, theprocess->next);
- if (entry != theprocess)
- {
- printf ("Bug encountered, process cache corrupted\n");
- exit (1);
- }
- }
- else
- {
- while (entry->next && entry->next != theprocess)
- entry = entry->next;
- class process *temp = (class process *) InterlockedExchangePointer (&entry->next, theprocess->next);
- if (temp != theprocess)
- {
- printf ("Bug encountered, process cache corrupted\n");
- exit (1);
- }
- }
- LeaveCriticalSection (&cache_write_access);
- /* Process any cleanup tasks */
- add_task (theprocess);
-}
-
-/* copy <= max_copy HANDLEs to dest[], starting at an offset into _our list_ of
- * begin_at. (Ie begin_at = 5, the first copied handle is still written to dest[0]
- * NOTE: Thread safe, but not thread guaranteed - a newly added process may be missed.
- * Who cares - It'll get caught the next time.
- */
-int
-process_cache::handle_snapshot (HANDLE * hdest, class process ** edest,
- ssize_t max_copy, int begin_at)
-{
- /* TODO:? grab a delete-lock, to prevent deletes during this process ? */
- class process *entry = head;
- int count = begin_at;
- /* skip begin_at entries */
- while (entry && count)
- {
- if (entry->exit_code () == STILL_ACTIVE)
- count--;
- entry = entry->next;
- }
- /* hit the end of the list within begin_at entries */
- if (count)
- return 0;
- HANDLE *hto = hdest;
- class process **eto = edest;
- while (entry && count < max_copy)
- {
- /* hack */
- if (entry->exit_code () == STILL_ACTIVE)
- {
- *hto = entry->handle ();
- *eto = entry;
- count++;
- hto++;
- eto++;
- }
- entry = entry->next;
- }
- return count;
-}
-
-/* process's */
-/* global process crit section */
-static CRITICAL_SECTION process_access;
-static pthread_once_t process_init;
-
-void
-do_process_init (void)
-{
- InitializeCriticalSection (&process_access);
- /* we don't have a cache shutdown capability today */
-}
-
-process::process (long pid):
-winpid (pid), next (NULL), cleaning_up (0), head (NULL), _exit_status (STILL_ACTIVE)
-{
- pthread_once (&process_init, do_process_init);
- EnterCriticalSection (&process_access);
- thehandle = OpenProcess (PROCESS_ALL_ACCESS, FALSE, pid);
- if (!thehandle)
- {
- printf ("unable to obtain handle for new cache process %ld\n", pid);
- thehandle = INVALID_HANDLE_VALUE;
- }
- debug_printf ("Got handle %p for new cache process %ld\n", thehandle, pid);
- InitializeCriticalSection (&access);
- LeaveCriticalSection (&process_access);
-}
-
-process::~process ()
-{
- DeleteCriticalSection (&access);
-}
-
-HANDLE
-process::handle ()
-{
-// DWORD exitstate = exit_code ();
-// if (exitstate == STILL_ACTIVE)
- return thehandle;
-
- /* FIXME: call the cleanup list ? */
-
-// CloseHandle (thehandle);
-// debug_printf ("Process id %ld has terminated, attempting to open a new handle\n",
-// winpid);
-// thehandle = OpenProcess (PROCESS_ALL_ACCESS, FALSE, winpid);
-// debug_printf ("Got handle %p when refreshing cache process %ld\n", thehandle, winpid);
-// /* FIXME: what if OpenProcess fails ? */
-// if (thehandle)
-// {
-// _exit_status = STILL_ACTIVE;
-// exit_code ();
-// }
-// else
-// thehandle = INVALID_HANDLE_VALUE;
-// return thehandle;
-}
-
-DWORD process::exit_code ()
-{
- if (_exit_status != STILL_ACTIVE)
- return _exit_status;
- bool
- err = GetExitCodeProcess (thehandle, &_exit_status);
- if (!err)
- {
- debug_printf ("Failed to retrieve exit code (%ld)\n", GetLastError ());
- thehandle = INVALID_HANDLE_VALUE;
- return _exit_status;
- }
- else if (_exit_status == STILL_ACTIVE)
- return _exit_status;
- /* add new cleanup task etc etc ? */
- return _exit_status;
-}
-
-/* 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 ()
-{
- /* Serialize this */
- EnterCriticalSection (&access);
- InterlockedIncrement (&(long)cleaning_up);
- class cleanup_routine *entry = head;
- while (entry)
- {
- class cleanup_routine *temp;
- entry->cleanup (winpid);
- temp = entry->next;
- delete entry;
- entry = temp;
- }
- LeaveCriticalSection (&access);
-}
-
-bool
-process::add_cleanup_routine (class cleanup_routine *new_cleanup)
-{
- if (cleaning_up)
- return false;
- EnterCriticalSection (&access);
- /* check that we didn't block with ::cleanup ()
- * This rigmarole is to get around win9x's glaring missing TryEnterCriticalSection call
- * which would be a whole lot easier
- */
- if (cleaning_up)
- {
- LeaveCriticalSection (&access);
- return false;
- }
- new_cleanup->next = head;
- head = new_cleanup;
- LeaveCriticalSection (&access);
- return true;
-}
-
-/* process_cleanup */
-void
-process_cleanup::process ()
-{
- theprocess->cleanup ();
- delete theprocess;
-}
-
-/* process_process_param */
-DWORD
-process_process_param::request_loop ()
-{
- process_cache *cache = (process_cache *) queue;
- /* always malloc one, so there is no special case in the loop */
- ssize_t HandlesSize = 2;
- HANDLE *Handles = (HANDLE *) malloc (sizeof (HANDLE) * HandlesSize);
- process **Entries = (process **) malloc (sizeof (LPVOID) * HandlesSize);
- /* TODO: put [1] at the end as it will also get done if a process dies? */
- Handles[0] = interrupt;
- Handles[1] = cache->cache_add_trigger;
- while (cache->active && !shutdown)
- {
- int copied;
- copied = -1;
- int offset;
- offset = 1;
- int count;
- count = 2;
- while ((copied == HandlesSize - 2 - offset) || copied < 0)
- {
- /* we need more storage to cope with all the HANDLES */
- if (copied == HandlesSize - 2 - offset)
- {
- HANDLE *temp = (HANDLE *) realloc (Handles,
- sizeof (HANDLE) *
- HandlesSize + 10);
- if (!temp)
- {
- printf
- ("cannot allocate more storage for the handle array!\n");
- exit (1);
- }
- Handles = temp;
- process **ptemp = (process **) realloc (Entries,
- sizeof (LPVOID) *
- HandlesSize + 10);
- if (!ptemp)
- {
- printf
- ("cannot allocate more storage for the handle array!\n");
- exit (1);
- }
- Entries = ptemp;
- HandlesSize += 10;
- }
- offset += copied;
- copied =
- cache->handle_snapshot (&Handles[2], &Entries[2],
- HandlesSize - 2 - offset, offset);
- count += copied;
- }
- debug_printf ("waiting on %u objects\n", count);
- DWORD rc = WaitForMultipleObjects (count, Handles, FALSE, INFINITE);
- if (rc == WAIT_FAILED)
- {
- printf ("Could not wait on the process handles (%ld)!\n",
- GetLastError ());
- exit (1);
- }
- int objindex = rc - WAIT_OBJECT_0;
- if (objindex > 1 && objindex < count)
- {
- debug_printf ("Process %ld has left the building\n",
- Entries[objindex]->winpid);
- /* fire off the termination routines */
- cache->remove_process (Entries[objindex]);
- }
- else if (objindex >= 0 && objindex < 2)
- {
- /* 0 is shutdown - do nothing */
- /* 1 is a cache add event - just rebuild the object list */
- }
- else
- {
- printf
- ("unexpected return code from WaitForMultiple objects in process_process_param::request_loop\n");
- }
- }
- running = false;
- return 0;
-}
diff --git a/winsup/cygwin/cygserver_shm.cc b/winsup/cygwin/cygserver_shm.cc
deleted file mode 100755
index 1116bc809..000000000
--- a/winsup/cygwin/cygserver_shm.cc
+++ /dev/null
@@ -1,665 +0,0 @@
-/* cygserver_shm.cc: Single unix specification IPC interface for Cygwin
-
-Copyright 2001, 2002 Red Hat, Inc.
-
-Originally written by Robert Collins <robert.collins@hotmail.com>
-
-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__
-#undef __INSIDE_CYGWIN__
-#else
-#include "winsup.h"
-#endif
-
-#ifndef __INSIDE_CYGWIN__
-#define DEBUG 0
-#define system_printf printf
-#define debug_printf if (DEBUG) printf
-#define api_fatal printf
-#include <stdio.h>
-#include <windows.h>
-#endif
-
-#include <sys/stat.h>
-#include <errno.h>
-#include "cygerrno.h"
-#include <unistd.h>
-#include "security.h"
-//#include "fhandler.h"
-//#include "dtable.h"
-//#include "cygheap.h"
-#include <stdio.h>
-//#include "thread.h"
-#ifndef __INSIDE_CYGWIN__
-#define __INSIDE_CYGWIN__
-#include <sys/shm.h>
-#undef __INSIDE_CYGWIN__
-#else
-#include <sys/shm.h>
-#endif
-//#include "perprocess.h"
-#include <threaded_queue.h>
-#include <cygwin/cygserver_process.h>
-#include "cygserver_shm.h"
-
-// FIXME IS THIS CORRECT
-/* Implementation notes: We use two shared memory regions per key:
- * One for the control structure, and one for the shared memory.
- * While this has a higher overhead tham a single shared area,
- * It allows more flexability. As the entire code is transparent to the user
- * We can merge these in the future should it be needed.
- * Also, IPC_PRIVATE keys create unique mappings each time. The shm_ids just
- * keep monotonically incrementing - system wide.
- */
-size_t
-getsystemallocgranularity ()
-{
- SYSTEM_INFO sysinfo;
- static size_t buffer_offset = 0;
- if (buffer_offset)
- return buffer_offset;
- GetSystemInfo (&sysinfo);
- buffer_offset = sysinfo.dwAllocationGranularity;
- return buffer_offset;
-}
-
-
-client_request_shm::client_request_shm ():client_request (CYGSERVER_REQUEST_SHM_GET,
- sizeof (parameters))
-{
- buffer = (char *) &parameters;
-}
-
-/* FIXME: If building on a 64-bit compiler, the address->int typecast will fail.
- * Solution: manually calculate the next id value
- */
-
-#if 0
-extern
-"C" void *
-shmat (int shmid, const void *shmaddr, int parameters.in.shmflg)
-{
- class shmid_ds *
- shm = (class shmid_ds *)
- shmid; //FIXME: verifyable object test
-
- if (shmaddr)
- {
- //FIXME: requested base address ?!
- set_errno (EINVAL);
- return (void *) -1;
- }
-
- void *
- rv =
- MapViewOfFile (shm->attachmap,
-
-
- (parameters.in.shmflg & SHM_RDONLY) ?
- FILE_MAP_READ : FILE_MAP_WRITE, 0,
- 0, 0);
-
- if (!rv)
- {
- //FIXME: translate GetLastError()
- set_errno (EACCES);
- return (void *) -1;
- }
-
-/* FIXME: this needs to be globally protected to prevent a mismatch betwen
- * attach count and attachees list
- */
-
- InterlockedIncrement (&shm->shm_nattch);
- _shmattach *
- attachnode =
- new
- _shmattach;
-
- attachnode->data = rv;
- attachnode->next =
- (_shmattach *) InterlockedExchangePointer ((LONG *) & shm->attachhead,
- (long int) attachnode);
- return rv;
-}
-#endif
-
-/* FIXME: evaluate getuid() and getgid() against the requested mode. Then
- * choose PAGE_READWRITE | PAGE_READONLY and FILE_MAP_WRITE | FILE_MAP_READ
- * appropriately
- */
-
-/* Test result from openbsd: shm ids are persistent cross process if a handle is left
- * open. This could lead to resource starvation: we're not copying that behaviour
- * unless we have to. (It will involve acygwin1.dll gloal shared list :[ ).
- */
-/* FIXME: shmid should be a verifyable object
- */
-
-/* FIXME: on NT we should check everything against the SD. On 95 we just emulate.
- */
-
-extern GENERIC_MAPPING
- access_mapping;
-
-extern 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);
-
-//FIXME: where should this live
-static shmnode *
- shm_head =
- NULL;
-//FIXME: ditto.
-static shmnode *
- deleted_head = NULL;
-/* must be long for InterlockedIncrement */
-static long
- new_id =
- 0;
-static long
- new_private_key =
- 0;
-
-static void
-delete_shmnode (shmnode **nodeptr)
-{
- shmnode *node = *nodeptr;
-
- // remove from the list
- if (node == shm_head)
- shm_head = shm_head->next;
- else
- {
- shmnode *tempnode = shm_head;
- while (tempnode && tempnode->next != node)
- tempnode = tempnode->next;
- if (tempnode)
- tempnode->next = node->next;
- // else log the unexpected !
- }
-
- // release the shared data view
- UnmapViewOfFile (node->shmds->mapptr);
- delete node->shmds;
- CloseHandle (node->filemap);
- CloseHandle (node->attachmap);
-
- // free the memory
- delete node;
- nodeptr = NULL;
-}
-
-void
-client_request_shm::serve (transport_layer_base * conn, process_cache * cache)
-{
-// DWORD sd_size = 4096;
-// char sd_buf[4096];
- PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR) parameters.in.sd_buf;
-// /* create a sd for our open requests based on shmflag & 0x01ff */
-// psd = alloc_sd (getuid (), getgid (), cygheap->user.logsrv (),
-// parameters.in.shmflg & 0x01ff, psd, &sd_size);
-
- HANDLE from_process_handle = NULL;
- HANDLE token_handle = NULL;
- DWORD rc;
-
- from_process_handle = cache->process (parameters.in.pid)->handle ();
- /* possible TODO: reduce the access on the handle before we use it */
- /* Note that unless we do this, we don't need to call CloseHandle - it's kept open
- * by the process cache until the process terminates.
- * We may need a refcount on the cache however...
- */
- if (!from_process_handle)
- {
- debug_printf ("error opening process (%lu)\n", GetLastError ());
- header.error_code = EACCES;
- return;
- }
-
- conn->impersonate_client ();
-
- rc = OpenThreadToken (GetCurrentThread (),
- TOKEN_QUERY, TRUE, &token_handle);
-
- conn->revert_to_self ();
-
- if (!rc)
- {
- debug_printf ("error opening thread token (%lu)\n", GetLastError ());
- header.error_code = EACCES;
- CloseHandle (from_process_handle);
- return;
- }
-
-
- /* we trust the clients request - we will be doing it as them, and
- * the worst they can do is open their own permissions
- */
-
-
- SECURITY_ATTRIBUTES sa;
- sa.nLength = sizeof (sa);
- sa.lpSecurityDescriptor = psd;
- sa.bInheritHandle = TRUE; /* the memory structures inherit ok */
-
- char *shmname = NULL, *shmaname = NULL;
- char stringbuf[29], stringbuf1[29];
-
- /* TODO: make this code block a function! */
- if (parameters.in.type == SHM_REATTACH)
- {
- /* just find and fill out the existing shm_id */
- shmnode *tempnode = shm_head;
- while (tempnode)
- {
- if (tempnode->shm_id == parameters.in.shm_id)
- {
- parameters.out.shm_id = tempnode->shm_id;
- parameters.out.key = tempnode->key;
- if (check_and_dup_handle
- (GetCurrentProcess (), from_process_handle, token_handle,
- DUPLICATE_SAME_ACCESS, tempnode->filemap,
- &parameters.out.filemap, TRUE) != 0)
- {
- debug_printf ("error duplicating filemap handle (%lu)\n",
- GetLastError ());
- header.error_code = EACCES;
- }
- if (check_and_dup_handle
- (GetCurrentProcess (), from_process_handle, token_handle,
- DUPLICATE_SAME_ACCESS, tempnode->attachmap,
- &parameters.out.attachmap, TRUE) != 0)
- {
- debug_printf ("error duplicating attachmap handle (%lu)\n",
- GetLastError ());
- header.error_code = EACCES;
- }
- CloseHandle (token_handle);
- return;
- }
- tempnode = tempnode->next;
- }
- header.error_code = EINVAL;
- CloseHandle (token_handle);
- return;
- }
-
- /* someone attached */
- /* someone can send shm_id's they don't have and currently we will increment those
- * attach counts. If someone wants to fix that, please go ahead.
- * The problem is that shm_get has nothing to do with the ability to attach. Attach
- * requires a permission check, which we get the OS to do in MapViewOfFile.
- */
- if (parameters.in.type == SHM_ATTACH)
- {
- shmnode *tempnode = shm_head;
- while (tempnode)
- {
- if (tempnode->shm_id == parameters.in.shm_id)
- {
- InterlockedIncrement (&tempnode->shmds->shm_nattch);
- header.error_code = 0;
- CloseHandle (token_handle);
- return;
- }
- tempnode = tempnode->next;
- }
- header.error_code = EINVAL;
- CloseHandle (token_handle);
- return;
- }
-
- /* Someone detached */
- if (parameters.in.type == SHM_DETACH)
- {
- shmnode *tempnode = shm_head;
- while (tempnode)
- {
- if (tempnode->shm_id == parameters.in.shm_id)
- {
- InterlockedDecrement (&tempnode->shmds->shm_nattch);
- header.error_code = 0;
- CloseHandle (token_handle);
- return;
- }
- tempnode = tempnode->next;
- }
- header.error_code = EINVAL;
- CloseHandle (token_handle);
- return;
- }
-
- /* Someone wants the ID removed. */
- if (parameters.in.type == SHM_DEL)
- {
- shmnode **tempnode = &shm_head;
- while (*tempnode)
- {
- if ((*tempnode)->shm_id == parameters.in.shm_id)
- {
- // unlink from the accessible node list
- shmnode *temp2 = *tempnode;
- *tempnode = temp2->next;
- // link into the deleted list
- temp2->next = deleted_head;
- deleted_head = temp2;
-
- // FIXME: when/where do we delete the handles?
- if (temp2->shmds->shm_nattch)
- {
- // FIXME: add to a pending queue?
- }
- else
- {
- delete_shmnode (&temp2);
- }
-
- header.error_code = 0;
- CloseHandle (token_handle);
- return;
- }
- tempnode = &(*tempnode)->next;
- }
- header.error_code = EINVAL;
- CloseHandle (token_handle);
- return;
- }
-
-
- if (parameters.in.type == SHM_CREATE)
- {
- /* FIXME: enter the checking for existing keys mutex. This mutex _must_ be system wide
- * to prevent races on shmget.
- */
-
- if (parameters.in.key == IPC_PRIVATE)
- {
- /* create the mapping name (CYGWINSHMKPRIVATE_0x01234567 */
- /* The K refers to Key, the actual mapped area has D */
- long private_key = (int) InterlockedIncrement (&new_private_key);
- snprintf (stringbuf, 29, "CYGWINSHMKPRIVATE_0x%0x", private_key);
- shmname = stringbuf;
- snprintf (stringbuf1, 29, "CYGWINSHMDPRIVATE_0x%0x", private_key);
- shmaname = stringbuf1;
- }
- else
- {
- /* create the mapping name (CYGWINSHMK0x0123456789abcdef */
- /* The K refers to Key, the actual mapped area has D */
-
- snprintf (stringbuf, 29, "CYGWINSHMK0x%0qx", parameters.in.key);
- shmname = stringbuf;
- snprintf (stringbuf1, 29, "CYGWINSHMD0x%0qx", parameters.in.key);
- shmaname = stringbuf1;
- debug_printf ("system id strings are \n%s\n%s\n", shmname,
- shmaname);
- debug_printf ("key input value is 0x%0qx\n", parameters.in.key);
- }
-
- /* attempt to open the key */
-
- /* get an existing key */
- /* On unix the same shmid identifier is returned on multiple calls to shm_get
- * with the same key and size. Different modes is a ?.
- */
-
-
-
- /* walk the list of known keys and return the id if found. remember, we are
- * authoritative...
- */
-
- shmnode *tempnode = shm_head;
- while (tempnode)
- {
- if (tempnode->key == parameters.in.key
- && parameters.in.key != IPC_PRIVATE)
- {
- // FIXME: free the mutex
- if (parameters.in.size
- && tempnode->shmds->shm_segsz < parameters.in.size)
- {
- header.error_code = EINVAL;
- CloseHandle (token_handle);
- return;
- }
- /* FIXME: can the same process call this twice without error ? test
- * on unix
- */
- if ((parameters.in.shmflg & IPC_CREAT)
- && (parameters.in.shmflg & IPC_EXCL))
- {
- header.error_code = EEXIST;
- debug_printf
- ("attempt to exclusively create already created shm_area with key 0x%0qx\n",
- parameters.in.key);
- // FIXME: free the mutex
- CloseHandle (token_handle);
- return;
- }
- // FIXME: do we need to other tests of the requested mode with the
- // tempnode->shm_id mode ? testcase on unix needed.
- // FIXME how do we do the security test? or
- // do we wait for shmat to bother with that?
- /* One possibly solution: impersonate the client, and then test we can
- * reopen the area. In fact we'll probably have to do that to get
- * handles back to them, alternatively just tell them the id, and then
- * let them attempt the open.
- */
- parameters.out.shm_id = tempnode->shm_id;
- if (check_and_dup_handle
- (GetCurrentProcess (), from_process_handle, token_handle,
- DUPLICATE_SAME_ACCESS, tempnode->filemap,
- &parameters.out.filemap, TRUE) != 0)
- {
- printf ("error duplicating filemap handle (%lu)\n",
- GetLastError ());
- header.error_code = EACCES;
-/*mutex*/
- CloseHandle (token_handle);
- return;
- }
- if (check_and_dup_handle
- (GetCurrentProcess (), from_process_handle, token_handle,
- DUPLICATE_SAME_ACCESS, tempnode->attachmap,
- &parameters.out.attachmap, TRUE) != 0)
- {
- printf ("error duplicating attachmap handle (%lu)\n",
- GetLastError ());
- header.error_code = EACCES;
-/*mutex*/
- CloseHandle (token_handle);
- return;
- }
-
- CloseHandle (token_handle);
- return;
- }
- tempnode = tempnode->next;
- }
- /* couldn't find a currently open shm area. */
-
- /* create one */
- /* do this as the client */
- conn->impersonate_client ();
- /* This may need sh_none... it's only a control structure */
- HANDLE filemap = CreateFileMapping (INVALID_HANDLE_VALUE, // system pagefile.
- &sa,
- PAGE_READWRITE, // protection
- 0x00000000,
- getsystemallocgranularity (),
- shmname // object name
- );
- int lasterr = GetLastError ();
- conn->revert_to_self ();
-
- if (filemap == NULL)
- {
- /* We failed to open the filemapping ? */
- system_printf ("failed to open file mapping: %lu\n",
- GetLastError ());
- // free the mutex
- // we can assume that it exists, and that it was an access problem.
- header.error_code = EACCES;
- CloseHandle (token_handle);
- return;
- }
-
- /* successfully opened the control region mapping */
- /* did we create it ? */
- int oldmapping = lasterr == ERROR_ALREADY_EXISTS;
- if (oldmapping)
- {
- /* should never happen - we are the global daemon! */
-#if 0
- if ((parameters.in.shmflg & IPC_CREAT)
- && (parameters.in.shmflg & IPC_EXCL))
-#endif
- {
- /* FIXME free mutex */
- CloseHandle (filemap);
- header.error_code = EEXIST;
- CloseHandle (token_handle);
- return;
- }
- }
-
- /* we created a new mapping */
- if (parameters.in.key != IPC_PRIVATE &&
- (parameters.in.shmflg & IPC_CREAT) == 0)
- {
- CloseHandle (filemap);
- /* FIXME free mutex */
- header.error_code = ENOENT;
- CloseHandle (token_handle);
- return;
- }
-
- conn->impersonate_client ();
- void *mapptr = MapViewOfFile (filemap, FILE_MAP_WRITE, 0, 0, 0);
- conn->revert_to_self ();
-
- if (!mapptr)
- {
- CloseHandle (filemap);
- //FIXME: close filemap and free the mutex
- /* we couldn't access the mapped area with the requested permissions */
- header.error_code = EACCES;
- CloseHandle (token_handle);
- return;
- }
-
- conn->impersonate_client ();
- /* Now get the user data */
- HANDLE attachmap = CreateFileMapping (INVALID_HANDLE_VALUE, // system pagefile
- &sa,
- PAGE_READWRITE, // protection (FIXME)
- 0x00000000,
- parameters.in.size +
- parameters.in.size %
- getsystemallocgranularity (),
- shmaname // object name
- );
- conn->revert_to_self ();
-
- if (attachmap == NULL)
- {
- system_printf ("failed to get shm attachmap\n");
- header.error_code = ENOMEM;
- UnmapViewOfFile (mapptr);
- CloseHandle (filemap);
- /* FIXME exit the mutex */
- CloseHandle (token_handle);
- return;
- }
-
- shmid_ds *shmtemp = new shmid_ds;
- if (!shmtemp)
- {
- system_printf ("failed to malloc shm node\n");
- header.error_code = ENOMEM;
- UnmapViewOfFile (mapptr);
- CloseHandle (filemap);
- CloseHandle (attachmap);
- /* FIXME exit mutex */
- CloseHandle (token_handle);
- return;
- }
-
- /* fill out the node data */
- shmtemp->shm_perm.cuid = getuid ();
- shmtemp->shm_perm.uid = shmtemp->shm_perm.cuid;
- shmtemp->shm_perm.cgid = getgid ();
- shmtemp->shm_perm.gid = shmtemp->shm_perm.cgid;
- shmtemp->shm_perm.mode = parameters.in.shmflg & 0x01ff;
- shmtemp->shm_lpid = 0;
- shmtemp->shm_nattch = 0;
- shmtemp->shm_atime = 0;
- shmtemp->shm_dtime = 0;
- shmtemp->shm_ctime = time (NULL);
- shmtemp->shm_segsz = parameters.in.size;
- *(shmid_ds *) mapptr = *shmtemp;
- shmtemp->mapptr = mapptr;
-
- /* no need for InterlockedExchange here, we're serialised by the global mutex */
- tempnode = new shmnode;
- tempnode->shmds = shmtemp;
- tempnode->shm_id = (int) InterlockedIncrement (&new_id);
- tempnode->key = parameters.in.key;
- tempnode->filemap = filemap;
- tempnode->attachmap = attachmap;
- tempnode->next = shm_head;
- shm_head = tempnode;
-
- /* we now have the area in the daemon list, opened.
-
- FIXME: leave the system wide shm mutex */
-
- parameters.out.shm_id = tempnode->shm_id;
- if (check_and_dup_handle (GetCurrentProcess (), from_process_handle,
- token_handle,
- DUPLICATE_SAME_ACCESS,
- tempnode->filemap, &parameters.out.filemap,
- TRUE) != 0)
- {
- printf ("error duplicating filemap handle (%lu)\n",
- GetLastError ());
- header.error_code = EACCES;
- CloseHandle (token_handle);
-/* mutex et al */
- return;
- }
- if (check_and_dup_handle (GetCurrentProcess (), from_process_handle,
- token_handle,
- DUPLICATE_SAME_ACCESS,
- tempnode->attachmap,
- &parameters.out.attachmap, TRUE) != 0)
- {
- printf ("error duplicating attachmap handle (%lu)\n",
- GetLastError ());
- header.error_code = EACCES;
- CloseHandle (from_process_handle);
- CloseHandle (token_handle);
-/* more cleanup... yay! */
- return;
- }
- CloseHandle (token_handle);
-
- return;
- }
-
- header.error_code = ENOSYS;
- CloseHandle (token_handle);
-
-
- return;
-}
diff --git a/winsup/cygwin/cygserver_shm.h b/winsup/cygwin/cygserver_shm.h
deleted file mode 100644
index f1dcaa53f..000000000
--- a/winsup/cygwin/cygserver_shm.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* cygserver_shm.h
-
- Copyright 2001, 2002 Red Hat Inc.
- Written by Robert Collins <rbtcollins@hotmail.com>
-
-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 <sys/types.h>
-#include "cygwin/cygserver_transport.h"
-#include "cygwin/cygserver.h"
-
-#define SHM_CREATE 0
-#define SHM_REATTACH 1
-#define SHM_ATTACH 2
-#define SHM_DETACH 3
-#define SHM_DEL 4
-
-
-class client_request_shm : public client_request
-{
- public:
-#ifndef __INSIDE_CYGWIN__
- virtual void serve (transport_layer_base *conn, process_cache *cache);
-#endif
- client_request_shm (key_t, size_t, int, char psdbuf[4096], pid_t);
- client_request_shm ();
- client_request_shm (int, int, pid_t);
- client_request_shm (int, int);
- union {
- struct {int type; pid_t pid; int shm_id; key_t key; size_t size; int shmflg; char sd_buf[4096];} in;
- struct {int shm_id; HANDLE filemap; HANDLE attachmap; key_t key;} out;
- } parameters;
-};
-
-#ifndef __INSIDE_CYGWIN__
-class shm_cleanup : cleanup_routine
-{
-public:
- virtual void cleanup (long winpid);
-};
-#endif
-#if 0
-class _shmattach {
-public:
- void *data;
- class _shmattach *next;
-};
-
-class shmid_ds {
-public:
- struct ipc_perm shm_perm;
- size_t shm_segsz;
- pid_t shm_lpid;
- pid_t shm_cpid;
- shmatt_t shm_nattch;
- time_t shm_atime;
- time_t shm_dtime;
- time_t shm_ctime;
- HANDLE filemap;
- HANDLE attachmap;
- void *mapptr;
- class _shmattach *attachhead;
-};
-
-class shmnode {
-public:
- class shmid_ds * shmid;
- class shmnode *next;
- key_t key;
-};
-//....
-struct shmid_ds {
- struct ipc_perm shm_perm;
- size_t shm_segsz;
- pid_t shm_lpid;
- pid_t shm_cpid;
- shmatt_t shm_nattch;
- time_t shm_atime;
- time_t shm_dtime;
- time_t shm_ctime;
-};
-
-void *shmat(int, const void *, int);
-int shmctl(int, int, struct shmid_ds *);
-int shmdt(const void *);
-int shmget(key_t, size_t, int);
-
-#endif
diff --git a/winsup/cygwin/cygserver_transport.cc b/winsup/cygwin/cygserver_transport.cc
deleted file mode 100755
index 01f044406..000000000
--- a/winsup/cygwin/cygserver_transport.cc
+++ /dev/null
@@ -1,92 +0,0 @@
-/* cygserver_transport.cc
-
- Copyright 2001, 2002 Red Hat Inc.
-
- Written by Robert Collins <rbtcollins@hotmail.com>
-
- 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 <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <windows.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include "wincap.h"
-#include "cygwin/cygserver_transport.h"
-#include "cygwin/cygserver_transport_pipes.h"
-#include "cygwin/cygserver_transport_sockets.h"
-
-/* to allow this to link into cygwin and the .dll, a little magic is needed. */
-#ifndef __OUTSIDE_CYGWIN__
-#include "winsup.h"
-#else
-#define debug_printf printf
-#endif
-
-/* The factory */
-class transport_layer_base *create_server_transport()
-{
- transport_layer_base *temp;
- /* currently there is only the base class! */
- if (wincap.is_winnt ())
- temp = new transport_layer_pipes ();
- else
- temp = new transport_layer_sockets ();
- return temp;
-}
-
-
-transport_layer_base::transport_layer_base ()
-{
- /* should we throw an error of some sort ? */
-}
-
-void
-transport_layer_base::listen ()
-{
-}
-
-class transport_layer_base *
-transport_layer_base::accept ()
-{
- return NULL;
-}
-
-void
-transport_layer_base::close()
-{
-}
-
-ssize_t
-transport_layer_base::read (char *buf, size_t len)
-{
- return 0;
-}
-
-ssize_t
-transport_layer_base::write (char *buf, size_t len)
-{
- return 0;
-}
-
-bool
-transport_layer_base::connect ()
-{
- return false;
-}
-
-void
-transport_layer_base::impersonate_client ()
-{
-}
-
-void
-transport_layer_base::revert_to_self ()
-{
-}
diff --git a/winsup/cygwin/cygserver_transport_pipes.cc b/winsup/cygwin/cygserver_transport_pipes.cc
deleted file mode 100755
index f2221700f..000000000
--- a/winsup/cygwin/cygserver_transport_pipes.cc
+++ /dev/null
@@ -1,210 +0,0 @@
-/* cygserver_transport_pipes.cc
-
- Copyright 2001, 2002 Red Hat Inc.
-
- Written by Robert Collins <rbtcollins@hotmail.com>
-
- 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 <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <windows.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include "wincap.h"
-#include "cygwin/cygserver_transport.h"
-#include "cygwin/cygserver_transport_pipes.h"
-
-/* to allow this to link into cygwin and the .dll, a little magic is needed. */
-#ifndef __OUTSIDE_CYGWIN__
-#include "winsup.h"
-#else
-#define DEBUG 0
-#define debug_printf if (DEBUG) printf
-#endif
-
-//SECURITY_DESCRIPTOR transport_layer_pipes::sd;
-//SECURITY_ATTRIBUTES transport_layer_pipes::sec_none_nih, transport_layer_pipes::sec_all_nih;
-//bool transport_layer_pipes::inited = false;
-
-transport_layer_pipes::transport_layer_pipes (HANDLE new_pipe)
-{
- inited = false; //FIXME: allow inited, sd, all_nih_.. to be static members
- pipe = new_pipe;
- if (inited != true)
- init_security();
-};
-
-transport_layer_pipes::transport_layer_pipes ()
-{
- inited = false;
- pipe = NULL;
- strcpy(pipe_name, "\\\\.\\pipe\\cygwin_lpc");
- if (inited != true)
- init_security();
-}
-
-void
-transport_layer_pipes::init_security()
-{
- /* FIXME: pthread_once or equivalent needed */
- InitializeSecurityDescriptor (&sd, SECURITY_DESCRIPTOR_REVISION);
- SetSecurityDescriptorDacl (&sd, TRUE, 0, FALSE);
-
- sec_none_nih.nLength = sec_all_nih.nLength = sizeof (SECURITY_ATTRIBUTES);
- sec_none_nih.bInheritHandle = sec_all_nih.bInheritHandle = FALSE;
- sec_none_nih.lpSecurityDescriptor = NULL;
- sec_all_nih.lpSecurityDescriptor = &sd;
- inited = true;
-}
-
-void
-transport_layer_pipes::listen ()
-{
- /* no-op */
-}
-
-class transport_layer_pipes *
-transport_layer_pipes::accept ()
-{
- if (pipe)
- {
- debug_printf ("Already have a pipe in this %p\n",this);
- return NULL;
- }
-
- pipe = CreateNamedPipe (pipe_name,
- PIPE_ACCESS_DUPLEX,
- PIPE_TYPE_BYTE | PIPE_WAIT,
- PIPE_UNLIMITED_INSTANCES,
- 0, 0, 1000,
- &sec_all_nih );
- if (pipe == INVALID_HANDLE_VALUE)
- {
- debug_printf ("error creating pipe (%lu)\n.", GetLastError ());
- return NULL;
- }
-
- if ( !ConnectNamedPipe ( pipe, NULL ) &&
- GetLastError () != ERROR_PIPE_CONNECTED)
- {
- printf ("error connecting to pipe (%lu)\n.", GetLastError ());
- CloseHandle (pipe);
- pipe = NULL;
- return NULL;
- }
-
- transport_layer_pipes *new_conn = new transport_layer_pipes (pipe);
- pipe = NULL;
-
- return new_conn;
-}
-
-void
-transport_layer_pipes::close()
-{
- debug_printf ("closing pipe %p\n", pipe);
- if (pipe && pipe != INVALID_HANDLE_VALUE)
- {
- FlushFileBuffers (pipe);
- DisconnectNamedPipe (pipe);
- CloseHandle (pipe);
- }
-}
-
-ssize_t
-transport_layer_pipes::read (char *buf, size_t len)
-{
- debug_printf ("reading from pipe %p\n", pipe);
- if (!pipe || pipe == INVALID_HANDLE_VALUE)
- return -1;
-
- DWORD bytes_read;
- DWORD rc = ReadFile (pipe, buf, len, &bytes_read, NULL);
- if (!rc)
- {
- debug_printf ("error reading from pipe (%lu)\n", GetLastError ());
- return -1;
- }
- return bytes_read;
-}
-
-ssize_t
-transport_layer_pipes::write (char *buf, size_t len)
-{
- debug_printf ("writing to pipe %p\n", pipe);
- DWORD bytes_written, rc;
- if (!pipe || pipe == INVALID_HANDLE_VALUE)
- return -1;
-
- rc = WriteFile (pipe, buf, len, &bytes_written, NULL);
- if (!rc)
- {
- debug_printf ("error writing to pipe (%lu)\n", GetLastError ());
- return -1;
- }
- return bytes_written;
-}
-
-bool
-transport_layer_pipes::connect ()
-{
- if (pipe && pipe != INVALID_HANDLE_VALUE)
- {
- debug_printf ("Already have a pipe in this %p\n",this);
- return false;
- }
-
- while (1)
- {
- pipe = CreateFile (pipe_name,
- GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- &sec_all_nih,
- OPEN_EXISTING,
- 0, NULL);
-
- if (pipe != INVALID_HANDLE_VALUE)
- /* got the pipe */
- return true;
-
- if (GetLastError () != ERROR_PIPE_BUSY)
- {
- debug_printf ("Error opening the pipe (%lu)\n", GetLastError ());
- pipe = NULL;
- return false;
- }
- if (!WaitNamedPipe (pipe_name, 20000))
- debug_printf ( "error connecting to server pipe after 20 seconds (%lu)\n", GetLastError () );
- /* We loop here, because the pipe exists but is busy. If it doesn't exist
- * the != ERROR_PIPE_BUSY will catch it.
- */
- }
-}
-
-void
-transport_layer_pipes::impersonate_client ()
-{
- debug_printf ("impersonating pipe %p\n", pipe);
- if (pipe && pipe != INVALID_HANDLE_VALUE)
- {
- BOOL rv = ImpersonateNamedPipeClient (pipe);
- if (!rv)
- debug_printf ("Failed to Impersonate the client, (%lu)\n", GetLastError ());
- }
- debug_printf("I am who you are\n");
-}
-
-void
-transport_layer_pipes::revert_to_self ()
-{
- RevertToSelf ();
- debug_printf("I am who I yam\n");
-}
-
diff --git a/winsup/cygwin/cygserver_transport_sockets.cc b/winsup/cygwin/cygserver_transport_sockets.cc
deleted file mode 100755
index a3a98b3e5..000000000
--- a/winsup/cygwin/cygserver_transport_sockets.cc
+++ /dev/null
@@ -1,131 +0,0 @@
-/* cygserver_transport_sockets.cc
-
- Copyright 2001, 2002 Red Hat Inc.
-
- Written by Robert Collins <rbtcollins@hotmail.com>
-
- 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 <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <windows.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include "wincap.h"
-#include "cygwin/cygserver_transport.h"
-#include "cygwin/cygserver_transport_sockets.h"
-
-/* to allow this to link into cygwin and the .dll, a little magic is needed. */
-#ifndef __OUTSIDE_CYGWIN__
-#include "winsup.h"
-extern "C" int
-cygwin_socket (int af, int type, int protocol);
-extern "C" int
-cygwin_connect (int fd,
- const struct sockaddr *name,
- int namelen);
-extern "C" int
-cygwin_accept (int fd, struct sockaddr *peer, int *len);
-extern "C" int
-cygwin_listen (int fd, int backlog);
-extern "C" int
-cygwin_bind (int fd, const struct sockaddr *my_addr, int addrlen);
-
-#else
-#define cygwin_accept(A,B,C) ::accept(A,B,C)
-#define cygwin_socket(A,B,C) ::socket(A,B,C)
-#define cygwin_listen(A,B) ::listen(A,B)
-#define cygwin_bind(A,B,C) ::bind(A,B,C)
-#define cygwin_connect(A,B,C) ::connect(A,B,C)
-#define debug_printf printf
-#endif
-
-transport_layer_sockets::transport_layer_sockets (int newfd): fd(newfd)
-{
- /* This may not be needed in this constructor - it's only used
- * when creating a connection via bind or connect
- */
- sockdetails.sa_family = AF_UNIX;
- strcpy (sockdetails.sa_data, "/tmp/cygdaemo");
- sdlen = strlen(sockdetails.sa_data) + sizeof(sockdetails.sa_family);
-};
-
-transport_layer_sockets::transport_layer_sockets (): fd (-1)
-{
- sockdetails.sa_family = AF_UNIX;
- strcpy (sockdetails.sa_data, "/tmp/cygdaemo");
- sdlen = strlen(sockdetails.sa_data) + sizeof(sockdetails.sa_family);
-}
-
-void
-transport_layer_sockets::listen ()
-{
- /* we want a thread pool based approach. */
- if ((fd = cygwin_socket (AF_UNIX, SOCK_STREAM,0)) < 0)
- printf ("Socket not created error %d\n", errno);
- if (cygwin_bind(fd, &sockdetails, sdlen))
- printf ("Bind doesn't like you. Tsk Tsk. Bind said %d\n", errno);
- if (cygwin_listen(fd, 5) < 0)
- printf ("And the OS just isn't listening, all it says is %d\n", errno);
-}
-
-class transport_layer_sockets *
-transport_layer_sockets::accept ()
-{
- /* FIXME: check we have listened */
- int new_fd;
-
- if ((new_fd = cygwin_accept(fd, &sockdetails, &sdlen)) < 0)
- {
- printf ("Nup, could' accept. %d\n",errno);
- return NULL;
- }
-
- transport_layer_sockets *new_conn = new transport_layer_sockets (new_fd);
-
- return new_conn;
-
-}
-
-void
-transport_layer_sockets::close()
-{
- /* FIXME - are we open? */
- ::close (fd);
-}
-
-ssize_t
-transport_layer_sockets::read (char *buf, size_t len)
-{
- /* FIXME: are we open? */
- return ::read (fd, buf, len);
-}
-
-ssize_t
-transport_layer_sockets::write (char *buf, size_t len)
-{
- /* FIXME: are we open? */
- return ::write (fd, buf, len);
-}
-
-bool
-transport_layer_sockets::connect ()
-{
- /* are we already connected? */
- if (fd != -1)
- return false;
- fd = cygwin_socket (AF_UNIX, SOCK_STREAM, 0);
- if (cygwin_connect (fd, &sockdetails, sdlen) < 0)
- {
- debug_printf("client connect failure %d\n", errno);
- ::close (fd);
- return false;
- }
- return true;
-}
diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din
deleted file mode 100644
index c9e7aac28..000000000
--- a/winsup/cygwin/cygwin.din
+++ /dev/null
@@ -1,1274 +0,0 @@
-LIBRARY "cygwin1.dll" BASE=0x61000000
-
-EXPORTS
-__assert
-__eprintf
-__errno
-__infinity
-__main
-__signgam
-__srget
-__swbuf
-__argv DATA
-__argc DATA
-__progname DATA
-_check_for_executable DATA
-; __vc__10pinfo_listi
-@ALLOCA@
-cygwin_stackdump
-abort
-_abort = abort
-abs
-_abs = abs
-access
-_access = access
-acos
-_acos = acos
-acosf
-_acosf = acosf
-acosh
-_acosh = acosh
-acoshf
-_acoshf = acoshf
-alarm
-_alarm = alarm
-alphasort
-_alphasort = alphasort
-asctime
-_asctime = asctime
-asctime_r
-_asctime_r = asctime_r
-asin
-_asin = asin
-asinf
-_asinf = asinf
-asinh
-_asinh = asinh
-asinhf
-_asinhf = asinhf
-atan
-_atan = atan
-atan2
-_atan2 = atan2
-atan2f
-_atan2f = atan2f
-atanf
-_atanf = atanf
-atanh
-_atanh = atanh
-atanhf
-_atanhf = atanhf
-atexit
-_atexit = atexit
-atof
-_atof = atof
-atoff
-_atoff = atoff
-atoi
-_atoi = atoi
-atol
-_atol = atol
-bcmp
-_bcmp = bcmp
-bcopy
-_bcopy = bcopy
-bsearch
-_bsearch = bsearch
-bzero
-_bzero = bzero
-cabs
-_cabs = cabs
-cabsf
-_cabsf = cabsf
-calloc = export_calloc
-_calloc = export_calloc
-cbrt
-_cbrt = cbrt
-cbrtf
-_cbrtf = cbrtf
-ceil
-_ceil = ceil
-ceilf
-_ceilf = ceilf
-cfgetospeed
-cfgetispeed
-cfsetospeed
-cfsetispeed
-chdir
-_chdir = chdir
-chmod
-_chmod = chmod
-chown
-_chown = chown
-chown32
-cleanup_glue
-clearerr
-_clearerr = clearerr
-clock
-_clock = clock
-_close
-close = _close
-closedir
-_closedir = closedir
-copysign
-_copysign = copysign
-copysignf
-_copysignf = copysignf
-cos
-_cos = cos
-cosf
-_cosf = cosf
-cosh
-_cosh = cosh
-coshf
-_coshf = coshf
-creat
-_creat = creat
-ctime
-_ctime = ctime
-ctime_r
-_ctime_r = ctime_r
-cwait
-_cwait = cwait
-difftime
-_difftime = difftime
-div
-_div = div
-dirfd
-_dirfd = dirfd
-_dll_crt0@0
-dll_crt0__FP11per_process
-cygwin_dll_init
-dll_dllcrt0
-dll_noncygwin_dllcrt0
-cygwin_detach_dll
-cygwin32_detach_dll = cygwin_detach_dll
-@DEF_DLL_ENTRY@
-drem
-_drem = drem
-dremf
-_dremf = dremf
-dup
-_dup = dup
-dup2
-_dup2 = dup2
-ecvt
-_ecvt = ecvt
-ecvtbuf
-_ecvtbuf = ecvtbuf
-ecvtf
-_ecvtf = ecvtf
-endgrent
-_endgrent = endgrent
-endutent
-_endutent = endutent
-erf
-_erf = erf
-erfc
-_erfc = erfc
-erfcf
-_erfcf = erfcf
-erff
-_erff = erff
-execl
-_execl = execl
-execle
-_execle = execle
-execlp
-_execlp = execlp
-execv
-_execv = execv
-execve
-_execve = execve
-execvp
-_execvp = execvp
-exit
-_exit
-exp
-_exp = exp
-expf
-_expf = expf
-expm1
-_expm1 = expm1
-expm1f
-_expm1f = expm1f
-fabs
-_fabs = fabs
-fabsf
-_fabsf = fabsf
-_f_atan2
-__f_atan2 = _f_atan2
-_f_atan2f
-__f_atan2f = _f_atan2f
-fchdir
-_fchdir = fchdir
-fchmod
-_fchmod = fchmod
-fchown
-_fchown = fchown
-fchown32
-fclose
-_fclose = fclose
-_fcntl
-fcntl = _fcntl
-fcvt
-_fcvt = fcvt
-fcvtbuf
-_fcvtbuf = fcvtbuf
-fcvtf
-_fcvtf = fcvtf
-fdopen
-_fdopen = fdopen
-feof
-_feof = feof
-ferror
-_ferror = ferror
-_f_exp
-__f_exp = _f_exp
-_f_expf
-__f_expf = _f_expf
-fflush
-_fflush = fflush
-_f_frexp
-__f_frexp = _f_frexp
-_f_frexpf
-__f_frexpf = _f_frexpf
-fgetc
-_fgetc = fgetc
-fgetpos
-_fgetpos = fgetpos
-fgets
-_fgets = fgets
-ffs
-_ffs = ffs
-fileno
-_fileno = fileno
-finite
-_finite = finite
-finitef
-_finitef = finitef
-fiprintf
-_fiprintf = fiprintf
-_f_ldexp
-__f_ldexp = _f_ldexp
-_f_ldexpf
-__f_ldexpf = _f_ldexpf
-_f_log
-__f_log = _f_log
-_f_logf
-__f_logf = _f_logf
-_f_log10
-__f_log10 = _f_log10
-_f_log10f
-__f_log10f = _f_log10f
-floor
-_floor = floor
-floorf
-_floorf = floorf
-fnmatch
-_fnmatch = fnmatch
-fmod
-_fmod = fmod
-fmodf
-_fmodf = fmodf
-fopen
-_fopen = fopen
-fork
-_fork = fork
-fpathconf
-_f_pow
-__f_pow = _f_pow
-_f_powf
-__f_powf = _f_powf
-fprintf
-_fprintf = fprintf
-fputc
-_fputc = fputc
-fputs
-_fputs = fputs
-fread
-_fread = fread
-free = export_free
-_free = export_free
-freopen
-_freopen = freopen
-frexp
-_frexp = frexp
-frexpf
-_frexpf = frexpf
-fscanf
-_fscanf = fscanf
-_fscanf_r
-fscanf_r = _fscanf_r
-fseek
-_fseek = fseek
-fsetpos
-_fsetpos = fsetpos
-_fstat
-fstat = _fstat
-fstat64
-fstatfs
-_fstatfs = fstatfs
-fsync
-_fsync = fsync
-_f_tan
-__f_tan = _f_tan
-_f_tanf
-__f_tanf = _f_tanf
-ftell
-_ftell = ftell
-ftime
-_ftime = ftime
-ftruncate
-_ftruncate = ftruncate
-ftruncate64
-fwrite
-_fwrite = fwrite
-gamma
-_gamma = gamma
-gamma_r
-_gamma_r = gamma_r
-gammaf
-_gammaf = gammaf
-gammaf_r
-_gammaf_r = gammaf_r
-gcvt
-_gcvt = gcvt
-gcvtf
-_gcvtf = gcvtf
-getc
-_getc = getc
-getchar
-_getchar = getchar
-getcwd
-_getcwd = getcwd
-getdtablesize
-_getdtablesize = getdtablesize
-getegid
-_getegid = getegid
-getegid32
-geteuid
-_geteuid = geteuid
-geteuid32
-getgid
-_getgid = getgid
-getgid32
-getgrgid
-_getgrgid = getgrgid
-getgrgid32
-getgrnam
-_getgrnam = getgrnam
-getgrnam32
-getgroups
-_getgroups = getgroups
-getgroups32
-gethostname = cygwin_gethostname
-_gethostname = cygwin_gethostname
-getlogin
-_getlogin = getlogin
-getmntent
-_getmntent = getmntent
-getmode
-_getmode = getmode
-get_osfhandle
-_get_osfhandle = get_osfhandle
-getpagesize
-_getpagesize = getpagesize
-getpass
-_getpass = getpass
-getpid
-_getpid = getpid
-getppid
-_getppid = getppid
-getrlimit
-_getrlimit = getrlimit
-getrusage
-_getrusage = getrusage
-gets
-_gets = gets
-gettimeofday
-_gettimeofday = gettimeofday
-getuid
-_getuid = getuid
-getuid32
-getutent
-_getutent = getutent
-getutid
-_getutid = getutid
-getutline
-_getutline = getutline
-glob
-_glob = glob
-globfree
-_globfree = globfree
-gmtime
-_gmtime = gmtime
-gmtime_r
-_gmtime_r = gmtime_r
-h_errno DATA
-hypot
-_hypot = hypot
-hypotf
-_hypotf = hypotf
-ilogb
-_ilogb = ilogb
-ilogbf
-_ilogbf = ilogbf
-index
-_index = index
-infinity
-_infinity = infinity
-infinityf
-_infinityf = infinityf
-initgroups
-initgroups32
-ioctl
-_ioctl = ioctl
-iprintf
-_iprintf = iprintf
-isalnum
-_isalnum = isalnum
-isalpha
-_isalpha = isalpha
-isascii
-_isascii = isascii
-isatty
-_isatty = isatty
-iscntrl
-_iscntrl = iscntrl
-isdigit
-_isdigit = isdigit
-isgraph
-_isgraph = isgraph
-isinf
-_isinf = isinf
-isinff
-_isinff = isinff
-islower
-_islower = islower
-isnan
-_isnan = isnan
-isnanf
-_isnanf = isnanf
-isprint
-_isprint = isprint
-ispunct
-_ispunct = ispunct
-isspace
-_isspace = isspace
-isupper
-_isupper = isupper
-isxdigit
-_isxdigit = isxdigit
-j0
-_j0 = j0
-j0f
-_j0f = j0f
-j1
-_j1 = j1
-j1f
-_j1f = j1f
-jn
-_jn = jn
-jnf
-_jnf = jnf
-_kill
-kill = _kill
-labs
-_labs = labs
-lchown
-_lchown = lchown
-lchown32
-ldexp
-_ldexp = ldexp
-ldexpf
-_ldexpf = ldexpf
-ldiv
-_ldiv = ldiv
-lgamma
-_lgamma = lgamma
-lgamma_r
-_lgamma_r = lgamma_r
-lgammaf
-_lgammaf = lgammaf
-lgammaf_r
-_lgammaf_r = lgammaf_r
-link
-_link = link
-localeconv
-_localeconv = localeconv
-localtime
-_localtime = localtime
-localtime_r
-_localtime_r = localtime_r
-log
-_log = log
-log10
-_log10 = log10
-log10f
-_log10f = log10f
-log1p
-_log1p = log1p
-log1pf
-_log1pf = log1pf
-logb
-_logb = logb
-logbf
-_logbf = logbf
-logf
-_logf = logf
-login
-logout
-longjmp
-_longjmp = longjmp
-_lseek
-lseek = _lseek
-lseek64
-lstat = cygwin_lstat
-_lstat = cygwin_lstat
-lstat64
-malloc = export_malloc
-_malloc = export_malloc
-matherr
-_matherr = matherr
-mblen
-_mblen = mblen
-mbstowcs
-_mbstowcs = mbstowcs
-mbtowc
-_mbtowc = mbtowc
-memchr
-_memchr = memchr
-memcmp
-_memcmp = memcmp
-memcpy
-_memcpy = memcpy
-memmove
-_memmove = memmove
-memset
-_memset = memset
-mkdir
-_mkdir = mkdir
-mkfifo
-mknod
-_mknod = mknod
-mkstemp
-_mkstemp = mkstemp
-mktemp
-_mktemp = mktemp
-mktime
-_mktime = mktime
-mmap
-mmap64
-mprotect
-msync
-munmap
-modf
-_modf = modf
-modff
-_modff = modff
-nan
-_nan = nan
-nanf
-_nanf = nanf
-nextafter
-_nextafter = nextafter
-nextafterf
-_nextafterf = nextafterf
-_open
-open = _open
-opendir
-_opendir = opendir
-pathconf
-_pathconf = pathconf
-perror
-_perror = perror
-pipe
-_pipe
-poll
-_poll = poll
-pow
-_pow = pow
-powf
-_powf = powf
-printf
-_printf = printf
-putc
-_putc = putc
-putchar
-_putchar = putchar
-puts
-_puts = puts
-putw
-_putw = putw
-qsort
-_qsort = qsort
-raise
-_raise = raise
-rand
-_rand = rand
-random
-initstate
-setstate
-_read
-read = read
-readdir
-_readdir = readdir
-readlink
-_readlink = readlink
-readv
-_readv = readv
-realloc = export_realloc
-_realloc = export_realloc
-posix_regcomp
-posix_regerror
-posix_regexec
-posix_regfree
-remainder
-_remainder = remainder
-remainderf
-_remainderf = remainderf
-remove
-_remove = remove
-_rename
-rename = _rename
-rewind
-_rewind = rewind
-rewinddir
-_rewinddir = rewinddir
-rindex
-_rindex = rindex
-rint
-_rint = rint
-rintf
-_rintf = rintf
-rmdir
-_rmdir = rmdir
-sbrk
-_sbrk = sbrk
-scalb
-_scalb = scalb
-scalbf
-_scalbf = scalbf
-scalbn
-_scalbn = scalbn
-scalbnf
-_scalbnf = scalbnf
-scandir
-_scandir = scandir
-scanf
-_scanf = scanf
-_scanf_r
-scanf_r = _scanf_r
-seekdir
-_seekdir = seekdir
-seekdir64
-setbuf
-_setbuf = setbuf
-setdtablesize
-_setdtablesize = setdtablesize
-setgid
-_setgid = setgid
-setgid32
-setjmp
-_setjmp = setjmp
-setlocale
-_setlocale = setlocale
-setpgid
-_setpgid = setpgid
-setrlimit
-_setrlimit = setrlimit
-setsid
-_setsid = setsid
-settimeofday
-_settimeofday = settimeofday
-seteuid
-_seteuid = seteuid
-seteuid32
-setegid
-_setegid = setegid
-setegid32
-setuid
-_setuid = setuid
-setuid32
-setutent
-_setutent = setutent
-chroot
-_chroot = chroot
-setvbuf
-_setvbuf = setvbuf
-sigaction
-_sigaction = sigaction
-sigaddset
-_sigaddset = sigaddset
-sigdelset
-_sigdelset = sigdelset
-sigismember
-_sigismember = sigismember
-sigemptyset
-_sigemptyset = sigemptyset
-sigfillset
-_sigfillset = sigfillset
-signal
-_signal = signal
-significand
-_significand = significand
-significandf
-_significandf = significandf
-sigpending
-_sigpending = sigpending
-sigprocmask
-_sigprocmask = sigprocmask
-sigsuspend
-_sigsuspend = sigsuspend
-sin
-_sin = sin
-sinf
-_sinf = sinf
-sinh
-_sinh = sinh
-sinhf
-_sinhf = sinhf
-siprintf
-_siprintf = siprintf
-sleep
-_sleep = sleep
-spawnl
-_spawnl = spawnl
-spawnle
-_spawnle = spawnle
-spawnlp
-_spawnlp = spawnlp
-spawnlpe
-_spawnlpe = spawnlpe
-spawnv
-_spawnv = spawnv
-spawnve
-_spawnve = spawnve
-spawnvp
-_spawnvp = spawnvp
-spawnvpe
-_spawnvpe = spawnvpe
-sprintf
-_sprintf = sprintf
-snprintf
-_snprintf = snprintf
-sqrt
-_sqrt = sqrt
-sqrtf
-_sqrtf = sqrtf
-srand
-_srand = srand
-srandom
-sscanf
-_sscanf = sscanf
-_sscanf_r
-sscanf_r = _sscanf_r
-_stat
-stat = _stat
-stat64
-statfs
-_statfs = statfs
-strcasecmp
-_strcasecmp = strcasecmp
-strcat
-_strcat = strcat
-strchr
-_strchr = strchr
-strcmp
-_strcmp = strcmp
-strcoll
-_strcoll = strcoll
-strcpy
-_strcpy = strcpy
-strcspn
-_strcspn = strcspn
-strdup
-_strdup = strdup
-strerror
-_strerror = strerror
-strlen
-_strlen = strlen
-strlwr
-_strlwr = strlwr
-strncasecmp
-_strncasecmp = strncasecmp
-strncat
-_strncat = strncat
-strncmp
-_strncmp = strncmp
-strncpy
-_strncpy = strncpy
-strpbrk
-_strpbrk = strpbrk
-strrchr
-_strrchr = strrchr
-strspn
-_strspn = strspn
-strstr
-_strstr = strstr
-strtod
-_strtod = strtod
-strtodf
-_strtodf = strtodf
-strtok
-_strtok = strtok
-strtok_r
-_strtok_r = strtok_r
-strtol
-_strtol = strtol
-strtoll
-_strtoll = strtoll
-strtoul
-_strtoul = strtoul
-strtoull
-_strtoull = strtoull
-strupr
-_strupr = strupr
-strxfrm
-_strxfrm = strxfrm
-swab
-_swab = swab
-symlink
-_symlink = symlink
-sync
-_sync = sync
-sysconf
-_sysconf = sysconf
-system
-_system = system
-tan
-_tan = tan
-tanf
-_tanf = tanf
-tanh
-_tanh = tanh
-tanhf
-_tanhf = tanhf
-tcdrain
-_tcdrain = tcdrain
-tcflow
-_tcflow = tcflow
-tcflush
-_tcflush = tcflush
-tcgetattr
-_tcgetattr = tcgetattr
-tcgetpgrp
-_tcgetpgrp = tcgetpgrp
-tcsendbreak
-_tcsendbreak = tcsendbreak
-tcsetattr
-_tcsetattr = tcsetattr
-tcsetpgrp
-_tcsetpgrp = tcsetpgrp
-telldir
-_telldir = telldir
-telldir64
-tempnam
-_tempnam = tempnam
-time
-_time = time
-_times
-times = _times
-timezone
-tmpfile
-_tmpfile = tmpfile
-tmpnam
-_tmpnam = tmpnam
-toascii
-_toascii = toascii
-tolower
-_tolower = tolower
-toupper
-_toupper = toupper
-truncate
-_truncate = truncate
-truncate64
-ttyname
-_ttyname = ttyname
-tzset
-_tzset = tzset
-ualarm
-_ualarm = ualarm
-umask
-_umask = umask
-uname
-_uname = uname
-ungetc
-_ungetc = ungetc
-_unlink
-unlink = _unlink
-usleep
-_usleep = usleep
-utime
-_utime = utime
-utimes
-_utimes = utimes
-utmpname
-_utmpname = utmpname
-vfiprintf
-_vfiprintf = vfiprintf
-vfork
-_vfork = vfork
-vfprintf
-_vfprintf = vfprintf
-vfscanf
-_vfscanf = vfscanf
-_vfscanf_r
-vfscanf_r = _vfscanf_r
-vprintf
-_vprintf = vprintf
-vscanf
-_vscanf = vscanf
-_vscanf_r
-vscanf_r = _vscanf_r
-vsprintf
-_vsprintf = vsprintf
-vsnprintf
-_vsnprintf = vsnprintf
-vsscanf
-_vsscanf = vsscanf
-_vsscanf_r
-vsscanf_r = _vsscanf_r
-_wait
-wait = _wait
-waitpid
-_waitpid = waitpid
-wait3
-wait4
-wcstombs
-_wcstombs = wcstombs
-wctomb
-_wctomb = wctomb
-_write
-write = _write
-barfly = write
-writev
-_writev = writev
-y0
-y0f
-y1
-y1f
-yn
-ynf
-drand48
-_drand48 = drand48
-erand48
-_erand48 = erand48
-jrand48
-_jrand48 = jrand48
-lcong48
-_lcong48 = lcong48
-lrand48
-_lrand48 = lrand48
-mrand48
-_lrand48 = lrand48
-nrand48
-_nrand48 = nrand48
-seed48
-_seed48 = seed48
-srand48
-_srand48 = srand48
-setmode
-_setmode = setmode
-__assertfail
-getw
-_getw = getw
-getwd
-_getwd = getwd
-popen
-_popen = popen
-pclose
-_pclose = pclose
-strftime
-_strftime = strftime
-strlcat
-_strlcat = strlcat
-strlcpy
-_strlcpy = strlcpy
-strptime
-_strptime = strptime
-setgrent
-_setgrent = setgrent
-cuserid
-_cuserid = cuserid
-setpgrp
-_setpgrp = setpgrp
-mount
-_mount = mount
-setmntent
-_setmntent = setmntent
-endmntent
-_endmntent = endmntent
-umount
-_umount = umount
-wcscmp
-_wcscmp = wcscmp
-wcslen
-_wcslen = wcslen
-wprintf
-_wprintf = wprintf
-memccpy
-_memccpy = memccpy
-getpwent
-_getpwent = getpwent
-endpwent
-_endpwent = endpwent
-setpwent
-_setpwent = setpwent
-getpwduid
-_getpwduid = getpwduid
-getpwnam
-_getpwnam = getpwnam
-getpwnam_r
-getpwuid
-_getpwuid = getpwuid
-getpwuid32
-getpwuid_r
-getpwuid_r32
-getpgrp
-_getpgrp = getpgrp
-getgrent
-_getgrent = getgrent
-getgrent32
-ntohl
-_ntohl = ntohl
-htonl
-_htonl = htonl
-htons
-_htons = htons
-ntohs
-_ntohs = ntohs
-accept = cygwin_accept
-bind = cygwin_bind
-connect = cygwin_connect
-hstrerror = cygwin_hstrerror
-herror = cygwin_herror
-inet_addr = cygwin_inet_addr
-inet_network = cygwin_inet_network
-inet_netof
-inet_makeaddr
-listen = cygwin_listen
-getdomainname
-_getdomainname = getdomainname
-gethostbyaddr = cygwin_gethostbyaddr
-gethostbyname = cygwin_gethostbyname
-getpeername = cygwin_getpeername
-getprotobyname = cygwin_getprotobyname
-getprotobynumber = cygwin_getprotobynumber
-getservbyname = cygwin_getservbyname
-getservbyport = cygwin_getservbyport
-getsockname = cygwin_getsockname
-getsockopt = cygwin_getsockopt
-recv = cygwin_recv
-select = cygwin_select
-_select = cygwin_select
-send = cygwin_send
-socket = cygwin_socket
-setsockopt = cygwin_setsockopt
-inet_aton = cygwin_inet_aton
-inet_ntoa = cygwin_inet_ntoa
-recvfrom = cygwin_recvfrom
-recvmsg = cygwin_recvmsg
-sendmsg = cygwin_sendmsg
-sendto = cygwin_sendto
-shutdown = cygwin_shutdown
-sethostent
-endhostent
-setpassent
-_setpassent = setpassent
-strsep
-_strsep = strsep
-syslog
-_syslog = syslog
-closelog
-_closelog = closelog
-openlog
-_openlog = openlog
-setlogmask
-vhangup
-_vhangup = vhangup
-nice
-_nice = nice
-cygwin_conv_to_win32_path
-cygwin_conv_to_full_win32_path
-cygwin_conv_to_posix_path
-cygwin_conv_to_full_posix_path
-cygwin_posix_path_list_p
-cygwin_win32_to_posix_path_list_buf_size
-cygwin_posix_to_win32_path_list_buf_size
-cygwin_win32_to_posix_path_list
-cygwin_posix_to_win32_path_list
-cygwin_split_path
-cygwin_umount
-cygwin32_conv_to_win32_path = cygwin_conv_to_win32_path
-cygwin32_conv_to_full_win32_path = cygwin_conv_to_full_win32_path
-cygwin32_conv_to_posix_path = cygwin_conv_to_posix_path
-cygwin32_conv_to_full_posix_path = cygwin_conv_to_full_posix_path
-cygwin32_posix_path_list_p = cygwin_posix_path_list_p
-cygwin32_win32_to_posix_path_list_buf_size = cygwin_win32_to_posix_path_list_buf_size
-cygwin32_posix_to_win32_path_list_buf_size = cygwin_posix_to_win32_path_list_buf_size
-cygwin32_win32_to_posix_path_list = cygwin_win32_to_posix_path_list
-cygwin32_posix_to_win32_path_list = cygwin_posix_to_win32_path_list
-cygwin32_split_path = cygwin_split_path
-cygwin_winpid_to_pid
-cygwin32_winpid_to_pid = cygwin_winpid_to_pid
-cygwin_logon_user
-cygwin_set_impersonation_token
-realpath
-reent_data DATA
-getenv
-_getenv = getenv
-putenv
-_putenv = putenv
-setenv
-_setenv = setenv
-unsetenv
-_unsetenv = unsetenv
-setitimer
-getitimer
-getpgid
-killpg
-pause
-__cygwin_environ DATA
-__cygwin_user_data DATA
-_ctype_ DATA
-_sys_errlist DATA
-sys_errlist = _sys_errlist DATA
-_sys_nerr DATA
-sys_nerr = _sys_nerr DATA
-__mb_cur_max DATA
-_timezone DATA
-_daylight DATA
-_tzname DATA
-ptsname
-grantpt
-unlockpt
-sexecve = sexecve_is_bad
-sexecl = sexecve_is_bad
-sexecle = sexecve_is_bad
-sexeclp = sexecve_is_bad
-sexeclpe = sexecve_is_bad
-sexecv = sexecve_is_bad
-sexecp = sexecve_is_bad
-sexecvpe = sexecve_is_bad
-ttyslot
-rcmd = cygwin_rcmd
-rresvport = cygwin_rresvport
-rexec = cygwin_rexec
-socketpair
-strsignal
-strtosigno
-ctermid
-dlopen
-dlclose
-dlsym
-dlerror
-dlfork
-sigpause
-cygwin_attach_handle_to_fd
-cygwin32_attach_handle_to_fd = cygwin_attach_handle_to_fd
-cygwin_internal
-cygwin32_internal = cygwin_internal
-pthread_atfork
-pthread_attr_destroy
-pthread_attr_getdetachstate
-pthread_attr_getinheritsched
-pthread_attr_getschedparam
-pthread_attr_getschedpolicy
-pthread_attr_getscope
-pthread_attr_getstacksize
-pthread_attr_init
-pthread_attr_setdetachstate
-pthread_attr_setinheritsched
-pthread_attr_setschedparam
-pthread_attr_setschedpolicy
-pthread_attr_setscope
-pthread_attr_setstacksize
-pthread_cancel
-_pthread_cleanup_push
-_pthread_cleanup_pop
-pthread_cond_broadcast
-pthread_cond_destroy
-pthread_cond_init
-pthread_cond_signal
-pthread_cond_timedwait
-pthread_cond_wait
-pthread_condattr_destroy
-pthread_condattr_getpshared
-pthread_condattr_init
-pthread_condattr_setpshared
-pthread_create
-pthread_detach
-pthread_equal
-pthread_exit
-pthread_getconcurrency
-pthread_getschedparam
-pthread_getspecific
-pthread_join
-pthread_key_create
-pthread_key_delete
-pthread_mutex_destroy
-pthread_mutex_getprioceiling
-pthread_mutex_init
-pthread_mutex_lock
-pthread_mutex_setprioceiling
-pthread_mutex_trylock
-pthread_mutex_unlock
-pthread_mutexattr_destroy
-pthread_mutexattr_getprioceiling
-pthread_mutexattr_getprotocol
-pthread_mutexattr_getpshared
-pthread_mutexattr_gettype
-pthread_mutexattr_init
-pthread_mutexattr_setprioceiling
-pthread_mutexattr_setprotocol
-pthread_mutexattr_setpshared
-pthread_mutexattr_settype
-pthread_once
-pthread_self
-pthread_setcancelstate
-pthread_setcanceltype
-pthread_setconcurrency
-pthread_setschedparam
-pthread_setspecific
-pthread_testcancel
-pthread_suspend
-pthread_continue
-pthread_kill
-pthread_sigmask
-sem_init
-sem_destroy
-sem_wait
-sem_trywait
-sem_post
-sched_get_priority_max
-sched_get_priority_min
-sched_getparam
-sched_getscheduler
-sched_rr_get_interval
-sched_setparam
-sched_setscheduler
-sched_yield
-acl
-_acl = acl
-facl
-_facl = facl
-lacl
-_lacl = lacl
-aclcheck
-_aclcheck = aclcheck
-aclsort
-_aclsort = aclsort
-acltomode
-_acltomode = acltomode
-aclfrommode
-_aclfrommode = aclfrommode
-acltopbits
-_acltopbits = acltopbits
-aclfrompbits
-_aclfrompbits = aclfrompbits
-acltotext
-_acltotext = acltotext
-aclfromtext
-_aclfromtext = aclfromtext
diff --git a/winsup/cygwin/cygwin.sc b/winsup/cygwin/cygwin.sc
deleted file mode 100644
index b050e3e37..000000000
--- a/winsup/cygwin/cygwin.sc
+++ /dev/null
@@ -1,111 +0,0 @@
-OUTPUT_FORMAT(pei-i386)
-SEARCH_DIR(/cygnus/i686-pc-cygwin/lib/w32api); SEARCH_DIR(/cygnus/i686-pc-cygwin/lib);
-ENTRY(_mainCRTStartup)
-SECTIONS
-{
- .text __image_base__ + __section_alignment__ :
- {
- *(.init)
- *(.text)
- *(SORT(.text$*))
- *(.glue_7t)
- *(.glue_7)
- ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
- LONG (-1); *(.ctors); *(.ctor); LONG (0);
- ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
- LONG (-1); *(.dtors); *(.dtor); LONG (0);
- *(.fini)
- /* ??? Why is .gcc_exc here? */
- *(.gcc_exc)
- etext = .;
- *(.gcc_except_table)
- }
- /* The Cygwin DLL uses a section to avoid copying certain data
- on fork. This used to be named ".data". The linker used
- to include this between __data_start__ and __data_end__, but that
- breaks building the cygwin32 dll. Instead, we name the section
- ".data_cygwin_nocopy" and explictly include it after __data_end__. */
- .data BLOCK(__section_alignment__) :
- {
- __data_start__ = . ;
- *(.data)
- *(.data2)
- *(SORT(.data$*))
- __data_end__ = . ;
- *(.data_cygwin_nocopy)
- }
- .rdata BLOCK(__section_alignment__) :
- {
- *(.rdata)
- *(SORT(.rdata$*))
- *(.eh_frame)
- }
- .pdata BLOCK(__section_alignment__) :
- {
- *(.pdata)
- }
- .bss BLOCK(__section_alignment__) :
- {
- __bss_start__ = . ;
- *(.bss)
- *(COMMON)
- __bss_end__ = . ;
- }
- .edata BLOCK(__section_alignment__) :
- {
- *(.edata)
- }
- /DISCARD/ :
- {
- *(.debug$S)
- *(.debug$T)
- *(.debug$F)
- *(.drectve)
- }
- .idata BLOCK(__section_alignment__) :
- {
- /* This cannot currently be handled with grouped sections.
- See pe.em:sort_sections. */
- SORT(*)(.idata$2)
- SORT(*)(.idata$3)
- /* These zeroes mark the end of the import list. */
- LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
- SORT(*)(.idata$4)
- SORT(*)(.idata$5)
- SORT(*)(.idata$6)
- SORT(*)(.idata$7)
- }
- .CRT BLOCK(__section_alignment__) :
- {
- *(SORT(.CRT$*))
- }
- .endjunk BLOCK(__section_alignment__) :
- {
- /* end is deprecated, don't use it */
- end = .;
- _end = .;
- __end__ = .;
- }
- .rsrc BLOCK(__section_alignment__) :
- {
- *(.rsrc)
- *(SORT(.rsrc$*))
- }
- .reloc BLOCK(__section_alignment__) :
- {
- *(.reloc)
- }
- .stab BLOCK(__section_alignment__) (NOLOAD) :
- {
- [ .stab ]
- }
- .stabstr BLOCK(__section_alignment__) (NOLOAD) :
- {
- [ .stabstr ]
- }
- .cygheap BLOCK(64 * 1024) :
- {
- __system_dlls__ = ABSOLUTE(.) ;
- __cygheap_start = ABSOLUTE(.) ;
- }
-}
diff --git a/winsup/cygwin/cygwin_version.h b/winsup/cygwin/cygwin_version.h
deleted file mode 100644
index 18bdf2416..000000000
--- a/winsup/cygwin/cygwin_version.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* cygwin_version.h: shared info for cygwin
-
- Copyright 2000, 2001 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 <cygwin/version.h>
-
-extern "C" {
-/* This is for programs that want to access the shared data. */
-class shared_info *cygwin_getshared (void);
-
-struct cygwin_version_info
-{
- unsigned short api_major;
- unsigned short api_minor;
- unsigned short dll_major;
- unsigned short dll_minor;
- unsigned short shared_data;
- unsigned short mount_registry;
- const char *dll_build_date;
- char shared_id[sizeof (CYGWIN_VERSION_DLL_IDENTIFIER) + 64];
-};
-
-extern cygwin_version_info cygwin_version;
-extern const char *cygwin_version_strings;
-}
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
deleted file mode 100644
index 6a358992d..000000000
--- a/winsup/cygwin/dcrt0.cc
+++ /dev/null
@@ -1,1069 +0,0 @@
-/* dcrt0.cc -- essentially the main() for the Cygwin dll
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <unistd.h>
-#include <stdlib.h>
-#include "glob.h"
-#include "exceptions.h"
-#include <ctype.h>
-#include <limits.h>
-#include <wingdi.h>
-#include <winuser.h>
-#include <errno.h>
-#include "sigproc.h"
-#include "pinfo.h"
-#include "cygerrno.h"
-#define NEED_VFORK
-#include "perprocess.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygheap.h"
-#include "child_info_magic.h"
-#include "perthread.h"
-#include "shared_info.h"
-#include "cygwin_version.h"
-#include "dll_init.h"
-#include "cygwin/cygserver_transport.h"
-#include "cygwin/cygserver.h"
-
-#define MAX_AT_FILE_LEVEL 10
-
-#define PREMAIN_LEN (sizeof (user_data->premain) / sizeof (user_data->premain[0]))
-
-HANDLE NO_COPY hMainProc = NULL;
-HANDLE NO_COPY hMainThread = NULL;
-
-sigthread NO_COPY mainthread; // ID of the main thread
-
-per_thread_waitq NO_COPY waitq_storage;
-per_thread_vfork NO_COPY vfork_storage;
-per_thread_signal_dispatch NO_COPY signal_dispatch_storage;
-
-per_thread NO_COPY *threadstuff[] = {&waitq_storage,
- &vfork_storage,
- &signal_dispatch_storage,
- NULL};
-
-BOOL display_title;
-BOOL strip_title_path;
-BOOL allow_glob = TRUE;
-codepage_type current_codepage = ansi_cp;
-
-int cygwin_finished_initializing;
-
-/* Used in SIGTOMASK for generating a bit for insertion into a sigset_t.
- This is subtracted from the signal number prior to shifting the bit.
- In older versions of cygwin, the signal was used as-is to shift the
- bit for masking. So, we'll temporarily detect this and set it to zero
- for programs that are linked using older cygwins. This is just a stopgap
- measure to allow an orderly transfer to the new, correct sigmask method. */
-unsigned NO_COPY int signal_shift_subtract = 1;
-
-ResourceLocks _reslock NO_COPY;
-MTinterface _mtinterf;
-
-bool NO_COPY _cygwin_testing;
-unsigned NO_COPY _cygwin_testing_magic;
-
-extern "C"
-{
- void *export_malloc (unsigned int);
- void export_free (void *);
- void *export_realloc (void *, unsigned int);
- void *export_calloc (unsigned int, unsigned int);
-
- /* This is an exported copy of environ which can be used by DLLs
- which use cygwin.dll. */
- char **__cygwin_environ;
- char ***main_environ;
- /* __progname used in getopt error message */
- char *__progname;
- struct _reent reent_data = _REENT_INIT(reent_data);
- struct per_process __cygwin_user_data =
- {/* initial_sp */ 0, /* magic_biscuit */ 0,
- /* dll_major */ CYGWIN_VERSION_DLL_MAJOR,
- /* dll_major */ CYGWIN_VERSION_DLL_MINOR,
- /* impure_ptr_ptr */ NULL, /* envptr */ NULL,
- /* malloc */ export_malloc, /* free */ export_free,
- /* realloc */ export_realloc,
- /* fmode_ptr */ NULL, /* main */ NULL, /* ctors */ NULL,
- /* dtors */ NULL, /* data_start */ NULL, /* data_end */ NULL,
- /* bss_start */ NULL, /* bss_end */ NULL,
- /* calloc */ export_calloc,
- /* premain */ {NULL, NULL, NULL, NULL},
- /* run_ctors_p */ 0,
- /* unused */ {0, 0, 0, 0, 0, 0, 0},
- /* forkee */ 0,
- /* hmodule */ NULL,
- /* api_major */ CYGWIN_VERSION_API_MAJOR,
- /* api_minor */ CYGWIN_VERSION_API_MINOR,
- /* unused2 */ {0, 0, 0, 0, 0},
- /* resourcelocks */ &_reslock, /* threadinterface */ &_mtinterf,
- /* impure_ptr */ &reent_data,
- };
- bool ignore_case_with_glob;
- int __declspec (dllexport) _check_for_executable = TRUE;
-#ifdef DEBUGGING
- int pinger;
-#endif
-};
-
-char *old_title;
-char title_buf[TITLESIZE + 1];
-
-static void
-do_global_dtors (void)
-{
- if (user_data->dtors)
- {
- void (**pfunc)() = user_data->dtors;
- while (*++pfunc)
- (*pfunc) ();
- }
-}
-
-static void __stdcall
-do_global_ctors (void (**in_pfunc)(), int force)
-{
- if (!force)
- {
- if (user_data->forkee || user_data->run_ctors_p)
- return; // inherit constructed stuff from parent pid
- user_data->run_ctors_p = 1;
- }
-
- /* Run ctors backwards, so skip the first entry and find how many
- there are, then run them. */
-
- void (**pfunc)() = in_pfunc;
-
- while (*++pfunc)
- ;
- while (--pfunc > in_pfunc)
- (*pfunc) ();
-
- if (user_data->magic_biscuit == SIZEOF_PER_PROCESS)
- atexit (do_global_dtors);
-}
-
-/*
- * Replaces -@file in the command line with the contents of the file.
- * There may be multiple -@file's in a single command line
- * A \-@file is replaced with -@file so that echo \-@foo would print
- * -@foo and not the contents of foo.
- */
-static int __stdcall
-insert_file (char *name, char *&cmd)
-{
- HANDLE f;
- DWORD size;
-
- f = CreateFile (name + 1,
- GENERIC_READ, /* open for reading */
- FILE_SHARE_READ, /* share for reading */
- &sec_none_nih, /* no security */
- OPEN_EXISTING, /* existing file only */
- FILE_ATTRIBUTE_NORMAL, /* normal file */
- NULL); /* no attr. template */
-
- if (f == INVALID_HANDLE_VALUE)
- {
- debug_printf ("couldn't open file '%s', %E", name);
- return FALSE;
- }
-
- /* This only supports files up to about 4 billion bytes in
- size. I am making the bold assumption that this is big
- enough for this feature */
- size = GetFileSize (f, NULL);
- if (size == 0xFFFFFFFF)
- {
- debug_printf ("couldn't get file size for '%s', %E", name);
- return FALSE;
- }
-
- int new_size = strlen (cmd) + size + 2;
- char *tmp = (char *) malloc (new_size);
- if (!tmp)
- {
- debug_printf ("malloc failed, %E");
- return FALSE;
- }
-
- /* realloc passed as it should */
- DWORD rf_read;
- BOOL rf_result;
- rf_result = ReadFile (f, tmp, size, &rf_read, NULL);
- CloseHandle (f);
- if (!rf_result || (rf_read != size))
- {
- debug_printf ("ReadFile failed, %E");
- return FALSE;
- }
-
- tmp[size++] = ' ';
- strcpy (tmp + size, cmd);
- cmd = tmp;
- return TRUE;
-}
-
-static inline int
-isquote (char c)
-{
- char ch = c;
- return ch == '"' || ch == '\'';
-}
-
-/* Step over a run of characters delimited by quotes */
-static /*__inline*/ char *
-quoted (char *cmd, int winshell)
-{
- char *p;
- char quote = *cmd;
-
- if (!winshell)
- {
- char *p;
- strcpy (cmd, cmd + 1);
- if ((p = strchr (cmd, quote)) != NULL)
- strcpy (p, p + 1);
- else
- p = strchr (cmd, '\0');
- return p;
- }
-
- const char *s = quote == '\'' ? "'" : "\\\"";
- /* This must have been run from a Windows shell, so preserve
- quotes for globify to play with later. */
- while (*cmd && *++cmd)
- if ((p = strpbrk (cmd, s)) == NULL)
- {
- cmd = strchr (cmd, '\0'); // no closing quote
- break;
- }
- else if (*p == '\\')
- cmd = ++p;
- else if (quote == '"' && p[1] == '"')
- {
- *p = '\\';
- cmd = ++p; // a quoted quote
- }
- else
- {
- cmd = p + 1; // point to after end
- break;
- }
- return cmd;
-}
-
-/* Perform a glob on word if it contains wildcard characters.
- Also quote every character between quotes to force glob to
- treat the characters literally. */
-static int __stdcall
-globify (char *word, char **&argv, int &argc, int &argvlen)
-{
- if (*word != '~' && strpbrk (word, "?*[\"\'(){}") == NULL)
- return 0;
-
- int n = 0;
- char *p, *s;
- int dos_spec = isdrive (word);
- if (!dos_spec && isquote (*word) && word[1] && word[2])
- dos_spec = isdrive (word + 1);
-
- /* We'll need more space if there are quoting characters in
- word. If that is the case, doubling the size of the
- string should provide more than enough space. */
- if (strpbrk (word, "'\""))
- n = strlen (word);
- char pattern[strlen (word) + ((dos_spec + 1) * n) + 1];
-
- /* Fill pattern with characters from word, quoting any
- characters found within quotes. */
- for (p = pattern, s = word; *s != '\000'; s++, p++)
- if (!isquote (*s))
- {
- if (dos_spec && *s == '\\')
- *p++ = '\\';
- *p = *s;
- }
- else
- {
- char quote = *s;
- while (*++s && *s != quote)
- {
- if (dos_spec || *s != '\\')
- /* nothing */;
- else if (s[1] == quote || s[1] == '\\')
- s++;
- *p++ = '\\';
- *p++ = *s;
- }
- if (*s == quote)
- p--;
- if (*s == '\0')
- break;
- }
-
- *p = '\0';
-
- glob_t gl;
- gl.gl_offs = 0;
-
- /* Attempt to match the argument. Return just word (minus quoting) if no match. */
- if (glob (pattern, GLOB_TILDE | GLOB_NOCHECK | GLOB_BRACE | GLOB_QUOTE, NULL, &gl) || !gl.gl_pathc)
- return 0;
-
- /* Allocate enough space in argv for the matched filenames. */
- n = argc;
- if ((argc += gl.gl_pathc) > argvlen)
- {
- argvlen = argc + 10;
- argv = (char **) realloc (argv, (1 + argvlen) * sizeof (argv[0]));
- }
-
- /* Copy the matched filenames to argv. */
- char **gv = gl.gl_pathv;
- char **av = argv + n;
- while (*gv)
- {
- debug_printf ("argv[%d] = '%s'\n", n++, *gv);
- *av++ = *gv++;
- }
-
- /* Clean up after glob. */
- free (gl.gl_pathv);
- return 1;
-}
-
-/* Build argv, argc from string passed from Windows. */
-
-static void __stdcall
-build_argv (char *cmd, char **&argv, int &argc, int winshell)
-{
- int argvlen = 0;
- int nesting = 0; // monitor "nesting" from insert_file
-
- argc = 0;
- argvlen = 0;
- argv = NULL;
-
- /* Scan command line until there is nothing left. */
- while (*cmd)
- {
- /* Ignore spaces */
- if (issep (*cmd))
- {
- cmd++;
- continue;
- }
-
- /* Found the beginning of an argument. */
- char *word = cmd;
- char *sawquote = NULL;
- while (*cmd)
- {
- if (*cmd != '"' && (!winshell || *cmd != '\''))
- cmd++; // Skip over this character
- else
- /* Skip over characters until the closing quote */
- {
- sawquote = cmd;
- cmd = quoted (cmd, winshell && argc > 0);
- }
- if (issep (*cmd)) // End of argument if space
- break;
- }
- if (*cmd)
- *cmd++ = '\0'; // Terminate `word'
-
- /* Possibly look for @file construction assuming that this isn't
- the very first argument and the @ wasn't quoted */
- if (argc && sawquote != word && *word == '@')
- {
- if (++nesting > MAX_AT_FILE_LEVEL)
- api_fatal ("Too many levels of nesting for %s", word);
- if (insert_file (word, cmd))
- continue; // There's new stuff in cmd now
- }
-
- /* See if we need to allocate more space for argv */
- if (argc >= argvlen)
- {
- argvlen = argc + 10;
- argv = (char **) realloc (argv, (1 + argvlen) * sizeof (argv[0]));
- }
-
- /* Add word to argv file after (optional) wildcard expansion. */
- if (!winshell || !argc || !globify (word, argv, argc, argvlen))
- {
- debug_printf ("argv[%d] = '%s'\n", argc, word);
- argv[argc++] = word;
- }
- }
-
- argv[argc] = NULL;
-
- debug_printf ("argc %d", argc);
-}
-
-/* sanity and sync check */
-void __stdcall
-check_sanity_and_sync (per_process *p)
-{
- /* Sanity check to make sure developers didn't change the per_process */
- /* struct without updating SIZEOF_PER_PROCESS [it makes them think twice */
- /* about changing it]. */
- if (sizeof (per_process) != SIZEOF_PER_PROCESS)
- {
- api_fatal ("per_process sanity check failed");
- }
-
- /* Make sure that the app and the dll are in sync. */
-
- /* Complain if older than last incompatible change */
- if (p->dll_major < CYGWIN_VERSION_DLL_EPOCH)
- api_fatal ("cygwin DLL and APP are out of sync -- DLL version mismatch %d < %d",
- p->dll_major, CYGWIN_VERSION_DLL_EPOCH);
-
- /* magic_biscuit != 0 if using the old style version numbering scheme. */
- if (p->magic_biscuit != SIZEOF_PER_PROCESS)
- api_fatal ("Incompatible cygwin .dll -- incompatible per_process info %d != %d",
- p->magic_biscuit, SIZEOF_PER_PROCESS);
-
- /* Complain if incompatible API changes made */
- if (p->api_major != cygwin_version.api_major)
- api_fatal ("cygwin DLL and APP are out of sync -- API version mismatch %d < %d",
- p->api_major, cygwin_version.api_major);
-
- if (CYGWIN_VERSION_DLL_MAKE_COMBINED (p->dll_major, p->dll_minor) <=
- CYGWIN_VERSION_DLL_BAD_SIGNAL_MASK)
- signal_shift_subtract = 0;
-}
-
-static NO_COPY STARTUPINFO si;
-# define fork_info ((struct child_info_fork *)(si.lpReserved2))
-# define spawn_info ((struct child_info_spawn *)(si.lpReserved2))
-child_info_fork NO_COPY *child_proc_info = NULL;
-static MEMORY_BASIC_INFORMATION sm;
-
-#define CYGWIN_GUARD ((wincap.has_page_guard ()) ? PAGE_GUARD : PAGE_NOACCESS)
-
-// __inline__ void
-extern void
-alloc_stack_hard_way (child_info_fork *ci, volatile char *b)
-{
- void *new_stack_pointer;
- MEMORY_BASIC_INFORMATION m;
- void *newbase;
- int newlen;
- LPBYTE curbot = (LPBYTE) sm.BaseAddress + sm.RegionSize;
- bool noguard;
-
- if (ci->stacktop > (LPBYTE) sm.AllocationBase && ci->stacktop < curbot)
- {
- newbase = curbot;
- newlen = (LPBYTE) ci->stackbottom - (LPBYTE) curbot;
- noguard = 1;
- }
- else
- {
- newbase = ci->stacktop;
- newlen = (DWORD) ci->stackbottom - (DWORD) ci->stacktop;
- noguard = 0;
- }
- if (!VirtualAlloc (newbase, newlen, MEM_RESERVE, PAGE_NOACCESS))
- api_fatal ("fork: can't reserve memory for stack %p - %p, %E",
- ci->stacktop, ci->stackbottom);
-
- new_stack_pointer = (void *) ((LPBYTE) ci->stackbottom - ci->stacksize);
-
- if (!VirtualAlloc (new_stack_pointer, ci->stacksize, MEM_COMMIT,
- PAGE_EXECUTE_READWRITE))
- api_fatal ("fork: can't commit memory for stack %p(%d), %E",
- new_stack_pointer, ci->stacksize);
- if (!VirtualQuery ((LPCVOID) new_stack_pointer, &m, sizeof m))
- api_fatal ("fork: couldn't get new stack info, %E");
- if (!noguard)
- {
- m.BaseAddress = (LPVOID)((DWORD)m.BaseAddress - 1);
- if (!VirtualAlloc ((LPVOID) m.BaseAddress, 1, MEM_COMMIT,
- PAGE_EXECUTE_READWRITE|CYGWIN_GUARD))
- api_fatal ("fork: couldn't allocate new stack guard page %p, %E",
- m.BaseAddress);
- }
- if (!VirtualQuery ((LPCVOID) m.BaseAddress, &m, sizeof m))
- api_fatal ("fork: couldn't get new stack info, %E");
- ci->stacktop = m.BaseAddress;
- *b = 0;
-}
-
-/* extend the stack prior to fork longjmp */
-
-static void
-alloc_stack (child_info_fork *ci)
-{
- /* FIXME: adding 16384 seems to avoid a stack copy problem during
- fork on Win95, but I don't know exactly why yet. DJ */
- volatile char b[ci->stacksize + 16384];
-
- if (!VirtualQuery ((LPCVOID) &b, &sm, sizeof sm))
- api_fatal ("fork: couldn't get stack info, %E");
-
- if (sm.AllocationBase != ci->stacktop)
- alloc_stack_hard_way (ci, b + sizeof (b) - 1);
- else
- ci->stacksize = 0;
-
- return;
-}
-
-static NO_COPY int mypid = 0;
-int _declspec(dllexport) __argc;
-char _declspec(dllexport) **__argv;
-vfork_save NO_COPY *main_vfork = NULL;
-
-void
-sigthread::init (const char *s)
-{
- InitializeCriticalSection (&lock);
- id = GetCurrentThreadId ();
-}
-
-/* Take over from libc's crt0.o and start the application. Note the
- various special cases when Cygwin DLL is being runtime loaded (as
- opposed to being link-time loaded by Cygwin apps) from a non
- cygwin app via LoadLibrary. */
-static void
-dll_crt0_1 ()
-{
- /* According to onno@stack.urc.tue.nl, the exception handler record must
- be on the stack. */
- /* FIXME: Verify forked children get their exception handler set up ok. */
- exception_list cygwin_except_entry;
-
- /* Initialize SIGSEGV handling, etc. */
- init_exceptions (&cygwin_except_entry);
-
- /* Set the os_being_run global. */
- wincap.init ();
- check_sanity_and_sync (user_data);
-
- do_global_ctors (&__CTOR_LIST__, 1);
-
- /* Nasty static stuff needed by newlib -- point to a local copy of
- the reent stuff.
- Note: this MUST be done here (before the forkee code) as the
- fork copy code doesn't copy the data in libccrt0.cc (that's why we
- pass in the per_process struct into the .dll from libccrt0). */
-
- _impure_ptr = &reent_data;
-
- user_data->resourcelocks->Init ();
- user_data->threadinterface->Init (user_data->forkee);
-
- threadname_init ();
- debug_init ();
- (void) getpagesize (); /* initialize page size constant */
-
- regthread ("main", GetCurrentThreadId ());
- mainthread.init ("mainthread"); // For use in determining if signals
- // should be blocked.
-
- int envc = 0;
- char **envp = NULL;
-
- if (child_proc_info)
- {
- switch (child_proc_info->type)
- {
- case _PROC_FORK:
- cygheap_fixup_in_child (child_proc_info, 0);
- alloc_stack (fork_info);
- set_myself (mypid);
- ProtectHandle (child_proc_info->forker_finished);
- break;
- case _PROC_SPAWN:
- if (spawn_info->hexec_proc)
- CloseHandle (spawn_info->hexec_proc);
- goto around;
- case _PROC_EXEC:
- hexec_proc = spawn_info->hexec_proc;
- around:
- HANDLE h;
- cygheap_fixup_in_child (spawn_info, 1);
- if (!spawn_info->moreinfo->myself_pinfo ||
- !DuplicateHandle (hMainProc, spawn_info->moreinfo->myself_pinfo,
- hMainProc, &h, 0, 0,
- DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
- h = NULL;
- set_myself (mypid, h);
- myself->uid = spawn_info->moreinfo->uid;
- __argc = spawn_info->moreinfo->argc;
- __argv = spawn_info->moreinfo->argv;
- envp = spawn_info->moreinfo->envp;
- envc = spawn_info->moreinfo->envc;
- cygheap->fdtab.fixup_after_exec (spawn_info->parent);
- signal_fixup_after_exec (child_proc_info->type == PROC_SPAWN);
- CloseHandle (spawn_info->parent);
- if (spawn_info->moreinfo->old_title)
- {
- old_title = strcpy (title_buf, spawn_info->moreinfo->old_title);
- cfree (spawn_info->moreinfo->old_title);
- }
- if (child_proc_info->subproc_ready)
- ProtectHandle (child_proc_info->subproc_ready);
- if (myself->uid == ILLEGAL_UID)
- cygheap->user.set_sid (NULL);
- break;
- }
- }
- ProtectHandle (hMainProc);
- ProtectHandle (hMainThread);
-
- /* Initialize the cygwin subsystem if this is the first process,
- or attach to shared data structures if it's already running. */
- memory_init ();
- cygheap->fdtab.vfork_child_fixup ();
-
- (void) SetErrorMode (SEM_FAILCRITICALERRORS);
-
- /* Initialize events. */
- events_init ();
-
- cygheap->cwd.init ();
- main_vfork = vfork_storage.create ();
-
- cygbench ("pre-forkee");
- if (user_data->forkee)
- {
- /* If we've played with the stack, stacksize != 0. That means that
- fork() was invoked from other than the main thread. Make sure that
- frame pointer is referencing the new stack so that the OS knows what
- to do when it needs to increase the size of the stack.
-
- NOTE: Don't do anything that involves the stack until you've completed
- this step. */
- if (fork_info->stacksize)
- {
- asm ("movl %0,%%fs:4" : : "r" (fork_info->stackbottom));
- asm ("movl %0,%%fs:8" : : "r" (fork_info->stacktop));
- }
-
- longjmp (fork_info->jmp, fork_info->cygpid);
- }
-
-#ifdef DEBUGGING
- {
- extern void fork_init ();
- fork_init ();
- }
-#endif
-
- /* Initialize our process table entry. */
- pinfo_init (envp, envc);
-
- if (!old_title && GetConsoleTitle (title_buf, TITLESIZE))
- old_title = title_buf;
-
- /* Allocate cygheap->fdtab */
- dtable_init ();
-
-/* Initialize uid, gid. */
- uinfo_init ();
-
- /* Initialize signal/subprocess handling. */
- sigproc_init ();
-
- cygserver_init ();
-
- /* Connect to tty. */
- tty_init ();
-
- if (!__argc)
- {
- char *line = GetCommandLineA ();
- line = strcpy ((char *) alloca (strlen (line) + 1), line);
-
- if (current_codepage == oem_cp)
- CharToOemA (line, line);
-
- /* Scan the command line and build argv. Expand wildcards if not
- called from another cygwin process. */
- build_argv (line, __argv, __argc,
- NOTSTATE (myself, PID_CYGPARENT) && allow_glob);
-
- /* Convert argv[0] to posix rules if it's currently blatantly
- win32 style. */
- if ((strchr (__argv[0], ':')) || (strchr (__argv[0], '\\')))
- {
- char *new_argv0 = (char *) alloca (MAX_PATH);
- cygwin_conv_to_posix_path (__argv[0], new_argv0);
- char *p = strchr (new_argv0, '\0') - 4;
- if (p > new_argv0 && strcasematch (p, ".exe"))
- *p = '\0';
- __argv[0] = new_argv0;
- }
- }
-
- if (user_data->premain[0])
- for (unsigned int i = 0; i < PREMAIN_LEN / 2; i++)
- user_data->premain[i] (__argc, __argv, user_data);
-
- /* Set up standard fds in file descriptor table. */
- cygheap->fdtab.stdio_init ();
-
- /* Set up __progname for getopt error call. */
- __progname = __argv[0];
-
- /* Set new console title if appropriate. */
-
- if (display_title && !dynamically_loaded)
- {
- char *cp = __progname;
- if (strip_title_path)
- for (char *ptr = cp; *ptr && *ptr != ' '; ptr++)
- if (isdirsep (*ptr))
- cp = ptr + 1;
- set_console_title (cp);
- }
-
- cygwin_finished_initializing = 1;
- /* Call init of loaded dlls. */
- dlls.init ();
-
- /* Execute any specified "premain" functions */
- if (user_data->premain[PREMAIN_LEN / 2])
- for (unsigned int i = PREMAIN_LEN / 2; i < PREMAIN_LEN; i++)
- user_data->premain[i] (__argc, __argv, user_data);
-
- debug_printf ("user_data->main %p", user_data->main);
-
- if (dynamically_loaded)
- {
- set_errno (0);
- return;
- }
-
- /* Disable case-insensitive globbing */
- ignore_case_with_glob = FALSE;
-
- /* Flush signals and ensure that signal thread is up and running. Can't
- do this for noncygwin case since the signal thread is blocked due to
- LoadLibrary serialization. */
- sig_send (NULL, __SIGFLUSH);
-
- set_errno (0);
-
- MALLOC_CHECK;
- cygbench (__progname);
- if (user_data->main)
- exit (user_data->main (__argc, __argv, *user_data->envptr));
-}
-
-void
-initial_env ()
-{
- char buf[MAX_PATH + 1];
-#ifdef DEBUGGING
- if (GetEnvironmentVariable ("CYGWIN_SLEEP", buf, sizeof (buf) - 1))
- {
- console_printf ("Sleeping %d, pid %u\n", atoi (buf), GetCurrentProcessId ());
- Sleep (atoi (buf));
- }
-#endif
-
- if (GetEnvironmentVariable ("CYGWIN_TESTING", buf, sizeof (buf) - 1))
- {
- _cygwin_testing = 1;
- DWORD len;
- if ((len = GetModuleFileName (cygwin_hmodule, buf, MAX_PATH))
- && len > sizeof ("new-cygwin1.dll")
- && strcasematch (buf + len - sizeof ("new-cygwin1.dll"),
- "\\new-cygwin1.dll"))
- _cygwin_testing_magic = 0x10;
- }
-}
-
-/* Wrap the real one, otherwise gdb gets confused about
- two symbols with the same name, but different addresses.
-
- UPTR is a pointer to global data that lives on the libc side of the
- line [if one distinguishes the application from the dll]. */
-
-extern "C" void __stdcall
-_dll_crt0 ()
-{
- DECLARE_TLS_STORAGE;
- initial_env ();
- char zeros[sizeof (fork_info->zero)] = {0};
-#ifdef DEBUGGING
- strace.microseconds ();
-#endif
-
- main_environ = user_data->envptr;
- *main_environ = NULL;
-
- early_stuff_init ();
- if (!DuplicateHandle (GetCurrentProcess (), GetCurrentProcess (),
- GetCurrentProcess (), &hMainProc, 0, FALSE,
- DUPLICATE_SAME_ACCESS))
- hMainProc = GetCurrentProcess ();
-
- DuplicateHandle (hMainProc, GetCurrentThread (), hMainProc,
- &hMainThread, 0, false, DUPLICATE_SAME_ACCESS);
-
- GetStartupInfo (&si);
- if (si.cbReserved2 >= EXEC_MAGIC_SIZE &&
- memcmp (fork_info->zero, zeros, sizeof (zeros)) == 0)
- {
- if ((fork_info->intro & OPROC_MAGIC_MASK) == OPROC_MAGIC_GENERIC)
- multiple_cygwin_problem ("proc", fork_info->intro, 0);
- else if (fork_info->intro == PROC_MAGIC_GENERIC
- && fork_info->magic != CHILD_INFO_MAGIC)
- multiple_cygwin_problem ("proc", fork_info->magic, CHILD_INFO_MAGIC);
- unsigned should_be_cb = 0;
- switch (fork_info->type)
- {
- case _PROC_FORK:
- user_data->forkee = fork_info->cygpid;
- should_be_cb = sizeof (child_info_fork);
- /* fall through */;
- case _PROC_SPAWN:
- if (fork_info->pppid_handle)
- CloseHandle (fork_info->pppid_handle);
- /* fall through */;
- case _PROC_EXEC:
- if (!should_be_cb)
- should_be_cb = sizeof (child_info);
- if (should_be_cb != fork_info->cb)
- multiple_cygwin_problem ("proc size", fork_info->cb, should_be_cb);
- else if (sizeof (fhandler_union) != fork_info->fhandler_union_cb)
- multiple_cygwin_problem ("fhandler size", fork_info->fhandler_union_cb, sizeof (fhandler_union));
- else
- {
- child_proc_info = fork_info;
- cygwin_mount_h = child_proc_info->mount_h;
- mypid = child_proc_info->cygpid;
- break;
- }
- default:
- system_printf ("unknown exec type %d", fork_info->type);
- fork_info = NULL;
- break;
- }
- }
- dll_crt0_1 ();
-}
-
-void
-dll_crt0 (per_process *uptr)
-{
- DECLARE_TLS_STORAGE;
- /* Set the local copy of the pointer into the user space. */
- if (uptr && uptr != user_data)
- {
- memcpy (user_data, uptr, per_process_overwrite);
- *(user_data->impure_ptr_ptr) = &reent_data;
- }
- _dll_crt0 ();
-}
-
-/* This must be called by anyone who uses LoadLibrary to load cygwin1.dll */
-extern "C" void
-cygwin_dll_init ()
-{
- static char **envp;
- static int _fmode;
-
- if (!DuplicateHandle (GetCurrentProcess (), GetCurrentProcess (),
- GetCurrentProcess (), &hMainProc, 0, FALSE,
- DUPLICATE_SAME_ACCESS))
- hMainProc = GetCurrentProcess ();
-
- DuplicateHandle (hMainProc, GetCurrentThread (), hMainProc,
- &hMainThread, 0, FALSE, DUPLICATE_SAME_ACCESS);
- user_data->magic_biscuit = sizeof (per_process);
-
- user_data->envptr = &envp;
- user_data->fmode_ptr = &_fmode;
-
- dll_crt0_1 ();
-}
-
-extern "C" void
-__main (void)
-{
- do_global_ctors (user_data->ctors, FALSE);
-}
-
-enum
- {
- ES_SIGNAL = 1,
- ES_CLOSEALL = 2,
- ES_SIGPROCTERMINATE = 3
- };
-
-extern "C" void __stdcall
-do_exit (int status)
-{
- UINT n = (UINT) status;
- static int NO_COPY exit_state = 0;
-
- syscall_printf ("do_exit (%d)", n);
-
- vfork_save *vf = vfork_storage.val ();
- if (vf != NULL && vf->pid < 0)
- {
- vf->pid = status < 0 ? status : -status;
- longjmp (vf->j, 1);
- }
-
- if (exit_state < ES_SIGNAL)
- {
- exit_state = ES_SIGNAL;
- if (!(n & EXIT_REPARENTING))
- {
- signal (SIGCHLD, SIG_IGN);
- signal (SIGHUP, SIG_IGN);
- signal (SIGINT, SIG_IGN);
- signal (SIGQUIT, SIG_IGN);
- }
- }
-
- if (exit_state < ES_CLOSEALL)
- {
- exit_state = ES_CLOSEALL;
- close_all_files ();
- }
-
- if (exit_state < ES_SIGPROCTERMINATE)
- {
- exit_state = ES_SIGPROCTERMINATE;
- sigproc_terminate ();
- }
-
- if (n & EXIT_REPARENTING)
- n &= ~EXIT_REPARENTING;
- else
- {
- myself->stopsig = 0;
-
- /* restore console title */
- if (old_title && display_title)
- set_console_title (old_title);
-
- /* Kill orphaned children on group leader exit */
- if (myself->has_pgid_children && myself->pid == myself->pgid)
- {
- sigproc_printf ("%d == pgrp %d, send SIG{HUP,CONT} to stopped children",
- myself->pid, myself->pgid);
- kill_pgrp (myself->pgid, -SIGHUP);
- }
-
- /* Kill the foreground process group on session leader exit */
- if (getpgrp () > 0 && myself->pid == myself->sid && real_tty_attached (myself))
- {
- tty *tp = cygwin_shared->tty[myself->ctty];
- sigproc_printf ("%d == sid %d, send SIGHUP to children",
- myself->pid, myself->sid);
-
- /* CGF FIXME: This can't be right. */
- if (tp->getsid () == myself->sid)
- tp->kill_pgrp (SIGHUP);
- }
-
- tty_terminate ();
- }
-
- window_terminate ();
- events_terminate ();
- shared_terminate ();
-
- minimal_printf ("winpid %d, exit %d", GetCurrentProcessId (), n);
- myself->exit (n);
-}
-
-extern "C" void
-_exit (int n)
-{
- do_exit ((DWORD) n & 0xffff);
-}
-
-extern "C" void
-__api_fatal (const char *fmt, ...)
-{
- char buf[4096];
- va_list ap;
-
- va_start (ap, fmt);
- __small_vsprintf (buf, fmt, ap);
- va_end (ap);
- strcat (buf, "\n");
- int len = strlen (buf);
- DWORD done;
- (void) WriteFile (GetStdHandle (STD_ERROR_HANDLE), buf, len, &done, 0);
-
- /* Make sure that the message shows up on the screen, too, since this is
- a serious error. */
- if (GetFileType (GetStdHandle (STD_ERROR_HANDLE)) != FILE_TYPE_CHAR)
- {
- HANDLE h = CreateFileA ("CONOUT$", GENERIC_READ|GENERIC_WRITE,
- FILE_SHARE_WRITE | FILE_SHARE_WRITE, &sec_none,
- OPEN_EXISTING, 0, 0);
- if (h)
- (void) WriteFile (h, buf, len, &done, 0);
- }
-
- /* We are going down without mercy. Make sure we reset
- our process_state. */
- sigproc_terminate ();
-#ifdef DEBUGGING
- (void) try_to_debug ();
-#endif
- myself->exit (1);
-}
-
-void
-multiple_cygwin_problem (const char *what, unsigned magic_version, unsigned version)
-{
- if (_cygwin_testing && strstr (what, "proc"))
- {
- fork_info = NULL;
- return;
- }
-
- char buf[1024];
- if (GetEnvironmentVariable ("CYGWIN_MISMATCH_OK", buf, sizeof (buf)))
- return;
-
- if (CYGWIN_VERSION_MAGIC_VERSION (magic_version) == version)
- system_printf ("%s magic number mismatch detected - %p/%p", what, magic_version, version);
- else
- api_fatal ("%s version mismatch detected - %p/%p.\n\
-You have multiple copies of cygwin1.dll on your system.\n\
-Search for cygwin1.dll using the Windows Start->Find/Search facility\n\
-and delete all but the most recent version. The most recent version *should*\n\
-reside in x:\\cygwin\\bin, where 'x' is the drive on which you have\n\
-installed the cygwin distribution.", what, magic_version, version);
-}
-
-#ifdef DEBUGGING
-void __stdcall
-cygbench (const char *s)
-{
- char buf[1024];
- if (GetEnvironmentVariable ("CYGWIN_BENCH", buf, sizeof (buf)))
- small_printf ("%05d ***** %s : %10d\n", GetCurrentProcessId (), s, strace.microseconds ());
-}
-#endif
diff --git a/winsup/cygwin/debug.cc b/winsup/cygwin/debug.cc
deleted file mode 100644
index 5d3d63bbc..000000000
--- a/winsup/cygwin/debug.cc
+++ /dev/null
@@ -1,361 +0,0 @@
-/* debug.cc
-
- Copyright 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#include "winsup.h"
-#include "exceptions.h"
-#include "sync.h"
-#include "sigproc.h"
-#include "pinfo.h"
-#include "perthread.h"
-#include "perprocess.h"
-#include "security.h"
-#include "cygerrno.h"
-
-#undef CloseHandle
-
-static muto NO_COPY *threadname_lock = NULL;
-#define lock_threadname() \
- do {if (threadname_lock) threadname_lock->acquire (INFINITE); } while (0)
-
-#define unlock_threadname() \
- do {if (threadname_lock) threadname_lock->release (); } while (0)
-
-typedef struct
- {
- DWORD id;
- const char *name;
- } thread_info;
-
-static NO_COPY thread_info threads[32] = {{0, NULL}}; // increase as necessary
-#define NTHREADS (sizeof (threads) / sizeof (threads[0]))
-
-void
-threadname_init ()
-{
- new_muto (threadname_lock);
-}
-
-void __stdcall
-regthread (const char *name, DWORD tid)
-{
- lock_threadname ();
- for (DWORD i = 0; i < NTHREADS; i++)
- if (threads[i].name == NULL || strcmp (threads[i].name, name) == 0 ||
- threads[i].id == tid)
- {
- threads[i].name = name;
- threads[i].id = tid;
- break;
- }
- unlock_threadname ();
-}
-
-int __stdcall
-iscygthread ()
-{
- DWORD tid = GetCurrentThreadId ();
- if (tid != mainthread.id)
- for (DWORD i = 0; i < NTHREADS && threads[i].name != NULL; i++)
- if (threads[i].id == tid)
- return 1;
- return 0;
-}
-
-struct thread_start
- {
- LONG notavail;
- LPTHREAD_START_ROUTINE func;
- VOID *arg;
- };
-
-/* A place to store arguments to thread_stub since they can't be
- stored on the stack. An available element is !notavail. */
-thread_start NO_COPY start_buf[NTHREADS] = {{0, NULL,NULL}};
-
-/* Initial stub called by makethread. Performs initial per-thread
- initialization. */
-static DWORD WINAPI
-thread_stub (VOID *arg)
-{
- DECLARE_TLS_STORAGE;
- LPTHREAD_START_ROUTINE threadfunc = ((thread_start *) arg)->func;
- VOID *threadarg = ((thread_start *) arg)->arg;
-
- exception_list except_entry;
-
- /* Give up our slot in the start_buf array */
- (void) InterlockedExchange (&((thread_start *) arg)->notavail, 0);
-
- /* Initialize this thread's ability to respond to things like
- SIGSEGV or SIGFPE. */
- init_exceptions (&except_entry);
-
- ExitThread (threadfunc (threadarg));
-}
-
-/* Wrapper for CreateThread. Registers the thread name/id and ensures that
- cygwin threads are properly initialized. */
-HANDLE __stdcall
-makethread (LPTHREAD_START_ROUTINE start, LPVOID param, DWORD flags,
- const char *name)
-{
- DWORD tid;
- HANDLE h;
- thread_start *info; /* Various information needed by the newly created thread */
-
- for (;;)
- {
- /* Search the start_buf array for an empty slot to use */
- for (info = start_buf; info < start_buf + NTHREADS; info++)
- if (!InterlockedExchange (&info->notavail, 1))
- goto out;
-
- /* Should never hit here, but be defensive anyway. */
- Sleep (0);
- }
-
-out:
- info->func = start; /* Real function to start */
- info->arg = param; /* The single parameter to the thread */
-
- if ((h = CreateThread (&sec_none_nih, 0, thread_stub, (VOID *) info, flags,
- &tid)))
- regthread (name, tid); /* Register for debugging output. */
-
- return h;
-}
-
-/* Return the symbolic name of the current thread for debugging.
- */
-const char * __stdcall
-threadname (DWORD tid, int lockit)
-{
- const char *res = NULL;
- if (!tid)
- tid = GetCurrentThreadId ();
-
- if (lockit)
- lock_threadname ();
- for (DWORD i = 0; i < NTHREADS && threads[i].name != NULL; i++)
- if (threads[i].id == tid)
- {
- res = threads[i].name;
- break;
- }
- if (lockit)
- unlock_threadname ();
-
- if (!res)
- {
- static char buf[30] NO_COPY = {0};
- __small_sprintf (buf, "unknown (%p)", tid);
- res = buf;
- }
-
- return res;
-}
-
-#ifdef DEBUGGING
-/* Here lies extra debugging routines which help track down internal
- Cygwin problems when compiled with -DDEBUGGING . */
-#include <stdlib.h>
-
-typedef struct _h
- {
- BOOL allocated;
- HANDLE h;
- const char *name;
- const char *func;
- int ln;
- DWORD clexec_pid;
- struct _h *next;
- } handle_list;
-
-static NO_COPY handle_list starth = {0, NULL, NULL, NULL, 0, 0, NULL};
-static NO_COPY handle_list *endh = NULL;
-
-static handle_list NO_COPY freeh[1000] = {{0, NULL, NULL, NULL, 0, 0, NULL}};
-#define NFREEH (sizeof (freeh) / sizeof (freeh[0]))
-
-static muto NO_COPY *debug_lock = NULL;
-
-struct lock_debug
-{
- lock_debug () {if (debug_lock) debug_lock->acquire (INFINITE);}
- void unlock () {if (debug_lock) debug_lock->release ();}
- ~lock_debug () {unlock ();}
-};
-
-static bool __stdcall mark_closed (const char *, int, HANDLE, const char *, BOOL);
-
-void
-debug_init ()
-{
- new_muto (debug_lock);
-}
-
-/* Find a registered handle in the linked list of handles. */
-static handle_list * __stdcall
-find_handle (HANDLE h)
-{
- handle_list *hl;
- for (hl = &starth; hl->next != NULL; hl = hl->next)
- if (hl->next->h == h)
- goto out;
- endh = hl;
- hl = NULL;
-
-out:
- return hl;
-}
-
-void
-setclexec_pid (HANDLE oh, HANDLE nh, bool setit)
-{
- handle_list *hl = find_handle (oh);
- if (hl)
- {
- hl->clexec_pid = setit ? GetCurrentProcessId () : 0;
- hl->h = nh;
- }
-}
-
-/* Create a new handle record */
-static handle_list * __stdcall
-newh ()
-{
- handle_list *hl;
- lock_debug here;
-
- for (hl = freeh; hl < freeh + NFREEH; hl++)
- if (hl->name == NULL)
- goto out;
-
- /* All used up??? */
- if ((hl = (handle_list *) malloc (sizeof *hl)) != NULL)
- {
- memset (hl, 0, sizeof (*hl));
- hl->allocated = TRUE;
- }
-
-out:
- return hl;
-}
-
-/* Add a handle to the linked list of known handles. */
-void __stdcall
-add_handle (const char *func, int ln, HANDLE h, const char *name)
-{
- handle_list *hl;
- lock_debug here;
-
- if ((hl = find_handle (h)))
- {
- hl = hl->next;
- system_printf ("%s:%d - multiple attempts to add handle %s<%p>", func,
- ln, name, h);
- system_printf (" previously allocated by %s:%d(%s<%p>)",
- hl->func, hl->ln, hl->name, hl->h);
- return;
- }
-
- if ((hl = newh ()) == NULL)
- {
- here.unlock ();
- system_printf ("couldn't allocate memory for %s(%d): %s(%p)",
- func, ln, name, h);
- return;
- }
- hl->h = h;
- hl->name = name;
- hl->func = func;
- hl->ln = ln;
- hl->next = NULL;
- endh->next = hl;
- endh = hl;
-
- return;
-}
-
-static void __stdcall
-delete_handle (handle_list *hl)
-{
- handle_list *hnuke = hl->next;
- hl->next = hl->next->next;
- if (hnuke->allocated)
- free (hnuke);
- else
- memset (hnuke, 0, sizeof (*hnuke));
-}
-
-void
-debug_fixup_after_fork ()
-{
- handle_list *hl;
- for (hl = &starth; hl->next != NULL; hl = hl->next)
- if (hl->next->clexec_pid)
- delete_handle (hl);
-}
-
-static bool __stdcall
-mark_closed (const char *func, int ln, HANDLE h, const char *name, BOOL force)
-{
- handle_list *hl;
- lock_debug here;
-
- if ((hl = find_handle (h)) && !force)
- {
- hl = hl->next;
- here.unlock (); // race here
- system_printf ("attempt to close protected handle %s:%d(%s<%p>)",
- hl->func, hl->ln, hl->name, hl->h);
- system_printf (" by %s:%d(%s<%p>)", func, ln, name, h);
- return FALSE;
- }
-
- handle_list *hln;
- if (hl && (hln = hl->next) && strcmp (name, hln->name))
- {
- system_printf ("closing protected handle %s:%d(%s<%p>)",
- hln->func, hln->ln, hln->name, hln->h);
- system_printf (" by %s:%d(%s<%p>)", func, ln, name, h);
- }
-
- if (hl)
- delete_handle (hl);
-
- return TRUE;
-}
-
-/* Close a known handle. Complain if !force and closing a known handle or
- if the name of the handle being closed does not match the registered name. */
-BOOL __stdcall
-close_handle (const char *func, int ln, HANDLE h, const char *name, BOOL force)
-{
- BOOL ret;
- lock_debug here;
-
- if (!mark_closed (func, ln, h, name, force))
- return FALSE;
-
- ret = CloseHandle (h);
-
-#if 0 /* Uncomment to see CloseHandle failures */
- if (!ret)
- small_printf ("CloseHandle(%s) failed %s:%d\n", name, func, ln);
-#endif
- return ret;
-}
-
-int __stdcall
-__set_errno (const char *func, int ln, int val)
-{
- debug_printf ("%s:%d val %d", func, ln, val);
- return _impure_ptr->_errno = val;
-}
-#endif /*DEBUGGING*/
diff --git a/winsup/cygwin/debug.h b/winsup/cygwin/debug.h
deleted file mode 100644
index 1b6e0fa1a..000000000
--- a/winsup/cygwin/debug.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* debug.h
-
- Copyright 1998, 1999, 2000, 2001 Red Hat, Inc.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#ifndef MALLOC_DEBUG
-#define MALLOC_CHECK do {} while (0)
-#else
-#include <stdlib.h>
-#include "dlmalloc.h"
-#define MALLOC_CHECK ({\
- debug_printf ("checking malloc pool");\
- (void)mallinfo ();\
-})
-#endif
-
-extern "C" {
-DWORD __stdcall WFSO (HANDLE, DWORD) __attribute__ ((regparm(2)));
-DWORD __stdcall WFMO (DWORD, CONST HANDLE *, BOOL, DWORD) __attribute__ ((regparm(3)));
-}
-
-#define WaitForSingleObject WFSO
-#define WaitForMultipleObject WFMO
-
-#if !defined(_DEBUG_H_)
-#define _DEBUG_H_
-
-#define being_debugged() \
- (IsDebuggerPresent () /* || GetLastError () == ERROR_PROC_NOT_FOUND*/)
-
-void threadname_init ();
-HANDLE __stdcall makethread (LPTHREAD_START_ROUTINE, LPVOID, DWORD, const char *) __attribute__ ((regparm(3)));
-const char * __stdcall threadname (DWORD, int lockit = TRUE) __attribute__ ((regparm(2)));
-void __stdcall regthread (const char *, DWORD) __attribute__ ((regparm(1)));
-int __stdcall iscygthread ();
-
-#ifndef DEBUGGING
-# define cygbench(s)
-# define ForceCloseHandle CloseHandle
-# define ForceCloseHandle1(h, n) CloseHandle (h)
-# define ForceCloseHandle2(h, n) CloseHandle (h)
-# define ProtectHandle(h) do {} while (0)
-# define ProtectHandle1(h,n) do {} while (0)
-# define ProtectHandle2(h,n) do {} while (0)
-# define debug_init() do {} while (0)
-# define setclexec_pid(h, nh, b) do {} while (0)
-# define debug_fixup_after_fork() do {} while (0)
-
-#else
-
-# ifdef NO_DEBUG_DEFINES
-# undef NO_DEBUG_DEFINES
-# else
-# define CloseHandle(h) \
- close_handle (__PRETTY_FUNCTION__, __LINE__, (h), #h, FALSE)
-# define ForceCloseHandle(h) \
- close_handle (__PRETTY_FUNCTION__, __LINE__, (h), #h, TRUE)
-# define ForceCloseHandle1(h,n) \
- close_handle (__PRETTY_FUNCTION__, __LINE__, (h), #n, TRUE)
-# define ForceCloseHandle2(h,n) \
- close_handle (__PRETTY_FUNCTION__, __LINE__, (h), n, TRUE)
-# endif
-
-# define ProtectHandle(h) add_handle (__PRETTY_FUNCTION__, __LINE__, (h), #h)
-# define ProtectHandle1(h, n) add_handle (__PRETTY_FUNCTION__, __LINE__, (h), #n)
-# define ProtectHandle2(h, n) add_handle (__PRETTY_FUNCTION__, __LINE__, (h), n)
-
-void debug_init ();
-void __stdcall add_handle (const char *, int, HANDLE, const char *)
- __attribute__ ((regparm (3)));
-BOOL __stdcall close_handle (const char *, int, HANDLE, const char *, BOOL)
- __attribute__ ((regparm (3)));
-void __stdcall cygbench (const char *s) __attribute__ ((regparm (1)));
-extern "C" void console_printf (const char *fmt,...);
-void setclexec_pid (HANDLE, HANDLE, bool);
-void debug_fixup_after_fork ();
-extern int pinger;
-
-#endif /*DEBUGGING*/
-#endif /*_DEBUG_H_*/
diff --git a/winsup/cygwin/delqueue.cc b/winsup/cygwin/delqueue.cc
deleted file mode 100644
index b7314eab2..000000000
--- a/winsup/cygwin/delqueue.cc
+++ /dev/null
@@ -1,103 +0,0 @@
-/* delqueue.cc
-
- Copyright 1996, 1998, 1999, 2000, 2001 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 "winsup.h"
-#include "shared_info.h"
-
-/* FIXME: this delqueue module is very flawed and should be rewritten.
- First, having an array of a fixed size for keeping track of the
- unlinked but not yet deleted files is bad. Second, some programs
- will unlink files and then create a new one in the same location
- and this behavior is not supported in the current code. Probably
- we should find a move/rename function that will work on open files,
- and move delqueue files to some special location or some such
- hack... */
-
-void
-delqueue_list::init ()
-{
- empty = 1;
- memset(inuse, 0, MAX_DELQUEUES_PENDING);
-}
-
-void
-delqueue_list::queue_file (const char *dosname)
-{
- char temp[MAX_PATH], *end;
- GetFullPathName (dosname, sizeof (temp), temp, &end);
-
- /* Note about race conditions: The only time we get to this point is
- when a delete fails because someone's holding the descriptor open.
- In those cases, other programs will be unable to delete the file
- also, so any entries referring to that file will not be removed
- from the queue while we're here. */
-
- if (!empty)
- {
- /* check for duplicates */
- for (int i=0; i < MAX_DELQUEUES_PENDING; i++)
- if (inuse[i] && strcmp(name[i], temp) == 0)
- return;
- }
-
- for (int i = 0; i < MAX_DELQUEUES_PENDING; i++)
- if (!inuse[i])
- {
- /* set the name first, in case someone else is running the
- queue they'll get a valid name */
- strcpy(name[i], temp);
- inuse[i] = 1;
- empty = 0;
- debug_printf ("adding '%s' to queue %d", temp, i);
- return;
- }
-
- system_printf ("Out of queue slots");
-}
-
-void
-delqueue_list::process_queue ()
-{
- if (empty)
- return;
- /* We set empty to 1 here, rather than later, to avoid a race
- condition - some other program might queue up a file while we're
- processing, and it will zero out empty also. */
- empty = 1; /* but might get set to zero again, below */
-
- syscall_printf ("Running delqueue");
-
- for (int i = 0; i < MAX_DELQUEUES_PENDING; i++)
- if (inuse[i])
- {
- if (DeleteFileA (name[i]))
- {
- syscall_printf ("Deleted %s", name[i]);
- inuse[i] = 0;
- }
- else
- {
- int res = GetLastError ();
- empty = 0;
- if (res == ERROR_SHARING_VIOLATION ||
- (wincap.access_denied_on_delete ()
- && res == ERROR_ACCESS_DENIED))
- {
- /* File still inuse, that's ok */
- syscall_printf ("Still using %s", name[i]);
- }
- else
- {
- syscall_printf ("Hmm, don't know what to do with '%s', %E", name[i]);
- inuse[i] = 0;
- }
- }
- }
-}
diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc
deleted file mode 100644
index 45ba57ff6..000000000
--- a/winsup/cygwin/dir.cc
+++ /dev/null
@@ -1,347 +0,0 @@
-/* dir.cc: Posix directory-related routines
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <errno.h>
-
-#define _COMPILING_NEWLIB
-#include <dirent.h>
-
-#include "pinfo.h"
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygheap.h"
-
-/* Cygwin internal */
-/* Return whether the directory of a file is writable. Return 1 if it
- is. Otherwise, return 0, and set errno appropriately. */
-int __stdcall
-writable_directory (const char *file)
-{
-#if 0
- char dir[strlen (file) + 1];
-
- strcpy (dir, file);
-
- const char *usedir;
- char *slash = strrchr (dir, '\\');
- if (slash == NULL)
- usedir = ".";
- else if (slash == dir)
- {
- usedir = "\\";
- }
- else
- {
- *slash = '\0';
- usedir = dir;
- }
-
- int acc = access (usedir, W_OK);
-
- return acc == 0;
-#else
- return 1;
-#endif
-}
-
-extern "C" int
-dirfd (DIR *dir)
-{
- if (check_null_invalid_struct_errno (dir))
- return -1;
- if (dir->__d_cookie != __DIRENT_COOKIE)
- {
- set_errno (EBADF);
- syscall_printf ("-1 = dirfd (%p)", dir);
- return -1;
- }
- return dir->__d_dirent->d_fd;
-}
-
-/* opendir: POSIX 5.1.2.1 */
-extern "C" DIR *
-opendir (const char *name)
-{
- fhandler_base *fh;
- path_conv pc;
- DIR *res;
-
- fh = cygheap->fdtab.build_fhandler_from_name (-1, name, NULL, pc,
- PC_SYM_FOLLOW | PC_FULL, NULL);
- if (!fh)
- res = NULL;
- else if (pc.exists ())
- res = fh->opendir (pc);
- else
- {
- set_errno (ENOENT);
- res = NULL;
- }
-
- if (!res && fh)
- delete fh;
- return res;
-}
-
-/* readdir: POSIX 5.1.2.1 */
-extern "C" struct dirent *
-readdir (DIR *dir)
-{
- if (check_null_invalid_struct_errno (dir))
- return NULL;
-
- if (dir->__d_cookie != __DIRENT_COOKIE)
- {
- set_errno (EBADF);
- syscall_printf ("%p = readdir (%p)", NULL, dir);
- return NULL;
- }
-
- dirent *res = ((fhandler_base *) dir->__d_u.__d_data.__fh)->readdir (dir);
-
- if (res)
- {
- /* Compute d_ino by combining filename hash with the directory hash
- (which was stored in dir->__d_dirhash when opendir was called). */
- if (res->d_name[0] == '.')
- {
- if (res->d_name[1] == '\0')
- dir->__d_dirent->d_ino = dir->__d_dirhash;
- else if (res->d_name[1] != '.' || res->d_name[2] != '\0')
- goto hashit;
- else
- {
- char *p, up[strlen (dir->__d_dirname) + 1];
- strcpy (up, dir->__d_dirname);
- if (!(p = strrchr (up, '\\')))
- goto hashit;
- *p = '\0';
- if (!(p = strrchr (up, '\\')))
- dir->__d_dirent->d_ino = hash_path_name (0, ".");
- else
- {
- *p = '\0';
- dir->__d_dirent->d_ino = hash_path_name (0, up);
- }
- }
- }
- else
- {
- hashit:
- ino_t dino = hash_path_name (dir->__d_dirhash, "\\");
- dir->__d_dirent->d_ino = hash_path_name (dino, res->d_name);
- }
- }
- return res;
-}
-
-extern "C" __off64_t
-telldir64 (DIR *dir)
-{
- if (check_null_invalid_struct_errno (dir))
- return -1;
-
- if (dir->__d_cookie != __DIRENT_COOKIE)
- return 0;
- return ((fhandler_base *) dir->__d_u.__d_data.__fh)->telldir (dir);
-}
-
-/* telldir */
-extern "C" __off32_t
-telldir (DIR *dir)
-{
- return telldir64 (dir);
-}
-
-extern "C" void
-seekdir64 (DIR *dir, __off64_t loc)
-{
- if (check_null_invalid_struct_errno (dir))
- return;
-
- if (dir->__d_cookie != __DIRENT_COOKIE)
- return;
- return ((fhandler_base *) dir->__d_u.__d_data.__fh)->seekdir (dir, loc);
-}
-
-/* seekdir */
-extern "C" void
-seekdir (DIR *dir, __off32_t loc)
-{
- seekdir64 (dir, (__off64_t)loc);
-}
-
-/* rewinddir: POSIX 5.1.2.1 */
-extern "C" void
-rewinddir (DIR *dir)
-{
- if (check_null_invalid_struct_errno (dir))
- return;
-
- if (dir->__d_cookie != __DIRENT_COOKIE)
- return;
- return ((fhandler_base *) dir->__d_u.__d_data.__fh)->rewinddir (dir);
-}
-
-/* closedir: POSIX 5.1.2.1 */
-extern "C" int
-closedir (DIR *dir)
-{
- if (check_null_invalid_struct_errno (dir))
- return -1;
-
- if (dir->__d_cookie != __DIRENT_COOKIE)
- {
- set_errno (EBADF);
- syscall_printf ("-1 = closedir (%p)", dir);
- return -1;
- }
-
- /* Reset the marker in case the caller tries to use `dir' again. */
- dir->__d_cookie = 0;
-
- int res = ((fhandler_base *) dir->__d_u.__d_data.__fh)->closedir (dir);
-
- cygheap->fdtab.release (dir->__d_dirent->d_fd);
-
- free (dir->__d_dirname);
- free (dir->__d_dirent);
- free (dir);
- syscall_printf ("%d = closedir (%p)", res);
- return res;
-}
-
-/* mkdir: POSIX 5.4.1.1 */
-extern "C" int
-mkdir (const char *dir, mode_t mode)
-{
- int res = -1;
- SECURITY_ATTRIBUTES sa = sec_none_nih;
-
- path_conv real_dir (dir, PC_SYM_NOFOLLOW);
-
- if (real_dir.error)
- {
- set_errno (real_dir.case_clash ? ECASECLASH : real_dir.error);
- goto done;
- }
-
- nofinalslash(real_dir.get_win32 (), real_dir.get_win32 ());
- if (! writable_directory (real_dir.get_win32 ()))
- goto done;
-
- if (allow_ntsec && real_dir.has_acls ())
- set_security_attribute (S_IFDIR | ((mode & 07777) & ~cygheap->umask),
- &sa, alloca (4096), 4096);
-
- if (CreateDirectoryA (real_dir.get_win32 (), &sa))
- {
- if (!allow_ntsec && allow_ntea)
- set_file_attribute (real_dir.has_acls (), real_dir.get_win32 (),
- S_IFDIR | ((mode & 07777) & ~cygheap->umask));
-#ifdef HIDDEN_DOT_FILES
- char *c = strrchr (real_dir.get_win32 (), '\\');
- if ((c && c[1] == '.') || *real_dir.get_win32 () == '.')
- SetFileAttributes (real_dir.get_win32 (), FILE_ATTRIBUTE_HIDDEN);
-#endif
- res = 0;
- }
- else
- __seterrno ();
-
-done:
- syscall_printf ("%d = mkdir (%s, %d)", res, dir, mode);
- return res;
-}
-
-/* rmdir: POSIX 5.5.2.1 */
-extern "C" int
-rmdir (const char *dir)
-{
- int res = -1;
- DWORD devn;
-
- path_conv real_dir (dir, PC_SYM_NOFOLLOW);
-
- if (real_dir.error)
- set_errno (real_dir.error);
- else if ((devn = real_dir.get_devn ()) == FH_PROC || devn == FH_REGISTRY
- || devn == FH_PROCESS)
- set_errno (EROFS);
- else if (!real_dir.exists ())
- set_errno (ENOENT);
- else if (!real_dir.isdir ())
- set_errno (ENOTDIR);
- else
- {
- /* Even own directories can't be removed if R/O attribute is set. */
- if (real_dir.has_attribute (FILE_ATTRIBUTE_READONLY))
- SetFileAttributes (real_dir,
- (DWORD) real_dir & ~FILE_ATTRIBUTE_READONLY);
-
- if (RemoveDirectory (real_dir))
- {
- /* RemoveDirectory on a samba drive doesn't return an error if the
- directory can't be removed because it's not empty. Checking for
- existence afterwards keeps us informed about success. */
- if (GetFileAttributes (real_dir) != INVALID_FILE_ATTRIBUTES)
- set_errno (ENOTEMPTY);
- else
- res = 0;
- }
- else
- {
- /* This kludge detects if we are attempting to remove the current working
- directory. If so, we will move elsewhere to potentially allow the
- rmdir to succeed. This means that cygwin's concept of the current working
- directory != Windows concept but, hey, whaddaregonnado?
- Note that this will not cause something like the following to work:
- $ cd foo
- $ rmdir .
- since the shell will have foo "open" in the above case and so Windows will
- not allow the deletion.
- FIXME: A potential workaround for this is for cygwin apps to *never* call
- SetCurrentDirectory. */
- if (strcasematch (real_dir, cygheap->cwd.win32)
- && !strcasematch ("c:\\", cygheap->cwd.win32))
- {
- DWORD err = GetLastError ();
- if (!SetCurrentDirectory ("c:\\"))
- SetLastError (err);
- else if ((res = rmdir (dir)))
- SetCurrentDirectory (cygheap->cwd.win32);
- }
- if (res)
- {
- if (GetLastError () != ERROR_ACCESS_DENIED
- || !wincap.access_denied_on_delete ())
- __seterrno ();
- else
- set_errno (ENOTEMPTY); /* On 9X ERROR_ACCESS_DENIED is
- returned if you try to remove a
- non-empty directory. */
-
- /* If directory still exists, restore R/O attribute. */
- if (real_dir.has_attribute (FILE_ATTRIBUTE_READONLY))
- SetFileAttributes (real_dir, real_dir);
- }
- }
- }
-
- syscall_printf ("%d = rmdir (%s)", res, dir);
- return res;
-}
diff --git a/winsup/cygwin/dlfcn.cc b/winsup/cygwin/dlfcn.cc
deleted file mode 100644
index b6babe66b..000000000
--- a/winsup/cygwin/dlfcn.cc
+++ /dev/null
@@ -1,151 +0,0 @@
-/* dlfcn.cc
-
- Copyright 1998, 2000, 2001 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 "winsup.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <ctype.h>
-#include "security.h"
-#include "fhandler.h"
-#include "perprocess.h"
-#include "path.h"
-#include "thread.h"
-#include "dlfcn.h"
-#include "dll_init.h"
-#include "cygerrno.h"
-
-#define _dl_error _reent_winsup ()->_dl_error
-#define _dl_buffer _reent_winsup ()->_dl_buffer
-
-static void __stdcall
-set_dl_error (const char *str)
-{
- __small_sprintf (_dl_buffer, "%s: %E", str);
- _dl_error = 1;
-}
-
-/* Look for an executable file given the name and the environment
- variable to use for searching (eg., PATH); returns the full
- pathname (static buffer) if found or NULL if not. */
-inline const char * __stdcall
-check_path_access (const char *mywinenv, const char *name, path_conv& buf)
-{
- return find_exec (name, buf, mywinenv, FE_NNF | FE_NATIVE | FE_CWD);
-}
-
-/* Search LD_LIBRARY_PATH for dll, if it exists.
- Return Windows version of given path. */
-static const char * __stdcall
-get_full_path_of_dll (const char* str, char *name)
-{
- int len = strlen (str);
-
- /* empty string or too long to be legal win32 pathname? */
- if (len == 0 || len >= MAX_PATH - 1)
- return str; /* Yes. Let caller deal with it. */
-
- const char *ret;
-
- strcpy (name, str); /* Put it somewhere where we can manipulate it. */
-
- /* Add extension if necessary */
- if (str[len - 1] != '.')
- {
- /* Add .dll only if no extension provided. */
- const char *p = strrchr (str, '.');
- if (!p || strpbrk (p, "\\/"))
- strcat (name, ".dll");
- }
-
- path_conv real_filename;
-
- if (isabspath (name) ||
- (ret = check_path_access ("LD_LIBRARY_PATH=", name, real_filename)) == NULL)
- real_filename.check (name); /* Convert */
-
- if (!real_filename.error)
- ret = strcpy (name, real_filename);
- else
- {
- set_errno (real_filename.error);
- ret = NULL;
- }
-
- return ret;
-}
-
-void *
-dlopen (const char *name, int)
-{
- SetResourceLock (LOCK_DLL_LIST, READ_LOCK | WRITE_LOCK, "dlopen");
-
- void *ret;
-
- if (name == NULL)
- ret = (void *) GetModuleHandle (NULL); /* handle for the current module */
- else
- {
- char buf[MAX_PATH];
- /* handle for the named library */
- const char *fullpath = get_full_path_of_dll (name, buf);
- if (!fullpath)
- ret = NULL;
- else
- {
- ret = (void *) LoadLibrary (fullpath);
- if (ret == NULL)
- __seterrno ();
- }
- }
-
- if (!ret)
- set_dl_error ("dlopen");
- debug_printf ("ret %p", ret);
-
- ReleaseResourceLock (LOCK_DLL_LIST, READ_LOCK | WRITE_LOCK, "dlopen");
- return ret;
-}
-
-void *
-dlsym (void *handle, const char *name)
-{
- void *ret = (void *) GetProcAddress ((HMODULE) handle, name);
- if (!ret)
- set_dl_error ("dlsym");
- debug_printf ("ret %p", ret);
- return ret;
-}
-
-int
-dlclose (void *handle)
-{
- SetResourceLock (LOCK_DLL_LIST, READ_LOCK | WRITE_LOCK, "dlclose");
-
- int ret = -1;
- void *temphandle = (void *) GetModuleHandle (NULL);
- if (temphandle == handle || FreeLibrary ((HMODULE) handle))
- ret = 0;
- if (ret)
- set_dl_error ("dlclose");
- CloseHandle ((HMODULE) temphandle);
-
- ReleaseResourceLock (LOCK_DLL_LIST, READ_LOCK | WRITE_LOCK, "dlclose");
- return ret;
-}
-
-char *
-dlerror ()
-{
- char *ret = 0;
- if (_dl_error)
- ret = _dl_buffer;
- return ret;
-}
diff --git a/winsup/cygwin/dll_init.cc b/winsup/cygwin/dll_init.cc
deleted file mode 100644
index 5a5b165dc..000000000
--- a/winsup/cygwin/dll_init.cc
+++ /dev/null
@@ -1,412 +0,0 @@
-/* dll_init.cc
-
- Copyright 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#include "winsup.h"
-#include <stdlib.h>
-#include <errno.h>
-#include "cygerrno.h"
-#include "perprocess.h"
-#include "dll_init.h"
-#include "environ.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygheap.h"
-#include "pinfo.h"
-
-extern void __stdcall check_sanity_and_sync (per_process *);
-
-dll_list NO_COPY dlls;
-
-static NO_COPY int in_forkee = 0;
-static int dll_global_dtors_recorded;
-
-/* Run destructors for all DLLs on exit. */
-static void
-dll_global_dtors()
-{
- for (dll *d = dlls.istart (DLL_ANY); d; d = dlls.inext ())
- d->p.run_dtors ();
-}
-
-/* Run all constructors associated with a dll */
-void
-per_module::run_ctors ()
-{
- void (**pfunc)() = ctors;
-
- /* Run ctors backwards, so skip the first entry and find how many
- there are, then run them. */
-
- if (pfunc)
- {
- int i;
- for (i = 1; pfunc[i]; i++);
-
- for (int j = i - 1; j > 0; j--)
- (pfunc[j]) ();
- }
-}
-
-/* Run all destructors associated with a dll */
-void
-per_module::run_dtors ()
-{
- void (**pfunc)() = dtors;
- for (int i = 1; pfunc[i]; i++)
- (pfunc[i]) ();
-}
-
-/* Initialize an individual DLL */
-int
-dll::init ()
-{
- int ret = 1;
-
- /* Why didn't we just import this variable? */
- *(p.envptr) = __cygwin_environ;
-
- /* Don't run constructors or the "main" if we've forked. */
- if (!in_forkee)
- {
- /* global contructors */
- p.run_ctors ();
-
- /* entry point of dll (use main of per_process with null args...) */
- if (p.main)
- ret = (*(p.main)) (0, 0, 0);
- }
-
- return ret;
-}
-
-/* Look for a dll based on name */
-dll *
-dll_list::operator[] (const char *name)
-{
- dll *d = &start;
- while ((d = d->next) != NULL)
- if (strcasematch (name, d->name))
- return d;
-
- return NULL;
-}
-
-#define RETRIES 1000
-
-/* Allocate space for a dll struct contiguous with the just-loaded dll. */
-dll *
-dll_list::alloc (HINSTANCE h, per_process *p, dll_type type)
-{
- char name[MAX_PATH + 1];
- DWORD namelen = GetModuleFileName (h, name, sizeof (name));
-
- /* Already loaded? */
- dll *d = dlls[name];
- if (d)
- {
- d->count++; /* Yes. Bump the usage count. */
- return d; /* Return previously allocated pointer. */
- }
-
- SYSTEM_INFO s1;
- GetSystemInfo (&s1);
-
- int i;
- void *s = p->bss_end;
- DWORD n;
- MEMORY_BASIC_INFORMATION m;
- /* Search for space after the DLL */
- for (i = 0; i <= RETRIES; i++, s = (char *) m.BaseAddress + m.RegionSize)
- {
- if (!VirtualQuery (s, &m, sizeof (m)))
- return NULL; /* Can't do it. */
- if (m.State == MEM_FREE)
- {
- /* Couldn't find any. Uh oh. FIXME: Issue an error? */
- if (i == RETRIES)
- return NULL; /* Oh well. Couldn't locate free space. */
-
- /* Ensure that this is rounded to the nearest page boundary.
- FIXME: Should this be ensured by VirtualQuery? */
- n = (DWORD) m.BaseAddress;
- DWORD r = n % s1.dwAllocationGranularity;
-
- if (r)
- n = ((n - r) + s1.dwAllocationGranularity);
-
- /* First reserve the area of memory, then commit it. */
- if (VirtualAlloc ((void *) n, sizeof (dll), MEM_RESERVE, PAGE_READWRITE))
- d = (dll *) VirtualAlloc ((void *) n, sizeof (dll), MEM_COMMIT,
- PAGE_READWRITE);
- if (d)
- break;
- }
- }
-
- /* Did we succeed? */
- if (d == NULL)
- { /* Nope. */
-#ifdef DEBUGGING
- system_printf ("VirtualAlloc failed, %E");
-#endif
- __seterrno ();
- return NULL;
- }
-
- /* Now we've allocated a block of information. Fill it in with the supplied
- info about this DLL. */
- d->count = 1;
- d->namelen = namelen;
- strcpy (d->name, name);
- d->handle = h;
- d->p = p;
- d->type = type;
- if (end == NULL)
- end = &start; /* Point to "end" of dll chain. */
- end->next = d; /* Standard linked list stuff. */
- d->next = NULL;
- d->prev = end;
- end = d;
- tot++;
- if (type == DLL_LOAD)
- loaded_dlls++;
- return d;
-}
-
-/* Detach a DLL from the chain. */
-void
-dll_list::detach (dll *d)
-{
- if (!myself || myself->process_state == PID_EXITED)
- return;
-
- if (d->count <= 0)
- system_printf ("WARNING: try to detach an already detached dll ...\n");
- else if (--d->count == 0)
- {
- d->p.run_dtors ();
- d->prev->next = d->next;
- if (d->next)
- d->next->prev = d->prev;
- if (d->type == DLL_LOAD)
- loaded_dlls--;
- if (end == d)
- end = d->prev;
- VirtualFree (d, 0, MEM_RELEASE);
- }
-}
-
-/* Initialization for all linked DLLs, called by dll_crt0_1. */
-void
-dll_list::init ()
-{
- /* Make sure that destructors are called on exit. */
- if (!dll_global_dtors_recorded)
- {
- atexit (dll_global_dtors);
- dll_global_dtors_recorded = 1;
- }
-
- /* Walk the dll chain, initializing each dll */
- dll *d = &start;
- while ((d = d->next))
- d->init ();
-}
-
-#define A64K (64 * 1024)
-
-/* Mark every memory address up to "here" as reserved. This may force
- Windows NT to load a DLL in the next available, lowest slot. */
-static void
-reserve_upto (const char *name, DWORD here)
-{
- DWORD size;
- MEMORY_BASIC_INFORMATION mb;
- for (DWORD start = 0x10000; start < here; start += size)
- if (!VirtualQuery ((void *) start, &mb, sizeof (mb)))
- size = 64 * 1024;
- else
- {
- size = A64K * ((mb.RegionSize + A64K - 1) / A64K);
- start = A64K * (((DWORD) mb.BaseAddress + A64K - 1) / A64K);
-
- if (start + size > here)
- size = here - start;
- if (mb.State == MEM_FREE &&
- !VirtualAlloc ((void *) start, size, MEM_RESERVE, PAGE_NOACCESS))
- api_fatal ("couldn't allocate memory %p(%d) for '%s' alignment, %E\n",
- start, size, name);
- }
-}
-
-/* Release all of the memory previously allocated by "upto" above.
- Note that this may also free otherwise reserved memory. If that becomes
- a problem, we'll have to keep track of the memory that we reserve above. */
-static void
-release_upto (const char *name, DWORD here)
-{
- DWORD size;
- MEMORY_BASIC_INFORMATION mb;
- for (DWORD start = 0x10000; start < here; start += size)
- if (!VirtualQuery ((void *) start, &mb, sizeof (mb)))
- size = 64 * 1024;
- else
- {
- size = mb.RegionSize;
- if (!(mb.State == MEM_RESERVE && mb.AllocationProtect == PAGE_NOACCESS &&
- ((void *) start < cygheap->heapbase || (void *) start > cygheap->heaptop)))
- continue;
- if (!VirtualFree ((void *) start, 0, MEM_RELEASE))
- api_fatal ("couldn't release memory %p(%d) for '%s' alignment, %E\n",
- start, size, name);
- }
-}
-
-/* Reload DLLs after a fork. Iterates over the list of dynamically loaded DLLs
- and attempts to load them in the same place as they were loaded in the parent. */
-void
-dll_list::load_after_fork (HANDLE parent, dll *first)
-{
- in_forkee = 1;
- int try2 = 0;
- dll d;
-
- void *next = first;
- while (next)
- {
- DWORD nb;
- /* Read the dll structure from the parent. */
- if (!ReadProcessMemory (parent, next, &d, sizeof (dll), &nb) ||
- nb != sizeof (dll))
- return;
-
- /* We're only interested in dynamically loaded dlls.
- Hopefully, this function wouldn't even have been called unless
- the parent had some of those. */
- if (d.type == DLL_LOAD)
- {
- HMODULE h = LoadLibraryEx (d.name, NULL, DONT_RESOLVE_DLL_REFERENCES);
-
- /* See if DLL will load in proper place. If so, free it and reload
- it the right way.
- It sort of stinks that we can't invert the order of the FreeLibrary
- and LoadLibrary since Microsoft documentation seems to imply that that
- should do what we want. However, since the library was loaded above,
- the second LoadLibrary does not execute it's startup code unless it
- is first unloaded. */
- if (h == d.handle)
- {
- FreeLibrary (h);
- LoadLibrary (d.name);
- }
- else if (try2)
- api_fatal ("unable to remap %s to same address as parent -- %p", d.name, h);
- else
- {
- /* It loaded in the wrong place. Dunno why this happens but it always
- seems to happen when there are multiple DLLs attempting to load into
- the same address space. In the "forked" process, the second DLL always
- loads into a different location. */
- FreeLibrary (h);
- /* Block all of the memory up to the new load address. */
- reserve_upto (d.name, (DWORD) d.handle);
- try2 = 1; /* And try */
- continue; /* again. */
- }
- /* If we reached here, and try2 is set, then there is a lot of memory to
- release. */
- if (try2)
- {
- release_upto (d.name, (DWORD) d.handle);
- try2 = 0;
- }
- }
- next = d.next; /* Get the address of the next DLL. */
- }
- in_forkee = 0;
-}
-
-extern "C" int
-dll_dllcrt0 (HMODULE h, per_process *p)
-{
- if (p == NULL)
- p = &__cygwin_user_data;
- else
- *(p->impure_ptr_ptr) = __cygwin_user_data.impure_ptr;
-
- /* Partially initialize Cygwin guts for non-cygwin apps. */
- if (dynamically_loaded && user_data->magic_biscuit == 0)
- dll_crt0 (p);
- else
- check_sanity_and_sync (p);
-
- dll_type type;
-
- /* If this function is called before cygwin has finished
- initializing, then the DLL must be a cygwin-aware DLL
- that was explicitly linked into the program rather than
- a dlopened DLL. */
- if (!cygwin_finished_initializing)
- type = DLL_LINK;
- else
- {
- type = DLL_LOAD;
- dlls.reload_on_fork = 1;
- }
-
- /* Allocate and initialize space for the DLL. */
- dll *d = dlls.alloc (h, p, type);
-
- /* If d == NULL, then something is broken.
- Otherwise, if we've finished initializing, it's ok to
- initialize the DLL. If we haven't finished initializing,
- it may not be safe to call the dll's "main" since not
- all of cygwin's internal structures may have been set up. */
- if (!d || (cygwin_finished_initializing && !d->init ()))
- return -1;
-
- return (DWORD) d;
-}
-
-/* OBSOLETE: This function is obsolescent and will go away in the
- future. Cygwin can now handle being loaded from a noncygwin app
- using the same entry point. */
-
-extern "C" int
-dll_noncygwin_dllcrt0 (HMODULE h, per_process *p)
-{
- return dll_dllcrt0 (h, p);
-}
-
-extern "C" void
-cygwin_detach_dll (dll *d)
-{
- dlls.detach (d);
-}
-
-extern "C" void
-dlfork (int val)
-{
- dlls.reload_on_fork = val;
-}
-
-/* Called from various places to update all of the individual
- ideas of the environ block. Explain to me again why we didn't
- just import __cygwin_environ? */
-void __stdcall
-update_envptrs ()
-{
- extern char ***main_environ;
- for (dll *d = dlls.istart (DLL_ANY); d; d = dlls.inext ())
- {
- *(d->p.envptr) = __cygwin_environ;
- }
- *main_environ = __cygwin_environ;
-}
diff --git a/winsup/cygwin/dll_init.h b/winsup/cygwin/dll_init.h
deleted file mode 100644
index bc9687bf7..000000000
--- a/winsup/cygwin/dll_init.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* dll_init.h
-
- Copyright 1998, 1999, 2000, 2001 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 per_module
-{
- char ***envptr;
- void (**ctors)(void);
- void (**dtors)(void);
- void *data_start;
- void *data_end;
- void *bss_start;
- void *bss_end;
- int (*main)(int, char **, char **);
- per_module &operator = (per_process *p)
- {
- envptr = p->envptr;
- ctors = p->ctors;
- dtors = p->dtors;
- data_start = p->data_start;
- data_end = p->data_end;
- bss_start = p->bss_start;
- bss_end = p->bss_end;
- main = p->main;
- return *this;
- }
- void run_ctors ();
- void run_dtors ();
-};
-
-
-typedef enum
-{
- DLL_NONE,
- DLL_LINK,
- DLL_LOAD,
- DLL_ANY
-} dll_type;
-
-struct dll
-{
- struct dll *next, *prev;
- per_module p;
- HMODULE handle;
- int count;
- dll_type type;
- int namelen;
- char name[MAX_PATH + 1];
- void detach ();
- int init ();
-};
-
-#define MAX_DLL_BEFORE_INIT 100
-
-class dll_list
-{
- dll *end;
- dll *hold;
- dll_type hold_type;
-public:
- dll start;
- int tot;
- int loaded_dlls;
- int reload_on_fork;
- dll *operator [] (const char *name);
- dll *alloc (HINSTANCE, per_process *, dll_type);
- void detach (dll *);
- void init ();
- void load_after_fork (HANDLE, dll *);
- dll *inext ()
- {
- while ((hold = hold->next))
- if (hold_type == DLL_ANY || hold->type == hold_type)
- break;
- return hold;
- }
- dll *istart (dll_type t)
- {
- hold_type = t;
- hold = &start;
- return inext ();
- }
-};
-
-extern dll_list dlls;
diff --git a/winsup/cygwin/dll_init.sgml b/winsup/cygwin/dll_init.sgml
deleted file mode 100644
index 38070390c..000000000
--- a/winsup/cygwin/dll_init.sgml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-<sect1 id="func-cygwin-detach-dll">
-<title>cygwin_detach_dll</title>
-
-<funcsynopsis>
-<funcdef>extern "C" void
-<function>cygwin_detach_dll</function></funcdef>
-<paramdef>int <parameter>dll_index</parameter></paramdef>
-</funcsynopsis>
-
-</sect1>
diff --git a/winsup/cygwin/dlmalloc.c b/winsup/cygwin/dlmalloc.c
deleted file mode 100644
index de14fcb6a..000000000
--- a/winsup/cygwin/dlmalloc.c
+++ /dev/null
@@ -1,3906 +0,0 @@
-/*
- * To do:
- * - strdup? maybe shouldn't bother yet, it seems difficult to get includes
- * right using dlmalloc.h
- * - add STD_C prototyping
- * - adhere to comment conventions
- * - maybe fix ALLOCFILL vs. MOATFILL in do_init_realloced_chunk()
- * - keep a list of mmaped regions for checking in malloc_update_mallinfo()
- * - I think memalign() is wrong: it aligns the chunk rather than the memory
- * portion of the chunk.
- * - "& -alignment" in memalign() is suspect: should use "& ~alignment"
- * instead?
- * - malloc.h doesn't need malloc_COPY or probably a bunch of other stuff
- * - add mallopt options for e.g. fill?
- * - come up with a non-BBC version of M_C
- * - document necessity of checking chunk address in do_check_chunk prior to
- * accessing any of its fields
- * Done:
- * minor speedup due to extend check before mremap
- * minor speedup due to returning malloc() result in memalign() if aligned
- * made malloc_update_mallinfo() check alloced regions at start of sbrk area
- * fixed bug: After discovering foreign sbrk, if old_top was MINSIZE, would
- * reduce old_top_size to 0, thus making inuse(old_top) return 0; other
- * functions would consequently attempt to access old_top->{fd,bk}, which
- * were invalid. This is in malloc_extend_top(), in the "double
- * fencepost" section.
- * Documentation:
- * malloc_usable_size(P) is equivalent to realloc(P, malloc_usable_size(P))
- *
- * $Log$
- * Revision 1.5 2001/10/03 03:49:25 cgf
- * * cygheap.cc (cfree): Remove malloc debugging probe.
- * * dlmalloc.c (errprint): Remove abort() call which causes interesting error
- * message printing to abort prematurely.
- * * environ.cc: Sprinkle MALLOC_CHECKs liberally throughout.
- * (_addenv): Allocate two empty elements at end of environ to
- * (apparently) work around problems with some buggy applications.
- * (winenv): Avoid calling alloca if no forced environment variable is present.
- *
- * * exceptions.cc (open_stackdumpfile): Don't print "Dumping stack trace to..."
- * when running in a cygwin environment (i.e., the parent is a cygwin process).
- *
- * * dtable.cc (dtable::init_std_file_from_handle): Move device type detection
- * code from build_fhandler here since it is only used by this function.
- * (dtable::build_fhandler_from_name): New method. Renamed from
- * dtable::build_fhandler.
- * (dtable::build_fhandler): Use build_fhandler_from_name.
- * (cygwin_attach_handle_to_fd): Ditto.
- * * syscalls.cc (_open): Ditto.
- * (stat_worker): Ditto.
- * * dtable.h (dtable::build_fhandler_from_name): Rename declaration from
- * dtable::build_fhandler.
- *
- * Revision 1.4 2001/09/07 21:32:04 cgf
- * * cygheap.h (init_cygheap): Move heap pointers here.
- * * include/sys/cygwin.h (perprocess): Remove heap pointers.
- * * dcrt0.cc (__cygwin_user_data): Reflect obsolete perprocess stuff.
- * (_dll_crt0): Don't initialize heap pointers.
- * (cygwin_dll_init): Ditto.
- * (release_upto): Use heap pointers from cygheap.
- * * heap.h: Ditto.
- * * fork.cc (fork_parent): Ditto. Don't set heap pointers in ch.
- * (fork_child): Remove obsolete sigproc_fixup_after_fork.
- * * shared.cc (memory_init): Reorganize so that cygheap initialization is called
- * prior to regular heap since regular heap uses cygheap now.
- * * sigproc.cc (proc_subproc): Eliminate zombies allocation.
- * (sigproc_init): Move zombies alloation here. Don't free up array on fork, just
- * reuse it.
- * (sigproc_fixup_after_fork): Eliminate.
- * * sigproc.h: Ditto.
- * * include/cygwin/version.h: Reflect change to perprocess structure.
- *
- * Revision 1.3 2001/06/26 14:47:48 cgf
- * * mmap.cc: Clean up *ResourceLock calls throughout.
- * * thread.cc (pthread_cond::TimedWait): Check for WAIT_TIMEOUT as well as
- * WAIT_ABANDONED.
- * (__pthread_cond_timedwait): Calculate a relative wait from the abstime
- * parameter.
- *
- * Revision 1.2 2001/06/24 22:26:49 cgf
- * forced commit
- *
- * Revision 1.1 2001/04/24 15:25:30 duda
- * * dlmalloc.c: New file. Port of Doug Lea's malloc
- * * dlmalloc.h: Ditto.
- * * Makefile.in: Add support for MALLOC_DEBUG
- * * config.h.in: Ditto.
- * * winsup.h: Ditto.
- * * configure.in: Add --enable-malloc-debugging option.
- * * configure: Regenerate.
- * * debug.h: Include declarations for debugging malloc.
- * * tty.cc (grantpt): Fix definition.
- * (unlockpt): Ditto.
- *
- * Revision 1.1 1997/12/24 18:34:47 nsd
- * Initial revision
- *
- */
-/* ---------- To make a malloc.h, start cutting here ------------ */
-
-/*
- A version of malloc/free/realloc written by Doug Lea and released to the
- public domain. Send questions/comments/complaints/performance data
- to dl@cs.oswego.edu
-
-* VERSION 2.6.4 Thu Nov 28 07:54:55 1996 Doug Lea (dl at gee)
-
- Note: There may be an updated version of this malloc obtainable at
- ftp://g.oswego.edu/pub/misc/malloc.c
- Check before installing!
-
-* Why use this malloc?
-
- This is not the fastest, most space-conserving, most portable, or
- most tunable malloc ever written. However it is among the fastest
- while also being among the most space-conserving, portable and tunable.
- Consistent balance across these factors results in a good general-purpose
- allocator. For a high-level description, see
- http://g.oswego.edu/dl/html/malloc.html
-
-* Synopsis of public routines
-
- (Much fuller descriptions are contained in the program documentation below.)
-
- malloc(size_t n);
- Return a pointer to a newly allocated chunk of at least n bytes, or null
- if no space is available.
- free(Void_t* p);
- Release the chunk of memory pointed to by p, or no effect if p is null.
- realloc(Void_t* p, size_t n);
- Return a pointer to a chunk of size n that contains the same data
- as does chunk p up to the minimum of (n, p's size) bytes, or null
- if no space is available. The returned pointer may or may not be
- the same as p. If p is null, equivalent to malloc. Unless the
- #define realloc_ZERO_BYTES_FREES below is set, realloc with a
- size argument of zero (re)allocates a minimum-sized chunk.
- memalign(size_t alignment, size_t n);
- Return a pointer to a newly allocated chunk of n bytes, aligned
- in accord with the alignment argument, which must be a power of
- two.
- valloc(size_t n);
- Equivalent to memalign(pagesize, n), where pagesize is the page
- size of the system (or as near to this as can be figured out from
- all the includes/defines below.)
- pvalloc(size_t n);
- Equivalent to valloc(minimum-page-that-holds(n)), that is,
- round up n to nearest pagesize.
- calloc(size_t unit, size_t quantity);
- Returns a pointer to quantity * unit bytes, with all locations
- set to zero.
- cfree(Void_t* p);
- Equivalent to free(p).
- malloc_trim(size_t pad);
- Release all but pad bytes of freed top-most memory back
- to the system. Return 1 if successful, else 0.
- malloc_usable_size(Void_t* p);
- Report the number usable allocated bytes associated with allocated
- chunk p. This may or may not report more bytes than were requested,
- due to alignment and minimum size constraints.
- malloc_stats();
- Prints brief summary statistics on stderr.
- mallinfo()
- Returns (by copy) a struct containing various summary statistics.
- mallopt(int parameter_number, int parameter_value)
- Changes one of the tunable parameters described below. Returns
- 1 if successful in changing the parameter, else 0.
-
-* Vital statistics:
-
- Alignment: 8-byte
- 8 byte alignment is currently hardwired into the design. This
- seems to suffice for all current machines and C compilers.
-
- Assumed pointer representation: 4 or 8 bytes
- Code for 8-byte pointers is untested by me but has worked
- reliably by Wolfram Gloger, who contributed most of the
- changes supporting this.
-
- Assumed size_t representation: 4 or 8 bytes
- Note that size_t is allowed to be 4 bytes even if pointers are 8.
-
- Minimum overhead per allocated chunk: 4 or 8 bytes
- Each malloced chunk has a hidden overhead of 4 bytes holding size
- and status information.
-
- Minimum allocated size: 4-byte ptrs: 16 bytes (including 4 overhead)
- 8-byte ptrs: 24/32 bytes (including, 4/8 overhead)
-
- When a chunk is freed, 12 (for 4byte ptrs) or 20 (for 8 byte
- ptrs but 4 byte size) or 24 (for 8/8) additional bytes are
- needed; 4 (8) for a trailing size field
- and 8 (16) bytes for free list pointers. Thus, the minimum
- allocatable size is 16/24/32 bytes.
-
- Even a request for zero bytes (i.e., malloc(0)) returns a
- pointer to something of the minimum allocatable size.
-
- Maximum allocated size: 4-byte size_t: 2^31 - 8 bytes
- 8-byte size_t: 2^63 - 16 bytes
-
- It is assumed that (possibly signed) size_t bit values suffice to
- represent chunk sizes. `Possibly signed' is due to the fact
- that `size_t' may be defined on a system as either a signed or
- an unsigned type. To be conservative, values that would appear
- as negative numbers are avoided.
- Requests for sizes with a negative sign bit will return a
- minimum-sized chunk.
-
- Maximum overhead wastage per allocated chunk: normally 15 bytes
-
- Alignnment demands, plus the minimum allocatable size restriction
- make the normal worst-case wastage 15 bytes (i.e., up to 15
- more bytes will be allocated than were requested in malloc), with
- two exceptions:
- 1. Because requests for zero bytes allocate non-zero space,
- the worst case wastage for a request of zero bytes is 24 bytes.
- 2. For requests >= mmap_threshold that are serviced via
- mmap(), the worst case wastage is 8 bytes plus the remainder
- from a system page (the minimal mmap unit); typically 4096 bytes.
-
-* Limitations
-
- Here are some features that are NOT currently supported
-
- * No user-definable hooks for callbacks and the like.
- * No automated mechanism for fully checking that all accesses
- to malloced memory stay within their bounds.
- * No support for compaction.
-
-* Synopsis of compile-time options:
-
- People have reported using previous versions of this malloc on all
- versions of Unix, sometimes by tweaking some of the defines
- below. It has been tested most extensively on Solaris and
- Linux. It is also reported to work on WIN32 platforms.
- People have also reported adapting this malloc for use in
- stand-alone embedded systems.
-
- The implementation is in straight, hand-tuned ANSI C. Among other
- consequences, it uses a lot of macros. Because of this, to be at
- all usable, this code should be compiled using an optimizing compiler
- (for example gcc -O2) that can simplify expressions and control
- paths.
-
- __STD_C (default: derived from C compiler defines)
- Nonzero if using ANSI-standard C compiler, a C++ compiler, or
- a C compiler sufficiently close to ANSI to get away with it.
- DEBUG (default: NOT defined)
- Define to enable debugging. Adds fairly extensive assertion-based
- checking to help track down memory errors, but noticeably slows down
- execution.
- realloc_ZERO_BYTES_FREES (default: NOT defined)
- Define this if you think that realloc(p, 0) should be equivalent
- to free(p). Otherwise, since malloc returns a unique pointer for
- malloc(0), so does realloc(p, 0).
- HAVE_memcpy (default: defined)
- Define if you are not otherwise using ANSI STD C, but still
- have memcpy and memset in your C library and want to use them.
- Otherwise, simple internal versions are supplied.
- USE_memcpy (default: 1 if HAVE_memcpy is defined, 0 otherwise)
- Define as 1 if you want the C library versions of memset and
- memcpy called in realloc and calloc (otherwise macro versions are used).
- At least on some platforms, the simple macro versions usually
- outperform libc versions.
- HAVE_MMAP (default: defined as 1)
- Define to non-zero to optionally make malloc() use mmap() to
- allocate very large blocks.
- HAVE_MREMAP (default: defined as 0 unless Linux libc set)
- Define to non-zero to optionally make realloc() use mremap() to
- reallocate very large blocks.
- malloc_getpagesize (default: derived from system #includes)
- Either a constant or routine call returning the system page size.
- HAVE_USR_INCLUDE_malloc_H (default: NOT defined)
- Optionally define if you are on a system with a /usr/include/malloc.h
- that declares struct mallinfo. It is not at all necessary to
- define this even if you do, but will ensure consistency.
- INTERNAL_SIZE_T (default: size_t)
- Define to a 32-bit type (probably `unsigned int') if you are on a
- 64-bit machine, yet do not want or need to allow malloc requests of
- greater than 2^31 to be handled. This saves space, especially for
- very small chunks.
- INTERNAL_LINUX_C_LIB (default: NOT defined)
- Defined only when compiled as part of Linux libc.
- Also note that there is some odd internal name-mangling via defines
- (for example, internally, `malloc' is named `mALLOc') needed
- when compiling in this case. These look funny but don't otherwise
- affect anything.
- WIN32 (default: undefined)
- Define this on MS win (95, nt) platforms to compile in sbrk emulation.
- LACKS_UNISTD_H (default: undefined)
- Define this if your system does not have a <unistd.h>.
- MORECORE (default: sbrk)
- The name of the routine to call to obtain more memory from the system.
- MORECORE_FAILURE (default: -1)
- The value returned upon failure of MORECORE.
- MORECORE_CLEARS (default 0)
- True (1) if the routine mapped to MORECORE zeroes out memory (which
- holds for sbrk).
- DEFAULT_TRIM_THRESHOLD
- DEFAULT_TOP_PAD
- DEFAULT_MMAP_THRESHOLD
- DEFAULT_MMAP_MAX
- Default values of tunable parameters (described in detail below)
- controlling interaction with host system routines (sbrk, mmap, etc).
- These values may also be changed dynamically via mallopt(). The
- preset defaults are those that give best performance for typical
- programs/systems.
-
-
-*/
-
-
-
-
-/* Preliminaries */
-
-#include "winsup.h"
-
-#ifndef __STD_C
-#ifdef __STDC__
-#define __STD_C 1
-#else
-#if __cplusplus
-#define __STD_C 1
-#else
-#define __STD_C 0
-#endif /*__cplusplus*/
-#endif /*__STDC__*/
-#endif /*__STD_C*/
-
-#ifndef Void_t
-#if __STD_C
-#define Void_t void
-#else
-#define Void_t char
-#endif
-#endif /*Void_t*/
-
-#define __MALLOC_H_INCLUDED
-
-#if __STD_C
-#include <stddef.h> /* for size_t */
-#else
-#include <sys/types.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdio.h> /* needed for malloc_stats */
-
-
-/*
- Compile-time options
-*/
-
-
-/*
- Debugging:
-
- Because freed chunks may be overwritten with link fields, this
- malloc will often die when freed memory is overwritten by user
- programs. This can be very effective (albeit in an annoying way)
- in helping track down dangling pointers.
-
- If you compile with -DDEBUG, a number of assertion checks are
- enabled that will catch more memory errors. You probably won't be
- able to make much sense of the actual assertion errors, but they
- should help you locate incorrectly overwritten memory. The
- checking is fairly extensive, and will slow down execution
- noticeably. Calling malloc_stats or mallinfo with DEBUG set will
- attempt to check every non-mmapped allocated and free chunk in the
- course of computing the summmaries. (By nature, mmapped regions
- cannot be checked very much automatically.)
-
- Setting DEBUG may also be helpful if you are trying to modify
- this code. The assertions in the check routines spell out in more
- detail the assumptions and invariants underlying the algorithms.
-
-*/
-
-#ifdef MALLOC_DEBUG
-#define DEBUG 1
-#define DEBUG1 1
-#define DEBUG2 1
-#define DEBUG3 1
-#endif
-
-#if DEBUG
-#include <assert.h>
-#else
-#define assert(x) ((void)0)
-#endif
-
-/*
- INTERNAL_SIZE_T is the word-size used for internal bookkeeping
- of chunk sizes. On a 64-bit machine, you can reduce malloc
- overhead by defining INTERNAL_SIZE_T to be a 32 bit `unsigned int'
- at the expense of not being able to handle requests greater than
- 2^31. This limitation is hardly ever a concern; you are encouraged
- to set this. However, the default version is the same as size_t.
-*/
-
-#ifndef INTERNAL_SIZE_T
-#define INTERNAL_SIZE_T size_t
-#endif
-
-/*
- realloc_ZERO_BYTES_FREES should be set if a call to
- realloc with zero bytes should be the same as a call to free.
- Some people think it should. Otherwise, since this malloc
- returns a unique pointer for malloc(0), so does realloc(p, 0).
-*/
-
-
-/* #define realloc_ZERO_BYTES_FREES */
-
-
-/*
- WIN32 causes an emulation of sbrk to be compiled in
- mmap-based options are not currently supported in WIN32.
-*/
-
-/* #define WIN32 */
-#ifdef WIN32
-#define MORECORE wsbrk
-#define HAVE_MMAP 0
-#endif
-
-
-/*
- HAVE_memcpy should be defined if you are not otherwise using
- ANSI STD C, but still have memcpy and memset in your C library
- and want to use them in calloc and realloc. Otherwise simple
- macro versions are defined here.
-
- USE_memcpy should be defined as 1 if you actually want to
- have memset and memcpy called. People report that the macro
- versions are often enough faster than libc versions on many
- systems that it is better to use them.
-
-*/
-
-#define HAVE_memcpy
-
-#ifndef USE_memcpy
-#ifdef HAVE_memcpy
-#define USE_memcpy 1
-#else
-#define USE_memcpy 0
-#endif
-#endif
-
-#if (__STD_C || defined(HAVE_memcpy))
-
-#if __STD_C
-void* memset(void*, int, size_t);
-void* memcpy(void*, const void*, size_t);
-#else
-Void_t* memset();
-Void_t* memcpy();
-#endif
-#endif
-
-#ifndef DEBUG3
-
-#if USE_memcpy
-
-/* The following macros are only invoked with (2n+1)-multiples of
- INTERNAL_SIZE_T units, with a positive integer n. This is exploited
- for fast inline execution when n is small. */
-
-#define malloc_ZERO(charp, nbytes) \
-do { \
- INTERNAL_SIZE_T mzsz = (nbytes); \
- if(mzsz <= 9*sizeof(mzsz)) { \
- INTERNAL_SIZE_T* mz = (INTERNAL_SIZE_T*) (charp); \
- if(mzsz >= 5*sizeof(mzsz)) { *mz++ = 0; \
- *mz++ = 0; \
- if(mzsz >= 7*sizeof(mzsz)) { *mz++ = 0; \
- *mz++ = 0; \
- if(mzsz >= 9*sizeof(mzsz)) { *mz++ = 0; \
- *mz++ = 0; }}} \
- *mz++ = 0; \
- *mz++ = 0; \
- *mz = 0; \
- } else memset((charp), 0, mzsz); \
-} while(0)
-
-#define malloc_COPY(dest,src,nbytes) \
-do { \
- INTERNAL_SIZE_T mcsz = (nbytes); \
- if(mcsz <= 9*sizeof(mcsz)) { \
- INTERNAL_SIZE_T* mcsrc = (INTERNAL_SIZE_T*) (src); \
- INTERNAL_SIZE_T* mcdst = (INTERNAL_SIZE_T*) (dest); \
- if(mcsz >= 5*sizeof(mcsz)) { *mcdst++ = *mcsrc++; \
- *mcdst++ = *mcsrc++; \
- if(mcsz >= 7*sizeof(mcsz)) { *mcdst++ = *mcsrc++; \
- *mcdst++ = *mcsrc++; \
- if(mcsz >= 9*sizeof(mcsz)) { *mcdst++ = *mcsrc++; \
- *mcdst++ = *mcsrc++; }}} \
- *mcdst++ = *mcsrc++; \
- *mcdst++ = *mcsrc++; \
- *mcdst = *mcsrc ; \
- } else memcpy(dest, src, mcsz); \
-} while(0)
-
-#else /* !USE_memcpy */
-
-/* Use Duff's device for good zeroing/copying performance. */
-
-#define malloc_ZERO(charp, nbytes) \
-do { \
- INTERNAL_SIZE_T* mzp = (INTERNAL_SIZE_T*)(charp); \
- long mctmp = (nbytes)/sizeof(INTERNAL_SIZE_T), mcn; \
- if (mctmp < 8) mcn = 0; else { mcn = (mctmp-1)/8; mctmp %= 8; } \
- switch (mctmp) { \
- case 0: for(;;) { *mzp++ = 0; \
- case 7: *mzp++ = 0; \
- case 6: *mzp++ = 0; \
- case 5: *mzp++ = 0; \
- case 4: *mzp++ = 0; \
- case 3: *mzp++ = 0; \
- case 2: *mzp++ = 0; \
- case 1: *mzp++ = 0; if(mcn <= 0) break; mcn--; } \
- } \
-} while(0)
-
-#define malloc_COPY(dest,src,nbytes) \
-do { \
- INTERNAL_SIZE_T* mcsrc = (INTERNAL_SIZE_T*) src; \
- INTERNAL_SIZE_T* mcdst = (INTERNAL_SIZE_T*) dest; \
- long mctmp = (nbytes)/sizeof(INTERNAL_SIZE_T), mcn; \
- if (mctmp < 8) mcn = 0; else { mcn = (mctmp-1)/8; mctmp %= 8; } \
- switch (mctmp) { \
- case 0: for(;;) { *mcdst++ = *mcsrc++; \
- case 7: *mcdst++ = *mcsrc++; \
- case 6: *mcdst++ = *mcsrc++; \
- case 5: *mcdst++ = *mcsrc++; \
- case 4: *mcdst++ = *mcsrc++; \
- case 3: *mcdst++ = *mcsrc++; \
- case 2: *mcdst++ = *mcsrc++; \
- case 1: *mcdst++ = *mcsrc++; if(mcn <= 0) break; mcn--; } \
- } \
-} while(0)
-
-#endif
-
-#else /* DEBUG3 */
-
-/* The trailing moat invalidates the above prediction about the nbytes
- parameter to malloc_ZERO and malloc_COPY. */
-
-#define malloc_ZERO(charp, nbytes) \
-do { \
- char *mzp = (char *)(charp); \
- long mzn = (nbytes); \
- while (mzn--) \
- *mzp++ = '\0'; \
-} while(0)
-
-#define malloc_COPY(dest,src,nbytes) \
-do { \
- char *mcsrc = (char *)(src); \
- char *mcdst = (char *)(dest); \
- long mcn = (nbytes); \
- while (mcn--) \
- *mcdst++ = *mcsrc++; \
-} while(0)
-
-#endif /* DEBUG3 */
-
-/*
- Define HAVE_MMAP to optionally make malloc() use mmap() to
- allocate very large blocks. These will be returned to the
- operating system immediately after a free().
-*/
-
-#ifndef HAVE_MMAP
-#define HAVE_MMAP 1
-#endif
-
-/*
- Define HAVE_MREMAP to make realloc() use mremap() to re-allocate
- large blocks. This is currently only possible on Linux with
- kernel versions newer than 1.3.77.
-*/
-
-#ifndef HAVE_MREMAP
-#ifdef INTERNAL_LINUX_C_LIB
-#define HAVE_MREMAP 1
-#else
-#define HAVE_MREMAP 0
-#endif
-#endif
-
-#if HAVE_MMAP
-
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-
-#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
-#define MAP_ANONYMOUS MAP_ANON
-#endif
-
-#endif /* HAVE_MMAP */
-
-/*
- Access to system page size. To the extent possible, this malloc
- manages memory from the system in page-size units.
-
- The following mechanics for getpagesize were adapted from
- bsd/gnu getpagesize.h
-*/
-
-#ifndef LACKS_UNISTD_H
-# include <unistd.h>
-#endif
-
-#ifndef malloc_getpagesize
-# ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */
-# ifndef _SC_PAGE_SIZE
-# define _SC_PAGE_SIZE _SC_PAGESIZE
-# endif
-# endif
-# ifdef _SC_PAGE_SIZE
-# define malloc_getpagesize sysconf(_SC_PAGE_SIZE)
-# else
-# if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE)
-# if __STD_C
- extern size_t getpagesize(void);
-# else
- extern size_t getpagesize();
-# endif
-# define malloc_getpagesize getpagesize()
-# else
-# include <sys/param.h>
-# ifdef EXEC_PAGESIZE
-# define malloc_getpagesize EXEC_PAGESIZE
-# else
-# ifdef NBPG
-# ifndef CLSIZE
-# define malloc_getpagesize NBPG
-# else
-# define malloc_getpagesize (NBPG * CLSIZE)
-# endif
-# else
-# ifdef NBPC
-# define malloc_getpagesize NBPC
-# else
-# ifdef PAGESIZE
-# define malloc_getpagesize PAGESIZE
-# else
-# define malloc_getpagesize (4096) /* just guess */
-# endif
-# endif
-# endif
-# endif
-# endif
-# endif
-#endif
-
-
-
-/*
-
- This version of malloc supports the standard SVID/XPG mallinfo
- routine that returns a struct containing the same kind of
- information you can get from malloc_stats. It should work on
- any SVID/XPG compliant system that has a /usr/include/malloc.h
- defining struct mallinfo. (If you'd like to install such a thing
- yourself, cut out the preliminary declarations as described above
- and below and save them in a malloc.h file. But there's no
- compelling reason to bother to do this.)
-
- The main declaration needed is the mallinfo struct that is returned
- (by-copy) by mallinfo(). The SVID/XPG malloinfo struct contains a
- bunch of fields, most of which are not even meaningful in this
- version of malloc. Some of these fields are are instead filled by
- mallinfo() with other numbers that might possibly be of interest.
-
- HAVE_USR_INCLUDE_malloc_H should be set if you have a
- /usr/include/malloc.h file that includes a declaration of struct
- mallinfo. If so, it is included; else an SVID2/XPG2 compliant
- version is declared below. These must be precisely the same for
- mallinfo() to work.
-
-*/
-
-/* #define HAVE_USR_INCLUDE_malloc_H */
-
-#if HAVE_USR_INCLUDE_malloc_H
-#include "/usr/include/malloc.h"
-#else
-
-/* SVID2/XPG mallinfo structure */
-
-struct mallinfo {
- int arena; /* total space allocated from system */
- int ordblks; /* number of non-inuse chunks */
- int smblks; /* unused -- always zero */
- int hblks; /* number of mmapped regions */
- int hblkhd; /* total space in mmapped regions */
- int usmblks; /* unused -- always zero */
- int fsmblks; /* unused -- always zero */
- int uordblks; /* total allocated space */
- int fordblks; /* total non-inuse space */
- int keepcost; /* top-most, releasable (via malloc_trim) space */
-};
-
-/* SVID2/XPG mallopt options */
-
-#define M_MXFAST 1 /* UNUSED in this malloc */
-#define M_NLBLKS 2 /* UNUSED in this malloc */
-#define M_GRAIN 3 /* UNUSED in this malloc */
-#define M_KEEP 4 /* UNUSED in this malloc */
-
-#endif
-
-/* mallopt options that actually do something */
-
-#define M_TRIM_THRESHOLD -1
-#define M_TOP_PAD -2
-#define M_MMAP_THRESHOLD -3
-#define M_MMAP_MAX -4
-#define M_SCANHEAP -5
-#define M_FILL
-
-
-
-#ifndef DEFAULT_TRIM_THRESHOLD
-#define DEFAULT_TRIM_THRESHOLD (128 * 1024)
-#endif
-
-/*
- M_TRIM_THRESHOLD is the maximum amount of unused top-most memory
- to keep before releasing via malloc_trim in free().
-
- Automatic trimming is mainly useful in long-lived programs.
- Because trimming via sbrk can be slow on some systems, and can
- sometimes be wasteful (in cases where programs immediately
- afterward allocate more large chunks) the value should be high
- enough so that your overall system performance would improve by
- releasing.
-
- The trim threshold and the mmap control parameters (see below)
- can be traded off with one another. Trimming and mmapping are
- two different ways of releasing unused memory back to the
- system. Between these two, it is often possible to keep
- system-level demands of a long-lived program down to a bare
- minimum. For example, in one test suite of sessions measuring
- the XF86 X server on Linux, using a trim threshold of 128K and a
- mmap threshold of 192K led to near-minimal long term resource
- consumption.
-
- If you are using this malloc in a long-lived program, it should
- pay to experiment with these values. As a rough guide, you
- might set to a value close to the average size of a process
- (program) running on your system. Releasing this much memory
- would allow such a process to run in memory. Generally, it's
- worth it to tune for trimming rather tham memory mapping when a
- program undergoes phases where several large chunks are
- allocated and released in ways that can reuse each other's
- storage, perhaps mixed with phases where there are no such
- chunks at all. And in well-behaved long-lived programs,
- controlling release of large blocks via trimming versus mapping
- is usually faster.
-
- However, in most programs, these parameters serve mainly as
- protection against the system-level effects of carrying around
- massive amounts of unneeded memory. Since frequent calls to
- sbrk, mmap, and munmap otherwise degrade performance, the default
- parameters are set to relatively high values that serve only as
- safeguards.
-
- The default trim value is high enough to cause trimming only in
- fairly extreme (by current memory consumption standards) cases.
- It must be greater than page size to have any useful effect. To
- disable trimming completely, you can set to (unsigned long)(-1);
-
-
-*/
-
-
-#ifndef DEFAULT_TOP_PAD
-#define DEFAULT_TOP_PAD (0)
-#endif
-
-/*
- M_TOP_PAD is the amount of extra `padding' space to allocate or
- retain whenever sbrk is called. It is used in two ways internally:
-
- * When sbrk is called to extend the top of the arena to satisfy
- a new malloc request, this much padding is added to the sbrk
- request.
-
- * When malloc_trim is called automatically from free(),
- it is used as the `pad' argument.
-
- In both cases, the actual amount of padding is rounded
- so that the end of the arena is always a system page boundary.
-
- The main reason for using padding is to avoid calling sbrk so
- often. Having even a small pad greatly reduces the likelihood
- that nearly every malloc request during program start-up (or
- after trimming) will invoke sbrk, which needlessly wastes
- time.
-
- Automatic rounding-up to page-size units is normally sufficient
- to avoid measurable overhead, so the default is 0. However, in
- systems where sbrk is relatively slow, it can pay to increase
- this value, at the expense of carrying around more memory than
- the program needs.
-
-*/
-
-
-#ifndef DEFAULT_MMAP_THRESHOLD
-#define DEFAULT_MMAP_THRESHOLD (128 * 1024)
-#endif
-
-/*
-
- M_MMAP_THRESHOLD is the request size threshold for using mmap()
- to service a request. Requests of at least this size that cannot
- be allocated using already-existing space will be serviced via mmap.
- (If enough normal freed space already exists it is used instead.)
-
- Using mmap segregates relatively large chunks of memory so that
- they can be individually obtained and released from the host
- system. A request serviced through mmap is never reused by any
- other request (at least not directly; the system may just so
- happen to remap successive requests to the same locations).
-
- Segregating space in this way has the benefit that mmapped space
- can ALWAYS be individually released back to the system, which
- helps keep the system level memory demands of a long-lived
- program low. Mapped memory can never become `locked' between
- other chunks, as can happen with normally allocated chunks, which
- menas that even trimming via malloc_trim would not release them.
-
- However, it has the disadvantages that:
-
- 1. The space cannot be reclaimed, consolidated, and then
- used to service later requests, as happens with normal chunks.
- 2. It can lead to more wastage because of mmap page alignment
- requirements
- 3. It causes malloc performance to be more dependent on host
- system memory management support routines which may vary in
- implementation quality and may impose arbitrary
- limitations. Generally, servicing a request via normal
- malloc steps is faster than going through a system's mmap.
-
- All together, these considerations should lead you to use mmap
- only for relatively large requests.
-
-
-*/
-
-
-
-#ifndef DEFAULT_MMAP_MAX
-#if HAVE_MMAP
-#define DEFAULT_MMAP_MAX (64)
-#else
-#define DEFAULT_MMAP_MAX (0)
-#endif
-#endif
-
-/*
- M_MMAP_MAX is the maximum number of requests to simultaneously
- service using mmap. This parameter exists because:
-
- 1. Some systems have a limited number of internal tables for
- use by mmap.
- 2. In most systems, overreliance on mmap can degrade overall
- performance.
- 3. If a program allocates many large regions, it is probably
- better off using normal sbrk-based allocation routines that
- can reclaim and reallocate normal heap memory. Using a
- small value allows transition into this mode after the
- first few allocations.
-
- Setting to 0 disables all use of mmap. If HAVE_MMAP is not set,
- the default value is 0, and attempts to set it to non-zero values
- in mallopt will fail.
-*/
-
-
-
-
-/*
-
- Special defines for linux libc
-
- Except when compiled using these special defines for Linux libc
- using weak aliases, this malloc is NOT designed to work in
- multithreaded applications. No semaphores or other concurrency
- control are provided to ensure that multiple malloc or free calls
- don't run at the same time, which could be disasterous. A single
- semaphore could be used across malloc, realloc, and free (which is
- essentially the effect of the linux weak alias approach). It would
- be hard to obtain finer granularity.
-
-*/
-
-
-#ifdef INTERNAL_LINUX_C_LIB
-
-#if __STD_C
-
-Void_t * __default_morecore_init (ptrdiff_t);
-Void_t *(*__morecore)(ptrdiff_t) = __default_morecore_init;
-
-#else
-
-Void_t * __default_morecore_init ();
-Void_t *(*__morecore)() = __default_morecore_init;
-
-#endif
-
-#define MORECORE (*__morecore)
-#define MORECORE_FAILURE 0
-#define MORECORE_CLEARS 1
-
-#else /* INTERNAL_LINUX_C_LIB */
-
-#if __STD_C
-/* extern Void_t* sbrk(ptrdiff_t);*/
-#else
-extern Void_t* sbrk();
-#endif
-
-#ifndef MORECORE
-#define MORECORE sbrk
-#endif
-
-#ifndef MORECORE_FAILURE
-#define MORECORE_FAILURE -1
-#endif
-
-#ifndef MORECORE_CLEARS
-#define MORECORE_CLEARS 0
-#endif
-
-#endif /* INTERNAL_LINUX_C_LIB */
-
-#if defined(INTERNAL_LINUX_C_LIB) && defined(__ELF__)
-
-#define cALLOc __libc_calloc
-#define fREe __libc_free
-#define mALLOc __libc_malloc
-#define mEMALIGn __libc_memalign
-#define rEALLOc __libc_realloc
-#define vALLOc __libc_valloc
-#define pvALLOc __libc_pvalloc
-#define mALLINFo __libc_mallinfo
-#define mALLOPt __libc_mallopt
-
-#pragma weak calloc = __libc_calloc
-#pragma weak free = __libc_free
-#pragma weak cfree = __libc_free
-#pragma weak malloc = __libc_malloc
-#pragma weak memalign = __libc_memalign
-#pragma weak realloc = __libc_realloc
-#pragma weak valloc = __libc_valloc
-#pragma weak pvalloc = __libc_pvalloc
-#pragma weak mallinfo = __libc_mallinfo
-#pragma weak mallopt = __libc_mallopt
-
-#else
-
-#ifndef cALLOc
-#define cALLOc calloc
-#endif
-#ifndef fREe
-#define fREe free
-#endif
-#ifndef mALLOc
-#define mALLOc malloc
-#endif
-#ifndef mEMALIGn
-#define mEMALIGn memalign
-#endif
-#ifndef rEALLOc
-#define rEALLOc realloc
-#endif
-#ifndef vALLOc
-#define vALLOc valloc
-#endif
-#ifndef pvALLOc
-#define pvALLOc pvalloc
-#endif
-#ifndef mALLINFo
-#define mALLINFo mallinfo
-#endif
-#ifndef mALLOPt
-#define mALLOPt mallopt
-#endif
-
-#endif
-
-/* Public routines */
-
-#ifdef DEBUG2
-#define malloc(size) malloc_dbg(size, __FILE__, __LINE__)
-#define free(p) free_dbg(p, __FILE__, __LINE__)
-#define realloc(p, size) realloc_dbg(p, size, __FILE__, __LINE__)
-#define calloc(n, size) calloc_dbg(n, size, __FILE__, __LINE__)
-#define memalign(align, size) memalign_dbg(align, size, __FILE__, __LINE__)
-#define valloc(size) valloc_dbg(size, __FILE__, __LINE__)
-#define pvalloc(size) pvalloc_dbg(size, __FILE__, __LINE__)
-#define cfree(p) cfree_dbg(p, __FILE__, __LINE__)
-#define malloc_trim(pad) malloc_trim_dbg(pad, __FILE__, __LINE__)
-#define malloc_usable_size(p) malloc_usable_size_dbg(p, __FILE__, __LINE__)
-#define malloc_stats(void) malloc_stats_dbg(__FILE__, __LINE__)
-#define mallopt(flag, val) mallopt_dbg(flag, val, __FILE__, __LINE__)
-#define mallinfo(void) mallinfo_dbg(__FILE__, __LINE__)
-
-#if __STD_C
-Void_t* malloc_dbg(size_t, const char *, int);
-void free_dbg(Void_t*, const char *, int);
-Void_t* realloc_dbg(Void_t*, size_t, const char *, int);
-Void_t* calloc_dbg(size_t, size_t, const char *, int);
-Void_t* memalign_dbg(size_t, size_t, const char *, int);
-Void_t* valloc_dbg(size_t, const char *, int);
-Void_t* pvalloc_dbg(size_t, const char *, int);
-void cfree_dbg(Void_t*, const char *, int);
-int malloc_trim_dbg(size_t, const char *, int);
-size_t malloc_usable_size_dbg(Void_t*, const char *, int);
-void malloc_stats_dbg(const char *, int);
-int mallopt_dbg(int, int, const char *, int);
-struct mallinfo mallinfo_dbg(const char *, int);
-#else
-Void_t* malloc_dbg();
-void free_dbg();
-Void_t* realloc_dbg();
-Void_t* calloc_dbg();
-Void_t* memalign_dbg();
-Void_t* valloc_dbg();
-Void_t* pvalloc_dbg();
-void cfree_dbg();
-int malloc_trim_dbg();
-size_t malloc_usable_size_dbg();
-void malloc_stats_dbg();
-int mallopt_dbg();
-struct mallinfo mallinfo_dbg();
-#endif /* !__STD_C */
-
-#else /* !DEBUG2 */
-
-#if __STD_C
-
-Void_t* mALLOc(size_t);
-void fREe(Void_t*);
-Void_t* rEALLOc(Void_t*, size_t);
-Void_t* cALLOc(size_t, size_t);
-Void_t* mEMALIGn(size_t, size_t);
-Void_t* vALLOc(size_t);
-Void_t* pvALLOc(size_t);
-void cfree(Void_t*);
-int malloc_trim(size_t);
-size_t malloc_usable_size(Void_t*);
-void malloc_stats(void);
-int mALLOPt(int, int);
-struct mallinfo mALLINFo(void);
-#else
-Void_t* mALLOc();
-void fREe();
-Void_t* rEALLOc();
-Void_t* cALLOc();
-Void_t* mEMALIGn();
-Void_t* vALLOc();
-Void_t* pvALLOc();
-void cfree();
-int malloc_trim();
-size_t malloc_usable_size();
-void malloc_stats();
-int mALLOPt();
-struct mallinfo mALLINFo();
-#endif
-#endif /* !DEBUG2 */
-
-#ifdef __cplusplus
-}; /* end of extern "C" */
-#endif
-
-/* ---------- To make a malloc.h, end cutting here ------------ */
-
-#ifdef DEBUG2
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#undef malloc
-#undef free
-#undef realloc
-#undef calloc
-#undef memalign
-#undef valloc
-#undef pvalloc
-#undef cfree
-#undef malloc_trim
-#undef malloc_usable_size
-#undef malloc_stats
-#undef mallopt
-#undef mallinfo
-
-#if __STD_C
-Void_t* mALLOc(size_t);
-void fREe(Void_t*);
-Void_t* rEALLOc(Void_t*, size_t);
-Void_t* cALLOc(size_t, size_t);
-Void_t* mEMALIGn(size_t, size_t);
-Void_t* vALLOc(size_t);
-Void_t* pvALLOc(size_t);
-void cfree(Void_t*);
-int malloc_trim(size_t);
-size_t malloc_usable_size(Void_t*);
-void malloc_stats(void);
-int mALLOPt(int, int);
-struct mallinfo mALLINFo(void);
-#else
-Void_t* mALLOc();
-void fREe();
-Void_t* rEALLOc();
-Void_t* cALLOc();
-Void_t* mEMALIGn();
-Void_t* vALLOc();
-Void_t* pvALLOc();
-void cfree();
-int malloc_trim();
-size_t malloc_usable_size();
-void malloc_stats();
-int mALLOPt();
-struct mallinfo mALLINFo();
-#endif
-
-#include <ctype.h> /* isprint() */
-#ifdef DEBUG3
-#include <stdlib.h> /* atexit() */
-#endif
-
-#ifdef __cplusplus
-}; /* end of extern "C" */
-#endif
-
-#endif /* DEBUG2 */
-
-/*
- Emulation of sbrk for WIN32
- All code within the ifdef WIN32 is untested by me.
-*/
-
-
-#ifdef WIN32
-
-#define AlignPage(add) (((add) + (malloc_getpagesize-1)) & \
- ~(malloc_getpagesize-1))
-
-/* resrve 64MB to insure large contiguous space */
-#define RESERVED_SIZE (1024*1024*64)
-#define NEXT_SIZE (2048*1024)
-#define TOP_MEMORY ((unsigned long)2*1024*1024*1024)
-
-struct GmListElement;
-typedef struct GmListElement GmListElement;
-
-struct GmListElement
-{
- GmListElement* next;
- void* base;
-};
-
-static GmListElement* head = 0;
-static unsigned int gNextAddress = 0;
-static unsigned int gAddressBase = 0;
-static unsigned int gAllocatedSize = 0;
-
-static
-GmListElement* makeGmListElement (void* bas)
-{
- GmListElement* this;
- this = (GmListElement*)(void*)LocalAlloc (0, sizeof (GmListElement));
- ASSERT (this);
- if (this)
- {
- this->base = bas;
- this->next = head;
- head = this;
- }
- return this;
-}
-
-void gcleanup ()
-{
- BOOL rval;
- ASSERT ( (head == NULL) || (head->base == (void*)gAddressBase));
- if (gAddressBase && (gNextAddress - gAddressBase))
- {
- rval = VirtualFree ((void*)gAddressBase,
- gNextAddress - gAddressBase,
- MEM_DECOMMIT);
- ASSERT (rval);
- }
- while (head)
- {
- GmListElement* next = head->next;
- rval = VirtualFree (head->base, 0, MEM_RELEASE);
- ASSERT (rval);
- LocalFree (head);
- head = next;
- }
-}
-
-static
-void* findRegion (void* start_address, unsigned long size)
-{
- MEMORY_BASIC_INFORMATION info;
- while ((unsigned long)start_address < TOP_MEMORY)
- {
- VirtualQuery (start_address, &info, sizeof (info));
- if (info.State != MEM_FREE)
- start_address = (char*)info.BaseAddress + info.RegionSize;
- else if (info.RegionSize >= size)
- return start_address;
- else
- start_address = (char*)info.BaseAddress + info.RegionSize;
- }
- return NULL;
-
-}
-
-
-void* wsbrk (long size)
-{
- void* tmp;
- if (size > 0)
- {
- if (gAddressBase == 0)
- {
- gAllocatedSize = max (RESERVED_SIZE, AlignPage (size));
- gNextAddress = gAddressBase =
- (unsigned int)VirtualAlloc (NULL, gAllocatedSize,
- MEM_RESERVE, PAGE_NOACCESS);
- } else if (AlignPage (gNextAddress + size) > (gAddressBase +
-gAllocatedSize))
- {
- long new_size = max (NEXT_SIZE, AlignPage (size));
- void* new_address = (void*)(gAddressBase+gAllocatedSize);
- do
- {
- new_address = findRegion (new_address, new_size);
-
- if (new_address == 0)
- return (void*)-1;
-
- gAddressBase = gNextAddress =
- (unsigned int)VirtualAlloc (new_address, new_size,
- MEM_RESERVE, PAGE_NOACCESS);
- // repeat in case of race condition
- // The region that we found has been snagged
- // by another thread
- }
- while (gAddressBase == 0);
-
- ASSERT (new_address == (void*)gAddressBase);
-
- gAllocatedSize = new_size;
-
- if (!makeGmListElement ((void*)gAddressBase))
- return (void*)-1;
- }
- if ((size + gNextAddress) > AlignPage (gNextAddress))
- {
- void* res;
- res = VirtualAlloc ((void*)AlignPage (gNextAddress),
- (size + gNextAddress -
- AlignPage (gNextAddress)),
- MEM_COMMIT, PAGE_READWRITE);
- if (res == 0)
- return (void*)-1;
- }
- tmp = (void*)gNextAddress;
- gNextAddress = (unsigned int)tmp + size;
- return tmp;
- }
- else if (size < 0)
- {
- unsigned int alignedGoal = AlignPage (gNextAddress + size);
- /* Trim by releasing the virtual memory */
- if (alignedGoal >= gAddressBase)
- {
- VirtualFree ((void*)alignedGoal, gNextAddress - alignedGoal,
- MEM_DECOMMIT);
- gNextAddress = gNextAddress + size;
- return (void*)gNextAddress;
- }
- else
- {
- VirtualFree ((void*)gAddressBase, gNextAddress - gAddressBase,
- MEM_DECOMMIT);
- gNextAddress = gAddressBase;
- return (void*)-1;
- }
- }
- else
- {
- return (void*)gNextAddress;
- }
-}
-
-#endif
-
-
-
-/*
- Type declarations
-*/
-
-#ifdef DEBUG3
-# define MOATWIDTH 4 /* number of guard bytes at each end of
- allocated region */
-# define MOATFILL 5 /* moat fill character */
-# define ALLOCFILL 1 /* fill char for allocated */
-# define FREEFILL 2 /* and freed regions */
-#endif
-
-typedef struct malloc_chunk
-{
- INTERNAL_SIZE_T prev_size; /* Size of previous chunk (if free). */
- INTERNAL_SIZE_T size; /* Size in bytes, including overhead. */
- struct malloc_chunk* fd; /* double links -- used only if free. */
- struct malloc_chunk* bk;
-#ifdef DEBUG3
- const char *file; /* file and */
- int line; /* line number of [re]allocation */
- size_t pad; /* nr pad bytes at mem end, excluding moat */
- int alloced; /* whether the chunk is allocated -- less prone
- to segv than inuse(chunk) */
- char moat[MOATWIDTH]; /* actual leading moat is last MOATWIDTH bytes
- of chunk header; those bytes may follow this
- field due to header alignment padding */
-#endif
-} Chunk;
-
-typedef Chunk* mchunkptr;
-
-/*
-
- malloc_chunk details:
-
- (The following includes lightly edited explanations by Colin Plumb.)
-
- Chunks of memory are maintained using a `boundary tag' method as
- described in e.g., Knuth or Standish. (See the paper by Paul
- Wilson ftp://ftp.cs.utexas.edu/pub/garbage/allocsrv.ps for a
- survey of such techniques.) Sizes of free chunks are stored both
- in the front of each chunk and at the end. This makes
- consolidating fragmented chunks into bigger chunks very fast. The
- size fields also hold bits representing whether chunks are free or
- in use.
-
- An allocated chunk looks like this:
-
-
- chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Size of previous chunk, if allocated | |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Size of chunk, in bytes |P|
- mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | User data starts here... .
- . .
- . (malloc_usable_space() bytes) .
- . |
-nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Size of chunk |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
-
- Where "chunk" is the front of the chunk for the purpose of most of
- the malloc code, but "mem" is the pointer that is returned to the
- user. "Nextchunk" is the beginning of the next contiguous chunk.
-
- Chunks always begin on even word boundries, so the mem portion
- (which is returned to the user) is also on an even word boundary, and
- thus double-word aligned.
-
- Free chunks are stored in circular doubly-linked lists, and look like this:
-
- chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Size of previous chunk |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- `head:' | Size of chunk, in bytes |P|
- mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Forward pointer to next chunk in list |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Back pointer to previous chunk in list |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Unused space (may be 0 bytes long) .
- . .
- . |
-nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- `foot:' | Size of chunk, in bytes |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
- The P (PREV_INUSE) bit, stored in the unused low-order bit of the
- chunk size (which is always a multiple of two words), is an in-use
- bit for the *previous* chunk. If that bit is *clear*, then the
- word before the current chunk size contains the previous chunk
- size, and can be used to find the front of the previous chunk.
- (The very first chunk allocated always has this bit set,
- preventing access to non-existent (or non-owned) memory.)
-
- Note that the `foot' of the current chunk is actually represented
- as the prev_size of the NEXT chunk. (This makes it easier to
- deal with alignments etc).
-
- The two exceptions to all this are
-
- 1. The special chunk `top', which doesn't bother using the
- trailing size field since there is no
- next contiguous chunk that would have to index off it. (After
- initialization, `top' is forced to always exist. If it would
- become less than MINSIZE bytes long, it is replenished via
- malloc_extend_top.)
-
- 2. Chunks allocated via mmap, which have the second-lowest-order
- bit (IS_MMAPPED) set in their size fields. Because they are
- never merged or traversed from any other chunk, they have no
- foot size or inuse information.
-
- Available chunks are kept in any of several places (all declared below):
-
- * `av': An array of chunks serving as bin headers for consolidated
- chunks. Each bin is doubly linked. The bins are approximately
- proportionally (log) spaced. There are a lot of these bins
- (128). This may look excessive, but works very well in
- practice. All procedures maintain the invariant that no
- consolidated chunk physically borders another one. Chunks in
- bins are kept in size order, with ties going to the
- approximately least recently used chunk.
-
- The chunks in each bin are maintained in decreasing sorted order by
- size. This is irrelevant for the small bins, which all contain
- the same-sized chunks, but facilitates best-fit allocation for
- larger chunks. (These lists are just sequential. Keeping them in
- order almost never requires enough traversal to warrant using
- fancier ordered data structures.) Chunks of the same size are
- linked with the most recently freed at the front, and allocations
- are taken from the back. This results in LRU or FIFO allocation
- order, which tends to give each chunk an equal opportunity to be
- consolidated with adjacent freed chunks, resulting in larger free
- chunks and less fragmentation.
-
- * `top': The top-most available chunk (i.e., the one bordering the
- end of available memory) is treated specially. It is never
- included in any bin, is used only if no other chunk is
- available, and is released back to the system if it is very
- large (see M_TRIM_THRESHOLD).
-
- * `last_remainder': A bin holding only the remainder of the
- most recently split (non-top) chunk. This bin is checked
- before other non-fitting chunks, so as to provide better
- locality for runs of sequentially allocated chunks.
-
- * Implicitly, through the host system's memory mapping tables.
- If supported, requests greater than a threshold are usually
- serviced via calls to mmap, and then later released via munmap.
-
-*/
-
-
-
-
-
-
-/* sizes, alignments */
-
-#define SIZE_SZ sizeof(INTERNAL_SIZE_T)
-#define ALIGNMENT (SIZE_SZ + SIZE_SZ)
-#define ALIGN_MASK (ALIGNMENT - 1)
-#ifndef DEBUG3
-# define MEMOFFSET (2*SIZE_SZ)
-# define OVERHEAD SIZE_SZ
-# define MMAP_EXTRA SIZE_SZ /* for correct alignment */
-# define MINSIZE sizeof(Chunk)
-#else
-typedef union {
- char strut[(sizeof(Chunk) - 1) / ALIGNMENT + 1][ALIGNMENT];
- Chunk chunk;
-} PaddedChunk;
-# define MEMOFFSET sizeof(PaddedChunk)
-# define OVERHEAD (MEMOFFSET + MOATWIDTH)
-# define MMAP_EXTRA 0
-# define MINSIZE ((OVERHEAD + ALIGN_MASK) & ~ALIGN_MASK)
-#endif
-
-/* conversion from malloc headers to user pointers, and back */
-
-#define chunk2mem(p) ((Void_t*)((char*)(p) + MEMOFFSET))
-#define mem2chunk(mem) ((mchunkptr)((char*)(mem) - MEMOFFSET))
-
-/* pad request bytes into a usable size, including overhead */
-
-#define request2size(req) \
- ((long)((req) + OVERHEAD) < (long)MINSIZE ? MINSIZE : \
- ((req) + OVERHEAD + ALIGN_MASK) & ~ALIGN_MASK)
-
-/* Check if m has acceptable alignment */
-
-#define aligned_OK(m) (((unsigned long)((m)) & ALIGN_MASK) == 0)
-
-
-
-
-/*
- Physical chunk operations
-*/
-
-
-/* size field is or'ed with PREV_INUSE when previous adjacent chunk in use */
-
-#define PREV_INUSE 0x1
-
-/* size field is or'ed with IS_MMAPPED if the chunk was obtained with mmap() */
-
-#define IS_MMAPPED 0x2
-
-/* Bits to mask off when extracting size */
-
-#define SIZE_BITS (PREV_INUSE|IS_MMAPPED)
-
-
-/* Ptr to next physical malloc_chunk. */
-
-#define next_chunk(p) ((mchunkptr)( ((char*)(p)) + ((p)->size & ~PREV_INUSE) ))
-
-/* Ptr to previous physical malloc_chunk */
-
-#define prev_chunk(p)\
- ((mchunkptr)( ((char*)(p)) - ((p)->prev_size) ))
-
-
-/* Treat space at ptr + offset as a chunk */
-
-#define chunk_at_offset(p, s) ((mchunkptr)(((char*)(p)) + (s)))
-
-
-
-
-/*
- Dealing with use bits
-*/
-
-/* extract p's inuse bit */
-
-#define inuse(p)\
-((((mchunkptr)(((char*)(p))+((p)->size & ~PREV_INUSE)))->size) & PREV_INUSE)
-
-/* extract inuse bit of previous chunk */
-
-#define prev_inuse(p) ((p)->size & PREV_INUSE)
-
-/* check for mmap()'ed chunk */
-
-#if HAVE_MMAP
-# define chunk_is_mmapped(p) ((p)->size & IS_MMAPPED)
-#else
-# define chunk_is_mmapped(p) 0
-#endif
-
-/* set/clear chunk as in use without otherwise disturbing */
-
-#define set_inuse(p)\
-((mchunkptr)(((char*)(p)) + ((p)->size & ~PREV_INUSE)))->size |= PREV_INUSE
-
-#define clear_inuse(p)\
-((mchunkptr)(((char*)(p)) + ((p)->size & ~PREV_INUSE)))->size &= ~(PREV_INUSE)
-
-/* check/set/clear inuse bits in known places */
-
-#define inuse_bit_at_offset(p, s)\
- (((mchunkptr)(((char*)(p)) + (s)))->size & PREV_INUSE)
-
-#define set_inuse_bit_at_offset(p, s)\
- (((mchunkptr)(((char*)(p)) + (s)))->size |= PREV_INUSE)
-
-#define clear_inuse_bit_at_offset(p, s)\
- (((mchunkptr)(((char*)(p)) + (s)))->size &= ~(PREV_INUSE))
-
-
-
-
-/*
- Dealing with size fields
-*/
-
-/* Get size, ignoring use bits */
-
-#define chunksize(p) ((p)->size & ~(SIZE_BITS))
-
-/* Set size at head, without disturbing its use bit */
-
-#define set_head_size(p, s) ((p)->size = (((p)->size & PREV_INUSE) | (s)))
-
-/* Set size/use ignoring previous bits in header */
-
-#define set_head(p, s) ((p)->size = (s))
-
-/* Set size at footer (only when chunk is not in use) */
-
-#define set_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_size = (s))
-
-
-
-
-
-/*
- Bins
-
- The bins, `av_' are an array of pairs of pointers serving as the
- heads of (initially empty) doubly-linked lists of chunks, laid out
- in a way so that each pair can be treated as if it were in a
- malloc_chunk. (This way, the fd/bk offsets for linking bin heads
- and chunks are the same).
-
- Bins for sizes < 512 bytes contain chunks of all the same size, spaced
- 8 bytes apart. Larger bins are approximately logarithmically
- spaced. (See the table below.) The `av_' array is never mentioned
- directly in the code, but instead via bin access macros.
-
- Bin layout:
-
- 64 bins of size 8
- 32 bins of size 64
- 16 bins of size 512
- 8 bins of size 4096
- 4 bins of size 32768
- 2 bins of size 262144
- 1 bin of size what's left
-
- There is actually a little bit of slop in the numbers in bin_index
- for the sake of speed. This makes no difference elsewhere.
-
- The special chunks `top' and `last_remainder' get their own bins,
- (this is implemented via yet more trickery with the av_ array),
- although `top' is never properly linked to its bin since it is
- always handled specially.
-
-*/
-
-#define NAV 128 /* number of bins */
-
-typedef Chunk* mbinptr;
-
-/* access macros */
-
-#define bin_at(i) ((mbinptr)((char*)&(av_[2*(i) + 2]) - 2*SIZE_SZ))
-#define next_bin(b) ((mbinptr)((char*)(b) + 2 * sizeof(mbinptr)))
-#define prev_bin(b) ((mbinptr)((char*)(b) - 2 * sizeof(mbinptr)))
-
-/*
- The first 2 bins are never indexed. The corresponding av_ cells are instead
- used for bookkeeping. This is not to save space, but to simplify
- indexing, maintain locality, and avoid some initialization tests.
-*/
-
-#define top (bin_at(0)->fd) /* The topmost chunk */
-#define last_remainder (bin_at(1)) /* remainder from last split */
-
-
-/*
- Because top initially points to its own bin with initial
- zero size, thus forcing extension on the first malloc request,
- we avoid having any special code in malloc to check whether
- it even exists yet. But we still need to in malloc_extend_top.
-*/
-
-#define initial_top ((mchunkptr)(bin_at(0)))
-
-/* Helper macro to initialize bins */
-
-#define IAV(i) bin_at(i), bin_at(i)
-
-static mbinptr av_[NAV * 2 + 2] = {
- 0, 0,
- IAV(0), IAV(1), IAV(2), IAV(3), IAV(4), IAV(5), IAV(6), IAV(7),
- IAV(8), IAV(9), IAV(10), IAV(11), IAV(12), IAV(13), IAV(14), IAV(15),
- IAV(16), IAV(17), IAV(18), IAV(19), IAV(20), IAV(21), IAV(22), IAV(23),
- IAV(24), IAV(25), IAV(26), IAV(27), IAV(28), IAV(29), IAV(30), IAV(31),
- IAV(32), IAV(33), IAV(34), IAV(35), IAV(36), IAV(37), IAV(38), IAV(39),
- IAV(40), IAV(41), IAV(42), IAV(43), IAV(44), IAV(45), IAV(46), IAV(47),
- IAV(48), IAV(49), IAV(50), IAV(51), IAV(52), IAV(53), IAV(54), IAV(55),
- IAV(56), IAV(57), IAV(58), IAV(59), IAV(60), IAV(61), IAV(62), IAV(63),
- IAV(64), IAV(65), IAV(66), IAV(67), IAV(68), IAV(69), IAV(70), IAV(71),
- IAV(72), IAV(73), IAV(74), IAV(75), IAV(76), IAV(77), IAV(78), IAV(79),
- IAV(80), IAV(81), IAV(82), IAV(83), IAV(84), IAV(85), IAV(86), IAV(87),
- IAV(88), IAV(89), IAV(90), IAV(91), IAV(92), IAV(93), IAV(94), IAV(95),
- IAV(96), IAV(97), IAV(98), IAV(99), IAV(100), IAV(101), IAV(102), IAV(103),
- IAV(104), IAV(105), IAV(106), IAV(107), IAV(108), IAV(109), IAV(110), IAV(111),
- IAV(112), IAV(113), IAV(114), IAV(115), IAV(116), IAV(117), IAV(118), IAV(119),
- IAV(120), IAV(121), IAV(122), IAV(123), IAV(124), IAV(125), IAV(126), IAV(127)
-};
-
-
-
-/* field-extraction macros */
-
-#define first(b) ((b)->fd)
-#define last(b) ((b)->bk)
-
-/*
- Indexing into bins
-*/
-
-#define bin_index(sz) \
-(((((unsigned long)(sz)) >> 9) == 0) ? (((unsigned long)(sz)) >> 3): \
- ((((unsigned long)(sz)) >> 9) <= 4) ? 56 + (((unsigned long)(sz)) >> 6): \
- ((((unsigned long)(sz)) >> 9) <= 20) ? 91 + (((unsigned long)(sz)) >> 9): \
- ((((unsigned long)(sz)) >> 9) <= 84) ? 110 + (((unsigned long)(sz)) >> 12): \
- ((((unsigned long)(sz)) >> 9) <= 340) ? 119 + (((unsigned long)(sz)) >> 15): \
- ((((unsigned long)(sz)) >> 9) <= 1364) ? 124 + (((unsigned long)(sz)) >> 18): \
- 126)
-/*
- bins for chunks < 512 are all spaced 8 bytes apart, and hold
- identically sized chunks. This is exploited in malloc.
-*/
-
-#define MAX_SMALLBIN 63
-#define MAX_SMALLBIN_SIZE 512
-#define SMALLBIN_WIDTH 8
-
-#define smallbin_index(sz) (((unsigned long)(sz)) >> 3)
-
-/*
- Requests are `small' if both the corresponding and the next bin are small
-*/
-
-#define is_small_request(nb) (nb < MAX_SMALLBIN_SIZE - SMALLBIN_WIDTH)
-
-
-
-/*
- To help compensate for the large number of bins, a one-level index
- structure is used for bin-by-bin searching. `binblocks' is a
- one-word bitvector recording whether groups of BINBLOCKWIDTH bins
- have any (possibly) non-empty bins, so they can be skipped over
- all at once during during traversals. The bits are NOT always
- cleared as soon as all bins in a block are empty, but instead only
- when all are noticed to be empty during traversal in malloc.
-*/
-
-#define BINBLOCKWIDTH 4 /* bins per block */
-
-#define binblocks (bin_at(0)->size) /* bitvector of nonempty blocks */
-
-/* bin<->block macros */
-
-#define idx2binblock(ix) ((unsigned)1 << (ix / BINBLOCKWIDTH))
-#define mark_binblock(ii) (binblocks |= idx2binblock(ii))
-#define clear_binblock(ii) (binblocks &= ~(idx2binblock(ii)))
-
-
-
-
-
-/* Other static bookkeeping data */
-
-/* variables holding tunable values */
-
-static unsigned long trim_threshold = DEFAULT_TRIM_THRESHOLD;
-static unsigned long top_pad = DEFAULT_TOP_PAD;
-static unsigned int n_mmaps_max = DEFAULT_MMAP_MAX;
-static unsigned long mmap_threshold = DEFAULT_MMAP_THRESHOLD;
-#ifdef DEBUG2
-static int scanheap = 1;
-#endif
-
-/* The first value returned from sbrk */
-static char* sbrk_base = (char*)(-1);
-
-/* The maximum memory obtained from system via sbrk */
-static unsigned long max_sbrked_mem = 0;
-
-/* The maximum via either sbrk or mmap */
-static unsigned long max_total_mem = 0;
-
-/* internal working copy of mallinfo */
-static struct mallinfo current_mallinfo = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
-
-/* The total memory obtained from system via sbrk */
-#define sbrked_mem (current_mallinfo.arena)
-
-/* Tracking mmaps */
-
-static unsigned int n_mmaps = 0;
-static unsigned long mmapped_mem = 0;
-#if HAVE_MMAP
-static unsigned int max_n_mmaps = 0;
-static unsigned long max_mmapped_mem = 0;
-#endif
-
-
-
-/*
- Debugging support
-*/
-
-#if DEBUG
-
-#ifndef DEBUG2
-# define unless(cond, err, p) assert(cond)
-#else
-# define unless(cond, err, p) do { if (!(cond)) malloc_err(err, p); } while (0)
-
-/*
- * When debug_file is non-null, it and debug_line respectively contain the
- * file and line number of the current invocation of malloc(), calloc(),
- * realloc(), or free().
- */
-static const char *debug_file = NULL;
-static int debug_line;
-
-/*
- * Avoid dereferencing invalid chunk.file pointers by tracking the range of
- * valid ones. Could add an "unallocated" flag to init_freed_chunk() for
- * more protection, but that's probably not necessary.
- */
-static const char *debug_file_min = (char *)~0;
-static const char *debug_file_max = NULL;
-
-static char *itos(int n)
-{
-#define NDIGITS (sizeof(int) * 3)
- static char s[NDIGITS + 1];
- int i = NDIGITS;
- do {
- s[--i] = '0' + n % 10;
- n /= 10;
- } while (n);
- return s + i;
-#undef NDIGITS
-}
-
-static int recurs = 0;
-
-static void errprint(const char *file, int line, const char *err)
-{
- if (recurs++) {
- recurs--;
- return;
- }
-
- if (file) {
- write(2, file, strlen(file));
- if (line) {
- write(2, ":", 1);
- write(2, itos(line), strlen(itos(line)));
- }
- write(2, ": ", 2);
- }
- write(2, err, strlen(err));
- write(2, "\n", 1);
- recurs--;
-}
-
-static void malloc_err(const char *err, mchunkptr p)
-{
- /*
- * Display ERR on stderr, accompanying it with the caller's file and line
- * number if available. If P is non-null, also attempt to display the file
- * and line number at which P was most recently [re]allocated.
- *
- * This function's name begins with "malloc_" to make setting debugger
- * breakpoints here more convenient.
- */
- errprint(debug_file, debug_line, err);
-
-# ifndef DEBUG3
- p = 0; /* avoid "unused param" warning */
-# else
- if (p && p->file &&
- /* avoid invalid pointers */
- debug_file_min &&
- p->file >= debug_file_min &&
- p->file <= debug_file_max &&
- /* try to avoid garbage file names */
- isprint(*p->file))
- errprint(p->file, p->line, "in block allocated here");
-# endif
-}
-
-#undef malloc
-#undef free
-#undef realloc
-#undef memalign
-#undef valloc
-#undef pvalloc
-#undef calloc
-#undef cfree
-#undef malloc_trim
-#undef malloc_usable_size
-#undef malloc_stats
-#undef mallopt
-#undef mallinfo
-
-static void malloc_update_mallinfo(void);
-
-/*
- * Define front-end functions for all user-visible entry points that may
- * trigger error().
- */
-#define skel(retdecl, retassign, call, retstmt) \
- retdecl \
- debug_file = file; \
- debug_line = line; \
- if (debug_file < debug_file_min) \
- debug_file_min = debug_file; \
- if (debug_file > debug_file_max) \
- debug_file_max = debug_file; \
- if (scanheap) \
- malloc_update_mallinfo(); \
- retassign call; \
- if (scanheap) \
- malloc_update_mallinfo(); \
- debug_file = NULL; \
- retstmt
-
-/*
- * The final letter of the names of the following macros is either r or v,
- * indicating that the macro handles functions with or without a return value,
- * respectively.
- */
-# define skelr(rettype, call) \
- skel(rettype ret;, ret = , call, return ret)
-/*
- * AIX's xlc compiler doesn't like empty macro args, so specify useless but
- * compilable retdecl, retassign, and retstmt args:
- */
-#define skelv(call) \
- skel(line += 0;, if (1), call, return)
-
-#define dbgargs const char *file, int line
-
-/*
- * Front-end function definitions:
- */
-Void_t* malloc_dbg(size_t bytes, dbgargs) {
- skelr(Void_t*, malloc(bytes));
-}
-void free_dbg(Void_t *mem, dbgargs) {
- skelv(free(mem));
-}
-Void_t* realloc_dbg(Void_t *oldmem, size_t bytes, dbgargs) {
- skelr(Void_t*, realloc(oldmem, bytes));
-}
-Void_t* memalign_dbg(size_t alignment, size_t bytes, dbgargs) {
- skelr(Void_t*, memalign(alignment, bytes));
-}
-Void_t* valloc_dbg(size_t bytes, dbgargs) {
- skelr(Void_t*, valloc(bytes));
-}
-Void_t* pvalloc_dbg(size_t bytes, dbgargs) {
- skelr(Void_t*, pvalloc(bytes));
-}
-Void_t* calloc_dbg(size_t n, size_t elem_size, dbgargs) {
- skelr(Void_t*, calloc(n, elem_size));
-}
-void cfree_dbg(Void_t *mem, dbgargs) {
- skelv(cfree(mem));
-}
-int malloc_trim_dbg(size_t pad, dbgargs) {
- skelr(int, malloc_trim(pad));
-}
-size_t malloc_usable_size_dbg(Void_t *mem, dbgargs) {
- skelr(size_t, malloc_usable_size(mem));
-}
-void malloc_stats_dbg(dbgargs) {
- skelv(malloc_stats());
-}
-int mallopt_dbg(int flag, int value, dbgargs) {
- skelr(int, mallopt(flag, value));
-}
-struct mallinfo mallinfo_dbg(dbgargs) {
- skelr(struct mallinfo, mallinfo());
-}
-
-#undef skel
-#undef skelr
-#undef skelv
-#undef dbgargs
-
-#endif /* DEBUG2 */
-
-/*
- These routines make a number of assertions about the states
- of data structures that should be true at all times. If any
- are not true, it's very likely that a user program has somehow
- trashed memory. (It's also possible that there is a coding error
- in malloc. In which case, please report it!)
-*/
-
-#ifdef DEBUG3
-static int memtest(void *s, int c, size_t n)
-{
- /*
- * Return whether the N-byte memory region starting at S consists
- * entirely of bytes with value C.
- */
- unsigned char *p = (unsigned char *)s;
- size_t i;
- for (i = 0; i < n; i++)
- if (p[i] != (unsigned char)c)
- return 0;
- return 1;
-}
-#endif /* DEBUG3 */
-
-#ifndef DEBUG3
-#define check_moats(P)
-#else
-#define check_moats do_check_moats
-static void do_check_moats(mchunkptr p)
-{
- INTERNAL_SIZE_T sz = chunksize(p);
- unless(memtest((char *)chunk2mem(p) - MOATWIDTH, MOATFILL,
- MOATWIDTH), "region underflow", p);
- unless(memtest((char *)p + sz - MOATWIDTH - p->pad, MOATFILL,
- MOATWIDTH + p->pad), "region overflow", p);
-}
-#endif /* DEBUG3 */
-
-#if __STD_C
-static void do_check_chunk(mchunkptr p)
-#else
-static void do_check_chunk(p) mchunkptr p;
-#endif
-{
- /* Try to ensure legal addresses before accessing any chunk fields, in the
- * hope of issuing an informative message rather than causing a segv.
- *
- * The following chunk_is_mmapped() call accesses p->size #if HAVE_MMAP.
- * This is unavoidable without maintaining a record of mmapped regions.
- */
- if (!chunk_is_mmapped(p))
- {
- INTERNAL_SIZE_T sz;
-
- unless((char*)p >= sbrk_base, "chunk precedes sbrk_base", p);
- unless((char*)p + MINSIZE <= (char*)top + chunksize(top),
- "chunk past sbrk area", p);
-
- sz = chunksize(p);
- if (p != top)
- unless((char*)p + sz <= (char*)top, "chunk extends beyond top", p);
- else
- unless((char*)p + sz <= sbrk_base + sbrked_mem,
- "chunk extends past sbrk area", p);
- }
- check_moats(p);
-}
-
-#if __STD_C
-static void do_check_free_chunk(mchunkptr p)
-#else
-static void do_check_free_chunk(p) mchunkptr p;
-#endif
-{
- INTERNAL_SIZE_T sz = chunksize(p);
- mchunkptr next = chunk_at_offset(p, sz);
-
- do_check_chunk(p);
-
- /* Check whether it claims to be free ... */
- unless(!inuse(p), "free chunk marked inuse", p);
-
- /* Unless a special marker, must have OK fields */
- if ((long)sz >= (long)MINSIZE)
- {
- unless((sz & ALIGN_MASK) == 0, "freed size defies alignment", p);
- unless(aligned_OK(chunk2mem(p)), "misaligned freed region", p);
- /* ... matching footer field */
- unless(next->prev_size == sz, "chunk size mismatch", p);
- /* ... and is fully consolidated */
- unless(prev_inuse(p), "free chunk not joined with prev", p);
- unless(next == top || inuse(next), "free chunk not joined with next", p);
-
- /* ... and has minimally sane links */
- unless(p->fd->bk == p, "broken forward link", p);
- unless(p->bk->fd == p, "broken backward link", p);
- }
- else /* markers are always of size SIZE_SZ */
- unless(sz == SIZE_SZ, "invalid small chunk size", p);
-}
-
-#if __STD_C
-static void do_check_inuse_chunk(mchunkptr p)
-#else
-static void do_check_inuse_chunk(p) mchunkptr p;
-#endif
-{
- mchunkptr next;
- do_check_chunk(p);
-
- if (chunk_is_mmapped(p))
- return;
-
- /* Check whether it claims to be in use ... */
-#ifdef DEBUG3
- unless(p->alloced, "memory not allocated", p);
-#endif
- unless(inuse(p), "memory not allocated", p);
-
- /* ... and is surrounded by OK chunks.
- Since more things can be checked with free chunks than inuse ones,
- if an inuse chunk borders them and debug is on, it's worth doing them.
- */
- if (!prev_inuse(p))
- {
- mchunkptr prv = prev_chunk(p);
- unless(next_chunk(prv) == p, "prev link scrambled", p);
- do_check_free_chunk(prv);
- }
- next = next_chunk(p);
- if (next == top)
- {
- unless(prev_inuse(next), "top chunk wrongly thinks prev is unused", p);
- unless(chunksize(next) >= MINSIZE, "top chunk too small", p);
- }
- else if (!inuse(next))
- do_check_free_chunk(next);
-}
-
-#if __STD_C
-static void do_check_malloced_chunk(mchunkptr p, INTERNAL_SIZE_T s)
-#else
-static void do_check_malloced_chunk(p, s) mchunkptr p; INTERNAL_SIZE_T s;
-#endif
-{
- INTERNAL_SIZE_T sz = chunksize(p);
- long room = sz - s;
-
- do_check_inuse_chunk(p);
-
- /* Legal size ... */
- unless((long)sz >= (long)MINSIZE, "chunk size too small", p);
- unless((sz & ALIGN_MASK) == 0, "malloced size defies alignment", p);
- unless(room >= 0, "chunk size too small for contents", p);
- unless(room < (long)MINSIZE, "chunk size leaves too much spare room", p);
-
- /* ... and alignment */
- unless(aligned_OK(chunk2mem(p)), "misaligned malloced region", p);
-
-
- /* ... and was allocated at front of an available chunk */
- unless(prev_inuse(p), "malloced from the middle of a free chunk", p);
-}
-
-#ifdef DEBUG3
-static void init_alloced_chunk(mchunkptr p, size_t bytes)
-{
- Void_t* mem = chunk2mem(p);
- p->file = debug_file;
- p->line = debug_line;
- p->pad = chunksize(p) - OVERHEAD - bytes;
- p->alloced = 1;
- memset((char *)mem + bytes, MOATFILL, p->pad + MOATWIDTH);
-}
-
-static void do_init_malloced_chunk(mchunkptr p, size_t bytes)
-{
- Void_t* mem = chunk2mem(p);
- init_alloced_chunk(p, bytes);
- memset((char *)mem - MOATWIDTH, MOATFILL, MOATWIDTH);
- memset(mem, ALLOCFILL, bytes);
-}
-
-static void do_init_realloced_chunk(mchunkptr p, size_t bytes,
- INTERNAL_SIZE_T oldsize)
-{
- Void_t* mem = chunk2mem(p);
- INTERNAL_SIZE_T newsize = chunksize(p);
- init_alloced_chunk(p, bytes);
- if (oldsize < newsize)
- /* This incorrectly leaves the leading pad area of the old trailing moat
- * set to MOATFILL rather than ALLOCFILL. An alternative is to save the
- * old p->pad in rEALLOc() below and pass it to this function.
- */
- memset((char *)mem + oldsize - OVERHEAD, ALLOCFILL,
- bytes - (oldsize - OVERHEAD));
-}
-
-static void do_check_freefill(mchunkptr p, long newsize,
- INTERNAL_SIZE_T oldsize)
-{
- /* The first newsize bytes of oldsize-byte chunk p are about to be
- * allocated. Issue a warning if any freefill locations in p that are about
- * to be overwritten do not contain the character FREEFILL.
- */
- size_t bytes, maxbytes;
- if (newsize <= 0)
- return;
- bytes = newsize - MEMOFFSET /* don't check p's header */
- + MEMOFFSET; /* header of split-off remainder */
- maxbytes = oldsize - OVERHEAD;
- if (bytes > maxbytes)
- bytes = maxbytes;
- unless(memtest(chunk2mem(p), FREEFILL, bytes),
- "detected write to freed region", p);
-}
-
-static void do_init_freed_chunk(mchunkptr p, INTERNAL_SIZE_T freehead,
- INTERNAL_SIZE_T freetail)
-{
- /* freehead and freetail are the number of bytes at the beginning of p and
- * end of p respectively that should already be initialized as free regions.
- */
- Void_t* mem = chunk2mem(p);
- size_t size = chunksize(p);
- size_t bytes = size - OVERHEAD;
- p->pad = 0;
- p->alloced = 0;
- memset((char *)mem - MOATWIDTH, MOATFILL, MOATWIDTH);
- memset((char *)mem + bytes, MOATFILL, MOATWIDTH);
-
- /* To avoid terrible O(n^2) performance when free() repeatedly grows a free
- * chunk, it's important not to free-fill regions that are already
- * free-filled.
- */
- if (freehead + freetail < size) {
- Void_t* start = !freehead ? mem : (char *)p + freehead - MOATWIDTH;
- size_t len = (char *)p + size - (char *)start -
- (!freetail ? MOATWIDTH : freetail - OVERHEAD);
- memset(start, FREEFILL, len);
- }
-}
-
-static void do_init_freeable_chunk(mchunkptr p)
-{
- /* Arrange for the subsequent fREe(p) not to generate any warnings. */
- init_alloced_chunk(p, chunksize(p) - OVERHEAD);
- memset((char *)chunk2mem(p) - MOATWIDTH, MOATFILL, MOATWIDTH);
-}
-
-static void do_maximize_chunk(mchunkptr p)
-{
- if (p->pad) {
- Void_t* mem = chunk2mem(p);
- size_t bytes = chunksize(p) - OVERHEAD - p->pad;
- memset((char *)mem + bytes, ALLOCFILL, p->pad);
- p->pad = 0;
- }
-}
-
-static int do_check_init(void)
-{
- /* Called from the first invocation of malloc_extend_top(), as detected by
- * sbrk_base == -1. Return whether this function allocated any memory.
- */
- static int state = 0; /* 1 => initializing, 2 => initialized */
- if (state == 1)
- return 0;
- unless(state == 0, "multiple calls to check_init", NULL);
- state++;
- atexit(malloc_update_mallinfo); /* calls malloc on WinNT */
- return sbrk_base != (char *)-1;
-}
-#endif /* DEBUG3 */
-
-static mchunkptr lowest_chunk;
-
-#define check_free_chunk(P) do_check_free_chunk(P)
-#define check_inuse_chunk(P) do_check_inuse_chunk(P)
-#define check_chunk(P) do_check_chunk(P)
-#define check_malloced_chunk(P,N) do_check_malloced_chunk(P,N)
-#else /* !DEBUG */
-#define check_free_chunk(P)
-#define check_inuse_chunk(P)
-#define check_chunk(P)
-#define check_malloced_chunk(P,N)
-#endif /* !DEBUG */
-
-#ifdef DEBUG3
-#define check_init do_check_init
-#define init_malloced_chunk do_init_malloced_chunk
-#define init_realloced_chunk do_init_realloced_chunk
-#define check_freefill do_check_freefill
-#define init_freed_chunk do_init_freed_chunk
-#define init_freeable_chunk do_init_freeable_chunk
-#define maximize_chunk do_maximize_chunk
-#else
-#define check_init() 0
-#define init_malloced_chunk(P,B)
-#define init_realloced_chunk(P,B,O)
-#define check_freefill(P,N,O)
-#define init_freed_chunk(P,H,T)
-#define init_freeable_chunk(P)
-#define maximize_chunk(P)
-#endif /* !DEBUG3 */
-
-
-
-/*
- Macro-based internal utilities
-*/
-
-
-/*
- Linking chunks in bin lists.
- Call these only with variables, not arbitrary expressions, as arguments.
-*/
-
-/*
- Place chunk p of size s in its bin, in size order,
- putting it ahead of others of same size.
-*/
-
-
-#define frontlink(P, S, IDX, BK, FD) \
-{ \
- if (S < MAX_SMALLBIN_SIZE) \
- { \
- IDX = smallbin_index(S); \
- mark_binblock(IDX); \
- BK = bin_at(IDX); \
- FD = BK->fd; \
- P->bk = BK; \
- P->fd = FD; \
- FD->bk = BK->fd = P; \
- } \
- else \
- { \
- IDX = bin_index(S); \
- BK = bin_at(IDX); \
- FD = BK->fd; \
- if (FD == BK) mark_binblock(IDX); \
- else \
- { \
- while (FD != BK && S < chunksize(FD)) FD = FD->fd; \
- BK = FD->bk; \
- } \
- P->bk = BK; \
- P->fd = FD; \
- FD->bk = BK->fd = P; \
- } \
-}
-
-
-/* take a chunk off a list */
-
-#define unlink(P, BK, FD) \
-{ \
- BK = P->bk; \
- FD = P->fd; \
- FD->bk = BK; \
- BK->fd = FD; \
-} \
-
-/* Place p as the last remainder */
-
-#define link_last_remainder(P) \
-{ \
- last_remainder->fd = last_remainder->bk = P; \
- P->fd = P->bk = last_remainder; \
-}
-
-/* Clear the last_remainder bin */
-
-#define clear_last_remainder \
- (last_remainder->fd = last_remainder->bk = last_remainder)
-
-
-
-
-
-
-/* Routines dealing with mmap(). */
-
-#if HAVE_MMAP
-
-#if __STD_C
-static mchunkptr mmap_chunk(size_t size)
-#else
-static mchunkptr mmap_chunk(size) size_t size;
-#endif
-{
- size_t page_mask = malloc_getpagesize - 1;
- mchunkptr p;
-
-#ifndef MAP_ANONYMOUS
- static int fd = -1;
-#endif
-
- if(n_mmaps >= n_mmaps_max) return 0; /* too many regions */
-
- size = (size + MMAP_EXTRA + page_mask) & ~page_mask;
-
-#ifdef MAP_ANONYMOUS
- p = (mchunkptr)mmap(0, size, PROT_READ|PROT_WRITE,
- MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
-#else /* !MAP_ANONYMOUS */
- if (fd < 0)
- {
- fd = open("/dev/zero", O_RDWR);
- if(fd < 0) return 0;
- }
- p = (mchunkptr)mmap(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
-#endif
-
- if(p == (mchunkptr)-1) return 0;
-
- n_mmaps++;
- if (n_mmaps > max_n_mmaps) max_n_mmaps = n_mmaps;
-
- /* We demand that eight bytes into a page must be 8-byte aligned. */
- assert(aligned_OK(chunk2mem(p)));
-
- /* The offset to the start of the mmapped region is stored
- * in the prev_size field of the chunk; normally it is zero,
- * but that can be changed in memalign().
- */
- p->prev_size = 0;
- set_head(p, size|IS_MMAPPED);
-
- mmapped_mem += size;
- if ((unsigned long)mmapped_mem > (unsigned long)max_mmapped_mem)
- max_mmapped_mem = mmapped_mem;
- if ((unsigned long)(mmapped_mem + sbrked_mem) > (unsigned long)max_total_mem)
- max_total_mem = mmapped_mem + sbrked_mem;
- return p;
-}
-
-#if __STD_C
-static void munmap_chunk(mchunkptr p)
-#else
-static void munmap_chunk(p) mchunkptr p;
-#endif
-{
- INTERNAL_SIZE_T size = chunksize(p);
- int ret;
-
- assert (chunk_is_mmapped(p));
- assert(! ((char*)p >= sbrk_base && (char*)p < sbrk_base + sbrked_mem));
- assert((n_mmaps > 0));
- assert(((p->prev_size + size) & (malloc_getpagesize-1)) == 0);
-
- n_mmaps--;
- mmapped_mem -= (size + p->prev_size);
-
- ret = munmap((char *)p - p->prev_size, size + p->prev_size);
-
- /* munmap returns non-zero on failure */
- assert(ret == 0);
-}
-
-#if HAVE_MREMAP
-
-#if __STD_C
-static mchunkptr mremap_chunk(mchunkptr p, size_t new_size)
-#else
-static mchunkptr mremap_chunk(p, new_size) mchunkptr p; size_t new_size;
-#endif
-{
- size_t page_mask = malloc_getpagesize - 1;
- INTERNAL_SIZE_T offset = p->prev_size;
- INTERNAL_SIZE_T size = chunksize(p);
- char *cp;
-
- assert (chunk_is_mmapped(p));
- assert(! ((char*)p >= sbrk_base && (char*)p < sbrk_base + sbrked_mem));
- assert((n_mmaps > 0));
- assert(((size + offset) & (malloc_getpagesize-1)) == 0);
-
- new_size = (new_size + offset + MMAP_EXTRA + page_mask) & ~page_mask;
-
- cp = (char *)mremap((char *)p - offset, size + offset, new_size, 1);
-
- if (cp == (char *)-1) return 0;
-
- p = (mchunkptr)(cp + offset);
-
- assert(aligned_OK(chunk2mem(p)));
-
- assert(p->prev_size == offset);
- set_head(p, (new_size - offset)|IS_MMAPPED);
-
- mmapped_mem -= size + offset;
- mmapped_mem += new_size;
- if ((unsigned long)mmapped_mem > (unsigned long)max_mmapped_mem)
- max_mmapped_mem = mmapped_mem;
- if ((unsigned long)(mmapped_mem + sbrked_mem) > (unsigned long)max_total_mem)
- max_total_mem = mmapped_mem + sbrked_mem;
- return p;
-}
-
-#endif /* HAVE_MREMAP */
-
-#endif /* HAVE_MMAP */
-
-
-
-
-/*
- Extend the top-most chunk by obtaining memory from system.
- Main interface to sbrk (but see also malloc_trim).
-*/
-
-#if __STD_C
-static void malloc_extend_top(INTERNAL_SIZE_T nb)
-#else
-static void malloc_extend_top(nb) INTERNAL_SIZE_T nb;
-#endif
-{
- char* lim; /* return value from sbrk */
- INTERNAL_SIZE_T front_misalign; /* unusable bytes at front of sbrked space */
- INTERNAL_SIZE_T correction; /* bytes for 2nd sbrk call */
- char* new_lim; /* return of 2nd sbrk call */
- INTERNAL_SIZE_T top_size; /* new size of top chunk */
-
- mchunkptr old_top = top; /* Record state of old top */
- INTERNAL_SIZE_T old_top_size = chunksize(old_top);
- char* old_end = (char*)(chunk_at_offset(old_top, old_top_size));
-
- /* Pad request with top_pad plus minimal overhead */
-
- INTERNAL_SIZE_T sbrk_size = nb + top_pad + MINSIZE;
- unsigned long pagesz = malloc_getpagesize;
-
- /* If not the first time through, round to preserve page boundary */
- /* Otherwise, we need to correct to a page size below anyway. */
- /* (We also correct below if an intervening foreign sbrk call.) */
-
- if (sbrk_base != (char*)(-1))
- sbrk_size = (sbrk_size + (pagesz - 1)) & ~(pagesz - 1);
-
- else if (check_init()) {
- if (chunksize(top) - nb < (long)MINSIZE)
- malloc_extend_top(nb);
- return;
- }
-
- lim = (char*)(MORECORE (sbrk_size));
-
- /* Fail if sbrk failed or if a foreign sbrk call killed our space */
- if (lim == (char*)(MORECORE_FAILURE) ||
- (lim < old_end && old_top != initial_top))
- return;
-
- sbrked_mem += sbrk_size;
-
- if (lim == old_end) /* can just add bytes to current top */
- {
- top_size = sbrk_size + old_top_size;
- set_head(top, top_size | PREV_INUSE);
- }
- else
- {
-#ifdef SBRKDBG
- INTERNAL_SIZE_T padding = (char *)sbrk (0) - (lim + sbrk_size);
- sbrk_size += padding;
- sbrked_mem += padding;
-#endif
-
- if (sbrk_base == (char*)(-1)) /* First time through. Record base */
- sbrk_base = lim;
- else /* Someone else called sbrk(). Count those bytes as sbrked_mem. */
- sbrked_mem += lim - (char*)old_end;
-
- /* Guarantee alignment of first new chunk made from this space */
- front_misalign = (unsigned long)chunk2mem(lim) & ALIGN_MASK;
- if (front_misalign > 0)
- {
- correction = (ALIGNMENT) - front_misalign;
- lim += correction;
- }
- else
- correction = 0;
-
- /* Guarantee the next brk will be at a page boundary */
- correction += pagesz - ((unsigned long)(lim + sbrk_size) & (pagesz - 1));
-
- /* Allocate correction */
- new_lim = (char*)(MORECORE (correction));
- if (new_lim == (char*)(MORECORE_FAILURE)) return;
-
- sbrked_mem += correction;
-
- top = (mchunkptr)lim;
- top_size = new_lim - lim + correction;
- set_head(top, top_size | PREV_INUSE);
-#if DEBUG
- lowest_chunk = top;
-#endif
-
-#ifdef OTHER_SBRKS
- if (old_top != initial_top)
- {
-
- /* There must have been an intervening foreign sbrk call. */
- /* A double fencepost is necessary to prevent consolidation */
-
- /* If not enough space to do this, then user did something very wrong */
- if (old_top_size < MINSIZE)
- {
- set_head(top, PREV_INUSE); /* will force null return from malloc */
- return;
- }
-
- old_top_size -= 2*SIZE_SZ;
- chunk_at_offset(old_top, old_top_size )->size =
- SIZE_SZ|PREV_INUSE;
- chunk_at_offset(old_top, old_top_size + SIZE_SZ)->size =
- SIZE_SZ|PREV_INUSE;
- set_head_size(old_top, old_top_size);
- /* If possible, release the rest. */
- if (old_top_size >= MINSIZE) {
- init_freeable_chunk(old_top);
- fREe(chunk2mem(old_top));
- }
- }
-#endif /* OTHER_SBRKS */
- }
-
- init_freed_chunk(top, old_top == initial_top ? old_top_size : 0, 0);
-
- if ((unsigned long)sbrked_mem > (unsigned long)max_sbrked_mem)
- max_sbrked_mem = sbrked_mem;
- if ((unsigned long)(mmapped_mem + sbrked_mem) > (unsigned long)max_total_mem)
- max_total_mem = mmapped_mem + sbrked_mem;
-
- /* We always land on a page boundary */
- assert(((unsigned long)((char*)top + top_size) & (pagesz - 1)) == 0);
-}
-
-
-
-
-/* Main public routines */
-
-
-/*
- Malloc Algorthim:
-
- The requested size is first converted into a usable form, `nb'.
- This currently means to add 4 bytes overhead plus possibly more to
- obtain 8-byte alignment and/or to obtain a size of at least
- MINSIZE (currently 16 bytes), the smallest allocatable size.
- (All fits are considered `exact' if they are within MINSIZE bytes.)
-
- From there, the first successful of the following steps is taken:
-
- 1. The bin corresponding to the request size is scanned, and if
- a chunk of exactly the right size is found, it is taken.
-
- 2. The most recently remaindered chunk is used if it is big
- enough. This is a form of (roving) first fit, used only in
- the absence of exact fits. Runs of consecutive requests use
- the remainder of the chunk used for the previous such request
- whenever possible. This limited use of a first-fit style
- allocation strategy tends to give contiguous chunks
- coextensive lifetimes, which improves locality and can reduce
- fragmentation in the long run.
-
- 3. Other bins are scanned in increasing size order, using a
- chunk big enough to fulfill the request, and splitting off
- any remainder. This search is strictly by best-fit; i.e.,
- the smallest (with ties going to approximately the least
- recently used) chunk that fits is selected.
-
- 4. If large enough, the chunk bordering the end of memory
- (`top') is split off. (This use of `top' is in accord with
- the best-fit search rule. In effect, `top' is treated as
- larger (and thus less well fitting) than any other available
- chunk since it can be extended to be as large as necessary
- (up to system limitations).
-
- 5. If the request size meets the mmap threshold and the
- system supports mmap, and there are few enough currently
- allocated mmapped regions, and a call to mmap succeeds,
- the request is allocated via direct memory mapping.
-
- 6. Otherwise, the top of memory is extended by
- obtaining more space from the system (normally using sbrk,
- but definable to anything else via the MORECORE macro).
- Memory is gathered from the system (in system page-sized
- units) in a way that allows chunks obtained across different
- sbrk calls to be consolidated, but does not require
- contiguous memory. Thus, it should be safe to intersperse
- mallocs with other sbrk calls.
-
-
- All allocations are made from the the `lowest' part of any found
- chunk. (The implementation invariant is that prev_inuse is
- always true of any allocated chunk; i.e., that each allocated
- chunk borders either a previously allocated and still in-use chunk,
- or the base of its memory arena.)
-
-*/
-
-#if __STD_C
-Void_t* mALLOc(size_t bytes)
-#else
-Void_t* mALLOc(bytes) size_t bytes;
-#endif
-{
- mchunkptr victim; /* inspected/selected chunk */
- INTERNAL_SIZE_T victim_size; /* its size */
- int idx; /* index for bin traversal */
- mbinptr bin; /* associated bin */
- mchunkptr remainder; /* remainder from a split */
- long remainder_size; /* its size */
- int remainder_index; /* its bin index */
- unsigned long block; /* block traverser bit */
- int startidx; /* first bin of a traversed block */
- mchunkptr fwd; /* misc temp for linking */
- mchunkptr bck; /* misc temp for linking */
- mbinptr q; /* misc temp */
-
- INTERNAL_SIZE_T nb = request2size(bytes); /* padded request size; */
-
- /* Check for exact match in a bin */
-
- if (is_small_request(nb)) /* Faster version for small requests */
- {
- idx = smallbin_index(nb);
-
- /* No traversal or size check necessary for small bins. */
-
- q = bin_at(idx);
- victim = last(q);
-
- /* Also scan the next one, since it would have a remainder < MINSIZE */
- if (victim == q)
- {
- q = next_bin(q);
- victim = last(q);
- }
- if (victim != q)
- {
- victim_size = chunksize(victim);
- unlink(victim, bck, fwd);
- set_inuse_bit_at_offset(victim, victim_size);
- check_freefill(victim, victim_size, victim_size);
- init_malloced_chunk(victim, bytes);
- check_malloced_chunk(victim, nb);
-
- return chunk2mem(victim);
- }
-
- idx += 2; /* Set for bin scan below. We've already scanned 2 bins. */
-
- }
- else
- {
- idx = bin_index(nb);
- bin = bin_at(idx);
-
- for (victim = last(bin); victim != bin; victim = victim->bk)
- {
- victim_size = chunksize(victim);
- remainder_size = victim_size - nb;
-
- if (remainder_size >= (long)MINSIZE) /* too big */
- {
- --idx; /* adjust to rescan below after checking last remainder */
- break;
- }
-
- else if (remainder_size >= 0) /* exact fit */
- {
- unlink(victim, bck, fwd);
- set_inuse_bit_at_offset(victim, victim_size);
- check_freefill(victim, victim_size, victim_size);
- init_malloced_chunk(victim, bytes);
- check_malloced_chunk(victim, nb);
- return chunk2mem(victim);
- }
- }
-
- ++idx;
-
- }
-
- /* Try to use the last split-off remainder */
-
- if ( (victim = last_remainder->fd) != last_remainder)
- {
- victim_size = chunksize(victim);
- remainder_size = victim_size - nb;
-
- if (remainder_size >= (long)MINSIZE) /* re-split */
- {
- remainder = chunk_at_offset(victim, nb);
- set_head(victim, nb | PREV_INUSE);
- check_freefill(victim, nb, victim_size);
- init_malloced_chunk(victim, bytes);
- link_last_remainder(remainder);
- set_head(remainder, remainder_size | PREV_INUSE);
- set_foot(remainder, remainder_size);
- init_freed_chunk(remainder, remainder_size, 0);
- check_malloced_chunk(victim, nb);
- return chunk2mem(victim);
- }
-
- clear_last_remainder;
-
- if (remainder_size >= 0) /* exhaust */
- {
- set_inuse_bit_at_offset(victim, victim_size);
- check_freefill(victim, victim_size, victim_size);
- init_malloced_chunk(victim, bytes);
- check_malloced_chunk(victim, nb);
- return chunk2mem(victim);
- }
-
- /* Else place in bin */
-
- frontlink(victim, victim_size, remainder_index, bck, fwd);
- }
-
- /*
- If there are any possibly nonempty big-enough blocks,
- search for best fitting chunk by scanning bins in blockwidth units.
- */
-
- if ( (block = idx2binblock(idx)) <= binblocks)
- {
-
- /* Get to the first marked block */
-
- if ( (block & binblocks) == 0)
- {
- /* force to an even block boundary */
- idx = (idx & ~(BINBLOCKWIDTH - 1)) + BINBLOCKWIDTH;
- block <<= 1;
- while ((block & binblocks) == 0)
- {
- idx += BINBLOCKWIDTH;
- block <<= 1;
- }
- }
-
- /* For each possibly nonempty block ... */
- for (;;)
- {
- startidx = idx; /* (track incomplete blocks) */
- q = bin = bin_at(idx);
-
- /* For each bin in this block ... */
- do
- {
- /* Find and use first big enough chunk ... */
-
- for (victim = last(bin); victim != bin; victim = victim->bk)
- {
- victim_size = chunksize(victim);
- remainder_size = victim_size - nb;
-
- if (remainder_size >= (long)MINSIZE) /* split */
- {
- remainder = chunk_at_offset(victim, nb);
- set_head(victim, nb | PREV_INUSE);
- check_freefill(victim, nb, victim_size);
- unlink(victim, bck, fwd);
- init_malloced_chunk(victim, bytes);
- link_last_remainder(remainder);
- set_head(remainder, remainder_size | PREV_INUSE);
- set_foot(remainder, remainder_size);
- init_freed_chunk(remainder, remainder_size, 0);
- check_malloced_chunk(victim, nb);
- return chunk2mem(victim);
- }
-
- else if (remainder_size >= 0) /* take */
- {
- check_freefill(victim, victim_size, victim_size);
- set_inuse_bit_at_offset(victim, victim_size);
- unlink(victim, bck, fwd);
- init_malloced_chunk(victim, bytes);
- check_malloced_chunk(victim, nb);
- return chunk2mem(victim);
- }
-
- }
-
- bin = next_bin(bin);
-
- } while ((++idx & (BINBLOCKWIDTH - 1)) != 0);
-
- /* Clear out the block bit. */
-
- do /* Possibly backtrack to try to clear a partial block */
- {
- if ((startidx & (BINBLOCKWIDTH - 1)) == 0)
- {
- binblocks &= ~block;
- break;
- }
- --startidx;
- q = prev_bin(q);
- } while (first(q) == q);
-
- /* Get to the next possibly nonempty block */
-
- if ( (block <<= 1) <= binblocks && (block != 0) )
- {
- while ((block & binblocks) == 0)
- {
- idx += BINBLOCKWIDTH;
- block <<= 1;
- }
- }
- else
- break;
- }
- }
-
-
- /* Try to use top chunk */
-
- /* Require that there be a remainder, ensuring top always exists */
- if ( (remainder_size = chunksize(top) - nb) < (long)MINSIZE)
- {
-
-#if HAVE_MMAP
- /* If big and would otherwise need to extend, try to use mmap instead */
- if ((unsigned long)nb >= (unsigned long)mmap_threshold &&
- (victim = mmap_chunk(nb)) != 0) {
- init_malloced_chunk(victim, bytes);
- return chunk2mem(victim);
- }
-#endif
-
- /* Try to extend */
- malloc_extend_top(nb);
- if ( (remainder_size = chunksize(top) - nb) < (long)MINSIZE)
- return 0; /* propagate failure */
- }
-
- victim = top;
- set_head(victim, nb | PREV_INUSE);
- check_freefill(victim, nb, nb + remainder_size);
- init_malloced_chunk(victim, bytes);
- top = chunk_at_offset(victim, nb);
- set_head(top, remainder_size | PREV_INUSE);
- init_freed_chunk(top, remainder_size, 0);
- check_malloced_chunk(victim, nb);
- return chunk2mem(victim);
-
-}
-
-
-
-
-/*
-
- free() algorithm :
-
- cases:
-
- 1. free(0) has no effect.
-
- 2. If the chunk was allocated via mmap, it is release via munmap().
-
- 3. If a returned chunk borders the current high end of memory,
- it is consolidated into the top, and if the total unused
- topmost memory exceeds the trim threshold, malloc_trim is
- called.
-
- 4. Other chunks are consolidated as they arrive, and
- placed in corresponding bins. (This includes the case of
- consolidating with the current `last_remainder').
-
-*/
-
-
-#if __STD_C
-void fREe(Void_t* mem)
-#else
-void fREe(mem) Void_t* mem;
-#endif
-{
- mchunkptr p; /* chunk corresponding to mem */
- INTERNAL_SIZE_T hd; /* its head field */
- INTERNAL_SIZE_T sz; /* its size */
- int idx; /* its bin index */
- mchunkptr next; /* next contiguous chunk */
- INTERNAL_SIZE_T nextsz; /* its size */
- INTERNAL_SIZE_T prevsz; /* size of previous contiguous chunk */
- mchunkptr bck; /* misc temp for linking */
- mchunkptr fwd; /* misc temp for linking */
- int islr; /* track whether merging with last_remainder */
-
- if (mem == 0) /* free(0) has no effect */
- return;
-
- p = mem2chunk(mem);
- check_inuse_chunk(p);
-
- hd = p->size;
-
-#if HAVE_MMAP
- if (hd & IS_MMAPPED) /* release mmapped memory. */
- {
- munmap_chunk(p);
- return;
- }
-#endif
-
- sz = hd & ~PREV_INUSE;
- next = chunk_at_offset(p, sz);
- nextsz = chunksize(next);
- prevsz = 0; /* avoid compiler warnings */
-
- if (next == top) /* merge with top */
- {
- sz += nextsz;
-
- if (!(hd & PREV_INUSE)) /* consolidate backward */
- {
- prevsz = p->prev_size;
- p = chunk_at_offset(p, -(long)prevsz);
- sz += prevsz;
- unlink(p, bck, fwd);
- }
-
- set_head(p, sz | PREV_INUSE);
- top = p;
- init_freed_chunk(top, !(hd & PREV_INUSE) ? prevsz : 0, nextsz);
- if ((unsigned long)(sz) >= trim_threshold)
- malloc_trim(top_pad);
- return;
- }
-
- set_head(next, nextsz); /* clear inuse bit */
-
- islr = 0;
-
- if (!(hd & PREV_INUSE)) /* consolidate backward */
- {
- prevsz = p->prev_size;
- p = chunk_at_offset(p, -(long)prevsz);
- sz += prevsz;
-
- if (p->fd == last_remainder) /* keep as last_remainder */
- islr = 1;
- else
- unlink(p, bck, fwd);
- }
-
- if (!(inuse_bit_at_offset(next, nextsz))) /* consolidate forward */
- {
- sz += nextsz;
-
- if (!islr && next->fd == last_remainder) /* re-insert last_remainder */
- {
- islr = 1;
- link_last_remainder(p);
- }
- else
- unlink(next, bck, fwd);
- }
-
-
- set_head(p, sz | PREV_INUSE);
- set_foot(p, sz);
- if (!islr)
- frontlink(p, sz, idx, bck, fwd);
- init_freed_chunk(p, !(hd & PREV_INUSE) ? prevsz : 0,
- !inuse_bit_at_offset(next, nextsz) ? nextsz : 0);
-}
-
-
-
-
-
-/*
-
- Realloc algorithm:
-
- Chunks that were obtained via mmap cannot be extended or shrunk
- unless HAVE_MREMAP is defined, in which case mremap is used.
- Otherwise, if their reallocation is for additional space, they are
- copied. If for less, they are just left alone.
-
- Otherwise, if the reallocation is for additional space, and the
- chunk can be extended, it is, else a malloc-copy-free sequence is
- taken. There are several different ways that a chunk could be
- extended. All are tried:
-
- * Extending forward into following adjacent free chunk.
- * Shifting backwards, joining preceding adjacent space
- * Both shifting backwards and extending forward.
- * Extending into newly sbrked space
-
- Unless the #define realloc_ZERO_BYTES_FREES is set, realloc with a
- size argument of zero (re)allocates a minimum-sized chunk.
-
- If the reallocation is for less space, and the new request is for
- a `small' (<512 bytes) size, then the newly unused space is lopped
- off and freed.
-
- The old unix realloc convention of allowing the last-free'd chunk
- to be used as an argument to realloc is no longer supported.
- I don't know of any programs still relying on this feature,
- and allowing it would also allow too many other incorrect
- usages of realloc to be sensible.
-
-
-*/
-
-
-#if __STD_C
-Void_t* rEALLOc(Void_t* oldmem, size_t bytes)
-#else
-Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes;
-#endif
-{
- INTERNAL_SIZE_T nb; /* padded request size */
-
- mchunkptr oldp; /* chunk corresponding to oldmem */
- INTERNAL_SIZE_T oldsize; /* its size */
-
- mchunkptr newp; /* chunk to return */
- INTERNAL_SIZE_T newsize; /* its size */
- Void_t* newmem; /* corresponding user mem */
-
- mchunkptr next; /* next contiguous chunk after oldp */
- INTERNAL_SIZE_T nextsize; /* its size */
-
- mchunkptr prev; /* previous contiguous chunk before oldp */
- INTERNAL_SIZE_T prevsize; /* its size */
-
- mchunkptr remainder; /* holds split off extra space from newp */
- INTERNAL_SIZE_T remainder_size; /* its size */
-
- mchunkptr bck; /* misc temp for linking */
- mchunkptr fwd; /* misc temp for linking */
-
-#ifdef realloc_ZERO_BYTES_FREES
- if (bytes == 0) { fREe(oldmem); return 0; }
-#endif
-
-
- /* realloc of null is supposed to be same as malloc */
- if (oldmem == 0) return mALLOc(bytes);
-
- newp = oldp = mem2chunk(oldmem);
- newsize = oldsize = chunksize(oldp);
-
-
- nb = request2size(bytes);
-
- check_inuse_chunk(oldp);
-
-#if HAVE_MMAP
- if (chunk_is_mmapped(oldp))
- {
- if (oldsize - MMAP_EXTRA >= nb) {
- init_realloced_chunk(oldp, bytes, oldsize);
- return oldmem; /* do nothing */
- }
-#if HAVE_MREMAP
- newp = mremap_chunk(oldp, nb);
- if (newp) {
- init_realloced_chunk(newp, bytes, oldsize);
- return chunk2mem(newp);
- }
-#endif
- /* Must alloc, copy, free. */
- newmem = mALLOc(bytes);
- if (newmem == 0) return 0; /* propagate failure */
- malloc_COPY(newmem, oldmem, oldsize - OVERHEAD - MMAP_EXTRA);
- munmap_chunk(oldp);
- return newmem;
- }
-#endif
-
- if (oldsize < nb)
- {
-
- /* Try expanding forward */
-
- next = chunk_at_offset(oldp, oldsize);
- if (next == top || !inuse(next))
- {
- nextsize = chunksize(next);
-
- /* Forward into top only if a remainder */
- if (next == top)
- {
- if ((long)(nextsize + newsize) >= (long)(nb + MINSIZE))
- {
- check_freefill(next, nb - oldsize, nextsize);
- newsize += nextsize;
- top = chunk_at_offset(oldp, nb);
- set_head(top, (newsize - nb) | PREV_INUSE);
- init_freed_chunk(top, newsize - nb, 0);
- set_head_size(oldp, nb);
- init_realloced_chunk(oldp, bytes, oldsize);
- return chunk2mem(oldp);
- }
- }
-
- /* Forward into next chunk */
- else if (((long)(nextsize + newsize) >= (long)nb))
- {
- check_freefill(next, nb - oldsize, nextsize);
- unlink(next, bck, fwd);
- newsize += nextsize;
- goto split;
- }
- }
- else
- {
- next = 0;
- nextsize = 0;
- }
-
- /* Try shifting backwards. */
-
- if (!prev_inuse(oldp))
- {
- prev = prev_chunk(oldp);
- prevsize = chunksize(prev);
-
- /* try forward + backward first to save a later consolidation */
-
- if (next != 0)
- {
- /* into top */
- if (next == top)
- {
- if ((long)(nextsize + prevsize + newsize) >= (long)(nb + MINSIZE))
- {
- check_freefill(prev, nb, prevsize);
- check_freefill(next, nb - (prevsize + newsize), nextsize);
- unlink(prev, bck, fwd);
- newp = prev;
- newsize += prevsize + nextsize;
- newmem = chunk2mem(newp);
- malloc_COPY(newmem, oldmem, oldsize - OVERHEAD);
- top = chunk_at_offset(newp, nb);
- set_head(top, (newsize - nb) | PREV_INUSE);
- init_freed_chunk(top, newsize - nb, 0);
- set_head_size(newp, nb);
- init_realloced_chunk(newp, bytes, oldsize);
- return newmem;
- }
- }
-
- /* into next chunk */
- else if (((long)(nextsize + prevsize + newsize) >= (long)(nb)))
- {
- check_freefill(prev, nb, prevsize);
- check_freefill(next, nb - (prevsize + newsize), nextsize);
- unlink(next, bck, fwd);
- unlink(prev, bck, fwd);
- newp = prev;
- newsize += nextsize + prevsize;
- newmem = chunk2mem(newp);
- malloc_COPY(newmem, oldmem, oldsize - OVERHEAD);
- goto split;
- }
- }
-
- /* backward only */
- if (prev != 0 && (long)(prevsize + newsize) >= (long)nb)
- {
- check_freefill(prev, nb, prevsize);
- unlink(prev, bck, fwd);
- newp = prev;
- newsize += prevsize;
- newmem = chunk2mem(newp);
- malloc_COPY(newmem, oldmem, oldsize - OVERHEAD);
- goto split;
- }
- }
-
- /* Must allocate */
-
- newmem = mALLOc (bytes);
-
- if (newmem == 0) /* propagate failure */
- return 0;
-
- /* Avoid copy if newp is next chunk after oldp. */
- /* (This can only happen when new chunk is sbrk'ed.) */
-
- if ( (newp = mem2chunk(newmem)) == next_chunk(oldp))
- {
- newsize += chunksize(newp);
- newp = oldp;
- goto split;
- }
-
- /* Otherwise copy, free, and exit */
- malloc_COPY(newmem, oldmem, oldsize - OVERHEAD);
- fREe(oldmem);
- return newmem;
- }
-
-
- split: /* split off extra room in old or expanded chunk */
-
- if (newsize - nb >= MINSIZE) /* split off remainder */
- {
- remainder = chunk_at_offset(newp, nb);
- remainder_size = newsize - nb;
- set_head_size(newp, nb);
- set_head(remainder, remainder_size | PREV_INUSE);
- set_inuse_bit_at_offset(remainder, remainder_size);
- init_malloced_chunk(remainder, remainder_size - OVERHEAD);
- fREe(chunk2mem(remainder)); /* let free() deal with it */
- }
- else
- {
- set_head_size(newp, newsize);
- set_inuse_bit_at_offset(newp, newsize);
- }
-
- init_realloced_chunk(newp, bytes, oldsize);
- check_inuse_chunk(newp);
- return chunk2mem(newp);
-}
-
-
-
-
-/*
-
- memalign algorithm:
-
- memalign requests more than enough space from malloc, finds a spot
- within that chunk that meets the alignment request, and then
- possibly frees the leading and trailing space.
-
- The alignment argument must be a power of two. This property is not
- checked by memalign, so misuse may result in random runtime errors.
-
- 8-byte alignment is guaranteed by normal malloc calls, so don't
- bother calling memalign with an argument of 8 or less.
-
- Overreliance on memalign is a sure way to fragment space.
-
-*/
-
-
-#if __STD_C
-Void_t* mEMALIGn(size_t alignment, size_t bytes)
-#else
-Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes;
-#endif
-{
- INTERNAL_SIZE_T nb; /* padded request size */
- char* m; /* memory returned by malloc call */
- mchunkptr p; /* corresponding chunk */
- char* lim; /* alignment point within p */
- mchunkptr newp; /* chunk to return */
- INTERNAL_SIZE_T newsize; /* its size */
- INTERNAL_SIZE_T leadsize; /* leading space befor alignment point */
- mchunkptr remainder; /* spare room at end to split off */
- long remainder_size; /* its size */
-
- /* If need less alignment than we give anyway, just relay to malloc */
-
- if (alignment <= ALIGNMENT) return mALLOc(bytes);
-
- /* Otherwise, ensure that it is at least a minimum chunk size */
-
- if (alignment < MINSIZE) alignment = MINSIZE;
-
- /* Call malloc with worst case padding to hit alignment. */
-
- nb = request2size(bytes);
- m = (char*)mALLOc(nb + alignment + MINSIZE);
-
- if (m == 0) return 0; /* propagate failure */
-
- p = mem2chunk(m);
-
- if ((((unsigned long)(m)) % alignment) == 0) /* aligned */
- {
- init_realloced_chunk(p, bytes, chunksize(p));
- return chunk2mem(p); /* nothing more to do */
- }
- else /* misaligned */
- {
- /*
- Find an aligned spot inside chunk.
- Since we need to give back leading space in a chunk of at
- least MINSIZE, if the first calculation places us at
- a spot with less than MINSIZE leader, we can move to the
- next aligned spot -- we've allocated enough total room so that
- this is always possible.
- */
-
- lim = (char*)mem2chunk(((unsigned long)(m + alignment - 1)) &
- ~(alignment - 1));
- if ((lim - (char*)p) < (long)MINSIZE) lim = lim + alignment;
-
- newp = (mchunkptr)lim;
- leadsize = lim - (char*)p;
- newsize = chunksize(p) - leadsize;
-
-#if HAVE_MMAP
- if(chunk_is_mmapped(p))
- {
- newp->prev_size = p->prev_size + leadsize;
- set_head(newp, newsize|IS_MMAPPED);
- init_malloced_chunk(newp, bytes);
- return chunk2mem(newp);
- }
-#endif
-
- /* give back leader, use the rest */
-
- set_head(newp, newsize | PREV_INUSE);
- set_inuse_bit_at_offset(newp, newsize);
- set_head_size(p, leadsize);
- init_freeable_chunk(p);
- fREe(chunk2mem(p));
- p = newp;
-
- assert (newsize >= nb && (((unsigned long)(chunk2mem(p))) % alignment) == 0);
- }
-
- /* Also give back spare room at the end */
-
- remainder_size = chunksize(p) - nb;
-
- if (remainder_size >= (long)MINSIZE)
- {
- remainder = chunk_at_offset(p, nb);
- set_head(remainder, remainder_size | PREV_INUSE);
- set_head_size(p, nb);
- init_freeable_chunk(remainder);
- fREe(chunk2mem(remainder));
- }
-
- init_malloced_chunk(p, bytes);
- check_inuse_chunk(p);
- return chunk2mem(p);
-
-}
-
-
-
-
-/*
- valloc just invokes memalign with alignment argument equal
- to the page size of the system (or as near to this as can
- be figured out from all the includes/defines above.)
-*/
-
-#if __STD_C
-Void_t* vALLOc(size_t bytes)
-#else
-Void_t* vALLOc(bytes) size_t bytes;
-#endif
-{
- return mEMALIGn (malloc_getpagesize, bytes);
-}
-
-/*
- pvalloc just invokes valloc for the nearest pagesize
- that will accommodate request
-*/
-
-
-#if __STD_C
-Void_t* pvALLOc(size_t bytes)
-#else
-Void_t* pvALLOc(bytes) size_t bytes;
-#endif
-{
- size_t pagesize = malloc_getpagesize;
- return mEMALIGn (pagesize, (bytes + pagesize - 1) & ~(pagesize - 1));
-}
-
-/*
-
- calloc calls malloc, then zeroes out the allocated chunk.
-
-*/
-
-#if __STD_C
-Void_t* cALLOc(size_t n, size_t elem_size)
-#else
-Void_t* cALLOc(n, elem_size) size_t n; size_t elem_size;
-#endif
-{
- mchunkptr p;
- INTERNAL_SIZE_T csz;
-
- INTERNAL_SIZE_T sz = n * elem_size;
-
- /* check if expand_top called, in which case don't need to clear */
-#if MORECORE_CLEARS
- mchunkptr oldtop = top;
- INTERNAL_SIZE_T oldtopsize = chunksize(top);
-#endif
- Void_t* mem = mALLOc (sz);
-
- if (mem == 0)
- return 0;
- else
- {
- p = mem2chunk(mem);
-
- /* Two optional cases in which clearing not necessary */
-
-
-#if HAVE_MMAP
- if (chunk_is_mmapped(p)) return mem;
-#endif
-
- csz = chunksize(p);
-
-#if MORECORE_CLEARS
- if (p == oldtop && csz > oldtopsize)
- {
- /* clear only the bytes from non-freshly-sbrked memory */
- csz = oldtopsize;
- }
-#endif
-
- malloc_ZERO(mem, csz - OVERHEAD);
- /* reinstate moat fill in pad region */
- init_realloced_chunk(p, sz, chunksize(p));
- return mem;
- }
-}
-
-/*
-
- cfree just calls free. It is needed/defined on some systems
- that pair it with calloc, presumably for odd historical reasons.
-
-*/
-
-#if !defined(INTERNAL_LINUX_C_LIB) || !defined(__ELF__)
-#if __STD_C
-void cfree(Void_t *mem)
-#else
-void cfree(mem) Void_t *mem;
-#endif
-{
- free(mem);
-}
-#endif
-
-
-
-/*
-
- Malloc_trim gives memory back to the system (via negative
- arguments to sbrk) if there is unused memory at the `high' end of
- the malloc pool. You can call this after freeing large blocks of
- memory to potentially reduce the system-level memory requirements
- of a program. However, it cannot guarantee to reduce memory. Under
- some allocation patterns, some large free blocks of memory will be
- locked between two used chunks, so they cannot be given back to
- the system.
-
- The `pad' argument to malloc_trim represents the amount of free
- trailing space to leave untrimmed. If this argument is zero,
- only the minimum amount of memory to maintain internal data
- structures will be left (one page or less). Non-zero arguments
- can be supplied to maintain enough trailing space to service
- future expected allocations without having to re-obtain memory
- from the system.
-
- Malloc_trim returns 1 if it actually released any memory, else 0.
-
-*/
-
-#if __STD_C
-int malloc_trim(size_t pad)
-#else
-int malloc_trim(pad) size_t pad;
-#endif
-{
- long top_size; /* Amount of top-most memory */
- long extra; /* Amount to release */
- char* current_lim; /* address returned by pre-check sbrk call */
- char* new_lim; /* address returned by negative sbrk call */
-
- unsigned long pagesz = malloc_getpagesize;
-
- top_size = chunksize(top);
- extra = ((top_size - pad - MINSIZE + (pagesz-1)) / pagesz - 1) * pagesz;
-
- if (extra < (long)pagesz) /* Not enough memory to release */
- return 0;
-
- else
- {
-#ifdef OTHER_SBRKS
- /* Test to make sure no one else called sbrk */
- current_lim = (char*)(MORECORE (0));
- if (current_lim != (char*)(top) + top_size)
- return 0; /* Apparently we don't own memory; must fail */
-
- else
-#endif
- {
- new_lim = (char*)(MORECORE (-extra));
-
- if (new_lim == (char*)(MORECORE_FAILURE)) /* sbrk failed? */
- {
- /* Try to figure out what we have */
- current_lim = (char*)(MORECORE (0));
- top_size = current_lim - (char*)top;
- if (top_size >= (long)MINSIZE) /* if not, we are very very dead! */
- {
- sbrked_mem = current_lim - sbrk_base;
- set_head(top, top_size | PREV_INUSE);
- init_freed_chunk(top, top_size, 0);
- }
- check_chunk(top);
- return 0;
- }
-
- else
- {
- /* Success. Adjust top accordingly. */
- set_head(top, (top_size - extra) | PREV_INUSE);
- sbrked_mem -= extra;
- init_freed_chunk(top, top_size - extra, 0);
- check_chunk(top);
- return 1;
- }
- }
- }
-}
-
-
-
-/*
- malloc_usable_size:
-
- This routine tells you how many bytes you can actually use in an
- allocated chunk, which may be more than you requested (although
- often not). You can use this many bytes without worrying about
- overwriting other allocated objects. Not a particularly great
- programming practice, but still sometimes useful.
-
-*/
-
-#if __STD_C
-size_t malloc_usable_size(Void_t* mem)
-#else
-size_t malloc_usable_size(mem) Void_t* mem;
-#endif
-{
- mchunkptr p;
- if (mem == 0)
- return 0;
- else
- {
- p = mem2chunk(mem);
- check_inuse_chunk(p);
- maximize_chunk(p);
- if(!chunk_is_mmapped(p))
- {
- if (!inuse(p)) return 0;
- return chunksize(p) - OVERHEAD;
- }
- return chunksize(p) - OVERHEAD - MMAP_EXTRA;
- }
-}
-
-
-
-
-/* Utility to update current_mallinfo for malloc_stats and mallinfo() */
-
-static void malloc_update_mallinfo(void)
-{
- int i;
- mbinptr b;
- mchunkptr p;
-#if DEBUG
- mchunkptr q;
-#endif
-
- INTERNAL_SIZE_T avail = chunksize(top);
- int navail = avail >= MINSIZE ? 1 : 0;
- check_freefill(top, avail, avail);
-
-#if DEBUG
- if (lowest_chunk)
- for (p = lowest_chunk;
- p < top && inuse(p) && chunksize(p) >= MINSIZE;
- p = next_chunk(p))
- check_inuse_chunk(p);
-#endif
-
- for (i = 1; i < NAV; ++i)
- {
- b = bin_at(i);
- for (p = last(b); p != b; p = p->bk)
- {
-#if DEBUG
- check_free_chunk(p);
- check_freefill(p, chunksize(p), chunksize(p));
- for (q = next_chunk(p);
- q < top && inuse(q) && chunksize(q) >= MINSIZE;
- q = next_chunk(q))
- check_inuse_chunk(q);
-#endif
- avail += chunksize(p);
- navail++;
- }
- }
-
- current_mallinfo.ordblks = navail;
- current_mallinfo.uordblks = sbrked_mem - avail;
- current_mallinfo.fordblks = avail;
- current_mallinfo.hblks = n_mmaps;
- current_mallinfo.hblkhd = mmapped_mem;
- current_mallinfo.keepcost = chunksize(top);
-
-}
-
-
-
-/*
-
- malloc_stats:
-
- Prints on stderr the amount of space obtain from the system (both
- via sbrk and mmap), the maximum amount (which may be more than
- current if malloc_trim and/or munmap got called), the maximum
- number of simultaneous mmap regions used, and the current number
- of bytes allocated via malloc (or realloc, etc) but not yet
- freed. (Note that this is the number of bytes allocated, not the
- number requested. It will be larger than the number requested
- because of alignment and bookkeeping overhead.)
-
-*/
-
-void malloc_stats(void)
-{
- malloc_update_mallinfo();
- fprintf(stderr, "max system bytes = %10u\n",
- (unsigned int)(max_total_mem));
- fprintf(stderr, "system bytes = %10u\n",
- (unsigned int)(sbrked_mem + mmapped_mem));
- fprintf(stderr, "in use bytes = %10u\n",
- (unsigned int)(current_mallinfo.uordblks + mmapped_mem));
-#if HAVE_MMAP
- fprintf(stderr, "max mmap regions = %10u\n",
- (unsigned int)max_n_mmaps);
-#endif
-}
-
-/*
- mallinfo returns a copy of updated current mallinfo.
-*/
-
-struct mallinfo mALLINFo(void)
-{
- malloc_update_mallinfo();
- return current_mallinfo;
-}
-
-
-
-
-/*
- mallopt:
-
- mallopt is the general SVID/XPG interface to tunable parameters.
- The format is to provide a (parameter-number, parameter-value) pair.
- mallopt then sets the corresponding parameter to the argument
- value if it can (i.e., so long as the value is meaningful),
- and returns 1 if successful else 0.
-
- See descriptions of tunable parameters above.
-
-*/
-
-#if __STD_C
-int mALLOPt(int param_number, int value)
-#else
-int mALLOPt(param_number, value) int param_number; int value;
-#endif
-{
- switch(param_number)
- {
- case M_TRIM_THRESHOLD:
- trim_threshold = value; return 1;
- case M_TOP_PAD:
- top_pad = value; return 1;
- case M_MMAP_THRESHOLD:
- mmap_threshold = value; return 1;
- case M_MMAP_MAX:
-#if HAVE_MMAP
- n_mmaps_max = value; return 1;
-#else
- if (value != 0) return 0; else n_mmaps_max = value; return 1;
-#endif
- case M_SCANHEAP:
-#ifdef DEBUG2
- scanheap = value;
-#endif
- return 1;
-
- default:
- return 0;
- }
-}
-
-/*
-
-History:
-
- V2.6.3 Sun May 19 08:17:58 1996 Doug Lea (dl at gee)
- * Added pvalloc, as recommended by H.J. Liu
- * Added 64bit pointer support mainly from Wolfram Gloger
- * Added anonymously donated WIN32 sbrk emulation
- * Malloc, calloc, getpagesize: add optimizations from Raymond Nijssen
- * malloc_extend_top: fix mask error that caused wastage after
- foreign sbrks
- * Add linux mremap support code from HJ Liu
-
- V2.6.2 Tue Dec 5 06:52:55 1995 Doug Lea (dl at gee)
- * Integrated most documentation with the code.
- * Add support for mmap, with help from
- Wolfram Gloger (Gloger@lrz.uni-muenchen.de).
- * Use last_remainder in more cases.
- * Pack bins using idea from colin@nyx10.cs.du.edu
- * Use ordered bins instead of best-fit threshhold
- * Eliminate block-local decls to simplify tracing and debugging.
- * Support another case of realloc via move into top
- * Fix error occuring when initial sbrk_base not word-aligned.
- * Rely on page size for units instead of SBRK_UNIT to
- avoid surprises about sbrk alignment conventions.
- * Add mallinfo, mallopt. Thanks to Raymond Nijssen
- (raymond@es.ele.tue.nl) for the suggestion.
- * Add `pad' argument to malloc_trim and top_pad mallopt parameter.
- * More precautions for cases where other routines call sbrk,
- courtesy of Wolfram Gloger (Gloger@lrz.uni-muenchen.de).
- * Added macros etc., allowing use in linux libc from
- H.J. Lu (hjl@gnu.ai.mit.edu)
- * Inverted this history list
-
- V2.6.1 Sat Dec 2 14:10:57 1995 Doug Lea (dl at gee)
- * Re-tuned and fixed to behave more nicely with V2.6.0 changes.
- * Removed all preallocation code since under current scheme
- the work required to undo bad preallocations exceeds
- the work saved in good cases for most test programs.
- * No longer use return list or unconsolidated bins since
- no scheme using them consistently outperforms those that don't
- given above changes.
- * Use best fit for very large chunks to prevent some worst-cases.
- * Added some support for debugging
-
- V2.6.0 Sat Nov 4 07:05:23 1995 Doug Lea (dl at gee)
- * Removed footers when chunks are in use. Thanks to
- Paul Wilson (wilson@cs.texas.edu) for the suggestion.
-
- V2.5.4 Wed Nov 1 07:54:51 1995 Doug Lea (dl at gee)
- * Added malloc_trim, with help from Wolfram Gloger
- (wmglo@Dent.MED.Uni-Muenchen.DE).
-
- V2.5.3 Tue Apr 26 10:16:01 1994 Doug Lea (dl at g)
-
- V2.5.2 Tue Apr 5 16:20:40 1994 Doug Lea (dl at g)
- * realloc: try to expand in both directions
- * malloc: swap order of clean-bin strategy;
- * realloc: only conditionally expand backwards
- * Try not to scavenge used bins
- * Use bin counts as a guide to preallocation
- * Occasionally bin return list chunks in first scan
- * Add a few optimizations from colin@nyx10.cs.du.edu
-
- V2.5.1 Sat Aug 14 15:40:43 1993 Doug Lea (dl at g)
- * faster bin computation & slightly different binning
- * merged all consolidations to one part of malloc proper
- (eliminating old malloc_find_space & malloc_clean_bin)
- * Scan 2 returns chunks (not just 1)
- * Propagate failure in realloc if malloc returns 0
- * Add stuff to allow compilation on non-ANSI compilers
- from kpv@research.att.com
-
- V2.5 Sat Aug 7 07:41:59 1993 Doug Lea (dl at g.oswego.edu)
- * removed potential for odd address access in prev_chunk
- * removed dependency on getpagesize.h
- * misc cosmetics and a bit more internal documentation
- * anticosmetics: mangled names in macros to evade debugger strangeness
- * tested on sparc, hp-700, dec-mips, rs6000
- with gcc & native cc (hp, dec only) allowing
- Detlefs & Zorn comparison study (in SIGPLAN Notices.)
-
- Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu)
- * Based loosely on libg++-1.2X malloc. (It retains some of the overall
- structure of old version, but most details differ.)
-
-*/
diff --git a/winsup/cygwin/dlmalloc.h b/winsup/cygwin/dlmalloc.h
deleted file mode 100644
index 15b25db7b..000000000
--- a/winsup/cygwin/dlmalloc.h
+++ /dev/null
@@ -1,96 +0,0 @@
-
-/*
- * Header file for BBCized version of Doug Lea's malloc.c, automatically
- * generated by
- * /source/prod/libbbc/compat/dlmalloc/cvt
- * from
- * /source/prod/libbbc/compat/dlmalloc/malloc.c
- *
- * bbclabel: autogenerated
- */
-
-void malloc_outofmem(void (*)(void));
-
-
-struct mallinfo {
- int arena; /* total space allocated from system */
- int ordblks; /* number of non-inuse chunks */
- int smblks; /* unused -- always zero */
- int hblks; /* number of mmapped regions */
- int hblkhd; /* total space in mmapped regions */
- int usmblks; /* unused -- always zero */
- int fsmblks; /* unused -- always zero */
- int uordblks; /* total allocated space */
- int fordblks; /* total non-inuse space */
- int keepcost; /* top-most, releasable (via malloc_trim) space */
-};
-
-
-#define M_MXFAST 1 /* UNUSED in this malloc */
-#define M_NLBLKS 2 /* UNUSED in this malloc */
-#define M_GRAIN 3 /* UNUSED in this malloc */
-#define M_KEEP 4 /* UNUSED in this malloc */
-
-
-#define M_TRIM_THRESHOLD -1
-#define M_TOP_PAD -2
-#define M_MMAP_THRESHOLD -3
-#define M_MMAP_MAX -4
-#define M_SCANHEAP -5
-#define M_FILL
-
-#ifdef MALLOC_DEBUG
-
-#define malloc(size) malloc_dbg(size, __FILE__, __LINE__)
-#define free(p) free_dbg(p, __FILE__, __LINE__)
-#define realloc(p, size) realloc_dbg(p, size, __FILE__, __LINE__)
-#define calloc(n, size) calloc_dbg(n, size, __FILE__, __LINE__)
-#define memalign(align, size) memalign_dbg(align, size, __FILE__, __LINE__)
-#define valloc(size) valloc_dbg(size, __FILE__, __LINE__)
-#define pvalloc(size) pvalloc_dbg(size, __FILE__, __LINE__)
-#define cfree(p) cfree_dbg(p, __FILE__, __LINE__)
-#define malloc_trim(pad) malloc_trim_dbg(pad, __FILE__, __LINE__)
-#define malloc_usable_size(p) malloc_usable_size_dbg(p, __FILE__, __LINE__)
-#define malloc_stats() malloc_stats_dbg(__FILE__, __LINE__)
-#define mallopt(flag, val) mallopt_dbg(flag, val, __FILE__, __LINE__)
-#define mallinfo() mallinfo_dbg(__FILE__, __LINE__)
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-void* malloc_dbg(size_t, const char *, int);
-void free_dbg(void*, const char *, int);
-void* realloc_dbg(void*, size_t, const char *, int);
-void* calloc_dbg(size_t, size_t, const char *, int);
-void* memalign_dbg(size_t, size_t, const char *, int);
-void* valloc_dbg(size_t, const char *, int);
-void* pvalloc_dbg(size_t, const char *, int);
-void cfree_dbg(void*, const char *, int);
-int malloc_trim_dbg(size_t, const char *, int);
-size_t malloc_usable_size_dbg(void*, const char *, int);
-void malloc_stats_dbg(const char *, int);
-int mallopt_dbg(int, int, const char *, int);
-struct mallinfo mallinfo_dbg(const char *, int);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* MALLOC_DEBUG */
-
-#ifndef MALLOC_DEBUG
-
-void* malloc(size_t);
-void free(void*);
-void* realloc(void*, size_t);
-void* calloc(size_t, size_t);
-void* memalign(size_t, size_t);
-void* valloc(size_t);
-void* pvalloc(size_t);
-void cfree(void*);
-int malloc_trim(size_t);
-size_t malloc_usable_size(void*);
-void malloc_stats(void);
-int mallopt(int, int);
-struct mallinfo mallinfo(void);
-#endif /* !MALLOC_DEBUG */
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
deleted file mode 100644
index 241528a3d..000000000
--- a/winsup/cygwin/dtable.cc
+++ /dev/null
@@ -1,817 +0,0 @@
-/* dtable.cc: file descriptor support.
-
- Copyright 1996, 1997, 1998, 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. */
-
-#define __INSIDE_CYGWIN_NET__
-
-#include "winsup.h"
-#include <errno.h>
-#include <sys/socket.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/cygwin.h>
-#include <assert.h>
-#include <ntdef.h>
-#include <winnls.h>
-
-#define USE_SYS_TYPES_FD_SET
-#include <winsock.h>
-#include "pinfo.h"
-#include "cygerrno.h"
-#include "perprocess.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygheap.h"
-#include "ntdll.h"
-
-static const NO_COPY DWORD std_consts[] = {STD_INPUT_HANDLE, STD_OUTPUT_HANDLE,
- STD_ERROR_HANDLE};
-
-static char *handle_to_fn (HANDLE, char *);
-
-/* Set aside space for the table of fds */
-void
-dtable_init (void)
-{
- if (!cygheap->fdtab.size)
- cygheap->fdtab.extend (NOFILE_INCR);
-}
-
-void __stdcall
-set_std_handle (int fd)
-{
- if (fd == 0)
- SetStdHandle (std_consts[fd], cygheap->fdtab[fd]->get_handle ());
- else if (fd <= 2)
- SetStdHandle (std_consts[fd], cygheap->fdtab[fd]->get_output_handle ());
-}
-
-void
-dtable::dec_console_fds ()
-{
- if (console_fds > 0 && !--console_fds &&
- myself->ctty != TTY_CONSOLE && !check_pty_fds())
- FreeConsole ();
-}
-
-int
-dtable::extend (int howmuch)
-{
- int new_size = size + howmuch;
- fhandler_base **newfds;
-
- if (howmuch <= 0)
- return 0;
-
- /* Try to allocate more space for fd table. We can't call realloc ()
- here to preserve old table if memory allocation fails */
-
- if (!(newfds = (fhandler_base **) ccalloc (HEAP_ARGV, new_size, sizeof newfds[0])))
- {
- debug_printf ("calloc failed");
- return 0;
- }
- if (fds)
- {
- memcpy (newfds, fds, size * sizeof (fds[0]));
- cfree (fds);
- }
-
- size = new_size;
- fds = newfds;
- debug_printf ("size %d, fds %p", size, fds);
- return 1;
-}
-
-void
-dtable::get_debugger_info ()
-{
- if (being_debugged ())
- {
- char std[3][sizeof ("/dev/ttyNNNN")];
- std[0][0] = std[1][0] = std [2][0] = '\0';
- char buf[sizeof ("cYgstd %x") + 32];
- sprintf (buf, "cYgstd %x %x %x", (unsigned) &std, sizeof (std[0]), 3);
- OutputDebugString (buf);
- for (int i = 0; i < 3; i++)
- if (std[i][0])
- {
- path_conv pc;
- HANDLE h = GetStdHandle (std_consts[i]);
- fhandler_base *fh = build_fhandler_from_name (i, std[i], NULL, pc);
- if (!fh)
- continue;
- if (!fh->open (&pc, (i ? O_WRONLY : O_RDONLY) | O_BINARY, 0777))
- release (i);
- else
- CloseHandle (h);
- }
- }
-}
-
-/* Initialize the file descriptor/handle mapping table.
- This function should only be called when a cygwin function is invoked
- by a non-cygwin function, i.e., it should only happen very rarely. */
-
-void
-dtable::stdio_init ()
-{
- extern void set_console_ctty ();
- /* Set these before trying to output anything from strace.
- Also, always set them even if we're to pick up our parent's fds
- in case they're missed. */
-
- if (myself->ppid_handle || ISSTATE (myself, PID_CYGPARENT))
- return;
-
- HANDLE in = GetStdHandle (STD_INPUT_HANDLE);
- HANDLE out = GetStdHandle (STD_OUTPUT_HANDLE);
- HANDLE err = GetStdHandle (STD_ERROR_HANDLE);
-
- init_std_file_from_handle (0, in, GENERIC_READ);
-
- /* STD_ERROR_HANDLE has been observed to be the same as
- STD_OUTPUT_HANDLE. We need separate handles (e.g. using pipes
- to pass data from child to parent). */
- if (out == err)
- {
- /* Since this code is not invoked for forked tasks, we don't have
- to worry about the close-on-exec flag here. */
- if (!DuplicateHandle (hMainProc, out, hMainProc, &err, 0,
- 1, DUPLICATE_SAME_ACCESS))
- {
- /* If that fails, do this as a fall back. */
- err = out;
- system_printf ("couldn't make stderr distinct from stdout");
- }
- }
-
- init_std_file_from_handle (1, out, GENERIC_WRITE);
- init_std_file_from_handle (2, err, GENERIC_WRITE);
- /* Assign the console as the controlling tty for this process if we actually
- have a console and no other controlling tty has been assigned. */
- if (myself->ctty < 0 && GetConsoleCP () > 0)
- set_console_ctty ();
-}
-
-int
-dtable::find_unused_handle (int start)
-{
- AssertResourceOwner (LOCK_FD_LIST, READ_LOCK);
-
- do
- {
- for (int i = start; i < (int) size; i++)
- /* See if open -- no need for overhead of not_open */
- if (fds[i] == NULL)
- return i;
- }
- while (extend (NOFILE_INCR));
- return -1;
-}
-
-void
-dtable::release (int fd)
-{
- if (!not_open (fd))
- {
- switch (fds[fd]->get_device ())
- {
- case FH_SOCKET:
- dec_need_fixup_before ();
- break;
- case FH_CONSOLE:
- dec_console_fds ();
- break;
- }
- delete fds[fd];
- fds[fd] = NULL;
- }
-}
-
-extern "C"
-int
-cygwin_attach_handle_to_fd (char *name, int fd, HANDLE handle, mode_t bin,
- DWORD myaccess)
-{
- if (fd == -1)
- fd = cygheap->fdtab.find_unused_handle ();
- path_conv pc;
- fhandler_base *res = cygheap->fdtab.build_fhandler_from_name (fd, name, handle,
- pc);
- res->init (handle, myaccess, bin);
- return fd;
-}
-
-void
-dtable::init_std_file_from_handle (int fd, HANDLE handle, DWORD myaccess)
-{
- const char *name;
- CONSOLE_SCREEN_BUFFER_INFO buf;
- struct sockaddr sa;
- int sal = sizeof (sa);
- DCB dcb;
-
- first_fd_for_open = 0;
-
- if (!not_open (fd))
- return;
-
- SetLastError (0);
- DWORD ft = GetFileType (handle);
- if (ft == FILE_TYPE_UNKNOWN && GetLastError () == ERROR_INVALID_HANDLE)
- name = NULL;
- else
- {
- /* See if we can consoleify it */
- if (GetConsoleScreenBufferInfo (handle, &buf))
- {
- if (ISSTATE (myself, PID_USETTY))
- name = "/dev/tty";
- else
- name = "/dev/conout";
- }
- else if (GetNumberOfConsoleInputEvents (handle, (DWORD *) &buf))
- {
- if (ISSTATE (myself, PID_USETTY))
- name = "/dev/tty";
- else
- name = "/dev/conin";
- }
- else if (ft == FILE_TYPE_PIPE)
- {
- if (fd == 0)
- name = "/dev/piper";
- else
- name = "/dev/pipew";
- }
- else if (wsock_started && getpeername ((SOCKET) handle, &sa, &sal) == 0)
- name = "/dev/socket";
- else if (GetCommState (handle, &dcb))
- name = "/dev/ttyS0"; // FIXME - determine correct device
- else
- name = handle_to_fn (handle, (char *) alloca (MAX_PATH + 100));
- }
-
- if (!name)
- fds[fd] = NULL;
- else
- {
- path_conv pc;
- build_fhandler_from_name (fd, name, handle, pc)->init (handle, myaccess,
- pc.binmode ());
- set_std_handle (fd);
- paranoid_printf ("fd %d, handle %p", fd, handle);
- }
-}
-
-fhandler_base *
-dtable::build_fhandler_from_name (int fd, const char *name, HANDLE handle,
- path_conv& pc, unsigned opt, suffix_info *si)
-{
- pc.check (name, opt | PC_NULLEMPTY | PC_FULL | PC_POSIX, si);
- if (pc.error)
- {
- set_errno (pc.error);
- return NULL;
- }
-
- if (!pc.exists () && handle)
- pc.fillin (handle);
-
- fhandler_base *fh = build_fhandler (fd, pc.get_devn (),
- pc.return_and_clear_normalized_path (),
- pc, pc.get_unitn ());
- return fh;
-}
-
-fhandler_base *
-dtable::build_fhandler (int fd, DWORD dev, const char *unix_name,
- const char *win32_name, int unit)
-{
- return build_fhandler (fd, dev, cstrdup (unix_name), win32_name, unit);
-}
-
-#define cnew(name) new ((void *) ccalloc (HEAP_FHANDLER, 1, sizeof (name))) name
-fhandler_base *
-dtable::build_fhandler (int fd, DWORD dev, char *unix_name,
- const char *win32_name, int unit)
-{
- fhandler_base *fh;
-
- dev &= FH_DEVMASK;
- switch (dev)
- {
- case FH_TTYM:
- fh = cnew (fhandler_tty_master) (unit);
- break;
- case FH_CONSOLE:
- case FH_CONIN:
- case FH_CONOUT:
- if ((fh = cnew (fhandler_console) ()))
- inc_console_fds ();
- break;
- case FH_PTYM:
- fh = cnew (fhandler_pty_master) ();
- break;
- case FH_TTYS:
- if (unit < 0)
- fh = cnew (fhandler_tty_slave) ();
- else
- fh = cnew (fhandler_tty_slave) (unit);
- break;
- case FH_WINDOWS:
- fh = cnew (fhandler_windows) ();
- break;
- case FH_SERIAL:
- fh = cnew (fhandler_serial) (unit);
- break;
- case FH_PIPE:
- case FH_PIPER:
- case FH_PIPEW:
- fh = cnew (fhandler_pipe) (dev);
- break;
- case FH_SOCKET:
- if ((fh = cnew (fhandler_socket) ()))
- inc_need_fixup_before ();
- break;
- case FH_DISK:
- fh = cnew (fhandler_disk_file) ();
- break;
- case FH_CYGDRIVE:
- fh = cnew (fhandler_cygdrive) (unit);
- break;
- case FH_FLOPPY:
- fh = cnew (fhandler_dev_floppy) (unit);
- break;
- case FH_TAPE:
- fh = cnew (fhandler_dev_tape) (unit);
- break;
- case FH_NULL:
- fh = cnew (fhandler_dev_null) ();
- break;
- case FH_ZERO:
- fh = cnew (fhandler_dev_zero) ();
- break;
- case FH_RANDOM:
- fh = cnew (fhandler_dev_random) (unit);
- break;
- case FH_MEM:
- fh = cnew (fhandler_dev_mem) (unit);
- break;
- case FH_CLIPBOARD:
- fh = cnew (fhandler_dev_clipboard) ();
- break;
- case FH_OSS_DSP:
- fh = cnew (fhandler_dev_dsp) ();
- break;
- case FH_PROC:
- fh = cnew (fhandler_proc) ();
- break;
- case FH_REGISTRY:
- fh = cnew (fhandler_registry) ();
- break;
- case FH_PROCESS:
- fh = cnew (fhandler_process) ();
- break;
- default:
- system_printf ("internal error -- unknown device - %p", dev);
- fh = NULL;
- }
-
- if (unix_name)
- {
- char new_win32_name[strlen (unix_name) + 1];
- if (!win32_name)
- {
- char *p;
- /* FIXME: ? Should we call win32_device_name here?
- It seems like overkill, but... */
- win32_name = strcpy (new_win32_name, unix_name);
- for (p = (char *) win32_name; (p = strchr (p, '/')); p++)
- *p = '\\';
- }
- fh->set_name (unix_name, win32_name, fh->get_unit ());
- }
- debug_printf ("fd %d, fh %p", fd, fh);
- return fd >= 0 ? (fds[fd] = fh) : fh;
-}
-
-fhandler_base *
-dtable::dup_worker (fhandler_base *oldfh)
-{
- fhandler_base *newfh = build_fhandler (-1, oldfh->get_device ());
- *newfh = *oldfh;
- newfh->set_io_handle (NULL);
- if (oldfh->dup (newfh))
- {
- cfree (newfh);
- newfh = NULL;
- return NULL;
- }
-
- newfh->set_close_on_exec_flag (0);
- MALLOC_CHECK;
- debug_printf ("duped '%s' old %p, new %p", oldfh->get_name (), oldfh->get_io_handle (), newfh->get_io_handle ());
- return newfh;
-}
-
-int
-dtable::dup2 (int oldfd, int newfd)
-{
- int res = -1;
- fhandler_base *newfh = NULL; // = NULL to avoid an incorrect warning
-
- MALLOC_CHECK;
- debug_printf ("dup2 (%d, %d)", oldfd, newfd);
-
- if (not_open (oldfd))
- {
- syscall_printf ("fd %d not open", oldfd);
- set_errno (EBADF);
- goto done;
- }
-
- if (newfd == oldfd)
- {
- res = 0;
- goto done;
- }
-
- if ((newfh = dup_worker (fds[oldfd])) == NULL)
- {
- res = -1;
- goto done;
- }
-
- debug_printf ("newfh->io_handle %p, oldfh->io_handle %p", newfh->get_io_handle (), fds[oldfd]->get_io_handle ());
- SetResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "dup");
-
- if (newfd < 0)
- {
- syscall_printf ("new fd out of bounds: %d", newfd);
- set_errno (EBADF);
- goto done;
- }
-
- if ((size_t) newfd >= size)
- {
- int inc_size = NOFILE_INCR * ((newfd + NOFILE_INCR - 1) / NOFILE_INCR) -
- size;
- extend (inc_size);
- }
-
- if (!not_open (newfd))
- _close (newfd);
- fds[newfd] = newfh;
-
- ReleaseResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "dup");
- MALLOC_CHECK;
-
- if ((res = newfd) <= 2)
- set_std_handle (res);
-
- MALLOC_CHECK;
-done:
- syscall_printf ("%d = dup2 (%d, %d)", res, oldfd, newfd);
-
- return res;
-}
-
-select_record *
-dtable::select_read (int fd, select_record *s)
-{
- if (not_open (fd))
- {
- set_errno (EBADF);
- return NULL;
- }
- fhandler_base *fh = fds[fd];
- s = fh->select_read (s);
- s->fd = fd;
- s->fh = fh;
- s->saw_error = 0;
- debug_printf ("%s fd %d", fh->get_name (), fd);
- return s;
-}
-
-select_record *
-dtable::select_write (int fd, select_record *s)
-{
- if (not_open (fd))
- {
- set_errno (EBADF);
- return NULL;
- }
- fhandler_base *fh = fds[fd];
- s = fh->select_write (s);
- s->fd = fd;
- s->fh = fh;
- s->saw_error = 0;
- debug_printf ("%s fd %d", fh->get_name (), fd);
- return s;
-}
-
-select_record *
-dtable::select_except (int fd, select_record *s)
-{
- if (not_open (fd))
- {
- set_errno (EBADF);
- return NULL;
- }
- fhandler_base *fh = fds[fd];
- s = fh->select_except (s);
- s->fd = fd;
- s->fh = fh;
- s->saw_error = 0;
- debug_printf ("%s fd %d", fh->get_name (), fd);
- return s;
-}
-
-/* Function to walk the fd table after an exec and perform
- per-fhandler type fixups. */
-void
-dtable::fixup_before_fork (DWORD target_proc_id)
-{
- SetResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "fixup_before_fork");
- fhandler_base *fh;
- for (size_t i = 0; i < size; i++)
- if ((fh = fds[i]) != NULL)
- {
- debug_printf ("fd %d (%s)", i, fh->get_name ());
- fh->fixup_before_fork_exec (target_proc_id);
- }
- ReleaseResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "fixup_before_fork");
-}
-
-void
-dtable::fixup_before_exec (DWORD target_proc_id)
-{
- SetResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "fixup_before_exec");
- fhandler_base *fh;
- for (size_t i = 0; i < size; i++)
- if ((fh = fds[i]) != NULL && !fh->get_close_on_exec ())
- {
- debug_printf ("fd %d (%s)", i, fh->get_name ());
- fh->fixup_before_fork_exec (target_proc_id);
- }
- ReleaseResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "fixup_before_exec");
-}
-
-void
-dtable::fixup_after_exec (HANDLE parent)
-{
- first_fd_for_open = 0;
- fhandler_base *fh;
- for (size_t i = 0; i < size; i++)
- if ((fh = fds[i]) != NULL)
- {
- fh->clear_readahead ();
- if (fh->get_close_on_exec ())
- release (i);
- else
- {
- fh->fixup_after_exec (parent);
- if (i == 0)
- SetStdHandle (std_consts[i], fh->get_io_handle ());
- else if (i <= 2)
- SetStdHandle (std_consts[i], fh->get_output_handle ());
- }
- }
-}
-
-void
-dtable::fixup_after_fork (HANDLE parent)
-{
- fhandler_base *fh;
- for (size_t i = 0; i < size; i++)
- if ((fh = fds[i]) != NULL)
- {
- if (fh->get_close_on_exec () || fh->get_need_fork_fixup ())
- {
- debug_printf ("fd %d (%s)", i, fh->get_name ());
- fh->fixup_after_fork (parent);
- }
- if (i == 0)
- SetStdHandle (std_consts[i], fh->get_io_handle ());
- else if (i <= 2)
- SetStdHandle (std_consts[i], fh->get_output_handle ());
- }
-}
-
-int
-dtable::vfork_child_dup ()
-{
- fhandler_base **newtable;
- SetResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "dup");
- newtable = (fhandler_base **) ccalloc (HEAP_ARGV, size, sizeof (fds[0]));
- int res = 1;
-
- /* Remove impersonation */
- if (cygheap->user.impersonated && cygheap->user.token != INVALID_HANDLE_VALUE)
- RevertToSelf ();
-
- for (size_t i = 0; i < size; i++)
- if (not_open (i))
- continue;
- else if ((newtable[i] = dup_worker (fds[i])) != NULL)
- newtable[i]->set_close_on_exec (fds[i]->get_close_on_exec ());
- else
- {
- res = 0;
- set_errno (EBADF);
- goto out;
- }
-
- fds_on_hold = fds;
- fds = newtable;
-
-out:
- /* Restore impersonation */
- if (cygheap->user.impersonated && cygheap->user.token != INVALID_HANDLE_VALUE)
- ImpersonateLoggedOnUser (cygheap->user.token);
-
- ReleaseResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "dup");
- return 1;
-}
-
-void
-dtable::vfork_parent_restore ()
-{
- SetResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "restore");
-
- close_all_files ();
- fhandler_base **deleteme = fds;
- assert (fds_on_hold != NULL);
- fds = fds_on_hold;
- fds_on_hold = NULL;
- cfree (deleteme);
-
- ReleaseResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "restore");
- return;
-}
-
-void
-dtable::vfork_child_fixup ()
-{
- if (!fds_on_hold)
- return;
- debug_printf ("here");
- fhandler_base **saveme = fds;
- fds = fds_on_hold;
-
- fhandler_base *fh;
- for (int i = 0; i < (int) cygheap->fdtab.size; i++)
- if ((fh = cygheap->fdtab[i]) != NULL)
- {
- fh->clear_readahead ();
- if (fh->get_close_on_exec ())
- release (i);
- else
- {
- fh->close ();
- cygheap->fdtab.release (i);
- }
- }
-
- fds = saveme;
- cfree (fds_on_hold);
- fds_on_hold = NULL;
-
- return;
-}
-
-#if 0
-static char *
-handle_to_fn (HANDLE h, char *posix_fn)
-{
- IO_STATUS_BLOCK io;
- FILE_NAME_INFORMATION ntfn;
-
- io.Status = 0;
- io.Information = 0;
-
- SetLastError (0);
- DWORD res = NtQueryInformationFile (h, &io, &ntfn, sizeof (ntfn), 9);
- if (res || GetLastError () == ERROR_PROC_NOT_FOUND)
- {
- strcpy (posix_fn, "some disk file");
- return posix_fn;
- }
- ntfn.FileName[ntfn.FileNameLength / sizeof (WCHAR)] = 0;
-
- char win32_fn[MAX_PATH + 100];
- sys_wcstombs (win32_fn, ntfn.FileName, ntfn.FileNameLength);
- cygwin_conv_to_full_posix_path (win32_fn, posix_fn);
- return posix_fn;
-}
-#else
-#define DEVICE_PREFIX "\\device\\"
-#define DEVICE_PREFIX_LEN sizeof(DEVICE_PREFIX) - 1
-#define REMOTE "\\Device\\LanmanRedirector\\"
-#define REMOTE_LEN sizeof (REMOTE) - 1
-
-static char *
-handle_to_fn (HANDLE h, char *posix_fn)
-{
- OBJECT_NAME_INFORMATION *ntfn;
- char fnbuf[32768];
-
- memset (fnbuf, 0, sizeof (fnbuf));
- ntfn = (OBJECT_NAME_INFORMATION *) fnbuf;
- ntfn->Name.MaximumLength = sizeof (fnbuf) - sizeof (*ntfn);
- ntfn->Name.Buffer = (WCHAR *) (ntfn + 1);
-
- DWORD res = NtQueryObject (h, ObjectNameInformation, ntfn, sizeof (fnbuf), NULL);
-
- if (res)
- {
- strcpy (posix_fn, "some disk file");
- debug_printf ("NtQueryObject failed");
- return posix_fn;
- }
-
- // NT seems to do this on an unopened file
- if (!ntfn->Name.Buffer)
- {
- debug_printf ("nt->Name.Buffer == NULL");
- return NULL;
- }
-
- ntfn->Name.Buffer[ntfn->Name.Length / sizeof (WCHAR)] = 0;
-
- char win32_fn[MAX_PATH + 100];
- sys_wcstombs (win32_fn, ntfn->Name.Buffer, ntfn->Name.Length);
- debug_printf ("nt name '%s'", win32_fn);
- if (!strncasematch (win32_fn, DEVICE_PREFIX, DEVICE_PREFIX_LEN)
- || !QueryDosDevice (NULL, fnbuf, sizeof (fnbuf)))
- return strcpy (posix_fn, win32_fn);
-
- char *p = strchr (win32_fn + DEVICE_PREFIX_LEN, '\\');
- if (!p)
- p = strchr (win32_fn + DEVICE_PREFIX_LEN, '\0');
-
- int n = p - win32_fn;
- int maxmatchlen = 0;
- char *maxmatchdos = NULL;
- for (char *s = fnbuf; *s; s = strchr (s, '\0') + 1)
- {
- char device[MAX_PATH + 10];
- device[MAX_PATH + 9] = '\0';
- if (strchr (s, ':') == NULL)
- continue;
- if (!QueryDosDevice (s, device, sizeof (device) - 1))
- continue;
- char *q = strrchr (device, ';');
- if (q)
- {
- char *r = strchr (q, '\\');
- if (r)
- strcpy (q, r + 1);
- }
- int devlen = strlen (device);
- if (device[devlen - 1] == '\\')
- device[--devlen] = '\0';
- if (devlen < maxmatchlen)
- continue;
- if (!strncasematch (device, win32_fn, devlen) ||
- (win32_fn[devlen] != '\0' && win32_fn[devlen] != '\\'))
- continue;
- maxmatchlen = devlen;
- maxmatchdos = s;
- debug_printf ("current match '%s'", device);
- }
-
- char *w32 = win32_fn;
- if (maxmatchlen)
- {
- n = strlen (maxmatchdos);
- if (maxmatchdos[n - 1] == '\\')
- n--;
- w32 += maxmatchlen - n;
- memcpy (w32, maxmatchdos, n);
- w32[n] = '\\';
- }
- else if (strncasematch (w32, REMOTE, REMOTE_LEN))
- {
- w32 += REMOTE_LEN - 2;
- *w32 = '\\';
- debug_printf ("remote drive");
- }
-
-
- debug_printf ("derived path '%s'", w32);
- cygwin_conv_to_full_posix_path (w32, posix_fn);
- return posix_fn;
-}
-#endif
diff --git a/winsup/cygwin/dtable.h b/winsup/cygwin/dtable.h
deleted file mode 100644
index 5a8f5697a..000000000
--- a/winsup/cygwin/dtable.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* dtable.h: fd table definition.
-
- Copyright 2000, 2001 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. */
-
-/* Initial and increment values for cygwin's fd table */
-#define NOFILE_INCR 32
-
-#include "thread.h"
-
-class suffix_info;
-class dtable
-{
- fhandler_base **fds;
- fhandler_base **fds_on_hold;
- int first_fd_for_open;
- int cnt_need_fixup_before;
- int console_fds;
-public:
- size_t size;
-
- dtable () : first_fd_for_open(3), cnt_need_fixup_before(0), console_fds(0) {}
- void init () {first_fd_for_open = 3;}
-
- void dec_need_fixup_before ()
- { if (cnt_need_fixup_before > 0) --cnt_need_fixup_before; }
- void inc_need_fixup_before ()
- { cnt_need_fixup_before++; }
- BOOL need_fixup_before ()
- { return cnt_need_fixup_before > 0; }
-
- void dec_console_fds ();
- void inc_console_fds ()
- { console_fds++; }
- BOOL has_console_fds ()
- { return console_fds > 0; }
-
- int vfork_child_dup ();
- void vfork_parent_restore ();
- void vfork_child_fixup ();
- fhandler_base *dup_worker (fhandler_base *oldfh);
- int extend (int howmuch);
- void fixup_before_exec (DWORD win_proc_id);
- void fixup_before_fork (DWORD win_proc_id);
- void fixup_after_fork (HANDLE);
- fhandler_base *build_fhandler (int fd, DWORD dev, const char *unix_name,
- const char *win32_name = NULL, int unit = -1);
- fhandler_base *build_fhandler (int fd, DWORD dev, char *unix_name = NULL,
- const char *win32_name = NULL, int unit = -1);
- fhandler_base *build_fhandler_from_name (int fd, const char *name, HANDLE h,
- path_conv& pc,
- unsigned opts = PC_SYM_FOLLOW,
- suffix_info *si = NULL);
- inline int not_open (int fd)
- {
- SetResourceLock (LOCK_FD_LIST, READ_LOCK, "not_open");
-
- int res = fd < 0 || fd >= (int) size || fds[fd] == NULL;
-
- ReleaseResourceLock (LOCK_FD_LIST, READ_LOCK, "not open");
- return res;
- }
- int find_unused_handle (int start);
- int find_unused_handle () { return find_unused_handle (first_fd_for_open);}
- void release (int fd);
- void init_std_file_from_handle (int fd, HANDLE handle, DWORD access);
- int dup2 (int oldfd, int newfd);
- void fixup_after_exec (HANDLE);
- inline fhandler_base *operator [](int fd) const { return fds[fd]; }
- select_record *select_read (int fd, select_record *s);
- select_record *select_write (int fd, select_record *s);
- select_record *select_except (int fd, select_record *s);
- operator fhandler_base **() {return fds;}
- void stdio_init ();
- void get_debugger_info ();
-};
-
-void dtable_init (void);
-void stdio_init (void);
-extern dtable fdtab;
-
-extern "C" int getfdtabsize ();
-extern "C" void setfdtabsize (int);
diff --git a/winsup/cygwin/dtable.sgml b/winsup/cygwin/dtable.sgml
deleted file mode 100644
index 9f292ee73..000000000
--- a/winsup/cygwin/dtable.sgml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-<sect1 id="func-cygwin-attach-handle-to-fd">
-<title>cygwin_attach_handle_to_fd</title>
-
-<funcsynopsis>
-<funcdef>extern "C" int
-<function>cygwin_attach_handle_to_fd</function></funcdef>
-<paramdef>char *<parameter>name</parameter></paramdef>
-<paramdef>int <parameter>fd</parameter></paramdef>
-<paramdef>HANDLE <parameter>handle</parameter></paramdef>
-<paramdef>int <parameter>bin</parameter></paramdef>
-<paramdef>int <parameter>access</parameter></paramdef>
-</funcsynopsis>
-
-<para>This function can be used to turn a Win32 "handle" into a
-posix-style file handle. <parameter>fd</parameter> may be -1 to
-make cygwin allocate a handle; the actual handle is returned
-in all cases.</para>
-
-</sect1>
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
deleted file mode 100644
index 4d535e436..000000000
--- a/winsup/cygwin/environ.cc
+++ /dev/null
@@ -1,948 +0,0 @@
-/* environ.cc: Cygwin-adopted functions from newlib to manipulate
- process's environment.
-
- Copyright 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#include "winsup.h"
-#include <errno.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <ctype.h>
-#include <assert.h>
-#include <sys/cygwin.h>
-#include <cygwin/version.h>
-#include "pinfo.h"
-#include "perprocess.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "cygerrno.h"
-#include "dtable.h"
-#include "cygheap.h"
-#include "registry.h"
-#include "environ.h"
-
-extern BOOL allow_daemon;
-extern BOOL allow_glob;
-extern bool ignore_case_with_glob;
-extern BOOL allow_ntea;
-extern BOOL allow_smbntsec;
-extern BOOL allow_winsymlinks;
-extern BOOL strip_title_path;
-extern int pcheck_case;
-extern int subauth_id;
-BOOL reset_com = FALSE;
-static BOOL envcache = TRUE;
-
-static char **lastenviron;
-
-#define ENVMALLOC \
- (CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) \
- <= CYGWIN_VERSION_DLL_MALLOC_ENV)
-
-/* List of names which are converted from dos to unix
- on the way in and back again on the way out.
-
- PATH needs to be here because CreateProcess uses it and gdb uses
- CreateProcess. HOME is here because most shells use it and would be
- confused by Windows style path names. */
-static int return_MAX_PATH (const char *) {return MAX_PATH;}
-static NO_COPY win_env conv_envvars[] =
- {
- {"PATH=", 5, NULL, NULL, cygwin_win32_to_posix_path_list,
- cygwin_posix_to_win32_path_list,
- cygwin_win32_to_posix_path_list_buf_size,
- cygwin_posix_to_win32_path_list_buf_size},
- {"HOME=", 5, NULL, NULL, cygwin_conv_to_full_posix_path, cygwin_conv_to_full_win32_path,
- return_MAX_PATH, return_MAX_PATH},
- {"LD_LIBRARY_PATH=", 16, NULL, NULL, cygwin_conv_to_full_posix_path,
- cygwin_conv_to_full_win32_path, return_MAX_PATH, return_MAX_PATH},
- {"TMPDIR=", 7, NULL, NULL, cygwin_conv_to_full_posix_path, cygwin_conv_to_full_win32_path,
- return_MAX_PATH, return_MAX_PATH},
- {"TMP=", 4, NULL, NULL, cygwin_conv_to_full_posix_path, cygwin_conv_to_full_win32_path,
- return_MAX_PATH, return_MAX_PATH},
- {"TEMP=", 5, NULL, NULL, cygwin_conv_to_full_posix_path, cygwin_conv_to_full_win32_path,
- return_MAX_PATH, return_MAX_PATH},
- {NULL, 0, NULL, NULL, NULL, NULL, 0, 0}
- };
-
-static unsigned char conv_start_chars[256] = {0};
-
-void
-win_env::add_cache (const char *in_posix, const char *in_native)
-{
- MALLOC_CHECK;
- posix = (char *) realloc (posix, strlen (in_posix) + 1);
- strcpy (posix, in_posix);
- if (in_native)
- {
- native = (char *) realloc (native, namelen + 1 + strlen (in_native));
- (void) strcpy (native, name);
- (void) strcpy (native + namelen, in_native);
- }
- else
- {
- native = (char *) realloc (native, namelen + 1 + win32_len (in_posix));
- (void) strcpy (native, name);
- towin32 (in_posix, native + namelen);
- }
- MALLOC_CHECK;
- debug_printf ("posix %s", posix);
- debug_printf ("native %s", native);
-}
-
-
-/* Check for a "special" environment variable name. *env is the pointer
- to the beginning of the environment variable name. *in_posix is any
- known posix value for the environment variable. Returns a pointer to
- the appropriate conversion structure. */
-win_env * __stdcall
-getwinenv (const char *env, const char *in_posix)
-{
- if (!conv_start_chars[(unsigned char)*env])
- return NULL;
-
- for (int i = 0; conv_envvars[i].name != NULL; i++)
- if (strncmp (env, conv_envvars[i].name, conv_envvars[i].namelen) == 0)
- {
- win_env * const we = conv_envvars + i;
- const char *val;
- if (!cur_environ () || !(val = in_posix ?: getenv (we->name)))
- debug_printf ("can't set native for %s since no environ yet",
- we->name);
- else if (!envcache || !we->posix || strcmp (val, we->posix) != 0)
- we->add_cache (val);
- return we;
- }
- return NULL;
-}
-
-/* Convert windows path specs to POSIX, if appropriate.
- */
-static void __stdcall
-posify (char **here, const char *value)
-{
- char *src = *here;
- win_env *conv;
-
- if (!(conv = getwinenv (src)))
- return;
-
- int len = strcspn (src, "=") + 1;
-
- /* Turn all the items from c:<foo>;<bar> into their
- mounted equivalents - if there is one. */
-
- char *outenv = (char *) malloc (1 + len + conv->posix_len (value));
- memcpy (outenv, src, len);
- conv->toposix (value, outenv + len);
- conv->add_cache (outenv + len, *value != '/' ? value : NULL);
-
- debug_printf ("env var converted to %s", outenv);
- *here = outenv;
- free (src);
- MALLOC_CHECK;
-}
-
-/*
- * my_findenv --
- * Returns pointer to value associated with name, if any, else NULL.
- * Sets offset to be the offset of the name/value combination in the
- * environment array, for use by setenv(3) and unsetenv(3).
- * Explicitly removes '=' in argument name.
- */
-
-static char * __stdcall
-my_findenv (const char *name, int *offset)
-{
- register int len;
- register char **p;
- const char *c;
-
- c = name;
- len = 0;
- while (*c && *c != '=')
- {
- c++;
- len++;
- }
-
- for (p = cur_environ (); *p; ++p)
- if (!strncmp (*p, name, len))
- if (*(c = *p + len) == '=')
- {
- *offset = p - cur_environ ();
- return (char *) (++c);
- }
- MALLOC_CHECK;
- return NULL;
-}
-
-/*
- * getenv --
- * Returns ptr to value associated with name, if any, else NULL.
- */
-
-extern "C" char *
-getenv (const char *name)
-{
- int offset;
-
- return my_findenv (name, &offset);
-}
-
-static int __stdcall
-envsize (const char * const *in_envp)
-{
- const char * const *envp;
- for (envp = in_envp; *envp; envp++)
- continue;
- return (1 + envp - in_envp) * sizeof (const char *);
-}
-
-/* Takes similar arguments to setenv except that overwrite is
- either -1, 0, or 1. 0 or 1 signify that the function should
- perform similarly to setenv. Otherwise putenv is assumed. */
-static int __stdcall
-_addenv (const char *name, const char *value, int overwrite)
-{
- int issetenv = overwrite >= 0;
- int offset;
- char *p;
-
- unsigned int valuelen = strlen (value);
- if ((p = my_findenv (name, &offset)))
- { /* Already exists. */
- if (!overwrite) /* Ok to overwrite? */
- return 0; /* No. Wanted to add new value. FIXME: Right return value? */
-
- /* We've found the offset into environ. If this is a setenv call and
- there is room in the current environment entry then just overwrite it.
- Otherwise handle this case below. */
- if (issetenv && strlen (p) >= valuelen)
- {
- strcpy (p, value);
- return 0;
- }
- }
- else
- { /* Create new slot. */
- int sz = envsize (cur_environ ());
- int allocsz = sz + (2 * sizeof (char *));
-
- offset = (sz - 1) / sizeof (char *);
-
- /* Allocate space for additional element plus terminating NULL. */
- if (cur_environ () == lastenviron)
- lastenviron = __cygwin_environ = (char **) realloc (cur_environ (),
- allocsz);
- else if ((lastenviron = (char **) malloc (allocsz)) != NULL)
- __cygwin_environ = (char **) memcpy ((char **) lastenviron,
- __cygwin_environ, sz);
-
- if (!__cygwin_environ)
- {
-#ifdef DEBUGGING
- try_to_debug ();
-#endif
- return -1; /* Oops. No more memory. */
- }
-
- __cygwin_environ[offset + 1] = NULL; /* NULL terminate. */
- update_envptrs (); /* Update any local copies of 'environ'. */
- }
-
- char *envhere;
- if (!issetenv)
- /* Not setenv. Just overwrite existing. */
- envhere = cur_environ ()[offset] = (char *) (ENVMALLOC ? strdup (name) : name);
- else
- { /* setenv */
- /* Look for an '=' in the name and ignore anything after that if found. */
- for (p = (char *) name; *p && *p != '='; p++)
- continue;
-
- int namelen = p - name; /* Length of name. */
- /* Allocate enough space for name + '=' + value + '\0' */
- envhere = cur_environ ()[offset] = (char *) malloc (namelen + valuelen + 2);
- if (!envhere)
- return -1; /* Oops. No more memory. */
-
- /* Put name '=' value into current slot. */
- strncpy (envhere, name, namelen);
- envhere[namelen] = '=';
- strcpy (envhere + namelen + 1, value);
- }
-
- /* Update cygwin's cache, if appropriate */
- win_env *spenv;
- if ((spenv = getwinenv (envhere)))
- spenv->add_cache (value);
-
- MALLOC_CHECK;
- return 0;
-}
-
-/* putenv Sets an environment variable */
-extern "C" int
-putenv (const char *str)
-{
- int res;
- if ((res = check_null_empty_str (str)))
- {
- if (res == ENOENT)
- return 0;
- set_errno (res);
- return -1;
- }
- char *eq = strchr (str, '=');
- if (eq)
- return _addenv (str, eq + 1, -1);
-
- /* Remove str from the environment. */
- unsetenv (str);
- return 0;
-}
-
-/* setenv -- Set the value of the environment variable "name" to be
- "value". If overwrite is set, replace any current value. */
-extern "C" int
-setenv (const char *name, const char *value, int overwrite)
-{
- int res;
- if ((res = check_null_empty_str (value)) == EFAULT)
- {
- set_errno (res);
- return -1;
- }
- if ((res = check_null_empty_str (name)))
- {
- if (res == ENOENT)
- return 0;
- set_errno (res);
- return -1;
- }
- if (*value == '=')
- value++;
- return _addenv (name, value, !!overwrite);
-}
-
-/* unsetenv(name) -- Delete environment variable "name". */
-extern "C" void
-unsetenv (const char *name)
-{
- register char **e;
- int offset;
-
- while (my_findenv (name, &offset)) /* if set multiple times */
- /* Move up the rest of the array */
- for (e = cur_environ () + offset; ; e++)
- if (!(*e = *(e + 1)))
- break;
-}
-
-/* Turn environment variable part of a=b string into uppercase. */
-static __inline__ void
-ucenv (char *p, char *eq)
-{
- /* Amazingly, NT has a case sensitive environment name list,
- but only sometimes.
- It's normal to have NT set your "Path" to something.
- Later, you set "PATH" to something else. This alters "Path".
- But if you try and do a naive getenv on "PATH" you'll get nothing.
-
- So we upper case the labels here to prevent confusion later but
- we only do it for the first process in a session group. */
- for (; p < eq; p++)
- if (islower (*p))
- *p = cyg_toupper (*p);
-}
-
-/* Parse CYGWIN options */
-
-static NO_COPY BOOL export_settings = FALSE;
-
-enum settings
- {
- justset,
- isfunc,
- setbit,
- set_process_state,
- };
-
-/* When BUF is:
- null or empty: disables globbing
- "ignorecase": enables case-insensitive globbing
- anything else: enables case-sensitive globbing */
-static void
-glob_init (const char *buf)
-{
- if (!buf || !*buf)
- {
- allow_glob = FALSE;
- ignore_case_with_glob = FALSE;
- }
- else if (strncasematch (buf, "ignorecase", 10))
- {
- allow_glob = TRUE;
- ignore_case_with_glob = TRUE;
- }
- else
- {
- allow_glob = TRUE;
- ignore_case_with_glob = FALSE;
- }
-}
-
-static void
-check_case_init (const char *buf)
-{
- if (!buf || !*buf)
- return;
-
- if (strncmp (buf, "relax", 5)== 0)
- {
- pcheck_case = PCHECK_RELAXED;
- debug_printf ("File case checking set to RELAXED");
- }
- else if (strcmp (buf, "adjust")== 0)
- {
- pcheck_case = PCHECK_ADJUST;
- debug_printf ("File case checking set to ADJUST");
- }
- else if (strcmp (buf, "strict")== 0)
- {
- pcheck_case = PCHECK_STRICT;
- debug_printf ("File case checking set to STRICT");
- }
- else
- {
- debug_printf ("Wrong case checking name: %s", buf);
- }
-}
-
-void
-set_file_api_mode (codepage_type cp)
-{
- if (cp == oem_cp)
- {
- SetFileApisToOEM ();
- debug_printf ("File APIs set to OEM");
- }
- else if (cp == ansi_cp)
- {
- SetFileApisToANSI ();
- debug_printf ("File APIs set to ANSI");
- }
-}
-
-static void
-codepage_init (const char *buf)
-{
- if (!buf || !*buf)
- return;
-
- if (strcmp (buf, "oem")== 0)
- {
- current_codepage = oem_cp;
- set_file_api_mode (current_codepage);
- }
- else if (strcmp (buf, "ansi")== 0)
- {
- current_codepage = ansi_cp;
- set_file_api_mode (current_codepage);
- }
- else
- {
- debug_printf ("Wrong codepage name: %s", buf);
- }
-}
-
-static void
-subauth_id_init (const char *buf)
-{
- if (!buf || !*buf)
- return;
-
- int i = strtol (buf, NULL, 0);
-
- /* 0..127 are reserved by Microsoft, 132 is IIS subauthentication. */
- if (i > 127 && i != 132 && i <= 255)
- subauth_id = i;
-}
-
-static void
-set_chunksize (const char *buf)
-{
- wincap.set_chunksize (strtol (buf, NULL, 0));
-}
-
-/* The structure below is used to set up an array which is used to
- parse the CYGWIN environment variable or, if enabled, options from
- the registry. */
-static struct parse_thing
- {
- const char *name;
- union parse_setting
- {
- BOOL *b;
- DWORD *x;
- int *i;
- void (*func)(const char *);
- } setting;
-
- enum settings disposition;
- char *remember;
- union parse_values
- {
- DWORD i;
- const char *s;
- } values[2];
- } known[] NO_COPY =
-{
- {"binmode", {x: &binmode}, justset, NULL, {{O_TEXT}, {O_BINARY}}},
- {"check_case", {func: &check_case_init}, isfunc, NULL, {{0}, {0}}},
- {"codepage", {func: &codepage_init}, isfunc, NULL, {{0}, {0}}},
- {"daemon", {&allow_daemon}, justset, NULL, {{FALSE}, {TRUE}}},
- {"envcache", {&envcache}, justset, NULL, {{TRUE}, {FALSE}}},
- {"error_start", {func: &error_start_init}, isfunc, NULL, {{0}, {0}}},
- {"export", {&export_settings}, justset, NULL, {{FALSE}, {TRUE}}},
- {"forkchunk", {func: set_chunksize}, isfunc, NULL, {{0}, {0}}},
- {"glob", {func: &glob_init}, isfunc, NULL, {{0}, {s: "normal"}}},
- {"ntea", {&allow_ntea}, justset, NULL, {{FALSE}, {TRUE}}},
- {"ntsec", {&allow_ntsec}, justset, NULL, {{FALSE}, {TRUE}}},
- {"smbntsec", {&allow_smbntsec}, justset, NULL, {{FALSE}, {TRUE}}},
- {"reset_com", {&reset_com}, justset, NULL, {{FALSE}, {TRUE}}},
- {"strip_title", {&strip_title_path}, justset, NULL, {{FALSE}, {TRUE}}},
- {"subauth_id", {func: &subauth_id_init}, isfunc, NULL, {{0}, {0}}},
- {"title", {&display_title}, justset, NULL, {{FALSE}, {TRUE}}},
- {"tty", {NULL}, set_process_state, NULL, {{0}, {PID_USETTY}}},
- {"winsymlinks", {&allow_winsymlinks}, justset, NULL, {{FALSE}, {TRUE}}},
- {NULL, {0}, justset, 0, {{0}, {0}}}
-};
-
-/* Parse a string of the form "something=stuff somethingelse=more-stuff",
- silently ignoring unknown "somethings". */
-static void __stdcall
-parse_options (char *buf)
-{
- int istrue;
- char *p, *lasts;
- parse_thing *k;
-
- if (buf == NULL)
- {
- char newbuf[MAX_PATH + 7] = "CYGWIN";
- for (k = known; k->name != NULL; k++)
- if (k->remember)
- {
- strcat (strcat (newbuf, " "), k->remember);
- free (k->remember);
- k->remember = NULL;
- }
- if (!export_settings)
- return;
- newbuf[sizeof ("CYGWIN") - 1] = '=';
- debug_printf ("%s", newbuf);
- putenv (newbuf);
- return;
- }
-
- buf = strcpy ((char *) alloca (strlen (buf) + 1), buf);
- for (p = strtok_r (buf, " \t", &lasts);
- p != NULL;
- p = strtok_r (NULL, " \t", &lasts))
- {
- if (!(istrue = !strncasematch (p, "no", 2)))
- p += 2;
- else if (!(istrue = *p != '-'))
- p++;
-
- char ch, *eq;
- if ((eq = strchr (p, '=')) != NULL || (eq = strchr (p, ':')) != NULL)
- ch = *eq, *eq++ = '\0';
- else
- ch = 0;
-
- for (parse_thing *k = known; k->name != NULL; k++)
- if (strcasematch (p, k->name))
- {
- switch (k->disposition)
- {
- case isfunc:
- k->setting.func ((!eq || !istrue) ?
- k->values[istrue].s : eq);
- debug_printf ("%s (called func)", k->name);
- break;
- case justset:
- if (!istrue || !eq)
- *k->setting.x = k->values[istrue].i;
- else
- *k->setting.x = strtol (eq, NULL, 0);
- debug_printf ("%s %d", k->name, *k->setting.x);
- break;
- case set_process_state:
- k->setting.x = &myself->process_state;
- /* fall through */
- case setbit:
- *k->setting.x &= ~k->values[istrue].i;
- if (istrue || (eq && strtol (eq, NULL, 0)))
- *k->setting.x |= k->values[istrue].i;
- debug_printf ("%s %x", k->name, *k->setting.x);
- break;
- }
-
- if (eq)
- *--eq = ch;
-
- int n = eq - p;
- p = strdup (p);
- if (n > 0)
- p[n] = ':';
- k->remember = p;
- break;
- }
- }
- debug_printf ("returning");
- return;
-}
-
-/* Set options from the registry. */
-static void __stdcall
-regopt (const char *name)
-{
- /* FIXME: should not be under mount */
- reg_key r (KEY_READ, CYGWIN_INFO_PROGRAM_OPTIONS_NAME, NULL);
- char buf[MAX_PATH];
- char lname[strlen(name) + 1];
- strlwr (strcpy (lname, name));
- if (r.get_string (lname, buf, sizeof (buf) - 1, "") == ERROR_SUCCESS)
- parse_options (buf);
- else
- {
- reg_key r1 (HKEY_LOCAL_MACHINE, KEY_READ, "SOFTWARE",
- CYGWIN_INFO_CYGNUS_REGISTRY_NAME,
- CYGWIN_INFO_CYGWIN_REGISTRY_NAME,
- CYGWIN_INFO_PROGRAM_OPTIONS_NAME, NULL);
- if (r1.get_string (lname, buf, sizeof (buf) - 1, "") == ERROR_SUCCESS)
- parse_options (buf);
- }
- MALLOC_CHECK;
-}
-
-/* Initialize the environ array. Look for the CYGWIN environment
- environment variable and set appropriate options from it. */
-void
-environ_init (char **envp, int envc)
-{
- char *rawenv;
- int i;
- char *p;
- char *newp;
- int sawTERM = 0;
- bool envp_passed_in;
- static char NO_COPY cygterm[] = "TERM=cygwin";
-
- static int initted;
- if (!initted)
- {
- for (int i = 0; conv_envvars[i].name != NULL; i++)
- {
- conv_start_chars[cyg_tolower(conv_envvars[i].name[0])] = 1;
- conv_start_chars[cyg_toupper(conv_envvars[i].name[0])] = 1;
- }
- initted = 1;
- }
-
- regopt ("default");
- if (myself->progname[0])
- regopt (myself->progname);
-
-#ifdef NTSEC_ON_BY_DEFAULT
- /* Set ntsec explicit as default, if NT is running */
- if (wincap.has_security ())
- allow_ntsec = TRUE;
-#endif
-
- if (!envp)
- envp_passed_in = 0;
- else
- {
- envc++;
- envc *= sizeof (char *);
- char **newenv = (char **) malloc (envc);
- memcpy (newenv, envp, envc);
- cfree (envp);
-
- /* Older applications relied on the fact that cygwin malloced elements of the
- environment list. */
- envp = newenv;
- if (ENVMALLOC)
- for (char **e = newenv; *e; e++)
- {
- char *p = *e;
- *e = strdup (p);
- cfree (p);
- }
- envp_passed_in = 1;
- goto out;
- }
-
- /* Allocate space for environment + trailing NULL + CYGWIN env. */
- lastenviron = envp = (char **) malloc ((4 + (envc = 100)) * sizeof (char *));
- rawenv = GetEnvironmentStrings ();
-
- /* Current directory information is recorded as variables of the
- form "=X:=X:\foo\bar; these must be changed into something legal
- (we could just ignore them but maybe an application will
- eventually want to use them). */
- for (i = 0, p = rawenv; *p != '\0'; p = strchr (p, '\0') + 1, i++)
- {
- newp = strdup (p);
- if (i >= envc)
- envp = (char **) realloc (envp, (4 + (envc += 100)) * sizeof (char *));
- envp[i] = newp;
- if (*newp == '=')
- *newp = '!';
- char *eq;
- if ((eq = strchr (newp, '=')) == NULL)
- eq = strchr (newp, '\0');
- if (!myself->ppid_handle)
- ucenv (newp, eq);
- if (*newp == 'T' && strncmp (newp, "TERM=", 5) == 0)
- sawTERM = 1;
- if (*newp == 'C' && strncmp (newp, "CYGWIN=", sizeof("CYGWIN=") - 1) == 0)
- parse_options (newp + sizeof("CYGWIN=") - 1);
- if (*eq && conv_start_chars[(unsigned char)envp[i][0]])
- posify (envp + i, *++eq ? eq : --eq);
- debug_printf ("%p: %s", envp[i], envp[i]);
- }
-
- if (!sawTERM)
- envp[i++] = cygterm;
- envp[i] = NULL;
- FreeEnvironmentStrings (rawenv);
-
-out:
- __cygwin_environ = envp;
- update_envptrs ();
- if (envp_passed_in)
- {
- p = getenv ("CYGWIN");
- if (p)
- parse_options (p);
- }
- parse_options (NULL);
- MALLOC_CHECK;
-}
-
-/* Function called by qsort to sort environment strings. */
-static int
-env_sort (const void *a, const void *b)
-{
- const char **p = (const char **) a;
- const char **q = (const char **) b;
-
- return strcmp (*p, *q);
-}
-
-struct spenv
-{
- const char *name;
- const char * (cygheap_user::*from_cygheap) ();
- char *retrieve (bool, const char * const = NULL, int = 0);
-};
-
-/* Keep this list in upper case and sorted */
-static NO_COPY spenv spenvs[] =
-{
- {"HOMEPATH=", &cygheap_user::env_homepath},
- {"HOMEDRIVE=", &cygheap_user::env_homedrive},
- {"LOGONSERVER=", &cygheap_user::env_logsrv},
- {"SYSTEMDRIVE=", NULL},
- {"SYSTEMROOT=", NULL},
- {"USERPROFILE=", &cygheap_user::env_userprofile},
-};
-
-char *
-spenv::retrieve (bool no_envblock, const char *const envname, int len)
-{
- if (len && !strncasematch (envname, name, len))
- return NULL;
- if (from_cygheap)
- {
- const char *p;
- if (!len)
- return NULL; /* No need to force these into the
- environment */
-
- if (no_envblock)
- return cstrdup1 (envname); /* Don't really care what it's set to
- if we're calling a cygwin program */
-
- /* Make a FOO=BAR entry from the value returned by the cygheap_user
- method. */
- if (!(p = (cygheap->user.*from_cygheap) ()))
- return NULL;
- int namelen = strlen (name);
- char *s = (char *) cmalloc (HEAP_1_STR, namelen + strlen (p) + 1);
- strcpy (s, name);
- (void) strcpy (s + namelen, p);
- return s;
- }
-
- if (len)
- return cstrdup1 (envname);
-
- char dum[1];
- int vallen = GetEnvironmentVariable (name, dum, 0);
- if (vallen > 0)
- {
- int namelen = strlen (name);
- char *p = (char *) cmalloc (HEAP_1_STR, namelen + ++vallen);
- strcpy (p, name);
- if (GetEnvironmentVariable (name, p + namelen, vallen))
- return p;
- else
- cfree (p);
- }
-
- debug_printf ("warning: %s not present in environment", name);
- return NULL;
-}
-
-#define SPENVS_SIZE (sizeof (spenvs) / sizeof (spenvs[0]))
-
-/* Create a Windows-style environment block, i.e. a typical character buffer
- filled with null terminated strings, terminated by double null characters.
- Converts environment variables noted in conv_envvars into win32 form
- prior to placing them in the string. */
-char ** __stdcall
-build_env (const char * const *envp, char *&envblock, int &envc,
- bool no_envblock)
-{
- int len, n;
- const char * const *srcp;
- char **dstp;
- bool saw_spenv[SPENVS_SIZE] = {0};
-
- debug_printf ("envp %p", envp);
-
- /* How many elements? */
- for (n = 0; envp[n]; n++)
- continue;
-
- /* Allocate a new "argv-style" environ list with room for extra stuff. */
- char **newenv = (char **) cmalloc (HEAP_1_ARGV, sizeof (char *) *
- (n + SPENVS_SIZE + 1));
-
- int tl = 0;
- /* Iterate over input list, generating a new environment list and refreshing
- "special" entries, if necessary. */
- for (srcp = envp, dstp = newenv; *srcp; srcp++, dstp++)
- {
- len = strcspn (*srcp, "=") + 1;
-
- /* Look for entries that require special attention */
- for (unsigned i = 0; i < SPENVS_SIZE; i++)
- if (!saw_spenv[i]
- && (*dstp = spenvs[i].retrieve (no_envblock, *srcp, len)))
- {
- saw_spenv[i] = 1;
- goto next;
- }
-
- *dstp = cstrdup1 (*srcp);
-
- next:
- if (!no_envblock)
- tl += strlen (*dstp) + 1;
- }
-
- /* Fill in any required-but-missing environment variables. */
- for (unsigned i = 0; i < SPENVS_SIZE; i++)
- if (!saw_spenv[i])
- {
- *dstp = spenvs[i].retrieve (no_envblock);
- if (*dstp)
- {
- if (!no_envblock)
- tl += strlen (*dstp) + 1;
- dstp++;
- }
- }
-
- envc = dstp - newenv;
- *dstp = NULL; /* Terminate */
-
- if (no_envblock)
- envblock = NULL;
- else
- {
- debug_printf ("env count %d, bytes %d", envc, tl);
-
- /* Windows programs expect the environment block to be sorted. */
- qsort (newenv, envc, sizeof (char *), env_sort);
-
- /* Create an environment block suitable for passing to CreateProcess. */
- char *s;
- envblock = (char *) malloc (2 + tl);
- int new_tl = 0;
- for (srcp = newenv, s = envblock; *srcp; srcp++)
- {
- const char *p;
- win_env *conv;
- len = strcspn (*srcp, "=") + 1;
-
- /* See if this entry requires posix->win32 conversion. */
- conv = getwinenv (*srcp, *srcp + len);
- if (conv)
- p = conv->native; /* Use win32 path */
- else
- p = *srcp; /* Don't worry about it */
-
- len = strlen (p);
- new_tl += len + 1; /* Keep running total of block length so far */
-
- /* See if we need to increase the size of the block. */
- if (new_tl > tl)
- envblock = (char *) realloc (envblock, 2 + (tl += len + 100));
-
- memcpy (s, p, len + 1);
-
- /* See if environment variable is "special" in a Windows sense.
- Under NT, the current directories for visited drives are stored
- as =C:=\bar. Cygwin converts the '=' to '!' for hopefully obvious
- reasons. We need to convert it back when building the envblock */
- if (s[0] == '!' && (isdrive (s + 1) || (s[1] == ':' && s[2] == ':'))
- && s[3] == '=')
- *s = '=';
- s += len + 1;
- }
- *s = '\0'; /* Two null bytes at the end */
- assert ((s - envblock) <= tl); /* Detect if we somehow ran over end
- of buffer */
- }
-
- return newenv;
-}
-
-/* This idiocy is necessary because the early implementers of cygwin
- did not seem to know about importing data variables from the DLL.
- So, we have to synchronize cygwin's idea of the environment with the
- main program's with each reference to the environment. */
-extern "C" char ** __stdcall
-cur_environ ()
-{
- if (*main_environ != __cygwin_environ)
- {
- __cygwin_environ = *main_environ;
- update_envptrs ();
- }
-
- return __cygwin_environ;
-}
diff --git a/winsup/cygwin/environ.h b/winsup/cygwin/environ.h
deleted file mode 100644
index 3f372b17c..000000000
--- a/winsup/cygwin/environ.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* environ.h: Declarations for environ manipulation
-
- Copyright 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. */
-
-/* Initialize the environment */
-void environ_init (char **, int);
-
-/* The structure below is used to control conversion to/from posix-style
- file specs. Currently, only PATH and HOME are converted, but PATH
- needs to use a "convert path list" function while HOME needs a simple
- "convert to posix/win32". For the simple case, where a calculated length
- is required, just return MAX_PATH. *FIXME* */
-struct win_env
- {
- const char *name;
- size_t namelen;
- char *posix;
- char *native;
- int (*toposix) (const char *, char *);
- int (*towin32) (const char *, char *);
- int (*posix_len) (const char *);
- int (*win32_len) (const char *);
- void add_cache (const char *in_posix, const char *in_native = NULL);
- const char * get_native () const {return native ? native + namelen : NULL;}
- const char * get_posix () const {return posix ? posix : NULL;}
- };
-
-win_env * __stdcall getwinenv (const char *name, const char *posix = NULL);
-
-void __stdcall update_envptrs ();
-extern char **__cygwin_environ, ***main_environ;
-extern "C" char __stdcall **cur_environ ();
-char ** __stdcall build_env (const char * const *envp, char *&envblock,
- int &envc, bool need_envblock);
diff --git a/winsup/cygwin/errno.cc b/winsup/cygwin/errno.cc
deleted file mode 100644
index 3ad7b3d4a..000000000
--- a/winsup/cygwin/errno.cc
+++ /dev/null
@@ -1,688 +0,0 @@
-/* errno.cc: errno-related functions
-
- Copyright 1996, 1997, 1998, 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. */
-
-#define _sys_nerr FOO_sys_nerr
-#define sys_nerr FOOsys_nerr
-#include "winsup.h"
-#define _REENT_ONLY
-#include <stdio.h>
-#include <errno.h>
-#include "cygerrno.h"
-#include "thread.h"
-#undef _sys_nerr
-#undef sys_nerr
-
-/* Table to map Windows error codes to Errno values. */
-/* FIXME: Doing things this way is a little slow. It's trivial to change
- this into a big case statement if necessary. Left as is for now. */
-
-#define X(w, e) {ERROR_##w, #w, e}
-
-static const NO_COPY struct
- {
- DWORD w; /* windows version of error */
- const char *s; /* text of windows version */
- int e; /* errno version of error */
- }
-errmap[] =
-{
- /* FIXME: Some of these choices are arbitrary! */
- X (INVALID_FUNCTION, EBADRQC),
- X (FILE_NOT_FOUND, ENOENT),
- X (PATH_NOT_FOUND, ENOENT),
- X (TOO_MANY_OPEN_FILES, EMFILE),
- X (ACCESS_DENIED, EACCES),
- X (INVALID_HANDLE, EBADF),
- X (NOT_ENOUGH_MEMORY, ENOMEM),
- X (INVALID_DATA, EINVAL),
- X (OUTOFMEMORY, ENOMEM),
- X (INVALID_DRIVE, ENODEV),
- X (NOT_SAME_DEVICE, EXDEV),
- X (NO_MORE_FILES, ENMFILE),
- X (WRITE_PROTECT, EROFS),
- X (BAD_UNIT, ENODEV),
- X (SHARING_VIOLATION, EACCES),
- X (LOCK_VIOLATION, EACCES),
- X (SHARING_BUFFER_EXCEEDED, ENOLCK),
- X (HANDLE_EOF, ENODATA),
- X (HANDLE_DISK_FULL, ENOSPC),
- X (NOT_SUPPORTED, ENOSYS),
- X (REM_NOT_LIST, ENONET),
- X (DUP_NAME, ENOTUNIQ),
- X (BAD_NETPATH, ENOSHARE),
- X (BAD_NET_NAME, ENOSHARE),
- X (FILE_EXISTS, EEXIST),
- X (CANNOT_MAKE, EPERM),
- X (INVALID_PARAMETER, EINVAL),
- X (NO_PROC_SLOTS, EAGAIN),
- X (BROKEN_PIPE, EPIPE),
- X (OPEN_FAILED, EIO),
- X (NO_MORE_SEARCH_HANDLES, ENFILE),
- X (CALL_NOT_IMPLEMENTED, ENOSYS),
- X (INVALID_NAME, ENOENT),
- X (WAIT_NO_CHILDREN, ECHILD),
- X (CHILD_NOT_COMPLETE, EBUSY),
- X (DIR_NOT_EMPTY, ENOTEMPTY),
- X (SIGNAL_REFUSED, EIO),
- X (BAD_PATHNAME, ENOENT),
- X (SIGNAL_PENDING, EBUSY),
- X (MAX_THRDS_REACHED, EAGAIN),
- X (BUSY, EBUSY),
- X (ALREADY_EXISTS, EEXIST),
- X (NO_SIGNAL_SENT, EIO),
- X (FILENAME_EXCED_RANGE, EINVAL),
- X (META_EXPANSION_TOO_LONG, EINVAL),
- X (INVALID_SIGNAL_NUMBER, EINVAL),
- X (THREAD_1_INACTIVE, EINVAL),
- X (BAD_PIPE, EINVAL),
- X (PIPE_BUSY, EBUSY),
- X (NO_DATA, EPIPE),
- X (PIPE_NOT_CONNECTED, ECOMM),
- X (MORE_DATA, EAGAIN),
- X (DIRECTORY, ENOTDIR),
- X (PIPE_CONNECTED, EBUSY),
- X (PIPE_LISTENING, ECOMM),
- X (NO_TOKEN, EINVAL),
- X (PROCESS_ABORTED, EFAULT),
- X (BAD_DEVICE, ENODEV),
- X (BAD_USERNAME, EINVAL),
- X (NOT_CONNECTED, ENOLINK),
- X (OPEN_FILES, EAGAIN),
- X (ACTIVE_CONNECTIONS, EAGAIN),
- X (DEVICE_IN_USE, EAGAIN),
- X (INVALID_AT_INTERRUPT_TIME, EINTR),
- X (IO_DEVICE, EIO),
- X (NOT_OWNER, EPERM),
- X (END_OF_MEDIA, ENOSPC),
- X (EOM_OVERFLOW, ENOSPC),
- X (BEGINNING_OF_MEDIA, ESPIPE),
- X (SETMARK_DETECTED, ESPIPE),
- X (NO_DATA_DETECTED, ENOSPC),
- X (POSSIBLE_DEADLOCK, EDEADLOCK),
- X (CRC, EIO),
- X (NEGATIVE_SEEK, EINVAL),
- X (NOT_READY, ENOMEDIUM),
- X (DISK_FULL, ENOSPC),
- X (NOACCESS, EFAULT),
- X (FILE_INVALID, ENXIO),
- { 0, NULL, 0}
-};
-
-int __stdcall
-geterrno_from_win_error (DWORD code, int deferrno)
-{
- for (int i = 0; errmap[i].w != 0; ++i)
- if (code == errmap[i].w)
- {
- syscall_printf ("windows error %u == errno %d", code, errmap[i].e);
- return errmap[i].e;
- }
-
- syscall_printf ("unknown windows error %u, setting errno to %d", code,
- deferrno);
- return deferrno; /* FIXME: what's so special about EACCESS? */
-}
-
-/* seterrno_from_win_error: Given a Windows error code, set errno
- as appropriate. */
-void __stdcall
-seterrno_from_win_error (const char *file, int line, DWORD code)
-{
- syscall_printf ("%s:%d errno %d", file, line, code);
- set_errno (geterrno_from_win_error (code, EACCES));
- return;
-}
-
-/* seterrno: Set `errno' based on GetLastError (). */
-void __stdcall
-seterrno (const char *file, int line)
-{
- seterrno_from_win_error (file, line, GetLastError ());
-}
-
-extern char *_user_strerror _PARAMS ((int));
-
-extern "C" {
-const NO_COPY char __declspec(dllexport) * const _sys_errlist[]=
-{
-/* NOERROR 0 */ "No error",
-/* EPERM 1 */ "Operation not permitted",
-/* ENOENT 2 */ "No such file or directory",
-/* ESRCH 3 */ "No such process",
-/* EINTR 4 */ "Interrupted system call",
-/* EIO 5 */ "I/O error",
-/* ENXIO 6 */ "No such device or address",
-/* E2BIG 7 */ "Arg list too long",
-/* ENOEXEC 8 */ "Exec format error",
-/* EBADF 9 */ "Bad file number",
-/* ECHILD 10 */ "No children",
-/* EAGAIN 11 */ "Resource temporarily unavailable",
-/* ENOMEM 12 */ "Not enough core",
-/* EACCES 13 */ "Permission denied",
-/* EFAULT 14 */ "Bad address",
-/* ENOTBLK 15 */ "Block device required",
-/* EBUSY 16 */ "Mount device busy",
-/* EEXIST 17 */ "File exists",
-/* EXDEV 18 */ "Cross-device link",
-/* ENODEV 19 */ "No such device",
-/* ENOTDIR 20 */ "Not a directory",
-/* EISDIR 21 */ "Is a directory",
-/* EINVAL 22 */ "Invalid argument",
-/* ENFILE 23 */ "Too many open files in system",
-/* EMFILE 24 */ "Too many open files",
-/* ENOTTY 25 */ "Not a typewriter",
-/* ETXTBSY 26 */ "Text file busy",
-/* EFBIG 27 */ "File too large",
-/* ENOSPC 28 */ "No space left on device",
-/* ESPIPE 29 */ "Illegal seek",
-/* EROFS 30 */ "Read only file system",
-/* EMLINK 31 */ "Too many links",
-/* EPIPE 32 */ "Broken pipe",
-/* EDOM 33 */ "Math arg out of domain of func",
-/* ERANGE 34 */ "Math result not representable",
-/* ENOMSG 35 */ "No message of desired type",
-/* EIDRM 36 */ "Identifier removed",
-/* ECHRNG 37 */ "Channel number out of range",
-/* EL2NSYNC 38 */ "Level 2 not synchronized",
-/* EL3HLT 39 */ "Level 3 halted",
-/* EL3RST 40 */ "Level 3 reset",
-/* ELNRNG 41 */ "Link number out of range",
-/* EUNATCH 42 */ "Protocol driver not attached",
-/* ENOCSI 43 */ "No CSI structure available",
-/* EL2HLT 44 */ "Level 2 halted",
-/* EDEADLK 45 */ "Deadlock condition",
-/* ENOLCK 46 */ "No record locks available",
- "47",
- "48",
- "49",
-/* EBADE 50 */ "Invalid exchange",
-/* EBADR 51 */ "Invalid request descriptor",
-/* EXFULL 52 */ "Exchange full",
-/* ENOANO 53 */ "No anode",
-/* EBADRQC 54 */ "Invalid request code",
-/* EBADSLT 55 */ "Invalid slot",
-/* EDEADLOCK 56 */ "File locking deadlock error",
-/* EBFONT 57 */ "Bad font file fmt",
- "58",
- "59",
-/* ENOSTR 60 */ "Device not a stream",
-/* ENODATA 61 */ "No data (for no delay io)",
-/* ETIME 62 */ "Timer expired",
-/* ENOSR 63 */ "Out of streams resources",
-/* ENONET 64 */ "Machine is not on the network",
-/* ENOPKG 65 */ "Package not installed",
-/* EREMOTE 66 */ "The object is remote",
-/* ENOLINK 67 */ "The link has been severed",
-/* EADV 68 */ "Advertise error",
-/* ESRMNT 69 */ "Srmount error",
-/* ECOMM 70 */ "Communication error on send",
-/* EPROTO 71 */ "Protocol error",
- "72",
- "73",
-/* EMULTIHOP 74 */ "Multihop attempted",
-/* ELBIN 75 */ "Inode is remote (not really error)",
-/* EDOTDOT 76 */ "Cross mount point (not really error)",
-/* EBADMSG 77 */ "Trying to read unreadable message",
- "78",
- "79",
-/* ENOTUNIQ 80 */ "Given log. name not unique",
-/* EBADFD 81 */ "f.d. invalid for this operation",
-/* EREMCHG 82 */ "Remote address changed",
-/* ELIBACC 83 */ "Can't access a needed shared lib",
-/* ELIBBAD 84 */ "Accessing a corrupted shared lib",
-/* ELIBSCN 85 */ ".lib section in a.out corrupted",
-/* ELIBMAX 86 */ "Attempting to link in too many libs",
-/* ELIBEXEC 87 */ "Attempting to exec a shared library",
-/* ENOSYS 88 */ "Function not implemented",
-/* ENMFILE 89 */ "No more files",
-/* ENOTEMPTY 90 */ "Directory not empty",
-/* ENAMETOOLONG 91 */ "File or path name too long",
-/* ELOOP 92 */ "Too many symbolic links",
- "93",
- "94",
-/* EOPNOTSUPP 95 */ "Operation not supported on transport endpoint",
-/* EPFNOSUPPORT 96 */ "Protocol family not supported",
- "97",
- "98",
- "99",
- "100",
- "101",
- "102",
- "103",
-/* ECONNRESET 104 */ "Connection reset by peer",
-/* ENOBUFS 105 */ "No buffer space available",
-/* EAFNOSUPPORT 106 */ "Address family not supported by protocol",
-/* EPROTOTYPE 107 */ "Protocol wrong type for transport endpoint",
-/* ENOTSOCK 108 */ "Socket operation on non-socket",
-/* ENOPROTOOPT 109 */ "Protocol not available",
-/* ESHUTDOWN 110 */ "Cannot send after transport endpoint shutdown",
-/* ECONNREFUSED 111 */ "Connection refused",
-/* EADDRINUSE 112 */ "Address already in use",
-/* ECONNABORTED 113 */ "Connection aborted",
-/* ENETUNREACH 114 */ "Network is unreachable",
-/* ENETDOWN 115 */ "Network is down",
-/* ETIMEDOUT 116 */ "Connection timed out",
-/* EHOSTDOWN 117 */ "Host is down",
-/* EHOSTUNREACH 118 */ "No route to host",
-/* EINPROGRESS 119 */ "Operation now in progress",
-/* EALREADY 120 */ "Operation already in progress",
-/* EDESTADDRREQ 121 */ "Destination address required",
-/* EMSGSIZE 122 */ "Message too long",
-/* EPROTONOSUPPORT 123 */ "Protocol not supported",
-/* ESOCKTNOSUPPORT 124 */ "Socket type not supported",
-/* EADDRNOTAVAIL 125 */ "Cannot assign requested address",
-/* ENETRESET 126 */ "Network dropped connection because of reset",
-/* EISCONN 127 */ "Transport endpoint is already connected",
-/* ENOTCONN 128 */ "Transport endpoint is not connected",
-/* ETOOMANYREFS 129 */ "Too many references: cannot splice",
-/* EPROCLIM 130 */ "Process limit exceeded",
-/* EUSERS 131 */ "Too many users",
-/* EDQUOT 132 */ "Quota exceeded",
-/* ESTALE 133 */ "Stale NFS file handle",
-/* ENOTSUP 134 */ "134",
-/* ENOMEDIUM 135 */ "no medium",
-/* ENOSHARE 136 */ "No such host or network path",
-/* ECASECLASH 137 */ "Filename exists with different case"
-};
-
-extern int const NO_COPY __declspec(dllexport) _sys_nerr = sizeof (_sys_errlist) / sizeof (_sys_errlist[0]);
-};
-
-/* FIXME: Why is strerror() a long switch and not just:
- return sys_errlist[errnum];
- (or moral equivalent).
- Some entries in sys_errlist[] don't match the corresponding
- entries in strerror(). This seems odd.
-*/
-
-/* CYGWIN internal */
-/* strerror: convert from errno values to error strings */
-extern "C" char *
-strerror (int errnum)
-{
- const char *error;
- if (errnum < _sys_nerr)
- error = _sys_errlist [errnum];
- else
- switch (errnum)
- {
- case EPERM:
- error = "Operation not permitted";
- break;
- case ENOENT:
- error = "No such file or directory";
- break;
- case ESRCH:
- error = "No such process";
- break;
- case EINTR:
- error = "Interrupted system call";
- break;
- case EIO:
- error = "I/O error";
- break;
- case ENXIO:
- error = "No such device or address";
- break;
- case E2BIG:
- error = "Arg list too long";
- break;
- case ENOEXEC:
- error = "Exec format error";
- break;
- case EBADF:
- error = "Bad file number";
- break;
- case ECHILD:
- error = "No children";
- break;
- case EAGAIN:
- error = "Resource temporarily unavailable";
- break;
- case ENOMEM:
- error = "Not enough memory";
- break;
- case EACCES:
- error = "Permission denied";
- break;
- case EFAULT:
- error = "Bad address";
- break;
- case ENOTBLK:
- error = "Block device required";
- break;
- case EBUSY:
- error = "Device or resource busy";
- break;
- case EEXIST:
- error = "File exists";
- break;
- case EXDEV:
- error = "Cross-device link";
- break;
- case ENODEV:
- error = "No such device";
- break;
- case ENOTDIR:
- error = "Not a directory";
- break;
- case EISDIR:
- error = "Is a directory";
- break;
- case EINVAL:
- error = "Invalid argument";
- break;
- case ENFILE:
- error = "Too many open files in system";
- break;
- case EMFILE:
- error = "Too many open files";
- break;
- case ENOTTY:
- error = "Not a character device";
- break;
- case ETXTBSY:
- error = "Text file busy";
- break;
- case EFBIG:
- error = "File too large";
- break;
- case ENOSPC:
- error = "No space left on device";
- break;
- case ESPIPE:
- error = "Illegal seek";
- break;
- case EROFS:
- error = "Read-only file system";
- break;
- case EMLINK:
- error = "Too many links";
- break;
- case EPIPE:
- error = "Broken pipe";
- break;
- case EDOM:
- error = "Math arg out of domain of func";
- break;
- case ERANGE:
- error = "Math result out of range";
- break;
- case ENOMSG:
- error = "No message of desired type";
- break;
- case EIDRM:
- error = "Identifier removed";
- break;
- case ECHRNG:
- error = "Channel number out of range";
- break;
- case EL2NSYNC:
- error = "Level 2 not synchronized";
- break;
- case EL3HLT:
- error = "Level 3 halted";
- break;
- case EL3RST:
- error = "Level 3 reset";
- break;
- case ELNRNG:
- error = "Link number out of range";
- break;
- case EUNATCH:
- error = "Protocol driver not attached";
- break;
- case ENOCSI:
- error = "No CSI structure available";
- break;
- case EL2HLT:
- error = "Level 2 halted";
- break;
- case EDEADLK:
- error = "Deadlock condition";
- break;
- case ENOLCK:
- error = "No lock";
- break;
- case EBADE:
- error = "Invalid exchange";
- break;
- case EBADR:
- error = "Invalid request descriptor";
- break;
- case EXFULL:
- error = "Exchange full";
- break;
- case ENOANO:
- error = "No anode";
- break;
- case EBADRQC:
- error = "Invalid request code";
- break;
- case EBADSLT:
- error = "Invalid slot";
- break;
- case EDEADLOCK:
- error = "File locking deadlock error";
- break;
- case EBFONT:
- error = "Bad font file fmt";
- break;
- case ENOSTR:
- error = "Not a stream";
- break;
- case ENODATA:
- error = "No data (for no delay io)";
- break;
- case ETIME:
- error = "Stream ioctl timeout";
- break;
- case ENOSR:
- error = "No stream resources";
- break;
- case ENONET:
- error = "Machine is not on the network";
- break;
- case ENOPKG:
- error = "No package";
- break;
- case EREMOTE:
- error = "Resource is remote";
- break;
- case ENOLINK:
- error = "Virtual circuit is gone";
- break;
- case EADV:
- error = "Advertise error";
- break;
- case ESRMNT:
- error = "Srmount error";
- break;
- case ECOMM:
- error = "Communication error";
- break;
- case EPROTO:
- error = "Protocol error";
- break;
- case EMULTIHOP:
- error = "Multihop attempted";
- break;
- case ELBIN:
- error = "Inode is remote (not really error)";
- break;
- case EDOTDOT:
- error = "Cross mount point (not really error)";
- break;
- case EBADMSG:
- error = "Bad message";
- break;
- case ENOTUNIQ:
- error = "Given log. name not unique";
- break;
- case EBADFD:
- error = "f.d. invalid for this operation";
- break;
- case EREMCHG:
- error = "Remote address changed";
- break;
- case ELIBACC:
- error = "Cannot access a needed shared library";
- break;
- case ELIBBAD:
- error = "Accessing a corrupted shared library";
- break;
- case ELIBSCN:
- error = ".lib section in a.out corrupted";
- break;
- case ELIBMAX:
- error = "Attempting to link in more shared libraries than system limit";
- break;
- case ELIBEXEC:
- error = "Cannot exec a shared library directly";
- break;
- case ENOSYS:
- error = "Function not implemented";
- break;
- case ENMFILE:
- error = "No more files";
- break;
- case ENOTEMPTY:
- error = "Directory not empty";
- break;
- case ENAMETOOLONG:
- error = "File or path name too long";
- break;
- case ELOOP:
- error = "Too many symbolic links";
- break;
- case EOPNOTSUPP:
- error = "Operation not supported on transport endpoint";
- break;
- case EPFNOSUPPORT:
- error = "Protocol family not supported";
- break;
- case ECONNRESET:
- error = "Connection reset by peer";
- break;
- case ENOBUFS:
- error = "No buffer space available; the socket cannot be connected";
- break;
- case EAFNOSUPPORT:
- error = "Addresses in the specified family cannot be used with this socket";
- break;
- case EPROTOTYPE:
- error = "errno EPROTOTYPE triggered";
- break;
- case ENOTSOCK:
- error = "The descriptor is a file, not a socket";
- break;
- case ENOPROTOOPT:
- error = "This option is unsupported";
- break;
- case ESHUTDOWN:
- error = "errno ESHUTDOWN triggered";
- break;
- case ECONNREFUSED:
- error = "Connection refused";
- break;
- case EADDRINUSE:
- error = "Address already in use";
- break;
- case ECONNABORTED:
- error = "The connection was aborted";
- break;
- case ENETUNREACH:
- error ="The network can't be reached from this host at this time";
- break;
- case ENETDOWN:
- error = "Network failed.";
- break;
- case ETIMEDOUT:
- error = "Attempt to connect timed out without establishing a connection";
- break;
- case EHOSTDOWN:
- error = "errno EHOSTDOWN triggered";
- break;
- case EHOSTUNREACH:
- error = "errno EHOSTUNREACH triggered";
- break;
- case EINPROGRESS:
- error = "errno EINPROGRESS triggered";
- break;
- case EALREADY:
- error = "errno EALREADY triggered";
- break;
- case EDESTADDRREQ:
- error = "errno EDESTADDRREQ triggered";
- break;
- case EMSGSIZE:
- error = "errno EMSGSIZE triggered";
- break;
-
- case EPROTONOSUPPORT:
- error = "errno EPROTONOSUPPORT triggered";
- break;
- case ESOCKTNOSUPPORT:
- error = "errno ESOCKTNOSUPPORT triggered";
- break;
- case EADDRNOTAVAIL:
- error = "errno EADDRNOTAVAIL triggered";
- break;
- case ENETRESET:
- error = "errno ENETRESET triggered";
- break;
- case EISCONN:
- error = "The socket is already connected";
- break;
- case ENOTCONN:
- error = "The socket is not connected";
- break;
- case ETOOMANYREFS:
- error = "errno ETOOMANYREFS triggered";
- break;
- case EPROCLIM:
- error = "errno EPROCLIM triggered";
- break;
- case EUSERS:
- error = "errno EUSERS triggered";
- break;
- case EDQUOT:
- error = "errno EDQUOT triggered";
- break;
- case ESTALE:
- error = "errno ESTALE triggered";
- break;
- case ENOTSUP:
- error = "errno ENOTSUP triggered";
- break;
- case ENOMEDIUM:
- error = "no medium";
- break;
- case ENOSHARE:
- error = "No such host or network path";
- break;
- case ECASECLASH:
- error = "Filename exists with different case";
- break;
- default:
-#ifdef _MT_SAFE
- char *buf= _reent_winsup()->_strerror_buf;
-#else
- static NO_COPY char buf[20];
-#endif
- __small_sprintf (buf, "error %d", errnum);
- error = buf;
- break;
- }
-
- /* FIXME: strerror should really be const in the appropriate newlib
- include files. */
- return (char *) error;
-}
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
deleted file mode 100644
index 1eb3fbac2..000000000
--- a/winsup/cygwin/exceptions.cc
+++ /dev/null
@@ -1,1244 +0,0 @@
-/* exceptions.cc
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <imagehlp.h>
-#include <errno.h>
-#include <stdlib.h>
-
-#include "exceptions.h"
-#include "sync.h"
-#include "sigproc.h"
-#include "pinfo.h"
-#include "cygerrno.h"
-#include "perthread.h"
-#include "shared_info.h"
-#include "perprocess.h"
-#include "security.h"
-
-#define CALL_HANDLER_RETRY 20
-
-char debugger_command[2 * MAX_PATH + 20];
-
-extern "C" {
-static int handle_exceptions (EXCEPTION_RECORD *, void *, CONTEXT *, void *);
-extern void sigreturn ();
-extern void sigdelayed ();
-extern void sigdelayed0 ();
-extern void siglast ();
-extern DWORD __no_sig_start, __no_sig_end;
-};
-
-extern DWORD sigtid;
-
-extern HANDLE hExeced;
-extern DWORD dwExeced;
-
-static BOOL WINAPI ctrl_c_handler (DWORD);
-static void signal_exit (int) __attribute__ ((noreturn));
-static char windows_system_directory[1024];
-static size_t windows_system_directory_length;
-
-/* This is set to indicate that we have already exited. */
-
-static NO_COPY int exit_already = 0;
-static NO_COPY muto *mask_sync = NULL;
-
-HMODULE NO_COPY cygwin_hmodule;
-
-NO_COPY static struct
-{
- unsigned int code;
- const char *name;
-} status_info[] =
-{
-#define X(s) s, #s
- { X (STATUS_ABANDONED_WAIT_0) },
- { X (STATUS_ACCESS_VIOLATION) },
- { X (STATUS_ARRAY_BOUNDS_EXCEEDED) },
- { X (STATUS_BREAKPOINT) },
- { X (STATUS_CONTROL_C_EXIT) },
- { X (STATUS_DATATYPE_MISALIGNMENT) },
- { X (STATUS_FLOAT_DENORMAL_OPERAND) },
- { X (STATUS_FLOAT_DIVIDE_BY_ZERO) },
- { X (STATUS_FLOAT_INEXACT_RESULT) },
- { X (STATUS_FLOAT_INVALID_OPERATION) },
- { X (STATUS_FLOAT_OVERFLOW) },
- { X (STATUS_FLOAT_STACK_CHECK) },
- { X (STATUS_FLOAT_UNDERFLOW) },
- { X (STATUS_GUARD_PAGE_VIOLATION) },
- { X (STATUS_ILLEGAL_INSTRUCTION) },
- { X (STATUS_INTEGER_DIVIDE_BY_ZERO) },
- { X (STATUS_INTEGER_OVERFLOW) },
- { X (STATUS_INVALID_DISPOSITION) },
- { X (STATUS_IN_PAGE_ERROR) },
- { X (STATUS_NONCONTINUABLE_EXCEPTION) },
- { X (STATUS_NO_MEMORY) },
- { X (STATUS_PENDING) },
- { X (STATUS_PRIVILEGED_INSTRUCTION) },
- { X (STATUS_SINGLE_STEP) },
- { X (STATUS_STACK_OVERFLOW) },
- { X (STATUS_TIMEOUT) },
- { X (STATUS_USER_APC) },
- { X (STATUS_WAIT_0) },
- { 0, 0 }
-#undef X
-};
-
-/* Initialization code. */
-
-#ifdef __i386__
-
-// Set up the exception handler for the current thread. The PowerPC & Mips
-// use compiler generated tables to set up the exception handlers for each
-// region of code, and the kernel walks the call list until it finds a region
-// of code that handles exceptions. The x86 on the other hand uses segment
-// register fs, offset 0 to point to the current exception handler.
-
-asm (".equ __except_list,0");
-
-extern exception_list *_except_list asm ("%fs:__except_list");
-
-static void
-init_exception_handler (exception_list *el)
-{
- el->handler = handle_exceptions;
- el->prev = _except_list;
- _except_list = el;
-}
-#endif
-
-void
-early_stuff_init ()
-{
- (void) SetConsoleCtrlHandler (ctrl_c_handler, FALSE);
- if (!SetConsoleCtrlHandler (ctrl_c_handler, TRUE))
- system_printf ("SetConsoleCtrlHandler failed, %E");
-
- /* Initialize global security attribute stuff */
-
- sec_none.nLength = sec_none_nih.nLength =
- sec_all.nLength = sec_all_nih.nLength = sizeof (SECURITY_ATTRIBUTES);
- sec_none.bInheritHandle = sec_all.bInheritHandle = TRUE;
- sec_none_nih.bInheritHandle = sec_all_nih.bInheritHandle = FALSE;
- sec_none.lpSecurityDescriptor = sec_none_nih.lpSecurityDescriptor = NULL;
- sec_all.lpSecurityDescriptor = sec_all_nih.lpSecurityDescriptor =
- get_null_sd ();
-}
-
-extern "C" void
-init_exceptions (exception_list *el)
-{
- init_exception_handler (el);
-}
-
-extern "C" void
-error_start_init (const char *buf)
-{
- if (!buf || !*buf)
- {
- debugger_command[0] = '\0';
- return;
- }
-
- char myself_posix_name[MAX_PATH];
-
- /* FIXME: gdb cannot use win32 paths, but what if debugger isn't gdb? */
- cygwin_conv_to_posix_path (myself->progname, myself_posix_name);
- __small_sprintf (debugger_command, "%s %s", buf, myself_posix_name);
-}
-
-static void
-open_stackdumpfile ()
-{
- if (myself->progname[0])
- {
- const char *p;
- /* write to progname.stackdump if possible */
- if (!myself->progname[0])
- p = "unknown";
- else if ((p = strrchr (myself->progname, '\\')))
- p++;
- else
- p = myself->progname;
- char corefile[strlen (p) + sizeof (".stackdump")];
- __small_sprintf (corefile, "%s.stackdump", p);
- HANDLE h = CreateFile (corefile, GENERIC_WRITE, 0, &sec_none_nih,
- CREATE_ALWAYS, 0, 0);
- if (h != INVALID_HANDLE_VALUE)
- {
- if (!myself->ppid_handle)
- system_printf ("Dumping stack trace to %s", corefile);
- else
- debug_printf ("Dumping stack trace to %s", corefile);
- SetStdHandle (STD_ERROR_HANDLE, h);
- }
- }
-}
-
-/* Utilities for dumping the stack, etc. */
-
-static void
-exception (EXCEPTION_RECORD *e, CONTEXT *in)
-{
- const char *exception_name = NULL;
-
- if (e)
- {
- for (int i = 0; status_info[i].name; i++)
- {
- if (status_info[i].code == e->ExceptionCode)
- {
- exception_name = status_info[i].name;
- break;
- }
- }
- }
-
-#ifdef __i386__
-#define HAVE_STATUS
- if (exception_name)
- small_printf ("Exception: %s at eip=%08x\r\n", exception_name, in->Eip);
- else
- small_printf ("Exception %d at eip=%08x\r\n", e->ExceptionCode, in->Eip);
- small_printf ("eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x\r\n",
- in->Eax, in->Ebx, in->Ecx, in->Edx, in->Esi, in->Edi);
- small_printf ("ebp=%08x esp=%08x program=%s\r\n",
- in->Ebp, in->Esp, myself->progname);
- small_printf ("cs=%04x ds=%04x es=%04x fs=%04x gs=%04x ss=%04x\r\n",
- in->SegCs, in->SegDs, in->SegEs, in->SegFs, in->SegGs, in->SegSs);
-#endif
-
-#ifndef HAVE_STATUS
- system_printf ("Had an exception");
-#endif
-}
-
-#ifdef __i386__
-/* Print a stack backtrace. */
-
-#define HAVE_STACK_TRACE
-
-/* A class for manipulating the stack. */
-class stack_info
-{
- int walk (); /* Uses the "old" method */
- char *next_offset () {return *((char **) sf.AddrFrame.Offset);}
- bool needargs;
- DWORD dummy_frame;
-public:
- STACKFRAME sf; /* For storing the stack information */
- void init (DWORD, bool, bool); /* Called the first time that stack info is needed */
-
- /* Postfix ++ iterates over the stack, returning zero when nothing is left. */
- int operator ++(int) { return this->walk (); }
-};
-
-/* The number of parameters used in STACKFRAME */
-#define NPARAMS (sizeof (thestack.sf.Params) / sizeof (thestack.sf.Params[0]))
-
-/* This is the main stack frame info for this process. */
-static NO_COPY stack_info thestack;
-static signal_dispatch sigsave;
-
-/* Initialize everything needed to start iterating. */
-void
-stack_info::init (DWORD ebp, bool wantargs, bool goodframe)
-{
-# define debp ((DWORD *) ebp)
- memset (&sf, 0, sizeof (sf));
- if (!goodframe)
- sf.AddrFrame.Offset = ebp;
- else
- {
- dummy_frame = ebp;
- sf.AddrFrame.Offset = (DWORD) &dummy_frame;
- }
- sf.AddrReturn.Offset = debp[1];
- sf.AddrFrame.Mode = AddrModeFlat;
- needargs = wantargs;
-# undef debp
-}
-
-/* Walk the stack by looking at successive stored 'bp' frames.
- This is not foolproof. */
-int
-stack_info::walk ()
-{
- char **ebp;
- if ((ebp = (char **) next_offset ()) == NULL)
- return 0;
-
- sf.AddrFrame.Offset = (DWORD) ebp;
- sf.AddrPC.Offset = sf.AddrReturn.Offset;
-
- if (!sf.AddrPC.Offset)
- return 0; /* stack frames are exhausted */
-
- /* The return address always follows the stack pointer */
- sf.AddrReturn.Offset = (DWORD) *++ebp;
-
- if (needargs)
- /* The arguments follow the return address */
- for (unsigned i = 0; i < NPARAMS; i++)
- sf.Params[i] = (DWORD) *++ebp;
-
- return 1;
-}
-
-static void
-stackdump (DWORD ebp, int open_file, bool isexception)
-{
- extern unsigned long rlim_core;
-
- if (rlim_core == 0UL)
- return;
-
- if (open_file)
- open_stackdumpfile ();
-
- int i;
-
- thestack.init (ebp, 1, !isexception); /* Initialize from the input CONTEXT */
- small_printf ("Stack trace:\r\nFrame Function Args\r\n");
- for (i = 0; i < 16 && thestack++; i++)
- {
- small_printf ("%08x %08x ", thestack.sf.AddrFrame.Offset,
- thestack.sf.AddrPC.Offset);
- for (unsigned j = 0; j < NPARAMS; j++)
- small_printf ("%s%08x", j == 0 ? " (" : ", ", thestack.sf.Params[j]);
- small_printf (")\r\n");
- }
- small_printf ("End of stack trace%s",
- i == 16 ? " (more stack frames may be present)" : "");
-}
-
-/* Temporary (?) function for external callers to get a stack dump */
-extern "C" void
-cygwin_stackdump ()
-{
- CONTEXT c;
- c.ContextFlags = CONTEXT_FULL;
- GetThreadContext (GetCurrentThread (), &c);
- stackdump (c.Ebp, 0, 0);
-}
-
-#define TIME_TO_WAIT_FOR_DEBUGGER 10000
-
-extern "C" int
-try_to_debug (bool waitloop)
-{
- debug_printf ("debugger_command '%s'", debugger_command);
- if (*debugger_command == '\0')
- return 0;
-
- __small_sprintf (strchr (debugger_command, '\0'), " %u", GetCurrentProcessId ());
-
- BOOL dbg;
-
- SetThreadPriority (hMainThread, THREAD_PRIORITY_HIGHEST);
- PROCESS_INFORMATION pi = {NULL, 0, 0, 0};
-
- STARTUPINFO si = {0, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL};
- si.lpReserved = NULL;
- si.lpDesktop = NULL;
- si.dwFlags = 0;
- si.cb = sizeof (si);
-
- /* FIXME: need to know handles of all running threads to
- suspend_all_threads_except (current_thread_id);
- */
-
- /* if any of these mutexes is owned, we will fail to start any cygwin app
- until trapped app exits */
-
- ReleaseMutex (title_mutex);
-
- /* prevent recursive exception handling */
- char* rawenv = GetEnvironmentStrings () ;
- for (char* p = rawenv; *p != '\0'; p = strchr (p, '\0') + 1)
- {
- if (strncmp (p, "CYGWIN=", sizeof ("CYGWIN=") - 1) == 0)
- {
- char* q = strstr (p, "error_start") ;
- /* replace 'error_start=...' with '_rror_start=...' */
- if (q) *q = '_' ;
- SetEnvironmentVariable ("CYGWIN", p + sizeof ("CYGWIN=")) ;
- break ;
- }
- }
-
- dbg = CreateProcess (NULL,
- debugger_command,
- NULL,
- NULL,
- FALSE,
- CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP,
- NULL,
- NULL,
- &si,
- &pi);
-
- if (!dbg)
- system_printf ("Failed to start debugger: %E");
- else
- {
- if (!waitloop)
- return 1;
- SetThreadPriority (hMainThread, THREAD_PRIORITY_IDLE);
- while (!being_debugged ())
- /* spin */;
- Sleep (4000);
- small_printf ("*** continuing from debugger call\n");
- }
-
- /* FIXME: need to know handles of all running threads to
- resume_all_threads_except (current_thread_id);
- */
- return 0;
-}
-
-/* Main exception handler. */
-
-static int
-handle_exceptions (EXCEPTION_RECORD *e, void *, CONTEXT *in, void *)
-{
- int sig;
- static int NO_COPY debugging = 0;
- static int NO_COPY recursed = 0;
-
- if (debugging && ++debugging < 500000)
- {
- SetThreadPriority (hMainThread, THREAD_PRIORITY_NORMAL);
- return 0;
- }
-
- /* If we've already exited, don't do anything here. Returning 1
- tells Windows to keep looking for an exception handler. */
- if (exit_already)
- return 1;
-
- /* Coerce win32 value to posix value. */
- switch (e->ExceptionCode)
- {
- case STATUS_FLOAT_DENORMAL_OPERAND:
- case STATUS_FLOAT_DIVIDE_BY_ZERO:
- case STATUS_FLOAT_INEXACT_RESULT:
- case STATUS_FLOAT_INVALID_OPERATION:
- case STATUS_FLOAT_OVERFLOW:
- case STATUS_FLOAT_STACK_CHECK:
- case STATUS_FLOAT_UNDERFLOW:
- case STATUS_INTEGER_DIVIDE_BY_ZERO:
- case STATUS_INTEGER_OVERFLOW:
- sig = SIGFPE;
- break;
-
- case STATUS_ILLEGAL_INSTRUCTION:
- case STATUS_PRIVILEGED_INSTRUCTION:
- case STATUS_NONCONTINUABLE_EXCEPTION:
- sig = SIGILL;
- break;
-
- case STATUS_TIMEOUT:
- sig = SIGALRM;
- break;
-
- case STATUS_ACCESS_VIOLATION:
- case STATUS_DATATYPE_MISALIGNMENT:
- case STATUS_ARRAY_BOUNDS_EXCEEDED:
- case STATUS_GUARD_PAGE_VIOLATION:
- case STATUS_IN_PAGE_ERROR:
- case STATUS_NO_MEMORY:
- case STATUS_INVALID_DISPOSITION:
- case STATUS_STACK_OVERFLOW:
- sig = SIGSEGV;
- break;
-
- case STATUS_CONTROL_C_EXIT:
- sig = SIGINT;
- break;
-
- case STATUS_INVALID_HANDLE:
- /* CloseHandle will throw this exception if it is given an
- invalid handle. We don't care about the exception; we just
- want CloseHandle to return an error. This can be revisited
- if gcc ever supports Windows style structured exception
- handling. */
- return 0;
-
- default:
- /* If we don't recognize the exception, we have to assume that
- we are doing structured exception handling, and we let
- something else handle it. */
- return 1;
- }
-
- debug_printf ("In cygwin_except_handler exc %p at %p sp %p", e->ExceptionCode, in->Eip, in->Esp);
- debug_printf ("In cygwin_except_handler sig = %d at %p", sig, in->Eip);
-
- if (myself->getsig (sig).sa_mask & SIGTOMASK (sig))
- syscall_printf ("signal %d, masked %p", sig, myself->getsig (sig).sa_mask);
-
- debug_printf ("In cygwin_except_handler calling %p",
- myself->getsig (sig).sa_handler);
-
- DWORD *ebp = (DWORD *)in->Esp;
- for (DWORD *bpend = (DWORD *) __builtin_frame_address (0); ebp > bpend; ebp--)
- if (*ebp == in->SegCs && ebp[-1] == in->Eip)
- {
- ebp -= 2;
- break;
- }
-
- if (!myself->progname[0]
- || GetCurrentThreadId () == sigtid
- || (void *) myself->getsig (sig).sa_handler == (void *) SIG_DFL
- || (void *) myself->getsig (sig).sa_handler == (void *) SIG_IGN
- || (void *) myself->getsig (sig).sa_handler == (void *) SIG_ERR)
- {
- /* Print the exception to the console */
- if (e)
- {
- for (int i = 0; status_info[i].name; i++)
- {
- if (status_info[i].code == e->ExceptionCode)
- {
- if (!myself->ppid_handle)
- system_printf ("Exception: %s", status_info[i].name);
- break;
- }
- }
- }
-
- /* Another exception could happen while tracing or while exiting.
- Only do this once. */
- if (recursed++)
- system_printf ("Error while dumping state (probably corrupted stack)");
- else
- {
- if (try_to_debug (0))
- {
- debugging = 1;
- return 0;
- }
-
- open_stackdumpfile ();
- exception (e, in);
- stackdump ((DWORD) ebp, 0, 1);
- }
-
- signal_exit (0x80 | sig); // Flag signal + core dump
- }
-
- sig_send (NULL, sig, (DWORD) ebp, 1); // Signal myself
- return 0;
-}
-#endif /* __i386__ */
-
-#ifndef HAVE_STACK_TRACE
-void
-stack (void)
-{
- system_printf ("Stack trace not yet supported on this machine.");
-}
-#endif
-
-/* Utilities to call a user supplied exception handler. */
-
-#define SIG_NONMASKABLE (SIGTOMASK (SIGKILL) | SIGTOMASK (SIGSTOP))
-
-#ifdef __i386__
-#define HAVE_CALL_HANDLER
-
-/* Non-raceable sigsuspend
- * Note: This implementation is based on the Single UNIX Specification
- * man page. This indicates that sigsuspend always returns -1 and that
- * attempts to block unblockable signals will be silently ignored.
- * This is counter to what appears to be documented in some UNIX
- * man pages, e.g. Linux.
- */
-int __stdcall
-handle_sigsuspend (sigset_t tempmask)
-{
- sigframe thisframe (mainthread);
- sigset_t oldmask = myself->getsigmask (); // Remember for restoration
-
- set_process_mask (tempmask & ~SIG_NONMASKABLE);// Let signals we're
- // interested in through.
- sigproc_printf ("old mask %x, new mask %x", oldmask, tempmask);
-
- WaitForSingleObject (signal_arrived, INFINITE);
-
- set_sig_errno (EINTR); // Per POSIX
-
- /* A signal dispatch function will have been added to our stack and will
- be hit eventually. Set the old mask to be restored when the signal
- handler returns. */
-
- sigsave.oldmask = oldmask; // Will be restored by signal handler
- return -1;
-}
-
-extern DWORD exec_exit; // Possible exit value for exec
-extern int pending_signals;
-
-extern "C" {
-static void
-sig_handle_tty_stop (int sig)
-{
- /* Silently ignore attempts to suspend if there is no accomodating
- cygwin parent to deal with this behavior. */
- if (!myself->ppid_handle)
- {
- myself->process_state &= ~PID_STOPPED;
- return;
- }
-
- myself->stopsig = sig;
- /* See if we have a living parent. If so, send it a special signal.
- * It will figure out exactly which pid has stopped by scanning
- * its list of subprocesses.
- */
- if (my_parent_is_alive ())
- {
- pinfo parent (myself->ppid);
- if (!(parent->getsig (SIGCHLD).sa_flags & SA_NOCLDSTOP))
- sig_send (parent, SIGCHLD);
- }
- sigproc_printf ("process %d stopped by signal %d, myself->ppid_handle %p",
- myself->pid, sig, myself->ppid_handle);
- SuspendThread (hMainThread);
- return;
-}
-}
-
-int
-interruptible (DWORD pc, int testvalid = 0)
-{
- int res;
- MEMORY_BASIC_INFORMATION m;
-
- memset (&m, 0, sizeof m);
- if (!VirtualQuery ((LPCVOID) pc, &m, sizeof m))
- sigproc_printf ("couldn't get memory info, pc %p, %E", pc);
-
- char *checkdir = (char *) alloca (windows_system_directory_length + 4);
- memset (checkdir, 0, sizeof (checkdir));
-
-# define h ((HMODULE) m.AllocationBase)
- /* Apparently Windows 95 can sometimes return bogus addresses from
- GetThreadContext. These resolve to an allocation base == 0.
- These should *never* be treated as interruptible. */
- if (!h || m.State != MEM_COMMIT)
- res = 0;
- else if (testvalid)
- res = 1; /* All we wanted to know was if this was a valid module. */
- else if (h == user_data->hmodule)
- res = 1;
- else if (h == cygwin_hmodule)
- res = 0;
- else if (!GetModuleFileName (h, checkdir, windows_system_directory_length + 2))
- res = 0;
- else
- res = !strncasematch (windows_system_directory, checkdir,
- windows_system_directory_length);
- sigproc_printf ("pc %p, h %p, interruptible %d, testvalid %d", pc, h, res, testvalid);
-# undef h
- return res;
-}
-
-bool
-sigthread::get_winapi_lock (int test)
-{
- if (test)
- return !InterlockedExchange (&winapi_lock, 1);
-
- /* Need to do a busy loop because we can't block or a potential SuspendThread
- will hang. */
- while (InterlockedExchange (&winapi_lock, 1))
- Sleep (1);
- return 1;
-}
-
-void
-sigthread::release_winapi_lock ()
-{
- /* Assumes that we have the lock. */
- InterlockedExchange (&winapi_lock, 0);
-}
-
-static void __stdcall interrupt_setup (int sig, void *handler, DWORD retaddr,
- DWORD *retaddr_on_stack,
- struct sigaction& siga)
- __attribute__((regparm(3)));
-static void __stdcall
-interrupt_setup (int sig, void *handler, DWORD retaddr, DWORD *retaddr_on_stack,
- struct sigaction& siga)
-{
- sigsave.retaddr = retaddr;
- sigsave.retaddr_on_stack = retaddr_on_stack;
- /* FIXME: Not multi-thread aware */
- sigsave.newmask = myself->getsigmask () | siga.sa_mask | SIGTOMASK (sig);
- sigsave.sa_flags = siga.sa_flags;
- sigsave.func = (void (*)(int)) handler;
- sigsave.sig = sig;
- sigsave.saved_errno = -1; // Flag: no errno to save
- if (handler == sig_handle_tty_stop)
- {
- myself->stopsig = 0;
- myself->process_state |= PID_STOPPED;
- }
- /* Clear any waiting threads prior to dispatching to handler function */
- proc_subproc (PROC_CLEARWAIT, 1);
- int res = SetEvent (signal_arrived); // For an EINTR case
- sigproc_printf ("armed signal_arrived %p, res %d", signal_arrived, res);
-}
-
-static bool interrupt_now (CONTEXT *, int, void *, struct sigaction&) __attribute__((regparm(3)));
-static bool
-interrupt_now (CONTEXT *ctx, int sig, void *handler, struct sigaction& siga)
-{
- interrupt_setup (sig, handler, ctx->Eip, 0, siga);
- ctx->Eip = (DWORD) sigdelayed;
- SetThreadContext (myself->getthread2signal (), ctx); /* Restart the thread in a new location */
- return 1;
-}
-
-void __stdcall
-signal_fixup_after_fork ()
-{
- if (!sigsave.sig)
- return;
-
- sigsave.sig = 0;
- if (sigsave.retaddr_on_stack)
- {
- *sigsave.retaddr_on_stack = sigsave.retaddr;
- set_process_mask (sigsave.oldmask);
- }
-}
-
-void __stdcall
-signal_fixup_after_exec (bool isspawn)
-{
- /* Set up child's signal handlers */
- for (int i = 0; i < NSIG; i++)
- {
- myself->getsig(i).sa_mask = 0;
- if (myself->getsig(i).sa_handler != SIG_IGN || isspawn)
- myself->getsig(i).sa_handler = SIG_DFL;
- }
-}
-
-static int interrupt_on_return (sigthread *, int, void *, struct sigaction&) __attribute__((regparm(3)));
-static int
-interrupt_on_return (sigthread *th, int sig, void *handler, struct sigaction& siga)
-{
- int i;
- DWORD ebp = th->frame;
-
- if (!ebp)
- return 0;
-
- thestack.init (ebp, 0, 1); /* Initialize from the input CONTEXT */
- for (i = 0; i < 32 && thestack++ ; i++)
- if (th->exception || interruptible (thestack.sf.AddrReturn.Offset))
- {
- DWORD *addr_retaddr = ((DWORD *)thestack.sf.AddrFrame.Offset) + 1;
- if (*addr_retaddr == thestack.sf.AddrReturn.Offset)
- {
- interrupt_setup (sig, handler, *addr_retaddr, addr_retaddr, siga);
- *addr_retaddr = (DWORD) sigdelayed;
- }
- return 1;
- }
-
- sigproc_printf ("couldn't find a stack frame, i %d\n", i);
- return 0;
-}
-
-extern "C" void __stdcall
-set_sig_errno (int e)
-{
- set_errno (e);
- sigsave.saved_errno = e;
- // sigproc_printf ("errno %d", e);
-}
-
-static int setup_handler (int, void *, struct sigaction&) __attribute__((regparm(3)));
-static int
-setup_handler (int sig, void *handler, struct sigaction& siga)
-{
- CONTEXT cx;
- bool interrupted = 0;
- HANDLE hth = NULL;
- int res;
- sigthread *th = NULL; // Initialization needed to shut up gcc
-
- if (sigsave.sig)
- goto set_pending;
-
- for (int i = 0; !interrupted && i < CALL_HANDLER_RETRY; i++)
- {
- EnterCriticalSection (&mainthread.lock);
- if (mainthread.frame)
- th = &mainthread;
- else
- {
- LeaveCriticalSection (&mainthread.lock);
-
- th = NULL;
-
- hth = myself->getthread2signal ();
-
- /* Suspend the thread which will receive the signal. But first ensure that
- this thread doesn't have any mutos. (FIXME: Someday we should just grab
- all of the mutos rather than checking for them)
- For Windows 95, we also have to ensure that the addresses returned by GetThreadContext
- are valid.
- If one of these conditions is not true we loop for a fixed number of times
- since we don't want to stall the signal handler. FIXME: Will this result in
- noticeable delays?
- If the thread is already suspended (which can occur when a program is stopped) then
- just queue the signal. */
-
- if (!mainthread.get_winapi_lock (1))
- continue;
- sigproc_printf ("suspending mainthread");
- res = SuspendThread (hth);
- mainthread.release_winapi_lock ();
- if (mainthread.frame)
- goto resume_thread; /* In case the main thread *just* set the frame */
-
- /* Just set pending if thread is already suspended */
- if (res)
- goto set_pending;
-
- muto *m;
- /* FIXME: Make multi-thread aware */
- for (m = muto_start.next; m != NULL; m = m->next)
- if (m->unstable () || m->owner () == mainthread.id)
- {
- sigproc_printf ("suspended thread owns a muto (%s)", m->name);
- goto resume_thread;
- }
-
- EnterCriticalSection (&mainthread.lock);
- if (mainthread.frame)
- {
- th = &mainthread;
- goto try_to_interrupt;
- }
-
- LeaveCriticalSection (&mainthread.lock);
-
- cx.ContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER;
- if (!GetThreadContext (hth, &cx))
- system_printf ("couldn't get context of main thread, %E");
- else if (!interruptible (cx.Eip, 1))
- sigproc_printf ("suspended thread in a strange state pc %p, sp %p",
- cx.Eip, cx.Esp);
- else
- goto try_to_interrupt;
-
- resume_thread:
- ResumeThread (hth);
- Sleep (0);
- continue;
- }
-
- try_to_interrupt:
- if (th)
- {
- interrupted = interrupt_on_return (th, sig, handler, siga);
- LeaveCriticalSection (&th->lock);
- }
- else if (interruptible (cx.Eip))
- interrupted = interrupt_now (&cx, sig, handler, siga);
- else
- break;
- }
-
- set_pending:
- if (interrupted)
- res = 1;
- else
- {
- pending_signals = 1; /* FIXME: Probably need to be more tricky here */
- sig_set_pending (sig);
- sig_dispatch_pending (1);
- Sleep (0); /* Hopefully, other process will be waking up soon. */
- sigproc_printf ("couldn't send signal %d", sig);
- }
-
- if (!hth)
- sigproc_printf ("good. Didn't suspend main thread, th %p", th);
- else
- {
- res = ResumeThread (hth);
- sigproc_printf ("ResumeThread returned %d", res);
- }
-
- sigproc_printf ("returning %d", interrupted);
- return interrupted;
-}
-#endif /* i386 */
-
-#ifndef HAVE_CALL_HANDLER
-#error "Need to supply machine dependent setup_handler"
-#endif
-
-/* Keyboard interrupt handler. */
-static BOOL WINAPI
-ctrl_c_handler (DWORD type)
-{
- if (type == CTRL_LOGOFF_EVENT)
- return TRUE;
-
- /* Return FALSE to prevent an "End task" dialog box from appearing
- for each Cygwin process window that's open when the computer
- is shut down or console window is closed. */
- if (type == CTRL_SHUTDOWN_EVENT)
- {
- sig_send (NULL, SIGTERM);
- return FALSE;
- }
- if (type == CTRL_CLOSE_EVENT)
- {
- sig_send (NULL, SIGHUP);
- return FALSE;
- }
-
- /* If we are a stub and the new process has a pinfo structure, let it
- handle this signal. */
- if (dwExeced && pinfo (dwExeced))
- return TRUE;
-
- /* We're only the process group leader when we have a valid pinfo structure.
- If we don't have one, then the parent "stub" will handle the signal. */
- if (!pinfo (cygwin_pid (GetCurrentProcessId ())))
- return TRUE;
-
- tty_min *t = cygwin_shared->tty.get_tty (myself->ctty);
- /* Ignore this if we're not the process group leader since it should be handled
- *by* the process group leader. */
- if (myself->ctty != -1 && t->getpgid () == myself->pid &&
- (GetTickCount () - t->last_ctrl_c) >= MIN_CTRL_C_SLOP)
- /* Otherwise we just send a SIGINT to the process group and return TRUE (to indicate
- that we have handled the signal). At this point, type should be
- a CTRL_C_EVENT or CTRL_BREAK_EVENT. */
- {
- t->last_ctrl_c = GetTickCount ();
- kill (-myself->pid, SIGINT);
- t->last_ctrl_c = GetTickCount ();
- return TRUE;
- }
-
- return TRUE;
-}
-
-/* Set the signal mask for this process.
- Note that some signals are unmaskable, as in UNIX. */
-extern "C" void __stdcall
-set_process_mask (sigset_t newmask)
-{
- sigframe thisframe (mainthread);
- mask_sync->acquire (INFINITE);
- sigset_t oldmask = myself->getsigmask ();
- newmask &= ~SIG_NONMASKABLE;
- sigproc_printf ("old mask = %x, new mask = %x", myself->getsigmask (), newmask);
- myself->setsigmask (newmask); // Set a new mask
- mask_sync->release ();
- if (oldmask != newmask && GetCurrentThreadId () != sigtid)
- sig_dispatch_pending ();
- else
- sigproc_printf ("not calling sig_dispatch_pending. sigtid %p current %p",
- sigtid, GetCurrentThreadId ());
- return;
-}
-
-int __stdcall
-sig_handle (int sig, bool thisproc)
-{
- int rc = 0;
-
- sigproc_printf ("signal %d", sig);
-
- struct sigaction thissig = myself->getsig (sig);
- void *handler = (void *) thissig.sa_handler;
-
- myself->rusage_self.ru_nsignals++;
-
- /* Clear pending SIGCONT on stop signals */
- if (sig == SIGSTOP || sig == SIGTSTP || sig == SIGTTIN || sig == SIGTTOU)
- sig_clear (SIGCONT);
-
- if (sig == SIGKILL)
- goto exit_sig;
-
- if (sig == SIGSTOP)
- goto stop;
-
- /* FIXME: Should we still do this if SIGCONT has a handler? */
- if (sig == SIGCONT)
- {
- myself->stopsig = 0;
- myself->process_state &= ~PID_STOPPED;
- /* Clear pending stop signals */
- sig_clear (SIGSTOP);
- sig_clear (SIGTSTP);
- sig_clear (SIGTTIN);
- sig_clear (SIGTTOU);
- /* Windows 95 hangs on resuming non-suspended thread */
- SuspendThread (hMainThread);
- while (ResumeThread (hMainThread) > 1)
- ;
- /* process pending signals */
- sig_dispatch_pending (1);
- }
-
-#if 0
- char sigmsg[24];
- __small_sprintf (sigmsg, "cygwin: signal %d\n", sig);
- OutputDebugString (sigmsg);
-#endif
-
- if (handler == (void *) SIG_DFL)
- {
- if (sig == SIGCHLD || sig == SIGIO || sig == SIGCONT || sig == SIGWINCH
- || sig == SIGURG || (thisproc && hExeced && sig == SIGINT))
- {
- sigproc_printf ("default signal %d ignored", sig);
- goto done;
- }
-
- if (sig == SIGTSTP || sig == SIGTTIN || sig == SIGTTOU)
- goto stop;
-
- goto exit_sig;
- }
-
- if (handler == (void *) SIG_IGN)
- {
- sigproc_printf ("signal %d ignored", sig);
- goto done;
- }
-
- if (handler == (void *) SIG_ERR)
- goto exit_sig;
-
- goto dosig;
-
- stop:
- /* Eat multiple attempts to STOP */
- if (ISSTATE (myself, PID_STOPPED))
- goto done;
- handler = (void *) sig_handle_tty_stop;
- thissig = myself->getsig (SIGSTOP);
-
- dosig:
- /* Dispatch to the appropriate function. */
- sigproc_printf ("signal %d, about to call %p", sig, handler);
- rc = setup_handler (sig, handler, thissig);
-
- done:
- sigproc_printf ("returning %d", rc);
- return rc;
-
- exit_sig:
- if (sig == SIGQUIT || sig == SIGABRT)
- {
- CONTEXT c;
- c.ContextFlags = CONTEXT_FULL;
- GetThreadContext (hMainThread, &c);
- if (!try_to_debug ())
- stackdump (c.Ebp, 1, 1);
- sig |= 0x80;
- }
- sigproc_printf ("signal %d, about to call do_exit", sig);
- signal_exit (sig);
- /* Never returns */
-}
-
-/* Cover function to `do_exit' to handle exiting even in presence of more
- exceptions. We used to call exit, but a SIGSEGV shouldn't cause atexit
- routines to run. */
-static void
-signal_exit (int rc)
-{
- rc = EXIT_SIGNAL | (rc << 8);
- if (exit_already++)
- myself->exit (rc);
-
- /* We'd like to stop the main thread from executing but when we do that it
- causes random, inexplicable hangs. So, instead, we set up the priority
- of this thread really high so that it should do its thing and then exit. */
- (void) SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_TIME_CRITICAL);
- (void) SetThreadPriority (hMainThread, THREAD_PRIORITY_IDLE);
-
- /* Unlock any main thread mutos since we're executing with prejudice. */
- muto *m;
- for (m = muto_start.next; m != NULL; m = m->next)
- if (m->unstable () || m->owner () == mainthread.id)
- m->reset ();
-
- user_data->resourcelocks->Delete ();
- user_data->resourcelocks->Init ();
-
- if (hExeced)
- TerminateProcess (hExeced, rc);
-
- sigproc_printf ("about to call do_exit (%x)", rc);
- do_exit (rc);
-}
-
-HANDLE NO_COPY title_mutex = NULL;
-
-void
-events_init (void)
-{
- /* title_mutex protects modification of console title. It's neccessary
- while finding console window handle */
-
- if (!(title_mutex = CreateMutex (&sec_all_nih, FALSE,
- shared_name ("title_mutex", 0))))
- api_fatal ("can't create title mutex, %E");
-
- ProtectHandle (title_mutex);
- new_muto (mask_sync);
- windows_system_directory[0] = '\0';
- (void) GetSystemDirectory (windows_system_directory, sizeof (windows_system_directory) - 2);
- char *end = strchr (windows_system_directory, '\0');
- if (end == windows_system_directory)
- api_fatal ("can't find windows system directory");
- if (end[-1] != '\\')
- {
- *end++ = '\\';
- *end = '\0';
- }
- windows_system_directory_length = end - windows_system_directory;
- debug_printf ("windows_system_directory '%s', windows_system_directory_length %d",
- windows_system_directory, windows_system_directory_length);
- debug_printf ("cygwin_hmodule %p", cygwin_hmodule);
-}
-
-void
-events_terminate (void)
-{
- ForceCloseHandle (title_mutex);
- exit_already = 1;
-}
-
-extern "C" {
-static int __stdcall
-call_signal_handler_now ()
-{
- if (!sigsave.sig)
- {
- sigproc_printf ("call_signal_handler_now called when no signal active");
- return 0;
- }
-
- int sa_flags = sigsave.sa_flags;
- sigproc_printf ("sa_flags %p", sa_flags);
- *sigsave.retaddr_on_stack = sigsave.retaddr;
- sigdelayed0 ();
- return sa_flags & SA_RESTART;
-}
-/* This kludge seems to keep a copy of call_signal_handler_now around
- even when compiling with -finline-functions. */
-static int __stdcall call_signal_handler_now_dummy ()
- __attribute__((alias ("call_signal_handler_now")));
-};
-
-int
-sigframe::call_signal_handler ()
-{
- return unregister () ? call_signal_handler_now () : 0;
-
-}
-
-#define pid_offset (unsigned)(((_pinfo *)NULL)->pid)
-extern "C" {
-void __stdcall
-reset_signal_arrived ()
-{
- (void) ResetEvent (signal_arrived);
- sigproc_printf ("reset signal_arrived");
-}
-
-void unused_sig_wrapper ()
-{
-/* Signal cleanup stuff. Cleans up stack (too bad that we didn't
- prototype signal handlers as __stdcall), calls _set_process_mask
- to restore any mask, restores any potentially clobbered registers
- and returns to original caller. */
-__asm__ volatile ("\n\
- .text \n\
-_sigreturn: \n\
- addl $4,%%esp # Remove argument \n\
- movl %%esp,%%ebp \n\
- addl $36,%%ebp \n\
- call _set_process_mask@4 \n\
- \n\
- cmpl $0,%4 # Did a signal come in? \n\
- jz 1f # No, if zero \n\
- call _call_signal_handler_now@0 # yes handle the signal \n\
- \n\
-1: popl %%eax # saved errno \n\
- testl %%eax,%%eax # Is it < 0 \n\
- jl 2f # yup. ignore it \n\
- movl %1,%%ebx \n\
- movl %%eax,(%%ebx) \n\
-2: popl %%eax \n\
- popl %%ebx \n\
- popl %%ecx \n\
- popl %%edx \n\
- popl %%edi \n\
- popl %%esi \n\
- popf \n\
- popl %%ebp \n\
- ret \n\
- \n\
-__no_sig_start: \n\
-_sigdelayed: \n\
- pushl %2 # original return address \n\
-_sigdelayed0: \n\
- pushl %%ebp \n\
- movl %%esp,%%ebp \n\
- pushf \n\
- pushl %%esi \n\
- pushl %%edi \n\
- pushl %%edx \n\
- pushl %%ecx \n\
- pushl %%ebx \n\
- pushl %%eax \n\
- pushl %6 # saved errno \n\
- pushl %3 # oldmask \n\
- pushl %4 # signal argument \n\
- pushl $_sigreturn \n\
- \n\
- call _reset_signal_arrived@0 \n\
- pushl %5 # signal number \n\
- pushl %7 # newmask \n\
- movl $0,%0 # zero the signal number as a \n\
- # flag to the signal handler thread\n\
- # that it is ok to set up sigsave\n\
- \n\
- call _set_process_mask@4 \n\
- popl %%eax \n\
- jmp *%%eax \n\
-__no_sig_end: \n\
-" : "=m" (sigsave.sig) : "m" (&_impure_ptr->_errno),
- "g" (sigsave.retaddr), "g" (sigsave.oldmask), "g" (sigsave.sig),
- "g" (sigsave.func), "g" (sigsave.saved_errno), "g" (sigsave.newmask)
-);
-}
-}
diff --git a/winsup/cygwin/exec.cc b/winsup/cygwin/exec.cc
deleted file mode 100644
index 942b79d83..000000000
--- a/winsup/cygwin/exec.cc
+++ /dev/null
@@ -1,98 +0,0 @@
-/* exec.cc: exec system call support.
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <process.h>
-#include "perprocess.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "pinfo.h"
-#include "environ.h"
-#include "cygerrno.h"
-
-/* This is called _execve and not execve because the real execve is defined
- in libc/posix/execve.c. It calls us. */
-
-extern "C" int
-_execve (const char *path, char *const argv[], char *const envp[])
-{
- static char *const empty_env[] = { 0 };
- MALLOC_CHECK;
- if (!envp)
- envp = empty_env;
- return spawnve (_P_OVERLAY, path, argv, envp);
-}
-
-extern "C" int
-execl (const char *path, const char *arg0, ...)
-{
- int i;
- va_list args;
- const char *argv[1024];
-
- va_start (args, arg0);
- argv[0] = arg0;
- i = 1;
- do
- argv[i] = va_arg (args, const char *);
- while (argv[i++] != NULL);
- va_end (args);
- MALLOC_CHECK;
- return _execve (path, (char * const *) argv, cur_environ ());
-}
-
-extern "C" int
-execv (const char *path, char * const *argv)
-{
- MALLOC_CHECK;
- return _execve (path, (char * const *) argv, cur_environ ());
-}
-
-extern "C" pid_t
-sexecve_is_bad ()
-{
- set_errno (ENOSYS);
- return 0;
-}
-
-/*
- * Copy string, until c or <nul> is encountered.
- * NUL-terminate the destination string (s1).
- * Return pointer to terminating byte in dst string.
- */
-
-char * __stdcall
-strccpy (char *s1, const char **s2, char c)
-{
- while (**s2 && **s2 != c)
- *s1++ = *((*s2)++);
- *s1 = 0;
-
- MALLOC_CHECK;
- return s1;
-}
-
-extern "C" int
-execvp (const char *path, char * const *argv)
-{
- path_conv buf;
- return execv (find_exec (path, buf), argv);
-}
-
-extern "C" int
-execvpe (const char *path, char * const *argv, char *const *envp)
-{
- path_conv buf;
- return execve (find_exec (path, buf), argv, envp);
-}
diff --git a/winsup/cygwin/external.cc b/winsup/cygwin/external.cc
deleted file mode 100644
index bc61027a0..000000000
--- a/winsup/cygwin/external.cc
+++ /dev/null
@@ -1,247 +0,0 @@
-/* external.cc: Interface to Cygwin internals from external programs.
-
- Copyright 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-
- Written by Christopher Faylor <cgf@cygnus.com>
-
-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 "winsup.h"
-#include <errno.h>
-#include "security.h"
-#include "fhandler.h"
-#include "sigproc.h"
-#include "pinfo.h"
-#include <exceptions.h>
-#include "shared_info.h"
-#include "cygwin_version.h"
-#include "perprocess.h"
-#include "cygerrno.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygheap.h"
-#include "wincap.h"
-#include "heap.h"
-
-static external_pinfo *
-fillout_pinfo (pid_t pid, int winpid)
-{
- BOOL nextpid;
- static external_pinfo ep;
-
- if ((nextpid = !!(pid & CW_NEXTPID)))
- pid ^= CW_NEXTPID;
-
- static winpids pids (0);
-
- static unsigned int i;
- if (!pids.npids || !nextpid)
- {
- pids.init (winpid);
- i = 0;
- }
-
- if (!pid)
- i = 0;
-
- memset (&ep, 0, sizeof ep);
- while (i < pids.npids)
- {
- DWORD thispid = pids.winpid (i);
- _pinfo *p = pids[i];
- i++;
-
- if (!p)
- {
- if (!nextpid && thispid != (DWORD) pid)
- continue;
- ep.pid = cygwin_pid (thispid);
- ep.dwProcessId = thispid;
- ep.process_state = PID_IN_USE;
- ep.ctty = -1;
- break;
- }
- else if (nextpid || p->pid == pid || (winpid && thispid == (DWORD) pid))
- {
- ep.ctty = p->ctty;
- ep.pid = p->pid;
- ep.ppid = p->ppid;
- ep.hProcess = p->hProcess;
- ep.dwProcessId = p->dwProcessId;
- ep.uid = p->uid;
- ep.gid = p->gid;
- ep.pgid = p->pgid;
- ep.sid = p->sid;
- ep.umask = 0;
- ep.start_time = p->start_time;
- ep.rusage_self = p->rusage_self;
- ep.rusage_children = p->rusage_children;
- strcpy (ep.progname, p->progname);
- ep.strace_mask = 0;
- ep.version = EXTERNAL_PINFO_VERSION;
-
- ep.process_state = p->process_state;
-
- ep.uid32 = p->uid;
- ep.gid32 = p->gid;
- break;
- }
- }
-
- if (!ep.pid)
- {
- i = 0;
- pids.reset ();
- return 0;
- }
- return &ep;
-}
-
-static DWORD
-get_cygdrive_info (char *user, char *system, char *user_flags,
- char *system_flags)
-{
- int res = mount_table->get_cygdrive_info (user, system, user_flags,
- system_flags);
- return (res == ERROR_SUCCESS) ? 1 : 0;
-}
-
-static DWORD
-get_cygdrive_prefixes (char *user, char *system)
-{
- char user_flags[MAX_PATH];
- char system_flags[MAX_PATH];
- DWORD res = get_cygdrive_info (user, system, user_flags, system_flags);
- return res;
-}
-
-extern "C" DWORD
-cygwin_internal (cygwin_getinfo_types t, ...)
-{
- va_list arg;
- va_start (arg, t);
- if (t != CW_USER_DATA)
- {
- wincap.init ();
- if (!myself)
- {
- memory_init ();
- malloc_init ();
- set_myself (1);
- }
- }
-
- switch (t)
- {
- case CW_LOCK_PINFO:
- return 1;
-
- case CW_UNLOCK_PINFO:
- return 1;
-
- case CW_GETTHREADNAME:
- return (DWORD) threadname (va_arg (arg, DWORD));
-
- case CW_SETTHREADNAME:
- {
- char *name = va_arg (arg, char *);
- regthread (name, va_arg (arg, DWORD));
- return 1;
- }
-
- case CW_GETPINFO:
- return (DWORD) fillout_pinfo (va_arg (arg, DWORD), 0);
-
- case CW_GETVERSIONINFO:
- return (DWORD) cygwin_version_strings;
-
- case CW_READ_V1_MOUNT_TABLES:
- set_errno (ENOSYS);
- return 1;
-
- case CW_USER_DATA:
- return (DWORD) &__cygwin_user_data;
-
- case CW_PERFILE:
- perfile_table = va_arg (arg, struct __cygwin_perfile *);
- return 0;
-
- case CW_GET_CYGDRIVE_PREFIXES:
- {
- char *user = va_arg (arg, char *);
- char *system = va_arg (arg, char *);
- return get_cygdrive_prefixes (user, system);
- }
-
- case CW_GETPINFO_FULL:
- return (DWORD) fillout_pinfo (va_arg (arg, pid_t), 1);
-
- case CW_INIT_EXCEPTIONS:
- init_exceptions ((exception_list *) arg);
- return 0;
-
- case CW_GET_CYGDRIVE_INFO:
- {
- char *user = va_arg (arg, char *);
- char *system = va_arg (arg, char *);
- char *user_flags = va_arg (arg, char *);
- char *system_flags = va_arg (arg, char *);
- return get_cygdrive_info (user, system, user_flags, system_flags);
- }
-
- case CW_SET_CYGWIN_REGISTRY_NAME:
- {
-# define cr ((char *) arg)
- if (check_null_empty_str_errno (cr))
- return (DWORD) NULL;
- cygheap->cygwin_regname = (char *) crealloc (cygheap->cygwin_regname,
- strlen (cr) + 1);
- strcpy (cygheap->cygwin_regname, cr);
- case CW_GET_CYGWIN_REGISTRY_NAME:
- return (DWORD) cygheap->cygwin_regname;
-# undef cr
- }
-
- case CW_STRACE_TOGGLE:
- {
- pid_t pid = va_arg (arg, pid_t);
- pinfo p (pid);
- if (p)
- {
- sig_send (p, __SIGSTRACE);
- return 0;
- }
- else
- {
- set_errno (ESRCH);
- return (DWORD) -1;
- }
- }
-
- case CW_STRACE_ACTIVE:
- {
- return strace.active;
- }
-
- case CW_CYGWIN_PID_TO_WINPID:
- {
- pinfo p (va_arg (arg, pid_t));
- return p ? p->dwProcessId : 0;
- }
- case CW_EXTRACT_DOMAIN_AND_USER:
- {
- struct passwd *pw = va_arg (arg, struct passwd *);
- char *domain = va_arg (arg, char *);
- char *user = va_arg (arg, char *);
- extract_nt_dom_user (pw, domain, user);
- return 0;
- }
- default:
- return (DWORD) -1;
- }
-}
diff --git a/winsup/cygwin/external.sgml b/winsup/cygwin/external.sgml
deleted file mode 100644
index 270eede4d..000000000
--- a/winsup/cygwin/external.sgml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-<sect1 id="func-cygwin-internal">
-<title>cygwin_internal</title>
-
-<funcsynopsis>
-<funcdef>extern "C" DWORD
-<function>cygwin_internal</function></funcdef>
-<paramdef>cygwin_getinfo_types <parameter>t</parameter></paramdef>
-<paramdef><parameter>...</parameter></paramdef>
-</funcsynopsis>
-
-<para>This function gives you access to various internal data and functions.
-It takes two arguments. The first argument is a type from the 'cygwin_getinfo_types'
-enum. The second is an optional pointer.</para>
-<para>Stay away unless you know what you're doing.</para>
-
-</sect1>
-
diff --git a/winsup/cygwin/fcntl.cc b/winsup/cygwin/fcntl.cc
deleted file mode 100644
index 0ba704991..000000000
--- a/winsup/cygwin/fcntl.cc
+++ /dev/null
@@ -1,49 +0,0 @@
-/* fcntl.cc: fcntl syscall
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <stdarg.h>
-#include <errno.h>
-#include <unistd.h>
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygerrno.h"
-#include "cygheap.h"
-#include "thread.h"
-
-extern "C"
-int
-_fcntl (int fd, int cmd,...)
-{
- void *arg = NULL;
- va_list args;
- int res;
-
- cygheap_fdget cfd (fd, true);
- if (cfd < 0)
- {
- res = -1;
- goto done;
- }
-
- va_start (args, cmd);
- arg = va_arg (args, void *);
- if (cmd != F_DUPFD)
- res = cfd->fcntl(cmd, arg);
- else
- res = dup2 (fd, cygheap_fdnew (((int) arg) - 1));
- va_end (args);
-
-done:
- syscall_printf ("%d = fcntl (%d, %d, %p)", res, fd, cmd, arg);
- return res;
-}
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
deleted file mode 100644
index 1ccc93d7e..000000000
--- a/winsup/cygwin/fhandler.cc
+++ /dev/null
@@ -1,1163 +0,0 @@
-/* fhandler.cc. See console.cc for fhandler_console functions.
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/cygwin.h>
-#include <signal.h>
-#include "cygerrno.h"
-#include "perprocess.h"
-#include "security.h"
-#include "cygwin/version.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygheap.h"
-#include "shared_info.h"
-#include "pinfo.h"
-#include <assert.h>
-#include <limits.h>
-
-static NO_COPY const int CHUNK_SIZE = 1024; /* Used for crlf conversions */
-
-struct __cygwin_perfile *perfile_table;
-
-DWORD binmode;
-
-inline fhandler_base&
-fhandler_base::operator =(fhandler_base &x)
-{
- memcpy (this, &x, sizeof *this);
- unix_path_name = x.unix_path_name ? cstrdup (x.unix_path_name) : NULL;
- win32_path_name = x.win32_path_name ? cstrdup (x.win32_path_name) : NULL;
- rabuf = NULL;
- ralen = 0;
- raixget = 0;
- raixput = 0;
- rabuflen = 0;
- return *this;
-}
-
-int
-fhandler_base::puts_readahead (const char *s, size_t len)
-{
- int success = 1;
- while ((*s || (len != (size_t) -1 && len--))
- && (success = put_readahead (*s++) > 0))
- continue;
- return success;
-}
-
-void
-fhandler_base::set_flags (int flags, int supplied_bin)
-{
- int bin;
- int fmode;
- debug_printf ("flags %p, supplied_bin %p", flags, supplied_bin);
- if ((bin = flags & (O_BINARY | O_TEXT)))
- debug_printf ("O_TEXT/O_BINARY set in flags %p", bin);
- else if (get_r_binset () && get_w_binset ())
- bin = get_r_binary () ? O_BINARY : O_TEXT; // FIXME: Not quite right
- else if (supplied_bin)
- bin = supplied_bin;
- else if ((fmode = get_default_fmode (flags)) & O_BINARY)
- bin = O_BINARY;
- else if (fmode & O_TEXT)
- bin = O_TEXT;
- else
- bin = get_w_binary () || get_r_binary () || (binmode != O_TEXT) ?
- O_BINARY : O_TEXT;
-
- openflags = flags | bin;
-
- set_r_binary (bin & O_BINARY);
- set_w_binary (bin & O_BINARY);
- syscall_printf ("filemode set to %s", bin ? "binary" : "text");
-}
-
-int
-fhandler_base::put_readahead (char value)
-{
- char *newrabuf;
- if (raixput < rabuflen)
- /* Nothing to do */;
- else if ((newrabuf = (char *) realloc (rabuf, rabuflen += 32)))
- rabuf = newrabuf;
- else
- return 0;
-
- rabuf[raixput++] = value;
- ralen++;
- return 1;
-}
-
-int
-fhandler_base::get_readahead ()
-{
- int chret = -1;
- if (raixget < ralen)
- chret = ((unsigned char) rabuf[raixget++]) & 0xff;
- /* FIXME - not thread safe */
- if (raixget >= ralen)
- raixget = raixput = ralen = 0;
- return chret;
-}
-
-int
-fhandler_base::peek_readahead (int queryput)
-{
- int chret = -1;
- if (!queryput && raixget < ralen)
- chret = ((unsigned char) rabuf[raixget]) & 0xff;
- else if (queryput && raixput > 0)
- chret = ((unsigned char) rabuf[raixput - 1]) & 0xff;
- return chret;
-}
-
-void
-fhandler_base::set_readahead_valid (int val, int ch)
-{
- if (!val)
- ralen = raixget = raixput = 0;
- if (ch != -1)
- put_readahead(ch);
-}
-
-int
-fhandler_base::eat_readahead (int n)
-{
- int oralen = ralen;
- if (n < 0)
- n = ralen;
- if (n > 0 && ralen)
- {
- if ((int) (ralen -= n) < 0)
- ralen = 0;
-
- if (raixget >= ralen)
- raixget = raixput = ralen = 0;
- else if (raixput > ralen)
- raixput = ralen;
- }
-
- return oralen;
-}
-
-int
-fhandler_base::get_readahead_into_buffer (char *buf, size_t buflen)
-{
- int ch;
- int copied_chars = 0;
-
- while (buflen)
- if ((ch = get_readahead ()) < 0)
- break;
- else
- {
- buf[copied_chars++] = (unsigned char)(ch & 0xff);
- buflen--;
- }
-
- return copied_chars;
-}
-
-/* Record the file name.
- Filenames are used mostly for debugging messages, and it's hoped that
- in cases where the name is really required, the filename wouldn't ever
- be too long (e.g. devices or some such).
- The unix_path_name is also used by virtual fhandlers. */
-void
-fhandler_base::set_name (const char *unix_path, const char *win32_path, int unit)
-{
- if (unix_path == NULL || !*unix_path)
- return;
-
- if (win32_path)
- win32_path_name = cstrdup (win32_path);
- else
- {
- const char *fmt = get_native_name ();
- char *w = (char *) cmalloc (HEAP_STR, strlen(fmt) + 16);
- __small_sprintf (w, fmt, unit);
- win32_path_name = w;
- }
-
- if (win32_path_name == NULL)
- {
- system_printf ("fatal error. strdup failed");
- exit (ENOMEM);
- }
-
- assert (unix_path_name == NULL);
- /* FIXME: This isn't really right. It ignores the first argument if we're
- building names for a device and just converts the device name from the
- win32 name since it has theoretically been previously detected by
- path_conv. Ideally, we should pass in a format string and build the
- unix_path, too. */
- if (!is_device () || *win32_path_name != '\\')
- unix_path_name = unix_path;
- else
- {
- char *p = cstrdup (win32_path_name);
- unix_path_name = p;
- while ((p = strchr (p, '\\')) != NULL)
- *p++ = '/';
- if (unix_path)
- cfree ((void *) unix_path);
- }
-
- if (unix_path_name == NULL)
- {
- system_printf ("fatal error. strdup failed");
- exit (ENOMEM);
- }
- namehash = hash_path_name (0, win32_path_name);
-}
-
-/* Detect if we are sitting at EOF for conditions where Windows
- returns an error but UNIX doesn't. */
-static int __stdcall
-is_at_eof (HANDLE h, DWORD err)
-{
- DWORD size, upper1, curr;
-
- size = GetFileSize (h, &upper1);
- if (upper1 != 0xffffffff || GetLastError () == NO_ERROR)
- {
- LONG upper2 = 0;
- curr = SetFilePointer (h, 0, &upper2, FILE_CURRENT);
- if (curr == size && upper1 == (DWORD) upper2)
- return 1;
- }
-
- SetLastError (err);
- return 0;
-}
-
-/* Normal file i/o handlers. */
-
-/* Cover function to ReadFile to achieve (as much as possible) Posix style
- semantics and use of errno. */
-int
-fhandler_base::raw_read (void *ptr, size_t ulen)
-{
- DWORD bytes_read;
-
- if (!ReadFile (get_handle(), ptr, ulen, &bytes_read, 0))
- {
- int errcode;
-
- /* Some errors are not really errors. Detect such cases here. */
-
- errcode = GetLastError ();
- switch (errcode)
- {
- case ERROR_BROKEN_PIPE:
- /* This is really EOF. */
- bytes_read = 0;
- break;
- case ERROR_MORE_DATA:
- /* `bytes_read' is supposedly valid. */
- break;
- case ERROR_NOACCESS:
- if (is_at_eof (get_handle (), errcode))
- return 0;
- case ERROR_INVALID_FUNCTION:
- case ERROR_INVALID_PARAMETER:
- if (openflags & O_DIROPEN)
- {
- set_errno (EISDIR);
- return -1;
- }
- default:
- syscall_printf ("ReadFile %s failed, %E", unix_path_name);
- __seterrno_from_win_error (errcode);
- return -1;
- break;
- }
- }
-
- return bytes_read;
-}
-
-/* Cover function to WriteFile to provide Posix interface and semantics
- (as much as possible). */
-int
-fhandler_base::raw_write (const void *ptr, size_t len)
-{
- DWORD bytes_written;
-
- if (!WriteFile (get_handle(), ptr, len, &bytes_written, 0))
- {
- if (GetLastError () == ERROR_DISK_FULL && bytes_written > 0)
- return bytes_written;
- __seterrno ();
- if (get_errno () == EPIPE)
- raise (SIGPIPE);
- return -1;
- }
- return bytes_written;
-}
-
-#define ACCFLAGS(x) (x & (O_RDONLY | O_WRONLY | O_RDWR))
-int
-fhandler_base::get_default_fmode (int flags)
-{
- if (perfile_table)
- {
- size_t nlen = strlen (get_name ());
- unsigned accflags = ACCFLAGS (flags);
- for (__cygwin_perfile *pf = perfile_table; pf->name; pf++)
- if (!*pf->name && ACCFLAGS (pf->flags) == accflags)
- return pf->flags & ~(O_RDONLY | O_WRONLY | O_RDWR);
- else
- {
- size_t pflen = strlen (pf->name);
- const char *stem = get_name () + nlen - pflen;
- if (pflen > nlen || (stem != get_name () && !isdirsep (stem[-1])))
- continue;
- else if (ACCFLAGS (pf->flags) == accflags && strcasematch (stem, pf->name))
- return pf->flags & ~(O_RDONLY | O_WRONLY | O_RDWR);
- }
- }
- return __fmode;
-}
-
-/* Open system call handler function. */
-int
-fhandler_base::open (path_conv *pc, int flags, mode_t mode)
-{
- int res = 0;
- HANDLE x;
- int file_attributes;
- int shared;
- int creation_distribution;
- SECURITY_ATTRIBUTES sa = sec_none;
-
- syscall_printf ("(%s, %p) query_open %d", get_win32_name (), flags, get_query_open ());
-
- if (get_win32_name () == NULL)
- {
- set_errno (ENOENT);
- goto done;
- }
-
- if (get_query_open ())
- access = 0;
- else if (get_device () == FH_TAPE)
- access = GENERIC_READ | GENERIC_WRITE;
- else if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDONLY)
- access = GENERIC_READ;
- else if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_WRONLY)
- access = GENERIC_WRITE;
- else
- access = GENERIC_READ | GENERIC_WRITE;
-
- /* Allow reliable lseek on disk devices. */
- if (get_device () == FH_FLOPPY)
- access |= GENERIC_READ;
-
- /* FIXME: O_EXCL handling? */
-
- if ((flags & O_TRUNC) && ((flags & O_ACCMODE) != O_RDONLY))
- {
- if (flags & O_CREAT)
- creation_distribution = CREATE_ALWAYS;
- else
- creation_distribution = TRUNCATE_EXISTING;
- }
- else if (flags & O_CREAT)
- creation_distribution = OPEN_ALWAYS;
- else
- creation_distribution = OPEN_EXISTING;
-
- if ((flags & O_EXCL) && (flags & O_CREAT))
- creation_distribution = CREATE_NEW;
-
- if (flags & O_APPEND)
- set_append_p();
-
- /* These flags are host dependent. */
- shared = wincap.shared ();
-
- file_attributes = FILE_ATTRIBUTE_NORMAL;
- if (flags & O_DIROPEN)
- file_attributes |= FILE_FLAG_BACKUP_SEMANTICS;
- if (get_device () == FH_SERIAL)
- file_attributes |= FILE_FLAG_OVERLAPPED;
-
-#ifdef HIDDEN_DOT_FILES
- if (flags & O_CREAT && get_device () == FH_DISK)
- {
- char *c = strrchr (get_win32_name (), '\\');
- if ((c && c[1] == '.') || *get_win32_name () == '.')
- file_attributes |= FILE_ATTRIBUTE_HIDDEN;
- }
-#endif
-
- /* CreateFile() with dwDesiredAccess == 0 when called on remote
- share returns some handle, even if file doesn't exist. This code
- works around this bug. */
- if (get_query_open () && isremote () &&
- creation_distribution == OPEN_EXISTING && pc && !pc->exists ())
- {
- set_errno (ENOENT);
- goto done;
- }
-
- /* If mode has no write bits set, we set the R/O attribute. */
- if (!(mode & (S_IWUSR | S_IWGRP | S_IWOTH)))
- file_attributes |= FILE_ATTRIBUTE_READONLY;
-
- /* If the file should actually be created and ntsec is on,
- set files attributes. */
- if (flags & O_CREAT && get_device () == FH_DISK && allow_ntsec && has_acls ())
- set_security_attribute (mode, &sa, alloca (4096), 4096);
-
- x = CreateFile (get_win32_name (), access, shared, &sa, creation_distribution,
- file_attributes, 0);
-
- syscall_printf ("%p = CreateFileA (%s, %p, %p, %p, %p, %p, 0)",
- x, get_win32_name (), access, shared, &sa,
- creation_distribution, file_attributes);
-
- if (x == INVALID_HANDLE_VALUE)
- {
- if (GetLastError () == ERROR_INVALID_HANDLE)
- set_errno (ENOENT);
- else
- __seterrno ();
- goto done;
- }
-
- /* Attributes may be set only if a file is _really_ created.
- This code is now only used for ntea here since the files
- security attributes are set in CreateFile () now. */
- if (flags & O_CREAT && get_device () == FH_DISK
- && GetLastError () != ERROR_ALREADY_EXISTS
- && !allow_ntsec && allow_ntea)
- set_file_attribute (has_acls (), get_win32_name (), mode);
-
- set_io_handle (x);
- set_flags (flags, pc ? pc->binmode () : 0);
-
- res = 1;
- set_open_status ();
-done:
- syscall_printf ("%d = fhandler_base::open (%s, %p)", res, get_win32_name (),
- flags);
- return res;
-}
-
-/* states:
- open buffer in binary mode? Just do the read.
-
- open buffer in text mode? Scan buffer for control zs and handle
- the first one found. Then scan buffer, converting every \r\n into
- an \n. If last char is an \r, look ahead one more char, if \n then
- modify \r, if not, remember char.
-*/
-int
-fhandler_base::read (void *in_ptr, size_t in_len)
-{
- int len = (int) in_len;
- char *ptr = (char *) in_ptr;
-
- int c;
- int copied_chars = 0;
-
- while (len)
- if ((c = get_readahead ()) < 0)
- break;
- else
- {
- ptr[copied_chars++] = (unsigned char) (c & 0xff);
- len--;
- }
-
- if (copied_chars && is_slow ())
- return copied_chars;
-
- if (len)
- {
- int readlen = raw_read (ptr + copied_chars, len);
- if (copied_chars == 0)
- copied_chars = readlen; /* Propagate error or EOF */
- else if (readlen > 0) /* FIXME: should flag EOF for next read */
- copied_chars += readlen;
- }
-
- if (copied_chars <= 0)
- return copied_chars;
- if (get_r_binary ())
- {
- debug_printf ("returning %d chars, binary mode", copied_chars);
- return copied_chars;
- }
-
-#if 0
- char *ctrlzpos;
- /* Scan buffer for a control-z and shorten the buffer to that length */
-
- ctrlzpos = (char *) memchr ((char *) ptr, 0x1a, copied_chars);
- if (ctrlzpos)
- {
- lseek ((ctrlzpos - ((char *) ptr + copied_chars)), SEEK_CUR);
- copied_chars = ctrlzpos - (char *) ptr;
- }
-
- if (copied_chars == 0)
- {
- debug_printf ("returning 0 chars, text mode, CTRL-Z found");
- return 0;
- }
-#endif
-
- /* Scan buffer and turn \r\n into \n */
- register char *src = (char *) ptr;
- register char *dst = (char *) ptr;
- register char *end = src + copied_chars - 1;
-
- /* Read up to the last but one char - the last char needs special handling */
- while (src < end)
- {
- *dst = *src++;
- if (*dst != '\r' || *src != '\n')
- dst++;
- }
-
- c = *src;
- /* if last char is a '\r' then read one more to see if we should
- translate this one too */
- if (c == '\r')
- {
- char c1 = 0;
- len = raw_read (&c1, 1);
- if (len <= 0)
- /* nothing */;
- else if (c1 == '\n')
- c = '\n';
- else
- set_readahead_valid (1, c1);
- }
-
- *dst++ = c;
- copied_chars = dst - (char *) ptr;
-
-#ifndef NOSTRACE
- if (strace.active)
- {
- char buf[16 * 6 + 1];
- char *p = buf;
-
- for (int i = 0; i < copied_chars && i < 16; ++i)
- {
- unsigned char c = ((unsigned char *) ptr)[i];
- /* >= 33 so space prints in hex */
- __small_sprintf (p, c >= 33 && c <= 127 ? " %c" : " %p", c);
- p += strlen (p);
- }
- debug_printf ("read %d bytes (%s%s)", copied_chars, buf,
- copied_chars > 16 ? " ..." : "");
- }
-#endif
-
- debug_printf ("returning %d chars, text mode", copied_chars);
- return copied_chars;
-}
-
-int
-fhandler_base::write (const void *ptr, size_t len)
-{
- int res;
-
- if (get_append_p ())
- SetFilePointer (get_handle(), 0, 0, FILE_END);
- else if (wincap.has_lseek_bug () && get_check_win95_lseek_bug ())
- {
- /* Note: this bug doesn't happen on NT4, even though the documentation
- for WriteFile() says that it *may* happen on any OS. */
- int actual_length, current_position;
- set_check_win95_lseek_bug (0); /* don't do it again */
- actual_length = GetFileSize (get_handle (), NULL);
- current_position = SetFilePointer (get_handle (), 0, 0, FILE_CURRENT);
- if (current_position > actual_length)
- {
- /* Oops, this is the bug case - Win95 uses whatever is on the disk
- instead of some known (safe) value, so we must seek back and
- fill in the gap with zeros. - DJ */
- char zeros[512];
- int number_of_zeros_to_write = current_position - actual_length;
- memset(zeros, 0, 512);
- SetFilePointer (get_handle (), 0, 0, FILE_END);
- while (number_of_zeros_to_write > 0)
- {
- DWORD zeros_this_time = (number_of_zeros_to_write > 512
- ? 512 : number_of_zeros_to_write);
- DWORD written;
- if (!WriteFile (get_handle (), zeros, zeros_this_time, &written,
- NULL))
- {
- __seterrno ();
- if (get_errno () == EPIPE)
- raise (SIGPIPE);
- /* This might fail, but it's the best we can hope for */
- SetFilePointer (get_handle (), current_position, 0, FILE_BEGIN);
- return -1;
-
- }
- if (written < zeros_this_time) /* just in case */
- {
- set_errno (ENOSPC);
- /* This might fail, but it's the best we can hope for */
- SetFilePointer (get_handle (), current_position, 0, FILE_BEGIN);
- return -1;
- }
- number_of_zeros_to_write -= written;
- }
- }
- }
-
- if (get_w_binary ())
- {
- debug_printf ("binary write");
- res = raw_write (ptr, len);
- }
- else
- {
- debug_printf ("text write");
- /* This is the Microsoft/DJGPP way. Still not ideal, but it's
- compatible.
- Modified slightly by CGF 2000-10-07 */
-
- int left_in_data = len;
- char *data = (char *)ptr;
- res = 0;
-
- while (left_in_data > 0)
- {
- char buf[CHUNK_SIZE + 1], *buf_ptr = buf;
- int left_in_buf = CHUNK_SIZE;
-
- while (left_in_buf > 0 && left_in_data > 0)
- {
- char ch = *data++;
- if (ch == '\n')
- {
- *buf_ptr++ = '\r';
- left_in_buf--;
- }
- *buf_ptr++ = ch;
- left_in_buf--;
- left_in_data--;
- if (left_in_data > 0 && ch == '\r' && *data == '\n')
- {
- *buf_ptr++ = *data++;
- left_in_buf--;
- left_in_data--;
- }
- }
-
- /* We've got a buffer-full, or we're out of data. Write it out */
- int nbytes;
- int want = buf_ptr - buf;
- if ((nbytes = raw_write (buf, want)) == want)
- {
- /* Keep track of how much written not counting additional \r's */
- res = data - (char *)ptr;
- continue;
- }
-
- if (nbytes == -1)
- res = -1; /* Error */
- else
- res += nbytes; /* Partial write. Return total bytes written. */
- break; /* All done */
- }
- }
-
- debug_printf ("%d = write (%p, %d)", res, ptr, len);
- return res;
-}
-
-__off64_t
-fhandler_base::lseek (__off64_t offset, int whence)
-{
- __off64_t res;
-
- /* 9x/Me doesn't support 64bit offsets. We trap that here and return
- EINVAL. It doesn't make sense to simulate bigger offsets by a
- SetFilePointer sequence since FAT and FAT32 don't support file
- size >= 4GB anyway. */
- if (!wincap.has_64bit_file_access ()
- && (offset < LONG_MIN || offset > LONG_MAX))
- {
- debug_printf ("Win9x, offset not 32 bit.");
- set_errno (EINVAL);
- return (__off64_t)-1;
- }
-
- /* Seeks on text files is tough, we rewind and read till we get to the
- right place. */
-
- if (whence != SEEK_CUR || offset != 0)
- {
- if (whence == SEEK_CUR)
- offset -= ralen - raixget;
- set_readahead_valid (0);
- }
-
- debug_printf ("lseek (%s, %D, %d)", unix_path_name, offset, whence);
-
- DWORD win32_whence = whence == SEEK_SET ? FILE_BEGIN
- : (whence == SEEK_CUR ? FILE_CURRENT : FILE_END);
-
- LONG off_low = offset & 0xffffffff;
- LONG *poff_high, off_high;
- if (!wincap.has_64bit_file_access ())
- poff_high = NULL;
- else
- {
- off_high = offset >> 32;
- poff_high = &off_high;
- }
-
- debug_printf ("setting file pointer to %u (high), %u (low)", off_high, off_low);
- res = SetFilePointer (get_handle(), off_low, poff_high, win32_whence);
- if (res == INVALID_SET_FILE_POINTER && GetLastError ())
- {
- __seterrno ();
- }
- else
- {
- /* When next we write(), we will check to see if *this* seek went beyond
- the end of the file, and back-seek and fill with zeros if so - DJ */
- set_check_win95_lseek_bug ();
-
- /* If this was a SEEK_CUR with offset 0, we still might have
- readahead that we have to take into account when calculating
- the actual position for the application. */
- if (whence == SEEK_CUR)
- res -= ralen - raixget;
- }
-
- return res;
-}
-
-int
-fhandler_base::close ()
-{
- int res = -1;
-
- syscall_printf ("closing '%s' handle %p", get_name (), get_handle());
- if (CloseHandle (get_handle()))
- res = 0;
- else
- {
- paranoid_printf ("CloseHandle (%d <%s>) failed", get_handle(),
- get_name ());
-
- __seterrno ();
- }
- return res;
-}
-
-int
-fhandler_base::ioctl (unsigned int cmd, void *buf)
-{
- if (cmd == FIONBIO)
- syscall_printf ("ioctl (FIONBIO, %p)", buf);
- else
- syscall_printf ("ioctl (%x, %p)", cmd, buf);
-
- set_errno (EINVAL);
- return -1;
-}
-
-int
-fhandler_base::lock (int, struct flock *)
-{
- set_errno (ENOSYS);
- return -1;
-}
-
-extern "C" char * __stdcall
-rootdir(char *full_path)
-{
- /* Possible choices:
- * d:... -> d:/
- * \\server\share... -> \\server\share\
- * else current drive.
- */
- char *root = full_path;
-
- if (full_path[1] == ':')
- strcpy (full_path + 2, "\\");
- else if (full_path[0] == '\\' && full_path[1] == '\\')
- {
- char *cp = full_path + 2;
- while (*cp && *cp != '\\')
- cp++;
- if (!*cp)
- {
- set_errno (ENOTDIR);
- return NULL;
- }
- cp++;
- while (*cp && *cp != '\\')
- cp++;
- strcpy (cp, "\\");
- }
- else
- root = NULL;
-
- return root;
-}
-
-int __stdcall
-fhandler_base::fstat (struct __stat64 *buf, path_conv *)
-{
- switch (get_device ())
- {
- case FH_PIPEW:
- buf->st_mode = STD_WBITS | S_IWGRP | S_IWOTH;
- break;
- case FH_PIPER:
- buf->st_mode = STD_RBITS;
- break;
- default:
- buf->st_mode = STD_RBITS | STD_WBITS | S_IWGRP | S_IWOTH;
- break;
- }
-
- buf->st_mode |= get_device () == FH_FLOPPY ? S_IFBLK : S_IFCHR;
- buf->st_nlink = 1;
- buf->st_blksize = S_BLKSIZE;
- time_as_timestruc_t (&buf->st_ctim);
- buf->st_atim = buf->st_mtim = buf->st_ctim;
- return 0;
-}
-
-void
-fhandler_base::init (HANDLE f, DWORD a, mode_t bin)
-{
- set_io_handle (f);
- access = a;
- a &= GENERIC_READ | GENERIC_WRITE;
- int flags = 0;
- if (a == GENERIC_READ)
- flags = O_RDONLY;
- else if (a == GENERIC_WRITE)
- flags = O_WRONLY;
- else if (a == (GENERIC_READ | GENERIC_WRITE))
- flags = O_RDWR;
- set_flags (flags, bin);
- set_open_status ();
- debug_printf ("created new fhandler_base for handle %p, bin %d", f, get_r_binary ());
-}
-
-void
-fhandler_base::dump (void)
-{
- paranoid_printf ("here");
-}
-
-int
-fhandler_base::dup (fhandler_base *child)
-{
- debug_printf ("in fhandler_base dup");
-
- HANDLE nh;
- if (get_nohandle ())
- nh = NULL;
- else if (!DuplicateHandle (hMainProc, get_handle(), hMainProc, &nh, 0, TRUE,
- DUPLICATE_SAME_ACCESS))
- {
- system_printf ("dup(%s) failed, handle %x, %E",
- get_name (), get_handle());
- __seterrno ();
- return -1;
- }
-
- child->set_io_handle (nh);
- return 0;
-}
-
-int fhandler_base::fcntl (int cmd, void *arg)
-{
- int res;
-
- switch (cmd)
- {
- case F_GETFD:
- res = get_close_on_exec () ? FD_CLOEXEC : 0;
- break;
- case F_SETFD:
- set_close_on_exec ((int) arg);
- res = 0;
- break;
- case F_GETFL:
- res = get_flags ();
- debug_printf ("GETFL: %d", res);
- break;
- case F_SETFL:
- {
- /*
- * Only O_APPEND, O_ASYNC and O_NONBLOCK/O_NDELAY are allowed.
- * Each other flag will be ignored.
- * Since O_ASYNC isn't defined in fcntl.h it's currently
- * ignored as well.
- */
- const int allowed_flags = O_APPEND | O_NONBLOCK_MASK;
- int new_flags = (int) arg & allowed_flags;
- /* Carefully test for the O_NONBLOCK or deprecated OLD_O_NDELAY flag.
- Set only the flag that has been passed in. If both are set, just
- record O_NONBLOCK. */
- if ((new_flags & OLD_O_NDELAY) && (new_flags & O_NONBLOCK))
- new_flags = O_NONBLOCK;
- set_flags ((get_flags () & ~allowed_flags) | new_flags);
- }
- res = 0;
- break;
- case F_GETLK:
- case F_SETLK:
- case F_SETLKW:
- res = lock (cmd, (struct flock *) arg);
- break;
- default:
- set_errno (EINVAL);
- res = -1;
- break;
- }
- return res;
-}
-
-/* Base terminal handlers. These just return errors. */
-
-int
-fhandler_base::tcflush (int)
-{
- set_errno (ENOTTY);
- return -1;
-}
-
-int
-fhandler_base::tcsendbreak (int)
-{
- set_errno (ENOTTY);
- return -1;
-}
-
-int
-fhandler_base::tcdrain (void)
-{
- set_errno (ENOTTY);
- return -1;
-}
-
-int
-fhandler_base::tcflow (int)
-{
- set_errno (ENOTTY);
- return -1;
-}
-
-int
-fhandler_base::tcsetattr (int, const struct termios *)
-{
- set_errno (ENOTTY);
- return -1;
-}
-
-int
-fhandler_base::tcgetattr (struct termios *)
-{
- set_errno (ENOTTY);
- return -1;
-}
-
-int
-fhandler_base::tcsetpgrp (const pid_t)
-{
- set_errno (ENOTTY);
- return -1;
-}
-
-int
-fhandler_base::tcgetpgrp (void)
-{
- set_errno (ENOTTY);
- return -1;
-}
-
-void
-fhandler_base::operator delete (void *p)
-{
- cfree (p);
- return;
-}
-
-/* Normal I/O constructor */
-fhandler_base::fhandler_base (DWORD devtype, int unit):
- status (devtype),
- access (0),
- io_handle (NULL),
- namehash (0),
- openflags (0),
- rabuf (NULL),
- ralen (0),
- raixget (0),
- raixput (0),
- rabuflen (0),
- unix_path_name (NULL),
- win32_path_name (NULL),
- open_status (0)
-{
-}
-
-/* Normal I/O destructor */
-fhandler_base::~fhandler_base (void)
-{
- if (unix_path_name != NULL)
- cfree ((void *) unix_path_name);
- if (win32_path_name != NULL)
- cfree ((void *) win32_path_name);
- if (rabuf)
- free (rabuf);
- unix_path_name = win32_path_name = NULL;
-}
-
-/**********************************************************************/
-/* /dev/null */
-
-fhandler_dev_null::fhandler_dev_null () :
- fhandler_base (FH_NULL)
-{
-}
-
-void
-fhandler_dev_null::dump (void)
-{
- paranoid_printf ("here");
-}
-
-void
-fhandler_base::set_inheritance (HANDLE &h, int not_inheriting)
-{
-#ifdef DEBUGGING
- HANDLE oh = h;
-#endif
- /* Note that we could use SetHandleInformation here but it is not available
- on all platforms. Test cases seem to indicate that using DuplicateHandle
- in this fashion does not actually close the original handle, which is
- what we want. If this changes in the future, we may be forced to use
- SetHandleInformation on newer OS's */
- if (!DuplicateHandle (hMainProc, h, hMainProc, &h, 0, !not_inheriting,
- DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
- debug_printf ("DuplicateHandle failed, %E");
-#ifdef DEBUGGING
- if (h)
- setclexec_pid (oh, h, not_inheriting);
-#endif
-}
-
-void
-fhandler_base::fork_fixup (HANDLE parent, HANDLE &h, const char *name)
-{
-#ifdef DEBUGGING
- HANDLE oh = h;
-#endif
- if (/* !is_socket () && */ !get_close_on_exec ())
- debug_printf ("handle %p already opened", h);
- else if (!DuplicateHandle (parent, h, hMainProc, &h, 0, !get_close_on_exec (),
- DUPLICATE_SAME_ACCESS))
- system_printf ("%s - %E, handle %s<%p>", get_name (), name, h);
-#ifdef DEBUGGING
- else
- {
- debug_printf ("%s success - oldh %p, h %p", get_name (), oh, h);
- // someday, maybe ProtectHandle2 (h, name);
- setclexec_pid (oh, h, !get_close_on_exec ());
- }
-#endif
-}
-
-void
-fhandler_base::set_close_on_exec (int val)
-{
- set_inheritance (io_handle, val);
- set_close_on_exec_flag (val);
- debug_printf ("set close_on_exec for %s to %d", get_name (), val);
-}
-
-void
-fhandler_base::fixup_after_fork (HANDLE parent)
-{
- debug_printf ("inheriting '%s' from parent", get_name ());
- fork_fixup (parent, io_handle, "io_handle");
-}
-
-bool
-fhandler_base::is_nonblocking ()
-{
- return (openflags & O_NONBLOCK_MASK) != 0;
-}
-
-void
-fhandler_base::set_nonblocking (int yes)
-{
- int current = openflags & O_NONBLOCK_MASK;
- int new_flags = yes ? (!current ? O_NONBLOCK : current) : 0;
- openflags = (openflags & ~O_NONBLOCK_MASK) | new_flags;
-}
-
-DIR *
-fhandler_base::opendir (path_conv&)
-{
- set_errno (ENOTDIR);
- return NULL;
-}
-
-struct dirent *
-fhandler_base::readdir (DIR *)
-{
- set_errno (ENOTDIR);
- return NULL;
-}
-
-__off64_t
-fhandler_base::telldir (DIR *)
-{
- set_errno (ENOTDIR);
- return -1;
-}
-
-void
-fhandler_base::seekdir (DIR *, __off64_t)
-{
- set_errno (ENOTDIR);
- return;
-}
-
-void
-fhandler_base::rewinddir (DIR *)
-{
- set_errno (ENOTDIR);
- return;
-}
-
-int
-fhandler_base::closedir (DIR *)
-{
- set_errno (ENOTDIR);
- return -1;
-}
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
deleted file mode 100644
index 08bb273a4..000000000
--- a/winsup/cygwin/fhandler.h
+++ /dev/null
@@ -1,1198 +0,0 @@
-/* fhandler.h
-
- Copyright 1996, 1997, 1998, 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. */
-
-#ifndef _FHANDLER_H_
-#define _FHANDLER_H_
-
-#include <sys/ioctl.h>
-#include <fcntl.h>
-
-enum
-{
- FH_RBINARY = 0x00001000, /* binary read mode */
- FH_WBINARY = 0x00002000, /* binary write mode */
- FH_CLOEXEC = 0x00004000, /* close-on-exec */
- FH_RBINSET = 0x00008000, /* binary read mode has been explicitly set */
- FH_WBINSET = 0x00010000, /* binary write mode has been explicitly set */
- FH_APPEND = 0x00020000, /* always append */
- FH_ASYNC = 0x00040000, /* async I/O */
- FH_SIGCLOSE = 0x00080000, /* signal handler should close fd on interrupt */
-
- FH_SYMLINK = 0x00100000, /* is a symlink */
- FH_EXECABL = 0x00200000, /* file looked like it would run:
- * ends in .exe or .bat or begins with #! */
- FH_W95LSBUG = 0x00400000, /* set when lseek is called as a flag that
- * _write should check if we've moved beyond
- * EOF, zero filling if so. */
- FH_NOHANDLE = 0x00800000, /* No handle associated with fhandler. */
- FH_NOEINTR = 0x01000000, /* Set if I/O should be uninterruptible. */
- FH_FFIXUP = 0x02000000, /* Set if need to fixup after fork. */
- FH_LOCAL = 0x04000000, /* File is unix domain socket */
- FH_SHUTRD = 0x08000000, /* Socket saw a SHUT_RD */
- FH_SHUTWR = 0x10000000, /* Socket saw a SHUT_WR */
- FH_ISREMOTE = 0x10000000, /* File is on a remote drive */
- FH_DCEXEC = 0x20000000, /* Don't care if this is executable */
- FH_HASACLS = 0x40000000, /* True if fs of file has ACLS */
- FH_QUERYOPEN = 0x80000000, /* open file without requesting either read
- or write access */
-
- /* Device flags */
-
- /* Slow devices */
- FH_CONSOLE = 0x00000001, /* is a console */
- FH_CONIN = 0x00000002, /* console input */
- FH_CONOUT = 0x00000003, /* console output */
- FH_TTYM = 0x00000004, /* is a tty master */
- FH_TTYS = 0x00000005, /* is a tty slave */
- FH_PTYM = 0x00000006, /* is a pty master */
- FH_SERIAL = 0x00000007, /* is a serial port */
- FH_PIPE = 0x00000008, /* is a pipe */
- FH_PIPER = 0x00000009, /* read end of a pipe */
- FH_PIPEW = 0x0000000a, /* write end of a pipe */
- FH_SOCKET = 0x0000000b, /* is a socket */
- FH_WINDOWS = 0x0000000c, /* is a window */
- FH_SLOW = 0x00000010, /* "slow" device if below this */
-
- /* Fast devices */
- FH_DISK = 0x00000010, /* is a disk */
- FH_FLOPPY = 0x00000011, /* is a floppy */
- FH_TAPE = 0x00000012, /* is a tape */
- FH_NULL = 0x00000013, /* is the null device */
- FH_ZERO = 0x00000014, /* is the zero device */
- FH_RANDOM = 0x00000015, /* is a random device */
- FH_MEM = 0x00000016, /* is a mem device */
- FH_CLIPBOARD = 0x00000017, /* is a clipboard device */
- FH_OSS_DSP = 0x00000018, /* is a dsp audio device */
- FH_CYGDRIVE= 0x00000019, /* /cygdrive/x */
- FH_PROC = 0x0000001a, /* /proc */
- FH_REGISTRY =0x0000001b, /* /proc/registry */
- FH_PROCESS = 0x0000001c, /* /proc/<n> */
-
- FH_NDEV = 0x0000001d, /* Maximum number of devices */
- FH_DEVMASK = 0x00000fff, /* devices live here */
- FH_BAD = 0xffffffff
-};
-
-#define FHDEVN(n) ((n) & FH_DEVMASK)
-#define FHISSETF(x) __ISSETF (this, x, FH)
-#define FHSETF(x) __SETF (this, x, FH)
-#define FHCLEARF(x) __CLEARF (this, x, FH)
-#define FHCONDSETF(n, x) __CONDSETF(n, this, x, FH)
-
-#define FHSTATOFF 0
-
-/* fcntl flags used only internaly. */
-#define O_NOSYMLINK 0x080000
-#define O_DIROPEN 0x100000
-
-/* newlib used to define O_NDELAY differently from O_NONBLOCK. Now it
- properly defines both to be the same. Unfortunately, we have to
- behave properly the old version, too, to accommodate older executables. */
-#define OLD_O_NDELAY (CYGWIN_VERSION_CHECK_FOR_OLD_O_NONBLOCK ? 4 : 0)
-
-/* Care for the old O_NDELAY flag. If one of the flags is set,
- both flags are set. */
-#define O_NONBLOCK_MASK (O_NONBLOCK | OLD_O_NDELAY)
-
-extern const char *windows_device_names[];
-extern struct __cygwin_perfile *perfile_table;
-#define __fmode (*(user_data->fmode_ptr))
-extern const char proc[];
-extern const int proc_len;
-
-class select_record;
-class path_conv;
-class fhandler_disk_file;
-typedef struct __DIR DIR;
-struct dirent;
-
-enum bg_check_types
-{
- bg_error = -1,
- bg_eof = 0,
- bg_ok = 1,
- bg_signalled = 2
-};
-
-enum executable_states
-{
- is_executable,
- dont_care_if_executable,
- not_executable = dont_care_if_executable,
- dont_know_if_executable
-};
-
-class fhandler_base
-{
- protected:
- DWORD status;
- private:
- int access;
- HANDLE io_handle;
-
- unsigned long namehash; /* hashed filename, used as inode num */
-
- protected:
- /* Full unix path name of this file */
- /* File open flags from open () and fcntl () calls */
- int openflags;
-
- char *rabuf; /* used for crlf conversion in text files */
- size_t ralen;
- size_t raixget;
- size_t raixput;
- size_t rabuflen;
-
- const char *unix_path_name;
- const char *win32_path_name;
- DWORD open_status;
-
- public:
- void set_name (const char * unix_path, const char *win32_path = NULL, int unit = 0);
-
- virtual fhandler_base& operator =(fhandler_base &x);
- fhandler_base (DWORD dev, int unit = 0);
- virtual ~fhandler_base ();
-
- /* Non-virtual simple accessor functions. */
- void set_io_handle (HANDLE x) { io_handle = x; }
-
- DWORD get_device () { return status & FH_DEVMASK; }
- virtual int get_unit () { return 0; }
- virtual BOOL is_slow () { return get_device () < FH_SLOW; }
-
- int get_access () { return access; }
- void set_access (int x) { access = x; }
-
- bool get_async () { return FHISSETF (ASYNC); }
- void set_async (int x) { FHCONDSETF (x, ASYNC); }
-
- int get_flags () { return openflags; }
- void set_flags (int x, int supplied_bin = 0);
-
- bool is_nonblocking ();
- void set_nonblocking (int yes);
-
- bool get_w_binary () { return FHISSETF (WBINSET) ? FHISSETF (WBINARY) : 1; }
- bool get_r_binary () { return FHISSETF (RBINSET) ? FHISSETF (RBINARY) : 1; }
-
- bool get_w_binset () { return FHISSETF (WBINSET); }
- bool get_r_binset () { return FHISSETF (RBINSET); }
-
- void set_w_binary (int b) { FHCONDSETF (b, WBINARY); FHSETF (WBINSET); }
- void set_r_binary (int b) { FHCONDSETF (b, RBINARY); FHSETF (RBINSET); }
- void clear_w_binary () {FHCLEARF (WBINARY); FHCLEARF (WBINSET); }
- void clear_r_binary () {FHCLEARF (RBINARY); FHCLEARF (RBINSET); }
-
- bool get_nohandle () { return FHISSETF (NOHANDLE); }
- void set_nohandle (int x) { FHCONDSETF (x, NOHANDLE); }
-
- void set_open_status () {open_status = status;}
- DWORD get_open_status () {return open_status;}
- void reset_to_open_binmode ()
- {
- set_flags ((get_flags () & ~(O_TEXT | O_BINARY))
- | ((open_status & (FH_WBINARY | FH_RBINARY)
- ? O_BINARY : O_TEXT)));
- }
-
- int get_default_fmode (int flags);
-
- bool get_r_no_interrupt () { return FHISSETF (NOEINTR); }
- void set_r_no_interrupt (int b) { FHCONDSETF (b, NOEINTR); }
-
- bool get_close_on_exec () { return FHISSETF (CLOEXEC); }
- int set_close_on_exec_flag (int b) { return FHCONDSETF (b, CLOEXEC); }
-
- LPSECURITY_ATTRIBUTES get_inheritance (bool all = 0)
- {
- if (all)
- return get_close_on_exec () ? &sec_all_nih : &sec_all;
- else
- return get_close_on_exec () ? &sec_none_nih : &sec_none;
- }
-
- void set_check_win95_lseek_bug (int b = 1) { FHCONDSETF (b, W95LSBUG); }
- bool get_check_win95_lseek_bug () { return FHISSETF (W95LSBUG); }
-
- bool get_need_fork_fixup () { return FHISSETF (FFIXUP); }
- void set_need_fork_fixup () { FHSETF (FFIXUP); }
-
- virtual void set_close_on_exec (int val);
-
- virtual void fixup_before_fork_exec (DWORD) {}
- virtual void fixup_after_fork (HANDLE);
- virtual void fixup_after_exec (HANDLE) {}
-
- bool get_symlink_p () { return FHISSETF (SYMLINK); }
- void set_symlink_p (int val) { FHCONDSETF (val, SYMLINK); }
- void set_symlink_p () { FHSETF (SYMLINK); }
-
- bool get_socket_p () { return FHISSETF (LOCAL); }
- void set_socket_p (int val) { FHCONDSETF (val, LOCAL); }
- void set_socket_p () { FHSETF (LOCAL); }
-
- bool get_execable_p () { return FHISSETF (EXECABL); }
- void set_execable_p (executable_states val)
- {
- FHCONDSETF (val == is_executable, EXECABL);
- FHCONDSETF (val == dont_care_if_executable, DCEXEC);
- }
- void set_execable_p () { FHSETF (EXECABL); }
- bool dont_care_if_execable () { return FHISSETF (DCEXEC); }
- bool exec_state_isknown () { return FHISSETF (DCEXEC) || FHISSETF (EXECABL); }
-
- bool get_append_p () { return FHISSETF (APPEND); }
- void set_append_p (int val) { FHCONDSETF (val, APPEND); }
- void set_append_p () { FHSETF (APPEND); }
-
- bool get_query_open () { return FHISSETF (QUERYOPEN); }
- void set_query_open (bool val) { FHCONDSETF (val, QUERYOPEN); }
-
- bool get_readahead_valid () { return raixget < ralen; }
- int puts_readahead (const char *s, size_t len = (size_t) -1);
- int put_readahead (char value);
-
- int get_readahead ();
- int peek_readahead (int queryput = 0);
-
- int eat_readahead (int n);
-
- void set_readahead_valid (int val, int ch = -1);
-
- int get_readahead_into_buffer (char *buf, size_t buflen);
-
- bool has_acls () { return FHISSETF (HASACLS); }
- void set_has_acls (int val) { FHCONDSETF (val, HASACLS); }
-
- bool isremote () { return FHISSETF (ISREMOTE); }
- void set_isremote (int val) { FHCONDSETF (val, ISREMOTE); }
-
- const char *get_name () { return unix_path_name; }
- const char *get_win32_name () { return win32_path_name; }
- unsigned long get_namehash () { return namehash; }
-
- virtual void hclose (HANDLE h) {CloseHandle (h);}
- virtual void set_inheritance (HANDLE &h, int not_inheriting);
-
- /* fixup fd possibly non-inherited handles after fork */
- void fork_fixup (HANDLE parent, HANDLE &h, const char *name);
-
- virtual int open (path_conv *real_path, int flags, mode_t mode = 0);
- virtual int close ();
- virtual int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3)));
- virtual int ioctl (unsigned int cmd, void *);
- virtual int fcntl (int cmd, void *);
- virtual char const * ttyname () { return get_name(); }
- virtual int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
- virtual int write (const void *ptr, size_t len);
- virtual __off64_t lseek (__off64_t offset, int whence);
- virtual int lock (int, struct flock *);
- virtual void dump ();
- virtual int dup (fhandler_base *child);
-
- virtual HANDLE mmap (caddr_t *addr, size_t len, DWORD access,
- int flags, __off64_t off);
- virtual int munmap (HANDLE h, caddr_t addr, size_t len);
- virtual int msync (HANDLE h, caddr_t addr, size_t len, int flags);
- virtual BOOL fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset,
- DWORD size, void *address);
-
- void *operator new (size_t, void *p) {return p;}
-
- virtual void init (HANDLE, DWORD, mode_t);
-
- virtual int tcflush (int);
- virtual int tcsendbreak (int);
- virtual int tcdrain ();
- virtual int tcflow (int);
- virtual int tcsetattr (int a, const struct termios *t);
- virtual int tcgetattr (struct termios *t);
- virtual int tcsetpgrp (const pid_t pid);
- virtual int tcgetpgrp ();
- virtual int is_tty () { return 0; }
- virtual BOOL is_device () { return TRUE; }
- virtual char *ptsname () { return NULL;}
- virtual class fhandler_socket *is_socket () { return 0; }
- virtual class fhandler_console *is_console () { return 0; }
- virtual int is_windows () {return 0; }
-
- virtual int raw_read (void *ptr, size_t ulen);
- virtual int raw_write (const void *ptr, size_t ulen);
-
- /* Virtual accessor functions to hide the fact
- that some fd's have two handles. */
- virtual HANDLE& get_handle () { return io_handle; }
- virtual HANDLE& get_io_handle () { return io_handle; }
- virtual HANDLE& get_output_handle () { return io_handle; }
- virtual bool hit_eof () {return FALSE;}
- virtual select_record *select_read (select_record *s);
- virtual select_record *select_write (select_record *s);
- virtual select_record *select_except (select_record *s);
- virtual int ready_for_read (int fd, DWORD howlong);
- virtual const char * get_native_name ()
- {
- return windows_device_names[FHDEVN (status)];
- }
- virtual bg_check_types bg_check (int) {return bg_ok;}
- void clear_readahead ()
- {
- raixput = raixget = ralen = rabuflen = 0;
- rabuf = NULL;
- }
- void operator delete (void *);
- virtual HANDLE get_guard () const {return NULL;}
- virtual void set_eof () {}
- virtual DIR *opendir (path_conv& pc);
- virtual dirent *readdir (DIR *);
- virtual __off64_t telldir (DIR *);
- virtual void seekdir (DIR *, __off64_t);
- virtual void rewinddir (DIR *);
- virtual int closedir (DIR *);
-};
-
-class fhandler_socket: public fhandler_base
-{
- private:
- int addr_family;
- int type;
- int connect_secret [4];
- HANDLE secret_event;
- struct _WSAPROTOCOL_INFOA *prot_info_ptr;
- char *sun_path;
-
- public:
- fhandler_socket ();
- ~fhandler_socket ();
- int get_socket () { return (int) get_handle(); }
- fhandler_socket * is_socket () { return this; }
-
- bool saw_shutdown_read () const {return FHISSETF (SHUTRD);}
- bool saw_shutdown_write () const {return FHISSETF (SHUTWR);}
-
- void set_shutdown_read () {FHSETF (SHUTRD);}
- void set_shutdown_write () {FHSETF (SHUTWR);}
-
- int recv (void *ptr, size_t len, unsigned int flags);
- int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
-
- int send (const void *ptr, size_t len, unsigned int flags);
- int write (const void *ptr, size_t len);
-
- int ioctl (unsigned int cmd, void *);
- int fcntl (int cmd, void *);
- __off64_t lseek (__off64_t, int) { return 0; }
- int close ();
- void hclose (HANDLE) {close ();}
- int dup (fhandler_base *child);
-
- void set_close_on_exec (int val);
- virtual void fixup_before_fork_exec (DWORD);
- void fixup_after_fork (HANDLE);
- void fixup_after_exec (HANDLE);
-
- select_record *select_read (select_record *s);
- select_record *select_write (select_record *s);
- select_record *select_except (select_record *s);
- void set_addr_family (int af) {addr_family = af;}
- int get_addr_family () {return addr_family;}
- void set_socket_type (int st) { type = st;}
- int get_socket_type () {return type;}
- void set_sun_path (const char *path);
- char *get_sun_path () {return sun_path;}
- void set_connect_secret ();
- void get_connect_secret (char*);
- HANDLE create_secret_event (int *secret = NULL);
- int check_peer_secret_event (struct sockaddr_in *peer, int *secret = NULL);
- void signal_secret_event ();
- void close_secret_event ();
- int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3)));
-};
-
-class fhandler_pipe: public fhandler_base
-{
- HANDLE guard;
- bool broken_pipe;
- HANDLE writepipe_exists;
- DWORD orig_pid;
- unsigned id;
- public:
- fhandler_pipe (DWORD devtype);
- __off64_t lseek (__off64_t offset, int whence);
- select_record *select_read (select_record *s);
- select_record *select_write (select_record *s);
- select_record *select_except (select_record *s);
- void set_close_on_exec (int val);
- int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
- int close ();
- void create_guard (SECURITY_ATTRIBUTES *sa) {guard = CreateMutex (sa, FALSE, NULL);}
- int dup (fhandler_base *child);
- void fixup_after_fork (HANDLE);
- bool hit_eof ();
- void set_eof () {broken_pipe = true;}
- friend int make_pipe (int fildes[2], unsigned int psize, int mode);
- HANDLE get_guard () const {return guard;}
-};
-
-class fhandler_dev_raw: public fhandler_base
-{
- protected:
- char *devbuf;
- size_t devbufsiz;
- size_t devbufstart;
- size_t devbufend;
- int eom_detected : 1;
- int eof_detected : 1;
- int lastblk_to_read : 1;
- int is_writing : 1;
- int has_written : 1;
- int varblkop : 1;
- int unit;
-
- virtual void clear (void);
- virtual int writebuf (void);
-
- /* returns not null, if `win_error' determines an end of media condition */
- virtual int is_eom(int win_error) = 0;
- /* returns not null, if `win_error' determines an end of file condition */
- virtual int is_eof(int win_error) = 0;
-
- fhandler_dev_raw (DWORD dev, int unit);
-
- public:
- ~fhandler_dev_raw (void);
-
- int get_unit () { return unit; }
-
- int open (path_conv *, int flags, mode_t mode = 0);
- int close (void);
-
- int raw_read (void *ptr, size_t ulen);
- int raw_write (const void *ptr, size_t ulen);
-
- int dup (fhandler_base *child);
-
- int ioctl (unsigned int cmd, void *buf);
-
- void fixup_after_fork (HANDLE);
- void fixup_after_exec (HANDLE);
-};
-
-class fhandler_dev_floppy: public fhandler_dev_raw
-{
- protected:
- virtual int is_eom (int win_error);
- virtual int is_eof (int win_error);
-
- public:
- fhandler_dev_floppy (int unit);
-
- virtual int open (path_conv *, int flags, mode_t mode = 0);
- virtual int close (void);
-
- virtual __off64_t lseek (__off64_t offset, int whence);
-
- virtual int ioctl (unsigned int cmd, void *buf);
-};
-
-class fhandler_dev_tape: public fhandler_dev_raw
-{
- int lasterr;
-
- bool is_rewind_device () { return get_unit () < 128; }
-
- protected:
- virtual void clear (void);
-
- virtual int is_eom (int win_error);
- virtual int is_eof (int win_error);
-
- public:
- fhandler_dev_tape (int unit);
-
- virtual int open (path_conv *, int flags, mode_t mode = 0);
- virtual int close (void);
-
- virtual __off64_t lseek (__off64_t offset, int whence);
-
- virtual int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3)));
-
- virtual int dup (fhandler_base *child);
-
- virtual int ioctl (unsigned int cmd, void *buf);
-
- private:
- int tape_write_marks (int marktype, DWORD len);
- int tape_get_pos (unsigned long *ret);
- int tape_set_pos (int mode, long count, BOOLEAN sfm_func = FALSE);
- int tape_erase (int mode);
- int tape_prepare (int action);
- BOOLEAN tape_get_feature (DWORD parm);
- int tape_get_blocksize (long *min, long *def, long *max, long *cur);
- int tape_set_blocksize (long count);
- int tape_status (struct mtget *get);
- int tape_compression (long count);
-};
-
-/* Standard disk file */
-
-class fhandler_disk_file: public fhandler_base
-{
- public:
- fhandler_disk_file ();
- fhandler_disk_file (DWORD devtype);
-
- int open (path_conv * real_path, int flags, mode_t mode);
- int close ();
- int lock (int, struct flock *);
- BOOL is_device () { return FALSE; }
- int __stdcall fstat (struct __stat64 *buf, path_conv *pc) __attribute__ ((regparm (3)));
- int __stdcall fstat_helper (struct __stat64 *buf, path_conv *pc,
- FILETIME ftCreateionTime,
- FILETIME ftLastAccessTime,
- FILETIME ftLastWriteTime,
- DWORD nFileSizeHigh,
- DWORD nFileSizeLow,
- DWORD nFileIndexHigh = 0,
- DWORD nFileIndexLow = 0,
- DWORD nNumberOfLinks = 1)
- __attribute__ ((regparm (3)));
- int __stdcall fstat_by_handle (struct __stat64 *buf, path_conv *pc) __attribute__ ((regparm (3)));
- int __stdcall fstat_by_name (struct __stat64 *buf, path_conv *pc) __attribute__ ((regparm (3)));
-
- HANDLE mmap (caddr_t *addr, size_t len, DWORD access, int flags, __off64_t off);
- int munmap (HANDLE h, caddr_t addr, size_t len);
- int msync (HANDLE h, caddr_t addr, size_t len, int flags);
- BOOL fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset,
- DWORD size, void *address);
- DIR *opendir (path_conv& pc);
- struct dirent *readdir (DIR *);
- __off64_t telldir (DIR *);
- void seekdir (DIR *, __off64_t);
- void rewinddir (DIR *);
- int closedir (DIR *);
-};
-
-class fhandler_cygdrive: public fhandler_disk_file
-{
- int unit;
- int ndrives;
- const char *pdrive;
- void set_drives ();
- public:
- bool iscygdrive_root () const { return !unit; }
- fhandler_cygdrive (int unit);
- DIR *opendir (path_conv& pc);
- struct dirent *readdir (DIR *);
- __off64_t telldir (DIR *);
- void seekdir (DIR *, __off64_t);
- void rewinddir (DIR *);
- int closedir (DIR *);
- int __stdcall fstat (struct __stat64 *buf, path_conv *pc) __attribute__ ((regparm (3)));
-};
-
-class fhandler_serial: public fhandler_base
-{
- private:
- unsigned int vmin_; /* from termios */
- unsigned int vtime_; /* from termios */
- pid_t pgrp_;
-
- public:
- int overlapped_armed;
- OVERLAPPED io_status;
- DWORD ev;
-
- /* Constructor */
- fhandler_serial (int unit);
-
- int open (path_conv *, int flags, mode_t mode);
- int close ();
- void init (HANDLE h, DWORD a, mode_t flags);
- void overlapped_setup ();
- int dup (fhandler_base *child);
- int raw_read (void *ptr, size_t ulen);
- int raw_write (const void *ptr, size_t ulen);
- int tcsendbreak (int);
- int tcdrain ();
- int tcflow (int);
- int tcsetattr (int a, const struct termios *t);
- int tcgetattr (struct termios *t);
- __off64_t lseek (__off64_t, int) { return 0; }
- int tcflush (int);
- void dump ();
- int is_tty () { return 1; }
- void fixup_after_fork (HANDLE parent);
- void fixup_after_exec (HANDLE);
-
- /* We maintain a pgrp so that tcsetpgrp and tcgetpgrp work, but we
- don't use it for permissions checking. fhandler_tty_slave does
- permission checking on pgrps. */
- virtual int tcgetpgrp () { return pgrp_; }
- virtual int tcsetpgrp (const pid_t pid) { pgrp_ = pid; return 0; }
- select_record *select_read (select_record *s);
- select_record *select_write (select_record *s);
- select_record *select_except (select_record *s);
-};
-
-#define acquire_output_mutex(ms) \
- __acquire_output_mutex (__PRETTY_FUNCTION__, __LINE__, ms);
-
-#define release_output_mutex() \
- __release_output_mutex (__PRETTY_FUNCTION__, __LINE__);
-
-class tty;
-class tty_min;
-class fhandler_termios: public fhandler_base
-{
- protected:
- HANDLE output_handle;
- virtual void doecho (const void *, DWORD) {};
- virtual int accept_input () {return 1;};
- public:
- tty_min *tc;
- fhandler_termios (DWORD dev, int unit = 0) :
- fhandler_base (dev, unit)
- {
- set_need_fork_fixup ();
- }
- HANDLE& get_output_handle () { return output_handle; }
- int line_edit (const char *rptr, int nread, int always_accept = 0);
- void set_output_handle (HANDLE h) { output_handle = h; }
- void tcinit (tty_min *this_tc, int force = FALSE);
- virtual int is_tty () { return 1; }
- int tcgetpgrp ();
- int tcsetpgrp (int pid);
- bg_check_types bg_check (int sig);
- virtual DWORD __acquire_output_mutex (const char *fn, int ln, DWORD ms) {return 1;}
- virtual void __release_output_mutex (const char *fn, int ln) {}
- void fixup_after_fork (HANDLE);
- void fixup_after_exec (HANDLE parent) { fixup_after_fork (parent); }
- void echo_erase (int force = 0);
- virtual __off64_t lseek (__off64_t, int);
-};
-
-enum ansi_intensity
-{
- INTENSITY_INVISIBLE,
- INTENSITY_DIM,
- INTENSITY_NORMAL,
- INTENSITY_BOLD
-};
-
-#define normal 1
-#define gotesc 2
-#define gotsquare 3
-#define gotarg1 4
-#define gotrsquare 5
-#define gotcommand 6
-#define gettitle 7
-#define eattitle 8
-#define MAXARGS 10
-
-/* This is a input and output console handle */
-class fhandler_console: public fhandler_termios
-{
- private:
-
- WORD default_color, underline_color, dim_color;
-
- /* Used to determine if an input keystroke should be modified with META. */
- int meta_mask;
-
-/* Output state */
- int state_;
- int args_[MAXARGS];
- int nargs_;
- unsigned rarg;
- bool saw_question_mark;
-
- char my_title_buf [TITLESIZE + 1];
-
- WORD current_win32_attr;
- ansi_intensity intensity;
- bool underline, blink, reverse;
- WORD fg, bg;
-
- /* saved cursor coordinates */
- int savex, savey;
-
- /* saved screen */
- COORD savebufsiz;
- PCHAR_INFO savebuf;
-
- struct
- {
- short Top, Bottom;
- } scroll_region;
- struct
- {
- SHORT winTop;
- SHORT winBottom;
- COORD dwWinSize;
- COORD dwBufferSize;
- COORD dwCursorPosition;
- WORD wAttributes;
- } info;
-
- COORD dwLastCursorPosition;
- DWORD dwLastButtonState;
- int nModifiers;
-
- bool insert_mode;
- bool use_mouse;
- bool raw_win32_keyboard_mode;
-
-/* Output calls */
- void set_default_attr ();
- WORD get_win32_attr ();
-
- BOOL fillin_info ();
- void clear_screen (int, int, int, int);
- void scroll_screen (int, int, int, int, int, int);
- void cursor_set (BOOL, int, int);
- void cursor_get (int *, int *);
- void cursor_rel (int, int);
- const unsigned char * write_normal (unsigned const char*, unsigned const char *);
- void char_command (char);
- BOOL set_raw_win32_keyboard_mode (BOOL);
- int output_tcsetattr (int a, const struct termios *t);
-
-/* Input calls */
- int igncr_enabled ();
- int input_tcsetattr (int a, const struct termios *t);
- void set_cursor_maybe ();
-
- public:
-
- fhandler_console ();
-
- fhandler_console* is_console () { return this; }
-
- int open (path_conv *, int flags, mode_t mode = 0);
-
- int write (const void *ptr, size_t len);
- void doecho (const void *str, DWORD len) { (void) write (str, len); }
- int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
- int close ();
-
- int tcflush (int);
- int tcsetattr (int a, const struct termios *t);
- int tcgetattr (struct termios *t);
-
- /* Special dup as we must dup two handles */
- int dup (fhandler_base *child);
-
- int ioctl (unsigned int cmd, void *);
- void init (HANDLE, DWORD, mode_t);
- bool mouse_aware () {return use_mouse;}
-
- select_record *select_read (select_record *s);
- select_record *select_write (select_record *s);
- select_record *select_except (select_record *s);
- void fixup_after_exec (HANDLE);
- void set_close_on_exec (int val);
- void fixup_after_fork (HANDLE parent);
- void set_input_state ();
-};
-
-class fhandler_tty_common: public fhandler_termios
-{
- public:
- fhandler_tty_common (DWORD dev, int unit = 0)
- : fhandler_termios (dev, unit), output_done_event (NULL),
- ioctl_request_event (NULL), ioctl_done_event (NULL), output_mutex (NULL),
- input_mutex (NULL), input_available_event (NULL), inuse (NULL), ttynum (unit)
- {
- // nothing to do
- }
- HANDLE output_done_event; // Raised by master when tty's output buffer
- // written. Write status in tty::write_retval.
- HANDLE ioctl_request_event; // Raised by slave to perform ioctl() request.
- // Ioctl() request in tty::cmd/arg.
- HANDLE ioctl_done_event; // Raised by master on ioctl() completion.
- // Ioctl() status in tty::ioctl_retval.
- HANDLE output_mutex, input_mutex;
- HANDLE input_available_event;
- HANDLE inuse; // used to indicate that a tty is in use
- int ttynum; // Master tty num.
-
- DWORD __acquire_output_mutex (const char *fn, int ln, DWORD ms);
- void __release_output_mutex (const char *fn, int ln);
-
- virtual int dup (fhandler_base *child);
-
- tty *get_ttyp () { return (tty *)tc; }
- int get_unit () { return ttynum; }
-
- int close ();
- void set_close_on_exec (int val);
- void fixup_after_fork (HANDLE parent);
- select_record *select_read (select_record *s);
- select_record *select_write (select_record *s);
- select_record *select_except (select_record *s);
-};
-
-class fhandler_tty_slave: public fhandler_tty_common
-{
- public:
- /* Constructor */
- fhandler_tty_slave ();
- fhandler_tty_slave (int);
-
- int open (path_conv *, int flags, mode_t mode = 0);
- int write (const void *ptr, size_t len);
- int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
- void init (HANDLE, DWORD, mode_t);
-
- int tcsetattr (int a, const struct termios *t);
- int tcgetattr (struct termios *t);
- int tcflush (int);
- int ioctl (unsigned int cmd, void *);
-
- __off64_t lseek (__off64_t, int) { return 0; }
- select_record *select_read (select_record *s);
- int ready_for_read (int fd, DWORD howlong);
-
- int cygserver_attach_tty (HANDLE*, HANDLE*);
-};
-
-class fhandler_pty_master: public fhandler_tty_common
-{
- int pktmode; // non-zero if pty in a packet mode.
- public:
- int need_nl; // Next read should start with \n
-
- /* Constructor */
- fhandler_pty_master (DWORD devtype = FH_PTYM, int unit = -1);
-
- int process_slave_output (char *buf, size_t len, int pktmode_on);
- void doecho (const void *str, DWORD len);
- int accept_input ();
- int open (path_conv *, int flags, mode_t mode = 0);
- int write (const void *ptr, size_t len);
- int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
- int close ();
-
- int tcsetattr (int a, const struct termios *t);
- int tcgetattr (struct termios *t);
- int tcflush (int);
- int ioctl (unsigned int cmd, void *);
-
- __off64_t lseek (__off64_t, int) { return 0; }
- char *ptsname ();
-
- void set_close_on_exec (int val);
- bool hit_eof ();
-};
-
-class fhandler_tty_master: public fhandler_pty_master
-{
- public:
- /* Constructor */
- fhandler_console *console; // device handler to perform real i/o.
- HANDLE hThread; // process_output thread handle.
-
- fhandler_tty_master (int unit);
- int init (int);
- int init_console ();
- void fixup_after_fork (HANDLE parent);
- void fixup_after_exec (HANDLE);
-};
-
-class fhandler_dev_null: public fhandler_base
-{
- public:
- fhandler_dev_null ();
-
- void dump ();
- select_record *select_read (select_record *s);
- select_record *select_write (select_record *s);
- select_record *select_except (select_record *s);
-};
-
-class fhandler_dev_zero: public fhandler_base
-{
- public:
- fhandler_dev_zero ();
- int open (path_conv *, int flags, mode_t mode = 0);
- int write (const void *ptr, size_t len);
- int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
- __off64_t lseek (__off64_t offset, int whence);
- int close (void);
-
- void dump ();
-};
-
-class fhandler_dev_random: public fhandler_base
-{
- protected:
- int unit;
- HCRYPTPROV crypt_prov;
- long pseudo;
-
- BOOL crypt_gen_random (void *ptr, size_t len);
- int pseudo_write (const void *ptr, size_t len);
- int pseudo_read (void *ptr, size_t len);
-
- public:
- fhandler_dev_random (int unit);
- int get_unit () { return unit; }
- int open (path_conv *, int flags, mode_t mode = 0);
- int write (const void *ptr, size_t len);
- int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
- __off64_t lseek (__off64_t offset, int whence);
- int close (void);
- int dup (fhandler_base *child);
-
- void dump ();
-};
-
-class fhandler_dev_mem: public fhandler_base
-{
- protected:
- int unit;
- DWORD mem_size;
- __off64_t pos;
-
- public:
- fhandler_dev_mem (int unit);
- ~fhandler_dev_mem (void);
-
- int open (path_conv *, int flags, mode_t mode = 0);
- int write (const void *ptr, size_t ulen);
- int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
- __off64_t lseek (__off64_t offset, int whence);
- int close (void);
- int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3)));
- int dup (fhandler_base *child);
-
- HANDLE mmap (caddr_t *addr, size_t len, DWORD access, int flags, __off64_t off);
- int munmap (HANDLE h, caddr_t addr, size_t len);
- int msync (HANDLE h, caddr_t addr, size_t len, int flags);
- BOOL fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset,
- DWORD size, void *address);
-
- void dump ();
-} ;
-
-class fhandler_dev_clipboard: public fhandler_base
-{
- public:
- fhandler_dev_clipboard ();
- int is_windows (void) { return 1; }
- int open (path_conv *, int flags, mode_t mode = 0);
- int write (const void *ptr, size_t len);
- int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
- __off64_t lseek (__off64_t offset, int whence);
- int close (void);
-
- int dup (fhandler_base *child);
-
- void dump ();
-
- private:
- __off64_t pos;
- void *membuffer;
- size_t msize;
- bool eof;
-};
-
-class fhandler_windows: public fhandler_base
-{
- private:
- HWND hWnd_; // the window whose messages are to be retrieved by read() call
- int method_; // write method (Post or Send)
- public:
- fhandler_windows ();
- int is_windows (void) { return 1; }
- int open (path_conv *, int flags, mode_t mode = 0);
- int write (const void *ptr, size_t len);
- int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
- int ioctl (unsigned int cmd, void *);
- __off64_t lseek (__off64_t, int) { return 0; }
- int close (void) { return 0; }
-
- void set_close_on_exec (int val);
- void fixup_after_fork (HANDLE parent);
- select_record *select_read (select_record *s);
- select_record *select_write (select_record *s);
- select_record *select_except (select_record *s);
-};
-
-class fhandler_dev_dsp : public fhandler_base
-{
- private:
- int audioformat_;
- int audiofreq_;
- int audiobits_;
- int audiochannels_;
- bool setupwav(const char *pData, int nBytes);
- public:
- fhandler_dev_dsp ();
- ~fhandler_dev_dsp();
-
- int open (path_conv *, int flags, mode_t mode = 0);
- int write (const void *ptr, size_t len);
- int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
- int ioctl (unsigned int cmd, void *);
- __off64_t lseek (__off64_t, int);
- int close (void);
- int dup (fhandler_base * child);
- void dump (void);
- void fixup_after_exec (HANDLE);
-};
-
-class fhandler_virtual : public fhandler_base
-{
- protected:
- char *filebuf;
- size_t bufalloc, filesize;
- __off64_t position;
- int fileid; // unique within each class
- public:
-
- fhandler_virtual (DWORD devtype);
- virtual ~fhandler_virtual();
-
- virtual int exists();
- DIR *opendir (path_conv& pc);
- __off64_t telldir (DIR *);
- void seekdir (DIR *, __off64_t);
- void rewinddir (DIR *);
- int closedir (DIR *);
- int write (const void *ptr, size_t len);
- int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
- __off64_t lseek (__off64_t, int);
- int dup (fhandler_base * child);
- int open (path_conv *, int flags, mode_t mode = 0);
- int close (void);
- int __stdcall fstat (struct stat *buf, path_conv *pc) __attribute__ ((regparm (3)));
- virtual void fill_filebuf ();
-};
-
-class fhandler_proc: public fhandler_virtual
-{
- public:
- fhandler_proc ();
- fhandler_proc (DWORD devtype);
- int exists();
- struct dirent *readdir (DIR *);
- static DWORD get_proc_fhandler(const char *path);
-
- int open (path_conv *real_path, int flags, mode_t mode = 0);
- int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3)));
- void fill_filebuf ();
-};
-
-class pinfo;
-class fhandler_registry: public fhandler_proc
-{
- public:
- fhandler_registry ();
- int exists();
- struct dirent *readdir (DIR *);
- __off64_t telldir (DIR *);
- void seekdir (DIR *, __off64_t);
- void rewinddir (DIR *);
- int closedir (DIR *);
-
- int open (path_conv *real_path, int flags, mode_t mode = 0);
- int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3)));
- HKEY open_key(const char *name, REGSAM access = KEY_READ, bool isValue = false);
- void fill_filebuf ();
-};
-
-struct _pinfo;
-class fhandler_process: public fhandler_proc
-{
- public:
- fhandler_process ();
- int exists();
- struct dirent *readdir (DIR *);
- int open (path_conv *real_path, int flags, mode_t mode = 0);
- int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3)));
- void fill_filebuf (pinfo& p);
-};
-
-typedef union
-{
- char base[sizeof(fhandler_base)];
- char console[sizeof(fhandler_console)];
- char dev_clipboard[sizeof(fhandler_dev_clipboard)];
- char dev_dsp[sizeof(fhandler_dev_dsp)];
- char dev_floppy[sizeof(fhandler_dev_floppy)];
- char dev_mem[sizeof(fhandler_dev_mem)];
- char dev_null[sizeof(fhandler_dev_null)];
- char dev_random[sizeof(fhandler_dev_random)];
- char dev_raw[sizeof(fhandler_dev_raw)];
- char dev_tape[sizeof(fhandler_dev_tape)];
- char dev_zero[sizeof(fhandler_dev_zero)];
- char disk_file[sizeof(fhandler_disk_file)];
- char pipe[sizeof(fhandler_pipe)];
- char proc[sizeof(fhandler_proc)];
- char process[sizeof(fhandler_process)];
- char pty_master[sizeof(fhandler_pty_master)];
- char registry[sizeof(fhandler_registry)];
- char serial[sizeof(fhandler_serial)];
- char socket[sizeof(fhandler_socket)];
- char termios[sizeof(fhandler_termios)];
- char tty_common[sizeof(fhandler_tty_common)];
- char tty_master[sizeof(fhandler_tty_master)];
- char tty_slave[sizeof(fhandler_tty_slave)];
- char windows[sizeof(fhandler_windows)];
-} fhandler_union;
-
-struct select_record
-{
- int fd;
- HANDLE h;
- fhandler_base *fh;
- bool saw_error;
- bool windows_handle;
- bool read_ready, write_ready, except_ready;
- bool read_selected, write_selected, except_selected;
- int (*startup) (select_record *me, class select_stuff *stuff);
- int (*peek) (select_record *, bool);
- int (*verify) (select_record *me, fd_set *readfds, fd_set *writefds,
- fd_set *exceptfds);
- void (*cleanup) (select_record *me, class select_stuff *stuff);
- struct select_record *next;
-
- select_record (fhandler_base *in_fh = NULL) : fd (0), h (NULL),
- fh (in_fh), saw_error (0), windows_handle (0),
- read_ready (0), write_ready (0), except_ready (0),
- read_selected (0), write_selected (0), except_selected (0),
- startup (NULL), peek (NULL), verify (NULL), cleanup (NULL),
- next (NULL) {}
-};
-
-class select_stuff
-{
- public:
- ~select_stuff ();
- select_stuff (): always_ready (0), windows_used (0), start (0)
- {
- memset (device_specific, 0, sizeof (device_specific));
- }
- bool always_ready, windows_used;
- select_record start;
- void *device_specific[FH_NDEV];
-
- int test_and_set (int i, fd_set *readfds, fd_set *writefds,
- fd_set *exceptfds);
- int poll (fd_set *readfds, fd_set *writefds, fd_set *exceptfds);
- int wait (fd_set *readfds, fd_set *writefds, fd_set *exceptfds, DWORD ms);
- void cleanup ();
-};
-
-int __stdcall set_console_state_for_spawn ();
-
-#endif /* _FHANDLER_H_ */
diff --git a/winsup/cygwin/fhandler_clipboard.cc b/winsup/cygwin/fhandler_clipboard.cc
deleted file mode 100644
index e3b26c9fa..000000000
--- a/winsup/cygwin/fhandler_clipboard.cc
+++ /dev/null
@@ -1,279 +0,0 @@
-/* fhandler_dev_clipboard: code to access /dev/clipboard
-
- Copyright 2000, 2001, 2002 Red Hat, Inc
-
- Written by Charles Wilson (cwilson@ece.gatech.edu)
-
-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 "winsup.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <unistd.h>
-#include <windows.h>
-#include <wingdi.h>
-#include <winuser.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-
-/*
- * Robert Collins:
- * FIXME: should we use GetClipboardSequenceNumber to tell if the clipboard has
- * changed? How does /dev/clipboard operate under (say) linux?
- */
-
-static const NO_COPY char *CYGWIN_NATIVE = "CYGWIN_NATIVE_CLIPBOARD";
-/* this is MT safe because windows format id's are atomic */
-static UINT cygnativeformat;
-
-fhandler_dev_clipboard::fhandler_dev_clipboard ()
- : fhandler_base (FH_CLIPBOARD), pos (0), membuffer (NULL), msize (0),
- eof (true)
-{
- /* FIXME: check for errors and loop until we can open the clipboard */
- OpenClipboard (NULL);
- cygnativeformat = RegisterClipboardFormat (CYGWIN_NATIVE);
- CloseClipboard ();
-}
-
-/*
- * Special clipboard dup to duplicate input and output
- * handles.
- */
-
-int
-fhandler_dev_clipboard::dup (fhandler_base * child)
-{
- fhandler_dev_clipboard *fhc = (fhandler_dev_clipboard *) child;
-
- if (!fhc->open (NULL, get_flags (), 0))
- system_printf ("error opening clipboard, %E");
-
- fhc->membuffer = membuffer;
- fhc->pos = pos;
- fhc->msize = msize;
-
- return 0;
-}
-
-int
-fhandler_dev_clipboard::open (path_conv *, int flags, mode_t)
-{
- set_flags (flags, O_TEXT);
- eof = false;
- pos = 0;
- if (membuffer)
- free (membuffer);
- membuffer = NULL;
- if (!cygnativeformat)
- cygnativeformat = RegisterClipboardFormat (CYGWIN_NATIVE);
- set_open_status ();
- return 1;
-}
-
-static int
-set_clipboard (const void *buf, size_t len)
-{
- HGLOBAL hmem;
- unsigned char *clipbuf;
- /* Native CYGWIN format */
- OpenClipboard (0);
- hmem = GlobalAlloc (GMEM_MOVEABLE, len + sizeof (size_t));
- if (!hmem)
- {
- system_printf ("Couldn't allocate global buffer for write\n");
- return -1;
- }
- clipbuf = (unsigned char *) GlobalLock (hmem);
- memcpy (clipbuf + sizeof (size_t), buf, len);
- *(size_t *) (clipbuf) = len;
- GlobalUnlock (hmem);
- EmptyClipboard ();
- if (!cygnativeformat)
- cygnativeformat = RegisterClipboardFormat (CYGWIN_NATIVE);
- if (!SetClipboardData (cygnativeformat, hmem))
- {
- system_printf
- ("Couldn't write native format to the clipboard %04x %x\n",
- cygnativeformat, hmem);
-/* FIXME: return an appriate error code &| set_errno(); */
- return -1;
- }
- CloseClipboard ();
- if (GlobalFree (hmem))
- {
- system_printf
- ("Couldn't free global buffer after write to the clipboard\n");
-/* FIXME: return an appriate error code &| set_errno(); */
- return 0;
- }
-
- /* CF_TEXT/CF_OEMTEXT for copying to wordpad and the like */
-
- OpenClipboard (0);
- hmem = GlobalAlloc (GMEM_MOVEABLE, len + 2);
- if (!hmem)
- {
- system_printf ("Couldn't allocate global buffer for write\n");
- return -1;
- }
- clipbuf = (unsigned char *) GlobalLock (hmem);
- memcpy (clipbuf, buf, len);
- *(clipbuf + len) = '\0';
- *(clipbuf + len + 1) = '\0';
- GlobalUnlock (hmem);
- if (!SetClipboardData
- ((current_codepage == ansi_cp ? CF_TEXT : CF_OEMTEXT), hmem))
- {
- system_printf ("Couldn't write to the clipboard\n");
-/* FIXME: return an appriate error code &| set_errno(); */
- return -1;
- }
- CloseClipboard ();
- if (GlobalFree (hmem))
- {
- system_printf
- ("Couldn't free global buffer after write to the clipboard\n");
-/* FIXME: return an appriate error code &| set_errno(); */
- }
- return 0;
-}
-
-/* FIXME: arbitrary seeking is not handled */
-int
-fhandler_dev_clipboard::write (const void *buf, size_t len)
-{
- if (!eof)
- {
- /* write to our membuffer */
- size_t cursize = msize;
- void *tempbuffer = realloc (membuffer, cursize + len);
- if (!tempbuffer)
- {
- system_printf ("Couldn't realloc() clipboard buffer for write\n");
- return -1;
- }
- membuffer = tempbuffer;
- msize = cursize + len;
- memcpy ((unsigned char *) membuffer + cursize, buf, len);
-
- /* now pass to windows */
- if (set_clipboard (membuffer, msize))
- {
- /* FIXME: membuffer is now out of sync with pos, but msize is used above */
- set_errno (ENOSPC);
- return -1;
- }
-
- pos = msize;
-
- set_errno (0);
- eof = false;
- return len;
- }
- else
- {
- /* FIXME: return 0 bytes written, file not open */
- return 0;
- }
-}
-
-int __stdcall
-fhandler_dev_clipboard::read (void *ptr, size_t len)
-{
- HGLOBAL hglb;
- size_t ret;
- UINT formatlist[2];
- UINT format;
- if (!eof)
- {
- formatlist[0] = cygnativeformat;
- formatlist[1] = current_codepage == ansi_cp ? CF_TEXT : CF_OEMTEXT;
- OpenClipboard (0);
- if ((format = GetPriorityClipboardFormat (formatlist, 2)) > 0)
- {
- hglb = GetClipboardData (format);
- if (format == cygnativeformat)
- {
- unsigned char *buf = (unsigned char *) GlobalLock (hglb);
- size_t buflen = (*(size_t *) buf);
- ret = ((len > (buflen - pos)) ? (buflen - pos) : len);
- memcpy (ptr, buf + sizeof (size_t)+ pos , ret);
- pos += ret;
- if (pos + len - ret >= buflen)
- eof = true;
- GlobalUnlock (hglb);
- }
- else
- {
- LPSTR lpstr;
- lpstr = (LPSTR) GlobalLock (hglb);
-
- ret =
- ((len > (strlen (lpstr) - pos)) ? (strlen (lpstr) - pos) :
- len);
-
- memcpy (ptr, lpstr + pos, ret);
- //ret = snprintf((char *) ptr, len, "%s", lpstr);//+pos);
- pos += ret;
- if (pos + len - ret >= strlen (lpstr))
- eof = true;
- GlobalUnlock (hglb);
- }
- CloseClipboard ();
- set_errno (0);
- return ret;
- }
- else
- {
- CloseClipboard ();
-#if 0
- system_printf ("a non-accepted format! %d\n", format);
-#endif
- set_errno (0);
- return 0;
- }
- }
- else
- {
- return 0;
- }
-}
-
-__off64_t
-fhandler_dev_clipboard::lseek (__off64_t offset, int whence)
-{
- /* On reads we check this at read time, not seek time.
- * On writes we use this to decide how to write - empty and write, or open, copy, empty
- * and write
- */
- pos = offset;
- /* treat seek like rewind */
- if (membuffer)
- free (membuffer);
- msize = 0;
- return 0;
-}
-
-int
-fhandler_dev_clipboard::close (void)
-{
- eof = true;
- pos = 0;
- if (membuffer)
- free (membuffer);
- msize = 0;
- return 0;
-}
-
-void
-fhandler_dev_clipboard::dump ()
-{
- paranoid_printf ("here, fhandler_dev_clipboard");
-}
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
deleted file mode 100644
index cc948d3d0..000000000
--- a/winsup/cygwin/fhandler_console.cc
+++ /dev/null
@@ -1,1778 +0,0 @@
-/* fhandler_console.cc
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <sys/termios.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <unistd.h>
-#include <wingdi.h>
-#include <winuser.h>
-#include <wincon.h>
-#include <winnls.h> // MultiByteToWideChar () and friends
-#include <ctype.h>
-#include <sys/cygwin.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygheap.h"
-#include "sigproc.h"
-#include "pinfo.h"
-#include "shared_info.h"
-
-#define CONVERT_LIMIT 4096
-
-/* The codepages are resolved here instead of using CP_ACP and
- CP_OEMCP, so that they can later be compared for equality. */
-inline UINT
-cp_get_internal ()
-{
- return current_codepage == ansi_cp ? GetACP() : GetOEMCP();
-}
-
-static BOOL
-cp_convert (UINT destcp, char * dest, UINT srccp, const char * src, DWORD size)
-{
- if (!size)
- /* no action */;
- else if (destcp == srccp)
- {
- if (dest != src)
- memcpy (dest, src, size);
- }
- else
- {
- WCHAR wbuffer[CONVERT_LIMIT]; /* same size as the maximum input, s.b. */
- if (!MultiByteToWideChar (srccp, 0, src, size, wbuffer, sizeof (wbuffer)))
- return FALSE;
- if (!WideCharToMultiByte (destcp, 0, wbuffer, size, dest, size,
- NULL, NULL))
- return FALSE;
- }
- return TRUE;
-}
-
-/* The results of GetConsoleCP() and GetConsoleOutputCP() cannot be
- cached, because a program or the user can change these values at
- any time. */
-inline BOOL
-con_to_str (char *d, const char *s, DWORD sz)
-{
- return cp_convert (cp_get_internal (), d, GetConsoleCP (), s, sz);
-}
-
-inline BOOL
-str_to_con (char *d, const char *s, DWORD sz)
-{
- return cp_convert (GetConsoleOutputCP (), d, cp_get_internal (), s, sz);
-}
-
-/*
- * Scroll the screen context.
- * x1, y1 - ul corner
- * x2, y2 - dr corner
- * xn, yn - new ul corner
- * Negative values represents current screen dimensions
- */
-
-#define srTop (info.winTop + scroll_region.Top)
-#define srBottom ((scroll_region.Bottom < 0) ? info.winBottom : info.winTop + scroll_region.Bottom)
-
-#define use_tty ISSTATE (myself, PID_USETTY)
-
-const char * get_nonascii_key (INPUT_RECORD&, char *);
-
-static tty_min NO_COPY *shared_console_info = NULL;
-
-/* Allocate and initialize the shared record for the current console.
- Returns a pointer to shared_console_info. */
-static tty_min *
-get_tty_stuff (int flags = 0)
-{
- if (shared_console_info)
- return shared_console_info;
-
- shared_console_info = (tty_min *) open_shared (NULL, 0, cygheap->console_h,
- sizeof (*shared_console_info),
- NULL);
- ProtectHandle (cygheap->console_h);
- if (!shared_console_info->ntty)
- {
- shared_console_info->setntty (TTY_CONSOLE);
- shared_console_info->setsid (myself->sid);
- shared_console_info->set_ctty (TTY_CONSOLE, flags);
- }
- return shared_console_info;
-}
-
-void
-set_console_ctty ()
-{
- (void) get_tty_stuff ();
-}
-
-/* Return the tty structure associated with a given tty number. If the
- tty number is < 0, just return a dummy record. */
-tty_min *
-tty_list::get_tty (int n)
-{
- static tty_min nada;
- if (n == TTY_CONSOLE)
- return get_tty_stuff ();
- else if (n >= 0)
- return &cygwin_shared->tty.ttys[n];
- else
- return &nada;
-}
-
-
-/* Determine if a console is associated with this process prior to a spawn.
- If it is, then we'll return 1. If the console has been initialized, then
- set it into a more friendly state for non-cygwin apps. */
-int __stdcall
-set_console_state_for_spawn ()
-{
- HANDLE h = CreateFileA ("CONIN$", GENERIC_READ, FILE_SHARE_WRITE,
- &sec_none_nih, OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL, NULL);
-
- if (h == INVALID_HANDLE_VALUE || h == NULL)
- return 0;
-
- if (shared_console_info != NULL)
- {
-# define tc shared_console_info /* ACK. Temporarily define for use in TTYSETF macro */
- SetConsoleMode (h, ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT);
- TTYSETF (RSTCONS);
-#if 0
- char ch;
- DWORD n;
- /* NOTE -- This ReadFile is apparently necessary for correct functioning on
- Windows NT 4.0. Without this, the next ReadFile returns garbage. */
- (void) ReadFile (h, &ch, 0, &n, NULL);
-#endif
-# undef tc
- }
-
- CloseHandle (h);
- return 1;
-}
-
-BOOL
-fhandler_console::set_raw_win32_keyboard_mode (BOOL new_mode)
-{
- BOOL old_mode = raw_win32_keyboard_mode;
- raw_win32_keyboard_mode = new_mode;
- syscall_printf ("raw keyboard mode %sabled", raw_win32_keyboard_mode ? "en" : "dis");
- return old_mode;
-};
-
-void
-fhandler_console::set_cursor_maybe ()
-{
- CONSOLE_SCREEN_BUFFER_INFO now;
-
- if (!GetConsoleScreenBufferInfo (get_output_handle (), &now))
- return;
-
- if (dwLastCursorPosition.X != now.dwCursorPosition.X ||
- dwLastCursorPosition.Y != now.dwCursorPosition.Y)
- {
- SetConsoleCursorPosition (get_output_handle (), now.dwCursorPosition);
- dwLastCursorPosition = now.dwCursorPosition;
- }
-}
-
-int __stdcall
-fhandler_console::read (void *pv, size_t buflen)
-{
- HANDLE h = get_io_handle ();
-
-#define buf ((char *) pv)
-
- int ch;
- set_input_state ();
-
- int copied_chars = get_readahead_into_buffer (buf, buflen);
-
- if (copied_chars)
- return copied_chars;
-
- HANDLE w4[2];
- DWORD nwait;
- char tmp[60];
-
- w4[0] = h;
- if (iscygthread ())
- nwait = 1;
- else
- {
- w4[1] = signal_arrived;
- nwait = 2;
- }
-
- for (;;)
- {
- int bgres;
- if ((bgres = bg_check (SIGTTIN)) <= bg_eof)
- return bgres;
-
- set_cursor_maybe (); /* to make cursor appear on the screen immediately */
- switch (WaitForMultipleObjects (nwait, w4, FALSE, INFINITE))
- {
- case WAIT_OBJECT_0:
- break;
- case WAIT_OBJECT_0 + 1:
- goto sig_exit;
- default:
- __seterrno ();
- return -1;
- }
-
- DWORD nread;
- INPUT_RECORD input_rec;
- const char *toadd = NULL;
-
- if (!ReadConsoleInput (h, &input_rec, 1, &nread))
- {
- __seterrno ();
- syscall_printf ("ReadConsoleInput failed, %E");
- return -1; /* seems to be failure */
- }
-
- /* check the event that occurred */
- switch (input_rec.EventType)
- {
- case KEY_EVENT:
-#define virtual_key_code (input_rec.Event.KeyEvent.wVirtualKeyCode)
-#define control_key_state (input_rec.Event.KeyEvent.dwControlKeyState)
-
-#ifdef DEBUGGING
- /* allow manual switching to/from raw mode via ctrl-alt-scrolllock */
- if (input_rec.Event.KeyEvent.bKeyDown &&
- virtual_key_code == VK_SCROLL &&
- control_key_state & (LEFT_ALT_PRESSED | LEFT_CTRL_PRESSED) == LEFT_ALT_PRESSED | LEFT_CTRL_PRESSED
- )
- {
- set_raw_win32_keyboard_mode (!raw_win32_keyboard_mode);
- continue;
- }
-#endif
-
- if (raw_win32_keyboard_mode)
- {
- __small_sprintf (tmp, "\033{%u;%u;%u;%u;%u;%luK",
- input_rec.Event.KeyEvent.bKeyDown,
- input_rec.Event.KeyEvent.wRepeatCount,
- input_rec.Event.KeyEvent.wVirtualKeyCode,
- input_rec.Event.KeyEvent.wVirtualScanCode,
- input_rec.Event.KeyEvent.uChar.UnicodeChar,
- input_rec.Event.KeyEvent.dwControlKeyState);
- toadd = tmp;
- nread = strlen (toadd);
- break;
- }
-
- if (!input_rec.Event.KeyEvent.bKeyDown)
- continue;
-
-#define ich (input_rec.Event.KeyEvent.uChar.AsciiChar)
-#define wch (input_rec.Event.KeyEvent.uChar.UnicodeChar)
-#define ALT_PRESSED (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED)
-#define CTRL_PRESSED (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)
-
- if (wch == 0 ||
- /* arrow/function keys */
- (input_rec.Event.KeyEvent.dwControlKeyState & ENHANCED_KEY))
- {
- toadd = get_nonascii_key (input_rec, tmp);
- if (!toadd)
- continue;
- nread = strlen (toadd);
- }
- else
- {
- tmp[1] = ich;
- /* Need this check since US code page seems to have a bug when
- converting a CTRL-U. */
- if ((unsigned char) ich > 0x7f)
- con_to_str (tmp + 1, tmp + 1, 1);
- /* Determine if the keystroke is modified by META. The tricky
- part is to distinguish whether the right Alt key should be
- recognized as Alt, or as AltGr. */
- bool meta;
- if (wincap.altgr_is_ctrl_alt ())
- /* WinNT: AltGr is reported as Ctrl+Alt, and Ctrl+Alt is
- treated just like AltGr. However, if Ctrl+Alt+key generates
- an ASCII control character, interpret is as META. */
- meta = (control_key_state & ALT_PRESSED) != 0
- && ((control_key_state & CTRL_PRESSED) == 0
- || (ich >= 0 && ich <= 0x1f || ich == 0x7f));
- else
- /* Win9x: there's no way to distinguish Alt from AltGr, so rely
- on meta_mask heuristic (see fhandler_console constructor). */
- meta = (control_key_state & meta_mask) != 0;
- if (!meta)
- toadd = tmp + 1;
- else
- {
- tmp[0] = '\033';
- tmp[1] = cyg_tolower (tmp[1]);
- toadd = tmp;
- nread++;
- }
- }
-#undef ich
-#undef wch
-#undef ALT_PRESSED
-#undef CTRL_PRESSED
- break;
-
- case MOUSE_EVENT:
- if (use_mouse)
- {
- MOUSE_EVENT_RECORD & mouse_event = input_rec.Event.MouseEvent;
-
- /* Treat the double-click event like a regular button press */
- if (mouse_event.dwEventFlags == DOUBLE_CLICK)
- {
- syscall_printf ("mouse: double-click -> click");
- mouse_event.dwEventFlags = 0;
- }
-
- /* Did something other than a click occur? */
- if (mouse_event.dwEventFlags)
- continue;
-
- /* If the mouse event occurred out of the area we can handle,
- ignore it. */
- int x = mouse_event.dwMousePosition.X;
- int y = mouse_event.dwMousePosition.Y;
- if ((x + ' ' + 1 > 0xFF) || (y + ' ' + 1 > 0xFF))
- {
- syscall_printf ("mouse: position out of range");
- continue;
- }
-
- /* Ignore unimportant mouse buttons */
- mouse_event.dwButtonState &= 0x7;
-
- /* This code assumes Windows never reports multiple button
- events at the same time. */
- int b = 0;
- char sz[32];
- if (mouse_event.dwButtonState == dwLastButtonState)
- {
- syscall_printf ("mouse: button state unchanged");
- continue;
- }
- else if (mouse_event.dwButtonState < dwLastButtonState)
- {
- b = 3;
- strcpy (sz, "btn up");
- }
- else if ((mouse_event.dwButtonState & 1) != (dwLastButtonState & 1))
- {
- b = 0;
- strcpy (sz, "btn1 down");
- }
- else if ((mouse_event.dwButtonState & 2) != (dwLastButtonState & 2))
- {
- b = 1;
- strcpy (sz, "btn2 down");
- }
- else if ((mouse_event.dwButtonState & 4) != (dwLastButtonState & 4))
- {
- b = 2;
- strcpy (sz, "btn3 down");
- }
-
- /* Remember the current button state */
- dwLastButtonState = mouse_event.dwButtonState;
-
- /* If a button was pressed, remember the modifiers */
- if (b != 3)
- {
- nModifiers = 0;
- if (mouse_event.dwControlKeyState & SHIFT_PRESSED)
- nModifiers |= 0x4;
- if (mouse_event.dwControlKeyState & (RIGHT_ALT_PRESSED|LEFT_ALT_PRESSED))
- nModifiers |= 0x8;
- if (mouse_event.dwControlKeyState & (RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED))
- nModifiers |= 0x10;
- }
-
- b |= nModifiers;
-
- /* We can now create the code. */
- sprintf (tmp, "\033[M%c%c%c", b + ' ', x + ' ' + 1, y + ' ' + 1);
- syscall_printf ("mouse: %s at (%d,%d)", sz, x, y);
-
- toadd = tmp;
- nread = 6;
- }
- break;
-
- case WINDOW_BUFFER_SIZE_EVENT:
- kill_pgrp (tc->getpgid (), SIGWINCH);
- continue;
-
- default:
- continue;
- }
-
- if (toadd)
- {
- int res = line_edit (toadd, nread);
- if (res < 0)
- goto sig_exit;
- else if (res)
- break;
- }
-#undef ich
- }
-
- while (buflen)
- if ((ch = get_readahead ()) < 0)
- break;
- else
- {
- buf[copied_chars++] = (unsigned char)(ch & 0xff);
- buflen--;
- }
-#undef buf
-
- return copied_chars;
-
- sig_exit:
- set_sig_errno (EINTR);
- return -1;
-}
-
-void
-fhandler_console::set_input_state ()
-{
- if (TTYISSETF (RSTCONS))
- input_tcsetattr (0, &tc->ti);
-}
-
-BOOL
-fhandler_console::fillin_info (void)
-{
- BOOL ret;
- CONSOLE_SCREEN_BUFFER_INFO linfo;
-
- if ((ret = GetConsoleScreenBufferInfo (get_output_handle (), &linfo)))
- {
- info.winTop = linfo.srWindow.Top;
- info.winBottom = linfo.srWindow.Bottom;
- info.dwWinSize.Y = 1 + linfo.srWindow.Bottom - linfo.srWindow.Top;
- info.dwWinSize.X = 1 + linfo.srWindow.Right - linfo.srWindow.Left;
- info.dwBufferSize = linfo.dwSize;
- info.dwCursorPosition = linfo.dwCursorPosition;
- info.wAttributes = linfo.wAttributes;
- }
- else
- {
- memset (&info, 0, sizeof info);
- info.dwWinSize.Y = 25;
- info.dwWinSize.X = 80;
- info.winBottom = 24;
- }
-
- return ret;
-}
-
-void
-fhandler_console::scroll_screen (int x1, int y1, int x2, int y2, int xn, int yn)
-{
- SMALL_RECT sr1, sr2;
- CHAR_INFO fill;
- COORD dest;
-
- (void)fillin_info ();
- sr1.Left = x1 >= 0 ? x1 : info.dwWinSize.X - 1;
- if (y1 == 0)
- sr1.Top = info.winTop;
- else
- sr1.Top = y1 > 0 ? y1 : info.winBottom;
- sr1.Right = x2 >= 0 ? x2 : info.dwWinSize.X - 1;
- if (y2 == 0)
- sr1.Bottom = info.winTop;
- else
- sr1.Bottom = y2 > 0 ? y2 : info.winBottom;
- sr2.Top = srTop;
- sr2.Left = 0;
- sr2.Bottom = srBottom;
- sr2.Right = info.dwWinSize.X - 1;
- if (sr1.Bottom > sr2.Bottom && sr1.Top <= sr2.Bottom)
- sr1.Bottom = sr2.Bottom;
- dest.X = xn >= 0 ? xn : info.dwWinSize.X - 1;
- if (yn == 0)
- dest.Y = info.winTop;
- else
- dest.Y = yn > 0 ? yn : info.winBottom;
- fill.Char.AsciiChar = ' ';
- fill.Attributes = current_win32_attr;
- ScrollConsoleScreenBuffer (get_output_handle (), &sr1, &sr2, dest, &fill);
-
- /* ScrollConsoleScreenBuffer on Windows 95 is buggy - when scroll distance
- * is more than half of screen, filling doesn't work as expected */
-
- if (sr1.Top != sr1.Bottom)
- if (dest.Y <= sr1.Top) /* forward scroll */
- clear_screen (0, 1 + dest.Y + sr1.Bottom - sr1.Top, sr2.Right, sr2.Bottom);
- else /* reverse scroll */
- clear_screen (0, sr1.Top, sr2.Right, dest.Y - 1);
-}
-
-int
-fhandler_console::open (path_conv *, int flags, mode_t)
-{
- HANDLE h;
-
- tcinit (get_tty_stuff (flags));
-
- set_io_handle (INVALID_HANDLE_VALUE);
- set_output_handle (INVALID_HANDLE_VALUE);
-
- set_flags (flags & ~O_TEXT, O_BINARY);
-
- /* Open the input handle as handle_ */
- h = CreateFileA ("CONIN$", GENERIC_READ|GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE, &sec_none,
- OPEN_EXISTING, 0, 0);
-
- if (h == INVALID_HANDLE_VALUE)
- {
- __seterrno ();
- return 0;
- }
- set_io_handle (h);
- set_r_no_interrupt (1); // Handled explicitly in read code
-
- h = CreateFileA ("CONOUT$", GENERIC_READ|GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE, &sec_none,
- OPEN_EXISTING, 0, 0);
-
- if (h == INVALID_HANDLE_VALUE)
- {
- __seterrno ();
- return 0;
- }
- set_output_handle (h);
-
- if (fillin_info ())
- default_color = info.wAttributes;
-
- set_default_attr ();
-
- DWORD cflags;
- if (GetConsoleMode (get_io_handle (), &cflags))
- {
- cflags |= ENABLE_PROCESSED_INPUT;
- SetConsoleMode (get_io_handle (), ENABLE_WINDOW_INPUT | ENABLE_MOUSE_INPUT | cflags);
- }
-
- TTYCLEARF (RSTCONS);
- set_open_status ();
- debug_printf ("opened conin$ %p, conout$ %p",
- get_io_handle (), get_output_handle ());
-
- return 1;
-}
-
-int
-fhandler_console::close (void)
-{
- CloseHandle (get_io_handle ());
- CloseHandle (get_output_handle ());
- set_io_handle (INVALID_HANDLE_VALUE);
- set_output_handle (INVALID_HANDLE_VALUE);
- return 0;
-}
-
-/*
- * Special console dup to duplicate input and output
- * handles.
- */
-
-int
-fhandler_console::dup (fhandler_base *child)
-{
- fhandler_console *fhc = (fhandler_console *) child;
-
- if (!fhc->open (NULL, get_flags () & ~O_NOCTTY, 0))
- system_printf ("error opening console, %E");
-
- fhc->default_color = default_color;
- fhc->underline_color = underline_color;
- fhc->dim_color = dim_color;
- fhc->state_ = state_;
- fhc->nargs_ = nargs_;
- for (int i = 0; i < MAXARGS; i++)
- fhc->args_[i] = args_[i];
- fhc->rarg = rarg;
- fhc->saw_question_mark = saw_question_mark;
-
- strncpy (fhc->my_title_buf, my_title_buf, TITLESIZE + 1) ;
-
- fhc->current_win32_attr = current_win32_attr;
- fhc->intensity = intensity;
- fhc->underline = underline;
- fhc->blink = blink;
- fhc->reverse = reverse;
- fhc->fg = fg;
- fhc->bg = bg;
-
- fhc->savex = savex;
- fhc->savey = savey;
-
- fhc->savebufsiz = savebufsiz;
- if (savebuf)
- {
- fhc->savebuf = (PCHAR_INFO) cmalloc (HEAP_1_BUF, sizeof (CHAR_INFO) *
- savebufsiz.X * savebufsiz.Y);
- memcpy (fhc->savebuf, savebuf, sizeof (CHAR_INFO) *
- savebufsiz.X * savebufsiz.Y);
- }
-
- fhc->scroll_region = scroll_region;
- fhc->dwLastCursorPosition = dwLastCursorPosition;
- fhc->dwLastButtonState = dwLastButtonState;
- fhc->nModifiers = nModifiers;
-
- fhc->insert_mode = insert_mode;
- fhc->use_mouse = use_mouse;
- fhc->raw_win32_keyboard_mode = raw_win32_keyboard_mode;
-
- return 0;
-}
-
-int
-fhandler_console::ioctl (unsigned int cmd, void *buf)
-{
- switch (cmd)
- {
- case TIOCGWINSZ:
- int st;
-
- st = fillin_info ();
- if (st)
- {
- /* *not* the buffer size, the actual screen size... */
- /* based on Left Top Right Bottom of srWindow */
- ((struct winsize *) buf)->ws_row = info.dwWinSize.Y;
- ((struct winsize *) buf)->ws_col = info.dwWinSize.X;
- syscall_printf ("WINSZ: (row=%d,col=%d)",
- ((struct winsize *) buf)->ws_row,
- ((struct winsize *) buf)->ws_col);
- return 0;
- }
- else
- {
- syscall_printf ("WINSZ failed");
- __seterrno ();
- return -1;
- }
- return 0;
- case TIOCSWINSZ:
- (void) bg_check (SIGTTOU);
- return 0;
- }
-
- return fhandler_base::ioctl (cmd, buf);
-}
-
-int
-fhandler_console::tcflush (int queue)
-{
- int res = 0;
- if (queue == TCIFLUSH
- || queue == TCIOFLUSH)
- {
- if (!FlushConsoleInputBuffer (get_io_handle ()))
- {
- __seterrno ();
- res = -1;
- }
- }
- return res;
-}
-
-int
-fhandler_console::output_tcsetattr (int, struct termios const *t)
-{
- /* All the output bits we can ignore */
-
- DWORD flags = ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT;
-
- int res = SetConsoleMode (get_output_handle (), flags) ? 0 : -1;
- syscall_printf ("%d = tcsetattr (,%x) (ENABLE FLAGS %x) (lflag %x oflag %x)",
- res, t, flags, t->c_lflag, t->c_oflag);
- return res;
-}
-
-int
-fhandler_console::input_tcsetattr (int, struct termios const *t)
-{
- /* Ignore the optional_actions stuff, since all output is emitted
- instantly */
-
- DWORD oflags;
-
- if (!GetConsoleMode (get_io_handle (), &oflags))
- oflags = 0;
- DWORD flags = 0;
-
-#if 0
- /* Enable/disable LF -> CRLF conversions */
- set_r_binary ((t->c_iflag & INLCR) ? 0 : 1);
-#endif
-
- /* There's some disparity between what we need and what's
- available. We've got ECHO and ICANON, they've
- got ENABLE_ECHO_INPUT and ENABLE_LINE_INPUT. */
-
- tc->ti = *t;
-
- if (t->c_lflag & ECHO)
- {
- flags |= ENABLE_ECHO_INPUT;
- }
- if (t->c_lflag & ICANON)
- {
- flags |= ENABLE_LINE_INPUT;
- }
-
- if (flags & ENABLE_ECHO_INPUT
- && !(flags & ENABLE_LINE_INPUT))
- {
- /* This is illegal, so turn off the echo here, and fake it
- when we read the characters */
-
- flags &= ~ENABLE_ECHO_INPUT;
- }
-
- if (t->c_lflag & ISIG)
- {
- flags |= ENABLE_PROCESSED_INPUT;
- }
- /* What about ENABLE_WINDOW_INPUT
- and ENABLE_MOUSE_INPUT ? */
-
- if (use_tty)
- {
- flags = 0; // ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT;
- tc->ti.c_iflag = 0;
- tc->ti.c_lflag = 0;
- }
-
- flags |= ENABLE_WINDOW_INPUT | ENABLE_MOUSE_INPUT;
-
- int res;
- if (flags == oflags)
- res = 0;
- else
- {
- res = SetConsoleMode (get_io_handle (), flags) ? 0 : -1;
- if (res < 0)
- __seterrno ();
- syscall_printf ("%d = tcsetattr (,%x) enable flags %p, c_lflag %p iflag %p",
- res, t, flags, t->c_lflag, t->c_iflag);
- }
-
- TTYCLEARF (RSTCONS);
- return res;
-}
-
-int
-fhandler_console::tcsetattr (int a, struct termios const *t)
-{
- int res = output_tcsetattr (a, t);
- if (res != 0)
- return res;
- return input_tcsetattr (a, t);
-}
-
-int
-fhandler_console::tcgetattr (struct termios *t)
-{
- int res;
- *t = tc->ti;
-
- t->c_cflag |= CS8;
-
- DWORD flags;
-
- if (!GetConsoleMode (get_io_handle (), &flags))
- {
- __seterrno ();
- res = -1;
- }
- else
- {
- if (flags & ENABLE_ECHO_INPUT)
- t->c_lflag |= ECHO;
-
- if (flags & ENABLE_LINE_INPUT)
- t->c_lflag |= ICANON;
-
- if (flags & ENABLE_PROCESSED_INPUT)
- t->c_lflag |= ISIG;
-
- /* What about ENABLE_WINDOW_INPUT
- and ENABLE_MOUSE_INPUT ? */
-
- /* All the output bits we can ignore */
- res = 0;
- }
- syscall_printf ("%d = tcgetattr (%p) enable flags %p, t->lflag %p, t->iflag %p",
- res, t, flags, t->c_lflag, t->c_iflag);
- return res;
-}
-
-fhandler_console::fhandler_console () :
- fhandler_termios (FH_CONSOLE, -1),
- default_color (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE),
- underline_color (FOREGROUND_GREEN | FOREGROUND_BLUE),
- dim_color (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE),
- meta_mask (LEFT_ALT_PRESSED), state_ (normal), nargs_ (0), savex (0),
- savey (0), savebuf (NULL), dwLastButtonState (0), nModifiers (0),
- insert_mode (false), use_mouse (false), raw_win32_keyboard_mode (false)
-{
- for (int i = 0; i < MAXARGS; i++) args_ [i] = 0;
- savebufsiz.X = savebufsiz.Y = 0;
- scroll_region.Top = 0;
- scroll_region.Bottom = -1;
- dwLastCursorPosition.X = -1;
- dwLastCursorPosition.Y = -1;
- /* Set the mask that determines if an input keystroke is modified by
- META. We set this based on the keyboard layout language loaded
- for the current thread. The left <ALT> key always generates
- META, but the right <ALT> key only generates META if we are using
- an English keyboard because many "international" keyboards
- replace common shell symbols ('[', '{', etc.) with accented
- language-specific characters (umlaut, accent grave, etc.). On
- these keyboards right <ALT> (called AltGr) is used to produce the
- shell symbols and should not be interpreted as META. */
- if (PRIMARYLANGID (LOWORD (GetKeyboardLayout (0))) == LANG_ENGLISH)
- meta_mask |= RIGHT_ALT_PRESSED;
-
-}
-
-#define FOREGROUND_ATTR_MASK (FOREGROUND_RED | FOREGROUND_GREEN | \
- FOREGROUND_BLUE | FOREGROUND_INTENSITY)
-#define BACKGROUND_ATTR_MASK (BACKGROUND_RED | BACKGROUND_GREEN | \
- BACKGROUND_BLUE | BACKGROUND_INTENSITY)
-void
-fhandler_console::set_default_attr ()
-{
- blink = underline = reverse = FALSE;
- intensity = INTENSITY_NORMAL;
- fg = default_color & FOREGROUND_ATTR_MASK;
- bg = default_color & BACKGROUND_ATTR_MASK;
- current_win32_attr = get_win32_attr ();
- SetConsoleTextAttribute (get_output_handle (), current_win32_attr);
-}
-
-WORD
-fhandler_console::get_win32_attr ()
-{
- WORD win_fg = fg;
- WORD win_bg = bg;
- if (reverse)
- {
- WORD save_fg = win_fg;
- win_fg = (win_bg & BACKGROUND_RED ? FOREGROUND_RED : 0) |
- (win_bg & BACKGROUND_GREEN ? FOREGROUND_GREEN : 0) |
- (win_bg & BACKGROUND_BLUE ? FOREGROUND_BLUE : 0) |
- (win_fg & FOREGROUND_INTENSITY);
- win_bg = (save_fg & FOREGROUND_RED ? BACKGROUND_RED : 0) |
- (save_fg & FOREGROUND_GREEN ? BACKGROUND_GREEN : 0) |
- (save_fg & FOREGROUND_BLUE ? BACKGROUND_BLUE : 0) |
- (win_bg & BACKGROUND_INTENSITY);
- }
- if (underline) win_fg = underline_color;
- /* emulate blink with bright background */
- if (blink) win_bg |= BACKGROUND_INTENSITY;
- if (intensity == INTENSITY_INVISIBLE)
- win_fg = win_bg;
- else if (intensity == INTENSITY_BOLD)
- win_fg |= FOREGROUND_INTENSITY;
- return (win_fg | win_bg);
-}
-
-/*
- * Clear the screen context from x1/y1 to x2/y2 cell.
- * Negative values represents current screen dimensions
- */
-void
-fhandler_console::clear_screen (int x1, int y1, int x2, int y2)
-{
- COORD tlc;
- DWORD done;
- int num;
-
- (void)fillin_info ();
-
- if (x1 < 0)
- x1 = info.dwWinSize.X - 1;
- if (y1 < 0)
- y1 = info.winBottom;
- if (x2 < 0)
- x2 = info.dwWinSize.X - 1;
- if (y2 < 0)
- y2 = info.winBottom;
-
- num = abs (y1 - y2) * info.dwBufferSize.X + abs (x1 - x2) + 1;
-
- if ((y2 * info.dwBufferSize.X + x2) > (y1 * info.dwBufferSize.X + x1))
- {
- tlc.X = x1;
- tlc.Y = y1;
- }
- else
- {
- tlc.X = x2;
- tlc.Y = y2;
- }
- FillConsoleOutputCharacterA (get_output_handle (), ' ',
- num,
- tlc,
- &done);
- FillConsoleOutputAttribute (get_output_handle (),
- current_win32_attr,
- num,
- tlc,
- &done);
-}
-
-void
-fhandler_console::cursor_set (BOOL rel_to_top, int x, int y)
-{
- COORD pos;
-
- (void)fillin_info ();
- if (y > info.winBottom)
- y = info.winBottom;
- else if (y < 0)
- y = 0;
- else if (rel_to_top)
- y += info.winTop;
-
- if (x > info.dwWinSize.X)
- x = info.dwWinSize.X - 1;
- else if (x < 0)
- x = 0;
-
- pos.X = x;
- pos.Y = y;
- SetConsoleCursorPosition (get_output_handle (), pos);
-}
-
-void
-fhandler_console::cursor_rel (int x, int y)
-{
- fillin_info ();
- x += info.dwCursorPosition.X;
- y += info.dwCursorPosition.Y;
- cursor_set (FALSE, x, y);
-}
-
-void
-fhandler_console::cursor_get (int *x, int *y)
-{
- fillin_info ();
- *y = info.dwCursorPosition.Y;
- *x = info.dwCursorPosition.X;
-}
-
-#define BAK 1
-#define ESC 2
-#define NOR 0
-#define IGN 4
-#if 0
-#define ERR 5
-#else
-#define ERR NOR
-#endif
-#define DWN 6
-#define BEL 7
-#define TAB 8 /* We should't let the console deal with these */
-#define CR 13
-#define LF 10
-
-static const char base_chars[256] =
-{
-/*00 01 02 03 04 05 06 07 */ IGN, ERR, ERR, NOR, NOR, NOR, NOR, BEL,
-/*08 09 0A 0B 0C 0D 0E 0F */ BAK, TAB, DWN, ERR, ERR, CR, ERR, IGN,
-/*10 11 12 13 14 15 16 17 */ NOR, NOR, ERR, ERR, ERR, ERR, ERR, ERR,
-/*18 19 1A 1B 1C 1D 1E 1F */ NOR, NOR, ERR, ESC, ERR, ERR, ERR, ERR,
-/* ! " # $ % & ' */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*() * + , - . / */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*0 1 2 3 4 5 6 7 */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*8 9 : ; < = > ? */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*@ A B C D E F G */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*H I J K L M N O */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*P Q R S T U V W */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*X Y Z [ \ ] ^ _ */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*` a b c d e f g */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*h i j k l m n o */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*p q r s t u v w */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*x y z { | } ~ 7F */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*80 81 82 83 84 85 86 87 */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*88 89 8A 8B 8C 8D 8E 8F */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*90 91 92 93 94 95 96 97 */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*98 99 9A 9B 9C 9D 9E 9F */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*A0 A1 A2 A3 A4 A5 A6 A7 */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*A8 A9 AA AB AC AD AE AF */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*B0 B1 B2 B3 B4 B5 B6 B7 */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*B8 B9 BA BB BC BD BE BF */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*C0 C1 C2 C3 C4 C5 C6 C7 */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*C8 C9 CA CB CC CD CE CF */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*D0 D1 D2 D3 D4 D5 D6 D7 */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*D8 D9 DA DB DC DD DE DF */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*E0 E1 E2 E3 E4 E5 E6 E7 */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*E8 E9 EA EB EC ED EE EF */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*F0 F1 F2 F3 F4 F5 F6 F7 */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR,
-/*F8 F9 FA FB FC FD FE FF */ NOR, NOR, NOR, NOR, NOR, NOR, NOR, NOR };
-
-void
-fhandler_console::char_command (char c)
-{
- int x, y;
- char buf[40];
-
- switch (c)
- {
- case 'm': /* Set Graphics Rendition */
- int i;
-
- for (i = 0; i <= nargs_; i++)
- switch (args_[i])
- {
- case 0: /* normal color */
- set_default_attr ();
- break;
- case 1: /* bold */
- intensity = INTENSITY_BOLD;
- break;
- case 4:
- underline = 1;
- break;
- case 5: /* blink mode */
- blink = TRUE;
- break;
- case 7: /* reverse */
- reverse = TRUE;
- break;
- case 8: /* invisible */
- intensity = INTENSITY_INVISIBLE;
- break;
- case 9: /* dim */
- intensity = INTENSITY_DIM;
- break;
- case 24:
- underline = FALSE;
- break;
- case 27:
- reverse = FALSE;
- break;
- case 30: /* BLACK foreground */
- fg = 0;
- break;
- case 31: /* RED foreground */
- fg = FOREGROUND_RED;
- break;
- case 32: /* GREEN foreground */
- fg = FOREGROUND_GREEN;
- break;
- case 33: /* YELLOW foreground */
- fg = FOREGROUND_RED | FOREGROUND_GREEN;
- break;
- case 34: /* BLUE foreground */
- fg = FOREGROUND_BLUE;
- break;
- case 35: /* MAGENTA foreground */
- fg = FOREGROUND_RED | FOREGROUND_BLUE;
- break;
- case 36: /* CYAN foreground */
- fg = FOREGROUND_BLUE | FOREGROUND_GREEN;
- break;
- case 37: /* WHITE foreg */
- fg = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED;
- break;
- case 39:
- fg = default_color & FOREGROUND_ATTR_MASK;
- break;
- case 40: /* BLACK background */
- bg = 0;
- break;
- case 41: /* RED background */
- bg = BACKGROUND_RED;
- break;
- case 42: /* GREEN background */
- bg = BACKGROUND_GREEN;
- break;
- case 43: /* YELLOW background */
- bg = BACKGROUND_RED | BACKGROUND_GREEN;
- break;
- case 44: /* BLUE background */
- bg = BACKGROUND_BLUE;
- break;
- case 45: /* MAGENTA background */
- bg = BACKGROUND_RED | BACKGROUND_BLUE;
- break;
- case 46: /* CYAN background */
- bg = BACKGROUND_BLUE | BACKGROUND_GREEN;
- break;
- case 47: /* WHITE background */
- bg = BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED;
- break;
- case 49:
- bg = default_color & BACKGROUND_ATTR_MASK;
- break;
- }
- current_win32_attr = get_win32_attr ();
- SetConsoleTextAttribute (get_output_handle (), current_win32_attr);
- break;
- case 'h':
- case 'l':
- if (!saw_question_mark)
- {
- switch (args_[0])
- {
- case 4: /* Insert mode */
- insert_mode = (c == 'h') ? TRUE : FALSE;
- syscall_printf ("insert mode %sabled", insert_mode ? "en" : "dis");
- break;
- }
- break;
- }
- switch (args_[0])
- {
- case 47: /* Save/Restore screen */
- if (c == 'h') /* save */
- {
- CONSOLE_SCREEN_BUFFER_INFO now;
- COORD cob = { 0, 0 };
-
- if (!GetConsoleScreenBufferInfo (get_output_handle (), &now))
- break;
-
- savebufsiz.X = now.srWindow.Right - now.srWindow.Left + 1;
- savebufsiz.Y = now.srWindow.Bottom - now.srWindow.Top + 1;
-
- if (savebuf)
- cfree (savebuf);
- savebuf = (PCHAR_INFO) cmalloc (HEAP_1_BUF, sizeof (CHAR_INFO) *
- savebufsiz.X * savebufsiz.Y);
-
- ReadConsoleOutputA (get_output_handle (), savebuf,
- savebufsiz, cob, &now.srWindow);
- }
- else /* restore */
- {
- CONSOLE_SCREEN_BUFFER_INFO now;
- COORD cob = { 0, 0 };
-
- if (!GetConsoleScreenBufferInfo (get_output_handle (), &now))
- break;
-
- if (!savebuf)
- break;
-
- WriteConsoleOutputA (get_output_handle (), savebuf,
- savebufsiz, cob, &now.srWindow);
-
- cfree (savebuf);
- savebuf = NULL;
- savebufsiz.X = savebufsiz.Y = 0;
- }
- break;
-
- case 1000: /* Mouse support */
- use_mouse = (c == 'h') ? TRUE : FALSE;
- syscall_printf ("mouse support %sabled", use_mouse ? "en" : "dis");
- break;
-
- case 2000: /* Raw keyboard mode */
- set_raw_win32_keyboard_mode ((c == 'h') ? TRUE : FALSE);
- break;
-
- default: /* Ignore */
- syscall_printf ("unknown h/l command: %d", args_[0]);
- break;
- }
- break;
- case 'J':
- switch (args_[0])
- {
- case 0: /* Clear to end of screen */
- cursor_get (&x, &y);
- clear_screen (x, y, -1, -1);
- break;
- case 1: /* Clear from beginning of screen to cursor */
- cursor_get (&x, &y);
- clear_screen (0, 0, x, y);
- break;
- case 2: /* Clear screen */
- clear_screen (0, 0, -1, -1);
- cursor_set (TRUE, 0,0);
- break;
- default:
- goto bad_escape;
- }
- break;
-
- case 'A':
- cursor_rel (0, -(args_[0] ? args_[0] : 1));
- break;
- case 'B':
- cursor_rel (0, args_[0] ? args_[0] : 1);
- break;
- case 'C':
- cursor_rel (args_[0] ? args_[0] : 1, 0);
- break;
- case 'D':
- cursor_rel (-(args_[0] ? args_[0] : 1),0);
- break;
- case 'K':
- switch (args_[0])
- {
- case 0: /* Clear to end of line */
- cursor_get (&x, &y);
- clear_screen (x, y, -1, y);
- break;
- case 2: /* Clear line */
- cursor_get (&x, &y);
- clear_screen (0, y, -1, y);
- break;
- case 1: /* Clear from bol to cursor */
- cursor_get (&x, &y);
- clear_screen (0, y, x, y);
- break;
- default:
- goto bad_escape;
- }
- break;
- case 'H':
- case 'f':
- cursor_set (TRUE, (args_[1] ? args_[1] : 1) - 1,
- (args_[0] ? args_[0] : 1) - 1);
- break;
- case 'G': /* hpa - position cursor at column n - 1 */
- cursor_get (&x, &y);
- cursor_set (FALSE, (args_[0] ? args_[0] - 1 : 0), y);
- break;
- case 'd': /* vpa - position cursor at line n */
- cursor_get (&x, &y);
- cursor_set (TRUE, x, (args_[0] ? args_[0] - 1 : 0));
- break;
- case 's': /* Save cursor position */
- cursor_get (&savex, &savey);
- savey -= info.winTop;
- break;
- case 'u': /* Restore cursor position */
- cursor_set (TRUE, savex, savey);
- break;
- case 'I': /* TAB */
- cursor_get (&x, &y);
- cursor_set (FALSE, 8 * (x / 8 + 1), y);
- break;
- case 'L': /* AL - insert blank lines */
- args_[0] = args_[0] ? args_[0] : 1;
- cursor_get (&x, &y);
- scroll_screen (0, y, -1, -1, 0, y + args_[0]);
- break;
- case 'M': /* DL - delete lines */
- args_[0] = args_[0] ? args_[0] : 1;
- cursor_get (&x, &y);
- scroll_screen (0, y + args_[0], -1, -1, 0, y);
- break;
- case '@': /* IC - insert chars */
- args_[0] = args_[0] ? args_[0] : 1;
- cursor_get (&x, &y);
- scroll_screen (x, y, -1, y, x + args_[0], y);
- break;
- case 'P': /* DC - delete chars */
- args_[0] = args_[0] ? args_[0] : 1;
- cursor_get (&x, &y);
- scroll_screen (x + args_[0], y, -1, y, x, y);
- break;
- case 'S': /* SF - Scroll forward */
- args_[0] = args_[0] ? args_[0] : 1;
- scroll_screen (0, args_[0], -1, -1, 0, 0);
- break;
- case 'T': /* SR - Scroll down */
- fillin_info ();
- args_[0] = args_[0] ? args_[0] : 1;
- scroll_screen (0, 0, -1, -1, 0, info.winTop + args_[0]);
- break;
- case 'X': /* ec - erase chars */
- args_[0] = args_[0] ? args_[0] : 1;
- cursor_get (&x, &y);
- scroll_screen (x + args_[0], y, -1, y, x, y);
- scroll_screen (x, y, -1, y, x + args_[0], y);
- break;
- case 'Z': /* Back tab */
- cursor_get (&x, &y);
- cursor_set (FALSE, ((8 * (x / 8 + 1)) - 8), y);
- break;
- case 'b': /* Repeat char #1 #2 times */
- if (insert_mode)
- {
- cursor_get (&x, &y);
- scroll_screen (x, y, -1, y, x + args_[1], y);
- }
- while (args_[1]--)
- WriteFile (get_output_handle (), &args_[0], 1, (DWORD *) &x, 0);
- break;
- case 'c': /* u9 - Terminal enquire string */
- strcpy (buf, "\033[?6c");
- puts_readahead (buf);
- break;
- case 'n':
- switch (args_[0])
- {
- case 6: /* u7 - Cursor position request */
- cursor_get (&x, &y);
- y -= info.winTop;
- /* x -= info.winLeft; // not available yet */
- __small_sprintf (buf, "\033[%d;%dR", y + 1, x + 1);
- puts_readahead (buf);
- break;
- default:
- goto bad_escape;
- }
- break;
- case 'r': /* Set Scroll region */
- scroll_region.Top = args_[0] ? args_[0] - 1 : 0;
- scroll_region.Bottom = args_[1] ? args_[1] - 1 : -1;
- cursor_set (TRUE, 0, 0);
- break;
- case 'g': /* TAB set/clear */
- break;
- default:
-bad_escape:
- break;
- }
-}
-
-const unsigned char *
-fhandler_console::write_normal (const unsigned char *src,
- const unsigned char *end)
-{
- /* Scan forward to see what a char which needs special treatment */
- DWORD done;
- const unsigned char *found = src;
-
- while (found < end)
- {
- if (base_chars[*found] != NOR)
- break;
- found++;
- }
-
- /* Print all the base ones out */
- if (found != src)
- {
- DWORD len = found - src;
- do
- {
- DWORD buf_len;
- char buf[CONVERT_LIMIT];
- done = buf_len = min (sizeof (buf), len);
- if (!str_to_con (buf, (const char *) src, buf_len))
- {
- debug_printf ("conversion error, handle %p", get_output_handle ());
- __seterrno ();
- return 0;
- }
-
- if (insert_mode)
- {
- int x, y;
- cursor_get (&x, &y);
- scroll_screen (x, y, -1, y, x + buf_len, y);
- }
-
- if (!WriteFile (get_output_handle (), buf, buf_len, &done, 0))
- {
- debug_printf ("write failed, handle %p", get_output_handle ());
- __seterrno ();
- return 0;
- }
- len -= done;
- src += done;
- }
- while (len > 0);
- }
-
- if (src < end)
- {
- int x, y;
- switch (base_chars[*src])
- {
- case BEL:
- Beep (412, 100);
- break;
- case ESC:
- state_ = gotesc;
- break;
- case DWN:
- cursor_get (&x, &y);
- if (y >= srBottom)
- {
- if (y >= info.winBottom && !scroll_region.Top)
- WriteFile (get_output_handle (), "\n", 1, &done, 0);
- else
- {
- scroll_screen (0, srTop + 1, -1, srBottom, 0, srTop);
- y--;
- }
- }
- cursor_set (FALSE, ((tc->ti.c_oflag & ONLCR) ? 0 : x), y + 1);
- break;
- case BAK:
- cursor_rel (-1, 0);
- break;
- case IGN:
- cursor_rel (1, 0);
- break;
- case CR:
- cursor_get (&x, &y);
- cursor_set (FALSE, 0, y);
- break;
- case ERR:
- WriteFile (get_output_handle (), src, 1, &done, 0);
- break;
- case TAB:
- cursor_get (&x, &y);
- cursor_set (FALSE, 8 * (x / 8 + 1), y);
- break;
- }
- src ++;
- }
- return src;
-}
-
-int
-fhandler_console::write (const void *vsrc, size_t len)
-{
- /* Run and check for ansi sequences */
- unsigned const char *src = (unsigned char *) vsrc;
- unsigned const char *end = src + len;
-
- debug_printf ("%x, %d", vsrc, len);
-
- while (src < end)
- {
- debug_printf ("at %d(%c) state is %d", *src, isprint (*src) ? *src : ' ',
- state_);
- switch (state_)
- {
- case normal:
- src = write_normal (src, end);
- if (!src) /* write_normal failed */
- return -1;
- break;
- case gotesc:
- if (*src == '[')
- {
- state_ = gotsquare;
- saw_question_mark = FALSE;
- for (nargs_ = 0; nargs_ < MAXARGS; nargs_++)
- args_[nargs_] = 0;
- nargs_ = 0;
- }
- else if (*src == ']')
- {
- rarg = 0;
- my_title_buf[0] = '\0';
- state_ = gotrsquare;
- }
- else if (*src == 'M') /* Reverse Index */
- {
- fillin_info ();
- scroll_screen (0, 0, -1, -1, 0, info.winTop + 1);
- state_ = normal;
- }
- else if (*src == 'c') /* Reset Linux terminal */
- {
- set_default_attr ();
- clear_screen (0, 0, -1, -1);
- cursor_set (TRUE, 0, 0);
- state_ = normal;
- }
- else if (*src == '8') /* Restore cursor position */
- {
- cursor_set (TRUE, savex, savey);
- state_ = normal;
- }
- else if (*src == '7') /* Save cursor position */
- {
- cursor_get (&savex, &savey);
- savey -= info.winTop;
- state_ = normal;
- }
- else if (*src == 'R')
- state_ = normal;
- else
- {
- state_ = normal;
- }
- src++;
- break;
- case gotarg1:
- if (isdigit (*src))
- {
- args_[nargs_] = args_[nargs_] * 10 + *src - '0';
- src++;
- }
- else if (*src == ';')
- {
- src++;
- nargs_++;
- if (nargs_ >= MAXARGS)
- nargs_--;
- }
- else
- {
- state_ = gotcommand;
- }
- break;
- case gotcommand:
- char_command (*src++);
- state_ = normal;
- break;
- case gotrsquare:
- if (isdigit (*src))
- rarg = rarg * 10 + (*src - '0');
- else if (*src == ';' && (rarg == 2 || rarg == 0))
- state_ = gettitle;
- else
- state_ = eattitle;
- src++;
- break;
- case eattitle:
- case gettitle:
- {
- int n = strlen (my_title_buf);
- if (*src < ' ' || *src >= '\177')
- {
- if (*src == '\007' && state_ == gettitle)
- {
- if (old_title)
- strcpy (old_title, my_title_buf);
- set_console_title (my_title_buf);
- }
- state_ = normal;
- }
- else if (n < TITLESIZE)
- {
- my_title_buf[n++] = *src;
- my_title_buf[n] = '\0';
- }
- src++;
- break;
- }
- case gotsquare:
- if (*src == ';')
- {
- state_ = gotarg1;
- nargs_++;
- src++;
- }
- else if (isalpha (*src))
- {
- state_ = gotcommand;
- }
- else if (*src != '@' && !isalpha (*src) && !isdigit (*src))
- {
- if (*src == '?')
- saw_question_mark = TRUE;
- /* ignore any extra chars between [ and first arg or command */
- src++;
- }
- else
- state_ = gotarg1;
- break;
- }
- }
-
- syscall_printf ("%d = write_console (,..%d)", len, len);
-
- return len;
-}
-
-static struct {
- int vk;
- const char *val[4];
-} keytable[] NO_COPY = {
- /* NORMAL */ /* SHIFT */ /* CTRL */ /* ALT */
- {VK_LEFT, {"\033[D", "\033[D", "\033[D", "\033\033[D"}},
- {VK_RIGHT, {"\033[C", "\033[C", "\033[C", "\033\033[C"}},
- {VK_UP, {"\033[A", "\033[A", "\033[A", "\033\033[A"}},
- {VK_DOWN, {"\033[B", "\033[B", "\033[B", "\033\033[B"}},
- {VK_PRIOR, {"\033[5~", "\033[5~", "\033[5~", "\033\033[5~"}},
- {VK_NEXT, {"\033[6~", "\033[6~", "\033[6~", "\033\033[6~"}},
- {VK_HOME, {"\033[1~", "\033[1~", "\033[1~", "\033\033[1~"}},
- {VK_END, {"\033[4~", "\033[4~", "\033[4~", "\033\033[4~"}},
- {VK_INSERT, {"\033[2~", "\033[2~", "\033[2~", "\033\033[2~"}},
- {VK_DELETE, {"\033[3~", "\033[3~", "\033[3~", "\033\033[3~"}},
- {VK_F1, {"\033[[A", "\033[23~", NULL, NULL}},
- {VK_F2, {"\033[[B", "\033[24~", NULL, NULL}},
- {VK_F3, {"\033[[C", "\033[25~", NULL, NULL}},
- {VK_F4, {"\033[[D", "\033[26~", NULL, NULL}},
- {VK_F5, {"\033[[E", "\033[28~", NULL, NULL}},
- {VK_F6, {"\033[17~", "\033[29~", "\036", NULL}},
- {VK_F7, {"\033[18~", "\033[31~", NULL, NULL}},
- {VK_F8, {"\033[19~", "\033[32~", NULL, NULL}},
- {VK_F9, {"\033[20~", "\033[33~", NULL, NULL}},
- {VK_F10, {"\033[21~", "\033[34~", NULL, NULL}},
- {VK_F11, {"\033[23~", NULL, NULL, NULL}},
- {VK_F12, {"\033[24~", NULL, NULL, NULL}},
- {VK_NUMPAD5, {"\033[G", NULL, NULL, NULL}},
- {VK_CLEAR, {"\033[G", NULL, NULL, NULL}},
- {'6', {NULL, NULL, "\036", NULL}},
- {0, {"", NULL, NULL, NULL}}
-};
-
-const char *
-get_nonascii_key (INPUT_RECORD& input_rec, char *tmp)
-{
-#define NORMAL 0
-#define SHIFT 1
-#define CONTROL 2
-#define ALT 3
- int modifier_index = NORMAL;
-
- if (input_rec.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED)
- modifier_index = SHIFT;
- else if (input_rec.Event.KeyEvent.dwControlKeyState &
- (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED))
- modifier_index = CONTROL;
- else if (input_rec.Event.KeyEvent.dwControlKeyState &
- (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED))
- modifier_index = ALT;
-
- for (int i = 0; keytable[i].vk; i++)
- if (input_rec.Event.KeyEvent.wVirtualKeyCode == keytable[i].vk)
- return keytable[i].val[modifier_index];
-
- if (input_rec.Event.KeyEvent.uChar.AsciiChar)
- {
- tmp[0] = input_rec.Event.KeyEvent.uChar.AsciiChar;
- tmp[1] = '\0';
- return tmp;
- }
- return NULL;
-}
-
-void
-fhandler_console::init (HANDLE f, DWORD a, mode_t bin)
-{
- // this->fhandler_termios::init (f, mode, bin);
- /* Ensure both input and output console handles are open */
- int flags = 0;
-
- a &= GENERIC_READ | GENERIC_WRITE;
- if (a == GENERIC_READ)
- flags = O_RDONLY;
- if (a == GENERIC_WRITE)
- flags = O_WRONLY;
- if (a == (GENERIC_READ | GENERIC_WRITE))
- flags = O_RDWR;
- open ((path_conv *) NULL, flags | O_BINARY);
- if (f != INVALID_HANDLE_VALUE)
- CloseHandle (f); /* Reopened by open */
-
- output_tcsetattr (0, &tc->ti);
-}
-
-int
-fhandler_console::igncr_enabled (void)
-{
- return tc->ti.c_iflag & IGNCR;
-}
-
-void
-fhandler_console::set_close_on_exec (int val)
-{
- this->fhandler_base::set_close_on_exec (val);
- set_inheritance (output_handle, val);
-}
-
-void
-fhandler_console::fixup_after_fork (HANDLE)
-{
- HANDLE h = get_handle ();
- HANDLE oh = get_output_handle ();
-
- /* Windows does not allow duplication of console handles between processes
- so open the console explicitly. */
-
- if (!open (NULL, O_NOCTTY | get_flags (), 0))
- system_printf ("error opening console after fork, %E");
-
- if (!get_close_on_exec ())
- {
- CloseHandle (h);
- CloseHandle (oh);
- }
-}
-
-void __stdcall
-set_console_title (char *title)
-{
- int rc;
- char buf[257];
- strncpy (buf, title, sizeof (buf) - 1);
- buf[sizeof (buf) - 1] = '\0';
- if ((rc = WaitForSingleObject (title_mutex, 15000)) != WAIT_OBJECT_0)
- sigproc_printf ("wait for title mutex failed rc %d, %E", rc);
- SetConsoleTitle (buf);
- ReleaseMutex (title_mutex);
- debug_printf ("title '%s'", buf);
-}
-
-void
-fhandler_console::fixup_after_exec (HANDLE)
-{
- HANDLE h = get_handle ();
- HANDLE oh = get_output_handle ();
-
- if (!open (NULL, O_NOCTTY | get_flags (), 0))
- {
- int sawerr = 0;
- if (!get_io_handle ())
- {
- system_printf ("error opening input console handle after exec, errno %d, %E", get_errno ());
- sawerr = 1;
- }
- if (!get_output_handle ())
- {
- system_printf ("error opening input console handle after exec, errno %d, %E", get_errno ());
- sawerr = 1;
- }
-
- if (!sawerr)
- system_printf ("error opening console after exec, errno %d, %E", get_errno ());
- }
-
- CloseHandle (h);
- CloseHandle (oh);
- return;
-}
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
deleted file mode 100644
index 443612ff4..000000000
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ /dev/null
@@ -1,818 +0,0 @@
-/* fhandler_disk_file.cc
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/cygwin.h>
-#include <signal.h>
-#include "cygerrno.h"
-#include "perprocess.h"
-#include "security.h"
-#include "cygwin/version.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygheap.h"
-#include "shared_info.h"
-#include "pinfo.h"
-#include <assert.h>
-
-#define _COMPILING_NEWLIB
-#include <dirent.h>
-
-static int __stdcall
-num_entries (const char *win32_name)
-{
- WIN32_FIND_DATA buf;
- HANDLE handle;
- char buf1[MAX_PATH];
- int count = 0;
-
- strcpy (buf1, win32_name);
- int len = strlen (buf1);
- if (len == 0 || isdirsep (buf1[len - 1]))
- strcat (buf1, "*");
- else
- strcat (buf1, "/*"); /* */
-
- handle = FindFirstFileA (buf1, &buf);
-
- if (handle == INVALID_HANDLE_VALUE)
- return 0;
- count ++;
- while (FindNextFileA (handle, &buf))
- {
- if ((buf.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
- count ++;
- }
- FindClose (handle);
- return count;
-}
-
-int __stdcall
-fhandler_disk_file::fstat_by_handle (struct __stat64 *buf, path_conv *pc)
-{
- int res = 0;
- BY_HANDLE_FILE_INFORMATION local;
-
- /* NT 3.51 seems to have a bug when attempting to get vol serial
- numbers. This loop gets around this. */
- for (int i = 0; i < 2; i++)
- {
- if (!(res = GetFileInformationByHandle (get_handle (), &local)))
- break;
- if (local.dwVolumeSerialNumber && (long) local.dwVolumeSerialNumber != -1)
- break;
- }
- debug_printf ("%d = GetFileInformationByHandle (%s, %d)",
- res, get_win32_name (), get_handle ());
- if (res == 0)
- /* GetFileInformationByHandle will fail if it's given stdin/out/err
- or a pipe*/
- {
- memset (&local, 0, sizeof (local));
- local.nFileSizeLow = GetFileSize (get_handle (), &local.nFileSizeHigh);
- }
-
- return fstat_helper (buf, pc,
- local.ftCreationTime,
- local.ftLastAccessTime,
- local.ftLastWriteTime,
- local.nFileSizeHigh,
- local.nFileSizeLow,
- local.nFileIndexHigh,
- local.nFileIndexLow,
- local.nNumberOfLinks);
-}
-
-int __stdcall
-fhandler_disk_file::fstat_by_name (struct __stat64 *buf, path_conv *pc)
-{
- int res;
- HANDLE handle;
- WIN32_FIND_DATA local;
-
- if (!pc->exists ())
- {
- set_errno (ENOENT);
- res = -1;
- }
- else if ((handle = FindFirstFile (pc->get_win32 (), &local)) == INVALID_HANDLE_VALUE)
- {
- __seterrno ();
- res = -1;
- }
- else
- {
- FindClose (handle);
- res = fstat_helper (buf, pc,
- local.ftCreationTime,
- local.ftLastAccessTime,
- local.ftLastWriteTime,
- local.nFileSizeHigh,
- local.nFileSizeLow);
- }
- return res;
-}
-
-int __stdcall
-fhandler_disk_file::fstat (struct __stat64 *buf, path_conv *pc)
-{
- int res = -1;
- int oret;
- __uid32_t uid;
- __gid32_t gid;
- int open_flags = O_RDONLY | O_BINARY | O_DIROPEN;
- bool query_open_already;
-
- if (get_io_handle ())
- return fstat_by_handle (buf, pc);
-
- /* If we don't care if the file is executable or we already know if it is,
- then just do a "query open" as it is apparently much faster. */
- if (pc->exec_state () != dont_know_if_executable)
- set_query_open (query_open_already = true);
- else
- query_open_already = false;
-
- if (query_open_already && strncasematch (pc->volname (), "FAT", 3)
- && !strpbrk (get_win32_name (), "?*|<>|"))
- oret = 0;
- else if (!(oret = open (pc, open_flags, 0)))
- {
- int ntsec_atts = 0;
- /* If we couldn't open the file, try a "query open" with no permissions.
- This will allow us to determine *some* things about the file, at least. */
- set_query_open (true);
- if (!query_open_already && (oret = open (pc, open_flags, 0)))
- /* ok */;
- else if (allow_ntsec && pc->has_acls () && get_errno () == EACCES
- && !get_file_attribute (TRUE, get_win32_name (), &ntsec_atts, &uid, &gid)
- && !ntsec_atts && uid == myself->uid && gid == myself->gid)
- {
- /* Check a special case here. If ntsec is ON it happens
- that a process creates a file using mode 000 to disallow
- other processes access. In contrast to UNIX, this results
- in a failing open call in the same process. Check that
- case. */
- set_file_attribute (TRUE, get_win32_name (), 0400);
- oret = open (pc, open_flags, 0);
- set_file_attribute (TRUE, get_win32_name (), ntsec_atts);
- }
- }
-
- if (!oret)
- res = fstat_by_name (buf, pc);
- else
- {
- res = fstat_by_handle (buf, pc);
- close ();
- }
-
- return res;
-}
-
-int __stdcall
-fhandler_disk_file::fstat_helper (struct __stat64 *buf, path_conv *pc,
- FILETIME ftCreationTime,
- FILETIME ftLastAccessTime,
- FILETIME ftLastWriteTime,
- DWORD nFileSizeHigh,
- DWORD nFileSizeLow,
- DWORD nFileIndexHigh,
- DWORD nFileIndexLow,
- DWORD nNumberOfLinks)
-{
- /* This is for FAT filesystems, which don't support atime/ctime */
- if (ftLastAccessTime.dwLowDateTime == 0
- && ftLastAccessTime.dwHighDateTime == 0)
- ftLastAccessTime = ftLastWriteTime;
- if (ftCreationTime.dwLowDateTime == 0
- && ftCreationTime.dwHighDateTime == 0)
- ftCreationTime = ftLastWriteTime;
-
- to_timestruc_t (&ftLastAccessTime, &buf->st_atim);
- to_timestruc_t (&ftLastWriteTime, &buf->st_mtim);
- to_timestruc_t (&ftCreationTime, &buf->st_ctim);
- buf->st_dev = pc->volser ();
- buf->st_size = ((__off64_t)nFileSizeHigh << 32) + nFileSizeLow;
- /* Unfortunately the count of 2 confuses `find (1)' command. So
- let's try it with `1' as link count. */
- if (pc->isdir () && !pc->isremote () && nNumberOfLinks == 1)
- buf->st_nlink = num_entries (pc->get_win32 ());
- else
- buf->st_nlink = nNumberOfLinks;
-
- /* Assume that if a drive has ACL support it MAY have valid "inodes".
- It definitely does not have valid inodes if it does not have ACL
- support. */
- switch (pc->has_acls () && (nFileIndexHigh || nFileIndexLow)
- ? pc->drive_type () : DRIVE_UNKNOWN)
- {
- case DRIVE_FIXED:
- case DRIVE_REMOVABLE:
- case DRIVE_CDROM:
- case DRIVE_RAMDISK:
- /* Although the documentation indicates otherwise, it seems like
- "inodes" on these devices are persistent, at least across reboots. */
- buf->st_ino = nFileIndexHigh | nFileIndexLow;
- break;
- default:
- /* Either the nFileIndex* fields are unreliable or unavailable. Use the
- next best alternative. */
- buf->st_ino = get_namehash ();
- break;
- }
-
- buf->st_blksize = S_BLKSIZE;
- buf->st_blocks = (buf->st_size + S_BLKSIZE - 1) / S_BLKSIZE;
-
- buf->st_mode = 0;
- /* Using a side effect: get_file_attibutes checks for
- directory. This is used, to set S_ISVTX, if needed. */
- if (pc->fileattr & FILE_ATTRIBUTE_DIRECTORY)
- buf->st_mode = S_IFDIR;
- else if (pc->issymlink ())
- buf->st_mode = S_IFLNK;
- else if (pc->issocket ())
- buf->st_mode = S_IFSOCK;
-
- __uid32_t uid;
- __gid32_t gid;
- if (get_file_attribute (pc->has_acls (), get_win32_name (), &buf->st_mode,
- &uid, &gid) == 0)
- {
- /* If read-only attribute is set, modify ntsec return value */
- if ((pc->fileattr & FILE_ATTRIBUTE_READONLY) && !get_symlink_p ())
- buf->st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
-
- if (!(buf->st_mode & S_IFMT))
- buf->st_mode |= S_IFREG;
- }
- else
- {
- buf->st_mode |= STD_RBITS;
-
- if (!(pc->fileattr & FILE_ATTRIBUTE_READONLY))
- buf->st_mode |= STD_WBITS;
- /* | S_IWGRP | S_IWOTH; we don't give write to group etc */
-
- if (buf->st_mode & S_IFDIR)
- buf->st_mode |= S_IFDIR | STD_XBITS;
- else if (buf->st_mode & S_IFMT)
- /* nothing */;
- else if (pc->issocket ())
- buf->st_mode |= S_IFSOCK;
- else
- {
- buf->st_mode |= S_IFREG;
- if (pc->exec_state () == dont_know_if_executable)
- {
- DWORD cur, done;
- char magic[3];
-
- /* First retrieve current position, set to beginning
- of file if not already there. */
- cur = SetFilePointer (get_handle(), 0, NULL, FILE_CURRENT);
- if (cur != INVALID_SET_FILE_POINTER &&
- (!cur ||
- SetFilePointer (get_handle(), 0, NULL, FILE_BEGIN)
- != INVALID_SET_FILE_POINTER))
- {
- /* FIXME should we use /etc/magic ? */
- magic[0] = magic[1] = magic[2] = '\0';
- if (ReadFile (get_handle (), magic, 3, &done, NULL) &&
- has_exec_chars (magic, done))
- {
- set_execable_p ();
- pc->set_exec ();
- }
- SetFilePointer (get_handle(), cur, NULL, FILE_BEGIN);
- }
- }
- if (pc->exec_state () == is_executable)
- buf->st_mode |= STD_XBITS;
- }
- }
-
- buf->st_uid = uid;
- buf->st_gid = gid;
-
- /* The number of links to a directory includes the
- number of subdirectories in the directory, since all
- those subdirectories point to it.
- This is too slow on remote drives, so we do without it and
- set the number of links to 2. */
-
- syscall_printf ("0 = fstat (, %p) st_atime=%x st_size=%D, st_mode=%p, st_ino=%d, sizeof=%d",
- buf, buf->st_atime, buf->st_size, buf->st_mode,
- (int) buf->st_ino, sizeof (*buf));
- return 0;
-}
-
-fhandler_disk_file::fhandler_disk_file (DWORD devtype) :
- fhandler_base (devtype)
-{
-}
-
-fhandler_disk_file::fhandler_disk_file () :
- fhandler_base (FH_DISK)
-{
-}
-
-int
-fhandler_disk_file::open (path_conv *real_path, int flags, mode_t mode)
-{
- if (real_path->case_clash && flags & O_CREAT)
- {
- debug_printf ("case clash detected");
- set_errno (ECASECLASH);
- return 0;
- }
-
- set_has_acls (real_path->has_acls ());
- set_isremote (real_path->isremote ());
-
- int res;
- if (!real_path->isdir () || wincap.can_open_directories ())
- res = this->fhandler_base::open (real_path, flags | O_DIROPEN, mode);
- else
- {
- set_errno (EISDIR);
- res = 0;
- }
-
- if (!res)
- goto out;
-
- /* This is for file systems known for having a buggy CreateFile call
- which might return a valid HANDLE without having actually opened
- the file.
- The only known file system to date is the SUN NFS Solstice Client 3.1
- which returns a valid handle when trying to open a file in a nonexistent
- directory. */
- if (real_path->has_buggy_open () && !real_path->exists ())
- {
- debug_printf ("Buggy open detected.");
- close ();
- set_errno (ENOENT);
- return 0;
- }
-
- if (flags & O_APPEND)
- SetFilePointer (get_handle(), 0, 0, FILE_END);
-
- set_symlink_p (real_path->issymlink ());
- set_execable_p (real_path->exec_state ());
- set_socket_p (real_path->issocket ());
-
-out:
- syscall_printf ("%d = fhandler_disk_file::open (%s, %p)", res,
- get_win32_name (), flags);
- return res;
-}
-
-int
-fhandler_disk_file::close ()
-{
- int res = this->fhandler_base::close ();
- if (!res)
- cygwin_shared->delqueue.process_queue ();
- return res;
-}
-
-/*
- * FIXME !!!
- * The correct way to do this to get POSIX locking
- * semantics is to keep a linked list of posix lock
- * requests and map them into Win32 locks. The problem
- * is that Win32 does not deal correctly with overlapping
- * lock requests. Also another pain is that Win95 doesn't do
- * non-blocking or non exclusive locks at all. For '95 just
- * convert all lock requests into blocking,exclusive locks.
- * This shouldn't break many apps but denying all locking
- * would.
- * For now just convert to Win32 locks and hope for the best.
- */
-
-int
-fhandler_disk_file::lock (int cmd, struct flock *fl)
-{
- __off64_t win32_start;
- int win32_len;
- DWORD win32_upper;
- __off64_t startpos;
-
- /*
- * We don't do getlck calls yet.
- */
-
- if (cmd == F_GETLK)
- {
- set_errno (ENOSYS);
- return -1;
- }
-
- /*
- * Calculate where in the file to start from,
- * then adjust this by fl->l_start.
- */
-
- switch (fl->l_whence)
- {
- case SEEK_SET:
- startpos = 0;
- break;
- case SEEK_CUR:
- if ((startpos = lseek (0, SEEK_CUR)) == ILLEGAL_SEEK)
- return -1;
- break;
- case SEEK_END:
- {
- BY_HANDLE_FILE_INFORMATION finfo;
- if (GetFileInformationByHandle (get_handle(), &finfo) == 0)
- {
- __seterrno ();
- return -1;
- }
- startpos = ((__off64_t)finfo.nFileSizeHigh << 32)
- + finfo.nFileSizeLow;
- break;
- }
- default:
- set_errno (EINVAL);
- return -1;
- }
-
- /*
- * Now the fun starts. Adjust the start and length
- * fields until they make sense.
- */
-
- win32_start = startpos + fl->l_start;
- if (fl->l_len < 0)
- {
- win32_start -= fl->l_len;
- win32_len = -fl->l_len;
- }
- else
- win32_len = fl->l_len;
-
- if (win32_start < 0)
- {
- /* watch the signs! */
- win32_len -= -win32_start;
- if (win32_len <= 0)
- {
- /* Failure ! */
- set_errno (EINVAL);
- return -1;
- }
- win32_start = 0;
- }
-
- /*
- * Special case if len == 0 for POSIX means lock
- * to the end of the entire file (and all future extensions).
- */
- if (win32_len == 0)
- {
- win32_len = 0xffffffff;
- win32_upper = wincap.lock_file_highword ();
- }
- else
- win32_upper = 0;
-
- BOOL res;
-
- if (wincap.has_lock_file_ex ())
- {
- DWORD lock_flags = (cmd == F_SETLK) ? LOCKFILE_FAIL_IMMEDIATELY : 0;
- lock_flags |= (fl->l_type == F_WRLCK) ? LOCKFILE_EXCLUSIVE_LOCK : 0;
-
- OVERLAPPED ov;
-
- ov.Internal = 0;
- ov.InternalHigh = 0;
- ov.Offset = (DWORD)win32_start;
- ov.OffsetHigh = 0;
- ov.hEvent = (HANDLE) 0;
-
- if (fl->l_type == F_UNLCK)
- {
- res = UnlockFileEx (get_handle (), 0, (DWORD)win32_len, win32_upper, &ov);
- }
- else
- {
- res = LockFileEx (get_handle (), lock_flags, 0, (DWORD)win32_len,
- win32_upper, &ov);
- /* Deal with the fail immediately case. */
- /*
- * FIXME !! I think this is the right error to check for
- * but I must admit I haven't checked....
- */
- if ((res == 0) && (lock_flags & LOCKFILE_FAIL_IMMEDIATELY) &&
- (GetLastError () == ERROR_LOCK_FAILED))
- {
- set_errno (EAGAIN);
- return -1;
- }
- }
- }
- else
- {
- /* Windows 95 -- use primitive lock call */
- if (fl->l_type == F_UNLCK)
- res = UnlockFile (get_handle (), (DWORD)win32_start, 0, (DWORD)win32_len,
- win32_upper);
- else
- res = LockFile (get_handle (), (DWORD)win32_start, 0, (DWORD)win32_len, win32_upper);
- }
-
- if (res == 0)
- {
- __seterrno ();
- return -1;
- }
-
- return 0;
-}
-
-DIR *
-fhandler_disk_file::opendir (path_conv& real_name)
-{
- DIR *dir;
- DIR *res = NULL;
- size_t len;
-
- if (!real_name.isdir ())
- set_errno (ENOTDIR);
- else if ((len = strlen (real_name))> MAX_PATH - 3)
- set_errno (ENAMETOOLONG);
- else if ((dir = (DIR *) malloc (sizeof (DIR))) == NULL)
- set_errno (ENOMEM);
- else if ((dir->__d_dirname = (char *) malloc (len + 3)) == NULL)
- {
- free (dir);
- set_errno (ENOMEM);
- }
- else if ((dir->__d_dirent =
- (struct dirent *) malloc (sizeof (struct dirent))) == NULL)
- {
- free (dir->__d_dirname);
- free (dir);
- set_errno (ENOMEM);
- }
- else
- {
- strcpy (dir->__d_dirname, real_name.get_win32 ());
- dir->__d_dirent->d_version = __DIRENT_VERSION;
- cygheap_fdnew fd;
- fd = this;
- fd->set_nohandle (true);
- dir->__d_dirent->d_fd = fd;
- dir->__d_u.__d_data.__fh = this;
- /* FindFirstFile doesn't seem to like duplicate /'s. */
- len = strlen (dir->__d_dirname);
- if (len == 0 || SLASH_P (dir->__d_dirname[len - 1]))
- strcat (dir->__d_dirname, "*");
- else
- strcat (dir->__d_dirname, "\\*"); /**/
- dir->__d_cookie = __DIRENT_COOKIE;
- dir->__d_u.__d_data.__handle = INVALID_HANDLE_VALUE;
- dir->__d_position = 0;
- dir->__d_dirhash = get_namehash ();
-
- res = dir;
- }
-
- syscall_printf ("%p = opendir (%s)", res, get_name ());
- return res;
-}
-
-struct dirent *
-fhandler_disk_file::readdir (DIR *dir)
-{
- WIN32_FIND_DATA buf;
- HANDLE handle;
- struct dirent *res = NULL;
-
- if (dir->__d_u.__d_data.__handle == INVALID_HANDLE_VALUE
- && dir->__d_position == 0)
- {
- handle = FindFirstFileA (dir->__d_dirname, &buf);
- DWORD lasterr = GetLastError ();
- dir->__d_u.__d_data.__handle = handle;
- if (handle == INVALID_HANDLE_VALUE && (lasterr != ERROR_NO_MORE_FILES))
- {
- seterrno_from_win_error (__FILE__, __LINE__, lasterr);
- return res;
- }
- }
- else if (dir->__d_u.__d_data.__handle == INVALID_HANDLE_VALUE)
- {
- return res;
- }
- else if (!FindNextFileA (dir->__d_u.__d_data.__handle, &buf))
- {
- DWORD lasterr = GetLastError ();
- (void) FindClose (dir->__d_u.__d_data.__handle);
- dir->__d_u.__d_data.__handle = INVALID_HANDLE_VALUE;
- /* POSIX says you shouldn't set errno when readdir can't
- find any more files; so, if another error we leave it set. */
- if (lasterr != ERROR_NO_MORE_FILES)
- seterrno_from_win_error (__FILE__, __LINE__, lasterr);
- syscall_printf ("%p = readdir (%p)", res, dir);
- return res;
- }
-
- /* We get here if `buf' contains valid data. */
- strcpy (dir->__d_dirent->d_name, buf.cFileName);
-
- /* Check for Windows shortcut. If it's a Cygwin or U/WIN
- symlink, drop the .lnk suffix. */
- if (buf.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
- {
- char *c = dir->__d_dirent->d_name;
- int len = strlen (c);
- if (strcasematch (c + len - 4, ".lnk"))
- {
- char fbuf[MAX_PATH + 1];
- strcpy (fbuf, dir->__d_dirname);
- strcpy (fbuf + strlen (fbuf) - 1, dir->__d_dirent->d_name);
- path_conv fpath (fbuf, PC_SYM_NOFOLLOW);
- if (fpath.issymlink ())
- c[len - 4] = '\0';
- }
- }
-
- dir->__d_position++;
- res = dir->__d_dirent;
- syscall_printf ("%p = readdir (%p) (%s)",
- &dir->__d_dirent, dir, buf.cFileName);
- return res;
-}
-
-__off64_t
-fhandler_disk_file::telldir (DIR *dir)
-{
- return dir->__d_position;
-}
-
-void
-fhandler_disk_file::seekdir (DIR *dir, __off64_t loc)
-{
- rewinddir (dir);
- while (loc > dir->__d_position)
- if (!readdir (dir))
- break;
-}
-
-void
-fhandler_disk_file::rewinddir (DIR *dir)
-{
- if (dir->__d_u.__d_data.__handle != INVALID_HANDLE_VALUE)
- {
- (void) FindClose (dir->__d_u.__d_data.__handle);
- dir->__d_u.__d_data.__handle = INVALID_HANDLE_VALUE;
- }
- dir->__d_position = 0;
-}
-
-int
-fhandler_disk_file::closedir (DIR *dir)
-{
- int res = 0;
- if (dir->__d_u.__d_data.__handle != INVALID_HANDLE_VALUE &&
- FindClose (dir->__d_u.__d_data.__handle) == 0)
- {
- __seterrno ();
- res = -1;
- }
- syscall_printf ("%d = closedir (%p)", res, dir);
- return 0;
-}
-
-fhandler_cygdrive::fhandler_cygdrive (int unit) :
- fhandler_disk_file (FH_CYGDRIVE), unit (unit), ndrives (0), pdrive (NULL)
-{
-}
-
-#define DRVSZ sizeof ("x:\\")
-void
-fhandler_cygdrive::set_drives ()
-{
- const int len = 1 + 26 * DRVSZ;
- char *p = (char *) crealloc ((void *) win32_path_name, len);
-
- win32_path_name = pdrive = p;
- ndrives = GetLogicalDriveStrings (len, p) / DRVSZ;
-}
-
-int
-fhandler_cygdrive::fstat (struct __stat64 *buf, path_conv *pc)
-{
- if (!iscygdrive_root ())
- return fhandler_disk_file::fstat (buf, pc);
- buf->st_mode = S_IFDIR | 0555;
- if (!ndrives)
- set_drives ();
- buf->st_nlink = ndrives;
- return 0;
-}
-
-DIR *
-fhandler_cygdrive::opendir (path_conv& real_name)
-{
- DIR *dir;
-
- dir = fhandler_disk_file::opendir (real_name);
- if (dir && iscygdrive_root () && !ndrives)
- set_drives ();
-
- return dir;
-}
-
-struct dirent *
-fhandler_cygdrive::readdir (DIR *dir)
-{
- if (!iscygdrive_root ())
- return fhandler_disk_file::readdir (dir);
- if (!pdrive || !*pdrive)
- {
- set_errno (ENMFILE);
- return NULL;
- }
- if (dir->__d_position == 0)
- {
- *dir->__d_dirent->d_name = '.';
- dir->__d_dirent->d_name[1] = '\0';
- }
- else if (dir->__d_position == 1)
- {
- dir->__d_dirent->d_name[0] = dir->__d_dirent->d_name[1] = '.';
- dir->__d_dirent->d_name[2] = '\0';
- }
- else if (GetFileAttributes (pdrive) == INVALID_FILE_ATTRIBUTES)
- {
- pdrive += DRVSZ;
- return readdir (dir);
- }
- else
- {
- *dir->__d_dirent->d_name = cyg_tolower (*pdrive);
- dir->__d_dirent->d_name[1] = '\0';
- }
- dir->__d_position++;
- pdrive += DRVSZ;
- syscall_printf ("%p = readdir (%p) (%s)", &dir->__d_dirent, dir,
- dir->__d_dirent->d_name);
- return dir->__d_dirent;
-}
-
-__off64_t
-fhandler_cygdrive::telldir (DIR *dir)
-{
- return fhandler_disk_file::telldir (dir);
-}
-
-void
-fhandler_cygdrive::seekdir (DIR *dir, __off64_t loc)
-{
- if (!iscygdrive_root ())
- return fhandler_disk_file::seekdir (dir, loc);
-
- for (pdrive = win32_path_name, dir->__d_position = -1; *pdrive; pdrive += DRVSZ)
- if (++dir->__d_position >= loc)
- break;
-
- return;
-}
-
-void
-fhandler_cygdrive::rewinddir (DIR *dir)
-{
- if (!iscygdrive_root ())
- return fhandler_disk_file::rewinddir (dir);
- pdrive = win32_path_name;
- dir->__d_position = 0;
- return;
-}
-
-int
-fhandler_cygdrive::closedir (DIR *dir)
-{
- if (!iscygdrive_root ())
- return fhandler_disk_file::closedir (dir);
- pdrive = win32_path_name;
- return -1;
-}
diff --git a/winsup/cygwin/fhandler_dsp.cc b/winsup/cygwin/fhandler_dsp.cc
deleted file mode 100644
index f809b93cc..000000000
--- a/winsup/cygwin/fhandler_dsp.cc
+++ /dev/null
@@ -1,646 +0,0 @@
-/* fhandler_dev_dsp: code to emulate OSS sound model /dev/dsp
-
- Copyright 2001, 2002 Red Hat, Inc
-
- Written by Andy Younger (andy@snoogie.demon.co.uk)
-
-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 "winsup.h"
-#include <stdio.h>
-#include <errno.h>
-#include <windows.h>
-#include <sys/soundcard.h>
-#include <mmsystem.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-
-//------------------------------------------------------------------------
-// Simple encapsulation of the win32 audio device.
-//
-static void CALLBACK wave_callback (HWAVE hWave, UINT msg, DWORD instance,
- DWORD param1, DWORD param2);
-class Audio
-{
-public:
- enum
- {
- MAX_BLOCKS = 12,
- BLOCK_SIZE = 16384,
- TOT_BLOCK_SIZE = BLOCK_SIZE + sizeof (WAVEHDR)
- };
-
- Audio ();
- ~Audio ();
-
- bool open (int rate, int bits, int channels, bool bCallback = false);
- void close ();
- int getvolume ();
- void setvolume (int newVolume);
- bool write (const void *pSampleData, int nBytes);
- int blocks ();
- void callback_sampledone (void *pData);
- void setformat (int format) {formattype_ = format;}
- int numbytesoutput ();
-
- void *operator new (size_t, void *p) {return p;}
-
-private:
- char *initialisebuffer ();
- void waitforcallback ();
- bool flush ();
-
- HWAVEOUT dev_;
- volatile int nBlocksInQue_;
- int nBytesWritten_;
- char *buffer_;
- int bufferIndex_;
- CRITICAL_SECTION lock_;
- char *freeblocks_[MAX_BLOCKS];
- int formattype_;
-
- char bigwavebuffer_[MAX_BLOCKS * TOT_BLOCK_SIZE];
-};
-
-static char audio_buf[sizeof (class Audio)];
-
-Audio::Audio ()
-{
- InitializeCriticalSection (&lock_);
- memset (bigwavebuffer_, 0, sizeof (bigwavebuffer_));
- for (int i = 0; i < MAX_BLOCKS; i++)
- freeblocks_[i] = &bigwavebuffer_[i * TOT_BLOCK_SIZE];
-}
-
-Audio::~Audio ()
-{
- if (dev_)
- close ();
- DeleteCriticalSection (&lock_);
-}
-
-bool
-Audio::open (int rate, int bits, int channels, bool bCallback)
-{
- WAVEFORMATEX format;
- int nDevices = waveOutGetNumDevs ();
-
- nBytesWritten_ = 0L;
- bufferIndex_ = 0;
- buffer_ = 0L;
- debug_printf ("number devices %d\n", nDevices);
- if (nDevices <= 0)
- return false;
-
- debug_printf ("trying to map device freq %d, bits %d, "
- "channels %d, callback %d\n", rate, bits, channels,
- bCallback);
-
- int bytesperSample = bits / 8;
-
- memset (&format, 0, sizeof (format));
- format.wFormatTag = WAVE_FORMAT_PCM;
- format.wBitsPerSample = bits;
- format.nChannels = channels;
- format.nSamplesPerSec = rate;
- format.nAvgBytesPerSec = format.nSamplesPerSec * format.nChannels *
- bytesperSample;
- format.nBlockAlign = format.nChannels * bytesperSample;
-
- nBlocksInQue_ = 0;
- HRESULT res = waveOutOpen (&dev_, WAVE_MAPPER, &format, (DWORD) wave_callback,
- (DWORD) this, bCallback ? CALLBACK_FUNCTION : 0);
- if (res == S_OK)
- {
- debug_printf ("Sucessfully opened!");
- return true;
- }
- else
- {
- debug_printf ("failed to open");
- return false;
- }
-}
-
-void
-Audio::close ()
-{
- if (dev_)
- {
- flush (); // force out last block whatever size..
-
- while (blocks ()) // block till finished..
- waitforcallback ();
-
- waveOutReset (dev_);
- waveOutClose (dev_);
- dev_ = 0L;
- }
- nBytesWritten_ = 0L;
-}
-
-int
-Audio::numbytesoutput ()
-{
- return nBytesWritten_;
-}
-
-int
-Audio::getvolume ()
-{
- DWORD volume;
-
- waveOutGetVolume (dev_, &volume);
- return ((volume >> 16) + (volume & 0xffff)) >> 1;
-}
-
-void
-Audio::setvolume (int newVolume)
-{
- waveOutSetVolume (dev_, (newVolume << 16) | newVolume);
-}
-
-char *
-Audio::initialisebuffer ()
-{
- EnterCriticalSection (&lock_);
- WAVEHDR *pHeader = 0L;
- for (int i = 0; i < MAX_BLOCKS; i++)
- {
- char *pData = freeblocks_[i];
- if (pData)
- {
- pHeader = (WAVEHDR *) pData;
- if (pHeader->dwFlags & WHDR_DONE)
- {
- waveOutUnprepareHeader (dev_, pHeader, sizeof (WAVEHDR));
- }
- freeblocks_[i] = 0L;
- break;
- }
- }
- LeaveCriticalSection (&lock_);
-
- if (pHeader)
- {
- memset (pHeader, 0, sizeof (WAVEHDR));
- pHeader->dwBufferLength = BLOCK_SIZE;
- pHeader->lpData = (LPSTR) (&pHeader[1]);
- return (char *) pHeader->lpData;
- }
- return 0L;
-}
-
-bool
-Audio::write (const void *pSampleData, int nBytes)
-{
- // split up big blocks into smaller BLOCK_SIZE chunks
- while (nBytes > BLOCK_SIZE)
- {
- write (pSampleData, BLOCK_SIZE);
- nBytes -= BLOCK_SIZE;
- pSampleData = (void *) ((char *) pSampleData + BLOCK_SIZE);
- }
-
- // Block till next sound is flushed
- if (blocks () == MAX_BLOCKS)
- waitforcallback ();
-
- // Allocate new wave buffer if necessary
- if (buffer_ == 0L)
- {
- buffer_ = initialisebuffer ();
- if (buffer_ == 0L)
- return false;
- }
-
-
- // Handle gathering blocks into larger buffer
- int sizeleft = BLOCK_SIZE - bufferIndex_;
- if (nBytes < sizeleft)
- {
- memcpy (&buffer_[bufferIndex_], pSampleData, nBytes);
- bufferIndex_ += nBytes;
- nBytesWritten_ += nBytes;
- return true;
- }
-
- // flushing when we reach our limit of BLOCK_SIZE
- memcpy (&buffer_[bufferIndex_], pSampleData, sizeleft);
- bufferIndex_ += sizeleft;
- nBytesWritten_ += sizeleft;
- flush ();
-
- // change pointer to rest of sample, and size accordingly
- pSampleData = (void *) ((char *) pSampleData + sizeleft);
- nBytes -= sizeleft;
-
- // if we still have some sample left over write it out
- if (nBytes)
- return write (pSampleData, nBytes);
-
- return true;
-}
-
-// return number of blocks back.
-int
-Audio::blocks ()
-{
- EnterCriticalSection (&lock_);
- int ret = nBlocksInQue_;
- LeaveCriticalSection (&lock_);
- return ret;
-}
-
-// This is called on an interupt so use locking.. Note nBlocksInQue_ is
-// modified by it so we should wrap all references to it in locks.
-void
-Audio::callback_sampledone (void *pData)
-{
- EnterCriticalSection (&lock_);
-
- nBlocksInQue_--;
- for (int i = 0; i < MAX_BLOCKS; i++)
- if (!freeblocks_[i])
- {
- freeblocks_[i] = (char *) pData;
- break;
- }
-
- LeaveCriticalSection (&lock_);
-}
-
-void
-Audio::waitforcallback ()
-{
- int n = blocks ();
- if (!n)
- return;
- do
- {
- Sleep (250);
- }
- while (n == blocks ());
-}
-
-bool
-Audio::flush ()
-{
- if (!buffer_)
- return false;
-
- // Send internal buffer out to the soundcard
- WAVEHDR *pHeader = ((WAVEHDR *) buffer_) - 1;
- pHeader->dwBufferLength = bufferIndex_;
-
- // Quick bit of sample buffer conversion
- if (formattype_ == AFMT_S8)
- {
- unsigned char *p = ((unsigned char *) buffer_);
- for (int i = 0; i < bufferIndex_; i++)
- {
- p[i] -= 0x7f;
- }
- }
-
- if (waveOutPrepareHeader (dev_, pHeader, sizeof (WAVEHDR)) == S_OK &&
- waveOutWrite (dev_, pHeader, sizeof (WAVEHDR)) == S_OK)
- {
- EnterCriticalSection (&lock_);
- nBlocksInQue_++;
- LeaveCriticalSection (&lock_);
- bufferIndex_ = 0;
- buffer_ = 0L;
- return true;
- }
- else
- {
- EnterCriticalSection (&lock_);
- for (int i = 0; i < MAX_BLOCKS; i++)
- if (!freeblocks_[i])
- {
- freeblocks_[i] = (char *) pHeader;
- break;
- }
- LeaveCriticalSection (&lock_);
- }
- return false;
-}
-
-//------------------------------------------------------------------------
-// Call back routine
-static void CALLBACK
-wave_callback (HWAVE hWave, UINT msg, DWORD instance, DWORD param1,
- DWORD param2)
-{
- if (msg == WOM_DONE)
- {
- Audio *ptr = (Audio *) instance;
- ptr->callback_sampledone ((void *) param1);
- }
-}
-
-//------------------------------------------------------------------------
-// /dev/dsp handler
-static Audio *s_audio; // static instance of the Audio handler
-
-//------------------------------------------------------------------------
-// wav file detection..
-#pragma pack(1)
-struct wavchunk
-{
- char id[4];
- unsigned int len;
-};
-struct wavformat
-{
- unsigned short wFormatTag;
- unsigned short wChannels;
- unsigned int dwSamplesPerSec;
- unsigned int dwAvgBytesPerSec;
- unsigned short wBlockAlign;
- unsigned short wBitsPerSample;
-};
-#pragma pack()
-
-bool
-fhandler_dev_dsp::setupwav (const char *pData, int nBytes)
-{
- int len;
- const char *end = pData + nBytes;
-
- if (!(pData[0] == 'R' && pData[1] == 'I' &&
- pData[2] == 'F' && pData[3] == 'F'))
- return false;
- if (!(pData[8] == 'W' && pData[9] == 'A' &&
- pData[10] == 'V' && pData[11] == 'E'))
- return false;
-
- len = *(int *) &pData[4];
- pData += 12;
- while (len && pData < end)
- {
- wavchunk * pChunk = (wavchunk *) pData;
- int blklen = pChunk-> len;
- if (pChunk->id[0] == 'f' && pChunk->id[1] == 'm' &&
- pChunk->id[2] == 't' && pChunk->id[3] == ' ')
- {
- wavformat *format = (wavformat *) (pChunk + 1);
- if ((char *) (format + 1) > end)
- return false;
-
- // Open up audio device with correct frequency for wav file
- //
- // FIXME: should through away all the header & not output
- // it to the soundcard.
- s_audio->close ();
- if (s_audio->open (format->dwSamplesPerSec, format->wBitsPerSample,
- format->wChannels) == false)
- {
- s_audio->open (audiofreq_, audiobits_, audiochannels_);
- }
- else
- {
- audiofreq_ = format->dwSamplesPerSec;
- audiobits_ = format->wBitsPerSample;
- audiochannels_ = format->wChannels;
- }
- return true;
- }
-
- pData += blklen + sizeof (wavchunk);
- }
- return false;
-}
-
-//------------------------------------------------------------------------
-fhandler_dev_dsp::fhandler_dev_dsp ():
- fhandler_base (FH_OSS_DSP)
-{
-}
-
-fhandler_dev_dsp::~fhandler_dev_dsp ()
-{
-}
-
-int
-fhandler_dev_dsp::open (path_conv *, int flags, mode_t mode)
-{
- // currently we only support writing
- if ((flags & (O_WRONLY | O_RDONLY | O_RDWR)) != O_WRONLY)
- {
- set_errno (EACCES);
- return 0;
- }
-
- set_flags (flags & ~O_TEXT, O_BINARY);
-
- if (!s_audio)
- s_audio = new (audio_buf) Audio;
-
- // Work out initial sample format & frequency
- // dev/dsp defaults
- audioformat_ = AFMT_S8;
- audiofreq_ = 8000;
- audiobits_ = 8;
- audiochannels_ = 1;
-
- int res;
- if (!s_audio->open (audiofreq_, audiobits_, audiochannels_))
- res = 0;
- else
- {
- set_open_status ();
- res = 1;
- }
-
- debug_printf ("returns %d", res);
- return res;
-}
-
-int
-fhandler_dev_dsp::write (const void *ptr, size_t len)
-{
- if (s_audio->numbytesoutput () == 0)
- {
- // check for wave file & setup frequencys properly if possible.
- setupwav ((const char *) ptr, len);
-
- // Open audio device properly with callbacks.
- s_audio->close ();
- if (!s_audio->open (audiofreq_, audiobits_, audiochannels_, true))
- return 0;
- }
-
- s_audio->write (ptr, len);
- return len;
-}
-
-int __stdcall
-fhandler_dev_dsp::read (void *ptr, size_t len)
-{
- return len;
-}
-
-__off64_t
-fhandler_dev_dsp::lseek (__off64_t offset, int whence)
-{
- return 0;
-}
-
-int
-fhandler_dev_dsp::close (void)
-{
- s_audio->close ();
- return 0;
-}
-
-int
-fhandler_dev_dsp::dup (fhandler_base * child)
-{
- fhandler_dev_dsp *fhc = (fhandler_dev_dsp *) child;
-
- fhc->set_flags (get_flags ());
- fhc->audiochannels_ = audiochannels_;
- fhc->audiobits_ = audiobits_;
- fhc->audiofreq_ = audiofreq_;
- fhc->audioformat_ = audioformat_;
- return 0;
-}
-
-int
-fhandler_dev_dsp::ioctl (unsigned int cmd, void *ptr)
-{
- int *intptr = (int *) ptr;
- switch (cmd)
- {
-#define CASE(a) case a : debug_printf("/dev/dsp: ioctl %s\n", #a);
-
- CASE (SNDCTL_DSP_RESET)
- audioformat_ = AFMT_S8;
- audiofreq_ = 8000;
- audiobits_ = 8;
- audiochannels_ = 1;
- return 0;
-
- CASE (SNDCTL_DSP_GETBLKSIZE)
- *intptr = Audio::BLOCK_SIZE;
- return 0;
-
- CASE (SNDCTL_DSP_SETFMT)
- {
- int nBits = 0;
- if (*intptr == AFMT_S16_LE)
- nBits = 16;
- else if (*intptr == AFMT_U8)
- nBits = 8;
- else if (*intptr == AFMT_S8)
- nBits = 8;
- if (nBits)
- {
- s_audio->setformat (*intptr);
- s_audio->close ();
- if (s_audio->open (audiofreq_, nBits, audiochannels_) == true)
- {
- audiobits_ = nBits;
- return 0;
- }
- else
- {
- s_audio->open (audiofreq_, audiobits_, audiochannels_);
- return -1;
- }
- }
- }
- break;
-
- CASE (SNDCTL_DSP_SPEED)
- s_audio->close ();
- if (s_audio->open (*intptr, audiobits_, audiochannels_) == true)
- {
- audiofreq_ = *intptr;
- return 0;
- }
- else
- {
- s_audio->open (audiofreq_, audiobits_, audiochannels_);
- return -1;
- }
- break;
-
- CASE (SNDCTL_DSP_STEREO)
- {
- int nChannels = *intptr + 1;
-
- s_audio->close ();
- if (s_audio->open (audiofreq_, audiobits_, nChannels) == true)
- {
- audiochannels_ = nChannels;
- return 0;
- }
- else
- {
- s_audio->open (audiofreq_, audiobits_, audiochannels_);
- return -1;
- }
- }
- break;
-
- CASE (SNDCTL_DSP_GETOSPACE)
- {
- audio_buf_info *p = (audio_buf_info *) ptr;
-
- int nBlocks = s_audio->blocks ();
- int leftblocks = ((Audio::MAX_BLOCKS - nBlocks) - 1);
- if (leftblocks < 0)
- leftblocks = 0;
- if (leftblocks > 1)
- leftblocks = 1;
- int left = leftblocks * Audio::BLOCK_SIZE;
-
- p->fragments = leftblocks;
- p->fragstotal = Audio::MAX_BLOCKS;
- p->fragsize = Audio::BLOCK_SIZE;
- p->bytes = left;
-
- debug_printf ("ptr %p nblocks %d leftblocks %d left bytes %d ",
- ptr, nBlocks, leftblocks, left);
-
- return 0;
- }
- break;
-
- CASE (SNDCTL_DSP_SETFRAGMENT)
- {
- // Fake!! esound & mikmod require this on non PowerPC platforms.
- //
- return 0;
- }
- break;
-
- default:
- debug_printf ("/dev/dsp: ioctl not handled yet! FIXME:\n");
- break;
-
-#undef CASE
- };
- return -1;
-}
-
-void
-fhandler_dev_dsp::dump ()
-{
- paranoid_printf ("here, fhandler_dev_dsp");
-}
-
-void
-fhandler_dev_dsp::fixup_after_exec (HANDLE)
-{
- /* FIXME: Is there a better way to do this? */
- s_audio = new (audio_buf) Audio;
-}
diff --git a/winsup/cygwin/fhandler_floppy.cc b/winsup/cygwin/fhandler_floppy.cc
deleted file mode 100644
index 3804fdf74..000000000
--- a/winsup/cygwin/fhandler_floppy.cc
+++ /dev/null
@@ -1,191 +0,0 @@
-/* fhandler_floppy.cc. See fhandler.h for a description of the
- fhandler classes.
-
- 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. */
-
-#include "winsup.h"
-#include <sys/termios.h>
-#include <errno.h>
-#include <unistd.h>
-#include <winioctl.h>
-#include "security.h"
-#include "fhandler.h"
-#include "cygerrno.h"
-
-/**********************************************************************/
-/* fhandler_dev_floppy */
-
-int
-fhandler_dev_floppy::is_eom (int win_error)
-{
- int ret = (win_error == ERROR_INVALID_PARAMETER);
- if (ret)
- debug_printf ("end of medium");
- return ret;
-}
-
-int
-fhandler_dev_floppy::is_eof (int)
-{
- int ret = 0;
- if (ret)
- debug_printf ("end of file");
- return ret;
-}
-
-fhandler_dev_floppy::fhandler_dev_floppy (int unit) : fhandler_dev_raw (FH_FLOPPY, unit)
-{
-}
-
-int
-fhandler_dev_floppy::open (path_conv *real_path, int flags, mode_t)
-{
- /* The correct size of the buffer would be 512 bytes,
- * which is the atomic size, supported by WinNT.
- * Unfortunately, the performance is worse than
- * access to file system on same device!
- * Setting buffer size to a relatively big value
- * increases performance by means.
- * The new ioctl call with 'rdevio.h' header file
- * supports changing this value.
- *
- * Let's be smart: Let's take a multiplier of typical tar
- * and cpio buffer sizes by default!
- */
- devbufsiz = 61440L; /* 512L; */
- return fhandler_dev_raw::open (real_path, flags);
-}
-
-int
-fhandler_dev_floppy::close (void)
-{
- int ret;
-
- ret = writebuf ();
- if (ret)
- {
- fhandler_dev_raw::close ();
- return ret;
- }
- return fhandler_dev_raw::close ();
-}
-
-__off64_t
-fhandler_dev_floppy::lseek (__off64_t offset, int whence)
-{
- int ret;
- char buf[512];
- __off64_t drive_size = 0;
- __off64_t lloffset = offset;
- __off64_t current_position;
- __off64_t sector_aligned_offset;
- __off64_t bytes_left;
- DWORD low;
- LONG high = 0;
-
- DISK_GEOMETRY di;
- PARTITION_INFORMATION pi;
- DWORD bytes_read;
-
- if (!DeviceIoControl (get_handle(),
- IOCTL_DISK_GET_DRIVE_GEOMETRY,
- NULL, 0,
- &di, sizeof (di),
- &bytes_read, NULL))
- {
- __seterrno ();
- return -1;
- }
- debug_printf ("disk geometry: (%ld cyl)*(%ld trk)*(%ld sec)*(%ld bps)",
- di.Cylinders.LowPart,
- di.TracksPerCylinder,
- di.SectorsPerTrack,
- di.BytesPerSector);
- if (DeviceIoControl (get_handle (),
- IOCTL_DISK_GET_PARTITION_INFO,
- NULL, 0,
- &pi, sizeof (pi),
- &bytes_read, NULL))
- {
- debug_printf ("partition info: %ld (%ld)",
- pi.StartingOffset.LowPart,
- pi.PartitionLength.LowPart);
- drive_size = pi.PartitionLength.QuadPart;
- }
- else
- {
- drive_size = di.Cylinders.QuadPart * di.TracksPerCylinder *
- di.SectorsPerTrack * di.BytesPerSector;
- }
- debug_printf ("drive size: %ld", drive_size);
-
- if (whence == SEEK_END && drive_size > 0)
- {
- lloffset = offset + drive_size;
- whence = SEEK_SET;
- }
-
- if (whence == SEEK_CUR)
- {
- low = SetFilePointer (get_handle (), 0, &high, FILE_CURRENT);
- if (low == INVALID_SET_FILE_POINTER && GetLastError ())
- {
- __seterrno ();
- return -1;
- }
- current_position = low + ((__off64_t) high << 32);
- if (is_writing)
- current_position += devbufend - devbufstart;
- else
- current_position -= devbufend - devbufstart;
-
- lloffset += current_position;
- whence = SEEK_SET;
- }
-
- if (lloffset < 0 ||
- drive_size > 0 && lloffset > drive_size)
- {
- set_errno (EINVAL);
- return -1;
- }
-
- /* FIXME: sector can possibly be not 512 bytes long */
- sector_aligned_offset = (lloffset / 512) * 512;
- bytes_left = lloffset - sector_aligned_offset;
-
- if (whence == SEEK_SET)
- {
- /* Invalidate buffer. */
- ret = writebuf ();
- if (ret)
- return ret;
- devbufstart = devbufend = 0;
-
- low = sector_aligned_offset & 0xffffffff;
- high = sector_aligned_offset >> 32;
- if (SetFilePointer (get_handle (), low, &high, FILE_BEGIN)
- == INVALID_SET_FILE_POINTER && GetLastError ())
- {
- __seterrno ();
- return -1;
- }
- return sector_aligned_offset + raw_read (buf, bytes_left);
- }
-
- set_errno (EINVAL);
- return -1;
-}
-
-int
-fhandler_dev_floppy::ioctl (unsigned int cmd, void *buf)
-{
- return fhandler_dev_raw::ioctl (cmd, buf);
-}
-
diff --git a/winsup/cygwin/fhandler_mem.cc b/winsup/cygwin/fhandler_mem.cc
deleted file mode 100644
index 9a53b1a22..000000000
--- a/winsup/cygwin/fhandler_mem.cc
+++ /dev/null
@@ -1,436 +0,0 @@
-/* fhandler_mem.cc. See fhandler.h for a description of the fhandler classes.
-
- Copyright 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. */
-
-#include "winsup.h"
-#include <errno.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <ntdef.h>
-
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-#include "ntdll.h"
-
-/**********************************************************************/
-/* fhandler_dev_mem */
-
-fhandler_dev_mem::fhandler_dev_mem (int nunit)
- : fhandler_base (FH_MEM), unit (nunit)
-{
- /* Reading physical memory only supported on NT/W2K. */
- if (!wincap.has_physical_mem_access ())
- {
- mem_size = 0;
- return;
- }
-
- if (unit == 1) /* /dev/mem */
- {
- NTSTATUS ret;
- SYSTEM_BASIC_INFORMATION sbi;
- if ((ret = NtQuerySystemInformation (SystemBasicInformation, (PVOID) &sbi,
- sizeof sbi, NULL)) != STATUS_SUCCESS)
- {
- __seterrno_from_win_error (RtlNtStatusToDosError (ret));
- debug_printf("NtQuerySystemInformation: ret = %d, Dos(ret) = %d",
- ret, RtlNtStatusToDosError (ret));
- mem_size = 0;
- }
- else
- mem_size = sbi.PhysicalPageSize * sbi.NumberOfPhysicalPages;
- debug_printf ("MemSize: %d MB", mem_size >> 20);
- }
- else if (unit == 2) /* /dev/kmem - Not yet supported */
- {
- mem_size = 0;
- debug_printf ("KMemSize: %d MB", mem_size >> 20);
- }
- else if (unit == 4) /* /dev/port == First 64K of /dev/mem */
- {
- mem_size = 65536;
- debug_printf ("PortSize: 64 KB");
- }
- else
- {
- mem_size = 0;
- debug_printf ("Illegal minor number!!!");
- }
-}
-
-fhandler_dev_mem::~fhandler_dev_mem (void)
-{
-}
-
-int
-fhandler_dev_mem::open (path_conv *, int flags, mode_t)
-{
- if (!wincap.has_physical_mem_access ())
- {
- set_errno (ENOENT);
- debug_printf ("%s is accessible under NT/W2K only",
- unit == 1 ? "/dev/mem" :
- unit == 2 ? "/dev/kmem" :
- "/dev/port");
- return 0;
- }
-
- /* Check for illegal flags. */
- if (flags & (O_APPEND | O_TRUNC | O_EXCL))
- {
- set_errno (EINVAL);
- return 0;
- }
-
- UNICODE_STRING memstr;
- RtlInitUnicodeString (&memstr, L"\\device\\physicalmemory");
-
- OBJECT_ATTRIBUTES attr;
- InitializeObjectAttributes(&attr, &memstr,
- OBJ_CASE_INSENSITIVE | OBJ_INHERIT,
- NULL, NULL);
-
- ACCESS_MASK section_access;
- if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDONLY)
- {
- set_access (GENERIC_READ);
- section_access = SECTION_MAP_READ;
- }
- else if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_WRONLY)
- {
- set_access (GENERIC_WRITE);
- section_access = SECTION_MAP_READ | SECTION_MAP_WRITE;
- }
- else
- {
- set_access (GENERIC_READ | GENERIC_WRITE);
- section_access = SECTION_MAP_READ | SECTION_MAP_WRITE;
- }
-
- HANDLE mem;
- NTSTATUS ret = NtOpenSection (&mem, section_access, &attr);
- if (!NT_SUCCESS(ret))
- {
- __seterrno_from_win_error (RtlNtStatusToDosError (ret));
- set_io_handle (NULL);
- return 0;
- }
-
- set_io_handle (mem);
- set_open_status ();
- return 1;
-}
-
-int
-fhandler_dev_mem::write (const void *ptr, size_t ulen)
-{
- if (!ulen || pos >= mem_size)
- return 0;
-
- if (!(get_access () & GENERIC_WRITE))
- {
- set_errno (EINVAL);
- return -1;
- }
-
- if (pos + ulen > mem_size)
- ulen = mem_size - pos;
-
- PHYSICAL_ADDRESS phys;
- NTSTATUS ret;
- void *viewmem = NULL;
- DWORD len = ulen + getpagesize () - 1;
-
- phys.QuadPart = (ULONGLONG) pos;
- if ((ret = NtMapViewOfSection (get_handle (),
- INVALID_HANDLE_VALUE,
- &viewmem,
- 0L,
- len,
- &phys,
- &len,
- ViewShare,
- 0,
- PAGE_READONLY)) != STATUS_SUCCESS)
- {
- __seterrno_from_win_error (RtlNtStatusToDosError (ret));
- return -1;
- }
-
- memcpy ((char *) viewmem + (pos - phys.QuadPart), ptr, ulen);
-
- if (!NT_SUCCESS(ret = NtUnmapViewOfSection (INVALID_HANDLE_VALUE, viewmem)))
- {
- __seterrno_from_win_error (RtlNtStatusToDosError (ret));
- return -1;
- }
-
- pos += ulen;
- return ulen;
-}
-
-int __stdcall
-fhandler_dev_mem::read (void *ptr, size_t ulen)
-{
- if (!ulen || pos >= mem_size)
- return 0;
-
- if (!(get_access () & GENERIC_READ))
- {
- set_errno (EINVAL);
- return -1;
- }
-
- if (pos + ulen > mem_size)
- ulen = mem_size - pos;
-
- PHYSICAL_ADDRESS phys;
- NTSTATUS ret;
- void *viewmem = NULL;
- DWORD len = ulen + getpagesize () - 1;
-
- phys.QuadPart = (ULONGLONG) pos;
- if ((ret = NtMapViewOfSection (get_handle (),
- INVALID_HANDLE_VALUE,
- &viewmem,
- 0L,
- len,
- &phys,
- &len,
- ViewShare,
- 0,
- PAGE_READONLY)) != STATUS_SUCCESS)
- {
- __seterrno_from_win_error (RtlNtStatusToDosError (ret));
- return -1;
- }
-
- memcpy (ptr, (char *) viewmem + (pos - phys.QuadPart), ulen);
-
- if (!NT_SUCCESS(ret = NtUnmapViewOfSection (INVALID_HANDLE_VALUE, viewmem)))
- {
- __seterrno_from_win_error (RtlNtStatusToDosError (ret));
- return -1;
- }
-
- pos += ulen;
- return ulen;
-}
-
-int
-fhandler_dev_mem::close (void)
-{
- return fhandler_base::close ();
-}
-
-__off64_t
-fhandler_dev_mem::lseek (__off64_t offset, int whence)
-{
- switch (whence)
- {
- case SEEK_SET:
- pos = offset;
- break;
-
- case SEEK_CUR:
- pos += offset;
- break;
-
- case SEEK_END:
- pos = mem_size;
- pos += offset;
- break;
-
- default:
- set_errno (EINVAL);
- return ILLEGAL_SEEK;
- }
-
- if (pos > mem_size)
- {
- set_errno (EINVAL);
- return ILLEGAL_SEEK;
- }
-
- return pos;
-}
-
-HANDLE
-fhandler_dev_mem::mmap (caddr_t *addr, size_t len, DWORD access,
- int flags, __off64_t off)
-{
- if (off >= mem_size
- || (DWORD) len >= mem_size
- || off + len >= mem_size)
- {
- set_errno (EINVAL);
- syscall_printf ("-1 = mmap(): illegal parameter, set EINVAL");
- return INVALID_HANDLE_VALUE;
- }
-
- UNICODE_STRING memstr;
- RtlInitUnicodeString (&memstr, L"\\device\\physicalmemory");
-
- OBJECT_ATTRIBUTES attr;
- InitializeObjectAttributes(&attr, &memstr,
- OBJ_CASE_INSENSITIVE | OBJ_INHERIT,
- NULL, NULL);
-
- ACCESS_MASK section_access;
- ULONG protect;
-
- if (access & FILE_MAP_COPY)
- {
- section_access = SECTION_MAP_READ | SECTION_MAP_WRITE;
- protect = PAGE_WRITECOPY;
- }
- else if (access & FILE_MAP_WRITE)
- {
- section_access = SECTION_MAP_READ | SECTION_MAP_WRITE;
- protect = PAGE_READWRITE;
- }
- else
- {
- section_access = SECTION_MAP_READ;
- protect = PAGE_READONLY;
- }
-
- HANDLE h;
- NTSTATUS ret = NtOpenSection (&h, section_access, &attr);
- if (!NT_SUCCESS(ret))
- {
- __seterrno_from_win_error (RtlNtStatusToDosError (ret));
- syscall_printf ("-1 = mmap(): NtOpenSection failed with %E");
- return INVALID_HANDLE_VALUE;
- }
-
- PHYSICAL_ADDRESS phys;
- void *base = *addr;
- DWORD dlen = len;
-
- phys.QuadPart = (ULONGLONG) off;
-
- if ((ret = NtMapViewOfSection (h,
- INVALID_HANDLE_VALUE,
- &base,
- 0L,
- dlen,
- &phys,
- &dlen,
- ViewShare /*??*/,
- 0,
- protect)) != STATUS_SUCCESS)
- {
- __seterrno_from_win_error (RtlNtStatusToDosError (ret));
- syscall_printf ("-1 = mmap(): NtMapViewOfSection failed with %E");
- return INVALID_HANDLE_VALUE;
- }
- if ((flags & MAP_FIXED) && base != *addr)
- {
- set_errno (EINVAL);
- syscall_printf ("-1 = mmap(): address shift with MAP_FIXED given");
- NtUnmapViewOfSection (INVALID_HANDLE_VALUE, base);
- return INVALID_HANDLE_VALUE;
- }
-
- *addr = (caddr_t) base;
- return h;
-}
-
-int
-fhandler_dev_mem::munmap (HANDLE h, caddr_t addr, size_t len)
-{
- NTSTATUS ret;
- if (!NT_SUCCESS(ret = NtUnmapViewOfSection (INVALID_HANDLE_VALUE, addr)))
- {
- __seterrno_from_win_error (RtlNtStatusToDosError (ret));
- return -1;
- }
- CloseHandle (h);
- return 0;
-}
-
-int
-fhandler_dev_mem::msync (HANDLE h, caddr_t addr, size_t len, int flags)
-{
- return 0;
-}
-
-BOOL
-fhandler_dev_mem::fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset,
- DWORD size, void *address)
-{
- DWORD ret;
- PHYSICAL_ADDRESS phys;
- void *base = address;
- DWORD dlen = size;
- ULONG protect;
-
- if (access & FILE_MAP_COPY)
- protect = PAGE_WRITECOPY;
- else if (access & FILE_MAP_WRITE)
- protect = PAGE_READWRITE;
- else
- protect = PAGE_READONLY;
-
- phys.QuadPart = (ULONGLONG) offset;
-
- if ((ret = NtMapViewOfSection (h,
- INVALID_HANDLE_VALUE,
- &base,
- 0L,
- dlen,
- &phys,
- &dlen,
- ViewShare /*??*/,
- 0,
- protect)) != STATUS_SUCCESS)
- {
- __seterrno_from_win_error (RtlNtStatusToDosError (ret));
- syscall_printf ("-1 = fixup_mmap_after_fork(): NtMapViewOfSection failed with %E");
- return FALSE;
- }
- return base == address;
-}
-
-int
-fhandler_dev_mem::fstat (struct __stat64 *buf, path_conv *pc)
-{
- this->fhandler_base::fstat (buf, pc);
- buf->st_mode = S_IFCHR;
- if (wincap.has_physical_mem_access ())
- buf->st_mode |= S_IRUSR | S_IWUSR |
- S_IRGRP | S_IWGRP |
- S_IROTH | S_IWOTH;
- buf->st_blksize = getpagesize ();
-
- return 0;
-}
-
-int
-fhandler_dev_mem::dup (fhandler_base *child)
-{
- int ret = fhandler_base::dup (child);
-
- if (! ret)
- {
- fhandler_dev_mem *fhc = (fhandler_dev_mem *) child;
-
- fhc->mem_size = mem_size;
- fhc->pos = pos;
- }
- return ret;
-}
-
-void
-fhandler_dev_mem::dump ()
-{
- paranoid_printf("here, fhandler_dev_mem");
-}
diff --git a/winsup/cygwin/fhandler_proc.cc b/winsup/cygwin/fhandler_proc.cc
deleted file mode 100644
index 65accd2e1..000000000
--- a/winsup/cygwin/fhandler_proc.cc
+++ /dev/null
@@ -1,502 +0,0 @@
-/* fhandler_proc.cc: fhandler for /proc virtual filesystem
-
- Copyright 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. */
-
-#include "winsup.h"
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/cygwin.h>
-#include <ntdef.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "pinfo.h"
-#include "dtable.h"
-#include "cygheap.h"
-#include <assert.h>
-#include <sys/utsname.h>
-#include "ntdll.h"
-
-#define _COMPILING_NEWLIB
-#include <dirent.h>
-
-/* offsets in proc_listing */
-static const int PROC_LOADAVG = 2; // /proc/loadavg
-static const int PROC_MEMINFO = 3; // /proc/meminfo
-static const int PROC_REGISTRY = 4; // /proc/registry
-static const int PROC_STAT = 5; // /proc/stat
-static const int PROC_VERSION = 6; // /proc/version
-static const int PROC_UPTIME = 7; // /proc/uptime
-
-/* names of objects in /proc */
-static const char *proc_listing[] = {
- ".",
- "..",
- "loadavg",
- "meminfo",
- "registry",
- "stat",
- "version",
- "uptime",
- NULL
-};
-
-static const int PROC_LINK_COUNT = (sizeof(proc_listing) / sizeof(const char *)) - 1;
-
-/* FH_PROC in the table below means the file/directory is handles by
- * fhandler_proc.
- */
-static const DWORD proc_fhandlers[PROC_LINK_COUNT] = {
- FH_PROC,
- FH_PROC,
- FH_PROC,
- FH_PROC,
- FH_REGISTRY,
- FH_PROC,
- FH_PROC,
- FH_PROC
-};
-
-/* name of the /proc filesystem */
-const char proc[] = "/proc";
-const int proc_len = sizeof (proc) - 1;
-
-static off_t format_proc_meminfo (char *destbuf, size_t maxsize);
-static off_t format_proc_stat (char *destbuf, size_t maxsize);
-static off_t format_proc_uptime (char *destbuf, size_t maxsize);
-
-/* auxillary function that returns the fhandler associated with the given path
- * this is where it would be nice to have pattern matching in C - polymorphism
- * just doesn't cut it
- */
-DWORD
-fhandler_proc::get_proc_fhandler (const char *path)
-{
- debug_printf ("get_proc_fhandler(%s)", path);
- path += proc_len;
- /* Since this method is called from path_conv::check we can't rely on
- * it being normalised and therefore the path may have runs of slashes
- * in it.
- */
- while (SLASH_P (*path))
- path++;
-
- /* Check if this is the root of the virtual filesystem (i.e. /proc). */
- if (*path == 0)
- return FH_PROC;
-
- for (int i = 0; proc_listing[i]; i++)
- {
- if (path_prefix_p (proc_listing[i], path, strlen (proc_listing[i])))
- return proc_fhandlers[i];
- }
-
- if (pinfo (atoi (path)))
- return FH_PROCESS;
-
- bool has_subdir = false;
- while (*path)
- if (SLASH_P (*path++))
- {
- has_subdir = true;
- break;
- }
-
- if (has_subdir)
- /* The user is trying to access a non-existent subdirectory of /proc. */
- return FH_BAD;
- else
- /* Return FH_PROC so that we can return EROFS if the user is trying to create
- a file. */
- return FH_PROC;
-}
-
-/* Returns 0 if path doesn't exist, >0 if path is a directory,
- * <0 if path is a file.
- */
-int
-fhandler_proc::exists ()
-{
- const char *path = get_name ();
- debug_printf ("exists (%s)", path);
- path += proc_len;
- if (*path == 0)
- return 2;
- for (int i = 0; proc_listing[i]; i++)
- if (pathmatch (path + 1, proc_listing[i]))
- return (proc_fhandlers[i] == FH_PROC) ? -1 : 1;
- return 0;
-}
-
-fhandler_proc::fhandler_proc ():
- fhandler_virtual (FH_PROC)
-{
-}
-
-fhandler_proc::fhandler_proc (DWORD devtype):
- fhandler_virtual (devtype)
-{
-}
-
-int
-fhandler_proc::fstat (struct __stat64 *buf, path_conv *pc)
-{
- const char *path = get_name ();
- debug_printf ("fstat (%s)", path);
-
- path += proc_len;
- (void) fhandler_base::fstat (buf, pc);
-
- buf->st_mode &= ~_IFMT & NO_W;
-
- if (!*path)
- {
- buf->st_nlink = PROC_LINK_COUNT;
- buf->st_mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH;
- return 0;
- }
- else
- {
- path++;
- for (int i = 0; proc_listing[i]; i++)
- if (pathmatch (path, proc_listing[i]))
- {
- if (proc_fhandlers[i] != FH_PROC)
- buf->st_mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH;
- else
- {
- buf->st_mode &= NO_X;
- buf->st_mode |= S_IFREG;
- }
- return 0;
- }
- }
- set_errno (ENOENT);
- return -1;
-}
-
-struct dirent *
-fhandler_proc::readdir (DIR * dir)
-{
- if (dir->__d_position >= PROC_LINK_COUNT)
- {
- winpids pids;
- int found = 0;
- for (unsigned i = 0; i < pids.npids; i++)
- if (found++ == dir->__d_position - PROC_LINK_COUNT)
- {
- __small_sprintf (dir->__d_dirent->d_name, "%d", pids[i]->pid);
- dir->__d_position++;
- return dir->__d_dirent;
- }
- set_errno (ENMFILE);
- return NULL;
- }
-
- strcpy (dir->__d_dirent->d_name, proc_listing[dir->__d_position++]);
- syscall_printf ("%p = readdir (%p) (%s)", &dir->__d_dirent, dir,
- dir->__d_dirent->d_name);
- return dir->__d_dirent;
-}
-
-int
-fhandler_proc::open (path_conv *pc, int flags, mode_t mode)
-{
- int proc_file_no = -1;
-
- int res = fhandler_virtual::open (pc, flags, mode);
- if (!res)
- goto out;
-
- const char *path;
-
- path = get_name () + proc_len;
-
- if (!*path)
- {
- if ((flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
- {
- set_errno (EEXIST);
- res = 0;
- goto out;
- }
- else if (flags & O_WRONLY)
- {
- set_errno (EISDIR);
- res = 0;
- goto out;
- }
- else
- {
- flags |= O_DIROPEN;
- goto success;
- }
- }
-
- proc_file_no = -1;
- for (int i = 0; proc_listing[i]; i++)
- if (path_prefix_p (proc_listing[i], path + 1, strlen (proc_listing[i])))
- {
- proc_file_no = i;
- if (proc_fhandlers[i] != FH_PROC)
- {
- if ((flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
- {
- set_errno (EEXIST);
- res = 0;
- goto out;
- }
- else if (flags & O_WRONLY)
- {
- set_errno (EISDIR);
- res = 0;
- goto out;
- }
- else
- {
- flags |= O_DIROPEN;
- goto success;
- }
- }
- }
-
- if (proc_file_no == -1)
- {
- if (flags & O_CREAT)
- {
- set_errno (EROFS);
- res = 0;
- goto out;
- }
- else
- {
- set_errno (ENOENT);
- res = 0;
- goto out;
- }
- }
- if (flags & O_WRONLY)
- {
- set_errno (EROFS);
- res = 0;
- goto out;
- }
-
- fileid = proc_file_no;
- fill_filebuf ();
-
- if (flags & O_APPEND)
- position = filesize;
- else
- position = 0;
-
-success:
- res = 1;
- set_flags (flags & ~O_TEXT, O_BINARY);
- set_open_status ();
-out:
- syscall_printf ("%d = fhandler_proc::open (%p, %d)", res, flags, mode);
- return res;
-}
-
-void
-fhandler_proc::fill_filebuf ()
-{
- switch (fileid)
- {
- case PROC_VERSION:
- {
- if (!filebuf)
- {
- struct utsname uts_name;
- uname (&uts_name);
- bufalloc = strlen (uts_name.sysname) + 1 + strlen (uts_name.release) +
- 1 + strlen (uts_name.version) + 2;
- filebuf = (char *) cmalloc (HEAP_BUF, bufalloc);
- filesize = __small_sprintf (filebuf, "%s %s %s\n", uts_name.sysname,
- uts_name.release, uts_name.version);
- }
- break;
- }
- case PROC_UPTIME:
- {
- if (!filebuf)
- filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 80);
- filesize = format_proc_uptime (filebuf, bufalloc);
- break;
- }
- case PROC_STAT:
- {
- if (!filebuf)
- filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 2048);
- filesize = format_proc_stat (filebuf, bufalloc);
- break;
- }
- case PROC_LOADAVG:
- {
- /*
- * not really supported - Windows doesn't keep track of these values
- * Windows 95/98/me does have the KERNEL/CPUUsage performance counter
- * which is similar.
- */
- if (!filebuf)
- filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 16);
- filesize = __small_sprintf (filebuf, "%u.%02u %u.%02u %u.%02u\n",
- 0, 0, 0, 0, 0, 0);
- break;
- }
- case PROC_MEMINFO:
- {
- if (!filebuf)
- filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 2048);
- filesize = format_proc_meminfo (filebuf, bufalloc);
- break;
- }
- }
-}
-
-static
-off_t
-format_proc_meminfo (char *destbuf, size_t maxsize)
-{
- unsigned long mem_total = 0UL, mem_free = 0UL, swap_total = 0UL,
- swap_free = 0UL;
- MEMORYSTATUS memory_status;
- GlobalMemoryStatus (&memory_status);
- mem_total = memory_status.dwTotalPhys;
- mem_free = memory_status.dwAvailPhys;
- swap_total = memory_status.dwTotalPageFile;
- swap_free = memory_status.dwAvailPageFile;
- return __small_sprintf (destbuf, " total: used: free:\n"
- "Mem: %10lu %10lu %10lu\n"
- "Swap: %10lu %10lu %10lu\n"
- "MemTotal: %10lu kB\n"
- "MemFree: %10lu kB\n"
- "MemShared: 0 kB\n"
- "HighTotal: 0 kB\n"
- "HighFree: 0 kB\n"
- "LowTotal: %10lu kB\n"
- "LowFree: %10lu kB\n"
- "SwapTotal: %10lu kB\n"
- "SwapFree: %10lu kB\n",
- mem_total, mem_total - mem_free, mem_free,
- swap_total, swap_total - swap_free, swap_free,
- mem_total >> 10, mem_free >> 10,
- mem_total >> 10, mem_free >> 10,
- swap_total >> 10, swap_free >> 10);
-}
-
-static
-off_t
-format_proc_uptime (char *destbuf, size_t maxsize)
-{
- unsigned long long uptime = 0ULL, idle_time = 0ULL;
- SYSTEM_PROCESSOR_TIMES spt;
-
- NTSTATUS ret = NtQuerySystemInformation (SystemProcessorTimes, (PVOID) &spt,
- sizeof spt, NULL);
- if (!ret && GetLastError () == ERROR_PROC_NOT_FOUND)
- uptime = GetTickCount() / 10;
- else if (ret != STATUS_SUCCESS)
- {
- __seterrno_from_win_error (RtlNtStatusToDosError (ret));
- debug_printf("NtQuerySystemInformation: ret = %d, "
- "Dos(ret) = %d",
- ret, RtlNtStatusToDosError (ret));
- return 0;
- }
- else
- {
- idle_time = spt.IdleTime.QuadPart / 100000ULL;
- uptime = (spt.InterruptTime.QuadPart + spt.KernelTime.QuadPart +
- spt.IdleTime.QuadPart + spt.UserTime.QuadPart +
- spt.DpcTime.QuadPart) / 100000ULL;
- }
-
- return __small_sprintf (destbuf, "%U.%02u %U.%02u\n",
- uptime / 100, long (uptime % 100),
- idle_time / 100, long (idle_time % 100));
-}
-
-static
-off_t
-format_proc_stat (char *destbuf, size_t maxsize)
-{
- unsigned long long user_time = 0ULL, kernel_time = 0ULL, idle_time = 0ULL;
- unsigned long pages_in = 0UL, pages_out = 0UL, interrupt_count = 0UL,
- context_switches = 0UL, swap_in = 0UL, swap_out = 0UL;
- time_t boot_time = 0;
-
- if (wincap.is_winnt ())
- {
- NTSTATUS ret;
- SYSTEM_PROCESSOR_TIMES spt;
- SYSTEM_PERFORMANCE_INFORMATION spi;
- SYSTEM_TIME_OF_DAY_INFORMATION stodi;
- ret = NtQuerySystemInformation (SystemProcessorTimes,
- (PVOID) &spt,
- sizeof spt, NULL);
- if (ret == STATUS_SUCCESS)
- ret = NtQuerySystemInformation (SystemPerformanceInformation,
- (PVOID) &spi,
- sizeof spi, NULL);
- if (ret == STATUS_SUCCESS)
- ret = NtQuerySystemInformation (SystemTimeOfDayInformation,
- (PVOID) &stodi,
- sizeof stodi, NULL);
- if (ret != STATUS_SUCCESS)
- {
- __seterrno_from_win_error (RtlNtStatusToDosError (ret));
- debug_printf("NtQuerySystemInformation: ret = %d, "
- "Dos(ret) = %d",
- ret, RtlNtStatusToDosError (ret));
- return 0;
- }
- kernel_time = (spt.KernelTime.QuadPart + spt.InterruptTime.QuadPart + spt.DpcTime.QuadPart) / 100000ULL;
- user_time = spt.UserTime.QuadPart / 100000ULL;
- idle_time = spt.IdleTime.QuadPart / 100000ULL;
- interrupt_count = spt.InterruptCount;
- pages_in = spi.PagesRead;
- pages_out = spi.PagefilePagesWritten + spi.MappedFilePagesWritten;
- /*
- * Note: there is no distinction made in this structure between pages
- * read from the page file and pages read from mapped files, but there
- * is such a distinction made when it comes to writing. Goodness knows
- * why. The value of swap_in, then, will obviously be wrong but its our
- * best guess.
- */
- swap_in = spi.PagesRead;
- swap_out = spi.PagefilePagesWritten;
- context_switches = spi.ContextSwitches;
- boot_time = to_time_t ((FILETIME *) &stodi.BootTime.QuadPart);
- }
- /*
- * else
- * {
- * There are only two relevant performance counters on Windows 95/98/me,
- * VMM/cPageIns and VMM/cPageOuts. The extra effort needed to read these
- * counters is by no means worth it.
- * }
- */
- return __small_sprintf (destbuf, "cpu %U %U %U %U\n"
- "page %u %u\n"
- "swap %u %u\n"
- "intr %u\n"
- "ctxt %u\n"
- "btime %u\n",
- user_time, 0ULL,
- kernel_time, idle_time,
- pages_in, pages_out,
- swap_in, swap_out,
- interrupt_count,
- context_switches,
- boot_time);
-}
diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc
deleted file mode 100644
index 86393db05..000000000
--- a/winsup/cygwin/fhandler_process.cc
+++ /dev/null
@@ -1,736 +0,0 @@
-/* fhandler_process.cc: fhandler for /proc/<pid> virtual filesystem
-
- Copyright 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. */
-
-#include "winsup.h"
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/cygwin.h>
-#include <ntdef.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-#include "pinfo.h"
-#include "path.h"
-#include "shared_info.h"
-#include "dtable.h"
-#include "cygheap.h"
-#include "ntdll.h"
-#include <assert.h>
-
-#define _COMPILING_NEWLIB
-#include <dirent.h>
-
-static const int PROCESS_PPID = 2;
-static const int PROCESS_EXENAME = 3;
-static const int PROCESS_WINPID = 4;
-static const int PROCESS_WINEXENAME = 5;
-static const int PROCESS_STATUS = 6;
-static const int PROCESS_UID = 7;
-static const int PROCESS_GID = 8;
-static const int PROCESS_PGID = 9;
-static const int PROCESS_SID = 10;
-static const int PROCESS_CTTY = 11;
-static const int PROCESS_STAT = 12;
-static const int PROCESS_STATM = 13;
-
-static const char *process_listing[] = {
- ".",
- "..",
- "ppid",
- "exename",
- "winpid",
- "winexename",
- "status",
- "uid",
- "gid",
- "pgid",
- "sid",
- "ctty",
- "stat",
- "statm",
- NULL
-};
-
-static const int PROCESS_LINK_COUNT = (sizeof(process_listing) / sizeof(const char *)) - 1;
-
-static off_t format_process_stat (_pinfo *p, char *destbuf, size_t maxsize);
-static off_t format_process_status (_pinfo *p, char *destbuf, size_t maxsize);
-static off_t format_process_statm (_pinfo *p, char *destbuf, size_t maxsize);
-static int get_process_state (DWORD dwProcessId);
-static bool get_mem_values(DWORD dwProcessId, unsigned long *vmsize, unsigned long *vmrss, unsigned long *vmtext,
- unsigned long *vmdata, unsigned long *vmlib, unsigned long *vmshare);
-
-/* Returns 0 if path doesn't exist, >0 if path is a directory,
- * <0 if path is a file.
- */
-int
-fhandler_process::exists ()
-{
- const char *path = get_name ();
- debug_printf ("exists (%s)", path);
- path += proc_len + 1;
- while (*path != 0 && !SLASH_P (*path))
- path++;
- if (*path == 0)
- return 2;
-
- for (int i = 0; process_listing[i]; i++)
- if (pathmatch (path + 1, process_listing[i]))
- return -1;
- return 0;
-}
-
-fhandler_process::fhandler_process ():
- fhandler_proc (FH_PROCESS)
-{
-}
-
-int
-fhandler_process::fstat (struct __stat64 *buf, path_conv *pc)
-{
- const char *path = get_name ();
- int file_type = exists ();
- (void) fhandler_base::fstat (buf, pc);
- path += proc_len + 1;
- int pid = atoi (path);
- winpids pids;
- pinfo p (pid);
- if (!p)
- {
- set_errno(ENOENT);
- return -1;
- }
-
- buf->st_mode &= ~_IFMT & NO_W;
-
- switch (file_type)
- {
- case 0:
- set_errno (ENOENT);
- return -1;
- case 1:
- buf->st_mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH;
- return 0;
- case 2:
- buf->st_ctime = buf->st_mtime = p->start_time;
- buf->st_ctim.tv_nsec = buf->st_mtim.tv_nsec = 0;
- time_as_timestruc_t(&buf->st_atim);
- buf->st_uid = p->uid;
- buf->st_gid = p->gid;
- buf->st_mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH;
- buf->st_nlink = PROCESS_LINK_COUNT;
- return 0;
- default:
- case -1:
- buf->st_uid = p->uid;
- buf->st_gid = p->gid;
- buf->st_mode |= S_IFREG | S_IRUSR | S_IRGRP | S_IROTH;
- return 0;
- }
-}
-
-struct dirent *
-fhandler_process::readdir (DIR * dir)
-{
- if (dir->__d_position >= PROCESS_LINK_COUNT)
- {
- set_errno (ENMFILE);
- return NULL;
- }
- strcpy (dir->__d_dirent->d_name, process_listing[dir->__d_position++]);
- syscall_printf ("%p = readdir (%p) (%s)", &dir->__d_dirent, dir,
- dir->__d_dirent->d_name);
- return dir->__d_dirent;
-}
-
-int
-fhandler_process::open (path_conv *pc, int flags, mode_t mode)
-{
- int process_file_no = -1, pid;
- winpids pids;
-
- int res = fhandler_virtual::open (pc, flags, mode);
- if (!res)
- goto out;
-
- const char *path;
- path = get_name () + proc_len + 1;
- pid = atoi (path);
- while (*path != 0 && !SLASH_P (*path))
- path++;
-
- if (*path == 0)
- {
- if ((flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
- {
- set_errno (EEXIST);
- res = 0;
- goto out;
- }
- else if (flags & O_WRONLY)
- {
- set_errno (EISDIR);
- res = 0;
- goto out;
- }
- else
- {
- flags |= O_DIROPEN;
- goto success;
- }
- }
-
- process_file_no = -1;
- for (int i = 0; process_listing[i]; i++)
- {
- if (path_prefix_p
- (process_listing[i], path + 1, strlen (process_listing[i])))
- process_file_no = i;
- }
- if (process_file_no == -1)
- {
- if (flags & O_CREAT)
- {
- set_errno (EROFS);
- res = 0;
- goto out;
- }
- else
- {
- set_errno (ENOENT);
- res = 0;
- goto out;
- }
- }
- if (flags & O_WRONLY)
- {
- set_errno (EROFS);
- res = 0;
- goto out;
- }
-
- {
- pinfo p (pid);
- if (!p)
- {
- set_errno (ENOENT);
- res = 0;
- goto out;
- }
-
- fileid = process_file_no;
- fill_filebuf (p);
-
- if (flags & O_APPEND)
- position = filesize;
- else
- position = 0;
- }
-
-success:
- res = 1;
- set_flags (flags & ~O_TEXT, O_BINARY);
- set_open_status ();
-out:
- syscall_printf ("%d = fhandler_proc::open (%p, %d)", res, flags, mode);
- return res;
-}
-
-void
-fhandler_process::fill_filebuf (pinfo& p)
-{
- switch (fileid)
- {
- case PROCESS_UID:
- case PROCESS_GID:
- case PROCESS_PGID:
- case PROCESS_SID:
- case PROCESS_CTTY:
- case PROCESS_PPID:
- {
- if (!filebuf)
- filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 40);
- int num;
- switch (fileid)
- {
- case PROCESS_PPID:
- num = p->ppid;
- break;
- case PROCESS_UID:
- num = p->uid;
- break;
- case PROCESS_PGID:
- num = p->pgid;
- break;
- case PROCESS_SID:
- num = p->sid;
- break;
- case PROCESS_GID:
- num = p->gid;
- break;
- case PROCESS_CTTY:
- num = p->ctty;
- break;
- default: // what's this here for?
- num = 0;
- break;
- }
- __small_sprintf (filebuf, "%d\n", num);
- filesize = strlen (filebuf);
- break;
- }
- case PROCESS_EXENAME:
- {
- if (!filebuf)
- filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = MAX_PATH);
- if (p->process_state & (PID_ZOMBIE | PID_EXITED))
- strcpy (filebuf, "<defunct>");
- else
- {
- mount_table->conv_to_posix_path (p->progname, filebuf, 1);
- int len = strlen (filebuf);
- if (len > 4)
- {
- char *s = filebuf + len - 4;
- if (strcasecmp (s, ".exe") == 0)
- *s = 0;
- }
- }
- filesize = strlen (filebuf);
- break;
- }
- case PROCESS_WINPID:
- {
- if (!filebuf)
- filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 40);
- __small_sprintf (filebuf, "%d\n", p->dwProcessId);
- filesize = strlen (filebuf);
- break;
- }
- case PROCESS_WINEXENAME:
- {
- int len = strlen (p->progname);
- if (!filebuf)
- filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = (len + 2));
- strcpy (filebuf, p->progname);
- filebuf[len] = '\n';
- filesize = len + 1;
- break;
- }
- case PROCESS_STATUS:
- {
- if (!filebuf)
- filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 2048);
- filesize = format_process_status (p, filebuf, bufalloc);
- break;
- }
- case PROCESS_STAT:
- {
- if (!filebuf)
- filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 2048);
- filesize = format_process_stat (p, filebuf, bufalloc);
- break;
- }
- case PROCESS_STATM:
- {
- if (!filebuf)
- filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 2048);
- filesize = format_process_statm (p, filebuf, bufalloc);
- break;
- }
- }
-}
-
-static
-off_t
-format_process_stat (_pinfo *p, char *destbuf, size_t maxsize)
-{
- char cmd[MAX_PATH];
- int state = 'R';
- unsigned long fault_count = 0UL,
- utime = 0UL, stime = 0UL,
- start_time = 0UL,
- vmsize = 0UL, vmrss = 0UL, vmmaxrss = 0UL;
- int priority = 0;
- if (p->process_state & (PID_ZOMBIE | PID_EXITED))
- strcpy (cmd, "<defunct");
- else
- {
- strcpy(cmd, p->progname);
- char *last_slash = strrchr (cmd, '\\');
- if (last_slash != NULL)
- strcpy (cmd, last_slash + 1);
- int len = strlen (cmd);
- if (len > 4)
- {
- char *s = cmd + len - 4;
- if (strcasecmp (s, ".exe") == 0)
- *s = 0;
- }
- }
- /*
- * Note: under Windows, a _process_ is always running - it's only _threads_
- * that get suspended. Therefore the default state is R (runnable).
- */
- if (p->process_state & PID_ZOMBIE)
- state = 'Z';
- else if (p->process_state & PID_STOPPED)
- state = 'T';
- else if (wincap.is_winnt ())
- state = get_process_state (p->dwProcessId);
- if (wincap.is_winnt ())
- {
- NTSTATUS ret;
- HANDLE hProcess;
- VM_COUNTERS vmc;
- KERNEL_USER_TIMES put;
- PROCESS_BASIC_INFORMATION pbi;
- QUOTA_LIMITS ql;
- SYSTEM_TIME_OF_DAY_INFORMATION stodi;
- SYSTEM_PROCESSOR_TIMES spt;
- hProcess = OpenProcess (PROCESS_VM_READ | PROCESS_QUERY_INFORMATION,
- FALSE, p->dwProcessId);
- if (hProcess != NULL)
- {
- ret = NtQueryInformationProcess (hProcess,
- ProcessVmCounters,
- (PVOID) &vmc,
- sizeof vmc, NULL);
- if (ret == STATUS_SUCCESS)
- ret = NtQueryInformationProcess (hProcess,
- ProcessTimes,
- (PVOID) &put,
- sizeof put, NULL);
- if (ret == STATUS_SUCCESS)
- ret = NtQueryInformationProcess (hProcess,
- ProcessBasicInformation,
- (PVOID) &pbi,
- sizeof pbi, NULL);
- if (ret == STATUS_SUCCESS)
- ret = NtQueryInformationProcess (hProcess,
- ProcessQuotaLimits,
- (PVOID) &ql,
- sizeof ql, NULL);
- CloseHandle (hProcess);
- }
- else
- {
- DWORD error = GetLastError ();
- __seterrno_from_win_error (error);
- debug_printf("OpenProcess: ret = %d",
- error);
- return 0;
- }
- if (ret == STATUS_SUCCESS)
- ret = NtQuerySystemInformation (SystemTimeOfDayInformation,
- (PVOID) &stodi,
- sizeof stodi, NULL);
- if (ret == STATUS_SUCCESS)
- ret = NtQuerySystemInformation (SystemProcessorTimes,
- (PVOID) &spt,
- sizeof spt, NULL);
- if (ret != STATUS_SUCCESS)
- {
- __seterrno_from_win_error (RtlNtStatusToDosError (ret));
- debug_printf("NtQueryInformationProcess: ret = %d, "
- "Dos(ret) = %d",
- ret, RtlNtStatusToDosError (ret));
- return 0;
- }
- fault_count = vmc.PageFaultCount;
- utime = put.UserTime.QuadPart / 100000ULL;
- stime = put.KernelTime.QuadPart / 100000ULL;
- if (stodi.CurrentTime.QuadPart > put.CreateTime.QuadPart)
- start_time = (spt.InterruptTime.QuadPart + spt.KernelTime.QuadPart +
- spt.IdleTime.QuadPart + spt.UserTime.QuadPart +
- spt.DpcTime.QuadPart - stodi.CurrentTime.QuadPart +
- put.CreateTime.QuadPart) / 100000ULL;
- else
- /*
- * sometimes stodi.CurrentTime is a bit behind
- * Note: some older versions of procps are broken and can't cope
- * with process start times > time(NULL).
- */
- start_time = (spt.InterruptTime.QuadPart + spt.KernelTime.QuadPart +
- spt.IdleTime.QuadPart + spt.UserTime.QuadPart +
- spt.DpcTime.QuadPart) / 100000ULL;
- priority = pbi.BasePriority;
- unsigned page_size = getpagesize();
- vmsize = vmc.VirtualSize;
- vmrss = vmc.WorkingSetSize / page_size;
- vmmaxrss = ql.MaximumWorkingSetSize / page_size;
- }
- else
- {
- start_time = (GetTickCount() / 1000 - time(NULL) + p->start_time) * 100;
- }
- return __small_sprintf (destbuf, "%d (%s) %c "
- "%d %d %d %d %d "
- "%lu %lu %lu %lu %lu %lu %lu "
- "%ld %ld %ld %ld %ld %ld "
- "%lu %lu "
- "%ld "
- "%lu",
- p->pid, cmd,
- state,
- p->ppid, p->pgid, p->sid, p->ctty, -1,
- 0, fault_count, fault_count, 0, 0, utime, stime,
- utime, stime, priority, 0, 0, 0,
- start_time, vmsize,
- vmrss, vmmaxrss
- );
-}
-
-static
-off_t
-format_process_status (_pinfo *p, char *destbuf, size_t maxsize)
-{
- char cmd[MAX_PATH];
- int state = 'R';
- const char *state_str = "unknown";
- unsigned long vmsize = 0UL, vmrss = 0UL, vmdata = 0UL, vmlib = 0UL, vmtext = 0UL,
- vmshare = 0UL;
- if (p->process_state & (PID_ZOMBIE | PID_EXITED))
- strcpy (cmd, "<defunct>");
- else
- {
- strcpy(cmd, p->progname);
- char *last_slash = strrchr (cmd, '\\');
- if (last_slash != NULL)
- strcpy (cmd, last_slash + 1);
- int len = strlen (cmd);
- if (len > 4)
- {
- char *s = cmd + len - 4;
- if (strcasecmp (s, ".exe") == 0)
- *s = 0;
- }
- }
- /*
- * Note: under Windows, a _process_ is always running - it's only _threads_
- * that get suspended. Therefore the default state is R (runnable).
- */
- if (p->process_state & PID_ZOMBIE)
- state = 'Z';
- else if (p->process_state & PID_STOPPED)
- state = 'T';
- else if (wincap.is_winnt ())
- state = get_process_state (p->dwProcessId);
- switch (state)
- {
- case 'O':
- state_str = "running";
- break;
- case 'D':
- case 'S':
- state_str = "sleeping";
- break;
- case 'R':
- state_str = "runnable";
- break;
- case 'Z':
- state_str = "zombie";
- break;
- case 'T':
- state_str = "stopped";
- break;
- }
- if (wincap.is_winnt ())
- {
- if (!get_mem_values (p->dwProcessId, &vmsize, &vmrss, &vmtext, &vmdata, &vmlib, &vmshare))
- return 0;
- unsigned page_size = getpagesize();
- vmsize *= page_size; vmrss *= page_size; vmdata *= page_size;
- vmtext *= page_size; vmlib *= page_size;
- }
- return __small_sprintf (destbuf, "Name: %s\n"
- "State: %c (%s)\n"
- "Tgid: %d\n"
- "Pid: %d\n"
- "PPid: %d\n"
- "Uid: %d %d %d %d\n"
- "Gid: %d %d %d %d\n"
- "VmSize: %8d kB\n"
- "VmLck: %8d kB\n"
- "VmRSS: %8d kB\n"
- "VmData: %8d kB\n"
- "VmStk: %8d kB\n"
- "VmExe: %8d kB\n"
- "VmLib: %8d kB\n"
- "SigPnd: %016x\n"
- "SigBlk: %016x\n"
- "SigIgn: %016x\n",
- cmd,
- state, state_str,
- p->pgid,
- p->pid,
- p->ppid,
- p->uid, cygheap->user.real_uid, cygheap->user.real_uid, p->uid,
- p->gid, cygheap->user.real_gid, cygheap->user.real_gid, p->gid,
- vmsize >> 10, 0, vmrss >> 10, vmdata >> 10, 0, vmtext >> 10, vmlib >> 10,
- 0, 0, p->getsigmask ()
- );
-}
-
-static
-off_t
-format_process_statm (_pinfo *p, char *destbuf, size_t maxsize)
-{
- unsigned long vmsize = 0UL, vmrss = 0UL, vmtext = 0UL, vmdata = 0UL, vmlib = 0UL,
- vmshare = 0UL;
- if (wincap.is_winnt ())
- {
- if (!get_mem_values (p->dwProcessId, &vmsize, &vmrss, &vmtext, &vmdata, &vmlib, &vmshare))
- return 0;
- }
- return __small_sprintf (destbuf, "%ld %ld %ld %ld %ld %ld %ld",
- vmsize, vmrss, vmshare, vmtext, vmlib, vmdata, 0
- );
-}
-
-static
-int
-get_process_state (DWORD dwProcessId)
-{
- /*
- * This isn't really heavy magic - just go through the processes'
- * threads one by one and return a value accordingly
- * Errors are silently ignored.
- */
- NTSTATUS ret;
- SYSTEM_PROCESSES *sp;
- ULONG n = 0x1000;
- PULONG p = new ULONG[n];
- int state =' ';
- while (STATUS_INFO_LENGTH_MISMATCH ==
- (ret = NtQuerySystemInformation (SystemProcessesAndThreadsInformation,
- (PVOID) p,
- n * sizeof *p, NULL)))
- delete [] p, p = new ULONG[n *= 2];
- if (ret != STATUS_SUCCESS)
- {
- debug_printf("NtQuerySystemInformation: ret = %d, "
- "Dos(ret) = %d",
- ret, RtlNtStatusToDosError (ret));
- goto out;
- }
- state = 'Z';
- sp = (SYSTEM_PROCESSES *) p;
- for (;;)
- {
- if (sp->ProcessId == dwProcessId)
- {
- SYSTEM_THREADS *st;
- if (wincap.has_process_io_counters ())
- /*
- * Windows 2000 and XP have an extra member in SYSTEM_PROCESSES
- * which means the offset of the first SYSTEM_THREADS entry is
- * different on these operating systems compared to NT 4.
- */
- st = &sp->Threads[0];
- else
- /*
- * 136 is the offset of the first SYSTEM_THREADS entry on
- * Windows NT 4.
- */
- st = (SYSTEM_THREADS *) ((char *) sp + 136);
- state = 'S';
- for (unsigned i = 0; i < sp->ThreadCount; i++)
- {
- if (st->State == StateRunning ||
- st->State == StateReady)
- {
- state = 'R';
- goto out;
- }
- st++;
- }
- break;
- }
- if (!sp->NextEntryDelta)
- break;
- sp = (SYSTEM_PROCESSES *) ((char *) sp + sp->NextEntryDelta);
- }
-out:
- delete [] p;
- return state;
-}
-
-static
-bool
-get_mem_values(DWORD dwProcessId, unsigned long *vmsize, unsigned long *vmrss, unsigned long *vmtext,
- unsigned long *vmdata, unsigned long *vmlib, unsigned long *vmshare)
-{
- bool res = true;
- NTSTATUS ret;
- HANDLE hProcess;
- VM_COUNTERS vmc;
- MEMORY_WORKING_SET_LIST *mwsl;
- ULONG n = 0x1000, length;
- PULONG p = new ULONG[n];
- unsigned page_size = getpagesize();
- hProcess = OpenProcess (PROCESS_QUERY_INFORMATION,
- FALSE, dwProcessId);
- if (hProcess == NULL)
- {
- DWORD error = GetLastError();
- __seterrno_from_win_error (error);
- debug_printf("OpenProcess: ret = %d",
- error);
- return false;
- }
- while ((ret = NtQueryVirtualMemory (hProcess, 0,
- MemoryWorkingSetList,
- (PVOID) p,
- n * sizeof *p, &length)),
- (ret == STATUS_SUCCESS || ret == STATUS_INFO_LENGTH_MISMATCH) &&
- length >= n * sizeof *p)
- delete [] p, p = new ULONG[n *= 2];
- if (ret != STATUS_SUCCESS)
- {
- debug_printf("NtQueryVirtualMemory: ret = %d, "
- "Dos(ret) = %d",
- ret, RtlNtStatusToDosError (ret));
- res = false;
- goto out;
- }
- mwsl = (MEMORY_WORKING_SET_LIST *) p;
- for (unsigned long i = 0; i < mwsl->NumberOfPages; i++)
- {
- ++*vmrss;
- unsigned flags = mwsl->WorkingSetList[i] & 0x0FFF;
- if (flags & (WSLE_PAGE_EXECUTE | WSLE_PAGE_SHAREABLE) == (WSLE_PAGE_EXECUTE | WSLE_PAGE_SHAREABLE))
- ++*vmlib;
- else if (flags & WSLE_PAGE_SHAREABLE)
- ++*vmshare;
- else if (flags & WSLE_PAGE_EXECUTE)
- ++*vmtext;
- else
- ++*vmdata;
- }
- ret = NtQueryInformationProcess (hProcess,
- ProcessVmCounters,
- (PVOID) &vmc,
- sizeof vmc, NULL);
- if (ret != STATUS_SUCCESS)
- {
- debug_printf("NtQueryInformationProcess: ret = %d, "
- "Dos(ret) = %d",
- ret, RtlNtStatusToDosError (ret));
- res = false;
- goto out;
- }
- *vmsize = vmc.VirtualSize / page_size;
-out:
- delete [] p;
- CloseHandle (hProcess);
- return res;
-}
diff --git a/winsup/cygwin/fhandler_random.cc b/winsup/cygwin/fhandler_random.cc
deleted file mode 100644
index 42481d6eb..000000000
--- a/winsup/cygwin/fhandler_random.cc
+++ /dev/null
@@ -1,165 +0,0 @@
-/* fhandler_random.cc: code to access /dev/random and /dev/urandom
-
- Copyright 2000, 2001, 2002 Red Hat, Inc.
-
- Written by Corinna Vinschen (vinschen@cygnus.com)
-
-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 "winsup.h"
-#include <errno.h>
-#include <limits.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-
-#define RANDOM 8
-#define URANDOM 9
-
-#define PSEUDO_MULTIPLIER (6364136223846793005LL)
-#define PSEUDO_SHIFTVAL (21)
-
-fhandler_dev_random::fhandler_dev_random (int nunit)
- : fhandler_base (FH_RANDOM), unit(nunit), crypt_prov((HCRYPTPROV) NULL)
-{
-}
-
-int
-fhandler_dev_random::open (path_conv *, int flags, mode_t)
-{
- set_flags (flags & ~O_TEXT, O_BINARY);
- set_open_status ();
- return 1;
-}
-
-BOOL
-fhandler_dev_random::crypt_gen_random (void *ptr, size_t len)
-{
- if (!crypt_prov
- && !CryptAcquireContext (&crypt_prov, NULL, MS_DEF_PROV, PROV_RSA_FULL,
- CRYPT_VERIFYCONTEXT | CRYPT_MACHINE_KEYSET)
- && !CryptAcquireContext (&crypt_prov, NULL, MS_DEF_PROV, PROV_RSA_FULL,
- CRYPT_VERIFYCONTEXT | CRYPT_MACHINE_KEYSET
- | CRYPT_NEWKEYSET))
- {
- debug_printf ("%E = CryptAquireContext()");
- return FALSE;
- }
- if (!CryptGenRandom (crypt_prov, len, (BYTE *)ptr))
- {
- debug_printf ("%E = CryptGenRandom()");
- return FALSE;
- }
- return TRUE;
-}
-
-int
-fhandler_dev_random::pseudo_write (const void *ptr, size_t len)
-{
- /* Use buffer to mess up the pseudo random number generator. */
- for (size_t i = 0; i < len; ++i)
- pseudo = (pseudo + ((unsigned char *)ptr)[i]) * PSEUDO_MULTIPLIER + 1;
- return len;
-}
-
-int
-fhandler_dev_random::write (const void *ptr, size_t len)
-{
- if (!len)
- return 0;
- if (!ptr)
- {
- set_errno (EINVAL);
- return -1;
- }
-
- /* Limit len to a value <= 512 since we don't want to overact.
- Copy to local buffer because CryptGenRandom violates const. */
- unsigned char buf[512];
- size_t limited_len = len <= 512 ? len : 512;
- memcpy (buf, ptr, limited_len);
-
- /* Mess up system entropy source. Return error if device is /dev/random. */
- if (!crypt_gen_random (buf, limited_len) && unit == RANDOM)
- {
- __seterrno ();
- return -1;
- }
- /* Mess up the pseudo random number generator. */
- pseudo_write (buf, limited_len);
- return len;
-}
-
-int
-fhandler_dev_random::pseudo_read (void *ptr, size_t len)
-{
- /* Use pseudo random number generator as fallback entropy source.
- This multiplier was obtained from Knuth, D.E., "The Art of
- Computer Programming," Vol 2, Seminumerical Algorithms, Third
- Edition, Addison-Wesley, 1998, p. 106 (line 26) & p. 108 */
- for (size_t i = 0; i < len; ++i)
- {
- pseudo = pseudo * PSEUDO_MULTIPLIER + 1;
- ((unsigned char *)ptr)[i] = (pseudo >> PSEUDO_SHIFTVAL) & UCHAR_MAX;
- }
- return len;
-}
-
-int __stdcall
-fhandler_dev_random::read (void *ptr, size_t len)
-{
- if (!len)
- return 0;
- if (!ptr)
- {
- set_errno (EINVAL);
- return -1;
- }
-
- if (crypt_gen_random (ptr, len))
- return len;
- /* If device is /dev/urandom, use pseudo number generator as fallback.
- Don't do this for /dev/random since it's intended for uses that need
- very high quality randomness. */
- if (unit == URANDOM)
- return pseudo_read (ptr, len);
-
- __seterrno ();
- return -1;
-}
-
-__off64_t
-fhandler_dev_random::lseek (__off64_t, int)
-{
- return 0;
-}
-
-int
-fhandler_dev_random::close (void)
-{
- if (crypt_prov)
- while (!CryptReleaseContext (crypt_prov, 0)
- && GetLastError () == ERROR_BUSY)
- Sleep(10);
- return 0;
-}
-
-int
-fhandler_dev_random::dup (fhandler_base *child)
-{
- fhandler_dev_random *fhr = (fhandler_dev_random *) child;
- fhr->unit = unit;
- fhr->crypt_prov = (HCRYPTPROV)NULL;
- return 0;
-}
-
-void
-fhandler_dev_random::dump ()
-{
- paranoid_printf("here, fhandler_dev_random");
-}
-
diff --git a/winsup/cygwin/fhandler_raw.cc b/winsup/cygwin/fhandler_raw.cc
deleted file mode 100644
index c692214ae..000000000
--- a/winsup/cygwin/fhandler_raw.cc
+++ /dev/null
@@ -1,563 +0,0 @@
-/* fhandler_raw.cc. See fhandler.h for a description of the fhandler classes.
-
- 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. */
-
-#include "winsup.h"
-#include <sys/termios.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include <cygwin/rdevio.h>
-#include <sys/mtio.h>
-#include <ntdef.h>
-#include "cygerrno.h"
-#include "perprocess.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygheap.h"
-#include "ntdll.h"
-
-/* static wrapper functions to hide the effect of media changes and
- bus resets which occurs after a new media is inserted. This is
- also related to the used tape device. */
-
-static BOOL write_file (HANDLE fh, const void *buf, DWORD to_write,
- DWORD *written, int *err)
-{
- BOOL ret;
-
- *err = 0;
- if (!(ret = WriteFile (fh, buf, to_write, written, 0)))
- {
- if ((*err = GetLastError ()) == ERROR_MEDIA_CHANGED
- || *err == ERROR_BUS_RESET)
- {
- *err = 0;
- if (!(ret = WriteFile (fh, buf, to_write, written, 0)))
- *err = GetLastError ();
- }
- }
- syscall_printf ("%d (err %d) = WriteFile (%d, %d, write %d, written %d, 0)",
- ret, *err, fh, buf, to_write, *written);
- return ret;
-}
-
-static BOOL read_file (HANDLE fh, void *buf, DWORD to_read,
- DWORD *read, int *err)
-{
- BOOL ret;
-
- *err = 0;
- if (!(ret = ReadFile(fh, buf, to_read, read, 0)))
- {
- if ((*err = GetLastError ()) == ERROR_MEDIA_CHANGED
- || *err == ERROR_BUS_RESET)
- {
- *err = 0;
- if (!(ret = ReadFile (fh, buf, to_read, read, 0)))
- *err = GetLastError ();
- }
- }
- syscall_printf ("%d (err %d) = ReadFile (%d, %d, to_read %d, read %d, 0)",
- ret, *err, fh, buf, to_read, *read);
- return ret;
-}
-
-/**********************************************************************/
-/* fhandler_dev_raw */
-
-void
-fhandler_dev_raw::clear (void)
-{
- devbuf = NULL;
- devbufsiz = 0;
- devbufstart = 0;
- devbufend = 0;
- eom_detected = 0;
- eof_detected = 0;
- lastblk_to_read = 0;
- varblkop = 0;
-}
-
-int
-fhandler_dev_raw::writebuf (void)
-{
- DWORD written;
- int ret = 0;
-
- if (is_writing && devbuf && devbufend)
- {
- DWORD to_write;
- int ret = 0;
-
- memset (devbuf + devbufend, 0, devbufsiz - devbufend);
- if (get_device () != FH_TAPE)
- to_write = ((devbufend - 1) / 512 + 1) * 512;
- else if (varblkop)
- to_write = devbufend;
- else
- to_write = devbufsiz;
- if (!write_file (get_handle (), devbuf, to_write, &written, &ret)
- && is_eom (ret))
- eom_detected = 1;
- if (written)
- has_written = 1;
- devbufstart = devbufend = 0;
- }
- is_writing = 0;
- return ret;
-}
-
-fhandler_dev_raw::fhandler_dev_raw (DWORD devtype, int nunit)
- : fhandler_base (devtype), unit (nunit)
-{
- clear ();
- set_need_fork_fixup ();
-}
-
-fhandler_dev_raw::~fhandler_dev_raw (void)
-{
- if (devbufsiz > 1L)
- delete [] devbuf;
- clear ();
-}
-
-int
-fhandler_dev_raw::open (path_conv *real_path, int flags, mode_t)
-{
- if (!wincap.has_raw_devices ())
- {
- set_errno (ENOENT);
- debug_printf("%s is accessible under NT/W2K only",real_path->get_win32());
- return 0;
- }
-
- /* Check for illegal flags. */
- if (flags & (O_APPEND | O_EXCL))
- {
- set_errno (EINVAL);
- return 0;
- }
-
- /* Always open a raw device existing and binary. */
- flags &= ~(O_CREAT | O_TRUNC);
- flags |= O_BINARY;
-
- DWORD access = GENERIC_READ | SYNCHRONIZE;
- if (get_device () == FH_TAPE
- || (flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_WRONLY
- || (flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDWR)
- access |= GENERIC_WRITE;
-
- extern void str2buf2uni (UNICODE_STRING &, WCHAR *, const char *);
- UNICODE_STRING dev;
- WCHAR devname[MAX_PATH + 1];
- str2buf2uni (dev, devname, real_path->get_win32 ());
- OBJECT_ATTRIBUTES attr;
- InitializeObjectAttributes (&attr, &dev, OBJ_CASE_INSENSITIVE, NULL, NULL);
-
- HANDLE h;
- IO_STATUS_BLOCK io;
- NTSTATUS status = NtOpenFile (&h, access, &attr, &io, wincap.shared (),
- FILE_SYNCHRONOUS_IO_NONALERT);
- if (!NT_SUCCESS (status))
- {
- __seterrno_from_win_error (RtlNtStatusToDosError (status));
- return 0;
- }
-
- set_io_handle (h);
- set_flags (flags & ~O_TEXT, O_BINARY);
-
- if (devbufsiz > 1L)
- devbuf = new char [devbufsiz];
-
- return 1;
-}
-
-int
-fhandler_dev_raw::close (void)
-{
- return fhandler_base::close ();
-}
-
-int
-fhandler_dev_raw::raw_read (void *ptr, size_t ulen)
-{
- DWORD bytes_read = 0;
- DWORD read2;
- DWORD bytes_to_read;
- int ret;
- size_t len = ulen;
- char *tgt;
-
- /* In mode O_RDWR the buffer has to be written to device first */
- ret = writebuf ();
- if (ret)
- {
- set_errno (is_eom (ret) ? ENOSPC : EACCES);
- return -1;
- }
-
- /* Checking a previous end of file */
- if (eof_detected && !lastblk_to_read)
- {
- eof_detected = 0;
- return 0;
- }
-
- /* Checking a previous end of media */
- if (eom_detected && !lastblk_to_read)
- {
- set_errno (ENOSPC);
- return -1;
- }
-
- if (devbuf)
- {
- while (len > 0)
- {
- if (devbufstart < devbufend)
- {
- bytes_to_read = min (len, devbufend - devbufstart);
- debug_printf ("read %d bytes from buffer (rest %d)",
- bytes_to_read, devbufstart - devbufend);
- memcpy (ptr, devbuf + devbufstart, bytes_to_read);
- len -= bytes_to_read;
- ptr = (void *) ((char *) ptr + bytes_to_read);
- bytes_read += bytes_to_read;
- devbufstart += bytes_to_read;
-
- if (lastblk_to_read)
- {
- lastblk_to_read = 0;
- break;
- }
- }
- if (len > 0)
- {
- if (!varblkop && len >= devbufsiz)
- {
- if (get_device () == FH_TAPE)
- bytes_to_read = (len / devbufsiz) * devbufsiz;
- else
- bytes_to_read = (len / 512) * 512;
- tgt = (char *) ptr;
- debug_printf ("read %d bytes direct from file",bytes_to_read);
- }
- else
- {
- bytes_to_read = devbufsiz;
- tgt = devbuf;
- if (varblkop)
- debug_printf ("read variable bytes from file into buffer");
- else
- debug_printf ("read %d bytes from file into buffer",
- bytes_to_read);
- }
- if (!read_file (get_handle (), tgt, bytes_to_read, &read2, &ret))
- {
- if (!is_eof (ret) && !is_eom (ret))
- {
- debug_printf ("return -1, set errno to EACCES");
- set_errno (EACCES);
- return -1;
- }
-
- if (is_eof (ret))
- eof_detected = 1;
- else
- eom_detected = 1;
-
- if (!read2)
- {
- if (!bytes_read && is_eom (ret))
- {
- debug_printf ("return -1, set errno to ENOSPC");
- set_errno (ENOSPC);
- return -1;
- }
- break;
- }
- lastblk_to_read = 1;
- }
- if (! read2)
- break;
- if (tgt == devbuf)
- {
- devbufstart = 0;
- devbufend = read2;
- }
- else
- {
- len -= bytes_to_read;
- ptr = (void *) ((char *) ptr + bytes_to_read);
- bytes_read += bytes_to_read;
- }
- }
- }
- }
- else if (!read_file (get_handle (), ptr, len, &bytes_read, &ret))
- {
- if (!is_eof (ret) && !is_eom (ret))
- {
- debug_printf ("return -1, set errno to EACCES");
- set_errno (EACCES);
- return -1;
- }
- if (bytes_read)
- {
- if (is_eof (ret))
- eof_detected = 1;
- else
- eom_detected = 1;
- }
- else if (is_eom (ret))
- {
- debug_printf ("return -1, set errno to ENOSPC");
- set_errno (ENOSPC);
- return -1;
- }
- }
-
- return bytes_read;
-}
-
-int
-fhandler_dev_raw::raw_write (const void *ptr, size_t len)
-{
- DWORD bytes_written = 0;
- DWORD bytes_to_write;
- DWORD written;
- char *p = (char *) ptr;
- char *tgt;
- int ret;
-
- /* Checking a previous end of media on tape */
- if (eom_detected)
- {
- set_errno (ENOSPC);
- return -1;
- }
-
- if (!is_writing)
- {
- devbufend = devbufstart;
- devbufstart = 0;
- }
- is_writing = 1;
-
- if (devbuf)
- {
- while (len > 0)
- {
- if (!varblkop &&
- (len < devbufsiz || devbufend > 0) && devbufend < devbufsiz)
- {
- bytes_to_write = min (len, devbufsiz - devbufend);
- memcpy (devbuf + devbufend, p, bytes_to_write);
- bytes_written += bytes_to_write;
- devbufend += bytes_to_write;
- p += bytes_to_write;
- len -= bytes_to_write;
- }
- else
- {
- if (varblkop)
- {
- bytes_to_write = len;
- tgt = p;
- }
- else if (devbufend == devbufsiz)
- {
- bytes_to_write = devbufsiz;
- tgt = devbuf;
- }
- else
- {
- bytes_to_write = (len / devbufsiz) * devbufsiz;
- tgt = p;
- }
-
- ret = 0;
- write_file (get_handle (), tgt, bytes_to_write, &written, &ret);
- if (written)
- has_written = 1;
-
- if (ret)
- {
- if (!is_eom (ret))
- {
- __seterrno ();
- return -1;
- }
-
- eom_detected = 1;
-
- if (!written && !bytes_written)
- {
- set_errno (ENOSPC);
- return -1;
- }
-
- if (tgt == p)
- bytes_written += written;
-
- break; // from while (len > 0)
- }
-
- if (tgt == devbuf)
- {
- if (written != devbufsiz)
- memmove (devbuf, devbuf + written, devbufsiz - written);
- devbufend = devbufsiz - written;
- }
- else
- {
- len -= written;
- p += written;
- bytes_written += written;
- }
- }
- }
- }
- else if (len > 0)
- {
- if (!write_file (get_handle (), ptr, len, &bytes_written, &ret))
- {
- if (bytes_written)
- has_written = 1;
- if (!is_eom (ret))
- {
- set_errno (EACCES);
- return -1;
- }
- eom_detected = 1;
- if (!bytes_written)
- {
- set_errno (ENOSPC);
- return -1;
- }
- }
- has_written = 1;
- }
- return bytes_written;
-}
-
-int
-fhandler_dev_raw::dup (fhandler_base *child)
-{
- int ret = fhandler_base::dup (child);
-
- if (! ret)
- {
- fhandler_dev_raw *fhc = (fhandler_dev_raw *) child;
-
- fhc->devbufsiz = devbufsiz;
- if (devbufsiz > 1L)
- fhc->devbuf = new char [devbufsiz];
- fhc->devbufstart = 0;
- fhc->devbufend = 0;
- fhc->eom_detected = eom_detected;
- fhc->eof_detected = eof_detected;
- fhc->lastblk_to_read = 0;
- fhc->varblkop = varblkop;
- fhc->unit = unit;
- }
- return ret;
-}
-
-void
-fhandler_dev_raw::fixup_after_fork (HANDLE)
-{
- devbufstart = 0;
- devbufend = 0;
- lastblk_to_read = 0;
-}
-
-void
-fhandler_dev_raw::fixup_after_exec (HANDLE)
-{
- if (devbufsiz > 1L)
- devbuf = new char [devbufsiz];
- devbufstart = 0;
- devbufend = 0;
- lastblk_to_read = 0;
-}
-
-int
-fhandler_dev_raw::ioctl (unsigned int cmd, void *buf)
-{
- int ret = NO_ERROR;
-
- if (cmd == RDIOCDOP)
- {
- struct rdop *op = (struct rdop *) buf;
-
- if (!op)
- ret = ERROR_INVALID_PARAMETER;
- else
- switch (op->rd_op)
- {
- case RDSETBLK:
- if (get_device () == FH_TAPE)
- {
- struct mtop mop;
-
- mop.mt_op = MTSETBLK;
- mop.mt_count = op->rd_parm;
- ret = ioctl (MTIOCTOP, &mop);
- }
- else if (op->rd_parm % 512)
- ret = ERROR_INVALID_PARAMETER;
- else if (devbuf && op->rd_parm < devbufend - devbufstart)
- ret = ERROR_INVALID_PARAMETER;
- else if (!devbuf || op->rd_parm != devbufsiz)
- {
- char *buf = new char [op->rd_parm];
- if (devbufsiz > 1L)
- {
- memcpy (buf, devbuf + devbufstart, devbufend - devbufstart);
- devbufend -= devbufstart;
- delete [] devbuf;
- }
- else
- devbufend = 0;
-
- devbufstart = 0;
- devbuf = buf;
- devbufsiz = op->rd_parm;
- }
- break;
- default:
- break;
- }
- }
- else if (cmd == RDIOCGET)
- {
- struct rdget *get = (struct rdget *) buf;
-
- if (!get)
- ret = ERROR_INVALID_PARAMETER;
- else
- get->bufsiz = devbufsiz ? devbufsiz : 1L;
- }
- else
- return fhandler_base::ioctl (cmd, buf);
-
- if (ret != NO_ERROR)
- {
- SetLastError (ret);
- __seterrno ();
- return -1;
- }
- return 0;
-}
diff --git a/winsup/cygwin/fhandler_registry.cc b/winsup/cygwin/fhandler_registry.cc
deleted file mode 100644
index 94220c62a..000000000
--- a/winsup/cygwin/fhandler_registry.cc
+++ /dev/null
@@ -1,544 +0,0 @@
-/* fhandler_registry.cc: fhandler for /proc/registry virtual filesystem
-
- Copyright 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. */
-
-/* FIXME: Access permissions are ignored at the moment. */
-
-#include "winsup.h"
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/cygwin.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygheap.h"
-#include <assert.h>
-
-#define _COMPILING_NEWLIB
-#include <dirent.h>
-
-static const int registry_len = sizeof ("registry") - 1;
-/* If this bit is set in __d_position then we are enumerating values,
- * else sub-keys. keeping track of where we are is horribly messy
- * the bottom 16 bits are the absolute position and the top 15 bits
- * make up the value index if we are enuerating values.
- */
-static const __off32_t REG_ENUM_VALUES_MASK = 0x8000000;
-static const __off32_t REG_POSITION_MASK = 0xffff;
-
-/* List of root keys in /proc/registry.
- * Possibly we should filter out those not relevant to the flavour of Windows
- * Cygwin is running on.
- */
-static const char *registry_listing[] =
-{
- ".",
- "..",
- "HKEY_CLASSES_ROOT",
- "HKEY_CURRENT_CONFIG",
- "HKEY_CURRENT_USER",
- "HKEY_LOCAL_MACHINE",
- "HKEY_USERS",
- "HKEY_DYN_DATA", // 95/98/Me
- "HKEY_PERFOMANCE_DATA", // NT/2000/XP
- NULL
-};
-
-static const HKEY registry_keys[] =
-{
- (HKEY) INVALID_HANDLE_VALUE,
- (HKEY) INVALID_HANDLE_VALUE,
- HKEY_CLASSES_ROOT,
- HKEY_CURRENT_CONFIG,
- HKEY_CURRENT_USER,
- HKEY_LOCAL_MACHINE,
- HKEY_USERS,
- HKEY_DYN_DATA,
- HKEY_PERFORMANCE_DATA
-};
-
-static const int ROOT_KEY_COUNT = sizeof(registry_keys) / sizeof(HKEY);
-
-/* These get added to each subdirectory in /proc/registry.
- * If we wanted to implement writing, we could maybe add a '.writable' entry or
- * suchlike.
- */
-static const char *special_dot_files[] =
-{
- ".",
- "..",
- NULL
-};
-
-static const int SPECIAL_DOT_FILE_COUNT = (sizeof(special_dot_files) / sizeof(const char *)) - 1;
-
-/* Name given to default values */
-static const char *DEFAULT_VALUE_NAME = "@";
-
-/* Returns 0 if path doesn't exist, >0 if path is a directory,
- * <0 if path is a file.
- *
- * We open the last key but one and then enum it's sub-keys and values to see if the
- * final component is there. This gets round the problem of not having security access
- * to the final key in the path.
- */
-int
-fhandler_registry::exists ()
-{
- int file_type = 0, index = 0, pathlen;
- DWORD buf_size = MAX_PATH;
- LONG error;
- char buf[buf_size];
- const char *file;
- HKEY hKey = (HKEY) INVALID_HANDLE_VALUE;
-
- const char *path = get_name ();
- debug_printf ("exists (%s)", path);
- path += proc_len + 1 + registry_len;
-
- while (SLASH_P (*path))
- path++;
- if (*path == 0)
- {
- file_type = 2;
- goto out;
- }
- pathlen = strlen (path);
- file = path + pathlen - 1;
- if (SLASH_P (*file) && pathlen > 1)
- file--;
- while (!SLASH_P (*file))
- file--;
- file++;
-
- if (file == path)
- {
- for (int i = 0; registry_listing[i]; i++)
- if (path_prefix_p
- (registry_listing[i], path, strlen (registry_listing[i])))
- {
- file_type = 1;
- goto out;
- }
- goto out;
- }
-
- hKey = open_key (path, KEY_READ, true);
- if (hKey == (HKEY) INVALID_HANDLE_VALUE)
- return 0;
-
- while (ERROR_SUCCESS ==
- (error = RegEnumKeyEx (hKey, index++, buf, &buf_size, NULL, NULL,
- NULL, NULL)) || (error == ERROR_MORE_DATA))
- {
- if (pathmatch (buf, file))
- {
- file_type = 1;
- goto out;
- }
- buf_size = MAX_PATH;
- }
- if (error != ERROR_NO_MORE_ITEMS)
- {
- seterrno_from_win_error (__FILE__, __LINE__, error);
- goto out;
- }
- index = 0;
- buf_size = MAX_PATH;
- while (ERROR_SUCCESS ==
- (error = RegEnumValue (hKey, index++, buf, &buf_size, NULL, NULL,
- NULL, NULL)) || (error == ERROR_MORE_DATA))
- {
- if (pathmatch (buf, file) || (buf[0] == '\0' &&
- pathmatch (file, DEFAULT_VALUE_NAME)))
- {
- file_type = -1;
- goto out;
- }
- buf_size = MAX_PATH;
- }
- if (error != ERROR_NO_MORE_ITEMS)
- {
- seterrno_from_win_error (__FILE__, __LINE__, error);
- goto out;
- }
-out:
- if (hKey != (HKEY) INVALID_HANDLE_VALUE)
- RegCloseKey (hKey);
- return file_type;
-}
-
-fhandler_registry::fhandler_registry ():
- fhandler_proc (FH_REGISTRY)
-{
-}
-
-int
-fhandler_registry::fstat (struct __stat64 *buf, path_conv *pc)
-{
- this->fhandler_base::fstat (buf, pc);
- buf->st_mode &= ~_IFMT & NO_W;
- int file_type = exists ();
- switch (file_type)
- {
- case 0:
- set_errno (ENOENT);
- return -1;
- case 1:
- buf->st_mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH;
- break;
- case 2:
- buf->st_mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH;
- buf->st_nlink = ROOT_KEY_COUNT;
- break;
- default:
- case -1:
- buf->st_mode |= S_IFREG;
- buf->st_mode &= NO_X;
- break;
- }
- return 0;
-}
-
-struct dirent *
-fhandler_registry::readdir (DIR * dir)
-{
- DWORD buf_size = MAX_PATH;
- char buf[buf_size];
- HANDLE handle;
- struct dirent *res = NULL;
- const char *path = dir->__d_dirname + proc_len + 1 + registry_len;
- LONG error;
-
- if (*path == 0)
- {
- if (dir->__d_position >= ROOT_KEY_COUNT)
- goto out;
- strcpy (dir->__d_dirent->d_name, registry_listing[dir->__d_position++]);
- res = dir->__d_dirent;
- goto out;
- }
- if (dir->__d_u.__d_data.__handle == INVALID_HANDLE_VALUE
- && dir->__d_position == 0)
- {
- handle = open_key (path + 1);
- dir->__d_u.__d_data.__handle = handle;;
- }
- if (dir->__d_u.__d_data.__handle == INVALID_HANDLE_VALUE)
- goto out;
- if (dir->__d_position < SPECIAL_DOT_FILE_COUNT)
- {
- strcpy (dir->__d_dirent->d_name, special_dot_files[dir->__d_position++]);
- res = dir->__d_dirent;
- goto out;
- }
-retry:
- if (dir->__d_position & REG_ENUM_VALUES_MASK)
- /* For the moment, the type of key is ignored here. when write access is added,
- * maybe add an extension for the type of each value?
- */
- error = RegEnumValue ((HKEY) dir->__d_u.__d_data.__handle,
- (dir->__d_position & ~REG_ENUM_VALUES_MASK) >> 16,
- buf, &buf_size, NULL, NULL, NULL, NULL);
- else
- error =
- RegEnumKeyEx ((HKEY) dir->__d_u.__d_data.__handle, dir->__d_position -
- SPECIAL_DOT_FILE_COUNT, buf, &buf_size, NULL, NULL, NULL, NULL);
- if (error == ERROR_NO_MORE_ITEMS
- && (dir->__d_position & REG_ENUM_VALUES_MASK) == 0)
- {
- /* If we're finished with sub-keys, start on values under this key. */
- dir->__d_position |= REG_ENUM_VALUES_MASK;
- buf_size = MAX_PATH;
- goto retry;
- }
- if (error != ERROR_SUCCESS && error != ERROR_MORE_DATA)
- {
- RegCloseKey ((HKEY) dir->__d_u.__d_data.__handle);
- dir->__d_u.__d_data.__handle = INVALID_HANDLE_VALUE;
- seterrno_from_win_error (__FILE__, __LINE__, error);
- goto out;
- }
-
- /* We get here if `buf' contains valid data. */
- if (*buf == 0)
- strcpy (dir->__d_dirent->d_name, DEFAULT_VALUE_NAME);
- else
- strcpy (dir->__d_dirent->d_name, buf);
-
- dir->__d_position++;
- if (dir->__d_position & REG_ENUM_VALUES_MASK)
- dir->__d_position += 0x10000;
- res = dir->__d_dirent;
-out:
- syscall_printf ("%p = readdir (%p) (%s)", &dir->__d_dirent, dir, buf);
- return res;
-}
-
-__off64_t
-fhandler_registry::telldir (DIR * dir)
-{
- return dir->__d_position & REG_POSITION_MASK;
-}
-
-void
-fhandler_registry::seekdir (DIR * dir, __off64_t loc)
-{
- /* Unfortunately cannot simply set __d_position due to transition from sub-keys to
- * values.
- */
- rewinddir (dir);
- while (loc > (dir->__d_position & REG_POSITION_MASK))
- if (!readdir (dir))
- break;
-}
-
-void
-fhandler_registry::rewinddir (DIR * dir)
-{
- if (dir->__d_u.__d_data.__handle != INVALID_HANDLE_VALUE)
- {
- (void) RegCloseKey ((HKEY) dir->__d_u.__d_data.__handle);
- dir->__d_u.__d_data.__handle = INVALID_HANDLE_VALUE;
- }
- dir->__d_position = 0;
- return;
-}
-
-int
-fhandler_registry::closedir (DIR * dir)
-{
- int res = 0;
- if (dir->__d_u.__d_data.__handle != INVALID_HANDLE_VALUE &&
- RegCloseKey ((HKEY) dir->__d_u.__d_data.__handle) != ERROR_SUCCESS)
- {
- __seterrno ();
- res = -1;
- }
- syscall_printf ("%d = closedir (%p)", res, dir);
- return 0;
-}
-
-int
-fhandler_registry::open (path_conv *pc, int flags, mode_t mode)
-{
- DWORD type, size;
- LONG error;
- HKEY hKey = (HKEY) INVALID_HANDLE_VALUE;
- int pathlen;
- const char *file;
-
- int res = fhandler_virtual::open (pc, flags, mode);
- if (!res)
- goto out;
-
- const char *path;
- path = get_name () + proc_len + 1 + registry_len;
- if (!*path)
- {
- if ((flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
- {
- set_errno (EEXIST);
- res = 0;
- goto out;
- }
- else if (flags & O_WRONLY)
- {
- set_errno (EISDIR);
- res = 0;
- goto out;
- }
- else
- {
- flags |= O_DIROPEN;
- goto success;
- }
- }
- path++;
- pathlen = strlen (path);
- file = path + pathlen - 1;
- if (SLASH_P (*file) && pathlen > 1)
- file--;
- while (!SLASH_P (*file))
- file--;
- file++;
-
- if (file == path)
- {
- for (int i = 0; registry_listing[i]; i++)
- if (path_prefix_p
- (registry_listing[i], path, strlen (registry_listing[i])))
- {
- if ((flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
- {
- set_errno (EEXIST);
- res = 0;
- goto out;
- }
- else if (flags & O_WRONLY)
- {
- set_errno (EISDIR);
- res = 0;
- goto out;
- }
- else
- {
- flags |= O_DIROPEN;
- goto success;
- }
- }
-
- if (flags & O_CREAT)
- {
- set_errno (EROFS);
- res = 0;
- goto out;
- }
- else
- {
- set_errno (ENOENT);
- res = 0;
- goto out;
- }
- }
-
- if (flags & O_WRONLY)
- {
- set_errno (EROFS);
- res = 0;
- goto out;
- }
-
- hKey = open_key (path, KEY_READ, true);
- if (hKey == (HKEY) INVALID_HANDLE_VALUE)
- {
- res = 0;
- goto out;
- }
- if (pathmatch (file, DEFAULT_VALUE_NAME))
- file = "";
-
- if (hKey != HKEY_PERFORMANCE_DATA)
- {
- error = RegQueryValueEx (hKey, file, NULL, &type, NULL, &size);
- if (error != ERROR_SUCCESS)
- {
- seterrno_from_win_error (__FILE__, __LINE__, error);
- res = -1;
- goto out;
- }
- bufalloc = size;
- filebuf = (char *) cmalloc (HEAP_BUF, bufalloc);
- error =
- RegQueryValueEx (hKey, file, NULL, NULL, (BYTE *) filebuf, &size);
- if (error != ERROR_SUCCESS)
- {
- seterrno_from_win_error (__FILE__, __LINE__, error);
- res = 0;
- goto out;
- }
- filesize = size;
- }
- else
- {
- bufalloc = 0;
- do
- {
- bufalloc += 1000;
- if (filebuf)
- {
- cfree (filebuf);
- filebuf = (char *) cmalloc (HEAP_BUF, bufalloc);
- }
- error =
- RegQueryValueEx (hKey, file, NULL, &type, (BYTE *) filebuf,
- &size);
- if (error != ERROR_SUCCESS && res != ERROR_MORE_DATA)
- {
- seterrno_from_win_error (__FILE__, __LINE__, error);
- res = 0;
- goto out;
- }
- }
- while (error == ERROR_MORE_DATA);
- filesize = size;
- }
-
- if (flags & O_APPEND)
- position = filesize;
- else
- position = 0;
-
-success:
- res = 1;
- set_flags (flags & ~O_TEXT, O_BINARY);
- set_open_status ();
-out:
- if (hKey != (HKEY) INVALID_HANDLE_VALUE)
- RegCloseKey (hKey);
- syscall_printf ("%d = fhandler_registry::open (%p, %d)", res, flags, mode);
- return res;
-}
-
-void
-fhandler_registry::fill_filebuf ()
-{
-}
-
-/* Auxillary member function to open registry keys. */
-HKEY
-fhandler_registry::open_key (const char *name, REGSAM access, bool isValue)
-{
- HKEY hKey = (HKEY) INVALID_HANDLE_VALUE;
- HKEY hParentKey = (HKEY) INVALID_HANDLE_VALUE;
- bool parentOpened = false;
- char component[MAX_PATH];
-
- while (*name)
- {
- const char *anchor = name;
- while (*name && !SLASH_P (*name))
- name++;
- strncpy (component, anchor, name - anchor);
- component[name - anchor] = '\0';
- if (*name)
- name++;
- if (*name == 0 && isValue == true)
- goto out;
-
- if (hParentKey != (HKEY) INVALID_HANDLE_VALUE)
- {
- hKey = (HKEY) INVALID_HANDLE_VALUE;
- LONG error = RegOpenKeyEx (hParentKey, component, 0, access, &hKey);
- if (hKey == (HKEY) INVALID_HANDLE_VALUE)
- {
- seterrno_from_win_error (__FILE__, __LINE__, error);
- return hKey;
- }
- if (parentOpened)
- RegCloseKey (hParentKey);
- hParentKey = hKey;
- parentOpened = true;
- }
- else
- {
- for (int i = 0; registry_listing[i]; i++)
- if (pathmatch (component, registry_listing[i]))
- hKey = registry_keys[i];
- if (hKey == (HKEY) INVALID_HANDLE_VALUE)
- return hKey;
- hParentKey = hKey;
- }
- }
-out:
- return hKey;
-}
diff --git a/winsup/cygwin/fhandler_serial.cc b/winsup/cygwin/fhandler_serial.cc
deleted file mode 100644
index e63de26d3..000000000
--- a/winsup/cygwin/fhandler_serial.cc
+++ /dev/null
@@ -1,883 +0,0 @@
-/* fhandler_serial.cc
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-#include "sigproc.h"
-#include "pinfo.h"
-#include <sys/termios.h>
-
-/**********************************************************************/
-/* fhandler_serial */
-
-fhandler_serial::fhandler_serial (int unit)
- : fhandler_base (FH_SERIAL, unit), vmin_ (0), vtime_ (0), pgrp_ (myself->pgid)
-{
- set_need_fork_fixup ();
-}
-
-void
-fhandler_serial::overlapped_setup ()
-{
- memset (&io_status, 0, sizeof (io_status));
- io_status.hEvent = CreateEvent (&sec_none_nih, TRUE, FALSE, NULL);
- ProtectHandle (io_status.hEvent);
- overlapped_armed = 0;
-}
-
-int
-fhandler_serial::raw_read (void *ptr, size_t ulen)
-{
- int tot;
- DWORD n;
- HANDLE w4[2];
- DWORD minchars = vmin_ ?: ulen;
-
- w4[0] = io_status.hEvent;
- w4[1] = signal_arrived;
-
- debug_printf ("ulen %d, vmin_ %d, vtime_ %d, hEvent %p", ulen, vmin_, vtime_,
- io_status.hEvent);
- if (!overlapped_armed)
- {
- (void) SetCommMask (get_handle (), EV_RXCHAR);
- ResetEvent (io_status.hEvent);
- }
-
- for (n = 0, tot = 0; ulen; ulen -= n, ptr = (char *)ptr + n)
- {
- COMSTAT st;
- DWORD inq = 1;
-
- n = 0;
-
- if (!vtime_ && !vmin_)
- inq = ulen;
- else if (vtime_)
- {
- inq = ulen; // non-interruptible -- have to use kernel timeouts
- // also note that this is not strictly correct.
- // if vmin > ulen then things won't work right.
- overlapped_armed = -1;
- }
-
- if (!ClearCommError (get_handle (), &ev, &st))
- goto err;
- else if (ev)
- termios_printf ("error detected %x", ev);
- else if (st.cbInQue)
- inq = st.cbInQue;
- else if (!overlapped_armed)
- {
- if ((size_t)tot >= minchars)
- break;
- else if (WaitCommEvent (get_handle (), &ev, &io_status))
- {
- debug_printf ("WaitCommEvent succeeded: ev %x", ev);
- if (!ev)
- continue;
- }
- else if (GetLastError () != ERROR_IO_PENDING)
- goto err;
- else
- {
- overlapped_armed = 1;
- switch (WaitForMultipleObjects (2, w4, FALSE, INFINITE))
- {
- case WAIT_OBJECT_0:
- if (!GetOverlappedResult (get_handle (), &io_status, &n, FALSE))
- goto err;
- debug_printf ("n %d, ev %x", n, ev);
- break;
- case WAIT_OBJECT_0 + 1:
- tot = -1;
- PurgeComm (get_handle (), PURGE_RXABORT);
- overlapped_armed = 0;
- set_sig_errno (EINTR);
- goto out;
- default:
- goto err;
- }
- }
- }
-
- overlapped_armed = 0;
- ResetEvent (io_status.hEvent);
- if (inq > ulen)
- inq = ulen;
- debug_printf ("inq %d", inq);
- if (ReadFile (get_handle(), ptr, min (inq, ulen), &n, &io_status))
- /* Got something */;
- else if (GetLastError () != ERROR_IO_PENDING)
- goto err;
- else if (!GetOverlappedResult (get_handle (), &io_status, &n, TRUE))
- goto err;
-
- tot += n;
- debug_printf ("vtime_ %d, vmin_ %d, n %d, tot %d", vtime_, vmin_, n, tot);
- if (vtime_ || !vmin_ || !n)
- break;
- continue;
-
- err:
- PurgeComm (get_handle (), PURGE_RXABORT);
- debug_printf ("err %E");
- if (GetLastError () == ERROR_OPERATION_ABORTED)
- n = 0;
- else
- {
- tot = -1;
- __seterrno ();
- break;
- }
- }
-
-out:
- return tot;
-}
-
-/* Cover function to WriteFile to provide Posix interface and semantics
- (as much as possible). */
-int
-fhandler_serial::raw_write (const void *ptr, size_t len)
-{
- DWORD bytes_written;
- OVERLAPPED write_status;
-
- memset (&write_status, 0, sizeof (write_status));
- write_status.hEvent = CreateEvent (&sec_none_nih, TRUE, FALSE, NULL);
- ProtectHandle (write_status.hEvent);
-
- for (;;)
- {
- if (WriteFile (get_handle(), ptr, len, &bytes_written, &write_status))
- break;
-
- switch (GetLastError ())
- {
- case ERROR_OPERATION_ABORTED:
- continue;
- case ERROR_IO_PENDING:
- break;
- default:
- goto err;
- }
-
- if (!GetOverlappedResult (get_handle (), &write_status, &bytes_written, TRUE))
- goto err;
-
- break;
- }
-
- ForceCloseHandle(write_status.hEvent);
-
- return bytes_written;
-
-err:
- __seterrno ();
- ForceCloseHandle(write_status.hEvent);
- return -1;
-}
-
-void
-fhandler_serial::dump (void)
-{
- paranoid_printf ("here");
-}
-
-void
-fhandler_serial::init (HANDLE f, DWORD flags, mode_t bin)
-{
- (void) open (NULL, flags, bin & (O_BINARY | O_TEXT));
-}
-
-int
-fhandler_serial::open (path_conv *, int flags, mode_t mode)
-{
- int res;
- COMMTIMEOUTS to;
- extern BOOL reset_com;
-
- syscall_printf ("fhandler_serial::open (%s, %p, %p)",
- get_name (), flags, mode);
-
- if (!(res = this->fhandler_base::open (NULL, flags, mode)))
- return 0;
-
- res = 1;
-
- (void) SetCommMask (get_handle (), EV_RXCHAR);
-
- set_r_no_interrupt (1); // Handled explicitly in read code
-
- overlapped_setup ();
-
- memset (&to, 0, sizeof (to));
- (void) SetCommTimeouts (get_handle (), &to);
-
- /* Reset serial port to known state of 9600-8-1-no flow control
- on open for better behavior under Win 95.
-
- FIXME: This should only be done when explicitly opening the com
- port. It should not be reset if an fd is inherited.
- Using __progname in this way, to determine how far along in the
- initialization we are, is really a terrible kludge and should
- be fixed ASAP.
- */
- extern char *__progname;
- if (reset_com && __progname)
- {
- DCB state;
- GetCommState (get_handle (), &state);
- syscall_printf ("setting initial state on %s (reset_com %d)",
- get_name (), reset_com);
- state.BaudRate = CBR_9600;
- state.ByteSize = 8;
- state.StopBits = ONESTOPBIT;
- state.Parity = NOPARITY; /* FIXME: correct default? */
- state.fBinary = TRUE; /* binary xfer */
- state.EofChar = 0; /* no end-of-data in binary mode */
- state.fNull = FALSE; /* don't discard nulls in binary mode */
- state.fParity = FALSE; /* ignore parity errors */
- state.fErrorChar = FALSE;
- state.fTXContinueOnXoff = TRUE; /* separate TX and RX flow control */
- state.fOutX = FALSE; /* disable transmission flow control */
- state.fInX = FALSE; /* disable reception flow control */
- state.XonChar = 0x11;
- state.XoffChar = 0x13;
- state.fOutxDsrFlow = FALSE; /* disable DSR flow control */
- state.fRtsControl = RTS_CONTROL_ENABLE; /* ignore lead control except
- DTR */
- state.fOutxCtsFlow = FALSE; /* disable output flow control */
- state.fDtrControl = DTR_CONTROL_ENABLE; /* assert DTR */
- state.fDsrSensitivity = FALSE; /* don't assert DSR */
- state.fAbortOnError = TRUE;
- if (!SetCommState (get_handle (), &state))
- system_printf ("couldn't set initial state for %s, %E", get_name ());
- }
-
- SetCommMask (get_handle (), EV_RXCHAR);
- set_open_status ();
- syscall_printf ("%p = fhandler_serial::open (%s, %p, %p)",
- res, get_name (), flags, mode);
- return res;
-}
-
-int
-fhandler_serial::close ()
-{
- (void) ForceCloseHandle (io_status.hEvent);
- return fhandler_base::close ();
-}
-
-/* tcsendbreak: POSIX 7.2.2.1 */
-/* Break for 250-500 milliseconds if duration == 0 */
-/* Otherwise, units for duration are undefined */
-int
-fhandler_serial::tcsendbreak (int duration)
-{
- unsigned int sleeptime = 300000;
-
- if (duration > 0)
- sleeptime *= duration;
-
- if (SetCommBreak (get_handle ()) == 0)
- return -1;
-
- /* FIXME: need to send zero bits during duration */
- usleep (sleeptime);
-
- if (ClearCommBreak (get_handle ()) == 0)
- return -1;
-
- syscall_printf ("0 = fhandler_serial:tcsendbreak (%d)", duration);
-
- return 0;
-}
-
-/* tcdrain: POSIX 7.2.2.1 */
-int
-fhandler_serial::tcdrain (void)
-{
- if (FlushFileBuffers (get_handle ()) == 0)
- return -1;
-
- return 0;
-}
-
-/* tcflow: POSIX 7.2.2.1 */
-int
-fhandler_serial::tcflow (int action)
-{
- DWORD win32action = 0;
- DCB dcb;
- char xchar;
-
- termios_printf ("action %d", action);
-
- switch (action)
- {
- case TCOOFF:
- win32action = SETXOFF;
- break;
- case TCOON:
- win32action = SETXON;
- break;
- case TCION:
- case TCIOFF:
- if (GetCommState (get_handle (), &dcb) == 0)
- return -1;
- if (action == TCION)
- xchar = (dcb.XonChar ? dcb.XonChar : 0x11);
- else
- xchar = (dcb.XoffChar ? dcb.XoffChar : 0x13);
- if (TransmitCommChar (get_handle (), xchar) == 0)
- return -1;
- return 0;
- break;
- default:
- return -1;
- break;
- }
-
- if (EscapeCommFunction (get_handle (), win32action) == 0)
- return -1;
-
- return 0;
-}
-
-/* tcflush: POSIX 7.2.2.1 */
-int
-fhandler_serial::tcflush (int queue)
-{
- if (queue == TCOFLUSH || queue == TCIOFLUSH)
- PurgeComm (get_handle (), PURGE_TXABORT | PURGE_TXCLEAR);
-
- if (queue == TCIFLUSH | queue == TCIOFLUSH)
- /* Input flushing by polling until nothing turns up
- (we stop after 1000 chars anyway) */
- for (int max = 1000; max > 0; max--)
- {
- COMSTAT st;
- if (!PurgeComm (get_handle (), PURGE_RXABORT | PURGE_RXCLEAR))
- break;
- Sleep (100);
- if (!ClearCommError (get_handle (), &ev, &st) || !st.cbInQue)
- break;
- }
-
- return 0;
-}
-
-/* tcsetattr: POSIX 7.2.1.1 */
-int
-fhandler_serial::tcsetattr (int action, const struct termios *t)
-{
- /* Possible actions:
- TCSANOW: immediately change attributes.
- TCSADRAIN: flush output, then change attributes.
- TCSAFLUSH: flush output and discard input, then change attributes.
- */
-
- BOOL dropDTR = FALSE;
- COMMTIMEOUTS to;
- DCB ostate, state;
- unsigned int ovtime = vtime_, ovmin = vmin_;
-
- termios_printf ("action %d", action);
- if ((action == TCSADRAIN) || (action == TCSAFLUSH))
- {
- FlushFileBuffers (get_handle ());
- termios_printf ("flushed file buffers");
- }
- if (action == TCSAFLUSH)
- PurgeComm (get_handle (), (PURGE_RXABORT | PURGE_RXCLEAR));
-
- /* get default/last comm state */
- if (!GetCommState (get_handle (), &ostate))
- return -1;
-
- state = ostate;
-
- /* -------------- Set baud rate ------------------ */
- /* FIXME: WIN32 also has 14400, 56000, 128000, and 256000.
- Unix also has 230400. */
-
- switch (t->c_ospeed)
- {
- case B0: /* drop DTR */
- dropDTR = TRUE;
- state.BaudRate = 0;
- break;
- case B110:
- state.BaudRate = CBR_110;
- break;
- case B300:
- state.BaudRate = CBR_300;
- break;
- case B600:
- state.BaudRate = CBR_600;
- break;
- case B1200:
- state.BaudRate = CBR_1200;
- break;
- case B2400:
- state.BaudRate = CBR_2400;
- break;
- case B4800:
- state.BaudRate = CBR_4800;
- break;
- case B9600:
- state.BaudRate = CBR_9600;
- break;
- case B19200:
- state.BaudRate = CBR_19200;
- break;
- case B38400:
- state.BaudRate = CBR_38400;
- break;
- case B57600:
- state.BaudRate = CBR_57600;
- break;
- case B115200:
- state.BaudRate = CBR_115200;
- break;
- default:
- /* Unsupported baud rate! */
- termios_printf ("Invalid t->c_ospeed %d", t->c_ospeed);
- set_errno (EINVAL);
- return -1;
- }
-
- /* -------------- Set byte size ------------------ */
-
- switch (t->c_cflag & CSIZE)
- {
- case CS5:
- state.ByteSize = 5;
- break;
- case CS6:
- state.ByteSize = 6;
- break;
- case CS7:
- state.ByteSize = 7;
- break;
- case CS8:
- state.ByteSize = 8;
- break;
- default:
- /* Unsupported byte size! */
- termios_printf ("Invalid t->c_cflag byte size %d",
- t->c_cflag & CSIZE);
- set_errno (EINVAL);
- return -1;
- }
-
- /* -------------- Set stop bits ------------------ */
-
- if (t->c_cflag & CSTOPB)
- state.StopBits = TWOSTOPBITS;
- else
- state.StopBits = ONESTOPBIT;
-
- /* -------------- Set parity ------------------ */
-
- if (t->c_cflag & PARENB)
- state.Parity = (t->c_cflag & PARODD) ? ODDPARITY : EVENPARITY;
- else
- state.Parity = NOPARITY;
-
- state.fBinary = TRUE; /* Binary transfer */
- state.EofChar = 0; /* No end-of-data in binary mode */
- state.fNull = FALSE; /* Don't discard nulls in binary mode */
-
- /* -------------- Parity errors ------------------ */
- /* fParity combines the function of INPCK and NOT IGNPAR */
-
- if ((t->c_iflag & INPCK) && !(t->c_iflag & IGNPAR))
- state.fParity = TRUE; /* detect parity errors */
- else
- state.fParity = FALSE; /* ignore parity errors */
-
- /* Only present in Win32, Unix has no equivalent */
- state.fErrorChar = FALSE;
- state.ErrorChar = 0;
-
- /* -------------- Set software flow control ------------------ */
- /* Set fTXContinueOnXoff to FALSE. This prevents the triggering of a
- premature XON when the remote device interprets a received character
- as XON (same as IXANY on the remote side). Otherwise, a TRUE
- value separates the TX and RX functions. */
-
- state.fTXContinueOnXoff = TRUE; /* separate TX and RX flow control */
-
- /* Transmission flow control */
- if (t->c_iflag & IXON)
- state.fOutX = TRUE; /* enable */
- else
- state.fOutX = FALSE; /* disable */
-
- /* Reception flow control */
- if (t->c_iflag & IXOFF)
- state.fInX = TRUE; /* enable */
- else
- state.fInX = FALSE; /* disable */
-
- /* XoffLim and XonLim are left at default values */
-
- state.XonChar = (t->c_cc[VSTART] ? t->c_cc[VSTART] : 0x11);
- state.XoffChar = (t->c_cc[VSTOP] ? t->c_cc[VSTOP] : 0x13);
-
- /* -------------- Set hardware flow control ------------------ */
-
- /* Disable DSR flow control */
- state.fOutxDsrFlow = FALSE;
-
- /* Some old flavors of Unix automatically enabled hardware flow
- control when software flow control was not enabled. Since newer
- Unices tend to require explicit setting of hardware flow-control,
- this is what we do. */
-
- /* RTS/CTS flow control */
- if (t->c_cflag & CRTSCTS)
- { /* enable */
- state.fOutxCtsFlow = TRUE;
- state.fRtsControl = RTS_CONTROL_HANDSHAKE;
- }
- else
- { /* disable */
- state.fRtsControl = RTS_CONTROL_ENABLE;
- state.fOutxCtsFlow = FALSE;
- }
-
- if (t->c_cflag & CRTSXOFF)
- state.fRtsControl = RTS_CONTROL_HANDSHAKE;
-
- /* -------------- DTR ------------------ */
- /* Assert DTR on device open */
-
- state.fDtrControl = DTR_CONTROL_ENABLE;
-
- /* -------------- DSR ------------------ */
- /* Assert DSR at the device? */
-
- if (t->c_cflag & CLOCAL)
- state.fDsrSensitivity = FALSE; /* no */
- else
- state.fDsrSensitivity = TRUE; /* yes */
-
- /* -------------- Error handling ------------------ */
- /* Since read/write operations terminate upon error, we
- will use ClearCommError() to resume. */
-
- state.fAbortOnError = TRUE;
-
- /* -------------- Set state and exit ------------------ */
- if (memcmp (&ostate, &state, sizeof (state)) != 0)
- SetCommState (get_handle (), &state);
-
- set_r_binary ((t->c_iflag & IGNCR) ? 0 : 1);
- set_w_binary ((t->c_oflag & ONLCR) ? 0 : 1);
-
- if (dropDTR == TRUE)
- EscapeCommFunction (get_handle (), CLRDTR);
- else
- {
- /* FIXME: Sometimes when CLRDTR is set, setting
- state.fDtrControl = DTR_CONTROL_ENABLE will fail. This
- is a problem since a program might want to change some
- parameters while DTR is still down. */
-
- EscapeCommFunction (get_handle (), SETDTR);
- }
-
- /*
- The following documentation on was taken from "Linux Serial Programming
- HOWTO". It explains how MIN (t->c_cc[VMIN] || vmin_) and TIME
- (t->c_cc[VTIME] || vtime_) is to be used.
-
- In non-canonical input processing mode, input is not assembled into
- lines and input processing (erase, kill, delete, etc.) does not
- occur. Two parameters control the behavior of this mode: c_cc[VTIME]
- sets the character timer, and c_cc[VMIN] sets the minimum number of
- characters to receive before satisfying the read.
-
- If MIN > 0 and TIME = 0, MIN sets the number of characters to receive
- before the read is satisfied. As TIME is zero, the timer is not used.
-
- If MIN = 0 and TIME > 0, TIME serves as a timeout value. The read will
- be satisfied if a single character is read, or TIME is exceeded (t =
- TIME *0.1 s). If TIME is exceeded, no character will be returned.
-
- If MIN > 0 and TIME > 0, TIME serves as an inter-character timer. The
- read will be satisfied if MIN characters are received, or the time
- between two characters exceeds TIME. The timer is restarted every time
- a character is received and only becomes active after the first
- character has been received.
-
- If MIN = 0 and TIME = 0, read will be satisfied immediately. The
- number of characters currently available, or the number of characters
- requested will be returned. According to Antonino (see contributions),
- you could issue a fcntl(fd, F_SETFL, FNDELAY); before reading to get
- the same result.
- */
-
- if (t->c_lflag & ICANON)
- {
- vmin_ = MAXDWORD;
- vtime_ = 0;
- }
- else
- {
- vtime_ = t->c_cc[VTIME] * 100;
- vmin_ = t->c_cc[VMIN];
- }
-
- debug_printf ("vtime %d, vmin %d\n", vtime_, vmin_);
-
- if (ovmin == vmin_ && ovtime == vtime_)
- return 0;
-
- memset (&to, 0, sizeof (to));
-
- if ((vmin_ > 0) && (vtime_ == 0))
- {
- /* Returns immediately with whatever is in buffer on a ReadFile();
- or blocks if nothing found. We will keep calling ReadFile(); until
- vmin_ characters are read */
- to.ReadIntervalTimeout = to.ReadTotalTimeoutMultiplier = MAXDWORD;
- to.ReadTotalTimeoutConstant = MAXDWORD - 1;
- }
- else if ((vmin_ == 0) && (vtime_ > 0))
- {
- /* set timeoout constant appropriately and we will only try to
- read one character in ReadFile() */
- to.ReadTotalTimeoutConstant = vtime_;
- to.ReadIntervalTimeout = to.ReadTotalTimeoutMultiplier = MAXDWORD;
- }
- else if ((vmin_ > 0) && (vtime_ > 0))
- {
- /* time applies to the interval time for this case */
- to.ReadIntervalTimeout = vtime_;
- }
- else if ((vmin_ == 0) && (vtime_ == 0))
- {
- /* returns immediately with whatever is in buffer as per
- Time-Outs docs in Win32 SDK API docs */
- to.ReadIntervalTimeout = MAXDWORD;
- }
-
- debug_printf ("ReadTotalTimeoutConstant %d, ReadIntervalTimeout %d, ReadTotalTimeoutMultiplier %d",
- to.ReadTotalTimeoutConstant, to.ReadIntervalTimeout, to.ReadTotalTimeoutMultiplier);
- int res = SetCommTimeouts (get_handle (), &to);
- if (!res)
- {
- system_printf ("SetCommTimeout failed, %E");
- __seterrno ();
- return -1;
- }
-
- return 0;
-}
-
-/* tcgetattr: POSIX 7.2.1.1 */
-int
-fhandler_serial::tcgetattr (struct termios *t)
-{
- DCB state;
-
- /* Get current Win32 comm state */
- if (GetCommState (get_handle (), &state) == 0)
- return -1;
-
- /* for safety */
- memset (t, 0, sizeof (*t));
-
- /* -------------- Baud rate ------------------ */
-
- switch (state.BaudRate)
- {
- case 0:
- /* FIXME: need to drop DTR */
- t->c_cflag = t->c_ospeed = t->c_ispeed = B0;
- break;
- case CBR_110:
- t->c_cflag = t->c_ospeed = t->c_ispeed = B110;
- break;
- case CBR_300:
- t->c_cflag = t->c_ospeed = t->c_ispeed = B300;
- break;
- case CBR_600:
- t->c_cflag = t->c_ospeed = t->c_ispeed = B600;
- break;
- case CBR_1200:
- t->c_cflag = t->c_ospeed = t->c_ispeed = B1200;
- break;
- case CBR_2400:
- t->c_cflag = t->c_ospeed = t->c_ispeed = B2400;
- break;
- case CBR_4800:
- t->c_cflag = t->c_ospeed = t->c_ispeed = B4800;
- break;
- case CBR_9600:
- t->c_cflag = t->c_ospeed = t->c_ispeed = B9600;
- break;
- case CBR_19200:
- t->c_cflag = t->c_ospeed = t->c_ispeed = B19200;
- break;
- case CBR_38400:
- t->c_cflag = t->c_ospeed = t->c_ispeed = B38400;
- break;
- case CBR_57600:
- t->c_cflag = t->c_ospeed = t->c_ispeed = B57600;
- break;
- case CBR_115200:
- t->c_cflag = t->c_ospeed = t->c_ispeed = B115200;
- break;
- default:
- /* Unsupported baud rate! */
- termios_printf ("Invalid baud rate %d", state.BaudRate);
- set_errno (EINVAL);
- return -1;
- }
-
- /* -------------- Byte size ------------------ */
-
- switch (state.ByteSize)
- {
- case 5:
- t->c_cflag |= CS5;
- break;
- case 6:
- t->c_cflag |= CS6;
- break;
- case 7:
- t->c_cflag |= CS7;
- break;
- case 8:
- t->c_cflag |= CS8;
- break;
- default:
- /* Unsupported byte size! */
- termios_printf ("Invalid byte size %d", state.ByteSize);
- set_errno (EINVAL);
- return -1;
- }
-
- /* -------------- Stop bits ------------------ */
-
- if (state.StopBits == TWOSTOPBITS)
- t->c_cflag |= CSTOPB;
-
- /* -------------- Parity ------------------ */
-
- if (state.Parity == ODDPARITY)
- t->c_cflag |= (PARENB | PARODD);
- if (state.Parity == EVENPARITY)
- t->c_cflag |= PARENB;
-
- /* -------------- Parity errors ------------------ */
-
- /* fParity combines the function of INPCK and NOT IGNPAR */
- if (state.fParity == TRUE)
- t->c_iflag |= INPCK;
- else
- t->c_iflag |= IGNPAR; /* not necessarily! */
-
- /* -------------- Software flow control ------------------ */
-
- /* transmission flow control */
- if (state.fOutX)
- t->c_iflag |= IXON;
-
- /* reception flow control */
- if (state.fInX)
- t->c_iflag |= IXOFF;
-
- t->c_cc[VSTART] = (state.XonChar ? state.XonChar : 0x11);
- t->c_cc[VSTOP] = (state.XoffChar ? state.XoffChar : 0x13);
-
- /* -------------- Hardware flow control ------------------ */
- /* Some old flavors of Unix automatically enabled hardware flow
- control when software flow control was not enabled. Since newer
- Unices tend to require explicit setting of hardware flow-control,
- this is what we do. */
-
- /* Input flow-control */
- if ((state.fRtsControl == RTS_CONTROL_HANDSHAKE) &&
- (state.fOutxCtsFlow == TRUE))
- t->c_cflag |= CRTSCTS;
- if (state.fRtsControl == RTS_CONTROL_HANDSHAKE)
- t->c_cflag |= CRTSXOFF;
-
- /* -------------- CLOCAL --------------- */
- /* DSR is only lead toggled only by CLOCAL. Check it to see if
- CLOCAL was called. */
- /* FIXME: If tcsetattr() hasn't been called previously, this may
- give a false CLOCAL. */
-
- if (state.fDsrSensitivity == FALSE)
- t->c_cflag |= CLOCAL;
-
- /* FIXME: need to handle IGNCR */
-#if 0
- if (!get_r_binary ())
- t->c_iflag |= IGNCR;
-#endif
-
- if (!get_w_binary ())
- t->c_oflag |= ONLCR;
-
- debug_printf ("vmin_ %d, vtime_ %d", vmin_, vtime_);
- if (vmin_ == MAXDWORD)
- {
- t->c_lflag |= ICANON;
- t->c_cc[VTIME] = t->c_cc[VMIN] = 0;
- }
- else
- {
- t->c_cc[VTIME] = vtime_ / 100;
- t->c_cc[VMIN] = vmin_;
- }
-
- return 0;
-}
-
-void
-fhandler_serial::fixup_after_fork (HANDLE parent)
-{
- if (get_close_on_exec ())
- this->fhandler_base::fixup_after_fork (parent);
- overlapped_setup ();
- debug_printf ("io_status.hEvent %p", io_status.hEvent);
-}
-
-void
-fhandler_serial::fixup_after_exec (HANDLE)
-{
- overlapped_setup ();
- debug_printf ("io_status.hEvent %p", io_status.hEvent);
- return;
-}
-
-int
-fhandler_serial::dup (fhandler_base *child)
-{
- fhandler_serial *fhc = (fhandler_serial *) child;
- overlapped_setup ();
- fhc->vmin_ = vmin_;
- fhc->vtime_ = vtime_;
- return fhandler_base::dup (child);
-}
diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc
deleted file mode 100644
index 3ef35687e..000000000
--- a/winsup/cygwin/fhandler_socket.cc
+++ /dev/null
@@ -1,559 +0,0 @@
-/* fhandler_socket.cc. See fhandler.h for a description of the fhandler classes.
-
- Copyright 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. */
-
-/* #define DEBUG_NEST_ON 1 */
-
-#define __INSIDE_CYGWIN_NET__
-
-#include "winsup.h"
-#include <errno.h>
-#include <sys/socket.h>
-#include <asm/byteorder.h>
-
-#include <stdlib.h>
-#include <unistd.h>
-#define USE_SYS_TYPES_FD_SET
-#include <winsock2.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "cygwin/version.h"
-#include "perprocess.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygheap.h"
-#include "sigproc.h"
-#include "wsock_event.h"
-
-#define SECRET_EVENT_NAME "cygwin.local_socket.secret.%d.%08x-%08x-%08x-%08x"
-#define ENTROPY_SOURCE_NAME "/dev/urandom"
-#define ENTROPY_SOURCE_DEV_UNIT 9
-
-fhandler_dev_random* entropy_source;
-
-/**********************************************************************/
-/* fhandler_socket */
-
-fhandler_socket::fhandler_socket ()
- : fhandler_base (FH_SOCKET), sun_path (NULL)
-{
- set_need_fork_fixup ();
- prot_info_ptr = (LPWSAPROTOCOL_INFOA) cmalloc (HEAP_BUF,
- sizeof (WSAPROTOCOL_INFOA));
-}
-
-fhandler_socket::~fhandler_socket ()
-{
- if (prot_info_ptr)
- cfree (prot_info_ptr);
- if (sun_path)
- cfree (sun_path);
-}
-
-void
-fhandler_socket::set_connect_secret ()
-{
- if (!entropy_source)
- {
- void *buf = malloc (sizeof (fhandler_dev_random));
- entropy_source = new (buf) fhandler_dev_random (ENTROPY_SOURCE_DEV_UNIT);
- }
- if (entropy_source &&
- !entropy_source->open (NULL, O_RDONLY))
- {
- delete entropy_source;
- entropy_source = NULL;
- }
- if (!entropy_source ||
- (entropy_source->read (connect_secret, sizeof (connect_secret)) !=
- sizeof (connect_secret)))
- bzero ((char*) connect_secret, sizeof (connect_secret));
-}
-
-void
-fhandler_socket::get_connect_secret (char* buf)
-{
- __small_sprintf (buf, "%08x-%08x-%08x-%08x",
- connect_secret [0], connect_secret [1],
- connect_secret [2], connect_secret [3]);
-}
-
-HANDLE
-fhandler_socket::create_secret_event (int* secret)
-{
- char buf [128];
- int* secret_ptr = (secret ? : connect_secret);
- struct sockaddr_in sin;
- int sin_len = sizeof (sin);
-
- if (getsockname (get_socket (), (struct sockaddr*) &sin, &sin_len))
- {
- debug_printf ("error getting local socket name (%d)", WSAGetLastError ());
- return NULL;
- }
-
- __small_sprintf (buf, SECRET_EVENT_NAME, sin.sin_port,
- secret_ptr [0], secret_ptr [1],
- secret_ptr [2], secret_ptr [3]);
- secret_event = CreateEvent (get_inheritance(true), FALSE, FALSE, buf);
- if (!secret_event && GetLastError () == ERROR_ALREADY_EXISTS)
- secret_event = OpenEvent (EVENT_ALL_ACCESS, FALSE, buf);
-
- if (secret_event)
- ProtectHandle (secret_event);
-
- return secret_event;
-}
-
-void
-fhandler_socket::signal_secret_event ()
-{
- if (!secret_event)
- debug_printf ("no secret event?");
- else
- {
- SetEvent (secret_event);
- debug_printf ("signaled secret_event");
- }
-}
-
-void
-fhandler_socket::close_secret_event ()
-{
- if (secret_event)
- ForceCloseHandle (secret_event);
- secret_event = NULL;
-}
-
-int
-fhandler_socket::check_peer_secret_event (struct sockaddr_in* peer, int* secret)
-{
- char buf [128];
- HANDLE ev;
- int* secret_ptr = (secret ? : connect_secret);
-
- __small_sprintf (buf, SECRET_EVENT_NAME, peer->sin_port,
- secret_ptr [0], secret_ptr [1],
- secret_ptr [2], secret_ptr [3]);
- ev = CreateEvent (&sec_all_nih, FALSE, FALSE, buf);
- if (!ev && GetLastError () == ERROR_ALREADY_EXISTS)
- {
- debug_printf ("%s event already exist");
- ev = OpenEvent (EVENT_ALL_ACCESS, FALSE, buf);
- }
-
- signal_secret_event ();
-
- if (ev)
- {
- DWORD rc = WaitForSingleObject (ev, 10000);
- debug_printf ("WFSO rc=%d", rc);
- CloseHandle (ev);
- return (rc == WAIT_OBJECT_0 ? 1 : 0 );
- }
- else
- return 0;
-}
-
-void
-fhandler_socket::fixup_before_fork_exec (DWORD win_proc_id)
-{
- if (!winsock2_active)
- {
- fhandler_base::fixup_before_fork_exec (win_proc_id);
- debug_printf ("Without Winsock 2.0");
- }
- else if (!WSADuplicateSocketA (get_socket (), win_proc_id, prot_info_ptr))
- debug_printf ("WSADuplicateSocket went fine, sock %p, win_proc_id %d, prot_info_ptr %p",
- get_socket (), win_proc_id, prot_info_ptr);
- else
- {
- debug_printf ("WSADuplicateSocket error, sock %p, win_proc_id %d, prot_info_ptr %p",
- get_socket (), win_proc_id, prot_info_ptr);
- set_winsock_errno ();
- }
-}
-
-extern "C" void __stdcall load_wsock32 ();
-void
-fhandler_socket::fixup_after_fork (HANDLE parent)
-{
- SOCKET new_sock;
-
- debug_printf ("WSASocket begin, dwServiceFlags1=%d",
- prot_info_ptr->dwServiceFlags1);
-
- if ((new_sock = WSASocketA (FROM_PROTOCOL_INFO,
- FROM_PROTOCOL_INFO,
- FROM_PROTOCOL_INFO,
- prot_info_ptr, 0, 0)) == INVALID_SOCKET)
- {
- debug_printf ("WSASocket error");
- set_winsock_errno ();
- }
- else if (!new_sock && !winsock2_active)
- {
- load_wsock32 ();
- fhandler_base::fixup_after_fork (parent);
- debug_printf ("Without Winsock 2.0");
- }
- else
- {
- debug_printf ("WSASocket went fine new_sock %p, old_sock %p", new_sock, get_io_handle ());
- set_io_handle ((HANDLE) new_sock);
- }
-
- if (secret_event)
- fork_fixup (parent, secret_event, "secret_event");
-}
-
-void
-fhandler_socket::fixup_after_exec (HANDLE parent)
-{
- debug_printf ("here");
- if (!get_close_on_exec ())
- fixup_after_fork (parent);
-#if 0
- else if (!winsock2_active)
- closesocket (get_socket ());
-#endif
-}
-
-int
-fhandler_socket::dup (fhandler_base *child)
-{
- debug_printf ("here");
- fhandler_socket *fhs = (fhandler_socket *) child;
- fhs->addr_family = addr_family;
- fhs->set_io_handle (get_io_handle ());
-
- fhs->fixup_before_fork_exec (GetCurrentProcessId ());
- if (winsock2_active)
- {
- fhs->fixup_after_fork (hMainProc);
- return 0;
- }
- return fhandler_base::dup (child);
-}
-
-int __stdcall
-fhandler_socket::fstat (struct __stat64 *buf, path_conv *pc)
-{
- int res = fhandler_base::fstat (buf, pc);
- if (!res)
- buf->st_ino = (ino_t) get_handle ();
- return res;
-}
-
-int
-fhandler_socket::recv (void *ptr, size_t len, unsigned int flags)
-{
- int res = -1;
- wsock_event wsock_evt;
- LPWSAOVERLAPPED ovr;
-
- sigframe thisframe (mainthread);
- if (is_nonblocking () || !(ovr = wsock_evt.prepare ()))
- {
- debug_printf ("Fallback to winsock 1 recv call");
- if ((res = ::recv (get_socket (), (char *) ptr, len, flags))
- == SOCKET_ERROR)
- {
- set_winsock_errno ();
- res = -1;
- }
- }
- else
- {
- WSABUF wsabuf = { len, (char *) ptr };
- DWORD ret = 0;
- if (WSARecv (get_socket (), &wsabuf, 1, &ret, (DWORD *)&flags,
- ovr, NULL) != SOCKET_ERROR)
- res = ret;
- else if ((res = WSAGetLastError ()) != WSA_IO_PENDING)
- {
- set_winsock_errno ();
- res = -1;
- }
- else if ((res = wsock_evt.wait (get_socket (), (DWORD *)&flags)) == -1)
- set_winsock_errno ();
- }
- return res;
-}
-
-int __stdcall
-fhandler_socket::read (void *ptr, size_t len)
-{
- return recv (ptr, len, 0);
-}
-
-int
-fhandler_socket::send (const void *ptr, size_t len, unsigned int flags)
-{
- int res = -1;
- wsock_event wsock_evt;
- LPWSAOVERLAPPED ovr;
-
- sigframe thisframe (mainthread);
- if (is_nonblocking () || !(ovr = wsock_evt.prepare ()))
- {
- debug_printf ("Fallback to winsock 1 send call");
- if ((res = ::send (get_socket (), (const char *) ptr, len, flags))
- == SOCKET_ERROR)
- {
- set_winsock_errno ();
- res = -1;
- }
- }
- else
- {
- WSABUF wsabuf = { len, (char *) ptr };
- DWORD ret = 0;
- if (WSASend (get_socket (), &wsabuf, 1, &ret, (DWORD)flags,
- ovr, NULL) != SOCKET_ERROR)
- res = ret;
- else if ((res = WSAGetLastError ()) != WSA_IO_PENDING)
- {
- set_winsock_errno ();
- res = -1;
- }
- else if ((res = wsock_evt.wait (get_socket (), (DWORD *)&flags)) == -1)
- set_winsock_errno ();
- }
- return res;
-}
-
-int
-fhandler_socket::write (const void *ptr, size_t len)
-{
- return send (ptr, len, 0);
-}
-
-/* Cygwin internal */
-int
-fhandler_socket::close ()
-{
- int res = 0;
- sigframe thisframe (mainthread);
-
- /* HACK to allow a graceful shutdown even if shutdown() hasn't been
- called by the application. Note that this isn't the ultimate
- solution but it helps in many cases. */
- struct linger linger;
- linger.l_onoff = 1;
- linger.l_linger = 240; /* seconds. default 2MSL value according to MSDN. */
- setsockopt (get_socket (), SOL_SOCKET, SO_LINGER,
- (const char *)&linger, sizeof linger);
-
- while ((res = closesocket (get_socket ())) != 0)
- {
- if (WSAGetLastError () != WSAEWOULDBLOCK)
- {
- set_winsock_errno ();
- res = -1;
- break;
- }
- if (WaitForSingleObject (signal_arrived, 10) == WAIT_OBJECT_0)
- {
- set_errno (EINTR);
- res = -1;
- break;
- }
- WSASetLastError (0);
- }
-
- close_secret_event ();
-
- debug_printf ("%d = fhandler_socket::close()", res);
- return res;
-}
-
-#define ASYNC_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT)
-
-/* Cygwin internal */
-int
-fhandler_socket::ioctl (unsigned int cmd, void *p)
-{
- extern int get_ifconf (struct ifconf *ifc, int what); /* net.cc */
- int res;
- struct ifconf ifc, *ifcp;
- struct ifreq *ifr, *ifrp;
- sigframe thisframe (mainthread);
-
- switch (cmd)
- {
- case SIOCGIFCONF:
- ifcp = (struct ifconf *) p;
- if (!ifcp)
- {
- set_errno (EINVAL);
- return -1;
- }
- res = get_ifconf (ifcp, cmd);
- if (res)
- debug_printf ("error in get_ifconf\n");
- break;
- case SIOCGIFFLAGS:
- ifr = (struct ifreq *) p;
- if (ifr == 0)
- {
- set_errno (EINVAL);
- return -1;
- }
- ifr->ifr_flags = IFF_NOTRAILERS | IFF_UP | IFF_RUNNING;
- if (ntohl (((struct sockaddr_in *) &ifr->ifr_addr)->sin_addr.s_addr)
- == INADDR_LOOPBACK)
- ifr->ifr_flags |= IFF_LOOPBACK;
- else
- ifr->ifr_flags |= IFF_BROADCAST;
- res = 0;
- break;
- case SIOCGIFBRDADDR:
- case SIOCGIFNETMASK:
- case SIOCGIFADDR:
- case SIOCGIFHWADDR:
- case SIOCGIFMETRIC:
- case SIOCGIFMTU:
- {
- ifc.ifc_len = 2048;
- ifc.ifc_buf = (char *) alloca (2048);
-
- ifr = (struct ifreq *) p;
- if (ifr == 0)
- {
- debug_printf ("ifr == NULL\n");
- set_errno (EINVAL);
- return -1;
- }
-
- res = get_ifconf (&ifc, cmd);
- if (res)
- {
- debug_printf ("error in get_ifconf\n");
- break;
- }
-
- debug_printf (" name: %s\n", ifr->ifr_name);
- for (ifrp = ifc.ifc_req;
- (caddr_t) ifrp < ifc.ifc_buf + ifc.ifc_len;
- ++ifrp)
- {
- debug_printf ("testname: %s\n", ifrp->ifr_name);
- if (! strcmp (ifrp->ifr_name, ifr->ifr_name))
- {
- switch (cmd)
- {
- case SIOCGIFADDR:
- ifr->ifr_addr = ifrp->ifr_addr;
- break;
- case SIOCGIFBRDADDR:
- ifr->ifr_broadaddr = ifrp->ifr_broadaddr;
- break;
- case SIOCGIFNETMASK:
- ifr->ifr_netmask = ifrp->ifr_netmask;
- break;
- case SIOCGIFHWADDR:
- ifr->ifr_hwaddr = ifrp->ifr_hwaddr;
- break;
- case SIOCGIFMETRIC:
- ifr->ifr_metric = ifrp->ifr_metric;
- break;
- case SIOCGIFMTU:
- ifr->ifr_mtu = ifrp->ifr_mtu;
- break;
- }
- break;
- }
- }
- if ((caddr_t) ifrp >= ifc.ifc_buf + ifc.ifc_len)
- {
- set_errno (EINVAL);
- return -1;
- }
- break;
- }
- case FIOASYNC:
- res = WSAAsyncSelect (get_socket (), gethwnd (), WM_ASYNCIO,
- *(int *) p ? ASYNC_MASK : 0);
- syscall_printf ("Async I/O on socket %s",
- *(int *) p ? "started" : "cancelled");
- set_async (*(int *) p);
- break;
- default:
- /* We must cancel WSAAsyncSelect (if any) before setting socket to
- * blocking mode
- */
- if (cmd == FIONBIO && *(int *) p == 0)
- WSAAsyncSelect (get_socket (), gethwnd (), 0, 0);
- res = ioctlsocket (get_socket (), cmd, (unsigned long *) p);
- if (res == SOCKET_ERROR)
- set_winsock_errno ();
- if (cmd == FIONBIO)
- {
- syscall_printf ("socket is now %sblocking",
- *(int *) p ? "non" : "");
- /* Start AsyncSelect if async socket unblocked */
- if (*(int *) p && get_async ())
- WSAAsyncSelect (get_socket (), gethwnd (), WM_ASYNCIO, ASYNC_MASK);
-
- set_nonblocking (*(int *) p);
- }
- break;
- }
- syscall_printf ("%d = ioctl_socket (%x, %x)", res, cmd, p);
- return res;
-}
-
-int
-fhandler_socket::fcntl (int cmd, void *arg)
-{
- int res = 0;
- int request, current;
-
- switch (cmd)
- {
- case F_SETFL:
- {
- /* Carefully test for the O_NONBLOCK or deprecated OLD_O_NDELAY flag.
- Set only the flag that has been passed in. If both are set, just
- record O_NONBLOCK. */
- int new_flags = (int) arg & O_NONBLOCK_MASK;
- if ((new_flags & OLD_O_NDELAY) && (new_flags & O_NONBLOCK))
- new_flags = O_NONBLOCK;
- current = get_flags () & O_NONBLOCK_MASK;
- request = new_flags ? 1 : 0;
- if (!!current != !!new_flags && (res = ioctl (FIONBIO, &request)))
- break;
- set_flags ((get_flags () & ~O_NONBLOCK_MASK) | new_flags);
- break;
- }
- default:
- res = fhandler_base::fcntl (cmd, arg);
- break;
- }
- return res;
-}
-
-void
-fhandler_socket::set_close_on_exec (int val)
-{
- if (!winsock2_active) /* < Winsock 2.0 */
- set_inheritance (get_handle (), val);
- set_close_on_exec_flag (val);
- debug_printf ("set close_on_exec for %s to %d", get_name (), val);
-}
-
-void
-fhandler_socket::set_sun_path (const char *path)
-{
- if (sun_path)
- cfree (sun_path);
- sun_path = cstrdup (path);
-}
diff --git a/winsup/cygwin/fhandler_tape.cc b/winsup/cygwin/fhandler_tape.cc
deleted file mode 100644
index aaf1ed751..000000000
--- a/winsup/cygwin/fhandler_tape.cc
+++ /dev/null
@@ -1,839 +0,0 @@
-/* fhandler_tape.cc. See fhandler.h for a description of the fhandler
- classes.
-
- 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. */
-
-#include "winsup.h"
-#include <sys/termios.h>
-#include <errno.h>
-#include <unistd.h>
-#include <sys/mtio.h>
-#include "cygerrno.h"
-#include "perprocess.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygheap.h"
-
-/**********************************************************************/
-/* fhandler_dev_tape */
-
-void
-fhandler_dev_tape::clear (void)
-{
- lasterr = 0;
- fhandler_dev_raw::clear ();
-}
-
-int
-fhandler_dev_tape::is_eom (int win_error)
-{
- int ret = ((win_error == ERROR_END_OF_MEDIA)
- || (win_error == ERROR_EOM_OVERFLOW)
- || (win_error == ERROR_NO_DATA_DETECTED));
- if (ret)
- debug_printf ("end of medium");
- return ret;
-}
-
-int
-fhandler_dev_tape::is_eof (int win_error)
-{
- int ret = ((win_error == ERROR_FILEMARK_DETECTED)
- || (win_error == ERROR_SETMARK_DETECTED));
- if (ret)
- debug_printf ("end of file");
- return ret;
-}
-
-fhandler_dev_tape::fhandler_dev_tape (int unit)
- : fhandler_dev_raw (FH_TAPE, unit)
-{
- debug_printf ("unit: %d", unit);
-}
-
-int
-fhandler_dev_tape::open (path_conv *real_path, int flags, mode_t)
-{
- int ret;
-
- devbufsiz = 1L;
-
- ret = fhandler_dev_raw::open (real_path, flags);
- if (ret)
- {
- struct mtget get;
- struct mtop op;
- struct mtpos pos;
-
- if (!ioctl (MTIOCGET, &get))
- /* Tape drive supports and is set to variable block size. */
- if (get.mt_dsreg == 0)
- devbufsiz = get.mt_maxblksize;
- else
- devbufsiz = get.mt_dsreg;
- varblkop = get.mt_dsreg == 0;
-
- if (devbufsiz > 1L)
- devbuf = new char [devbufsiz];
-
- /* The following rewind in position 0 solves a problem which appears
- * in case of multi volume archives: The last ReadFile on first medium
- * returns ERROR_NO_DATA_DETECTED. After media change, all subsequent
- * ReadFile calls return ERROR_NO_DATA_DETECTED, too.
- * The call to tape_set_pos seems to reset some internal flags. */
- if ((! ioctl (MTIOCPOS, &pos)) && (! pos.mt_blkno))
- {
- op.mt_op = MTREW;
- ioctl (MTIOCTOP, &op);
- }
-
- if (flags & O_APPEND)
- {
- /* In append mode, seek to beginning of next filemark */
- op.mt_op = MTFSFM;
- op.mt_count = 1;
- ioctl (MTIOCTOP, &op);
- }
- }
-
- return ret;
-}
-
-int
-fhandler_dev_tape::close (void)
-{
- struct mtop op;
- int ret = 0;
-
- if (is_writing)
- {
- ret = writebuf ();
- if ((has_written) && (! eom_detected))
- {
- /* if last operation was writing, write a filemark */
- debug_printf ("writing filemark\n");
- op.mt_op = MTWEOF;
- op.mt_count = 1;
- ioctl (MTIOCTOP, &op);
- }
- }
-
- // To protected reads on signaling (e.g. Ctrl-C)
- eof_detected = 1;
-
- if (is_rewind_device ())
- {
- debug_printf ("rewinding\n");
- op.mt_op = MTREW;
- ioctl (MTIOCTOP, &op);
- }
-
- if (ret)
- {
- fhandler_dev_raw::close ();
- return ret;
- }
-
- return fhandler_dev_raw::close ();
-}
-
-int
-fhandler_dev_tape::fstat (struct __stat64 *buf, path_conv *pc)
-{
- int ret;
-
- if (!(ret = fhandler_base::fstat (buf, pc)))
- {
- struct mtget get;
-
- if (!ioctl (MTIOCGET, &get))
- buf->st_blocks = get.mt_capacity / buf->st_blksize;
- }
-
- return ret;
-}
-
-__off64_t
-fhandler_dev_tape::lseek (__off64_t offset, int whence)
-{
- struct mtop op;
- struct mtpos pos;
-
- debug_printf ("lseek (%s, %d, %d)\n", get_name (), offset, whence);
-
- writebuf ();
- eom_detected = eof_detected = 0;
- lastblk_to_read = 0;
- devbufstart = devbufend = 0;
-
- if (ioctl (MTIOCPOS, &pos))
- {
- return ILLEGAL_SEEK;
- }
-
- switch (whence)
- {
- case SEEK_END:
- op.mt_op = MTFSF;
- op.mt_count = 1;
- if (ioctl (MTIOCTOP, &op))
- return -1;
- break;
- case SEEK_SET:
- if (whence == SEEK_SET && offset < 0)
- {
- set_errno (EINVAL);
- return -1;
- }
- break;
- case SEEK_CUR:
- break;
- default:
- set_errno (EINVAL);
- return -1;
- }
-
- op.mt_op = MTFSR;
- op.mt_count = offset / devbufsiz
- - (whence == SEEK_SET ? pos.mt_blkno : 0);
-
- if (op.mt_count < 0)
- {
- op.mt_op = MTBSR;
- op.mt_count = -op.mt_count;
- }
-
- if (ioctl (MTIOCTOP, &op) || ioctl (MTIOCPOS, &pos))
- return -1;
-
- return (pos.mt_blkno * devbufsiz);
-}
-
-int
-fhandler_dev_tape::dup (fhandler_base *child)
-{
- fhandler_dev_tape *fhc = (fhandler_dev_tape *) child;
-
- fhc->lasterr = lasterr;
- return fhandler_dev_raw::dup (child);
-}
-
-int
-fhandler_dev_tape::ioctl (unsigned int cmd, void *buf)
-{
- int ret = NO_ERROR;
- unsigned long block;
-
- if (cmd == MTIOCTOP)
- {
- struct mtop *op = (struct mtop *) buf;
-
- if (! op)
- ret = ERROR_INVALID_PARAMETER;
- else
- switch (op->mt_op)
- {
- case MTRESET:
- break;
- case MTFSF:
- ret = tape_set_pos (TAPE_SPACE_FILEMARKS, op->mt_count);
- break;
- case MTBSF:
- ret = tape_set_pos (TAPE_SPACE_FILEMARKS, -op->mt_count);
- break;
- case MTFSR:
- ret = tape_set_pos (TAPE_SPACE_RELATIVE_BLOCKS, op->mt_count);
- break;
- case MTBSR:
- ret = tape_set_pos (TAPE_SPACE_RELATIVE_BLOCKS, -op->mt_count);
- break;
- case MTWEOF:
- if (tape_get_feature (TAPE_DRIVE_WRITE_FILEMARKS))
- ret = tape_write_marks (TAPE_FILEMARKS, op->mt_count);
- else if (tape_get_feature (TAPE_DRIVE_WRITE_LONG_FMKS))
- ret = tape_write_marks (TAPE_LONG_FILEMARKS, op->mt_count);
- else
- ret = tape_write_marks (TAPE_SHORT_FILEMARKS, op->mt_count);
- break;
- case MTREW:
- ret = tape_set_pos (TAPE_REWIND, 0);
- break;
- case MTOFFL:
- ret = tape_prepare (TAPE_UNLOAD);
- break;
- case MTNOP:
- break;
- case MTRETEN:
- if (! tape_get_feature (TAPE_DRIVE_END_OF_DATA))
- ret = ERROR_INVALID_PARAMETER;
- else if (! (ret = tape_set_pos (TAPE_REWIND, 0, FALSE)))
- ret = tape_prepare (TAPE_TENSION);
- break;
- case MTBSFM:
- ret = tape_set_pos (TAPE_SPACE_FILEMARKS, -op->mt_count, TRUE);
- break;
- case MTFSFM:
- ret = tape_set_pos (TAPE_SPACE_FILEMARKS, op->mt_count, TRUE);
- break;
- case MTEOM:
- if (tape_get_feature (TAPE_DRIVE_END_OF_DATA))
- ret = tape_set_pos (TAPE_SPACE_END_OF_DATA, 0);
- else
- ret = tape_set_pos (TAPE_SPACE_FILEMARKS, 32767);
- break;
- case MTERASE:
- ret = tape_erase (TAPE_ERASE_SHORT);
- break;
- case MTRAS1:
- case MTRAS2:
- case MTRAS3:
- ret = ERROR_INVALID_PARAMETER;
- break;
- case MTSETBLK:
- {
- long min, max;
-
- if (! tape_get_feature (TAPE_DRIVE_SET_BLOCK_SIZE))
- {
- ret = ERROR_INVALID_PARAMETER;
- break;
- }
- ret = tape_get_blocksize (&min, NULL, &max, NULL);
- if (ret)
- break;
- if (devbuf && (size_t) op->mt_count == devbufsiz && !varblkop)
- {
- ret = 0;
- break;
- }
- if ((op->mt_count == 0
- && !tape_get_feature (TAPE_DRIVE_VARIABLE_BLOCK))
- || (op->mt_count > 0
- && (op->mt_count < min || op->mt_count > max)))
- {
- ret = ERROR_INVALID_PARAMETER;
- break;
- }
- if (devbuf && op->mt_count > 0
- && (size_t) op->mt_count < devbufend - devbufstart)
- {
- ret = ERROR_MORE_DATA;
- break;
- }
- if (! (ret = tape_set_blocksize (op->mt_count)))
- {
- size_t size = 0;
- if (op->mt_count == 0)
- {
- struct mtget get;
- if ((ret = tape_status (&get)) != NO_ERROR)
- break;
- size = get.mt_maxblksize;
- ret = NO_ERROR;
- }
- char *buf = NULL;
- if (size > 1L && !(buf = new char [size]))
- {
- ret = ERROR_OUTOFMEMORY;
- break;
- }
- if (devbufsiz > 1L && size > 1L)
- {
- memcpy(buf, devbuf + devbufstart,
- devbufend - devbufstart);
- devbufend -= devbufstart;
- }
- else
- devbufend = 0;
- if (devbufsiz > 1L)
- delete [] devbuf;
- devbufstart = 0;
- devbuf = buf;
- devbufsiz = size;
- varblkop = op->mt_count == 0;
- }
- }
- break;
- case MTSETDENSITY:
- ret = ERROR_INVALID_PARAMETER;
- break;
- case MTSEEK:
- if (tape_get_feature (TAPE_DRIVE_ABSOLUTE_BLK))
- {
- ret = tape_set_pos (TAPE_ABSOLUTE_BLOCK, op->mt_count);
- break;
- }
- if (! (ret = tape_get_pos (&block)))
- {
- ret = tape_set_pos (TAPE_SPACE_RELATIVE_BLOCKS,
- op->mt_count - block);
- }
- break;
- case MTTELL:
- if (! (ret = tape_get_pos (&block)))
- op->mt_count = block;
- break;
- case MTSETDRVBUFFER:
- ret = ERROR_INVALID_PARAMETER;
- break;
- case MTFSS:
- ret = tape_set_pos (TAPE_SPACE_SETMARKS, op->mt_count);
- break;
- case MTBSS:
- ret = tape_set_pos (TAPE_SPACE_SETMARKS, -op->mt_count);
- break;
- case MTWSM:
- ret = tape_write_marks (TAPE_SETMARKS, op->mt_count);
- break;
- case MTLOCK:
- ret = tape_prepare (TAPE_LOCK);
- break;
- case MTUNLOCK:
- ret = tape_prepare (TAPE_UNLOCK);
- break;
- case MTLOAD:
- ret = tape_prepare (TAPE_LOAD);
- break;
- case MTUNLOAD:
- ret = tape_prepare (TAPE_UNLOAD);
- break;
- case MTCOMPRESSION:
- ret = tape_compression (op->mt_count);
- break;
- case MTSETPART:
- case MTMKPART:
- default:
- ret = ERROR_INVALID_PARAMETER;
- break;
- }
- }
- else if (cmd == MTIOCGET)
- ret = tape_status ((struct mtget *) buf);
- else if (cmd == MTIOCPOS)
- {
- ret = ERROR_INVALID_PARAMETER;
- if (buf && (ret = tape_get_pos (&block)))
- ((struct mtpos *) buf)->mt_blkno = block;
- }
- else
- return fhandler_dev_raw::ioctl (cmd, buf);
-
- if (ret != NO_ERROR)
- {
- SetLastError (ret);
- __seterrno ();
- return -1;
- }
-
- return 0;
-}
-
-/* ------------------------------------------------------------------ */
-/* Private functions used by `ioctl' */
-/* ------------------------------------------------------------------ */
-
-static int
-tape_error (DWORD lasterr, const char *txt)
-{
- if (lasterr)
- debug_printf ("%s: error: %d\n", txt, lasterr);
-
- return lasterr;
-}
-
-int
-fhandler_dev_tape::tape_write_marks (int marktype, DWORD len)
-{
- syscall_printf ("write_tapemark\n");
- while (((lasterr = WriteTapemark (get_handle (),
- marktype,
- len,
- FALSE)) == ERROR_MEDIA_CHANGED)
- || (lasterr == ERROR_BUS_RESET))
- ;
-
- return tape_error (lasterr, "tape_write_marks");
-}
-
-int
-fhandler_dev_tape::tape_get_pos (unsigned long *ret)
-{
- DWORD part, low, high;
-
- while (((lasterr = GetTapePosition (get_handle (),
- TAPE_ABSOLUTE_POSITION,
- &part,
- &low,
- &high)) == ERROR_MEDIA_CHANGED)
- || (lasterr == ERROR_BUS_RESET))
- ;
- if (! tape_error (lasterr, "tape_get_pos") && ret)
- *ret = low;
-
- return lasterr;
-}
-
-static int _tape_set_pos (HANDLE hTape, int mode, long count)
-{
- int err;
-
- while (((err = SetTapePosition (hTape,
- mode,
- 1,
- count,
- count < 0 ? -1 : 0,
- FALSE)) == ERROR_MEDIA_CHANGED)
- || (err == ERROR_BUS_RESET))
- ;
-
- return err;
-}
-
-int
-fhandler_dev_tape::tape_set_pos (int mode, long count, BOOLEAN sfm_func)
-{
- unsigned long pos, tgtpos;
-
- switch (mode)
- {
- case TAPE_SPACE_RELATIVE_BLOCKS:
- lasterr = tape_get_pos (&pos);
-
- if (lasterr)
- return lasterr;
-
- tgtpos = pos + count;
-
- while (((lasterr = _tape_set_pos (get_handle (),
- mode,
- count)) == ERROR_FILEMARK_DETECTED)
- || (lasterr == ERROR_SETMARK_DETECTED))
- {
- lasterr = tape_get_pos (&pos);
- if (lasterr)
- return lasterr;
- count = tgtpos - pos;
- }
-
- if (lasterr == ERROR_BEGINNING_OF_MEDIA && ! tgtpos)
- lasterr = NO_ERROR;
-
- break;
- case TAPE_SPACE_FILEMARKS:
- if (count < 0)
- {
- if (pos > 0)
- {
- if ((! _tape_set_pos (get_handle (),
- TAPE_SPACE_RELATIVE_BLOCKS,
- -1))
- || (sfm_func))
- ++count;
- _tape_set_pos (get_handle (), TAPE_SPACE_RELATIVE_BLOCKS, 1);
- }
-
- while (! (lasterr = _tape_set_pos (get_handle (), mode, -1))
- && count++ < 0)
- ;
-
- if (lasterr == ERROR_BEGINNING_OF_MEDIA)
- {
- if (! count)
- lasterr = NO_ERROR;
- }
- else if (! sfm_func)
- lasterr = _tape_set_pos (get_handle (), mode, 1);
- }
- else
- {
- if (sfm_func)
- {
- if (_tape_set_pos (get_handle (),
- TAPE_SPACE_RELATIVE_BLOCKS,
- 1) == ERROR_FILEMARK_DETECTED)
- ++count;
- _tape_set_pos (get_handle (), TAPE_SPACE_RELATIVE_BLOCKS, -1);
- }
-
- if (! (lasterr = _tape_set_pos (get_handle (), mode, count))
- && sfm_func)
- lasterr = _tape_set_pos (get_handle (), mode, -1);
- }
- break;
- case TAPE_SPACE_SETMARKS:
- case TAPE_ABSOLUTE_BLOCK:
- case TAPE_SPACE_END_OF_DATA:
- case TAPE_REWIND:
- lasterr = _tape_set_pos (get_handle (), mode, count);
- break;
- }
-
- return tape_error (lasterr, "tape_set_pos");
-}
-
-int
-fhandler_dev_tape::tape_erase (int mode)
-{
- DWORD varlen;
- TAPE_GET_DRIVE_PARAMETERS dp;
-
- while (((lasterr = GetTapeParameters (get_handle (),
- GET_TAPE_DRIVE_INFORMATION,
- (varlen = sizeof dp, &varlen),
- &dp)) == ERROR_MEDIA_CHANGED)
- || (lasterr == ERROR_BUS_RESET))
- ;
-
- switch (mode)
- {
- case TAPE_ERASE_SHORT:
- if (! lasterr && ! (dp.FeaturesLow & TAPE_DRIVE_ERASE_SHORT))
- mode = TAPE_ERASE_LONG;
- break;
- case TAPE_ERASE_LONG:
- if (! lasterr && ! (dp.FeaturesLow & TAPE_DRIVE_ERASE_LONG))
- mode = TAPE_ERASE_SHORT;
- break;
- }
-
- return tape_error (EraseTape (get_handle (), mode, FALSE), "tape_erase");
-}
-
-int
-fhandler_dev_tape::tape_prepare (int action)
-{
- while (((lasterr = PrepareTape (get_handle (),
- action,
- FALSE)) == ERROR_MEDIA_CHANGED)
- || (lasterr == ERROR_BUS_RESET))
- ;
- return tape_error (lasterr, "tape_prepare");
-}
-
-BOOLEAN
-fhandler_dev_tape::tape_get_feature (DWORD parm)
-{
- DWORD varlen;
- TAPE_GET_DRIVE_PARAMETERS dp;
-
- while (((lasterr = GetTapeParameters (get_handle (),
- GET_TAPE_DRIVE_INFORMATION,
- (varlen = sizeof dp, &varlen),
- &dp)) == ERROR_MEDIA_CHANGED)
- || (lasterr == ERROR_BUS_RESET))
- ;
-
- if (lasterr)
- return FALSE;
-
- return ((parm & TAPE_DRIVE_HIGH_FEATURES)
- ? ((dp.FeaturesHigh & parm) != 0)
- : ((dp.FeaturesLow & parm) != 0));
-}
-
-int
-fhandler_dev_tape::tape_get_blocksize (long *min, long *def, long *max, long *cur)
-{
- DWORD varlen;
- TAPE_GET_DRIVE_PARAMETERS dp;
- TAPE_GET_MEDIA_PARAMETERS mp;
-
- while (((lasterr = GetTapeParameters (get_handle (),
- GET_TAPE_DRIVE_INFORMATION,
- (varlen = sizeof dp, &varlen),
- &dp)) == ERROR_MEDIA_CHANGED)
- || (lasterr == ERROR_BUS_RESET))
- ;
-
- if (lasterr)
- return tape_error (lasterr, "tape_get_blocksize");
-
- while (((lasterr = GetTapeParameters (get_handle (),
- GET_TAPE_MEDIA_INFORMATION,
- (varlen = sizeof dp, &varlen),
- &mp)) == ERROR_MEDIA_CHANGED)
- || (lasterr == ERROR_BUS_RESET))
- ;
-
- if (lasterr)
- return tape_error (lasterr, "tape_get_blocksize");
-
- if (min)
- *min = (long) dp.MinimumBlockSize;
- if (def)
- *def = (long) dp.DefaultBlockSize;
- if (max)
- *max = (long) dp.MaximumBlockSize;
- if (cur)
- *cur = (long) mp.BlockSize;
-
- return tape_error (lasterr, "tape_get_blocksize");
-}
-
-int
-fhandler_dev_tape::tape_set_blocksize (long count)
-{
- long min, max;
- TAPE_SET_MEDIA_PARAMETERS mp;
-
- lasterr = tape_get_blocksize (&min, NULL, &max, NULL);
-
- if (lasterr)
- return lasterr;
-
- if (count != 0 && (count < min || count > max))
- return tape_error (ERROR_INVALID_PARAMETER, "tape_set_blocksize");
-
- mp.BlockSize = count;
-
- return tape_error (SetTapeParameters (get_handle (),
- SET_TAPE_MEDIA_INFORMATION,
- &mp),
- "tape_set_blocksize");
-}
-
-static long long
-get_ll (PLARGE_INTEGER i)
-{
- long long l = 0;
-
- l = i->HighPart;
- l <<= 32;
- l |= i->LowPart;
- return l;
-}
-
-int
-fhandler_dev_tape::tape_status (struct mtget *get)
-{
- DWORD varlen;
- TAPE_GET_DRIVE_PARAMETERS dp;
- TAPE_GET_MEDIA_PARAMETERS mp;
- int notape = 0;
-
- if (! get)
- return ERROR_INVALID_PARAMETER;
-
- while (((lasterr = GetTapeParameters (get_handle (),
- GET_TAPE_DRIVE_INFORMATION,
- (varlen = sizeof dp, &varlen),
- &dp)) == ERROR_MEDIA_CHANGED)
- || (lasterr == ERROR_BUS_RESET))
- ;
-
- /* Setting varlen to sizeof DP is by intention, actually! Never set
- it to sizeof MP which seems to be more correct but results in a
- ERROR_MORE_DATA error at least on W2K. */
- if ((lasterr) || (lasterr = GetTapeParameters (get_handle (),
- GET_TAPE_MEDIA_INFORMATION,
- (varlen = sizeof dp, &varlen),
- &mp)))
- notape = 1;
-
- memset (get, 0, sizeof *get);
-
- get->mt_type = MT_ISUNKNOWN;
-
- if (! notape && (dp.FeaturesLow & TAPE_DRIVE_TAPE_REMAINING))
- {
- get->mt_remaining = get_ll (&mp.Remaining);
- get->mt_resid = get->mt_remaining >> 10;
- }
-
- if ((dp.FeaturesHigh & TAPE_DRIVE_SET_BLOCK_SIZE) && ! notape)
- get->mt_dsreg = mp.BlockSize;
- else
- get->mt_dsreg = dp.DefaultBlockSize;
-
- if (notape)
- get->mt_gstat |= GMT_DR_OPEN (-1);
-
- if (! notape)
- {
- if (dp.FeaturesLow & TAPE_DRIVE_GET_ABSOLUTE_BLK)
- tape_get_pos ((unsigned long *) &get->mt_blkno);
-
- if (! get->mt_blkno)
- get->mt_gstat |= GMT_BOT (-1);
-
- get->mt_gstat |= GMT_ONLINE (-1);
-
- if ((dp.FeaturesLow & TAPE_DRIVE_WRITE_PROTECT) && mp.WriteProtected)
- get->mt_gstat |= GMT_WR_PROT (-1);
-
- if (dp.FeaturesLow & TAPE_DRIVE_TAPE_CAPACITY)
- get->mt_capacity = get_ll (&mp.Capacity);
- }
-
- if ((dp.FeaturesLow & TAPE_DRIVE_COMPRESSION) && dp.Compression)
- get->mt_gstat |= GMT_HW_COMP (-1);
-
- if ((dp.FeaturesLow & TAPE_DRIVE_ECC) && dp.ECC)
- get->mt_gstat |= GMT_HW_ECC (-1);
-
- if ((dp.FeaturesLow & TAPE_DRIVE_PADDING) && dp.DataPadding)
- get->mt_gstat |= GMT_PADDING (-1);
-
- if ((dp.FeaturesLow & TAPE_DRIVE_REPORT_SMKS) && dp.ReportSetmarks)
- get->mt_gstat |= GMT_IM_REP_EN (-1);
-
- get->mt_erreg = lasterr;
-
- get->mt_minblksize = dp.MinimumBlockSize;
- get->mt_maxblksize = dp.MaximumBlockSize;
- get->mt_defblksize = dp.DefaultBlockSize;
- get->mt_featureslow = dp.FeaturesLow;
- get->mt_featureshigh = dp.FeaturesHigh;
- get->mt_eotwarningzonesize = dp.EOTWarningZoneSize;
-
- return 0;
-}
-
-int
-fhandler_dev_tape::tape_compression (long count)
-{
- DWORD varlen;
- TAPE_GET_DRIVE_PARAMETERS dpg;
- TAPE_SET_DRIVE_PARAMETERS dps;
-
- while (((lasterr = GetTapeParameters (get_handle (),
- GET_TAPE_DRIVE_INFORMATION,
- (varlen = sizeof dpg, &varlen),
- &dpg)) == ERROR_MEDIA_CHANGED)
- || (lasterr == ERROR_BUS_RESET))
- ;
-
- if (lasterr)
- return tape_error (lasterr, "tape_compression");
-
- if (! (dpg.FeaturesLow & TAPE_DRIVE_COMPRESSION))
- return ERROR_INVALID_PARAMETER;
-
- if (count)
- {
- dps.ECC = dpg.ECC;
- dps.Compression = count ? TRUE : FALSE;
- dps.DataPadding = dpg.DataPadding;
- dps.ReportSetmarks = dpg.ReportSetmarks;
- dps.EOTWarningZoneSize = dpg.EOTWarningZoneSize;
- lasterr = SetTapeParameters (get_handle (),
- SET_TAPE_DRIVE_INFORMATION,
- &dps);
-
- if (lasterr)
- return tape_error (lasterr, "tape_compression");
-
- dpg.Compression = dps.Compression;
- }
-
- return 0;
-}
-
diff --git a/winsup/cygwin/fhandler_termios.cc b/winsup/cygwin/fhandler_termios.cc
deleted file mode 100644
index 778c09651..000000000
--- a/winsup/cygwin/fhandler_termios.cc
+++ /dev/null
@@ -1,352 +0,0 @@
-/* fhandler_termios.cc
-
- 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. */
-
-#include "winsup.h"
-#include <sys/termios.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <ctype.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-#include "sigproc.h"
-#include "pinfo.h"
-#include "tty.h"
-
-/* Common functions shared by tty/console */
-
-void
-fhandler_termios::tcinit (tty_min *this_tc, int force)
-{
- /* Initial termios values */
-
- tc = this_tc;
-
- if (force || !TTYISSETF (INITIALIZED))
- {
- tc->ti.c_iflag = BRKINT | ICRNL | IXON;
- tc->ti.c_oflag = OPOST | ONLCR;
- tc->ti.c_cflag = B38400 | CS8 | CREAD;
- tc->ti.c_lflag = ISIG | ICANON | ECHO | IEXTEN;
-
- tc->ti.c_cc[VDISCARD] = CFLUSH;
- tc->ti.c_cc[VEOL] = CEOL;
- tc->ti.c_cc[VEOL2] = CEOL2;
- tc->ti.c_cc[VEOF] = CEOF;
- tc->ti.c_cc[VERASE] = CERASE;
- tc->ti.c_cc[VINTR] = CINTR;
- tc->ti.c_cc[VKILL] = CKILL;
- tc->ti.c_cc[VLNEXT] = CLNEXT;
- tc->ti.c_cc[VMIN] = 1;
- tc->ti.c_cc[VQUIT] = CQUIT;
- tc->ti.c_cc[VREPRINT] = CRPRNT;
- tc->ti.c_cc[VSTART] = CSTART;
- tc->ti.c_cc[VSTOP] = CSTOP;
- tc->ti.c_cc[VSUSP] = CSUSP;
- tc->ti.c_cc[VSWTC] = CSWTCH;
- tc->ti.c_cc[VTIME] = 0;
- tc->ti.c_cc[VWERASE] = CWERASE;
-
- tc->ti.c_ispeed = tc->ti.c_ospeed = B38400;
- tc->pgid = myself->pgid;
- TTYSETF (INITIALIZED);
- }
-}
-
-int
-fhandler_termios::tcsetpgrp (const pid_t pgid)
-{
- termios_printf ("tty %d pgid %d, sid %d, tsid %d", tc->ntty, pgid,
- myself->sid, tc->getsid ());
- if (myself->sid != tc->getsid ())
- {
- set_errno (EPERM);
- return -1;
- }
- tc->setpgid (pgid);
- return 0;
-}
-
-int
-fhandler_termios::tcgetpgrp ()
-{
- return tc->pgid;
-}
-
-void
-tty_min::kill_pgrp (int sig)
-{
- int killself = 0;
- winpids pids;
- for (unsigned i = 0; i < pids.npids; i++)
- {
- _pinfo *p = pids[i];
- if (!proc_exists (p) || p->ctty != ntty || p->pgid != pgid)
- continue;
- if (p == myself)
- killself++;
- else
- (void) sig_send (p, sig);
- }
- if (killself)
- sig_send (myself, sig);
-}
-
-void
-tty_min::set_ctty (int ttynum, int flags)
-{
- if ((myself->ctty < 0 || myself->ctty == ttynum) && !(flags & O_NOCTTY))
- {
- myself->ctty = ttynum;
- syscall_printf ("attached tty%d sid %d, pid %d, tty->pgid %d, tty->sid %d",
- ttynum, myself->sid, myself->pid, pgid, getsid ());
-
- pinfo p (getsid ());
- if (myself->sid == myself->pid &&
- (p == myself || !proc_exists (p)))
- {
- paranoid_printf ("resetting tty%d sid. Was %d, now %d. pgid was %d, now %d.",
- ttynum, getsid(), myself->sid, getpgid (), myself->pgid);
- /* We are the session leader */
- setsid (myself->sid);
- setpgid (myself->pgid);
- }
- else
- myself->sid = getsid ();
- if (getpgid () == 0)
- setpgid (myself->pgid);
- }
-}
-
-bg_check_types
-fhandler_termios::bg_check (int sig)
-{
- if (!myself->pgid || tc->getpgid () == myself->pgid ||
- myself->ctty != tc->ntty ||
- ((sig == SIGTTOU) && !(tc->ti.c_lflag & TOSTOP)))
- return bg_ok;
-
- if (sig < 0)
- sig = -sig;
-
- termios_printf("bg I/O pgid %d, tpgid %d, ctty %d",
- myself->pgid, tc->getpgid (), myself->ctty);
-
- if (tc->getsid () == 0)
- {
- /* The pty has been closed by the master. Return an EOF
- indication. FIXME: There is nothing to stop somebody
- from reallocating this pty. I think this is the case
- which is handled by unlockpt on a Unix system. */
- termios_printf ("closed by master");
- return bg_eof;
- }
-
- /* If the process group is no more or if process is ignoring or blocks 'sig',
- return with error */
- int pgid_gone = !pid_exists (myself->pgid);
- int sigs_ignored =
- ((void *) myself->getsig(sig).sa_handler == (void *) SIG_IGN) ||
- (myself->getsigmask () & SIGTOMASK (sig));
-
- if (pgid_gone)
- goto setEIO;
- else if (!sigs_ignored)
- /* nothing */;
- else if (sig == SIGTTOU)
- return bg_ok; /* Just allow the output */
- else
- goto setEIO; /* This is an output error */
-
- /* Don't raise a SIGTT* signal if we have already been interrupted
- by another signal. */
- if (WaitForSingleObject (signal_arrived, 0) != WAIT_OBJECT_0)
- _raise (sig);
- return bg_signalled;
-
-setEIO:
- set_errno (EIO);
- return bg_error;
-}
-
-#define set_input_done(x) input_done = input_done || (x)
-
-inline void
-fhandler_termios::echo_erase (int force)
-{
- if (force || tc->ti.c_lflag & ECHO)
- doecho ("\b \b", 3);
-}
-
-int
-fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
-{
- char c;
- int input_done = 0;
- bool sawsig = FALSE;
- int iscanon = tc->ti.c_lflag & ICANON;
-
- while (nread-- > 0)
- {
- c = *rptr++;
-
- termios_printf ("char %c", c);
-
- /* Check for special chars */
-
- if (c == '\r')
- {
- if (tc->ti.c_iflag & IGNCR)
- continue;
- if (tc->ti.c_iflag & ICRNL)
- {
- c = '\n';
- set_input_done (iscanon);
- }
- }
- else if (c == '\n')
- {
- if (tc->ti.c_iflag & INLCR)
- c = '\r';
- else
- set_input_done (iscanon);
- }
-
- if (tc->ti.c_iflag & ISTRIP)
- c &= 0x7f;
- if (tc->ti.c_lflag & ISIG)
- {
- int sig;
- if (CCEQ(tc->ti.c_cc[VINTR], c))
- sig = SIGINT;
- else if (CCEQ(tc->ti.c_cc[VQUIT], c))
- sig = SIGQUIT;
- else if (CCEQ(tc->ti.c_cc[VSUSP], c))
- sig = SIGTSTP;
- else
- goto not_a_sig;
-
- termios_printf ("got interrupt %d, sending signal %d", c, sig);
- eat_readahead (-1);
- tc->kill_pgrp (sig);
- tc->ti.c_lflag &= ~FLUSHO;
- sawsig = 1;
- goto restart_output;
- }
- not_a_sig:
- if (tc->ti.c_iflag & IXON)
- {
- if (CCEQ(tc->ti.c_cc[VSTOP], c))
- {
- if (!tc->output_stopped)
- {
- tc->output_stopped = 1;
- acquire_output_mutex (INFINITE);
- }
- continue;
- }
- else if (CCEQ(tc->ti.c_cc[VSTART], c))
- {
- restart_output:
- tc->output_stopped = 0;
- release_output_mutex ();
- continue;
- }
- else if ((tc->ti.c_iflag & IXANY) && tc->output_stopped)
- goto restart_output;
- }
- if (iscanon && tc->ti.c_lflag & IEXTEN && CCEQ(tc->ti.c_cc[VDISCARD], c))
- {
- tc->ti.c_lflag ^= FLUSHO;
- continue;
- }
- if (!iscanon)
- /* nothing */;
- else if (CCEQ(tc->ti.c_cc[VERASE], c))
- {
- if (eat_readahead (1))
- echo_erase ();
- continue;
- }
- else if (CCEQ(tc->ti.c_cc[VWERASE], c))
- {
- int ch;
- do
- if (!eat_readahead (1))
- break;
- else
- echo_erase ();
- while ((ch = peek_readahead (1)) >= 0 && !isspace (ch));
- continue;
- }
- else if (CCEQ(tc->ti.c_cc[VKILL], c))
- {
- int nchars = eat_readahead (-1);
- if (tc->ti.c_lflag & ECHO)
- while (nchars--)
- echo_erase (1);
- continue;
- }
- else if (CCEQ(tc->ti.c_cc[VREPRINT], c))
- {
- if (tc->ti.c_lflag & ECHO)
- {
- doecho ("\n\r", 2);
- doecho (rabuf, ralen);
- }
- continue;
- }
- else if (CCEQ(tc->ti.c_cc[VEOF], c))
- {
- termios_printf ("EOF");
- input_done = 1;
- continue;
- }
- else if (CCEQ(tc->ti.c_cc[VEOL], c) ||
- CCEQ(tc->ti.c_cc[VEOL2], c) ||
- c == '\n')
- {
- set_input_done (1);
- termios_printf ("EOL");
- }
-
- if (tc->ti.c_iflag & IUCLC && isupper (c))
- c = cyg_tolower (c);
-
- if (tc->ti.c_lflag & ECHO)
- doecho (&c, 1);
- put_readahead (c);
- }
-
- if (!iscanon || always_accept)
- set_input_done (ralen > 0);
-
- if (sawsig)
- input_done = -1;
- else if (input_done)
- (void) accept_input ();
-
- return input_done;
-}
-
-void
-fhandler_termios::fixup_after_fork (HANDLE parent)
-{
- this->fhandler_base::fixup_after_fork (parent);
- fork_fixup (parent, get_output_handle (), "output_handle");
-}
-
-__off64_t
-fhandler_termios::lseek (__off64_t, int)
-{
- set_errno (ESPIPE);
- return -1;
-}
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
deleted file mode 100644
index 758d6eaec..000000000
--- a/winsup/cygwin/fhandler_tty.cc
+++ /dev/null
@@ -1,1231 +0,0 @@
-/* fhandler_tty.cc
-
- Copyright 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <ctype.h>
-#include <limits.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "sigproc.h"
-#include "pinfo.h"
-#include "cygheap.h"
-#include "shared_info.h"
-#include "cygwin/cygserver_transport.h"
-#include "cygwin/cygserver.h"
-
-/* Tty master stuff */
-
-fhandler_tty_master NO_COPY *tty_master;
-
-static DWORD WINAPI process_input (void *); // Input queue thread
-static DWORD WINAPI process_output (void *); // Output queue thread
-static DWORD WINAPI process_ioctl (void *); // Ioctl requests thread
-
-fhandler_tty_master::fhandler_tty_master (int unit)
- : fhandler_pty_master (FH_TTYM, unit), console (NULL), hThread (NULL)
-{
-}
-
-int
-fhandler_tty_master::init (int ntty)
-{
- HANDLE h;
- termios_printf ("Creating master for tty%d", ntty);
-
- if (init_console ())
- {
- termios_printf ("can't create fhandler");
- return -1;
- }
-
- termios ti;
- memset (&ti, 0, sizeof (ti));
- console->tcsetattr (0, &ti);
-
- ttynum = ntty;
-
- cygwin_shared->tty[ttynum]->common_init (this);
-
- inuse = get_ttyp ()->create_inuse (TTY_MASTER_ALIVE);
-
- h = makethread (process_input, NULL, 0, "ttyin");
- if (h == NULL)
- {
- termios_printf ("can't create input thread");
- return -1;
- }
- else
- {
- SetThreadPriority (h, THREAD_PRIORITY_HIGHEST);
- CloseHandle (h);
- }
-
- h = makethread (process_ioctl, NULL, 0, "ttyioctl");
- if (h == NULL)
- {
- termios_printf ("can't create ioctl thread");
- return -1;
- }
- else
- {
- SetThreadPriority (h, THREAD_PRIORITY_HIGHEST);
- CloseHandle (h);
- }
-
- hThread = makethread (process_output, NULL, 0, "ttyout");
- if (hThread != NULL)
- SetThreadPriority (hThread, THREAD_PRIORITY_HIGHEST);
- else
- {
- termios_printf ("can't create output thread");
- return -1;
- }
-
- return 0;
-}
-
-#ifdef DEBUGGING
-static class mutex_stack
-{
-public:
- const char *fn;
- int ln;
- const char *tname;
-} ostack[100];
-
-static int osi;
-#endif /*DEBUGGING*/
-
-DWORD
-fhandler_tty_common::__acquire_output_mutex (const char *fn, int ln,
- DWORD ms)
-{
- if (strace.active)
- strace.prntf (_STRACE_TERMIOS, fn, "(%d): tty output_mutex: waiting %d ms", ln, ms);
- DWORD res = WaitForSingleObject (output_mutex, ms);
- if (res == WAIT_OBJECT_0)
- {
-#ifndef DEBUGGING
- if (strace.active)
- strace.prntf (_STRACE_TERMIOS, fn, "(%d): tty output_mutex: acquired", ln, res);
-#else
- ostack[osi].fn = fn;
- ostack[osi].ln = ln;
- ostack[osi].tname = threadname (0, 0);
- termios_printf ("acquired for %s:%d, osi %d", fn, ln, osi);
- osi++;
-#endif
- }
- return res;
-}
-
-void
-fhandler_tty_common::__release_output_mutex (const char *fn, int ln)
-{
- if (ReleaseMutex (output_mutex))
- {
-#ifndef DEBUGGING
- if (strace.active)
- strace.prntf (_STRACE_TERMIOS, fn, "(%d): tty output_mutex released", ln);
-#else
- if (osi > 0)
- osi--;
- termios_printf ("released at %s:%d, osi %d", fn, ln, osi);
- termios_printf (" for %s:%d (%s)", ostack[osi].fn, ostack[osi].ln, ostack[osi].tname);
- ostack[osi].ln = -ln;
-#endif
- }
-}
-
-/* Process tty input. */
-
-void
-fhandler_pty_master::doecho (const void *str, DWORD len)
-{
- acquire_output_mutex (INFINITE);
- if (!WriteFile (get_ttyp ()->to_master, str, len, &len, NULL))
- termios_printf ("Write to %p failed, %E", get_ttyp ()->to_master);
-// WaitForSingleObject (output_done_event, INFINITE);
- release_output_mutex ();
-}
-
-int
-fhandler_pty_master::accept_input ()
-{
- DWORD bytes_left, written;
- DWORD n;
- DWORD rc;
- char* p;
-
- rc = WaitForSingleObject (input_mutex, INFINITE);
-
- bytes_left = n = eat_readahead (-1);
- get_ttyp ()->read_retval = 0;
- p = rabuf;
-
- if (n != 0)
- {
- while (bytes_left > 0)
- {
- termios_printf ("about to write %d chars to slave", bytes_left);
- rc = WriteFile (get_output_handle (), p, bytes_left, &written, NULL);
- if (!rc)
- {
- debug_printf ("error writing to pipe %E");
- break;
- }
- get_ttyp ()->read_retval += written;
- p += written;
- bytes_left -= written;
- if (bytes_left > 0)
- {
- debug_printf ("to_slave pipe is full");
- SetEvent (input_available_event);
- ReleaseMutex (input_mutex);
- Sleep (10);
- rc = WaitForSingleObject (input_mutex, INFINITE);
- }
- }
- }
- else
- termios_printf ("sending EOF to slave");
- SetEvent (input_available_event);
- ReleaseMutex (input_mutex);
- return get_ttyp ()->read_retval;
-}
-
-static DWORD WINAPI
-process_input (void *)
-{
- char rawbuf[INP_BUFFER_SIZE];
-
- while (1)
- {
- int nraw = tty_master->console->read ((void *) rawbuf,
- (size_t) INP_BUFFER_SIZE);
- (void) tty_master->line_edit (rawbuf, nraw);
- }
-}
-
-bool
-fhandler_pty_master::hit_eof ()
-{
- if (get_ttyp ()->was_opened && !get_ttyp ()->slave_alive ())
- {
- /* We have the only remaining open handle to this pty, and
- the slave pty has been opened at least once. We treat
- this as EOF. */
- termios_printf ("all other handles closed");
- return 1;
- }
- return 0;
-}
-
-/* Process tty output requests */
-
-int
-fhandler_pty_master::process_slave_output (char *buf, size_t len, int pktmode_on)
-{
- size_t rlen;
- char outbuf[OUT_BUFFER_SIZE + 1];
- DWORD n;
- int column = 0;
- int rc = 0;
-
- if (len == 0)
- goto out;
-
- if (need_nl)
- {
- /* We need to return a left over \n character, resulting from
- \r\n conversion. Note that we already checked for FLUSHO and
- output_stopped at the time that we read the character, so we
- don't check again here. */
- buf[0] = '\n';
- need_nl = 0;
- rc = 1;
- goto out;
- }
-
-
- for (;;)
- {
- /* Set RLEN to the number of bytes to read from the pipe. */
- rlen = len;
- if (get_ttyp ()->ti.c_oflag & OPOST && get_ttyp ()->ti.c_oflag & ONLCR)
- {
- /* We are going to expand \n to \r\n, so don't read more than
- half of the number of bytes requested. */
- rlen /= 2;
- if (rlen == 0)
- rlen = 1;
- }
- if (rlen > sizeof outbuf)
- rlen = sizeof outbuf;
-
- HANDLE handle = get_io_handle ();
-
- n = 0; // get_readahead_into_buffer (outbuf, len);
- if (!n)
- {
- /* Doing a busy wait like this is quite inefficient, but nothing
- else seems to work completely. Windows should provide some sort
- of overlapped I/O for pipes, or something, but it doesn't. */
- while (1)
- {
- if (!PeekNamedPipe (handle, NULL, 0, NULL, &n, NULL))
- goto err;
- if (n > 0)
- break;
- if (hit_eof ())
- goto out;
- if (n == 0 && is_nonblocking ())
- {
- set_errno (EAGAIN);
- rc = -1;
- break;
- }
-
- Sleep (10);
- }
-
- if (ReadFile (handle, outbuf, rlen, &n, NULL) == FALSE)
- goto err;
- }
-
- termios_printf ("bytes read %u", n);
- get_ttyp ()->write_error = 0;
- if (output_done_event != NULL)
- SetEvent (output_done_event);
-
- if (get_ttyp ()->ti.c_lflag & FLUSHO)
- continue;
-
- char *optr;
- optr = buf;
- if (pktmode_on)
- *optr++ = TIOCPKT_DATA;
-
- if (!(get_ttyp ()->ti.c_oflag & OPOST)) // post-process output
- {
- memcpy (optr, outbuf, n);
- optr += n;
- }
- else // raw output mode
- {
- char *iptr = outbuf;
-
- while (n--)
- {
- switch (*iptr)
- {
- case '\r':
- if ((get_ttyp ()->ti.c_oflag & ONOCR) && column == 0)
- {
- iptr++;
- continue;
- }
- if (get_ttyp ()->ti.c_oflag & OCRNL)
- *iptr = '\n';
- else
- column = 0;
- break;
- case '\n':
- if (get_ttyp ()->ti.c_oflag & ONLCR)
- {
- *optr++ = '\r';
- column = 0;
- }
- if (get_ttyp ()->ti.c_oflag & ONLRET)
- column = 0;
- break;
- default:
- column++;
- break;
- }
-
- /* Don't store data past the end of the user's buffer. This
- can happen if the user requests a read of 1 byte when
- doing \r\n expansion. */
- if (optr - buf >= (int) len)
- {
- if (*iptr != '\n' || n != 0)
- system_printf ("internal error: %d unexpected characters", n);
- need_nl = 1;
- break;
- }
-
- *optr++ = *iptr++;
- }
- }
- rc = optr - buf;
- break;
-
- err:
- if (GetLastError () == ERROR_BROKEN_PIPE)
- rc = 0;
- else
- {
- __seterrno ();
- rc = -1;
- }
- break;
- }
-
-out:
- termios_printf ("returning %d", rc);
- return rc;
-}
-
-static DWORD WINAPI
-process_output (void *)
-{
- char buf[OUT_BUFFER_SIZE*2];
-
- for (;;)
- {
- int n = tty_master->process_slave_output (buf, OUT_BUFFER_SIZE, 0);
- if (n < 0)
- {
- termios_printf ("ReadFile %E");
- ExitThread (0);
- }
- if (n == 0)
- {
- /* End of file. */
- ExitThread (0);
- }
- n = tty_master->console->write ((void *) buf, (size_t) n);
- tty_master->get_ttyp ()->write_error = n == -1 ? get_errno () : 0;
- }
-}
-
-
-/* Process tty ioctl requests */
-
-static DWORD WINAPI
-process_ioctl (void *)
-{
- while (1)
- {
- WaitForSingleObject (tty_master->ioctl_request_event, INFINITE);
- termios_printf ("ioctl() request");
- tty_master->get_ttyp ()->ioctl_retval =
- tty_master->console->ioctl (tty_master->get_ttyp ()->cmd,
- (void *) &tty_master->get_ttyp ()->arg);
- SetEvent (tty_master->ioctl_done_event);
- }
-}
-
-/**********************************************************************/
-/* Tty slave stuff */
-
-fhandler_tty_slave::fhandler_tty_slave (int num)
- : fhandler_tty_common (FH_TTYS, num)
-{
-}
-
-fhandler_tty_slave::fhandler_tty_slave ()
- : fhandler_tty_common (FH_TTYS, 0)
-{
-}
-
-/* FIXME: This function needs to close handles when it has
- a failing condition. */
-int
-fhandler_tty_slave::open (path_conv *, int flags, mode_t)
-{
- tcinit (cygwin_shared->tty[ttynum]);
-
- attach_tty (ttynum);
- tc->set_ctty (ttynum, flags);
-
- set_flags (flags & ~O_TEXT, O_BINARY);
- /* Create synchronisation events */
- char buf[40];
-
- /* output_done_event may or may not exist. It will exist if the tty
- was opened by fhandler_tty_master::init, normally called at
- startup if use_tty is non-zero. It will not exist if this is a
- pty opened by fhandler_pty_master::open. In the former case, tty
- output is handled by a separate thread which controls output. */
- __small_sprintf (buf, OUTPUT_DONE_EVENT, ttynum);
- output_done_event = OpenEvent (EVENT_ALL_ACCESS, TRUE, buf);
-
- if (!(output_mutex = get_ttyp ()->open_output_mutex ()))
- {
- termios_printf ("open output mutex failed, %E");
- __seterrno ();
- return 0;
- }
- if (!(input_mutex = get_ttyp ()->open_input_mutex ()))
- {
- termios_printf ("open input mutex failed, %E");
- __seterrno ();
- return 0;
- }
- __small_sprintf (buf, INPUT_AVAILABLE_EVENT, ttynum);
- if (!(input_available_event = OpenEvent (EVENT_ALL_ACCESS, TRUE, buf)))
- {
- termios_printf ("open input event failed, %E");
- __seterrno ();
- return 0;
- }
-
- /* The ioctl events may or may not exist. See output_done_event,
- above. */
- __small_sprintf (buf, IOCTL_REQUEST_EVENT, ttynum);
- ioctl_request_event = OpenEvent (EVENT_ALL_ACCESS, TRUE, buf);
- __small_sprintf (buf, IOCTL_DONE_EVENT, ttynum);
- ioctl_done_event = OpenEvent (EVENT_ALL_ACCESS, TRUE, buf);
-
- /* FIXME: Needs a method to eliminate tty races */
- {
- acquire_output_mutex (500);
- inuse = get_ttyp ()->create_inuse (TTY_SLAVE_ALIVE);
- get_ttyp ()->was_opened = TRUE;
- release_output_mutex ();
- }
-
- /* Duplicate tty handles. */
-
- if (!get_ttyp ()->from_slave || !get_ttyp ()->to_slave)
- {
- termios_printf ("tty handles have been closed");
- set_errno (EACCES);
- return 0;
- }
-
- HANDLE from_master_local, to_master_local;
-
- if (!wincap.has_security () ||
- cygserver_running!=CYGSERVER_OK ||
- !cygserver_attach_tty ( &from_master_local, &to_master_local))
- {
- termios_printf ("cannot dup handles via server. using old method.");
-
- HANDLE tty_owner = OpenProcess (PROCESS_DUP_HANDLE, FALSE,
- get_ttyp ()->master_pid);
- termios_printf ("tty own handle %p",tty_owner);
- if (tty_owner == NULL)
- {
- termios_printf ("can't open tty (%d) handle process %d",
- ttynum, get_ttyp ()->master_pid);
- __seterrno ();
- return 0;
- }
-
- if (!DuplicateHandle (tty_owner, get_ttyp ()->from_master,
- hMainProc, &from_master_local, 0, TRUE,
- DUPLICATE_SAME_ACCESS))
- {
- termios_printf ("can't duplicate input, %E");
- __seterrno ();
- return 0;
- }
-
- if (!DuplicateHandle (tty_owner, get_ttyp ()->to_master,
- hMainProc, &to_master_local, 0, TRUE,
- DUPLICATE_SAME_ACCESS))
- {
- termios_printf ("can't duplicate output, %E");
- __seterrno ();
- return 0;
- }
- CloseHandle (tty_owner);
- }
-
- termios_printf ("duplicated from_master %p->%p from tty_owner",
- get_ttyp ()->from_master, from_master_local);
- termios_printf ("duplicated to_master %p->%p from tty_owner",
- get_ttyp ()->to_master, to_master_local);
-
- set_io_handle (from_master_local);
- ProtectHandle1 (from_master_local, from_pty);
- set_output_handle (to_master_local);
- ProtectHandle1 (to_master_local, to_pty);
-
- set_open_status ();
- termios_printf ("tty%d opened", ttynum);
-
- return 1;
-}
-
-int
-fhandler_tty_slave::cygserver_attach_tty (LPHANDLE from_master_ptr,
- LPHANDLE to_master_ptr)
-{
- if (!from_master_ptr || !to_master_ptr)
- return 0;
-
- client_request_attach_tty *request =
- new client_request_attach_tty ((DWORD) GetCurrentProcessId (),
- (DWORD) get_ttyp ()->master_pid,
- (HANDLE) get_ttyp ()->from_master,
- (HANDLE) get_ttyp ()->to_master);
-
- if (cygserver_request (request) != 0 ||
- request->header.error_code != 0)
- return 0;
-
-/*
- struct request_attach_tty req;
- INIT_REQUEST (req, CYGSERVER_REQUEST_ATTACH_TTY);
- req.pid = GetCurrentProcessId ();
- req.master_pid = get_ttyp ()->master_pid;
- req.from_master = get_ttyp ()->from_master;
- req.to_master = get_ttyp ()->to_master;
- if (cygserver_request ((struct request_header*) &req) != 0)
- return 0;
-*/
- *from_master_ptr = request->from_master ();
- *to_master_ptr = request->to_master ();
- delete request;
- return 1;
-}
-
-void
-fhandler_tty_slave::init (HANDLE, DWORD a, mode_t)
-{
- int mode = 0;
-
- a &= GENERIC_READ | GENERIC_WRITE;
- if (a == GENERIC_READ)
- mode = O_RDONLY;
- if (a == GENERIC_WRITE)
- mode = O_WRONLY;
- if (a == (GENERIC_READ | GENERIC_WRITE))
- mode = O_RDWR;
-
- open (0, mode);
-}
-
-int
-fhandler_tty_slave::write (const void *ptr, size_t len)
-{
- DWORD n, towrite = len;
-
- termios_printf ("tty%d, write(%x, %d)", ttynum, ptr, len);
-
- acquire_output_mutex (INFINITE);
-
- while (len)
- {
- n = min (OUT_BUFFER_SIZE, len);
- char *buf = (char *)ptr;
- ptr = (char *) ptr + n;
- len -= n;
-
- /* Previous write may have set write_error to != 0. Check it here.
- This is less than optimal, but the alternative slows down tty
- writes enormously. */
- if (get_ttyp ()->write_error)
- {
- set_errno (get_ttyp ()->write_error);
- towrite = (DWORD) -1;
- break;
- }
-
- if (WriteFile (get_output_handle (), buf, n, &n, NULL) == FALSE)
- {
- DWORD err = GetLastError ();
- termios_printf ("WriteFile failed, %E");
- switch (err)
- {
- case ERROR_NO_DATA:
- err = ERROR_IO_DEVICE;
- default:
- __seterrno_from_win_error (err);
- }
- _raise (SIGHUP); /* FIXME: Should this be SIGTTOU? */
- towrite = (DWORD) -1;
- break;
- }
-
- if (output_done_event != NULL)
- {
- DWORD rc;
- DWORD x = n * 1000;
- rc = WaitForSingleObject (output_done_event, x);
- termios_printf ("waited %d ms for output_done_event, WFSO %d", x, rc);
- }
- }
- release_output_mutex ();
- return towrite;
-}
-
-int __stdcall
-fhandler_tty_slave::read (void *ptr, size_t len)
-{
- DWORD n;
- int totalread = 0;
- int vmin = INT_MAX;
- int vtime = 0; /* Initialized to prevent -Wuninitialized warning */
- size_t readlen;
- DWORD bytes_in_pipe;
- char buf[INP_BUFFER_SIZE];
- char peek_buf[INP_BUFFER_SIZE];
- DWORD time_to_wait;
- DWORD rc;
- HANDLE w4[2];
-
- termios_printf ("read(%x, %d) handle %p", ptr, len, get_handle ());
-
- if (!(get_ttyp ()->ti.c_lflag & ICANON))
- {
- vmin = get_ttyp ()->ti.c_cc[VMIN];
- if (vmin > INP_BUFFER_SIZE)
- vmin = INP_BUFFER_SIZE;
- vtime = get_ttyp ()->ti.c_cc[VTIME];
- if (vmin < 0) vmin = 0;
- if (vtime < 0) vtime = 0;
- if (vmin == 0)
- time_to_wait = INFINITE;
- else
- time_to_wait = (vtime == 0 ? INFINITE : 100 * vtime);
- }
- else
- time_to_wait = INFINITE;
-
- w4[0] = signal_arrived;
- w4[1] = input_available_event;
-
- while (len)
- {
- rc = WaitForMultipleObjects (2, w4, FALSE, time_to_wait);
- if (rc == WAIT_OBJECT_0)
- {
- /* if we've received signal after successfully reading some data,
- just return all data successfully read */
- if (totalread > 0)
- break;
- set_sig_errno (EINTR);
- return -1;
- }
- else if (rc == WAIT_FAILED)
- {
- termios_printf ("wait for input event failed, %E");
- break;
- }
- else if (rc == WAIT_TIMEOUT)
- break;
- rc = WaitForSingleObject (input_mutex, 1000);
- if (rc == WAIT_FAILED)
- {
- termios_printf ("wait for input mutex failed, %E");
- break;
- }
- else if (rc == WAIT_TIMEOUT)
- {
- termios_printf ("failed to acquire input mutex after input event arrived");
- break;
- }
- if (!PeekNamedPipe (get_handle (), peek_buf, sizeof(peek_buf), &bytes_in_pipe, NULL, NULL))
- {
- termios_printf ("PeekNamedPipe failed, %E");
- _raise (SIGHUP);
- bytes_in_pipe = 0;
- }
- readlen = min (bytes_in_pipe, min (len, sizeof (buf)));
- if (readlen)
- {
- termios_printf ("reading %d bytes (vtime %d)", readlen, vtime);
- if (ReadFile (get_handle (), buf, readlen, &n, NULL) == FALSE)
- {
- termios_printf ("read failed, %E");
- _raise (SIGHUP);
- }
- /* MSDN states that 5th prameter can be used to determine total
- number of bytes in pipe, but for some reason this number doesn't
- change after successful read. So we have to peek into the pipe
- again to see if input is still available */
- if (!PeekNamedPipe (get_handle (), peek_buf, 1, &bytes_in_pipe, NULL, NULL))
- {
- termios_printf ("PeekNamedPipe failed, %E");
- _raise (SIGHUP);
- bytes_in_pipe = 0;
- }
- if (n)
- {
- len -= n;
- totalread += n;
- memcpy (ptr, buf, n);
- ptr = (char *) ptr + n;
- }
- }
-
- if (!bytes_in_pipe)
- ResetEvent (input_available_event);
-
- ReleaseMutex (input_mutex);
-
- if (get_ttyp ()->read_retval < 0) // read error
- {
- set_errno (-get_ttyp ()->read_retval);
- totalread = -1;
- break;
- }
- if (get_ttyp ()->read_retval == 0) //EOF
- {
- termios_printf ("saw EOF");
- break;
- }
- if (get_ttyp ()->ti.c_lflag & ICANON || is_nonblocking ())
- break;
- if (totalread >= vmin && (vmin > 0 || totalread > 0))
- break;
-
- /* vmin == 0 && vtime == 0:
- * we've already read all input, if any, so return immediately
- * vmin == 0 && vtime > 0:
- * we've waited for input 10*vtime ms in WFSO(input_available_event),
- * no matter whether any input arrived, we shouldn't wait any longer,
- * so return immediately
- * vmin > 0 && vtime == 0:
- * here, totalread < vmin, so continue waiting until more data
- * arrive
- * vmin > 0 && vtime > 0:
- * similar to the previous here, totalread < vmin, and timer
- * hadn't expired -- WFSO(input_available_event) != WAIT_TIMEOUT,
- * so "restart timer" and wait until more data arrive
- */
-
- if (vmin == 0)
- break;
- }
- termios_printf ("%d=read(%x, %d)", totalread, ptr, len);
- return totalread;
-}
-
-int
-fhandler_tty_common::dup (fhandler_base *child)
-{
- fhandler_tty_slave *fts = (fhandler_tty_slave *) child;
- int errind;
-
- fts->ttynum = ttynum;
- fts->tcinit (get_ttyp ());
-
- attach_tty (ttynum);
- tc->set_ctty (ttynum, openflags);
-
- HANDLE nh;
-
- if (output_done_event == NULL)
- fts->output_done_event = NULL;
- else if (!DuplicateHandle (hMainProc, output_done_event, hMainProc,
- &fts->output_done_event, 0, 1,
- DUPLICATE_SAME_ACCESS))
- {
- errind = 1;
- goto err;
- }
- if (ioctl_request_event == NULL)
- fts->ioctl_request_event = NULL;
- else if (!DuplicateHandle (hMainProc, ioctl_request_event, hMainProc,
- &fts->ioctl_request_event, 0, 1,
- DUPLICATE_SAME_ACCESS))
- {
- errind = 2;
- goto err;
- }
- if (ioctl_done_event == NULL)
- fts->ioctl_done_event = NULL;
- else if (!DuplicateHandle (hMainProc, ioctl_done_event, hMainProc,
- &fts->ioctl_done_event, 0, 1,
- DUPLICATE_SAME_ACCESS))
- {
- errind = 3;
- goto err;
- }
- if (!DuplicateHandle (hMainProc, input_available_event, hMainProc,
- &fts->input_available_event, 0, 1,
- DUPLICATE_SAME_ACCESS))
- {
- errind = 4;
- goto err;
- }
- if (!DuplicateHandle (hMainProc, output_mutex, hMainProc,
- &fts->output_mutex, 0, 1,
- DUPLICATE_SAME_ACCESS))
- {
- errind = 5;
- goto err;
- }
- if (!DuplicateHandle (hMainProc, input_mutex, hMainProc,
- &fts->input_mutex, 0, 1,
- DUPLICATE_SAME_ACCESS))
- {
- errind = 6;
- goto err;
- }
- if (!DuplicateHandle (hMainProc, get_handle (), hMainProc,
- &nh, 0, 1,
- DUPLICATE_SAME_ACCESS))
- {
- errind = 7;
- goto err;
- }
- fts->set_io_handle (nh);
-
- if (!DuplicateHandle (hMainProc, get_output_handle (), hMainProc,
- &nh, 0, 1,
- DUPLICATE_SAME_ACCESS))
- {
- errind = 8;
- goto err;
- }
- fts->set_output_handle (nh);
-
- if (inuse == NULL)
- fts->inuse = NULL;
- else if (!DuplicateHandle (hMainProc, inuse, hMainProc,
- &fts->inuse, 0, 1,
- DUPLICATE_SAME_ACCESS))
- {
- errind = 9;
- goto err;
- }
- return 0;
-
-err:
- __seterrno ();
- termios_printf ("dup %d failed in DuplicateHandle, %E", errind);
- return -1;
-}
-
-int
-fhandler_tty_slave::tcgetattr (struct termios *t)
-{
- *t = get_ttyp ()->ti;
- return 0;
-}
-
-int
-fhandler_tty_slave::tcsetattr (int, const struct termios *t)
-{
- acquire_output_mutex (INFINITE);
- get_ttyp ()->ti = *t;
- release_output_mutex ();
- return 0;
-}
-
-int
-fhandler_tty_slave::tcflush (int)
-{
- return 0;
-}
-
-int
-fhandler_tty_slave::ioctl (unsigned int cmd, void *arg)
-{
- termios_printf ("ioctl (%x)", cmd);
-
- if (myself->pgid && get_ttyp ()->getpgid () != myself->pgid &&
- myself->ctty == ttynum && (get_ttyp ()->ti.c_lflag & TOSTOP))
- {
- /* background process */
- termios_printf ("bg ioctl pgid %d, tpgid %d, ctty %d",
- myself->pgid, get_ttyp ()->getpgid (), myself->ctty);
- _raise (SIGTTOU);
- }
-
- switch (cmd)
- {
- case TIOCGWINSZ:
- case TIOCSWINSZ:
- break;
- case FIONBIO:
- set_nonblocking (*(int *) arg);
- goto out;
- default:
- set_errno (EINVAL);
- return -1;
- }
-
- acquire_output_mutex (INFINITE);
-
- get_ttyp ()->cmd = cmd;
- get_ttyp ()->ioctl_retval = 0;
- switch (cmd)
- {
- case TIOCGWINSZ:
- get_ttyp ()->arg.winsize = get_ttyp ()->winsize;
- if (ioctl_request_event)
- SetEvent (ioctl_request_event);
- * (struct winsize *) arg = get_ttyp ()->arg.winsize;
- if (ioctl_done_event)
- WaitForSingleObject (ioctl_done_event, INFINITE);
- get_ttyp ()->winsize = get_ttyp ()->arg.winsize;
- break;
- case TIOCSWINSZ:
- get_ttyp ()->ioctl_retval = -1;
- get_ttyp ()->arg.winsize = * (struct winsize *) arg;
- if (ioctl_request_event)
- SetEvent (ioctl_request_event);
- if (ioctl_done_event)
- WaitForSingleObject (ioctl_done_event, INFINITE);
- break;
- }
-
- release_output_mutex ();
-
-out:
- termios_printf ("%d = ioctl (%x)", get_ttyp ()->ioctl_retval, cmd);
- return get_ttyp ()->ioctl_retval;
-}
-
-/*******************************************************
- fhandler_pty_master
-*/
-fhandler_pty_master::fhandler_pty_master (DWORD devtype, int unit)
- : fhandler_tty_common (devtype, unit)
-{
-}
-
-int
-fhandler_pty_master::open (path_conv *, int flags, mode_t)
-{
- ttynum = cygwin_shared->tty.allocate_tty (0);
- if (ttynum < 0)
- return 0;
-
- cygwin_shared->tty[ttynum]->common_init (this);
- inuse = get_ttyp ()->create_inuse (TTY_MASTER_ALIVE);
- set_flags (flags & ~O_TEXT, O_BINARY);
- set_open_status ();
-
- termios_printf ("opened pty master tty%d<%p>", ttynum, this);
- return 1;
-}
-
-int
-fhandler_tty_common::close ()
-{
- if (output_done_event && !CloseHandle (output_done_event))
- termios_printf ("CloseHandle (output_done_event), %E");
- if (ioctl_done_event && !CloseHandle (ioctl_done_event))
- termios_printf ("CloseHandle (ioctl_done_event), %E");
- if (ioctl_request_event && !CloseHandle (ioctl_request_event))
- termios_printf ("CloseHandle (ioctl_request_event), %E");
- if (inuse && !CloseHandle (inuse))
- termios_printf ("CloseHandle (inuse), %E");
- if (!ForceCloseHandle (input_mutex))
- termios_printf ("CloseHandle (input_mutex<%p>), %E", input_mutex);
- if (!ForceCloseHandle (output_mutex))
- termios_printf ("CloseHandle (output_mutex<%p>), %E", output_mutex);
-
- /* Send EOF to slaves if master side is closed */
- if (!get_ttyp ()->master_alive ())
- {
- termios_printf ("no more masters left. sending EOF" );
- SetEvent (input_available_event);
- }
-
- if (!ForceCloseHandle (input_available_event))
- termios_printf ("CloseHandle (input_available_event<%p>), %E", input_available_event);
- if (!ForceCloseHandle1 (get_handle (), from_pty))
- termios_printf ("CloseHandle (get_handle ()<%p>), %E", get_handle ());
- if (!ForceCloseHandle1 (get_output_handle (), to_pty))
- termios_printf ("CloseHandle (get_output_handle ()<%p>), %E", get_output_handle ());
-
- inuse = NULL;
- termios_printf ("tty%d <%p,%p> closed", ttynum, get_handle (), get_output_handle ());
- return 0;
-}
-
-int
-fhandler_pty_master::close ()
-{
-#if 0
- while (accept_input () > 0)
- continue;
-#endif
- this->fhandler_tty_common::close ();
-
- if (!get_ttyp ()->master_alive ())
- {
- termios_printf ("freeing tty%d (%d)", ttynum, get_ttyp ()->ntty);
-#if 0
- if (get_ttyp ()->to_slave)
- ForceCloseHandle1 (get_ttyp ()->to_slave, to_slave);
- if (get_ttyp ()->from_slave)
- ForceCloseHandle1 (get_ttyp ()->from_slave, from_slave);
-#endif
- if (get_ttyp ()->from_master)
- CloseHandle (get_ttyp ()->from_master);
- if (get_ttyp ()->to_master)
- CloseHandle (get_ttyp ()->to_master);
- get_ttyp ()->init ();
- }
-
- return 0;
-}
-
-int
-fhandler_pty_master::write (const void *ptr, size_t len)
-{
- (void) line_edit ((char *) ptr, len);
- return len;
-}
-
-int __stdcall
-fhandler_pty_master::read (void *ptr, size_t len)
-{
- return process_slave_output ((char *) ptr, len, pktmode);
-}
-
-int
-fhandler_pty_master::tcgetattr (struct termios *t)
-{
- *t = cygwin_shared->tty[ttynum]->ti;
- return 0;
-}
-
-int
-fhandler_pty_master::tcsetattr (int, const struct termios *t)
-{
- cygwin_shared->tty[ttynum]->ti = *t;
- return 0;
-}
-
-int
-fhandler_pty_master::tcflush (int)
-{
- return 0;
-}
-
-int
-fhandler_pty_master::ioctl (unsigned int cmd, void *arg)
-{
- switch (cmd)
- {
- case TIOCPKT:
- pktmode = * (int *) arg;
- break;
- case TIOCGWINSZ:
- * (struct winsize *) arg = get_ttyp ()->winsize;
- break;
- case TIOCSWINSZ:
- get_ttyp ()->winsize = * (struct winsize *) arg;
- _kill (-get_ttyp ()->getpgid (), SIGWINCH);
- break;
- case FIONBIO:
- set_nonblocking (*(int *) arg);
- break;
- default:
- set_errno (EINVAL);
- return -1;
- }
- return 0;
-}
-
-char *
-fhandler_pty_master::ptsname (void)
-{
- static char buf[32];
-
- __small_sprintf (buf, "/dev/tty%d", ttynum);
- return buf;
-}
-
-void
-fhandler_tty_common::set_close_on_exec (int val)
-{
-#ifndef DEBUGGING
- this->fhandler_base::set_close_on_exec (val);
-#else
- /* FIXME: This is a duplication from fhandler_base::set_close_on_exec.
- It is here because we need to specify the "from_pty" stuff here or
- we'll get warnings from ForceCloseHandle when debugging. */
- set_inheritance (get_io_handle (), val);
- set_close_on_exec_flag (val);
-#endif
- if (output_done_event)
- set_inheritance (output_done_event, val);
- if (ioctl_request_event)
- set_inheritance (ioctl_request_event, val);
- if (ioctl_done_event)
- set_inheritance (ioctl_done_event, val);
- if (inuse)
- set_inheritance (inuse, val);
- set_inheritance (output_mutex, val);
- set_inheritance (input_mutex, val);
- set_inheritance (input_available_event, val);
- set_inheritance (output_handle, val);
-}
-
-void
-fhandler_tty_common::fixup_after_fork (HANDLE parent)
-{
- this->fhandler_termios::fixup_after_fork (parent);
- if (output_done_event)
- fork_fixup (parent, output_done_event, "output_done_event");
- if (ioctl_request_event)
- fork_fixup (parent, ioctl_request_event, "ioctl_request_event");
- if (ioctl_done_event)
- fork_fixup (parent, ioctl_done_event, "ioctl_done_event");
- if (output_mutex)
- fork_fixup (parent, output_mutex, "output_mutex");
- if (input_mutex)
- fork_fixup (parent, input_mutex, "input_mutex");
- if (input_available_event)
- fork_fixup (parent, input_available_event, "input_available_event");
- fork_fixup (parent, inuse, "inuse");
-}
-
-void
-fhandler_pty_master::set_close_on_exec (int val)
-{
- this->fhandler_tty_common::set_close_on_exec (val);
-
- /* FIXME: There is a console handle leak here. */
- if (get_ttyp ()->master_pid == GetCurrentProcessId ())
- {
- get_ttyp ()->from_slave = get_handle ();
- get_ttyp ()->to_slave = get_output_handle ();
- termios_printf ("from_slave %p, to_slave %p", get_handle (),
- get_output_handle ());
- }
-}
-
-void
-fhandler_tty_master::fixup_after_fork (HANDLE child)
-{
- this->fhandler_pty_master::fixup_after_fork (child);
- console->fixup_after_fork (child);
-}
-
-void
-fhandler_tty_master::fixup_after_exec (HANDLE)
-{
- console->close ();
- init_console ();
- return;
-}
-
-int
-fhandler_tty_master::init_console ()
-{
- console = (fhandler_console *) cygheap->fdtab.build_fhandler (-1, FH_CONSOLE, "/dev/ttym");
- if (console == NULL)
- return -1;
-
- console->init (INVALID_HANDLE_VALUE, GENERIC_READ | GENERIC_WRITE, O_BINARY);
- console->set_r_no_interrupt (1);
- return 0;
-}
diff --git a/winsup/cygwin/fhandler_virtual.cc b/winsup/cygwin/fhandler_virtual.cc
deleted file mode 100644
index a05543426..000000000
--- a/winsup/cygwin/fhandler_virtual.cc
+++ /dev/null
@@ -1,226 +0,0 @@
-/* fhandler_virtual.cc: base fhandler class for virtual filesystems
-
- Copyright 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. */
-
-#include "winsup.h"
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/cygwin.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "shared_info.h"
-#include "cygheap.h"
-#include <assert.h>
-
-#define _COMPILING_NEWLIB
-#include <dirent.h>
-
-fhandler_virtual::fhandler_virtual (DWORD devtype):
- fhandler_base (devtype), filebuf (NULL), bufalloc ((size_t) -1),
- fileid (-1)
-{
-}
-
-fhandler_virtual::~fhandler_virtual ()
-{
- if (filebuf)
- cfree (filebuf);
- filebuf = NULL;
-}
-
-DIR *
-fhandler_virtual::opendir (path_conv& pc)
-{
- DIR *dir;
- DIR *res = NULL;
- size_t len;
-
- if (exists () <= 0)
- set_errno (ENOTDIR);
- else if ((len = strlen (get_name ())) > MAX_PATH - 3)
- set_errno (ENAMETOOLONG);
- else if ((dir = (DIR *) malloc (sizeof (DIR))) == NULL)
- set_errno (ENOMEM);
- else if ((dir->__d_dirname = (char *) malloc (len + 3)) == NULL)
- {
- free (dir);
- set_errno (ENOMEM);
- }
- else if ((dir->__d_dirent =
- (struct dirent *) malloc (sizeof (struct dirent))) == NULL)
- {
- free (dir);
- set_errno (ENOMEM);
- }
- else
- {
- strcpy (dir->__d_dirname, get_name ());
- dir->__d_dirent->d_version = __DIRENT_VERSION;
- cygheap_fdnew fd;
- fd = this;
- fd->set_nohandle (true);
- dir->__d_dirent->d_fd = fd;
- dir->__d_u.__d_data.__fh = this;
- dir->__d_cookie = __DIRENT_COOKIE;
- dir->__d_u.__d_data.__handle = INVALID_HANDLE_VALUE;
- dir->__d_position = 0;
- dir->__d_dirhash = get_namehash ();
-
- res = dir;
- }
-
- syscall_printf ("%p = opendir (%s)", res, get_name ());
- return res;
-}
-
-__off64_t fhandler_virtual::telldir (DIR * dir)
-{
- return dir->__d_position;
-}
-
-void
-fhandler_virtual::seekdir (DIR * dir, __off64_t loc)
-{
- dir->__d_position = loc;
- return;
-}
-
-void
-fhandler_virtual::rewinddir (DIR * dir)
-{
- dir->__d_position = 0;
- return;
-}
-
-int
-fhandler_virtual::closedir (DIR * dir)
-{
- return 0;
-}
-
-__off64_t
-fhandler_virtual::lseek (__off64_t offset, int whence)
-{
- /*
- * On Linux, when you lseek within a /proc file,
- * the contents of the file are updated.
- */
- fill_filebuf ();
- switch (whence)
- {
- case SEEK_SET:
- position = offset;
- break;
- case SEEK_CUR:
- position += offset;
- break;
- case SEEK_END:
- position = filesize + offset;
- break;
- default:
- set_errno (EINVAL);
- return (__off64_t) -1;
- }
- return position;
-}
-
-int
-fhandler_virtual::dup (fhandler_base * child)
-{
- int ret = fhandler_base::dup (child);
-
- if (!ret)
- {
- fhandler_virtual *fhproc_child = (fhandler_virtual *) child;
- fhproc_child->filebuf = (char *) cmalloc (HEAP_BUF, filesize);
- fhproc_child->bufalloc = fhproc_child->filesize = filesize;
- fhproc_child->position = position;
- memcpy (fhproc_child->filebuf, filebuf, filesize);
- fhproc_child->set_flags (get_flags ());
- }
- return ret;
-}
-
-int
-fhandler_virtual::close ()
-{
- if (filebuf)
- cfree (filebuf);
- filebuf = NULL;
- bufalloc = (size_t) -1;
- cygwin_shared->delqueue.process_queue ();
- return 0;
-}
-
-int
-fhandler_virtual::read (void *ptr, size_t len)
-{
- if (len == 0)
- return 0;
- if (openflags & O_DIROPEN)
- {
- set_errno (EISDIR);
- return -1;
- }
- if (!filebuf)
- return 0;
- int read = len;
- if (read > filesize - position)
- read = filesize - position;
- if (read < 0)
- read = 0;
- else
- memcpy (ptr, filebuf + position, read);
- position += read;
- return read;
-}
-
-int
-fhandler_virtual::write (const void *ptr, size_t len)
-{
- set_errno (EACCES);
- return -1;
-}
-
-/* low-level open for all proc files */
-int
-fhandler_virtual::open (path_conv *, int flags, mode_t mode)
-{
- set_r_binary (1);
- set_w_binary (1);
-
- set_has_acls (false);
- set_isremote (false);
-
- /* what to do about symlinks? */
- set_symlink_p (false);
- set_execable_p (not_executable);
- set_socket_p (false);
-
- set_flags (flags & ~O_TEXT, O_BINARY);
-
- set_nohandle (true);
-
- return 1;
-}
-
-int
-fhandler_virtual::exists ()
-{
- return 0;
-}
-
-void
-fhandler_virtual::fill_filebuf ()
-{
-}
diff --git a/winsup/cygwin/fhandler_windows.cc b/winsup/cygwin/fhandler_windows.cc
deleted file mode 100644
index 591f2c704..000000000
--- a/winsup/cygwin/fhandler_windows.cc
+++ /dev/null
@@ -1,148 +0,0 @@
-/* fhandler_windows.cc: code to access windows message queues.
-
- Copyright 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-
- Written by Sergey S. Okhapkin (sos@prospect.com.ru).
- Feedback and testing by Andy Piper (andyp@parallax.co.uk).
-
-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 "winsup.h"
-#include <errno.h>
-#include <wingdi.h>
-#include <winuser.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-
-/*
-The following unix-style calls are supported:
-
- open ("/dev/windows", flags, mode=0)
- - create a unix fd for message queue.
- O_NONBLOCK flag controls the read() call behavior.
-
- read (fd, buf, len)
- - return next message from queue. buf must point to MSG
- structure, len must be >= sizeof (MSG). If read is set to
- non-blocking and the queue is empty, read call returns -1
- immediately with errno set to EAGAIN, otherwise it blocks
- untill the message will be received.
-
- write (fd, buf, len)
- - send a message pointed by buf. len argument ignored.
-
- ioctl (fd, command, *param)
- - control read()/write() behavior.
- ioctl (fd, WINDOWS_POST, NULL): write() will PostMessage();
- ioctl (fd, WINDOWS_SEND, NULL): write() will SendMessage();
- ioctl (fd, WINDOWS_HWND, &hWnd): read() messages for
- hWnd window.
-
- select () call marks read fd when any message posted to queue.
-*/
-
-fhandler_windows::fhandler_windows ()
- : fhandler_base (FH_WINDOWS), hWnd_ (NULL), method_ (WINDOWS_POST)
-{
-}
-
-int
-fhandler_windows::open (path_conv *, int flags, mode_t)
-{
- set_flags (flags & ~O_TEXT, O_BINARY);
- set_close_on_exec_flag (1);
- set_open_status ();
- return 1;
-}
-
-int
-fhandler_windows::write (const void *buf, size_t)
-{
- MSG *ptr = (MSG *) buf;
-
- if (method_ == WINDOWS_POST)
- {
- if (!PostMessage (ptr->hwnd, ptr->message, ptr->wParam, ptr->lParam))
- {
- __seterrno ();
- return -1;
- }
- else
- return sizeof (MSG);
- }
- else
- return SendMessage (ptr->hwnd, ptr->message, ptr->wParam, ptr->lParam);
-}
-
-int __stdcall
-fhandler_windows::read (void *buf, size_t len)
-{
- MSG *ptr = (MSG *) buf;
- int ret;
-
- if (len < sizeof (MSG))
- {
- set_errno (EINVAL);
- return -1;
- }
-
- ret = GetMessage (ptr, hWnd_, 0, 0);
-
- if (ret == -1)
- {
- __seterrno ();
- }
- set_errno (0);
- return ret;
-}
-
-int
-fhandler_windows::ioctl (unsigned int cmd, void *val)
-{
- switch (cmd)
- {
- case WINDOWS_POST:
- case WINDOWS_SEND:
- method_ = cmd;
- break;
- case WINDOWS_HWND:
- if (val == NULL)
- {
- set_errno (EINVAL);
- return -1;
- }
- hWnd_ = * ((HWND *) val);
- break;
- default:
- set_errno (EINVAL);
- return -1;
- }
- return 0;
-}
-
-void
-fhandler_windows::set_close_on_exec (int val)
-{
- if (get_handle ())
- this->fhandler_base::set_close_on_exec (val);
- else
- this->fhandler_base::set_close_on_exec_flag (val);
- void *h = hWnd_;
- if (h)
- set_inheritance (h, val);
-}
-
-void
-fhandler_windows::fixup_after_fork (HANDLE parent)
-{
- if (get_handle ())
- this->fhandler_base::fixup_after_fork (parent);
- void *h = hWnd_;
- if (h)
- fork_fixup (parent, h, "hWnd_");
-}
diff --git a/winsup/cygwin/fhandler_zero.cc b/winsup/cygwin/fhandler_zero.cc
deleted file mode 100644
index ff8271344..000000000
--- a/winsup/cygwin/fhandler_zero.cc
+++ /dev/null
@@ -1,60 +0,0 @@
-/* fhandler_dev_zero.cc: code to access /dev/zero
-
- Copyright 2000, 2001, 2002 Red Hat, Inc.
-
- Written by DJ Delorie (dj@cygnus.com)
-
-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 "winsup.h"
-#include <errno.h>
-#include "security.h"
-#include "fhandler.h"
-
-fhandler_dev_zero::fhandler_dev_zero ()
- : fhandler_base (FH_ZERO)
-{
-}
-
-int
-fhandler_dev_zero::open (path_conv *, int flags, mode_t)
-{
- set_flags (flags & ~O_TEXT, O_BINARY);
- set_open_status ();
- return 1;
-}
-
-int
-fhandler_dev_zero::write (const void *, size_t len)
-{
- return len;
-}
-
-int __stdcall
-fhandler_dev_zero::read (void *ptr, size_t len)
-{
- memset(ptr, 0, len);
- return len;
-}
-
-__off64_t
-fhandler_dev_zero::lseek (__off64_t, int)
-{
- return 0;
-}
-
-int
-fhandler_dev_zero::close (void)
-{
- return 0;
-}
-
-void
-fhandler_dev_zero::dump ()
-{
- paranoid_printf("here, fhandler_dev_zero");
-}
diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc
deleted file mode 100644
index ff464f038..000000000
--- a/winsup/cygwin/fork.cc
+++ /dev/null
@@ -1,753 +0,0 @@
-/* fork.cc
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <errno.h>
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygerrno.h"
-#include "sigproc.h"
-#include "pinfo.h"
-#include "cygheap.h"
-#include "child_info.h"
-#define NEED_VFORK
-#include "perthread.h"
-#include "perprocess.h"
-#include "dll_init.h"
-
-#ifdef DEBUGGING
-static int npid;
-static int npid_max;
-static pid_t fork_pids[100];
-#endif
-
-/* Timeout to wait for child to start, parent to init child, etc. */
-/* FIXME: Once things stabilize, bump up to a few minutes. */
-#define FORK_WAIT_TIMEOUT (300 * 1000) /* 300 seconds */
-
-#define dll_data_start &_data_start__
-#define dll_data_end &_data_end__
-#define dll_bss_start &_bss_start__
-#define dll_bss_end &_bss_end__
-
-void
-per_thread::set (void *s)
-{
- if (s == PER_THREAD_FORK_CLEAR)
- {
- tls = TlsAlloc ();
- s = NULL;
- }
- TlsSetValue (get_tls (), s);
-}
-
-static void
-stack_base (child_info_fork &ch)
-{
- MEMORY_BASIC_INFORMATION m;
- memset (&m, 0, sizeof m);
- if (!VirtualQuery ((LPCVOID) &m, &m, sizeof m))
- system_printf ("couldn't get memory info, %E");
-
- ch.stacktop = m.AllocationBase;
- ch.stackbottom = (LPBYTE) m.BaseAddress + m.RegionSize;
- ch.stacksize = (DWORD) ch.stackbottom - (DWORD) &m;
- debug_printf ("bottom %p, top %p, stack %p, size %d, reserve %d",
- ch.stackbottom, ch.stacktop, &m, ch.stacksize,
- (DWORD) ch.stackbottom - (DWORD) ch.stacktop);
-}
-
-/* Copy memory from parent to child.
- The result is a boolean indicating success. */
-
-static int
-fork_copy (PROCESS_INFORMATION &pi, const char *what, ...)
-{
- va_list args;
- char *low;
- int pass = 0;
-
- va_start (args, what);
-
- while ((low = va_arg (args, char *)))
- {
- char *high = va_arg (args, char *);
- DWORD todo = wincap.chunksize () ?: high - low;
- char *here;
-
- for (here = low; here < high; here += todo)
- {
- DWORD done = 0;
- if (here + todo > high)
- todo = high - here;
- int res = WriteProcessMemory (pi.hProcess, here, here, todo, &done);
- debug_printf ("child handle %p, low %p, high %p, res %d", pi.hProcess,
- low, high, res);
- if (!res || todo != done)
- {
- if (!res)
- __seterrno ();
- /* If this happens then there is a bug in our fork
- implementation somewhere. */
- system_printf ("%s pass %d failed, %p..%p, done %d, windows pid %u, %E",
- what, pass, low, high, done, pi.dwProcessId);
- goto err;
- }
- }
-
- pass++;
- }
-
- debug_printf ("done");
- return 1;
-
- err:
- TerminateProcess (pi.hProcess, 1);
- set_errno (EAGAIN);
- return 0;
-}
-
-/* Wait for child to finish what it's doing and signal us.
- We don't want to wait forever here.If there's a problem somewhere
- it'll hang the entire system (since all forks are mutex'd). If we
- time out, set errno = EAGAIN and hope the app tries again. */
-static int
-sync_with_child (PROCESS_INFORMATION &pi, HANDLE subproc_ready,
- BOOL hang_child, const char *s)
-{
- /* We also add the child process handle to the wait. If the child fails
- to initialize (eg. because of a missing dll). Then this
- handle will become signalled. This stops a *looong* timeout wait.
- */
- HANDLE w4[2];
-
- debug_printf ("waiting for child. reason: %s, hang_child %d", s,
- hang_child);
- w4[1] = pi.hProcess;
- w4[0] = subproc_ready;
- DWORD rc = WaitForMultipleObjects (2, w4, FALSE, FORK_WAIT_TIMEOUT);
-
- if (rc == WAIT_OBJECT_0 ||
- WaitForSingleObject (subproc_ready, 0) == WAIT_OBJECT_0)
- /* That's ok */;
- else if (rc == WAIT_FAILED || rc == WAIT_TIMEOUT)
- {
- if (rc != WAIT_FAILED)
- system_printf ("WaitForMultipleObjects timed out");
- else
- system_printf ("WaitForMultipleObjects failed, %E");
- set_errno (EAGAIN);
- syscall_printf ("-1 = fork(), WaitForMultipleObjects failed");
- TerminateProcess (pi.hProcess, 1);
- return 0;
- }
- else
- {
- /* Child died. Clean up and exit. */
- DWORD errcode;
- GetExitCodeProcess (pi.hProcess, &errcode);
- /* Fix me. This is not enough. The fork should not be considered
- * to have failed if the process was essentially killed by a signal.
- */
- if (errcode != STATUS_CONTROL_C_EXIT)
- {
- system_printf ("child %d(%p) died before initialization with status code %p",
- pi.dwProcessId, pi.hProcess, errcode);
- system_printf ("*** child state %s", s);
-#ifdef DEBUGGING
- abort ();
-#endif
- }
- set_errno (EAGAIN);
- syscall_printf ("Child died before subproc_ready signalled");
- return 0;
- }
-
- debug_printf ("child signalled me");
- return 1;
-}
-
-static int
-resume_child (PROCESS_INFORMATION &pi, HANDLE forker_finished)
-{
- SetEvent (forker_finished);
- debug_printf ("signalled child");
- return 1;
-}
-
-/* Notify parent that it is time for the next step.
- Note that this has to be a macro since the parent may be messing with
- our stack. */
-static void __stdcall
-sync_with_parent(const char *s, bool hang_self)
-{
- debug_printf ("signalling parent: %s", s);
- /* Tell our parent we're waiting. */
- if (!SetEvent (child_proc_info->subproc_ready))
- api_fatal ("fork child - SetEvent for %s failed, %E", s);
- if (hang_self)
- {
- HANDLE h = child_proc_info->forker_finished;
- /* Wait for the parent to fill in our stack and heap.
- Don't wait forever here. If our parent dies we don't want to clog
- the system. If the wait fails, we really can't continue so exit. */
- DWORD psync_rc = WaitForSingleObject (h, FORK_WAIT_TIMEOUT);
- debug_printf ("awake");
- switch (psync_rc)
- {
- case WAIT_TIMEOUT:
- api_fatal ("WFSO timed out for %s", s);
- break;
- case WAIT_FAILED:
- if (GetLastError () == ERROR_INVALID_HANDLE &&
- WaitForSingleObject (child_proc_info->forker_finished, 1) != WAIT_FAILED)
- break;
- api_fatal ("WFSO failed for %s, fork_finished %p, %E", s,
- child_proc_info->forker_finished);
- break;
- default:
- debug_printf ("no problems");
- break;
- }
- }
-}
-
-static int __stdcall
-fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls)
-{
- debug_printf ("child is running. pid %d, ppid %d, stack here %p",
- myself->pid, myself->ppid, __builtin_frame_address (0));
-
- /* Restore the inheritance state as in parent
- Don't call setuid here! The flags are already set. */
- if (cygheap->user.impersonated)
- {
- debug_printf ("Impersonation of child, token: %d", cygheap->user.token);
- if (cygheap->user.token == INVALID_HANDLE_VALUE)
- RevertToSelf (); // probably not needed
- else if (!ImpersonateLoggedOnUser (cygheap->user.token))
- system_printf ("Impersonate for forked child failed: %E");
- }
-
- sync_with_parent ("after longjmp.", TRUE);
- ProtectHandle (hParent);
- sigproc_printf ("hParent %p, child 1 first_dll %p, load_dlls %d\n", hParent,
- first_dll, load_dlls);
-
-#ifdef DEBUGGING
- char c;
- if (GetEnvironmentVariable ("FORKDEBUG", &c, 1))
- try_to_debug ();
- char buf[80];
- /* This is useful for debugging fork problems. Use gdb to attach to
- the pid reported here. */
- if (GetEnvironmentVariable ("CYGWIN_FORK_SLEEP", buf, sizeof (buf)))
- {
- small_printf ("Sleeping %d after fork, pid %u\n", atoi (buf), GetCurrentProcessId ());
- Sleep (atoi(buf));
- }
-#endif
-
- /* If we've played with the stack, stacksize != 0. That means that
- fork() was invoked from other than the main thread. Make sure that
- when the "main" thread exits it calls do_exit, like a normal process.
- Exit with a status code of 0. */
- if (child_proc_info->stacksize)
- {
- ((DWORD *)child_proc_info->stackbottom)[-17] = (DWORD)do_exit;
- ((DWORD *)child_proc_info->stackbottom)[-15] = (DWORD)0;
- }
-
- set_file_api_mode (current_codepage);
-
- MALLOC_CHECK;
-
- debug_fixup_after_fork ();
- pinfo_fixup_after_fork ();
- cygheap->fdtab.fixup_after_fork (hParent);
- signal_fixup_after_fork ();
-
- MALLOC_CHECK;
-
- if (fixup_mmaps_after_fork (hParent))
- api_fatal ("recreate_mmaps_after_fork_failed");
-
- /* If we haven't dynamically loaded any dlls, just signal
- the parent. Otherwise, load all the dlls, tell the parent
- that we're done, and wait for the parent to fill in the.
- loaded dlls' data/bss. */
- if (!load_dlls)
- sync_with_parent ("performed fork fixup.", FALSE);
- else
- {
- dlls.load_after_fork (hParent, first_dll);
- sync_with_parent ("loaded dlls", TRUE);
- }
-
- ForceCloseHandle (hParent);
- (void) ForceCloseHandle (child_proc_info->subproc_ready);
- (void) ForceCloseHandle (child_proc_info->forker_finished);
-
- if (fixup_shms_after_fork ())
- api_fatal ("recreate_shm areas after fork failed");
-
- /* Set thread local stuff to zero. Under Windows 95/98 this is sometimes
- non-zero, for some reason.
- FIXME: There is a memory leak here after a fork. */
- for (per_thread **t = threadstuff; *t; t++)
- if ((*t)->clear_on_fork ())
- (*t)->set ();
-
- user_data->threadinterface->fixup_after_fork ();
-
- /* Initialize signal/process handling */
- sigproc_init ();
- __pthread_atforkchild ();
- cygbench ("fork-child");
- return 0;
-}
-
-static void
-slow_pid_reuse (HANDLE h)
-{
- static NO_COPY HANDLE last_fork_procs[8] = {0};
- static NO_COPY unsigned nfork_procs = 0;
-
- if (nfork_procs >= (sizeof (last_fork_procs) / sizeof (last_fork_procs [0])))
- nfork_procs = 0;
- /* Keep a list of handles to forked processes sitting around to prevent
- Windows from reusing the same pid n times in a row. Having the same pids
- close in succesion confuses bash. Keeping a handle open will stop
- windows from reusing the same pid. */
- if (last_fork_procs[nfork_procs])
- ForceCloseHandle1 (last_fork_procs[nfork_procs], fork_stupidity);
- if (DuplicateHandle (hMainProc, h, hMainProc, &last_fork_procs[nfork_procs],
- 0, FALSE, DUPLICATE_SAME_ACCESS))
- ProtectHandle1 (last_fork_procs[nfork_procs], fork_stupidity);
- else
- {
- last_fork_procs[nfork_procs] = NULL;
- system_printf ("couldn't create last_fork_proc, %E");
- }
- nfork_procs++;
-}
-
-static int __stdcall
-fork_parent (HANDLE& hParent, dll *&first_dll,
- bool& load_dlls, void *stack_here, child_info_fork &ch)
-{
- HANDLE subproc_ready, forker_finished;
- DWORD rc;
- PROCESS_INFORMATION pi = {0, NULL, 0, 0};
-
- /* call the pthread_atfork prepare functions */
- __pthread_atforkprepare ();
-
- subproc_init ();
-
-#ifdef DEBUGGING_NOTNEEDED
- /* The ProtectHandle call allocates memory so we need to make sure
- that enough is set aside here so that the sbrk pointer does not
- move when ProtectHandle is called after the child is started.
- Otherwise the sbrk pointers in the parent will not agree with
- the child and when user_data is (regrettably) copied over,
- the user_data->ptr field will not be accurate. */
- free (malloc (4096));
-#endif
-
- int c_flags = GetPriorityClass (hMainProc) /*|
- CREATE_NEW_PROCESS_GROUP*/;
- STARTUPINFO si = {0, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL};
-
- /* If we don't have a console, then don't create a console for the
- child either. */
- HANDLE console_handle = CreateFileA ("CONOUT$", GENERIC_WRITE,
- FILE_SHARE_WRITE, &sec_none_nih,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
- NULL);
-
- if (console_handle != INVALID_HANDLE_VALUE && console_handle != 0)
- CloseHandle (console_handle);
- else
- c_flags |= DETACHED_PROCESS;
-
- /* Some file types (currently only sockets) need extra effort in the
- parent after CreateProcess and before copying the datastructures
- to the child. So we have to start the child in suspend state,
- unfortunately, to avoid a race condition. */
- if (cygheap->fdtab.need_fixup_before ())
- c_flags |= CREATE_SUSPENDED;
-
- /* Create an inheritable handle to pass to the child process. This will
- allow the child to duplicate handles from the parent to itself. */
- hParent = NULL;
- if (!DuplicateHandle (hMainProc, hMainProc, hMainProc, &hParent, 0, 1,
- DUPLICATE_SAME_ACCESS))
- {
- system_printf ("couldn't create handle to myself for child, %E");
- return -1;
- }
-
- /* Remember the address of the first loaded dll and decide
- if we need to load dlls. We do this here so that this
- information will be available in the parent and, when
- the stack is copied, in the child. */
- first_dll = dlls.start.next;
- load_dlls = dlls.reload_on_fork && dlls.loaded_dlls;
-
- /* This will help some of the confusion. */
- fflush (stdout);
-
- subproc_ready = CreateEvent (&sec_all, FALSE, FALSE, NULL);
- if (subproc_ready == NULL)
- {
- CloseHandle (hParent);
- system_printf ("unable to allocate subproc_ready event, %E");
- return -1;
- }
- forker_finished = CreateEvent (&sec_all, FALSE, FALSE, NULL);
- if (forker_finished == NULL)
- {
- CloseHandle (hParent);
- CloseHandle (subproc_ready);
- system_printf ("unable to allocate forker_finished event, %E");
- return -1;
- }
-
- ProtectHandle (subproc_ready);
- ProtectHandle (forker_finished);
-
- init_child_info (PROC_FORK, &ch, 1, subproc_ready);
-
- ch.forker_finished = forker_finished;
-
- stack_base (ch);
-
- si.cb = sizeof (STARTUPINFO);
- si.lpReserved2 = (LPBYTE)&ch;
- si.cbReserved2 = sizeof(ch);
-
- /* Remove impersonation */
- if (cygheap->user.impersonated && cygheap->user.token != INVALID_HANDLE_VALUE)
- RevertToSelf ();
-
- ch.parent = hParent;
-#ifdef DEBUGGING
- if (npid_max)
- {
- for (int pass = 0; pass < 2; pass++)
- {
- pid_t pid;
- while ((pid = fork_pids[npid++]))
- if (!pinfo (pid))
- {
- ch.cygpid = pid;
- goto out;
- }
- npid = 0;
- }
- }
- out:
-#endif
-
- char sa_buf[1024];
- PSECURITY_ATTRIBUTES sec_attribs = sec_user_nih (sa_buf);
- syscall_printf ("CreateProcess (%s, %s, 0, 0, 1, %x, 0, 0, %p, %p)",
- myself->progname, myself->progname, c_flags, &si, &pi);
- __malloc_lock (_reent_clib ());
- void *newheap;
- newheap = cygheap_setup_for_child (&ch,cygheap->fdtab.need_fixup_before ());
- rc = CreateProcess (myself->progname, /* image to run */
- myself->progname, /* what we send in arg0 */
- sec_attribs,
- sec_attribs,
- TRUE, /* inherit handles from parent */
- c_flags,
- NULL, /* environment filled in later */
- 0, /* use current drive/directory */
- &si,
- &pi);
-
- CloseHandle (hParent);
-
- if (!rc)
- {
- __seterrno ();
- syscall_printf ("CreateProcessA failed, %E");
- ForceCloseHandle(subproc_ready);
- ForceCloseHandle(forker_finished);
- /* Restore impersonation */
- if (cygheap->user.impersonated
- && cygheap->user.token != INVALID_HANDLE_VALUE)
- ImpersonateLoggedOnUser (cygheap->user.token);
- cygheap_setup_for_child_cleanup (newheap, &ch, 0);
- return -1;
- }
-
- /* Fixup the parent datastructure if needed and resume the child's
- main thread. */
- if (!cygheap->fdtab.need_fixup_before ())
- cygheap_setup_for_child_cleanup (newheap, &ch, 0);
- else
- {
- cygheap->fdtab.fixup_before_fork (pi.dwProcessId);
- cygheap_setup_for_child_cleanup (newheap, &ch, 1);
- ResumeThread (pi.hThread);
- }
-
-#ifdef DEBUGGING
- pinfo forked ((ch.cygpid != 1 ? ch.cygpid : cygwin_pid (pi.dwProcessId)), 1);
-#else
- pinfo forked (cygwin_pid (pi.dwProcessId), 1);
-#endif
-
- /* Initialize things that are done later in dll_crt0_1 that aren't done
- for the forkee. */
- strcpy(forked->progname, myself->progname);
-
- /* Restore impersonation */
- if (cygheap->user.impersonated && cygheap->user.token != INVALID_HANDLE_VALUE)
- ImpersonateLoggedOnUser (cygheap->user.token);
-
- ProtectHandle (pi.hThread);
- /* Protect the handle but name it similarly to the way it will
- be called in subproc handling. */
- ProtectHandle1 (pi.hProcess, childhProc);
-
- /* Fill in fields in the child's process table entry. */
- forked->hProcess = pi.hProcess;
- forked->dwProcessId = pi.dwProcessId;
- forked->copysigs(myself);
-
- /* Hopefully, this will succeed. The alternative to doing things this
- way is to reserve space prior to calling CreateProcess and then fill
- it in afterwards. This requires more bookkeeping than I like, though,
- so we'll just do it the easy way. So, terminate any child process if
- we can't actually record the pid in the internal table. */
- if (!forked.remember ())
- {
- TerminateProcess (pi.hProcess, 1);
- set_errno (EAGAIN);
- goto cleanup;
- }
-
- slow_pid_reuse (pi.hProcess);
-
- /* Wait for subproc to initialize itself. */
- if (!sync_with_child (pi, subproc_ready, TRUE, "waiting for longjmp"))
- goto cleanup;
-
- /* CHILD IS STOPPED */
- debug_printf ("child is alive (but stopped)");
-
- /* Initialize, in order: data, bss, heap, stack, dll data, dll bss
- Note: variables marked as NO_COPY will not be copied
- since they are placed in a protected segment. */
-
-
- MALLOC_CHECK;
- rc = fork_copy (pi, "user/cygwin data",
- user_data->data_start, user_data->data_end,
- user_data->bss_start, user_data->bss_end,
- cygheap->heapbase, cygheap->heapptr,
- stack_here, ch.stackbottom,
- dll_data_start, dll_data_end,
- dll_bss_start, dll_bss_end, NULL);
-
- __malloc_unlock (_reent_clib ());
- MALLOC_CHECK;
- if (!rc)
- goto cleanup;
-
- /* Now fill data/bss of any DLLs that were linked into the program. */
- for (dll *d = dlls.istart (DLL_LINK); d; d = dlls.inext ())
- {
- debug_printf ("copying data/bss of a linked dll");
- if (!fork_copy (pi, "linked dll data/bss", d->p.data_start, d->p.data_end,
- d->p.bss_start, d->p.bss_end,
- NULL))
- goto cleanup;
- }
-
- /* Start thread, and wait for it to reload dlls. */
- if (!resume_child (pi, forker_finished) ||
- !sync_with_child (pi, subproc_ready, load_dlls, "child loading dlls"))
- goto cleanup;
-
- /* If DLLs were loaded in the parent, then the child has reloaded all
- of them and is now waiting to have all of the individual data and
- bss sections filled in. */
- if (load_dlls)
- {
- /* CHILD IS STOPPED */
- /* write memory of reloaded dlls */
- for (dll *d = dlls.istart (DLL_LOAD); d; d = dlls.inext ())
- {
- debug_printf ("copying data/bss for a loaded dll");
- if (!fork_copy (pi, "loaded dll data/bss", d->p.data_start, d->p.data_end,
- d->p.bss_start, d->p.bss_end,
- NULL))
- goto cleanup;
- }
- /* Start the child up again. */
- (void) resume_child (pi, forker_finished);
- }
-
- ForceCloseHandle (subproc_ready);
- ForceCloseHandle (pi.hThread);
- ForceCloseHandle (forker_finished);
- forker_finished = NULL;
- pi.hThread = NULL;
- __pthread_atforkparent ();
-
- return forked->pid;
-
-/* Common cleanup code for failure cases */
- cleanup:
- /* Remember to de-allocate the fd table. */
- if (pi.hProcess)
- ForceCloseHandle1 (pi.hProcess, childhProc);
- if (pi.hThread)
- ForceCloseHandle (pi.hThread);
- if (subproc_ready)
- ForceCloseHandle (subproc_ready);
- if (forker_finished)
- ForceCloseHandle (forker_finished);
- return -1;
-}
-
-extern "C" int
-fork ()
-{
- struct
- {
- HANDLE hParent;
- dll *first_dll;
- bool load_dlls;
- } grouped;
-
- MALLOC_CHECK;
- sigframe thisframe (mainthread);
-
- debug_printf ("entering");
- grouped.hParent = grouped.first_dll = NULL;
- grouped.load_dlls = 0;
-
- if (ISSTATE(myself, PID_SPLIT_HEAP))
- {
- system_printf ("The heap has been split, CYGWIN can't fork this process.");
- system_printf ("Increase the heap_chunk_size in the registry and try again.");
- set_errno (ENOMEM);
- syscall_printf ("-1 = fork (), split heap");
- return -1;
- }
-
- void *esp;
- __asm__ volatile ("movl %%esp,%0": "=r" (esp));
-
- myself->set_has_pgid_children ();
-
- child_info_fork ch;
-
- int res = setjmp (ch.jmp);
-
- if (res)
- res = fork_child (grouped.hParent, grouped.first_dll, grouped.load_dlls);
- else
- res = fork_parent (grouped.hParent, grouped.first_dll, grouped.load_dlls, esp, ch);
-
- MALLOC_CHECK;
- syscall_printf ("%d = fork()", res);
- return res;
-}
-#ifdef DEBUGGING
-void
-fork_init ()
-{
- char buf[1024];
- if (!GetEnvironmentVariable ("CYGWIN_FORK_PIDS", buf, 1024))
- return;
- pid_t pid;
- char *p, *pe;
- for (p = buf; (pid = strtol (p, &pe, 10)); p = pe)
- fork_pids[npid_max++] = pid;
-}
-#endif /*DEBUGGING*/
-
-#ifdef NEWVFORK
-/* Dummy function to force second assignment below to actually be
- carried out */
-static vfork_save *
-get_vfork_val ()
-{
- return vfork_storage.val ();
-}
-#endif
-
-extern "C"
-int
-vfork ()
-{
-#ifndef NEWVFORK
- return fork ();
-#else
- sigframe thisframe;
- vfork_save *vf = get_vfork_val ();
- char **esp, **pp;
-
- if (vf == NULL)
- vf = vfork_storage.create ();
- else if (vf->pid)
- return fork ();
-
- if (!setjmp (vf->j))
- {
- vf->pid = -1;
- __asm__ volatile ("movl %%esp,%0": "=r" (vf->vfork_esp):);
- __asm__ volatile ("movl %%ebp,%0": "=r" (vf->vfork_ebp):);
- for (pp = (char **)vf->frame, esp = vf->vfork_esp;
- esp <= vf->vfork_ebp + 2; pp++, esp++)
- *pp = *esp;
- int res = cygheap->fdtab.vfork_child_dup () ? 0 : -1;
- debug_printf ("%d = vfork()", res);
- debug_printf ("exiting vfork, res %d", res);
- return res;
- }
-
- vf = get_vfork_val ();
-
- for (pp = (char **)vf->frame, esp = vf->vfork_esp;
- esp <= vf->vfork_ebp + 2; pp++, esp++)
- *esp = *pp;
-
- thisframe.init (mainthread);
- cygheap->fdtab.vfork_parent_restore ();
-
- if (vf->pid < 0)
- {
- int exitval = -vf->pid;
- vf->pid = 0;
- if ((vf->pid = fork ()) == 0)
- exit (exitval);
- }
-
- int pid = vf->pid;
- vf->pid = 0;
- debug_printf ("exiting vfork, pid %d", pid);
- sig_dispatch_pending ();
- return pid;
-#endif
-}
diff --git a/winsup/cygwin/gcrt0.c b/winsup/cygwin/gcrt0.c
deleted file mode 100644
index 19a941676..000000000
--- a/winsup/cygwin/gcrt0.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* gcrt0.c
-
- Copyright 1998, 1999, 2000, 2001 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 <sys/types.h>
-#include <stdlib.h>
-
-extern u_char etext asm ("etext");
-extern u_char eprol asm ("__eprol");
-extern void _mcleanup (void);
-extern void monstartup (u_long, u_long);
-
-void _monstartup (void) __attribute__((__constructor__));
-
-/* startup initialization for -pg support */
-
-void
-_monstartup (void)
-{
- static int called;
-
- /* Guard against multiple calls that may happen if DLLs are linked
- with profile option set as well. Addede side benefit is that it
- makes profiling backward compatible (GCC used to emit a call to
- _monstartup when compiling main with profiling enabled). */
- if (called++)
- return;
-
- monstartup ((u_long) &eprol, (u_long) &etext);
- atexit (&_mcleanup);
-}
-
-asm (".text");
-asm ("__eprol:");
-
diff --git a/winsup/cygwin/glob.c b/winsup/cygwin/glob.c
deleted file mode 100644
index 971b3092e..000000000
--- a/winsup/cygwin/glob.c
+++ /dev/null
@@ -1,956 +0,0 @@
-/* $NetBSD: __glob13.c,v 1.1.2.1 1997/10/22 06:41:27 thorpej Exp $ */
-
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Guido van Rossum.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-
-/*
- * glob(3) -- a superset of the one defined in POSIX 1003.2.
- *
- * The [!...] convention to negate a range is supported (SysV, Posix, ksh).
- *
- * Optional extra services, controlled by flags not defined by POSIX:
- *
- * GLOB_QUOTE:
- * Escaping convention: \ inhibits any special meaning the following
- * character might have (except \ at end of string is retained).
- * GLOB_MAGCHAR:
- * Set in gl_flags if pattern contained a globbing character.
- * GLOB_NOMAGIC:
- * Same as GLOB_NOCHECK, but it will only append pattern if it did
- * not contain any magic characters. [Used in csh style globbing]
- * GLOB_ALTDIRFUNC:
- * Use alternately specified directory access functions.
- * GLOB_TILDE:
- * expand ~user/foo to the /home/dir/of/user/foo
- * GLOB_BRACE:
- * expand {1,2}{a,b} to 1a 1b 2a 2b
- * gl_matchc:
- * Number of matches in the current invocation of glob.
- */
-
-#include "winsup.h"
-
-#include <sys/param.h>
-#include <sys/stat.h>
-
-#include <ctype.h>
-#include <dirent.h>
-#include <errno.h>
-#include <glob.h>
-
-#include <pwd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <windows.h>
-
-#ifdef __weak_alias
-#ifdef __LIBC12_SOURCE__
-__weak_alias(glob,_glob);
-__weak_alias(globfree,_globfree);
-#else
-#error "XXX THESE ARE NOT RIGHT!"
-__weak_alias(__glob13,___glob13);
-__weak_alias(__globfree13,___globfree13);
-#endif /* __LIBC12_SOURCE__ */
-#endif /* __weak_alias */
-
-#ifdef __LIBC12_SOURCE__
-#define STAT stat12
-#else
-#if defined (__INSIDE_CYGWIN__)
-#define STAT __stat64
-#else
-#define STAT stat
-#endif
-#endif
-
-#define DOLLAR '$'
-#define DOT '.'
-#define EOS '\0'
-#define LBRACKET '['
-#define NOT '!'
-#define QUESTION '?'
-#define QUOTE '\\'
-#define RANGE '-'
-#define RBRACKET ']'
-#define SEP '/'
-#define STAR '*'
-#define TILDE '~'
-#define UNDERSCORE '_'
-#define LBRACE '{'
-#define RBRACE '}'
-#define SLASH '/'
-#define COMMA ','
-
-#ifndef DEBUG
-
-#define M_QUOTE 0x8000
-#define M_PROTECT 0x4000
-#define M_MASK 0xffff
-#define M_ASCII 0x00ff
-
-typedef u_short Char;
-
-#else
-
-#define M_QUOTE 0x80
-#define M_PROTECT 0x40
-#define M_MASK 0xff
-#define M_ASCII 0x7f
-
-typedef char Char;
-
-#endif
-
-
-#define CHAR(c) ((Char)((c)&M_ASCII))
-#define META(c) ((Char)((c)|M_QUOTE))
-#define M_ALL META('*')
-#define M_END META(']')
-#define M_NOT META('!')
-#define M_ONE META('?')
-#define M_RNG META('-')
-#define M_SET META('[')
-#define ismeta(c) (((c)&M_QUOTE) != 0)
-
-
-static int compare __P((const void *, const void *));
-static void g_Ctoc __P((const Char *, char *));
-static int g_lstat __P((Char *, struct STAT *, glob_t *));
-static DIR *g_opendir __P((Char *, glob_t *));
-static Char *g_strchr __P((Char *, int));
-#ifdef notdef
-static Char *g_strcat __P((Char *, const Char *));
-#endif
-static int g_stat __P((Char *, struct STAT *, glob_t *));
-static int glob0 __P((const Char *, glob_t *));
-static int glob1 __P((Char *, glob_t *));
-static int glob2 __P((Char *, Char *, Char *, glob_t *));
-static int glob3 __P((Char *, Char *, Char *, Char *, glob_t *));
-static int globextend __P((const Char *, glob_t *));
-static const Char * globtilde __P((const Char *, Char *, glob_t *));
-static int globexp1 __P((const Char *, glob_t *));
-static int globexp2 __P((const Char *, const Char *, glob_t *, int *));
-static int match __P((Char *, Char *, Char *));
-#ifdef DEBUG
-static void qprintf __P((const char *, Char *));
-#endif
-
-#undef MAXPATHLEN
-#define MAXPATHLEN 16384
-
-extern BOOL ignore_case_with_glob;
-
-int
-glob(pattern, flags, errfunc, pglob)
- const char *pattern;
- int flags, (*errfunc) __P((const char *, int));
- glob_t *pglob;
-{
- const u_char *patnext;
- int c;
- Char *bufnext, *bufend, patbuf[MAXPATHLEN+1];
-
- patnext = (u_char *) pattern;
- if (!(flags & GLOB_APPEND)) {
- pglob->gl_pathc = 0;
- pglob->gl_pathv = NULL;
- if (!(flags & GLOB_DOOFFS))
- pglob->gl_offs = 0;
- }
- pglob->gl_flags = flags & ~GLOB_MAGCHAR;
- pglob->gl_errfunc = errfunc;
- pglob->gl_matchc = 0;
-
- bufnext = patbuf;
- bufend = bufnext + MAXPATHLEN;
- if (flags & GLOB_QUOTE) {
- /* Protect the quoted characters. */
- while (bufnext < bufend && (c = *patnext++) != EOS)
- if (c == QUOTE) {
- if ((c = *patnext++) == EOS) {
- c = QUOTE;
- --patnext;
- }
- *bufnext++ = c | M_PROTECT;
- }
- else
- *bufnext++ = c;
- }
- else
- while (bufnext < bufend && (c = *patnext++) != EOS)
- *bufnext++ = c;
- *bufnext = EOS;
-
- if (flags & GLOB_BRACE)
- return globexp1(patbuf, pglob);
- else
- return glob0(patbuf, pglob);
-}
-
-/*
- * Expand recursively a glob {} pattern. When there is no more expansion
- * invoke the standard globbing routine to glob the rest of the magic
- * characters
- */
-static int globexp1(pattern, pglob)
- const Char *pattern;
- glob_t *pglob;
-{
- const Char* ptr = pattern;
- int rv;
-
- /* Protect a single {}, for find(1), like csh */
- if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS)
- return glob0(pattern, pglob);
-
- while ((ptr = (const Char *) g_strchr((Char *) ptr, LBRACE)) != NULL)
- if (!globexp2(ptr, pattern, pglob, &rv))
- return rv;
-
- return glob0(pattern, pglob);
-}
-
-
-/*
- * Recursive brace globbing helper. Tries to expand a single brace.
- * If it succeeds then it invokes globexp1 with the new pattern.
- * If it fails then it tries to glob the rest of the pattern and returns.
- */
-static int globexp2(ptr, pattern, pglob, rv)
- const Char *ptr, *pattern;
- glob_t *pglob;
- int *rv;
-{
- int i;
- Char *lm, *ls;
- const Char *pe, *pm, *pl;
- Char patbuf[MAXPATHLEN + 1];
-
- /* copy part up to the brace */
- for (lm = patbuf, pm = pattern; pm != ptr; *lm++ = *pm++)
- continue;
- ls = lm;
-
- /* Find the balanced brace */
- for (i = 0, pe = ++ptr; *pe; pe++)
- if (*pe == LBRACKET) {
- /* Ignore everything between [] */
- for (pm = pe++; *pe != RBRACKET && *pe != EOS; pe++)
- continue;
- if (*pe == EOS) {
- /*
- * We could not find a matching RBRACKET.
- * Ignore and just look for RBRACE
- */
- pe = pm;
- }
- }
- else if (*pe == LBRACE)
- i++;
- else if (*pe == RBRACE) {
- if (i == 0)
- break;
- i--;
- }
-
- /* Non matching braces; just glob the pattern */
- if (i != 0 || *pe == EOS) {
- *rv = glob0(patbuf, pglob);
- return 0;
- }
-
- for (i = 0, pl = pm = ptr; pm <= pe; pm++)
- switch (*pm) {
- case LBRACKET:
- /* Ignore everything between [] */
- for (pl = pm++; *pm != RBRACKET && *pm != EOS; pm++)
- continue;
- if (*pm == EOS) {
- /*
- * We could not find a matching RBRACKET.
- * Ignore and just look for RBRACE
- */
- pm = pl;
- }
- break;
-
- case LBRACE:
- i++;
- break;
-
- case RBRACE:
- if (i) {
- i--;
- break;
- }
- /* FALLTHROUGH */
- case COMMA:
- if (i && *pm == COMMA)
- break;
- else {
- /* Append the current string */
- for (lm = ls; (pl < pm); *lm++ = *pl++)
- continue;
- /*
- * Append the rest of the pattern after the
- * closing brace
- */
- for (pl = pe + 1; (*lm++ = *pl++) != EOS;)
- continue;
-
- /* Expand the current pattern */
-#ifdef DEBUG
- qprintf("globexp2:", patbuf);
-#endif
- *rv = globexp1(patbuf, pglob);
-
- /* move after the comma, to the next string */
- pl = pm + 1;
- }
- break;
-
- default:
- break;
- }
- *rv = 0;
- return 0;
-}
-
-
-
-/*
- * expand tilde from the passwd file.
- */
-static const Char *
-globtilde(pattern, patbuf, pglob)
- const Char *pattern;
- Char *patbuf;
- glob_t *pglob;
-{
- struct passwd *pwd;
- char *h;
- const Char *p;
- Char *b;
-
- if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE))
- return pattern;
-
- /* Copy up to the end of the string or / */
- for (p = pattern + 1, h = (char *) patbuf; *p && *p != SLASH;
- *h++ = *p++)
- continue;
-
- *h = EOS;
-
- if (((char *) patbuf)[0] == EOS) {
- /*
- * handle a plain ~ or ~/ by expanding $HOME
- * first and then trying the password file
- */
- if ((h = getenv("HOME")) == NULL) {
- if ((pwd = getpwuid(getuid())) == NULL)
- return pattern;
- else
- h = pwd->pw_dir;
- }
- }
- else {
- /*
- * Expand a ~user
- */
- if ((pwd = getpwnam((char*) patbuf)) == NULL)
- return pattern;
- else
- h = pwd->pw_dir;
- }
-
- /* Copy the home directory */
- for (b = patbuf; *h; *b++ = *h++)
- continue;
-
- /* Append the rest of the pattern */
- while ((*b++ = *p++) != EOS)
- continue;
-
- return patbuf;
-}
-
-
-/*
- * The main glob() routine: compiles the pattern (optionally processing
- * quotes), calls glob1() to do the real pattern matching, and finally
- * sorts the list (unless unsorted operation is requested). Returns 0
- * if things went well, nonzero if errors occurred. It is not an error
- * to find no matches.
- */
-static int
-glob0(pattern, pglob)
- const Char *pattern;
- glob_t *pglob;
-{
- const Char *qpatnext;
- int c, err, oldpathc;
- Char *bufnext, patbuf[MAXPATHLEN+1];
-
- qpatnext = globtilde(pattern, patbuf, pglob);
- oldpathc = pglob->gl_pathc;
- bufnext = patbuf;
-
- /* We don't need to check for buffer overflow any more. */
- while ((c = *qpatnext++) != EOS) {
- switch (c) {
- case LBRACKET:
- c = *qpatnext;
- if (c == NOT)
- ++qpatnext;
- if (*qpatnext == EOS ||
- g_strchr((Char *) qpatnext+1, RBRACKET) == NULL) {
- *bufnext++ = LBRACKET;
- if (c == NOT)
- --qpatnext;
- break;
- }
- *bufnext++ = M_SET;
- if (c == NOT)
- *bufnext++ = M_NOT;
- c = *qpatnext++;
- do {
- *bufnext++ = CHAR(c);
- if (*qpatnext == RANGE &&
- (c = qpatnext[1]) != RBRACKET) {
- *bufnext++ = M_RNG;
- *bufnext++ = CHAR(c);
- qpatnext += 2;
- }
- } while ((c = *qpatnext++) != RBRACKET);
- pglob->gl_flags |= GLOB_MAGCHAR;
- *bufnext++ = M_END;
- break;
- case QUESTION:
- pglob->gl_flags |= GLOB_MAGCHAR;
- *bufnext++ = M_ONE;
- break;
- case STAR:
- pglob->gl_flags |= GLOB_MAGCHAR;
- /* collapse adjacent stars to one,
- * to avoid exponential behavior
- */
- if (bufnext == patbuf || bufnext[-1] != M_ALL)
- *bufnext++ = M_ALL;
- break;
- default:
- *bufnext++ = CHAR(c);
- break;
- }
- }
- *bufnext = EOS;
-#ifdef DEBUG
- qprintf("glob0:", patbuf);
-#endif
-
- if ((err = glob1(patbuf, pglob)) != 0)
- return(err);
-
- /*
- * If there was no match we are going to append the pattern
- * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified
- * and the pattern did not contain any magic characters
- * GLOB_NOMAGIC is there just for compatibility with csh.
- */
- if (pglob->gl_pathc == oldpathc &&
- ((pglob->gl_flags & GLOB_NOCHECK) ||
- ((pglob->gl_flags & GLOB_NOMAGIC) &&
- !(pglob->gl_flags & GLOB_MAGCHAR))))
- return(globextend(pattern, pglob));
- else if (!(pglob->gl_flags & GLOB_NOSORT))
- qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc,
- pglob->gl_pathc - oldpathc, sizeof(char *), compare);
- return(0);
-}
-
-static int
-compare(p, q)
- const void *p, *q;
-{
- return(strcmp(*(char **)p, *(char **)q));
-}
-
-static int
-glob1(pattern, pglob)
- Char *pattern;
- glob_t *pglob;
-{
- Char pathbuf[MAXPATHLEN+1];
-
- /* A null pathname is invalid -- POSIX 1003.1 sect. 2.4. */
- if (*pattern == EOS)
- return(0);
- return(glob2(pathbuf, pathbuf, pattern, pglob));
-}
-
-/*
- * The functions glob2 and glob3 are mutually recursive; there is one level
- * of recursion for each segment in the pattern that contains one or more
- * meta characters.
- */
-static int
-glob2(pathbuf, pathend, pattern, pglob)
- Char *pathbuf, *pathend, *pattern;
- glob_t *pglob;
-{
- struct STAT sb;
- Char *p, *q;
- int anymeta;
-
- /*
- * Loop over pattern segments until end of pattern or until
- * segment with meta character found.
- */
- for (anymeta = 0;;) {
- if (*pattern == EOS) { /* End of pattern? */
- *pathend = EOS;
- if (g_lstat(pathbuf, &sb, pglob))
- return(0);
-
- if (((pglob->gl_flags & GLOB_MARK) &&
- pathend[-1] != SEP) && (S_ISDIR(sb.st_mode)
- || (S_ISLNK(sb.st_mode) &&
- (g_stat(pathbuf, &sb, pglob) == 0) &&
- S_ISDIR(sb.st_mode)))) {
- *pathend++ = SEP;
- *pathend = EOS;
- }
- ++pglob->gl_matchc;
- return(globextend(pathbuf, pglob));
- }
-
- /* Find end of next segment, copy tentatively to pathend. */
- q = pathend;
- p = pattern;
- while (*p != EOS && *p != SEP) {
- if (ismeta(*p))
- anymeta = 1;
- *q++ = *p++;
- }
-
- if (!anymeta) { /* No expansion, do next segment. */
- pathend = q;
- pattern = p;
- while (*pattern == SEP)
- *pathend++ = *pattern++;
- } else /* Need expansion, recurse. */
- return(glob3(pathbuf, pathend, pattern, p, pglob));
- }
- /* NOTREACHED */
-}
-
-static int
-glob3(pathbuf, pathend, pattern, restpattern, pglob)
- Char *pathbuf, *pathend, *pattern, *restpattern;
- glob_t *pglob;
-{
- register struct dirent *dp;
- DIR *dirp;
- int err;
- char buf[MAXPATHLEN];
-
- /*
- * The readdirfunc declaration can't be prototyped, because it is
- * assigned, below, to two functions which are prototyped in glob.h
- * and dirent.h as taking pointers to differently typed opaque
- * structures.
- */
- struct dirent *(*readdirfunc) __P((void *));
-
- *pathend = EOS;
- errno = 0;
-
- if ((dirp = g_opendir(pathbuf, pglob)) == NULL) {
- /* TODO: don't call for ENOENT or ENOTDIR? */
- if (pglob->gl_errfunc) {
- g_Ctoc(pathbuf, buf);
- if (pglob->gl_errfunc(buf, errno) ||
- pglob->gl_flags & GLOB_ERR)
- return (GLOB_ABEND);
- }
- return(0);
- }
-
- err = 0;
-
- /* Search directory for matching names. */
- if (pglob->gl_flags & GLOB_ALTDIRFUNC)
- readdirfunc = pglob->gl_readdir;
- else
- readdirfunc = (struct dirent *(*)__P((void *))) readdir;
- while ((dp = (*readdirfunc)(dirp))) {
- register u_char *sc;
- register Char *dc;
-
- /* Initial DOT must be matched literally. */
- if (dp->d_name[0] == DOT && *pattern != DOT)
- continue;
- for (sc = (u_char *) dp->d_name, dc = pathend;
- (*dc++ = *sc++) != EOS;)
- continue;
- if (!match(pathend, pattern, restpattern)) {
- *pathend = EOS;
- continue;
- }
- err = glob2(pathbuf, --dc, restpattern, pglob);
- if (err)
- break;
- }
-
- if (pglob->gl_flags & GLOB_ALTDIRFUNC)
- (*pglob->gl_closedir)(dirp);
- else
- closedir(dirp);
- return(err);
-}
-
-
-/*
- * Extend the gl_pathv member of a glob_t structure to accommodate a new item,
- * add the new item, and update gl_pathc.
- *
- * This assumes the BSD realloc, which only copies the block when its size
- * crosses a power-of-two boundary; for v7 realloc, this would cause quadratic
- * behavior.
- *
- * Return 0 if new item added, error code if memory couldn't be allocated.
- *
- * Invariant of the glob_t structure:
- * Either gl_pathc is zero and gl_pathv is NULL; or gl_pathc > 0 and
- * gl_pathv points to (gl_offs + gl_pathc + 1) items.
- */
-static int
-globextend(path, pglob)
- const Char *path;
- glob_t *pglob;
-{
- register char **pathv;
- register int i;
- u_int newsize;
- char *copy;
- const Char *p;
-
- newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs);
- pathv = pglob->gl_pathv ?
- realloc((char *)pglob->gl_pathv, newsize) :
- malloc(newsize);
- if (pathv == NULL)
- return(GLOB_NOSPACE);
-
- if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {
- /* first time around -- clear initial gl_offs items */
- pathv += pglob->gl_offs;
- for (i = pglob->gl_offs; --i >= 0;)
- *--pathv = NULL;
- }
- pglob->gl_pathv = pathv;
-
- for (p = path; *p++;)
- continue;
- if ((copy = malloc(p - path)) != NULL) {
- g_Ctoc(path, copy);
- pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
- }
- pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
- return(copy == NULL ? GLOB_NOSPACE : 0);
-}
-
-
-/*
- * pattern matching function for filenames. Each occurrence of the *
- * pattern causes a recursion level.
- */
-static int
-match(name, pat, patend)
- register Char *name, *pat, *patend;
-{
- int ok, negate_range;
- Char c, k;
-
- while (pat < patend) {
- c = *pat++;
- switch (c & M_MASK) {
- case M_ALL:
- if (pat == patend)
- return(1);
- do
- if (match(name, pat, patend))
- return(1);
- while (*name++ != EOS);
- return(0);
- case M_ONE:
- if (*name++ == EOS)
- return(0);
- break;
- case M_SET:
- ok = 0;
- if ((k = *name++) == EOS)
- return(0);
- if ((negate_range = ((*pat & M_MASK) == M_NOT)) != EOS)
- ++pat;
- if (ignore_case_with_glob)
- {
- while (((c = *pat++) & M_MASK) != M_END)
- if ((*pat & M_MASK) == M_RNG) {
- if (tolower(c) <= tolower(k) && tolower(k) <= tolower(pat[1]))
- ok = 1;
- pat += 2;
- } else if (tolower(c) == tolower(k))
- ok = 1;
- }
- else
- {
- while (((c = *pat++) & M_MASK) != M_END)
- if ((*pat & M_MASK) == M_RNG) {
- if (c <= k && k <= pat[1])
- ok = 1;
- pat += 2;
- } else if (c == k)
- ok = 1;
- }
- if (ok == negate_range)
- return(0);
- break;
- default:
- if (ignore_case_with_glob)
- {
- if (tolower(*name) != tolower(c))
- return(0);
- ++name;
- }
- else
- {
- if (*name++ != c)
- return(0);
- }
- break;
- }
- }
- return(*name == EOS);
-}
-
-/* Free allocated data belonging to a glob_t structure. */
-void
-globfree(pglob)
- glob_t *pglob;
-{
- register int i;
- register char **pp;
-
- if (pglob->gl_pathv != NULL) {
- pp = pglob->gl_pathv + pglob->gl_offs;
- for (i = pglob->gl_pathc; i--; ++pp)
- if (*pp)
- free(*pp);
- free(pglob->gl_pathv);
- }
-}
-
-static DIR *
-g_opendir(str, pglob)
- register Char *str;
- glob_t *pglob;
-{
- char buf[MAXPATHLEN];
-
- if (!*str)
- strcpy(buf, ".");
- else
- g_Ctoc(str, buf);
-
- if (pglob->gl_flags & GLOB_ALTDIRFUNC)
- return((*pglob->gl_opendir)(buf));
-
- return(opendir(buf));
-}
-
-static void
-stat32_to_STAT (struct __stat32 *src, struct STAT *dst)
-{
- dst->st_dev = src->st_dev;
- dst->st_ino = src->st_ino;
- dst->st_mode = src->st_mode;
- dst->st_nlink = src->st_nlink;
- dst->st_uid = src->st_uid;
- dst->st_gid = src->st_gid;
- dst->st_rdev = src->st_rdev;
- dst->st_size = src->st_size;
- dst->st_atim = src->st_atim;
- dst->st_mtim = src->st_mtim;
- dst->st_ctim = src->st_ctim;
- dst->st_blksize = src->st_blksize;
- dst->st_blocks = src->st_blocks;
-}
-
-static int
-g_lstat(fn, sb, pglob)
- register Char *fn;
- struct STAT *sb;
- glob_t *pglob;
-{
- /* FIXME: This only works as long as the application uses the old
- struct stat with 32 bit off_t types!!!
-
- As soon as we switch over to 64 bit, we have to decide by
- the applications API minor version number, whether to use
- a pointer to a __stat64 or a _stat32 struct to the
- pglob->gl_lstat function. */
-#ifdef __CYGWIN_USE_BIG_TYPES__
-#error FIXME check apps API minor and use correct struct stat
-#endif
- char buf[MAXPATHLEN];
-
- g_Ctoc(fn, buf);
- if (pglob->gl_flags & GLOB_ALTDIRFUNC) {
- struct __stat32 lsb;
- int ret;
-
- if (!(ret = (*pglob->gl_lstat)(buf, &lsb)))
- stat32_to_STAT (&lsb, sb);
- return ret;
- }
-#ifdef __INSIDE_CYGWIN__
- return(lstat64(buf, sb));
-#else
- return(lstat(buf, sb));
-#endif
-}
-
-static int
-g_stat(fn, sb, pglob)
- register Char *fn;
- struct STAT *sb;
- glob_t *pglob;
-{
- /* FIXME: This only works as long as the application uses the old
- struct stat with 32 bit off_t types!!!
-
- As soon as we switch over to 64 bit, we have to decide by
- the applications API minor version number, whether to use
- a pointer to a __stat64 or a _stat32 struct to the
- pglob->gl_stat function. */
-#ifdef __CYGWIN_USE_BIG_TYPES__
-#error FIXME check apps API minor and use correct struct stat
-#endif
- char buf[MAXPATHLEN];
-
- g_Ctoc(fn, buf);
- if (pglob->gl_flags & GLOB_ALTDIRFUNC) {
- struct __stat32 lsb;
- int ret;
-
- if (!(ret = (*pglob->gl_stat)(buf, &lsb)))
- stat32_to_STAT (&lsb, sb);
- return ret;
- }
-#ifdef __INSIDE_CYGWIN__
- return(stat64(buf, sb));
-#else
- return(stat(buf, sb));
-#endif
-}
-
-static Char *
-g_strchr(str, ch)
- Char *str;
- int ch;
-{
- do {
- if (*str == ch)
- return (str);
- } while (*str++);
- return (NULL);
-}
-
-#ifdef notdef
-static Char *
-g_strcat(dst, src)
- Char *dst;
- const Char* src;
-{
- Char *sdst = dst;
-
- while (*dst++)
- continue;
- --dst;
- while((*dst++ = *src++) != EOS)
- continue;
-
- return (sdst);
-}
-#endif
-
-static void
-g_Ctoc(str, buf)
- register const Char *str;
- char *buf;
-{
- register char *dc;
-
- for (dc = buf; (*dc++ = *str++) != EOS;)
- continue;
-}
-
-#ifdef DEBUG
-static void
-qprintf(str, s)
- const char *str;
- register Char *s;
-{
- register Char *p;
-
- (void)printf("%s:\n", str);
- for (p = s; *p; p++)
- (void)printf("%c", CHAR(*p));
- (void)printf("\n");
- for (p = s; *p; p++)
- (void)printf("%c", *p & M_PROTECT ? '"' : ' ');
- (void)printf("\n");
- for (p = s; *p; p++)
- (void)printf("%c", ismeta(*p) ? '_' : ' ');
- (void)printf("\n");
-}
-#endif
diff --git a/winsup/cygwin/gmon.c b/winsup/cygwin/gmon.c
deleted file mode 100644
index 048ef0df1..000000000
--- a/winsup/cygwin/gmon.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/*-
- * Copyright (c) 1983, 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if !defined(lint) && defined(LIBC_SCCS)
-static char rcsid[] = "$OpenBSD: gmon.c,v 1.8 1997/07/23 21:11:27 kstailey Exp $";
-#endif
-
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <gmon.h>
-
-#include <profil.h>
-#include <windows.h>
-
-/* XXX needed? */
-//extern char *minbrk __asm ("minbrk");
-
-struct gmonparam _gmonparam = { GMON_PROF_OFF };
-
-static int s_scale;
-/* see profil(2) where this is describe (incorrectly) */
-#define SCALE_1_TO_1 0x10000L
-
-#define ERR(s) write(2, s, sizeof(s))
-
-void moncontrol __P((int));
-
-static void *
-fake_sbrk(int size)
-{
- void *rv = malloc(size);
- if (rv)
- return rv;
- else
- return (void *) -1;
-}
-
-void
-monstartup(lowpc, highpc)
- u_long lowpc;
- u_long highpc;
-{
- register int o;
- char *cp;
- struct gmonparam *p = &_gmonparam;
-
- /*
- * round lowpc and highpc to multiples of the density we're using
- * so the rest of the scaling (here and in gprof) stays in ints.
- */
- p->lowpc = ROUNDDOWN(lowpc, HISTFRACTION * sizeof(HISTCOUNTER));
- p->highpc = ROUNDUP(highpc, HISTFRACTION * sizeof(HISTCOUNTER));
- p->textsize = p->highpc - p->lowpc;
- p->kcountsize = p->textsize / HISTFRACTION;
- p->hashfraction = HASHFRACTION;
- p->fromssize = p->textsize / p->hashfraction;
- p->tolimit = p->textsize * ARCDENSITY / 100;
- if (p->tolimit < MINARCS)
- p->tolimit = MINARCS;
- else if (p->tolimit > MAXARCS)
- p->tolimit = MAXARCS;
- p->tossize = p->tolimit * sizeof(struct tostruct);
-
- cp = fake_sbrk(p->kcountsize + p->fromssize + p->tossize);
- if (cp == (char *)-1) {
- ERR("monstartup: out of memory\n");
- return;
- }
-#ifdef notdef
- bzero(cp, p->kcountsize + p->fromssize + p->tossize);
-#endif
- p->tos = (struct tostruct *)cp;
- cp += p->tossize;
- p->kcount = (u_short *)cp;
- cp += p->kcountsize;
- p->froms = (u_short *)cp;
-
- /* XXX minbrk needed? */
- //minbrk = fake_sbrk(0);
- p->tos[0].link = 0;
-
- o = p->highpc - p->lowpc;
- if (p->kcountsize < o) {
-#ifndef notdef
- s_scale = ((float)p->kcountsize / o ) * SCALE_1_TO_1;
-#else /* avoid floating point */
- int quot = o / p->kcountsize;
-
- if (quot >= 0x10000)
- s_scale = 1;
- else if (quot >= 0x100)
- s_scale = 0x10000 / quot;
- else if (o >= 0x800000)
- s_scale = 0x1000000 / (o / (p->kcountsize >> 8));
- else
- s_scale = 0x1000000 / ((o << 8) / p->kcountsize);
-#endif
- } else
- s_scale = SCALE_1_TO_1;
-
- moncontrol(1);
-}
-
-void
-_mcleanup()
-{
- int fd;
- int hz;
- int fromindex;
- int endfrom;
- u_long frompc;
- int toindex;
- struct rawarc rawarc;
- struct gmonparam *p = &_gmonparam;
- struct gmonhdr gmonhdr, *hdr;
- char *proffile;
-#ifdef DEBUG
- int log, len;
- char dbuf[200];
-#endif
-
- if (p->state == GMON_PROF_ERROR)
- ERR("_mcleanup: tos overflow\n");
-
- hz = PROF_HZ;
- moncontrol(0);
-
-#ifdef nope
- if ((profdir = getenv("PROFDIR")) != NULL) {
- extern char *__progname;
- char *s, *t, *limit;
- pid_t pid;
- long divisor;
-
- /* If PROFDIR contains a null value, no profiling
- output is produced */
- if (*profdir == '\0') {
- return;
- }
-
- limit = buf + sizeof buf - 1 - 10 - 1 -
- strlen(__progname) - 1;
- t = buf;
- s = profdir;
- while((*t = *s) != '\0' && t < limit) {
- t++;
- s++;
- }
- *t++ = '/';
-
- /*
- * Copy and convert pid from a pid_t to a string. For
- * best performance, divisor should be initialized to
- * the largest power of 10 less than PID_MAX.
- */
- pid = getpid();
- divisor=10000;
- while (divisor > pid) divisor /= 10; /* skip leading zeros */
- do {
- *t++ = (pid/divisor) + '0';
- pid %= divisor;
- } while (divisor /= 10);
- *t++ = '.';
-
- s = __progname;
- while ((*t++ = *s++) != '\0')
- ;
-
- proffile = buf;
- } else {
- proffile = "gmon.out";
- }
-#else
- {
- char gmon_out[] = "gmon.out";
- proffile = gmon_out;
- }
-#endif
-
- fd = open(proffile , O_CREAT|O_TRUNC|O_WRONLY|O_BINARY, 0666);
- if (fd < 0) {
- perror( proffile );
- return;
- }
-#ifdef DEBUG
- log = open("gmon.log", O_CREAT|O_TRUNC|O_WRONLY, 0664);
- if (log < 0) {
- perror("mcount: gmon.log");
- return;
- }
- len = sprintf(dbuf, "[mcleanup1] kcount 0x%x ssiz %d\n",
- p->kcount, p->kcountsize);
- write(log, dbuf, len);
-#endif
- hdr = (struct gmonhdr *)&gmonhdr;
- hdr->lpc = p->lowpc;
- hdr->hpc = p->highpc;
- hdr->ncnt = p->kcountsize + sizeof(gmonhdr);
- hdr->version = GMONVERSION;
- hdr->profrate = hz;
- write(fd, (char *)hdr, sizeof *hdr);
- write(fd, p->kcount, p->kcountsize);
- endfrom = p->fromssize / sizeof(*p->froms);
- for (fromindex = 0; fromindex < endfrom; fromindex++) {
- if (p->froms[fromindex] == 0)
- continue;
-
- frompc = p->lowpc;
- frompc += fromindex * p->hashfraction * sizeof(*p->froms);
- for (toindex = p->froms[fromindex]; toindex != 0;
- toindex = p->tos[toindex].link) {
-#ifdef DEBUG
- len = sprintf(dbuf,
- "[mcleanup2] frompc 0x%x selfpc 0x%x count %d\n" ,
- frompc, p->tos[toindex].selfpc,
- p->tos[toindex].count);
- write(log, dbuf, len);
-#endif
- rawarc.raw_frompc = frompc;
- rawarc.raw_selfpc = p->tos[toindex].selfpc;
- rawarc.raw_count = p->tos[toindex].count;
- write(fd, &rawarc, sizeof rawarc);
- }
- }
- close(fd);
-}
-
-/*
- * Control profiling
- * profiling is what mcount checks to see if
- * all the data structures are ready.
- */
-void
-moncontrol(mode)
- int mode;
-{
- struct gmonparam *p = &_gmonparam;
-
- if (mode) {
- /* start */
- profil((char *)p->kcount, p->kcountsize, p->lowpc,
- s_scale);
- p->state = GMON_PROF_ON;
- } else {
- /* stop */
- profil((char *)0, 0, 0, 0);
- p->state = GMON_PROF_OFF;
- }
-}
-
-
diff --git a/winsup/cygwin/gmon.h b/winsup/cygwin/gmon.h
deleted file mode 100644
index be016791e..000000000
--- a/winsup/cygwin/gmon.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/* $OpenBSD: gmon.h,v 1.3 1996/04/21 22:31:46 deraadt Exp $ */
-/* $NetBSD: gmon.h,v 1.5 1996/04/09 20:55:30 cgd Exp $ */
-
-/*-
- * Copyright (c) 1982, 1986, 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)gmon.h 8.2 (Berkeley) 1/4/94
- */
-
-#ifndef _SYS_GMON_H_
-#define _SYS_GMON_H_
-
-#ifndef __P
-#define __P(x) x
-#endif
-
-#include <profile.h>
-
-/*
- * Structure prepended to gmon.out profiling data file.
- */
-struct gmonhdr {
- u_long lpc; /* base pc address of sample buffer */
- u_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
-
-/*
- * histogram counters are unsigned shorts (according to the kernel).
- */
-#define HISTCOUNTER unsigned short
-
-/*
- * fraction of text space to allocate for histogram counters here, 1/2
- */
-#define HISTFRACTION 2
-
-/*
- * Fraction of text space to allocate for from hash buckets.
- * The value of HASHFRACTION is based on the minimum number of bytes
- * of separation between two subroutine call points in the object code.
- * Given MIN_SUBR_SEPARATION bytes of separation the value of
- * HASHFRACTION is calculated as:
- *
- * HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof(short) - 1);
- *
- * For example, on the VAX, the shortest two call sequence is:
- *
- * calls $0,(r0)
- * calls $0,(r0)
- *
- * which is separated by only three bytes, thus HASHFRACTION is
- * calculated as:
- *
- * HASHFRACTION = 3 / (2 * 2 - 1) = 1
- *
- * Note that the division above rounds down, thus if MIN_SUBR_FRACTION
- * is less than three, this algorithm will not work!
- *
- * In practice, however, call instructions are rarely at a minimal
- * distance. Hence, we will define HASHFRACTION to be 2 across all
- * architectures. This saves a reasonable amount of space for
- * profiling data structures without (in practice) sacrificing
- * any granularity.
- */
-#define HASHFRACTION 2
-
-/*
- * percent of text space to allocate for tostructs with a minimum.
- */
-#define ARCDENSITY 2
-#define MINARCS 50
-#define MAXARCS ((1 << (8 * sizeof(HISTCOUNTER))) - 2)
-
-struct tostruct {
- u_long selfpc;
- long count;
- u_short link;
- u_short pad;
-};
-
-/*
- * a raw arc, with pointers to the calling site and
- * the called site and a count.
- */
-struct rawarc {
- u_long raw_frompc;
- u_long raw_selfpc;
- long raw_count;
-};
-
-/*
- * general rounding functions.
- */
-#define ROUNDDOWN(x,y) (((x)/(y))*(y))
-#define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y))
-
-/*
- * The profiling data structures are housed in this structure.
- */
-struct gmonparam {
- int state;
- u_short *kcount;
- u_long kcountsize;
- u_short *froms;
- u_long fromssize;
- struct tostruct *tos;
- u_long tossize;
- long tolimit;
- u_long lowpc;
- u_long highpc;
- u_long textsize;
- u_long hashfraction;
-};
-extern struct gmonparam _gmonparam;
-
-/*
- * Possible states of profiling.
- */
-#define GMON_PROF_ON 0
-#define GMON_PROF_BUSY 1
-#define GMON_PROF_ERROR 2
-#define GMON_PROF_OFF 3
-
-/*
- * Sysctl definitions for extracting profiling information from the kernel.
- */
-#define GPROF_STATE 0 /* int: profiling enabling variable */
-#define GPROF_COUNT 1 /* struct: profile tick count buffer */
-#define GPROF_FROMS 2 /* struct: from location hash bucket */
-#define GPROF_TOS 3 /* struct: destination/count structure */
-#define GPROF_GMONPARAM 4 /* struct: profiling parameters (see above) */
-#endif /* !_SYS_GMONH_ */
diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc
deleted file mode 100644
index 54725c227..000000000
--- a/winsup/cygwin/grp.cc
+++ /dev/null
@@ -1,459 +0,0 @@
-/* grp.cc
-
- Copyright 1996, 1997, 1998, 2000, 2001, 2002 Red Hat, Inc.
-
- Original stubs by Jason Molenda of Cygnus Support, crash@cygnus.com
- First implementation by Gunther Ebert, gunther.ebert@ixos-leipzig.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. */
-
-#include "winsup.h"
-#include <grp.h>
-#include <wininet.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include "pinfo.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygerrno.h"
-#include "cygheap.h"
-#include "pwdgrp.h"
-
-/* Read /etc/group only once for better performance. This is done
- on the first call that needs information from it. */
-
-static struct __group32 *group_buf; /* group contents in memory */
-static int curr_lines;
-static int max_lines;
-
-/* Position in the group cache */
-#ifdef _MT_SAFE
-#define grp_pos _reent_winsup()->_grp_pos
-#else
-static int grp_pos = 0;
-#endif
-
-static pwdgrp_check group_state;
-
-static int
-parse_grp (struct __group32 &grp, char *line)
-{
- int len = strlen(line);
- if (line[--len] == '\r')
- line[len] = '\0';
-
- char *dp = strchr (line, ':');
-
- if (!dp)
- return 0;
-
- *dp++ = '\0';
- grp.gr_name = line;
-
- grp.gr_passwd = dp;
- dp = strchr (grp.gr_passwd, ':');
- if (dp)
- {
- *dp++ = '\0';
- if (!strlen (grp.gr_passwd))
- grp.gr_passwd = NULL;
-
- grp.gr_gid = strtol (dp, NULL, 10);
- dp = strchr (dp, ':');
- if (dp)
- {
- if (*++dp)
- {
- int i = 0;
- char *cp;
-
- for (cp = dp; (cp = strchr (cp, ',')) != NULL; ++cp)
- ++i;
- char **namearray = (char **) calloc (i + 2, sizeof (char *));
- if (namearray)
- {
- i = 0;
- for (cp = dp; (cp = strchr (dp, ',')) != NULL; dp = cp + 1)
- {
- *cp = '\0';
- namearray[i++] = dp;
- }
- namearray[i++] = dp;
- namearray[i] = NULL;
- }
- grp.gr_mem = namearray;
- }
- else
- grp.gr_mem = (char **) calloc (1, sizeof (char *));
- return 1;
- }
- }
- return 0;
-}
-
-/* Read one line from /etc/group into the group cache */
-static void
-add_grp_line (char *line)
-{
- if (curr_lines == max_lines)
- {
- max_lines += 10;
- group_buf = (struct __group32 *) realloc (group_buf, max_lines * sizeof (struct __group32));
- }
- if (parse_grp (group_buf[curr_lines], line))
- curr_lines++;
-}
-
-class group_lock
-{
- bool armed;
- static NO_COPY pthread_mutex_t mutex;
- public:
- group_lock (bool doit)
- {
- if (armed = doit)
- pthread_mutex_lock (&mutex);
- }
- ~group_lock ()
- {
- if (armed)
- pthread_mutex_unlock (&mutex);
- }
-};
-
-pthread_mutex_t NO_COPY group_lock::mutex = (pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER;
-
-/* Cygwin internal */
-/* Read in /etc/group and save contents in the group cache */
-/* This sets group_in_memory_p to 1 so functions in this file can
- tell that /etc/group has been read in */
-/* FIXME: should be static but this is called in uinfo_init outside this
- file */
-void
-read_etc_group ()
-{
- static pwdgrp_read gr;
-
- group_lock here (cygwin_finished_initializing);
-
- /* if we got blocked by the mutex, then etc_group may have been processed */
- if (group_state != uninitialized)
- return;
-
- if (group_state != initializing)
- {
- group_state = initializing;
- if (gr.open ("/etc/group"))
- {
- char *line;
- while ((line = gr.gets ()) != NULL)
- if (strlen (line))
- add_grp_line (line);
-
- group_state.set_last_modified (gr.get_fhandle(), gr.get_fname ());
- group_state = loaded;
- gr.close ();
- debug_printf ("Read /etc/group, %d lines", curr_lines);
- }
- else /* /etc/group doesn't exist -- create default one in memory */
- {
- char group_name [UNLEN + 1];
- DWORD group_name_len = UNLEN + 1;
- char domain_name [INTERNET_MAX_HOST_NAME_LENGTH + 1];
- DWORD domain_name_len = INTERNET_MAX_HOST_NAME_LENGTH + 1;
- SID_NAME_USE acType;
- static char linebuf [200];
-
- if (wincap.has_security ())
- {
- HANDLE ptok;
- cygsid tg;
- DWORD siz;
-
- if (OpenProcessToken (GetCurrentProcess (), TOKEN_QUERY, &ptok))
- {
- if (GetTokenInformation (ptok, TokenPrimaryGroup, &tg,
- sizeof tg, &siz)
- && LookupAccountSidA (NULL, tg, group_name,
- &group_name_len, domain_name,
- &domain_name_len, &acType))
- {
- char strbuf[100];
- snprintf (linebuf, sizeof (linebuf), "%s:%s:%lu:",
- group_name,
- tg.string (strbuf),
- *GetSidSubAuthority(tg,
- *GetSidSubAuthorityCount(tg) - 1));
- debug_printf ("Emulating /etc/group: %s", linebuf);
- add_grp_line (linebuf);
- group_state = emulated;
- }
- CloseHandle (ptok);
- }
- }
- if (group_state != emulated)
- {
- strncpy (group_name, "Administrators", sizeof (group_name));
- if (!LookupAccountSidA (NULL, well_known_admins_sid, group_name,
- &group_name_len, domain_name,
- &domain_name_len, &acType))
- {
- strcpy (group_name, "unknown");
- debug_printf ("Failed to get local admins group name. %E");
- }
- snprintf (linebuf, sizeof (linebuf), "%s::%u:", group_name,
- (unsigned) DEFAULT_GID);
- debug_printf ("Emulating /etc/group: %s", linebuf);
- add_grp_line (linebuf);
- group_state = emulated;
- }
- }
- }
-
- return;
-}
-
-static
-struct __group16 *
-grp32togrp16 (struct __group16 *gp16, struct __group32 *gp32)
-{
- if (!gp16 || !gp32)
- return NULL;
-
- /* Copying the pointers is actually unnecessary. Just having the correct
- return type is important. */
- gp16->gr_name = gp32->gr_name;
- gp16->gr_passwd = gp32->gr_passwd;
- gp16->gr_gid = (__gid16_t) gp32->gr_gid; /* Not loss-free */
- gp16->gr_mem = gp32->gr_mem;
-
- return gp16;
-}
-
-extern "C"
-struct __group32 *
-getgrgid32 (__gid32_t gid)
-{
- struct __group32 * default_grp = NULL;
- if (group_state <= initializing)
- read_etc_group();
-
- for (int i = 0; i < curr_lines; i++)
- {
- if (group_buf[i].gr_gid == DEFAULT_GID)
- default_grp = group_buf + i;
- if (group_buf[i].gr_gid == gid)
- return group_buf + i;
- }
-
- return allow_ntsec ? NULL : default_grp;
-}
-
-extern "C"
-struct __group16 *
-getgrgid (__gid16_t gid)
-{
- static struct __group16 g16;
-
- return grp32togrp16 (&g16, getgrgid32 ((__gid32_t) gid));
-}
-
-extern "C"
-struct __group32 *
-getgrnam32 (const char *name)
-{
- if (group_state <= initializing)
- read_etc_group();
-
- for (int i = 0; i < curr_lines; i++)
- if (strcasematch (group_buf[i].gr_name, name))
- return group_buf + i;
-
- /* Didn't find requested group */
- return NULL;
-}
-
-extern "C"
-struct __group16 *
-getgrnam (const char *name)
-{
- static struct __group16 g16;
-
- return grp32togrp16 (&g16, getgrnam32 (name));
-}
-
-extern "C"
-void
-endgrent()
-{
- grp_pos = 0;
-}
-
-extern "C"
-struct __group32 *
-getgrent32()
-{
- if (group_state <= initializing)
- read_etc_group();
-
- if (grp_pos < curr_lines)
- return group_buf + grp_pos++;
-
- return NULL;
-}
-
-extern "C"
-struct __group16 *
-getgrent()
-{
- static struct __group16 g16;
-
- return grp32togrp16 (&g16, getgrent32 ());
-}
-
-extern "C"
-void
-setgrent ()
-{
- grp_pos = 0;
-}
-
-/* Internal function. ONLY USE THIS INTERNALLY, NEVER `getgrent'!!! */
-struct __group32 *
-internal_getgrent (int pos)
-{
- if (group_state <= initializing)
- read_etc_group();
-
- if (pos < curr_lines)
- return group_buf + pos;
- return NULL;
-}
-
-int
-getgroups32 (int gidsetsize, __gid32_t *grouplist, __gid32_t gid,
- const char *username)
-{
- HANDLE hToken = NULL;
- DWORD size;
- int cnt = 0;
- struct __group32 *gr;
-
- if (group_state <= initializing)
- read_etc_group();
-
- if (allow_ntsec &&
- OpenProcessToken (hMainProc, TOKEN_QUERY, &hToken))
- {
- if (GetTokenInformation (hToken, TokenGroups, NULL, 0, &size)
- || GetLastError () == ERROR_INSUFFICIENT_BUFFER)
- {
- char buf[size];
- TOKEN_GROUPS *groups = (TOKEN_GROUPS *) buf;
-
- if (GetTokenInformation (hToken, TokenGroups, buf, size, &size))
- {
- cygsid sid;
-
- for (int gidx = 0; (gr = internal_getgrent (gidx)); ++gidx)
- if (sid.getfromgr (gr))
- for (DWORD pg = 0; pg < groups->GroupCount; ++pg)
- if (sid == groups->Groups[pg].Sid)
- {
- if (cnt < gidsetsize)
- grouplist[cnt] = gr->gr_gid;
- ++cnt;
- if (gidsetsize && cnt > gidsetsize)
- {
- CloseHandle (hToken);
- goto error;
- }
- break;
- }
- }
- }
- else
- debug_printf ("%d = GetTokenInformation(NULL) %E", size);
- CloseHandle (hToken);
- if (cnt)
- return cnt;
- }
-
- for (int gidx = 0; (gr = internal_getgrent (gidx)); ++gidx)
- if (gid == gr->gr_gid)
- {
- if (cnt < gidsetsize)
- grouplist[cnt] = gr->gr_gid;
- ++cnt;
- if (gidsetsize && cnt > gidsetsize)
- goto error;
- }
- else if (gr->gr_mem)
- for (int gi = 0; gr->gr_mem[gi]; ++gi)
- if (strcasematch (username, gr->gr_mem[gi]))
- {
- if (cnt < gidsetsize)
- grouplist[cnt] = gr->gr_gid;
- ++cnt;
- if (gidsetsize && cnt > gidsetsize)
- goto error;
- }
- return cnt;
-
-error:
- set_errno (EINVAL);
- return -1;
-}
-
-extern "C"
-int
-getgroups32 (int gidsetsize, __gid32_t *grouplist)
-{
- return getgroups32 (gidsetsize, grouplist, myself->gid,
- cygheap->user.name ());
-}
-
-extern "C"
-int
-getgroups (int gidsetsize, __gid16_t *grouplist)
-{
- __gid32_t *grouplist32 = NULL;
-
- if (gidsetsize < 0)
- {
- set_errno (EINVAL);
- return -1;
- }
- if (gidsetsize > 0 && grouplist)
- grouplist32 = (__gid32_t *) alloca (gidsetsize * sizeof (__gid32_t));
-
- int ret = getgroups32 (gidsetsize, grouplist32, myself->gid,
- cygheap->user.name ());
-
- if (gidsetsize > 0 && grouplist)
- for (int i = 0; i < ret; ++ i)
- grouplist[i] = grouplist32[i];
-
- return ret;
-}
-
-extern "C"
-int
-initgroups32 (const char *, __gid32_t)
-{
- return 0;
-}
-
-extern "C"
-int
-initgroups (const char *, __gid16_t)
-{
- return 0;
-}
diff --git a/winsup/cygwin/heap.cc b/winsup/cygwin/heap.cc
deleted file mode 100644
index 5c301cc16..000000000
--- a/winsup/cygwin/heap.cc
+++ /dev/null
@@ -1,144 +0,0 @@
-/* heap.cc: Cygwin heap manager.
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <errno.h>
-#include "cygerrno.h"
-#include "sigproc.h"
-#include "pinfo.h"
-#include "heap.h"
-#include "shared_info.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygheap.h"
-
-#define assert(x)
-
-static unsigned page_const;
-
-extern "C" size_t getpagesize ();
-
-/* Initialize the heap at process start up. */
-
-void
-heap_init ()
-{
- /* If we're the forkee, we must allocate the heap at exactly the same place
- as our parent. If not, we don't care where it ends up. */
-
- page_const = system_info.dwPageSize;
- if (cygheap->heapbase)
- {
- DWORD chunk = cygwin_shared->heap_chunk_size (); /* allocation chunk */
- /* total size commited in parent */
- DWORD allocsize = (char *) cygheap->heaptop - (char *) cygheap->heapbase;
- /* round up by chunk size */
- DWORD reserve_size = chunk * ((allocsize + (chunk - 1)) / chunk);
-
- /* Loop until we've managed to reserve an adequate amount of memory. */
- char *p;
- for (;;)
- {
- p = (char *) VirtualAlloc (cygheap->heapbase, reserve_size,
- MEM_RESERVE, PAGE_READWRITE);
- if (p)
- break;
- if ((reserve_size -= page_const) <= allocsize)
- break;
- }
- if (p == NULL)
- api_fatal ("1. unable to allocate heap %p, heap_chunk_size %d, pid %d, %E",
- cygheap->heapbase, cygwin_shared->heap_chunk_size (), myself->pid);
- if (p != cygheap->heapbase)
- api_fatal ("heap allocated but not at %p", cygheap->heapbase);
- if (! VirtualAlloc (cygheap->heapbase, allocsize, MEM_COMMIT, PAGE_READWRITE))
- api_fatal ("MEM_COMMIT failed, %E");
- }
- else
- {
- /* Initialize page mask and default heap size. Preallocate a heap
- * to assure contiguous memory. */
- cygheap->heapptr = cygheap->heaptop = cygheap->heapbase =
- VirtualAlloc(NULL, cygwin_shared->heap_chunk_size (), MEM_RESERVE,
- PAGE_NOACCESS);
- if (cygheap->heapbase == NULL)
- api_fatal ("2. unable to allocate heap, heap_chunk_size %d, %E",
- cygwin_shared->heap_chunk_size ());
- }
-
- debug_printf ("heap base %p, heap top %p", cygheap->heapbase,
- cygheap->heaptop);
- page_const--;
- malloc_init ();
-}
-
-#define pround(n) (((size_t)(n) + page_const) & ~page_const)
-
-/* FIXME: This function no longer handles "split heaps". */
-
-extern "C" void *
-_sbrk(int n)
-{
- sigframe thisframe (mainthread);
- char *newtop, *newbrk;
- unsigned commitbytes, newbrksize;
-
- if (n == 0)
- return cygheap->heapptr; /* Just wanted to find current cygheap->heapptr address */
-
- newbrk = (char *) cygheap->heapptr + n; /* Where new cygheap->heapptr will be */
- newtop = (char *) pround (newbrk); /* Actual top of allocated memory -
- on page boundary */
-
- if (newtop == cygheap->heaptop)
- goto good;
-
- if (n < 0)
- { /* Freeing memory */
- assert(newtop < cygheap->heaptop);
- n = (char *) cygheap->heaptop - newtop;
- if (VirtualFree(newtop, n, MEM_DECOMMIT)) /* Give it back to OS */
- goto good; /* Didn't take */
- else
- goto err;
- }
-
- assert(newtop > cygheap->heaptop);
-
- /* Need to grab more pages from the OS. If this fails it may be because
- * we have used up previously reserved memory. Or, we're just plumb out
- * of memory. */
- commitbytes = pround (newtop - (char *) cygheap->heaptop);
- if (VirtualAlloc(cygheap->heaptop, commitbytes, MEM_COMMIT, PAGE_READWRITE) != NULL)
- goto good;
-
- /* Couldn't allocate memory. Maybe we can reserve some more.
- Reserve either the maximum of the standard cygwin_shared->heap_chunk_size () or the requested
- amount. Then attempt to actually allocate it. */
-
- if ((newbrksize = cygwin_shared->heap_chunk_size ()) < commitbytes)
- newbrksize = commitbytes;
-
- if ((VirtualAlloc(cygheap->heaptop, newbrksize, MEM_RESERVE, PAGE_NOACCESS) != NULL) &&
- (VirtualAlloc(cygheap->heaptop, commitbytes, MEM_COMMIT, PAGE_READWRITE) != NULL))
- goto good;
-
-err:
- set_errno (ENOMEM);
- return (void *) -1;
-
-good:
- void *oldbrk = cygheap->heapptr;
- cygheap->heapptr = newbrk;
- cygheap->heaptop = newtop;
- return oldbrk;
-}
diff --git a/winsup/cygwin/heap.h b/winsup/cygwin/heap.h
deleted file mode 100644
index bcea4bae0..000000000
--- a/winsup/cygwin/heap.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* heap.h: Cygwin heap manager definitions.
-
- Copyright 2000, 2001 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 "perprocess.h"
-
-/* Heap management. */
-void heap_init ();
-void malloc_init ();
-
-#define inheap(s) \
- (cygheap->heapptr && s && ((char *) (s) >= (char *) cygheap->heapbase) \
- && ((char *) (s) <= (char *) cygheap->heaptop))
diff --git a/winsup/cygwin/hires.h b/winsup/cygwin/hires.h
deleted file mode 100644
index 611b2df0d..000000000
--- a/winsup/cygwin/hires.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* hires.h: Definitions for hires clock calculations
-
- Copyright 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. */
-
-#ifndef __HIRES_H__
-#define __HIRES_H__
-
-#include <mmsystem.h>
-
-class hires_base
-{
- protected:
- int inited;
- virtual void prime () {}
- public:
- virtual LONGLONG usecs (bool justdelta) {return 0LL;}
- virtual ~hires_base () {}
-};
-
-class hires_us : hires_base
-{
- LARGE_INTEGER primed_ft;
- LARGE_INTEGER primed_pc;
- double freq;
- void prime ();
- public:
- LONGLONG usecs (bool justdelta);
-};
-
-class hires_ms : hires_base
-{
- DWORD initime_ms;
- LARGE_INTEGER initime_us;
- UINT minperiod;
- void prime ();
- public:
- LONGLONG usecs (bool justdelta);
- ~hires_ms ();
-};
-
-#endif /*__HIRES_H__*/
diff --git a/winsup/cygwin/how-cygheap-works.txt b/winsup/cygwin/how-cygheap-works.txt
deleted file mode 100644
index b60f88808..000000000
--- a/winsup/cygwin/how-cygheap-works.txt
+++ /dev/null
@@ -1,120 +0,0 @@
-Copyright 2001 Red Hat Inc., Christopher Faylor
-
-Cygwin has recently adopted something called the "cygwin heap". This is
-an internal heap that is inherited by forked/execed children. It
-consists of process specific information that should be inherited. So
-things like the file descriptor table, the current working directory,
-and the chroot value live there.
-
-The cygheap is also used to pass argv information to a child process.
-There is a problem here, though. If you allocate space for argv on the
-heap and then exec a process the child process (1) will happily use the
-space in the heap. But what happens when that process execs another
-process (2)? The space used by child process (1) still is being used in
-child process (2) but it is basically just a memory leak.
-
-To rectify this problem, memory used by child process 1 is tagged in
-such a way that child process 2 will know to delete it. This is in
-cygheap_fixup_in_child.
-
-The cygheap memory allocation functions are adapted from memory
-allocators developed by DJ Delorie. They are similar to early BSD
-malloc and are intended to be relatively lightweight and relatively
-fast.
-
-How is the cygheap propagated to the child?
-
-Well, it depends if you are running on Windows 9x or Windows NT.
-
-On NT and 9x, just before CreateProcess is about to be called in
-fork or exec, a shared memory region is prepared for copying of the
-cygwin heap. This is in cygheap_setup_for_child. The handle to this
-shared memory region is passed to the new process in the 'child_info'
-structure.
-
-If there are no handles that need "fixing up" prior to starting another
-process, cygheap_setup_for_child will also copy the contents of the
-cygwin heap to the shared memory region.
-
-If there are any handles that need "fixing up" prior to invoking
-another process (i.e., sockets) then the creation of the shared
-memory region and copying of the current cygwin heap is a two
-step process.
-
-First the shared memory region is created and the process is started
-in a "CREATE_SUSPENDED" state, inheriting the handle. After the
-process is created, the fixup_before_*() functions are called. These
-set information in the heap and duplicate handles in the child, essentially
-ensuring that the child's fd table is correct.
-
-(Note that it is vital that the cygwin heap should not grow during this
-process. Currently, there is no guard against this happening so this
-operation is not thread safe.)
-
-Meanwhile, back in fork_parent, the function
-cygheap_setup_for_child_cleanup is called. In the simple "one step"
-case above, all that happens is that the shared memory is ummapped and
-the handle referring to it is closed.
-
-In the two step process, the cygheap is now copied to the shared memory
-region, complete with new fdtab info (the child process will see the
-updated information as soon as it starts). Then the memory is unmapped,
-the handle is closed, and upon return the child process is started.
-
-It is in the child process that the difference between Windows 9x and
-Windows NT becomes evident.
-
-Under Windows NT, the operation is simple. The shared memory handle is
-used to map the information that the parent has set up into the cygheap
-location in the child. This means that the child has a copy of the
-cygwin heap existing in "shared memory" but the only process with a view
-to this "shared memory" is the child.
-
-Under Windows 9x, due to address limitations, we can't just map the
-shared memory region into the cygheap position. So, instead, the memory
-is mapped whereever Windows wants to put it, a new heap region is
-allocated at the same place as in the parent, the contents of the shared
-memory is *copied* to the new heap, and the shared memory is unmapped.
-Simple, huh?
-
-Why do we go to these contortions? Previous versions (<1.3.3) of cygwin
-used to block when creating a child so that the child could copy the
-parent's cygheap. The problem with this was that when a cygwin process
-invoked a non-cygwin child, it would block forever waiting for the child
-to let it know that it was done copying the heap. That caused
-understandable complaints from people who wanted to run non-cygwin
-applications "in the background".
-
-In Cygwin 1.3.3 (and presumably beyond) the location of the cygwin heap
-has been fixed to be at the end of the cygwin1.dll address space.
-Previously, we let the "OS" choose where to allocate the cygwin heap in
-the initial cygwin process and attempted to use this same location in
-subsequent cygwin processes started from this parent.
-
-The reason for putting cygheap at a fixed, known location is that we
-need to put this information at a fixed location since it incorporates
-pointers to entities within itself. So, when a process forks or execs,
-the memory referred to by the pointers has to exist at the same place in
-both the parent or the child.
-
-(It "might be nice" to used something like Microsoft's "based pointers"
-for the cygheap. Unfortunately gcc does not support that feature, as of
-this writing.)
-
-The reason for choosing a fixed, arbitrary location is to accommodate
-Windows XP, although there were sporadic complaints of cygwin heap
-failures in other pathological situations with both NT and 9x. In
-Windows XP, Microsoft made the allocation of memory less deterministic.
-This is certainly their right. Cygwin was previously relying on
-undocumented and "iffy" behavior before. So, now we always allocate
-space immediately after the dll in the theory that there is not going
-to be anything else living there.
-
-Recent (2001-09-20) cygwin email threads have indicated that we're not
-exactly on completely firm ground now, though. We are assuming that
-there is sufficient space after the cygwin DLL for the allocation of the
-cygwin heap. Unfortunately the ld option '--enable-auto-image-base'
-has a tendency to allocate DLLs immediately after cygwin1.dll. This
-causes the dreaded "Couldn't reserve space for cygwin's heap" message.
-
-Solutions for this behavior are currently in the musing state.
diff --git a/winsup/cygwin/how-fhandlers-work.txt b/winsup/cygwin/how-fhandlers-work.txt
deleted file mode 100644
index cef46fedc..000000000
--- a/winsup/cygwin/how-fhandlers-work.txt
+++ /dev/null
@@ -1,75 +0,0 @@
-Copyright 2001 Red Hat Inc., Robert Collins
-
-fhandlers are the core mechanism by which cygwin provides a file descripter (fd)
-interface to things such as a random number generated, winsock sockets, raw disk
-devices, the clipboard, the console and so on. Under unix access to all such
-devices is via a combination of IOCTL's and open/close/read/write calls. Some
-special functions do exist - such as bind () and listen () for sockets, but
-these consistently operate on fd's. Under Win32 there are disparate interfaces
-that have little in common with each other. See for example Direct Sound and
-the Clipboard.
-
-The fhandler class provides all open,read,write,close, ioctl and fork()/exec()
-functionality for the fd interface. The base class operates on win32 backed
-files. The various derived classes utilise win32 primitives to provide their
-specific functionality.
-
-When a file is opened - not necesarily via open() a fd is assigned to it. The fd
-includes a pointer to the actual fhandler that operates this specific file. All
-file-oriented system calls then operate off this basic structure.
-
-For example, lets examine lseek ().
-
-extern "C" off_t
-_lseek (int fd, off_t pos, int dir)
-{
- off_t res;
- sigframe thisframe (mainthread);
-
- if (dir != SEEK_SET && dir != SEEK_CUR && dir != SEEK_END)
- {
- set_errno (EINVAL);
- res = -1;
- }
- else if (cygheap->fdtab.not_open (fd))
- {
- set_errno (EBADF);
- res = -1;
- }
- else
- {
- res = cygheap->fdtab[fd]->lseek (pos, dir);
- }
- syscall_printf ("%d = lseek (%d, %d, %d)", res, fd, pos, dir);
-
- return res;
-}
-
-The sigframe thisframe (mainthread); is signal related - see
-"how_signals_work.txt".
-
-The if, else if, else tests (in order)
-* the validity of the dir parameter,
-* is the fd being passed actually open? (cannot seek on a closed fd)
-* call the lseek virtual function in the associated fhandler.
-
-So as you can see, there is no code that attempts to understand the nature of
-the fhandler.
-
-fhandlers that make cross-function-call use of win32 objects that are not
-inheritable cross-process need to implement fixup-after-fork and recreate those
-objects. HANDLES can be inherited, but memory mapped regions (for example)
-cannot.
-
-For an example step-by-step to create a new fhandler, see
-../doc/fhandler-tut.txt
-
-Note: In most case, it is safe to assume that using new/delete (or
-malloc/free) in an fhandler is dangerous and to be avoided. The reason
-for this is that memory allocated to fhandlers is copied between execed
-processes in the cygwin heap. Memory allocated in new/delete is only
-copied to forked processes. So use cmalloc/cfree.
-
-Obviously it is possible to use new/delete in some situations but if you're
-seeing strange core dumps with usages like cat < /my/newfhandler then the
-above may well be the culprit.
diff --git a/winsup/cygwin/how-signals-work.txt b/winsup/cygwin/how-signals-work.txt
deleted file mode 100644
index 7ab85db8b..000000000
--- a/winsup/cygwin/how-signals-work.txt
+++ /dev/null
@@ -1,128 +0,0 @@
-Copyright 2001 Red Hat Inc., Christopher Faylor
-
-How do signals work?
-
-On process startup, cygwin starts a secondary thread that deals with signals.
-This thread contains a loop which blocks waiting for one of three events:
-
-1) sigcatch_main - a semaphore which, when incremented, indicates that a
- signal may be available for the main thread. The caller waits for the
- signal to be delivered before returning.
-
-2) sigcatch_nonmain - a semaphore which , when incremented, indicates that
- a signal is available for a non-main thread (currently this is not truly
- implemented). The caller waits for the signal to be delivered before
- returning.
-
-3) sigcatch_nosync - a semaphore which, when incremented, indicates that
- a signal may be available for the main thread. The caller does not wait
- for the delivery of the signal before returning.
-
-So, the signal handler blocks waiting for one of these three semaphores.
-
-If one of these is activated, then the the signal handler inspects an
-array of integers looking for a non-zero value. The array corresponds
-to the normal UNIX signals + two extra locations for internal usage.
-This array is located in the 'sigtodo' array in the procinfo class.
-
-The signal thread uses the InterlockedDecrement function to atomically
-inspect elements of the array. If one one of the elements of the array
-is non-zero, then cygwin checks to see if the user has blocked the
-signal by inspecting the process signal mask. If the signal is blocked,
-then the current array element is reincremented and the next element is
-checked.
-
-If the signal is not blocked, then the function "sig_handle" is called
-with the signal number as an argument. This is a fairly straightforward
-function. It first checks to see if the signal is special in any way.
-
-A special signal is something like SIGKILL or SIGSTOP. The user has no
-control over how those signals affect a UNIX process. If a SIGKILL is
-received then sig_handle calls exit_sig to exit the process. If SIGSTOP
-is called then sig_handle calls the regular signal dispatch function
-with a special function argument "sig_handle_tty_stop". The signal
-dispatch function is described below.
-
-An uncaught signal like SIGTERM or SIGHUP will cause the process to exit
-with the standard UNIX exit values. Uncaught signals like SIGUSR1 are
-ignored, as on UNIX.
-
-If the signal has an associated signal handler, then the setup_handler
-function is eventually called. It is passed the signal, the address of
-the handler, and a standard UNIX sigaction structure. The meat of
-signal processing is in setup_handler.
-
-setup_handler has a "simple" task. It tries to stop the appropriate
-thread and redirect its execution to the signal handler function.
-Currently, the "appropriate thread" is only the main thread. Someday
-we'll have to change this to allow cygwin to interrupt other user
-threads.
-
-To accomplish its task, setup_handler first inspects the static sigsave
-structure. This structure contains information on any not-yet-handled
-signals that may have been set up by a previous call to setup_handler
-but not yet dispatched in the main thread. If the sigsave structure
-seems to be "active", then a "pending" flag is set (see below) and the
-function returns. Otherwise processing continues.
-
-After determining that sigsave is available, setup_handler will take one
-of two routes, depending on whether the main thread is executing in the
-cygwin DLL or is currently in "user" code. We'll discuss the cygwin DLL
-case first.
-
-If sigsave seems to be available, then the frame information for the
-main thread is inspected. This information is set by any cygwin
-function that is known to block (such as _read()), usually by calling
-'sigframe thisframe (mainthread)' in the cygwin function. This call
-sets up information about the current stack frame of an executing cygwin
-process. Any function which uses 'sigframe thisframe' should be signal
-aware. It should detect when a signal has arrived and return
-immediately.
-
-So, if mainframe is active, that means that we have good information
-about the state of the main thread. Cygwin uses the stack frame info
-from this structure to insert a call to the assembly language function
-'sigdelayed' in place of the main thread's normal return address. So,
-when a call to (e.g.) _read returns after detecting a signal, it does
-not return to its caller. Rather, it returns to sigdelayed.
-
-The sigdelayed function saves a lot of state on the stack and sets the
-signal mask as appropriate for POSIX. It uses information from the
-sigsave structure which has been filled in by interrupt_on_return, as
-called by setup_handler. sigdelayed pushes a "call" to the function
-"sigreturn" on the stack. This will be the return address seen by the
-signal handler. After setting up the return value, modifying the signal
-mask, and saving other information on the stack, sigreturn clears the
-sigsave structure (so that setup_handler can use it) and jumps to the
-signal handler function. And, so a UNIX signal handler function is
-emulated.
-
-The signal handler function operates as normal for UNIX but, upon
-return, it does not go directly back to the return address of the
-original cygwin function. Instead it returns to the previously
-mentioned 'sigreturn' assembly language function.
-
-sigreturn resets the process mask to its state prior to calling the
-signal handler. It checks to see if any new signals have come in and
-calls the handler for them now, ensuring that the order of signal
-arrival is more or less maintained. It checks to see if a cygwin
-routine has set a special "restore this errno on returning from a
-signal" value and sets errno to this, if so. Finally, it restores all
-of the register values that were in effect when sigdelayed was called.
-
-Ok, you thought I had forgotten about the 'pending' stuff didn't you?
-Well, if you can rewind up to the discussion of sig_handle, we'll return
-to the situation where sigsave was currently active. In this case,
-setup_handler will set a "pending" flag, will reincrement the appropriate
-element of the above signal array, and will return 0 to indicate that
-the interrupt did not occur. Otherwise setup_handler returns 1.
-
-For pending signals, the theory is that the signal handler thread will
-be forced to be rerun by having some strategic cygwin function call
-sig_send with a __SIGFLUSH "argument" to it. This causes the signal
-handler to rescan the signal array looking for pending signals.
-
-This leads us to the sig_send function. This is the "client side" part
-of the signal manipulation process. sig_send is the low-level function
-called by a high level process like kill(). You would use sig_send
-to send a __SIGFLUSH to the signal thread.
diff --git a/winsup/cygwin/how-spawn-works.txt b/winsup/cygwin/how-spawn-works.txt
deleted file mode 100644
index e4e25eae9..000000000
--- a/winsup/cygwin/how-spawn-works.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-Spawn.cc in cygwin handles spawn, vfork and exec calls. It does this via
-a mode parameter that determines its behaviour with respect to the
-child.
-
-Of particular interest is the exec behaviour.
-
-In general spawn_guts (where the action happens) does the following:
-* Finds the actual program being run (which may include path searching).
-* Determines the type (.exe, shell script, perl etc) and for non binary
-programs finds the correct interpreter.
-* Creates a commandline (based on the type and the user parameters).
-* Guesses at whether the binary that will be invoked is a cygwin program
-or not (if (real_path.iscygexec ())) and uses that information to copy
-the argv table, or to translate it for win32 program usage.
-* passes a handle to the parent to the child (note: this handle should
-have it's rights restricted the daemon is merged).
-* Start the process.
-* if the mode is _P_OVERLAY (we are doing an exec)
-wait for the child to
-a) if it's a cygwin process, signal us via an event.
-b) if it's a win32 process, exit.
-c) exit.
-
-If a) occurs, we 'reparent' the child which makes it look to the current
-process's parent in the pid and process group chains.
-b) is where the cygwin process hangs around as a 'stub' presenting it's
-pid as the win32 process's pid, to allow cygwin tools to kill the win32
-process.
-once a-c has occured, execution resumes.
-* If the mode is _P_OVERLAY, this process exits, otherwise it's
-behaviour depends on the mode parameter. See the last block of
-spawn_guts.
diff --git a/winsup/cygwin/how-to-debug-cygwin.txt b/winsup/cygwin/how-to-debug-cygwin.txt
deleted file mode 100644
index 52e85c30e..000000000
--- a/winsup/cygwin/how-to-debug-cygwin.txt
+++ /dev/null
@@ -1,103 +0,0 @@
-Copyright 2001 Red Hat Inc., Egor Duda
-
-So, your favorite program has crashed? And did you say something about
-'stackdump'? Or it just prints its output from left to right and
-upside-down? Well, you can file an angry bug report and wait until some
-of the core developers try to reproduce your problem, try to find what's
-the matter with your program and cygwin and fix the bug, if any. But
-you can do something better than that. You can debug the problem
-yourself, and even if you can't fix it, your analysis may be very
-helpful. Here's the (incomplete) howto on cygwin debugging.
-
-1. The first thing you'll need to do is to build cygwin1.dll and your
- crashed application from sources. To debug them you'll need debug
- information, which is normally stripped from executables. You probably
- also want to build a version of the dll with more debugging capabilities
- by reconfiguring your build directory, specifying the --enable-debugging
- option to configure.
-
-2. Create known-working cygwin debugging environment.
- - create a separate directory, say, c:\cygdeb, and put known-working
- cygwin1.dll and gdb.exe in it.
- - create a wrapper c:\cygdeb\debug_wrapper.cmd:
-
-========= debug_wrapper.cmd =========
-rem setting CYGWIN_TESTING environment variable makes cygwin application
-rem not to interfere with other already running cygwin applications.
-set CYGWIN_TESTING=1
-c:\cygdeb\gdb.exe -nw %1 %2
-===================================
-
-3. Try to use cygwin's JIT debugging facility:
- add 'error_start=c:\cygdeb\debug_wrapper.cmd' to CYGWIN environment
- variable. When some application encounters critical error, cygwin will stop
- it and execute debug_wrapper.cmd, which will run gdb and make it to attach to
- the crashed application.
-
-4. Strace.
- You can run your program under 'strace' utility, described if user's manual.
- If you know where the problem approximately is, you can add a bunch of
- additional debug_printf()s in the source code and see what they print in
- strace log. There's one common problem with this method, that some bugs
- may mysteriously disappear once the program is run under strace. Then the
- bug is likely a race condition. strace has two useful options to deal with
- such situation: -b enables buffering of output and reduces additional
- timeouts introduced by strace, and -m option allows you to mask certain
- classes of *_printf() functions, reducing timeouts even more.
-
- Note that strace does not use the cygwin DLL and so any process that it
- starts does not inherit a cygwin environment. It is equivalent to starting
- a program from the command prompt.
-
-5. Problems at early startup.
- Sometimes, something crashes at the very early stages of application
- initialization, when JIT debugging facility is not yet active. Ok, there's
- another environment variable that may help. Create program_wrapper.cmd:
-
-========= program_wrapper.cmd =========
-rem setting CYGWIN_SLEEP environment variable makes cygwin application
-rem to sleep for x milliseconds at startup
-set CYGWIN_SLEEP=20000
-c:\some\path\bad_program.exe some parameters
-===================================
-
- Now, run program_wrapper.cmd. It should print running program pid.
- After starting program_wrapper.cmd you've got 20 seconds to open another
- window, cd to c:\cygdeb in it, run gdb there and in gdb prompt type
-
- (gdb) attach <pid>
-
- where <pid> is the pid that program_wrapper.cmd have printed.
- After that you can normally step through the code in cygwin1.dll and
- bad_program.exe
-
-6. Heap corruption.
- If your program crashes at malloc() or free() or when it references some
- malloc()'ed memory, it looks like heap corruption. You can configure and
- build special version of cygwin1.dll which includes heap sanity checking.
- To do it, just add --enable-malloc-debugging option to configure. Be warned,
- however, that this version of dll is _very_ slow (10-100 times slower than
- normal), so use it only when absolutely necessary.
-
-7. Program dies when running under strace.
- If your program crashes when you run it using strace but runs ok (or has a
- different problem) otherwise, then there may be a problem in one of the
- strace *_printf statements. Usually this is caused by a change in arguments
- resulting in a %s being used with something other than a pointer to a
- string.
-
- To debug this scenario, do something like this:
-
- bash$ gdb -nw yourapp.exe
- (gdb) dll cygwin1
- (gdb) l dll_crt0_1
- (gdb) bp <<first line in the function>>
- (gdb) run
- (gdb) set strace.active=1
- (gdb) continue
-
- The program will then run in "strace mode", calling each strace *_printf,
- just like it does when run under the strace program. Eventually, the
- program will crash, probably in small_printf. At that point, a 'bt'
- command should show you the offending call to strace_printf with the
- improper format string.
diff --git a/winsup/cygwin/how-vfork-works.txt b/winsup/cygwin/how-vfork-works.txt
deleted file mode 100644
index 7148366db..000000000
--- a/winsup/cygwin/how-vfork-works.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-Copyright 2001 Red Hat Inc., Christopher Faylor
-
-How does vfork work?
-
-When a program calls vfork, cygwin attempts to short circuit its
-normal, expensive fork mechanism.
-
-Vfork is mainly smoke and mirrors. A call to vfork contines to execute
-in the current process but first it returns a pid of 0 so that process
-will execute code intended for the child in a UNIX system. Before
-returning the zero, vfork makes a copy of the current fd table so that
-closing an fd in the "child" will not affect the "parent".
-
-Some of this info is stored in a per-thread structure but vfork is not
-really thread-safe since it also stores the fd "backup" table in the
-global fd table.
-
-The process continues to execute until it hits some type of exec call.
-The exec call is essentially translated into a spawn NO_WAIT call and
-the new process is started via this mechanism. After execing, the
-"child" process no longer should exist, so the spawn code longjmps back
-to the original vfork call. The previously opened fds are closed and
-the parent's fd table is restored. vfork() then returns the pid of the
-just-spawned process.
-
-Meanwhile, the just-spawned child notices that it has been spawned as
-the result of a vfork and closes the extra file handles.
-
-This all relies on the fact that the child in a vfork call can affect
-just about everything in the parent except for the parent's fds.
-The assumption is that a vfork is always just used as a method for
-starting a program.
-
-The assumption is also that all of this is much faster than the
-slow method that cygwin uses to implement fork().
-
diff --git a/winsup/cygwin/include/a.out.h b/winsup/cygwin/include/a.out.h
deleted file mode 100644
index 500e14f3f..000000000
--- a/winsup/cygwin/include/a.out.h
+++ /dev/null
@@ -1,431 +0,0 @@
-/* a.out.h
-
- Copyright 1997, 1998, 1999, 2001 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 _A_OUT_H_
-#define _A_OUT_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-#define COFF_IMAGE_WITH_PE
-#define COFF_LONG_SECTION_NAMES
-
-/*** coff information for Intel 386/486. */
-
-
-/********************** FILE HEADER **********************/
-
-struct external_filehdr {
- short f_magic; /* magic number */
- short f_nscns; /* number of sections */
- unsigned long f_timdat; /* time & date stamp */
- unsigned long f_symptr; /* file pointer to symtab */
- unsigned long f_nsyms; /* number of symtab entries */
- short f_opthdr; /* sizeof(optional hdr) */
- short f_flags; /* flags */
-};
-
-/* Bits for f_flags:
- * F_RELFLG relocation info stripped from file
- * F_EXEC file is executable (no unresolved external references)
- * F_LNNO line numbers stripped from file
- * F_LSYMS local symbols stripped from file
- * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax)
- */
-
-#define F_RELFLG (0x0001)
-#define F_EXEC (0x0002)
-#define F_LNNO (0x0004)
-#define F_LSYMS (0x0008)
-
-
-
-#define I386MAGIC 0x14c
-#define I386PTXMAGIC 0x154
-#define I386AIXMAGIC 0x175
-
-/* This is Lynx's all-platform magic number for executables. */
-
-#define LYNXCOFFMAGIC 0415
-
-#define I386BADMAG(x) (((x).f_magic != I386MAGIC) \
- && (x).f_magic != I386AIXMAGIC \
- && (x).f_magic != I386PTXMAGIC \
- && (x).f_magic != LYNXCOFFMAGIC)
-
-#define FILHDR struct external_filehdr
-#define FILHSZ 20
-
-
-/********************** AOUT "OPTIONAL HEADER"=
- **********************/
-
-
-typedef struct
-{
- unsigned short magic; /* type of file */
- unsigned short vstamp; /* version stamp */
- unsigned long tsize; /* text size in bytes, padded to FW bdry*/
- unsigned long dsize; /* initialized data " " */
- unsigned long bsize; /* uninitialized data " " */
- unsigned long entry; /* entry pt. */
- unsigned long text_start; /* base of text used for this file */
- unsigned long data_start; /* base of data used for this file=
- */
-}
-AOUTHDR;
-
-#define AOUTSZ 28
-#define AOUTHDRSZ 28
-
-#define OMAGIC 0404 /* object files, eg as output */
-#define ZMAGIC 0413 /* demand load format, eg normal ld output */
-#define STMAGIC 0401 /* target shlib */
-#define SHMAGIC 0443 /* host shlib */
-
-
-/* define some NT default values */
-/* #define NT_IMAGE_BASE 0x400000 moved to internal.h */
-#define NT_SECTION_ALIGNMENT 0x1000
-#define NT_FILE_ALIGNMENT 0x200
-#define NT_DEF_RESERVE 0x100000
-#define NT_DEF_COMMIT 0x1000
-
-/********************** SECTION HEADER **********************/
-
-
-struct external_scnhdr {
- char s_name[8]; /* section name */
- unsigned long s_paddr; /* physical address, offset
- of last addr in scn */
- unsigned long s_vaddr; /* virtual address */
- unsigned long s_size; /* section size */
- unsigned long s_scnptr; /* file ptr to raw data for section */
- unsigned long s_relptr; /* file ptr to relocation */
- unsigned long s_lnnoptr; /* file ptr to line numbers */
- unsigned short s_nreloc; /* number of relocation entries */
- unsigned short s_nlnno; /* number of line number entries*/
- unsigned long s_flags; /* flags */
-};
-
-#define SCNHDR struct external_scnhdr
-#define SCNHSZ 40
-
-/*
- * names of "special" sections
- */
-#define _TEXT ".text"
-#define _DATA ".data"
-#define _BSS ".bss"
-#define _COMMENT ".comment"
-#define _LIB ".lib"
-
-/********************** LINE NUMBERS **********************/
-
-/* 1 line number entry for every "breakpointable" source line in a section.
- * Line numbers are grouped on a per function basis; first entry in a function
- * grouping will have l_lnno = 0 and in place of physical address will be the
- * symbol table index of the function name.
- */
-struct external_lineno {
- union {
- unsigned long l_symndx; /* function name symbol index, iff l_lnno 0 */
- unsigned long l_paddr; /* (physical) address of line number */
- } l_addr;
- unsigned short l_lnno; /* line number */
-};
-
-#define LINENO struct external_lineno
-#define LINESZ 6
-
-/********************** SYMBOLS **********************/
-
-#define E_SYMNMLEN 8 /* # characters in a symbol name */
-#define E_FILNMLEN 14 /* # characters in a file name */
-#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
-
-struct external_syment
-{
- union {
- char e_name[E_SYMNMLEN];
- struct {
- unsigned long e_zeroes;
- unsigned long e_offset;
- } e;
- } e;
- unsigned long e_value;
- unsigned short e_scnum;
- unsigned short e_type;
- char e_sclass[1];
- char e_numaux[1];
-};
-
-#define N_BTMASK (0xf)
-#define N_TMASK (0x30)
-#define N_BTSHFT (4)
-#define N_TSHIFT (2)
-
-union external_auxent {
- struct {
- unsigned long x_tagndx; /* str, un, or enum tag indx */
- union {
- struct {
- unsigned short x_lnno; /* declaration line number */
- unsigned short x_size; /* str/union/array size */
- } x_lnsz;
- unsigned long x_fsize; /* size of function */
- } x_misc;
- union {
- struct { /* if ISFCN, tag, or .bb */
- unsigned long x_lnnoptr;/* ptr to fcn line # */
- unsigned long x_endndx; /* entry ndx past block end */
- } x_fcn;
- struct { /* if ISARY, up to 4 dimen. */
- char x_dimen[E_DIMNUM][2];
- } x_ary;
- } x_fcnary;
- unsigned short x_tvndx; /* tv index */
- } x_sym;
-
- union {
- char x_fname[E_FILNMLEN];
- struct {
- unsigned long x_zeroes;
- unsigned long x_offset;
- } x_n;
- } x_file;
-
- struct {
- unsigned long x_scnlen; /* section length */
- unsigned short x_nreloc; /* # relocation entries */
- unsigned short x_nlinno; /* # line numbers */
- unsigned long x_checksum; /* section COMDAT checksum */
- unsigned short x_associated;/* COMDAT associated section index */
- char x_comdat[1]; /* COMDAT selection number */
- } x_scn;
-
- struct {
- unsigned long x_tvfill; /* tv fill value */
- unsigned short x_tvlen; /* length of .tv */
- char x_tvran[2][2]; /* tv range */
- } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
-
-};
-
-#define SYMENT struct external_syment
-#define SYMESZ 18
-#define AUXENT union external_auxent
-#define AUXESZ 18
-
-#define _ETEXT "etext"
-
-/********************** RELOCATION DIRECTIVES **********************/
-
-struct external_reloc {
- char r_vaddr[4];
- char r_symndx[4];
- char r_type[2];
-};
-
-#define RELOC struct external_reloc
-#define RELSZ 10
-
-/* end of coff/i386.h */
-
-/* PE COFF header information */
-
-#ifndef _PE_H
-#define _PE_H
-
-/* NT specific file attributes */
-#define IMAGE_FILE_RELOCS_STRIPPED 0x0001
-#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
-#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
-#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
-#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
-#define IMAGE_FILE_32BIT_MACHINE 0x0100
-#define IMAGE_FILE_DEBUG_STRIPPED 0x0200
-#define IMAGE_FILE_SYSTEM 0x1000
-#define IMAGE_FILE_DLL 0x2000
-#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
-
-/* additional flags to be set for section headers to allow the NT loader to
- read and write to the section data (to replace the addresses of data in
- dlls for one thing); also to execute the section in .text's case=
- */
-#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
-#define IMAGE_SCN_MEM_EXECUTE 0x20000000
-#define IMAGE_SCN_MEM_READ 0x40000000
-#define IMAGE_SCN_MEM_WRITE 0x80000000
-
-/*
- * Section characteristics added for ppc-nt
- */
-
-#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved. */
-
-#define IMAGE_SCN_CNT_CODE 0x00000020 /* Section contains code. */
-#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 /* Section contains initialized data. */
-#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 /* Section contains uninitialized data. */
-
-#define IMAGE_SCN_LNK_OTHER 0x00000100 /* Reserved. */
-#define IMAGE_SCN_LNK_INFO 0x00000200 /* Section contains comments or some other type of information. */
-#define IMAGE_SCN_LNK_REMOVE 0x00000800 /* Section contents will not become part of image. */
-#define IMAGE_SCN_LNK_COMDAT 0x00001000 /* Section contents comdat. */
-
-#define IMAGE_SCN_MEM_FARDATA 0x00008000
-
-#define IMAGE_SCN_MEM_PURGEABLE 0x00020000
-#define IMAGE_SCN_MEM_16BIT 0x00020000
-#define IMAGE_SCN_MEM_LOCKED 0x00040000
-#define IMAGE_SCN_MEM_PRELOAD 0x00080000
-
-#define IMAGE_SCN_ALIGN_1BYTES 0x00100000
-#define IMAGE_SCN_ALIGN_2BYTES 0x00200000
-#define IMAGE_SCN_ALIGN_4BYTES 0x00300000
-#define IMAGE_SCN_ALIGN_8BYTES 0x00400000
-#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default alignment if no others are specified. */
-#define IMAGE_SCN_ALIGN_32BYTES 0x00600000
-#define IMAGE_SCN_ALIGN_64BYTES 0x00700000
-
-
-#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 /* Section contains extended relocations. */
-#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 /* Section is not cachable. */
-#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 /* Section is not pageable. */
-#define IMAGE_SCN_MEM_SHARED 0x10000000 /* Section is shareable. */
-
-/* COMDAT selection codes. */
-
-#define IMAGE_COMDAT_SELECT_NODUPLICATES (1) /* Warn if duplicates. */
-#define IMAGE_COMDAT_SELECT_ANY (2) /* No warning. */
-#define IMAGE_COMDAT_SELECT_SAME_SIZE (3) /* Warn if different size. */
-#define IMAGE_COMDAT_SELECT_EXACT_MATCH (4) /* Warn if different. */
-#define IMAGE_COMDAT_SELECT_ASSOCIATIVE (5) /* Base on other section. */
-
-/* Magic values that are true for all dos/nt implementations */
-#define DOSMAGIC 0x5a4d
-#define NT_SIGNATURE 0x00004550
-
-/* NT allows long filenames, we want to accommodate this. This may break
- some of the bfd functions */
-#undef FILNMLEN
-#define FILNMLEN 18 /* # characters in a file name */
-
-
-#ifdef COFF_IMAGE_WITH_PE
-/* The filehdr is only weired in images */
-
-#undef FILHDR
-struct external_PE_filehdr
-{
- /* DOS header fields */
- unsigned short e_magic; /* Magic number, 0x5a4d */
- unsigned short e_cblp; /* Bytes on last page of file, 0x90 */
- unsigned short e_cp; /* Pages in file, 0x3 */
- unsigned short e_crlc; /* Relocations, 0x0 */
- unsigned short e_cparhdr; /* Size of header in paragraphs, 0x4 */
- unsigned short e_minalloc; /* Minimum extra paragraphs needed, 0x0 */
- unsigned short e_maxalloc; /* Maximum extra paragraphs needed, 0xFFFF */
- unsigned short e_ss; /* Initial (relative) SS value, 0x0 */
- unsigned short e_sp; /* Initial SP value, 0xb8 */
- unsigned short e_csum; /* Checksum, 0x0 */
- unsigned short e_ip; /* Initial IP value, 0x0 */
- unsigned short e_cs; /* Initial (relative) CS value, 0x0 */
- unsigned short e_lfarlc; /* File address of relocation table, 0x40 */
- unsigned short e_ovno; /* Overlay number, 0x0 */
- char e_res[4][2]; /* Reserved words, all 0x0 */
- unsigned short e_oemid; /* OEM identifier (for e_oeminfo), 0x0 */
- unsigned short e_oeminfo; /* OEM information; e_oemid specific, 0x0 */
- char e_res2[10][2]; /* Reserved words, all 0x0 */
- unsigned long e_lfanew; /* File address of new exe header, 0x80 */
- char dos_message[16][4]; /* other stuff, always follow DOS header */
- unsigned int nt_signature; /* required NT signature, 0x4550 */
-
- /* From standard header */
-
- unsigned short f_magic; /* magic number */
- unsigned short f_nscns; /* number of sections */
- unsigned long f_timdat; /* time & date stamp */
- unsigned long f_symptr; /* file pointer to symtab */
- unsigned long f_nsyms; /* number of symtab entries */
- unsigned short f_opthdr; /* sizeof(optional hdr) */
- unsigned short f_flags; /* flags */
-};
-
-
-#define FILHDR struct external_PE_filehdr
-#undef FILHSZ
-#define FILHSZ 152
-
-#endif
-
-typedef struct
-{
- unsigned short magic; /* type of file */
- unsigned short vstamp; /* version stamp */
- unsigned long tsize; /* text size in bytes, padded to FW bdry*/
- unsigned long dsize; /* initialized data " " */
- unsigned long bsize; /* uninitialized data " " */
- unsigned long entry; /* entry pt. */
- unsigned long text_start; /* base of text used for this file */
- unsigned long data_start; /* base of all data used for this file */
-
- /* NT extra fields; see internal.h for descriptions */
- unsigned long ImageBase;
- unsigned long SectionAlignment;
- unsigned long FileAlignment;
- unsigned short MajorOperatingSystemVersion;
- unsigned short MinorOperatingSystemVersion;
- unsigned short MajorImageVersion;
- unsigned short MinorImageVersion;
- unsigned short MajorSubsystemVersion;
- unsigned short MinorSubsystemVersion;
- char Reserved1[4];
- unsigned long SizeOfImage;
- unsigned long SizeOfHeaders;
- unsigned long CheckSum;
- unsigned short Subsystem;
- unsigned short DllCharacteristics;
- unsigned long SizeOfStackReserve;
- unsigned long SizeOfStackCommit;
- unsigned long SizeOfHeapReserve;
- unsigned long SizeOfHeapCommit;
- unsigned long LoaderFlags;
- unsigned long NumberOfRvaAndSizes;
- /* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; */
- char DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars */
-
-} PEAOUTHDR;
-
-
-#undef AOUTSZ
-#define AOUTSZ (AOUTHDRSZ + 196)
-
-#undef E_FILNMLEN
-#define E_FILNMLEN 18 /* # characters in a file name */
-#endif
-
-/* end of coff/pe.h */
-
-#define DT_NON (0) /* no derived type */
-#define DT_PTR (1) /* pointer */
-#define DT_FCN (2) /* function */
-#define DT_ARY (3) /* array */
-
-#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
-#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
-#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _A_OUT_H_ */
-
diff --git a/winsup/cygwin/include/arpa/ftp.h b/winsup/cygwin/include/arpa/ftp.h
deleted file mode 100644
index 7d39a3e7a..000000000
--- a/winsup/cygwin/include/arpa/ftp.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 1983, 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ftp.h 8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _ARPA_FTP_H
-#define _ARPA_FTP_H
-
-/* Definitions for FTP; see RFC-765. */
-
-/*
- * Reply codes.
- */
-#define PRELIM 1 /* positive preliminary */
-#define COMPLETE 2 /* positive completion */
-#define CONTINUE 3 /* positive intermediate */
-#define TRANSIENT 4 /* transient negative completion */
-#define ERROR 5 /* permanent negative completion */
-
-/*
- * Type codes
- */
-#define TYPE_A 1 /* ASCII */
-#define TYPE_E 2 /* EBCDIC */
-#define TYPE_I 3 /* image */
-#define TYPE_L 4 /* local byte size */
-
-#ifdef FTP_NAMES
-char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" };
-#endif
-
-/*
- * Form codes
- */
-#define FORM_N 1 /* non-print */
-#define FORM_T 2 /* telnet format effectors */
-#define FORM_C 3 /* carriage control (ASA) */
-#ifdef FTP_NAMES
-char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" };
-#endif
-
-/*
- * Structure codes
- */
-#define STRU_F 1 /* file (no record structure) */
-#define STRU_R 2 /* record structure */
-#define STRU_P 3 /* page structure */
-#ifdef FTP_NAMES
-char *strunames[] = {"0", "File", "Record", "Page" };
-#endif
-
-/*
- * Mode types
- */
-#define MODE_S 1 /* stream */
-#define MODE_B 2 /* block */
-#define MODE_C 3 /* compressed */
-#ifdef FTP_NAMES
-char *modenames[] = {"0", "Stream", "Block", "Compressed" };
-#endif
-
-/*
- * Record Tokens
- */
-#define REC_ESC '\377' /* Record-mode Escape */
-#define REC_EOR '\001' /* Record-mode End-of-Record */
-#define REC_EOF '\002' /* Record-mode End-of-File */
-
-/*
- * Block Header
- */
-#define BLK_EOR 0x80 /* Block is End-of-Record */
-#define BLK_EOF 0x40 /* Block is End-of-File */
-#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */
-#define BLK_RESTART 0x10 /* Block is Restart Marker */
-
-#define BLK_BYTECOUNT 2 /* Bytes in this block */
-
-#endif /* !_ARPA_FTP_H */
diff --git a/winsup/cygwin/include/arpa/inet.h b/winsup/cygwin/include/arpa/inet.h
deleted file mode 100644
index dc144d6b8..000000000
--- a/winsup/cygwin/include/arpa/inet.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* arpa/inet.h
-
- Copyright 1997, 1998, 2001 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 _ARPA_INET_H
-#define _ARPA_INET_H
-
-#include <netinet/in.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#ifndef __INSIDE_CYGWIN_NET__
-unsigned long inet_addr (const char *);
-int inet_aton (const char *, struct in_addr *);
-unsigned long inet_lnaof (struct in_addr);
-struct in_addr inet_makeaddr (unsigned long , unsigned long);
-unsigned int inet_netof (struct in_addr);
-unsigned int inet_network (const char *);
-char *inet_ntoa (struct in_addr);
-#endif
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif /* _ARPA_INET_H */
diff --git a/winsup/cygwin/include/arpa/telnet.h b/winsup/cygwin/include/arpa/telnet.h
deleted file mode 100644
index 50874765c..000000000
--- a/winsup/cygwin/include/arpa/telnet.h
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)telnet.h 8.2 (Berkeley) 12/15/93
- */
-
-#ifndef _ARPA_TELNET_H
-#define _ARPA_TELNET_H
-
-/*
- * Definitions for the TELNET protocol.
- */
-#define IAC 255 /* interpret as command: */
-#define DONT 254 /* you are not to use option */
-#define DO 253 /* please, you use option */
-#define WONT 252 /* I won't use option */
-#define WILL 251 /* I will use option */
-#define SB 250 /* interpret as subnegotiation */
-#define GA 249 /* you may reverse the line */
-#define EL 248 /* erase the current line */
-#define EC 247 /* erase the current character */
-#define AYT 246 /* are you there */
-#define AO 245 /* abort output--but let prog finish */
-#define IP 244 /* interrupt process--permanently */
-#define BREAK 243 /* break */
-#define DM 242 /* data mark--for connect. cleaning */
-#define NOP 241 /* nop */
-#define SE 240 /* end sub negotiation */
-#define EOR 239 /* end of record (transparent mode) */
-#define ABORT 238 /* Abort process */
-#define SUSP 237 /* Suspend process */
-#define xEOF 236 /* End of file: EOF is already used... */
-
-#define SYNCH 242 /* for telfunc calls */
-
-#ifdef TELCMDS
-char *telcmds[] = {
- "EOF", "SUSP", "ABORT", "EOR",
- "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
- "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0,
-};
-#else
-extern char *telcmds[];
-#endif
-
-#define TELCMD_FIRST xEOF
-#define TELCMD_LAST IAC
-#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \
- (unsigned int)(x) >= TELCMD_FIRST)
-#define TELCMD(x) telcmds[(x)-TELCMD_FIRST]
-
-/* telnet options */
-#define TELOPT_BINARY 0 /* 8-bit data path */
-#define TELOPT_ECHO 1 /* echo */
-#define TELOPT_RCP 2 /* prepare to reconnect */
-#define TELOPT_SGA 3 /* suppress go ahead */
-#define TELOPT_NAMS 4 /* approximate message size */
-#define TELOPT_STATUS 5 /* give status */
-#define TELOPT_TM 6 /* timing mark */
-#define TELOPT_RCTE 7 /* remote controlled transmission and echo */
-#define TELOPT_NAOL 8 /* negotiate about output line width */
-#define TELOPT_NAOP 9 /* negotiate about output page size */
-#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */
-#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */
-#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */
-#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */
-#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */
-#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */
-#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */
-#define TELOPT_XASCII 17 /* extended ascic character set */
-#define TELOPT_LOGOUT 18 /* force logout */
-#define TELOPT_BM 19 /* byte macro */
-#define TELOPT_DET 20 /* data entry terminal */
-#define TELOPT_SUPDUP 21 /* supdup protocol */
-#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */
-#define TELOPT_SNDLOC 23 /* send location */
-#define TELOPT_TTYPE 24 /* terminal type */
-#define TELOPT_EOR 25 /* end or record */
-#define TELOPT_TUID 26 /* TACACS user identification */
-#define TELOPT_OUTMRK 27 /* output marking */
-#define TELOPT_TTYLOC 28 /* terminal location number */
-#define TELOPT_3270REGIME 29 /* 3270 regime */
-#define TELOPT_X3PAD 30 /* X.3 PAD */
-#define TELOPT_NAWS 31 /* window size */
-#define TELOPT_TSPEED 32 /* terminal speed */
-#define TELOPT_LFLOW 33 /* remote flow control */
-#define TELOPT_LINEMODE 34 /* Linemode option */
-#define TELOPT_XDISPLOC 35 /* X Display Location */
-#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */
-#define TELOPT_AUTHENTICATION 37/* Authenticate */
-#define TELOPT_ENCRYPT 38 /* Encryption option */
-#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */
-#define TELOPT_EXOPL 255 /* extended-options-list */
-#define TELOPT_ENVIRON TELOPT_OLD_ENVIRON
-
-#define NTELOPTS (1+TELOPT_NEW_ENVIRON)
-#ifdef TELOPTS
-char *telopts[NTELOPTS+1] = {
- "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
- "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
- "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
- "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
- "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
- "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
- "TACACS UID", "OUTPUT MARKING", "TTYLOC",
- "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
- "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
- "ENCRYPT", "NEW-ENVIRON",
- 0,
-};
-#define TELOPT_FIRST TELOPT_BINARY
-#define TELOPT_LAST TELOPT_NEW_ENVIRON
-#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST)
-#define TELOPT(x) telopts[(x)-TELOPT_FIRST]
-#endif
-
-/* sub-option qualifiers */
-#define TELQUAL_IS 0 /* option is... */
-#define TELQUAL_SEND 1 /* send option */
-#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */
-#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */
-#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */
-
-#define LFLOW_OFF 0 /* Disable remote flow control */
-#define LFLOW_ON 1 /* Enable remote flow control */
-#define LFLOW_RESTART_ANY 2 /* Restart output on any char */
-#define LFLOW_RESTART_XON 3 /* Restart output only on XON */
-
-/*
- * LINEMODE suboptions
- */
-
-#define LM_MODE 1
-#define LM_FORWARDMASK 2
-#define LM_SLC 3
-
-#define MODE_EDIT 0x01
-#define MODE_TRAPSIG 0x02
-#define MODE_ACK 0x04
-#define MODE_SOFT_TAB 0x08
-#define MODE_LIT_ECHO 0x10
-
-#define MODE_MASK 0x1f
-
-/* Not part of protocol, but needed to simplify things... */
-#define MODE_FLOW 0x0100
-#define MODE_ECHO 0x0200
-#define MODE_INBIN 0x0400
-#define MODE_OUTBIN 0x0800
-#define MODE_FORCE 0x1000
-
-#define SLC_SYNCH 1
-#define SLC_BRK 2
-#define SLC_IP 3
-#define SLC_AO 4
-#define SLC_AYT 5
-#define SLC_EOR 6
-#define SLC_ABORT 7
-#define SLC_EOF 8
-#define SLC_SUSP 9
-#define SLC_EC 10
-#define SLC_EL 11
-#define SLC_EW 12
-#define SLC_RP 13
-#define SLC_LNEXT 14
-#define SLC_XON 15
-#define SLC_XOFF 16
-#define SLC_FORW1 17
-#define SLC_FORW2 18
-
-#define NSLC 18
-
-/*
- * For backwards compatability, we define SLC_NAMES to be the
- * list of names if SLC_NAMES is not defined.
- */
-#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
- "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
- "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0,
-#ifdef SLC_NAMES
-char *slc_names[] = {
- SLC_NAMELIST
-};
-#else
-extern char *slc_names[];
-#define SLC_NAMES SLC_NAMELIST
-#endif
-
-#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC)
-#define SLC_NAME(x) slc_names[x]
-
-#define SLC_NOSUPPORT 0
-#define SLC_CANTCHANGE 1
-#define SLC_VARIABLE 2
-#define SLC_DEFAULT 3
-#define SLC_LEVELBITS 0x03
-
-#define SLC_FUNC 0
-#define SLC_FLAGS 1
-#define SLC_VALUE 2
-
-#define SLC_ACK 0x80
-#define SLC_FLUSHIN 0x40
-#define SLC_FLUSHOUT 0x20
-
-#define OLD_ENV_VAR 1
-#define OLD_ENV_VALUE 0
-#define NEW_ENV_VAR 0
-#define NEW_ENV_VALUE 1
-#define ENV_ESC 2
-#define ENV_USERVAR 3
-
-#define ENV_VALUE 0
-#define ENV_VAR 1
-
-/*
- * AUTHENTICATION suboptions
- */
-
-/*
- * Who is authenticating who ...
- */
-#define AUTH_WHO_CLIENT 0 /* Client authenticating server */
-#define AUTH_WHO_SERVER 1 /* Server authenticating client */
-#define AUTH_WHO_MASK 1
-
-/*
- * amount of authentication done
- */
-#define AUTH_HOW_ONE_WAY 0
-#define AUTH_HOW_MUTUAL 2
-#define AUTH_HOW_MASK 2
-
-#define AUTHTYPE_NULL 0
-#define AUTHTYPE_KERBEROS_V4 1
-#define AUTHTYPE_KERBEROS_V5 2
-#define AUTHTYPE_SPX 3
-#define AUTHTYPE_MINK 4
-#define AUTHTYPE_CNT 5
-
-#define AUTHTYPE_TEST 99
-
-#ifdef AUTH_NAMES
-char *authtype_names[] = {
- "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0,
-};
-#else
-extern char *authtype_names[];
-#endif
-
-#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT)
-#define AUTHTYPE_NAME(x) authtype_names[x]
-
-/*
- * ENCRYPTion suboptions
- */
-#define ENCRYPT_IS 0 /* I pick encryption type ... */
-#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */
-#define ENCRYPT_REPLY 2 /* Initial setup response */
-#define ENCRYPT_START 3 /* Am starting to send encrypted */
-#define ENCRYPT_END 4 /* Am ending encrypted */
-#define ENCRYPT_REQSTART 5 /* Request you start encrypting */
-#define ENCRYPT_REQEND 6 /* Request you send encrypting */
-#define ENCRYPT_ENC_KEYID 7
-#define ENCRYPT_DEC_KEYID 8
-#define ENCRYPT_CNT 9
-
-#define ENCTYPE_ANY 0
-#define ENCTYPE_DES_CFB64 1
-#define ENCTYPE_DES_OFB64 2
-#define ENCTYPE_CNT 3
-
-#ifdef ENCRYPT_NAMES
-char *encrypt_names[] = {
- "IS", "SUPPORT", "REPLY", "START", "END",
- "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
- 0,
-};
-char *enctype_names[] = {
- "ANY", "DES_CFB64", "DES_OFB64", 0,
-};
-#else
-extern char *encrypt_names[];
-extern char *enctype_names[];
-#endif
-
-
-#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT)
-#define ENCRYPT_NAME(x) encrypt_names[x]
-
-#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT)
-#define ENCTYPE_NAME(x) enctype_names[x]
-#endif /* _ARPA_TELNET_H */
diff --git a/winsup/cygwin/include/asm/byteorder.h b/winsup/cygwin/include/asm/byteorder.h
deleted file mode 100644
index fe6548b75..000000000
--- a/winsup/cygwin/include/asm/byteorder.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* asm/byteorder.h
-
- Copyright 1996, 1998, 2001 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 _I386_BYTEORDER_H
-#define _I386_BYTEORDER_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if 0
-#undef ntohl
-#undef ntohs
-#undef htonl
-#undef htons
-#endif
-
-#ifndef __LITTLE_ENDIAN
-#define __LITTLE_ENDIAN 1234
-#endif
-
-#ifndef __LITTLE_ENDIAN_BITFIELD
-#define __LITTLE_ENDIAN_BITFIELD
-#endif
-
-#if 1
-extern unsigned long int ntohl(unsigned long int);
-extern unsigned short int ntohs(unsigned short int);
-extern unsigned long int htonl(unsigned long int);
-extern unsigned short int htons(unsigned short int);
-
-extern __inline__ unsigned long int __ntohl(unsigned long int);
-extern __inline__ unsigned short int __ntohs(unsigned short int);
-extern __inline__ unsigned long int __constant_ntohl(unsigned long int);
-extern __inline__ unsigned short int __constant_ntohs(unsigned short int);
-
-extern __inline__ unsigned long int
-__ntohl(unsigned long int x)
-{
- __asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */
- "rorl $16,%0\n\t" /* swap words */
- "xchgb %b0,%h0" /* swap higher bytes */
- :"=q" (x)
- : "0" (x));
- return x;
-}
-
-#define __constant_ntohl(x) \
- ((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \
- (((unsigned long int)(x) & 0x0000ff00U) << 8) | \
- (((unsigned long int)(x) & 0x00ff0000U) >> 8) | \
- (((unsigned long int)(x) & 0xff000000U) >> 24)))
-
-extern __inline__ unsigned short int
-__ntohs(unsigned short int x)
-{
- __asm__("xchgb %b0,%h0" /* swap bytes */
- : "=q" (x)
- : "0" (x));
- return x;
-}
-
-#define __constant_ntohs(x) \
- ((unsigned short int)((((unsigned short int)(x) & 0x00ff) << 8) | \
- (((unsigned short int)(x) & 0xff00) >> 8))) \
-
-#define __htonl(x) __ntohl(x)
-#define __htons(x) __ntohs(x)
-#define __constant_htonl(x) __constant_ntohl(x)
-#define __constant_htons(x) __constant_ntohs(x)
-
-#ifdef __OPTIMIZE__
-# define ntohl(x) \
-(__builtin_constant_p((long)(x)) ? \
- __constant_ntohl((x)) : \
- __ntohl((x)))
-# define ntohs(x) \
-(__builtin_constant_p((short)(x)) ? \
- __constant_ntohs((x)) : \
- __ntohs((x)))
-# define htonl(x) \
-(__builtin_constant_p((long)(x)) ? \
- __constant_htonl((x)) : \
- __htonl((x)))
-# define htons(x) \
-(__builtin_constant_p((short)(x)) ? \
- __constant_htons((x)) : \
- __htons((x)))
-#endif
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/winsup/cygwin/include/asm/socket.h b/winsup/cygwin/include/asm/socket.h
deleted file mode 100644
index b1392ce22..000000000
--- a/winsup/cygwin/include/asm/socket.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* asm/socket.h
-
- Copyright 1996, 1997, 1998, 2001 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 _ASM_SOCKET_H
-#define _ASM_SOCKET_H
-
-#include <cygwin/if.h>
-
-#define IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */
-#define IOC_VOID 0x20000000 /* no parameters */
-#define IOC_OUT 0x40000000 /* copy out parameters */
-#define IOC_IN 0x80000000 /* copy in parameters */
-
-#define _IO(x,y) (IOC_VOID|(x<<8)|y)
-#define _IOR(x,y,t) (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
-#define _IOW(x,y,t) (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
-
-#define SIOCATMARK _IOR('s', 7, u_long) /* at oob mark? */
-#define FIONREAD _IOR('f', 127, u_long) /* get # bytes to read */
-#define FIONBIO 0x8004667e /* To be compatible with termiost version */
-#define REAL_FIONBIO _IOW('f', 126, u_long) /* set/clear non-blocking i/o */
-#define FIOASYNC _IOW('f', 125, u_long) /* set/clear async i/o */
-#define SIOCSHIWAT _IOW('s', 0, u_long) /* set high watermark */
-#define SIOCGHIWAT _IOR('s', 1, u_long) /* get high watermark */
-#define SIOCSLOWAT _IOW('s', 2, u_long) /* set low watermark */
-#define SIOCGLOWAT _IOR('s', 3, u_long) /* get low watermark */
-
-/* Needed for if queries */
-#define SIOCGIFCONF _IOW('s', 100, struct ifconf) /* get if list */
-#define SIOCGIFFLAGS _IOW('s', 101, struct ifreq) /* Get if flags */
-#define SIOCGIFADDR _IOW('s', 102, struct ifreq) /* Get if addr */
-#define SIOCGIFBRDADDR _IOW('s', 103, struct ifreq) /* Get if broadcastaddr */
-#define SIOCGIFNETMASK _IOW('s', 104, struct ifreq) /* Get if netmask */
-#define SIOCGIFHWADDR _IOW('s', 105, struct ifreq) /* Get hw addr */
-#define SIOCGIFMETRIC _IOW('s', 106, struct ifreq) /* get metric */
-#define SIOCGIFMTU _IOW('s', 107, struct ifreq) /* get MTU size */
-
-#define SOL_SOCKET 0xffff /* options for socket level */
-
-#define SO_DEBUG 0x0001 /* turn on debugging info recording */
-#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */
-#define SO_REUSEADDR 0x0004 /* allow local address reuse */
-#define SO_KEEPALIVE 0x0008 /* keep connections alive */
-#define SO_DONTROUTE 0x0010 /* just use interface addresses */
-#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */
-#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */
-#define SO_LINGER 0x0080 /* linger on close if data present */
-#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */
-#define SO_DONTLINGER (u_int)(~SO_LINGER)
-
-/*
- * Additional options.
- */
-#define SO_SNDBUF 0x1001 /* send buffer size */
-#define SO_RCVBUF 0x1002 /* receive buffer size */
-#define SO_SNDLOWAT 0x1003 /* send low-water mark */
-#define SO_RCVLOWAT 0x1004 /* receive low-water mark */
-#define SO_SNDTIMEO 0x1005 /* send timeout */
-#define SO_RCVTIMEO 0x1006 /* receive timeout */
-#define SO_ERROR 0x1007 /* get error status and clear */
-#define SO_TYPE 0x1008 /* get socket type */
-
-#endif /* _ASM_SOCKET_H */
-
diff --git a/winsup/cygwin/include/asm/types.h b/winsup/cygwin/include/asm/types.h
deleted file mode 100644
index 2653fd674..000000000
--- a/winsup/cygwin/include/asm/types.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* asm/types.h
-
- Copyright 1998, 2001 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 _ASM_TYPES_H
-#define _ASM_TYPES_H
-
-typedef __signed__ char __s8;
-typedef unsigned char __u8;
-
-typedef __signed__ short __s16;
-typedef unsigned short __u16;
-
-typedef __signed__ int __s32;
-typedef unsigned int __u32;
-
-#endif /* _ASM_TYPES_H */
diff --git a/winsup/cygwin/include/cygwin/acl.h b/winsup/cygwin/include/cygwin/acl.h
deleted file mode 100644
index 3ea5f91e5..000000000
--- a/winsup/cygwin/include/cygwin/acl.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* cygwin/acl.h header file for Cygwin.
-
- Copyright 1999, 2000, 2001, 2002 Red Hat, Inc.
- Written by C. 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. */
-
-#ifndef _CYGWIN_ACL_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-#define _CYGWIN_ACL_H
-
-#include <_ansi.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-/* Values for `cmd' in calls to acl(2) and facl(2) */
-#define SETACL (0x0)
-#define GETACL (0x1)
-#define GETACLCNT (0x2)
-
-#define MIN_ACL_ENTRIES (4) // minimal acl entries from GETACLCNT
-#define MAX_ACL_ENTRIES (256) // max entries of each type
-
-// Return values of aclcheck(3) in case of error */
-#define GRP_ERROR (0x1)
-#define USER_ERROR (0x2)
-#define CLASS_ERROR (0x3)
-#define OTHER_ERROR (0x4)
-#define DUPLICATE_ERROR (0x5)
-#define ENTRY_ERROR (0x6)
-#define MISS_ERROR (0x7) // which = -1
-#define MEM_ERROR (0x8) // which = -1
-
-// Values for entry type of struct acl
-#define USER_OBJ (0x0001) // owner
-#define USER (0x0002) // additional user
-#define GROUP_OBJ (0x0004) // owning group
-#define GROUP (0x0008) // additional group
-#define CLASS_OBJ (0x0010) // mask entry
-#define OTHER_OBJ (0x0020) // others
-#define ACL_DEFAULT (0x1000) // default flag
-#define DEF_USER_OBJ (ACL_DEFAULT|USER_OBJ) // default owner
-#define DEF_USER (ACL_DEFAULT|USER) // default additional user
-#define DEF_GROUP_OBJ (ACL_DEFAULT|GROUP_OBJ) // default owning group
-#define DEF_GROUP (ACL_DEFAULT|GROUP) // default additional group
-#define DEF_CLASS_OBJ (ACL_DEFAULT|CLASS_OBJ) // default mask entry
-#define DEF_OTHER_OBJ (ACL_DEFAULT|OTHER_OBJ) // default others
-// Values with equivalent meanings
-#define USER_OWNER USER_OBJ
-#define GROUP_OWNER GROUP_OBJ
-#define MASK CLASS_OBJ
-#define OTHER OTHER_OBJ
-
-#ifdef __INSIDE_CYGWIN__
-typedef struct __acl16 {
- int a_type;
- __uid16_t a_id;
- mode_t a_perm;
-} __aclent16_t;
-
-typedef struct __acl32 {
- int a_type;
- __uid32_t a_id;
- mode_t a_perm;
-} __aclent32_t;
-#else
-typedef struct acl {
- int a_type; /* entry type */
- uid_t a_id; /* UID | GID */
- mode_t a_perm; /* permissions */
-} aclent_t;
-#endif
-
-#ifndef __INSIDE_CYGWIN__
-int _EXFUN(acl,(const char *path, int cmd, int nentries, aclent_t *aclbufp));
-int _EXFUN(lacl,(const char *path, int cmd, int nentries, aclent_t *aclbufp));
-int _EXFUN(facl,(int fd, int cmd, int nentries, aclent_t *aclbufp));
-int _EXFUN(aclcheck,(aclent_t *aclbufp, int nentries, int *which));
-int _EXFUN(aclsort,(int nentries, int calclass, aclent_t *aclbufp));
-int _EXFUN(acltomode,(aclent_t *aclbufp, int nentries, mode_t *modep));
-int _EXFUN(aclfrommode,(aclent_t *aclbufp, int nentries, mode_t *modep));
-int _EXFUN(acltopbits,(aclent_t *aclbufp, int nentries, mode_t *pbitsp));
-int _EXFUN(aclfrompbits,(aclent_t *aclbufp, int nentries, mode_t *pbitsp));
-char *_EXFUN(acltotext,(aclent_t *aclbufp, int aclcnt));
-aclent_t *_EXFUN(aclfromtext,(char *acltextp, int *aclcnt));
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* _CYGWIN_ACL_H */
diff --git a/winsup/cygwin/include/cygwin/core_dump.h b/winsup/cygwin/include/cygwin/core_dump.h
deleted file mode 100644
index b1943937b..000000000
--- a/winsup/cygwin/include/cygwin/core_dump.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* core_dump.h
-
- Copyright 1999, 2000, 2001 Red Hat, Inc.
-
- Written by Egor Duda <deo@logos-m.ru>
-
-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 _CYGWIN_CORE_DUMP_H
-#define _CYGWIN_CORE_DUMP_H
-
-#include <windows.h>
-
-#define NOTE_INFO_PROCESS 1
-#define NOTE_INFO_THREAD 2
-#define NOTE_INFO_MODULE 3
-
-struct win32_core_process_info
-{
- DWORD pid;
- int signal;
- int command_line_size;
- char command_line[1];
-}
-#ifdef __GNUC__
- __attribute__ ((packed))
-#endif
-;
-
-struct win32_core_thread_info
-{
- DWORD tid;
- BOOL is_active_thread;
- CONTEXT thread_context;
-}
-#ifdef __GNUC__
- __attribute__ ((packed))
-#endif
-;
-
-struct win32_core_module_info
-{
- void* base_address;
- int module_name_size;
- char module_name[1];
-}
-#ifdef __GNUC__
- __attribute__ ((packed))
-#endif
-;
-
-struct win32_pstatus
-{
- unsigned long data_type;
- union
- {
- struct win32_core_process_info process_info;
- struct win32_core_thread_info thread_info;
- struct win32_core_module_info module_info;
- } data ;
-}
-#ifdef __GNUC__
- __attribute__ ((packed))
-#endif
-;
-
-typedef struct win32_pstatus win32_pstatus_t ;
-
-#endif /* _CYGWIN_CORE_DUMP_H */
diff --git a/winsup/cygwin/include/cygwin/cygserver.h b/winsup/cygwin/include/cygwin/cygserver.h
deleted file mode 100755
index c7a04929f..000000000
--- a/winsup/cygwin/include/cygwin/cygserver.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* cygserver.h
-
- Copyright 2001, 2002 Red Hat Inc.
-
- Written by Egor Duda <deo@logos-m.ru>
-
-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 _CYGSERVER_H_
-#define _CYGSERVER_H_
-
-#define MAX_REQUEST_SIZE 128
-
-#define CYGWIN_SERVER_VERSION_MAJOR 1
-#define CYGWIN_SERVER_VERSION_API 1
-#define CYGWIN_SERVER_VERSION_MINOR 0
-#define CYGWIN_SERVER_VERSION_PATCH 0
-
-
-typedef enum {
- CYGSERVER_UNKNOWN=0,
- CYGSERVER_OK=1,
- CYGSERVER_DEAD=2
-} cygserver_states;
-
-typedef enum {
- CYGSERVER_REQUEST_INVALID = 0,
- CYGSERVER_REQUEST_GET_VERSION,
- CYGSERVER_REQUEST_ATTACH_TTY,
- CYGSERVER_REQUEST_SHUTDOWN,
- CYGSERVER_REQUEST_SHM_GET,
- CYGSERVER_REQUEST_LAST
-} cygserver_request_code;
-
-class request_header
-{
- public:
- ssize_t cb;
- cygserver_request_code req_id;
- ssize_t error_code;
- request_header (cygserver_request_code id, ssize_t ncb) : cb (ncb), req_id (id), error_code (0) {} ;
-}
-#ifdef __GNUC__
- __attribute__ ((packed))
-#endif
-;
-
-extern void cygserver_init ();
-
-#define INIT_REQUEST(req,id) \
- (req).header.cb = sizeof (req); \
- (req).header.req_id = id;
-
-struct request_get_version
-{
- DWORD major, api, minor, patch;
-}
-#ifdef __GNUC__
- __attribute__ ((packed))
-#endif
-;
-
-struct request_shutdown
-{
- int foo;
-}
-#ifdef __GNUC__
- __attribute__ ((packed))
-#endif
-;
-
-struct request_attach_tty
-{
- DWORD pid, master_pid;
- HANDLE from_master, to_master;
-}
-#ifdef __GNUC__
- __attribute__ ((packed))
-#endif
-;
-
-class client_request
-{
- public:
- client_request (cygserver_request_code id, ssize_t data_size);
- virtual void send (transport_layer_base *conn);
-#ifndef __INSIDE_CYGWIN__
- virtual void serve (transport_layer_base *conn, class process_cache *cache);
-#endif
- virtual operator struct request_header ();
- cygserver_request_code req_id () {return header.req_id;};
- virtual ~client_request();
- request_header header;
- char *buffer;
-};
-
-class client_request_get_version : public client_request
-{
- public:
-#ifndef __INSIDE_CYGWIN__
- virtual void serve (transport_layer_base *conn, class process_cache *cache);
-#endif
- client_request_get_version::client_request_get_version();
- struct request_get_version version;
-};
-
-class client_request_shutdown : public client_request
-{
- public:
-#ifndef __INSIDE_CYGWIN__
- virtual void serve (transport_layer_base *conn, class process_cache *cache);
-#endif
- client_request_shutdown ();
-};
-
-class client_request_attach_tty : public client_request
-{
- public:
-#ifndef __INSIDE_CYGWIN__
- virtual void serve (transport_layer_base *conn, class process_cache *cache);
-#endif
- client_request_attach_tty ();
- client_request_attach_tty (DWORD npid, DWORD nmaster_pid, HANDLE nfrom_master, HANDLE nto_master);
- HANDLE from_master () {return req.from_master;};
- HANDLE to_master () {return req.to_master;};
- struct request_attach_tty req;
-};
-
-extern int cygserver_request (client_request *);
-
-#endif /* _CYGSERVER+H+ */
diff --git a/winsup/cygwin/include/cygwin/cygserver_process.h b/winsup/cygwin/include/cygwin/cygserver_process.h
deleted file mode 100755
index c8ff40b09..000000000
--- a/winsup/cygwin/include/cygwin/cygserver_process.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* cygserver_process.h
-
- Copyright 2001, 2002 Red Hat Inc.
-
- Written by Robert Collins <rbtcollins@hotmail.com>
-
- 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 _CYGSERVER_PROCESS_
-#define _CYGSERVER_PROCESS_
-
-/* needs threaded_queue.h */
-
-class process_cleanup:public queue_request
-{
-public:
- virtual void process ();
- process_cleanup (class process *nprocess) : theprocess (nprocess) {};
-private:
- class process * theprocess;
-};
-
-class process_process_param:public queue_process_param
-{
- class process_cache *cache;
-public:
- DWORD request_loop ();
- process_process_param ():queue_process_param (true) {};
-};
-
-class cleanup_routine
-{
-public:
- cleanup_routine () : next (NULL) {};
- class cleanup_routine * next;
- /* MUST BE SYNCHRONOUS */
- virtual void cleanup (long winpid);
-};
-
-class process
-{
-public:
- HANDLE handle ();
- long winpid;
- process (long);
- ~process ();
- DWORD exit_code ();
- class process * next;
- long refcount;
- bool add_cleanup_routine (class cleanup_routine *);
- void cleanup ();
-private:
- /* used to prevent races-on-delete */
- CRITICAL_SECTION access;
- volatile long cleaning_up;
- class cleanup_routine *head;
- HANDLE thehandle;
- DWORD _exit_status;
-};
-
-class process_cache:public threaded_queue
-{
-public:
- process_cache (unsigned int initial_workers);
- virtual ~ process_cache ();
- class process *process (long);
- /* remove a process from the cache */
- int handle_snapshot (HANDLE *, class process **, ssize_t, int);
- void remove_process (class process *);
- /* threaded_queue methods */
- void process_requests ();
- HANDLE cache_add_trigger;
-
-private:
- virtual void add_task (class process *);
- class process *head;
- CRITICAL_SECTION cache_write_access;
-};
-
-#endif /* _CYGSERVER_PROCESS_ */
diff --git a/winsup/cygwin/include/cygwin/cygserver_transport.h b/winsup/cygwin/include/cygwin/cygserver_transport.h
deleted file mode 100755
index 493c9b530..000000000
--- a/winsup/cygwin/include/cygwin/cygserver_transport.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* cygserver.cc
-
- Copyright 2001, 2002 Red Hat Inc.
-
- Written by Robert Collins <rbtcollins@hotmail.com>
-
- 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 _CYGSERVER_TRANSPORT_
-#define _CYGSERVER_TRANSPORT_
-class transport_layer_base *create_server_transport();
-
-/* the base class does nothing. */
-class transport_layer_base
-{
- public:
- virtual void listen ();
- virtual class transport_layer_base * accept ();
- virtual void close ();
- virtual ssize_t read (char *buf, size_t len);
- virtual ssize_t write (char *buf, size_t len);
- virtual bool connect();
- virtual void impersonate_client ();
- virtual void revert_to_self ();
- transport_layer_base ();
-};
-
-#endif /* _CYGSERVER_TRANSPORT_ */
diff --git a/winsup/cygwin/include/cygwin/cygserver_transport_pipes.h b/winsup/cygwin/include/cygwin/cygserver_transport_pipes.h
deleted file mode 100755
index 9ebeee2a4..000000000
--- a/winsup/cygwin/include/cygwin/cygserver_transport_pipes.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* cygserver.cc
-
- Copyright 2001, 2002 Red Hat Inc.
-
- Written by Robert Collins <rbtcollins@hotmail.com>
-
- 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 _CYGSERVER_TRANSPORT_PIPES_
-#define _CYGSERVER_TRANSPORT_PIPES_
-/* Named pipes based transport, for security on NT */
-class transport_layer_pipes : public transport_layer_base
-{
- public:
- virtual void listen ();
- virtual class transport_layer_pipes * accept ();
- virtual void close ();
- virtual ssize_t read (char *buf, size_t len);
- virtual ssize_t write (char *buf, size_t len);
- virtual bool connect();
- virtual void impersonate_client ();
- virtual void revert_to_self ();
- transport_layer_pipes ();
-
- private:
- /* for pipe based communications */
- void init_security ();
- SECURITY_DESCRIPTOR sd;
- SECURITY_ATTRIBUTES sec_none_nih, sec_all_nih;
- char pipe_name [MAX_PATH];
- HANDLE pipe;
- bool inited;
- transport_layer_pipes (HANDLE new_pipe);
-};
-#endif /* _CYGSERVER_TRANSPORT_PIPES_ */
diff --git a/winsup/cygwin/include/cygwin/cygserver_transport_sockets.h b/winsup/cygwin/include/cygwin/cygserver_transport_sockets.h
deleted file mode 100755
index 9881ca2bb..000000000
--- a/winsup/cygwin/include/cygwin/cygserver_transport_sockets.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* cygserver.cc
-
- Copyright 2001, 2002 Red Hat Inc.
-
- Written by Robert Collins <rbtcollins@hotmail.com>
-
- 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 _CYGSERVER_TRANSPORT_SOCKETS_
-#define _CYGSERVER_TRANSPORT_SOCKETS_
-class transport_layer_sockets : public transport_layer_base
-{
- public:
- virtual void listen ();
- virtual class transport_layer_sockets * accept ();
- virtual void close ();
- virtual ssize_t read (char *buf, size_t len);
- virtual ssize_t write (char *buf, size_t len);
- virtual bool connect();
- transport_layer_sockets ();
-
- private:
- /* for socket based communications */
- int fd;
- struct sockaddr sockdetails;
- int sdlen;
- transport_layer_sockets (int newfd);
-};
-#endif /* _CYGSERVER_TRANSPORT_SOCKETS_ */
diff --git a/winsup/cygwin/include/cygwin/cygwin_dll.h b/winsup/cygwin/include/cygwin/cygwin_dll.h
deleted file mode 100644
index 80c9d13c6..000000000
--- a/winsup/cygwin/include/cygwin/cygwin_dll.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* cygwin_dll.h
-
- Copyright 1998, 1999, 2000, 2001 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 __CYGWIN_CYGWIN_DLL_H__
-#define __CYGWIN_CYGWIN_DLL_H__
-
-#include <windows.h>
-
-#ifdef __cplusplus
-#define CDECL_BEGIN extern "C" {
-#define CDECL_END }
-#else
-#define CDECL_BEGIN
-#define CDECL_END
-#endif
-
-#define DECLARE_CYGWIN_DLL(Entry) \
- \
-CDECL_BEGIN \
- int WINAPI Entry (HINSTANCE h, DWORD reason, void *ptr); \
- typedef int (*mainfunc) (int, char **, char **); \
- extern int cygwin_attach_dll (HMODULE, mainfunc); \
- extern void cygwin_detach_dll (DWORD); \
-CDECL_END \
- \
-static HINSTANCE storedHandle; \
-static DWORD storedReason; \
-static void* storedPtr; \
- \
-static int __dllMain (int a, char **b, char **c) \
-{ \
- return Entry (storedHandle, storedReason, storedPtr); \
-} \
- \
-static DWORD dll_index; \
- \
-int WINAPI _cygwin_dll_entry (HINSTANCE h, DWORD reason, void *ptr) \
-{ \
- int ret; \
- ret = 1; \
- \
- switch (reason) \
- { \
- case DLL_PROCESS_ATTACH: \
- { \
- storedHandle = h; \
- storedReason = reason; \
- storedPtr = ptr; \
- dll_index = cygwin_attach_dll (h, &__dllMain); \
- if (dll_index == (DWORD) -1) \
- ret = 0; \
- } \
- break; \
- \
- case DLL_PROCESS_DETACH: \
- { \
- ret = Entry (h, reason, ptr); \
- if (ret) \
- { \
- cygwin_detach_dll (dll_index); \
- dll_index = (DWORD) -1; \
- } \
- } \
- break; \
- \
- case DLL_THREAD_ATTACH: \
- { \
- ret = Entry (h, reason, ptr); \
- } \
- break; \
- \
- case DLL_THREAD_DETACH: \
- { \
- ret = Entry (h, reason, ptr); \
- } \
- break; \
- } \
- return ret; \
-} \
- \
-/* OBSOLETE: This is only provided for source level compatibility. */ \
-int WINAPI _cygwin_noncygwin_dll_entry (HINSTANCE h, DWORD reason, void *ptr) \
-{ \
- return _cygwin_dll_entry (h, reason, ptr); \
-} \
-
-#endif /* __CYGWIN_CYGWIN_DLL_H__ */
diff --git a/winsup/cygwin/include/cygwin/grp.h b/winsup/cygwin/include/cygwin/grp.h
deleted file mode 100644
index 7dcae637d..000000000
--- a/winsup/cygwin/include/cygwin/grp.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* cygwin/grp.h
-
- Copyright 2002 Red Hat Inc.
- Written by Corinna Vinschen <corinna@vinschen.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. */
-
-#ifndef _CYGWIN_GRP_H_
-#define _CYGWIN_GRP_H_
-
-#include <sys/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __INSIDE_CYGWIN__
-struct __group16
-{
- char *gr_name;
- char *gr_passwd;
- __gid16_t gr_gid;
- char **gr_mem;
-};
-
-struct __group32
-{
- char *gr_name;
- char *gr_passwd;
- __gid32_t gr_gid;
- char **gr_mem;
-};
-
-struct __group32 * getgrgid32 (__gid32_t gid);
-struct __group32 * getgrnam32 (const char *name);
-__gid32_t getgid32 ();
-__gid32_t getegid32 ();
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _CYGWIN_GRP_H_ */
diff --git a/winsup/cygwin/include/cygwin/icmp.h b/winsup/cygwin/include/cygwin/icmp.h
deleted file mode 100644
index 7e7aedccd..000000000
--- a/winsup/cygwin/include/cygwin/icmp.h
+++ /dev/null
@@ -1 +0,0 @@
-/* icmp.h */
diff --git a/winsup/cygwin/include/cygwin/if.h b/winsup/cygwin/include/cygwin/if.h
deleted file mode 100644
index b0953de36..000000000
--- a/winsup/cygwin/include/cygwin/if.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* cygwin/if.h
-
- Copyright 1996, 2001 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 _CYGWIN_IF_H_
-#define _CYGWIN_IF_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-/* Standard interface flags. */
-#define IFF_UP 0x1 /* interface is up */
-#define IFF_BROADCAST 0x2 /* broadcast address valid */
-#define IFF_LOOPBACK 0x8 /* is a loopback net */
-#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */
-#define IFF_RUNNING 0x40 /* resources allocated */
-#define IFF_PROMISC 0x100 /* receive all packets */
-#define IFF_MULTICAST 0x1000 /* Supports multicast */
-
-/*
- * Interface request structure used for socket
- * ioctl's. All interface ioctl's must have parameter
- * definitions which begin with ifr_name. The
- * remainder may be interface specific.
- */
-
-struct ifreq
-{
-#define IFNAMSIZ 16
-#define IFHWADDRLEN 6
- union
- {
- char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */
- } ifr_ifrn;
-
- union {
- struct sockaddr ifru_addr;
- struct sockaddr ifru_broadaddr;
- struct sockaddr ifru_netmask;
- struct sockaddr ifru_hwaddr;
- short ifru_flags;
- int ifru_metric;
- int ifru_mtu;
- } ifr_ifru;
-};
-
-#define ifr_name ifr_ifrn.ifrn_name /* interface name */
-#define ifr_addr ifr_ifru.ifru_addr /* address */
-#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
-#define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */
-#define ifr_flags ifr_ifru.ifru_flags /* flags */
-#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
-#define ifr_metric ifr_ifru.ifru_metric /* metric */
-#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
-
-
-/*
- * Structure used in SIOCGIFCONF request.
- * Used to retrieve interface configuration
- * for machine (useful for programs which
- * must know all networks accessible).
- */
-
-struct ifconf
-{
- int ifc_len; /* size of buffer */
- union
- {
- caddr_t ifcu_buf;
- struct ifreq *ifcu_req;
- } ifc_ifcu;
-};
-#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
-#define ifc_req ifc_ifcu.ifcu_req /* array of structures */
-
-#ifdef __cplusplus
-};
-#endif /* __cplusplus */
-
-#endif /* _CYGWIN_IF_H_ */
diff --git a/winsup/cygwin/include/cygwin/in.h b/winsup/cygwin/include/cygwin/in.h
deleted file mode 100644
index ff6952743..000000000
--- a/winsup/cygwin/include/cygwin/in.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * INET An implementation of the TCP/IP protocol suite for the LINUX
- * operating system. INET is implemented using the BSD Socket
- * interface as the means of communication with the user level.
- *
- * Definitions of the Internet Protocol.
- *
- * Version: @(#)in.h 1.0.1 04/21/93
- *
- * Authors: Original taken from the GNU Project <netinet/in.h> file.
- * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
- *
- * 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.
- */
-#ifndef _CYGWIN_IN_H
-#define _CYGWIN_IN_H
-
-#include <cygwin/types.h>
-
-/* Standard well-defined IP protocols. */
-enum {
- IPPROTO_IP = 0, /* Dummy protocol for TCP */
- IPPROTO_ICMP = 1, /* Internet Control Message Protocol */
- IPPROTO_IGMP = 2, /* Internet Gateway Management Protocol */
- IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94) */
- IPPROTO_TCP = 6, /* Transmission Control Protocol */
- IPPROTO_EGP = 8, /* Exterior Gateway Protocol */
- IPPROTO_PUP = 12, /* PUP protocol */
- IPPROTO_UDP = 17, /* User Datagram Protocol */
- IPPROTO_IDP = 22, /* XNS IDP protocol */
-
- IPPROTO_RAW = 255, /* Raw IP packets */
- IPPROTO_MAX
-};
-
-/* Standard well-known ports. *//* from winsup/include/netinet/in.h */
-enum
- {
- IPPORT_ECHO = 7, /* Echo service. */
- IPPORT_DISCARD = 9, /* Discard transmissions service. */
- IPPORT_SYSTAT = 11, /* System status service. */
- IPPORT_DAYTIME = 13, /* Time of day service. */
- IPPORT_NETSTAT = 15, /* Network status service. */
- IPPORT_FTP = 21, /* File Transfer Protocol. */
- IPPORT_TELNET = 23, /* Telnet protocol. */
- IPPORT_SMTP = 25, /* Simple Mail Transfer Protocol. */
- IPPORT_TIMESERVER = 37, /* Timeserver service. */
- IPPORT_NAMESERVER = 42, /* Domain Name Service. */
- IPPORT_WHOIS = 43, /* Internet Whois service. */
- IPPORT_MTP = 57,
-
- IPPORT_TFTP = 69, /* Trivial File Transfer Protocol. */
- IPPORT_RJE = 77,
- IPPORT_FINGER = 79, /* Finger service. */
- IPPORT_TTYLINK = 87,
- IPPORT_SUPDUP = 95, /* SUPDUP protocol. */
-
-
- IPPORT_EXECSERVER = 512, /* execd service. */
- IPPORT_LOGINSERVER = 513, /* rlogind service. */
- IPPORT_CMDSERVER = 514,
- IPPORT_EFSSERVER = 520,
-
- /* UDP ports. */
- IPPORT_BIFFUDP = 512,
- IPPORT_WHOSERVER = 513,
- IPPORT_ROUTESERVER = 520,
-
- /* Ports less than this value are reserved for privileged processes. */
- IPPORT_RESERVED = 1024,
-
- /* Ports greater this value are reserved for (non-privileged) servers. */
- IPPORT_USERRESERVED = 5000
- };
-
-
-/* Internet address. */
-struct in_addr {
- unsigned int s_addr;
-};
-
-/* Request struct for multicast socket ops */
-
-struct ip_mreq
-{
- struct in_addr imr_multiaddr; /* IP multicast address of group */
- struct in_addr imr_interface; /* local IP address of interface */
-};
-
-
-/* Structure describing an Internet (IP) socket address. */
-#define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */
-struct sockaddr_in {
- short int sin_family; /* Address family */
- unsigned short int sin_port; /* Port number */
- struct in_addr sin_addr; /* Internet address */
-
- /* Pad to size of `struct sockaddr'. */
- unsigned char __pad[__SOCK_SIZE__ - sizeof(short int) -
- sizeof(unsigned short int) - sizeof(struct in_addr)];
-};
-#define sin_zero __pad /* for BSD UNIX comp. -FvK */
-
-
-/*
- * Definitions of the bits in an Internet address integer.
- * On subnets, host and network parts are found according
- * to the subnet mask, not these masks.
- */
-#define IN_CLASSA(a) ((((long int) (a)) & 0x80000000) == 0)
-#define IN_CLASSA_NET 0xff000000
-#define IN_CLASSA_NSHIFT 24
-#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET)
-#define IN_CLASSA_MAX 128
-
-#define IN_CLASSB(a) ((((long int) (a)) & 0xc0000000) == 0x80000000)
-#define IN_CLASSB_NET 0xffff0000
-#define IN_CLASSB_NSHIFT 16
-#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET)
-#define IN_CLASSB_MAX 65536
-
-#define IN_CLASSC(a) ((((long int) (a)) & 0xe0000000) == 0xc0000000)
-#define IN_CLASSC_NET 0xffffff00
-#define IN_CLASSC_NSHIFT 8
-#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET)
-
-#define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000)
-#define IN_MULTICAST(a) IN_CLASSD(a)
-#define IN_MULTICAST_NET 0xF0000000
-
-#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xe0000000) == 0xe0000000)
-#define IN_BADCLASS(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000)
-
-/* Address to accept any incoming messages. */
-#define INADDR_ANY ((unsigned long int) 0x00000000)
-
-/* Address to send to all hosts. */
-#define INADDR_BROADCAST ((unsigned long int) 0xffffffff)
-
-/* Address indicating an error return. */
-#define INADDR_NONE 0xffffffff
-
-/* Network number for local host loopback. */
-#define IN_LOOPBACKNET 127
-
-/* Address to loopback in software to local host. */
-#define INADDR_LOOPBACK 0x7f000001 /* 127.0.0.1 */
-#define IN_LOOPBACK(a) ((((long int) (a)) & 0xff000000) == 0x7f000000)
-
-/* Defines for Multicast INADDR */
-#define INADDR_UNSPEC_GROUP 0xe0000000 /* 224.0.0.0 */
-#define INADDR_ALLHOSTS_GROUP 0xe0000001 /* 224.0.0.1 */
-#define INADDR_MAX_LOCAL_GROUP 0xe00000ff /* 224.0.0.255 */
-
-/* <asm/byteorder.h> contains the htonl type stuff.. */
-
-#include <asm/byteorder.h>
-
-/* Some random defines to make it easier in the kernel.. */
-#ifdef __KERNEL__
-
-#define LOOPBACK(x) (((x) & htonl(0xff000000)) == htonl(0x7f000000))
-#define MULTICAST(x) (((x) & htonl(0xf0000000)) == htonl(0xe0000000))
-
-#endif
-
-/*
- * IPv6 definitions as we start to include them. This is just
- * a beginning dont get excited 8)
- */
-
-struct in6_addr
-{
- unsigned char s6_addr[16];
-};
-
-struct sockaddr_in6
-{
- unsigned short sin6_family;
- unsigned short sin6_port;
- unsigned long sin6_flowinfo;
- struct in6_addr sin6_addr;
-};
-
-#endif /* _CYGWIN_IN_H */
diff --git a/winsup/cygwin/include/cygwin/in_systm.h b/winsup/cygwin/include/cygwin/in_systm.h
deleted file mode 100644
index 1a2c1b2e7..000000000
--- a/winsup/cygwin/include/cygwin/in_systm.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* System specific type definitions for networking code.
- *
- * Version: @(#)in_systm.h 1.0.0 06/07/00
- *
- * Authors: Original taken from the GNU Project <netinet/in_systm.h> file.
- * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
- *
- * 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.
- */
-#ifndef _CYGWIN_IN_SYSTM_H
-#define _CYGWIN_IN_SYSTM_H
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-__BEGIN_DECLS
-
-/*
- * Network order versions of various data types. Unfortunately, BSD
- * assumes specific sizes for shorts (16 bit) and longs (32 bit) which
- * don't hold in general. As a consequence, the network order versions
- * may not reflect the actual size of the native data types.
- */
-
-typedef u_int16_t n_short; /* short as received from the net */
-typedef u_int32_t n_long; /* long as received from the net */
-typedef u_int32_t n_time; /* ms since 00:00 GMT, byte rev */
-
-__END_DECLS
-
-#endif /* _CYGWIN_IN_SYSTM_H */
diff --git a/winsup/cygwin/include/cygwin/mtio.h b/winsup/cygwin/include/cygwin/mtio.h
deleted file mode 100644
index 04e65234c..000000000
--- a/winsup/cygwin/include/cygwin/mtio.h
+++ /dev/null
@@ -1,205 +0,0 @@
-/* cygwin/mtio.h
-
- Copyright 1999, 2001 Red Hat, Inc.
-
- Written by Corinna Vinschen <corinna@vinschen.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. */
-
-/* cygwin/mtio.h header file for Cygwin.
-
- by C. Vinschen. */
-
-#ifndef _CYGWIN_MTIO_H
-#define _CYGWIN_MTIO_H
-
-#include <sys/ioctl.h>
-#include <asm/socket.h>
-
-#ifndef DEFTAPE
-#define DEFTAPE "/dev/tape"
-#endif
-
-/*
- * Structures and definitions for mag tape io control commands
- */
-
-/* structure for MTIOCTOP - mag tape op command */
-struct mtop {
- short mt_op; /* operations defined below */
- int mt_count; /* how many of them */
-};
-
-/* Magnetic Tape operations [Not all operations supported by all drivers]: */
-#define MTRESET 0 /* +reset drive in case of problems */
-#define MTFSF 1 /* forward space over FileMark,
- * position at first record of next file
- */
-#define MTBSF 2 /* backward space FileMark (position before FM) */
-#define MTFSR 3 /* forward space record */
-#define MTBSR 4 /* backward space record */
-#define MTWEOF 5 /* write an end-of-file record (mark) */
-#define MTREW 6 /* rewind */
-#define MTOFFL 7 /* rewind and put the drive offline (eject?) */
-#define MTNOP 8 /* no op, set status only (read with MTIOCGET) */
-#define MTRETEN 9 /* retension tape */
-#define MTBSFM 10 /* +backward space FileMark, position at FM */
-#define MTFSFM 11 /* +forward space FileMark, position at FM */
-#define MTEOM 12 /* goto end of recorded media (for appending files).
- * MTEOM positions after the last FM, ready for
- * appending another file.
- */
-#define MTERASE 13 /* erase tape -- be careful! */
-
-#define MTRAS1 14 /* run self test 1 (nondestructive) */
-#define MTRAS2 15 /* run self test 2 (destructive) */
-#define MTRAS3 16 /* reserved for self test 3 */
-
-#define MTSETBLK 20 /* set block length (SCSI) */
-#define MTSETDENSITY 21 /* set tape density (SCSI) */
-#define MTSEEK 22 /* seek to block (Tandberg, etc.) */
-#define MTTELL 23 /* tell block (Tandberg, etc.) */
-#define MTSETDRVBUFFER 24 /* set the drive buffering according to SCSI-2 */
- /* ordinary buffered operation with code 1 */
-#define MTFSS 25 /* space forward over setmarks */
-#define MTBSS 26 /* space backward over setmarks */
-#define MTWSM 27 /* write setmarks */
-
-#define MTLOCK 28 /* lock the drive door */
-#define MTUNLOCK 29 /* unlock the drive door */
-#define MTLOAD 30 /* execute the SCSI load command */
-#define MTUNLOAD 31 /* execute the SCSI unload command */
-#define MTCOMPRESSION 32/* control compression with SCSI mode page 15 */
-#define MTSETPART 33 /* Change the active tape partition */
-#define MTMKPART 34 /* Format the tape with one or two partitions */
-
-/* structure for MTIOCGET - mag tape get status command */
-
-struct mtget {
- long mt_type; /* type of magtape device
- * Cygwin: MT_ISUNKNOWN */
- long mt_resid; /* residual count: (not sure)
- * number of bytes ignored, or
- * number of files not skipped, or
- * number of records not skipped.
- * Cygwin: remaining KB.
- */
- /* the following registers are device dependent */
- long mt_dsreg; /* status register, Cygwin returns current
- blocksize here. */
- long mt_gstat; /* generic (device independent) status */
- long mt_erreg; /* error register */
- /* The next two fields are not always used */
- long mt_fileno; /* number of current file on tape */
- long mt_blkno; /* current block number */
- /* The next are Windows NT specific */
- long long mt_capacity; /* Tape capacity in bytes */
- long long mt_remaining; /* Remaining bytes */
- int mt_minblksize;
- int mt_maxblksize;
- int mt_defblksize;
- unsigned long mt_featureslow;
- unsigned long mt_featureshigh;
- unsigned long mt_eotwarningzonesize;
-};
-
-/* structure for MTIOCPOS - mag tape get position command */
-
-struct mtpos {
- long mt_blkno; /* current block number */
-};
-
-
-/* mag tape io control commands */
-#define MTIOCTOP _IOW('m', 1, struct mtop) /* do a mag tape op */
-#define MTIOCGET _IOR('m', 2, struct mtget) /* get tape status */
-#define MTIOCPOS _IOR('m', 3, struct mtpos) /* get tape position */
-
-/* Generic Mag Tape (device independent) status macros for examining
- * mt_gstat -- HP-UX compatible.
- * There is room for more generic status bits here, but I don't
- * know which of them are reserved. At least three or so should
- * be added to make this really useful.
- */
-#define GMT_EOF(x) ((x) & 0x80000000)
-#define GMT_BOT(x) ((x) & 0x40000000)
-#define GMT_EOT(x) ((x) & 0x20000000)
-#define GMT_SM(x) ((x) & 0x10000000) /* DDS setmark */
-#define GMT_EOD(x) ((x) & 0x08000000) /* DDS EOD */
-#define GMT_WR_PROT(x) ((x) & 0x04000000)
-/* #define GMT_ ? ((x) & 0x02000000) */
-#define GMT_ONLINE(x) ((x) & 0x01000000)
-#define GMT_D_6250(x) ((x) & 0x00800000)
-#define GMT_D_1600(x) ((x) & 0x00400000)
-#define GMT_D_800(x) ((x) & 0x00200000)
-#define GMT_PADDING(x) ((x) & 0x00100000) /* data padding */
-#define GMT_HW_ECC(x) ((x) & 0x00080000) /* HW error correction */
-#define GMT_DR_OPEN(x) ((x) & 0x00040000) /* door open (no tape) */
-#define GMT_HW_COMP(x) ((x) & 0x00020000) /* HW compression */
-#define GMT_IM_REP_EN(x) ((x) & 0x00010000) /* immediate report mode */
-/* 16 generic status bits unused */
-
-
-/* SCSI-tape specific definitions */
-/* Bitfield shifts in the status mt_dsreg */
-#define MT_ST_BLKSIZE_SHIFT 0
-#define MT_ST_BLKSIZE_MASK 0xffffff
-#define MT_ST_DENSITY_SHIFT 24
-#define MT_ST_DENSITY_MASK 0xff000000
-
-#define MT_ST_SOFTERR_SHIFT 0
-#define MT_ST_SOFTERR_MASK 0xffff
-
-/*
- * Constants for mt_type. Not all of these are supported,
- * and these are not all of the ones that are supported.
- */
-#define MT_ISUNKNOWN 0x01
-#define MT_ISQIC02 0x02 /* Generic QIC-02 tape streamer */
-#define MT_ISWT5150 0x03 /* Wangtek 5150EQ, QIC-150, QIC-02 */
-#define MT_ISARCHIVE_5945L2 0x04 /* Archive 5945L-2, QIC-24, QIC-02? */
-#define MT_ISCMSJ500 0x05 /* CMS Jumbo 500 (QIC-02?) */
-#define MT_ISTDC3610 0x06 /* Tandberg 6310, QIC-24 */
-#define MT_ISARCHIVE_VP60I 0x07 /* Archive VP60i, QIC-02 */
-#define MT_ISARCHIVE_2150L 0x08 /* Archive Viper 2150L */
-#define MT_ISARCHIVE_2060L 0x09 /* Archive Viper 2060L */
-#define MT_ISARCHIVESC499 0x0A /* Archive SC-499 QIC-36 controller */
-#define MT_ISQIC02_ALL_FEATURES 0x0F /* Generic QIC-02 with all features */
-#define MT_ISWT5099EEN24 0x11 /* Wangtek 5099-een24, 60MB, QIC-24 */
-#define MT_ISTEAC_MT2ST 0x12 /* Teac MT-2ST 155mb drive, Teac DC-1 card (Wangtek type) */
-#define MT_ISEVEREX_FT40A 0x32 /* Everex FT40A (QIC-40) */
-#define MT_ISDDS1 0x51 /* DDS device without partitions */
-#define MT_ISDDS2 0x52 /* DDS device with partitions */
-#define MT_ISSCSI1 0x71 /* Generic ANSI SCSI-1 tape unit */
-#define MT_ISSCSI2 0x72 /* Generic ANSI SCSI-2 tape unit */
-
-struct mt_tape_info {
- long t_type; /* device type id (mt_type) */
- char *t_name; /* descriptive name */
-};
-
-#define MT_TAPE_INFO { \
- {MT_ISUNKNOWN, "Unknown type of tape device"}, \
- {MT_ISQIC02, "Generic QIC-02 tape streamer"}, \
- {MT_ISWT5150, "Wangtek 5150, QIC-150"}, \
- {MT_ISARCHIVE_5945L2, "Archive 5945L-2"}, \
- {MT_ISCMSJ500, "CMS Jumbo 500"}, \
- {MT_ISTDC3610, "Tandberg TDC 3610, QIC-24"}, \
- {MT_ISARCHIVE_VP60I, "Archive VP60i, QIC-02"}, \
- {MT_ISARCHIVE_2150L, "Archive Viper 2150L"}, \
- {MT_ISARCHIVE_2060L, "Archive Viper 2060L"}, \
- {MT_ISARCHIVESC499, "Archive SC-499 QIC-36 controller"}, \
- {MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"}, \
- {MT_ISWT5099EEN24, "Wangtek 5099-een24, 60MB"}, \
- {MT_ISTEAC_MT2ST, "Teac MT-2ST 155mb data cassette drive"}, \
- {MT_ISEVEREX_FT40A, "Everex FT40A, QIC-40"}, \
- {MT_ISSCSI1, "Generic SCSI-1 tape"}, \
- {MT_ISSCSI2, "Generic SCSI-2 tape"}, \
- {0, NULL} \
-}
-
-#endif /* _CYGWIN_MTIO_H */
diff --git a/winsup/cygwin/include/cygwin/rdevio.h b/winsup/cygwin/include/cygwin/rdevio.h
deleted file mode 100644
index 73059ac09..000000000
--- a/winsup/cygwin/include/cygwin/rdevio.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* cygwin/rdevio.h
-
- Copyright 1999, 2001 Red Hat, Inc.
-
- Written by Corinna Vinschen <corinna@vinschen.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. */
-
-/*
- * cygwin/rdevio.h header file for Cygwin.
- *
- * Written by C. Vinschen.
- */
-
-#ifndef _CYGWIN_RDEVIO_H
-#define _CYGWIN_RDEVIO_H
-
-/* structure for RDIOCDOP - raw device operation */
-struct rdop {
- short rd_op;
- unsigned long rd_parm;
-};
-
-/* Raw device operations */
-#define RDSETBLK 1 /* set buffer for driver */
-
-/* structure for RDIOCGET - get raw device */
-struct rdget {
- unsigned long bufsiz;
-};
-
-/*
- * ioctl commands
-*/
-#define RDIOCDOP _IOW('r', 128, struct rdop)
-#define RDIOCGET _IOR('r', 129, struct rdget)
-
-#endif /* _CYGWIN_RDEVIO_H */
diff --git a/winsup/cygwin/include/cygwin/socket.h b/winsup/cygwin/include/cygwin/socket.h
deleted file mode 100644
index b66c38f73..000000000
--- a/winsup/cygwin/include/cygwin/socket.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/* cygwin/socket.h
-
- Copyright 1999, 2000, 2001 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 _CYGWIN_SOCKET_H
-#define _CYGWIN_SOCKET_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-struct sockaddr {
- unsigned short sa_family; /* address family, AF_xxx */
- char sa_data[14]; /* 14 bytes of protocol address */
-};
-
-#include <asm/socket.h> /* arch-dependent defines */
-#include <cygwin/sockios.h> /* the SIOCxxx I/O controls */
-#include <cygwin/uio.h> /* iovec support */
-#include <sys/types.h>
-
-struct linger {
- unsigned short l_onoff; /* Linger active */
- unsigned short l_linger; /* How long to linger for */
-};
-
-struct msghdr
-{
- void * msg_name; /* Socket name */
- int msg_namelen; /* Length of name */
- struct iovec * msg_iov; /* Data blocks */
- int msg_iovlen; /* Number of blocks */
- void * msg_accrights; /* Per protocol magic (eg BSD file descriptor passing) */
- int msg_accrightslen; /* Length of rights list */
-};
-
-#ifndef socklen_t
-#define socklen_t int
-#endif
-
-/* Socket types. */
-#define SOCK_STREAM 1 /* stream (connection) socket */
-#define SOCK_DGRAM 2 /* datagram (conn.less) socket */
-#define SOCK_RAW 3 /* raw socket */
-#define SOCK_RDM 4 /* reliably-delivered message */
-#define SOCK_SEQPACKET 5 /* sequential packet socket */
-
-/* Supported address families. */
-/*
- * Address families.
- */
-#define AF_UNSPEC 0 /* unspecified */
-#define AF_UNIX 1 /* local to host (pipes, portals) */
-#define AF_LOCAL 1 /* POSIX name for AF_UNIX */
-#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
-#define AF_IMPLINK 3 /* arpanet imp addresses */
-#define AF_PUP 4 /* pup protocols: e.g. BSP */
-#define AF_CHAOS 5 /* mit CHAOS protocols */
-#define AF_NS 6 /* XEROX NS protocols */
-#define AF_ISO 7 /* ISO protocols */
-#define AF_OSI AF_ISO /* OSI is ISO */
-#define AF_ECMA 8 /* european computer manufacturers */
-#define AF_DATAKIT 9 /* datakit protocols */
-#define AF_CCITT 10 /* CCITT protocols, X.25 etc */
-#define AF_SNA 11 /* IBM SNA */
-#define AF_DECnet 12 /* DECnet */
-#define AF_DLI 13 /* Direct data link interface */
-#define AF_LAT 14 /* LAT */
-#define AF_HYLINK 15 /* NSC Hyperchannel */
-#define AF_APPLETALK 16 /* AppleTalk */
-#define AF_NETBIOS 17 /* NetBios-style addresses */
-#define AF_INET6 23 /* IP version 6 */
-
-#define AF_MAX 32
-/*
- * Protocol families, same as address families for now.
- */
-#define PF_UNSPEC AF_UNSPEC
-#define PF_UNIX AF_UNIX
-#define PF_LOCAL AF_LOCAL
-#define PF_INET AF_INET
-#define PF_IMPLINK AF_IMPLINK
-#define PF_PUP AF_PUP
-#define PF_CHAOS AF_CHAOS
-#define PF_NS AF_NS
-#define PF_ISO AF_ISO
-#define PF_OSI AF_OSI
-#define PF_ECMA AF_ECMA
-#define PF_DATAKIT AF_DATAKIT
-#define PF_CCITT AF_CCITT
-#define PF_SNA AF_SNA
-#define PF_DECnet AF_DECnet
-#define PF_DLI AF_DLI
-#define PF_LAT AF_LAT
-#define PF_HYLINK AF_HYLINK
-#define PF_APPLETALK AF_APPLETALK
-#define PF_NETBIOS AF_NETBIOS
-#define PF_INET6 AF_INET6
-
-#define PF_MAX AF_MAX
-
-/* Maximum queue length specificable by listen. */
-#define SOMAXCONN 5
-
-/* Flags we can use with send/ and recv. */
-#define MSG_OOB 0x1 /* process out-of-band data */
-#define MSG_PEEK 0x2 /* peek at incoming message */
-#define MSG_DONTROUTE 0x4 /* send without using routing tables */
-
-/* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */
-#define SOL_IP 0
-#define SOL_IPX 256
-#define SOL_AX25 257
-#define SOL_ATALK 258
-#define SOL_NETROM 259
-#define SOL_TCP 6
-#define SOL_UDP 17
-
-/* IP options */
-#ifndef IPTOS_LOWDELAY
-#define IPTOS_LOWDELAY 0x10
-#define IPTOS_THROUGHPUT 0x08
-#define IPTOS_RELIABILITY 0x04
-#endif
-
-/* These need to appear somewhere around here */
-#define IP_DEFAULT_MULTICAST_TTL 1
-#define IP_DEFAULT_MULTICAST_LOOP 1
-#define IP_MAX_MEMBERSHIPS 20
-
-/* IP options for use with WinSock */
-
-#define IP_OPTIONS 1
-#define IP_MULTICAST_IF 2
-#define IP_MULTICAST_TTL 3
-#define IP_MULTICAST_LOOP 4
-#define IP_ADD_MEMBERSHIP 5
-#define IP_DROP_MEMBERSHIP 6
-#define IP_TTL 7
-#define IP_TOS 8
-#define IP_DONTFRAGMENT 9
-
-/* IPX options */
-#define IPX_TYPE 1
-
-/* TCP options - this way around because someone left a set in the c library includes */
-#ifndef TCP_NODELAY
-#define TCP_NODELAY 0x0001
-#define TCP_MAXSEG 2
-#endif
-
-/* The various priorities. */
-#define SOPRI_INTERACTIVE 0
-#define SOPRI_NORMAL 1
-#define SOPRI_BACKGROUND 2
-
-#ifdef __cplusplus
-};
-#endif /* __cplusplus */
-
-#endif /* _CYGWIN_SOCKET_H */
diff --git a/winsup/cygwin/include/cygwin/sockios.h b/winsup/cygwin/include/cygwin/sockios.h
deleted file mode 100644
index 2e756954e..000000000
--- a/winsup/cygwin/include/cygwin/sockios.h
+++ /dev/null
@@ -1 +0,0 @@
-/* sockios.h */
diff --git a/winsup/cygwin/include/cygwin/stat.h b/winsup/cygwin/include/cygwin/stat.h
deleted file mode 100644
index 5772a3754..000000000
--- a/winsup/cygwin/include/cygwin/stat.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* cygwin/stat.h
-
- Copyright 2002 Red Hat Inc.
- Written by Corinna Vinschen <corinna@vinschen.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. */
-
-#ifndef _CYGWIN_STAT_H
-#define _CYGWIN_STAT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __INSIDE_CYGWIN__
-struct __stat32
-{
- __dev16_t st_dev;
- ino_t st_ino;
- mode_t st_mode;
- nlink_t st_nlink;
- __uid16_t st_uid;
- __gid16_t st_gid;
- __dev16_t st_rdev;
- __off32_t st_size;
- timestruc_t st_atim;
- timestruc_t st_mtim;
- timestruc_t st_ctim;
- blksize_t st_blksize;
- __blkcnt32_t st_blocks;
- long st_spare4[2];
-};
-
-struct __stat64
-{
- __dev32_t st_dev;
- ino_t st_ino;
- mode_t st_mode;
- nlink_t st_nlink;
- __uid32_t st_uid;
- __gid32_t st_gid;
- __dev32_t st_rdev;
- __off64_t st_size;
- timestruc_t st_atim;
- timestruc_t st_mtim;
- timestruc_t st_ctim;
- blksize_t st_blksize;
- __blkcnt64_t st_blocks;
- long st_spare4[2];
-};
-
-extern int fstat64 (int fd, struct __stat64 *buf);
-extern int stat64 (const char *file_name, struct __stat64 *buf);
-extern int lstat64 (const char *file_name, struct __stat64 *buf);
-
-#endif
-
-struct stat
-{
- dev_t st_dev;
- ino_t st_ino;
- mode_t st_mode;
- nlink_t st_nlink;
- uid_t st_uid;
- gid_t st_gid;
- dev_t st_rdev;
- off_t st_size;
- timestruc_t st_atim;
- timestruc_t st_mtim;
- timestruc_t st_ctim;
- blksize_t st_blksize;
- blkcnt_t st_blocks;
- long st_spare4[2];
-};
-
-#define st_atime st_atim.tv_sec
-#define st_mtime st_mtim.tv_sec
-#define st_ctime st_ctim.tv_sec
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _CYGWIN_STAT_H */
diff --git a/winsup/cygwin/include/cygwin/types.h b/winsup/cygwin/include/cygwin/types.h
deleted file mode 100644
index 69bfa2056..000000000
--- a/winsup/cygwin/include/cygwin/types.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* types.h
-
- Copyright 2001, 2002 Red Hat Inc.
- Written by Robert Collins <rbtcollins@hotmail.com>
-
-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 __cplusplus
-extern "C"
-{
-#endif
-
-#ifndef _CYGWIN_TYPES_H
-#define _CYGWIN_TYPES_H
-
-#include <sys/sysmacros.h>
-
-typedef struct timespec timespec_t, timestruc_t;
-
-typedef long __off32_t;
-typedef long long __off64_t;
-#ifdef __CYGWIN_USE_BIG_TYPES__
-typedef __off64_t off_t;
-#else
-typedef __off32_t off_t;
-#endif
-
-typedef short __dev16_t;
-typedef unsigned long __dev32_t;
-#ifdef __CYGWIN_USE_BIG_TYPES__
-typedef __dev32_t dev_t;
-#else
-typedef __dev16_t dev_t;
-#endif
-
-typedef long blksize_t;
-
-typedef long __blkcnt32_t;
-typedef long long __blkcnt64_t;
-#ifdef __CYGWIN_USE_BIG_TYPES__
-typedef __blkcnt64_t blkcnt_t;
-#else
-typedef __blkcnt32_t blkcnt_t;
-#endif
-
-typedef unsigned short __uid16_t;
-typedef unsigned short __gid16_t;
-typedef unsigned long __uid32_t;
-typedef unsigned long __gid32_t;
-#ifdef __CYGWIN_USE_BIG_TYPES__
-typedef __uid32_t uid_t;
-typedef __gid32_t gid_t;
-#else
-typedef __uid16_t uid_t;
-typedef __gid16_t gid_t;
-#endif
-
-#if !defined(__INSIDE_CYGWIN__) || !defined(__cplusplus)
-
-typedef void *pthread_t;
-typedef void *pthread_mutex_t;
-
-typedef void *pthread_key_t;
-typedef void *pthread_attr_t;
-typedef void *pthread_mutexattr_t;
-typedef void *pthread_condattr_t;
-typedef void *pthread_cond_t;
-
- /* These variables are not user alterable. This means you!. */
-typedef struct
-{
- pthread_mutex_t mutex;
- int state;
-}
-pthread_once_t;
-typedef void *pthread_rwlock_t;
-typedef void *pthread_rwlockattr_t;
-
-#else
-
-/* pthreads types */
-
-typedef class pthread *pthread_t;
-typedef class pthread_mutex *pthread_mutex_t;
-typedef class pthread_key *pthread_key_t;
-typedef class pthread_attr *pthread_attr_t;
-typedef class pthread_mutexattr *pthread_mutexattr_t;
-typedef class pthread_condattr *pthread_condattr_t;
-typedef class pthread_cond *pthread_cond_t;
-typedef class pthread_once pthread_once_t;
-typedef class pthread_rwlock *pthread_rwlock_t;
-typedef class pthread_rwlockattr *pthread_rwlockattr_t;
-
-/* semaphores types */
-typedef class semaphore *sem_t;
-#endif /* __INSIDE_CYGWIN__ */
-#endif /* _CYGWIN_TYPES_H */
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/winsup/cygwin/include/cygwin/uio.h b/winsup/cygwin/include/cygwin/uio.h
deleted file mode 100644
index 18c77ae65..000000000
--- a/winsup/cygwin/include/cygwin/uio.h
+++ /dev/null
@@ -1 +0,0 @@
-/* uio.h */
diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h
deleted file mode 100644
index 6ab596e09..000000000
--- a/winsup/cygwin/include/cygwin/version.h
+++ /dev/null
@@ -1,225 +0,0 @@
-/* version.h -- Cygwin version numbers and accompanying documentation.
-
- Copyright 1996, 1997, 1998, 1999, 2000, 2001 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. */
-
-/* Cygwin versioning is relatively complicated because of its status
- as a shared library. Let's start with how versioning used to be done.
-
- Historical versioning in Cygwin 16.0 to 19.5:
-
- In the olden days of Cygwin, we had a dll major and minor version
- and a registry version. The major number started at 16 because the
- "b15" GNU-Win32 release of the compiler tools was out when this
- scheme was started. We incremented the DLL name frequently (for
- every official release) and towards the end of this period every
- release used a different shared memory area to prevent DLLs from
- interfering with each other (embedding a build timestamp into the
- name of the shared memory area). This turned out to be a Bad Idea
- (tm) because people needed to mingle separate releases and have
- them work together more than we thought they would. This was
- especially problematic when tty info needed to be retained when an
- old Cygwin executable executed a newer one.
-
- In the old scheme, we incremented the major number whenever a
- change to the dll invalidated existing executables. This can
- happen for a number of reasons, including when functions are
- removed from the export list of the dll. The minor number was
- incremented when a change was made that we wanted to record, but
- that didn't invalidate existing executables. Both numbers were
- recorded in the executable and in the dll.
-
- In October 1998 (starting with Cygwin 19.6), we started a new
- means of Cygwin versioning: */
-
- /* The DLL major and minor numbers correspond to the "version of
- the Cygwin library". This version is used to track important
- changes to the DLL and is mainly informative in nature. */
-
- /* The current cygwin version is 1.3.6 */
-
-#define CYGWIN_VERSION_DLL_MAJOR 1003
-#define CYGWIN_VERSION_DLL_MINOR 11
-
- /* Major numbers before CYGWIN_VERSION_DLL_EPOCH are
- incompatible. */
-
-#define CYGWIN_VERSION_DLL_EPOCH 19
-
- /* CYGWIN_VERSION_DLL_COMBINED gives us a single number
- representing the combined DLL major and minor numbers. */
-
- /* WATCH OUT FOR OCTAL! Don't use, say, "00020" for 0.20 */
-
-#define CYGWIN_VERSION_DLL_MAKE_COMBINED(maj, min) (((maj) * 1000) + min)
-#define CYGWIN_VERSION_DLL_COMBINED \
- CYGWIN_VERSION_DLL_MAKE_COMBINED (CYGWIN_VERSION_DLL_MAJOR, CYGWIN_VERSION_DLL_MINOR)
-
- /* Every version of cygwin <= this uses an old, incorrect method
- to determine signal masks. */
-
-#define CYGWIN_VERSION_DLL_BAD_SIGNAL_MASK 19005
-
- /* API versions <= this had a termios structure whose members were
- too small to accomodate modern settings. */
-#define CYGWIN_VERSION_DLL_OLD_TERMIOS 5
-#define CYGWIN_VERSION_DLL_IS_OLD_TERMIOS \
- (CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) <= \
- CYGWIN_VERSION_DLL_OLD_TERMIOS)
-
-#define CYGWIN_VERSION_DLL_MALLOC_ENV 28
- /* Old APIs had getc/putc macros that conflict with new CR/LF
- handling in the stdio buffers */
-#define CYGWIN_VERSION_OLD_STDIO_CRLF_HANDLING \
- (CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) <= \
- 20)
-
-#define CYGWIN_VERSION_CHECK_FOR_S_IEXEC \
- (CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) >= \
- 36)
-
-#define CYGWIN_VERSION_CHECK_FOR_OLD_O_NONBLOCK \
- (CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) <= \
- 28)
- /* We used to use the DLL major/minor to track
- non-backward-compatible interface changes to the API. Now we
- use an API major/minor number for this purpose. */
-
- /* API_MAJOR 0.0: Initial version. API_MINOR changes:
- 1: Export cygwin32_ calls as cygwin_ as well.
- 2: Export j1, jn, y1, yn.
- 3: Export dll_noncygwin_dllcrt0.
- 4: New socket ioctls, revamped ifconf support.
- 5: Thread support/exports.
- 6: Change in termios handling.
- 7: Export scandir and alphasort.
- 8: Export _ctype_, _sys_errlist, _sys_nerr.
- 9: Mount-related changes, new cygwin_umount export.
- Raw device support (tape, floppies).
- 10: Fast math routine support added.
- 11: Export seekdir, telldir.
- 12: Export pthread_join, pthread_detach.
- 13: Export math funcs gamma and friends, also _j0, _j1, etc.
- 14: Export snprintf and vnsprintf.
- 15: Export glob
- 16: Export cygwin_stackdump
- 17: Export fast math stuff
- 18: Stop exporting _strace_wm
- 19: Export fchown, lchown, lacl
- 20: regsub, inet_network
- 21: incompatible change to stdio cr/lf and buffering
- 22: Export cygwin_logon_user, cygwin_set_impersonation_token.
- geteuid, getegid return effective uid/gid.
- getuid, getgid return real uid/gid.
- seteuid, setegid set only effective uid/gid.
- setuid, setgid set effective and real uid/gid.
- 23: Export new dll_crt0 interface and cygwin_user_data for use
- with crt0 startup code.
- 24: Export poll and _poll.
- 25: Export getmode and _getmode.
- 26: CW_GET_CYGDRIVE_PREFIXES addition to external.cc
- 27: CW_GETPINFO_FULL addition to external.cc
- 28: Accidentally bumped by cgf
- 29: Export hstrerror
- 30: CW_GET_CYGDRIVE_INFO addition to external.cc
- 31: Export inet_aton
- 32: Export getrlimit/setrlimit
- 33: Export setlogmask
- 34: Separated out mount table
- 35: Export drand48, erand48, jrand48, lcong48, lrand48,
- mrand48, nrand48, seed48, and srand48.
- 36: Added _cygwin_S_IEXEC, et al
- 37: [f]pathconv support _PC_POSIX_PERMISSIONS and _PC_POSIX_SECURITY
- 38: vscanf, vscanf_r, and random pthread functions
- 39: asctime_r, ctime_r, gmtime_r, localtime_r
- 40: fchdir
- 41: __signgam
- 42: sys_errlist, sys_nerr
- 43: sigsetjmp, siglongjmp fixed
- 44: Export dirfd
- 45: perprocess change, gamma_r, gammaf_r, lgamma_r, lgammaf_r
- 46: Remove cygwin_getshared
- 47: Report EOTWarningZoneSize in struct mtget.
- 48: Export "posix" regex functions
- 49: Export setutent, endutent, utmpname, getutent, getutid, getutline.
- 50: Export fnmatch.
- 51: Export recvmsg, sendmsg.
- 52: Export strptime
- 53: Export strlcat, strlcpy.
- */
-
- /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
-
-#define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 53
-
- /* There is also a compatibity version number associated with the
- shared memory regions. It is incremented when incompatible
- changes are made to the shared memory region *or* to any named
- shared mutexes, semaphores, etc. The arbitrary starting
- version was 0 (cygwin release 98r2). */
-
-#define CYGWIN_VERSION_SHARED_DATA 3
-
- /* An identifier used in the names used to create shared objects.
- The full names include the CYGWIN_VERSION_SHARED_DATA version
- as well as this identifier. */
-
-#define CYGWIN_VERSION_DLL_IDENTIFIER "cygwin1"
-
- /* The Cygwin mount table interface in the Win32 registry also
- has a version number associated with it in case that is
- changed in a non-backwards compatible fashion. Increment this
- version number whenever incompatible changes in mount table
- registry usage are made.
-
- 1: Original number version.
- 2: New mount registry layout, system-wide mount accessibility.
- */
-
-#define CYGWIN_VERSION_MOUNT_REGISTRY 2
-
- /* Identifiers used in the Win32 registry. */
-
-#define CYGWIN_INFO_CYGNUS_REGISTRY_NAME "Cygnus Solutions"
-#define CYGWIN_INFO_CYGWIN_REGISTRY_NAME "Cygwin"
-#define CYGWIN_INFO_PROGRAM_OPTIONS_NAME "Program Options"
-#define CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME "mounts v2"
-#define CYGWIN_INFO_CYGDRIVE_FLAGS "cygdrive flags"
-#define CYGWIN_INFO_CYGDRIVE_PREFIX "cygdrive prefix"
-#define CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX "/cygdrive"
-
- /* In addition to the above version number strings, the build
- process adds some strings that may be useful in
- debugging/identifying a particular Cygwin DLL:
-
- The mkvers.sh script at the top level produces a .cc file
- which initializes a cygwin_version structure based on the
- above version information and creates a string table for
- grepping via "fgrep '%%%' cygwinwhatever.dll" if you are
- using GNU grep. Otherwise you may want to do a
- "strings cygwinwhatever.dll | fgrep '%%%'" instead.
-
- This will produce output such as:
-
- %%% Cygwin dll_identifier: cygwin
- %%% Cygwin api_major: 0
- %%% Cygwin api_minor: 0
- %%% Cygwin dll_major: 19
- %%% Cygwin dll_minor: 6
- %%% Cygwin shared_data: 1
- %%% Cygwin registry: b15
- %%% Cygwin build date: Wed Oct 14 16:26:51 EDT 1998
- %%% Cygwin shared id: cygwinS1
-
- This information can also be obtained through a call to
- cygwin_internal (CW_GETVERSIONINFO).
- */
-
-#define CYGWIN_VERSION_MAGIC(a, b) ((unsigned) (((unsigned short) a) | (unsigned short) b))
-#define CYGWIN_VERSION_MAGIC_VERSION(a) ((unsigned) ((unsigned)a & 0xffff))
diff --git a/winsup/cygwin/include/dlfcn.h b/winsup/cygwin/include/dlfcn.h
deleted file mode 100644
index 5eaa7061e..000000000
--- a/winsup/cygwin/include/dlfcn.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* dlfcn.h
-
- Copyright 1998, 1999, 2000, 2001 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 _DLFCN_H
-#define _DLFCN_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* declarations used for dynamic linking support routines */
-extern void *dlopen (const char *, int);
-extern void *dlsym (void *, const char *);
-extern int dlclose (void *);
-extern char *dlerror (void);
-
-/* specific to CYGWIN */
-#define FORK_RELOAD 1
-#define FORK_NO_RELOAD 0
-
-extern void dlfork (int);
-
-/* following doesn't exist in Win32 API .... */
-
-/* valid values for mode argument to dlopen */
-#define RTLD_LAZY 1 /* lazy function call binding */
-#define RTLD_NOW 2 /* immediate function call binding */
-#define RTLD_GLOBAL 4 /* symbols in this dlopen'ed obj are visible to other dlopen'ed objs */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _DLFCN_H */
diff --git a/winsup/cygwin/include/exceptions.h b/winsup/cygwin/include/exceptions.h
deleted file mode 100644
index 462000d61..000000000
--- a/winsup/cygwin/include/exceptions.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/* exceptions.h
-
- Copyright 1996, 1997, 1998, 2001 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 _EXCEPTIONS_H
-#define _EXCEPTIONS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/* Documentation on the innards of exception handling (i.e. from the
- perspective of a compiler implementor) apparently doesn't exist. Sigh.
- However, the following came from Onno Hovers <onno@stack.urc.tue.nl>
-
-The first pointer to the chain of handlers is in the thread environment block
-at FS:[0]. This chain has the following format:
-
-typedef struct __EXCEPTION_FRAME
-{
- struct __EXCEPTION_FRAME *Prev; /-* pointer to the previous frame *-/
- PEXCEPTION_HANDLER Handler; /-* handler function *-/
-}
-
-You register an exception handler in your compiler with this simple ASM
-sequence:
- PUSH _MyExceptionHandler
- PUSH FS:[0]
- MOV FS:[0],ESP
-An exception frame MUST be on the stack! The frame may have more fields and
-both Visual C++ and Borland C++ use more fields for themselves.
-
-When an exception occurs the system calls all handlers starting with the
-handler at FS:0, and then the previous etc. until one handler returns
-ExceptionContinueExecution, which is 0. If a handler does not want to handle
-the exception it should just return ExceptionContinueSearch, which is 1.
-
-The handler has the following parameters:
-ehandler (
- PEXCEPTION_RECORD erecord,
- PEXCEPTION_FRAME myframe,
- PCONTEXT context, /-* context before and after *-/
- PVOID dispatch) /-* something *-/
-
-When a handler wants to handle the exception, it has some alternatives:
-
--one is to do do something about the exception condition, like emulating
-an invalid instruction, mapping memory where there was a page fault, etc.
-If the handler wants to have the context of the thread that causes the
-exception changed, it should make that change in the context passed to the
-handler.
-
--the second alternative is to call all exception handlers again, indicating
-that you want them to clean up. This way all the __finally blocks get
-executed. After doing that you change the context passed to the handler so
-the code starts executing in the except block. For this purpose you could
-call RtlUnwind. This (undocumented) function calls all exception handlers
-up to but not including the exception frame passed to it. If NULL is passed
-as exception frame RtlUnwind calls all exception handlers and then exits the
-process. The parameters to RtlUnwind are:
-
-RtlUnwind (
- PEXCEPTION_FRAME endframe,
- PVOID unusedEip,
- PEXCEPTION_RECORD erecord,
- DWORD returnEax)
-
-You should set unusedEip to the address where RtlUnwind should return like
-this:
- PUSH 0
- PUSH OFFSET ReturnUnwind
- PUSH 0
- PUSH 0
- CALL RtlUnwind
-ReturnUnwind:
- .....
-
-If no EXCEPTION_RECORD is passed, RtlUnwind makes a default exception
-record. In any case, the ExceptionFlags part of this record has the
-EH_UNWINDING (=2), flag set. (and EH_EXIT_UNWIND (=4), when NULL is passed as the end
-frame.).
-
-The handler for a exception as well as a for unwinds may be executed in the
-thread causing the exception, but may also be executed in another (special
-exception) thread. So it is not wise to make any assumptions about that!
-
-As an alternative you may consider the SetUnhandledExceptionFilter API
-to install your own exception filter. This one is documented.
-*/
-
-/* The January 1994 MSJ has an article entitled "Clearer, More Comprehensive
- Error Processing with Win32 Structured Exception Handling". It goes into
- a teensy bit of detail of the innards of exception handling (i.e. what we
- have to do). */
-
-typedef int (exception_handler)
- (EXCEPTION_RECORD *, void *, CONTEXT *, void *);
-
-typedef struct _exception_list
-{
- struct _exception_list *prev;
- exception_handler *handler;
-
- /* We're apparently free to add more stuff here.
- At present we don't need any. */
-} exception_list;
-
-void init_exceptions (exception_list *);
-
-#ifdef __cplusplus
-};
-#endif /* __cplusplus */
-
-#endif /* _EXCEPTIONS_H */
diff --git a/winsup/cygwin/include/fcntl.h b/winsup/cygwin/include/fcntl.h
deleted file mode 100644
index 774966e9a..000000000
--- a/winsup/cygwin/include/fcntl.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* fcntl.h
-
- Copyright 1996, 1998, 2001 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 _FCNTL_H
-#define _FCNTL_H
-
-#include <sys/fcntl.h>
-#define O_NDELAY _FNDELAY
-
-#endif /* _FCNTL_H */
diff --git a/winsup/cygwin/include/features.h b/winsup/cygwin/include/features.h
deleted file mode 100644
index 1161909f0..000000000
--- a/winsup/cygwin/include/features.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* features.h
-
- Copyright 2001 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 _FEATURES_H
-#define _FEATURES_H
-
-#include <sys/features.h>
-
-#endif /* _FEATURES_H */
diff --git a/winsup/cygwin/include/fnmatch.h b/winsup/cygwin/include/fnmatch.h
deleted file mode 100644
index e4500abe2..000000000
--- a/winsup/cygwin/include/fnmatch.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $OpenBSD: fnmatch.h,v 1.5 2000/03/24 17:13:23 millert Exp $ */
-/* $NetBSD: fnmatch.h,v 1.5 1994/10/26 00:55:53 cgd Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fnmatch.h 8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _FNMATCH_H_
-#define _FNMATCH_H_
-
-#define FNM_NOMATCH 1 /* Match failed. */
-#define FNM_NOSYS 2 /* Function not supported (unused). */
-
-#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */
-#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */
-#define FNM_PERIOD 0x04 /* Period must be matched by period. */
-#ifndef _POSIX_SOURCE
-#define FNM_LEADING_DIR 0x08 /* Ignore /<tail> after Imatch. */
-#define FNM_CASEFOLD 0x10 /* Case insensitive search. */
-#define FNM_IGNORECASE FNM_CASEFOLD
-#define FNM_FILE_NAME FNM_PATHNAME
-#endif
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-int fnmatch __P((const char *, const char *, int));
-__END_DECLS
-
-#endif /* !_FNMATCH_H_ */
-
-
diff --git a/winsup/cygwin/include/getopt.h b/winsup/cygwin/include/getopt.h
deleted file mode 100644
index 6b6f643b7..000000000
--- a/winsup/cygwin/include/getopt.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 1987, 1993, 1994, 1996
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef __GETOPT_H__
-#define __GETOPT_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern int opterr; /* if error message should be printed */
-extern int optind; /* index into parent argv vector */
-extern int optopt; /* character checked for validity */
-extern int optreset; /* reset getopt */
-extern char *optarg; /* argument associated with option */
-
-int getopt (int, char * const *, const char *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __GETOPT_H__ */
-
-#ifndef __UNISTD_GETOPT__
-#ifndef __GETOPT_LONG_H__
-#define __GETOPT_LONG_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct option {
- const char *name;
- int has_arg;
- int *flag;
- int val;
-};
-
-int getopt_long (int, char *const *, const char *, const struct option *, int *);
-#ifndef HAVE_DECL_GETOPT
-#define HAVE_DECL_GETOPT 1
-#endif
-
-#define no_argument 0
-#define required_argument 1
-#define optional_argument 2
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __GETOPT_LONG_H__ */
-#endif /* __UNISTD_GETOPT__ */
diff --git a/winsup/cygwin/include/glob.h b/winsup/cygwin/include/glob.h
deleted file mode 100644
index 6a393f004..000000000
--- a/winsup/cygwin/include/glob.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* $NetBSD: glob.h,v 1.6.2.2 1997/11/04 23:38:33 thorpej Exp $ */
-
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Guido van Rossum.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)glob.h 8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _GLOB_H_
-#define _GLOB_H_
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-typedef struct {
- int gl_pathc; /* Count of total paths so far. */
- int gl_matchc; /* Count of paths matching pattern. */
- int gl_offs; /* Reserved at beginning of gl_pathv. */
- int gl_flags; /* Copy of flags parameter to glob. */
- char **gl_pathv; /* List of paths matching pattern. */
- /* Copy of errfunc parameter to glob. */
- int (*gl_errfunc) __P((const char *, int));
-
- /*
- * Alternate filesystem access methods for glob; replacement
- * versions of closedir(3), readdir(3), opendir(3), stat(2)
- * and lstat(2).
- */
- void (*gl_closedir) __P((void *));
- struct dirent *(*gl_readdir) __P((void *));
- void *(*gl_opendir) __P((const char *));
-#ifdef __LIBC12_SOURCE__
- int (*gl_lstat) __P((const char *, struct stat12 *));
- int (*gl_stat) __P((const char *, struct stat12 *));
-#else
-#if defined (__INSIDE_CYGWIN__)
- int (*gl_lstat) ();
- int (*gl_stat) ();
-#else
- int (*gl_lstat) __P((const char *, struct stat *));
- int (*gl_stat) __P((const char *, struct stat *));
-#endif
-#endif
-} glob_t;
-
-#define GLOB_APPEND 0x0001 /* Append to output from previous call. */
-#define GLOB_DOOFFS 0x0002 /* Use gl_offs. */
-#define GLOB_ERR 0x0004 /* Return on error. */
-#define GLOB_MARK 0x0008 /* Append / to matching directories. */
-#define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */
-#define GLOB_NOSORT 0x0020 /* Don't sort. */
-
-#ifndef _POSIX_SOURCE
-#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */
-#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */
-#define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */
-#define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */
-#define GLOB_QUOTE 0x0400 /* Quote special chars with \. */
-#define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */
-#endif
-
-#define GLOB_NOSPACE (-1) /* Malloc call failed. */
-#define GLOB_ABEND (-2) /* Unignored error. */
-
-__BEGIN_DECLS
-
-#undef DLLEXPORT
-#ifdef __INSIDE_CYGWIN__
-# define DLLEXPORT
-#else
-# define DLLEXPORT __declspec(dllimport)
-#endif
-int DLLEXPORT glob(const char *, int, int (*)(const char *, int), glob_t *);
-void DLLEXPORT globfree(glob_t *);
-
-#undef DLLEXPORT
-__END_DECLS
-
-#endif /* !_GLOB_H_ */
diff --git a/winsup/cygwin/include/icmp.h b/winsup/cygwin/include/icmp.h
deleted file mode 100644
index 7e7aedccd..000000000
--- a/winsup/cygwin/include/icmp.h
+++ /dev/null
@@ -1 +0,0 @@
-/* icmp.h */
diff --git a/winsup/cygwin/include/io.h b/winsup/cygwin/include/io.h
deleted file mode 100644
index de9f39e0a..000000000
--- a/winsup/cygwin/include/io.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* io.h
-
- Copyright 1999, 2000, 2001 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 _IO_H_
-#define _IO_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * Function to return a Win32 HANDLE from a fd.
- */
-extern long get_osfhandle(int);
-extern int setmode (int __fd, int __mode);
-int access(const char *__path, int __amode);
-
-#ifdef __cplusplus
-};
-#endif /* __cplusplus */
-
-#endif /* _IO_H_ */
diff --git a/winsup/cygwin/include/lastlog.h b/winsup/cygwin/include/lastlog.h
deleted file mode 100644
index 9db86206d..000000000
--- a/winsup/cygwin/include/lastlog.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* lastlog.h
-
- Copyright 2001 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 _LASTLOG_H
-#define _LASTLOG_H
-
-#include <utmp.h>
-
-struct lastlog {
- long ll_time;
- char ll_line[UT_LINESIZE];
- char ll_host[UT_HOSTSIZE];
-};
-
-#endif
diff --git a/winsup/cygwin/include/limits.h b/winsup/cygwin/include/limits.h
deleted file mode 100644
index 78c475170..000000000
--- a/winsup/cygwin/include/limits.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/* limits.h
-
- Copyright 1999, 2000, 2001 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 _LIMITS_H___
-#ifndef _MACH_MACHLIMITS_H_
-
-/* _MACH_MACHLIMITS_H_ is used on OSF/1. */
-#define _LIMITS_H___
-#define _MACH_MACHLIMITS_H_
-
-/* Number of bits in a `char'. */
-#undef CHAR_BIT
-#define CHAR_BIT 8
-
-/* Maximum length of a multibyte character. */
-#ifndef MB_LEN_MAX
-#define MB_LEN_MAX 1
-#endif
-
-/* Minimum and maximum values a `signed char' can hold. */
-#undef SCHAR_MIN
-#define SCHAR_MIN (-128)
-#undef SCHAR_MAX
-#define SCHAR_MAX 127
-
-/* Maximum value an `unsigned char' can hold. (Minimum is 0). */
-#undef UCHAR_MAX
-#define UCHAR_MAX 255
-
-/* Minimum and maximum values a `char' can hold. */
-#ifdef __CHAR_UNSIGNED__
-#undef CHAR_MIN
-#define CHAR_MIN 0
-#undef CHAR_MAX
-#define CHAR_MAX 255
-#else
-#undef CHAR_MIN
-#define CHAR_MIN (-128)
-#undef CHAR_MAX
-#define CHAR_MAX 127
-#endif
-
-/* Minimum and maximum values a `signed short int' can hold. */
-#undef SHRT_MIN
-#define SHRT_MIN (-32768)
-#undef SHRT_MAX
-#define SHRT_MAX 32767
-
-/* Maximum value an `unsigned short int' can hold. (Minimum is 0). */
-#undef USHRT_MAX
-#define USHRT_MAX 65535
-
-/* Minimum and maximum values a `signed int' can hold. */
-#ifndef __INT_MAX__
-#define __INT_MAX__ 2147483647
-#endif
-#undef INT_MIN
-#define INT_MIN (-INT_MAX-1)
-#undef INT_MAX
-#define INT_MAX __INT_MAX__
-
-/* Maximum value an `unsigned int' can hold. (Minimum is 0). */
-#undef UINT_MAX
-#define UINT_MAX (INT_MAX * 2U + 1)
-
-/* Minimum and maximum values a `signed long int' can hold.
- (Same as `int'). */
-#ifndef __LONG_MAX__
-#ifndef __alpha__
-#define __LONG_MAX__ 2147483647L
-#else
-#define __LONG_MAX__ 9223372036854775807L
-# endif /* __alpha__ */
-#endif
-#undef LONG_MIN
-#define LONG_MIN (-LONG_MAX-1)
-#undef LONG_MAX
-#define LONG_MAX __LONG_MAX__
-
-/* Maximum value an `unsigned long int' can hold. (Minimum is 0). */
-#undef ULONG_MAX
-#define ULONG_MAX (LONG_MAX * 2UL + 1)
-
-/* Minimum and maximum values a `signed long long int' can hold. */
-#ifndef __LONG_LONG_MAX__
-#define __LONG_LONG_MAX__ 9223372036854775807LL
-#endif
-
-#if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__)
-#undef LONG_LONG_MIN
-#define LONG_LONG_MIN (-LONG_LONG_MAX-1)
-#undef LONG_LONG_MAX
-#define LONG_LONG_MAX __LONG_LONG_MAX__
-
-/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
-#undef ULONG_LONG_MAX
-#define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1)
-#endif
-
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-/* Minimum and maximum values a `signed long long int' can hold. */
-#undef LLONG_MIN
-#define LLONG_MIN (-LLONG_MAX-1)
-#undef LLONG_MAX
-#define LLONG_MAX __LONG_LONG_MAX__
-
-/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
-#undef ULLONG_MAX
-#define ULLONG_MAX (LLONG_MAX * 2ULL + 1)
-#endif
-
-/* Maximum number of iovcnt in a writev */
-#undef IOV_MAX
-#define IOV_MAX (__INT_MAX__-1)
-
-/* Maximum size of ssize_t */
-#undef SSIZE_MAX
-#define SSIZE_MAX (__LONG_MAX__)
-
-/* Maximum length of a path */
-#define PATH_MAX (260 - 1 /*NUL*/)
-
-/* Max num groups for a user, value taken from NT documentation */
-/* Must match <sys/param.h> NGROUPS */
-#define NGROUPS_MAX 16
-
-/* WaitForMultipleObjects can't handle waiting for more than 64 objects.
- This limits how many children we can fork/spawn off. */
-#define CHILD_MAX 63
-
-/* # of open files per process. Actually it can be more since Cygwin
- grows the dtable as necessary. We define a reasonable limit here
- which is returned by getdtablesize(), sysconf(_SC_OPEN_MAX) and
- getrlimit(RLIMIT_NOFILE). */
-#undef OPEN_MAX
-#define OPEN_MAX 256
-
-/* # of bytes in a pipe buf. This is the max # of bytes which can be
- written to a pipe in one atomic operation. */
-#undef PIPE_BUF
-#define PIPE_BUF 4096
-
-/* POSIX values */
-/* These should never vary from one system type to another */
-/* They represent the minimum values that POSIX systems must support.
- POSIX-conforming apps must not require larger values. */
-#define _POSIX_ARG_MAX 4096
-#define _POSIX_CHILD_MAX 6
-#define _POSIX_LINK_MAX 8
-#define _POSIX_MAX_CANON 255
-#define _POSIX_MAX_INPUT 255
-#define _POSIX_NAME_MAX 14
-#define _POSIX_NGROUPS_MAX 0
-#define _POSIX_OPEN_MAX 16
-#define _POSIX_PATH_MAX 255
-#define _POSIX_PIPE_BUF 512
-#define _POSIX_SSIZE_MAX 32767
-#define _POSIX_STREAM_MAX 8
-#define _POSIX_TZNAME_MAX 3
-
-#endif /* _MACH_MACHLIMITS_H_ */
-#endif /* _LIMITS_H___ */
diff --git a/winsup/cygwin/include/mapi.h b/winsup/cygwin/include/mapi.h
deleted file mode 100644
index e2d47e264..000000000
--- a/winsup/cygwin/include/mapi.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* mapi.h
-
- Copyright 1997, 1998, 1999, 2000, 2001 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 _MAPI_H
-#define _MAPI_H
-
-/* Currently this doesn't include all the definitions. It does cover
- the parts of Simple MAPI required to send mail. */
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
- /* FIXME: should this be elsewhere? */
-typedef unsigned long FLAGS;
-
- /* FIXME: should this be elsewhere? */
-#define SUCCESS_SUCCESS 0
-
- /* FIXME: should this be elsewhere? */
-typedef unsigned long LHANDLE, FAR *LPLHANDLE;
-
-
-#define MAPI_E_AMBIGUOUS_RECIPIENT 0x15
-#define MAPI_E_ATTACHMENT_NOT_FOUND 0xb
-#define MAPI_E_ATTACHMENT_OPEN_FAILURE 0xc
-#define MAPI_E_BAD_RECIPTYPE 0xf
-#define MAPI_E_FAILURE 0x2
-#define MAPI_E_INSUFFICIENT_MEMORY 0x5
-#define MAPI_E_INVALID_RECIPS 0x19
-#define MAPI_E_LOGIN_FAILURE 0x3
-#define MAPI_E_TEXT_TOO_LARGE 0x12
-#define MAPI_E_TOO_MANY_FILES 0x9
-#define MAPI_E_TOO_MANY_RECIPIENTS 0xa
-#define MAPI_E_UNKNOWN_RECIPIENT 0xe
-#define MAPI_E_USER_ABORT 0x1
-#define MAPI_E_TEXT_TOO_LARGE 0x12
-#define MAPI_DIALOG 0x8
-#define MAPI_NEW_SESSION 0x2
-#define MAPI_LOGON_UI 0x1
-#define MAPI_RECEIPT_REQUESTED 0x2
-#define MAPI_SENT 0x4
-#define MAPI_UNREAD 0x1
-#define MAPI_OLE 0x1
-#define MAPI_OLE_STATIC 0x2
-
-#define MAPI_ORIG 0
-#define MAPI_TO 1
-#define MAPI_CC 2
-#define MAPI_BCC 3
-
-typedef struct
-{
- ULONG ulReserved;
- ULONG flFlags;
- ULONG nPosition;
- LPTSTR lpszPathName;
- LPTSTR lpszFileName;
- LPVOID lpFileType;
-} MapiFileDesc, FAR *lpMapiFileDesc;
-
-typedef struct
-{
- ULONG ulReserved;
- ULONG ulRecipClass;
- LPTSTR lpszName;
- LPTSTR lpszAddress;
- ULONG ulEIDSize;
- LPVOID lpEntryID;
-} MapiRecipDesc, FAR *lpMapiRecipDesc;
-
-typedef struct
-{
- ULONG ulReserved;
- LPTSTR lpszSubject;
- LPTSTR lpszNoteText;
- LPTSTR lpszMessageType;
- LPTSTR lpszDateReceived;
- LPTSTR lpszConversationID;
- FLAGS flFlags;
- lpMapiRecipDesc lpOriginator;
- ULONG nRecipCount;
- lpMapiRecipDesc lpRecips;
- ULONG nFileCount;
- lpMapiFileDesc lpFiles;
-} MapiMessage, FAR *lpMapiMessage;
-
-ULONG FAR PASCAL MAPISendMail (LHANDLE, ULONG, lpMapiMessage, FLAGS, ULONG);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _MAPI_H */
diff --git a/winsup/cygwin/include/memory.h b/winsup/cygwin/include/memory.h
deleted file mode 100644
index 2e16766b9..000000000
--- a/winsup/cygwin/include/memory.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* memory.h
-
- Copyright 1998, 2001 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 _MEMORY_H
-#define _MEMORY_H
-
-/* This allows more things to compile. */
-#include <string.h>
-
-#endif /* _MEMORY_H */
diff --git a/winsup/cygwin/include/mntent.h b/winsup/cygwin/include/mntent.h
deleted file mode 100644
index fde1680a0..000000000
--- a/winsup/cygwin/include/mntent.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* mntent.h
-
- Copyright 1996, 1998, 1999, 2000, 2001 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 _MNTENT_H
-#define _MNTENT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct mntent
-{
- char *mnt_fsname;
- char *mnt_dir;
- char *mnt_type;
- char *mnt_opts;
- int mnt_freq;
- int mnt_passno;
-};
-
-#ifndef _NOMNTENT_FUNCS
-FILE *setmntent (const char *__filep, const char *__type);
-struct mntent *getmntent (FILE *__filep);
-int addmntent (FILE *__filep, const struct mntent *__mnt);
-int endmntent (FILE *__filep);
-char *hasmntopt (const struct mntent *__mnt, const char *__opt);
-#endif
-
-/* This next file doesn't exist, it is in the registry,
- however applications need the define to pass to
- the above calls.
-*/
-#ifndef MOUNTED
-#define MOUNTED "/etc/mtab"
-#endif
-#ifdef __cplusplus
-};
-#endif
-
-#endif /* _MNTENT_H */
diff --git a/winsup/cygwin/include/net/if.h b/winsup/cygwin/include/net/if.h
deleted file mode 100644
index aff3b88e9..000000000
--- a/winsup/cygwin/include/net/if.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* net/if.h
-
- Copyright 1998, 2001 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 _NET_IF_H
-#define _NET_IF_H
-
-#include <cygwin/if.h>
-
-#endif /* _NET_IF_H */
diff --git a/winsup/cygwin/include/netdb.h b/winsup/cygwin/include/netdb.h
deleted file mode 100644
index f49a94379..000000000
--- a/winsup/cygwin/include/netdb.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/* Original linux netdb.h merged with winsock.h types */
-
-/*-
- * Copyright (c) 1980, 1983, 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)netdb.h 8.1 (Berkeley) 6/2/93
- * netdb.h,v 1.1.1.1 1995/02/18 05:34:07 hjl Exp
- * -
- * Portions Copyright (c) 1993 by Digital Equipment Corporation.
- *
- * Permission to use, copy, modify and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies, and that
- * the name of Digital Equipment Corporation not be used in advertising or
- * publicity pertaining to distribution of the document or software without
- * specific, written prior permission.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
- * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- * -
- * --Copyright--
- */
-
-#ifndef _NETDB_H_
-#define _NETDB_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Structures returned by network data base library. All addresses are
- * supplied in host order, and returned in network order (suitable for
- * use in system calls).
- */
-
- /* Different from the linux versions - note the shorts.. */
-struct hostent {
- const char *h_name; /* official name of host */
- char **h_aliases; /* alias list */
- short h_addrtype; /* host address type */
- short h_length; /* length of address */
- char **h_addr_list; /* list of addresses from name server */
-#define h_addr h_addr_list[0] /* address, for backward compatiblity */
-};
-
-/*
- * Assumption here is that a network number
- * fits in an unsigned long -- probably a poor one.
- */
-
-struct netent {
- char *n_name; /* official name of net */
- char **n_aliases; /* alias list */
- short n_addrtype; /* net address type */
- unsigned long n_net; /* network # */
-};
-
-struct servent {
- char *s_name; /* official service name */
- char **s_aliases; /* alias list */
- short s_port; /* port # */
- char *s_proto; /* protocol to use */
-};
-
-struct protoent
-{
- char *p_name; /* official protocol name */
- char **p_aliases; /* alias list */
- short p_proto; /* protocol # */
-};
-
-struct rpcent {
- char *r_name; /* name of server for this rpc program */
- char **r_aliases; /* alias list */
- int r_number; /* rpc program number */
-};
-
-/*
- * Error return codes from gethostbyname() and gethostbyaddr()
- * (left in extern int h_errno).
- */
-
-#ifdef __INSIDE_CYGWIN_NET__
-extern int h_errno;
-#else
-extern __declspec(dllimport) int h_errno;
-#endif
-
-#define NETDB_INTERNAL -1 /* see errno */
-#define NETDB_SUCCESS 0 /* no problem */
-#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
-#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
-#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
-#define NO_DATA 4 /* Valid name, no data record of requested type */
-#define NO_ADDRESS NO_DATA /* no address, look for MX record */
-
-#ifndef __INSIDE_CYGWIN_NET__
-void endhostent (void);
-void endnetent (void);
-void endprotoent (void);
-void endservent (void);
-void endrpcent (void);
-struct hostent *gethostbyaddr (const char *, int, int);
-struct hostent *gethostbyname (const char *);
-struct hostent *gethostent (void);
-struct netent *getnetbyaddr (long, int); /* u_long? */
-struct netent *getnetbyname (const char *);
-struct netent *getnetent (void);
-struct protoent *getprotobyname (const char *);
-struct protoent *getprotobynumber (int);
-struct protoent *getprotoent (void);
-struct servent *getservbyname (const char *, const char *);
-struct servent *getservbyport (int, const char *);
-struct servent *getservent (void);
-struct rpcent *getrpcent (void);
-struct rpcent *getrpcbyname (const char *);
-struct rpcent *getrpcbynumber (int);
-const char *hstrerror (int);
-void herror (const char *);
-void sethostent (int);
-void setnetent (int);
-void setprotoent (int);
-void setservent (int);
-void setrpcent (int);
-#endif
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif /* !_NETDB_H_ */
-
diff --git a/winsup/cygwin/include/netinet/in.h b/winsup/cygwin/include/netinet/in.h
deleted file mode 100644
index 7081282a7..000000000
--- a/winsup/cygwin/include/netinet/in.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* netinet/in.h
-
- Copyright 1998, 2001 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 _NETINET_IN_H
-#define _NETINET_IN_H
-
-#include <cygwin/in.h>
-
-#endif /* _NETINET_IN_H */
diff --git a/winsup/cygwin/include/netinet/in_systm.h b/winsup/cygwin/include/netinet/in_systm.h
deleted file mode 100644
index 17b5feb8d..000000000
--- a/winsup/cygwin/include/netinet/in_systm.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* netinet/in_systm.h
-
- Copyright 2000, 2001 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 _NETINET_IN_SYSTM_H
-#define _NETINET_IN_SYSTM_H
-
-#include <cygwin/in_systm.h>
-
-#endif /* _NETINET_IN_SYSTM_H */
diff --git a/winsup/cygwin/include/netinet/ip.h b/winsup/cygwin/include/netinet/ip.h
deleted file mode 100644
index a8dac5b67..000000000
--- a/winsup/cygwin/include/netinet/ip.h
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright (c) 1982, 1986, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ip.h 8.2 (Berkeley) 6/1/94
- * $FreeBSD: src/sys/netinet/ip.h,v 1.17 1999/12/22 19:13:20 shin Exp $
- */
-
-#ifndef _NETINET_IP_H
-#define _NETINET_IP_H
-
-/* Added by Wu Yongwei */
-#ifndef LITTLE_ENDIAN
-#define LITTLE_ENDIAN 1234
-#define BIG_ENDIAN 4321
-#endif
-#ifndef BYTE_ORDER
-#define BYTE_ORDER LITTLE_ENDIAN
-#endif
-
-/*
- * Definitions for internet protocol version 4.
- * Per RFC 791, September 1981.
- */
-#define IPVERSION 4
-
-/*
- * Structure of an internet header, naked of options.
- */
-struct ip {
-#ifdef _IP_VHL
- u_char ip_vhl; /* version << 4 | header length >> 2 */
-#else
-#if BYTE_ORDER == LITTLE_ENDIAN
- u_int ip_hl:4, /* header length */
- ip_v:4; /* version */
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
- u_int ip_v:4, /* version */
- ip_hl:4; /* header length */
-#endif
-#endif /* not _IP_VHL */
- u_char ip_tos; /* type of service */
- u_short ip_len; /* total length */
- u_short ip_id; /* identification */
- u_short ip_off; /* fragment offset field */
-#define IP_RF 0x8000 /* reserved fragment flag */
-#define IP_DF 0x4000 /* dont fragment flag */
-#define IP_MF 0x2000 /* more fragments flag */
-#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
- u_char ip_ttl; /* time to live */
- u_char ip_p; /* protocol */
- u_short ip_sum; /* checksum */
- struct in_addr ip_src,ip_dst; /* source and dest address */
-};
-
-#ifdef _IP_VHL
-#define IP_MAKE_VHL(v, hl) ((v) << 4 | (hl))
-#define IP_VHL_HL(vhl) ((vhl) & 0x0f)
-#define IP_VHL_V(vhl) ((vhl) >> 4)
-#define IP_VHL_BORING 0x45
-#endif
-
-#define IP_MAXPACKET 65535 /* maximum packet size */
-
-/*
- * Definitions for IP type of service (ip_tos)
- */
-#ifndef IPTOS_LOWDELAY
-#define IPTOS_LOWDELAY 0x10
-#define IPTOS_THROUGHPUT 0x08
-#define IPTOS_RELIABILITY 0x04
-#endif
-#define IPTOS_MINCOST 0x02
-/* ECN bits proposed by Sally Floyd */
-#define IPTOS_CE 0x01 /* congestion experienced */
-#define IPTOS_ECT 0x02 /* ECN-capable transport */
-
-
-/*
- * Definitions for IP precedence (also in ip_tos) (hopefully unused)
- */
-#define IPTOS_PREC_NETCONTROL 0xe0
-#define IPTOS_PREC_INTERNETCONTROL 0xc0
-#define IPTOS_PREC_CRITIC_ECP 0xa0
-#define IPTOS_PREC_FLASHOVERRIDE 0x80
-#define IPTOS_PREC_FLASH 0x60
-#define IPTOS_PREC_IMMEDIATE 0x40
-#define IPTOS_PREC_PRIORITY 0x20
-#define IPTOS_PREC_ROUTINE 0x00
-
-/*
- * Definitions for options.
- */
-#define IPOPT_COPIED(o) ((o)&0x80)
-#define IPOPT_CLASS(o) ((o)&0x60)
-#define IPOPT_NUMBER(o) ((o)&0x1f)
-
-#define IPOPT_CONTROL 0x00
-#define IPOPT_RESERVED1 0x20
-#define IPOPT_DEBMEAS 0x40
-#define IPOPT_RESERVED2 0x60
-
-#define IPOPT_EOL 0 /* end of option list */
-#define IPOPT_NOP 1 /* no operation */
-
-#define IPOPT_RR 7 /* record packet route */
-#define IPOPT_TS 68 /* timestamp */
-#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */
-#define IPOPT_LSRR 131 /* loose source route */
-#define IPOPT_SATID 136 /* satnet id */
-#define IPOPT_SSRR 137 /* strict source route */
-#define IPOPT_RA 148 /* router alert */
-
-/*
- * Offsets to fields in options other than EOL and NOP.
- */
-#define IPOPT_OPTVAL 0 /* option ID */
-#define IPOPT_OLEN 1 /* option length */
-#define IPOPT_OFFSET 2 /* offset within option */
-#define IPOPT_MINOFF 4 /* min value of above */
-
-/*
- * Time stamp option structure.
- */
-struct ip_timestamp {
- u_char ipt_code; /* IPOPT_TS */
- u_char ipt_len; /* size of structure (variable) */
- u_char ipt_ptr; /* index of current entry */
-#if BYTE_ORDER == LITTLE_ENDIAN
- u_int ipt_flg:4, /* flags, see below */
- ipt_oflw:4; /* overflow counter */
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
- u_int ipt_oflw:4, /* overflow counter */
- ipt_flg:4; /* flags, see below */
-#endif
- union ipt_timestamp {
- n_long ipt_time[1];
- struct ipt_ta {
- struct in_addr ipt_addr;
- n_long ipt_time;
- } ipt_ta[1];
- } ipt_timestamp;
-};
-
-/* flag bits for ipt_flg */
-#define IPOPT_TS_TSONLY 0 /* timestamps only */
-#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
-#define IPOPT_TS_PRESPEC 3 /* specified modules only */
-
-/* bits for security (not byte swapped) */
-#define IPOPT_SECUR_UNCLASS 0x0000
-#define IPOPT_SECUR_CONFID 0xf135
-#define IPOPT_SECUR_EFTO 0x789a
-#define IPOPT_SECUR_MMMM 0xbc4d
-#define IPOPT_SECUR_RESTR 0xaf13
-#define IPOPT_SECUR_SECRET 0xd788
-#define IPOPT_SECUR_TOPSECRET 0x6bc5
-
-/*
- * Internet implementation parameters.
- */
-#define MAXTTL 255 /* maximum time to live (seconds) */
-#define IPDEFTTL 64 /* default ttl, from RFC 1340 */
-#define IPFRAGTTL 60 /* time to live for frags, slowhz */
-#define IPTTLDEC 1 /* subtracted when forwarding */
-
-#define IP_MSS 576 /* default maximum segment size */
-
-#endif
diff --git a/winsup/cygwin/include/netinet/ip_icmp.h b/winsup/cygwin/include/netinet/ip_icmp.h
deleted file mode 100644
index 6a1be053c..000000000
--- a/winsup/cygwin/include/netinet/ip_icmp.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* netinet/ip_icmp.h
-
- Copyright 1998, 2001 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 _NETINET_IP_ICMP_H
-#define _NETINET_IP_ICMP_H
-
-#include <cygwin/icmp.h>
-
-#endif /* _NETINET_IP_ICMP_H */
diff --git a/winsup/cygwin/include/netinet/tcp.h b/winsup/cygwin/include/netinet/tcp.h
deleted file mode 100644
index 9fcee6c71..000000000
--- a/winsup/cygwin/include/netinet/tcp.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 1982, 1986, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)tcp.h 8.1 (Berkeley) 6/10/93
- * $FreeBSD: src/sys/netinet/tcp.h,v 1.13 2000/01/09 19:17:25 shin Exp $
- */
-
-#ifndef _NETINET_TCP_H
-#define _NETINET_TCP_H
-
-/* Added by Wu Yongwei */
-#ifndef LITTLE_ENDIAN
-#define LITTLE_ENDIAN 1234
-#define BIG_ENDIAN 4321
-#endif
-#ifndef BYTE_ORDER
-#define BYTE_ORDER LITTLE_ENDIAN
-#endif
-
-typedef u_int32_t tcp_seq;
-typedef u_int32_t tcp_cc; /* connection count per rfc1644 */
-
-#define tcp6_seq tcp_seq /* for KAME src sync over BSD*'s */
-#define tcp6hdr tcphdr /* for KAME src sync over BSD*'s */
-
-/*
- * TCP header.
- * Per RFC 793, September, 1981.
- */
-struct tcphdr {
- u_short th_sport; /* source port */
- u_short th_dport; /* destination port */
- tcp_seq th_seq; /* sequence number */
- tcp_seq th_ack; /* acknowledgement number */
-#if BYTE_ORDER == LITTLE_ENDIAN
- u_int th_x2:4, /* (unused) */
- th_off:4; /* data offset */
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
- u_int th_off:4, /* data offset */
- th_x2:4; /* (unused) */
-#endif
- u_char th_flags;
-#define TH_FIN 0x01
-#define TH_SYN 0x02
-#define TH_RST 0x04
-#define TH_PUSH 0x08
-#define TH_ACK 0x10
-#define TH_URG 0x20
-#define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG)
-
- u_short th_win; /* window */
- u_short th_sum; /* checksum */
- u_short th_urp; /* urgent pointer */
-};
-
-#define TCPOPT_EOL 0
-#define TCPOPT_NOP 1
-#define TCPOPT_MAXSEG 2
-#define TCPOLEN_MAXSEG 4
-#define TCPOPT_WINDOW 3
-#define TCPOLEN_WINDOW 3
-#define TCPOPT_SACK_PERMITTED 4 /* Experimental */
-#define TCPOLEN_SACK_PERMITTED 2
-#define TCPOPT_SACK 5 /* Experimental */
-#define TCPOPT_TIMESTAMP 8
-#define TCPOLEN_TIMESTAMP 10
-#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
-#define TCPOPT_TSTAMP_HDR \
- (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
-
-#define TCPOPT_CC 11 /* CC options: RFC-1644 */
-#define TCPOPT_CCNEW 12
-#define TCPOPT_CCECHO 13
-#define TCPOLEN_CC 6
-#define TCPOLEN_CC_APPA (TCPOLEN_CC+2)
-#define TCPOPT_CC_HDR(ccopt) \
- (TCPOPT_NOP<<24|TCPOPT_NOP<<16|(ccopt)<<8|TCPOLEN_CC)
-
-/*
- * Default maximum segment size for TCP.
- * With an IP MSS of 576, this is 536,
- * but 512 is probably more convenient.
- * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)).
- */
-#define TCP_MSS 512
-
-/*
- * Default maximum segment size for TCP6.
- * With an IP6 MSS of 1280, this is 1220,
- * but 1024 is probably more convenient. (xxx kazu in doubt)
- * This should be defined as MIN(1024, IP6_MSS - sizeof (struct tcpip6hdr))
- */
-#define TCP6_MSS 1024
-
-#define TCP_MAXWIN 65535 /* largest value for (unscaled) window */
-#define TTCP_CLIENT_SND_WND 4096 /* dflt send window for T/TCP client */
-
-#define TCP_MAX_WINSHIFT 14 /* maximum window shift */
-
-#define TCP_MAXHLEN (0xf<<2) /* max length of header in bytes */
-#define TCP_MAXOLEN (TCP_MAXHLEN - sizeof(struct tcphdr))
- /* max space left for options */
-
-/*
- * User-settable options (used with setsockopt).
- */
-#ifndef TCP_NODELAY
-#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */
-#define TCP_MAXSEG 0x02 /* set maximum segment size */
-#endif
-#define TCP_NOPUSH 0x04 /* don't push last block of write */
-#define TCP_NOOPT 0x08 /* don't use TCP options */
-
-#endif
diff --git a/winsup/cygwin/include/netinet/udp.h b/winsup/cygwin/include/netinet/udp.h
deleted file mode 100644
index 61932720b..000000000
--- a/winsup/cygwin/include/netinet/udp.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1982, 1986, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)udp.h 8.1 (Berkeley) 6/10/93
- * $FreeBSD: src/sys/netinet/udp.h,v 1.7 1999/08/28 00:49:34 peter Exp $
- */
-
-#ifndef _NETINET_UDP_H
-#define _NETINET_UDP_H
-
-/*
- * Udp protocol header.
- * Per RFC 768, September, 1981.
- */
-struct udphdr {
- u_short uh_sport; /* source port */
- u_short uh_dport; /* destination port */
- u_short uh_ulen; /* udp length */
- u_short uh_sum; /* udp checksum */
-};
-
-#endif
diff --git a/winsup/cygwin/include/paths.h b/winsup/cygwin/include/paths.h
deleted file mode 100644
index e5ff51e96..000000000
--- a/winsup/cygwin/include/paths.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* paths.h
-
- Copyright 2001 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 _PATHS_H_
-#define _PATHS_H_
-
-#define _PATH_DEV "/dev/"
-#define _PATH_BSHELL "/bin/sh"
-#define _PATH_LASTLOG "/var/log/lastlog"
-#define _PATH_UTMP "/var/run/utmp"
-#define _PATH_WTMP "/var/log/wtmp"
-#endif /* _PATHS_H_ */
diff --git a/winsup/cygwin/include/poll.h b/winsup/cygwin/include/poll.h
deleted file mode 100644
index a836b2af4..000000000
--- a/winsup/cygwin/include/poll.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/* poll.h
-
- Copyright 2000, 2001 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 <sys/poll.h>
diff --git a/winsup/cygwin/include/pthread.h b/winsup/cygwin/include/pthread.h
deleted file mode 100644
index acdde4fc3..000000000
--- a/winsup/cygwin/include/pthread.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/* pthread.h: POSIX pthread interface
-
- Copyright 1996, 1997, 1998, 1999, 20000, 2001 Red Hat, Inc.
-
- Written by Marco Fuykschot <marco@ddi.nl>
-
- 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 <sys/types.h>
-#include <signal.h>
-#include <sched.h>
-
-#ifndef _PTHREAD_H
-#define _PTHREAD_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-/* Defines. (These are correctly defined here as per
- http://www.opengroup.org/onlinepubs/7908799/xsh/pthread.h.html */
-
-/* FIXME: this should allocate a new cond variable, and return the value that
- would normally be written to the passed parameter of pthread_cond_init(lvalue, NULL); */
-/* #define PTHREAD_COND_INITIALIZER 0 */
-
-#define PTHREAD_DESTRUCTOR_ITERATIONS 1
-/* Tls has 64 items for pre win2000 - and we don't want to use them all :]
- * Before committing discuss this with the list
- */
-#define PTHREAD_KEYS_MAX 32
-/* the default : joinable */
-
-#define PTHREAD_CANCEL_ASYNCHRONOUS 1
-/* defaults are enable, deferred */
-#define PTHREAD_CANCEL_ENABLE 0
-#define PTHREAD_CANCEL_DEFERRED 0
-#define PTHREAD_CANCEL_DISABLE 1
-#define PTHREAD_CANCELED
-/* this should be a value that can never be a valid address */
-#define PTHREAD_COND_INITIALIZER (void *)21
-#define PTHREAD_CREATE_DETACHED 1
-/* the default : joinable */
-#define PTHREAD_CREATE_JOINABLE 0
-#define PTHREAD_EXPLICIT_SCHED 1
-#define PTHREAD_INHERIT_SCHED 0
-#define PTHREAD_MUTEX_DEFAULT 0
-#define PTHREAD_MUTEX_ERRORCHECK 1
-#define PTHREAD_MUTEX_NORMAL 2
-/* this should be too low to ever be a valid address */
-#define PTHREAD_MUTEX_INITIALIZER (void *)20
-#define PTHREAD_MUTEX_RECURSIVE 0
-#define PTHREAD_ONCE_INIT { PTHREAD_MUTEX_INITIALIZER, 0 }
-#define PTHREAD_PRIO_INHERIT
-#define PTHREAD_PRIO_NONE
-#define PTHREAD_PRIO_PROTECT
-#define PTHREAD_PROCESS_SHARED 1
-#define PTHREAD_PROCESS_PRIVATE 0
-#define PTHREAD_RWLOCK_INITIALIZER
-/* process is the default */
-#define PTHREAD_SCOPE_PROCESS 0
-#define PTHREAD_SCOPE_SYSTEM 1
-
-
-/* Attributes */
-int pthread_attr_destroy (pthread_attr_t *);
-int pthread_attr_getdetachstate (const pthread_attr_t *, int *);
-int pthread_attr_getinheritsched (const pthread_attr_t *, int *);
-int pthread_attr_getschedparam (const pthread_attr_t *, struct sched_param *);
-int pthread_attr_getschedpolicy (const pthread_attr_t *, int *);
-int pthread_attr_getscope (const pthread_attr_t *, int *);
-int pthread_attr_init (pthread_attr_t *);
-int pthread_attr_setdetachstate (pthread_attr_t *, int);
-int pthread_attr_setinheritsched (pthread_attr_t *, int);
-int pthread_attr_setschedparam (pthread_attr_t *, const struct sched_param *);
-int pthread_attr_setschedpolicy (pthread_attr_t *, int);
-int pthread_attr_setscope (pthread_attr_t *, int);
-
-#ifdef _POSIX_THREAD_ATTR_STACKADDR
-/* These functions may be implementable via some low level trickery. For now they are
- * Not supported or implemented. The prototypes are here so if someone greps the
- * source they will see these comments
- */
-int pthread_attr_getstackaddr (const pthread_attr_t *, void **);
-int pthread_attr_setstackaddr (pthread_attr_t *, void *);
-#endif
-
-#ifdef _POSIX_THREAD_ATTR_STACKSIZE
-int pthread_attr_getstacksize (const pthread_attr_t *, size_t *);
-int pthread_attr_setstacksize (pthread_attr_t *, size_t);
-#endif
-
-int pthread_cancel (pthread_t);
-/* Macros for cleanup_push and pop;
- * The function definitions are
-void pthread_cleanup_push (void (*routine)(void*), void *arg);
-void pthread_cleanup_pop (int execute);
-*/
-typedef void (*__cleanup_routine_type) (void *);
-typedef struct _pthread_cleanup_handler
-{
- __cleanup_routine_type function;
- void *arg;
- struct _pthread_cleanup_handler *next;
-} __pthread_cleanup_handler;
-
-void _pthread_cleanup_push (__pthread_cleanup_handler *handler);
-void _pthread_cleanup_pop (int execute);
-
-#define pthread_cleanup_push(_fn, _arg) { __pthread_cleanup_handler __cleanup_handler = \
- { _fn, _arg, NULL }; \
- _pthread_cleanup_push( &__cleanup_handler );
-#define pthread_cleanup_pop(_execute) _pthread_cleanup_pop( _execute ); }
-
-/* Condition variables */
-int pthread_cond_broadcast (pthread_cond_t *);
-int pthread_cond_destroy (pthread_cond_t *);
-int pthread_cond_init (pthread_cond_t *, const pthread_condattr_t *);
-int pthread_cond_signal (pthread_cond_t *);
-int pthread_cond_timedwait (pthread_cond_t *,
- pthread_mutex_t *, const struct timespec *);
-int pthread_cond_wait (pthread_cond_t *, pthread_mutex_t *);
-int pthread_condattr_destroy (pthread_condattr_t *);
-int pthread_condattr_getpshared (const pthread_condattr_t *, int *);
-int pthread_condattr_init (pthread_condattr_t *);
-int pthread_condattr_setpshared (pthread_condattr_t *, int);
-
-int pthread_create (pthread_t *, const pthread_attr_t *,
- void *(*)(void *), void *);
-int pthread_detach (pthread_t);
-int pthread_equal (pthread_t, pthread_t);
-void pthread_exit (void *);
-int pthread_getschedparam (pthread_t, int *, struct sched_param *);
-void *pthread_getspecific (pthread_key_t);
-int pthread_join (pthread_t, void **);
-int pthread_key_create (pthread_key_t *, void (*)(void *));
-int pthread_key_delete (pthread_key_t);
-
-/* Mutex's */
-int pthread_mutex_destroy (pthread_mutex_t *);
-int pthread_mutex_getprioceiling (const pthread_mutex_t *, int *);
-int pthread_mutex_init (pthread_mutex_t *, const pthread_mutexattr_t *);
-int pthread_mutex_lock (pthread_mutex_t *);
-int pthread_mutex_setprioceiling (pthread_mutex_t *, int, int *);
-int pthread_mutex_trylock (pthread_mutex_t *);
-int pthread_mutex_unlock (pthread_mutex_t *);
-int pthread_mutexattr_destroy (pthread_mutexattr_t *);
-int pthread_mutexattr_getprioceiling (const pthread_mutexattr_t *, int *);
-int pthread_mutexattr_getprotocol (const pthread_mutexattr_t *, int *);
-int pthread_mutexattr_getpshared (const pthread_mutexattr_t *, int *);
-int pthread_mutexattr_gettype (const pthread_mutexattr_t *, int *);
-int pthread_mutexattr_init (pthread_mutexattr_t *);
-int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *, int);
-int pthread_mutexattr_setprotocol (pthread_mutexattr_t *, int);
-int pthread_mutexattr_setpshared (pthread_mutexattr_t *, int);
-int pthread_mutexattr_settype (pthread_mutexattr_t *, int);
-
-int pthread_once (pthread_once_t *, void (*)(void));
-
-/* Concurrency levels - X/Open interface */
-int pthread_getconcurrency (void);
-int pthread_setconcurrency (int);
-
-
-pthread_t pthread_self (void);
-int pthread_setcancelstate (int, int *);
-int pthread_setcanceltype (int, int *);
-int pthread_setschedparam (pthread_t, int, const struct sched_param *);
-int pthread_setspecific (pthread_key_t, const void *);
-void pthread_testcancel (void);
-
-/* Non posix calls */
-
-int pthread_suspend (pthread_t);
-int pthread_continue (pthread_t);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _PTHREAD_H */
diff --git a/winsup/cygwin/include/sched.h b/winsup/cygwin/include/sched.h
deleted file mode 100644
index f97b8ebf4..000000000
--- a/winsup/cygwin/include/sched.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* sched.h: scheduler interface for Cygwin
-
- Copyright 2001 Red Hat, Inc.
-
- Written by Robert Collins <rbtcollins@hotmail.com>
-
- 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. */
-
-/* Written from the opengroup specifications */
-
-#ifndef _SCHED_H
-#define _SCHED_H
-#include <time.h>
-
-/* we return -1 and set errno on failure */
-#define SCHED_FIFO 1
-#define SCHED_RR 2
-#define SCHED_OTHER 3
-
-struct sched_param
-{
- int sched_priority;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* max priority for policy */
-int sched_get_priority_max (int);
-/* min priority for policy */
-int sched_get_priority_min (int);
-/* get sched params for process */
-int sched_getparam (pid_t, struct sched_param *);
-/* get the scheduler for pid */
-int sched_getscheduler (pid_t);
-/* get the time quantum for pid */
-int sched_rr_get_interval (pid_t, struct timespec *);
-/* set the scheduling parameters */
-int sched_setparam (pid_t, const struct sched_param *);
-/* set the scheduler */
-int sched_setscheduler (pid_t, int, const struct sched_param *);
-/* yield the cpu */
-int sched_yield (void);
-
-#if defined(__INSIDE_CYGWIN__)
-/* These are private helper functions used to calculate scheduler settings and
- * validate parameters */
-
-/* check parameters for validity */
-int valid_sched_parameters(const struct sched_param *);
-/* set a single thread's priority */
-int sched_set_thread_priority(HANDLE thread, int priority);
-
-#endif /* INSIDE_CYGWIN */
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* _SCHED_H */
diff --git a/winsup/cygwin/include/semaphore.h b/winsup/cygwin/include/semaphore.h
deleted file mode 100644
index 6dbfa09ac..000000000
--- a/winsup/cygwin/include/semaphore.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* semaphore.h: POSIX semaphore interface
-
- Copyright 2001 Red Hat, Inc.
-
- Written by Robert Collins <rbtcollins@hotmail.com>
-
- 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 <sys/types.h>
-
-#ifndef _SEMAPHORE_H
-#define _SEMAPHORE_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#ifndef __INSIDE_CYGWIN__
- typedef void *sem_t;
-#endif
-
-#define SEM_FAILED 0
-#define SEM_VALUE_MAX 1147483648
-
-/* Semaphores */
- int sem_init (sem_t * sem, int pshared, unsigned int value);
- int sem_destroy (sem_t * sem);
- int sem_wait (sem_t * sem);
- int sem_trywait (sem_t * sem);
- int sem_post (sem_t * sem);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _SEMAPHORE_H */
diff --git a/winsup/cygwin/include/strings.h b/winsup/cygwin/include/strings.h
deleted file mode 100644
index e9d2839f2..000000000
--- a/winsup/cygwin/include/strings.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _STRINGS_H
-#define _STRINGS_H
-
-#include <string.h>
-
-#endif /* _STRINGS_H */
diff --git a/winsup/cygwin/include/sys/acl.h b/winsup/cygwin/include/sys/acl.h
deleted file mode 100644
index 89c38bc0f..000000000
--- a/winsup/cygwin/include/sys/acl.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* sys/acl.h header file for Cygwin.
-
- Copyright 1999, 2000, 2001 Red Hat, Inc.
- Written by C. 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. */
-
-#ifndef _SYS_ACL_H
-#define _SYS_ACL_H
-
-#include <cygwin/acl.h>
-
-#endif /* _SYS_ACL_H */
diff --git a/winsup/cygwin/include/sys/cdefs.h b/winsup/cygwin/include/sys/cdefs.h
deleted file mode 100644
index 57bf89bef..000000000
--- a/winsup/cygwin/include/sys/cdefs.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* sys/cdefs.h
-
- Copyright 1998, 2000, 2001 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 _SYS_CDEFS_H
-#define _SYS_CDEFS_H
-#ifdef __cplusplus
-#define __BEGIN_DECLS extern "C" {
-#define __END_DECLS }
-#else
-#define __BEGIN_DECLS
-#define __END_DECLS
-#endif
-#define __P(protos) protos /* full-blown ANSI C */
-#endif
-
diff --git a/winsup/cygwin/include/sys/copying.dj b/winsup/cygwin/include/sys/copying.dj
deleted file mode 100644
index b6d105976..000000000
--- a/winsup/cygwin/include/sys/copying.dj
+++ /dev/null
@@ -1,41 +0,0 @@
-This is the file "copying.dj". It does not apply to any sources
-copyrighted by UCB Berkeley or the Free Software Foundation.
-
- Copyright Information for sources and executables that are marked
- Copyright (C) DJ Delorie
- 24 Kirsten Ave
- Rochester NH 03867-2954
-
-This document is Copyright (C) DJ Delorie and may be distributed
-verbatim, but changing it is not allowed.
-
-Source code copyright DJ Delorie is distributed under the terms of the
-GNU General Public Licence, with the following exceptions:
-
-* Any existing copyright or authorship information in any given source
-file must remain intact. If you modify a source file, a notice to that
-effect must be added to the authorship information in the source file.
-
-* binaries provided in djgpp may be distributed without sources ONLY if
-the recipient is given sufficient information to obtain a copy of djgpp
-themselves. This primarily applies to go32.exe, emu387, stub.exe, and
-the graphics drivers.
-
-* modified versions of the binaries provided in djgpp must be
-distributed under the terms of the GPL.
-
-* objects and libraries linked into an application may be distributed
-without sources.
-
------
-
-Changes to source code copyright BSD or FSF are copyright DJ Delorie, but
-fall under the terms of the original copyright.
-
-A copy of the file "COPYING" is included with this document. If you did not
-receive a copy of "COPYING", you may obtain one from whence this document
-was obtained, or by writing:
- Free Software Foundation
- 675 Mass Ave
- Cambridge, MA 02139
- USA
diff --git a/winsup/cygwin/include/sys/cygwin.h b/winsup/cygwin/include/sys/cygwin.h
deleted file mode 100644
index f8feda4c7..000000000
--- a/winsup/cygwin/include/sys/cygwin.h
+++ /dev/null
@@ -1,259 +0,0 @@
-/* sys/cygwin.h
-
- Copyright 1997, 1998, 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. */
-
-#ifndef _SYS_CYGWIN_H
-#define _SYS_CYGWIN_H
-
-#include <sys/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern pid_t cygwin32_winpid_to_pid (int);
-extern void cygwin32_win32_to_posix_path_list (const char *, char *);
-extern int cygwin32_win32_to_posix_path_list_buf_size (const char *);
-extern void cygwin32_posix_to_win32_path_list (const char *, char *);
-extern int cygwin32_posix_to_win32_path_list_buf_size (const char *);
-extern int cygwin32_conv_to_win32_path (const char *, char *);
-extern int cygwin32_conv_to_full_win32_path (const char *, char *);
-extern void cygwin32_conv_to_posix_path (const char *, char *);
-extern void cygwin32_conv_to_full_posix_path (const char *, char *);
-extern int cygwin32_posix_path_list_p (const char *);
-extern void cygwin32_split_path (const char *, char *, char *);
-
-extern pid_t cygwin_winpid_to_pid (int);
-extern int cygwin_win32_to_posix_path_list (const char *, char *);
-extern int cygwin_win32_to_posix_path_list_buf_size (const char *);
-extern int cygwin_posix_to_win32_path_list (const char *, char *);
-extern int cygwin_posix_to_win32_path_list_buf_size (const char *);
-extern int cygwin_conv_to_win32_path (const char *, char *);
-extern int cygwin_conv_to_full_win32_path (const char *, char *);
-extern int cygwin_conv_to_posix_path (const char *, char *);
-extern int cygwin_conv_to_full_posix_path (const char *, char *);
-extern int cygwin_posix_path_list_p (const char *);
-extern void cygwin_split_path (const char *, char *, char *);
-
-struct __cygwin_perfile
-{
- const char *name;
- unsigned flags;
-};
-
-/* External interface stuff */
-
-typedef enum
- {
- CW_LOCK_PINFO,
- CW_UNLOCK_PINFO,
- CW_GETTHREADNAME,
- CW_GETPINFO,
- CW_SETPINFO,
- CW_SETTHREADNAME,
- CW_GETVERSIONINFO,
- CW_READ_V1_MOUNT_TABLES,
- CW_USER_DATA,
- CW_PERFILE,
- CW_GET_CYGDRIVE_PREFIXES,
- CW_GETPINFO_FULL,
- CW_INIT_EXCEPTIONS,
- CW_GET_CYGDRIVE_INFO,
- CW_SET_CYGWIN_REGISTRY_NAME,
- CW_GET_CYGWIN_REGISTRY_NAME,
- CW_STRACE_TOGGLE,
- CW_STRACE_ACTIVE,
- CW_CYGWIN_PID_TO_WINPID,
- CW_EXTRACT_DOMAIN_AND_USER
- } cygwin_getinfo_types;
-
-#define CW_NEXTPID 0x80000000 // or with pid to get next one
-
-/* Flags associated with process_state */
-enum
-{
- PID_IN_USE = 0x0001, // Entry in use.
- PID_ZOMBIE = 0x0002, // Child exited: no parent wait.
- PID_STOPPED = 0x0004, // Waiting for SIGCONT.
- PID_TTYIN = 0x0008, // Waiting for terminal input.
- PID_TTYOU = 0x0010, // Waiting for terminal output.
- PID_ORPHANED = 0x0020, // Member of an orphaned process group.
- PID_ACTIVE = 0x0040, // Pid accepts signals.
- PID_CYGPARENT = 0x0080, // Set if parent was a cygwin app.
- PID_SPLIT_HEAP = 0x0100, // Set if the heap has been split,
- // which means we can't fork again.
- PID_UNUSED = 0x0200, // Flag that pid should be cleared from parent's
- // wait list
- PID_UNUSED1 = 0x0400, // Set if process uses Winsock.
- PID_INITIALIZING = 0x0800, // Set until ready to receive signals.
- PID_USETTY = 0x1000, // Setting this enables or disables cygwin's
- // tty support. This is inherited by
- // all execed or forked processes.
- PID_ALLPIDS = 0x2000, // child has execed
- PID_EXECED = 0x4000, // redirect to original pid info block
- PID_NOREDIR = 0x8000, // don't redirect if execed
- PID_EXITED = 0x80000000 // Free entry.
-};
-
-#ifdef WINVER
-#ifdef _PATH_PASSWD
-extern HANDLE cygwin_logon_user (const struct passwd *, const char *);
-#endif
-
-/* This lives in the app and is initialized before jumping into the DLL.
- It should only contain stuff which the user's process needs to see, or
- which is needed before the user pointer is initialized, or is needed to
- carry inheritance information from parent to child. Note that it cannot
- be used to carry inheritance information across exec!
-
- Remember, this structure is linked into the application's executable.
- Changes to this can invalidate existing executables, so we go to extra
- lengths to avoid having to do it.
-
- When adding/deleting members, remember to adjust {public,internal}_reserved.
- The size of the class shouldn't change [unless you really are prepared to
- invalidate all existing executables]. The program does a check (using
- SIZEOF_PER_PROCESS) to make sure you remember to make the adjustment.
-*/
-
-#ifdef __cplusplus
-class ResourceLocks;
-class MTinterface;
-#endif
-
-struct per_process
-{
- char *initial_sp;
-
- /* The offset of these 3 values can never change. */
- /* magic_biscuit is the size of this class and should never change. */
- unsigned long magic_biscuit;
- unsigned long dll_major;
- unsigned long dll_minor;
-
- struct _reent **impure_ptr_ptr;
- char ***envptr;
-
- /* Used to point to the memory machine we should use. Usually these
- point back into the dll, but they can be overridden by the user. */
- void *(*malloc)(size_t);
- void (*free)(void *);
- void *(*realloc)(void *, size_t);
-
- int *fmode_ptr;
-
- int (*main)(int, char **, char **);
- void (**ctors)(void);
- void (**dtors)(void);
-
- /* For fork */
- void *data_start;
- void *data_end;
- void *bss_start;
- void *bss_end;
-
- void *(*calloc)(size_t, size_t);
- /* For future expansion of values set by the app. */
- void (*premain[4]) (int, char **, struct per_process *);
-
- /* The rest are *internal* to cygwin.dll.
- Those that are here because we want the child to inherit the value from
- the parent (which happens when bss is copied) are marked as such. */
-
- /* non-zero of ctors have been run. Inherited from parent. */
- int run_ctors_p;
-
- DWORD unused[7];
-
- /* Non-zero means the task was forked. The value is the pid.
- Inherited from parent. */
- int forkee;
-
- HMODULE hmodule;
-
- DWORD api_major; /* API version that this program was */
- DWORD api_minor; /* linked with */
- /* For future expansion, so apps won't have to be relinked if we
- add an item. */
- DWORD unused2[5];
-
-#ifdef __INSIDE_CYGWIN__
- ResourceLocks *resourcelocks;
- MTinterface *threadinterface;
-#else
- void *resourcelocks;
- void *threadinterface;
-#endif
- struct _reent *impure_ptr;
-};
-#define per_process_overwrite ((unsigned) &(((struct per_process *) NULL)->resourcelocks))
-
-extern void cygwin_premain0 (int argc, char **argv, struct per_process *);
-extern void cygwin_premain1 (int argc, char **argv, struct per_process *);
-extern void cygwin_premain2 (int argc, char **argv, struct per_process *);
-extern void cygwin_premain3 (int argc, char **argv, struct per_process *);
-
-extern void cygwin_set_impersonation_token (const HANDLE);
-
-/* included if <windows.h> is included */
-extern int cygwin32_attach_handle_to_fd (char *, int, HANDLE, mode_t, DWORD);
-extern int cygwin_attach_handle_to_fd (char *, int, HANDLE, mode_t, DWORD);
-
-#include <sys/resource.h>
-
-#define TTY_CONSOLE 0x40000000
-
-#define EXTERNAL_PINFO_VERSION_16_BIT 0
-#define EXTERNAL_PINFO_VERSION_32_BIT 1
-#define EXTERNAL_PINFO_VERSION EXTERNAL_PINFO_VERSION_32_BIT
-
-#ifndef _SYS_TYPES_H
-typedef unsigned short __uid16_t;
-typedef unsigned short __gid16_t;
-typedef unsigned long __uid32_t;
-typedef unsigned long __gid32_t;
-#endif
-
-struct external_pinfo
- {
- pid_t pid;
- pid_t ppid;
- HANDLE hProcess;
- DWORD dwProcessId, dwSpawnedProcessId;
- __uid16_t uid;
- __gid16_t gid;
- pid_t pgid;
- pid_t sid;
- int ctty;
- mode_t umask;
-
- long start_time;
- struct rusage rusage_self;
- struct rusage rusage_children;
-
- char progname[MAX_PATH];
-
- DWORD strace_mask;
- DWORD version;
-
- DWORD process_state;
-
- /* Only available if version >= EXTERNAL_PINFO_VERSION_32_BIT */
- __uid32_t uid32;
- __gid32_t gid32;
-};
-
-DWORD cygwin_internal (cygwin_getinfo_types, ...);
-#endif /*WINVER*/
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif /* _SYS_CYGWIN_H */
diff --git a/winsup/cygwin/include/sys/file.h b/winsup/cygwin/include/sys/file.h
deleted file mode 100644
index dbf2ea88a..000000000
--- a/winsup/cygwin/include/sys/file.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* This is file FILE.H */
-/*
-** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
-**
-** This file is distributed under the terms listed in the document
-** "copying.dj", available from DJ Delorie at the address above.
-** A copy of "copying.dj" should accompany this file; if not, a copy
-** should be available from where this file was obtained. This file
-** may not be distributed without a verbatim copy of "copying.dj".
-**
-** This file is distributed WITHOUT ANY WARRANTY; without even the implied
-** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-*/
-
-#ifndef _FILE_H_
-#define _FILE_H_
-
-#include <fcntl.h>
-
-#define L_SET 0
-#define L_CURR 1
-#define L_INCR 1
-#define L_XTND 2
-
-#define F_OK 0 /* does file exist */
-#define X_OK 1 /* is it executable by caller */
-#define W_OK 2 /* is it writable by caller */
-#define R_OK 4 /* is it readable by caller */
-
-#endif
diff --git a/winsup/cygwin/include/sys/ioctl.h b/winsup/cygwin/include/sys/ioctl.h
deleted file mode 100644
index fd9515fb1..000000000
--- a/winsup/cygwin/include/sys/ioctl.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* sys/ioctl.h
-
- Copyright 1998, 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. */
-
-/* sys/ioctl.h */
-
-#ifndef _SYS_IOCTL_H
-#define _SYS_IOCTL_H
-
-#include <sys/cdefs.h>
-
-/* /dev/windows ioctls */
-
-#define WINDOWS_POST 0 /* Set write() behavior to PostMessage() */
-#define WINDOWS_SEND 1 /* Set write() behavior to SendMessage() */
-#define WINDOWS_HWND 2 /* Set hWnd for read() calls */
-
-__BEGIN_DECLS
-
-int ioctl (int __fd, int __cmd, ...);
-
-__END_DECLS
-
-#endif
diff --git a/winsup/cygwin/include/sys/ipc.h b/winsup/cygwin/include/sys/ipc.h
deleted file mode 100644
index c718a173a..000000000
--- a/winsup/cygwin/include/sys/ipc.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* sys/ipc.h
-
- Copyright 2001 Red Hat Inc.
- Written by Robert Collins <rbtcollins@hotmail.com>
-
-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 __cplusplus
-extern "C"
-{
-#endif
-
-#ifndef _SYS_IPC_H
-#define _SYS_IPC_H
-
-/* sys/types must be included before sys/ipc.h. We aren't meant to automatically
- * include it however
- */
-
-struct ipc_perm {
- uid_t uid;
- gid_t gid;
- uid_t cuid;
- gid_t cgid;
- mode_t mode;
-};
-
-/* the mode flags used with the _get functions use the low order 9 bits for a mode
- * request
- */
-#define IPC_CREAT 0x0200
-#define IPC_EXCL 0x0400
-#define IPC_NOWAIT 0x0800
-
-/* this is a value that will _never_ be a valid key from ftok */
-#define IPC_PRIVATE -2
-
-/* ctl commands 1000-1fff is ipc reserved */
-#define IPC_RMID 0x1003
-#define IPC_SET 0x1002
-#define IPC_STAT 0x1001
-
-key_t ftok(const char *, int);
-
-#endif /* _SYS_IPC_H */
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/winsup/cygwin/include/sys/mman.h b/winsup/cygwin/include/sys/mman.h
deleted file mode 100644
index 70c003589..000000000
--- a/winsup/cygwin/include/sys/mman.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* sys/mman.h
-
- Copyright 1996, 1997, 1998, 2000, 2001 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 _SYS_MMAN_H_
-#define _SYS_MMAN_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#include <stddef.h>
-#include <sys/types.h>
-
-#define PROT_NONE 0
-#define PROT_READ 1
-#define PROT_WRITE 2
-#define PROT_EXEC 4
-
-#define MAP_FILE 0
-#define MAP_SHARED 1
-#define MAP_PRIVATE 2
-#define MAP_TYPE 0xF
-#define MAP_FIXED 0x10
-#define MAP_ANONYMOUS 0x20
-#define MAP_ANON MAP_ANONYMOUS
-
-#define MAP_FAILED ((caddr_t)-1)
-
-/*
- * Flags for msync.
- */
-#define MS_ASYNC 1
-#define MS_SYNC 2
-#define MS_INVALIDATE 4
-
-extern caddr_t mmap (caddr_t __addr, size_t __len, int __prot, int __flags, int __fd, off_t __off);
-extern int munmap (caddr_t __addr, size_t __len);
-extern int mprotect (caddr_t __addr, size_t __len, int __prot);
-extern int msync (caddr_t __addr, size_t __len, int __flags);
-
-#ifdef __cplusplus
-};
-#endif /* __cplusplus */
-
-#endif /* _SYS_MMAN_H_ */
diff --git a/winsup/cygwin/include/sys/mount.h b/winsup/cygwin/include/sys/mount.h
deleted file mode 100644
index 26e02cba2..000000000
--- a/winsup/cygwin/include/sys/mount.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* sys/mount.h
-
- Copyright 1998, 1999, 2000, 2001 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 _SYS_MOUNT_H
-#define _SYS_MOUNT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum
-{
- MOUNT_SYMLINK = 0x001, /* "mount point" is a symlink */
- MOUNT_BINARY = 0x002, /* "binary" format read/writes */
- MOUNT_SYSTEM = 0x008, /* mount point came from system table */
- MOUNT_EXEC = 0x010, /* Any file in the mounted directory gets 'x' bit */
- MOUNT_CYGDRIVE = 0x020, /* mount point refers to cygdriv device mount */
- MOUNT_CYGWIN_EXEC = 0x040, /* file or directory is or contains a cygwin
- executable */
- MOUNT_MIXED = 0x080, /* reads are text, writes are binary
- not yet implemented */
- MOUNT_NOTEXEC = 0x100, /* don't check files for executable magic */
- MOUNT_DEVFS = 0x200, /* /device "filesystem" */
- MOUNT_PROC = 0x400 /* /proc "filesystem" */
-};
-
-int mount (const char *, const char *, unsigned __flags);
-int umount (const char *);
-int cygwin_umount (const char *__path, unsigned __flags);
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif /* _SYS_MOUNT_H */
diff --git a/winsup/cygwin/include/sys/mtio.h b/winsup/cygwin/include/sys/mtio.h
deleted file mode 100644
index 84812bdc9..000000000
--- a/winsup/cygwin/include/sys/mtio.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* sys/mtio.h
-
- Copyright 1999, 2001 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. */
-
-/* sys/mtio.h header file for Cygwin. */
-
-#ifndef _SYS_MTIO_H
-#define _SYS_MTIO_H
-
-#include <cygwin/mtio.h>
-
-#endif /* _SYS_MTIO_H */
diff --git a/winsup/cygwin/include/sys/poll.h b/winsup/cygwin/include/sys/poll.h
deleted file mode 100644
index a5bd4bded..000000000
--- a/winsup/cygwin/include/sys/poll.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* sys/poll.h
-
- Copyright 2000, 2001 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 _SYS_POLL_H
-#define _SYS_POLL_H
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-
-#define POLLIN 1 /* Set if data to read. */
-#define POLLPRI 2 /* Set if urgent data to read. */
-#define POLLOUT 4 /* Set if writing data wouldn't block. */
-#define POLLERR 8 /* An error occured. */
-#define POLLHUP 16 /* Shutdown or close happened. */
-#define POLLNVAL 32 /* Invalid file descriptor. */
-
-#define NPOLLFILE 64 /* Number of canonical fd's in one call to poll(). */
-
-/* The following values are defined by XPG4. */
-#define POLLRDNORM POLLIN
-#define POLLRDBAND POLLPRI
-#define POLLWRNORM POLLOUT
-#define POLLWRBAND POLLOUT
-
-struct pollfd {
- int fd;
- short events;
- short revents;
-};
-
-extern int poll __P ((struct pollfd *fds, unsigned int nfds, int timeout));
-
-__END_DECLS
-
-#endif /* _SYS_POLL_H */
diff --git a/winsup/cygwin/include/sys/procfs.h b/winsup/cygwin/include/sys/procfs.h
deleted file mode 100644
index 78485f678..000000000
--- a/winsup/cygwin/include/sys/procfs.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* sys/procfs.h
-
- Copyright 2000, 2001 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. */
-
-/* sys/procfs.h header file for Cygwin. */
-
-#ifndef _SYS_PROCFS_H
-#define _SYS_PROCFS_H
-
-#include <cygwin/core_dump.h>
-
-#endif /* _SYS_PROCFS_H */
diff --git a/winsup/cygwin/include/sys/resource.h b/winsup/cygwin/include/sys/resource.h
deleted file mode 100644
index c1fe544a9..000000000
--- a/winsup/cygwin/include/sys/resource.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* sys/resource.h
-
- Copyright 1997, 1998, 2000, 2001 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 _SYS_RESOURCE_H_
-#define _SYS_RESOURCE_H_
-
-#include <sys/time.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define RLIMIT_CPU 0 /* CPU time in seconds */
-#define RLIMIT_FSIZE 1 /* Maximum filesize */
-#define RLIMIT_DATA 2 /* max data size */
-#define RLIMIT_STACK 3 /* max stack size */
-#define RLIMIT_CORE 4 /* max core file size */
-#define RLIMIT_NOFILE 5 /* max number of open files */
-#define RLIMIT_OFILE RLIMIT_NOFILE /* BSD name */
-#define RLIMIT_AS 6 /* address space (virt. memory) limit */
-
-#define RLIMIT_NLIMITS 7 /* upper bound of RLIMIT_* defines */
-#define RLIM_NLIMITS RLIMIT_NLIMITS
-
-#define RLIM_INFINITY (0xffffffffUL)
-#define RLIM_SAVED_MAX RLIM_INFINITY
-#define RLIM_SAVED_CUR RLIM_INFINITY
-
-typedef unsigned long rlim_t;
-
-struct rlimit {
- rlim_t rlim_cur;
- rlim_t rlim_max;
-};
-
-#define RUSAGE_SELF 0 /* calling process */
-#define RUSAGE_CHILDREN -1 /* terminated child processes */
-
-struct rusage {
- struct timeval ru_utime; /* user time used */
- struct timeval ru_stime; /* system time used */
- long ru_maxrss;
- long ru_ixrss; /* XXX: 0 */
- long ru_idrss; /* XXX: sum of rm_asrss */
- long ru_isrss; /* XXX: 0 */
- long ru_minflt; /* any page faults not requiring I/O */
- long ru_majflt; /* any page faults requiring I/O */
- long ru_nswap; /* swaps */
- long ru_inblock; /* block input operations */
- long ru_oublock; /* block output operations */
- long ru_msgsnd; /* messages sent */
- long ru_msgrcv; /* messages received */
- long ru_nsignals; /* signals received */
- long ru_nvcsw; /* voluntary context switches */
- long ru_nivcsw; /* involuntary " */
-#define ru_last ru_nivcsw
-};
-
-int getrlimit (int __resource, struct rlimit *__rlp);
-int setrlimit (int __resource, const struct rlimit *__rlp);
-
-int getrusage (int __who, struct rusage *__rusage);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/winsup/cygwin/include/sys/select.h b/winsup/cygwin/include/sys/select.h
deleted file mode 100644
index 666a151eb..000000000
--- a/winsup/cygwin/include/sys/select.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* select.h
- Copyright 1998, 1999, 2000, 2001 Red Hat, Inc.
-
- Written by Geoffrey Noer <noer@cygnus.com>
-
-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 _SYS_SELECT_H
-#define _SYS_SELECT_H
-
-#if !defined (_POSIX_SOURCE) && !defined (__INSIDE_CYGWIN_NET__)
-
-#include <sys/cdefs.h>
-
-/* Get fd_set, and macros like FD_SET */
-#include <sys/types.h>
-
-/* Get definition of timeval. */
-#include <sys/time.h>
-#include <time.h>
-
-__BEGIN_DECLS
-
-int select __P ((int __n, fd_set *__readfds, fd_set *__writefds,
- fd_set *__exceptfds, struct timeval *__timeout));
-
-__END_DECLS
-
-#endif /* !_POSIX_SOURCE, !__INSIDE_CYGWIN_NET__ */
-
-#endif /* sys/select.h */
diff --git a/winsup/cygwin/include/sys/shm.h b/winsup/cygwin/include/sys/shm.h
deleted file mode 100644
index 208c5f29f..000000000
--- a/winsup/cygwin/include/sys/shm.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* sys/shm.h
-
- Copyright 2001 Red Hat Inc.
- Written by Robert Collins <rbtcollins@hotmail.com>
-
-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 __cplusplus
-extern "C"
-{
-#endif
-
-#ifndef _SYS_SHM_H
-#define _SYS_SHM_H
-
-#include <sys/ipc.h>
-
-#define SHM_RDONLY 1
-/* 64 Kb was hardcoded for x86. MS states this may change, but we need it in the header
- * file.
- */
-#define SHMLBA 65536
-#define SHM_RND 1
-
-typedef long int shmatt_t;
-
-#if defined(__INSIDE_CYGWIN__) && defined(__cplusplus)
-
-class _shmattach {
-public:
- void *data;
- int shmflg;
- class _shmattach *next;
-};
-
-class shmid_ds {
-public:
- struct ipc_perm shm_perm;
- size_t shm_segsz;
- pid_t shm_lpid;
- pid_t shm_cpid;
- shmatt_t shm_nattch;
- time_t shm_atime;
- time_t shm_dtime;
- time_t shm_ctime;
- void *mapptr;
-};
-
-class shmnode {
-public:
- class shmid_ds * shmds;
- int shm_id;
- class shmnode *next;
- key_t key;
- HANDLE filemap;
- HANDLE attachmap;
- class _shmattach *attachhead;
-};
-
-#else
-/* this is what we return when queried. It has no bitwise correspondence
- * the internal structures
- */
-struct shmid_ds {
- struct ipc_perm shm_perm;
- size_t shm_segsz;
- pid_t shm_lpid;
- pid_t shm_cpid;
- shmatt_t shm_nattch;
- time_t shm_atime;
- time_t shm_dtime;
- time_t shm_ctime;
-};
-#endif /* __INSIDE_CYGWIN__ */
-
-void *shmat(int, const void *, int);
-int shmctl(int, int, struct shmid_ds *);
-int shmdt(const void *);
-int shmget(key_t, size_t, int);
-
-#endif /* _SYS_SHM_H */
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/winsup/cygwin/include/sys/smallprint.h b/winsup/cygwin/include/sys/smallprint.h
deleted file mode 100644
index 9593d4d10..000000000
--- a/winsup/cygwin/include/sys/smallprint.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* sys/smallprint.h
-
- Copyright 1998, 2001 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 _SYS_SMALLPRINT_H
-#define _SYS_SMALLPRINT_H
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int __small_sprintf (char *__dst, const char *__fmt, ...);
-int __small_vsprintf (char *__dst, const char *__fmt, va_list __ap);
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif /* _SYS_SMALLPRINT_H */
diff --git a/winsup/cygwin/include/sys/socket.h b/winsup/cygwin/include/sys/socket.h
deleted file mode 100644
index 51ed54e54..000000000
--- a/winsup/cygwin/include/sys/socket.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* sys/socket.h
-
- Copyright 1996-2001 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 _SYS_SOCKET_H
-#define _SYS_SOCKET_H
-
-#include <features.h>
-#include <cygwin/socket.h>
-#include <sys/time.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/* SUS symbolic values for the second parm to shutdown(2) */
-#define SHUT_RD 0 /* == Win32 SD_RECEIVE */
-#define SHUT_WR 1 /* == Win32 SD_SEND */
-#define SHUT_RDWR 2 /* == Win32 SD_BOTH */
-
-#ifndef __INSIDE_CYGWIN_NET__
- int accept (int, struct sockaddr *__peer, int *);
- int bind (int, const struct sockaddr *__my_addr, int __addrlen);
- int connect (int, const struct sockaddr *, int);
- int getpeername (int, struct sockaddr *__peer, int *);
- int getsockname (int, struct sockaddr *__addr, int *);
- int listen (int, int __n);
- int recv (int, void *__buff, int __len, unsigned int __flags);
- int recvfrom (int, char *__buff, int __len, int __flags,
- struct sockaddr *__from, int *__fromlen);
- int recvmsg(int s, struct msghdr *msg, int flags);
- int send (int, const void *__buff, int __len, unsigned int __flags);
- int sendmsg(int s, const struct msghdr *msg, int flags);
- int sendto (int, const void *, int, unsigned int, const struct sockaddr *, int);
- int setsockopt (int __s, int __level, int __optname, const void *optval, int __optlen);
- int getsockopt (int __s, int __level, int __optname, void *__optval, int *__optlen);
- int shutdown (int, int);
- int socket (int __family, int __type, int __protocol);
- int socketpair (int __domain, int __type, int __protocol, int *__socket_vec);
-
- struct servent *getservbyname (const char *__name, const char *__proto);
-#endif
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif /* _SYS_SOCKET_H */
diff --git a/winsup/cygwin/include/sys/soundcard.h b/winsup/cygwin/include/sys/soundcard.h
deleted file mode 100644
index 79341c547..000000000
--- a/winsup/cygwin/include/sys/soundcard.h
+++ /dev/null
@@ -1,1287 +0,0 @@
-#ifndef SOUNDCARD_H
-#define SOUNDCARD_H
-/*
- * Copyright by Hannu Savolainen 1993-1997
- *
- * 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.
- */
-
-
-/*
- * OSS interface version. With versions earlier than 3.6 this value is
- * an integer with value less than 361. In versions 3.6 and later
- * it's a six digit hexadecimal value. For example value
- * of 0x030600 represents OSS version 3.6.0.
- * Use ioctl(fd, OSS_GETVERSION, &int) to get the version number of
- * the currently active driver.
- */
-#define SOUND_VERSION 0x030802
-#define OPEN_SOUND_SYSTEM
-
-/* In Linux we need to be prepared for cross compiling */
-//#include <linux/ioctl.h>
-
-/*
- * Supported card ID numbers (Should be somewhere else?)
- */
-
-#define SNDCARD_ADLIB 1
-#define SNDCARD_SB 2
-#define SNDCARD_PAS 3
-#define SNDCARD_GUS 4
-#define SNDCARD_MPU401 5
-#define SNDCARD_SB16 6
-#define SNDCARD_SB16MIDI 7
-#define SNDCARD_UART6850 8
-#define SNDCARD_GUS16 9
-#define SNDCARD_MSS 10
-#define SNDCARD_PSS 11
-#define SNDCARD_SSCAPE 12
-#define SNDCARD_PSS_MPU 13
-#define SNDCARD_PSS_MSS 14
-#define SNDCARD_SSCAPE_MSS 15
-#define SNDCARD_TRXPRO 16
-#define SNDCARD_TRXPRO_SB 17
-#define SNDCARD_TRXPRO_MPU 18
-#define SNDCARD_MAD16 19
-#define SNDCARD_MAD16_MPU 20
-#define SNDCARD_CS4232 21
-#define SNDCARD_CS4232_MPU 22
-#define SNDCARD_MAUI 23
-#define SNDCARD_PSEUDO_MSS 24
-#define SNDCARD_GUSPNP 25
-#define SNDCARD_UART401 26
-/* Sound card numbers 27 to N are reserved. Don't add more numbers here. */
-
-/***********************************
- * IOCTL Commands for /dev/sequencer
- */
-
-#ifndef _SIOWR
-#if defined(_IOWR) && (defined(_AIX) || (!defined(sun) && !defined(sparc) && !defined(__sparc__) && !defined(__INCioctlh) && !defined(__Lynx__)))
-/* Use already defined ioctl defines if they exist (except with Sun or Sparc) */
-#define SIOCPARM_MASK IOCPARM_MASK
-#define SIOC_VOID IOC_VOID
-#define SIOC_OUT IOC_OUT
-#define SIOC_IN IOC_IN
-#define SIOC_INOUT IOC_INOUT
-#define _SIOC_SIZE _IOC_SIZE
-#define _SIOC_DIR _IOC_DIR
-#define _SIOC_NONE _IOC_NONE
-#define _SIOC_READ _IOC_READ
-#define _SIOC_WRITE _IOC_WRITE
-#define _SIO _IO
-#define _SIOR _IOR
-#define _SIOW _IOW
-#define _SIOWR _IOWR
-#else
-
-/* Ioctl's have the command encoded in the lower word,
- * and the size of any in or out parameters in the upper
- * word. The high 2 bits of the upper word are used
- * to encode the in/out status of the parameter; for now
- * we restrict parameters to at most 8191 bytes.
- */
-/* #define SIOCTYPE (0xff<<8) */
-#define SIOCPARM_MASK 0x1fff /* parameters must be < 8192 bytes */
-#define SIOC_VOID 0x00000000 /* no parameters */
-#define SIOC_OUT 0x20000000 /* copy out parameters */
-#define SIOC_IN 0x40000000 /* copy in parameters */
-#define SIOC_INOUT (SIOC_IN|SIOC_OUT)
-/* the 0x20000000 is so we can distinguish new ioctl's from old */
-#define _SIO(x,y) ((int)(SIOC_VOID|(x<<8)|y))
-#define _SIOR(x,y,t) ((int)(SIOC_OUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
-#define _SIOW(x,y,t) ((int)(SIOC_IN|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
-/* this should be _SIORW, but stdio got there first */
-#define _SIOWR(x,y,t) ((int)(SIOC_INOUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
-#define _SIOC_SIZE(x) ((x>>16)&SIOCPARM_MASK)
-#define _SIOC_DIR(x) (x & 0xf0000000)
-#define _SIOC_NONE SIOC_VOID
-#define _SIOC_READ SIOC_OUT
-#define _SIOC_WRITE SIOC_IN
-# endif /* _IOWR */
-#endif /* !_SIOWR */
-
-#define SNDCTL_SEQ_RESET _SIO ('Q', 0)
-#define SNDCTL_SEQ_SYNC _SIO ('Q', 1)
-#define SNDCTL_SYNTH_INFO _SIOWR('Q', 2, struct synth_info)
-#define SNDCTL_SEQ_CTRLRATE _SIOWR('Q', 3, int) /* Set/get timer resolution (HZ) */
-#define SNDCTL_SEQ_GETOUTCOUNT _SIOR ('Q', 4, int)
-#define SNDCTL_SEQ_GETINCOUNT _SIOR ('Q', 5, int)
-#define SNDCTL_SEQ_PERCMODE _SIOW ('Q', 6, int)
-#define SNDCTL_FM_LOAD_INSTR _SIOW ('Q', 7, struct sbi_instrument) /* Obsolete. Don't use!!!!!! */
-#define SNDCTL_SEQ_TESTMIDI _SIOW ('Q', 8, int)
-#define SNDCTL_SEQ_RESETSAMPLES _SIOW ('Q', 9, int)
-#define SNDCTL_SEQ_NRSYNTHS _SIOR ('Q',10, int)
-#define SNDCTL_SEQ_NRMIDIS _SIOR ('Q',11, int)
-#define SNDCTL_MIDI_INFO _SIOWR('Q',12, struct midi_info)
-#define SNDCTL_SEQ_THRESHOLD _SIOW ('Q',13, int)
-#define SNDCTL_SYNTH_MEMAVL _SIOWR('Q',14, int) /* in=dev#, out=memsize */
-#define SNDCTL_FM_4OP_ENABLE _SIOW ('Q',15, int) /* in=dev# */
-#define SNDCTL_SEQ_PANIC _SIO ('Q',17)
-#define SNDCTL_SEQ_OUTOFBAND _SIOW ('Q',18, struct seq_event_rec)
-#define SNDCTL_SEQ_GETTIME _SIOR ('Q',19, int)
-#define SNDCTL_SYNTH_ID _SIOWR('Q',20, struct synth_info)
-#define SNDCTL_SYNTH_CONTROL _SIOWR('Q',21, struct synth_control)
-#define SNDCTL_SYNTH_REMOVESAMPLE _SIOWR('Q',22, struct remove_sample)
-
-typedef struct synth_control
-{
- int devno; /* Synthesizer # */
- char data[4000]; /* Device spesific command/data record */
-}synth_control;
-
-typedef struct remove_sample
-{
- int devno; /* Synthesizer # */
- int bankno; /* MIDI bank # (0=General MIDI) */
- int instrno; /* MIDI instrument number */
-} remove_sample;
-
-typedef struct seq_event_rec {
- unsigned char arr[8];
-} seq_event_rec;
-
-#define SNDCTL_TMR_TIMEBASE _SIOWR('T', 1, int)
-#define SNDCTL_TMR_START _SIO ('T', 2)
-#define SNDCTL_TMR_STOP _SIO ('T', 3)
-#define SNDCTL_TMR_CONTINUE _SIO ('T', 4)
-#define SNDCTL_TMR_TEMPO _SIOWR('T', 5, int)
-#define SNDCTL_TMR_SOURCE _SIOWR('T', 6, int)
-# define TMR_INTERNAL 0x00000001
-# define TMR_EXTERNAL 0x00000002
-# define TMR_MODE_MIDI 0x00000010
-# define TMR_MODE_FSK 0x00000020
-# define TMR_MODE_CLS 0x00000040
-# define TMR_MODE_SMPTE 0x00000080
-#define SNDCTL_TMR_METRONOME _SIOW ('T', 7, int)
-#define SNDCTL_TMR_SELECT _SIOW ('T', 8, int)
-
-/*
- * Some big endian/little endian handling macros
- */
-
-#if defined(_AIX) || defined(AIX) || defined(sparc) || defined(__sparc__) || defined(HPPA) || defined(PPC)
-/* Big endian machines */
-# define _PATCHKEY(id) (0xfd00|id)
-# define AFMT_S16_NE AFMT_S16_BE
-#else
-# define _PATCHKEY(id) ((id<<8)|0xfd)
-# define AFMT_S16_NE AFMT_S16_LE
-#endif
-
-/*
- * Sample loading mechanism for internal synthesizers (/dev/sequencer)
- * The following patch_info structure has been designed to support
- * Gravis UltraSound. It tries to be universal format for uploading
- * sample based patches but is probably too limited.
- *
- * (PBD) As Hannu guessed, the GUS structure is too limited for
- * the WaveFront, but this is the right place for a constant definition.
- */
-
-struct patch_info {
- unsigned short key; /* Use WAVE_PATCH here */
-#define WAVE_PATCH _PATCHKEY(0x04)
-#define GUS_PATCH WAVE_PATCH
-#define WAVEFRONT_PATCH _PATCHKEY(0x06)
-
- short device_no; /* Synthesizer number */
- short instr_no; /* Midi pgm# */
-
- unsigned int mode;
-/*
- * The least significant byte has the same format than the GUS .PAT
- * files
- */
-#define WAVE_16_BITS 0x01 /* bit 0 = 8 or 16 bit wave data. */
-#define WAVE_UNSIGNED 0x02 /* bit 1 = Signed - Unsigned data. */
-#define WAVE_LOOPING 0x04 /* bit 2 = looping enabled-1. */
-#define WAVE_BIDIR_LOOP 0x08 /* bit 3 = Set is bidirectional looping. */
-#define WAVE_LOOP_BACK 0x10 /* bit 4 = Set is looping backward. */
-#define WAVE_SUSTAIN_ON 0x20 /* bit 5 = Turn sustaining on. (Env. pts. 3)*/
-#define WAVE_ENVELOPES 0x40 /* bit 6 = Enable envelopes - 1 */
-#define WAVE_FAST_RELEASE 0x80 /* bit 7 = Shut off immediately after note off */
- /* (use the env_rate/env_offs fields). */
-/* Linux specific bits */
-#define WAVE_VIBRATO 0x00010000 /* The vibrato info is valid */
-#define WAVE_TREMOLO 0x00020000 /* The tremolo info is valid */
-#define WAVE_SCALE 0x00040000 /* The scaling info is valid */
-#define WAVE_FRACTIONS 0x00080000 /* Fraction information is valid */
-/* Reserved bits */
-#define WAVE_ROM 0x40000000 /* For future use */
-#define WAVE_MULAW 0x20000000 /* For future use */
-/* Other bits must be zeroed */
-
- int len; /* Size of the wave data in bytes */
- int loop_start, loop_end; /* Byte offsets from the beginning */
-
-/*
- * The base_freq and base_note fields are used when computing the
- * playback speed for a note. The base_note defines the tone frequency
- * which is heard if the sample is played using the base_freq as the
- * playback speed.
- *
- * The low_note and high_note fields define the minimum and maximum note
- * frequencies for which this sample is valid. It is possible to define
- * more than one samples for an instrument number at the same time. The
- * low_note and high_note fields are used to select the most suitable one.
- *
- * The fields base_note, high_note and low_note should contain
- * the note frequency multiplied by 1000. For example value for the
- * middle A is 440*1000.
- */
-
- unsigned int base_freq;
- unsigned int base_note;
- unsigned int high_note;
- unsigned int low_note;
- int panning; /* -128=left, 127=right */
- int detuning;
-
-/* New fields introduced in version 1.99.5 */
-
- /* Envelope. Enabled by mode bit WAVE_ENVELOPES */
- unsigned char env_rate[ 6 ]; /* GUS HW ramping rate */
- unsigned char env_offset[ 6 ]; /* 255 == 100% */
-
- /*
- * The tremolo, vibrato and scale info are not supported yet.
- * Enable by setting the mode bits WAVE_TREMOLO, WAVE_VIBRATO or
- * WAVE_SCALE
- */
-
- unsigned char tremolo_sweep;
- unsigned char tremolo_rate;
- unsigned char tremolo_depth;
-
- unsigned char vibrato_sweep;
- unsigned char vibrato_rate;
- unsigned char vibrato_depth;
-
- int scale_frequency;
- unsigned int scale_factor; /* from 0 to 2048 or 0 to 2 */
-
- int volume;
- int fractions;
- int reserved1;
- int spare[2];
- char data[1]; /* The waveform data starts here */
- };
-
-struct sysex_info {
- short key; /* Use SYSEX_PATCH or MAUI_PATCH here */
-#define SYSEX_PATCH _PATCHKEY(0x05)
-#define MAUI_PATCH _PATCHKEY(0x06)
- short device_no; /* Synthesizer number */
- int len; /* Size of the sysex data in bytes */
- unsigned char data[1]; /* Sysex data starts here */
- };
-
-/*
- * /dev/sequencer input events.
- *
- * The data written to the /dev/sequencer is a stream of events. Events
- * are records of 4 or 8 bytes. The first byte defines the size.
- * Any number of events can be written with a write call. There
- * is a set of macros for sending these events. Use these macros if you
- * want to maximize portability of your program.
- *
- * Events SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO. Are also input events.
- * (All input events are currently 4 bytes long. Be prepared to support
- * 8 byte events also. If you receive any event having first byte >= 128,
- * it's a 8 byte event.
- *
- * The events are documented at the end of this file.
- *
- * Normal events (4 bytes)
- * There is also a 8 byte version of most of the 4 byte events. The
- * 8 byte one is recommended.
- */
-#define SEQ_NOTEOFF 0
-#define SEQ_FMNOTEOFF SEQ_NOTEOFF /* Just old name */
-#define SEQ_NOTEON 1
-#define SEQ_FMNOTEON SEQ_NOTEON
-#define SEQ_WAIT TMR_WAIT_ABS
-#define SEQ_PGMCHANGE 3
-#define SEQ_FMPGMCHANGE SEQ_PGMCHANGE
-#define SEQ_SYNCTIMER TMR_START
-#define SEQ_MIDIPUTC 5
-#define SEQ_DRUMON 6 /*** OBSOLETE ***/
-#define SEQ_DRUMOFF 7 /*** OBSOLETE ***/
-#define SEQ_ECHO TMR_ECHO /* For synching programs with output */
-#define SEQ_AFTERTOUCH 9
-#define SEQ_CONTROLLER 10
-
-/*******************************************
- * Midi controller numbers
- *******************************************
- * Controllers 0 to 31 (0x00 to 0x1f) and
- * 32 to 63 (0x20 to 0x3f) are continuous
- * controllers.
- * In the MIDI 1.0 these controllers are sent using
- * two messages. Controller numbers 0 to 31 are used
- * to send the MSB and the controller numbers 32 to 63
- * are for the LSB. Note that just 7 bits are used in MIDI bytes.
- */
-
-#define CTL_BANK_SELECT 0x00
-#define CTL_MODWHEEL 0x01
-#define CTL_BREATH 0x02
-/* undefined 0x03 */
-#define CTL_FOOT 0x04
-#define CTL_PORTAMENTO_TIME 0x05
-#define CTL_DATA_ENTRY 0x06
-#define CTL_MAIN_VOLUME 0x07
-#define CTL_BALANCE 0x08
-/* undefined 0x09 */
-#define CTL_PAN 0x0a
-#define CTL_EXPRESSION 0x0b
-/* undefined 0x0c */
-/* undefined 0x0d */
-/* undefined 0x0e */
-/* undefined 0x0f */
-#define CTL_GENERAL_PURPOSE1 0x10
-#define CTL_GENERAL_PURPOSE2 0x11
-#define CTL_GENERAL_PURPOSE3 0x12
-#define CTL_GENERAL_PURPOSE4 0x13
-/* undefined 0x14 - 0x1f */
-
-/* undefined 0x20 */
-/* The controller numbers 0x21 to 0x3f are reserved for the */
-/* least significant bytes of the controllers 0x00 to 0x1f. */
-/* These controllers are not recognised by the driver. */
-
-/* Controllers 64 to 69 (0x40 to 0x45) are on/off switches. */
-/* 0=OFF and 127=ON (intermediate values are possible) */
-#define CTL_DAMPER_PEDAL 0x40
-#define CTL_SUSTAIN 0x40 /* Alias */
-#define CTL_HOLD 0x40 /* Alias */
-#define CTL_PORTAMENTO 0x41
-#define CTL_SOSTENUTO 0x42
-#define CTL_SOFT_PEDAL 0x43
-/* undefined 0x44 */
-#define CTL_HOLD2 0x45
-/* undefined 0x46 - 0x4f */
-
-#define CTL_GENERAL_PURPOSE5 0x50
-#define CTL_GENERAL_PURPOSE6 0x51
-#define CTL_GENERAL_PURPOSE7 0x52
-#define CTL_GENERAL_PURPOSE8 0x53
-/* undefined 0x54 - 0x5a */
-#define CTL_EXT_EFF_DEPTH 0x5b
-#define CTL_TREMOLO_DEPTH 0x5c
-#define CTL_CHORUS_DEPTH 0x5d
-#define CTL_DETUNE_DEPTH 0x5e
-#define CTL_CELESTE_DEPTH 0x5e /* Alias for the above one */
-#define CTL_PHASER_DEPTH 0x5f
-#define CTL_DATA_INCREMENT 0x60
-#define CTL_DATA_DECREMENT 0x61
-#define CTL_NONREG_PARM_NUM_LSB 0x62
-#define CTL_NONREG_PARM_NUM_MSB 0x63
-#define CTL_REGIST_PARM_NUM_LSB 0x64
-#define CTL_REGIST_PARM_NUM_MSB 0x65
-/* undefined 0x66 - 0x78 */
-/* reserved 0x79 - 0x7f */
-
-/* Pseudo controllers (not midi compatible) */
-#define CTRL_PITCH_BENDER 255
-#define CTRL_PITCH_BENDER_RANGE 254
-#define CTRL_EXPRESSION 253 /* Obsolete */
-#define CTRL_MAIN_VOLUME 252 /* Obsolete */
-#define SEQ_BALANCE 11
-#define SEQ_VOLMODE 12
-
-/*
- * Volume mode decides how volumes are used
- */
-
-#define VOL_METHOD_ADAGIO 1
-#define VOL_METHOD_LINEAR 2
-
-/*
- * Note! SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO are used also as
- * input events.
- */
-
-/*
- * Event codes 0xf0 to 0xfc are reserved for future extensions.
- */
-
-#define SEQ_FULLSIZE 0xfd /* Long events */
-/*
- * SEQ_FULLSIZE events are used for loading patches/samples to the
- * synthesizer devices. These events are passed directly to the driver
- * of the associated synthesizer device. There is no limit to the size
- * of the extended events. These events are not queued but executed
- * immediately when the write() is called (execution can take several
- * seconds of time).
- *
- * When a SEQ_FULLSIZE message is written to the device, it must
- * be written using exactly one write() call. Other events cannot
- * be mixed to the same write.
- *
- * For FM synths (YM3812/OPL3) use struct sbi_instrument and write it to the
- * /dev/sequencer. Don't write other data together with the instrument structure
- * Set the key field of the structure to FM_PATCH. The device field is used to
- * route the patch to the corresponding device.
- *
- * For wave table use struct patch_info. Initialize the key field
- * to WAVE_PATCH.
- */
-#define SEQ_PRIVATE 0xfe /* Low level HW dependent events (8 bytes) */
-#define SEQ_EXTENDED 0xff /* Extended events (8 bytes) OBSOLETE */
-
-/*
- * Record for FM patches
- */
-
-typedef unsigned char sbi_instr_data[32];
-
-struct sbi_instrument {
- unsigned short key; /* FM_PATCH or OPL3_PATCH */
-#define FM_PATCH _PATCHKEY(0x01)
-#define OPL3_PATCH _PATCHKEY(0x03)
- short device; /* Synth# (0-4) */
- int channel; /* Program# to be initialized */
- sbi_instr_data operators; /* Register settings for operator cells (.SBI format) */
- };
-
-struct synth_info { /* Read only */
- char name[30];
- int device; /* 0-N. INITIALIZE BEFORE CALLING */
- int synth_type;
-#define SYNTH_TYPE_FM 0
-#define SYNTH_TYPE_SAMPLE 1
-#define SYNTH_TYPE_MIDI 2 /* Midi interface */
-
- int synth_subtype;
-#define FM_TYPE_ADLIB 0x00
-#define FM_TYPE_OPL3 0x01
-#define MIDI_TYPE_MPU401 0x401
-
-#define SAMPLE_TYPE_BASIC 0x10
-#define SAMPLE_TYPE_GUS SAMPLE_TYPE_BASIC
-#define SAMPLE_TYPE_WAVEFRONT 0x11
-
- int perc_mode; /* No longer supported */
- int nr_voices;
- int nr_drums; /* Obsolete field */
- int instr_bank_size;
- unsigned int capabilities;
-#define SYNTH_CAP_PERCMODE 0x00000001 /* No longer used */
-#define SYNTH_CAP_OPL3 0x00000002 /* Set if OPL3 supported */
-#define SYNTH_CAP_INPUT 0x00000004 /* Input (MIDI) device */
- int dummies[19]; /* Reserve space */
- };
-
-struct sound_timer_info {
- char name[32];
- int caps;
- };
-
-#define MIDI_CAP_MPU401 1 /* MPU-401 intelligent mode */
-
-struct midi_info {
- char name[30];
- int device; /* 0-N. INITIALIZE BEFORE CALLING */
- unsigned int capabilities; /* To be defined later */
- int dev_type;
- int dummies[18]; /* Reserve space */
- };
-
-/********************************************
- * ioctl commands for the /dev/midi##
- */
-typedef struct {
- unsigned char cmd;
- char nr_args, nr_returns;
- unsigned char data[30];
- } mpu_command_rec;
-
-#define SNDCTL_MIDI_PRETIME _SIOWR('m', 0, int)
-#define SNDCTL_MIDI_MPUMODE _SIOWR('m', 1, int)
-#define SNDCTL_MIDI_MPUCMD _SIOWR('m', 2, mpu_command_rec)
-
-/********************************************
- * IOCTL commands for /dev/dsp and /dev/audio
- */
-
-#define SNDCTL_DSP_RESET _SIO ('P', 0)
-#define SNDCTL_DSP_SYNC _SIO ('P', 1)
-#define SNDCTL_DSP_SPEED _SIOWR('P', 2, int)
-#define SNDCTL_DSP_STEREO _SIOWR('P', 3, int)
-#define SNDCTL_DSP_GETBLKSIZE _SIOWR('P', 4, int)
-#define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT
-#define SNDCTL_DSP_CHANNELS _SIOWR('P', 6, int)
-#define SOUND_PCM_WRITE_CHANNELS SNDCTL_DSP_CHANNELS
-#define SOUND_PCM_WRITE_FILTER _SIOWR('P', 7, int)
-#define SNDCTL_DSP_POST _SIO ('P', 8)
-#define SNDCTL_DSP_SUBDIVIDE _SIOWR('P', 9, int)
-#define SNDCTL_DSP_SETFRAGMENT _SIOWR('P',10, int)
-
-/* Audio data formats (Note! U8=8 and S16_LE=16 for compatibility) */
-#define SNDCTL_DSP_GETFMTS _SIOR ('P',11, int) /* Returns a mask */
-#define SNDCTL_DSP_SETFMT _SIOWR('P',5, int) /* Selects ONE fmt*/
-# define AFMT_QUERY 0x00000000 /* Return current fmt */
-# define AFMT_MU_LAW 0x00000001
-# define AFMT_A_LAW 0x00000002
-# define AFMT_IMA_ADPCM 0x00000004
-# define AFMT_U8 0x00000008
-# define AFMT_S16_LE 0x00000010 /* Little endian signed 16*/
-# define AFMT_S16_BE 0x00000020 /* Big endian signed 16 */
-# define AFMT_S8 0x00000040
-# define AFMT_U16_LE 0x00000080 /* Little endian U16 */
-# define AFMT_U16_BE 0x00000100 /* Big endian U16 */
-# define AFMT_MPEG 0x00000200 /* MPEG (2) audio */
-# define AFMT_AC3 0x00000400 /* Dolby Digital AC3 */
-
-/*
- * Buffer status queries.
- */
-typedef struct audio_buf_info {
- int fragments; /* # of available fragments (partially usend ones not counted) */
- int fragstotal; /* Total # of fragments allocated */
- int fragsize; /* Size of a fragment in bytes */
-
- int bytes; /* Available space in bytes (includes partially used fragments) */
- /* Note! 'bytes' could be more than fragments*fragsize */
- } audio_buf_info;
-
-#define SNDCTL_DSP_GETOSPACE _SIOR ('P',12, audio_buf_info)
-#define SNDCTL_DSP_GETISPACE _SIOR ('P',13, audio_buf_info)
-#define SNDCTL_DSP_NONBLOCK _SIO ('P',14)
-#define SNDCTL_DSP_GETCAPS _SIOR ('P',15, int)
-# define DSP_CAP_REVISION 0x000000ff /* Bits for revision level (0 to 255) */
-# define DSP_CAP_DUPLEX 0x00000100 /* Full duplex record/playback */
-# define DSP_CAP_REALTIME 0x00000200 /* Real time capability */
-# define DSP_CAP_BATCH 0x00000400 /* Device has some kind of */
- /* internal buffers which may */
- /* cause some delays and */
- /* decrease precision of timing */
-# define DSP_CAP_COPROC 0x00000800 /* Has a coprocessor */
- /* Sometimes it's a DSP */
- /* but usually not */
-# define DSP_CAP_TRIGGER 0x00001000 /* Supports SETTRIGGER */
-# define DSP_CAP_MMAP 0x00002000 /* Supports mmap() */
-# define DSP_CAP_MULTI 0x00004000 /* support multiple open */
-# define DSP_CAP_BIND 0x00008000 /* channel binding to front/rear/cneter/lfe */
-
-
-#define SNDCTL_DSP_GETTRIGGER _SIOR ('P',16, int)
-#define SNDCTL_DSP_SETTRIGGER _SIOW ('P',16, int)
-# define PCM_ENABLE_INPUT 0x00000001
-# define PCM_ENABLE_OUTPUT 0x00000002
-
-typedef struct count_info {
- int bytes; /* Total # of bytes processed */
- int blocks; /* # of fragment transitions since last time */
- int ptr; /* Current DMA pointer value */
- } count_info;
-
-#define SNDCTL_DSP_GETIPTR _SIOR ('P',17, count_info)
-#define SNDCTL_DSP_GETOPTR _SIOR ('P',18, count_info)
-
-typedef struct buffmem_desc {
- unsigned *buffer;
- int size;
- } buffmem_desc;
-#define SNDCTL_DSP_MAPINBUF _SIOR ('P', 19, buffmem_desc)
-#define SNDCTL_DSP_MAPOUTBUF _SIOR ('P', 20, buffmem_desc)
-#define SNDCTL_DSP_SETSYNCRO _SIO ('P', 21)
-#define SNDCTL_DSP_SETDUPLEX _SIO ('P', 22)
-#define SNDCTL_DSP_GETODELAY _SIOR ('P', 23, int)
-
-#define SNDCTL_DSP_GETCHANNELMASK _SIOWR('P', 64, int)
-#define SNDCTL_DSP_BIND_CHANNEL _SIOWR('P', 65, int)
-# define DSP_BIND_QUERY 0x00000000
-# define DSP_BIND_FRONT 0x00000001
-# define DSP_BIND_SURR 0x00000002
-# define DSP_BIND_CENTER_LFE 0x00000004
-# define DSP_BIND_HANDSET 0x00000008
-# define DSP_BIND_MIC 0x00000010
-# define DSP_BIND_MODEM1 0x00000020
-# define DSP_BIND_MODEM2 0x00000040
-# define DSP_BIND_I2S 0x00000080
-# define DSP_BIND_SPDIF 0x00000100
-
-/*
- * Application's profile defines the way how playback underrun situations should be handled.
- *
- * APF_NORMAL (the default) and APF_NETWORK make the driver to cleanup the
- * playback buffer whenever an underrun occurs. This consumes some time
- * prevents looping the existing buffer.
- * APF_CPUINTENS is intended to be set by CPU intensive applications which
- * are likely to run out of time occasionally. In this mode the buffer cleanup is
- * disabled which saves CPU time but also let's the previous buffer content to
- * be played during the "pause" after the underrun.
- */
-#define SNDCTL_DSP_PROFILE _SIOW ('P', 23, int)
-#define APF_NORMAL 0 /* Normal applications */
-#define APF_NETWORK 1 /* Underruns probably caused by an "external" delay */
-#define APF_CPUINTENS 2 /* Underruns probably caused by "overheating" the CPU */
-
-#define SOUND_PCM_READ_RATE _SIOR ('P', 2, int)
-#define SOUND_PCM_READ_CHANNELS _SIOR ('P', 6, int)
-#define SOUND_PCM_READ_BITS _SIOR ('P', 5, int)
-#define SOUND_PCM_READ_FILTER _SIOR ('P', 7, int)
-
-/* Some alias names */
-#define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SETFMT
-#define SOUND_PCM_WRITE_RATE SNDCTL_DSP_SPEED
-#define SOUND_PCM_POST SNDCTL_DSP_POST
-#define SOUND_PCM_RESET SNDCTL_DSP_RESET
-#define SOUND_PCM_SYNC SNDCTL_DSP_SYNC
-#define SOUND_PCM_SUBDIVIDE SNDCTL_DSP_SUBDIVIDE
-#define SOUND_PCM_SETFRAGMENT SNDCTL_DSP_SETFRAGMENT
-#define SOUND_PCM_GETFMTS SNDCTL_DSP_GETFMTS
-#define SOUND_PCM_SETFMT SNDCTL_DSP_SETFMT
-#define SOUND_PCM_GETOSPACE SNDCTL_DSP_GETOSPACE
-#define SOUND_PCM_GETISPACE SNDCTL_DSP_GETISPACE
-#define SOUND_PCM_NONBLOCK SNDCTL_DSP_NONBLOCK
-#define SOUND_PCM_GETCAPS SNDCTL_DSP_GETCAPS
-#define SOUND_PCM_GETTRIGGER SNDCTL_DSP_GETTRIGGER
-#define SOUND_PCM_SETTRIGGER SNDCTL_DSP_SETTRIGGER
-#define SOUND_PCM_SETSYNCRO SNDCTL_DSP_SETSYNCRO
-#define SOUND_PCM_GETIPTR SNDCTL_DSP_GETIPTR
-#define SOUND_PCM_GETOPTR SNDCTL_DSP_GETOPTR
-#define SOUND_PCM_MAPINBUF SNDCTL_DSP_MAPINBUF
-#define SOUND_PCM_MAPOUTBUF SNDCTL_DSP_MAPOUTBUF
-
-/*
- * ioctl calls to be used in communication with coprocessors and
- * DSP chips.
- */
-
-typedef struct copr_buffer {
- int command; /* Set to 0 if not used */
- int flags;
-#define CPF_NONE 0x0000
-#define CPF_FIRST 0x0001 /* First block */
-#define CPF_LAST 0x0002 /* Last block */
- int len;
- int offs; /* If required by the device (0 if not used) */
-
- unsigned char data[4000]; /* NOTE! 4000 is not 4k */
- } copr_buffer;
-
-typedef struct copr_debug_buf {
- int command; /* Used internally. Set to 0 */
- int parm1;
- int parm2;
- int flags;
- int len; /* Length of data in bytes */
- } copr_debug_buf;
-
-typedef struct copr_msg {
- int len;
- unsigned char data[4000];
- } copr_msg;
-
-#define SNDCTL_COPR_RESET _SIO ('C', 0)
-#define SNDCTL_COPR_LOAD _SIOWR('C', 1, copr_buffer)
-#define SNDCTL_COPR_RDATA _SIOWR('C', 2, copr_debug_buf)
-#define SNDCTL_COPR_RCODE _SIOWR('C', 3, copr_debug_buf)
-#define SNDCTL_COPR_WDATA _SIOW ('C', 4, copr_debug_buf)
-#define SNDCTL_COPR_WCODE _SIOW ('C', 5, copr_debug_buf)
-#define SNDCTL_COPR_RUN _SIOWR('C', 6, copr_debug_buf)
-#define SNDCTL_COPR_HALT _SIOWR('C', 7, copr_debug_buf)
-#define SNDCTL_COPR_SENDMSG _SIOWR('C', 8, copr_msg)
-#define SNDCTL_COPR_RCVMSG _SIOR ('C', 9, copr_msg)
-
-/*********************************************
- * IOCTL commands for /dev/mixer
- */
-
-/*
- * Mixer devices
- *
- * There can be up to 20 different analog mixer channels. The
- * SOUND_MIXER_NRDEVICES gives the currently supported maximum.
- * The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells
- * the devices supported by the particular mixer.
- */
-
-#define SOUND_MIXER_NRDEVICES 25
-#define SOUND_MIXER_VOLUME 0
-#define SOUND_MIXER_BASS 1
-#define SOUND_MIXER_TREBLE 2
-#define SOUND_MIXER_SYNTH 3
-#define SOUND_MIXER_PCM 4
-#define SOUND_MIXER_SPEAKER 5
-#define SOUND_MIXER_LINE 6
-#define SOUND_MIXER_MIC 7
-#define SOUND_MIXER_CD 8
-#define SOUND_MIXER_IMIX 9 /* Recording monitor */
-#define SOUND_MIXER_ALTPCM 10
-#define SOUND_MIXER_RECLEV 11 /* Recording level */
-#define SOUND_MIXER_IGAIN 12 /* Input gain */
-#define SOUND_MIXER_OGAIN 13 /* Output gain */
-/*
- * The AD1848 codec and compatibles have three line level inputs
- * (line, aux1 and aux2). Since each card manufacturer have assigned
- * different meanings to these inputs, it's inpractical to assign
- * specific meanings (line, cd, synth etc.) to them.
- */
-#define SOUND_MIXER_LINE1 14 /* Input source 1 (aux1) */
-#define SOUND_MIXER_LINE2 15 /* Input source 2 (aux2) */
-#define SOUND_MIXER_LINE3 16 /* Input source 3 (line) */
-#define SOUND_MIXER_DIGITAL1 17 /* Digital (input) 1 */
-#define SOUND_MIXER_DIGITAL2 18 /* Digital (input) 2 */
-#define SOUND_MIXER_DIGITAL3 19 /* Digital (input) 3 */
-#define SOUND_MIXER_PHONEIN 20 /* Phone input */
-#define SOUND_MIXER_PHONEOUT 21 /* Phone output */
-#define SOUND_MIXER_VIDEO 22 /* Video/TV (audio) in */
-#define SOUND_MIXER_RADIO 23 /* Radio in */
-#define SOUND_MIXER_MONITOR 24 /* Monitor (usually mic) volume */
-
-/* Some on/off settings (SOUND_SPECIAL_MIN - SOUND_SPECIAL_MAX) */
-/* Not counted to SOUND_MIXER_NRDEVICES, but use the same number space */
-#define SOUND_ONOFF_MIN 28
-#define SOUND_ONOFF_MAX 30
-
-/* Note! Number 31 cannot be used since the sign bit is reserved */
-#define SOUND_MIXER_NONE 31
-
-/*
- * The following unsupported macros are no longer functional.
- * Use SOUND_MIXER_PRIVATE# macros in future.
- */
-#define SOUND_MIXER_ENHANCE SOUND_MIXER_NONE
-#define SOUND_MIXER_MUTE SOUND_MIXER_NONE
-#define SOUND_MIXER_LOUD SOUND_MIXER_NONE
-
-
-#define SOUND_DEVICE_LABELS {"Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", \
- "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", \
- "Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", \
- "PhoneIn", "PhoneOut", "Video", "Radio", "Monitor"}
-
-#define SOUND_DEVICE_NAMES {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \
- "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \
- "line1", "line2", "line3", "dig1", "dig2", "dig3", \
- "phin", "phout", "video", "radio", "monitor"}
-
-/* Device bitmask identifiers */
-
-#define SOUND_MIXER_RECSRC 0xff /* Arg contains a bit for each recording source */
-#define SOUND_MIXER_DEVMASK 0xfe /* Arg contains a bit for each supported device */
-#define SOUND_MIXER_RECMASK 0xfd /* Arg contains a bit for each supported recording source */
-#define SOUND_MIXER_CAPS 0xfc
-# define SOUND_CAP_EXCL_INPUT 0x00000001 /* Only one recording source at a time */
-#define SOUND_MIXER_STEREODEVS 0xfb /* Mixer channels supporting stereo */
-#define SOUND_MIXER_OUTSRC 0xfa /* Arg contains a bit for each input source to output */
-#define SOUND_MIXER_OUTMASK 0xf9 /* Arg contains a bit for each supported input source to output */
-
-/* Device mask bits */
-
-#define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME)
-#define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS)
-#define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE)
-#define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH)
-#define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM)
-#define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER)
-#define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE)
-#define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC)
-#define SOUND_MASK_CD (1 << SOUND_MIXER_CD)
-#define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX)
-#define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM)
-#define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV)
-#define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN)
-#define SOUND_MASK_OGAIN (1 << SOUND_MIXER_OGAIN)
-#define SOUND_MASK_LINE1 (1 << SOUND_MIXER_LINE1)
-#define SOUND_MASK_LINE2 (1 << SOUND_MIXER_LINE2)
-#define SOUND_MASK_LINE3 (1 << SOUND_MIXER_LINE3)
-#define SOUND_MASK_DIGITAL1 (1 << SOUND_MIXER_DIGITAL1)
-#define SOUND_MASK_DIGITAL2 (1 << SOUND_MIXER_DIGITAL2)
-#define SOUND_MASK_DIGITAL3 (1 << SOUND_MIXER_DIGITAL3)
-#define SOUND_MASK_PHONEIN (1 << SOUND_MIXER_PHONEIN)
-#define SOUND_MASK_PHONEOUT (1 << SOUND_MIXER_PHONEOUT)
-#define SOUND_MASK_RADIO (1 << SOUND_MIXER_RADIO)
-#define SOUND_MASK_VIDEO (1 << SOUND_MIXER_VIDEO)
-#define SOUND_MASK_MONITOR (1 << SOUND_MIXER_MONITOR)
-
-/* Obsolete macros */
-#define SOUND_MASK_MUTE (1 << SOUND_MIXER_MUTE)
-#define SOUND_MASK_ENHANCE (1 << SOUND_MIXER_ENHANCE)
-#define SOUND_MASK_LOUD (1 << SOUND_MIXER_LOUD)
-
-#define MIXER_READ(dev) _SIOR('M', dev, int)
-#define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME)
-#define SOUND_MIXER_READ_BASS MIXER_READ(SOUND_MIXER_BASS)
-#define SOUND_MIXER_READ_TREBLE MIXER_READ(SOUND_MIXER_TREBLE)
-#define SOUND_MIXER_READ_SYNTH MIXER_READ(SOUND_MIXER_SYNTH)
-#define SOUND_MIXER_READ_PCM MIXER_READ(SOUND_MIXER_PCM)
-#define SOUND_MIXER_READ_SPEAKER MIXER_READ(SOUND_MIXER_SPEAKER)
-#define SOUND_MIXER_READ_LINE MIXER_READ(SOUND_MIXER_LINE)
-#define SOUND_MIXER_READ_MIC MIXER_READ(SOUND_MIXER_MIC)
-#define SOUND_MIXER_READ_CD MIXER_READ(SOUND_MIXER_CD)
-#define SOUND_MIXER_READ_IMIX MIXER_READ(SOUND_MIXER_IMIX)
-#define SOUND_MIXER_READ_ALTPCM MIXER_READ(SOUND_MIXER_ALTPCM)
-#define SOUND_MIXER_READ_RECLEV MIXER_READ(SOUND_MIXER_RECLEV)
-#define SOUND_MIXER_READ_IGAIN MIXER_READ(SOUND_MIXER_IGAIN)
-#define SOUND_MIXER_READ_OGAIN MIXER_READ(SOUND_MIXER_OGAIN)
-#define SOUND_MIXER_READ_LINE1 MIXER_READ(SOUND_MIXER_LINE1)
-#define SOUND_MIXER_READ_LINE2 MIXER_READ(SOUND_MIXER_LINE2)
-#define SOUND_MIXER_READ_LINE3 MIXER_READ(SOUND_MIXER_LINE3)
-
-/* Obsolete macros */
-#define SOUND_MIXER_READ_MUTE MIXER_READ(SOUND_MIXER_MUTE)
-#define SOUND_MIXER_READ_ENHANCE MIXER_READ(SOUND_MIXER_ENHANCE)
-#define SOUND_MIXER_READ_LOUD MIXER_READ(SOUND_MIXER_LOUD)
-
-#define SOUND_MIXER_READ_RECSRC MIXER_READ(SOUND_MIXER_RECSRC)
-#define SOUND_MIXER_READ_DEVMASK MIXER_READ(SOUND_MIXER_DEVMASK)
-#define SOUND_MIXER_READ_RECMASK MIXER_READ(SOUND_MIXER_RECMASK)
-#define SOUND_MIXER_READ_STEREODEVS MIXER_READ(SOUND_MIXER_STEREODEVS)
-#define SOUND_MIXER_READ_CAPS MIXER_READ(SOUND_MIXER_CAPS)
-
-#define MIXER_WRITE(dev) _SIOWR('M', dev, int)
-#define SOUND_MIXER_WRITE_VOLUME MIXER_WRITE(SOUND_MIXER_VOLUME)
-#define SOUND_MIXER_WRITE_BASS MIXER_WRITE(SOUND_MIXER_BASS)
-#define SOUND_MIXER_WRITE_TREBLE MIXER_WRITE(SOUND_MIXER_TREBLE)
-#define SOUND_MIXER_WRITE_SYNTH MIXER_WRITE(SOUND_MIXER_SYNTH)
-#define SOUND_MIXER_WRITE_PCM MIXER_WRITE(SOUND_MIXER_PCM)
-#define SOUND_MIXER_WRITE_SPEAKER MIXER_WRITE(SOUND_MIXER_SPEAKER)
-#define SOUND_MIXER_WRITE_LINE MIXER_WRITE(SOUND_MIXER_LINE)
-#define SOUND_MIXER_WRITE_MIC MIXER_WRITE(SOUND_MIXER_MIC)
-#define SOUND_MIXER_WRITE_CD MIXER_WRITE(SOUND_MIXER_CD)
-#define SOUND_MIXER_WRITE_IMIX MIXER_WRITE(SOUND_MIXER_IMIX)
-#define SOUND_MIXER_WRITE_ALTPCM MIXER_WRITE(SOUND_MIXER_ALTPCM)
-#define SOUND_MIXER_WRITE_RECLEV MIXER_WRITE(SOUND_MIXER_RECLEV)
-#define SOUND_MIXER_WRITE_IGAIN MIXER_WRITE(SOUND_MIXER_IGAIN)
-#define SOUND_MIXER_WRITE_OGAIN MIXER_WRITE(SOUND_MIXER_OGAIN)
-#define SOUND_MIXER_WRITE_LINE1 MIXER_WRITE(SOUND_MIXER_LINE1)
-#define SOUND_MIXER_WRITE_LINE2 MIXER_WRITE(SOUND_MIXER_LINE2)
-#define SOUND_MIXER_WRITE_LINE3 MIXER_WRITE(SOUND_MIXER_LINE3)
-
-/* Obsolete macros */
-#define SOUND_MIXER_WRITE_MUTE MIXER_WRITE(SOUND_MIXER_MUTE)
-#define SOUND_MIXER_WRITE_ENHANCE MIXER_WRITE(SOUND_MIXER_ENHANCE)
-#define SOUND_MIXER_WRITE_LOUD MIXER_WRITE(SOUND_MIXER_LOUD)
-
-#define SOUND_MIXER_WRITE_RECSRC MIXER_WRITE(SOUND_MIXER_RECSRC)
-
-typedef struct mixer_info
-{
- char id[16];
- char name[32];
- int modify_counter;
- int fillers[10];
-} mixer_info;
-
-typedef struct _old_mixer_info /* Obsolete */
-{
- char id[16];
- char name[32];
-} _old_mixer_info;
-
-#define SOUND_MIXER_INFO _SIOR ('M', 101, mixer_info)
-#define SOUND_OLD_MIXER_INFO _SIOR ('M', 101, _old_mixer_info)
-
-/*
- * A mechanism for accessing "proprietary" mixer features. This method
- * permits passing 128 bytes of arbitrary data between a mixer application
- * and the mixer driver. Interpretation of the record is defined by
- * the particular mixer driver.
- */
-typedef unsigned char mixer_record[128];
-
-#define SOUND_MIXER_ACCESS _SIOWR('M', 102, mixer_record)
-
-/*
- * Two ioctls for special souncard function
- */
-#define SOUND_MIXER_AGC _SIOWR('M', 103, int)
-#define SOUND_MIXER_3DSE _SIOWR('M', 104, int)
-
-/*
- * The SOUND_MIXER_PRIVATE# commands can be redefined by low level drivers.
- * These features can be used when accessing device specific features.
- */
-#define SOUND_MIXER_PRIVATE1 _SIOWR('M', 111, int)
-#define SOUND_MIXER_PRIVATE2 _SIOWR('M', 112, int)
-#define SOUND_MIXER_PRIVATE3 _SIOWR('M', 113, int)
-#define SOUND_MIXER_PRIVATE4 _SIOWR('M', 114, int)
-#define SOUND_MIXER_PRIVATE5 _SIOWR('M', 115, int)
-
-/*
- * SOUND_MIXER_GETLEVELS and SOUND_MIXER_SETLEVELS calls can be used
- * for querying current mixer settings from the driver and for loading
- * default volume settings _prior_ activating the mixer (loading
- * doesn't affect current state of the mixer hardware). These calls
- * are for internal use only.
- */
-
-typedef struct mixer_vol_table {
- int num; /* Index to volume table */
- char name[32];
- int levels[32];
-} mixer_vol_table;
-
-#define SOUND_MIXER_GETLEVELS _SIOWR('M', 116, mixer_vol_table)
-#define SOUND_MIXER_SETLEVELS _SIOWR('M', 117, mixer_vol_table)
-
-/*
- * An ioctl for identifying the driver version. It will return value
- * of the SOUND_VERSION macro used when compiling the driver.
- * This call was introduced in OSS version 3.6 and it will not work
- * with earlier versions (returns EINVAL).
- */
-#define OSS_GETVERSION _SIOR ('M', 118, int)
-
-/*
- * Level 2 event types for /dev/sequencer
- */
-
-/*
- * The 4 most significant bits of byte 0 specify the class of
- * the event:
- *
- * 0x8X = system level events,
- * 0x9X = device/port specific events, event[1] = device/port,
- * The last 4 bits give the subtype:
- * 0x02 = Channel event (event[3] = chn).
- * 0x01 = note event (event[4] = note).
- * (0x01 is not used alone but always with bit 0x02).
- * event[2] = MIDI message code (0x80=note off etc.)
- *
- */
-
-#define EV_SEQ_LOCAL 0x80
-#define EV_TIMING 0x81
-#define EV_CHN_COMMON 0x92
-#define EV_CHN_VOICE 0x93
-#define EV_SYSEX 0x94
-/*
- * Event types 200 to 220 are reserved for application use.
- * These numbers will not be used by the driver.
- */
-
-/*
- * Events for event type EV_CHN_VOICE
- */
-
-#define MIDI_NOTEOFF 0x80
-#define MIDI_NOTEON 0x90
-#define MIDI_KEY_PRESSURE 0xA0
-
-/*
- * Events for event type EV_CHN_COMMON
- */
-
-#define MIDI_CTL_CHANGE 0xB0
-#define MIDI_PGM_CHANGE 0xC0
-#define MIDI_CHN_PRESSURE 0xD0
-#define MIDI_PITCH_BEND 0xE0
-
-#define MIDI_SYSTEM_PREFIX 0xF0
-
-/*
- * Timer event types
- */
-#define TMR_WAIT_REL 1 /* Time relative to the prev time */
-#define TMR_WAIT_ABS 2 /* Absolute time since TMR_START */
-#define TMR_STOP 3
-#define TMR_START 4
-#define TMR_CONTINUE 5
-#define TMR_TEMPO 6
-#define TMR_ECHO 8
-#define TMR_CLOCK 9 /* MIDI clock */
-#define TMR_SPP 10 /* Song position pointer */
-#define TMR_TIMESIG 11 /* Time signature */
-
-/*
- * Local event types
- */
-#define LOCL_STARTAUDIO 1
-
-#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS)
-/*
- * Some convenience macros to simplify programming of the
- * /dev/sequencer interface
- *
- * These macros define the API which should be used when possible.
- */
-#define SEQ_DECLAREBUF() SEQ_USE_EXTBUF()
-
-void seqbuf_dump(void); /* This function must be provided by programs */
-
-extern int OSS_init(int seqfd, int buflen);
-extern void OSS_seqbuf_dump(int fd, unsigned char *buf, int buflen);
-extern void OSS_seq_advbuf(int len, int fd, unsigned char *buf, int buflen);
-extern void OSS_seq_needbuf(int len, int fd, unsigned char *buf, int buflen);
-extern void OSS_patch_caching(int dev, int chn, int patch,
- int fd, unsigned char *buf, int buflen);
-extern void OSS_drum_caching(int dev, int chn, int patch,
- int fd, unsigned char *buf, int buflen);
-extern void OSS_write_patch(int fd, unsigned char *buf, int len);
-extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
-
-#define SEQ_PM_DEFINES int __foo_bar___
-#ifdef OSSLIB
-# define SEQ_USE_EXTBUF() \
- extern unsigned char *_seqbuf; \
- extern int _seqbuflen;extern int _seqbufptr
-# define SEQ_DEFINEBUF(len) SEQ_USE_EXTBUF();static int _requested_seqbuflen=len
-# define _SEQ_ADVBUF(len) OSS_seq_advbuf(len, seqfd, _seqbuf, _seqbuflen)
-# define _SEQ_NEEDBUF(len) OSS_seq_needbuf(len, seqfd, _seqbuf, _seqbuflen)
-# define SEQ_DUMPBUF() OSS_seqbuf_dump(seqfd, _seqbuf, _seqbuflen)
-
-# define SEQ_LOAD_GMINSTR(dev, instr) \
- OSS_patch_caching(dev, -1, instr, seqfd, _seqbuf, _seqbuflen)
-# define SEQ_LOAD_GMDRUM(dev, drum) \
- OSS_drum_caching(dev, -1, drum, seqfd, _seqbuf, _seqbuflen)
-#else /* !OSSLIB */
-
-# define SEQ_LOAD_GMINSTR(dev, instr)
-# define SEQ_LOAD_GMDRUM(dev, drum)
-
-# define SEQ_USE_EXTBUF() \
- extern unsigned char _seqbuf[]; \
- extern int _seqbuflen;extern int _seqbufptr
-
-#ifndef USE_SIMPLE_MACROS
-/* Sample seqbuf_dump() implementation:
- *
- * SEQ_DEFINEBUF (2048); -- Defines a buffer for 2048 bytes
- *
- * int seqfd; -- The file descriptor for /dev/sequencer.
- *
- * void
- * seqbuf_dump ()
- * {
- * if (_seqbufptr)
- * if (write (seqfd, _seqbuf, _seqbufptr) == -1)
- * {
- * perror ("write /dev/sequencer");
- * exit (-1);
- * }
- * _seqbufptr = 0;
- * }
- */
-
-#define SEQ_DEFINEBUF(len) unsigned char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0
-#define _SEQ_NEEDBUF(len) if ((_seqbufptr+(len)) > _seqbuflen) seqbuf_dump()
-#define _SEQ_ADVBUF(len) _seqbufptr += len
-#define SEQ_DUMPBUF seqbuf_dump
-#else
-/*
- * This variation of the sequencer macros is used just to format one event
- * using fixed buffer.
- *
- * The program using the macro library must define the following macros before
- * using this library.
- *
- * #define _seqbuf name of the buffer (unsigned char[])
- * #define _SEQ_ADVBUF(len) If the applic needs to know the exact
- * size of the event, this macro can be used.
- * Otherwise this must be defined as empty.
- * #define _seqbufptr Define the name of index variable or 0 if
- * not required.
- */
-#define _SEQ_NEEDBUF(len) /* empty */
-#endif
-#endif /* !OSSLIB */
-
-#define SEQ_VOLUME_MODE(dev, mode) {_SEQ_NEEDBUF(8);\
- _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
- _seqbuf[_seqbufptr+1] = SEQ_VOLMODE;\
- _seqbuf[_seqbufptr+2] = (dev);\
- _seqbuf[_seqbufptr+3] = (mode);\
- _seqbuf[_seqbufptr+4] = 0;\
- _seqbuf[_seqbufptr+5] = 0;\
- _seqbuf[_seqbufptr+6] = 0;\
- _seqbuf[_seqbufptr+7] = 0;\
- _SEQ_ADVBUF(8);}
-
-/*
- * Midi voice messages
- */
-
-#define _CHN_VOICE(dev, event, chn, note, parm) \
- {_SEQ_NEEDBUF(8);\
- _seqbuf[_seqbufptr] = EV_CHN_VOICE;\
- _seqbuf[_seqbufptr+1] = (dev);\
- _seqbuf[_seqbufptr+2] = (event);\
- _seqbuf[_seqbufptr+3] = (chn);\
- _seqbuf[_seqbufptr+4] = (note);\
- _seqbuf[_seqbufptr+5] = (parm);\
- _seqbuf[_seqbufptr+6] = (0);\
- _seqbuf[_seqbufptr+7] = 0;\
- _SEQ_ADVBUF(8);}
-
-#define SEQ_START_NOTE(dev, chn, note, vol) \
- _CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol)
-
-#define SEQ_STOP_NOTE(dev, chn, note, vol) \
- _CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol)
-
-#define SEQ_KEY_PRESSURE(dev, chn, note, pressure) \
- _CHN_VOICE(dev, MIDI_KEY_PRESSURE, chn, note, pressure)
-
-/*
- * Midi channel messages
- */
-
-#define _CHN_COMMON(dev, event, chn, p1, p2, w14) \
- {_SEQ_NEEDBUF(8);\
- _seqbuf[_seqbufptr] = EV_CHN_COMMON;\
- _seqbuf[_seqbufptr+1] = (dev);\
- _seqbuf[_seqbufptr+2] = (event);\
- _seqbuf[_seqbufptr+3] = (chn);\
- _seqbuf[_seqbufptr+4] = (p1);\
- _seqbuf[_seqbufptr+5] = (p2);\
- *(short *)&_seqbuf[_seqbufptr+6] = (w14);\
- _SEQ_ADVBUF(8);}
-/*
- * SEQ_SYSEX permits sending of sysex messages. (It may look that it permits
- * sending any MIDI bytes but it's absolutely not possible. Trying to do
- * so _will_ cause problems with MPU401 intelligent mode).
- *
- * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be
- * sent by calling SEQ_SYSEX() several times (there must be no other events
- * between them). First sysex fragment must have 0xf0 in the first byte
- * and the last byte (buf[len-1] of the last fragment must be 0xf7. No byte
- * between these sysex start and end markers cannot be larger than 0x7f. Also
- * lengths of each fragments (except the last one) must be 6.
- *
- * Breaking the above rules may work with some MIDI ports but is likely to
- * cause fatal problems with some other devices (such as MPU401).
- */
-#define SEQ_SYSEX(dev, buf, len) \
- {int ii, ll=(len); \
- unsigned char *bufp=buf;\
- if (ll>6)ll=6;\
- _SEQ_NEEDBUF(8);\
- _seqbuf[_seqbufptr] = EV_SYSEX;\
- _seqbuf[_seqbufptr+1] = (dev);\
- for(ii=0;ii<ll;ii++)\
- _seqbuf[_seqbufptr+ii+2] = bufp[ii];\
- for(ii=ll;ii<6;ii++)\
- _seqbuf[_seqbufptr+ii+2] = 0xff;\
- _SEQ_ADVBUF(8);}
-
-#define SEQ_CHN_PRESSURE(dev, chn, pressure) \
- _CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0)
-
-#define SEQ_SET_PATCH SEQ_PGM_CHANGE
-#ifdef OSSLIB
-# define SEQ_PGM_CHANGE(dev, chn, patch) \
- {OSS_patch_caching(dev, chn, patch, seqfd, _seqbuf, _seqbuflen); \
- _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0);}
-#else
-# define SEQ_PGM_CHANGE(dev, chn, patch) \
- _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0)
-#endif
-
-#define SEQ_CONTROL(dev, chn, controller, value) \
- _CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value)
-
-#define SEQ_BENDER(dev, chn, value) \
- _CHN_COMMON(dev, MIDI_PITCH_BEND, chn, 0, 0, value)
-
-
-#define SEQ_V2_X_CONTROL(dev, voice, controller, value) {_SEQ_NEEDBUF(8);\
- _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
- _seqbuf[_seqbufptr+1] = SEQ_CONTROLLER;\
- _seqbuf[_seqbufptr+2] = (dev);\
- _seqbuf[_seqbufptr+3] = (voice);\
- _seqbuf[_seqbufptr+4] = (controller);\
- _seqbuf[_seqbufptr+5] = ((value)&0xff);\
- _seqbuf[_seqbufptr+6] = ((value>>8)&0xff);\
- _seqbuf[_seqbufptr+7] = 0;\
- _SEQ_ADVBUF(8);}
-/*
- * The following 5 macros are incorrectly implemented and obsolete.
- * Use SEQ_BENDER and SEQ_CONTROL (with proper controller) instead.
- */
-#define SEQ_PITCHBEND(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER, value)
-#define SEQ_BENDER_RANGE(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value)
-#define SEQ_EXPRESSION(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128)
-#define SEQ_MAIN_VOLUME(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100)
-#define SEQ_PANNING(dev, voice, pos) SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2)
-
-/*
- * Timing and syncronization macros
- */
-
-#define _TIMER_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\
- _seqbuf[_seqbufptr+0] = EV_TIMING; \
- _seqbuf[_seqbufptr+1] = (ev); \
- _seqbuf[_seqbufptr+2] = 0;\
- _seqbuf[_seqbufptr+3] = 0;\
- *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
- _SEQ_ADVBUF(8);}
-
-#define SEQ_START_TIMER() _TIMER_EVENT(TMR_START, 0)
-#define SEQ_STOP_TIMER() _TIMER_EVENT(TMR_STOP, 0)
-#define SEQ_CONTINUE_TIMER() _TIMER_EVENT(TMR_CONTINUE, 0)
-#define SEQ_WAIT_TIME(ticks) _TIMER_EVENT(TMR_WAIT_ABS, ticks)
-#define SEQ_DELTA_TIME(ticks) _TIMER_EVENT(TMR_WAIT_REL, ticks)
-#define SEQ_ECHO_BACK(key) _TIMER_EVENT(TMR_ECHO, key)
-#define SEQ_SET_TEMPO(value) _TIMER_EVENT(TMR_TEMPO, value)
-#define SEQ_SONGPOS(pos) _TIMER_EVENT(TMR_SPP, pos)
-#define SEQ_TIME_SIGNATURE(sig) _TIMER_EVENT(TMR_TIMESIG, sig)
-
-/*
- * Local control events
- */
-
-#define _LOCAL_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\
- _seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; \
- _seqbuf[_seqbufptr+1] = (ev); \
- _seqbuf[_seqbufptr+2] = 0;\
- _seqbuf[_seqbufptr+3] = 0;\
- *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
- _SEQ_ADVBUF(8);}
-
-#define SEQ_PLAYAUDIO(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO, devmask)
-/*
- * Events for the level 1 interface only
- */
-
-#define SEQ_MIDIOUT(device, byte) {_SEQ_NEEDBUF(4);\
- _seqbuf[_seqbufptr] = SEQ_MIDIPUTC;\
- _seqbuf[_seqbufptr+1] = (byte);\
- _seqbuf[_seqbufptr+2] = (device);\
- _seqbuf[_seqbufptr+3] = 0;\
- _SEQ_ADVBUF(4);}
-
-/*
- * Patch loading.
- */
-#ifdef OSSLIB
-# define SEQ_WRPATCH(patchx, len) \
- OSS_write_patch(seqfd, (char*)(patchx), len)
-# define SEQ_WRPATCH2(patchx, len) \
- OSS_write_patch2(seqfd, (char*)(patchx), len)
-#else
-# define SEQ_WRPATCH(patchx, len) \
- {if (_seqbufptr) SEQ_DUMPBUF();\
- if (write(seqfd, (char*)(patchx), len)==-1) \
- perror("Write patch: /dev/sequencer");}
-# define SEQ_WRPATCH2(patchx, len) \
- (SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len))
-#endif
-
-#endif
-#endif
diff --git a/winsup/cygwin/include/sys/strace.h b/winsup/cygwin/include/sys/strace.h
deleted file mode 100644
index b43ab886f..000000000
--- a/winsup/cygwin/include/sys/strace.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/* sys/strace.h
-
- Copyright 1996, 1997, 1998, 1999, 2000, 2001 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. */
-
-/* sys/strace.h */
-
-/* This file contains routines for tracing system calls and other internal
- phenomenon.
-
- When tracing system calls, try to use the same style throughout:
-
- result = syscall (arg1, arg2, arg3) [optional extra stuff]
-
- If a system call can block (eg: read, write, wait), print another message
- before hanging so the user will know why the program has stopped.
-
- Note: __seterrno will also print a trace message. Have that printed
- *first*. This will make it easy to always know what __seterrno is
- refering to. For the same reason, try not to have __seterrno messages
- printed alone.
-*/
-
-#ifndef _SYS_STRACE_H
-#define _SYS_STRACE_H
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-
-class strace
-{
- int vsprntf (char *buf, const char *func, const char *infmt, va_list ap);
- void write (unsigned category, const char *buf, int count);
-public:
- int microseconds ();
- int version;
- int active;
- int lmicrosec;
- int execing;
- int inited;
- void hello ();
- void prntf (unsigned, const char *func, const char *, ...) /*__attribute__ ((regparm(3)))*/;
- void vprntf (unsigned, const char *func, const char *, va_list ap) /*__attribute__ ((regparm(3)))*/;
- void wm (int message, int word, int lon) __attribute__ ((regparm(3)));
-};
-
-extern strace strace;
-
-#endif /* __cplusplus */
-
-#define _STRACE_INTERFACE_ACTIVATE_ADDR -1
-#define _STRACE_INTERFACE_ACTIVATE_ADDR1 -2
-
-/* Bitmasks of tracing messages to print. */
-
-#define _STRACE_ALL 0x00001 // so behaviour of strace=1 is unchanged
-#define _STRACE_FLUSH 0x00002 // flush output buffer after every message
-#define _STRACE_INHERIT 0x00004 // children inherit mask from parent
-#define _STRACE_UHOH 0x00008 // unusual or weird phenomenon
-#define _STRACE_SYSCALL 0x00010 // system calls
-#define _STRACE_STARTUP 0x00020 // argc/envp printout at startup
-#define _STRACE_DEBUG 0x00040 // info to help debugging
-#define _STRACE_PARANOID 0x00080 // paranoid info
-#define _STRACE_TERMIOS 0x00100 // info for debugging termios stuff
-#define _STRACE_SELECT 0x00200 // info on ugly select internals
-#define _STRACE_WM 0x00400 // trace windows messages (enable _strace_wm)
-#define _STRACE_SIGP 0x00800 // trace signal and process handling
-#define _STRACE_MINIMAL 0x01000 // very minimal strace output
-#define _STRACE_EXITDUMP 0x04000 // dump strace cache on exit
-#define _STRACE_SYSTEM 0x08000 // cache strace messages
-#define _STRACE_NOMUTEX 0x10000 // don't use mutex for synchronization
-#define _STRACE_MALLOC 0x20000 // trace malloc calls
-#define _STRACE_THREAD 0x40000 // thread-locking calls
-#define _STRACE_NOTALL 0x80000 // don't include if _STRACE_ALL
-#if defined (DEBUGGING)
-# define _STRACE_ON strace.active = 1;
-# define _STRACE_OFF strace.active = 0;
-#else
-# define _STRACE_ON
-# define _STRACE_OFF
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void small_printf (const char *, ...);
-void strace_printf (unsigned, const char *func, const char *, ...);
-
-#ifdef __cplusplus
-}
-#endif
-
-#ifdef __cplusplus
-
-#ifdef NOSTRACE
-#define define_strace(c, f)
-#define define_strace1(c, f)
-#else
-#ifdef NEW_MACRO_VARARGS
-/* Output message to strace log */
-
-#define define_strace0(c,...) \
- do { \
- if ((c & _STRACE_SYSTEM) || strace.active) \
- strace.prntf (c, __PRETTY_FUNCTION__, __VA_ARGS__); \
- } \
- while (0)
-
-#define define_strace(c, ...) define_strace0 (_STRACE_ ## c, __VA_ARGS__)
-#define define_strace1(c, ...) define_strace0 ((_STRACE_ ## c | _STRACE_NOTALL), __VA_ARGS__)
-
-#define debug_printf(...) define_strace (DEBUG, __VA_ARGS__)
-#define paranoid_printf(...) define_strace (PARANOID, __VA_ARGS__)
-#define select_printf(...) define_strace (SELECT, __VA_ARGS__)
-#define sigproc_printf(...) define_strace (SIGP, __VA_ARGS__)
-#define syscall_printf(...) define_strace (SYSCALL, __VA_ARGS__)
-#define system_printf(...) define_strace (SYSTEM, __VA_ARGS__)
-#define termios_printf(...) define_strace (TERMIOS, __VA_ARGS__)
-#define wm_printf(...) define_strace (WM, __VA_ARGS__)
-#define minimal_printf(...) define_strace1 (MINIMAL, __VA_ARGS__)
-#define malloc_printf(...) define_strace1 (MALLOC, __VA_ARGS__)
-#define thread_printf(...) define_strace1 (THREAD, __VA_ARGS__)
-#else
-#define strace_printf_wrap(what, fmt, args...) \
- ((void) ({\
- if ((_STRACE_ ## what & _STRACE_SYSTEM) || strace.active) \
- strace.prntf(_STRACE_ ## what, __PRETTY_FUNCTION__, fmt, ## args); \
- 0; \
- }))
-#define strace_printf_wrap1(what, fmt, args...) \
- ((void) ({\
- if ((_STRACE_ ## what & _STRACE_SYSTEM) || strace.active) \
- strace.prntf((_STRACE_ ## what) | _STRACE_NOTALL, __PRETTY_FUNCTION__, fmt, ## args); \
- 0; \
- }))
-
-#define debug_printf(fmt, args...) strace_printf_wrap(DEBUG, fmt , ## args)
-#define paranoid_printf(fmt, args...) strace_printf_wrap(PARANOID, fmt , ## args)
-#define select_printf(fmt, args...) strace_printf_wrap(SELECT, fmt , ## args)
-#define sigproc_printf(fmt, args...) strace_printf_wrap(SIGP, fmt , ## args)
-#define syscall_printf(fmt, args...) strace_printf_wrap(SYSCALL, fmt , ## args)
-#define system_printf(fmt, args...) strace_printf_wrap(SYSTEM, fmt , ## args)
-#define termios_printf(fmt, args...) strace_printf_wrap(TERMIOS, fmt , ## args)
-#define wm_printf(fmt, args...) strace_printf_wrap(WM, fmt , ## args)
-#define minimal_printf(fmt, args...) strace_printf_wrap1(MINIMAL, fmt , ## args)
-#define malloc_printf(fmt, args...) strace_printf_wrap1(MALLOC, fmt , ## args)
-#define thread_printf(fmt, args...) strace_printf_wrap1(THREAD, fmt , ## args)
-#endif /*NEW_MACRO_VARARGS*/
-#endif /*NOSTRACE*/
-#endif /* __cplusplus */
-#endif /* _SYS_STRACE_H */
diff --git a/winsup/cygwin/include/sys/syslog.h b/winsup/cygwin/include/sys/syslog.h
deleted file mode 100644
index f3195175e..000000000
--- a/winsup/cygwin/include/sys/syslog.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* sys/syslog.h
-
- Copyright 1996, 1998, 2001 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 _SYS_LOG_H
-#define _SYS_LOG_H
-
-#include <sys/cdefs.h>
-#define LOG_EMERG 0
-#define LOG_ALERT 1
-#define LOG_CRIT 2
-#define LOG_ERR 3
-#define LOG_WARNING 4
-#define LOG_NOTICE 5
-#define LOG_INFO 6
-#define LOG_DEBUG 7
-
-#define LOG_PRIMASK 0x07
-
-#define LOG_PRI(p) ((p) & LOG_PRIMASK)
-#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri))
-
-#define LOG_KERN (0<<3)
-#define LOG_USER (1<<3)
-#define LOG_MAIL (2<<3)
-#define LOG_DAEMON (3<<3)
-#define LOG_AUTH (4<<3)
-#define LOG_SYSLOG (5<<3)
-#define LOG_LPR (6<<3)
-#define LOG_NEWS (7<<3)
-#define LOG_UUCP (8<<3)
-#define LOG_CRON (9<<3)
-#define LOG_AUTHPRIV (10<<3)
-#define LOG_FTP (11<<3)
-
-/* Codes through 15 are reserved for system use */
-#define LOG_LOCAL0 (16<<3)
-#define LOG_LOCAL1 (17<<3)
-#define LOG_LOCAL2 (18<<3)
-#define LOG_LOCAL3 (19<<3)
-#define LOG_LOCAL4 (20<<3)
-#define LOG_LOCAL5 (21<<3)
-#define LOG_LOCAL6 (22<<3)
-#define LOG_LOCAL7 (23<<3)
-
-#define LOG_NFACILITIES 24
-#define LOG_FACMASK 0x03f8
-#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
-
-#define LOG_MASK(pri) (1 << (pri))
-#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1)
-
-/*
- * Option flags for openlog.
- *
- * LOG_ODELAY no longer does anything.
- * LOG_NDELAY is the inverse of what it used to be.
- */
-#define LOG_PID 0x01 /* log the pid with each message */
-#define LOG_CONS 0x02 /* log on the console if errors in sending */
-#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */
-#define LOG_NDELAY 0x08 /* don't delay open */
-#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */
-#define LOG_PERROR 0x20 /* log to stderr as well */
-
-__BEGIN_DECLS
-
-
-void closelog (void);
-void openlog (const char *, int, int);
-int setlogmask (int);
-void syslog (int, const char *, ...);
-
-__END_DECLS
-
-
-#endif /* _SYS_LOG_H */
diff --git a/winsup/cygwin/include/sys/sysmacros.h b/winsup/cygwin/include/sys/sysmacros.h
deleted file mode 100644
index 2c9c69923..000000000
--- a/winsup/cygwin/include/sys/sysmacros.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* sys/sysmacros.h
-
- Copyright 1998, 2001 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 _SYS_SYSMACROS_H
-#define _SYS_SYSMACROS_H
-
-#ifdef __CYGWIN_USE_BIG_TYPES__
-#define major(dev) ((int)(((dev) >> 16) & 0xffff))
-#define minor(dev) ((int)((dev) & 0xffff))
-#define makedev(major, minor) (((major) << 16) | ((minor) & 0xffff))
-#else
-#define major(dev) ((int)(((dev) >> 8) & 0xff))
-#define minor(dev) ((int)((dev) & 0xff))
-#define makedev(major, minor) (((major) << 8) | ((minor) & 0xff))
-#endif
-
-#endif /* _SYS_SYSMACROS_H */
diff --git a/winsup/cygwin/include/sys/termio.h b/winsup/cygwin/include/sys/termio.h
deleted file mode 100644
index 87f2eb461..000000000
--- a/winsup/cygwin/include/sys/termio.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* sys/termio.h
-
- Copyright 2001 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 <sys/termios.h>
-
diff --git a/winsup/cygwin/include/sys/termios.h b/winsup/cygwin/include/sys/termios.h
deleted file mode 100644
index c37776111..000000000
--- a/winsup/cygwin/include/sys/termios.h
+++ /dev/null
@@ -1,313 +0,0 @@
-/* sys/termios.h
-
- Copyright 1997, 1998, 1999, 2000, 2001 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. */
-
-/* sys/termios.h */
-
-#ifndef _SYS_TERMIOS_H
-#define _SYS_TERMIOS_H
-
-#define TCOOFF 0
-#define TCOON 1
-#define TCIOFF 2
-#define TCION 3
-
-#define TCGETA 5
-#define TCSETA 6
-#define TCSETAW 7
-#define TCSETAF 8
-
-#define TCIFLUSH 0
-#define TCOFLUSH 1
-#define TCIOFLUSH 2
-#define TCFLSH 3
-
-#define TCSAFLUSH 1
-#define TCSANOW 2
-#define TCSADRAIN 3
-#define TCSADFLUSH 4
-
-#define TIOCPKT 6
-
-#define TIOCPKT_DATA 0
-#define TIOCPKT_FLUSHREAD 1
-#define TIOCPKT_FLUSHWRITE 2
-#define TIOCPKT_STOP 4
-#define TIOCPKT_START 8
-#define TIOCPKT_NOSTOP 16
-#define TIOCPKT_DOSTOP 32
-
-#define FIONBIO 0x8004667e /* To be compatible with socket version */
-
-#define CTRL(ch) ((ch)&0x1F)
-
-#define CNUL 0
-#define CDEL 0x0007f
-#define CESC '\\'
-#define CINTR CTRL('C')
-#define CQUIT 0x0001c
-#define CERASE CTRL('H')
-#define CKILL CTRL('U')
-#define CEOT CTRL('D')
-#define CEOL 0
-#define CEOL2 0
-#define CEOF CTRL('D')
-#define CSTART CTRL('Q')
-#define CSTOP CTRL('S')
-#define CSWTCH 0x0001a
-#define NSWTCH 0
-#define CSUSP CTRL('Z')
-#define CDSUSP CTRL('Y')
-#define CRPRNT CTRL('R')
-#define CFLUSH CTRL('O')
-#define CWERASE CTRL('W')
-#define CLNEXT CTRL('V')
-
-/* iflag bits */
-#define IGNBRK 0x00001
-#define BRKINT 0x00002
-#define IGNPAR 0x00004
-#define IMAXBEL 0x00008
-#define INPCK 0x00010
-#define ISTRIP 0x00020
-#define INLCR 0x00040
-#define IGNCR 0x00080
-#define ICRNL 0x00100
-#define IXON 0x00400
-#define IXOFF 0x01000
-#define IUCLC 0x04000
-#define IXANY 0x08000
-#define PARMRK 0x10000
-
-/* oflag bits */
-
-#define OPOST 0x00001
-#define OLCUC 0x00002
-#define OCRNL 0x00004
-#define ONLCR 0x00008
-#define ONOCR 0x00010
-#define ONLRET 0x00020
-#define OFILL 0x00040
-#define CRDLY 0x00180
-#define CR0 0x00000
-#define CR1 0x00080
-#define CR2 0x00100
-#define CR3 0x00180
-#define NLDLY 0x00200
-#define NL0 0x00000
-#define NL1 0x00200
-#define BSDLY 0x00400
-#define BS0 0x00000
-#define BS1 0x00400
-#define TABDLY 0x01800
-#define TAB0 0x00000
-#define TAB1 0x00800
-#define TAB2 0x01000
-#define TAB3 0x01800
-#define XTABS 0x01800
-#define VTDLY 0x02000
-#define VT0 0x00000
-#define VT1 0x02000
-#define FFDLY 0x04000
-#define FF0 0x00000
-#define FF1 0x04000
-#define OFDEL 0x08000
-
-/* cflag bits */
-
-/* Baud rate values. These must fit in speed_t, which is unsigned
- char. See also the extended baud rates below. These baud rates
- set an additional bit. */
-#define CBAUD 0x0100f
-#define B0 0x00000
-#define B50 0x00001
-#define B75 0x00002
-#define B110 0x00003
-#define B134 0x00004
-#define B150 0x00005
-#define B200 0x00006
-#define B300 0x00007
-#define B600 0x00008
-#define B1200 0x00009
-#define B1800 0x0000a
-#define B2400 0x0000b
-#define B4800 0x0000c
-#define B9600 0x0000d
-#define B19200 0x0000e
-#define B38400 0x0000f
-
-#define CSIZE 0x00030
-#define CS5 0x00000
-#define CS6 0x00010
-#define CS7 0x00020
-#define CS8 0x00030
-#define CSTOPB 0x00040
-#define CREAD 0x00080
-#define PARENB 0x00100
-#define PARODD 0x00200
-#define HUPCL 0x00400
-#define CLOCAL 0x00800
-#define CBAUDEX 0x0100f
-#define B57600 0x01001
-#define B115200 0x01002
-#define B128000 0x01003
-#define B256000 0x01003
-#define CRTSXOFF 0x04000
-#define CRTSCTS 0x08000
-
-/* lflag bits */
-#define ISIG 0x0001
-#define ICANON 0x0002
-#define ECHO 0x0004
-#define ECHOE 0x0008
-#define ECHOK 0x0010
-#define ECHONL 0x0020
-#define NOFLSH 0x0040
-#define TOSTOP 0x0080
-#define IEXTEN 0x0100
-#define FLUSHO 0x0200
-#define ECHOKE 0x0400
-#define ECHOCTL 0x0800
-
-#define VDISCARD 1
-#define VEOL 2
-#define VEOL2 3
-#define VEOF 4
-#define VERASE 5
-#define VINTR 6
-#define VKILL 7
-#define VLNEXT 8
-#define VMIN 9
-#define VQUIT 10
-#define VREPRINT 11
-#define VSTART 12
-#define VSTOP 13
-#define VSUSP 14
-#define VSWTC 15
-#define VTIME 16
-#define VWERASE 17
-
-#define NCCS 18
-
-/* `c_cc' member of 'struct termios' structure can be disabled by
- using the value _POSIX_VDISABLE. */
-#define _POSIX_VDISABLE '\0'
-
-/* Compare a character C to a value VAL from the `c_cc' array in a
- `struct termios'. If VAL is _POSIX_VDISABLE, no character can match it. */
-#define CCEQ(val, c) ((c) == (val) && (val) != _POSIX_VDISABLE)
-
-typedef unsigned char cc_t;
-typedef unsigned int tcflag_t;
-typedef unsigned int speed_t;
-typedef unsigned short otcflag_t;
-typedef unsigned char ospeed_t;
-
-struct __oldtermios {
- otcflag_t c_iflag;
- otcflag_t c_oflag;
- otcflag_t c_cflag;
- otcflag_t c_lflag;
- char c_line;
- cc_t c_cc[NCCS];
- ospeed_t c_ispeed;
- ospeed_t c_ospeed;
-};
-
-struct termios {
- tcflag_t c_iflag;
- tcflag_t c_oflag;
- tcflag_t c_cflag;
- tcflag_t c_lflag;
- char c_line;
- cc_t c_cc[NCCS];
- speed_t c_ispeed;
- speed_t c_ospeed;
-};
-
-#ifdef CYGWIN_VERSION_DLL_IS_OLD_TERMIOS
-#ifdef __GNUC__
-# define __tonew_termios(ti) \
- ({ \
- struct termios *__newti; \
- \
- if (!CYGWIN_VERSION_DLL_IS_OLD_TERMIOS) \
- __newti = (struct termios *) ti; \
- else \
- { \
- __newti = (struct termios *) alloca(sizeof(struct termios)); \
- __newti->c_iflag = ((struct __oldtermios *)ti)->c_iflag; \
- __newti->c_oflag = ((struct __oldtermios *)ti)->c_oflag; \
- __newti->c_cflag = ((struct __oldtermios *)ti)->c_cflag; \
- __newti->c_lflag = ((struct __oldtermios *)ti)->c_lflag; \
- __newti->c_line = ((struct __oldtermios *)ti)->c_line; \
- __newti->c_ispeed = ((struct __oldtermios *)ti)->c_ispeed; \
- __newti->c_ospeed = ((struct __oldtermios *)ti)->c_ospeed; \
- memcpy (__newti->c_cc, ((struct __oldtermios *)ti)->c_cc, sizeof(__newti->c_cc)); \
- } \
- __newti; \
- })
-
-# define __makenew_termios(ti) \
- (CYGWIN_VERSION_DLL_IS_OLD_TERMIOS ? \
- (struct termios *) alloca (sizeof (struct termios)) : (ti))
-
-# define __toapp_termios(toti, fromti) \
- ({ \
- if (!CYGWIN_VERSION_DLL_IS_OLD_TERMIOS) \
- toti = fromti; \
- else \
- { \
- ((struct __oldtermios *)toti)->c_iflag = fromti->c_iflag; \
- ((struct __oldtermios *)toti)->c_oflag = fromti->c_oflag; \
- ((struct __oldtermios *)toti)->c_cflag = fromti->c_cflag; \
- ((struct __oldtermios *)toti)->c_lflag = fromti->c_lflag; \
- ((struct __oldtermios *)toti)->c_line = fromti->c_line; \
- ((struct __oldtermios *)toti)->c_ispeed = fromti->c_ispeed; \
- ((struct __oldtermios *)toti)->c_ospeed = fromti->c_ospeed; \
- memcpy (((struct __oldtermios*)toti)->c_cc, fromti->c_cc, sizeof(fromti->c_cc)); \
- } \
- toti; \
- })
-#endif /*__GNUC__*/
-#endif
-
-#define termio termios
-
-#define cfgetospeed(tp) ((tp)->c_ospeed)
-#define cfgetispeed(tp) ((tp)->c_ispeed)
-#define cfsetospeed(tp,s) (((tp)->c_ospeed = (s)), 0)
-#define cfsetispeed(tp,s) (((tp)->c_ispeed = (s)), 0)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int tcgetattr (int, struct termios *);
-int tcsetattr (int, int, const struct termios *);
-int tcsendbreak (int, int);
-int tcdrain (int);
-int tcflush (int, int);
-int tcflow (int, int);
-
-#ifdef __cplusplus
-}
-#endif
-
-/* Extra stuff to make porting stuff easier. */
-struct winsize
-{
- unsigned short ws_row, ws_col;
- unsigned short ws_xpixel, ws_ypixel;
-};
-
-#define TIOCGWINSZ (('T' << 8) | 1)
-#define TIOCSWINSZ (('T' << 8) | 2)
-
-#endif /* _SYS_TERMIOS_H */
diff --git a/winsup/cygwin/include/sys/ttychars.h b/winsup/cygwin/include/sys/ttychars.h
deleted file mode 100644
index 2d313646f..000000000
--- a/winsup/cygwin/include/sys/ttychars.h
+++ /dev/null
@@ -1 +0,0 @@
-/* ttychars.h */
diff --git a/winsup/cygwin/include/sys/uio.h b/winsup/cygwin/include/sys/uio.h
deleted file mode 100644
index d355ac5b6..000000000
--- a/winsup/cygwin/include/sys/uio.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* sys/uio.h
-
- Copyright 1996, 2000, 2001 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 _UIO_H_
-#define _UIO_H_
-
-/* For size_t */
-#include <stddef.h>
-/* For ssize_t */
-#include <sys/types.h>
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-
-/*
- * Define the uio buffers used for writev, readv.
- */
-
-struct iovec {
- caddr_t iov_base;
- int iov_len;
-};
-
-extern ssize_t readv __P ((int filedes, const struct iovec *vector, int count));
-extern ssize_t writev __P ((int filedes, const struct iovec *vector, int count));
-
-__END_DECLS
-
-#endif /* _UIO_H_ */
diff --git a/winsup/cygwin/include/sys/un.h b/winsup/cygwin/include/sys/un.h
deleted file mode 100644
index 4e3eee82b..000000000
--- a/winsup/cygwin/include/sys/un.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* sys/un.h
-
- Copyright 1999, 2001 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 _SYS_UN_H
-#define _SYS_UN_H
-
-/* POSIX requires only at least 100 bytes */
-#define UNIX_PATH_LEN 108
-
-struct sockaddr_un {
- unsigned short sun_family; /* address family AF_LOCAL/AF_UNIX */
- char sun_path[UNIX_PATH_LEN]; /* 108 bytes of socket address */
-};
-
-/* Evaluates the actual length of `sockaddr_un' structure. */
-#define SUN_LEN(p) ((size_t)(((struct sockaddr_un *) NULL)->sun_path) \
- + strlen ((p)->sun_path))
-
-#endif
diff --git a/winsup/cygwin/include/sys/utsname.h b/winsup/cygwin/include/sys/utsname.h
deleted file mode 100644
index bb770c0f1..000000000
--- a/winsup/cygwin/include/sys/utsname.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* sys/utsname.h
-
- Copyright 2001 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 _SYS_UTSNAME_H
-#define _SYS_UTSNAME_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct utsname
-{
- char sysname[20];
- char nodename[20];
- char release[20];
- char version[20];
- char machine[20];
-};
-
-int uname (struct utsname *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/winsup/cygwin/include/sys/vfs.h b/winsup/cygwin/include/sys/vfs.h
deleted file mode 100644
index 57b6f9232..000000000
--- a/winsup/cygwin/include/sys/vfs.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* sys/vfs.h
-
- Copyright 1997, 1998, 2001 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 _SYS_VFS_H_
-#define _SYS_VFS_H_
-
-struct statfs {
- long f_type; /* type of filesystem */
- long f_bsize; /* optimal transfer block size */
- long f_blocks; /* total data blocks in file system */
- long f_bfree; /* free blocks in fs */
- long f_bavail; /* free blocks avail to non-superuser */
- long f_files; /* total file nodes in file system */
- long f_ffree; /* free file nodes in fs */
- long f_fsid; /* file system id */
- long f_namelen; /* maximum length of filenames */
- long f_spare[6]; /* spare for later */
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-int statfs (const char *__path, struct statfs *__buf);
-int fstatfs (int __fd, struct statfs *__buf);
-
-#ifdef __cplusplus
-};
-#endif /* __cplusplus */
-
-#endif /*_SYS_VFS_H_*/
diff --git a/winsup/cygwin/include/sys/wait.h b/winsup/cygwin/include/sys/wait.h
deleted file mode 100644
index 9dd8bf7dc..000000000
--- a/winsup/cygwin/include/sys/wait.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* sys/wait.h
-
- Copyright 1997, 1998, 2001 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 _SYS_WAIT_H
-#define _SYS_WAIT_H
-
-#include <sys/types.h>
-#include <sys/resource.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define WNOHANG 1
-#define WUNTRACED 2
-
-/* A status looks like:
- <2 bytes info> <2 bytes code>
-
- <code> == 0, child has exited, info is the exit value
- <code> == 1..7e, child has exited, info is the signal number.
- <code> == 7f, child has stopped, info was the signal number.
- <code> == 80, there was a core dump.
-*/
-
-#define WIFEXITED(w) (((w) & 0xff) == 0)
-#define WIFSIGNALED(w) (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f))
-#define WIFSTOPPED(w) (((w) & 0xff) == 0x7f)
-#define WEXITSTATUS(w) (((w) >> 8) & 0xff)
-#define WTERMSIG(w) ((w) & 0x7f)
-#define WSTOPSIG WEXITSTATUS
-
-pid_t wait (int *);
-pid_t waitpid (pid_t, int *, int);
-pid_t wait3 (int *__status, int __options, struct rusage *__rusage);
-pid_t wait4 (pid_t __pid, int *__status, int __options, struct rusage *__rusage);
-
-union wait
- {
- int w_status;
- struct
- {
- unsigned int __w_termsig:7; /* Terminating signal. */
- unsigned int __w_coredump:1; /* Set if dumped core. */
- unsigned int __w_retcode:8; /* Return code if exited normally. */
- unsigned int:16;
- } __wait_terminated;
- struct
- {
- unsigned int __w_stopval:8; /* W_STOPPED if stopped. */
- unsigned int __w_stopsig:8; /* Stopping signal. */
- unsigned int:16;
- } __wait_stopped;
- };
-
-#define w_termsig __wait_terminated.__w_termsig
-#define w_coredump __wait_terminated.__w_coredump
-#define w_retcode __wait_terminated.__w_retcode
-#define w_stopsig __wait_stopped.__w_stopsig
-#define w_stopval __wait_stopped.__w_stopval
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif
diff --git a/winsup/cygwin/include/sysexits.h b/winsup/cygwin/include/sysexits.h
deleted file mode 100644
index eba0b92dd..000000000
--- a/winsup/cygwin/include/sysexits.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)sysexits.h 8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _SYSEXITS_H_
-#define _SYSEXITS_H_
-
-/*
- * SYSEXITS.H -- Exit status codes for system programs.
- *
- * This include file attempts to categorize possible error
- * exit statuses for system programs, notably delivermail
- * and the Berkeley network.
- *
- * Error numbers begin at EX__BASE to reduce the possibility of
- * clashing with other exit statuses that random programs may
- * already return. The meaning of the codes is approximately
- * as follows:
- *
- * EX_USAGE -- The command was used incorrectly, e.g., with
- * the wrong number of arguments, a bad flag, a bad
- * syntax in a parameter, or whatever.
- * EX_DATAERR -- The input data was incorrect in some way.
- * This should only be used for user's data & not
- * system files.
- * EX_NOINPUT -- An input file (not a system file) did not
- * exist or was not readable. This could also include
- * errors like "No message" to a mailer (if it cared
- * to catch it).
- * EX_NOUSER -- The user specified did not exist. This might
- * be used for mail addresses or remote logins.
- * EX_NOHOST -- The host specified did not exist. This is used
- * in mail addresses or network requests.
- * EX_UNAVAILABLE -- A service is unavailable. This can occur
- * if a support program or file does not exist. This
- * can also be used as a catchall message when something
- * you wanted to do doesn't work, but you don't know
- * why.
- * EX_SOFTWARE -- An internal software error has been detected.
- * This should be limited to non-operating system related
- * errors as possible.
- * EX_OSERR -- An operating system error has been detected.
- * This is intended to be used for such things as "cannot
- * fork", "cannot create pipe", or the like. It includes
- * things like getuid returning a user that does not
- * exist in the passwd file.
- * EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp,
- * etc.) does not exist, cannot be opened, or has some
- * sort of error (e.g., syntax error).
- * EX_CANTCREAT -- A (user specified) output file cannot be
- * created.
- * EX_IOERR -- An error occurred while doing I/O on some file.
- * EX_TEMPFAIL -- temporary failure, indicating something that
- * is not really an error. In sendmail, this means
- * that a mailer (e.g.) could not create a connection,
- * and the request should be reattempted later.
- * EX_PROTOCOL -- the remote system returned something that
- * was "not possible" during a protocol exchange.
- * EX_NOPERM -- You did not have sufficient permission to
- * perform the operation. This is not intended for
- * file system problems, which should use NOINPUT or
- * CANTCREAT, but rather for higher level permissions.
- */
-
-#define EX_OK 0 /* successful termination */
-
-#define EX__BASE 64 /* base value for error messages */
-
-#define EX_USAGE 64 /* command line usage error */
-#define EX_DATAERR 65 /* data format error */
-#define EX_NOINPUT 66 /* cannot open input */
-#define EX_NOUSER 67 /* addressee unknown */
-#define EX_NOHOST 68 /* host name unknown */
-#define EX_UNAVAILABLE 69 /* service unavailable */
-#define EX_SOFTWARE 70 /* internal software error */
-#define EX_OSERR 71 /* system error (e.g., can't fork) */
-#define EX_OSFILE 72 /* critical OS file missing */
-#define EX_CANTCREAT 73 /* can't create (user) output file */
-#define EX_IOERR 74 /* input/output error */
-#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */
-#define EX_PROTOCOL 76 /* remote error in protocol */
-#define EX_NOPERM 77 /* permission denied */
-#define EX_CONFIG 78 /* configuration error */
-
-#define EX__MAX 78 /* maximum listed value */
-
-#endif /* !_SYSEXITS_H_ */
diff --git a/winsup/cygwin/include/syslog.h b/winsup/cygwin/include/syslog.h
deleted file mode 100644
index 5721ca5e4..000000000
--- a/winsup/cygwin/include/syslog.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* syslog.h
-
- Copyright 1996, 1998, 2001 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 _SYSLOG_H
-#define _SYSLOG_H
-
-#include <sys/syslog.h>
-
-#endif /* _SYSLOG_H */
diff --git a/winsup/cygwin/include/termio.h b/winsup/cygwin/include/termio.h
deleted file mode 100644
index ba7b3b10b..000000000
--- a/winsup/cygwin/include/termio.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* termio.h
-
- Copyright 2001 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 _TERMIO_H
-#define _TERMIO_H
-
-#include <sys/termio.h>
-
-#endif
diff --git a/winsup/cygwin/include/tzfile.h b/winsup/cygwin/include/tzfile.h
deleted file mode 100644
index 4d3e11cb9..000000000
--- a/winsup/cygwin/include/tzfile.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* tzfile.h
-
- Copyright 2001 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 _TZFILE_H
-#define _TZFILE_H
-
-#define SECSPERDAY (60*60*24)
-#define DAYSPERNYEAR 365
-#define DAYSPERLYEAR 366
-
-#define isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0)
-#endif
diff --git a/winsup/cygwin/include/wchar.h b/winsup/cygwin/include/wchar.h
deleted file mode 100644
index bf3f017a2..000000000
--- a/winsup/cygwin/include/wchar.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* wchar.h
-
- Copyright 1998, 1999, 2000, 2001 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 _WCHAR_H
-#define _WCHAR_H
-
-#include <sys/cdefs.h>
-
-/* Get wchar_t and wint_t from <stddef.h>. */
-#define __need_wchar_t
-#define __need_wint_t
-#define __need_size_t
-#include <stddef.h>
-
-__BEGIN_DECLS
-
-int wcscmp (const wchar_t *__s1, const wchar_t *__s2);
-size_t wcslen (const wchar_t *__s1);
-
-__END_DECLS
-
-#endif /* _WCHAR_H */
diff --git a/winsup/cygwin/init.cc b/winsup/cygwin/init.cc
deleted file mode 100644
index 525ec29b1..000000000
--- a/winsup/cygwin/init.cc
+++ /dev/null
@@ -1,54 +0,0 @@
-/* init.cc
-
- Copyright 1996, 1997, 1998, 1999, 2000, 2001 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 "winsup.h"
-#include <stdlib.h>
-#include "thread.h"
-#include "perprocess.h"
-
-int NO_COPY dynamically_loaded;
-
-extern "C" int
-WINAPI dll_entry (HANDLE h, DWORD reason, void *static_load)
-{
- switch (reason)
- {
- case DLL_PROCESS_ATTACH:
- cygwin_hmodule = (HMODULE) h;
- dynamically_loaded = (static_load == NULL);
- break;
- case DLL_THREAD_ATTACH:
- if (user_data->threadinterface)
- {
- if (!TlsSetValue(user_data->threadinterface->reent_index,
- &user_data->threadinterface->reents))
- api_fatal("Sig proc MT init failed\n");
- }
- break;
- case DLL_PROCESS_DETACH:
- break;
- case DLL_THREAD_DETACH:
-#if 0 // FIXME: REINSTATE SOON
- waitq *w;
- if ((w = waitq_storage.get ()) != NULL)
- {
- if (w->thread_ev != NULL)
- {
- system_printf ("closing %p", w->thread_ev);
- (void) CloseHandle (w->thread_ev);
- }
- memset (w, 0, sizeof(*w)); // FIXME: memory leak
- }
- // FIXME: Need to add other per_thread stuff here
-#endif
- break;
- }
- return 1;
-}
diff --git a/winsup/cygwin/ioctl.cc b/winsup/cygwin/ioctl.cc
deleted file mode 100644
index 2f96e8508..000000000
--- a/winsup/cygwin/ioctl.cc
+++ /dev/null
@@ -1,53 +0,0 @@
-/* ioctl.cc: ioctl routines.
-
- Copyright 1996, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-
- Written by Doug Evans of Cygnus Support
- dje@cygnus.com
-
-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 "winsup.h"
-#include <sys/ioctl.h>
-#include <errno.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygheap.h"
-#include <sys/termios.h>
-
-extern "C" int
-ioctl (int fd, int cmd, ...)
-{
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- return -1;
-
- /* check for optional mode argument */
- va_list ap;
- va_start (ap, cmd);
- char *argp = va_arg (ap, char *);
- va_end (ap);
-
- debug_printf ("fd %d, cmd %x\n", fd, cmd);
- if (cfd->is_tty () && cfd->get_device () != FH_PTYM)
- switch (cmd)
- {
- case TCGETA:
- return tcgetattr (fd, (struct termios *) argp);
- case TCSETA:
- return tcsetattr (fd, TCSANOW, (struct termios *) argp);
- case TCSETAW:
- return tcsetattr (fd, TCSADRAIN, (struct termios *) argp);
- case TCSETAF:
- return tcsetattr (fd, TCSAFLUSH, (struct termios *) argp);
- }
-
- return cfd->ioctl (cmd, argp);
-}
diff --git a/winsup/cygwin/ipc.cc b/winsup/cygwin/ipc.cc
deleted file mode 100644
index 1f496d328..000000000
--- a/winsup/cygwin/ipc.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-/* ipc.cc: Single unix specification IPC interface for Cygwin
-
- Copyright 2001, 2002 Red Hat, Inc.
-
- Originally written by Robert Collins <robert.collins@hotmail.com>
-
- 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 "winsup.h"
-#include <sys/ipc.h>
-#include <sys/stat.h>
-
-extern "C"
-{
-
-/* Notes: we return a valid key even if id's low order 8 bits are 0. */
-key_t
-ftok(const char *path, int id)
-{
- struct stat statbuf;
- if (stat(path, &statbuf))
- {
- /* stat set the appropriate errno for us */
- return (key_t) -1;
- }
-
- /* dev_t is short for cygwin
- * ino_t is long for cygwin
- * and we need 8 bits for the id.
- * thus key_t is long long.
- */
- return ((long long) statbuf.st_dev << (5*8)) | (statbuf.st_ino << (8) ) | (id & 0x00ff);
-}
-
-}
diff --git a/winsup/cygwin/lib/_cygwin_S_IEXEC.cc b/winsup/cygwin/lib/_cygwin_S_IEXEC.cc
deleted file mode 100644
index 371126073..000000000
--- a/winsup/cygwin/lib/_cygwin_S_IEXEC.cc
+++ /dev/null
@@ -1,21 +0,0 @@
-/* _cygwin_S_IEXEC.cc: stat helper stuff
-
- Copyright 2001 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. */
-
-extern "C" {
-#include "winsup.h"
-#include <sys/stat.h>
-#include <sys/unistd.h>
-
-unsigned _cygwin_S_IEXEC = S_IEXEC;
-unsigned _cygwin_S_IXUSR = S_IXUSR;
-unsigned _cygwin_S_IXGRP = S_IXGRP;
-unsigned _cygwin_S_IXOTH = S_IXOTH;
-unsigned _cygwin_X_OK = X_OK;
-};
diff --git a/winsup/cygwin/lib/_cygwin_crt0_common.cc b/winsup/cygwin/lib/_cygwin_crt0_common.cc
deleted file mode 100644
index e0a3e6052..000000000
--- a/winsup/cygwin/lib/_cygwin_crt0_common.cc
+++ /dev/null
@@ -1,99 +0,0 @@
-/* common.cc: common crt0 function for cygwin crt0's.
-
- Copyright 2000, 2001 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 "winsup.h"
-#include "perprocess.h"
-#include "cygwin/version.h"
-#include "crt0.h"
-#include <reent.h>
-#include <stdlib.h>
-
-#undef environ
-
-extern "C"
-{
-char **environ;
-void cygwin_crt0 (MainFunc);
-int cygwin_attach_dll (HMODULE, MainFunc);
-int cygwin_attach_noncygwin_dll (HMODULE, MainFunc);
-int main (int, char **, char **);
-struct _reent *_impure_ptr;
-int _fmode;
-
-/* Set up pointers to various pieces so the dll can then use them,
- and then jump to the dll. */
-
-int __stdcall
-_cygwin_crt0_common (MainFunc f, per_process *u)
-{
- /* This is used to record what the initial sp was. The value is needed
- when copying the parent's stack to the child during a fork. */
- DWORD newu;
- int uwasnull;
-
- if (u != NULL)
- uwasnull = 0; /* Caller allocated space for per_process structure */
- else if ((newu = cygwin_internal (CW_USER_DATA)) == (DWORD) -1)
- return 0;
- else
- {
- u = (per_process *) newu; /* Using DLL built-in per_process */
- uwasnull = 1; /* Remember for later */
- }
-
- /* The version numbers are the main source of compatibility checking.
- As a backup to them, we use the size of the per_process struct. */
- u->magic_biscuit = sizeof (per_process);
-
- /* cygwin.dll version number in effect at the time the app was created. */
- u->dll_major = CYGWIN_VERSION_DLL_MAJOR;
- u->dll_minor = CYGWIN_VERSION_DLL_MINOR;
- u->api_major = CYGWIN_VERSION_API_MAJOR;
- u->api_minor = CYGWIN_VERSION_API_MINOR;
-
- u->ctors = &__CTOR_LIST__;
- u->dtors = &__DTOR_LIST__;
- u->envptr = &environ;
- if (uwasnull)
- _impure_ptr = u->impure_ptr; /* Use field initialized in newer DLLs. */
- else
- u->impure_ptr_ptr = &_impure_ptr; /* Older DLLs need this. */
-
- u->forkee = 0; /* This should only be set in dcrt0.cc
- when the process is actually forked */
- u->main = f;
-
- /* These functions are executed prior to main. They are just stubs unless the
- user overrides them. */
- u->premain[0] = cygwin_premain0;
- u->premain[1] = cygwin_premain1;
- u->premain[2] = cygwin_premain2;
- u->premain[3] = cygwin_premain3;
- u->fmode_ptr = &_fmode;
- u->initial_sp = (char *) __builtin_frame_address (1);
-
- /* Remember whatever the user linked his application with - or
- point to entries in the dll. */
- u->malloc = &malloc;
- u->free = &free;
- u->realloc = &realloc;
- u->calloc = &calloc;
-
- /* Setup the module handle so fork can get the path name. */
- u->hmodule = GetModuleHandle (0);
-
- /* variables for fork */
- u->data_start = &_data_start__;
- u->data_end = &_data_end__;
- u->bss_start = &_bss_start__;
- u->bss_end = &_bss_end__;
- return 1;
-}
-} /* "C" */
diff --git a/winsup/cygwin/lib/crt0.h b/winsup/cygwin/lib/crt0.h
deleted file mode 100644
index 7bd240622..000000000
--- a/winsup/cygwin/lib/crt0.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* crt0.h: header file for crt0.
-
- Copyright 2000, 2001 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 __cplusplus
-extern "C" {
-#endif
-
-struct per_process;
-typedef int (*MainFunc) (int argc, char *argv[], char **env);
-int __stdcall _cygwin_crt0_common (MainFunc, struct per_process *);
-int dll_dllcrt0 (HMODULE, struct per_process *);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/winsup/cygwin/lib/cygwin_attach_dll.c b/winsup/cygwin/lib/cygwin_attach_dll.c
deleted file mode 100644
index 3788bdf9c..000000000
--- a/winsup/cygwin/lib/cygwin_attach_dll.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* attach_dll.cc: crt0 for attaching cygwin DLL from a non-cygwin app.
-
- Copyright 2000, 2001 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. */
-
-#undef __INSIDE_CYGWIN__
-#include <windows.h>
-#include <sys/cygwin.h>
-#include "crt0.h"
-
-/* for a loaded dll */
-int
-cygwin_attach_dll (HMODULE h, MainFunc f)
-{
- static struct per_process u;
- (void) _cygwin_crt0_common (f, &u);
-
- /* jump into the dll. */
- return dll_dllcrt0 (h, &u);
-}
diff --git a/winsup/cygwin/lib/cygwin_crt0.c b/winsup/cygwin/lib/cygwin_crt0.c
deleted file mode 100644
index fb2a84b18..000000000
--- a/winsup/cygwin/lib/cygwin_crt0.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* cygwin_crt0.cc: crt0 for cygwin
-
- Copyright 2000, 2001 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. */
-
-#undef __INSIDE_CYGWIN__
-#include <windows.h>
-#include <sys/cygwin.h>
-#include <stdlib.h>
-#include "crt0.h"
-
-extern void dll_crt0__FP11per_process (struct per_process *) __declspec (dllimport) __attribute ((noreturn));
-
-/* for main module */
-void
-cygwin_crt0 (MainFunc f)
-{
- struct per_process *u;
- if (_cygwin_crt0_common (f, NULL))
- u = NULL; /* Newer DLL. Use DLL internal per_process. */
- else /* Older DLL. Provide a per_process */
- {
- u = (struct per_process *) alloca (sizeof (*u));
- memset (u, 0, sizeof (u));
- (void) _cygwin_crt0_common (f, u);
- }
- dll_crt0__FP11per_process (u); /* Jump into the dll, never to return */
-}
diff --git a/winsup/cygwin/lib/dll_entry.c b/winsup/cygwin/lib/dll_entry.c
deleted file mode 100644
index 781f6a3ea..000000000
--- a/winsup/cygwin/lib/dll_entry.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* dll_entry.cc: Provide the default user DLL linker entry point.
-
- Copyright 1998, 2000, 2001 Red Hat, Inc.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-/* Here we simply instantiate the DECLARE_CYGWIN_DLL to define the
- linker entry point, __cygwin_dll_entry@12, which in turn calls
- _DllMain@12 to do user-specific initialization, if any. There is a
- default DllMain stub in the library if there is no user supplied
- one. */
-
-#include "cygwin/cygwin_dll.h"
-
-DECLARE_CYGWIN_DLL (DllMain);
diff --git a/winsup/cygwin/lib/dll_main.cc b/winsup/cygwin/lib/dll_main.cc
deleted file mode 100644
index a224a0a2f..000000000
--- a/winsup/cygwin/lib/dll_main.cc
+++ /dev/null
@@ -1,41 +0,0 @@
-/* dll_main.cc: Provide the DllMain stub that the user can override.
-
- Copyright 1998, 2000, 2001 Red Hat, Inc.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#include <windows.h>
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
-#include <stdio.h>
-
-extern "C"
-BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason,
- LPVOID reserved /* Not used. */);
-
-BOOL APIENTRY
-DllMain (
- HINSTANCE hInst /* Library instance handle. */ ,
- DWORD reason /* Reason this function is being called. */ ,
- LPVOID reserved /* Not used. */)
-{
- switch (reason)
- {
- case DLL_PROCESS_ATTACH:
- break;
-
- case DLL_PROCESS_DETACH:
- break;
-
- case DLL_THREAD_ATTACH:
- break;
-
- case DLL_THREAD_DETACH:
- break;
- }
- return TRUE;
-}
diff --git a/winsup/cygwin/lib/getopt.c b/winsup/cygwin/lib/getopt.c
deleted file mode 100644
index effa5d774..000000000
--- a/winsup/cygwin/lib/getopt.c
+++ /dev/null
@@ -1,501 +0,0 @@
-/* $NetBSD: getopt_long.c,v 1.12 2001/04/24 09:07:43 joda Exp $ */
-
-/*-
- * Copyright (c) 2000 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Dieter Baron and Thomas Klausner.
- *
- * 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.
- */
-
-#include <sys/cdefs.h>
-
-/*#include "namespace.h"*/
-
-#include <assert.h>
-#include <errno.h>
-/*#include <err.h>*/
-#include <stdlib.h>
-#include <string.h>
-#include <getopt.h>
-#include <stdarg.h>
-#include <stdio.h>
-
-#define REPLACE_GETOPT
-
-#define _DIAGASSERT(x) do {} while (0)
-
-#ifdef REPLACE_GETOPT
-#ifdef __weak_alias
-__weak_alias(getopt,_getopt)
-#endif
-int opterr = 1; /* if error message should be printed */
-int optind = 1; /* index into parent argv vector */
-int optopt = '?'; /* character checked for validity */
-int optreset; /* reset getopt */
-char *optarg; /* argument associated with option */
-#endif
-
-#ifdef __weak_alias
-__weak_alias(getopt_long,_getopt_long)
-#endif
-
-#ifndef __CYGWIN__
-#define __progname __argv[0]
-#else
-extern char __declspec(dllimport) *__progname;
-#endif
-
-#define IGNORE_FIRST (*options == '-' || *options == '+')
-#define PRINT_ERROR ((opterr) && ((*options != ':') \
- || (IGNORE_FIRST && options[1] != ':')))
-#if defined(__CYGWIN__) || defined(__MINGW32__)
-# define IS_POSIXLY_CORRECT (1)
-#else
-# define IS_POSIXLY_CORRECT (getenv("POSIXLY_CORRECT") != NULL)
-#endif
-
-#define PERMUTE (!IS_POSIXLY_CORRECT && !IGNORE_FIRST)
-/* XXX: GNU ignores PC if *options == '-' */
-#define IN_ORDER (!IS_POSIXLY_CORRECT && *options == '-')
-
-/* return values */
-#define BADCH (int)'?'
-#define BADARG ((IGNORE_FIRST && options[1] == ':') \
- || (*options == ':') ? (int)':' : (int)'?')
-#define INORDER (int)1
-
-#define EMSG ""
-
-static int getopt_internal __P((int, char * const *, const char *));
-static int gcd __P((int, int));
-static void permute_args __P((int, int, int, char * const *));
-
-static const char *place = EMSG; /* option letter processing */
-
-/* XXX: set optreset to 1 rather than these two */
-static int nonopt_start = -1; /* first non option argument (for permute) */
-static int nonopt_end = -1; /* first option after non options (for permute) */
-
-/* Error messages */
-static const char recargchar[] = "option requires an argument -- %c";
-static const char recargstring[] = "option requires an argument -- %s";
-static const char ambig[] = "ambiguous option -- %.*s";
-static const char noarg[] = "option doesn't take an argument -- %.*s";
-static const char illoptchar[] = "unknown option -- %c";
-static const char illoptstring[] = "unknown option -- %s";
-
-static void
-_vwarnx(const char *fmt, va_list ap)
-{
- (void)fprintf(stderr, "%s: ", __progname);
- if (fmt != NULL)
- (void)vfprintf(stderr, fmt, ap);
- (void)fprintf(stderr, "\n");
-}
-
-static void
-warnx(const char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- _vwarnx(fmt, ap);
- va_end(ap);
-}
-
-/*
- * Compute the greatest common divisor of a and b.
- */
-static int
-gcd(a, b)
- int a;
- int b;
-{
- int c;
-
- c = a % b;
- while (c != 0) {
- a = b;
- b = c;
- c = a % b;
- }
-
- return b;
-}
-
-/*
- * Exchange the block from nonopt_start to nonopt_end with the block
- * from nonopt_end to opt_end (keeping the same order of arguments
- * in each block).
- */
-static void
-permute_args(nonopt_start, nonopt_end, opt_end, nargv)
- int nonopt_start;
- int nonopt_end;
- int opt_end;
- char * const *nargv;
-{
- int cstart, cyclelen, i, j, ncycle, nnonopts, nopts, pos;
- char *swap;
-
- _DIAGASSERT(nargv != NULL);
-
- /*
- * compute lengths of blocks and number and size of cycles
- */
- nnonopts = nonopt_end - nonopt_start;
- nopts = opt_end - nonopt_end;
- ncycle = gcd(nnonopts, nopts);
- cyclelen = (opt_end - nonopt_start) / ncycle;
-
- for (i = 0; i < ncycle; i++) {
- cstart = nonopt_end+i;
- pos = cstart;
- for (j = 0; j < cyclelen; j++) {
- if (pos >= nonopt_end)
- pos -= nnonopts;
- else
- pos += nopts;
- swap = nargv[pos];
- /* LINTED const cast */
- ((char **) nargv)[pos] = nargv[cstart];
- /* LINTED const cast */
- ((char **)nargv)[cstart] = swap;
- }
- }
-}
-
-/*
- * getopt_internal --
- * Parse argc/argv argument vector. Called by user level routines.
- * Returns -2 if -- is found (can be long option or end of options marker).
- */
-static int
-getopt_internal(int nargc, char *const * nargv, const char *options)
-{
- char *oli; /* option letter list index */
- int optchar;
-
- _DIAGASSERT(nargv != NULL);
- _DIAGASSERT(options != NULL);
-
- optarg = NULL;
-
- /*
- * XXX Some programs (like rsyncd) expect to be able to
- * XXX re-initialize optind to 0 and have getopt_long(3)
- * XXX properly function again. Work around this braindamage.
- */
- if (optind == 0 && optreset == 0)
- optind = 1;
-
- if (optreset)
- nonopt_start = nonopt_end = -1;
-start:
- if (optreset || !*place) { /* update scanning pointer */
- optreset = 0;
- if (optind >= nargc) { /* end of argument vector */
- place = EMSG;
- if (nonopt_end != -1) {
- /* do permutation, if we have to */
- permute_args(nonopt_start, nonopt_end,
- optind, nargv);
- optind -= nonopt_end - nonopt_start;
- }
- else if (nonopt_start != -1) {
- /*
- * If we skipped non-options, set optind
- * to the first of them.
- */
- optind = nonopt_start;
- }
- nonopt_start = nonopt_end = -1;
- return -1;
- }
- if ((*(place = nargv[optind]) != '-')
- || (place[1] == '\0')) { /* found non-option */
- place = EMSG;
- if (IN_ORDER) {
- /*
- * GNU extension:
- * return non-option as argument to option 1
- */
- optarg = nargv[optind++];
- return INORDER;
- }
- if (!PERMUTE) {
- /*
- * if no permutation wanted, stop parsing
- * at first non-option
- */
- return -1;
- }
- /* do permutation */
- if (nonopt_start == -1)
- nonopt_start = optind;
- else if (nonopt_end != -1) {
- permute_args(nonopt_start, nonopt_end,
- optind, nargv);
- nonopt_start = optind -
- (nonopt_end - nonopt_start);
- nonopt_end = -1;
- }
- optind++;
- /* process next argument */
- goto start;
- }
- if (nonopt_start != -1 && nonopt_end == -1)
- nonopt_end = optind;
- if (place[1] && *++place == '-') { /* found "--" */
- place++;
- return -2;
- }
- }
- if ((optchar = (int)*place++) == (int)':' ||
- (oli = strchr(options + (IGNORE_FIRST ? 1 : 0), optchar)) == NULL) {
- /* option letter unknown or ':' */
- if (!*place)
- ++optind;
- if (PRINT_ERROR)
- warnx(illoptchar, optchar);
- optopt = optchar;
- return BADCH;
- }
- if (optchar == 'W' && oli[1] == ';') { /* -W long-option */
- /* XXX: what if no long options provided (called by getopt)? */
- if (*place)
- return -2;
-
- if (++optind >= nargc) { /* no arg */
- place = EMSG;
- if (PRINT_ERROR)
- warnx(recargchar, optchar);
- optopt = optchar;
- return BADARG;
- } else /* white space */
- place = nargv[optind];
- /*
- * Handle -W arg the same as --arg (which causes getopt to
- * stop parsing).
- */
- return -2;
- }
- if (*++oli != ':') { /* doesn't take argument */
- if (!*place)
- ++optind;
- } else { /* takes (optional) argument */
- optarg = NULL;
- if (*place) /* no white space */
- optarg = (char *) place;
- /* XXX: disable test for :: if PC? (GNU doesn't) */
- else if (oli[1] != ':') { /* arg not optional */
- if (++optind >= nargc) { /* no arg */
- place = EMSG;
- if (PRINT_ERROR)
- warnx(recargchar, optchar);
- optopt = optchar;
- return BADARG;
- } else
- optarg = nargv[optind];
- }
- place = EMSG;
- ++optind;
- }
- /* dump back option letter */
- return optchar;
-}
-
-#ifdef REPLACE_GETOPT
-/*
- * getopt --
- * Parse argc/argv argument vector.
- *
- * [eventually this will replace the real getopt]
- */
-int
-getopt(int nargc, char * const *nargv, const char *options)
-{
- int retval;
-
- _DIAGASSERT(nargv != NULL);
- _DIAGASSERT(options != NULL);
-
- if ((retval = getopt_internal(nargc, nargv, options)) == -2) {
- ++optind;
- /*
- * We found an option (--), so if we skipped non-options,
- * we have to permute.
- */
- if (nonopt_end != -1) {
- permute_args(nonopt_start, nonopt_end, optind,
- nargv);
- optind -= nonopt_end - nonopt_start;
- }
- nonopt_start = nonopt_end = -1;
- retval = -1;
- }
- return retval;
-}
-#endif
-
-/*
- * getopt_long --
- * Parse argc/argv argument vector.
- */
-int
-getopt_long(int nargc, char * const *nargv, const char *options,
- const struct option *long_options, int *idx)
-{
- int retval;
-
- _DIAGASSERT(nargv != NULL);
- _DIAGASSERT(options != NULL);
- _DIAGASSERT(long_options != NULL);
- /* idx may be NULL */
-
- if ((retval = getopt_internal(nargc, nargv, options)) == -2) {
- char *current_argv, *has_equal;
- size_t current_argv_len;
- int i, match;
-
- current_argv = (char *) place;
- match = -1;
-
- optind++;
- place = EMSG;
-
- if (*current_argv == '\0') { /* found "--" */
- /*
- * We found an option (--), so if we skipped
- * non-options, we have to permute.
- */
- if (nonopt_end != -1) {
- permute_args(nonopt_start, nonopt_end,
- optind, nargv);
- optind -= nonopt_end - nonopt_start;
- }
- nonopt_start = nonopt_end = -1;
- return -1;
- }
- if ((has_equal = strchr(current_argv, '=')) != NULL) {
- /* argument found (--option=arg) */
- current_argv_len = has_equal - current_argv;
- has_equal++;
- } else
- current_argv_len = strlen(current_argv);
-
- for (i = 0; long_options[i].name; i++) {
- /* find matching long option */
- if (strncmp(current_argv, long_options[i].name,
- current_argv_len))
- continue;
-
- if (strlen(long_options[i].name) ==
- (unsigned)current_argv_len) {
- /* exact match */
- match = i;
- break;
- }
- if (match == -1) /* partial match */
- match = i;
- else {
- /* ambiguous abbreviation */
- if (PRINT_ERROR)
- warnx(ambig, (int)current_argv_len,
- current_argv);
- optopt = 0;
- return BADCH;
- }
- }
- if (match != -1) { /* option found */
- if (long_options[match].has_arg == no_argument
- && has_equal) {
- if (PRINT_ERROR)
- warnx(noarg, (int)current_argv_len,
- current_argv);
- /*
- * XXX: GNU sets optopt to val regardless of
- * flag
- */
- if (long_options[match].flag == NULL)
- optopt = long_options[match].val;
- else
- optopt = 0;
- return BADARG;
- }
- if (long_options[match].has_arg == required_argument ||
- long_options[match].has_arg == optional_argument) {
- if (has_equal)
- optarg = has_equal;
- else if (long_options[match].has_arg ==
- required_argument) {
- /*
- * optional argument doesn't use
- * next nargv
- */
- optarg = nargv[optind++];
- }
- }
- if ((long_options[match].has_arg == required_argument)
- && (optarg == NULL)) {
- /*
- * Missing argument; leading ':'
- * indicates no error should be generated
- */
- if (PRINT_ERROR)
- warnx(recargstring, current_argv);
- /*
- * XXX: GNU sets optopt to val regardless
- * of flag
- */
- if (long_options[match].flag == NULL)
- optopt = long_options[match].val;
- else
- optopt = 0;
- --optind;
- return BADARG;
- }
- } else { /* unknown option */
- if (PRINT_ERROR)
- warnx(illoptstring, current_argv);
- optopt = 0;
- return BADCH;
- }
- if (long_options[match].flag) {
- *long_options[match].flag = long_options[match].val;
- retval = 0;
- } else
- retval = long_options[match].val;
- if (idx)
- *idx = match;
- }
- return retval;
-}
diff --git a/winsup/cygwin/lib/libcmain.c b/winsup/cygwin/lib/libcmain.c
deleted file mode 100644
index 13cc34cd9..000000000
--- a/winsup/cygwin/lib/libcmain.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* libcmain.c
-
- Copyright 1996, 1997, 1998, 2000, 2001 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 <windows.h>
-
-/* Allow apps which don't have a main work, as long as they define WinMain */
-int
-main ()
-{
- HMODULE x = GetModuleHandleA(0);
- char *s = GetCommandLineA ();
- STARTUPINFO si;
-
- /* GetCommandLineA returns the entire command line including the
- program name, but WinMain is defined to accept the command
- line without the program name. */
- while (*s != ' ' && *s != '\0')
- ++s;
- while (*s == ' ')
- ++s;
-
- GetStartupInfo (&si);
-
- return WinMain (x, 0, s,
- ((si.dwFlags & STARTF_USESHOWWINDOW) != 0
- ? si.wShowWindow
- : SW_SHOWNORMAL));
-}
diff --git a/winsup/cygwin/lib/premain0.c b/winsup/cygwin/lib/premain0.c
deleted file mode 100644
index b77e02e8e..000000000
--- a/winsup/cygwin/lib/premain0.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/* premain0.c
-
- Copyright 2000 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. */
-
-void
-cygwin_premain0(int argc, char **argv)
-{
-}
diff --git a/winsup/cygwin/lib/premain1.c b/winsup/cygwin/lib/premain1.c
deleted file mode 100644
index 99aeac916..000000000
--- a/winsup/cygwin/lib/premain1.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/* premain1.c
-
- Copyright 2000 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. */
-
-void
-cygwin_premain1(int argc, char **argv)
-{
-}
diff --git a/winsup/cygwin/lib/premain2.c b/winsup/cygwin/lib/premain2.c
deleted file mode 100644
index a89e76ec3..000000000
--- a/winsup/cygwin/lib/premain2.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/* premain2.c
-
- Copyright 2000 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. */
-
-void
-cygwin_premain2(int argc, char **argv)
-{
-}
diff --git a/winsup/cygwin/lib/premain3.c b/winsup/cygwin/lib/premain3.c
deleted file mode 100644
index c5b99b918..000000000
--- a/winsup/cygwin/lib/premain3.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/* premain3.c
-
- Copyright 2000 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. */
-
-void
-cygwin_premain3(int argc, char **argv)
-{
-}
diff --git a/winsup/cygwin/libc/fnmatch.c b/winsup/cygwin/libc/fnmatch.c
deleted file mode 100644
index 709bc78c8..000000000
--- a/winsup/cygwin/libc/fnmatch.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/* $OpenBSD: fnmatch.c,v 1.7 2000/03/23 19:13:51 millert Exp $ */
-
-/*
- * Copyright (c) 1989, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Guido van Rossum.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)fnmatch.c 8.2 (Berkeley) 4/16/94";
-#else
-static char rcsid[] = "$OpenBSD: fnmatch.c,v 1.7 2000/03/23 19:13:51 millert Exp $";
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-/*
- * Function fnmatch() as specified in POSIX 1003.2-1992, section B.6.
- * Compares a filename or pathname to a pattern.
- */
-
-/* Just this single line added for Cygwin. */
-#include "winsup.h"
-
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-#include <fnmatch.h>
-
-#define EOS '\0'
-
-#define RANGE_MATCH 1
-#define RANGE_NOMATCH 0
-#define RANGE_ERROR (-1)
-
-static int rangematch __P((const char *, char, int, char **));
-
-int
-fnmatch(pattern, string, flags)
- const char *pattern, *string;
- int flags;
-{
- const char *stringstart;
- char *newp;
- char c, test;
-
- for (stringstart = string;;)
- switch (c = *pattern++) {
- case EOS:
- if ((flags & FNM_LEADING_DIR) && *string == '/')
- return (0);
- return (*string == EOS ? 0 : FNM_NOMATCH);
- case '?':
- if (*string == EOS)
- return (FNM_NOMATCH);
- if (*string == '/' && (flags & FNM_PATHNAME))
- return (FNM_NOMATCH);
- if (*string == '.' && (flags & FNM_PERIOD) &&
- (string == stringstart ||
- ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
- return (FNM_NOMATCH);
- ++string;
- break;
- case '*':
- c = *pattern;
- /* Collapse multiple stars. */
- while (c == '*')
- c = *++pattern;
-
- if (*string == '.' && (flags & FNM_PERIOD) &&
- (string == stringstart ||
- ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
- return (FNM_NOMATCH);
-
- /* Optimize for pattern with * at end or before /. */
- if (c == EOS) {
- if (flags & FNM_PATHNAME)
- return ((flags & FNM_LEADING_DIR) ||
- strchr(string, '/') == NULL ?
- 0 : FNM_NOMATCH);
- else
- return (0);
- } else if (c == '/' && (flags & FNM_PATHNAME)) {
- if ((string = strchr(string, '/')) == NULL)
- return (FNM_NOMATCH);
- break;
- }
-
- /* General case, use recursion. */
- while ((test = *string) != EOS) {
- if (!fnmatch(pattern, string, flags & ~FNM_PERIOD))
- return (0);
- if (test == '/' && (flags & FNM_PATHNAME))
- break;
- ++string;
- }
- return (FNM_NOMATCH);
- case '[':
- if (*string == EOS)
- return (FNM_NOMATCH);
- if (*string == '/' && (flags & FNM_PATHNAME))
- return (FNM_NOMATCH);
- if (*string == '.' && (flags & FNM_PERIOD) &&
- (string == stringstart ||
- ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
- return (FNM_NOMATCH);
-
- switch (rangematch(pattern, *string, flags, &newp)) {
- case RANGE_ERROR:
- /* not a good range, treat as normal text */
- goto normal;
- case RANGE_MATCH:
- pattern = newp;
- break;
- case RANGE_NOMATCH:
- return (FNM_NOMATCH);
- }
- ++string;
- break;
- case '\\':
- if (!(flags & FNM_NOESCAPE)) {
- if ((c = *pattern++) == EOS) {
- c = '\\';
- --pattern;
- }
- }
- /* FALLTHROUGH */
- default:
- normal:
- if (c != *string && !((flags & FNM_CASEFOLD) &&
- (tolower((unsigned char)c) ==
- tolower((unsigned char)*string))))
- return (FNM_NOMATCH);
- ++string;
- break;
- }
- /* NOTREACHED */
-}
-
-static int
-#ifdef __STDC__
-rangematch(const char *pattern, char test, int flags, char **newp)
-#else
-rangematch(pattern, test, flags, newp)
- char *pattern;
- char test;
- int flags;
- char **newp;
-#endif
-{
- int negate, ok;
- char c, c2;
-
- /*
- * A bracket expression starting with an unquoted circumflex
- * character produces unspecified results (IEEE 1003.2-1992,
- * 3.13.2). This implementation treats it like '!', for
- * consistency with the regular expression syntax.
- * J.T. Conklin (conklin@ngai.kaleida.com)
- */
- if ((negate = (*pattern == '!' || *pattern == '^')))
- ++pattern;
-
- if (flags & FNM_CASEFOLD)
- test = tolower((unsigned char)test);
-
- /*
- * A right bracket shall lose its special meaning and represent
- * itself in a bracket expression if it occurs first in the list.
- * -- POSIX.2 2.8.3.2
- */
- ok = 0;
- c = *pattern++;
- do {
- if (c == '\\' && !(flags & FNM_NOESCAPE))
- c = *pattern++;
- if (c == EOS)
- return (RANGE_ERROR);
- if (c == '/' && (flags & FNM_PATHNAME))
- return (RANGE_NOMATCH);
- if ((flags & FNM_CASEFOLD))
- c = tolower((unsigned char)c);
- if (*pattern == '-'
- && (c2 = *(pattern+1)) != EOS && c2 != ']') {
- pattern += 2;
- if (c2 == '\\' && !(flags & FNM_NOESCAPE))
- c2 = *pattern++;
- if (c2 == EOS)
- return (RANGE_ERROR);
- if (flags & FNM_CASEFOLD)
- c2 = tolower((unsigned char)c2);
- if (c <= test && test <= c2)
- ok = 1;
- } else if (c == test)
- ok = 1;
- } while ((c = *pattern++) != ']');
-
- *newp = (char *)pattern;
- return (ok == negate ? RANGE_NOMATCH : RANGE_MATCH);
-}
diff --git a/winsup/cygwin/localtime.cc b/winsup/cygwin/localtime.cc
deleted file mode 100644
index 8267bdebb..000000000
--- a/winsup/cygwin/localtime.cc
+++ /dev/null
@@ -1,2160 +0,0 @@
-/*
-** This file is in the public domain, so clarified as of
-** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
-*/
-/* Temporarily merged private.h and tzfile.h for ease of management - DJ */
-
-#include "winsup.h"
-#include "cygerrno.h"
-#include <windows.h>
-#define lint
-
-#define USG_COMPAT
-
-#ifndef lint
-#ifndef NOID
-static char elsieid[] = "@(#)localtime.c 7.66";
-#endif /* !defined NOID */
-#endif /* !defined lint */
-
-/*
-** Leap second handling from Bradley White (bww@k.gp.cs.cmu.edu).
-** POSIX-style TZ environment variable handling from Guy Harris
-** (guy@auspex.com).
-*/
-
-/*LINTLIBRARY*/
-
-#ifndef PRIVATE_H
-
-#define PRIVATE_H
-
-/*
-** This file is in the public domain, so clarified as of
-** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
-*/
-
-/*
-** This header is for use ONLY with the time conversion code.
-** There is no guarantee that it will remain unchanged,
-** or that it will remain at all.
-** Do NOT copy it to any system include directory.
-** Thank you!
-*/
-
-/*
-** ID
-*/
-
-#ifndef lint
-#ifndef NOID
-static char privatehid[] = "@(#)private.h 7.48";
-#endif /* !defined NOID */
-#endif /* !defined lint */
-
-/*
-** Defaults for preprocessor symbols.
-** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'.
-*/
-
-#ifndef HAVE_ADJTIME
-#define HAVE_ADJTIME 1
-#endif /* !defined HAVE_ADJTIME */
-
-#ifndef HAVE_GETTEXT
-#define HAVE_GETTEXT 0
-#endif /* !defined HAVE_GETTEXT */
-
-#ifndef HAVE_SETTIMEOFDAY
-#define HAVE_SETTIMEOFDAY 3
-#endif /* !defined HAVE_SETTIMEOFDAY */
-
-#ifndef HAVE_STRERROR
-#define HAVE_STRERROR 0
-#endif /* !defined HAVE_STRERROR */
-
-#ifndef HAVE_SYMLINK
-#define HAVE_SYMLINK 1
-#endif /* !defined HAVE_SYMLINK */
-
-#ifndef HAVE_UNISTD_H
-#define HAVE_UNISTD_H 1
-#endif /* !defined HAVE_UNISTD_H */
-
-#ifndef HAVE_UTMPX_H
-#define HAVE_UTMPX_H 0
-#endif /* !defined HAVE_UTMPX_H */
-
-#ifndef LOCALE_HOME
-#define LOCALE_HOME "/usr/lib/locale"
-#endif /* !defined LOCALE_HOME */
-
-/*
-** Nested includes
-*/
-
-#include "sys/types.h" /* for time_t */
-#include "stdio.h"
-#include "limits.h" /* for CHAR_BIT */
-#include "time.h"
-#include "stdlib.h"
-
-#if HAVE_GETTEXT - 0
-#include "libintl.h"
-#endif /* HAVE_GETTEXT - 0 */
-
-#if HAVE_UNISTD_H - 0
-#include "unistd.h" /* for F_OK and R_OK */
-#endif /* HAVE_UNISTD_H - 0 */
-
-#if !(HAVE_UNISTD_H - 0)
-#ifndef F_OK
-#define F_OK 0
-#endif /* !defined F_OK */
-#ifndef R_OK
-#define R_OK 4
-#endif /* !defined R_OK */
-#endif /* !(HAVE_UNISTD_H - 0) */
-
-/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
-#define is_digit(c) ((unsigned)(c) - '0' <= 9)
-
-/*
-** Workarounds for compilers/systems.
-*/
-
-/*
-** SunOS 4.1.1 cc lacks const.
-*/
-
-#ifndef const
-#ifndef __STDC__
-#define const
-#endif /* !defined __STDC__ */
-#endif /* !defined const */
-
-/*
-** SunOS 4.1.1 cc lacks prototypes.
-*/
-
-#ifndef P
-#ifdef __STDC__
-#define P(x) x
-#endif /* defined __STDC__ */
-#ifndef __STDC__
-#define P(x) ()
-#endif /* !defined __STDC__ */
-#endif /* !defined P */
-
-/*
-** SunOS 4.1.1 headers lack EXIT_SUCCESS.
-*/
-
-#ifndef EXIT_SUCCESS
-#define EXIT_SUCCESS 0
-#endif /* !defined EXIT_SUCCESS */
-
-/*
-** SunOS 4.1.1 headers lack EXIT_FAILURE.
-*/
-
-#ifndef EXIT_FAILURE
-#define EXIT_FAILURE 1
-#endif /* !defined EXIT_FAILURE */
-
-/*
-** SunOS 4.1.1 headers lack FILENAME_MAX.
-*/
-
-#ifndef FILENAME_MAX
-
-#ifndef MAXPATHLEN
-#ifdef unix
-#include "sys/param.h"
-#endif /* defined unix */
-#endif /* !defined MAXPATHLEN */
-
-#ifdef MAXPATHLEN
-#define FILENAME_MAX MAXPATHLEN
-#endif /* defined MAXPATHLEN */
-#ifndef MAXPATHLEN
-#define FILENAME_MAX 1024 /* Pure guesswork */
-#endif /* !defined MAXPATHLEN */
-
-#endif /* !defined FILENAME_MAX */
-
-/*
-** SunOS 4.1.1 libraries lack remove.
-*/
-
-#ifndef remove
-extern int unlink P((const char * filename));
-#define remove unlink
-#endif /* !defined remove */
-
-/*
-** Finally, some convenience items.
-*/
-
-#ifndef TRUE
-#define TRUE 1
-#endif /* !defined TRUE */
-
-#ifndef FALSE
-#define FALSE 0
-#endif /* !defined FALSE */
-
-#ifndef TYPE_BIT
-#define TYPE_BIT(type) (sizeof (type) * CHAR_BIT)
-#endif /* !defined TYPE_BIT */
-
-#ifndef TYPE_SIGNED
-#define TYPE_SIGNED(type) (((type) -1) < 0)
-#endif /* !defined TYPE_SIGNED */
-
-#ifndef INT_STRLEN_MAXIMUM
-/*
-** 302 / 1000 is log10(2.0) rounded up.
-** Subtract one for the sign bit if the type is signed;
-** add one for integer division truncation;
-** add one more for a minus sign if the type is signed.
-*/
-#define INT_STRLEN_MAXIMUM(type) \
- ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + 1 + TYPE_SIGNED(type))
-#endif /* !defined INT_STRLEN_MAXIMUM */
-
-/*
-** INITIALIZE(x)
-*/
-
-#ifndef GNUC_or_lint
-#ifdef lint
-#define GNUC_or_lint
-#endif /* defined lint */
-#ifndef lint
-#ifdef __GNUC__
-#define GNUC_or_lint
-#endif /* defined __GNUC__ */
-#endif /* !defined lint */
-#endif /* !defined GNUC_or_lint */
-
-#ifndef INITIALIZE
-#ifdef GNUC_or_lint
-#define INITIALIZE(x) ((x) = 0)
-#endif /* defined GNUC_or_lint */
-#ifndef GNUC_or_lint
-#define INITIALIZE(x)
-#endif /* !defined GNUC_or_lint */
-#endif /* !defined INITIALIZE */
-
-/*
-** For the benefit of GNU folk...
-** `_(MSGID)' uses the current locale's message library string for MSGID.
-** The default is to use gettext if available, and use MSGID otherwise.
-*/
-
-#ifndef _
-#if HAVE_GETTEXT - 0
-#define _(msgid) gettext(msgid)
-#else /* !(HAVE_GETTEXT - 0) */
-#define _(msgid) msgid
-#endif /* !(HAVE_GETTEXT - 0) */
-#endif /* !defined _ */
-
-#ifndef TZ_DOMAIN
-#define TZ_DOMAIN "tz"
-#endif /* !defined TZ_DOMAIN */
-
-/*
-** UNIX was a registered trademark of UNIX System Laboratories in 1993.
-*/
-
-#endif /* !defined PRIVATE_H */
-
-#ifndef TZFILE_H
-
-#define TZFILE_H
-
-/*
-** This file is in the public domain, so clarified as of
-** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
-*/
-
-/*
-** This header is for use ONLY with the time conversion code.
-** There is no guarantee that it will remain unchanged,
-** or that it will remain at all.
-** Do NOT copy it to any system include directory.
-** Thank you!
-*/
-
-/*
-** ID
-*/
-
-#ifndef lint
-#ifndef NOID
-static char tzfilehid[] = "@(#)tzfile.h 7.14";
-#endif /* !defined NOID */
-#endif /* !defined lint */
-
-/*
-** Information about time zone files.
-*/
-
-#ifndef TZDIR
-#define TZDIR "/usr/local/etc/zoneinfo" /* Time zone object file directory */
-#endif /* !defined TZDIR */
-
-#ifndef TZDEFAULT
-#define TZDEFAULT "localtime"
-#endif /* !defined TZDEFAULT */
-
-#ifndef TZDEFRULES
-#define TZDEFRULES "posixrules"
-#endif /* !defined TZDEFRULES */
-
-/*
-** Each file begins with. . .
-*/
-
-#define TZ_MAGIC "TZif"
-
-struct tzhead {
- char tzh_magic[4]; /* TZ_MAGIC */
- char tzh_reserved[16]; /* reserved for future use */
- char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */
- char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */
- char tzh_leapcnt[4]; /* coded number of leap seconds */
- char tzh_timecnt[4]; /* coded number of transition times */
- char tzh_typecnt[4]; /* coded number of local time types */
- char tzh_charcnt[4]; /* coded number of abbr. chars */
-};
-
-/*
-** . . .followed by. . .
-**
-** tzh_timecnt (char [4])s coded transition times a la time(2)
-** tzh_timecnt (unsigned char)s types of local time starting at above
-** tzh_typecnt repetitions of
-** one (char [4]) coded UTC offset in seconds
-** one (unsigned char) used to set tm_isdst
-** one (unsigned char) that's an abbreviation list index
-** tzh_charcnt (char)s '\0'-terminated zone abbreviations
-** tzh_leapcnt repetitions of
-** one (char [4]) coded leap second transition times
-** one (char [4]) total correction after above
-** tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition
-** time is standard time, if FALSE,
-** transition time is wall clock time
-** if absent, transition times are
-** assumed to be wall clock time
-** tzh_ttisgmtcnt (char)s indexed by type; if TRUE, transition
-** time is UTC, if FALSE,
-** transition time is local time
-** if absent, transition times are
-** assumed to be local time
-*/
-
-/*
-** In the current implementation, "tzset()" refuses to deal with files that
-** exceed any of the limits below.
-*/
-
-#ifndef TZ_MAX_TIMES
-/*
-** The TZ_MAX_TIMES value below is enough to handle a bit more than a
-** year's worth of solar time (corrected daily to the nearest second) or
-** 138 years of Pacific Presidential Election time
-** (where there are three time zone transitions every fourth year).
-*/
-#define TZ_MAX_TIMES 370
-#endif /* !defined TZ_MAX_TIMES */
-
-#ifndef TZ_MAX_TYPES
-#ifndef NOSOLAR
-#define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */
-#endif /* !defined NOSOLAR */
-#ifdef NOSOLAR
-/*
-** Must be at least 14 for Europe/Riga as of Jan 12 1995,
-** as noted by Earl Chew <earl@hpato.aus.hp.com>.
-*/
-#define TZ_MAX_TYPES 20 /* Maximum number of local time types */
-#endif /* !defined NOSOLAR */
-#endif /* !defined TZ_MAX_TYPES */
-
-#ifndef TZ_MAX_CHARS
-#define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */
- /* (limited by what unsigned chars can hold) */
-#endif /* !defined TZ_MAX_CHARS */
-
-#ifndef TZ_MAX_LEAPS
-#define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */
-#endif /* !defined TZ_MAX_LEAPS */
-
-#define SECSPERMIN 60
-#define MINSPERHOUR 60
-#define HOURSPERDAY 24
-#define DAYSPERWEEK 7
-#define DAYSPERNYEAR 365
-#define DAYSPERLYEAR 366
-#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR)
-#define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY)
-#define MONSPERYEAR 12
-
-#define TM_SUNDAY 0
-#define TM_MONDAY 1
-#define TM_TUESDAY 2
-#define TM_WEDNESDAY 3
-#define TM_THURSDAY 4
-#define TM_FRIDAY 5
-#define TM_SATURDAY 6
-
-#define TM_JANUARY 0
-#define TM_FEBRUARY 1
-#define TM_MARCH 2
-#define TM_APRIL 3
-#define TM_MAY 4
-#define TM_JUNE 5
-#define TM_JULY 6
-#define TM_AUGUST 7
-#define TM_SEPTEMBER 8
-#define TM_OCTOBER 9
-#define TM_NOVEMBER 10
-#define TM_DECEMBER 11
-
-#define TM_YEAR_BASE 1900
-
-#define EPOCH_YEAR 1970
-#define EPOCH_WDAY TM_THURSDAY
-
-/*
-** Accurate only for the past couple of centuries;
-** that will probably do.
-*/
-
-#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
-
-#ifndef USG
-
-/*
-** Use of the underscored variants may cause problems if you move your code to
-** certain System-V-based systems; for maximum portability, use the
-** underscore-free variants. The underscored variants are provided for
-** backward compatibility only; they may disappear from future versions of
-** this file.
-*/
-
-#define SECS_PER_MIN SECSPERMIN
-#define MINS_PER_HOUR MINSPERHOUR
-#define HOURS_PER_DAY HOURSPERDAY
-#define DAYS_PER_WEEK DAYSPERWEEK
-#define DAYS_PER_NYEAR DAYSPERNYEAR
-#define DAYS_PER_LYEAR DAYSPERLYEAR
-#define SECS_PER_HOUR SECSPERHOUR
-#define SECS_PER_DAY SECSPERDAY
-#define MONS_PER_YEAR MONSPERYEAR
-
-#endif /* !defined USG */
-
-#endif /* !defined TZFILE_H */
-
-#include "fcntl.h"
-
-/*
-** SunOS 4.1.1 headers lack O_BINARY.
-*/
-
-#ifdef O_BINARY
-#define OPEN_MODE (O_RDONLY | O_BINARY)
-#endif /* defined O_BINARY */
-#ifndef O_BINARY
-#define OPEN_MODE O_RDONLY
-#endif /* !defined O_BINARY */
-
-#ifndef WILDABBR
-/*
-** Someone might make incorrect use of a time zone abbreviation:
-** 1. They might reference tzname[0] before calling tzset (explicitly
-** or implicitly).
-** 2. They might reference tzname[1] before calling tzset (explicitly
-** or implicitly).
-** 3. They might reference tzname[1] after setting to a time zone
-** in which Daylight Saving Time is never observed.
-** 4. They might reference tzname[0] after setting to a time zone
-** in which Standard Time is never observed.
-** 5. They might reference tm.TM_ZONE after calling offtime.
-** What's best to do in the above cases is open to debate;
-** for now, we just set things up so that in any of the five cases
-** WILDABBR is used. Another possibility: initialize tzname[0] to the
-** string "tzname[0] used before set", and similarly for the other cases.
-** And another: initialize tzname[0] to "ERA", with an explanation in the
-** manual page of what this "time zone abbreviation" means (doing this so
-** that tzname[0] has the "normal" length of three characters).
-*/
-#define WILDABBR " "
-#endif /* !defined WILDABBR */
-
-static char wildabbr[] NO_COPY = WILDABBR;
-
-static char gmt[] NO_COPY = "GMT";
-
-struct ttinfo { /* time type information */
- long tt_gmtoff; /* UTC offset in seconds */
- int tt_isdst; /* used to set tm_isdst */
- int tt_abbrind; /* abbreviation list index */
- int tt_ttisstd; /* TRUE if transition is std time */
- int tt_ttisgmt; /* TRUE if transition is UTC */
-};
-
-struct lsinfo { /* leap second information */
- time_t ls_trans; /* transition time */
- long ls_corr; /* correction to apply */
-};
-
-#define BIGGEST(a, b) (((a) > (b)) ? (a) : (b))
-
-#ifdef TZNAME_MAX
-#define MY_TZNAME_MAX TZNAME_MAX
-#endif /* defined TZNAME_MAX */
-#ifndef TZNAME_MAX
-#define MY_TZNAME_MAX 255
-#endif /* !defined TZNAME_MAX */
-
-struct state {
- int leapcnt;
- int timecnt;
- int typecnt;
- int charcnt;
- time_t ats[TZ_MAX_TIMES];
- unsigned char types[TZ_MAX_TIMES];
- struct ttinfo ttis[TZ_MAX_TYPES];
- char chars[BIGGEST(BIGGEST(TZ_MAX_CHARS + 1, sizeof gmt),
- (2 * (MY_TZNAME_MAX + 1)))];
- struct lsinfo lsis[TZ_MAX_LEAPS];
-};
-
-struct rule {
- int r_type; /* type of rule--see below */
- int r_day; /* day number of rule */
- int r_week; /* week number of rule */
- int r_mon; /* month number of rule */
- long r_time; /* transition time of rule */
-};
-
-#define JULIAN_DAY 0 /* Jn - Julian day */
-#define DAY_OF_YEAR 1 /* n - day of year */
-#define MONTH_NTH_DAY_OF_WEEK 2 /* Mm.n.d - month, week, day of week */
-
-/*
-** Prototypes for static functions.
-*/
-
-static long detzcode P((const char * codep));
-static const char * getzname P((const char * strp));
-static const char * getnum P((const char * strp, int * nump, int min,
- int max));
-static const char * getsecs P((const char * strp, long * secsp));
-static const char * getoffset P((const char * strp, long * offsetp));
-static const char * getrule P((const char * strp, struct rule * rulep));
-static void gmtload P((struct state * sp));
-static void gmtsub P((const time_t * timep, long offset,
- struct tm * tmp));
-static void localsub P((const time_t * timep, long offset,
- struct tm * tmp));
-static int increment_overflow P((int * number, int delta));
-static int normalize_overflow P((int * tensptr, int * unitsptr,
- int base));
-static void settzname P((void));
-static time_t time1 P((struct tm * tmp,
- void(*funcp) P((const time_t *,
- long, struct tm *)),
- long offset));
-static time_t time2 P((struct tm *tmp,
- void(*funcp) P((const time_t *,
- long, struct tm*)),
- long offset, int * okayp));
-static time_t time2sub P((struct tm *tmp,
- void(*funcp) P((const time_t *,
- long, struct tm*)),
- long offset, int * okayp, int do_norm_secs));
-static void timesub P((const time_t * timep, long offset,
- const struct state * sp, struct tm * tmp));
-static int tmcomp P((const struct tm * atmp,
- const struct tm * btmp));
-static time_t transtime P((time_t janfirst, int year,
- const struct rule * rulep, long offset));
-static int tzload P((const char * name, struct state * sp));
-static int tzparse P((const char * name, struct state * sp,
- int lastditch));
-
-#ifdef ALL_STATE
-static struct state * lclptr;
-static struct state * gmtptr;
-#endif /* defined ALL_STATE */
-
-#ifndef ALL_STATE
-static struct state lclmem;
-static struct state gmtmem;
-#define lclptr (&lclmem)
-#define gmtptr (&gmtmem)
-#endif /* State Farm */
-
-#ifndef TZ_STRLEN_MAX
-#define TZ_STRLEN_MAX 255
-#endif /* !defined TZ_STRLEN_MAX */
-
-static char lcl_TZname[TZ_STRLEN_MAX + 1];
-static int lcl_is_set;
-static int gmt_is_set;
-
-#define tzname _tzname
-#undef _tzname
-
-char * tzname[2] = {
- wildabbr,
- wildabbr
-};
-
-/*
-** Section 4.12.3 of X3.159-1989 requires that
-** Except for the strftime function, these functions [asctime,
-** ctime, gmtime, localtime] return values in one of two static
-** objects: a broken-down time structure and an array of char.
-** Thanks to Paul Eggert (eggert@twinsun.com) for noting this.
-*/
-
-static struct tm tm;
-
-
-/* These variables are initialized by tzset. The macro versions are
- defined in time.h, and indirect through the __imp_ pointers. */
-
-#define timezone _timezone
-#define daylight _daylight
-#undef _timezone
-#undef _daylight
-
-#ifdef USG_COMPAT
-time_t timezone;
-int daylight;
-#endif /* defined USG_COMPAT */
-
-#ifdef ALTZONE
-time_t altzone;
-#endif /* defined ALTZONE */
-
-static long
-detzcode(const char *codep)
-{
- register long result;
- register int i;
-
- result = (codep[0] & 0x80) ? ~0L : 0L;
- for (i = 0; i < 4; ++i)
- result = (result << 8) | (codep[i] & 0xff);
- return result;
-}
-
-static void
-settzname P((void))
-{
- register struct state * const sp = lclptr;
- register int i;
-
- tzname[0] = wildabbr;
- tzname[1] = wildabbr;
-#ifdef USG_COMPAT
- daylight = 0;
- timezone = 0;
-#endif /* defined USG_COMPAT */
-#ifdef ALTZONE
- altzone = 0;
-#endif /* defined ALTZONE */
-#ifdef ALL_STATE
- if (sp == NULL) {
- tzname[0] = tzname[1] = gmt;
- return;
- }
-#endif /* defined ALL_STATE */
- for (i = 0; i < sp->typecnt; ++i) {
- register const struct ttinfo * const ttisp = &sp->ttis[i];
-
- tzname[ttisp->tt_isdst] =
- &sp->chars[ttisp->tt_abbrind];
-#ifdef USG_COMPAT
- if (ttisp->tt_isdst)
- daylight = 1;
- if (i == 0 || !ttisp->tt_isdst)
- timezone = -(ttisp->tt_gmtoff);
-#endif /* defined USG_COMPAT */
-#ifdef ALTZONE
- if (i == 0 || ttisp->tt_isdst)
- altzone = -(ttisp->tt_gmtoff);
-#endif /* defined ALTZONE */
- }
- /*
- ** And to get the latest zone names into tzname. . .
- */
- for (i = 0; i < sp->timecnt; ++i) {
- register const struct ttinfo * const ttisp =
- &sp->ttis[
- sp->types[i]];
-
- tzname[ttisp->tt_isdst] =
- &sp->chars[ttisp->tt_abbrind];
- }
-}
-
-#include "tz_posixrules.h"
-
-static int
-tzload(const char *name, struct state *sp)
-{
- register const char * p;
- register int i;
- register int fid;
- save_errno save;
-
- if (name == NULL && (name = TZDEFAULT) == NULL)
- return -1;
- {
- register int doaccess;
- /*
- ** Section 4.9.1 of the C standard says that
- ** "FILENAME_MAX expands to an integral constant expression
- ** that is the size needed for an array of char large enough
- ** to hold the longest file name string that the implementation
- ** guarantees can be opened."
- */
- char fullname[FILENAME_MAX + 1];
-
- if (name[0] == ':')
- ++name;
- doaccess = name[0] == '/';
- if (!doaccess) {
- if ((p = TZDIR) == NULL)
- return -1;
- if ((strlen(p) + strlen(name) + 1) >= sizeof fullname)
- return -1;
- (void) strcpy(fullname, p);
- (void) strcat(fullname, "/");
- (void) strcat(fullname, name);
- /*
- ** Set doaccess if '.' (as in "../") shows up in name.
- */
- if (strchr(name, '.') != NULL)
- doaccess = TRUE;
- name = fullname;
- }
-#if 0
- if (doaccess && access(name, R_OK) != 0)
- return -1;
-#endif
- if ((fid = open(name, OPEN_MODE)) == -1)
- {
- const char *base = strrchr(name, '/');
- if (base)
- base++;
- else
- base = name;
- if (strcmp(base, "posixrules"))
- return -1;
-
- /* We've got a built-in copy of posixrules just in case */
- fid = -2;
- }
- }
- {
- struct tzhead * tzhp;
- union {
- struct tzhead tzhead;
- char buf[sizeof *sp + sizeof *tzhp];
- } u;
- int ttisstdcnt;
- int ttisgmtcnt;
-
- if (fid == -2)
- {
- memcpy(u.buf, _posixrules_data, sizeof(_posixrules_data));
- i = sizeof(_posixrules_data);
- }
- else
- {
- i = read(fid, u.buf, sizeof u.buf);
- if (close(fid) != 0)
- return -1;
- }
- ttisstdcnt = (int) detzcode(u.tzhead.tzh_ttisgmtcnt);
- ttisgmtcnt = (int) detzcode(u.tzhead.tzh_ttisstdcnt);
- sp->leapcnt = (int) detzcode(u.tzhead.tzh_leapcnt);
- sp->timecnt = (int) detzcode(u.tzhead.tzh_timecnt);
- sp->typecnt = (int) detzcode(u.tzhead.tzh_typecnt);
- sp->charcnt = (int) detzcode(u.tzhead.tzh_charcnt);
- p = u.tzhead.tzh_charcnt + sizeof u.tzhead.tzh_charcnt;
- if (sp->leapcnt < 0 || sp->leapcnt > TZ_MAX_LEAPS ||
- sp->typecnt <= 0 || sp->typecnt > TZ_MAX_TYPES ||
- sp->timecnt < 0 || sp->timecnt > TZ_MAX_TIMES ||
- sp->charcnt < 0 || sp->charcnt > TZ_MAX_CHARS ||
- (ttisstdcnt != sp->typecnt && ttisstdcnt != 0) ||
- (ttisgmtcnt != sp->typecnt && ttisgmtcnt != 0))
- return -1;
- if (i - (p - u.buf) < sp->timecnt * 4 + /* ats */
- sp->timecnt + /* types */
- sp->typecnt * (4 + 2) + /* ttinfos */
- sp->charcnt + /* chars */
- sp->leapcnt * (4 + 4) + /* lsinfos */
- ttisstdcnt + /* ttisstds */
- ttisgmtcnt) /* ttisgmts */
- return -1;
- for (i = 0; i < sp->timecnt; ++i) {
- sp->ats[i] = detzcode(p);
- p += 4;
- }
- for (i = 0; i < sp->timecnt; ++i) {
- sp->types[i] = (unsigned char) *p++;
- if (sp->types[i] >= sp->typecnt)
- return -1;
- }
- for (i = 0; i < sp->typecnt; ++i) {
- register struct ttinfo * ttisp;
-
- ttisp = &sp->ttis[i];
- ttisp->tt_gmtoff = detzcode(p);
- p += 4;
- ttisp->tt_isdst = (unsigned char) *p++;
- if (ttisp->tt_isdst != 0 && ttisp->tt_isdst != 1)
- return -1;
- ttisp->tt_abbrind = (unsigned char) *p++;
- if (ttisp->tt_abbrind < 0 ||
- ttisp->tt_abbrind > sp->charcnt)
- return -1;
- }
- for (i = 0; i < sp->charcnt; ++i)
- sp->chars[i] = *p++;
- sp->chars[i] = '\0'; /* ensure '\0' at end */
- for (i = 0; i < sp->leapcnt; ++i) {
- register struct lsinfo * lsisp;
-
- lsisp = &sp->lsis[i];
- lsisp->ls_trans = detzcode(p);
- p += 4;
- lsisp->ls_corr = detzcode(p);
- p += 4;
- }
- for (i = 0; i < sp->typecnt; ++i) {
- register struct ttinfo * ttisp;
-
- ttisp = &sp->ttis[i];
- if (ttisstdcnt == 0)
- ttisp->tt_ttisstd = FALSE;
- else {
- ttisp->tt_ttisstd = *p++;
- if (ttisp->tt_ttisstd != TRUE &&
- ttisp->tt_ttisstd != FALSE)
- return -1;
- }
- }
- for (i = 0; i < sp->typecnt; ++i) {
- register struct ttinfo * ttisp;
-
- ttisp = &sp->ttis[i];
- if (ttisgmtcnt == 0)
- ttisp->tt_ttisgmt = FALSE;
- else {
- ttisp->tt_ttisgmt = *p++;
- if (ttisp->tt_ttisgmt != TRUE &&
- ttisp->tt_ttisgmt != FALSE)
- return -1;
- }
- }
- }
- return 0;
-}
-
-static const int mon_lengths[2][MONSPERYEAR] = {
- { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
- { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
-};
-
-static const int year_lengths[2] = {
- DAYSPERNYEAR, DAYSPERLYEAR
-};
-
-/*
-** Given a pointer into a time zone string, scan until a character that is not
-** a valid character in a zone name is found. Return a pointer to that
-** character.
-*/
-
-static const char *
-getzname(const char *strp)
-{
- register char c;
-
- while ((c = *strp) != '\0' && !is_digit(c) && c != ',' && c != '-' &&
- c != '+')
- ++strp;
- return strp;
-}
-
-/*
-** Given a pointer into a time zone string, extract a number from that string.
-** Check that the number is within a specified range; if it is not, return
-** NULL.
-** Otherwise, return a pointer to the first character not part of the number.
-*/
-
-static const char *
-getnum(const char *strp, int *nump, const int min, const int max)
-{
- register char c;
- register int num;
-
- if (strp == NULL || !is_digit(c = *strp))
- return NULL;
- num = 0;
- do {
- num = num * 10 + (c - '0');
- if (num > max)
- return NULL; /* illegal value */
- c = *++strp;
- } while (is_digit(c));
- if (num < min)
- return NULL; /* illegal value */
- *nump = num;
- return strp;
-}
-
-/*
-** Given a pointer into a time zone string, extract a number of seconds,
-** in hh[:mm[:ss]] form, from the string.
-** If any error occurs, return NULL.
-** Otherwise, return a pointer to the first character not part of the number
-** of seconds.
-*/
-
-static const char *
-getsecs(const char *strp, long *secsp)
-{
- int num;
-
- /*
- ** `HOURSPERDAY * DAYSPERWEEK - 1' allows quasi-Posix rules like
- ** "M10.4.6/26", which does not conform to Posix,
- ** but which specifies the equivalent of
- ** ``02:00 on the first Sunday on or after 23 Oct''.
- */
- strp = getnum(strp, &num, 0, HOURSPERDAY * DAYSPERWEEK - 1);
- if (strp == NULL)
- return NULL;
- *secsp = num * (long) SECSPERHOUR;
- if (*strp == ':') {
- ++strp;
- strp = getnum(strp, &num, 0, MINSPERHOUR - 1);
- if (strp == NULL)
- return NULL;
- *secsp += num * SECSPERMIN;
- if (*strp == ':') {
- ++strp;
- /* `SECSPERMIN' allows for leap seconds. */
- strp = getnum(strp, &num, 0, SECSPERMIN);
- if (strp == NULL)
- return NULL;
- *secsp += num;
- }
- }
- return strp;
-}
-
-/*
-** Given a pointer into a time zone string, extract an offset, in
-** [+-]hh[:mm[:ss]] form, from the string.
-** If any error occurs, return NULL.
-** Otherwise, return a pointer to the first character not part of the time.
-*/
-
-static const char *
-getoffset(const char *strp, long *offsetp)
-{
- register int neg = 0;
-
- if (*strp == '-') {
- neg = 1;
- ++strp;
- } else if (*strp == '+')
- ++strp;
- strp = getsecs(strp, offsetp);
- if (strp == NULL)
- return NULL; /* illegal time */
- if (neg)
- *offsetp = -*offsetp;
- return strp;
-}
-
-/*
-** Given a pointer into a time zone string, extract a rule in the form
-** date[/time]. See POSIX section 8 for the format of "date" and "time".
-** If a valid rule is not found, return NULL.
-** Otherwise, return a pointer to the first character not part of the rule.
-*/
-
-static const char *
-getrule(const char *strp, struct rule *rulep)
-{
- if (*strp == 'J') {
- /*
- ** Julian day.
- */
- rulep->r_type = JULIAN_DAY;
- ++strp;
- strp = getnum(strp, &rulep->r_day, 1, DAYSPERNYEAR);
- } else if (*strp == 'M') {
- /*
- ** Month, week, day.
- */
- rulep->r_type = MONTH_NTH_DAY_OF_WEEK;
- ++strp;
- strp = getnum(strp, &rulep->r_mon, 1, MONSPERYEAR);
- if (strp == NULL)
- return NULL;
- if (*strp++ != '.')
- return NULL;
- strp = getnum(strp, &rulep->r_week, 1, 5);
- if (strp == NULL)
- return NULL;
- if (*strp++ != '.')
- return NULL;
- strp = getnum(strp, &rulep->r_day, 0, DAYSPERWEEK - 1);
- } else if (is_digit(*strp)) {
- /*
- ** Day of year.
- */
- rulep->r_type = DAY_OF_YEAR;
- strp = getnum(strp, &rulep->r_day, 0, DAYSPERLYEAR - 1);
- } else return NULL; /* invalid format */
- if (strp == NULL)
- return NULL;
- if (*strp == '/') {
- /*
- ** Time specified.
- */
- ++strp;
- strp = getsecs(strp, &rulep->r_time);
- } else rulep->r_time = 2 * SECSPERHOUR; /* default = 2:00:00 */
- return strp;
-}
-
-/*
-** Given the Epoch-relative time of January 1, 00:00:00 UTC, in a year, the
-** year, a rule, and the offset from UTC at the time that rule takes effect,
-** calculate the Epoch-relative time that rule takes effect.
-*/
-
-static time_t
-transtime(const time_t janfirst, const int year, const struct rule *rulep,
- long offset)
-{
- register int leapyear;
- register time_t value;
- register int i;
- int d, m1, yy0, yy1, yy2, dow;
-
- INITIALIZE(value);
- leapyear = isleap(year);
- switch (rulep->r_type) {
-
- case JULIAN_DAY:
- /*
- ** Jn - Julian day, 1 == January 1, 60 == March 1 even in leap
- ** years.
- ** In non-leap years, or if the day number is 59 or less, just
- ** add SECSPERDAY times the day number-1 to the time of
- ** January 1, midnight, to get the day.
- */
- value = janfirst + (rulep->r_day - 1) * SECSPERDAY;
- if (leapyear && rulep->r_day >= 60)
- value += SECSPERDAY;
- break;
-
- case DAY_OF_YEAR:
- /*
- ** n - day of year.
- ** Just add SECSPERDAY times the day number to the time of
- ** January 1, midnight, to get the day.
- */
- value = janfirst + rulep->r_day * SECSPERDAY;
- break;
-
- case MONTH_NTH_DAY_OF_WEEK:
- /*
- ** Mm.n.d - nth "dth day" of month m.
- */
- value = janfirst;
- for (i = 0; i < rulep->r_mon - 1; ++i)
- value += mon_lengths[leapyear][i] * SECSPERDAY;
-
- /*
- ** Use Zeller's Congruence to get day-of-week of first day of
- ** month.
- */
- m1 = (rulep->r_mon + 9) % 12 + 1;
- yy0 = (rulep->r_mon <= 2) ? (year - 1) : year;
- yy1 = yy0 / 100;
- yy2 = yy0 % 100;
- dow = ((26 * m1 - 2) / 10 +
- 1 + yy2 + yy2 / 4 + yy1 / 4 - 2 * yy1) % 7;
- if (dow < 0)
- dow += DAYSPERWEEK;
-
- /*
- ** "dow" is the day-of-week of the first day of the month. Get
- ** the day-of-month (zero-origin) of the first "dow" day of the
- ** month.
- */
- d = rulep->r_day - dow;
- if (d < 0)
- d += DAYSPERWEEK;
- for (i = 1; i < rulep->r_week; ++i) {
- if (d + DAYSPERWEEK >=
- mon_lengths[leapyear][rulep->r_mon - 1])
- break;
- d += DAYSPERWEEK;
- }
-
- /*
- ** "d" is the day-of-month (zero-origin) of the day we want.
- */
- value += d * SECSPERDAY;
- break;
- }
-
- /*
- ** "value" is the Epoch-relative time of 00:00:00 UTC on the day in
- ** question. To get the Epoch-relative time of the specified local
- ** time on that day, add the transition time and the current offset
- ** from UTC.
- */
- return value + rulep->r_time + offset;
-}
-
-/*
-** Given a POSIX section 8-style TZ string, fill in the rule tables as
-** appropriate.
-*/
-
-static int
-tzparse(const char *name, struct state *sp, const int lastditch)
-{
- const char * stdname;
- const char * dstname;
- size_t stdlen;
- size_t dstlen;
- long stdoffset;
- long dstoffset;
- register time_t * atp;
- register unsigned char * typep;
- register char * cp;
- register int load_result;
-
- INITIALIZE(dstname);
- stdname = name;
- if (lastditch) {
- stdlen = strlen(name); /* length of standard zone name */
- name += stdlen;
- if (stdlen >= sizeof sp->chars)
- stdlen = (sizeof sp->chars) - 1;
- stdoffset = 0;
- } else {
- name = getzname(name);
- stdlen = name - stdname;
- if (stdlen < 3)
- return -1;
- if (*name == '\0')
- return -1;
- name = getoffset(name, &stdoffset);
- if (name == NULL)
- return -1;
- }
- load_result = tzload(TZDEFRULES, sp);
- if (load_result != 0)
- sp->leapcnt = 0; /* so, we're off a little */
- if (*name != '\0') {
- dstname = name;
- name = getzname(name);
- dstlen = name - dstname; /* length of DST zone name */
- if (dstlen < 3)
- return -1;
- if (*name != '\0' && *name != ',' && *name != ';') {
- name = getoffset(name, &dstoffset);
- if (name == NULL)
- return -1;
- } else dstoffset = stdoffset - SECSPERHOUR;
- if (*name == ',' || *name == ';') {
- struct rule start;
- struct rule end;
- register int year;
- register time_t janfirst;
- time_t starttime;
- time_t endtime;
-
- ++name;
- if ((name = getrule(name, &start)) == NULL)
- return -1;
- if (*name++ != ',')
- return -1;
- if ((name = getrule(name, &end)) == NULL)
- return -1;
- if (*name != '\0')
- return -1;
- sp->typecnt = 2; /* standard time and DST */
- /*
- ** Two transitions per year, from EPOCH_YEAR to 2037.
- */
- sp->timecnt = 2 * (2037 - EPOCH_YEAR + 1);
- if (sp->timecnt > TZ_MAX_TIMES)
- return -1;
- sp->ttis[0].tt_gmtoff = -dstoffset;
- sp->ttis[0].tt_isdst = 1;
- sp->ttis[0].tt_abbrind = stdlen + 1;
- sp->ttis[1].tt_gmtoff = -stdoffset;
- sp->ttis[1].tt_isdst = 0;
- sp->ttis[1].tt_abbrind = 0;
- atp = sp->ats;
- typep = sp->types;
- janfirst = 0;
- for (year = EPOCH_YEAR; year <= 2037; ++year) {
- starttime = transtime(janfirst, year, &start,
- stdoffset);
- endtime = transtime(janfirst, year, &end,
- dstoffset);
- if (starttime > endtime) {
- *atp++ = endtime;
- *typep++ = 1; /* DST ends */
- *atp++ = starttime;
- *typep++ = 0; /* DST begins */
- } else {
- *atp++ = starttime;
- *typep++ = 0; /* DST begins */
- *atp++ = endtime;
- *typep++ = 1; /* DST ends */
- }
- janfirst += year_lengths[isleap(year)] *
- SECSPERDAY;
- }
- } else {
- register long theirstdoffset;
- register long theirdstoffset;
- register long theiroffset;
- register int isdst;
- register int i;
- register int j;
-
- if (*name != '\0')
- return -1;
- if (load_result != 0)
- return -1;
- /*
- ** Initial values of theirstdoffset and theirdstoffset.
- */
- theirstdoffset = 0;
- for (i = 0; i < sp->timecnt; ++i) {
- j = sp->types[i];
- if (!sp->ttis[j].tt_isdst) {
- theirstdoffset =
- -sp->ttis[j].tt_gmtoff;
- break;
- }
- }
- theirdstoffset = 0;
- for (i = 0; i < sp->timecnt; ++i) {
- j = sp->types[i];
- if (sp->ttis[j].tt_isdst) {
- theirdstoffset =
- -sp->ttis[j].tt_gmtoff;
- break;
- }
- }
- /*
- ** Initially we're assumed to be in standard time.
- */
- isdst = FALSE;
- theiroffset = theirstdoffset;
- /*
- ** Now juggle transition times and types
- ** tracking offsets as you do.
- */
- for (i = 0; i < sp->timecnt; ++i) {
- j = sp->types[i];
- sp->types[i] = sp->ttis[j].tt_isdst;
- if (sp->ttis[j].tt_ttisgmt) {
- /* No adjustment to transition time */
- } else {
- /*
- ** If summer time is in effect, and the
- ** transition time was not specified as
- ** standard time, add the summer time
- ** offset to the transition time;
- ** otherwise, add the standard time
- ** offset to the transition time.
- */
- /*
- ** Transitions from DST to DDST
- ** will effectively disappear since
- ** POSIX provides for only one DST
- ** offset.
- */
- if (isdst && !sp->ttis[j].tt_ttisstd) {
- sp->ats[i] += dstoffset -
- theirdstoffset;
- } else {
- sp->ats[i] += stdoffset -
- theirstdoffset;
- }
- }
- theiroffset = -sp->ttis[j].tt_gmtoff;
- if (sp->ttis[j].tt_isdst)
- theirdstoffset = theiroffset;
- else theirstdoffset = theiroffset;
- }
- /*
- ** Finally, fill in ttis.
- ** ttisstd and ttisgmt need not be handled.
- */
- sp->ttis[0].tt_gmtoff = -stdoffset;
- sp->ttis[0].tt_isdst = FALSE;
- sp->ttis[0].tt_abbrind = 0;
- sp->ttis[1].tt_gmtoff = -dstoffset;
- sp->ttis[1].tt_isdst = TRUE;
- sp->ttis[1].tt_abbrind = stdlen + 1;
- sp->typecnt = 2;
- }
- } else {
- dstlen = 0;
- sp->typecnt = 1; /* only standard time */
- sp->timecnt = 0;
- sp->ttis[0].tt_gmtoff = -stdoffset;
- sp->ttis[0].tt_isdst = 0;
- sp->ttis[0].tt_abbrind = 0;
- }
- sp->charcnt = stdlen + 1;
- if (dstlen != 0)
- sp->charcnt += dstlen + 1;
- if ((size_t) sp->charcnt > sizeof sp->chars)
- return -1;
- cp = sp->chars;
- (void) strncpy(cp, stdname, stdlen);
- cp += stdlen;
- *cp++ = '\0';
- if (dstlen != 0) {
- (void) strncpy(cp, dstname, dstlen);
- *(cp + dstlen) = '\0';
- }
- return 0;
-}
-
-static void
-gmtload(struct state *sp)
-{
- if (tzload(gmt, sp) != 0)
- (void) tzparse(gmt, sp, TRUE);
-}
-
-#ifndef STD_INSPIRED
-/*
-** A non-static declaration of tzsetwall in a system header file
-** may cause a warning about this upcoming static declaration...
-*/
-static
-#endif /* !defined STD_INSPIRED */
-void
-tzsetwall P((void))
-{
- if (lcl_is_set < 0)
- return;
- lcl_is_set = -1;
-
-#ifdef ALL_STATE
- if (lclptr == NULL) {
- lclptr = (struct state *) malloc(sizeof *lclptr);
- if (lclptr == NULL) {
- settzname(); /* all we can do */
- return;
- }
- }
-#endif /* defined ALL_STATE */
-#if defined (_WIN32) || defined (__CYGWIN__)
-#define is_upper(c) ((unsigned)(c) - 'A' <= 26)
- {
- TIME_ZONE_INFORMATION tz;
- char buf[BUFSIZ];
- char *cp, *dst;
- wchar_t *src;
- div_t d;
- GetTimeZoneInformation(&tz);
- dst = cp = buf;
- for (src = tz.StandardName; *src; src++)
- if (is_upper(*src)) *dst++ = *src;
- if ((dst - cp) < 3)
- {
- /* In non-english Windows, converted tz.StandardName
- may not contain a valid standard timezone name. */
- strcpy(cp, wildabbr);
- cp += strlen(wildabbr);
- }
- else
- cp = dst;
- d = div(tz.Bias+tz.StandardBias, 60);
- sprintf(cp, "%d", d.quot);
- if (d.rem)
- sprintf(cp=strchr(cp, 0), ":%d", abs(d.rem));
- if(tz.StandardDate.wMonth) {
- cp = strchr(cp, 0);
- dst = cp;
- for (src = tz.DaylightName; *src; src++)
- if (is_upper(*src)) *dst++ = *src;
- if ((dst - cp) < 3)
- {
- /* In non-english Windows, converted tz.DaylightName
- may not contain a valid daylight timezone name. */
- strcpy(cp, wildabbr);
- cp += strlen(wildabbr);
- }
- else
- cp = dst;
- d = div(tz.Bias+tz.DaylightBias, 60);
- sprintf(cp, "%d", d.quot);
- if (d.rem)
- sprintf(cp=strchr(cp, 0), ":%d", abs(d.rem));
- cp = strchr(cp, 0);
- sprintf(cp=strchr(cp, 0), ",M%d.%d.%d/%d",
- tz.DaylightDate.wMonth,
- tz.DaylightDate.wDay,
- tz.DaylightDate.wDayOfWeek,
- tz.DaylightDate.wHour);
- if (tz.DaylightDate.wMinute || tz.DaylightDate.wSecond)
- sprintf(cp=strchr(cp, 0), ":%d", tz.DaylightDate.wMinute);
- if (tz.DaylightDate.wSecond)
- sprintf(cp=strchr(cp, 0), ":%d", tz.DaylightDate.wSecond);
- cp = strchr(cp, 0);
- sprintf(cp=strchr(cp, 0), ",M%d.%d.%d/%d",
- tz.StandardDate.wMonth,
- tz.StandardDate.wDay,
- tz.StandardDate.wDayOfWeek,
- tz.StandardDate.wHour);
- if (tz.StandardDate.wMinute || tz.StandardDate.wSecond)
- sprintf(cp=strchr(cp, 0), ":%d", tz.StandardDate.wMinute);
- if (tz.StandardDate.wSecond)
- sprintf(cp=strchr(cp, 0), ":%d", tz.StandardDate.wSecond);
- }
- /* printf("TZ deduced as `%s'\n", buf); */
- if (tzparse(buf, lclptr, FALSE) == 0) {
- settzname();
- setenv("TZ", buf, 1);
- return;
- }
- }
-#endif
- if (tzload((char *) NULL, lclptr) != 0)
- gmtload(lclptr);
- settzname();
-}
-
-extern "C" void
-tzset P((void))
-{
- const char * name = getenv("TZ");
-
- if (name == NULL) {
- tzsetwall();
- return;
- }
-
- if (lcl_is_set > 0 && strcmp(lcl_TZname, name) == 0)
- return;
- lcl_is_set = (strlen(name) < sizeof(lcl_TZname));
- if (lcl_is_set)
- (void) strcpy(lcl_TZname, name);
-
-#ifdef ALL_STATE
- if (lclptr == NULL) {
- lclptr = (struct state *) malloc(sizeof *lclptr);
- if (lclptr == NULL) {
- settzname(); /* all we can do */
- return;
- }
- }
-#endif /* defined ALL_STATE */
- if (*name == '\0') {
- /*
- ** User wants it fast rather than right.
- */
- lclptr->leapcnt = 0; /* so, we're off a little */
- lclptr->timecnt = 0;
- lclptr->ttis[0].tt_gmtoff = 0;
- lclptr->ttis[0].tt_abbrind = 0;
- (void) strcpy(lclptr->chars, gmt);
- } else if (tzload(name, lclptr) != 0) {
- if (name[0] == ':' || tzparse(name, lclptr, FALSE) != 0)
- (void) gmtload(lclptr);
- }
- settzname();
-}
-
-/*
-** The easy way to behave "as if no library function calls" localtime
-** is to not call it--so we drop its guts into "localsub", which can be
-** freely called. (And no, the PANS doesn't require the above behavior--
-** but it *is* desirable.)
-**
-** The unused offset argument is for the benefit of mktime variants.
-*/
-
-/*ARGSUSED*/
-static void
-localsub (const time_t * const timep,
- const long offset,
- struct tm * const tmp)
-{
- register struct state * sp;
- register const struct ttinfo * ttisp;
- register int i;
- const time_t t = *timep;
-
- sp = lclptr;
-#ifdef ALL_STATE
- if (sp == NULL) {
- gmtsub(timep, offset, tmp);
- return;
- }
-#endif /* defined ALL_STATE */
- if (sp->timecnt == 0 || t < sp->ats[0]) {
- i = 0;
- while (sp->ttis[i].tt_isdst)
- if (++i >= sp->typecnt) {
- i = 0;
- break;
- }
- } else {
- for (i = 1; i < sp->timecnt; ++i)
- if (t < sp->ats[i])
- break;
- i = sp->types[i - 1];
- }
- ttisp = &sp->ttis[i];
- /*
- ** To get (wrong) behavior that's compatible with System V Release 2.0
- ** you'd replace the statement below with
- ** t += ttisp->tt_gmtoff;
- ** timesub(&t, 0L, sp, tmp);
- */
- timesub(&t, ttisp->tt_gmtoff, sp, tmp);
- tmp->tm_isdst = ttisp->tt_isdst;
- tzname[tmp->tm_isdst] = &sp->chars[ttisp->tt_abbrind];
-#ifdef TM_ZONE
- tmp->TM_ZONE = &sp->chars[ttisp->tt_abbrind];
-#endif /* defined TM_ZONE */
-}
-
-extern "C" struct tm *
-localtime(const time_t *timep)
-{
- tzset();
- localsub(timep, 0L, &tm);
- return &tm;
-}
-
-/*
- * Re-entrant version of localtime
- */
-extern "C" struct tm *
-localtime_r(const time_t *timep, struct tm *tm)
-{
- localsub(timep, 0L, tm);
- return tm;
-}
-
-/*
-** gmtsub is to gmtime as localsub is to localtime.
-*/
-
-static void
-gmtsub(const time_t *timep, const long offset, struct tm *tmp)
-{
- if (!gmt_is_set) {
- gmt_is_set = TRUE;
-#ifdef ALL_STATE
- gmtptr = (struct state *) malloc(sizeof *gmtptr);
- if (gmtptr != NULL)
-#endif /* defined ALL_STATE */
- gmtload(gmtptr);
- }
- timesub(timep, offset, gmtptr, tmp);
-#ifdef TM_ZONE
- /*
- ** Could get fancy here and deliver something such as
- ** "UTC+xxxx" or "UTC-xxxx" if offset is non-zero,
- ** but this is no time for a treasure hunt.
- */
- if (offset != 0)
- tmp->TM_ZONE = wildabbr;
- else {
-#ifdef ALL_STATE
- if (gmtptr == NULL)
- tmp->TM_ZONE = gmt;
- else tmp->TM_ZONE = gmtptr->chars;
-#endif /* defined ALL_STATE */
-#ifndef ALL_STATE
- tmp->TM_ZONE = gmtptr->chars;
-#endif /* State Farm */
- }
-#endif /* defined TM_ZONE */
-}
-
-extern "C" struct tm *
-gmtime(const time_t *timep)
-{
- gmtsub(timep, 0L, &tm);
- return &tm;
-}
-
-/*
- * Re-entrant version of gmtime
- */
-extern "C" struct tm *
-gmtime_r(const time_t *timep, struct tm *tm)
-{
- gmtsub(timep, 0L, tm);
- return tm;
-}
-
-#ifdef STD_INSPIRED
-
-extern "C" struct tm *
-offtime(const time_t *timep, const long offset)
-{
- gmtsub(timep, offset, &tm);
- return &tm;
-}
-
-#endif /* defined STD_INSPIRED */
-
-static void
-timesub(const time_t *timep, const long offset, const struct state *sp,
- struct tm *tmp)
-{
- register const struct lsinfo * lp;
- register long days;
- register long rem;
- register int y;
- register int yleap;
- register const int * ip;
- register long corr;
- register int hit;
- register int i;
-
- corr = 0;
- hit = 0;
-#ifdef ALL_STATE
- i = (sp == NULL) ? 0 : sp->leapcnt;
-#endif /* defined ALL_STATE */
-#ifndef ALL_STATE
- i = sp->leapcnt;
-#endif /* State Farm */
- while (--i >= 0) {
- lp = &sp->lsis[i];
- if (*timep >= lp->ls_trans) {
- if (*timep == lp->ls_trans) {
- hit = ((i == 0 && lp->ls_corr > 0) ||
- lp->ls_corr > sp->lsis[i - 1].ls_corr);
- if (hit)
- while (i > 0 &&
- sp->lsis[i].ls_trans ==
- sp->lsis[i - 1].ls_trans + 1 &&
- sp->lsis[i].ls_corr ==
- sp->lsis[i - 1].ls_corr + 1) {
- ++hit;
- --i;
- }
- }
- corr = lp->ls_corr;
- break;
- }
- }
- days = *timep / SECSPERDAY;
- rem = *timep % SECSPERDAY;
-#ifdef mc68k
- if (*timep == 0x80000000) {
- /*
- ** A 3B1 muffs the division on the most negative number.
- */
- days = -24855;
- rem = -11648;
- }
-#endif /* defined mc68k */
- rem += (offset - corr);
- while (rem < 0) {
- rem += SECSPERDAY;
- --days;
- }
- while (rem >= SECSPERDAY) {
- rem -= SECSPERDAY;
- ++days;
- }
- tmp->tm_hour = (int) (rem / SECSPERHOUR);
- rem = rem % SECSPERHOUR;
- tmp->tm_min = (int) (rem / SECSPERMIN);
- /*
- ** A positive leap second requires a special
- ** representation. This uses "... ??:59:60" et seq.
- */
- tmp->tm_sec = (int) (rem % SECSPERMIN) + hit;
- tmp->tm_wday = (int) ((EPOCH_WDAY + days) % DAYSPERWEEK);
- if (tmp->tm_wday < 0)
- tmp->tm_wday += DAYSPERWEEK;
- y = EPOCH_YEAR;
-#define LEAPS_THRU_END_OF(y) ((y) / 4 - (y) / 100 + (y) / 400)
- while (days < 0 || days >= (long) year_lengths[yleap = isleap(y)]) {
- register int newy;
-
- newy = y + days / DAYSPERNYEAR;
- if (days < 0)
- --newy;
- days -= (newy - y) * DAYSPERNYEAR +
- LEAPS_THRU_END_OF(newy - 1) -
- LEAPS_THRU_END_OF(y - 1);
- y = newy;
- }
- tmp->tm_year = y - TM_YEAR_BASE;
- tmp->tm_yday = (int) days;
- ip = mon_lengths[yleap];
- for (tmp->tm_mon = 0; days >= (long) ip[tmp->tm_mon]; ++(tmp->tm_mon))
- days = days - (long) ip[tmp->tm_mon];
- tmp->tm_mday = (int) (days + 1);
- tmp->tm_isdst = 0;
-#ifdef TM_GMTOFF
- tmp->TM_GMTOFF = offset;
-#endif /* defined TM_GMTOFF */
-}
-
-extern "C" char *
-ctime(const time_t *timep)
-{
-/*
-** Section 4.12.3.2 of X3.159-1989 requires that
-** The ctime function converts the calendar time pointed to by timer
-** to local time in the form of a string. It is equivalent to
-** asctime(localtime(timer))
-*/
- return asctime(localtime(timep));
-}
-
-extern "C" char *
-ctime_r(const time_t *timep, char *buf)
-{
- struct tm tm;
-
- return asctime_r(localtime_r(timep, &tm), buf);
-}
-
-/*
-** Adapted from code provided by Robert Elz, who writes:
-** The "best" way to do mktime I think is based on an idea of Bob
-** Kridle's (so its said...) from a long time ago.
-** [kridle@xinet.com as of 1996-01-16.]
-** It does a binary search of the time_t space. Since time_t's are
-** just 32 bits, its a max of 32 iterations (even at 64 bits it
-** would still be very reasonable).
-*/
-
-#ifndef WRONG
-#define WRONG (-1)
-#endif /* !defined WRONG */
-
-/*
-** Simplified normalize logic courtesy Paul Eggert (eggert@twinsun.com).
-*/
-
-static int
-increment_overflow(int *number, int delta)
-{
- int number0;
-
- number0 = *number;
- *number += delta;
- return (*number < number0) != (delta < 0);
-}
-
-static int
-normalize_overflow(int *tensptr, int *unitsptr, const int base)
-{
- register int tensdelta;
-
- tensdelta = (*unitsptr >= 0) ?
- (*unitsptr / base) :
- (-1 - (-1 - *unitsptr) / base);
- *unitsptr -= tensdelta * base;
- return increment_overflow(tensptr, tensdelta);
-}
-
-static int
-tmcomp(register const struct tm *atmp, register const struct tm *btmp)
-{
- register int result;
-
- if ((result = (atmp->tm_year - btmp->tm_year)) == 0 &&
- (result = (atmp->tm_mon - btmp->tm_mon)) == 0 &&
- (result = (atmp->tm_mday - btmp->tm_mday)) == 0 &&
- (result = (atmp->tm_hour - btmp->tm_hour)) == 0 &&
- (result = (atmp->tm_min - btmp->tm_min)) == 0)
- result = atmp->tm_sec - btmp->tm_sec;
- return result;
-}
-
-static time_t
-time2sub(struct tm *tmp, void (*funcp) P((const time_t*, long, struct tm*)),
- const long offset, int *okayp, const int do_norm_secs)
-{
- register const struct state * sp;
- register int dir;
- register int bits;
- register int i, j ;
- register int saved_seconds;
- time_t newt;
- time_t t;
- struct tm yourtm, mytm;
-
- *okayp = FALSE;
- yourtm = *tmp;
- if (do_norm_secs) {
- if (normalize_overflow(&yourtm.tm_min, &yourtm.tm_sec,
- SECSPERMIN))
- return WRONG;
- }
- if (normalize_overflow(&yourtm.tm_hour, &yourtm.tm_min, MINSPERHOUR))
- return WRONG;
- if (normalize_overflow(&yourtm.tm_mday, &yourtm.tm_hour, HOURSPERDAY))
- return WRONG;
- if (normalize_overflow(&yourtm.tm_year, &yourtm.tm_mon, MONSPERYEAR))
- return WRONG;
- /*
- ** Turn yourtm.tm_year into an actual year number for now.
- ** It is converted back to an offset from TM_YEAR_BASE later.
- */
- if (increment_overflow(&yourtm.tm_year, TM_YEAR_BASE))
- return WRONG;
- while (yourtm.tm_mday <= 0) {
- if (increment_overflow(&yourtm.tm_year, -1))
- return WRONG;
- i = yourtm.tm_year + (1 < yourtm.tm_mon);
- yourtm.tm_mday += year_lengths[isleap(i)];
- }
- while (yourtm.tm_mday > DAYSPERLYEAR) {
- i = yourtm.tm_year + (1 < yourtm.tm_mon);
- yourtm.tm_mday -= year_lengths[isleap(i)];
- if (increment_overflow(&yourtm.tm_year, 1))
- return WRONG;
- }
- for ( ; ; ) {
- i = mon_lengths[isleap(yourtm.tm_year)][yourtm.tm_mon];
- if (yourtm.tm_mday <= i)
- break;
- yourtm.tm_mday -= i;
- if (++yourtm.tm_mon >= MONSPERYEAR) {
- yourtm.tm_mon = 0;
- if (increment_overflow(&yourtm.tm_year, 1))
- return WRONG;
- }
- }
- if (increment_overflow(&yourtm.tm_year, -TM_YEAR_BASE))
- return WRONG;
- if (yourtm.tm_year + TM_YEAR_BASE < EPOCH_YEAR) {
- /*
- ** We can't set tm_sec to 0, because that might push the
- ** time below the minimum representable time.
- ** Set tm_sec to 59 instead.
- ** This assumes that the minimum representable time is
- ** not in the same minute that a leap second was deleted from,
- ** which is a safer assumption than using 58 would be.
- */
- if (increment_overflow(&yourtm.tm_sec, 1 - SECSPERMIN))
- return WRONG;
- saved_seconds = yourtm.tm_sec;
- yourtm.tm_sec = SECSPERMIN - 1;
- } else {
- saved_seconds = yourtm.tm_sec;
- yourtm.tm_sec = 0;
- }
- /*
- ** Divide the search space in half
- ** (this works whether time_t is signed or unsigned).
- */
- bits = TYPE_BIT(time_t) - 1;
- /*
- ** If time_t is signed, then 0 is just above the median,
- ** assuming two's complement arithmetic.
- ** If time_t is unsigned, then (1 << bits) is just above the median.
- */
- t = TYPE_SIGNED(time_t) ? 0 : (((time_t) 1) << bits);
- for ( ; ; ) {
- (*funcp)(&t, offset, &mytm);
- dir = tmcomp(&mytm, &yourtm);
- if (dir != 0) {
- if (bits-- < 0)
- return WRONG;
- if (bits < 0)
- --t; /* may be needed if new t is minimal */
- else if (dir > 0)
- t -= ((time_t) 1) << bits;
- else t += ((time_t) 1) << bits;
- continue;
- }
- if (yourtm.tm_isdst < 0 || mytm.tm_isdst == yourtm.tm_isdst)
- break;
- /*
- ** Right time, wrong type.
- ** Hunt for right time, right type.
- ** It's okay to guess wrong since the guess
- ** gets checked.
- */
- /*
- ** The (void *) casts are the benefit of SunOS 3.3 on Sun 2's.
- */
- sp = (const struct state *)
- (((void *) funcp == (void *) localsub) ?
- lclptr : gmtptr);
-#ifdef ALL_STATE
- if (sp == NULL)
- return WRONG;
-#endif /* defined ALL_STATE */
- for (i = sp->typecnt - 1; i >= 0; --i) {
- if (sp->ttis[i].tt_isdst != yourtm.tm_isdst)
- continue;
- for (j = sp->typecnt - 1; j >= 0; --j) {
- if (sp->ttis[j].tt_isdst == yourtm.tm_isdst)
- continue;
- newt = t + sp->ttis[j].tt_gmtoff -
- sp->ttis[i].tt_gmtoff;
- (*funcp)(&newt, offset, &mytm);
- if (tmcomp(&mytm, &yourtm) != 0)
- continue;
- if (mytm.tm_isdst != yourtm.tm_isdst)
- continue;
- /*
- ** We have a match.
- */
- t = newt;
- goto label;
- }
- }
- return WRONG;
- }
-label:
- newt = t + saved_seconds;
- if ((newt < t) != (saved_seconds < 0))
- return WRONG;
- t = newt;
- (*funcp)(&t, offset, tmp);
- *okayp = TRUE;
- return t;
-}
-
-static time_t
-time2(struct tm *tmp, void (*funcp) P((const time_t*, long, struct tm*)),
- const long offset, int *okayp)
-{
- time_t t;
-
- /*
- ** First try without normalization of seconds
- ** (in case tm_sec contains a value associated with a leap second).
- ** If that fails, try with normalization of seconds.
- */
- t = time2sub(tmp, funcp, offset, okayp, FALSE);
- return *okayp ? t : time2sub(tmp, funcp, offset, okayp, TRUE);
-}
-
-static time_t
-time1(struct tm *tmp, void (*funcp) P((const time_t *, long, struct tm *)),
- const long offset)
-{
- register time_t t;
- register const struct state * sp;
- register int samei, otheri;
- int okay;
-
- if (tmp->tm_isdst > 1)
- tmp->tm_isdst = 1;
- t = time2(tmp, funcp, offset, &okay);
-#ifdef PCTS
- /*
- ** PCTS code courtesy Grant Sullivan (grant@osf.org).
- */
- if (okay)
- return t;
- if (tmp->tm_isdst < 0)
- tmp->tm_isdst = 0; /* reset to std and try again */
-#endif /* defined PCTS */
-#ifndef PCTS
- if (okay || tmp->tm_isdst < 0)
- return t;
-#endif /* !defined PCTS */
- /*
- ** We're supposed to assume that somebody took a time of one type
- ** and did some math on it that yielded a "struct tm" that's bad.
- ** We try to divine the type they started from and adjust to the
- ** type they need.
- */
- /*
- ** The (void *) casts are the benefit of SunOS 3.3 on Sun 2's.
- */
- sp = (const struct state *) (((void *) funcp == (void *) localsub) ?
- lclptr : gmtptr);
-#ifdef ALL_STATE
- if (sp == NULL)
- return WRONG;
-#endif /* defined ALL_STATE */
- for (samei = sp->typecnt - 1; samei >= 0; --samei) {
- if (sp->ttis[samei].tt_isdst != tmp->tm_isdst)
- continue;
- for (otheri = sp->typecnt - 1; otheri >= 0; --otheri) {
- if (sp->ttis[otheri].tt_isdst == tmp->tm_isdst)
- continue;
- tmp->tm_sec += sp->ttis[otheri].tt_gmtoff -
- sp->ttis[samei].tt_gmtoff;
- tmp->tm_isdst = !tmp->tm_isdst;
- t = time2(tmp, funcp, offset, &okay);
- if (okay)
- return t;
- tmp->tm_sec -= sp->ttis[otheri].tt_gmtoff -
- sp->ttis[samei].tt_gmtoff;
- tmp->tm_isdst = !tmp->tm_isdst;
- }
- }
- return WRONG;
-}
-
-extern "C" time_t
-mktime(struct tm *tmp)
-{
- tzset();
- return time1(tmp, localsub, 0L);
-}
-
-#ifdef STD_INSPIRED
-
-extern "C" time_t
-timelocal(struct tm *tmp)
-{
- tmp->tm_isdst = -1; /* in case it wasn't initialized */
- return mktime(tmp);
-}
-
-extern "C" time_t
-timegm(struct tm *tmp)
-{
- tmp->tm_isdst = 0;
- return time1(tmp, gmtsub, 0L);
-}
-
-extern "C" time_t
-timeoff(struct tm *tmp, const long offset)
-{
- tmp->tm_isdst = 0;
- return time1(tmp, gmtsub, offset);
-}
-
-#endif /* defined STD_INSPIRED */
-
-#ifdef CMUCS
-
-/*
-** The following is supplied for compatibility with
-** previous versions of the CMUCS runtime library.
-*/
-
-extern "C" long
-gtime(struct tm *tmp)
-{
- const time_t t = mktime(tmp);
-
- if (t == WRONG)
- return -1;
- return t;
-}
-
-#endif /* defined CMUCS */
-
-/*
-** XXX--is the below the right way to conditionalize??
-*/
-
-#ifdef STD_INSPIRED
-
-/*
-** IEEE Std 1003.1-1988 (POSIX) legislates that 536457599
-** shall correspond to "Wed Dec 31 23:59:59 UTC 1986", which
-** is not the case if we are accounting for leap seconds.
-** So, we provide the following conversion routines for use
-** when exchanging timestamps with POSIX conforming systems.
-*/
-
-static long
-leapcorr(time_t *timep)
-{
- register struct state * sp;
- register struct lsinfo * lp;
- register int i;
-
- sp = lclptr;
- i = sp->leapcnt;
- while (--i >= 0) {
- lp = &sp->lsis[i];
- if (*timep >= lp->ls_trans)
- return lp->ls_corr;
- }
- return 0;
-}
-
-extern "C" time_t
-time2posix(time_t t)
-{
- tzset();
- return t - leapcorr(&t);
-}
-
-extern "C" time_t
-posix2time(time_t t)
-{
- time_t x;
- time_t y;
-
- tzset();
- /*
- ** For a positive leap second hit, the result
- ** is not unique. For a negative leap second
- ** hit, the corresponding time doesn't exist,
- ** so we return an adjacent second.
- */
- x = t + leapcorr(&t);
- y = x - leapcorr(&x);
- if (y < t) {
- do {
- x++;
- y = x - leapcorr(&x);
- } while (y < t);
- if (t != y)
- return x - 1;
- } else if (y > t) {
- do {
- --x;
- y = x - leapcorr(&x);
- } while (y > t);
- if (t != y)
- return x + 1;
- }
- return x;
-}
-
-#endif /* defined STD_INSPIRED */
diff --git a/winsup/cygwin/malloc_wrapper.cc b/winsup/cygwin/malloc_wrapper.cc
deleted file mode 100644
index ee039f30f..000000000
--- a/winsup/cygwin/malloc_wrapper.cc
+++ /dev/null
@@ -1,246 +0,0 @@
-/* malloc.cc
-
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-
- Originally written by Steve Chamberlain of Cygnus Support
- sac@cygnus.com
-
-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 "winsup.h"
-#include <stdlib.h>
-#include <assert.h>
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include <errno.h>
-#include "cygerrno.h"
-#include "cygheap.h"
-#include "heap.h"
-#include "sync.h"
-#include "perprocess.h"
-
-/* we provide these stubs to call into a user's
- provided malloc if there is one - otherwise
- functions we provide - like strdup will cause
- problems if malloced on our heap and free'd on theirs.
-*/
-
-static int export_malloc_called;
-static int use_internal_malloc = 1;
-
-#undef in
-#undef out
-#define in(x)
-#define out(x)
-
-#ifdef MALLOC_DEBUG
-extern "C" void * _sbrk (size_t incr_arg);
-
-#if 0
-extern "C" void *
-_sbrk_r (struct _reent *, size_t incr_arg)
-{
- return _sbrk (incr_arg);
-}
-#endif
-
-extern "C" void *
-_malloc_r (struct _reent *, size_t size)
-{
- export_malloc_called = 1;
- return malloc (size);
-}
-#undef malloc
-
-extern "C" void *
-_calloc_r (struct _reent *, size_t nmemb, size_t size)
-{
- export_malloc_called = 1;
- return calloc (nmemb, size);
-}
-#undef calloc
-
-extern "C" void
-_free_r (struct _reent *, void *p)
-{
- export_malloc_called = 1;
- assert (!incygheap (p));
- assert (inheap (p));
- free (p);
-}
-#undef free
-
-extern "C" void *
-_realloc_r (struct _reent *, void *p, size_t size)
-{
- export_malloc_called = 1;
- assert (!incygheap (p));
- assert (inheap (p));
- return realloc (p, size);
-}
-#undef realloc
-
-extern "C" char *
-strdup_dbg (const char *s, const char *file, int line)
-{
- char *p;
- export_malloc_called = 1;
- if ((p = (char *) malloc_dbg (strlen (s) + 1, file, line)) != NULL)
- strcpy (p, s);
- return p;
-}
-
-#undef strdup
-extern "C" char *
-strdup (const char *s)
-{
- return strdup_dbg (s, __FILE__, __LINE__);
-}
-#else
-/* Call though the application pointer,
- which either points to export_malloc, or the application's
- own version. */
-
-void *
-malloc (size_t size)
-{
- void *res;
- res = user_data->malloc (size);
- return res;
-}
-
-void
-free (void *p)
-{
- user_data->free (p);
-}
-
-void *
-realloc (void *p, size_t size)
-{
- void *res;
- res = user_data->realloc (p, size);
- return res;
-}
-
-void *
-calloc (size_t nmemb, size_t size)
-{
- void *res;
- res = user_data->calloc (nmemb, size);
- return res;
-}
-
-extern "C" char *
-strdup (const char *s)
-{
- char *p;
- size_t len = strlen (s) + 1;
- if ((p = (char *) malloc (len)) != NULL)
- memcpy (p, s, len);
- return p;
-}
-
-extern "C" char *
-_strdup_r (struct _reent *, const char *s)
-{
- return strdup (s);
-}
-#endif
-
-/* These routines are used by the application if it
- doesn't provide its own malloc. */
-
-extern "C" void
-export_free (void *p)
-{
- malloc_printf ("(%p), called by %x", p, ((int *)&p)[-1]);
- if (use_internal_malloc)
- _free_r (_impure_ptr, p);
- else
- user_data->free (p);
-}
-
-extern "C" void *
-export_malloc (int size)
-{
- void *res;
- export_malloc_called = 1;
- if (use_internal_malloc)
- res = _malloc_r (_impure_ptr, size);
- else
- res = user_data->malloc (size);
- malloc_printf ("(%d) = %x, called by %x", size, res, ((int *)&size)[-1]);
- return res;
-}
-
-extern "C" void *
-export_realloc (void *p, int size)
-{
- void *res;
- if (use_internal_malloc)
- res = _realloc_r (_impure_ptr, p, size);
- else
- res = user_data->realloc (p, size);
- malloc_printf ("(%x, %d) = %x, called by %x", p, size, res, ((int *)&p)[-1]);
- return res;
-}
-
-extern "C" void *
-export_calloc (size_t nmemb, size_t size)
-{
- void *res;
- if (use_internal_malloc)
- res = _calloc_r (_impure_ptr, nmemb, size);
- else
- res = user_data->calloc (nmemb, size);
- malloc_printf ("(%d, %d) = %x, called by %x", nmemb, size, res, ((int *)&nmemb)[-1]);
- return res;
-}
-
-/* We use a critical section to lock access to the malloc data
- structures. This permits malloc to be called from different
- threads. Note that it does not make malloc reentrant, and it does
- not permit a signal handler to call malloc. The malloc code in
- newlib will call __malloc_lock and __malloc_unlock at appropriate
- times. */
-
-static NO_COPY muto *mprotect = NULL;
-
-void
-malloc_init ()
-{
- new_muto (mprotect);
- /* Check if mallock is provided by application. If so, redirect all
- calls to export_malloc/free/realloc to application provided. This may
- happen if some other dll calls cygwin's malloc, but main code provides
- its own malloc */
- if (!user_data->forkee)
- {
-#ifdef MALLOC_DEBUG
- _free_r (NULL, _malloc_r (NULL, 16));
-#else
- free (malloc (16));
-#endif
- if (!export_malloc_called)
- use_internal_malloc = 0;
- }
-}
-
-extern "C" void
-__malloc_lock (struct _reent *)
-{
- mprotect->acquire ();
-}
-
-extern "C" void
-__malloc_unlock (struct _reent *)
-{
- mprotect->release ();
-}
diff --git a/winsup/cygwin/mcount.c b/winsup/cygwin/mcount.c
deleted file mode 100644
index dcdbc2b06..000000000
--- a/winsup/cygwin/mcount.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/*-
- * Copyright (c) 1983, 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if !defined(lint) && !defined(_KERNEL) && defined(LIBC_SCCS)
-static char rcsid[] = "$OpenBSD: mcount.c,v 1.6 1997/07/23 21:11:27 kstailey Exp $";
-#endif
-
-#include <sys/param.h>
-#include <sys/types.h>
-#include <gmon.h>
-
-/*
- * mcount is called on entry to each function compiled with the profiling
- * switch set. _mcount(), which is declared in a machine-dependent way
- * with _MCOUNT_DECL, does the actual work and is either inlined into a
- * C routine or called by an assembly stub. In any case, this magic is
- * taken care of by the MCOUNT definition in <machine/profile.h>.
- *
- * _mcount updates data structures that represent traversals of the
- * program's call graph edges. frompc and selfpc are the return
- * address and function address that represents the given call graph edge.
- *
- * Note: the original BSD code used the same variable (frompcindex) for
- * both frompcindex and frompc. Any reasonable, modern compiler will
- * perform this optimization.
- */
-//_MCOUNT_DECL __P((u_long frompc, u_long selfpc));
-_MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */
- register u_long frompc, selfpc;
-{
- register u_short *frompcindex;
- register struct tostruct *top, *prevtop;
- register struct gmonparam *p;
- register long toindex;
-
- p = &_gmonparam;
- /*
- * check that we are profiling
- * and that we aren't recursively invoked.
- */
- if (p->state != GMON_PROF_ON)
- return;
- p->state = GMON_PROF_BUSY;
- /*
- * check that frompcindex is a reasonable pc value.
- * for example: signal catchers get called from the stack,
- * not from text space. too bad.
- */
- frompc -= p->lowpc;
- if (frompc > p->textsize)
- goto done;
-
-#if (HASHFRACTION & (HASHFRACTION - 1)) == 0
- if (p->hashfraction == HASHFRACTION)
- frompcindex =
- &p->froms[frompc / (HASHFRACTION * sizeof(*p->froms))];
- else
-#endif
- frompcindex =
- &p->froms[frompc / (p->hashfraction * sizeof(*p->froms))];
- toindex = *frompcindex;
- if (toindex == 0) {
- /*
- * first time traversing this arc
- */
- toindex = ++p->tos[0].link;
- if (toindex >= p->tolimit)
- /* halt further profiling */
- goto overflow;
-
- *frompcindex = toindex;
- top = &p->tos[toindex];
- top->selfpc = selfpc;
- top->count = 1;
- top->link = 0;
- goto done;
- }
- top = &p->tos[toindex];
- if (top->selfpc == selfpc) {
- /*
- * arc at front of chain; usual case.
- */
- top->count++;
- goto done;
- }
- /*
- * have to go looking down chain for it.
- * top points to what we are looking at,
- * prevtop points to previous top.
- * we know it is not at the head of the chain.
- */
- for (; /* goto done */; ) {
- if (top->link == 0) {
- /*
- * top is end of the chain and none of the chain
- * had top->selfpc == selfpc.
- * so we allocate a new tostruct
- * and link it to the head of the chain.
- */
- toindex = ++p->tos[0].link;
- if (toindex >= p->tolimit)
- goto overflow;
-
- top = &p->tos[toindex];
- top->selfpc = selfpc;
- top->count = 1;
- top->link = *frompcindex;
- *frompcindex = toindex;
- goto done;
- }
- /*
- * otherwise, check the next arc on the chain.
- */
- prevtop = top;
- top = &p->tos[top->link];
- if (top->selfpc == selfpc) {
- /*
- * there it is.
- * increment its count
- * move it to the head of the chain.
- */
- top->count++;
- toindex = prevtop->link;
- prevtop->link = top->link;
- top->link = *frompcindex;
- *frompcindex = toindex;
- goto done;
- }
- }
-done:
- p->state = GMON_PROF_ON;
- return;
-overflow:
- p->state = GMON_PROF_ERROR;
- return;
-}
-
-/*
- * Actual definition of mcount function. Defined in <machine/profile.h>,
- * which is included by <sys/gmon.h>
- */
-MCOUNT
-
diff --git a/winsup/cygwin/misc-std.sgml b/winsup/cygwin/misc-std.sgml
deleted file mode 100644
index 01ac231cd..000000000
--- a/winsup/cygwin/misc-std.sgml
+++ /dev/null
@@ -1,74 +0,0 @@
-<sect1 id="std-misc">
-<title>Compatibility with Miscellaneous Other Standards</title>
-
-<para>The following functions are compatible with miscellaneous other
-standards:</para>
-
-
-<sect2><title>Networking</title>
-
-<para>(Standardized by POSIX 1.g, which is probably still in draft?)</para>
-
-<para>accept, bind, connect, getdomainname, gethostbyaddr,
-gethostbyname, getpeername, getprotobyname, getprotobynumber,
-getservbyname, getservbyport, getsockname, getsockopt, herror, htonl,
-htons, inet_addr, inet_makeaddr, inet_netof, inet_ntoa, listen, ntohl,
-ntohs, rcmd, recv, recvfrom, rexec, rresvport, send, sendto,
-setsockopt, shutdown, socket, socketpair</para>
-
-<para>Of these networking calls, rexec, rcmd and rresvport are
-implemented in MS IP stack but may not be implemented in other
-vendors' stacks. </para>
-
-</sect2>
-
-<sect2><title>Other</title><para>
-
-chroot, closelog, cwait, dlclose, dlerror, dlfork, dlopen, dlsym,
-endgrent, ffs, fstatfs, ftime, get_osfhandle, getdtablesize, getgrent,
-gethostname, getitimer, getmntent, getpagesize, getpgid, getpwent,
-gettimeofday, grantpt, initgroups, ioctl, killpg, login, logout,
-lstat, mknod, memccpy, nice, openlog, pclose, popen, ptsname, putenv,
-random, readv, realpath, regfree, rexec, select, setegid setenv,
-seterrno, seteuid, setitimer, setmntent, setmode, setpassent, setpgrp,
-setpwent, settimeofday, sexecl, sexecle, sexeclp, sexeclpe, sexeclpe,
-sexecp, sexecv, sexecve, sexecvpe, sigpause, spawnl, spawnle, spawnlp,
-spawnlpe, spawnv, spawnve, spawnvp, spawnvpe, srandom, statfs,
-strsignal, strtosigno, swab, syslog, timezone, truncate, ttyslot,
-unlockpt, unsetenv, usleep, utimes, vfork, vhangup, wait3, wait4,
-wcscmp, wcslen, wprintf, writev
-
-</para></sect2>
-<sect2><title>Implementation Notes</title>
-
-<para> <function>initgroups</function> does nothing</para>
-
-<para> <function>chroot</function>, <function>mknod</function>,
-<function>settimeofday</function>, and <function>vhangup</function>
-always return -1 and sets errno to ENOSYS.</para>
-
-<para> <function>nice</function> allows Cygwin programs to alter their
-current runtime priority through the use of its incr argument. Cygwin
-processes can be set to IDLE_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS,
-HIGH_PRIORITY_CLASS, or REALTIME_PRIORITY_CLASS with the
-<function>nice</function> call. NORMAL_PRIORITY_CLASS is the
-default. If you pass a positive number to nice(), then the priority
-level will decrease by one (within the above list of priorities). A
-negative number would make it increase by one. It is not possible to
-change it by more than one at a time without making repeated calls.
-An increment above REALTIME_PRIORITY_CLASS results in the process
-staying at that priority. Likewise, a decrement to
-IDLE_PRIORITY_CLASS has it stay at that priority. Note that in the
-Win32 API, there are 32 priorities. So currently we only give access
-to four of these through <function>nice</function>.</para>
-
-<para> <function>seteuid</function> and <function>setegid</function>
-always return 0 and set errno to
-ENOSYS.</para>
-
-<para><function>vfork</function> just calls
-<function>fork</function></para>
-
-</sect2>
-
-</sect1>
diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc
deleted file mode 100644
index 5d3010470..000000000
--- a/winsup/cygwin/miscfuncs.cc
+++ /dev/null
@@ -1,178 +0,0 @@
-/* miscfuncs.cc: misc funcs that don't belong anywhere else
-
- Copyright 1996, 1997, 1998, 1999, 2000 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 "winsup.h"
-#include "cygerrno.h"
-#include <sys/errno.h>
-
-long tls_ix = -1;
-
-const char case_folded_lower[] NO_COPY = {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, '!', '"', '#', '$', '%', '&', 39, '(', ')', '*', '+', ',', '-', '.', '/',
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?',
- '@', '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', '[', 92, ']', '^', '_',
- '`', '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', '{', '|', '}', '~', 127,
- 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
- 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
- 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
- 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
- 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
- 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
- 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
-};
-
-const char case_folded_upper[] NO_COPY = {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, '!', '"', '#', '$', '%', '&', 39, '(', ')', '*', '+', ',', '-', '.', '/',
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?',
- '@', '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', '[', 92, ']', '^', '_',
- '`', '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', '{', '|', '}', '~', 127,
- 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
- 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
- 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
- 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
- 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
- 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
- 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
-};
-
-#define ch_case_eq(ch1, ch2) (cyg_tolower(ch1) == cyg_tolower(ch2))
-
-/* Return TRUE if two strings match up to length n */
-extern "C" int __stdcall
-strncasematch (const char *s1, const char *s2, size_t n)
-{
- if (s1 == s2)
- return 1;
-
- n++;
- while (--n && *s1)
- {
- if (!ch_case_eq (*s1, *s2))
- return 0;
- s1++; s2++;
- }
- return !n || *s2 == '\0';
-}
-
-/* Return TRUE if two strings match */
-extern "C" int __stdcall
-strcasematch (const char *s1, const char *s2)
-{
- if (s1 == s2)
- return 1;
-
- while (*s1)
- {
- if (!ch_case_eq (*s1, *s2))
- return 0;
- s1++; s2++;
- }
- return *s2 == '\0';
-}
-
-extern "C" char * __stdcall
-strcasestr (const char *searchee, const char *lookfor)
-{
- if (*searchee == 0)
- {
- if (*lookfor)
- return NULL;
- return (char *) searchee;
- }
-
- while (*searchee)
- {
- int i = 0;
- while (1)
- {
- if (lookfor[i] == 0)
- return (char *) searchee;
-
- if (!ch_case_eq (lookfor[i], searchee[i]))
- break;
- lookfor++;
- }
- searchee++;
- }
-
- return NULL;
-}
-
-int __stdcall
-check_null_str (const char *name)
-{
- if (name && !IsBadStringPtr (name, MAX_PATH))
- return 0;
-
- return EFAULT;
-}
-
-int __stdcall
-check_null_empty_str (const char *name)
-{
- if (name && !IsBadStringPtr (name, MAX_PATH))
- return !*name ? ENOENT : 0;
-
- return EFAULT;
-}
-
-int __stdcall
-check_null_empty_str_errno (const char *name)
-{
- int __err;
- if ((__err = check_null_empty_str (name)))
- set_errno (__err);
- return __err;
-}
-
-int __stdcall
-check_null_str_errno (const char *name)
-{
- int __err;
- if ((__err = check_null_str (name)))
- set_errno (__err);
- return __err;
-}
-
-int __stdcall
-__check_null_invalid_struct (const void *s, unsigned sz)
-{
- if (s && !IsBadWritePtr ((void *) s, sz))
- return 0;
-
- return EFAULT;
-}
-
-int __stdcall
-__check_null_invalid_struct_errno (const void *s, unsigned sz)
-{
- int err;
- if ((err = __check_null_invalid_struct (s, sz)))
- set_errno (err);
- return err;
-}
-
-int __stdcall
-__check_invalid_read_ptr_errno (const void *s, unsigned sz)
-{
- if (s && !IsBadReadPtr ((void *) s, sz))
- return 0;
- return set_errno (EFAULT);
-}
diff --git a/winsup/cygwin/mkvers.sh b/winsup/cygwin/mkvers.sh
deleted file mode 100755
index 3296b569a..000000000
--- a/winsup/cygwin/mkvers.sh
+++ /dev/null
@@ -1,177 +0,0 @@
-#!/bin/sh
-# mkvers.sh - Make version information for cygwin DLL
-#
-# Copyright 1998, 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.
-
-exec 9> version.cc
-
-#
-# Arg 1 is the name of the version include file
-#
-incfile="$1"
-rcfile="$2"
-windres="$3"
-
-[ -r $incfile ] || {
- echo "**** Couldn't open file '$incfile'. Aborting."
-}
-
-#
-# Load the current date so we can work on individual fields
-#
-build_date=`date`
-set -$- $build_date
-#
-# Translate the month into a number
-#
-case "$2" in
- Jan) m=01 ;;
- Feb) m=02 ;;
- Mar) m=03 ;;
- Apr) m=04 ;;
- May) m=05 ;;
- Jun) m=06 ;;
- Jul) m=07 ;;
- Aug) m=08 ;;
- Sep) m=09 ;;
- Oct) m=10 ;;
- Nov) m=11 ;;
- Dec) m=12 ;;
-esac
-
-if [ "$3" -le 10 ]; then
- d=0$3
-else
- d=$3
-fi
-hhmm="`echo $4 | sed 's/:..$//'`"
-#
-# Set date into YYYY-MM-DD HH:MM:SS format
-#
-builddate="${6-$5}-$m-$d $hhmm"
-
-set -$- ''
-
-#
-# Output the initial part of version.cc
-#
-cat <<EOF 1>&9
-#include "config.h"
-#include "cygwin_version.h"
-
-#define strval(x) #x
-#define str(x) strval(x)
-#define shared_data_version str(CYGWIN_VERSION_SHARED_DATA)
-
-const char *cygwin_version_strings =
- "BEGIN_CYGWIN_VERSION_INFO\n"
-EOF
-
-#
-# Split version file into dir and filename components
-#
-dir=`dirname $incfile`
-fn=`basename $incfile`
-
-#
-# Look in the include file CVS directory for a CVS Tag file. This file,
-# if it exists, will contain the name of the sticky tag associated with
-# the current build. Save that for output later.
-#
-cvs_tag="`sed 's%^.\(.*\)%\1%' $dir/CVS/Tag 2>/dev/null`"
-
-wv_cvs_tag="$cvs_tag"
-[ -n "$cvs_tag" ] && cvs_tag=" CVS tag"'
-'"$cvs_tag"
-
-#
-# Look in the source directory containing the include/cygwin/version.h
-# and set dir accordingly.
-dir=`echo $dir | sed -e 's%/include/cygwin.*$%%' -e 's%include/cygwin.*$%.%'`
-
-# Look in $dir for a a ".snapshot-date" file. If one is found then this
-# information will be saved for output to the DLL.
-#
-if [ -r "$dir/.snapshot-date" ]; then
- read snapshotdate < "$dir/.snapshot-date"
- snapshot="snapshot date
-$snapshotdate"
-fi
-
-#
-# Scan the version.h file for strings that begin with CYGWIN_INFO or
-# CYGWIN_VERSION. Perform crude parsing on the lines to get the values
-# associated with these values and then pipe it into a while loop which
-# outputs these values in C palatable format for inclusion in the DLL
-# with a '%% ' identifier that will introduce "interesting" strings.
-# These strings are strictly for use by a user to scan the DLL for
-# interesting information.
-#
-(sed -n -e 's%#define CYGWIN_INFO_\([A-Z_]*\)[ ][ ]*\([a-zA-Z0-9"][^/]*\).*%_\1\
-\2%p' -e 's%#define CYGWIN_VERSION_\([A-Z_]*\)[ ][ ]*\([a-zA-Z0-9"][^/]*\).*%_\1\
-\2%p' $incfile | sed -e 's/["\\]//g' -e '/^_/y/ABCDEFGHIJKLMNOPQRSTUVWXYZ_/abcdefghijklmnopqrstuvwxyz /';
-echo ' build date'; echo $build_date; [ -n "$cvs_tag" ] && echo "$cvs_tag";\
-[ -n "$snapshot" ] && echo "$snapshot"
-) | while read var; do
- read val
-cat <<EOF
- "%%% Cygwin $var: $val\n"
-EOF
-done | tee /tmp/mkvers.$$ 1>&9
-
-trap "rm -f /tmp/mkvers.$$" 0 1 2 15
-
-if [ -n "$snapshotdate" ]; then
- usedate="`echo $snapshotdate | sed 's/-\\(..:..[^-]*\\).*$/ \1SNP/'`"
-else
- usedate="$builddate"
-fi
-
-#
-# Finally, output the shared ID and set up the cygwin_version structure
-# for use by Cygwin itself.
-#
-cat <<EOF 1>&9
-#ifdef DEBUGGING
- "%%% Cygwin shared id: " CYGWIN_VERSION_DLL_IDENTIFIER "S" shared_data_version "-$builddate\n"
-#else
- "%%% Cygwin shared id: " CYGWIN_VERSION_DLL_IDENTIFIER "S" shared_data_version "\n"
-#endif
- "END_CYGWIN_VERSION_INFO\n\0";
-cygwin_version_info cygwin_version =
-{
- CYGWIN_VERSION_API_MAJOR, CYGWIN_VERSION_API_MINOR,
- CYGWIN_VERSION_DLL_MAJOR, CYGWIN_VERSION_DLL_MINOR,
- CYGWIN_VERSION_SHARED_DATA,
- CYGWIN_VERSION_MOUNT_REGISTRY,
- "$usedate",
-#ifdef DEBUGGING
- CYGWIN_VERSION_DLL_IDENTIFIER "S" shared_data_version "-$builddate"
-#else
- CYGWIN_VERSION_DLL_IDENTIFIER "S" shared_data_version
-#endif
-};
-EOF
-
-#
-# Generate winver.o using cygwin/version.h information.
-# Turn the cygwin major number from some large number to something like 1.1.0.
-#
-eval `sed -n 's/^.*dll \(m[ai][jn]or\): \([0-9]*\)[^0-9]*$/\1=\2/p' /tmp/mkvers.$$`
-cygverhigh=`expr $major / 1000`
-cygverlow=`expr $major % 1000`
-cygwin_ver="$cygverhigh.$cygverlow.$minor"
-if [ -n "$cvs_tag" ]; then
- cvs_tag="`echo $wv_cvs_tag | sed -e 's/-branch.*//'`"
- cygwin_ver="$cygwin_ver-$cvs_tag"
-fi
-
-echo "Version $cygwin_ver"
-set -$- $builddate
-$windres --include-dir $dir/../w32api/include --include-dir $dir/include --define CYGWIN_BUILD_DATE="$1" --define CYGWIN_BUILD_TIME="$2" --define CYGWIN_VERSION='"'"$cygwin_ver"'"' $rcfile winver.o
diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc
deleted file mode 100644
index c89cf4c7b..000000000
--- a/winsup/cygwin/mmap.cc
+++ /dev/null
@@ -1,989 +0,0 @@
-/* mmap.cc
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <unistd.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <sys/mman.h>
-#include <errno.h>
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygerrno.h"
-#include "cygheap.h"
-#include "pinfo.h"
-#include "sys/cygwin.h"
-
-#define PAGE_CNT(bytes) howmany(bytes,getpagesize())
-
-#define PGBITS (sizeof(DWORD)*8)
-#define MAPSIZE(pages) howmany(pages,PGBITS)
-
-#define MAP_SET(n) (map_map_[(n)/PGBITS] |= (1L << ((n) % PGBITS)))
-#define MAP_CLR(n) (map_map_[(n)/PGBITS] &= ~(1L << ((n) % PGBITS)))
-#define MAP_ISSET(n) (map_map_[(n)/PGBITS] & (1L << ((n) % PGBITS)))
-
-/*
- * Simple class used to keep a record of all current
- * mmap areas in a process. Needed so that
- * they can be duplicated after a fork().
- */
-
-class mmap_record
-{
- private:
- int fdesc_;
- HANDLE mapping_handle_;
- int devtype_;
- DWORD access_mode_;
- __off64_t offset_;
- DWORD size_to_map_;
- caddr_t base_address_;
- DWORD *map_map_;
-
- public:
- mmap_record (int fd, HANDLE h, DWORD ac, __off64_t o, DWORD s, caddr_t b) :
- fdesc_ (fd),
- mapping_handle_ (h),
- devtype_ (0),
- access_mode_ (ac),
- offset_ (o),
- size_to_map_ (s),
- base_address_ (b),
- map_map_ (NULL)
- {
- if (fd >= 0 && !cygheap->fdtab.not_open (fd))
- devtype_ = cygheap->fdtab[fd]->get_device ();
- }
-
- /* Default Copy constructor/operator=/destructor are ok */
-
- /* Simple accessors */
- int get_fd () const { return fdesc_; }
- HANDLE get_handle () const { return mapping_handle_; }
- DWORD get_device () const { return devtype_; }
- DWORD get_access () const { return access_mode_; }
- DWORD get_offset () const { return offset_; }
- DWORD get_size () const { return size_to_map_; }
- caddr_t get_address () const { return base_address_; }
- DWORD *get_map () const { return map_map_; }
-
- void alloc_map ()
- {
- /* Allocate one bit per page */
- map_map_ = (DWORD *) calloc (MAPSIZE(PAGE_CNT (size_to_map_)),
- sizeof (DWORD));
- if (wincap.virtual_protect_works_on_shared_pages ())
- {
- DWORD old_prot;
- if (!VirtualProtect (base_address_, size_to_map_,
- PAGE_NOACCESS, &old_prot))
- syscall_printf ("-1 = alloc_map (): %E");
- }
- }
- void free_map () { if (map_map_) free (map_map_); }
-
- DWORD find_empty (DWORD pages);
- __off64_t map_map (__off64_t off, DWORD len);
- BOOL unmap_map (caddr_t addr, DWORD len);
- void fixup_map (void);
- int access (char *address);
-
- fhandler_base *alloc_fh ();
- void free_fh (fhandler_base *fh);
-};
-
-DWORD
-mmap_record::find_empty (DWORD pages)
-{
- DWORD mapped_pages = PAGE_CNT (size_to_map_);
- DWORD start;
-
- if (pages > mapped_pages)
- return (DWORD)-1;
- for (start = 0; start <= mapped_pages - pages; ++start)
- if (!MAP_ISSET (start))
- {
- DWORD cnt;
- for (cnt = 0; cnt < pages; ++cnt)
- if (MAP_ISSET (start + cnt))
- break;
- if (cnt >= pages)
- return start;
- }
- return (DWORD)-1;
-}
-
-__off64_t
-mmap_record::map_map (__off64_t off, DWORD len)
-{
- DWORD prot, old_prot;
- switch (access_mode_)
- {
- case FILE_MAP_WRITE:
- prot = PAGE_READWRITE;
- break;
- case FILE_MAP_READ:
- prot = PAGE_READONLY;
- break;
- default:
- prot = PAGE_WRITECOPY;
- break;
- }
-
- len = PAGE_CNT (len);
- if (fdesc_ == -1 && !off)
- {
- off = find_empty (len);
- if (off != (DWORD)-1)
- {
- if (wincap.virtual_protect_works_on_shared_pages ()
- && !VirtualProtect (base_address_ + off * getpagesize (),
- len * getpagesize (), prot, &old_prot))
- {
- debug_printf ("-1 = map_map (): %E");
- return (__off64_t)-1;
- }
-
- while (len-- > 0)
- MAP_SET (off + len);
- return off * getpagesize ();
- }
- return 0L;
- }
- off -= offset_;
- DWORD start = off / getpagesize ();
- if (wincap.virtual_protect_works_on_shared_pages ()
- && !VirtualProtect (base_address_ + start * getpagesize (),
- len * getpagesize (), prot, &old_prot))
- {
- debug_printf ("-1 = map_map (): %E");
- return (__off64_t)-1;
- }
-
- for (; len-- > 0; ++start)
- MAP_SET (start);
- return off;
-}
-
-BOOL
-mmap_record::unmap_map (caddr_t addr, DWORD len)
-{
- DWORD old_prot;
- DWORD off = addr - base_address_;
- off /= getpagesize ();
- len = PAGE_CNT (len);
- if (wincap.virtual_protect_works_on_shared_pages ()
- && !VirtualProtect (base_address_ + off * getpagesize (),
- len * getpagesize (), PAGE_NOACCESS, &old_prot))
- syscall_printf ("-1 = unmap_map (): %E");
-
- for (; len-- > 0; ++off)
- MAP_CLR (off);
- /* Return TRUE if all pages are free'd which may result in unmapping
- the whole chunk. */
- for (len = MAPSIZE(PAGE_CNT (size_to_map_)); len > 0; )
- if (map_map_[--len])
- return FALSE;
- return TRUE;
-}
-
-void
-mmap_record::fixup_map ()
-{
- if (!wincap.virtual_protect_works_on_shared_pages ())
- return;
-
- DWORD prot, old_prot;
- switch (access_mode_)
- {
- case FILE_MAP_WRITE:
- prot = PAGE_READWRITE;
- break;
- case FILE_MAP_READ:
- prot = PAGE_READONLY;
- break;
- default:
- prot = PAGE_WRITECOPY;
- break;
- }
-
- for (DWORD off = PAGE_CNT (size_to_map_); off > 0; --off)
- VirtualProtect (base_address_ + off * getpagesize (),
- getpagesize (),
- MAP_ISSET (off - 1) ? prot : PAGE_NOACCESS,
- &old_prot);
-}
-
-int
-mmap_record::access (char *address)
-{
- if (address < base_address_ || address >= base_address_ + size_to_map_)
- return 0;
- DWORD off = (address - base_address_) / getpagesize ();
- return MAP_ISSET (off);
-}
-
-static fhandler_disk_file fh_paging_file;
-
-fhandler_base *
-mmap_record::alloc_fh ()
-{
- if (get_fd () == -1)
- {
- fh_paging_file.set_io_handle (INVALID_HANDLE_VALUE);
- return &fh_paging_file;
- }
-
- /* The file descriptor could have been closed or, even
- worse, could have been reused for another file before
- the call to fork(). This requires creating a fhandler
- of the correct type to be sure to call the method of the
- correct class. */
- return cygheap->fdtab.build_fhandler (-1, get_device ());
-}
-
-void
-mmap_record::free_fh (fhandler_base *fh)
-{
- if (get_fd () != -1)
- cfree (fh);
-}
-
-class list {
-public:
- mmap_record *recs;
- int nrecs, maxrecs;
- int fd;
- DWORD hash;
- list ();
- ~list ();
- mmap_record *add_record (mmap_record r);
- void erase (int i);
- void erase ();
- mmap_record *match (__off64_t off, DWORD len);
- long match (caddr_t addr, DWORD len, long start);
-};
-
-list::list ()
-: nrecs (0), maxrecs (10), fd (0), hash (0)
-{
- recs = (mmap_record *) malloc (10 * sizeof(mmap_record));
-}
-
-list::~list ()
-{
- for (mmap_record *rec = recs; nrecs-- > 0; ++rec)
- rec->free_map ();
- free (recs);
-}
-
-mmap_record *
-list::add_record (mmap_record r)
-{
- if (nrecs == maxrecs)
- {
- maxrecs += 5;
- recs = (mmap_record *) realloc (recs, maxrecs * sizeof (mmap_record));
- }
- recs[nrecs] = r;
- recs[nrecs].alloc_map ();
- return recs + nrecs++;
-}
-
-/* Used in mmap() */
-mmap_record *
-list::match (__off64_t off, DWORD len)
-{
- if (fd == -1 && !off)
- {
- len = PAGE_CNT (len);
- for (int i = 0; i < nrecs; ++i)
- if (recs[i].find_empty (len) != (DWORD)-1)
- return recs + i;
- }
- else
- {
- for (int i = 0; i < nrecs; ++i)
- if (off >= recs[i].get_offset ()
- && off + len <= recs[i].get_offset () + recs[i].get_size ())
- return recs + i;
- }
- return NULL;
-}
-
-/* Used in munmap() */
-long
-list::match (caddr_t addr, DWORD len, __off32_t start)
-{
- for (int i = start + 1; i < nrecs; ++i)
- if (addr >= recs[i].get_address ()
- && addr + len <= recs[i].get_address () + recs[i].get_size ())
- return i;
- return -1;
-}
-
-void
-list::erase (int i)
-{
- recs[i].free_map ();
- for (; i < nrecs-1; i++)
- recs[i] = recs[i+1];
- nrecs--;
-}
-
-void
-list::erase ()
-{
- erase (nrecs-1);
-}
-
-class map {
-public:
- list **lists;
- int nlists, maxlists;
- map ();
- ~map ();
- list *get_list_by_fd (int fd);
- list *add_list (list *l, int fd);
- void erase (int i);
-};
-
-map::map ()
-{
- lists = (list **) malloc (10 * sizeof(list *));
- nlists = 0;
- maxlists = 10;
-}
-
-map::~map ()
-{
- free (lists);
-}
-
-list *
-map::get_list_by_fd (int fd)
-{
- int i;
- for (i=0; i<nlists; i++)
-#if 0 /* The fd isn't sufficient since it could already be another file. */
- if (lists[i]->fd == fd
-#else /* so we use the name hash value to identify the file unless
- it's not an anonymous mapping. */
- if ((fd == -1 && lists[i]->fd == -1)
- || (fd != -1 && lists[i]->hash == cygheap->fdtab[fd]->get_namehash ()))
-#endif
- return lists[i];
- return 0;
-}
-
-list *
-map::add_list (list *l, int fd)
-{
- l->fd = fd;
- if (fd != -1)
- l->hash = cygheap->fdtab[fd]->get_namehash ();
- if (nlists == maxlists)
- {
- maxlists += 5;
- lists = (list **) realloc (lists, maxlists * sizeof (list *));
- }
- lists[nlists++] = l;
- return lists[nlists-1];
-}
-
-void
-map::erase (int i)
-{
- for (; i < nlists-1; i++)
- lists[i] = lists[i+1];
- nlists--;
-}
-
-/*
- * Code to keep a record of all mmap'ed areas in a process.
- * Needed to duplicate tham in a child of fork().
- * mmap_record classes are kept in an STL list in an STL map, keyed
- * by file descriptor. This is *NOT* duplicated accross a fork(), it
- * needs to be specially handled by the fork code.
- */
-
-static map *mmapped_areas;
-
-extern "C"
-caddr_t
-mmap64 (caddr_t addr, size_t len, int prot, int flags, int fd, __off64_t off)
-{
- syscall_printf ("addr %x, len %d, prot %x, flags %x, fd %d, off %D",
- addr, len, prot, flags, fd, off);
-
- static DWORD granularity;
- if (!granularity)
- {
- SYSTEM_INFO si;
- GetSystemInfo (&si);
- granularity = si.dwAllocationGranularity;
- }
-
- /* Error conditions according to SUSv2 */
- if (off % getpagesize ()
- || (!(flags & MAP_SHARED) && !(flags & MAP_PRIVATE))
- || ((flags & MAP_SHARED) && (flags & MAP_PRIVATE))
- || ((flags & MAP_FIXED) && ((DWORD)addr % granularity))
- || !len)
- {
- set_errno (EINVAL);
- syscall_printf ("-1 = mmap(): EINVAL");
- return MAP_FAILED;
- }
-
- SetResourceLock(LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap");
-
- if (mmapped_areas == NULL)
- {
- /* First mmap call, create STL map */
- mmapped_areas = new map;
- if (mmapped_areas == NULL)
- {
- set_errno (ENOMEM);
- syscall_printf ("-1 = mmap(): ENOMEM");
- ReleaseResourceLock(LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap");
- return MAP_FAILED;
- }
- }
-
- if (flags & MAP_ANONYMOUS)
- fd = -1;
-
- /* Map always in multipliers of `granularity'-sized chunks. */
- __off64_t gran_off = off & ~(granularity - 1);
- DWORD gran_len = howmany (len, granularity) * granularity;
-
- fhandler_base *fh;
- caddr_t base = addr;
- HANDLE h;
-
- if (fd != -1)
- {
- /* Ensure that fd is open */
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- {
- syscall_printf ("-1 = mmap(): EBADF");
- ReleaseResourceLock(LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap");
- return MAP_FAILED;
- }
- fh = cfd;
- if (fh->get_device () == FH_DISK)
- {
- DWORD high;
- DWORD low = GetFileSize (fh->get_handle (), &high);
- __off64_t fsiz = ((__off64_t)high << 32) + low;
- fsiz -= gran_off;
- if (gran_len > fsiz)
- gran_len = fsiz;
- }
- else if (fh->get_device () == FH_ZERO)
- /* mmap /dev/zero is like MAP_ANONYMOUS. */
- fd = -1;
- }
- if (fd == -1)
- {
- fh_paging_file.set_io_handle (INVALID_HANDLE_VALUE);
- fh = &fh_paging_file;
- }
-
- list *l = mmapped_areas->get_list_by_fd (fd);
-
- /* First check if this mapping matches into the chunk of another
- already performed mapping. Only valid for MAP_ANON in a special
- case of MAP_PRIVATE. */
- if (l && fd == -1 && off == 0 && !(flags & MAP_FIXED))
- {
- mmap_record *rec;
- if ((rec = l->match (off, len)) != NULL)
- {
- if ((off = rec->map_map (off, len)) == (__off64_t)-1)
- {
- set_errno (ENOMEM);
- syscall_printf ("-1 = mmap(): ENOMEM");
- ReleaseResourceLock(LOCK_MMAP_LIST, READ_LOCK|WRITE_LOCK, "mmap");
- return MAP_FAILED;
- }
- caddr_t ret = rec->get_address () + off;
- syscall_printf ("%x = mmap() succeeded", ret);
- ReleaseResourceLock(LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap");
- return ret;
- }
- }
-
- DWORD access = (prot & PROT_WRITE) ? FILE_MAP_WRITE : FILE_MAP_READ;
- /* copy-on-write doesn't work at all on 9x using anonymous maps.
- Workaround: Anonymous mappings always use normal READ or WRITE
- access and don't use named file mapping.
- copy-on-write doesn't also work properly on 9x with real files.
- While the changes are not propagated to the file, they are
- visible to other processes sharing the same file mapping object.
- Workaround: Don't use named file mapping. That should work since
- sharing file mappings only works reliable using named
- file mapping on 9x.
- */
- if ((flags & MAP_PRIVATE)
- && (wincap.has_working_copy_on_write () || fd != -1))
- access = FILE_MAP_COPY;
-
- h = fh->mmap (&base, gran_len, access, flags, gran_off);
-
- if (h == INVALID_HANDLE_VALUE)
- {
- ReleaseResourceLock(LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap");
- return MAP_FAILED;
- }
-
- /* Now we should have a successfully mmapped area.
- Need to save it so forked children can reproduce it.
- */
- if (fd == -1)
- gran_len = PAGE_CNT (gran_len) * getpagesize ();
- mmap_record mmap_rec (fd, h, access, gran_off, gran_len, base);
-
- /* Get list of mmapped areas for this fd, create a new one if
- one does not exist yet.
- */
- if (l == 0)
- {
- /* Create a new one */
- l = new list;
- if (l == 0)
- {
- fh->munmap (h, base, gran_len);
- set_errno (ENOMEM);
- syscall_printf ("-1 = mmap(): ENOMEM");
- ReleaseResourceLock(LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap");
- return MAP_FAILED;
- }
- l = mmapped_areas->add_list (l, fd);
- }
-
- /* Insert into the list */
- mmap_record *rec = l->add_record (mmap_rec);
- if ((off = rec->map_map (off, len)) == (__off64_t)-1)
- {
- fh->munmap (h, base, gran_len);
- l->erase ();
- set_errno (ENOMEM);
- syscall_printf ("-1 = mmap(): ENOMEM");
- ReleaseResourceLock(LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap");
- return MAP_FAILED;
- }
- caddr_t ret = rec->get_address () + off;
- syscall_printf ("%x = mmap() succeeded", ret);
- ReleaseResourceLock(LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap");
- return ret;
-}
-
-extern "C"
-caddr_t
-mmap (caddr_t addr, size_t len, int prot, int flags, int fd, __off32_t off)
-{
- return mmap64 (addr, len, prot, flags, fd, (__off64_t)off);
-}
-
-/* munmap () removes an mmapped area. It insists that base area
- requested is the same as that mmapped, error if not. */
-
-extern "C"
-int
-munmap (caddr_t addr, size_t len)
-{
- syscall_printf ("munmap (addr %x, len %d)", addr, len);
-
- /* Error conditions according to SUSv2 */
- if (((DWORD)addr % getpagesize ()) || !len)
- {
- set_errno (EINVAL);
- syscall_printf ("-1 = munmap(): Invalid parameters");
- return -1;
- }
-
- SetResourceLock(LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "munmap");
- /* Check if a mmap'ed area was ever created */
- if (mmapped_areas == NULL)
- {
- syscall_printf ("-1 = munmap(): mmapped_areas == NULL");
- set_errno (EINVAL);
- ReleaseResourceLock(LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "munmap");
- return -1;
- }
-
- /* Iterate through the map, looking for the mmapped area.
- Error if not found. */
-
- for (int it = 0; it < mmapped_areas->nlists; ++it)
- {
- list *l = mmapped_areas->lists[it];
- if (l)
- {
- long li = -1;
- if ((li = l->match(addr, len, li)) >= 0)
- {
- mmap_record *rec = l->recs + li;
- if (rec->unmap_map (addr, len))
- {
- fhandler_base *fh = rec->alloc_fh ();
- fh->munmap (rec->get_handle (), addr, len);
- rec->free_fh (fh);
-
- /* Delete the entry. */
- l->erase (li);
- }
- syscall_printf ("0 = munmap(): %x", addr);
- ReleaseResourceLock(LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "munmap");
- return 0;
- }
- }
- }
-
- set_errno (EINVAL);
- syscall_printf ("-1 = munmap(): EINVAL");
-
- ReleaseResourceLock(LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "munmap");
- return -1;
-}
-
-/* Sync file with memory. Ignore flags for now. */
-
-extern "C"
-int
-msync (caddr_t addr, size_t len, int flags)
-{
- syscall_printf ("addr = %x, len = %d, flags = %x",
- addr, len, flags);
-
- /* However, check flags for validity. */
- if ((flags & ~(MS_ASYNC | MS_SYNC | MS_INVALIDATE))
- || ((flags & MS_ASYNC) && (flags & MS_SYNC)))
- {
- syscall_printf ("-1 = msync(): Invalid flags");
- set_errno (EINVAL);
- return -1;
- }
-
- SetResourceLock(LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "msync");
- /* Check if a mmap'ed area was ever created */
- if (mmapped_areas == NULL)
- {
- syscall_printf ("-1 = msync(): mmapped_areas == NULL");
- set_errno (EINVAL);
- ReleaseResourceLock(LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "msync");
- return -1;
- }
-
- /* Iterate through the map, looking for the mmapped area.
- Error if not found. */
-
- for (int it = 0; it < mmapped_areas->nlists; ++it)
- {
- list *l = mmapped_areas->lists[it];
- if (l != 0)
- {
- for (int li = 0; li < l->nrecs; ++li)
- {
- mmap_record *rec = l->recs + li;
- if (rec->access (addr))
- {
- /* Check whole area given by len. */
- for (DWORD i = getpagesize (); i < len; ++i)
- if (!rec->access (addr + i))
- goto invalid_address_range;
- fhandler_base *fh = rec->alloc_fh ();
- int ret = fh->msync (rec->get_handle (), addr, len, flags);
- rec->free_fh (fh);
-
- if (ret)
- syscall_printf ("%d = msync(): %E", ret);
- else
- syscall_printf ("0 = msync()");
-
- ReleaseResourceLock(LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "msync");
- return 0;
- }
- }
- }
- }
-
-invalid_address_range:
- /* SUSv2: Return code if indicated memory was not mapped is ENOMEM. */
- set_errno (ENOMEM);
- syscall_printf ("-1 = msync(): ENOMEM");
-
- ReleaseResourceLock(LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "msync");
- return -1;
-}
-
-/*
- * Base implementation:
- *
- * `mmap' returns ENODEV as documented in SUSv2.
- * In contrast to the global function implementation, the member function
- * `mmap' has to return the mapped base address in `addr' and the handle to
- * the mapping object as return value. In case of failure, the fhandler
- * mmap has to close that handle by itself and return INVALID_HANDLE_VALUE.
- *
- * `munmap' and `msync' get the handle to the mapping object as first parameter
- * additionally.
-*/
-HANDLE
-fhandler_base::mmap (caddr_t *addr, size_t len, DWORD access,
- int flags, __off64_t off)
-{
- set_errno (ENODEV);
- return INVALID_HANDLE_VALUE;
-}
-
-int
-fhandler_base::munmap (HANDLE h, caddr_t addr, size_t len)
-{
- set_errno (ENODEV);
- return -1;
-}
-
-int
-fhandler_base::msync (HANDLE h, caddr_t addr, size_t len, int flags)
-{
- set_errno (ENODEV);
- return -1;
-}
-
-BOOL
-fhandler_base::fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset,
- DWORD size, void *address)
-{
- set_errno (ENODEV);
- return -1;
-}
-
-/* Implementation for disk files. */
-HANDLE
-fhandler_disk_file::mmap (caddr_t *addr, size_t len, DWORD access,
- int flags, __off64_t off)
-{
- DWORD protect;
-
- if (access & FILE_MAP_COPY)
- protect = PAGE_WRITECOPY;
- else if (access & FILE_MAP_WRITE)
- protect = PAGE_READWRITE;
- else
- protect = PAGE_READONLY;
-
- HANDLE h;
-
- /* On 9x/ME try first to open the mapping by name when opening a
- shared file object. This is needed since 9x/ME only shares
- objects between processes by name. What a mess... */
- if (wincap.share_mmaps_only_by_name ()
- && get_handle () != INVALID_HANDLE_VALUE
- && !(access & FILE_MAP_COPY))
- {
- /* Grrr, the whole stuff is just needed to try to get a reliable
- mapping of the same file. Even that uprising isn't bullet
- proof but it does it's best... */
- char namebuf[MAX_PATH];
- cygwin_conv_to_full_posix_path (get_name (), namebuf);
- for (int i = strlen (namebuf) - 1; i >= 0; --i)
- namebuf[i] = cyg_tolower (namebuf [i]);
-
- debug_printf ("named sharing");
- if (!(h = OpenFileMapping (access, TRUE, namebuf)))
- h = CreateFileMapping (get_handle(), &sec_none, protect, 0, 0, namebuf);
- }
- else
- h = CreateFileMapping (get_handle (), &sec_none, protect, 0,
- get_handle () == INVALID_HANDLE_VALUE ? len : 0,
- NULL);
- if (!h)
- {
- __seterrno ();
- syscall_printf ("-1 = mmap(): CreateFileMapping failed with %E");
- return INVALID_HANDLE_VALUE;
- }
-
- DWORD high = off >> 32, low = off & 0xffffffff;
- void *base = MapViewOfFileEx (h, access, high, low, len,
- (flags & MAP_FIXED) ? *addr : NULL);
- debug_printf ("%x = MapViewOfFileEx (h:%x, access:%x, 0, off:%D, len:%d, addr:%x)", base, h, access, off, len, (flags & MAP_FIXED) ? *addr : NULL);
- if (!base || ((flags & MAP_FIXED) && base != *addr))
- {
- if (!base)
- {
- __seterrno ();
- syscall_printf ("-1 = mmap(): MapViewOfFileEx failed with %E");
- }
- else
- {
- set_errno (EINVAL);
- syscall_printf ("-1 = mmap(): address shift with MAP_FIXED given");
- }
- CloseHandle (h);
- return INVALID_HANDLE_VALUE;
- }
-
- *addr = (caddr_t) base;
- return h;
-}
-
-int
-fhandler_disk_file::munmap (HANDLE h, caddr_t addr, size_t len)
-{
- UnmapViewOfFile (addr);
- CloseHandle (h);
- return 0;
-}
-
-int
-fhandler_disk_file::msync (HANDLE h, caddr_t addr, size_t len, int flags)
-{
- if (FlushViewOfFile (addr, len) == 0)
- {
- __seterrno ();
- return -1;
- }
- return 0;
-}
-
-BOOL
-fhandler_disk_file::fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset,
- DWORD size, void *address)
-{
- /* Re-create the MapViewOfFileEx call */
- void *base = MapViewOfFileEx (h, access, 0, offset, size, address);
- return base == address;
-}
-
-/* Set memory protection */
-
-extern "C"
-int
-mprotect (caddr_t addr, size_t len, int prot)
-{
- DWORD old_prot;
- DWORD new_prot = 0;
-
- syscall_printf ("mprotect (addr %x, len %d, prot %x)", addr, len, prot);
-
- if (prot == PROT_NONE)
- new_prot = PAGE_NOACCESS;
- else
- {
- switch (prot)
- {
- case PROT_READ | PROT_WRITE | PROT_EXEC:
- new_prot = PAGE_EXECUTE_READWRITE;
- break;
- case PROT_READ | PROT_WRITE:
- new_prot = PAGE_READWRITE;
- break;
- case PROT_READ | PROT_EXEC:
- new_prot = PAGE_EXECUTE_READ;
- break;
- case PROT_READ:
- new_prot = PAGE_READONLY;
- break;
- default:
- syscall_printf ("-1 = mprotect (): invalid prot value");
- set_errno (EINVAL);
- return -1;
- }
- }
-
- if (VirtualProtect (addr, len, new_prot, &old_prot) == 0)
- {
- __seterrno ();
- syscall_printf ("-1 = mprotect (): %E");
- return -1;
- }
-
- syscall_printf ("0 = mprotect ()");
- return 0;
-}
-
-/*
- * Call to re-create all the file mappings in a forked
- * child. Called from the child in initialization. At this
- * point we are passed a valid mmapped_areas map, and all the
- * HANDLE's are valid for the child, but none of the
- * mapped areas are in our address space. We need to iterate
- * through the map, doing the MapViewOfFile calls.
- */
-
-int __stdcall
-fixup_mmaps_after_fork (HANDLE parent)
-{
-
- debug_printf ("recreate_mmaps_after_fork, mmapped_areas %p", mmapped_areas);
-
- /* Check if a mmapped area was ever created */
- if (mmapped_areas == NULL)
- return 0;
-
- /* Iterate through the map */
- for (int it = 0; it < mmapped_areas->nlists; ++it)
- {
- list *l = mmapped_areas->lists[it];
- if (l != 0)
- {
- int li;
- for (li = 0; li < l->nrecs; ++li)
- {
- mmap_record *rec = l->recs + li;
-
- debug_printf ("fd %d, h %x, access %x, offset %d, size %d, address %p",
- rec->get_fd (), rec->get_handle (), rec->get_access (),
- rec->get_offset (), rec->get_size (), rec->get_address ());
-
- fhandler_base *fh = rec->alloc_fh ();
- BOOL ret = fh->fixup_mmap_after_fork (rec->get_handle (),
- rec->get_access (),
- rec->get_offset (),
- rec->get_size (),
- rec->get_address ());
- rec->free_fh (fh);
-
- if (!ret)
- {
- system_printf ("base address fails to match requested address %p",
- rec->get_address ());
- return -1;
- }
- if (rec->get_access () == FILE_MAP_COPY)
- {
- for (char *address = rec->get_address ();
- address < rec->get_address () + rec->get_size ();
- address += getpagesize ())
- if (rec->access (address)
- && !ReadProcessMemory (parent, address, address,
- getpagesize (), NULL))
- {
- system_printf ("ReadProcessMemory failed for MAP_PRIVATE address %p, %E",
- rec->get_address ());
- return -1;
- }
- }
- rec->fixup_map ();
- }
- }
- }
-
- debug_printf ("succeeded");
- return 0;
-}
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
deleted file mode 100644
index 32e930392..000000000
--- a/winsup/cygwin/net.cc
+++ /dev/null
@@ -1,2539 +0,0 @@
-/* net.cc: network-related routines.
-
- Copyright 1996, 1997, 1998, 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. */
-
-/* #define DEBUG_NEST_ON 1 */
-
-#define __INSIDE_CYGWIN_NET__
-
-#include "winsup.h"
-#include <errno.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <iphlpapi.h>
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <netdb.h>
-#define USE_SYS_TYPES_FD_SET
-#include <winsock2.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygheap.h"
-#include "sigproc.h"
-#include "pinfo.h"
-#include "registry.h"
-#include "wsock_event.h"
-#include <sys/uio.h>
-
-extern "C" {
-int h_errno;
-
-int __stdcall rcmd (char **ahost, unsigned short inport, char *locuser,
- char *remuser, char *cmd, SOCKET *fd2p);
-int __stdcall rexec (char **ahost, unsigned short inport, char *locuser,
- char *password, char *cmd, SOCKET *fd2p);
-int __stdcall rresvport (int *);
-int sscanf (const char *, const char *, ...);
-} /* End of "C" section */
-
-LPWSAOVERLAPPED
-wsock_event::prepare ()
-{
- LPWSAOVERLAPPED ret = NULL;
-
- SetLastError (0);
- if ((event = WSACreateEvent ()) != WSA_INVALID_EVENT)
- {
- memset (&ovr, 0, sizeof ovr);
- ovr.hEvent = event;
- ret = &ovr;
- }
- else if (GetLastError () == ERROR_PROC_NOT_FOUND) /* winsock2 not available */
- WSASetLastError (0);
-
- debug_printf ("%d = wsock_event::prepare ()", ret);
- return ret;
-}
-
-int
-wsock_event::wait (int socket, LPDWORD flags)
-{
- int ret = -1;
- WSAEVENT ev[2] = { event, signal_arrived };
-
- switch (WSAWaitForMultipleEvents(2, ev, FALSE, WSA_INFINITE, FALSE))
- {
- case WSA_WAIT_EVENT_0:
- DWORD len;
- if (WSAGetOverlappedResult(socket, &ovr, &len, FALSE, flags))
- ret = (int) len;
- break;
- case WSA_WAIT_EVENT_0 + 1:
- if (!CancelIo ((HANDLE)socket))
- {
- debug_printf ("CancelIo() %E, fallback to blocking io");
- WSAGetOverlappedResult(socket, &ovr, &len, TRUE, flags);
- }
- else
- WSASetLastError (WSAEINTR);
- break;
- case WSA_WAIT_FAILED:
- break;
- default: /* Should be impossible. *LOL* */
- WSASetLastError (WSAEFAULT);
- break;
- }
- WSACloseEvent (event);
- event = NULL;
- return ret;
-}
-
-WSADATA wsadata;
-
-/* Cygwin internal */
-static fhandler_socket *
-get (int fd)
-{
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- return 0;
-
- return cfd->is_socket ();
-}
-
-/* Cygwin internal */
-static SOCKET __stdcall
-set_socket_inheritance (SOCKET sock)
-{
- SOCKET osock = sock;
- if (!DuplicateHandle (hMainProc, (HANDLE) sock, hMainProc, (HANDLE *) &sock,
- 0, TRUE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
- system_printf ("DuplicateHandle failed %E");
- else
- debug_printf ("DuplicateHandle succeeded osock %p, sock %p", osock, sock);
- return sock;
-}
-
-/* htonl: standards? */
-extern "C" unsigned long int
-htonl (unsigned long int x)
-{
- return ((((x & 0x000000ffU) << 24) |
- ((x & 0x0000ff00U) << 8) |
- ((x & 0x00ff0000U) >> 8) |
- ((x & 0xff000000U) >> 24)));
-}
-
-/* ntohl: standards? */
-extern "C" unsigned long int
-ntohl (unsigned long int x)
-{
- return htonl (x);
-}
-
-/* htons: standards? */
-extern "C" unsigned short
-htons (unsigned short x)
-{
- return ((((x & 0x000000ffU) << 8) |
- ((x & 0x0000ff00U) >> 8)));
-}
-
-/* ntohs: standards? */
-extern "C" unsigned short
-ntohs (unsigned short x)
-{
- return htons (x);
-}
-
-/* Cygwin internal */
-static void
-dump_protoent (struct protoent *p)
-{
- if (p)
- debug_printf ("protoent %s %x %x", p->p_name, p->p_aliases, p->p_proto);
-}
-
-/* exported as inet_ntoa: BSD 4.3 */
-extern "C" char *
-cygwin_inet_ntoa (struct in_addr in)
-{
-#ifdef _MT_SAFE
-#define ntoa_buf _reent_winsup ()->_ntoa_buf
-#else
- static char *ntoa_buf = NULL;
-#endif
-
- char *res = inet_ntoa (in);
- if (ntoa_buf)
- {
- free (ntoa_buf);
- ntoa_buf = NULL;
- }
- if (res)
- ntoa_buf = strdup (res);
- return ntoa_buf;
-}
-
-/* exported as inet_addr: BSD 4.3 */
-extern "C" unsigned long
-cygwin_inet_addr (const char *cp)
-{
- if (check_null_str_errno (cp))
- return INADDR_NONE;
- unsigned long res = inet_addr (cp);
- return res;
-}
-
-/* exported as inet_aton: BSD 4.3
- inet_aton is not exported by wsock32 and ws2_32,
- so it has to be implemented here. */
-extern "C" int
-cygwin_inet_aton (const char *cp, struct in_addr *inp)
-{
- if (check_null_str_errno (cp) || check_null_invalid_struct_errno (inp))
- return 0;
-
- unsigned long res = inet_addr (cp);
- if (res == INADDR_NONE && strcmp (cp, "255.255.255.255"))
- return 0;
- if (inp)
- inp->s_addr = res;
- return 1;
-}
-
-/* undocumented in wsock32.dll */
-extern "C" unsigned int WINAPI inet_network (const char *);
-
-extern "C" unsigned int
-cygwin_inet_network (const char *cp)
-{
- if (check_null_str_errno (cp))
- return INADDR_NONE;
- unsigned int res = inet_network (cp);
- return res;
-}
-
-/* inet_netof is in the standard BSD sockets library. It is useless
- for modern networks, since it assumes network values which are no
- longer meaningful, but some existing code calls it. */
-
-extern "C" unsigned long
-inet_netof (struct in_addr in)
-{
- unsigned long i, res;
-
- i = ntohl (in.s_addr);
- if (IN_CLASSA (i))
- res = (i & IN_CLASSA_NET) >> IN_CLASSA_NSHIFT;
- else if (IN_CLASSB (i))
- res = (i & IN_CLASSB_NET) >> IN_CLASSB_NSHIFT;
- else
- res = (i & IN_CLASSC_NET) >> IN_CLASSC_NSHIFT;
-
-
- return res;
-}
-
-/* inet_makeaddr is in the standard BSD sockets library. It is
- useless for modern networks, since it assumes network values which
- are no longer meaningful, but some existing code calls it. */
-
-extern "C" struct in_addr
-inet_makeaddr (int net, int lna)
-{
- unsigned long i;
- struct in_addr in;
-
- if (net < IN_CLASSA_MAX)
- i = (net << IN_CLASSA_NSHIFT) | (lna & IN_CLASSA_HOST);
- else if (net < IN_CLASSB_MAX)
- i = (net << IN_CLASSB_NSHIFT) | (lna & IN_CLASSB_HOST);
- else if (net < 0x1000000)
- i = (net << IN_CLASSC_NSHIFT) | (lna & IN_CLASSC_HOST);
- else
- i = net | lna;
-
- in.s_addr = htonl (i);
-
-
- return in;
-}
-
-struct tl
-{
- int w;
- const char *s;
- int e;
-};
-
-static NO_COPY struct tl errmap[] =
-{
- {WSAEINTR, "WSAEINTR", EINTR},
- {WSAEWOULDBLOCK, "WSAEWOULDBLOCK", EWOULDBLOCK},
- {WSAEINPROGRESS, "WSAEINPROGRESS", EINPROGRESS},
- {WSAEALREADY, "WSAEALREADY", EALREADY},
- {WSAENOTSOCK, "WSAENOTSOCK", ENOTSOCK},
- {WSAEDESTADDRREQ, "WSAEDESTADDRREQ", EDESTADDRREQ},
- {WSAEMSGSIZE, "WSAEMSGSIZE", EMSGSIZE},
- {WSAEPROTOTYPE, "WSAEPROTOTYPE", EPROTOTYPE},
- {WSAENOPROTOOPT, "WSAENOPROTOOPT", ENOPROTOOPT},
- {WSAEPROTONOSUPPORT, "WSAEPROTONOSUPPORT", EPROTONOSUPPORT},
- {WSAESOCKTNOSUPPORT, "WSAESOCKTNOSUPPORT", ESOCKTNOSUPPORT},
- {WSAEOPNOTSUPP, "WSAEOPNOTSUPP", EOPNOTSUPP},
- {WSAEPFNOSUPPORT, "WSAEPFNOSUPPORT", EPFNOSUPPORT},
- {WSAEAFNOSUPPORT, "WSAEAFNOSUPPORT", EAFNOSUPPORT},
- {WSAEADDRINUSE, "WSAEADDRINUSE", EADDRINUSE},
- {WSAEADDRNOTAVAIL, "WSAEADDRNOTAVAIL", EADDRNOTAVAIL},
- {WSAENETDOWN, "WSAENETDOWN", ENETDOWN},
- {WSAENETUNREACH, "WSAENETUNREACH", ENETUNREACH},
- {WSAENETRESET, "WSAENETRESET", ENETRESET},
- {WSAECONNABORTED, "WSAECONNABORTED", ECONNABORTED},
- {WSAECONNRESET, "WSAECONNRESET", ECONNRESET},
- {WSAENOBUFS, "WSAENOBUFS", ENOBUFS},
- {WSAEISCONN, "WSAEISCONN", EISCONN},
- {WSAENOTCONN, "WSAENOTCONN", ENOTCONN},
- {WSAESHUTDOWN, "WSAESHUTDOWN", ESHUTDOWN},
- {WSAETOOMANYREFS, "WSAETOOMANYREFS", ETOOMANYREFS},
- {WSAETIMEDOUT, "WSAETIMEDOUT", ETIMEDOUT},
- {WSAECONNREFUSED, "WSAECONNREFUSED", ECONNREFUSED},
- {WSAELOOP, "WSAELOOP", ELOOP},
- {WSAENAMETOOLONG, "WSAENAMETOOLONG", ENAMETOOLONG},
- {WSAEHOSTDOWN, "WSAEHOSTDOWN", EHOSTDOWN},
- {WSAEHOSTUNREACH, "WSAEHOSTUNREACH", EHOSTUNREACH},
- {WSAENOTEMPTY, "WSAENOTEMPTY", ENOTEMPTY},
- {WSAEPROCLIM, "WSAEPROCLIM", EPROCLIM},
- {WSAEUSERS, "WSAEUSERS", EUSERS},
- {WSAEDQUOT, "WSAEDQUOT", EDQUOT},
- {WSAESTALE, "WSAESTALE", ESTALE},
- {WSAEREMOTE, "WSAEREMOTE", EREMOTE},
- {WSAEINVAL, "WSAEINVAL", EINVAL},
- {WSAEFAULT, "WSAEFAULT", EFAULT},
- {0, "NOERROR", 0},
- {0, NULL, 0}
-};
-
-static int
-find_winsock_errno (int why)
-{
- for (int i = 0; errmap[i].s != NULL; ++i)
- if (why == errmap[i].w)
- return errmap[i].e;
-
- return EPERM;
-}
-
-/* Cygwin internal */
-void
-__set_winsock_errno (const char *fn, int ln)
-{
- DWORD werr = WSAGetLastError ();
- int err = find_winsock_errno (werr);
- set_errno (err);
- syscall_printf ("%s:%d - winsock error %d -> errno %d", fn, ln, werr, err);
-}
-
-/*
- * Since the member `s' isn't used for debug output we can use it
- * for the error text returned by herror and hstrerror.
- */
-static NO_COPY struct tl host_errmap[] =
-{
- {WSAHOST_NOT_FOUND, "Unknown host", HOST_NOT_FOUND},
- {WSATRY_AGAIN, "Host name lookup failure", TRY_AGAIN},
- {WSANO_RECOVERY, "Unknown server error", NO_RECOVERY},
- {WSANO_DATA, "No address associated with name", NO_DATA},
- {0, NULL, 0}
-};
-
-/* Cygwin internal */
-static void
-set_host_errno ()
-{
- int i;
-
- int why = WSAGetLastError ();
- for (i = 0; host_errmap[i].w != 0; ++i)
- if (why == host_errmap[i].w)
- break;
-
- if (host_errmap[i].w != 0)
- h_errno = host_errmap[i].e;
- else
- h_errno = NETDB_INTERNAL;
-}
-
-static void
-free_char_list (char **clist)
-{
- if (clist)
- {
- for (char **cl = clist; *cl; ++cl)
- free (*cl);
- free (clist);
- }
-}
-
-static char **
-dup_char_list (char **src)
-{
- char **dst;
- int cnt = 0;
-
- for (char **cl = src; *cl; ++cl)
- ++cnt;
- if (!(dst = (char **) calloc (cnt + 1, sizeof *dst)))
- return NULL;
- while (cnt-- > 0)
- if (!(dst[cnt] = strdup (src[cnt])))
- return NULL;
- return dst;
-}
-
-#define free_addr_list(addr_list) free_char_list (addr_list)
-
-static char **
-dup_addr_list (char **src, unsigned int size)
-{
- char **dst;
- int cnt = 0;
-
- for (char **cl = src; *cl; ++cl)
- ++cnt;
- if (!(dst = (char **) calloc (cnt + 1, sizeof *dst)))
- return NULL;
- while (cnt-- > 0)
- {
- if (!(dst[cnt] = (char *) malloc(size)))
- return NULL;
- memcpy(dst[cnt], src[cnt], size);
- }
- return dst;
-}
-
-static void
-free_protoent_ptr (struct protoent *&p)
-{
- if (p)
- {
- debug_printf ("protoent: %s", p->p_name);
-
- if (p->p_name)
- free (p->p_name);
- free_char_list (p->p_aliases);
- p = NULL;
- }
-}
-
-static struct protoent *
-dup_protoent_ptr (struct protoent *src)
-{
- if (!src)
- return NULL;
-
- struct protoent *dst = (struct protoent *) calloc (1, sizeof *dst);
- if (!dst)
- return NULL;
-
- debug_printf ("protoent: %s", src->p_name);
-
- dst->p_proto = src->p_proto;
- if (src->p_name && !(dst->p_name = strdup (src->p_name)))
- goto out;
- if (src->p_aliases && !(dst->p_aliases = dup_char_list (src->p_aliases)))
- goto out;
-
- debug_printf ("protoent: copied %s", dst->p_name);
-
- return dst;
-
-out:
- free_protoent_ptr (dst);
- return NULL;
-}
-
-#ifdef _MT_SAFE
-#define protoent_buf _reent_winsup ()->_protoent_buf
-#else
- static struct protoent *protoent_buf = NULL;
-#endif
-
-/* exported as getprotobyname: standards? */
-extern "C" struct protoent *
-cygwin_getprotobyname (const char *p)
-{
- if (check_null_str_errno (p))
- return NULL;
- free_protoent_ptr (protoent_buf);
- protoent_buf = dup_protoent_ptr (getprotobyname (p));
- if (!protoent_buf)
- set_winsock_errno ();
-
- dump_protoent (protoent_buf);
- return protoent_buf;
-}
-
-/* exported as getprotobynumber: standards? */
-extern "C" struct protoent *
-cygwin_getprotobynumber (int number)
-{
- free_protoent_ptr (protoent_buf);
- protoent_buf = dup_protoent_ptr (getprotobynumber (number));
- if (!protoent_buf)
- set_winsock_errno ();
-
- dump_protoent (protoent_buf);
- return protoent_buf;
-}
-
-fhandler_socket *
-fdsock (int& fd, const char *name, SOCKET soc)
-{
- if (!winsock2_active)
- soc = set_socket_inheritance (soc);
- else if (wincap.has_set_handle_information ())
- {
- /* NT systems apparently set sockets to inheritable by default */
- SetHandleInformation ((HANDLE)soc, HANDLE_FLAG_INHERIT, 0);
- debug_printf ("reset socket inheritance since winsock2_active %d", winsock2_active);
- }
- else
- debug_printf ("not setting socket inheritance since winsock2_active %d", winsock2_active);
- fhandler_socket *fh = (fhandler_socket *) cygheap->fdtab.build_fhandler (fd, FH_SOCKET, name);
- fh->set_io_handle ((HANDLE) soc);
- fh->set_flags (O_RDWR, O_BINARY);
- debug_printf ("fd %d, name '%s', soc %p", fd, name, soc);
- return fh;
-}
-
-/* exported as socket: standards? */
-extern "C" int
-cygwin_socket (int af, int type, int protocol)
-{
- int res = -1;
- SOCKET soc = 0;
- fhandler_socket* fh = NULL;
-
- cygheap_fdnew fd;
-
- if (fd >= 0)
- {
- debug_printf ("socket (%d, %d, %d)", af, type, protocol);
-
- soc = socket (AF_INET, type, af == AF_LOCAL ? 0 : protocol);
-
- if (soc == INVALID_SOCKET)
- {
- set_winsock_errno ();
- goto done;
- }
-
- const char *name;
- if (af == AF_INET)
- name = (type == SOCK_STREAM ? "/dev/tcp" : "/dev/udp");
- else
- name = (type == SOCK_STREAM ? "/dev/streamsocket" : "/dev/dgsocket");
-
- fh = fdsock (fd, name, soc);
- if (fh)
- {
- fh->set_addr_family (af);
- fh->set_socket_type (type);
- }
- res = fd;
- }
-
-done:
- syscall_printf ("%d = socket (%d, %d, %d)", res, af, type, protocol);
- return res;
-}
-
-/* cygwin internal: map sockaddr into internet domain address */
-
-static int get_inet_addr (const struct sockaddr *in, int inlen,
- struct sockaddr_in *out, int *outlen, int* secret = 0)
-{
- int secret_buf [4];
- int* secret_ptr = (secret ? : secret_buf);
-
- if (in->sa_family == AF_INET)
- {
- *out = * (sockaddr_in *)in;
- *outlen = inlen;
- return 1;
- }
- else if (in->sa_family == AF_LOCAL)
- {
- int fd = _open (in->sa_data, O_RDONLY);
- if (fd == -1)
- return 0;
-
- int ret = 0;
- char buf[128];
- memset (buf, 0, sizeof buf);
- if (read (fd, buf, sizeof buf) != -1)
- {
- sockaddr_in sin;
- sin.sin_family = AF_INET;
- sscanf (buf + strlen (SOCKET_COOKIE), "%hu %08x-%08x-%08x-%08x",
- &sin.sin_port,
- secret_ptr, secret_ptr + 1, secret_ptr + 2, secret_ptr + 3);
- sin.sin_port = htons (sin.sin_port);
- sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
- *out = sin;
- *outlen = sizeof sin;
- ret = 1;
- }
- _close (fd);
- return ret;
- }
- else
- {
- set_errno (EAFNOSUPPORT);
- return 0;
- }
-}
-
-/* exported as sendto: standards? */
-extern "C" int
-cygwin_sendto (int fd,
- const void *buf,
- int len,
- unsigned int flags,
- const struct sockaddr *to,
- int tolen)
-{
- int res;
- wsock_event wsock_evt;
- LPWSAOVERLAPPED ovr;
- fhandler_socket *h = get (fd);
-
- if ((len && __check_invalid_read_ptr_errno (buf, (unsigned) len))
- || __check_null_invalid_struct_errno (to, tolen)
- || !h)
- res = -1;
- else
- {
- sockaddr_in sin;
- sigframe thisframe (mainthread);
-
- if (get_inet_addr (to, tolen, &sin, &tolen) == 0)
- return -1;
-
- if (h->is_nonblocking () || !(ovr = wsock_evt.prepare ()))
- {
- debug_printf ("Fallback to winsock 1 sendto call");
- if ((res = sendto (h->get_socket (), (const char *) buf, len, flags,
- (sockaddr *) &sin, tolen)) == SOCKET_ERROR)
- {
- set_winsock_errno ();
- res = -1;
- }
- }
- else
- {
- WSABUF wsabuf = { len, (char *) buf };
- DWORD ret = 0;
- if (WSASendTo (h->get_socket (), &wsabuf, 1, &ret, (DWORD)flags,
- (sockaddr *) &sin, tolen, ovr, NULL) != SOCKET_ERROR)
- res = ret;
- else if ((res = WSAGetLastError ()) != WSA_IO_PENDING)
- {
- set_winsock_errno ();
- res = -1;
- }
- else if ((res = wsock_evt.wait (h->get_socket (), (DWORD *)&flags)) == -1)
- set_winsock_errno ();
- }
- }
-
- syscall_printf ("%d = sendto (%d, %x, %x, %x)", res, fd, buf, len, flags);
-
- return res;
-}
-
-/* exported as recvfrom: standards? */
-extern "C" int
-cygwin_recvfrom (int fd,
- char *buf,
- int len,
- int flags,
- struct sockaddr *from,
- int *fromlen)
-{
- int res;
- wsock_event wsock_evt;
- LPWSAOVERLAPPED ovr;
- fhandler_socket *h = get (fd);
-
- if (__check_null_invalid_struct_errno (buf, (unsigned) len)
- || check_null_invalid_struct_errno (fromlen)
- || (from && __check_null_invalid_struct_errno (from, (unsigned) *fromlen))
- || !h)
- res = -1;
- else
- {
- sigframe thisframe (mainthread);
-
- if (h->is_nonblocking () ||!(ovr = wsock_evt.prepare ()))
- {
- debug_printf ("Fallback to winsock 1 recvfrom call");
- if ((res = recvfrom (h->get_socket (), buf, len, flags, from, fromlen))
- == SOCKET_ERROR)
- {
- set_winsock_errno ();
- res = -1;
- }
- }
- else
- {
- WSABUF wsabuf = { len, (char *) buf };
- DWORD ret = 0;
- if (WSARecvFrom (h->get_socket (), &wsabuf, 1, &ret, (DWORD *)&flags,
- from, fromlen, ovr, NULL) != SOCKET_ERROR)
- res = ret;
- else if ((res = WSAGetLastError ()) != WSA_IO_PENDING)
- {
- set_winsock_errno ();
- res = -1;
- }
- else if ((res = wsock_evt.wait (h->get_socket (), (DWORD *)&flags)) == -1)
- set_winsock_errno ();
- }
- }
-
- syscall_printf ("%d = recvfrom (%d, %x, %x, %x)", res, fd, buf, len, flags);
-
- return res;
-}
-
-/* exported as setsockopt: standards? */
-extern "C" int
-cygwin_setsockopt (int fd,
- int level,
- int optname,
- const void *optval,
- int optlen)
-{
- fhandler_socket *h = get (fd);
- int res = -1;
- const char *name = "error";
-
- if ((!optval || !__check_invalid_read_ptr_errno (optval, optlen)) && h)
- {
- /* For the following debug_printf */
- switch (optname)
- {
- case SO_DEBUG:
- name="SO_DEBUG";
- break;
- case SO_ACCEPTCONN:
- name="SO_ACCEPTCONN";
- break;
- case SO_REUSEADDR:
- name="SO_REUSEADDR";
- break;
- case SO_KEEPALIVE:
- name="SO_KEEPALIVE";
- break;
- case SO_DONTROUTE:
- name="SO_DONTROUTE";
- break;
- case SO_BROADCAST:
- name="SO_BROADCAST";
- break;
- case SO_USELOOPBACK:
- name="SO_USELOOPBACK";
- break;
- case SO_LINGER:
- name="SO_LINGER";
- break;
- case SO_OOBINLINE:
- name="SO_OOBINLINE";
- break;
- case SO_ERROR:
- name="SO_ERROR";
- break;
- }
-
- res = setsockopt (h->get_socket (), level, optname,
- (const char *) optval, optlen);
-
- if (optlen == 4)
- syscall_printf ("setsockopt optval=%x", *(long *) optval);
-
- if (res)
- set_winsock_errno ();
- }
-
- syscall_printf ("%d = setsockopt (%d, %d, %x (%s), %x, %d)",
- res, fd, level, optname, name, optval, optlen);
- return res;
-}
-
-/* exported as getsockopt: standards? */
-extern "C" int
-cygwin_getsockopt (int fd,
- int level,
- int optname,
- void *optval,
- int *optlen)
-{
- fhandler_socket *h = get (fd);
- int res = -1;
- const char *name = "error";
- if (!check_null_invalid_struct_errno (optlen)
- && (!optval || !__check_null_invalid_struct_errno (optval, (unsigned) *optlen))
- && h)
- {
- /* For the following debug_printf */
- switch (optname)
- {
- case SO_DEBUG:
- name="SO_DEBUG";
- break;
- case SO_ACCEPTCONN:
- name="SO_ACCEPTCONN";
- break;
- case SO_REUSEADDR:
- name="SO_REUSEADDR";
- break;
- case SO_KEEPALIVE:
- name="SO_KEEPALIVE";
- break;
- case SO_DONTROUTE:
- name="SO_DONTROUTE";
- break;
- case SO_BROADCAST:
- name="SO_BROADCAST";
- break;
- case SO_USELOOPBACK:
- name="SO_USELOOPBACK";
- break;
- case SO_LINGER:
- name="SO_LINGER";
- break;
- case SO_OOBINLINE:
- name="SO_OOBINLINE";
- break;
- case SO_ERROR:
- name="SO_ERROR";
- break;
- }
-
- res = getsockopt (h->get_socket (), level, optname,
- (char *) optval, (int *) optlen);
-
- if (optname == SO_ERROR)
- {
- int *e = (int *) optval;
- *e = find_winsock_errno (*e);
- }
-
- if (res)
- set_winsock_errno ();
- }
-
- syscall_printf ("%d = getsockopt (%d, %d, %x (%s), %x, %d)",
- res, fd, level, optname, name, optval, optlen);
- return res;
-}
-
-/* exported as connect: standards? */
-extern "C" int
-cygwin_connect (int fd,
- const struct sockaddr *name,
- int namelen)
-{
- int res;
- BOOL secret_check_failed = FALSE;
- BOOL in_progress = FALSE;
- fhandler_socket *sock = get (fd);
- sockaddr_in sin;
- int secret [4];
- sigframe thisframe (mainthread);
-
- if (__check_invalid_read_ptr_errno (name, namelen))
- return -1;
-
- if (get_inet_addr (name, namelen, &sin, &namelen, secret) == 0)
- return -1;
-
- if (!sock)
- res = -1;
- else
- {
- res = connect (sock->get_socket (), (sockaddr *) &sin, namelen);
- if (res)
- {
- /* Special handling for connect to return the correct error code
- when called on a non-blocking socket. */
- if (sock->is_nonblocking ())
- {
- DWORD err = WSAGetLastError ();
- if (err == WSAEWOULDBLOCK || err == WSAEALREADY)
- {
- WSASetLastError (WSAEINPROGRESS);
- in_progress = TRUE;
- }
- else if (err == WSAEINVAL)
- WSASetLastError (WSAEISCONN);
- }
- set_winsock_errno ();
- }
- if (sock->get_addr_family () == AF_LOCAL &&
- sock->get_socket_type () == SOCK_STREAM)
- {
- if (!res || in_progress)
- {
- if (!sock->create_secret_event (secret))
- {
- secret_check_failed = TRUE;
- }
- else if (in_progress)
- sock->signal_secret_event ();
- }
-
- if (!secret_check_failed && !res)
- {
- if (!sock->check_peer_secret_event (&sin, secret))
- {
- debug_printf ( "accept from unauthorized server" );
- secret_check_failed = TRUE;
- }
- }
-
- if (secret_check_failed)
- {
- sock->close_secret_event ();
- if (res)
- closesocket (res);
- set_errno (ECONNREFUSED);
- res = -1;
- }
- }
- }
- return res;
-}
-
-static void
-free_servent_ptr (struct servent *&p)
-{
- if (p)
- {
- debug_printf ("servent: %s", p->s_name);
-
- if (p->s_name)
- free (p->s_name);
- if (p->s_proto)
- free (p->s_proto);
- free_char_list (p->s_aliases);
- p = NULL;
- }
-}
-
-#pragma pack(push,2)
-struct pservent
-{
- char *s_name;
- char **s_aliases;
- short s_port;
- char *s_proto;
-};
-#pragma pack(pop)
-static struct servent *
-dup_servent_ptr (struct servent *src)
-{
- if (!src)
- return NULL;
-
- struct servent *dst = (struct servent *) calloc (1, sizeof *dst);
- if (!dst)
- return NULL;
-
- debug_printf ("servent: %s", src->s_name);
-
- dst->s_port = src->s_port;
- if (src->s_name && !(dst->s_name = strdup (src->s_name)))
- goto out;
- if (src->s_aliases && !(dst->s_aliases = dup_char_list (src->s_aliases)))
- goto out;
- char *s_proto;
- if (IsBadReadPtr (src->s_proto, sizeof (src->s_proto))
- && !IsBadReadPtr (((pservent *) src)->s_proto, sizeof (src->s_proto)))
- s_proto = ((pservent *)src)->s_proto;
- else
- s_proto = src->s_proto;
-
- if (s_proto && !(dst->s_proto = strdup (s_proto)))
- goto out;
-
- debug_printf ("servent: copied %s", dst->s_name);
-
- return dst;
-
-out:
- free_servent_ptr (dst);
- return NULL;
-}
-
-#ifdef _MT_SAFE
-#define servent_buf _reent_winsup ()->_servent_buf
-#else
- static struct servent *servent_buf = NULL;
-#endif
-
-/* exported as getservbyname: standards? */
-extern "C" struct servent *
-cygwin_getservbyname (const char *name, const char *proto)
-{
- if (check_null_str_errno (name)
- || (proto != NULL && check_null_str_errno (proto)))
- return NULL;
-
- free_servent_ptr (servent_buf);
- servent_buf = dup_servent_ptr (getservbyname (name, proto));
- if (!servent_buf)
- set_winsock_errno ();
-
- syscall_printf ("%x = getservbyname (%s, %s)", servent_buf, name, proto);
- return servent_buf;
-}
-
-/* exported as getservbyport: standards? */
-extern "C" struct servent *
-cygwin_getservbyport (int port, const char *proto)
-{
- if (proto != NULL && check_null_str_errno (proto))
- return NULL;
-
- free_servent_ptr (servent_buf);
- servent_buf = dup_servent_ptr (getservbyport (port, proto));
- if (!servent_buf)
- set_winsock_errno ();
-
- syscall_printf ("%x = getservbyport (%d, %s)", servent_buf, port, proto);
- return servent_buf;
-}
-
-extern "C" int
-cygwin_gethostname (char *name, size_t len)
-{
- int PASCAL win32_gethostname (char*, int);
-
- if (__check_null_invalid_struct_errno (name, len))
- return -1;
-
- if (wsock32_handle == NULL ||
- win32_gethostname (name, len) == SOCKET_ERROR)
- {
- DWORD local_len = len;
-
- if (!GetComputerNameA (name, &local_len))
- {
- set_winsock_errno ();
- return -1;
- }
- }
- debug_printf ("name %s\n", name);
- h_errno = 0;
- return 0;
-}
-
-static void
-free_hostent_ptr (struct hostent *&p)
-{
- if (p)
- {
- debug_printf ("hostent: %s", p->h_name);
-
- if (p->h_name)
- free ((void *)p->h_name);
- free_char_list (p->h_aliases);
- free_addr_list (p->h_addr_list);
- p = NULL;
- }
-}
-
-static struct hostent *
-dup_hostent_ptr (struct hostent *src)
-{
- if (!src)
- return NULL;
-
- struct hostent *dst = (struct hostent *) calloc (1, sizeof *dst);
- if (!dst)
- return NULL;
-
- debug_printf ("hostent: %s", src->h_name);
-
- dst->h_addrtype = src->h_addrtype;
- dst->h_length = src->h_length;
- if (src->h_name && !(dst->h_name = strdup (src->h_name)))
- goto out;
- if (src->h_aliases && !(dst->h_aliases = dup_char_list (src->h_aliases)))
- goto out;
- if (src->h_addr_list
- && !(dst->h_addr_list = dup_addr_list(src->h_addr_list, src->h_length)))
- goto out;
-
- debug_printf ("hostent: copied %s", dst->h_name);
-
- return dst;
-
-out:
- free_hostent_ptr (dst);
- return NULL;
-}
-
-#ifdef _MT_SAFE
-#define hostent_buf _reent_winsup ()->_hostent_buf
-#else
- static struct hostent *hostent_buf = NULL;
-#endif
-
-/* exported as gethostbyname: standards? */
-extern "C" struct hostent *
-cygwin_gethostbyname (const char *name)
-{
- static unsigned char tmp_addr[4];
- static struct hostent tmp;
- static char *tmp_aliases[1];
- static char *tmp_addr_list[2];
- static int a, b, c, d;
-
- if (check_null_str_errno (name))
- return NULL;
-
- if (sscanf (name, "%d.%d.%d.%d", &a, &b, &c, &d) == 4)
- {
- /* In case you don't have DNS, at least x.x.x.x still works */
- memset (&tmp, 0, sizeof (tmp));
- tmp_addr[0] = a;
- tmp_addr[1] = b;
- tmp_addr[2] = c;
- tmp_addr[3] = d;
- tmp_addr_list[0] = (char *) tmp_addr;
- tmp.h_name = name;
- tmp.h_aliases = tmp_aliases;
- tmp.h_addrtype = 2;
- tmp.h_length = 4;
- tmp.h_addr_list = tmp_addr_list;
- return &tmp;
- }
-
- free_hostent_ptr (hostent_buf);
- hostent_buf = dup_hostent_ptr (gethostbyname (name));
- if (!hostent_buf)
- {
- set_winsock_errno ();
- set_host_errno ();
- }
- else
- {
- debug_printf ("h_name %s", hostent_buf->h_name);
- h_errno = 0;
- }
- return hostent_buf;
-}
-
-/* exported as gethostbyaddr: standards? */
-extern "C" struct hostent *
-cygwin_gethostbyaddr (const char *addr, int len, int type)
-{
- if (__check_null_invalid_struct_errno (addr, len))
- return NULL;
-
- free_hostent_ptr (hostent_buf);
- hostent_buf = dup_hostent_ptr (gethostbyaddr (addr, len, type));
- if (!hostent_buf)
- {
- set_winsock_errno ();
- set_host_errno ();
- }
- else
- {
- debug_printf ("h_name %s", hostent_buf->h_name);
- h_errno = 0;
- }
- return hostent_buf;
-}
-
-/* exported as accept: standards? */
-extern "C" int
-cygwin_accept (int fd, struct sockaddr *peer, int *len)
-{
- if (peer != NULL
- && (check_null_invalid_struct_errno (len)
- || __check_null_invalid_struct_errno (peer, (unsigned) *len)))
- return -1;
-
- int res = -1;
- BOOL secret_check_failed = FALSE;
- BOOL in_progress = FALSE;
- sigframe thisframe (mainthread);
-
- fhandler_socket *sock = get (fd);
- if (sock)
- {
- /* Allows NULL peer and len parameters. */
- struct sockaddr_in peer_dummy;
- int len_dummy;
- if (!peer)
- peer = (struct sockaddr *) &peer_dummy;
- if (!len)
- {
- len_dummy = sizeof (struct sockaddr_in);
- len = &len_dummy;
- }
-
- /* accept on NT fails if len < sizeof (sockaddr_in)
- * some programs set len to
- * sizeof (name.sun_family) + strlen (name.sun_path) for UNIX domain
- */
- if (len && ((unsigned) *len < sizeof (struct sockaddr_in)))
- *len = sizeof (struct sockaddr_in);
-
- res = accept (sock->get_socket (), peer, len); // can't use a blocking call inside a lock
-
- if ((SOCKET) res == (SOCKET) INVALID_SOCKET &&
- WSAGetLastError () == WSAEWOULDBLOCK)
- in_progress = TRUE;
-
- if (sock->get_addr_family () == AF_LOCAL &&
- sock->get_socket_type () == SOCK_STREAM)
- {
- if ((SOCKET) res != (SOCKET) INVALID_SOCKET || in_progress)
- {
- if (!sock->create_secret_event ())
- secret_check_failed = TRUE;
- else if (in_progress)
- sock->signal_secret_event ();
- }
-
- if (!secret_check_failed &&
- (SOCKET) res != (SOCKET) INVALID_SOCKET)
- {
- if (!sock->check_peer_secret_event ((struct sockaddr_in*) peer))
- {
- debug_printf ("connect from unauthorized client");
- secret_check_failed = TRUE;
- }
- }
-
- if (secret_check_failed)
- {
- sock->close_secret_event ();
- if ((SOCKET) res != (SOCKET) INVALID_SOCKET)
- closesocket (res);
- set_errno (ECONNABORTED);
- res = -1;
- goto done;
- }
- }
-
-
- cygheap_fdnew res_fd;
- if (res_fd < 0)
- /* FIXME: what is correct errno? */;
- else if ((SOCKET) res == (SOCKET) INVALID_SOCKET)
- set_winsock_errno ();
- else
- {
- fhandler_socket* res_fh = fdsock (res_fd, sock->get_name (), res);
- if (sock->get_addr_family () == AF_LOCAL)
- res_fh->set_sun_path (sock->get_sun_path ());
- res_fh->set_addr_family (sock->get_addr_family ());
- res_fh->set_socket_type (sock->get_socket_type ());
- res = res_fd;
- }
- }
- done:
- syscall_printf ("%d = accept (%d, %x, %x)", res, fd, peer, len);
- return res;
-}
-
-/* exported as bind: standards? */
-extern "C" int
-cygwin_bind (int fd, const struct sockaddr *my_addr, int addrlen)
-{
- if (__check_null_invalid_struct_errno (my_addr, addrlen))
- return -1;
-
- int res = -1;
-
- fhandler_socket *sock = get (fd);
- if (sock)
- {
- if (my_addr->sa_family == AF_LOCAL)
- {
-#define un_addr ((struct sockaddr_un *) my_addr)
- struct sockaddr_in sin;
- int len = sizeof sin;
- int fd;
-
- if (strlen (un_addr->sun_path) >= UNIX_PATH_LEN)
- {
- set_errno (ENAMETOOLONG);
- goto out;
- }
- sin.sin_family = AF_INET;
- sin.sin_port = 0;
- sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
- if (bind (sock->get_socket (), (sockaddr *) &sin, len))
- {
- syscall_printf ("AF_LOCAL: bind failed %d", get_errno ());
- set_winsock_errno ();
- goto out;
- }
- if (getsockname (sock->get_socket (), (sockaddr *) &sin, &len))
- {
- syscall_printf ("AF_LOCAL: getsockname failed %d", get_errno ());
- set_winsock_errno ();
- goto out;
- }
-
- sin.sin_port = ntohs (sin.sin_port);
- debug_printf ("AF_LOCAL: socket bound to port %u", sin.sin_port);
-
- /* bind must fail if file system socket object already exists
- so _open () is called with O_EXCL flag. */
- fd = _open (un_addr->sun_path,
- O_WRONLY | O_CREAT | O_EXCL | O_BINARY,
- 0);
- if (fd < 0)
- {
- if (get_errno () == EEXIST)
- set_errno (EADDRINUSE);
- goto out;
- }
-
- sock->set_connect_secret ();
-
- char buf[sizeof (SOCKET_COOKIE) + 80];
- __small_sprintf (buf, "%s%u ", SOCKET_COOKIE, sin.sin_port);
- sock->get_connect_secret (strchr (buf, '\0'));
- len = strlen (buf) + 1;
-
- /* Note that the terminating nul is written. */
- if (_write (fd, buf, len) != len)
- {
- save_errno here;
- _close (fd);
- _unlink (un_addr->sun_path);
- }
- else
- {
- _close (fd);
- chmod (un_addr->sun_path,
- (S_IFSOCK | S_IRWXU | S_IRWXG | S_IRWXO) & ~cygheap->umask);
- sock->set_sun_path (un_addr->sun_path);
- res = 0;
- }
-#undef un_addr
- }
- else if (bind (sock->get_socket (), my_addr, addrlen))
- set_winsock_errno ();
- else
- res = 0;
- }
-
-out:
- syscall_printf ("%d = bind (%d, %x, %d)", res, fd, my_addr, addrlen);
- return res;
-}
-
-/* exported as getsockname: standards? */
-extern "C" int
-cygwin_getsockname (int fd, struct sockaddr *addr, int *namelen)
-{
- if (check_null_invalid_struct_errno (namelen)
- || __check_null_invalid_struct_errno (addr, (unsigned) *namelen))
- return -1;
-
- int res = -1;
-
- fhandler_socket *sock = get (fd);
- if (sock)
- {
- if (sock->get_addr_family () == AF_LOCAL)
- {
- struct sockaddr_un *sun = (struct sockaddr_un *) addr;
- memset (sun, 0, *namelen);
- sun->sun_family = AF_LOCAL;
-
- if (!sock->get_sun_path ())
- sun->sun_path[0] = '\0';
- else
- /* According to SUSv2 "If the actual length of the address is
- greater than the length of the supplied sockaddr structure, the
- stored address will be truncated." We play it save here so
- that the path always has a trailing 0 even if it's truncated. */
- strncpy (sun->sun_path, sock->get_sun_path (),
- *namelen - sizeof *sun + sizeof sun->sun_path - 1);
-
- *namelen = sizeof *sun - sizeof sun->sun_path
- + strlen (sun->sun_path) + 1;
- res = 0;
- }
- else
- {
- res = getsockname (sock->get_socket (), addr, namelen);
- if (res)
- set_winsock_errno ();
- }
- }
- syscall_printf ("%d = getsockname (%d, %x, %d)", res, fd, addr, namelen);
- return res;
-}
-
-/* exported as listen: standards? */
-extern "C" int
-cygwin_listen (int fd, int backlog)
-{
- int res = -1;
-
-
- fhandler_socket *sock = get (fd);
- if (sock)
- {
- res = listen (sock->get_socket (), backlog);
- if (res)
- set_winsock_errno ();
- }
- syscall_printf ("%d = listen (%d, %d)", res, fd, backlog);
- return res;
-}
-
-/* exported as shutdown: standards? */
-extern "C" int
-cygwin_shutdown (int fd, int how)
-{
- int res = -1;
- sigframe thisframe (mainthread);
-
- fhandler_socket *sock = get (fd);
- if (sock)
- {
- res = shutdown (sock->get_socket (), how);
- if (res)
- set_winsock_errno ();
- else
- switch (how)
- {
- case SHUT_RD:
- sock->set_shutdown_read ();
- break;
- case SHUT_WR:
- sock->set_shutdown_write ();
- break;
- case SHUT_RDWR:
- sock->set_shutdown_read ();
- sock->set_shutdown_write ();
- break;
- }
- }
- syscall_printf ("%d = shutdown (%d, %d)", res, fd, how);
- return res;
-}
-
-/* exported as hstrerror: BSD 4.3 */
-extern "C" const char *
-cygwin_hstrerror (int err)
-{
- int i;
-
- for (i = 0; host_errmap[i].e != 0; ++i)
- if (err == host_errmap[i].e)
- break;
-
- return host_errmap[i].s;
-}
-
-/* exported as herror: BSD 4.3 */
-extern "C" void
-cygwin_herror (const char *s)
-{
- if (s && check_null_str (s))
- return;
- if (cygheap->fdtab.not_open (2))
- return;
-
- if (s)
- {
- write (2, s, strlen (s));
- write (2, ": ", 2);
- }
-
- const char *h_errstr = cygwin_hstrerror (h_errno);
-
- if (!h_errstr)
- switch (h_errno)
- {
- case NETDB_INTERNAL:
- h_errstr = "Resolver internal error";
- break;
- case NETDB_SUCCESS:
- h_errstr = "Resolver error 0 (no error)";
- break;
- default:
- h_errstr = "Unknown resolver error";
- break;
- }
- write (2, h_errstr, strlen (h_errstr));
- write (2, "\n", 1);
-}
-
-/* exported as getpeername: standards? */
-extern "C" int
-cygwin_getpeername (int fd, struct sockaddr *name, int *len)
-{
- int res;
- if (check_null_invalid_struct_errno (len)
- || __check_null_invalid_struct_errno (name, (unsigned) *len))
- return -1;
-
- fhandler_socket *h = get (fd);
-
- if (!h)
- res = -1;
- else
- {
- res = getpeername (h->get_socket (), name, len);
- if (res)
- set_winsock_errno ();
- }
-
- debug_printf ("%d = getpeername %d", res, h->get_socket ());
- return res;
-}
-
-/* exported as recv: standards? */
-extern "C" int
-cygwin_recv (int fd, void *buf, int len, unsigned int flags)
-{
- int res;
- fhandler_socket *fh = get (fd);
-
- if (__check_null_invalid_struct_errno (buf, len) || !fh)
- res = -1;
- else
- res = fh->recv (buf, len, flags);
-
- syscall_printf ("%d = recv (%d, %x, %x, %x)", res, fd, buf, len, flags);
-
- return res;
-}
-
-/* exported as send: standards? */
-extern "C" int
-cygwin_send (int fd, const void *buf, int len, unsigned int flags)
-{
- int res;
- fhandler_socket *fh = get (fd);
-
- if (__check_invalid_read_ptr_errno (buf, len) || !fh)
- res = -1;
- else
- res = fh->send (buf, len, flags);
-
- syscall_printf ("%d = send (%d, %x, %d, %x)", res, fd, buf, len, flags);
-
- return res;
-}
-
-/* getdomainname: standards? */
-extern "C" int
-getdomainname (char *domain, size_t len)
-{
- /*
- * This works for Win95 only if the machine is configured to use MS-TCP.
- * If a third-party TCP is being used this will fail.
- * FIXME: On Win95, is there a way to portably check the TCP stack
- * in use and include paths for the Domain name in each ?
- * Punt for now and assume MS-TCP on Win95.
- */
- if (__check_null_invalid_struct_errno (domain, len))
- return -1;
-
- reg_key r (HKEY_LOCAL_MACHINE, KEY_READ,
- (!wincap.is_winnt ()) ? "System" : "SYSTEM",
- "CurrentControlSet", "Services",
- (!wincap.is_winnt ()) ? "VxD" : "Tcpip",
- (!wincap.is_winnt ()) ? "MSTCP" : "Parameters",
- NULL);
-
- /* FIXME: Are registry keys case sensitive? */
- if (r.error () || r.get_string ("Domain", domain, len, "") != ERROR_SUCCESS)
- {
- __seterrno ();
- return -1;
- }
-
- return 0;
-}
-
-/* Cygwin internal */
-/* Fill out an ifconf struct. */
-
-/*
- * IFCONF 98/ME, NTSP4, W2K:
- * Use IP Helper Library
- */
-static void
-get_2k_ifconf (struct ifconf *ifc, int what)
-{
- int cnt = 0;
- char eth[2] = "/", ppp[2] = "/", slp[2] = "/", sub[2] = "0", tok[2] = "/";
-
- /* Union maps buffer to correct struct */
- struct ifreq *ifr = ifc->ifc_req;
-
- DWORD if_cnt, ip_cnt, lip, lnp;
- DWORD siz_if_table = 0;
- DWORD siz_ip_table = 0;
- PMIB_IFTABLE ift;
- PMIB_IPADDRTABLE ipt;
- struct sockaddr_in *sa = NULL;
- struct sockaddr *so = NULL;
-
- if (GetIfTable(NULL, &siz_if_table, TRUE) == ERROR_INSUFFICIENT_BUFFER &&
- GetIpAddrTable(NULL, &siz_ip_table, TRUE) == ERROR_INSUFFICIENT_BUFFER &&
- (ift = (PMIB_IFTABLE) alloca (siz_if_table)) &&
- (ipt = (PMIB_IPADDRTABLE) alloca (siz_ip_table)) &&
- !GetIfTable(ift, &siz_if_table, TRUE) &&
- !GetIpAddrTable(ipt, &siz_ip_table, TRUE))
- {
- /* Iterate over all known interfaces */
- for (if_cnt = 0; if_cnt < ift->dwNumEntries; ++if_cnt)
- {
- *sub = '0';
- /* Iterate over all configured IP-addresses */
- for (ip_cnt = 0; ip_cnt < ipt->dwNumEntries; ++ip_cnt)
- {
- /* Does the IP address belong to the interface? */
- if (ipt->table[ip_cnt].dwIndex == ift->table[if_cnt].dwIndex)
- {
- /* Setup the interface name */
- switch (ift->table[if_cnt].dwType)
- {
- case MIB_IF_TYPE_TOKENRING:
- ++*tok;
- strcpy (ifr->ifr_name, "tok");
- strcat (ifr->ifr_name, tok);
- break;
- case MIB_IF_TYPE_ETHERNET:
- if (*sub == '0')
- ++*eth;
- strcpy (ifr->ifr_name, "eth");
- strcat (ifr->ifr_name, eth);
- break;
- case MIB_IF_TYPE_PPP:
- ++*ppp;
- strcpy (ifr->ifr_name, "ppp");
- strcat (ifr->ifr_name, ppp);
- break;
- case MIB_IF_TYPE_SLIP:
- ++*slp;
- strcpy (ifr->ifr_name, "slp");
- strcat (ifr->ifr_name, slp);
- break;
- case MIB_IF_TYPE_LOOPBACK:
- strcpy (ifr->ifr_name, "lo");
- break;
- default:
- continue;
- }
- if (*sub > '0')
- {
- strcat (ifr->ifr_name, ":");
- strcat (ifr->ifr_name, sub);
- }
- ++*sub;
- /* setup sockaddr struct */
- switch (what)
- {
- case SIOCGIFCONF:
- case SIOCGIFADDR:
- sa = (struct sockaddr_in *) &ifr->ifr_addr;
- sa->sin_addr.s_addr = ipt->table[ip_cnt].dwAddr;
- sa->sin_family = AF_INET;
- sa->sin_port = 0;
- break;
- case SIOCGIFBRDADDR:
- sa = (struct sockaddr_in *) &ifr->ifr_broadaddr;
-#if 0
- /* Unfortunately, the field returns only crap. */
- sa->sin_addr.s_addr = ipt->table[ip_cnt].dwBCastAddr;
-#else
- lip = ipt->table[ip_cnt].dwAddr;
- lnp = ipt->table[ip_cnt].dwMask;
- sa->sin_addr.s_addr = lip & lnp | ~lnp;
- sa->sin_family = AF_INET;
- sa->sin_port = 0;
-#endif
- break;
- case SIOCGIFNETMASK:
- sa = (struct sockaddr_in *) &ifr->ifr_netmask;
- sa->sin_addr.s_addr = ipt->table[ip_cnt].dwMask;
- sa->sin_family = AF_INET;
- sa->sin_port = 0;
- break;
- case SIOCGIFHWADDR:
- so = &ifr->ifr_hwaddr;
- for (UINT i = 0; i < IFHWADDRLEN; ++i)
- if (i >= ift->table[if_cnt].dwPhysAddrLen)
- so->sa_data[i] = '\0';
- else
- so->sa_data[i] = ift->table[if_cnt].bPhysAddr[i];
- so->sa_family = AF_INET;
- break;
- case SIOCGIFMETRIC:
- ifr->ifr_metric = 1;
- break;
- case SIOCGIFMTU:
- ifr->ifr_mtu = ift->table[if_cnt].dwMtu;
- break;
- }
- ++cnt;
- if ((caddr_t) ++ifr >
- ifc->ifc_buf + ifc->ifc_len - sizeof (struct ifreq))
- goto done;
- }
- }
- }
- }
-done:
- /* Set the correct length */
- ifc->ifc_len = cnt * sizeof (struct ifreq);
-}
-
-/*
- * IFCONF Windows NT < SP4:
- * Look at the Bind value in
- * HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Linkage\
- * This is a REG_MULTI_SZ with strings of the form:
- * \Device\<Netcard>, where netcard is the name of the net device.
- * Then look under:
- * HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<NetCard>\
- * Parameters\Tcpip
- * at the IPAddress, Subnetmask and DefaultGateway values for the
- * required values.
- */
-static void
-get_nt_ifconf (struct ifconf *ifc, int what)
-{
- HKEY key;
- unsigned long lip, lnp;
- struct sockaddr_in *sa = NULL;
- struct sockaddr *so = NULL;
- DWORD size;
- int cnt = 1;
- char *binding = (char *) 0;
-
- /* Union maps buffer to correct struct */
- struct ifreq *ifr = ifc->ifc_req;
-
- if (RegOpenKeyEx (HKEY_LOCAL_MACHINE,
- "SYSTEM\\"
- "CurrentControlSet\\"
- "Services\\"
- "Tcpip\\"
- "Linkage",
- 0, KEY_READ, &key) == ERROR_SUCCESS)
- {
- if (RegQueryValueEx (key, "Bind",
- NULL, NULL,
- NULL, &size) == ERROR_SUCCESS)
- {
- binding = (char *) alloca (size);
- if (RegQueryValueEx (key, "Bind",
- NULL, NULL,
- (unsigned char *) binding,
- &size) != ERROR_SUCCESS)
- {
- binding = NULL;
- }
- }
- RegCloseKey (key);
- }
-
- if (binding)
- {
- char *bp, eth[2] = "/";
- char cardkey[256], ipaddress[256], netmask[256];
-
- for (bp = binding; *bp; bp += strlen (bp) + 1)
- {
- bp += strlen ("\\Device\\");
- strcpy (cardkey, "SYSTEM\\CurrentControlSet\\Services\\");
- strcat (cardkey, bp);
- strcat (cardkey, "\\Parameters\\Tcpip");
-
- if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, cardkey,
- 0, KEY_READ, &key) != ERROR_SUCCESS)
- continue;
-
- if (RegQueryValueEx (key, "IPAddress",
- NULL, NULL,
- (unsigned char *) ipaddress,
- (size = 256, &size)) == ERROR_SUCCESS
- && RegQueryValueEx (key, "SubnetMask",
- NULL, NULL,
- (unsigned char *) netmask,
- (size = 256, &size)) == ERROR_SUCCESS)
- {
- char *ip, *np;
- char dhcpaddress[256], dhcpnetmask[256];
-
- for (ip = ipaddress, np = netmask;
- *ip && *np;
- ip += strlen (ip) + 1, np += strlen (np) + 1)
- {
- if ((caddr_t) ++ifr > ifc->ifc_buf
- + ifc->ifc_len
- - sizeof (struct ifreq))
- break;
-
- if (! strncmp (bp, "NdisWan", 7))
- {
- strcpy (ifr->ifr_name, "ppp");
- strcat (ifr->ifr_name, bp + 7);
- }
- else
- {
- ++*eth;
- strcpy (ifr->ifr_name, "eth");
- strcat (ifr->ifr_name, eth);
- }
- memset (&ifr->ifr_addr, '\0', sizeof ifr->ifr_addr);
- if (cygwin_inet_addr (ip) == 0L
- && RegQueryValueEx (key, "DhcpIPAddress",
- NULL, NULL,
- (unsigned char *) dhcpaddress,
- (size = 256, &size))
- == ERROR_SUCCESS
- && RegQueryValueEx (key, "DhcpSubnetMask",
- NULL, NULL,
- (unsigned char *) dhcpnetmask,
- (size = 256, &size))
- == ERROR_SUCCESS)
- {
- switch (what)
- {
- case SIOCGIFCONF:
- case SIOCGIFADDR:
- sa = (struct sockaddr_in *) &ifr->ifr_addr;
- sa->sin_addr.s_addr = cygwin_inet_addr (dhcpaddress);
- sa->sin_family = AF_INET;
- sa->sin_port = 0;
- break;
- case SIOCGIFBRDADDR:
- lip = cygwin_inet_addr (dhcpaddress);
- lnp = cygwin_inet_addr (dhcpnetmask);
- sa = (struct sockaddr_in *) &ifr->ifr_broadaddr;
- sa->sin_addr.s_addr = lip & lnp | ~lnp;
- sa->sin_family = AF_INET;
- sa->sin_port = 0;
- break;
- case SIOCGIFNETMASK:
- sa = (struct sockaddr_in *) &ifr->ifr_netmask;
- sa->sin_addr.s_addr =
- cygwin_inet_addr (dhcpnetmask);
- sa->sin_family = AF_INET;
- sa->sin_port = 0;
- break;
- case SIOCGIFHWADDR:
- so = &ifr->ifr_hwaddr;
- memset (so->sa_data, 0, IFHWADDRLEN);
- so->sa_family = AF_INET;
- break;
- case SIOCGIFMETRIC:
- ifr->ifr_metric = 1;
- break;
- case SIOCGIFMTU:
- ifr->ifr_mtu = 1500;
- break;
- }
- }
- else
- {
- switch (what)
- {
- case SIOCGIFCONF:
- case SIOCGIFADDR:
- sa = (struct sockaddr_in *) &ifr->ifr_addr;
- sa->sin_addr.s_addr = cygwin_inet_addr (ip);
- sa->sin_family = AF_INET;
- sa->sin_port = 0;
- break;
- case SIOCGIFBRDADDR:
- lip = cygwin_inet_addr (ip);
- lnp = cygwin_inet_addr (np);
- sa = (struct sockaddr_in *) &ifr->ifr_broadaddr;
- sa->sin_addr.s_addr = lip & lnp | ~lnp;
- sa->sin_family = AF_INET;
- sa->sin_port = 0;
- break;
- case SIOCGIFNETMASK:
- sa = (struct sockaddr_in *) &ifr->ifr_netmask;
- sa->sin_addr.s_addr = cygwin_inet_addr (np);
- sa->sin_family = AF_INET;
- sa->sin_port = 0;
- break;
- case SIOCGIFHWADDR:
- so = &ifr->ifr_hwaddr;
- memset (so->sa_data, 0, IFHWADDRLEN);
- so->sa_family = AF_INET;
- break;
- case SIOCGIFMETRIC:
- ifr->ifr_metric = 1;
- break;
- case SIOCGIFMTU:
- ifr->ifr_mtu = 1500;
- break;
- }
- }
- ++cnt;
- }
- }
- RegCloseKey (key);
- }
- }
-
- /* Set the correct length */
- ifc->ifc_len = cnt * sizeof (struct ifreq);
-}
-
-/*
- * IFCONF Windows 95:
- * HKLM/Enum/Network/MSTCP/"*"
- * -> Value "Driver" enthält Subkey relativ zu
- * HKLM/System/CurrentControlSet/Class/
- * -> In Subkey "Bindings" die Values aufzählen
- * -> Enthält Subkeys der Form "VREDIR\*"
- * Das * ist ein Subkey relativ zu
- * HKLM/System/CurrentControlSet/Class/Net/
- * HKLM/System/CurrentControlSet/Class/"Driver"
- * -> Value "IPAddress"
- * -> Value "IPMask"
- * HKLM/System/CurrentControlSet/Class/Net/"*"(aus "VREDIR\*")
- * -> Wenn Value "AdapterName" == "MS$PPP" -> ppp interface
- * -> Value "DriverDesc" enthält den Namen
- *
- */
-static void
-get_95_ifconf (struct ifconf *ifc, int what)
-{
- HKEY key;
- unsigned long lip, lnp;
- struct sockaddr_in *sa = NULL;
- struct sockaddr *so = NULL;
- FILETIME update;
- LONG res;
- DWORD size;
- int cnt = 1;
- char ifname[256];
- char eth[2] = "/";
- char ppp[2] = "/";
-
- /* Union maps buffer to correct struct */
- struct ifreq *ifr = ifc->ifc_req;
-
- if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, "Enum\\Network\\MSTCP",
- 0, KEY_READ, &key) != ERROR_SUCCESS)
- {
- /* Set the correct length */
- ifc->ifc_len = cnt * sizeof (struct ifreq);
- return;
- }
-
- for (int i = 0;
- (res = RegEnumKeyEx (key, i, ifname,
- (size = sizeof ifname, &size),
- 0, 0, 0, &update)) != ERROR_NO_MORE_ITEMS;
- ++i)
- {
- HKEY ifkey, subkey;
- char driver[256], classname[256], netname[256];
- char adapter[256], ip[256], np[256];
-
- if (res != ERROR_SUCCESS
- || RegOpenKeyEx (key, ifname, 0,
- KEY_READ, &ifkey) != ERROR_SUCCESS)
- continue;
-
- if (RegQueryValueEx (ifkey, "Driver", 0,
- NULL, (unsigned char *) driver,
- (size = sizeof driver, &size)) != ERROR_SUCCESS)
- {
- RegCloseKey (ifkey);
- continue;
- }
-
- strcpy (classname, "System\\CurrentControlSet\\Services\\Class\\");
- strcat (classname, driver);
- if ((res = RegOpenKeyEx (HKEY_LOCAL_MACHINE, classname,
- 0, KEY_READ, &subkey)) != ERROR_SUCCESS)
- {
- RegCloseKey (ifkey);
- continue;
- }
-
- if (RegQueryValueEx (subkey, "IPAddress", 0,
- NULL, (unsigned char *) ip,
- (size = sizeof ip, &size)) == ERROR_SUCCESS
- && RegQueryValueEx (subkey, "IPMask", 0,
- NULL, (unsigned char *) np,
- (size = sizeof np, &size)) == ERROR_SUCCESS)
- {
- if ((caddr_t)++ifr > ifc->ifc_buf
- + ifc->ifc_len
- - sizeof (struct ifreq))
- goto out;
-
- switch (what)
- {
- case SIOCGIFCONF:
- case SIOCGIFADDR:
- sa = (struct sockaddr_in *) &ifr->ifr_addr;
- sa->sin_addr.s_addr = cygwin_inet_addr (ip);
- sa->sin_family = AF_INET;
- sa->sin_port = 0;
- break;
- case SIOCGIFBRDADDR:
- lip = cygwin_inet_addr (ip);
- lnp = cygwin_inet_addr (np);
- sa = (struct sockaddr_in *) &ifr->ifr_broadaddr;
- sa->sin_addr.s_addr = lip & lnp | ~lnp;
- sa->sin_family = AF_INET;
- sa->sin_port = 0;
- break;
- case SIOCGIFNETMASK:
- sa = (struct sockaddr_in *) &ifr->ifr_netmask;
- sa->sin_addr.s_addr = cygwin_inet_addr (np);
- sa->sin_family = AF_INET;
- sa->sin_port = 0;
- break;
- case SIOCGIFHWADDR:
- so = &ifr->ifr_hwaddr;
- memset (so->sa_data, 0, IFHWADDRLEN);
- so->sa_family = AF_INET;
- break;
- case SIOCGIFMETRIC:
- ifr->ifr_metric = 1;
- break;
- case SIOCGIFMTU:
- ifr->ifr_mtu = 1500;
- break;
- }
- }
-
- RegCloseKey (subkey);
-
- strcpy (netname, "System\\CurrentControlSet\\Services\\Class\\Net\\");
- strcat (netname, ifname);
-
- if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, netname,
- 0, KEY_READ, &subkey) != ERROR_SUCCESS)
- {
- RegCloseKey (ifkey);
- --ifr;
- continue;
- }
-
- if (RegQueryValueEx (subkey, "AdapterName", 0,
- NULL, (unsigned char *) adapter,
- (size = sizeof adapter, &size)) == ERROR_SUCCESS
- && strcasematch (adapter, "MS$PPP"))
- {
- ++*ppp;
- strcpy (ifr->ifr_name, "ppp");
- strcat (ifr->ifr_name, ppp);
- }
- else
- {
- ++*eth;
- strcpy (ifr->ifr_name, "eth");
- strcat (ifr->ifr_name, eth);
- }
-
- RegCloseKey (subkey);
- RegCloseKey (ifkey);
-
- ++cnt;
- }
-
-out:
-
- RegCloseKey (key);
-
- /* Set the correct length */
- ifc->ifc_len = cnt * sizeof (struct ifreq);
-}
-
-int
-get_ifconf (struct ifconf *ifc, int what)
-{
- unsigned long lip, lnp;
- struct sockaddr_in *sa;
-
- if (check_null_invalid_struct_errno (ifc))
- return -1;
-
- /* Union maps buffer to correct struct */
- struct ifreq *ifr = ifc->ifc_req;
-
- /* Ensure we have space for two struct ifreqs, fail if not. */
- if (ifc->ifc_len < (int) (2 * sizeof (struct ifreq)))
- {
- set_errno (EFAULT);
- return -1;
- }
-
- /* Set up interface lo0 first */
- strcpy (ifr->ifr_name, "lo");
- memset (&ifr->ifr_addr, '\0', sizeof (ifr->ifr_addr));
- switch (what)
- {
- case SIOCGIFCONF:
- case SIOCGIFADDR:
- sa = (struct sockaddr_in *) &ifr->ifr_addr;
- sa->sin_addr.s_addr = htonl (INADDR_LOOPBACK);
- sa->sin_family = AF_INET;
- sa->sin_port = 0;
- break;
- case SIOCGIFBRDADDR:
- lip = htonl (INADDR_LOOPBACK);
- lnp = cygwin_inet_addr ("255.0.0.0");
- sa = (struct sockaddr_in *) &ifr->ifr_broadaddr;
- sa->sin_addr.s_addr = lip & lnp | ~lnp;
- sa->sin_family = AF_INET;
- sa->sin_port = 0;
- break;
- case SIOCGIFNETMASK:
- sa = (struct sockaddr_in *) &ifr->ifr_netmask;
- sa->sin_addr.s_addr = cygwin_inet_addr ("255.0.0.0");
- sa->sin_family = AF_INET;
- sa->sin_port = 0;
- break;
- case SIOCGIFHWADDR:
- ifr->ifr_hwaddr.sa_family = AF_INET;
- memset (ifr->ifr_hwaddr.sa_data, 0, IFHWADDRLEN);
- break;
- case SIOCGIFMETRIC:
- ifr->ifr_metric = 1;
- break;
- case SIOCGIFMTU:
- /* This funny value is returned by `ifconfig lo' on Linux 2.2 kernel. */
- ifr->ifr_mtu = 3924;
- break;
- default:
- set_errno (EINVAL);
- return -1;
- }
-
- OSVERSIONINFO os_version_info;
- memset (&os_version_info, 0, sizeof os_version_info);
- os_version_info.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
- GetVersionEx (&os_version_info);
- if (wincap.has_ip_helper_lib ())
- get_2k_ifconf (ifc, what);
- else if (wincap.is_winnt ())
- get_nt_ifconf (ifc, what);
- else
- get_95_ifconf (ifc, what);
- return 0;
-}
-
-/* exported as rcmd: standards? */
-extern "C" int
-cygwin_rcmd (char **ahost, unsigned short inport, char *locuser,
- char *remuser, char *cmd, int *fd2p)
-{
- int res = -1;
- SOCKET fd2s;
- sigframe thisframe (mainthread);
-
- if (check_null_invalid_struct_errno (ahost) ||
- check_null_empty_str_errno (*ahost) ||
- (locuser && check_null_empty_str_errno (locuser)) ||
- (remuser && check_null_str_errno (remuser)))
- return (int) INVALID_SOCKET;
-
- cygheap_fdnew res_fd;
- if (res_fd < 0)
- goto done;
-
- if (fd2p)
- {
- cygheap_fdnew newfd (res_fd, false);
- if (*fd2p < 0)
- goto done;
- *fd2p = newfd;
- }
-
- res = rcmd (ahost, inport, locuser, remuser, cmd, fd2p ? &fd2s : NULL);
- if (res == (int) INVALID_SOCKET)
- goto done;
- else
- {
- fdsock (res_fd, "/dev/tcp", res);
- res = res_fd;
- }
-
- if (fd2p)
- fdsock (*fd2p, "/dev/tcp", fd2s);
-
-done:
- syscall_printf ("%d = rcmd (...)", res);
- return res;
-}
-
-/* exported as rresvport: standards? */
-extern "C" int
-cygwin_rresvport (int *port)
-{
- int res;
- sigframe thisframe (mainthread);
-
- if (check_null_invalid_struct_errno (port))
- return -1;
-
- cygheap_fdnew res_fd;
- if (res_fd < 0)
- res = -1;
- else
- {
- res = rresvport (port);
-
- if (res != (int) INVALID_SOCKET)
- {
- fdsock (res_fd, "/dev/tcp", res);
- res = res_fd;
- }
- }
-
- syscall_printf ("%d = rresvport (%d)", res, port ? *port : 0);
- return res;
-}
-
-/* exported as rexec: standards? */
-extern "C" int
-cygwin_rexec (char **ahost, unsigned short inport, char *locuser,
- char *password, char *cmd, int *fd2p)
-{
- int res = -1;
- SOCKET fd2s;
- sigframe thisframe (mainthread);
-
- if (check_null_invalid_struct_errno (ahost) ||
- check_null_empty_str_errno (*ahost) ||
- (locuser && check_null_empty_str_errno (locuser)) ||
- (password && check_null_str_errno (password)))
- return (int) INVALID_SOCKET;
-
- cygheap_fdnew res_fd;
- if (res_fd < 0)
- goto done;
- if (fd2p)
- {
- cygheap_fdnew newfd (res_fd);
- if (newfd < 0)
- goto done;
- *fd2p = newfd;
- }
- res = rexec (ahost, inport, locuser, password, cmd, fd2p ? &fd2s : NULL);
- if (res == (int) INVALID_SOCKET)
- goto done;
- else
- {
- fdsock (res_fd, "/dev/tcp", res);
- res = res_fd;
- }
- if (fd2p)
- fdsock (*fd2p, "/dev/tcp", fd2s);
-
-done:
- syscall_printf ("%d = rexec (...)", res);
- return res;
-}
-
-/* socketpair: standards? */
-/* Win32 supports AF_INET only, so ignore domain and protocol arguments */
-extern "C" int
-socketpair (int family, int type, int protocol, int *sb)
-{
- int res = -1;
- SOCKET insock, outsock, newsock;
- struct sockaddr_in sock_in, sock_out;
- int len;
- cygheap_fdnew sb0;
- fhandler_socket *fh;
-
- if (__check_null_invalid_struct_errno (sb, 2 * sizeof(int)))
- return -1;
-
- if (family != AF_LOCAL && family != AF_INET)
- {
- set_errno (EAFNOSUPPORT);
- goto done;
- }
- if (type != SOCK_STREAM && type != SOCK_DGRAM)
- {
- set_errno (EPROTOTYPE);
- goto done;
- }
- if ((family == AF_LOCAL && protocol != PF_UNSPEC && protocol != PF_LOCAL)
- || (family == AF_INET && protocol != PF_UNSPEC && protocol != PF_INET))
- {
- set_errno (EPROTONOSUPPORT);
- goto done;
- }
-
- if (sb0 < 0)
- goto done;
- else
- {
- sb[0] = sb0;
- cygheap_fdnew sb1 (sb0, false);
- if (sb1 < 0)
- goto done;
-
- sb[1] = sb1;
- }
-
- /* create the first socket */
- newsock = socket (AF_INET, type, 0);
- if (newsock == INVALID_SOCKET)
- {
- debug_printf ("first socket call failed");
- set_winsock_errno ();
- goto done;
- }
-
- /* bind the socket to any unused port */
- sock_in.sin_family = AF_INET;
- sock_in.sin_port = 0;
- sock_in.sin_addr.s_addr = INADDR_ANY;
- if (bind (newsock, (struct sockaddr *) &sock_in, sizeof (sock_in)) < 0)
- {
- debug_printf ("bind failed");
- set_winsock_errno ();
- closesocket (newsock);
- goto done;
- }
- len = sizeof (sock_in);
- if (getsockname (newsock, (struct sockaddr *) &sock_in, &len) < 0)
- {
- debug_printf ("getsockname error");
- set_winsock_errno ();
- closesocket (newsock);
- goto done;
- }
-
- /* For stream sockets, create a listener */
- if (type == SOCK_STREAM)
- listen (newsock, 2);
-
- /* create a connecting socket */
- outsock = socket (AF_INET, type, 0);
- if (outsock == INVALID_SOCKET)
- {
- debug_printf ("second socket call failed");
- set_winsock_errno ();
- closesocket (newsock);
- goto done;
- }
-
- /* For datagram sockets, bind the 2nd socket to an unused address, too */
- if (type == SOCK_DGRAM)
- {
- sock_out.sin_family = AF_INET;
- sock_out.sin_port = 0;
- sock_out.sin_addr.s_addr = INADDR_ANY;
- if (bind (outsock, (struct sockaddr *) &sock_out, sizeof (sock_out)) < 0)
- {
- debug_printf ("bind failed");
- set_winsock_errno ();
- closesocket (newsock);
- closesocket (outsock);
- goto done;
- }
- len = sizeof (sock_out);
- if (getsockname (outsock, (struct sockaddr *) &sock_out, &len) < 0)
- {
- debug_printf ("getsockname error");
- set_winsock_errno ();
- closesocket (newsock);
- closesocket (outsock);
- goto done;
- }
- }
-
- /* Force IP address to loopback */
- sock_in.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
- if (type == SOCK_DGRAM)
- sock_out.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
-
- /* Do a connect */
- if (connect (outsock, (struct sockaddr *) &sock_in,
- sizeof (sock_in)) < 0)
- {
- debug_printf ("connect error");
- set_winsock_errno ();
- closesocket (newsock);
- closesocket (outsock);
- goto done;
- }
-
- if (type == SOCK_STREAM)
- {
- /* For stream sockets, accept the connection and close the listener */
- len = sizeof (sock_in);
- insock = accept (newsock, (struct sockaddr *) &sock_in, &len);
- if (insock == INVALID_SOCKET)
- {
- debug_printf ("accept error");
- set_winsock_errno ();
- closesocket (newsock);
- closesocket (outsock);
- goto done;
- }
- closesocket (newsock);
- }
- else
- {
- /* For datagram sockets, connect the 2nd socket */
- if (connect (newsock, (struct sockaddr *) &sock_out,
- sizeof (sock_out)) < 0)
- {
- debug_printf ("connect error");
- set_winsock_errno ();
- closesocket (newsock);
- closesocket (outsock);
- goto done;
- }
- insock = newsock;
- }
-
- res = 0;
-
- if (family == AF_LOCAL)
- {
-
- fh = fdsock (sb[0],
- type == SOCK_STREAM ? "/dev/streamsocket" : "/dev/dgsocket",
- insock);
- fh->set_sun_path ("");
- fh->set_addr_family (AF_LOCAL);
- fh->set_socket_type (type);
- fh = fdsock (sb[1],
- type == SOCK_STREAM ? "/dev/streamsocket" : "/dev/dgsocket",
- outsock);
- fh->set_sun_path ("");
- fh->set_addr_family (AF_LOCAL);
- fh->set_socket_type (type);
- }
- else
- {
- fh = fdsock (sb[0], type == SOCK_STREAM ? "/dev/tcp" : "/dev/udp",
- insock);
- fh->set_addr_family (AF_INET);
- fh->set_socket_type (type);
- fh = fdsock (sb[1], type == SOCK_STREAM ? "/dev/tcp" : "/dev/udp",
- outsock);
- fh->set_addr_family (AF_INET);
- fh->set_socket_type (type);
- }
-
-done:
- syscall_printf ("%d = socketpair (...)", res);
- return res;
-}
-
-/* sethostent: standards? */
-extern "C" void
-sethostent (int)
-{
-}
-
-/* endhostent: standards? */
-extern "C" void
-endhostent (void)
-{
-}
-
-/* exported as recvmsg: standards? */
-extern "C" int
-cygwin_recvmsg(int s, struct msghdr *msg, int flags)
-{
- int ret, nb;
- size_t tot = 0;
- int i;
- char *buf, *p;
- struct iovec *iov = msg->msg_iov;
-
- for(i = 0; i < msg->msg_iovlen; ++i)
- tot += iov[i].iov_len;
- buf = (char *) malloc(tot);
- if (tot != 0 && buf == NULL)
- {
- errno = ENOMEM;
- return -1;
- }
- nb = ret = cygwin_recvfrom (s, buf, tot, flags,
- (struct sockaddr *) msg->msg_name, (int *) &msg->msg_namelen);
- p = buf;
- while (nb > 0)
- {
- ssize_t cnt = min(nb, iov->iov_len);
-
- memcpy (iov->iov_base, p, cnt);
- p += cnt;
- nb -= cnt;
- ++iov;
- }
- free(buf);
- return ret;
-}
-
-/* exported as sendmsg: standards? */
-extern "C" int
-cygwin_sendmsg(int s, const struct msghdr *msg, int flags)
-{
- int ret;
- size_t tot = 0;
- int i;
- char *buf, *p;
- struct iovec *iov = msg->msg_iov;
-
- for(i = 0; i < msg->msg_iovlen; ++i)
- tot += iov[i].iov_len;
- buf = (char *) malloc(tot);
- if (tot != 0 && buf == NULL)
- {
- errno = ENOMEM;
- return -1;
- }
- p = buf;
- for (i = 0; i < msg->msg_iovlen; ++i)
- {
- memcpy (p, iov[i].iov_base, iov[i].iov_len);
- p += iov[i].iov_len;
- }
- ret = cygwin_sendto (s, buf, tot, flags,
- (struct sockaddr *) msg->msg_name, msg->msg_namelen);
- free (buf);
- return ret;
-}
diff --git a/winsup/cygwin/newsym b/winsup/cygwin/newsym
deleted file mode 100755
index 688a8c6f8..000000000
--- a/winsup/cygwin/newsym
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh -x
-lib=$1; shift
-as=$1; shift
-ar=$1; shift
-ranlib=$1; shift
-rm -rf newsym.dir
-trap "rm -rf newsym.dir" 0 1 2 15
-mkdir newsym.dir
-while [ -n "$1" ]; do
- newsym=$1; shift
- oldsym=$1; shift
- cat <<EOF > newsym.dir/$newsym.s
- .section .idata$6
- .extern __imp__$oldsym
- .extern __head_cygwin1_dll
- .section .text
- .global _$newsym
-_$newsym:
- jmp *__imp__$oldsym
-EOF
- $as -o newsym.dir/$newsym.o newsym.dir/$newsym.s
-done
-$ar cru $lib newsym.dir/*.o
-$ranlib $lib
diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h
deleted file mode 100644
index f10d27dcf..000000000
--- a/winsup/cygwin/ntdll.h
+++ /dev/null
@@ -1,392 +0,0 @@
-/* ntdll.h. Contains ntdll specific stuff not defined elsewhere.
-
- Copyright 2000, 2001 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 STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS) 0xc0000004)
-#define FILE_SYNCHRONOUS_IO_NONALERT 32
-#define PDI_MODULES 0x01
-#define PDI_HEAPS 0x04
-#define LDRP_IMAGE_DLL 0x00000004
-#define WSLE_PAGE_READONLY 0x001
-#define WSLE_PAGE_EXECUTE 0x002
-#define WSLE_PAGE_EXECUTE_READ 0x003
-#define WSLE_PAGE_READWRITE 0x004
-#define WSLE_PAGE_WRITECOPY 0x005
-#define WSLE_PAGE_EXECUTE_READWRITE 0x006
-#define WSLE_PAGE_EXECUTE_WRITECOPY 0x007
-#define WSLE_PAGE_SHARE_COUNT_MASK 0x0E0
-#define WSLE_PAGE_SHAREABLE 0x100
-
-typedef ULONG KAFFINITY;
-
-typedef enum _SYSTEM_INFORMATION_CLASS
-{
- SystemBasicInformation = 0,
- SystemPerformanceInformation = 2,
- SystemTimeOfDayInformation = 3,
- SystemProcessesAndThreadsInformation = 5,
- SystemProcessorTimes = 8,
- /* There are a lot more of these... */
-} SYSTEM_INFORMATION_CLASS;
-
-typedef struct _SYSTEM_BASIC_INFORMATION
-{
- ULONG Unknown;
- ULONG MaximumIncrement;
- ULONG PhysicalPageSize;
- ULONG NumberOfPhysicalPages;
- ULONG LowestPhysicalPage;
- ULONG HighestPhysicalPage;
- ULONG AllocationGranularity;
- ULONG LowestUserAddress;
- ULONG HighestUserAddress;
- ULONG ActiveProcessors;
- UCHAR NumberProcessors;
-} SYSTEM_BASIC_INFORMATION, *PSYSTEM_BASIC_INFORMATION;
-
-typedef struct _SYSTEM_PROCESSOR_TIMES
-{
- LARGE_INTEGER IdleTime;
- LARGE_INTEGER KernelTime;
- LARGE_INTEGER UserTime;
- LARGE_INTEGER DpcTime;
- LARGE_INTEGER InterruptTime;
- ULONG InterruptCount;
-} SYSTEM_PROCESSOR_TIMES, *PSYSTEM_PROCESSOR_TIMES;
-
-typedef LONG KPRIORITY;
-typedef struct _VM_COUNTERS
-{
- ULONG PeakVirtualSize;
- ULONG VirtualSize;
- ULONG PageFaultCount;
- ULONG PeakWorkingSetSize;
- ULONG WorkingSetSize;
- ULONG QuotaPeakPagedPoolUsage;
- ULONG QuotaPagedPoolUsage;
- ULONG QuotaPeakNonPagedPoolUsage;
- ULONG QuotaNonPagedPoolUsage;
- ULONG PagefileUsage;
- ULONG PeakPagefileUsage;
-} VM_COUNTERS, *PVM_COUNTERS;
-
-typedef struct _CLIENT_ID
-{
- HANDLE UniqueProcess;
- HANDLE UniqueThread;
-} CLIENT_ID, *PCLIENT_ID;
-
-typedef enum
-{
- StateInitialized,
- StateReady,
- StateRunning,
- StateStandby,
- StateTerminated,
- StateWait,
- StateTransition,
- StateUnknown,
-} THREAD_STATE;
-
-typedef enum
-{
- Executive,
- FreePage,
- PageIn,
- PoolAllocation,
- DelayExecution,
- Suspended,
- UserRequest,
- WrExecutive,
- WrFreePage,
- WrPageIn,
- WrPoolAllocation,
- WrDelayExecution,
- WrSuspended,
- WrUserRequest,
- WrEventPair,
- WrQueue,
- WrLpcReceive,
- WrLpcReply,
- WrVirtualMemory,
- WrPageOut,
- WrRendezvous,
- Spare2,
- Spare3,
- Spare4,
- Spare5,
- Spare6,
- WrKernel,
- MaximumWaitReason
-} KWAIT_REASON;
-
-typedef struct _SYSTEM_THREADS
-{
- LARGE_INTEGER KernelTime;
- LARGE_INTEGER UserTime;
- LARGE_INTEGER CreateTime;
- ULONG WaitTime;
- PVOID StartAddress;
- CLIENT_ID ClientId;
- KPRIORITY Priority;
- KPRIORITY BasePriority;
- ULONG ContextSwitchCount;
- THREAD_STATE State;
- KWAIT_REASON WaitReason;
- DWORD Reserved;
-} SYSTEM_THREADS, *PSYSTEM_THREADS;
-
-typedef struct _SYSTEM_PROCESSES
-{
- ULONG NextEntryDelta;
- ULONG ThreadCount;
- ULONG Reserved1[6];
- LARGE_INTEGER CreateTime;
- LARGE_INTEGER UserTime;
- LARGE_INTEGER KernelTime;
- UNICODE_STRING ProcessName;
- KPRIORITY BasePriority;
- ULONG ProcessId;
- ULONG InheritedFromProcessId;
- ULONG HandleCount;
- ULONG Reserved2[2];
- VM_COUNTERS VmCounters;
- IO_COUNTERS IoCounters;
- SYSTEM_THREADS Threads[1];
-} SYSTEM_PROCESSES, *PSYSTEM_PROCESSES;
-
-typedef struct _IO_STATUS_BLOCK
-{
- NTSTATUS Status;
- ULONG Information;
-} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
-
-typedef struct _SYSTEM_PERFORMANCE_INFORMATION
-{
- LARGE_INTEGER IdleTime;
- LARGE_INTEGER ReadTransferCount;
- LARGE_INTEGER WriteTransferCount;
- LARGE_INTEGER OtherTransferCount;
- ULONG ReadOperationCount;
- ULONG WriteOperationCount;
- ULONG OtherOperationCount;
- ULONG AvailablePages;
- ULONG TotalCommittedPages;
- ULONG TotalCommitLimit;
- ULONG PeakCommitment;
- ULONG PageFaults;
- ULONG WriteCopyFaults;
- ULONG TransitionFaults;
- ULONG Reserved1;
- ULONG DemandZeroFaults;
- ULONG PagesRead;
- ULONG PageReadIos;
- ULONG Reserved2[2];
- ULONG PagefilePagesWritten;
- ULONG PagefilePageWriteIos;
- ULONG MappedFilePagesWritten;
- ULONG MappedFilePageWriteIos;
- ULONG PagedPoolUsage;
- ULONG NonPagedPoolUsage;
- ULONG PagedPoolAllocs;
- ULONG PagedPoolFrees;
- ULONG NonPagedPoolAllocs;
- ULONG NonPagedPoolFrees;
- ULONG TotalFreeSystemPtes;
- ULONG SystemCodePage;
- ULONG TotalSystemDriverPages;
- ULONG TotalSystemCodePages;
- ULONG SmallNonPagedLookasideListAllocateHits;
- ULONG SmallPagedLookasideListAllocateHits;
- ULONG Reserved3;
- ULONG MmSystemCachePage;
- ULONG PagedPoolPage;
- ULONG SystemDriverPage;
- ULONG FastReadNoWait;
- ULONG FastReadWait;
- ULONG FastReadResourceMiss;
- ULONG FastReadNotPossible;
- ULONG FastMdlReadNoWait;
- ULONG FastMdlReadWait;
- ULONG FastMdlReadResourceMiss;
- ULONG FastMdlReadNotPossible;
- ULONG MapDataNoWait;
- ULONG MapDataWait;
- ULONG MapDataNoWaitMiss;
- ULONG MapDataWaitMiss;
- ULONG PinMappedDataCount;
- ULONG PinReadNoWait;
- ULONG PinReadWait;
- ULONG PinReadNoWaitMiss;
- ULONG PinReadWaitMiss;
- ULONG CopyReadNoWait;
- ULONG CopyReadWait;
- ULONG CopyReadNoWaitMiss;
- ULONG CopyReadWaitMiss;
- ULONG MdlReadNoWait;
- ULONG MdlReadWait;
- ULONG MdlReadNoWaitMiss;
- ULONG MdlReadWaitMiss;
- ULONG ReadAheadIos;
- ULONG LazyWriteIos;
- ULONG LazyWritePages;
- ULONG DataFlushes;
- ULONG DataPages;
- ULONG ContextSwitches;
- ULONG FirstLevelTbFills;
- ULONG SecondLevelTbFills;
- ULONG SystemCalls;
-} SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION;
-
-typedef struct _SYSTEM_TIME_OF_DAY_INFORMATION
-{
- LARGE_INTEGER BootTime;
- LARGE_INTEGER CurrentTime;
- LARGE_INTEGER TimeZoneBias;
- ULONG CurrentTimeZoneId;
-} SYSTEM_TIME_OF_DAY_INFORMATION, *PSYSTEM_TIME_OF_DAY_INFORMATION;
-
-typedef enum _PROCESSINFOCLASS
-{
- ProcessBasicInformation = 0,
- ProcessQuotaLimits = 1,
- ProcessVmCounters = 3,
- ProcessTimes =4,
-} PROCESSINFOCLASS;
-
-typedef struct _DEBUG_BUFFER
-{
- HANDLE SectionHandle;
- PVOID SectionBase;
- PVOID RemoteSectionBase;
- ULONG SectionBaseDelta;
- HANDLE EventPairHandle;
- ULONG Unknown[2];
- HANDLE RemoteThreadHandle;
- ULONG InfoClassMask;
- ULONG SizeOfInfo;
- ULONG AllocatedSize;
- ULONG SectionSize;
- PVOID ModuleInformation;
- PVOID BackTraceInformation;
- PVOID HeapInformation;
- PVOID LockInformation;
- PVOID Reserved[9];
-} DEBUG_BUFFER, *PDEBUG_BUFFER;
-
-typedef struct _DEBUG_HEAP_INFORMATION
-{
- ULONG Base;
- ULONG Flags;
- USHORT Granularity;
- USHORT Unknown;
- ULONG Allocated;
- ULONG Committed;
- ULONG TagCount;
- ULONG BlockCount;
- ULONG Reserved[7];
- PVOID Tags;
- PVOID Blocks;
-} DEBUG_HEAP_INFORMATION, *PDEBUG_HEAP_INFORMATION;
-
-typedef struct _DEBUG_MODULE_INFORMATION
-{
- ULONG Reserved[2];
- ULONG Base;
- ULONG Size;
- ULONG Flags;
- USHORT Index;
- USHORT Unknown;
- USHORT LoadCount;
- USHORT ModuleNameOffset;
- CHAR ImageName[256];
-} DEBUG_MODULE_INFORMATION, *PDEBUG_MODULE_INFORMATION;
-
-typedef struct _KERNEL_USER_TIMES
-{
- LARGE_INTEGER CreateTime;
- LARGE_INTEGER ExitTime;
- LARGE_INTEGER KernelTime;
- LARGE_INTEGER UserTime;
-} KERNEL_USER_TIMES, *PKERNEL_USER_TIMES;
-
-typedef void *PPEB;
-
-typedef struct _PROCESS_BASIC_INFORMATION
-{
- NTSTATUS ExitStatus;
- PPEB PebBaseAddress;
- KAFFINITY AffinityMask;
- KPRIORITY BasePriority;
- ULONG UniqueProcessId;
- ULONG InheritedFromUniqueProcessId;
-} PROCESS_BASIC_INFORMATION, *PPROCESS_BASIC_INFORMATION;
-
-typedef enum _MEMORY_INFORMATION_CLASS
-{
- MemoryBasicInformation,
- MemoryWorkingSetList,
- MemorySectionName,
- MemoryBaiscVlmInformation
-} MEMORY_INFORMATION_CLASS;
-
-typedef struct _MEMORY_WORKING_SET_LIST
-{
- ULONG NumberOfPages;
- ULONG WorkingSetList[1];
-} MEMORY_WORKING_SET_LIST, *PMEMORY_WORKING_SET_LIST;
-
-typedef struct _FILE_NAME_INFORMATION
-{
- DWORD FileNameLength;
- WCHAR FileName[MAX_PATH + 100];
-} FILE_NAME_INFORMATION;
-
-typedef enum _OBJECT_INFORMATION_CLASS
-{
- ObjectBasicInformation = 0,
- ObjectNameInformation = 1,
- ObjectHandleInformation = 4
- // and many more
-} OBJECT_INFORMATION_CLASS;
-
-typedef struct _OBJECT_NAME_INFORMATION
-{
- UNICODE_STRING Name;
-} OBJECT_NAME_INFORMATION;
-
-/* Function declarations for ntdll.dll. These don't appear in any
- standard Win32 header. */
-extern "C"
-{
- NTSTATUS NTAPI NtCreateToken (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
- TOKEN_TYPE, PLUID, PLARGE_INTEGER, PTOKEN_USER,
- PTOKEN_GROUPS, PTOKEN_PRIVILEGES, PTOKEN_OWNER,
- PTOKEN_PRIMARY_GROUP, PTOKEN_DEFAULT_DACL,
- PTOKEN_SOURCE);
- NTSTATUS NTAPI NtMapViewOfSection (HANDLE, HANDLE, PVOID *, ULONG, ULONG,
- PLARGE_INTEGER, PULONG, SECTION_INHERIT,
- ULONG, ULONG);
- NTSTATUS NTAPI NtOpenFile (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
- PIO_STATUS_BLOCK, ULONG, ULONG);
- NTSTATUS NTAPI NtOpenSection (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
- NTSTATUS NTAPI NtQueryInformationFile (HANDLE, IO_STATUS_BLOCK *, VOID *,
- DWORD, DWORD);
- NTSTATUS NTAPI NtQueryInformationProcess (HANDLE, PROCESSINFOCLASS,
- PVOID, ULONG, PULONG);
- NTSTATUS NTAPI NtQueryObject (HANDLE, OBJECT_INFORMATION_CLASS, VOID *,
- ULONG, ULONG *);
- NTSTATUS NTAPI NtQuerySystemInformation (SYSTEM_INFORMATION_CLASS,
- PVOID, ULONG, PULONG);
- NTSTATUS NTAPI NtQueryVirtualMemory (HANDLE, PVOID, MEMORY_INFORMATION_CLASS,
- PVOID, ULONG, PULONG);
- NTSTATUS NTAPI NtUnmapViewOfSection (HANDLE, PVOID);
- VOID NTAPI RtlInitUnicodeString (PUNICODE_STRING, PCWSTR);
- ULONG NTAPI RtlNtStatusToDosError (NTSTATUS);
-}
diff --git a/winsup/cygwin/ntea.cc b/winsup/cygwin/ntea.cc
deleted file mode 100644
index 224478b16..000000000
--- a/winsup/cygwin/ntea.cc
+++ /dev/null
@@ -1,327 +0,0 @@
-/* ntea.cc: code for manipulating NTEA information
-
- Copyright 1997, 1998, 2000, 2001 Red Hat, Inc.
-
- Written by Sergey S. Okhapkin (sos@prospect.com.ru)
-
-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 "winsup.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include "security.h"
-
-/* Default to not using NTEA information */
-BOOL allow_ntea;
-
-/*
-From Windows NT DDK:
-
-FILE_FULL_EA_INFORMATION provides extended attribute information.
-This structure is used primarily by network drivers.
-
-Members
-
-NextEntryOffset
-The offset of the next FILE_FULL_EA_INFORMATION-type entry. This member is
-zero if no other entries follow this one.
-
-Flags
-Can be zero or can be set with FILE_NEED_EA, indicating that the file to which
-the EA belongs cannot be interpreted without understanding the associated
-extended attributes.
-
-EaNameLength
-The length in bytes of the EaName array. This value does not include a
-zero-terminator to EaName.
-
-EaValueLength
-The length in bytes of each EA value in the array.
-
-EaName
-An array of characters naming the EA for this entry.
-
-Comments
-This structure is longword-aligned. If a set of FILE_FULL_EA_INFORMATION
-entries is buffered, NextEntryOffset value in each entry, except the last,
-falls on a longword boundary.
-The value(s) associated with each entry follows the EaName array. That is, an
-EA's values are located at EaName + (EaNameLength + 1).
-*/
-
-typedef struct _FILE_FULL_EA_INFORMATION {
- ULONG NextEntryOffset;
- UCHAR Flags;
- UCHAR EaNameLength;
- USHORT EaValueLength;
- CHAR EaName[1];
-} FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
-
-/* Functions prototypes */
-
-int NTReadEA (const char *file, const char *attrname, char *buf, int len);
-static PFILE_FULL_EA_INFORMATION NTReadEARaw (HANDLE file, int *len);
-BOOL NTWriteEA(const char *file, const char *attrname, char *buf, int len);
-
-/*
- * NTReadEA - read file's Extended Attribute.
- *
- * Parameters:
- * file - pointer to filename
- * attrname- pointer to EA name (case insensitivy. EAs are sored in upper
- * case).
- * attrbuf - pointer to buffer to store EA's value.
- * len - length of attrbuf.
- * Return value:
- * 0 - if file or attribute "attrname" not found.
- * N - number of bytes stored in attrbuf if succes.
- * -1 - attrbuf too small for EA value.
- */
-
-int __stdcall
-NTReadEA (const char *file, const char *attrname, char *attrbuf, int len)
-{
- HANDLE hFileSource;
- int eafound = 0;
- PFILE_FULL_EA_INFORMATION ea, sea;
- int easize;
-
- hFileSource = CreateFile (file, FILE_READ_EA,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- &sec_none_nih, // sa
- OPEN_EXISTING,
- FILE_FLAG_BACKUP_SEMANTICS,
- NULL
- );
-
- if (hFileSource == INVALID_HANDLE_VALUE)
- return 0;
-
- /* Read in raw array of EAs */
- ea = sea = NTReadEARaw (hFileSource, &easize);
-
- /* Search for requested attribute */
- while (sea)
- {
- if (strcasematch (ea->EaName, attrname)) /* EA found */
- {
- if (ea->EaValueLength > len)
- {
- eafound = -1; /* buffer too small */
- break;
- }
- memcpy (attrbuf, ea->EaName + (ea->EaNameLength + 1),
- ea->EaValueLength);
- eafound = ea->EaValueLength;
- break;
- }
- if ((ea->NextEntryOffset == 0) || ((int) ea->NextEntryOffset > easize))
- break;
- ea = (PFILE_FULL_EA_INFORMATION) ((char *) ea + ea->NextEntryOffset);
- }
-
- if (sea)
- free (sea);
- CloseHandle (hFileSource);
-
- return eafound;
-}
-
-/*
- * NTReadEARaw - internal routine to read EAs array to malloced buffer. The
- * caller should free this buffer after usage.
- * Parameters:
- * hFileSource - handle to file. This handle should have FILE_READ_EA
- * rights.
- * len - pointer to int variable where length of buffer will
- * be stored.
- * Return value:
- * pointer to buffer with file's EAs, or NULL if any error occured.
- */
-
-static
-PFILE_FULL_EA_INFORMATION
-NTReadEARaw (HANDLE hFileSource, int *len)
-{
- WIN32_STREAM_ID StreamId;
- DWORD dwBytesWritten;
- LPVOID lpContext;
- DWORD StreamSize;
- PFILE_FULL_EA_INFORMATION eafound = NULL;
-
- lpContext = NULL;
- StreamSize = sizeof (WIN32_STREAM_ID) - sizeof (WCHAR**);
-
- /* Read the WIN32_STREAM_ID in */
-
- while (BackupRead (hFileSource, (LPBYTE) &StreamId, StreamSize,
- &dwBytesWritten,
- FALSE, // don't abort yet
- FALSE, // don't process security
- &lpContext))
- {
- DWORD sl,sh;
-
- if (dwBytesWritten == 0) /* No more Stream IDs */
- break;
- /* skip StreamName */
- if (StreamId.dwStreamNameSize)
- {
- unsigned char *buf;
- buf = (unsigned char *) malloc (StreamId.dwStreamNameSize);
-
- if (buf == NULL)
- break;
-
- if (!BackupRead (hFileSource, buf, // buffer to read
- StreamId.dwStreamNameSize, // num bytes to read
- &dwBytesWritten,
- FALSE, // don't abort yet
- FALSE, // don't process security
- &lpContext)) // Stream name read error
- {
- free (buf);
- break;
- }
- free (buf);
- }
-
- /* Is it EA stream? */
- if (StreamId.dwStreamId == BACKUP_EA_DATA)
- {
- unsigned char *buf;
- buf = (unsigned char *) malloc (StreamId.Size.LowPart);
-
- if (buf == NULL)
- break;
- if (!BackupRead (hFileSource, buf, // buffer to read
- StreamId.Size.LowPart, // num bytes to write
- &dwBytesWritten,
- FALSE, // don't abort yet
- FALSE, // don't process security
- &lpContext))
- {
- free (buf); /* EA read error */
- break;
- }
- eafound = (PFILE_FULL_EA_INFORMATION) buf;
- *len = StreamId.Size.LowPart;
- break;
- }
- /* Skip current stream */
- if (!BackupSeek (hFileSource,
- StreamId.Size.LowPart,
- StreamId.Size.HighPart,
- &sl,
- &sh,
- &lpContext))
- break;
- }
-
- /* free context */
- BackupRead (
- hFileSource,
- NULL, // buffer to write
- 0, // number of bytes to write
- &dwBytesWritten,
- TRUE, // abort
- FALSE, // don't process security
- &lpContext);
-
- return eafound;
-}
-
-/*
- * NTWriteEA - write file's Extended Attribute.
- *
- * Parameters:
- * file - pointer to filename
- * attrname- pointer to EA name (case insensitivy. EAs are sored in upper
- * case).
- * buf - pointer to buffer with EA value.
- * len - length of buf.
- * Return value:
- * TRUE if success, FALSE otherwice.
- * Note: if len=0 given EA will be deleted.
- */
-
-BOOL __stdcall
-NTWriteEA (const char *file, const char *attrname, const char *buf, int len)
-{
- HANDLE hFileSource;
- WIN32_STREAM_ID StreamId;
- DWORD dwBytesWritten;
- LPVOID lpContext;
- DWORD StreamSize, easize;
- BOOL bSuccess=FALSE;
- PFILE_FULL_EA_INFORMATION ea;
-
- hFileSource = CreateFile (file, FILE_WRITE_EA,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- &sec_none_nih, // sa
- OPEN_EXISTING,
- FILE_FLAG_BACKUP_SEMANTICS,
- NULL);
-
- if (hFileSource == INVALID_HANDLE_VALUE)
- return FALSE;
-
- lpContext = NULL;
- StreamSize = sizeof (WIN32_STREAM_ID) - sizeof (WCHAR**);
-
- /* FILE_FULL_EA_INFORMATION structure is longword-aligned */
- easize = sizeof (*ea) - sizeof (WCHAR**) + strlen (attrname) + 1 + len
- + (sizeof (DWORD) - 1);
- easize &= ~(sizeof (DWORD) - 1);
-
- if ((ea = (PFILE_FULL_EA_INFORMATION) malloc (easize)) == NULL)
- goto cleanup;
-
- memset (ea, 0, easize);
- ea->EaNameLength = strlen (attrname);
- ea->EaValueLength = len;
- strcpy (ea->EaName, attrname);
- memcpy (ea->EaName + (ea->EaNameLength + 1), buf, len);
-
- StreamId.dwStreamId = BACKUP_EA_DATA;
- StreamId.dwStreamAttributes = 0;
- StreamId.Size.HighPart = 0;
- StreamId.Size.LowPart = easize;
- StreamId.dwStreamNameSize = 0;
-
- if (!BackupWrite (hFileSource, (LPBYTE) &StreamId, StreamSize,
- &dwBytesWritten,
- FALSE, // don't abort yet
- FALSE, // don't process security
- &lpContext))
- goto cleanup;
-
- if (!BackupWrite (hFileSource, (LPBYTE) ea, easize,
- &dwBytesWritten,
- FALSE, // don't abort yet
- FALSE, // don't process security
- &lpContext))
- goto cleanup;
-
- bSuccess = TRUE;
- /* free context */
-
-cleanup:
- BackupRead (hFileSource,
- NULL, // buffer to write
- 0, // number of bytes to write
- &dwBytesWritten,
- TRUE, // abort
- FALSE, // don't process security
- &lpContext);
-
- CloseHandle (hFileSource);
- if (ea)
- free (ea);
-
- return bSuccess;
-}
diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc
deleted file mode 100644
index a3df1219e..000000000
--- a/winsup/cygwin/passwd.cc
+++ /dev/null
@@ -1,446 +0,0 @@
-/* passwd.cc: getpwnam () and friends
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <stdlib.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <errno.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "pinfo.h"
-#include "cygheap.h"
-#include <sys/termios.h>
-#include "pwdgrp.h"
-
-/* Read /etc/passwd only once for better performance. This is done
- on the first call that needs information from it. */
-
-static struct passwd *passwd_buf; /* passwd contents in memory */
-static int curr_lines;
-static int max_lines;
-
-static pwdgrp_check passwd_state;
-
-
-/* Position in the passwd cache */
-#ifdef _MT_SAFE
-#define pw_pos _reent_winsup ()->_pw_pos
-#else
-static int pw_pos = 0;
-#endif
-
-/* Remove a : teminated string from the buffer, and increment the pointer */
-static char *
-grab_string (char **p)
-{
- char *src = *p;
- char *res = src;
-
- while (*src && *src != ':' && *src != '\n')
- src++;
-
- if (*src == ':')
- {
- *src = 0;
- src++;
- }
- *p = src;
- return res;
-}
-
-/* same, for ints */
-static int
-grab_int (char **p)
-{
- char *src = *p;
- int val = strtol (src, NULL, 10);
- while (*src && *src != ':' && *src != '\n')
- src++;
- if (*src == ':')
- src++;
- *p = src;
- return val;
-}
-
-/* Parse /etc/passwd line into passwd structure. */
-void
-parse_pwd (struct passwd &res, char *buf)
-{
- /* Allocate enough room for the passwd struct and all the strings
- in it in one go */
- size_t len = strlen (buf);
- if (buf[--len] == '\r')
- buf[len] = '\0';
-
- res.pw_name = grab_string (&buf);
- res.pw_passwd = grab_string (&buf);
- res.pw_uid = grab_int (&buf);
- res.pw_gid = grab_int (&buf);
- res.pw_comment = 0;
- res.pw_gecos = grab_string (&buf);
- res.pw_dir = grab_string (&buf);
- res.pw_shell = grab_string (&buf);
-}
-
-/* Add one line from /etc/passwd into the password cache */
-static void
-add_pwd_line (char *line)
-{
- if (curr_lines >= max_lines)
- {
- max_lines += 10;
- passwd_buf = (struct passwd *) realloc (passwd_buf, max_lines * sizeof (struct passwd));
- }
- parse_pwd (passwd_buf[curr_lines++], line);
-}
-
-class passwd_lock
-{
- bool armed;
- static NO_COPY pthread_mutex_t mutex;
- public:
- passwd_lock (bool doit)
- {
- if (doit)
- pthread_mutex_lock (&mutex);
- armed = doit;
- }
- ~passwd_lock ()
- {
- if (armed)
- pthread_mutex_unlock (&mutex);
- }
-};
-
-pthread_mutex_t NO_COPY passwd_lock::mutex = (pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER;
-
-/* Read in /etc/passwd and save contents in the password cache.
- This sets passwd_state to loaded or emulated so functions in this file can
- tell that /etc/passwd has been read in or will be emulated. */
-void
-read_etc_passwd ()
-{
- static pwdgrp_read pr;
-
- /* A mutex is ok for speed here - pthreads will use critical sections not
- * mutexes for non-shared mutexes in the future. Also, this function will
- * at most be called once from each thread, after that the passwd_state
- * test will succeed */
- passwd_lock here (cygwin_finished_initializing);
-
- /* if we got blocked by the mutex, then etc_passwd may have been processed */
- if (passwd_state != uninitialized)
- return;
-
- if (passwd_state != initializing)
- {
- passwd_state = initializing;
- if (pr.open ("/etc/passwd"))
- {
- char *line;
- while ((line = pr.gets ()) != NULL)
- if (strlen (line))
- add_pwd_line (line);
-
- passwd_state.set_last_modified (pr.get_fhandle(), pr.get_fname ());
- passwd_state = loaded;
- pr.close ();
- debug_printf ("Read /etc/passwd, %d lines", curr_lines);
- }
- else
- {
- static char linebuf[1024];
-
- if (wincap.has_security ())
- {
- HANDLE ptok;
- cygsid tu, tg;
- DWORD siz;
-
- if (OpenProcessToken (GetCurrentProcess (), TOKEN_QUERY, &ptok))
- {
- if (GetTokenInformation (ptok, TokenUser, &tu, sizeof tu,
- &siz)
- && GetTokenInformation (ptok, TokenPrimaryGroup, &tg,
- sizeof tg, &siz))
- {
- char strbuf[100];
- snprintf (linebuf, sizeof (linebuf),
- "%s::%lu:%lu:%s:%s:/bin/sh",
- cygheap->user.name (),
- *GetSidSubAuthority(tu,
- *GetSidSubAuthorityCount(tu) - 1),
- *GetSidSubAuthority(tg,
- *GetSidSubAuthorityCount(tg) - 1),
- tu.string (strbuf), getenv ("HOME") ?: "/");
- debug_printf ("Emulating /etc/passwd: %s", linebuf);
- add_pwd_line (linebuf);
- passwd_state = emulated;
- }
- CloseHandle (ptok);
- }
- }
- if (passwd_state != emulated)
- {
- snprintf (linebuf, sizeof (linebuf), "%s::%u:%u::%s:/bin/sh",
- cygheap->user.name (), (unsigned) DEFAULT_UID,
- (unsigned) DEFAULT_GID, getenv ("HOME") ?: "/");
- debug_printf ("Emulating /etc/passwd: %s", linebuf);
- add_pwd_line (linebuf);
- passwd_state = emulated;
- }
- }
-
- }
-
- return;
-}
-
-/* Cygwin internal */
-/* If this ever becomes non-reentrant, update all the getpw*_r functions */
-static struct passwd *
-search_for (__uid32_t uid, const char *name)
-{
- struct passwd *res = 0;
- struct passwd *default_pw = 0;
-
- for (int i = 0; i < curr_lines; i++)
- {
- res = passwd_buf + i;
- if (res->pw_uid == DEFAULT_UID)
- default_pw = res;
- /* on Windows NT user names are case-insensitive */
- if (name)
- {
- if (strcasematch (name, res->pw_name))
- return res;
- }
- else if (uid == (__uid32_t) res->pw_uid)
- return res;
- }
-
- /* Return default passwd entry if passwd is emulated or it's a
- request for the current user. */
- if (passwd_state != loaded
- || (!name && uid == myself->uid)
- || (name && strcasematch (name, cygheap->user.name ())))
- return default_pw;
-
- return NULL;
-}
-
-extern "C" struct passwd *
-getpwuid32 (__uid32_t uid)
-{
- if (passwd_state <= initializing)
- read_etc_passwd ();
-
- pthread_testcancel();
-
- return search_for (uid, 0);
-}
-
-extern "C" struct passwd *
-getpwuid (__uid16_t uid)
-{
- return getpwuid32 (uid16touid32 (uid));
-}
-
-extern "C" int
-getpwuid_r32 (__uid32_t uid, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result)
-{
- *result = NULL;
-
- if (!pwd || !buffer)
- return ERANGE;
-
- if (passwd_state <= initializing)
- read_etc_passwd ();
-
- pthread_testcancel();
-
- struct passwd *temppw = search_for (uid, 0);
-
- if (!temppw)
- return 0;
-
- /* check needed buffer size. */
- size_t needsize = strlen (temppw->pw_name) + strlen (temppw->pw_dir) +
- strlen (temppw->pw_shell) + strlen (temppw->pw_gecos) +
- strlen (temppw->pw_passwd) + 5;
- if (needsize > bufsize)
- return ERANGE;
-
- /* make a copy of temppw */
- *result = pwd;
- pwd->pw_uid = temppw->pw_uid;
- pwd->pw_gid = temppw->pw_gid;
- pwd->pw_name = buffer;
- pwd->pw_dir = pwd->pw_name + strlen (temppw->pw_name) + 1;
- pwd->pw_shell = pwd->pw_dir + strlen (temppw->pw_dir) + 1;
- pwd->pw_gecos = pwd->pw_shell + strlen (temppw->pw_shell) + 1;
- pwd->pw_passwd = pwd->pw_gecos + strlen (temppw->pw_gecos) + 1;
- strcpy (pwd->pw_name, temppw->pw_name);
- strcpy (pwd->pw_dir, temppw->pw_dir);
- strcpy (pwd->pw_shell, temppw->pw_shell);
- strcpy (pwd->pw_gecos, temppw->pw_gecos);
- strcpy (pwd->pw_passwd, temppw->pw_passwd);
- return 0;
-}
-
-extern "C" int
-getpwuid_r (__uid16_t uid, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result)
-{
- return getpwuid_r32 (uid16touid32 (uid), pwd, buffer, bufsize, result);
-}
-
-extern "C" struct passwd *
-getpwnam (const char *name)
-{
- if (passwd_state <= initializing)
- read_etc_passwd ();
-
- pthread_testcancel();
-
- return search_for (0, name);
-}
-
-
-/* the max size buffer we can expect to
- * use is returned via sysconf with _SC_GETPW_R_SIZE_MAX.
- * This may need updating! - Rob Collins April 2001.
- */
-extern "C" int
-getpwnam_r (const char *nam, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result)
-{
- *result = NULL;
-
- if (!pwd || !buffer || !nam)
- return ERANGE;
-
- if (passwd_state <= initializing)
- read_etc_passwd ();
-
- pthread_testcancel();
-
- struct passwd *temppw = search_for (0, nam);
-
- if (!temppw)
- return 0;
-
- /* check needed buffer size. */
- size_t needsize = strlen (temppw->pw_name) + strlen (temppw->pw_dir) +
- strlen (temppw->pw_shell) + strlen (temppw->pw_gecos) +
- strlen (temppw->pw_passwd) + 5;
- if (needsize > bufsize)
- return ERANGE;
-
- /* make a copy of temppw */
- *result = pwd;
- pwd->pw_uid = temppw->pw_uid;
- pwd->pw_gid = temppw->pw_gid;
- pwd->pw_name = buffer;
- pwd->pw_dir = pwd->pw_name + strlen (temppw->pw_name) + 1;
- pwd->pw_shell = pwd->pw_dir + strlen (temppw->pw_dir) + 1;
- pwd->pw_gecos = pwd->pw_shell + strlen (temppw->pw_shell) + 1;
- pwd->pw_passwd = pwd->pw_gecos + strlen (temppw->pw_gecos) + 1;
- strcpy (pwd->pw_name, temppw->pw_name);
- strcpy (pwd->pw_dir, temppw->pw_dir);
- strcpy (pwd->pw_shell, temppw->pw_shell);
- strcpy (pwd->pw_gecos, temppw->pw_gecos);
- strcpy (pwd->pw_passwd, temppw->pw_passwd);
- return 0;
-}
-
-extern "C" struct passwd *
-getpwent (void)
-{
- if (passwd_state <= initializing)
- read_etc_passwd ();
-
- if (pw_pos < curr_lines)
- return passwd_buf + pw_pos++;
-
- return NULL;
-}
-
-extern "C" struct passwd *
-getpwduid (__uid16_t)
-{
- return NULL;
-}
-
-extern "C" void
-setpwent (void)
-{
- pw_pos = 0;
-}
-
-extern "C" void
-endpwent (void)
-{
- pw_pos = 0;
-}
-
-extern "C" int
-setpassent ()
-{
- return 0;
-}
-
-/* Internal function. ONLY USE THIS INTERNALLY, NEVER `getpwent'!!! */
-struct passwd *
-internal_getpwent (int pos)
-{
- if (passwd_state <= initializing)
- read_etc_passwd ();
-
- if (pos < curr_lines)
- return passwd_buf + pos;
- return NULL;
-}
-
-extern "C" char *
-getpass (const char * prompt)
-{
-#ifdef _MT_SAFE
- char *pass=_reent_winsup ()->_pass;
-#else
- static char pass[_PASSWORD_LEN];
-#endif
- struct termios ti, newti;
-
- if (passwd_state <= initializing)
- read_etc_passwd ();
-
- cygheap_fdget fhstdin (0);
-
- if (fhstdin < 0)
- pass[0] = '\0';
- else
- {
- fhstdin->tcgetattr (&ti);
- newti = ti;
- newti.c_lflag &= ~ECHO;
- fhstdin->tcsetattr (TCSANOW, &newti);
- fputs (prompt, stderr);
- fgets (pass, _PASSWORD_LEN, stdin);
- fprintf (stderr, "\n");
- for (int i=0; pass[i]; i++)
- if (pass[i] == '\r' || pass[i] == '\n')
- pass[i] = '\0';
- fhstdin->tcsetattr (TCSANOW, &ti);
- }
- return pass;
-}
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
deleted file mode 100644
index cfa3ef241..000000000
--- a/winsup/cygwin/path.cc
+++ /dev/null
@@ -1,3660 +0,0 @@
-/* path.cc: path support.
-
- Copyright 1996, 1997, 1998, 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 module's job is to
- - convert between POSIX and Win32 style filenames,
- - support the `mount' functionality,
- - support symlinks for files and directories
-
- Pathnames are handled as follows:
-
- - A \ or : in a path denotes a pure windows spec.
- - Paths beginning with // (or \\) are not translated (i.e. looked
- up in the mount table) and are assumed to be UNC path names.
-
- The goal in the above set of rules is to allow both POSIX and Win32
- flavors of pathnames without either interfering. The rules are
- intended to be as close to a superset of both as possible.
-
- Note that you can have more than one path to a file. The mount
- table is always prefered when translating Win32 paths to POSIX
- paths. Win32 paths in mount table entries may be UNC paths or
- standard Win32 paths starting with <drive-letter>:
-
- Text vs Binary issues are not considered here in path style
- decisions, although the appropriate flags are retrieved and
- stored in various structures.
-
- Removing mounted filesystem support would simplify things greatly,
- but having it gives us a mechanism of treating disk that lives on a
- UNIX machine as having UNIX semantics [it allows one to edit a text
- file on that disk and not have cr's magically appear and perhaps
- break apps running on UNIX boxes]. It also useful to be able to
- layout a hierarchy without changing the underlying directories.
-
- The semantics of mounting file systems is not intended to precisely
- follow normal UNIX systems.
-
- Each DOS drive is defined to have a current directory. Supporting
- this would complicate things so for now things are defined so that
- c: means c:\. FIXME: Is this still true?
-*/
-
-#include "winsup.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/mount.h>
-#include <mntent.h>
-#include <unistd.h>
-#include <errno.h>
-#include <ctype.h>
-#include <winioctl.h>
-#include <wingdi.h>
-#include <winuser.h>
-#include <winnls.h>
-#include <winnetwk.h>
-#include <sys/cygwin.h>
-#include <cygwin/version.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "sync.h"
-#include "sigproc.h"
-#include "pinfo.h"
-#include "dtable.h"
-#include "cygheap.h"
-#include "shared_info.h"
-#include "registry.h"
-#include <assert.h>
-#include "shortcut.h"
-
-#ifdef _MT_SAFE
-#define iteration _reent_winsup ()->_iteration
-#define available_drives _reent_winsup ()->available_drives
-#else
-static int iteration;
-static DWORD available_drives;
-#endif
-
-static int normalize_win32_path (const char *src, char *dst);
-static void slashify (const char *src, char *dst, int trailing_slash_p);
-static void backslashify (const char *src, char *dst, int trailing_slash_p);
-
-struct symlink_info
-{
- char contents[MAX_PATH + 4];
- char *ext_here;
- int extn;
- unsigned pflags;
- DWORD fileattr;
- int is_symlink;
- bool ext_tacked_on;
- int error;
- bool case_clash;
- int check (char *path, const suffix_info *suffixes, unsigned opt);
- BOOL case_check (char *path);
-};
-
-int pcheck_case = PCHECK_RELAXED; /* Determines the case check behaviour. */
-
-#define CYGWIN_REGNAME (cygheap->cygwin_regname ?: CYGWIN_INFO_CYGWIN_REGISTRY_NAME)
-
-/* Determine if path prefix matches current cygdrive */
-#define iscygdrive(path) \
- (path_prefix_p (mount_table->cygdrive, (path), mount_table->cygdrive_len))
-
-#define iscygdrive_device(path) \
- (isalpha(path[mount_table->cygdrive_len]) && \
- (isdirsep(path[mount_table->cygdrive_len + 1]) || \
- !path[mount_table->cygdrive_len + 1]))
-
-#define isproc(path) \
- (path_prefix_p (proc, (path), proc_len))
-
-#define isvirtual_dev(devn) \
- (devn == FH_CYGDRIVE || devn == FH_PROC || devn == FH_REGISTRY || devn == FH_PROCESS)
-
-/* 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
-*/
-
-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 && SLASH_P (path1[len1 - 1]))
- len1--;
-
- if (len1 == 0)
- return SLASH_P (path2[0]) && !SLASH_P (path2[1]);
-
- if (!pathnmatch (path1, path2, len1))
- return 0;
-
- return SLASH_P (path2[len1]) || path2[len1] == 0 || path1[len1 - 1] == ':';
-}
-
-/* Return non-zero if paths match in first len chars.
- Check is dependent of the case sensitivity setting. */
-int
-pathnmatch (const char *path1, const char *path2, int len)
-{
- return pcheck_case == PCHECK_STRICT ? !strncmp (path1, path2, len)
- : strncasematch (path1, path2, len);
-}
-
-/* Return non-zero if paths match. Check is dependent of the case
- sensitivity setting. */
-int
-pathmatch (const char *path1, const char *path2)
-{
- return pcheck_case == PCHECK_STRICT ? !strcmp (path1, path2)
- : strcasematch (path1, path2);
-}
-
-/* Normalize a POSIX path.
- \'s are converted to /'s in the process.
- All duplicate /'s, except for 2 leading /'s, are deleted.
- The result is 0 for success, or an errno error value. */
-
-#define isslash(c) ((c) == '/')
-
-static int
-normalize_posix_path (const char *src, char *dst)
-{
- const char *src_start = src;
- char *dst_start = dst;
-
- syscall_printf ("src %s", src);
- if (isdrive (src) || strpbrk (src, "\\:"))
- {
- cygwin_conv_to_full_posix_path (src, dst);
- return 0;
- }
- if (!isslash (src[0]))
- {
- if (!cygheap->cwd.get (dst))
- return get_errno ();
- dst = strchr (dst, '\0');
- if (*src == '.')
- {
- if (dst == dst_start + 1 && *dst_start == '/')
- --dst;
- goto sawdot;
- }
- if (dst > dst_start && !isslash (dst[-1]))
- *dst++ = '/';
- }
- /* Two leading /'s? If so, preserve them. */
- else if (isslash (src[1]))
- {
- *dst++ = '/';
- *dst++ = '/';
- src += 2;
- if (isslash (*src))
- { /* Starts with three or more slashes - reset. */
- dst = dst_start;
- *dst++ = '/';
- src = src_start + 1;
- }
- else if (src[0] == '.' && isslash (src[1]))
- {
- *dst++ = '.';
- *dst++ = '/';
- src += 2;
- }
- }
- else
- *dst = '\0';
-
- while (*src)
- {
- /* Strip runs of /'s. */
- if (!isslash (*src))
- *dst++ = *src++;
- else
- {
- while (*++src)
- {
- if (isslash (*src))
- continue;
-
- if (*src != '.')
- break;
-
- sawdot:
- if (src[1] != '.')
- {
- if (!src[1])
- {
- if (dst == dst_start)
- *dst++ = '/';
- goto done;
- }
- if (!isslash (src[1]))
- break;
- }
- else if (src[2] && !isslash (src[2]))
- {
- if (src[2] == '.')
- return ENOENT;
- break;
- }
- else
- {
- while (dst > dst_start && !isslash (*--dst))
- continue;
- src++;
- }
- }
-
- *dst++ = '/';
- }
- if ((dst - dst_start) >= MAX_PATH)
- {
- debug_printf ("ENAMETOOLONG = normalize_posix_path (%s)", src);
- return ENAMETOOLONG;
- }
- }
-
-done:
- *dst = '\0';
- if (--dst > dst_start && isslash (*dst))
- *dst = '\0';
-
- debug_printf ("%s = normalize_posix_path (%s)", dst_start, src_start);
- return 0;
-}
-
-inline void
-path_conv::add_ext_from_sym (symlink_info &sym)
-{
- if (sym.ext_here && *sym.ext_here)
- {
- known_suffix = path + sym.extn;
- if (sym.ext_tacked_on)
- strcpy (known_suffix, sym.ext_here);
- }
-}
-
-static void __stdcall mkrelpath (char *dst) __attribute__ ((regparm (2)));
-static void __stdcall
-mkrelpath (char *path)
-{
- char cwd_win32[MAX_PATH];
- if (!cygheap->cwd.get (cwd_win32, 0))
- return;
-
- unsigned cwdlen = strlen (cwd_win32);
- if (!path_prefix_p (cwd_win32, path, cwdlen))
- return;
-
- size_t n = strlen (path);
- if (n < cwdlen)
- return;
-
- char *tail = path;
- if (n == cwdlen)
- tail += cwdlen;
- else
- tail += isdirsep (cwd_win32[cwdlen - 1]) ? cwdlen : cwdlen + 1;
-
- memmove (path, tail, strlen (tail) + 1);
- if (!*path)
- strcpy (path, ".");
-}
-
-bool
-fs_info::update (const char *win32_path)
-{
- char tmp_buf [MAX_PATH];
- strncpy (tmp_buf, win32_path, MAX_PATH);
-
- if (!rootdir (tmp_buf))
- {
- debug_printf ("Cannot get root component of path %s", win32_path);
- name [0] = '\0';
- sym_opt = flags = serial = 0;
- return false;
- }
-
- if (strcmp (tmp_buf, root_dir) == 0)
- return 1;
-
- strncpy (root_dir, tmp_buf, MAX_PATH);
- drive_type = GetDriveType (root_dir);
- if (drive_type == DRIVE_REMOTE || (drive_type == DRIVE_UNKNOWN && (root_dir[0] == '\\' && root_dir[1] == '\\')))
- is_remote_drive = 1;
- else
- is_remote_drive = 0;
-
- if (!GetVolumeInformation (root_dir, NULL, 0, &serial, NULL, &flags,
- name, sizeof (name)))
- {
- debug_printf ("Cannot get volume information (%s), %E", root_dir);
- name [0] = '\0';
- sym_opt = flags = serial = 0;
- return false;
- }
- /* FIXME: Samba by default returns "NTFS" in file system name, but
- * doesn't support Extended Attributes. If there's some fast way to
- * distinguish between samba and real ntfs, it should be implemented
- * here.
- */
- sym_opt = (!is_remote_drive && strcmp (name, "NTFS") == 0) ? PC_CHECK_EA : 0;
-
- return true;
-}
-
-char *
-path_conv::return_and_clear_normalized_path ()
-{
- char *s = normalized_path;
- normalized_path = NULL;
- return s;
-}
-
-void
-path_conv::fillin (HANDLE h)
-{
- BY_HANDLE_FILE_INFORMATION local;
- if (!GetFileInformationByHandle (h, &local))
- {
- fileattr = INVALID_FILE_ATTRIBUTES;
- fs.serial = 0;
- }
- else
- {
- fileattr = local.dwFileAttributes;
- fs.serial = local.dwVolumeSerialNumber;
- }
- fs.drive_type = DRIVE_UNKNOWN;
-}
-
-/* Convert an arbitrary path SRC to a pure Win32 path, suitable for
- passing to Win32 API routines.
-
- If an error occurs, `error' is set to the errno value.
- Otherwise it is set to 0.
-
- follow_mode values:
- SYMLINK_FOLLOW - convert to PATH symlink points to
- SYMLINK_NOFOLLOW - convert to PATH of symlink itself
- SYMLINK_IGNORE - do not check PATH for symlinks
- SYMLINK_CONTENTS - just return symlink contents
-*/
-
-void
-path_conv::check (const char *src, unsigned opt,
- const suffix_info *suffixes)
-{
- /* This array is used when expanding symlinks. It is MAX_PATH * 2
- in length so that we can hold the expanded symlink plus a
- trailer. */
- char path_copy[MAX_PATH + 3];
- char tmp_buf[2 * MAX_PATH + 3];
- symlink_info sym;
- bool need_directory = 0;
- bool saw_symlinks = 0;
- int is_relpath;
- char *tail;
- sigframe thisframe (mainthread);
-
-#if 0
- static path_conv last_path_conv;
- static char last_src[MAX_PATH + 1];
-
- if (*last_src && strcmp (last_src, src) == 0)
- {
- *this = last_path_conv;
- return;
- }
-#endif
-
- int loop = 0;
- path_flags = 0;
- known_suffix = NULL;
- fileattr = INVALID_FILE_ATTRIBUTES;
- case_clash = false;
- devn = unit = 0;
- fs.root_dir[0] = '\0';
- fs.name[0] = '\0';
- fs.flags = fs.serial = 0;
- fs.sym_opt = 0;
- fs.drive_type = 0;
- fs.is_remote_drive = 0;
- normalized_path = NULL;
-
- if (!(opt & PC_NULLEMPTY))
- error = 0;
- else if ((error = check_null_empty_str (src)))
- return;
-
- /* This loop handles symlink expansion. */
- for (;;)
- {
- MALLOC_CHECK;
- assert (src);
-
- char *p = strrchr (src, '\0');
- /* Detect if the user was looking for a directory. We have to strip the
- trailing slash initially and add it back on at the end due to Windows
- brain damage. */
- if (--p > src)
- {
- if (isdirsep (*p))
- need_directory = 1;
- else if (--p > src && p[1] == '.' && isdirsep (*p))
- need_directory = 1;
- }
-
- is_relpath = !isabspath (src);
- error = normalize_posix_path (src, path_copy);
- if (error)
- return;
-
- tail = strchr (path_copy, '\0'); // Point to end of copy
- char *path_end = tail;
- tail[1] = '\0';
-
- /* Scan path_copy from right to left looking either for a symlink
- or an actual existing file. If an existing file is found, just
- return. If a symlink is found exit the for loop.
- Also: be careful to preserve the errno returned from
- symlink.check as the caller may need it. */
- /* FIXME: Do we have to worry about multiple \'s here? */
- int component = 0; // Number of translated components
- sym.contents[0] = '\0';
-
- for (;;)
- {
- const suffix_info *suff;
- char pathbuf[MAX_PATH];
- char *full_path;
-
- /* Don't allow symlink.check to set anything in the path_conv
- class if we're working on an inner component of the path */
- if (component)
- {
- suff = NULL;
- sym.pflags = 0;
- full_path = pathbuf;
- }
- else
- {
- suff = suffixes;
- sym.pflags = path_flags;
- full_path = this->path;
- }
-
- /* Convert to native path spec sans symbolic link info. */
- error = mount_table->conv_to_win32_path (path_copy, full_path, devn,
- unit, &sym.pflags, 1);
-
- if (error)
- return;
-
- if (devn == FH_CYGDRIVE)
- {
- if (!component)
- fileattr = FILE_ATTRIBUTE_DIRECTORY;
- else
- {
- devn = FH_BAD;
- fileattr = GetFileAttributes (this->path);
- }
- goto out;
- }
- else if (isvirtual_dev (devn))
- {
- /* FIXME: Calling build_fhandler here is not the right way to handle this. */
- fhandler_virtual *fh =
- (fhandler_virtual *) cygheap->fdtab.build_fhandler (-1, devn, (const char *) path_copy, NULL, unit);
- int file_type = fh->exists ();
- switch (file_type)
- {
- case 1:
- case 2:
- fileattr = FILE_ATTRIBUTE_DIRECTORY;
- break;
- case -1:
- fileattr = 0;
- break;
- default:
- fileattr = INVALID_FILE_ATTRIBUTES;
- break;
- }
- delete fh;
- goto out;
- }
- /* devn should not be a device. If it is, then stop parsing now. */
- else if (devn != FH_BAD)
- {
- fileattr = 0;
- if (component)
- {
- error = ENOTDIR;
- return;
- }
- goto out; /* Found a device. Stop parsing. */
- }
-
- if (!fs.update (full_path))
- fs.root_dir[0] = '\0';
-
- /* Eat trailing slashes */
- char *dostail = strchr (full_path, '\0');
-
- /* If path is only a drivename, Windows interprets it as the
- current working directory on this drive instead of the root
- dir which is what we want. So we need the trailing backslash
- in this case. */
- while (dostail > full_path + 3 && (*--dostail == '\\'))
- *tail = '\0';
-
- if (full_path[0] && full_path[1] == ':' && full_path[2] == '\0')
- {
- full_path[2] = '\\';
- full_path[3] = '\0';
- }
-
- if ((opt & PC_SYM_IGNORE) && pcheck_case == PCHECK_RELAXED)
- {
- fileattr = GetFileAttributes (this->path);
- goto out;
- }
-
- int len = sym.check (full_path, suff, opt | fs.sym_opt);
-
- if (sym.case_clash)
- {
- if (pcheck_case == PCHECK_STRICT)
- {
- case_clash = TRUE;
- error = ENOENT;
- goto out;
- }
- /* If pcheck_case==PCHECK_ADJUST the case_clash is remembered
- if the last component is concerned. This allows functions
- which shall create files to avoid overriding already existing
- files with another case. */
- if (!component)
- case_clash = TRUE;
- }
- if (!(opt & PC_SYM_IGNORE))
- {
- if (!component)
- path_flags = sym.pflags;
-
- /* If symlink.check found an existing non-symlink file, then
- it sets the appropriate flag. It also sets any suffix found
- into `ext_here'. */
- if (!sym.is_symlink && sym.fileattr != INVALID_FILE_ATTRIBUTES)
- {
- error = sym.error;
- if (component == 0)
- {
- fileattr = sym.fileattr;
- add_ext_from_sym (sym);
- }
- if (pcheck_case == PCHECK_RELAXED)
- goto out; // file found
- /* Avoid further symlink evaluation. Only case checks are
- done now. */
- opt |= PC_SYM_IGNORE;
- }
- /* Found a symlink if len > 0. If component == 0, then the
- src path itself was a symlink. If !follow_mode then
- we're done. Otherwise we have to insert the path found
- into the full path that we are building and perform all of
- these operations again on the newly derived path. */
- else if (len > 0)
- {
- saw_symlinks = 1;
- if (component == 0 && !need_directory && !(opt & PC_SYM_FOLLOW))
- {
- set_symlink (); // last component of path is a symlink.
- fileattr = sym.fileattr;
- if (opt & PC_SYM_CONTENTS)
- {
- strcpy (path, sym.contents);
- goto out;
- }
- add_ext_from_sym (sym);
- if (pcheck_case == PCHECK_RELAXED)
- goto out;
- /* Avoid further symlink evaluation. Only case checks are
- done now. */
- opt |= PC_SYM_IGNORE;
- }
- else
- break;
- }
- /* No existing file found. */
- }
-
- /* Find the "tail" of the path, e.g. in '/for/bar/baz',
- /baz is the tail. */
- char *newtail = strrchr (path_copy, '/');
- if (tail != path_end)
- *tail = '/';
-
- /* Exit loop if there is no tail or we are at the
- beginning of a UNC path */
- if (!newtail || newtail == path_copy || (newtail == path_copy + 1 && newtail[-1] == '/'))
- goto out; // all done
-
- tail = newtail;
-
- /* Haven't found an existing pathname component yet.
- Pinch off the tail and try again. */
- *tail = '\0';
- component++;
- }
-
- /* Arrive here if above loop detected a symlink. */
- if (++loop > MAX_LINK_DEPTH)
- {
- error = ELOOP; // Eep.
- return;
- }
-
- MALLOC_CHECK;
-
- /* The tail is pointing at a null pointer. Increment it and get the length.
- If the tail was empty then this increment will end up pointing to the extra
- \0 added to path_copy above. */
- int taillen = strlen (++tail);
- int buflen = strlen (sym.contents);
- if (buflen + taillen > MAX_PATH)
- {
- error = ENAMETOOLONG;
- strcpy (path, "::ENAMETOOLONG::");
- return;
- }
-
- /* Strip off current directory component since this is the part that refers
- to the symbolic link. */
- if ((p = strrchr (path_copy, '/')) == NULL)
- p = path_copy;
- else if (p == path_copy)
- p++;
- *p = '\0';
-
- char *headptr;
- if (isabspath (sym.contents))
- headptr = tmp_buf; /* absolute path */
- else
- {
- /* Copy the first part of the path and point to the end. */
- strcpy (tmp_buf, path_copy);
- headptr = strchr (tmp_buf, '\0');
- }
-
- /* See if we need to separate first part + symlink contents with a / */
- if (headptr > tmp_buf && headptr[-1] != '/')
- *headptr++ = '/';
-
- /* Copy the symlink contents to the end of tmp_buf.
- Convert slashes. FIXME? */
- for (p = sym.contents; *p; p++)
- *headptr++ = *p == '\\' ? '/' : *p;
-
- /* Copy any tail component */
- if (tail >= path_end)
- *headptr = '\0';
- else
- {
- *headptr++ = '/';
- strcpy (headptr, tail);
- }
-
- /* Now evaluate everything all over again. */
- src = tmp_buf;
- }
-
- if (!(opt & PC_SYM_CONTENTS))
- add_ext_from_sym (sym);
-
-out:
- if (opt & PC_POSIX)
- {
- if (tail[1] != '\0')
- *tail = '/';
- normalized_path = cstrdup (path_copy);
- }
- /* Deal with Windows stupidity which considers filename\. to be valid
- even when "filename" is not a directory. */
- if (!need_directory || error)
- /* nothing to do */;
- else if (fileattr & FILE_ATTRIBUTE_DIRECTORY)
- path_flags &= ~PATH_SYMLINK;
- else
- {
- debug_printf ("%s is a non-directory", path);
- error = ENOTDIR;
- return;
- }
-
- if (devn == FH_BAD)
- {
- if (!fs.update (path))
- {
- fs.root_dir[0] = '\0';
- set_has_acls (false);
- set_has_buggy_open (false);
- }
- else
- {
- set_isdisk ();
- debug_printf ("root_dir(%s), this->path(%s), set_has_acls(%d)",
- fs.root_dir, this->path, fs.flags & FS_PERSISTENT_ACLS);
- if (!allow_smbntsec && fs.is_remote_drive)
- set_has_acls (false);
- else
- set_has_acls (fs.flags & FS_PERSISTENT_ACLS);
- /* Known file systems with buggy open calls. Further explanation
- in fhandler.cc (fhandler_disk_file::open). */
- set_has_buggy_open (strcmp (fs.name, "SUNWNFS") == 0);
- }
- }
-#if 0
- if (issocket ())
- devn = FH_SOCKET;
-#endif
-
- if (!(opt & PC_FULL))
- {
- if (is_relpath)
- mkrelpath (this->path);
- if (need_directory)
- {
- char n = strlen (this->path);
- /* Do not add trailing \ to UNC device names like \\.\a: */
- if (this->path[n - 1] != '\\' &&
- (strncmp (this->path, "\\\\.\\", 4) != 0 ||
- !strncasematch (this->path + 4, "unc\\", 4)))
- {
- this->path[n] = '\\';
- this->path[n + 1] = '\0';
- }
- }
- }
-
- if (saw_symlinks)
- set_has_symlinks ();
-
- if (!error && !isdir () && !(path_flags & PATH_ALL_EXEC))
- {
- const char *p = strchr (path, '\0') - 4;
- if (p >= path &&
- (strcasematch (".exe", p) ||
- strcasematch (".bat", p) ||
- strcasematch (".com", p)))
- path_flags |= PATH_EXEC;
- }
-
-#if 0
- if (!error)
- {
- last_path_conv = *this;
- strcpy (last_src, src);
- }
-#endif
-}
-
-static __inline int
-digits (const char *name)
-{
- char *p;
- int n = strtol(name, &p, 10);
-
- return p > name && !*p ? n : -1;
-}
-
-const char *windows_device_names[] NO_COPY =
-{
- NULL,
- "\\dev\\console",
- "conin",
- "conout",
- "\\dev\\ttym",
- "\\dev\\tty%d",
- "\\dev\\ptym",
- "\\\\.\\com%d",
- "\\dev\\pipe",
- "\\dev\\piper",
- "\\dev\\pipew",
- "\\dev\\socket",
- "\\dev\\windows",
-
- NULL, NULL, NULL,
-
- "\\dev\\disk",
- "\\dev\\fd%d",
- "\\dev\\st%d",
- "nul",
- "\\dev\\zero",
- "\\dev\\%srandom",
- "\\dev\\mem",
- "\\dev\\clipboard",
- "\\dev\\dsp"
-};
-
-#define deveq(s) (strcasematch (name, (s)))
-#define deveqn(s, n) (strncasematch (name, (s), (n)))
-#define wdeveq(s) (strcasematch (w32_path, (s)))
-#define wdeveqn(s, n) (strncasematch (w32_path, (s), (n)))
-#define udeveq(s) (strcasematch (unix_path, (s)))
-#define udeveqn(s, n) (strncasematch (unix_path, (s), (n)))
-
-static int __stdcall
-get_devn (const char *name, int &unit)
-{
- int devn = FH_BAD;
- name += 5;
- if (deveq ("tty"))
- {
- if (real_tty_attached (myself))
- {
- unit = myself->ctty;
- devn = FH_TTYS;
- }
- else if (myself->ctty > 0)
- devn = FH_CONSOLE;
- }
- else if (deveqn ("tty", 3) && (unit = digits (name + 3)) >= 0)
- devn = FH_TTYS;
- else if (deveq ("ttym"))
- devn = FH_TTYM;
- else if (deveq ("ptmx"))
- devn = FH_PTYM;
- else if (deveq ("windows"))
- devn = FH_WINDOWS;
- else if (deveq ("dsp"))
- devn = FH_OSS_DSP;
- else if (deveq ("conin"))
- devn = FH_CONIN;
- else if (deveq ("conout"))
- devn = FH_CONOUT;
- else if (deveq ("null"))
- devn = FH_NULL;
- else if (deveq ("zero"))
- devn = FH_ZERO;
- else if (deveq ("random") || deveq ("urandom"))
- {
- devn = FH_RANDOM;
- unit = 8 + (deveqn ("u", 1) ? 1 : 0); /* Keep unit Linux conformant */
- }
- else if (deveq ("mem"))
- {
- devn = FH_MEM;
- unit = 1;
- }
- else if (deveq ("clipboard"))
- devn = FH_CLIPBOARD;
- else if (deveq ("port"))
- {
- devn = FH_MEM;
- unit = 4;
- }
- else if (deveqn ("com", 3) && (unit = digits (name + 3)) >= 0 && unit < 100)
- devn = FH_SERIAL;
- else if (deveqn ("ttyS", 4) && (unit = digits (name + 4)) >= 0)
- {
- devn = FH_SERIAL;
- unit++;
- }
- else if (deveq ("pipe"))
- devn = FH_PIPE;
- else if (deveq ("piper"))
- devn = FH_PIPER;
- else if (deveq ("pipew"))
- devn = FH_PIPEW;
- else if (deveq ("tcp") || deveq ("udp") || deveq ("streamsocket")
- || deveq ("dgsocket"))
- devn = FH_SOCKET;
-
- return devn;
-}
-
-/*
- major minor POSIX filename NT filename
- ----- ----- -------------- -------------------------
- FH_TAPE 0 /dev/st0 \device\tape0
- FH_TAPE 1 /dev/st1 \device\tape1
- ...
- FH_TAPE 128 /dev/nst0 \device\tape0
- FH_TAPE 129 /dev/nst1 \device\tape1
- ...
-
- FH_FLOPPY 0 /dev/fd0 \device\floppy0
- FH_FLOPPY 1 /dev/fd1 \device\floppy1
- ...
-
- FH_FLOPPY 16 /dev/scd0 \device\cdrom0
- FH_FLOPPY 17 /dev/scd0 \device\cdrom1
- ...
-
- FH_FLOPPY 32 /dev/sda \device\harddisk0\partition0
- FH_FLOPPY 33 /dev/sda1 \device\harddisk0\partition1
- ...
- FH_FLOPPY 47 /dev/sda15 \device\harddisk0\partition15
-
- FH_FLOPPY 48 /dev/sdb \device\harddisk1\partition0
- FH_FLOPPY 33 /dev/sdb1 \device\harddisk1\partition1
- ...
- FH_FLOPPY 208 /dev/sdl \device\harddisk11\partition0
- ...
- FH_FLOPPY 223 /dev/sdl15 \device\harddisk11\partition15
-
- The following are needed to maintain backward compatibility with
- the old Win32 partitioning scheme on W2K/XP.
-
- FH_FLOPPY 224 from mount tab \\.\A:
- ...
- FH_FLOPPY 250 from mount tab \\.\Z:
-*/
-static int
-get_raw_device_number (const char *name, const char *w32_path, int &unit)
-{
- DWORD devn = FH_BAD;
-
- if (!w32_path) /* New approach using fixed device names. */
- {
- if (deveqn ("st", 2))
- {
- unit = digits (name + 2);
- if (unit >= 0 && unit < 128)
- devn = FH_TAPE;
- }
- else if (deveqn ("nst", 3))
- {
- unit = digits (name + 3) + 128;
- if (unit >= 128 && unit < 256)
- devn = FH_TAPE;
- }
- else if (deveqn ("fd", 2))
- {
- unit = digits (name + 2);
- if (unit >= 0 && unit < 16)
- devn = FH_FLOPPY;
- }
- else if (deveqn ("scd", 3))
- {
- unit = digits (name + 3) + 16;
- if (unit >= 16 && unit < 32)
- devn = FH_FLOPPY;
- }
- else if (deveqn ("sd", 2) && isalpha (name[2]))
- {
- unit = (cyg_tolower (name[2]) - 'a') * 16 + 32;
- if (unit >= 32 && unit < 224)
- if (!name[3])
- devn = FH_FLOPPY;
- else
- {
- int d = digits (name + 3);
- if (d >= 1 && d < 16)
- {
- unit += d;
- devn = FH_FLOPPY;
- }
- }
- }
- }
- else /* Backward compatible checking of mount table device mapping. */
- {
- if (wdeveqn ("tape", 4))
- {
- unit = digits (w32_path + 4);
- /* Norewind tape devices have leading n in name. */
- if (deveqn ("n", 1))
- unit += 128;
- devn = FH_TAPE;
- }
- else if (wdeveqn ("physicaldrive", 13))
- {
- unit = digits (w32_path + 13) * 16 + 32;
- devn = FH_FLOPPY;
- }
- else if (isdrive (w32_path))
- {
- unit = cyg_tolower (w32_path[0]) - 'a' + 224;
- devn = FH_FLOPPY;
- }
- }
- return devn;
-}
-
-static int __stdcall get_device_number (const char *unix_path,
- const char *w32_path, int &unit)
- __attribute__ ((regparm(3)));
-static int __stdcall
-get_device_number (const char *unix_path, const char *w32_path, int &unit)
-{
- DWORD devn = FH_BAD;
- unit = 0;
-
- if (*unix_path == '/' && udeveqn ("/dev/", 5))
- {
- devn = get_devn (unix_path, unit);
- if (devn == FH_BAD && *w32_path == '\\' && wdeveqn ("\\dev\\", 5))
- devn = get_devn (w32_path, unit);
- if (devn == FH_BAD && wdeveqn ("\\\\.\\", 4))
- devn = get_raw_device_number (unix_path + 5, w32_path + 4, unit);
- if (devn == FH_BAD)
- devn = get_raw_device_number (unix_path + 5, NULL, unit);
- }
- else
- {
- char *p = strrchr (unix_path, '/');
- if (p)
- unix_path = p + 1;
- if (udeveqn ("com", 3)
- && (unit = digits (unix_path + 3)) >= 0 && unit < 100)
- devn = FH_SERIAL;
- }
-
- return devn;
-}
-
-/* Return TRUE if src_path is a Win32 device name, filling out the device
- name in win32_path */
-
-static BOOL
-win32_device_name (const char *src_path, char *win32_path,
- DWORD &devn, int &unit)
-{
- const char *devfmt;
-
- devn = get_device_number (src_path, win32_path, unit);
-
- if (devn == FH_BAD)
- return false;
-
- if ((devfmt = windows_device_names[FHDEVN (devn)]) == NULL)
- return false;
- switch (devn)
- {
- case FH_RANDOM:
- __small_sprintf (win32_path, devfmt, unit == 8 ? "" : "u");
- break;
- case FH_TAPE:
- __small_sprintf (win32_path, "\\Device\\Tape%d", unit % 128);
- break;
- case FH_FLOPPY:
- if (unit < 16)
- __small_sprintf (win32_path, "\\Device\\Floppy%d", unit);
- else if (unit < 32)
- __small_sprintf (win32_path, "\\Device\\CdRom%d", unit - 16);
- else if (unit < 224)
- __small_sprintf (win32_path, "\\Device\\Harddisk%d\\Partition%d",
- (unit - 32) / 16, unit % 16);
- else
- __small_sprintf (win32_path, "\\DosDevices\\%c:", unit - 224 + 'A');
- break;
- default:
- __small_sprintf (win32_path, devfmt, unit);
- break;
- }
- return TRUE;
-}
-
-/* Normalize a Win32 path.
- /'s are converted to \'s in the process.
- All duplicate \'s, except for 2 leading \'s, are deleted.
-
- The result is 0 for success, or an errno error value.
- FIXME: A lot of this should be mergeable with the POSIX critter. */
-static int
-normalize_win32_path (const char *src, char *dst)
-{
- const char *src_start = src;
- char *dst_start = dst;
- char *dst_root_start = dst;
- bool beg_src_slash = isdirsep (src[0]);
-
- if (beg_src_slash && isdirsep (src[1]))
- {
- *dst++ = '\\';
- src++;
- if (src[1] == '.' && isdirsep (src[2]))
- {
- *dst++ = '\\';
- *dst++ = '.';
- src += 2;
- }
- }
- else if (strchr (src, ':') == NULL && *src != '/')
- {
- if (!cygheap->cwd.get (dst, 0))
- return get_errno ();
- if (beg_src_slash)
- {
- if (dst[1] == ':')
- dst[2] = '\0';
- else if (slash_unc_prefix_p (dst))
- {
- char *p = strpbrk (dst + 2, "\\/");
- if (p && (p = strpbrk (p + 1, "\\/")))
- *p = '\0';
- }
- }
- if (strlen (dst) + 1 + strlen (src) >= MAX_PATH)
- {
- debug_printf ("ENAMETOOLONG = normalize_win32_path (%s)", src);
- return ENAMETOOLONG;
- }
- dst += strlen (dst);
- if (!beg_src_slash)
- *dst++ = '\\';
- }
-
- while (*src)
- {
- /* Strip duplicate /'s. */
- if (SLASH_P (src[0]) && SLASH_P (src[1]))
- src++;
- /* Ignore "./". */
- else if (src[0] == '.' && SLASH_P (src[1])
- && (src == src_start || SLASH_P (src[-1])))
- src += 2;
-
- /* Backup if "..". */
- else if (src[0] == '.' && src[1] == '.'
- /* dst must be greater than dst_start */
- && dst[-1] == '\\'
- && (SLASH_P (src[2]) || src[2] == 0))
- {
- /* Back up over /, but not if it's the first one. */
- if (dst > dst_root_start + 1)
- dst--;
- /* Now back up to the next /. */
- while (dst > dst_root_start + 1 && dst[-1] != '\\' && dst[-2] != ':')
- dst--;
- src += 2;
- if (SLASH_P (*src))
- src++;
- }
- /* Otherwise, add char to result. */
- else
- {
- if (*src == '/')
- *dst++ = '\\';
- else
- *dst++ = *src;
- ++src;
- }
- if ((dst - dst_start) >= MAX_PATH)
- return ENAMETOOLONG;
- }
- *dst = 0;
- debug_printf ("%s = normalize_win32_path (%s)", dst_start, src_start);
- return 0;
-}
-
-/* Various utilities. */
-
-/* slashify: Convert all back slashes in src path to forward slashes
- in dst path. Add a trailing slash to dst when trailing_slash_p arg
- is set to 1. */
-
-static void
-slashify (const char *src, char *dst, int trailing_slash_p)
-{
- const char *start = src;
-
- while (*src)
- {
- if (*src == '\\')
- *dst++ = '/';
- else
- *dst++ = *src;
- ++src;
- }
- if (trailing_slash_p
- && src > start
- && !isdirsep (src[-1]))
- *dst++ = '/';
- *dst++ = 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. */
-
-static void
-backslashify (const char *src, char *dst, int trailing_slash_p)
-{
- const char *start = src;
-
- while (*src)
- {
- if (*src == '/')
- *dst++ = '\\';
- else
- *dst++ = *src;
- ++src;
- }
- if (trailing_slash_p
- && src > start
- && !isdirsep (src[-1]))
- *dst++ = '\\';
- *dst++ = 0;
-}
-
-/* nofinalslash: Remove trailing / and \ from SRC (except for the
- first one). It is ok for src == dst. */
-
-void __stdcall
-nofinalslash (const char *src, char *dst)
-{
- int len = strlen (src);
- if (src != dst)
- memcpy (dst, src, len + 1);
- while (len > 1 && SLASH_P (dst[--len]))
- dst[len] = '\0';
-}
-
-/* slash_unc_prefix_p: Return non-zero if PATH begins with //UNC/SHARE */
-
-int __stdcall
-slash_unc_prefix_p (const char *path)
-{
- char *p = NULL;
- int ret = (isdirsep (path[0])
- && isdirsep (path[1])
- && isalpha (path[2])
- && path[3] != 0
- && !isdirsep (path[3])
- && ((p = strpbrk(path + 3, "\\/")) != NULL));
- if (!ret || p == NULL)
- return ret;
- return ret && isalnum (p[1]);
-}
-
-/* conv_path_list: Convert a list of path names to/from Win32/POSIX. */
-
-static void
-conv_path_list (const char *src, char *dst, int to_posix_p)
-{
- char *s;
- char *d = dst;
- char src_delim = to_posix_p ? ';' : ':';
- char dst_delim = to_posix_p ? ':' : ';';
- int (*conv_fn) (const char *, char *) = (to_posix_p
- ? cygwin_conv_to_posix_path
- : cygwin_conv_to_win32_path);
-
- char *srcbuf = (char *) alloca (strlen (src) + 1);
-
- for (;;)
- {
- s = strccpy (srcbuf, &src, src_delim);
- int len = s - srcbuf;
- if (len >= MAX_PATH)
- srcbuf[MAX_PATH - 1] = '\0';
- (*conv_fn) (len ? srcbuf : ".", d);
- if (!*src++)
- break;
- d = strchr (d, '\0');
- *d++ = dst_delim;
- }
-}
-
-/* init: Initialize the mount table. */
-
-void
-mount_info::init ()
-{
- nmounts = 0;
-
- /* Fetch the mount table and cygdrive-related information from
- the registry. */
- from_registry ();
-}
-
-static void
-set_flags (unsigned *flags, unsigned val)
-{
- *flags = val;
- if (!(*flags & PATH_BINARY))
- *flags = PATH_TEXT;
-}
-
-/* conv_to_win32_path: Ensure src_path is a pure Win32 path and store
- the result in win32_path.
-
- If win32_path != NULL, the relative path, if possible to keep, is
- stored in win32_path. If the relative path isn't possible to keep,
- the full path is stored.
-
- If full_win32_path != NULL, the full path is stored there.
-
- The result is zero for success, or an errno value.
-
- {,full_}win32_path must have sufficient space (i.e. MAX_PATH bytes). */
-
-int
-mount_info::conv_to_win32_path (const char *src_path, char *dst,
- DWORD &devn, int &unit, unsigned *flags,
- bool no_normalize)
-{
- while (sys_mount_table_counter < cygwin_shared->sys_mount_table_counter)
- {
- init ();
- sys_mount_table_counter++;
- }
- int src_path_len = strlen (src_path);
- MALLOC_CHECK;
- unsigned dummy_flags;
- int chroot_ok = !cygheap->root.exists ();
-
- devn = FH_BAD;
- unit = 0;
-
- if (!flags)
- flags = &dummy_flags;
-
- *flags = 0;
- debug_printf ("conv_to_win32_path (%s)", src_path);
-
- if (src_path_len >= MAX_PATH)
- {
- debug_printf ("ENAMETOOLONG = conv_to_win32_path (%s)", src_path);
- return ENAMETOOLONG;
- }
-
- int i, rc;
- mount_item *mi = NULL; /* initialized to avoid compiler warning */
- char pathbuf[MAX_PATH];
-
- if (dst == NULL)
- goto out; /* Sanity check. */
-
- /* An MS-DOS spec has either a : or a \. If this is found, short
- circuit most of the rest of this function. */
- if (strpbrk (src_path, ":\\") != NULL || slash_unc_prefix_p (src_path))
- {
- debug_printf ("%s already win32", src_path);
- rc = normalize_win32_path (src_path, dst);
- if (rc)
- {
- debug_printf ("normalize_win32_path failed, rc %d", rc);
- return rc;
- }
-
- set_flags (flags, (unsigned) set_flags_from_win32_path (dst));
- goto out;
- }
-
- /* Normalize the path, taking out ../../ stuff, we need to do this
- so that we can move from one mounted directory to another with relative
- stuff.
-
- eg mounting c:/foo /foo
- d:/bar /bar
-
- cd /bar
- ls ../foo
-
- should look in c:/foo, not d:/foo.
-
- We do this by first getting an absolute UNIX-style path and then
- converting it to a DOS-style path, looking up the appropriate drive
- in the mount table. */
-
- if (no_normalize)
- strcpy (pathbuf, src_path);
- else
- {
- rc = normalize_posix_path (src_path, pathbuf);
-
- if (rc)
- {
- debug_printf ("%d = conv_to_win32_path (%s)", rc, src_path);
- return rc;
- }
- }
-
- /* See if this is a cygwin "device" */
- if (win32_device_name (pathbuf, dst, devn, unit))
- {
- *flags = MOUNT_BINARY; /* FIXME: Is this a sensible default for devices? */
- rc = 0;
- goto out_no_chroot_check;
- }
-
- /* Check if the cygdrive prefix was specified. If so, just strip
- off the prefix and transform it into an MS-DOS path. */
- MALLOC_CHECK;
- if (isproc (pathbuf))
- {
- devn = fhandler_proc::get_proc_fhandler (pathbuf);
- if (devn == FH_BAD)
- return ENOENT;
- }
- else if (iscygdrive (pathbuf))
- {
- int n = mount_table->cygdrive_len - 1;
- if (!pathbuf[n] ||
- (pathbuf[n] == '/' && pathbuf[n + 1] == '.' && !pathbuf[n + 2]))
- {
- unit = 0;
- dst[0] = '\0';
- if (mount_table->cygdrive_len > 1)
- devn = FH_CYGDRIVE;
- }
- else if (cygdrive_win32_path (pathbuf, dst, unit))
- {
- set_flags (flags, (unsigned) cygdrive_flags);
- goto out;
- }
- else if (mount_table->cygdrive_len > 1)
- return ENOENT;
- }
-
- int chrooted_path_len;
- chrooted_path_len = 0;
- /* Check the mount table for prefix matches. */
- for (i = 0; i < nmounts; i++)
- {
- const char *path;
- int len;
-
- mi = mount + posix_sorted[i];
- if (!cygheap->root.exists ()
- || (mi->posix_pathlen == 1 && mi->posix_path[0] == '/'))
- {
- path = mi->posix_path;
- len = mi->posix_pathlen;
- }
- else if (cygheap->root.posix_ok (mi->posix_path))
- {
- path = cygheap->root.unchroot (mi->posix_path);
- chrooted_path_len = len = strlen (path);
- }
- else
- {
- chrooted_path_len = 0;
- continue;
- }
-
- if (path_prefix_p (path, pathbuf, len))
- break;
- }
-
- if (i >= nmounts)
- {
- backslashify (pathbuf, dst, 0); /* just convert */
- set_flags (flags, PATH_BINARY);
- }
- else
- {
- int n;
- const char *native_path;
- int posix_pathlen;
- if (chroot_ok || chrooted_path_len || mi->posix_pathlen != 1
- || mi->posix_path[0] != '/')
- {
- n = mi->native_pathlen;
- native_path = mi->native_path;
- posix_pathlen = chrooted_path_len ?: mi->posix_pathlen;
- chroot_ok = 1;
- }
- else
- {
- n = cygheap->root.native_length ();
- native_path = cygheap->root.native_path ();
- posix_pathlen = mi->posix_pathlen;
- chroot_ok = 1;
- }
- memcpy (dst, native_path, n + 1);
- const char *p = pathbuf + posix_pathlen;
- if (*p == '/')
- /* nothing */;
- else if ((isdrive (dst) && !dst[2]) || *p)
- dst[n++] = '\\';
- strcpy (dst + n, p);
- backslashify (dst, dst, 0);
- set_flags (flags, (unsigned) mi->flags);
- }
-
- if (!isvirtual_dev (devn))
- win32_device_name (src_path, dst, devn, unit);
-
- out:
- MALLOC_CHECK;
- if (chroot_ok || cygheap->root.ischroot_native (dst))
- rc = 0;
- else
- {
- debug_printf ("attempt to access outside of chroot '%s = %s'",
- cygheap->root.posix_path (), cygheap->root.native_path ());
- rc = ENOENT;
- }
-
- out_no_chroot_check:
- debug_printf ("src_path %s, dst %s, flags %p, rc %d", src_path, dst, *flags, rc);
- return rc;
-}
-
-/* cygdrive_posix_path: Build POSIX path used as the
- mount point for cygdrives created when there is no other way to
- obtain a POSIX path from a Win32 one. */
-
-void
-mount_info::cygdrive_posix_path (const char *src, char *dst, int trailing_slash_p)
-{
- int len = cygdrive_len;
-
- memcpy (dst, cygdrive, len + 1);
-
- /* Now finish the path off with the drive letter to be used.
- The cygdrive prefix always ends with a trailing slash so
- the drive letter is added after the path. */
- dst[len++] = cyg_tolower (src[0]);
- if (!src[2] || (SLASH_P (src[2]) && !src[3]))
- dst[len++] = '\000';
- else
- {
- int n;
- dst[len++] = '/';
- if (SLASH_P (src[2]))
- n = 3;
- else
- n = 2;
- strcpy (dst + len, src + n);
- }
- slashify (dst, dst, trailing_slash_p);
-}
-
-int
-mount_info::cygdrive_win32_path (const char *src, char *dst, int& unit)
-{
- int res;
- const char *p = src + cygdrive_len;
- if (!isalpha (*p) || (!isdirsep (p[1]) && p[1]))
- {
- unit = -1;
- dst[0] = '\0';
- res = 0;
- }
- else
- {
- dst[0] = cyg_tolower (*p);
- dst[1] = ':';
- strcpy (dst + 2, p + 1);
- backslashify (dst, dst, !dst[2]);
- unit = dst[0];
- res = 1;
- }
- debug_printf ("src '%s', dst '%s'", src, dst);
- return res;
-}
-
-/* conv_to_posix_path: Ensure src_path is a POSIX path.
-
- The result is zero for success, or an errno value.
- posix_path must have sufficient space (i.e. MAX_PATH bytes).
- If keep_rel_p is non-zero, relative paths stay that way. */
-
-int
-mount_info::conv_to_posix_path (const char *src_path, char *posix_path,
- int keep_rel_p)
-{
- int src_path_len = strlen (src_path);
- int relative_path_p = !isabspath (src_path);
- int trailing_slash_p;
-
- if (src_path_len <= 1)
- trailing_slash_p = 0;
- else
- {
- const char *lastchar = src_path + src_path_len - 1;
- trailing_slash_p = SLASH_P (*lastchar) && lastchar[-1] != ':';
- }
-
- debug_printf ("conv_to_posix_path (%s, %s, %s)", src_path,
- keep_rel_p ? "keep-rel" : "no-keep-rel",
- trailing_slash_p ? "add-slash" : "no-add-slash");
- MALLOC_CHECK;
-
- if (src_path_len >= MAX_PATH)
- {
- debug_printf ("ENAMETOOLONG");
- return ENAMETOOLONG;
- }
-
- /* FIXME: For now, if the path is relative and it's supposed to stay
- that way, skip mount table processing. */
-
- if (keep_rel_p && relative_path_p)
- {
- slashify (src_path, posix_path, 0);
- debug_printf ("%s = conv_to_posix_path (%s)", posix_path, src_path);
- return 0;
- }
-
- char pathbuf[MAX_PATH];
- int rc = normalize_win32_path (src_path, pathbuf);
- if (rc != 0)
- {
- debug_printf ("%d = conv_to_posix_path (%s)", rc, src_path);
- return rc;
- }
-
- int pathbuflen = strlen (pathbuf);
- for (int i = 0; i < nmounts; ++i)
- {
- mount_item &mi = mount[native_sorted[i]];
- if (!path_prefix_p (mi.native_path, pathbuf, mi.native_pathlen))
- continue;
-
- if (cygheap->root.exists () && !cygheap->root.posix_ok (mi.posix_path))
- continue;
-
- /* SRC_PATH is in the mount table. */
- int nextchar;
- const char *p = pathbuf + mi.native_pathlen;
-
- if (!*p || !p[1])
- nextchar = 0;
- else if (isdirsep (*p))
- nextchar = -1;
- else
- nextchar = 1;
-
- int addslash = nextchar > 0 ? 1 : 0;
- if ((mi.posix_pathlen + (pathbuflen - mi.native_pathlen) + addslash) >= MAX_PATH)
- return ENAMETOOLONG;
- strcpy (posix_path, mi.posix_path);
- if (addslash)
- strcat (posix_path, "/");
- if (nextchar)
- slashify (p,
- posix_path + addslash + (mi.posix_pathlen == 1 ? 0 : mi.posix_pathlen),
- trailing_slash_p);
-
- if (cygheap->root.exists ())
- {
- const char *p = cygheap->root.unchroot (posix_path);
- memmove (posix_path, p, strlen (p) + 1);
- }
- goto out;
- }
-
- if (!cygheap->root.exists ())
- /* nothing */;
- else if (cygheap->root.ischroot_native (pathbuf))
- {
- const char *p = pathbuf + cygheap->root.native_length ();
- if (*p)
- slashify (p, posix_path, trailing_slash_p);
- else
- {
- posix_path[0] = '/';
- posix_path[1] = '\0';
- }
- }
- else
- return ENOENT;
-
- /* Not in the database. This should [theoretically] only happen if either
- the path begins with //, or / isn't mounted, or the path has a drive
- letter not covered by the mount table. If it's a relative path then the
- caller must want an absolute path (otherwise we would have returned
- above). So we always return an absolute path at this point. */
- if (isdrive (pathbuf))
- cygdrive_posix_path (pathbuf, posix_path, trailing_slash_p);
- else
- {
- /* The use of src_path and not pathbuf here is intentional.
- We couldn't translate the path, so just ensure no \'s are present. */
- slashify (src_path, posix_path, trailing_slash_p);
- }
-
-out:
- debug_printf ("%s = conv_to_posix_path (%s)", posix_path, src_path);
- MALLOC_CHECK;
- return 0;
-}
-
-/* Return flags associated with a mount point given the win32 path. */
-
-unsigned
-mount_info::set_flags_from_win32_path (const char *p)
-{
- for (int i = 0; i < nmounts; i++)
- {
- mount_item &mi = mount[native_sorted[i]];
- if (path_prefix_p (mi.native_path, p, mi.native_pathlen))
- return mi.flags;
- }
- return PATH_BINARY;
-}
-
-/* read_mounts: Given a specific regkey, read mounts from under its
- key. */
-
-void
-mount_info::read_mounts (reg_key& r)
-{
- char posix_path[MAX_PATH];
- HKEY key = r.get_key ();
- DWORD i, posix_path_size;
- int res;
-
- /* Loop through subkeys */
- /* FIXME: we would like to not check MAX_MOUNTS but the heap in the
- shared area is currently statically allocated so we can't have an
- arbitrarily large number of mounts. */
- for (i = 0; ; i++)
- {
- char native_path[MAX_PATH];
- int mount_flags;
-
- posix_path_size = MAX_PATH;
- /* FIXME: if maximum posix_path_size is 256, we're going to
- run into problems if we ever try to store a mount point that's
- over 256 but is under MAX_PATH. */
- res = RegEnumKeyEx (key, i, posix_path, &posix_path_size, NULL,
- NULL, NULL, NULL);
-
- if (res == ERROR_NO_MORE_ITEMS)
- break;
- else if (res != ERROR_SUCCESS)
- {
- debug_printf ("RegEnumKeyEx failed, error %d!\n", res);
- break;
- }
-
- /* Get a reg_key based on i. */
- reg_key subkey = reg_key (key, KEY_READ, posix_path, NULL);
-
- /* Fetch info from the subkey. */
- subkey.get_string ("native", native_path, sizeof (native_path), "");
- mount_flags = subkey.get_int ("flags", 0);
-
- /* Add mount_item corresponding to registry mount point. */
- res = mount_table->add_item (native_path, posix_path, mount_flags, false);
- if (res && get_errno () == EMFILE)
- break; /* The number of entries exceeds MAX_MOUNTS */
- }
-}
-
-/* from_registry: Build the entire mount table from the registry. Also,
- read in cygdrive-related information from its registry location. */
-
-void
-mount_info::from_registry ()
-{
- /* Use current mount areas if either user or system mount areas
- already exist. Otherwise, import old mounts. */
-
- reg_key r;
-
- /* Retrieve cygdrive-related information. */
- read_cygdrive_info_from_registry ();
-
- nmounts = 0;
-
- /* First read mounts from user's table. */
- read_mounts (r);
-
- /* Then read mounts from system-wide mount table. */
- reg_key r1 (HKEY_LOCAL_MACHINE, KEY_READ, "SOFTWARE",
- CYGWIN_INFO_CYGNUS_REGISTRY_NAME, CYGWIN_REGNAME,
- CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME,
- NULL);
- read_mounts (r1);
-}
-
-/* add_reg_mount: Add mount item to registry. Return zero on success,
- non-zero on failure. */
-/* FIXME: Need a mutex to avoid collisions with other tasks. */
-
-int
-mount_info::add_reg_mount (const char * native_path, const char * posix_path, unsigned mountflags)
-{
- int res = 0;
-
- /* Add the mount to the right registry location, depending on
- whether MOUNT_SYSTEM is set in the mount flags. */
- if (!(mountflags & MOUNT_SYSTEM)) /* current_user mount */
- {
- /* reg_key for user mounts in HKEY_CURRENT_USER. */
- reg_key reg_user;
-
- /* Start by deleting existing mount if one exists. */
- res = reg_user.kill (posix_path);
- if (res != ERROR_SUCCESS && res != ERROR_FILE_NOT_FOUND)
- goto err;
-
- /* Create the new mount. */
- reg_key subkey = reg_key (reg_user.get_key (),
- KEY_ALL_ACCESS,
- posix_path, NULL);
- res = subkey.set_string ("native", native_path);
- if (res != ERROR_SUCCESS)
- goto err;
- res = subkey.set_int ("flags", mountflags);
- }
- else /* local_machine mount */
- {
- /* reg_key for system mounts in HKEY_LOCAL_MACHINE. */
- reg_key reg_sys (HKEY_LOCAL_MACHINE, KEY_ALL_ACCESS, "SOFTWARE",
- CYGWIN_INFO_CYGNUS_REGISTRY_NAME, CYGWIN_REGNAME,
- CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME,
- NULL);
-
- /* Start by deleting existing mount if one exists. */
- res = reg_sys.kill (posix_path);
- if (res != ERROR_SUCCESS && res != ERROR_FILE_NOT_FOUND)
- goto err;
-
- /* Create the new mount. */
- reg_key subkey = reg_key (reg_sys.get_key (),
- KEY_ALL_ACCESS,
- posix_path, NULL);
- res = subkey.set_string ("native", native_path);
- if (res != ERROR_SUCCESS)
- goto err;
- res = subkey.set_int ("flags", mountflags);
-
- sys_mount_table_counter++;
- cygwin_shared->sys_mount_table_counter++;
- }
-
- return 0; /* Success */
- err:
- __seterrno_from_win_error (res);
- return -1;
-}
-
-/* del_reg_mount: delete mount item from registry indicated in flags.
- Return zero on success, non-zero on failure.*/
-/* FIXME: Need a mutex to avoid collisions with other tasks. */
-
-int
-mount_info::del_reg_mount (const char * posix_path, unsigned flags)
-{
- int res;
-
- if (!(flags & MOUNT_SYSTEM)) /* Delete from user registry */
- {
- reg_key reg_user (KEY_ALL_ACCESS,
- CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, NULL);
- res = reg_user.kill (posix_path);
- }
- else /* Delete from system registry */
- {
- sys_mount_table_counter++;
- cygwin_shared->sys_mount_table_counter++;
- reg_key reg_sys (HKEY_LOCAL_MACHINE, KEY_ALL_ACCESS, "SOFTWARE",
- CYGWIN_INFO_CYGNUS_REGISTRY_NAME, CYGWIN_REGNAME,
- CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME,
- NULL);
- res = reg_sys.kill (posix_path);
- }
-
- if (res != ERROR_SUCCESS)
- {
- __seterrno_from_win_error (res);
- return -1;
- }
-
- return 0; /* Success */
-}
-
-/* read_cygdrive_info_from_registry: Read the default prefix and flags
- to use when creating cygdrives from the special user registry
- location used to store cygdrive information. */
-
-void
-mount_info::read_cygdrive_info_from_registry ()
-{
- /* reg_key for user path prefix in HKEY_CURRENT_USER. */
- reg_key r;
-
- if (r.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, cygdrive, sizeof (cygdrive), "") != 0)
- {
- /* Didn't find the user path prefix so check the system path prefix. */
-
- /* reg_key for system path prefix in HKEY_LOCAL_MACHINE. */
- reg_key r2 (HKEY_LOCAL_MACHINE, KEY_READ, "SOFTWARE",
- CYGWIN_INFO_CYGNUS_REGISTRY_NAME, CYGWIN_REGNAME,
- CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME,
- NULL);
-
- if (r2.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, cygdrive,
- sizeof (cygdrive), ""))
- strcpy (cygdrive, CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX);
- cygdrive_flags = r2.get_int (CYGWIN_INFO_CYGDRIVE_FLAGS, MOUNT_CYGDRIVE);
- slashify (cygdrive, cygdrive, 1);
- cygdrive_len = strlen (cygdrive);
- }
- else
- {
- /* Fetch user cygdrive_flags from registry; returns MOUNT_CYGDRIVE on
- error. */
- cygdrive_flags = r.get_int (CYGWIN_INFO_CYGDRIVE_FLAGS, MOUNT_CYGDRIVE);
- slashify (cygdrive, cygdrive, 1);
- cygdrive_len = strlen(cygdrive);
- }
-}
-
-/* write_cygdrive_info_to_registry: Write the default prefix and flags
- to use when creating cygdrives to the special user registry
- location used to store cygdrive information. */
-
-int
-mount_info::write_cygdrive_info_to_registry (const char *cygdrive_prefix, unsigned flags)
-{
- /* Determine whether to modify user or system cygdrive path prefix. */
- HKEY top = (flags & MOUNT_SYSTEM) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
-
- if (flags & MOUNT_SYSTEM)
- {
- sys_mount_table_counter++;
- cygwin_shared->sys_mount_table_counter++;
- }
-
- /* reg_key for user path prefix in HKEY_CURRENT_USER or system path prefix in
- HKEY_LOCAL_MACHINE. */
- reg_key r (top, KEY_ALL_ACCESS, "SOFTWARE",
- CYGWIN_INFO_CYGNUS_REGISTRY_NAME, CYGWIN_REGNAME,
- CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME,
- NULL);
-
- /* Verify cygdrive prefix starts with a forward slash and if there's
- another character, it's not a slash. */
- if ((cygdrive_prefix == NULL) || (*cygdrive_prefix == 0) ||
- (!isslash (cygdrive_prefix[0])) ||
- ((cygdrive_prefix[1] != '\0') && (isslash (cygdrive_prefix[1]))))
- {
- set_errno (EINVAL);
- return -1;
- }
-
- char hold_cygdrive_prefix[strlen (cygdrive_prefix) + 1];
- /* Ensure that there is never a final slash */
- nofinalslash (cygdrive_prefix, hold_cygdrive_prefix);
-
- int res;
- res = r.set_string (CYGWIN_INFO_CYGDRIVE_PREFIX, hold_cygdrive_prefix);
- if (res != ERROR_SUCCESS)
- {
- __seterrno_from_win_error (res);
- return -1;
- }
- r.set_int (CYGWIN_INFO_CYGDRIVE_FLAGS, flags);
-
- /* This also needs to go in the in-memory copy of "cygdrive", but only if
- appropriate:
- 1. setting user path prefix, or
- 2. overwriting (a previous) system path prefix */
- if (!(flags & MOUNT_SYSTEM) || (mount_table->cygdrive_flags & MOUNT_SYSTEM))
- {
- slashify (cygdrive_prefix, mount_table->cygdrive, 1);
- mount_table->cygdrive_flags = flags;
- mount_table->cygdrive_len = strlen(mount_table->cygdrive);
- }
-
- return 0;
-}
-
-int
-mount_info::remove_cygdrive_info_from_registry (const char *cygdrive_prefix, unsigned flags)
-{
- /* Determine whether to modify user or system cygdrive path prefix. */
- HKEY top = (flags & MOUNT_SYSTEM) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
-
- if (flags & MOUNT_SYSTEM)
- {
- sys_mount_table_counter++;
- cygwin_shared->sys_mount_table_counter++;
- }
-
- /* reg_key for user path prefix in HKEY_CURRENT_USER or system path prefix in
- HKEY_LOCAL_MACHINE. */
- reg_key r (top, KEY_ALL_ACCESS, "SOFTWARE",
- CYGWIN_INFO_CYGNUS_REGISTRY_NAME, CYGWIN_REGNAME,
- CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME,
- NULL);
-
- /* Delete cygdrive prefix and flags. */
- int res = r.killvalue (CYGWIN_INFO_CYGDRIVE_PREFIX);
- int res2 = r.killvalue (CYGWIN_INFO_CYGDRIVE_FLAGS);
-
- /* Reinitialize the cygdrive path prefix to reflect to removal from the
- registry. */
- read_cygdrive_info_from_registry ();
-
- return (res != ERROR_SUCCESS) ? res : res2;
-}
-
-int
-mount_info::get_cygdrive_info (char *user, char *system, char* user_flags,
- char* system_flags)
-{
- /* Get the user path prefix from HKEY_CURRENT_USER. */
- reg_key r;
- int res = r.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, user, MAX_PATH, "");
-
- /* Get the user flags, if appropriate */
- if (res == ERROR_SUCCESS)
- {
- int flags = r.get_int (CYGWIN_INFO_CYGDRIVE_FLAGS, MOUNT_CYGDRIVE);
- strcpy (user_flags, (flags & MOUNT_BINARY) ? "binmode" : "textmode");
- }
-
- /* Get the system path prefix from HKEY_LOCAL_MACHINE. */
- reg_key r2 (HKEY_LOCAL_MACHINE, KEY_READ, "SOFTWARE",
- CYGWIN_INFO_CYGNUS_REGISTRY_NAME, CYGWIN_REGNAME,
- CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME,
- NULL);
- int res2 = r2.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, system, MAX_PATH, "");
-
- /* Get the system flags, if appropriate */
- if (res2 == ERROR_SUCCESS)
- {
- int flags = r2.get_int (CYGWIN_INFO_CYGDRIVE_FLAGS, MOUNT_CYGDRIVE);
- strcpy (system_flags, (flags & MOUNT_BINARY) ? "binmode" : "textmode");
- }
-
- return (res != ERROR_SUCCESS) ? res : res2;
-}
-
-static mount_item *mounts_for_sort;
-
-/* sort_by_posix_name: qsort callback to sort the mount entries. Sort
- user mounts ahead of system mounts to the same POSIX path. */
-/* FIXME: should the user should be able to choose whether to
- prefer user or system mounts??? */
-static int
-sort_by_posix_name (const void *a, const void *b)
-{
- mount_item *ap = mounts_for_sort + (*((int*) a));
- mount_item *bp = mounts_for_sort + (*((int*) b));
-
- /* Base weighting on longest posix path first so that the most
- obvious path will be chosen. */
- size_t alen = strlen (ap->posix_path);
- size_t blen = strlen (bp->posix_path);
-
- int res = blen - alen;
-
- if (res)
- return res; /* Path lengths differed */
-
- /* The two paths were the same length, so just determine normal
- lexical sorted order. */
- res = strcmp (ap->posix_path, bp->posix_path);
-
- if (res == 0)
- {
- /* need to select between user and system mount to same POSIX path */
- if (!(bp->flags & MOUNT_SYSTEM)) /* user mount */
- return 1;
- else
- return -1;
- }
-
- return res;
-}
-
-/* sort_by_native_name: qsort callback to sort the mount entries. Sort
- user mounts ahead of system mounts to the same POSIX path. */
-/* FIXME: should the user should be able to choose whether to
- prefer user or system mounts??? */
-static int
-sort_by_native_name (const void *a, const void *b)
-{
- mount_item *ap = mounts_for_sort + (*((int*) a));
- mount_item *bp = mounts_for_sort + (*((int*) b));
-
- /* Base weighting on longest win32 path first so that the most
- obvious path will be chosen. */
- size_t alen = strlen (ap->native_path);
- size_t blen = strlen (bp->native_path);
-
- int res = blen - alen;
-
- if (res)
- return res; /* Path lengths differed */
-
- /* The two paths were the same length, so just determine normal
- lexical sorted order. */
- res = strcmp (ap->native_path, bp->native_path);
-
- if (res == 0)
- {
- /* need to select between user and system mount to same POSIX path */
- if (!(bp->flags & MOUNT_SYSTEM)) /* user mount */
- return 1;
- else
- return -1;
- }
-
- return res;
-}
-
-void
-mount_info::sort ()
-{
- for (int i = 0; i < nmounts; i++)
- native_sorted[i] = posix_sorted[i] = i;
- /* Sort them into reverse length order, otherwise we won't
- be able to look for /foo in /. */
- mounts_for_sort = mount; /* ouch. */
- qsort (posix_sorted, nmounts, sizeof (posix_sorted[0]), sort_by_posix_name);
- qsort (native_sorted, nmounts, sizeof (native_sorted[0]), sort_by_native_name);
-}
-
-/* Add an entry to the mount table.
- Returns 0 on success, -1 on failure and errno is set.
-
- This is where all argument validation is done. It may not make sense to
- do this when called internally, but it's cleaner to keep it all here. */
-
-int
-mount_info::add_item (const char *native, const char *posix, unsigned mountflags, int reg_p)
-{
- /* Something's wrong if either path is NULL or empty, or if it's
- not a UNC or absolute path. */
-
- if ((native == NULL) || (*native == 0) ||
- (posix == NULL) || (*posix == 0) ||
- !isabspath (native) || !isabspath (posix) ||
- slash_unc_prefix_p (posix) || isdrive (posix))
- {
- set_errno (EINVAL);
- return -1;
- }
-
- /* Make sure both paths do not end in /. */
- char nativetmp[MAX_PATH];
- char posixtmp[MAX_PATH];
-
- backslashify (native, nativetmp, 0);
- nofinalslash (nativetmp, nativetmp);
-
- slashify (posix, posixtmp, 0);
- nofinalslash (posixtmp, posixtmp);
-
- debug_printf ("%s[%s], %s[%s], %p",
- native, nativetmp, posix, posixtmp, mountflags);
-
- /* Duplicate /'s in path are an error. */
- for (char *p = posixtmp + 1; *p; ++p)
- {
- if (p[-1] == '/' && p[0] == '/')
- {
- set_errno (EINVAL);
- return -1;
- }
- }
-
- /* Write over an existing mount item with the same POSIX path if
- it exists and is from the same registry area. */
- int i;
- for (i = 0; i < nmounts; i++)
- {
- if (strcasematch (mount[i].posix_path, posixtmp) &&
- (mount[i].flags & MOUNT_SYSTEM) == (mountflags & MOUNT_SYSTEM))
- break;
- }
-
- if (i == nmounts && nmounts == MAX_MOUNTS)
- {
- set_errno (EMFILE);
- return -1;
- }
-
- if (reg_p && add_reg_mount (nativetmp, posixtmp, mountflags))
- return -1;
-
- if (i == nmounts)
- nmounts++;
- mount[i].init (nativetmp, posixtmp, mountflags);
- sort ();
-
- return 0;
-}
-
-/* Delete a mount table entry where path is either a Win32 or POSIX
- path. Since the mount table is really just a table of aliases,
- deleting / is ok (although running without a slash mount is
- strongly discouraged because some programs may run erratically
- without one). If MOUNT_SYSTEM is set in flags, remove from system
- registry, otherwise remove the user registry mount.
-*/
-
-int
-mount_info::del_item (const char *path, unsigned flags, int reg_p)
-{
- char pathtmp[MAX_PATH];
- int posix_path_p = false;
-
- /* Something's wrong if path is NULL or empty. */
- if (path == NULL || *path == 0 || !isabspath (path))
- {
- set_errno (EINVAL);
- return -1;
- }
-
- if (slash_unc_prefix_p (path) || strpbrk (path, ":\\"))
- backslashify (path, pathtmp, 0);
- else
- {
- slashify (path, pathtmp, 0);
- posix_path_p = TRUE;
- }
- nofinalslash (pathtmp, pathtmp);
-
- if (reg_p && posix_path_p &&
- del_reg_mount (pathtmp, flags) &&
- del_reg_mount (path, flags)) /* for old irregular entries */
- return -1;
-
- for (int i = 0; i < nmounts; i++)
- {
- int ent = native_sorted[i]; /* in the same order as getmntent() */
- if (((posix_path_p)
- ? strcasematch (mount[ent].posix_path, pathtmp)
- : strcasematch (mount[ent].native_path, pathtmp)) &&
- (mount[ent].flags & MOUNT_SYSTEM) == (flags & MOUNT_SYSTEM))
- {
- if (!posix_path_p &&
- reg_p && del_reg_mount (mount[ent].posix_path, flags))
- return -1;
-
- nmounts--; /* One less mount table entry */
- /* Fill in the hole if not at the end of the table */
- if (ent < nmounts)
- memmove (mount + ent, mount + ent + 1,
- sizeof (mount[ent]) * (nmounts - ent));
- sort (); /* Resort the table */
- return 0;
- }
- }
- set_errno (EINVAL);
- return -1;
-}
-
-/************************* mount_item class ****************************/
-
-static mntent *
-fillout_mntent (const char *native_path, const char *posix_path, unsigned flags)
-{
-#ifdef _MT_SAFE
- struct mntent &ret=_reent_winsup()->mntbuf;
-#else
- static NO_COPY struct mntent ret;
-#endif
-
- /* Remove drivenum from list if we see a x: style path */
- if (strlen (native_path) == 2 && native_path[1] == ':')
- {
- int drivenum = cyg_tolower (native_path[0]) - 'a';
- if (drivenum >= 0 && drivenum <= 31)
- available_drives &= ~(1 << drivenum);
- }
-
- /* Pass back pointers to mount_table strings reserved for use by
- getmntent rather than pointers to strings in the internal mount
- table because the mount table might change, causing weird effects
- from the getmntent user's point of view. */
-
- strcpy (_reent_winsup ()->mnt_fsname, native_path);
- ret.mnt_fsname = _reent_winsup ()->mnt_fsname;
- strcpy (_reent_winsup ()->mnt_dir, posix_path);
- ret.mnt_dir = _reent_winsup ()->mnt_dir;
-
- if (!(flags & MOUNT_SYSTEM)) /* user mount */
- strcpy (_reent_winsup ()->mnt_type, (char *) "user");
- else /* system mount */
- strcpy (_reent_winsup ()->mnt_type, (char *) "system");
-
- ret.mnt_type = _reent_winsup ()->mnt_type;
-
- /* mnt_opts is a string that details mount params such as
- binary or textmode, or exec. We don't print
- `silent' here; it's a magic internal thing. */
-
- if (!(flags & MOUNT_BINARY))
- strcpy (_reent_winsup ()->mnt_opts, (char *) "textmode");
- else
- strcpy (_reent_winsup ()->mnt_opts, (char *) "binmode");
-
- if (flags & MOUNT_CYGWIN_EXEC)
- strcat (_reent_winsup ()->mnt_opts, (char *) ",cygexec");
- else if (flags & MOUNT_EXEC)
- strcat (_reent_winsup ()->mnt_opts, (char *) ",exec");
- else if (flags & MOUNT_NOTEXEC)
- strcat (_reent_winsup ()->mnt_opts, (char *) ",noexec");
-
- if ((flags & MOUNT_CYGDRIVE)) /* cygdrive */
- strcat (_reent_winsup ()->mnt_opts, (char *) ",noumount");
-
- ret.mnt_opts = _reent_winsup ()->mnt_opts;
-
- ret.mnt_freq = 1;
- ret.mnt_passno = 1;
- return &ret;
-}
-
-struct mntent *
-mount_item::getmntent ()
-{
- return fillout_mntent (native_path, posix_path, flags);
-}
-
-static struct mntent *
-cygdrive_getmntent ()
-{
- char native_path[4];
- char posix_path[MAX_PATH];
- DWORD mask = 1, drive = 'a';
- struct mntent *ret = NULL;
-
- while (available_drives)
- {
- for (/* nothing */; drive <= 'z'; mask <<= 1, drive++)
- if (available_drives & mask)
- break;
-
- __small_sprintf (native_path, "%c:\\", drive);
- if (GetDriveType (native_path) == DRIVE_REMOVABLE ||
- GetFileAttributes (native_path) == INVALID_FILE_ATTRIBUTES)
- {
- available_drives &= ~mask;
- continue;
- }
- native_path[2] = '\0';
- __small_sprintf (posix_path, "%s%c", mount_table->cygdrive, drive);
- ret = fillout_mntent (native_path, posix_path, mount_table->cygdrive_flags);
- break;
- }
-
- return ret;
-}
-
-struct mntent *
-mount_info::getmntent (int x)
-{
- if (x < 0 || x >= nmounts)
- return cygdrive_getmntent ();
-
- return mount[native_sorted[x]].getmntent ();
-}
-
-/* Fill in the fields of a mount table entry. */
-
-void
-mount_item::init (const char *native, const char *posix, unsigned mountflags)
-{
- strcpy ((char *) native_path, native);
- strcpy ((char *) posix_path, posix);
-
- native_pathlen = strlen (native_path);
- posix_pathlen = strlen (posix_path);
-
- flags = mountflags;
-}
-
-/********************** Mount System Calls **************************/
-
-/* Mount table system calls.
- Note that these are exported to the application. */
-
-/* mount: Add a mount to the mount table in memory and to the registry
- that will cause paths under win32_path to be translated to paths
- under posix_path. */
-
-extern "C" int
-mount (const char *win32_path, const char *posix_path, unsigned flags)
-{
- int res = -1;
-
- if (flags & MOUNT_CYGDRIVE) /* normal mount */
- {
- /* When flags include MOUNT_CYGDRIVE, take this to mean that
- we actually want to change the cygdrive prefix and flags
- without actually mounting anything. */
- res = mount_table->write_cygdrive_info_to_registry (posix_path, flags);
- win32_path = NULL;
- }
- else
- res = mount_table->add_item (win32_path, posix_path, flags, TRUE);
-
- syscall_printf ("%d = mount (%s, %s, %p)", res, win32_path, posix_path, flags);
- return res;
-}
-
-/* umount: The standard umount call only has a path parameter. Since
- it is not possible for this call to specify whether to remove the
- mount from the user or global mount registry table, assume the user
- table. */
-
-extern "C" int
-umount (const char *path)
-{
- return cygwin_umount (path, 0);
-}
-
-/* cygwin_umount: This is like umount but takes an additional flags
- parameter that specifies whether to umount from the user or system-wide
- registry area. */
-
-extern "C" int
-cygwin_umount (const char *path, unsigned flags)
-{
- int res = -1;
-
- if (flags & MOUNT_CYGDRIVE)
- {
- /* When flags include MOUNT_CYGDRIVE, take this to mean that we actually want
- to remove the cygdrive prefix and flags without actually unmounting
- anything. */
- res = mount_table->remove_cygdrive_info_from_registry (path, flags);
- }
- else
- {
- res = mount_table->del_item (path, flags, TRUE);
- }
-
- syscall_printf ("%d = cygwin_umount (%s, %d)", res, path, flags);
- return res;
-}
-
-extern "C" FILE *
-setmntent (const char *filep, const char *)
-{
- iteration = 0;
- available_drives = GetLogicalDrives ();
- return (FILE *) filep;
-}
-
-extern "C" struct mntent *
-getmntent (FILE *)
-{
- return mount_table->getmntent (iteration++);
-}
-
-extern "C" int
-endmntent (FILE *)
-{
- return 1;
-}
-
-/********************** Symbolic Link Support **************************/
-
-/* Read symlink from Extended Attribute */
-int
-get_symlink_ea (const char* frompath, char* buf, int buf_size)
-{
- int res = NTReadEA (frompath, SYMLINK_EA_NAME, buf, buf_size);
- if (res == 0)
- debug_printf ("Cannot read symlink from EA");
- return (res - 1);
-}
-
-/* Save symlink to Extended Attribute */
-BOOL
-set_symlink_ea (const char* frompath, const char* topath)
-{
- if (!NTWriteEA (frompath, SYMLINK_EA_NAME, topath, strlen (topath) + 1))
- {
- debug_printf ("Cannot save symlink in EA");
- return false;
- }
- return TRUE;
-}
-
-/* Create a symlink from FROMPATH to TOPATH. */
-
-/* If TRUE create symlinks as Windows shortcuts, if false create symlinks
- as normal files with magic number and system bit set. */
-int allow_winsymlinks = TRUE;
-
-extern "C" int
-symlink (const char *topath, const char *frompath)
-{
- HANDLE h;
- int res = -1;
- path_conv win32_path, win32_topath;
- char from[MAX_PATH + 5];
- char cwd[MAX_PATH + 1], *cp = NULL, c = 0;
- char w32topath[MAX_PATH + 1];
- DWORD written;
- SECURITY_ATTRIBUTES sa = sec_none_nih;
-
- /* POSIX says that empty 'frompath' is invalid input whlie empty
- 'topath' is valid -- it's symlink resolver job to verify if
- symlink contents point to existing filesystem object */
- if (check_null_empty_str_errno (topath) == EFAULT ||
- check_null_empty_str_errno (frompath))
- goto done;
-
- if (strlen (topath) >= MAX_PATH)
- {
- set_errno (ENAMETOOLONG);
- goto done;
- }
-
- win32_path.check (frompath, PC_SYM_NOFOLLOW);
- if (allow_winsymlinks && !win32_path.exists ())
- {
- strcpy (from, frompath);
- strcat (from, ".lnk");
- win32_path.check (from, PC_SYM_NOFOLLOW);
- }
-
- if (win32_path.error)
- {
- set_errno (win32_path.case_clash ? ECASECLASH : win32_path.error);
- goto done;
- }
-
- syscall_printf ("symlink (%s, %s)", topath, win32_path.get_win32 ());
-
- if (win32_path.is_device () || win32_path.exists ())
- {
- set_errno (EEXIST);
- goto done;
- }
-
- if (allow_winsymlinks)
- {
- if (!isabspath (topath))
- {
- getcwd (cwd, MAX_PATH + 1);
- if ((cp = strrchr (from, '/')) || (cp = strrchr (from, '\\')))
- {
- c = *cp;
- *cp = '\0';
- chdir (from);
- }
- backslashify (topath, w32topath, 0);
- }
- if (!cp || GetFileAttributes (w32topath) == INVALID_FILE_ATTRIBUTES)
- {
- win32_topath.check (topath, PC_SYM_NOFOLLOW);
- if (!cp || win32_topath.error != ENOENT)
- strcpy (w32topath, win32_topath);
- }
- if (cp)
- {
- *cp = c;
- chdir (cwd);
- }
- }
-
- if (allow_ntsec && win32_path.has_acls ())
- set_security_attribute (S_IFLNK | S_IRWXU | S_IRWXG | S_IRWXO,
- &sa, alloca (4096), 4096);
-
- h = CreateFileA(win32_path, GENERIC_WRITE, 0, &sa,
- CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
- if (h == INVALID_HANDLE_VALUE)
- __seterrno ();
- else
- {
- BOOL success;
-
- if (allow_winsymlinks)
- {
- create_shortcut_header ();
- /* Don't change the datatypes of `len' and `win_len' since
- their sizeof is used when writing. */
- unsigned short len = strlen (topath);
- unsigned short win_len = strlen (w32topath);
- success = WriteFile (h, shortcut_header, SHORTCUT_HDR_SIZE,
- &written, NULL)
- && written == SHORTCUT_HDR_SIZE
- && WriteFile (h, &len, sizeof len, &written, NULL)
- && written == sizeof len
- && WriteFile (h, topath, len, &written, NULL)
- && written == len
- && WriteFile (h, &win_len, sizeof win_len, &written, NULL)
- && written == sizeof win_len
- && WriteFile (h, w32topath, win_len, &written, NULL)
- && written == win_len;
- }
- else
- {
- /* This is the old technique creating a symlink. */
- char buf[sizeof (SYMLINK_COOKIE) + MAX_PATH + 10];
-
- __small_sprintf (buf, "%s%s", SYMLINK_COOKIE, topath);
- DWORD len = strlen (buf) + 1;
-
- /* Note that the terminating nul is written. */
- success = WriteFile (h, buf, len, &written, NULL)
- || written != len;
-
- }
- if (success)
- {
- CloseHandle (h);
- if (!allow_ntsec && allow_ntea)
- set_file_attribute (win32_path.has_acls (),
- win32_path.get_win32 (),
- S_IFLNK | S_IRWXU | S_IRWXG | S_IRWXO);
-
- DWORD attr = allow_winsymlinks ? FILE_ATTRIBUTE_READONLY
- : FILE_ATTRIBUTE_SYSTEM;
-#ifdef HIDDEN_DOT_FILES
- cp = strrchr (win32_path, '\\');
- if ((cp && cp[1] == '.') || *win32_path == '.')
- attr |= FILE_ATTRIBUTE_HIDDEN;
-#endif
- SetFileAttributes (win32_path.get_win32 (), attr);
-
- if (win32_path.fs_fast_ea ())
- set_symlink_ea (win32_path, topath);
- res = 0;
- }
- else
- {
- __seterrno ();
- CloseHandle (h);
- DeleteFileA (win32_path.get_win32 ());
- }
- }
-
-done:
- syscall_printf ("%d = symlink (%s, %s)", res, topath, frompath);
- return res;
-}
-
-static int
-check_sysfile (const char *path, DWORD fileattr, HANDLE h,
- char *contents, int *error, unsigned *pflags)
-{
- char cookie_buf[sizeof (SYMLINK_COOKIE) - 1];
- DWORD got;
- int res = 0;
-
- if (!ReadFile (h, cookie_buf, sizeof (cookie_buf), &got, 0))
- {
- debug_printf ("ReadFile1 failed");
- *error = EIO;
- }
- else if (got == sizeof (cookie_buf)
- && memcmp (cookie_buf, SYMLINK_COOKIE, sizeof (cookie_buf)) == 0)
- {
- /* It's a symlink. */
- *pflags = PATH_SYMLINK;
-
- res = ReadFile (h, contents, MAX_PATH + 1, &got, 0);
- if (!res)
- {
- debug_printf ("ReadFile2 failed");
- *error = EIO;
- }
- else
- {
- /* Versions prior to b16 stored several trailing
- NULs with the path (to fill the path out to 1024
- chars). Current versions only store one trailing
- NUL. The length returned is the path without
- *any* trailing NULs. We also have to handle (or
- at least not die from) corrupted paths. */
- if (memchr (contents, 0, got) != NULL)
- res = strlen (contents);
- else
- res = got;
- }
- }
- else if (got == sizeof (cookie_buf)
- && memcmp (cookie_buf, SOCKET_COOKIE, sizeof (cookie_buf)) == 0)
- *pflags |= PATH_SOCKET;
- else
- {
- /* Not a symlink, see if executable. */
- if (*pflags & PATH_ALL_EXEC)
- /* Nothing to do */;
- else if (has_exec_chars (cookie_buf, got))
- *pflags |= PATH_EXEC;
- else
- *pflags |= PATH_NOTEXEC;
- }
- syscall_printf ("%d = symlink.check_sysfile (%s, %s) (%p)",
- res, path, contents, *pflags);
-
- CloseHandle (h);
- return res;
-}
-
-enum
-{
- SCAN_BEG,
- SCAN_LNK,
- SCAN_HASLNK,
- SCAN_JUSTCHECK,
- SCAN_APPENDLNK,
- SCAN_EXTRALNK,
- SCAN_DONE,
-};
-
-class suffix_scan
-{
- const suffix_info *suffixes, *suffixes_start;
- int nextstate;
- char *eopath;
-public:
- const char *path;
- char *has (const char *, const suffix_info *);
- int next ();
- int lnk_match () {return nextstate >= SCAN_EXTRALNK;}
-};
-
-char *
-suffix_scan::has (const char *in_path, const suffix_info *in_suffixes)
-{
- nextstate = SCAN_BEG;
- suffixes = suffixes_start = in_suffixes;
-
- char *ext_here = strrchr (in_path, '.');
- path = in_path;
- eopath = strchr (path, '\0');
-
- if (!ext_here)
- goto noext;
-
- if (suffixes)
- {
- /* Check if the extension matches a known extension */
- for (const suffix_info *ex = in_suffixes; ex->name != NULL; ex++)
- if (strcasematch (ext_here, ex->name))
- {
- nextstate = SCAN_JUSTCHECK;
- suffixes = NULL; /* Has an extension so don't scan for one. */
- goto done;
- }
- }
-
- /* Didn't match. Use last resort -- .lnk. */
- if (strcasematch (ext_here, ".lnk"))
- {
- nextstate = SCAN_HASLNK;
- suffixes = NULL;
- }
-
- noext:
- ext_here = eopath;
-
- done:
- return ext_here;
-}
-
-int
-suffix_scan::next ()
-{
- if (suffixes)
- {
- while (suffixes && suffixes->name)
- if (!suffixes->addon)
- suffixes++;
- else
- {
- strcpy (eopath, suffixes->name);
- if (nextstate == SCAN_EXTRALNK)
- strcat (eopath, ".lnk");
- suffixes++;
- return 1;
- }
- suffixes = NULL;
- }
-
- switch (nextstate)
- {
- case SCAN_BEG:
- suffixes = suffixes_start;
- if (!suffixes)
- nextstate = SCAN_LNK;
- else
- {
- if (!*suffixes->name)
- suffixes++;
- nextstate = SCAN_EXTRALNK;
- }
- return 1;
- case SCAN_HASLNK:
- nextstate = SCAN_EXTRALNK; /* Skip SCAN_BEG */
- return 1;
- case SCAN_LNK:
- case SCAN_EXTRALNK:
- strcpy (eopath, ".lnk");
- nextstate = SCAN_DONE;
- return 1;
- case SCAN_JUSTCHECK:
- nextstate = SCAN_APPENDLNK;
- return 1;
- case SCAN_APPENDLNK:
- strcat (eopath, ".lnk");
- nextstate = SCAN_DONE;
- return 1;
- default:
- *eopath = '\0';
- return 0;
- }
-}
-
-/* Check if PATH is a symlink. PATH must be a valid Win32 path name.
-
- If PATH is a symlink, put the value of the symlink--the file to
- which it points--into BUF. The value stored in BUF is not
- necessarily null terminated. BUFLEN is the length of BUF; only up
- to BUFLEN characters will be stored in BUF. BUF may be NULL, in
- which case nothing will be stored.
-
- Set *SYML if PATH is a symlink.
-
- Set *EXEC if PATH appears to be executable. This is an efficiency
- hack because we sometimes have to open the file anyhow. *EXEC will
- not be set for every executable file.
-
- Return -1 on error, 0 if PATH is not a symlink, or the length
- stored into BUF if PATH is a symlink. */
-
-int
-symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt)
-{
- HANDLE h;
- int res = 0;
- suffix_scan suffix;
- contents[0] = '\0';
-
- is_symlink = TRUE;
- ext_here = suffix.has (path, suffixes);
- extn = ext_here - path;
-
- pflags &= ~PATH_SYMLINK;
-
- case_clash = false;
-
- while (suffix.next ())
- {
- error = 0;
- fileattr = GetFileAttributes (suffix.path);
- if (fileattr == INVALID_FILE_ATTRIBUTES)
- {
- /* The GetFileAttributes call can fail for reasons that don't
- matter, so we just return 0. For example, getting the
- attributes of \\HOST will typically fail. */
- debug_printf ("GetFileAttributes (%s) failed", suffix.path);
- error = geterrno_from_win_error (GetLastError (), EACCES);
- continue;
- }
-
-
- ext_tacked_on = !!*ext_here;
-
- if (pcheck_case != PCHECK_RELAXED && !case_check (path)
- || (opt & PC_SYM_IGNORE))
- goto file_not_symlink;
-
- int sym_check;
-
- sym_check = 0;
-
- if (fileattr & FILE_ATTRIBUTE_DIRECTORY)
- goto file_not_symlink;
-
- /* Windows shortcuts are treated as symlinks. */
- if (suffix.lnk_match ())
- sym_check = 1;
-
- /* This is the old Cygwin method creating symlinks: */
- /* A symlink will have the `system' file attribute. */
- /* Only files can be symlinks (which can be symlinks to directories). */
- if (fileattr & FILE_ATTRIBUTE_SYSTEM)
- sym_check = 2;
-
- if (!sym_check)
- goto file_not_symlink;
-
- if (sym_check > 0 && opt & PC_CHECK_EA &&
- (res = get_symlink_ea (suffix.path, contents, sizeof (contents))) > 0)
- {
- pflags = PATH_SYMLINK;
- debug_printf ("Got symlink from EA: %s", contents);
- break;
- }
-
- /* Open the file. */
-
- h = CreateFileA (suffix.path, GENERIC_READ, FILE_SHARE_READ, &sec_none_nih, OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL, 0);
- res = -1;
- if (h == INVALID_HANDLE_VALUE)
- goto file_not_symlink;
-
- /* FIXME: if symlink isn't present in EA, but EAs are supported,
- * should we write it there?
- */
- switch (sym_check)
- {
- case 1:
- res = check_shortcut (suffix.path, fileattr, h, contents, &error, &pflags);
- if (res)
- break;
- /* If searching for `foo' and then finding a `foo.lnk' which is
- no shortcut, return the same as if file not found. */
- if (!suffix.lnk_match () || !ext_tacked_on)
- goto file_not_symlink;
-
- fileattr = INVALID_FILE_ATTRIBUTES;
- continue; /* in case we're going to tack *another* .lnk on this filename. */
- case 2:
- res = check_sysfile (suffix.path, fileattr, h, contents, &error, &pflags);
- if (!res)
- goto file_not_symlink;
- break;
- }
- break;
-
- file_not_symlink:
- is_symlink = false;
- syscall_printf ("not a symlink");
- res = 0;
- break;
- }
-
- syscall_printf ("%d = symlink.check (%s, %p) (%p)",
- res, suffix.path, contents, pflags);
- return res;
-}
-
-/* Check the correct case of the last path component (given in DOS style).
- Adjust the case in this->path if pcheck_case == PCHECK_ADJUST or return
- false if pcheck_case == PCHECK_STRICT.
- Dont't call if pcheck_case == PCHECK_RELAXED.
-*/
-
-BOOL
-symlink_info::case_check (char *path)
-{
- WIN32_FIND_DATA data;
- HANDLE h;
- char *c;
-
- /* Set a pointer to the beginning of the last component. */
- if (!(c = strrchr (path, '\\')))
- c = path;
- else
- ++c;
-
- if ((h = FindFirstFile (path, &data))
- != INVALID_HANDLE_VALUE)
- {
- FindClose (h);
-
- /* If that part of the component exists, check the case. */
- if (strcmp (c, data.cFileName))
- {
- case_clash = TRUE;
-
- /* If check is set to STRICT, a wrong case results
- in returning a ENOENT. */
- if (pcheck_case == PCHECK_STRICT)
- return false;
-
- /* PCHECK_ADJUST adjusts the case in the incoming
- path which points to the path in *this. */
- strcpy (c, data.cFileName);
- }
- }
- return TRUE;
-}
-
-/* readlink system call */
-
-extern "C" int
-readlink (const char *path, char *buf, int buflen)
-{
- extern suffix_info stat_suffixes[];
-
- if (buflen < 0)
- {
- set_errno (ENAMETOOLONG);
- return -1;
- }
-
- path_conv pathbuf (path, PC_SYM_CONTENTS, stat_suffixes);
-
- if (pathbuf.error)
- {
- set_errno (pathbuf.error);
- syscall_printf ("-1 = readlink (%s, %p, %d)", path, buf, buflen);
- return -1;
- }
-
- if (!pathbuf.exists ())
- {
- set_errno (ENOENT);
- return -1;
- }
-
- if (!pathbuf.issymlink ())
- {
- if (pathbuf.fileattr != INVALID_FILE_ATTRIBUTES)
- set_errno (EINVAL);
- return -1;
- }
-
- int len = min (buflen, (int) strlen (pathbuf.get_win32 ()));
- memcpy (buf, pathbuf.get_win32 (), len);
-
- /* errno set by symlink.check if error */
- return len;
-}
-
-/* Some programs rely on st_dev/st_ino being unique for each file.
- Hash the path name and hope for the best. The hash arg is not
- always initialized to zero since readdir needs to compute the
- dirent ino_t based on a combination of the hash of the directory
- done during the opendir call and the hash or the filename within
- the directory. FIXME: Not bullet-proof. */
-/* Cygwin internal */
-
-unsigned long __stdcall
-hash_path_name (unsigned long hash, const char *name)
-{
- if (!*name)
- return hash;
-
- /* Perform some initial permutations on the pathname if this is
- not "seeded" */
- if (!hash)
- {
- /* Simplistic handling of drives. If there is a drive specified,
- make sure that the initial letter is upper case. If there is
- no \ after the ':' assume access through the root directory
- of that drive.
- FIXME: Should really honor MS-Windows convention of using
- the environment to track current directory on various drives. */
- if (name[1] == ':')
- {
- char *nn, *newname = (char *) alloca (strlen (name) + 2);
- nn = newname;
- *nn = isupper (*name) ? cyg_tolower (*name) : *name;
- *++nn = ':';
- name += 2;
- if (*name != '\\')
- *++nn = '\\';
- strcpy (++nn, name);
- name = newname;
- goto hashit;
- }
-
- /* Fill out the hashed path name with the current working directory if
- this is not an absolute path and there is no pre-specified hash value.
- Otherwise the inodes same will differ depending on whether a file is
- referenced with an absolute value or relatively. */
-
- if (!hash && !isabspath (name))
- {
- hash = cygheap->cwd.get_hash ();
- if (name[0] == '.' && name[1] == '\0')
- return hash;
- hash = (hash << 5) - hash + '\\';
- }
- }
-
-hashit:
- /* Build up hash. Ignore single trailing slash or \a\b\ != \a\b or
- \a\b\. but allow a single \ if that's all there is. */
- do
- {
- int ch = cyg_tolower(*name);
- hash = (hash << 5) - hash + ch;
- }
- while (*++name != '\0' &&
- !(*name == '\\' && (!name[1] || (name[1] == '.' && !name[2]))));
- return hash;
-}
-
-char *
-getcwd (char *buf, size_t ulen)
-{
- char* res = NULL;
- if (ulen == 0 && buf)
- set_errno (EINVAL);
- else if (buf == NULL || !__check_null_invalid_struct_errno (buf, ulen))
- res = cygheap->cwd.get (buf, 1, 1, ulen);
- return res;
-}
-
-/* getwd: standards? */
-extern "C" char *
-getwd (char *buf)
-{
- return getcwd (buf, MAX_PATH);
-}
-
-/* chdir: POSIX 5.2.1.1 */
-extern "C" int
-chdir (const char *in_dir)
-{
- if (check_null_empty_str_errno (in_dir))
- return -1;
-
- syscall_printf ("dir '%s'", in_dir);
-
- char *s;
- char dir[strlen (in_dir) + 1];
- strcpy (dir, in_dir);
- /* Incredibly. Windows allows you to specify a path with trailing
- whitespace to SetCurrentDirectory. This doesn't work too well
- with other parts of the API, though, apparently. So nuke trailing
- white space. */
- for (s = strchr (dir, '\0'); --s >= dir && isspace ((unsigned int) (*s & 0xff)); )
- *s = '\0';
-
- if (!*s)
- {
- set_errno (ENOENT);
- return -1;
- }
-
- /* Convert path. First argument ensures that we don't check for NULL/empty/invalid
- again. */
- path_conv path (PC_NONULLEMPTY, dir, PC_FULL | PC_SYM_FOLLOW);
- if (path.error)
- {
- set_errno (path.error);
- syscall_printf ("-1 = chdir (%s)", dir);
- return -1;
- }
-
-
- /* Look for trailing path component consisting entirely of dots. This
- is needed only in case of chdir since Windows simply ignores count
- of dots > 2 here instead of returning an error code. Counts of dots
- <= 2 are already eliminated by normalize_posix_path. */
- const char *p = strrchr (dir, '/');
- if (!p)
- p = dir;
- else
- p++;
-
- size_t len = strlen (p);
- if (len > 2 && strspn (p, ".") == len)
- {
- set_errno (ENOENT);
- return -1;
- }
-
- const char *native_dir = path.get_win32 ();
-
- /* Check to see if path translates to something like C:.
- If it does, append a \ to the native directory specification to
- defeat the Windows 95 (i.e. MS-DOS) tendency of returning to
- the last directory visited on the given drive. */
- if (isdrive (native_dir) && !native_dir[2])
- {
- path.get_win32 ()[2] = '\\';
- path.get_win32 ()[3] = '\0';
- }
- int res;
- int devn = path.get_devn();
- if (!isvirtual_dev (devn))
- res = SetCurrentDirectory (native_dir) ? 0 : -1;
- else if (!path.exists ())
- {
- set_errno (ENOENT);
- return -1;
- }
- else if (!path.isdir ())
- {
- set_errno (ENOTDIR);
- return -1;
- }
- else
- {
- native_dir = "c:\\";
- res = 0;
- }
-
- /* If res != 0, we didn't change to a new directory.
- Otherwise, set the current windows and posix directory cache from input.
- If the specified directory is a MS-DOS style directory or if the directory
- was symlinked, convert the MS-DOS path back to posix style. Otherwise just
- store the given directory. This allows things like "find", which traverse
- directory trees, to work correctly with Cygwin mounted directories.
- FIXME: Is just storing the posixized windows directory the correct thing to
- do when we detect a symlink? Should we instead rebuild the posix path from
- the input by traversing links? This would be an expensive operation but
- we'll see if Cygwin mailing list users whine about the current behavior. */
- if (res)
- __seterrno ();
- else if ((!path.has_symlinks () && strpbrk (dir, ":\\") == NULL
- && pcheck_case == PCHECK_RELAXED) || isvirtual_dev (devn))
- cygheap->cwd.set (native_dir, dir);
- else
- cygheap->cwd.set (native_dir, NULL);
-
- /* Note that we're accessing cwd.posix without a lock here. I didn't think
- it was worth locking just for strace. */
- syscall_printf ("%d = chdir() cygheap->cwd.posix '%s' native '%s'", res,
- cygheap->cwd.posix, native_dir);
- MALLOC_CHECK;
- return res;
-}
-
-extern "C" int
-fchdir (int fd)
-{
- int res;
- sigframe thisframe (mainthread);
-
- cygheap_fdget cfd (fd);
- if (cfd >= 0)
- res = chdir (cfd->get_win32_name ());
- else
- res = -1;
-
- syscall_printf ("%d = fchdir (%d)", res, fd);
- return res;
-}
-
-/******************** Exported Path Routines *********************/
-
-/* Cover functions to the path conversion routines.
- These are exported to the world as cygwin_foo by cygwin.din. */
-
-extern "C" int
-cygwin_conv_to_win32_path (const char *path, char *win32_path)
-{
- path_conv p (path, PC_SYM_FOLLOW);
- if (p.error)
- {
- win32_path[0] = '\0';
- set_errno (p.error);
- return -1;
- }
-
- strcpy (win32_path, p);
- return 0;
-}
-
-extern "C" int
-cygwin_conv_to_full_win32_path (const char *path, char *win32_path)
-{
- path_conv p (path, PC_SYM_FOLLOW | PC_FULL);
- if (p.error)
- {
- win32_path[0] = '\0';
- set_errno (p.error);
- return -1;
- }
-
- strcpy (win32_path, p);
- return 0;
-}
-
-/* This is exported to the world as cygwin_foo by cygwin.din. */
-
-extern "C" int
-cygwin_conv_to_posix_path (const char *path, char *posix_path)
-{
- if (check_null_empty_str_errno (path))
- return -1;
- mount_table->conv_to_posix_path (path, posix_path, 1);
- return 0;
-}
-
-extern "C" int
-cygwin_conv_to_full_posix_path (const char *path, char *posix_path)
-{
- if (check_null_empty_str_errno (path))
- return -1;
- mount_table->conv_to_posix_path (path, posix_path, 0);
- return 0;
-}
-
-/* The realpath function is supported on some UNIX systems. */
-
-extern "C" char *
-realpath (const char *path, char *resolved)
-{
- int err;
-
- path_conv real_path (path, PC_SYM_FOLLOW | PC_FULL);
-
- if (real_path.error)
- err = real_path.error;
- else
- {
- err = mount_table->conv_to_posix_path (real_path.get_win32 (), resolved, 0);
- if (err == 0)
- return resolved;
- }
-
- /* FIXME: on error, we are supposed to put the name of the path
- component which could not be resolved into RESOLVED. */
- resolved[0] = '\0';
-
- set_errno (err);
- return NULL;
-}
-
-/* Return non-zero if path is a POSIX path list.
- This is exported to the world as cygwin_foo by cygwin.din.
-
-DOCTOOL-START
-<sect1 id="add-func-cygwin-posix-path-list-p">
- <para>Rather than use a mode to say what the "proper" path list
- format is, we allow any, and give apps the tools they need to
- convert between the two. If a ';' is present in the path list it's
- a Win32 path list. Otherwise, if the first path begins with
- [letter]: (in which case it can be the only element since if it
- wasn't a ';' would be present) it's a Win32 path list. Otherwise,
- it's a POSIX path list.</para>
-</sect1>
-DOCTOOL-END
- */
-
-extern "C" int
-cygwin_posix_path_list_p (const char *path)
-{
- int posix_p = !(strchr (path, ';') || isdrive (path));
- return posix_p;
-}
-
-/* These are used for apps that need to convert env vars like PATH back and
- forth. The conversion is a two step process. First, an upper bound on the
- size of the buffer needed is computed. Then the conversion is done. This
- allows the caller to use alloca if it wants. */
-
-static int
-conv_path_list_buf_size (const char *path_list, int to_posix_p)
-{
- int i, num_elms, max_mount_path_len, size;
- const char *p;
-
- /* The theory is that an upper bound is
- current_size + (num_elms * max_mount_path_len) */
-
- char delim = to_posix_p ? ';' : ':';
- p = path_list;
- for (num_elms = 1; (p = strchr (p, delim)) != NULL; ++num_elms)
- ++p;
-
- /* 7: strlen ("//c") + slop, a conservative initial value */
- for (max_mount_path_len = 7, i = 0; i < mount_table->nmounts; ++i)
- {
- int mount_len = (to_posix_p
- ? mount_table->mount[i].posix_pathlen
- : mount_table->mount[i].native_pathlen);
- if (max_mount_path_len < mount_len)
- max_mount_path_len = mount_len;
- }
-
- /* 100: slop */
- size = strlen (path_list) + (num_elms * max_mount_path_len) + 100;
- return size;
-}
-
-extern "C" int
-cygwin_win32_to_posix_path_list_buf_size (const char *path_list)
-{
- return conv_path_list_buf_size (path_list, 1);
-}
-
-extern "C" int
-cygwin_posix_to_win32_path_list_buf_size (const char *path_list)
-{
- return conv_path_list_buf_size (path_list, 0);
-}
-
-extern "C" int
-cygwin_win32_to_posix_path_list (const char *win32, char *posix)
-{
- conv_path_list (win32, posix, 1);
- return 0;
-}
-
-extern "C" int
-cygwin_posix_to_win32_path_list (const char *posix, char *win32)
-{
- conv_path_list (posix, win32, 0);
- return 0;
-}
-
-/* cygwin_split_path: Split a path into directory and file name parts.
- Buffers DIR and FILE are assumed to be big enough.
-
- Examples (path -> `dir' / `file'):
- / -> `/' / `'
- "" -> `.' / `'
- . -> `.' / `.' (FIXME: should this be `.' / `'?)
- .. -> `.' / `..' (FIXME: should this be `..' / `'?)
- foo -> `.' / `foo'
- foo/bar -> `foo' / `bar'
- foo/bar/ -> `foo' / `bar'
- /foo -> `/' / `foo'
- /foo/bar -> `/foo' / `bar'
- c: -> `c:/' / `'
- c:/ -> `c:/' / `'
- c:foo -> `c:/' / `foo'
- c:/foo -> `c:/' / `foo'
- */
-
-extern "C" void
-cygwin_split_path (const char *path, char *dir, char *file)
-{
- int dir_started_p = 0;
-
- /* Deal with drives.
- Remember that c:foo <==> c:/foo. */
- if (isdrive (path))
- {
- *dir++ = *path++;
- *dir++ = *path++;
- *dir++ = '/';
- if (!*path)
- {
- *dir = 0;
- *file = 0;
- return;
- }
- if (SLASH_P (*path))
- ++path;
- dir_started_p = 1;
- }
-
- /* Determine if there are trailing slashes and "delete" them if present.
- We pretend as if they don't exist. */
- const char *end = path + strlen (path);
- /* path + 1: keep leading slash. */
- while (end > path + 1 && SLASH_P (end[-1]))
- --end;
-
- /* At this point, END points to one beyond the last character
- (with trailing slashes "deleted"). */
-
- /* Point LAST_SLASH at the last slash (duh...). */
- const char *last_slash;
- for (last_slash = end - 1; last_slash >= path; --last_slash)
- if (SLASH_P (*last_slash))
- break;
-
- if (last_slash == path)
- {
- *dir++ = '/';
- *dir = 0;
- }
- else if (last_slash > path)
- {
- memcpy (dir, path, last_slash - path);
- dir[last_slash - path] = 0;
- }
- else
- {
- if (dir_started_p)
- ; /* nothing to do */
- else
- *dir++ = '.';
- *dir = 0;
- }
-
- memcpy (file, last_slash + 1, end - last_slash - 1);
- file[end - last_slash - 1] = 0;
-}
-
-/*****************************************************************************/
-
-/* Return the hash value for the current win32 value.
- This is used when constructing inodes. */
-DWORD
-cwdstuff::get_hash ()
-{
- DWORD hashnow;
- cwd_lock->acquire ();
- hashnow = hash;
- cwd_lock->release ();
- return hashnow;
-}
-
-/* Initialize cygcwd 'muto' for serializing access to cwd info. */
-void
-cwdstuff::init ()
-{
- new_muto (cwd_lock);
-}
-
-/* Get initial cwd. Should only be called once in a
- process tree. */
-bool
-cwdstuff::get_initial ()
-{
- cwd_lock->acquire ();
-
- if (win32)
- return 1;
-
- int i;
- DWORD len, dlen;
- for (i = 0, dlen = MAX_PATH, len = 0; i < 3; dlen *= 2, i++)
- {
- win32 = (char *) crealloc (win32, dlen + 2);
- if ((len = GetCurrentDirectoryA (dlen, win32)) < dlen)
- break;
- }
-
- if (len == 0)
- {
- __seterrno ();
- cwd_lock->release ();
- debug_printf ("get_initial_cwd failed, %E");
- cwd_lock->release ();
- return 0;
- }
- set (NULL);
- return 1; /* Leaves cwd lock unreleased */
-}
-
-/* Fill out the elements of a cwdstuff struct.
- It is assumed that the lock for the cwd is acquired if
- win32_cwd == NULL. */
-void
-cwdstuff::set (const char *win32_cwd, const char *posix_cwd)
-{
- char pathbuf[MAX_PATH];
-
- if (win32_cwd)
- {
- cwd_lock->acquire ();
- win32 = (char *) crealloc (win32, strlen (win32_cwd) + 1);
- strcpy (win32, win32_cwd);
- }
-
- if (!posix_cwd)
- mount_table->conv_to_posix_path (win32, pathbuf, 0);
- else
- (void) normalize_posix_path (posix_cwd, pathbuf);
-
- posix = (char *) crealloc (posix, strlen (pathbuf) + 1);
- strcpy (posix, pathbuf);
-
- hash = hash_path_name (0, win32);
-
- if (win32_cwd)
- cwd_lock->release ();
-
- return;
-}
-
-/* Copy the value for either the posix or the win32 cwd into a buffer. */
-char *
-cwdstuff::get (char *buf, int need_posix, int with_chroot, unsigned ulen)
-{
- MALLOC_CHECK;
-
- if (ulen)
- /* nothing */;
- else if (buf == NULL)
- ulen = (unsigned) -1;
- else
- {
- set_errno (EINVAL);
- goto out;
- }
-
- if (!get_initial ()) /* Get initial cwd and set cwd lock */
- return NULL;
-
- char *tocopy;
- if (!need_posix)
- tocopy = win32;
- else
- tocopy = posix;
-
- debug_printf("posix %s", posix);
- if (strlen (tocopy) >= ulen)
- {
- set_errno (ERANGE);
- buf = NULL;
- }
- else
- {
- if (!buf)
- buf = (char *) malloc (strlen (tocopy) + 1);
- strcpy (buf, tocopy);
- if (!buf[0]) /* Should only happen when chroot */
- strcpy (buf, "/");
- }
-
- cwd_lock->release ();
-
-out:
- syscall_printf ("(%s) = cwdstuff::get (%p, %d, %d, %d), errno %d",
- buf, buf, ulen, need_posix, with_chroot, errno);
- MALLOC_CHECK;
- return buf;
-}
diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h
deleted file mode 100644
index 50c5a743c..000000000
--- a/winsup/cygwin/path.h
+++ /dev/null
@@ -1,204 +0,0 @@
-/* path.h: path data structures
-
- Copyright 1996, 1997, 1998, 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. */
-
-struct suffix_info
-{
- const char *name;
- int addon;
- suffix_info (const char *s, int addit = 0): name (s), addon (addit) {}
-};
-
-enum pathconv_arg
-{
- PC_SYM_FOLLOW = 0x0001,
- PC_SYM_NOFOLLOW = 0x0002,
- PC_SYM_IGNORE = 0x0004,
- PC_SYM_CONTENTS = 0x0008,
- PC_FULL = 0x0010,
- PC_NULLEMPTY = 0x0020,
- PC_CHECK_EA = 0x0040,
- PC_POSIX = 0x0080
-};
-
-enum case_checking
-{
- PCHECK_RELAXED = 0,
- PCHECK_ADJUST = 1,
- PCHECK_STRICT = 2
-};
-
-#define PC_NONULLEMPTY -1
-
-#include <sys/mount.h>
-
-enum path_types
-{
- PATH_NOTHING = 0,
- PATH_SYMLINK = MOUNT_SYMLINK,
- PATH_BINARY = MOUNT_BINARY,
- PATH_EXEC = MOUNT_EXEC,
- PATH_NOTEXEC = MOUNT_NOTEXEC,
- PATH_CYGWIN_EXEC = MOUNT_CYGWIN_EXEC,
- PATH_ALL_EXEC = (PATH_CYGWIN_EXEC | PATH_EXEC),
- PATH_TEXT = 0x02000000,
- PATH_ISDISK = 0x04000000,
- PATH_HAS_SYMLINKS = 0x10000000,
- PATH_HASBUGGYOPEN = 0x20000000,
- PATH_SOCKET = 0x40000000,
- PATH_HASACLS = 0x80000000
-};
-
-class symlink_info;
-struct fs_info
-{
- char name[MAX_PATH];
- char root_dir[MAX_PATH];
- DWORD flags;
- DWORD serial;
- DWORD sym_opt; /* additional options to pass to symlink_info resolver */
- DWORD is_remote_drive;
- DWORD drive_type;
- bool update (const char *);
-};
-class path_conv
-{
- char path[MAX_PATH];
- fs_info fs;
- void add_ext_from_sym (symlink_info&);
- public:
-
- unsigned path_flags;
- char *known_suffix;
- int error;
- DWORD devn;
- int unit;
- DWORD fileattr;
- BOOL case_clash;
- char *normalized_path;
-
- int isdisk () const { return path_flags & PATH_ISDISK;}
- int isremote () const {return fs.is_remote_drive;}
- int has_acls () const {return path_flags & PATH_HASACLS;}
- int has_symlinks () const {return path_flags & PATH_HAS_SYMLINKS;}
- int hasgood_inode () const {return path_flags & PATH_HASACLS;} // Not strictly correct
- int has_buggy_open () const {return path_flags & PATH_HASBUGGYOPEN;}
- int binmode () const
- {
- if (path_flags & PATH_BINARY)
- return O_BINARY;
- if (path_flags & PATH_TEXT)
- return O_TEXT;
- return 0;
- }
- int issymlink () const {return path_flags & PATH_SYMLINK;}
- int issocket () const {return path_flags & PATH_SOCKET;}
- int iscygexec () const {return path_flags & PATH_CYGWIN_EXEC;}
- bool exists () const {return fileattr != INVALID_FILE_ATTRIBUTES;}
- bool has_attribute (DWORD x) const {return exists () && (fileattr & x);}
- int isdir () const {return has_attribute (FILE_ATTRIBUTE_DIRECTORY);}
- executable_states exec_state ()
- {
- extern int _check_for_executable;
- if (path_flags & PATH_ALL_EXEC)
- return is_executable;
- if (path_flags & PATH_NOTEXEC)
- return not_executable;
- if (!_check_for_executable)
- return dont_care_if_executable;
- return dont_know_if_executable;
- }
-
- void set_binary () {path_flags |= PATH_BINARY;}
- void set_symlink () {path_flags |= PATH_SYMLINK;}
- void set_has_symlinks () {path_flags |= PATH_HAS_SYMLINKS;}
- void set_isdisk () {path_flags |= PATH_ISDISK; devn = FH_DISK;}
- void set_exec (int x = 1) {path_flags |= x ? PATH_EXEC : PATH_NOTEXEC;}
- void set_has_acls (int x = 1) {path_flags |= x ? PATH_HASACLS : PATH_NOTHING;}
- void set_has_buggy_open (int x = 1) {path_flags |= x ? PATH_HASBUGGYOPEN : PATH_NOTHING;}
-
- void check (const char *src, unsigned opt = PC_SYM_FOLLOW,
- const suffix_info *suffixes = NULL) __attribute__ ((regparm(3)));
-
- path_conv (int, const char *src, unsigned opt = PC_SYM_FOLLOW,
- const suffix_info *suffixes = NULL)
- {
- check (src, opt, suffixes);
- }
-
- path_conv (const char *src, unsigned opt = PC_SYM_FOLLOW,
- const suffix_info *suffixes = NULL)
- {
- check (src, opt | PC_NULLEMPTY, suffixes);
- }
-
- path_conv (): path_flags (0), known_suffix (NULL), error (0), devn (0),
- unit (0), fileattr (INVALID_FILE_ATTRIBUTES),
- normalized_path (NULL) {path[0] = '\0';}
-
- inline char *get_win32 () { return path; }
- operator char *() {return path;}
- operator const char *() {return path;}
- operator DWORD &() {return fileattr;}
- operator int &() {return (int) fileattr; }
- BOOL is_device () {return devn != FH_BAD && devn != FH_DISK;}
- DWORD get_devn () {return devn == FH_BAD ? (DWORD) FH_DISK : devn;}
- short get_unitn () {return devn == FH_BAD ? 0 : unit;}
- DWORD file_attributes () {return fileattr;}
- DWORD drive_type () {return fs.drive_type;}
- BOOL fs_fast_ea () {return fs.sym_opt & PC_CHECK_EA;}
- void set_path (const char *p) {strcpy (path, p);}
- char *return_and_clear_normalized_path ();
- const char * root_dir () { return fs.root_dir; }
- DWORD volser () { return fs.serial; }
- const char *volname () {return fs.name; }
- void fillin (HANDLE h);
-};
-
-/* Symlink marker */
-#define SYMLINK_COOKIE "!<symlink>"
-
-#define SYMLINK_EA_NAME ".CYGSYMLINK"
-
-/* Socket marker */
-#define SOCKET_COOKIE "!<socket >"
-
-/* Maximum depth of symlinks (after which ELOOP is issued). */
-#define MAX_LINK_DEPTH 10
-int __stdcall slash_unc_prefix_p (const char *path) __attribute__ ((regparm(1)));
-
-enum fe_types
-{
- FE_NADA = 0, /* Nothing special */
- FE_NNF = 1, /* Return NULL if not found */
- FE_NATIVE = 2, /* Return native path in path_conv struct */
- FE_CWD = 4 /* Search CWD for program */
-};
-const char * __stdcall find_exec (const char *name, path_conv& buf,
- const char *winenv = "PATH=",
- unsigned opt = FE_NADA,
- const char **known_suffix = NULL)
- __attribute__ ((regparm(3)));
-
-/* Common macros for checking for invalid path names */
-#define isdrive(s) (isalpha (*(s)) && (s)[1] == ':')
-
-static inline bool
-has_exec_chars (const char *buf, int len)
-{
- return len >= 2 &&
- ((buf[0] == '#' && buf[1] == '!') ||
- (buf[0] == ':' && buf[1] == '\n') ||
- (buf[0] == 'M' && buf[1] == 'Z'));
-}
-
-int pathmatch (const char *path1, const char *path2) __attribute__ ((regparm (2)));
-int pathnmatch (const char *path1, const char *path2, int len) __attribute__ ((regparm (2)));
-
-int path_prefix_p (const char *path1, const char *path2, int len1) __attribute__ ((regparm (3)));
diff --git a/winsup/cygwin/path.sgml b/winsup/cygwin/path.sgml
deleted file mode 100644
index 6030c8f78..000000000
--- a/winsup/cygwin/path.sgml
+++ /dev/null
@@ -1,205 +0,0 @@
-<sect1 id="func-cygwin-posix-to-win32-path-list">
-<title>cygwin_posix_to_win32_path_list</title>
-
-<funcsynopsis>
-<funcdef>extern "C" void
-<function>cygwin_posix_to_win32_path_list</function></funcdef>
-<paramdef>const char *<parameter>posix</parameter></paramdef>
-<paramdef>char *<parameter>win32</parameter></paramdef>
-</funcsynopsis>
-
-<para>Given a POSIX path-style string (i.e. /foo:/bar) convert it to
-the equivalent Win32 path-style string (i.e. d:\;e:\bar).
-<parameter>win32</parameter> must point to a sufficiently large
-buffer.</para>
-
-<example>
-<title>Example use of cygwin_posix_to_win32_path_list</title>
-<programlisting>
-char *_epath;
-char *_win32epath;
-_epath = _win32epath = getenv (NAME);
-/* If we have a POSIX path list, convert to win32 path list */
-if (_epath != NULL && *_epath != 0
- && cygwin_posix_path_list_p (_epath))
- {
- _win32epath = (char *) xmalloc
- (cygwin_posix_to_win32_path_list_buf_size (_epath));
- cygwin_posix_to_win32_path_list (_epath, _win32epath);
- }
-</programlisting>
-</example>
-
-<para>See also <link linkend="func-cygwin-posix-to-win32-path-list-buf-size">
-cygwin_posix_to_win32_path_list_buf_size</link></para>
-
-</sect1>
-
-<sect1 id="func-cygwin-win32-to-posix-path-list">
-<title>cygwin_win32_to_posix_path_list</title>
-
-<funcsynopsis>
-<funcdef>extern "C" void
-<function>cygwin_win32_to_posix_path_list</function></funcdef>
-<paramdef>const char *<parameter>win32</parameter></paramdef>
-<paramdef>char *<parameter>posix</parameter></paramdef>
-</funcsynopsis>
-
-<para>Given a Win32 path-style string (i.e. d:\;e:\bar) convert it to
-the equivalent POSIX path-style string (i.e. /foo:/bar).
-<parameter>posix</parameter> must point to a sufficiently large
-buffer. See also <link
-linkend="func-cygwin-win32-to-posix-path-list-buf-size">
-cygwin_win32_to_posix_path_list_buf_size</link></para>
-
-</sect1>
-
-<sect1 id="func-cygwin-posix-to-win32-path-list-buf-size">
-<title>cygwin_posix_to_win32_path_list_buf_size</title>
-
-<funcsynopsis>
-<funcdef>extern "C" int
-<function>cygwin_posix_to_win32_path_list_buf_size</function></funcdef>
-<paramdef>const char *<parameter>path_list</parameter></paramdef>
-</funcsynopsis>
-
-<para>Returns the number of bytes needed to hold the result of calling
-<link linkend="func-cygwin-posix-to-win32-path-list">
-cygwin_posix_to_win32_path_list</link>.</para>
-
-</sect1>
-
-<sect1 id="func-cygwin-win32-to-posix-path-list-buf-size">
-<title>cygwin_win32_to_posix_path_list_buf_size</title>
-
-<funcsynopsis>
-<funcdef>extern "C" int
-<function>cygwin_win32_to_posix_path_list_buf_size</function></funcdef>
-<paramdef>const char *<parameter>path_list</parameter></paramdef>
-</funcsynopsis>
-
-<para>Tells you how many bytes are needed for the results of <link
-linkend="func-cygwin-win32-to-posix-path-list">
-cygwin_win32_to_posix_path_list</link>.</para>
-
-</sect1>
-
-<sect1 id="func-cygwin-conv-to-posix-path">
-<title>cygwin_conv_to_posix_path</title>
-
-<funcsynopsis>
-<funcdef>extern "C" void
-<function>cygwin_conv_to_posix_path</function></funcdef>
-<paramdef>const char *<parameter>path</parameter></paramdef>
-<paramdef>char *<parameter>posix_path</parameter></paramdef>
-</funcsynopsis>
-
-<para>Converts a Win32 path to a POSIX path. If
-<parameter>path</parameter> is already a POSIX path, leaves it alone.
-If <parameter>path</parameter> is relative, then
-<parameter>posix_path</parameter> will also be relative. Note that
-<parameter>posix_path</parameter> must point to a buffer of sufficient
-size; use MAX_PATH if needed.</para>
-
-</sect1>
-
-<sect1 id="func-cygwin-conv-to-win32-path">
-<title>cygwin_conv_to_win32_path</title>
-
-<funcsynopsis>
-<funcdef>extern "C" void
-<function>cygwin_conv_to_win32_path</function></funcdef>
-<paramdef>const char *<parameter>path</parameter></paramdef>
-<paramdef>char *<parameter>win32_path</parameter></paramdef>
-</funcsynopsis>
-
-<para>Converts a POSIX path to a Win32 path. If
-<parameter>path</parameter> is already a Win32 path, leaves it alone.
-If <parameter>path</parameter> is relative, then
-<parameter>win32_path</parameter> will also be relative. Note that
-<parameter>win32_path</parameter> must point to a buffer of sufficient
-size; use MAX_PATH if needed.</para>
-
-</sect1>
-<sect1 id="func-cygwin-conv-to-full-posix-path">
-<title>cygwin_conv_to_full_posix_path</title>
-
-<funcsynopsis>
-<funcdef>extern "C" void
-<function>cygwin_conv_to_full_posix_path</function></funcdef>
-<paramdef>const char *<parameter>path</parameter></paramdef>
-<paramdef>char *<parameter>posix_path</parameter></paramdef>
-</funcsynopsis>
-
-<para>Converts a Win32 path to a POSIX path. If
-<parameter>path</parameter> is already a POSIX path, leaves it alone.
-If <parameter>path</parameter> is relative, then
-<parameter>posix_path</parameter> will be converted to an absolute
-path. Note that <parameter>posix_path</parameter> must point to a
-buffer of sufficient size; use MAX_PATH if needed.</para>
-
-</sect1>
-
-<sect1 id="func-cygwin-conv-to-full-win32-path">
-<title>cygwin_conv_to_full_win32_path</title>
-
-<funcsynopsis>
-<funcdef>extern "C" void
-<function>cygwin_conv_to_full_win32_path</function></funcdef>
-<paramdef>const char *<parameter>path</parameter></paramdef>
-<paramdef>char *<parameter>win32_path</parameter></paramdef>
-</funcsynopsis>
-
-<para>Converts a POSIX path to a Win32 path. If
-<parameter>path</parameter> is already a Win32 path, leaves it alone.
-If <parameter>path</parameter> is relative, then
-<parameter>win32_path</parameter> will be converted to an absolute
-path. Note that <parameter>win32_path</parameter> must point to a
-buffer of sufficient size; use MAX_PATH if needed.</para>
-
-</sect1>
-
-<sect1 id="func-cygwin-posix-path-list-p">
-<title>cygwin_posix_path_list_p</title>
-
-<funcsynopsis>
-<funcdef>extern "C" int
-<function>posix_path_list_p</function></funcdef>
-<paramdef>const char *<parameter>path</parameter></paramdef>
-</funcsynopsis>
-
-<para>This function tells you if the supplied
-<parameter>path</parameter> is a POSIX-style path (i.e. posix names,
-forward slashes, colon delimiters) or a Win32-style path (drive
-letters, reverse slashes, semicolon delimiters. The return value is
-true if the path is a POSIX path. Note that "_p" means "predicate", a
-lisp term meaning that the function tells you something about the
-parameter.</para>
-
-</sect1>
-
-<sect1 id="func-cygwin-split-path">
-<title>cygwin_split_path</title>
-
-<funcsynopsis>
-<funcdef>extern "C" void
-<function>cygwin_split_path</function>
-</funcdef>
-<paramdef>const char * <parameter>path</parameter></paramdef>
-<paramdef>char * <parameter>dir</parameter></paramdef>
-<paramdef>char * <parameter>file</parameter></paramdef>
-</funcsynopsis>
-
-<para>Split a path into the directory and the file portions. Both
-<parameter>dir</parameter> and <parameter>file</parameter> are
-expected to point to buffers of sufficient size. </para>
-
-<example>
-<title>Example use of cygwin_split_path</title>
-<programlisting>
-char dir[200], file[100];
-cygwin_split_path("c:/foo/bar.c", dir, file);
-printf("dir=%s, file=%s\n", dir, file);
-</programlisting>
-</example>
-</sect1>
diff --git a/winsup/cygwin/perprocess.h b/winsup/cygwin/perprocess.h
deleted file mode 100644
index c0a555983..000000000
--- a/winsup/cygwin/perprocess.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* per_process.h: main Cygwin header file.
-
- Copyright 2000, 2001 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 <sys/cygwin.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Pointer into application's static data */
-extern struct per_process __cygwin_user_data;
-#define user_data (&__cygwin_user_data)
-
-/* We use the following to test that sizeof hasn't changed. When adding
- or deleting members, insert fillers or use the reserved entries.
- Do not change this value. */
-#define SIZEOF_PER_PROCESS (42 * 4)
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/winsup/cygwin/perthread.h b/winsup/cygwin/perthread.h
deleted file mode 100644
index 48ad97621..000000000
--- a/winsup/cygwin/perthread.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* perthread.h: Header file for cygwin synchronization primitives.
-
- Copyright 2000, 2001 Red Hat, Inc.
-
- Written by Christopher Faylor <cgf@cygnus.com>
-
-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 PTMAGIC 0x77366377
-
-struct _reent;
-extern struct _reent reent_data;
-
-#define PER_THREAD_FORK_CLEAR ((void *)0xffffffff)
-class per_thread
-{
- DWORD tls;
- int clear_on_fork_p;
-public:
- per_thread (int forkval = 1) {tls = TlsAlloc (); clear_on_fork_p = forkval;}
- DWORD get_tls () {return tls;}
- int clear_on_fork () {return clear_on_fork_p;}
-
- virtual void *get () {return TlsGetValue (get_tls ());}
- virtual size_t size () {return 0;}
- virtual void set (void *s = NULL);
- virtual void set (int n) {TlsSetValue (get_tls (), (void *)n);}
- virtual void *create ()
- {
- void *s = new char [size ()];
- memset (s, 0, size ());
- set (s);
- return s;
- }
-};
-
-class per_thread_waitq : public per_thread
-{
-public:
- per_thread_waitq () : per_thread (0) {}
- void *get () {return (waitq *) this->per_thread::get ();}
- void *create () {return (waitq *) this->per_thread::create ();}
- size_t size () {return sizeof (waitq);}
-};
-
-#if defined (NEED_VFORK)
-struct vfork_save
-{
- int pid;
- jmp_buf j;
- DWORD frame[100];
- char **vfork_ebp;
- char **vfork_esp;
- int is_active () { return pid < 0; }
-};
-
-class per_thread_vfork : public per_thread
-{
-public:
- vfork_save *val () { return (vfork_save *) this->per_thread::get (); }
- vfork_save *create () {return (vfork_save *) this->per_thread::create ();}
- size_t size () {return sizeof (vfork_save);}
-};
-extern per_thread_vfork vfork_storage;
-extern vfork_save *main_vfork;
-#endif
-
-extern "C" {
-struct signal_dispatch
-{
- int arg;
- void (*func) (int);
- int sig;
- int saved_errno;
- int sa_flags;
- DWORD oldmask;
- DWORD newmask;
- DWORD retaddr;
- DWORD *retaddr_on_stack;
-};
-};
-
-struct per_thread_signal_dispatch : public per_thread
-{
- signal_dispatch *get () { return (signal_dispatch *) this->per_thread::get (); }
- signal_dispatch *create () {return (signal_dispatch *) this->per_thread::create ();}
- size_t size () {return sizeof (signal_dispatch);}
-};
-
-extern per_thread_waitq waitq_storage;
-extern per_thread_signal_dispatch signal_dispatch_storage;
-
-extern per_thread *threadstuff[];
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
deleted file mode 100644
index 44ca1df46..000000000
--- a/winsup/cygwin/pinfo.cc
+++ /dev/null
@@ -1,410 +0,0 @@
-/* pinfo.cc: process table support
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <stdlib.h>
-#include <time.h>
-#include <errno.h>
-#include <limits.h>
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygerrno.h"
-#include "sigproc.h"
-#include "pinfo.h"
-#include "cygwin_version.h"
-#include "perprocess.h"
-#include "environ.h"
-#include <assert.h>
-#include <ntdef.h>
-#include "ntdll.h"
-
-static char NO_COPY pinfo_dummy[sizeof (_pinfo)] = {0};
-
-pinfo NO_COPY myself ((_pinfo *)&pinfo_dummy); // Avoid myself != NULL checks
-
-HANDLE hexec_proc;
-
-void __stdcall
-pinfo_fixup_after_fork ()
-{
- if (hexec_proc)
- CloseHandle (hexec_proc);
-
- if (!DuplicateHandle (hMainProc, hMainProc, hMainProc, &hexec_proc, 0,
- TRUE, DUPLICATE_SAME_ACCESS))
- {
- system_printf ("couldn't save current process handle %p, %E", hMainProc);
- hexec_proc = NULL;
- }
-}
-
-/* Initialize the process table.
- This is done once when the dll is first loaded. */
-
-void __stdcall
-set_myself (pid_t pid, HANDLE h)
-{
- DWORD winpid = GetCurrentProcessId ();
- if (pid == 1)
- pid = cygwin_pid (winpid);
- myself.init (pid, 1, h);
- myself->dwProcessId = winpid;
- myself->process_state |= PID_IN_USE;
- myself->start_time = time (NULL); /* Register our starting time. */
-
- (void) GetModuleFileName (NULL, myself->progname,
- sizeof(myself->progname));
- strace.hello ();
- return;
-}
-
-/* Initialize the process table entry for the current task.
- This is not called for forked tasks, only execed ones. */
-void __stdcall
-pinfo_init (char **envp, int envc)
-{
- if (envp)
- {
- environ_init (envp, envc);
- /* spawn has already set up a pid structure for us so we'll use that */
- myself->process_state |= PID_CYGPARENT;
- }
- else
- {
- /* Invent our own pid. */
-
- set_myself (1);
- myself->ppid = 1;
- myself->pgid = myself->sid = myself->pid;
- myself->ctty = -1;
- myself->uid = ILLEGAL_UID;
-
- environ_init (NULL, 0); /* call after myself has been set up */
- }
-
- debug_printf ("pid %d, pgid %d", myself->pid, myself->pgid);
-}
-
-void
-_pinfo::exit (UINT n, bool norecord)
-{
- if (this)
- {
- if (!norecord)
- process_state = PID_EXITED;
-
- /* FIXME: There is a potential race between an execed process and its
- parent here. I hated to add a mutex just for this, though. */
- struct rusage r;
- fill_rusage (&r, hMainProc);
- add_rusage (&rusage_self, &r);
- }
-
- sigproc_printf ("Calling ExitProcess %d", n);
- ExitProcess (n);
-}
-
-void
-pinfo::init (pid_t n, DWORD flag, HANDLE in_h)
-{
- if (myself && n == myself->pid)
- {
- procinfo = myself;
- destroy = 0;
- h = NULL;
- return;
- }
-
- int createit = flag & (PID_IN_USE | PID_EXECED);
- for (int i = 0; i < 10; i++)
- {
- int created;
- char mapname[MAX_PATH];
- __small_sprintf (mapname, "cygpid.%x", n);
-
- int mapsize;
- if (flag & PID_EXECED)
- mapsize = PINFO_REDIR_SIZE;
- else
- mapsize = sizeof (_pinfo);
-
- if (in_h)
- {
- h = in_h;
- created = 0;
- }
- else if (!createit)
- {
- h = OpenFileMappingA (FILE_MAP_READ | FILE_MAP_WRITE, FALSE, mapname);
- created = 0;
- }
- else
- {
- h = CreateFileMapping (INVALID_HANDLE_VALUE, &sec_all_nih,
- PAGE_READWRITE, 0, mapsize, mapname);
- created = h && GetLastError () != ERROR_ALREADY_EXISTS;
- }
-
- if (!h)
- {
- if (createit)
- __seterrno ();
- procinfo = NULL;
- return;
- }
-
- procinfo = (_pinfo *) MapViewOfFile (h, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0);
- ProtectHandle1 (h, pinfo_shared_handle);
-
- if ((procinfo->process_state & PID_INITIALIZING) && (flag & PID_NOREDIR)
- && cygwin_pid (procinfo->dwProcessId) != procinfo->pid)
- {
- release ();
- set_errno (ENOENT);
- return;
- }
-
- if (procinfo->process_state & PID_EXECED)
- {
- assert (!i);
- pid_t realpid = procinfo->pid;
- debug_printf ("execed process windows pid %d, cygwin pid %d", n, realpid);
- if (realpid == n)
- api_fatal ("retrieval of execed process info for pid %d failed due to recursion.", n);
- n = realpid;
- release ();
- if (flag & PID_ALLPIDS)
- {
- set_errno (ENOENT);
- break;
- }
- continue;
- }
-
- /* In certain rare, pathological cases, it is possible for the shared
- memory region to exist for a while after a process has exited. This
- should only be a brief occurrence, so rather than introduce some kind
- of locking mechanism, just loop. FIXME: I'm sure I'll regret doing it
- this way at some point. */
- if (i < 9 && !created && createit && (procinfo->process_state & PID_EXITED))
- {
- Sleep (5);
- release ();
- continue;
- }
-
- if (!created)
- /* nothing */;
- else if (!(flag & PID_EXECED))
- procinfo->pid = n;
- else
- {
- procinfo->process_state |= PID_IN_USE | PID_EXECED;
- procinfo->pid = myself->pid;
- }
- break;
- }
- destroy = 1;
-}
-
-void
-pinfo::release ()
-{
- if (h)
- {
-#ifdef DEBUGGING
- if (((DWORD) procinfo & 0x77000000) == 0x61000000) try_to_debug ();
-#endif
- UnmapViewOfFile (procinfo);
- procinfo = NULL;
- ForceCloseHandle1 (h, pinfo_shared_handle);
- h = NULL;
- }
-}
-
-/* DOCTOOL-START
-
-<sect1 id="func-cygwin-winpid-to-pid">
- <title>cygwin_winpid_to_pid</title>
-
- <funcsynopsis>
- <funcdef>extern "C" pid_t
- <function>cygwin_winpid_to_pid</function>
- </funcdef>
- <paramdef>int <parameter>winpid</parameter></paramdef>
- </funcsynopsis>
-
- <para>Given a windows pid, converts to the corresponding Cygwin
-pid, if any. Returns -1 if windows pid does not correspond to
-a cygwin pid.</para>
- <example>
- <title>Example use of cygwin_winpid_to_pid</title>
- <programlisting>
- extern "C" cygwin_winpid_to_pid (int winpid);
- pid_t mypid;
- mypid = cygwin_winpid_to_pid (windows_pid);
- </programlisting>
- </example>
-</sect1>
-
- DOCTOOL-END */
-
-extern "C" pid_t
-cygwin_winpid_to_pid (int winpid)
-{
- pinfo p (cygwin_pid (winpid));
- if (p)
- return p->pid;
-
- set_errno (ESRCH);
- return (pid_t) -1;
-}
-
-#include <tlhelp32.h>
-
-#define slop_pidlist 200
-#define size_pidlist(i) (sizeof (pidlist[0]) * ((i) + 1))
-#define size_pinfolist(i) (sizeof (pinfolist[0]) * ((i) + 1))
-
-inline void
-winpids::add (DWORD& nelem, bool winpid, DWORD pid)
-{
- pid_t cygpid = cygwin_pid (pid);
- if (nelem >= npidlist)
- {
- npidlist += slop_pidlist;
- pidlist = (DWORD *) realloc (pidlist, size_pidlist (npidlist + 1));
- pinfolist = (pinfo *) realloc (pinfolist, size_pinfolist (npidlist + 1));
- }
-
- pinfolist[nelem].init (cygpid, PID_NOREDIR | (winpid ? PID_ALLPIDS : 0));
- if (winpid)
- /* nothing to do */;
- else if (!pinfolist[nelem])
- return;
- else
- /* Scan list of previously recorded pids to make sure that this pid hasn't
- shown up before. This can happen when a process execs. */
- for (unsigned i = 0; i < nelem; i++)
- if (pinfolist[i]->pid == pinfolist[nelem]->pid)
- {
- if ((_pinfo *) pinfolist[nelem] != (_pinfo *) myself)
- pinfolist[nelem].release ();
- return;
- }
-
- pidlist[nelem++] = pid;
-}
-
-DWORD
-winpids::enumNT (bool winpid)
-{
- static DWORD szprocs;
- static SYSTEM_PROCESSES *procs;
-
- DWORD nelem = 0;
- if (!szprocs)
- procs = (SYSTEM_PROCESSES *) malloc (sizeof (*procs) + (szprocs = 200 * sizeof (*procs)));
-
- NTSTATUS res;
- for (;;)
- {
- res = NtQuerySystemInformation (SystemProcessesAndThreadsInformation,
- procs, szprocs, NULL);
- if (res == 0)
- break;
-
- if (res == STATUS_INFO_LENGTH_MISMATCH)
- procs = (SYSTEM_PROCESSES *) realloc (procs, szprocs += 200 * sizeof (*procs));
- else
- {
- system_printf ("error %p reading system process information", res);
- return 0;
- }
- }
-
- SYSTEM_PROCESSES *px = procs;
- for (;;)
- {
- if (px->ProcessId)
- add (nelem, winpid, px->ProcessId);
- if (!px->NextEntryDelta)
- break;
- px = (SYSTEM_PROCESSES *) ((char *) px + px->NextEntryDelta);
- }
-
- return nelem;
-}
-
-DWORD
-winpids::enum9x (bool winpid)
-{
- DWORD nelem = 0;
-
- HANDLE h = CreateToolhelp32Snapshot (TH32CS_SNAPPROCESS, 0);
- if (!h)
- {
- system_printf ("Couldn't create process snapshot, %E");
- return 0;
- }
-
- PROCESSENTRY32 proc;
- proc.dwSize = sizeof (proc);
-
- if (Process32First (h, &proc))
- do
- {
- if (proc.th32ProcessID)
- add (nelem, winpid, proc.th32ProcessID);
- }
- while (Process32Next (h, &proc));
-
- CloseHandle (h);
- return nelem;
-}
-
-void
-winpids::init (bool winpid)
-{
- npids = (this->*enum_processes) (winpid);
- if (pidlist)
- pidlist[npids] = 0;
-}
-
-DWORD
-winpids::enum_init (bool winpid)
-{
- if (wincap.is_winnt ())
- enum_processes = &winpids::enumNT;
- else
- enum_processes = &winpids::enum9x;
-
- return (this->*enum_processes) (winpid);
-}
-
-void
-winpids::release ()
-{
- for (unsigned i = 0; i < npids; i++)
- if (pinfolist[i] && (_pinfo *) pinfolist[i] != (_pinfo *) myself)
- pinfolist[i].release ();
-}
-
-winpids::~winpids ()
-{
- if (npidlist)
- {
- release ();
- free (pidlist);
- free (pinfolist);
- }
-}
diff --git a/winsup/cygwin/pinfo.h b/winsup/cygwin/pinfo.h
deleted file mode 100644
index 8a090cfd9..000000000
--- a/winsup/cygwin/pinfo.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* pinfo.h: process table info
-
- Copyright 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. */
-
-#ifndef _PINFO_H
-#define _PINFO_H
-/* Signal constants (have to define them here, unfortunately) */
-
-enum
-{
- __SIGFLUSH = -2,
- __SIGSTRACE = -1,
- __SIGUNUSED = 0,
- __SIGOFFSET = 2
-};
-
-#define PSIZE 63
-
-#include <sys/resource.h>
-#include "thread.h"
-
-class _pinfo
-{
-public:
- /* Cygwin pid */
- pid_t pid;
-
- /* Various flags indicating the state of the process. See PID_
- constants below. */
- DWORD process_state;
-
- /* If hProcess is set, it's because it came from a
- CreateProcess call. This means it's process relative
- to the thing which created the process. That's ok because
- we only use this handle from the parent. */
- HANDLE hProcess;
-
-#define PINFO_REDIR_SIZE ((char *) &myself.procinfo->hProcess - (char *) myself.procinfo)
-
- /* Handle associated with initial Windows pid which started it all. */
- HANDLE pid_handle;
-
- /* Handle to the logical parent of this pid. */
- HANDLE ppid_handle;
-
- /* Parent process id. */
- pid_t ppid;
-
- /* dwProcessId contains the processid used for sending signals. It
- * will be reset in a child process when it is capable of receiving
- * signals.
- */
- DWORD dwProcessId;
-
- /* Used to spawn a child for fork(), among other things. */
- char progname[MAX_PATH];
-
- /* User information.
- The information is derived from the GetUserName system call,
- with the name looked up in /etc/passwd and assigned a default value
- if not found. This data resides in the shared data area (allowing
- tasks to store whatever they want here) so it's for informational
- purposes only. */
- __uid32_t uid; /* User ID */
- __gid32_t gid; /* Group ID */
- pid_t pgid; /* Process group ID */
- pid_t sid; /* Session ID */
- int ctty; /* Control tty */
- bool has_pgid_children;/* True if we've forked or spawned children with our GID. */
-
- /* Resources used by process. */
- long start_time;
- struct rusage rusage_self;
- struct rusage rusage_children;
-
- /* Non-zero if process was stopped by a signal. */
- char stopsig;
-
- void exit (UINT n, bool norecord = 0) __attribute__ ((noreturn, regparm(2)));
-
- inline void set_has_pgid_children ()
- {
- if (pgid == pid)
- has_pgid_children = 1;
- }
-
- inline void set_has_pgid_children (bool val) {has_pgid_children = val;}
-
- inline struct sigaction& getsig (int sig)
- {
- return thread2signal ? thread2signal->sigs[sig] : sigs[sig];
- }
-
- inline void copysigs (_pinfo *p) {memcpy (sigs, p->sigs, sizeof (sigs));}
-
- inline sigset_t& getsigmask ()
- {
- return thread2signal ? *thread2signal->sigmask : sig_mask;
- }
-
- inline void setsigmask (sigset_t mask)
- {
- if (thread2signal)
- *(thread2signal->sigmask) = mask;
- sig_mask = mask;
- }
-
- inline LONG* getsigtodo (int sig) {return _sigtodo + __SIGOFFSET + sig;}
-
- inline HANDLE getthread2signal ()
- {
- return thread2signal ? thread2signal->win32_obj_id : hMainThread;
- }
-
- inline void setthread2signal (void *thr) {thread2signal = (pthread *) thr;}
-
-private:
- struct sigaction sigs[NSIG];
- sigset_t sig_mask; /* one set for everything to ignore. */
- LONG _sigtodo[NSIG + __SIGOFFSET];
- pthread *thread2signal; // NULL means means thread any other means a pthread
-};
-
-class pinfo
-{
- HANDLE h;
- _pinfo *procinfo;
- int destroy;
-public:
- void init (pid_t n, DWORD create = 0, HANDLE h = NULL) __attribute__ ((regparm(3)));
- pinfo () {}
- pinfo (_pinfo *x): procinfo (x) {}
- pinfo (pid_t n) {init (n);}
- pinfo (pid_t n, int create) {init (n, create);}
- void release ();
- ~pinfo ()
- {
- if (destroy && procinfo)
- release ();
- }
-
- _pinfo *operator -> () const {return procinfo;}
- int operator == (pinfo *x) const {return x->procinfo == procinfo;}
- int operator == (pinfo &x) const {return x.procinfo == procinfo;}
- int operator == (void *x) const {return procinfo == x;}
- int operator == (int x) const {return (int) procinfo == (int) x;}
- int operator == (char *x) const {return (char *) procinfo == x;}
- _pinfo *operator * () const {return procinfo;}
- operator _pinfo * () const {return procinfo;}
- // operator bool () const {return (int) h;}
-#ifdef _SIGPROC_H
- int remember () {destroy = 0; return proc_subproc (PROC_ADDCHILD, (DWORD) this);}
-#else
- int remember () {system_printf ("remember is not here"); return 0;}
-#endif
- HANDLE shared_handle () {return h;}
-};
-
-#define ISSTATE(p, f) (!!((p)->process_state & f))
-#define NOTSTATE(p, f) (!((p)->process_state & f))
-
-class winpids
-{
- DWORD *pidlist;
- DWORD npidlist;
- pinfo *pinfolist;
- DWORD (winpids::* enum_processes) (bool winpid);
- DWORD enum_init (bool winpid);
- DWORD enumNT (bool winpid);
- DWORD enum9x (bool winpid);
- void add (DWORD& nelem, bool, DWORD pid);
-public:
- DWORD npids;
- inline void reset () { npids = 0; release (); }
- void init (bool winpid);
- winpids (int): enum_processes (&winpids::enum_init) { reset (); }
- winpids (): pidlist (NULL), npidlist (0), pinfolist (NULL),
- enum_processes (&winpids::enum_init), npids (0) { init (0); }
- inline DWORD& winpid (int i) const {return pidlist[i];}
- inline _pinfo *operator [] (int i) const {return (_pinfo *) pinfolist[i];}
- ~winpids ();
- void release ();
-};
-
-extern __inline pid_t
-cygwin_pid (pid_t pid)
-{
- return (pid_t) (wincap.has_negative_pids ()) ? -(int) pid : pid;
-}
-
-void __stdcall pinfo_init (char **, int);
-void __stdcall set_myself (pid_t pid, HANDLE h = NULL);
-extern pinfo myself;
-
-#define _P_VFORK 0
-extern void __stdcall pinfo_fixup_after_fork ();
-extern HANDLE hexec_proc;
-
-/* For mmaps across fork(). */
-int __stdcall fixup_mmaps_after_fork (HANDLE parent);
-/* for shm areas across fork (). */
-int __stdcall fixup_shms_after_fork ();
-
-void __stdcall fill_rusage (struct rusage *, HANDLE);
-void __stdcall add_rusage (struct rusage *, struct rusage *);
-#endif /*_PINFO_H*/
diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/pipe.cc
deleted file mode 100644
index 9313f085c..000000000
--- a/winsup/cygwin/pipe.cc
+++ /dev/null
@@ -1,196 +0,0 @@
-/* pipe.cc: pipe for Cygwin.
-
- Copyright 1996, 1998, 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. */
-
-#include "winsup.h"
-#include <unistd.h>
-#include <errno.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygheap.h"
-#include "thread.h"
-#include "pinfo.h"
-
-static unsigned pipecount;
-static const NO_COPY char pipeid_fmt[] = "stupid_pipe.%u.%u";
-
-fhandler_pipe::fhandler_pipe (DWORD devtype)
- : fhandler_base (devtype), guard (NULL), broken_pipe (false), writepipe_exists(0),
- orig_pid (0), id (0)
-{
-}
-
-__off64_t
-fhandler_pipe::lseek (__off64_t offset, int whence)
-{
- debug_printf ("(%d, %d)", offset, whence);
- set_errno (ESPIPE);
- return -1;
-}
-
-void
-fhandler_pipe::set_close_on_exec (int val)
-{
- this->fhandler_base::set_close_on_exec (val);
- if (guard)
- set_inheritance (guard, val);
- if (writepipe_exists)
- set_inheritance (writepipe_exists, val);
-}
-
-int __stdcall
-fhandler_pipe::read (void *in_ptr, size_t in_len)
-{
- if (broken_pipe)
- return 0;
- int res = this->fhandler_base::read (in_ptr, in_len);
- (void) ReleaseMutex (guard);
- return res;
-}
-
-int fhandler_pipe::close ()
-{
- int res = this->fhandler_base::close ();
- if (guard)
- CloseHandle (guard);
- if (writepipe_exists)
- CloseHandle (writepipe_exists);
- return res;
-}
-
-bool
-fhandler_pipe::hit_eof ()
-{
- char buf[80];
- HANDLE ev;
- if (broken_pipe)
- return 1;
- if (!orig_pid)
- return false;
- __small_sprintf (buf, pipeid_fmt, orig_pid, id);
- if ((ev = OpenEvent (EVENT_ALL_ACCESS, FALSE, buf)))
- CloseHandle (ev);
- debug_printf ("%s %p", buf, ev);
- return ev == NULL;
-}
-
-void
-fhandler_pipe::fixup_after_fork (HANDLE parent)
-{
- this->fhandler_base::fixup_after_fork (parent);
- if (guard)
- fork_fixup (parent, guard, "guard");
- if (writepipe_exists)
- fork_fixup (parent, writepipe_exists, "guard");
-}
-
-int
-fhandler_pipe::dup (fhandler_base *child)
-{
- int res = this->fhandler_base::dup (child);
- if (res)
- return res;
-
- fhandler_pipe *ftp = (fhandler_pipe *) child;
-
- if (guard == NULL)
- ftp->guard = NULL;
- else if (!DuplicateHandle (hMainProc, guard, hMainProc, &ftp->guard, 0, 1,
- DUPLICATE_SAME_ACCESS))
- {
- debug_printf ("couldn't duplicate guard %p, %E", guard);
- return -1;
- }
-
- if (writepipe_exists == NULL)
- ftp->writepipe_exists = NULL;
- else if (!DuplicateHandle (hMainProc, writepipe_exists, hMainProc,
- &ftp->writepipe_exists, 0, 1,
- DUPLICATE_SAME_ACCESS))
- {
- debug_printf ("couldn't duplicate writepipe_exists %p, %E", writepipe_exists);
- return -1;
- }
-
- ftp->id = id;
- ftp->orig_pid = orig_pid;
- return 0;
-}
-
-
-int
-make_pipe (int fildes[2], unsigned int psize, int mode)
-{
- HANDLE r, w;
- SECURITY_ATTRIBUTES *sa = (mode & O_NOINHERIT) ? &sec_none_nih : &sec_none;
- int res = -1;
-
- cygheap_fdnew fdr;
- if (fdr >= 0)
- {
- cygheap_fdnew fdw (fdr, false);
- if (fdw < 0)
- /* out of fds? */;
- else if (!CreatePipe (&r, &w, sa, psize))
- __seterrno ();
- else
- {
- fhandler_pipe *fhr = (fhandler_pipe *) cygheap->fdtab.build_fhandler (fdr, FH_PIPER, "/dev/piper");
- fhandler_pipe *fhw = (fhandler_pipe *) cygheap->fdtab.build_fhandler (fdw, FH_PIPEW, "/dev/pipew");
-
- int binmode = mode & O_TEXT ?: O_BINARY;
- fhr->init (r, GENERIC_READ, binmode);
- fhw->init (w, GENERIC_WRITE, binmode);
- if (mode & O_NOINHERIT)
- {
- fhr->set_close_on_exec_flag (1);
- fhw->set_close_on_exec_flag (1);
- }
-
- fildes[0] = fdr;
- fildes[1] = fdw;
-
- res = 0;
- fhr->create_guard (sa);
- if (wincap.has_unreliable_pipes ())
- {
- char buf[80];
- int count = pipecount++; /* FIXME: Should this be InterlockedIncrement? */
- __small_sprintf (buf, pipeid_fmt, myself->pid, count);
- fhw->writepipe_exists = CreateEvent (sa, TRUE, FALSE, buf);
- fhr->orig_pid = myself->pid;
- fhr->id = count;
- }
- }
- }
-
- syscall_printf ("%d = make_pipe ([%d, %d], %d, %p)", res, fildes[0],
- fildes[1], psize, mode);
- return res;
-}
-
-extern "C" int
-pipe (int filedes[2])
-{
- extern DWORD binmode;
- return make_pipe (filedes, 16384, (!binmode || binmode == O_BINARY) ? O_BINARY : O_TEXT);
-}
-
-extern "C" int
-_pipe (int filedes[2], unsigned int psize, int mode)
-{
- int res = make_pipe (filedes, psize, mode);
- /* This type of pipe is not interruptible so set the appropriate flag. */
- if (!res)
- cygheap->fdtab[filedes[0]]->set_r_no_interrupt (1);
- return res;
-}
diff --git a/winsup/cygwin/poll.cc b/winsup/cygwin/poll.cc
deleted file mode 100644
index a1c50e8b0..000000000
--- a/winsup/cygwin/poll.cc
+++ /dev/null
@@ -1,100 +0,0 @@
-/* poll.cc. Implements poll(2) via usage of select(2) call.
-
- Copyright 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. */
-
-#include "winsup.h"
-#include <sys/time.h>
-#include <sys/poll.h>
-#include <errno.h>
-#include <stdlib.h>
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygerrno.h"
-#include "cygheap.h"
-#include "sigproc.h"
-
-extern "C"
-int
-poll (struct pollfd *fds, unsigned int nfds, int timeout)
-{
- int max_fd = 0;
- fd_set *read_fds, *write_fds, *except_fds;
- struct timeval tv = { timeout / 1000, (timeout % 1000) * 1000 };
- sigframe thisframe (mainthread);
-
- for (unsigned int i = 0; i < nfds; ++i)
- if (fds[i].fd > max_fd)
- max_fd = fds[i].fd;
-
- size_t fds_size = howmany(max_fd + 1, NFDBITS) * sizeof (fd_mask);
-
- read_fds = (fd_set *) alloca (fds_size);
- write_fds = (fd_set *) alloca (fds_size);
- except_fds = (fd_set *) alloca (fds_size);
-
- if (!read_fds || !write_fds || !except_fds)
- {
- set_errno (ENOMEM);
- return -1;
- }
-
- memset (read_fds, 0, fds_size);
- memset (write_fds, 0, fds_size);
- memset (except_fds, 0, fds_size);
-
- int invalid_fds = 0;
- for (unsigned int i = 0; i < nfds; ++i)
- {
- fds[i].revents = 0;
- if (!cygheap->fdtab.not_open(fds[i].fd))
- {
- if (fds[i].events & POLLIN)
- FD_SET(fds[i].fd, read_fds);
- if (fds[i].events & POLLOUT)
- FD_SET(fds[i].fd, write_fds);
- if (fds[i].events & POLLPRI)
- FD_SET(fds[i].fd, except_fds);
- }
- else if (fds[i].fd >= 0)
- {
- ++invalid_fds;
- fds[i].revents = POLLNVAL;
- }
- }
-
- if (invalid_fds)
- return invalid_fds;
-
- int ret = cygwin_select (max_fd + 1, read_fds, write_fds, except_fds, timeout < 0 ? NULL : &tv);
-
- if (ret > 0)
- for (unsigned int i = 0; i < nfds; ++i)
- {
- if (fds[i].fd >= 0)
- {
- if (cygheap->fdtab.not_open(fds[i].fd))
- fds[i].revents = POLLHUP;
- else
- {
- if (FD_ISSET(fds[i].fd, read_fds))
- fds[i].revents |= POLLIN;
- if (FD_ISSET(fds[i].fd, write_fds))
- fds[i].revents |= POLLOUT;
- if (FD_ISSET(fds[i].fd, read_fds) && FD_ISSET(fds[i].fd, write_fds))
- fds[i].revents |= POLLERR;
- if (FD_ISSET(fds[i].fd, except_fds))
- fds[i].revents |= POLLPRI;
- }
- }
- }
-
- return ret;
-}
diff --git a/winsup/cygwin/posix.sgml b/winsup/cygwin/posix.sgml
deleted file mode 100644
index 80e9c6e97..000000000
--- a/winsup/cygwin/posix.sgml
+++ /dev/null
@@ -1,98 +0,0 @@
-<sect1 id="std-posix">
-<title>Compatibility with POSIX.1</title>
-
-<para>The following functions are compatible with POSIX.1:</para>
-
-<sect2><title>Process Primitives (Section 3) </title><para>
-
-fork, execl, execle, execlp, execv, execve, execvp, wait, waitpid,
-_exit, kill, sigemptyset, sigfillset, sigaddset, sigdelset,
-sigismember, sigaction, pthread_sigmask, sigprocmask, sigpending,
-sigsuspend, alarm, pause, sleep, pthread_kill, pthread_sigmask
-
-</para></sect2>
-<sect2><title>Process Environment (Section 4) </title><para>
-
-getpid, getppid, getuid, geteuid, getgid, getegid, setuid, setgid,
-getgroups, getlogin, getpgrp, setsid, setpgid, uname, time, times,
-getenv, ctermid, ttyname, isatty, sysconf
-
-</para></sect2>
-<sect2><title>Files and Directories (Section 5) </title><para>
-
-opendir, readdir, rewinddir, closedir, chdir, getcwd, open, creat,
-umask, link, mkdir, unlink, rmdir, rename, stat, fstat, access, chmod,
-fchmod, chown, utime, ftruncate, pathconf, fpathconf
-
-</para></sect2>
-<sect2><title>Input and Output Primitives (Section 6) </title><para>
-
-pipe, dup, dup2, close, read, write, fcntl, lseek, fsync
-
-</para></sect2>
-<sect2><title>Device- and Class-Specific Functions (Section 7) </title><para>
-
-cfgetispeed, cfgetospeed, cfsetispeed, cfsetospeed, tcdrain, tcflow,
-tcflush, tcgetattr, tcgetpgrp, tcsendbreak, tcsetattr, tcsetpgrp
-
-</para></sect2>
-<sect2><title>Language-Specific Services for the C Programming Language (Section 8) </title><para>
-
-abort, exit, fclose, fdopen, fflush, fgetc, fgets, fileno, fopen,
-fprintf, fputc, fputs, fread, freopen, fscanf, fseek, ftell, fwrite,
-getc, getchar, gets, perror, printf, putc, putchar, puts, remove,
-rewind, scanf, setlocale, siglongjmp, sigsetjmp, tmpfile, tmpnam,
-tzset
-
-</para></sect2>
-<sect2><title>System Databases (Section 9) </title><para>
-
-getgrgid, getgrnam, getpwnam, getpwuid
-
-</para></sect2>
-<sect2><title>Synchronization (Section 11) </title><para>
-
-sem_init, sem_destroy, sem_wait, sem_trywait, sem_post,
-pthread_mutex_init, pthread_mutex_destroy, pthread_mutex_lock,
-pthread_mutex_trylock, pthread_mutex_unlock
-
-</para></sect2>
-<sect2><title>Memory Management (Section 12) </title><para>
-
-mmap, mprotect, msync, munmap
-
-</para></sect2>
-<sect2><title>Thread Management (Section 16) </title><para>
-
-pthread_attr_init, pthread_attr_destroy, pthread_attr_setstacksize,
-pthread_attr_getstacksize, pthread_create, pthread_exit, pthread_self,
-pthread_equal
-
-</para></sect2>
-<sect2><title>Thread-Specific Data Functions (Section 17) </title><para>
-
-pthread_key_create, pthread_setspecific, pthread_getspecific,
-pthread_key_delete
-
-</para></sect2>
-
-<sect2><title>Implementation Details</title>
-
-<para><function>setuid</function> and <function>setgid</function>
-always return ENOSYS.</para>
-
-<para><function>link</function> will copy the file if it can't
-implement a true symbolic link. Currently, symbolic links work, if at
-all, only under Windows NT.</para>
-
-<para><function>chown</function> always returns zero.</para>
-
-<para><function>fcntl</function> doesn't support F_GETLK - it returns
--1 and sets errno to ENOSYS.</para>
-
-<para><function>lseek</function> only works properly on binary
-files.</para>
-
-</sect2>
-
-</sect1>
diff --git a/winsup/cygwin/profil.c b/winsup/cygwin/profil.c
deleted file mode 100644
index 7be0839b2..000000000
--- a/winsup/cygwin/profil.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/* profil.c -- win32 profil.c equivalent
-
- Copyright 1998, 1999, 2000, 2001 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 <windows.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <math.h>
-
-#include <profil.h>
-
-#define SLEEPTIME (1000 / PROF_HZ)
-
-/* global profinfo for profil() call */
-static struct profinfo prof;
-
-/* Get the pc for thread THR */
-
-static u_long
-get_thrpc (HANDLE thr)
-{
- CONTEXT ctx;
- u_long pc;
- int res;
-
- res = SuspendThread (thr);
- if (res == -1)
- return (u_long) - 1;
- ctx.ContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER;
- pc = (u_long) - 1;
- if (GetThreadContext (thr, &ctx))
- pc = ctx.Eip;
- ResumeThread (thr);
- return pc;
-}
-
-/* Display cell of profile buffer */
-#if 0
-static void
-print_prof (struct profinfo *p)
-{
- printf ("profthr %x\ttarget thr %x\n", p->profthr, p->targthr);
- printf ("pc: %x - %x\n", p->lowpc, p->highpc);
- printf ("scale: %x\n", p->scale);
- return;
-}
-#endif
-
-/* Everytime we wake up use the main thread pc to hash into the cell in the
- profile buffer ARG. */
-
-static DWORD CALLBACK
-profthr_func (LPVOID arg)
-{
- struct profinfo *p = (struct profinfo *) arg;
- u_long pc, idx;
-
- for (;;)
- {
- pc = (u_long) get_thrpc (p->targthr);
- if (pc >= p->lowpc && pc < p->highpc)
- {
- idx = PROFIDX (pc, p->lowpc, p->scale);
- p->counter[idx]++;
- }
-#if 0
- print_prof (p);
-#endif
- Sleep (SLEEPTIME);
- }
- return 0;
-}
-
-/* Stop profiling to the profiling buffer pointed to by P. */
-
-static int
-profile_off (struct profinfo *p)
-{
- if (p->profthr)
- {
- TerminateThread (p->profthr, 0);
- CloseHandle (p->profthr);
- }
- if (p->targthr)
- CloseHandle (p->targthr);
- return 0;
-}
-
-/* Create a timer thread and pass it a pointer P to the profiling buffer. */
-
-static int
-profile_on (struct profinfo *p)
-{
- DWORD thrid;
-
- /* get handle for this thread */
- if (!DuplicateHandle (GetCurrentProcess (), GetCurrentThread (),
- GetCurrentProcess (), &p->targthr, 0, FALSE,
- DUPLICATE_SAME_ACCESS))
- {
- errno = ESRCH;
- return -1;
- }
-
- p->profthr = CreateThread (0, 0, profthr_func, (void *) p, 0, &thrid);
- if (!p->profthr)
- {
- CloseHandle (p->targthr);
- p->targthr = 0;
- errno = EAGAIN;
- return -1;
- }
- return 0;
-}
-
-/*
- * start or stop profiling
- *
- * profiling goes into the SAMPLES buffer of size SIZE (which is treated
- * as an array of u_shorts of size size/2)
- *
- * each bin represents a range of pc addresses from OFFSET. The number
- * of pc addresses in a bin depends on SCALE. (A scale of 65536 maps
- * each bin to two addresses, A scale of 32768 maps each bin to 4 addresses,
- * a scale of 1 maps each bin to 128k addreses). Scale may be 1 - 65536,
- * or zero to turn off profiling
- */
-int
-profile_ctl (struct profinfo * p, char *samples, size_t size,
- u_long offset, u_int scale)
-{
- u_long maxbin;
-
- if (scale > 65536)
- {
- errno = EINVAL;
- return -1;
- }
-
- profile_off (p);
- if (scale)
- {
- memset (samples, 0, size);
- memset (p, 0, sizeof *p);
- maxbin = size >> 1;
- prof.counter = (u_short *) samples;
- prof.lowpc = offset;
- prof.highpc = PROFADDR (maxbin, offset, scale);
- prof.scale = scale;
-
- return profile_on (p);
- }
- return 0;
-}
-
-/* Equivalent to unix profil()
- Every SLEEPTIME interval, the user's program counter (PC) is examined:
- offset is subtracted and the result is multiplied by scale.
- The word pointed to by this address is incremented. Buf is unused. */
-
-int
-profil (char *samples, size_t size, u_long offset, u_int scale)
-{
- return profile_ctl (&prof, samples, size, offset, scale);
-}
-
diff --git a/winsup/cygwin/profil.h b/winsup/cygwin/profil.h
deleted file mode 100644
index 582b2a7cb..000000000
--- a/winsup/cygwin/profil.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* profil.h: gprof profiling header file
-
- Copyright 1998, 1999, 2000, 2001 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. */
-
-/* profiling frequency. (No larger than 1000) */
-#define PROF_HZ 100
-
-/* convert an addr to an index */
-#define PROFIDX(pc, base, scale) \
- ({ \
- size_t i = (pc - base) / 2; \
- if (sizeof (unsigned long long int) > sizeof (size_t)) \
- i = (unsigned long long int) i * scale / 65536; \
- else \
- i = i / 65536 * scale + i % 65536 * scale / 65536; \
- i; \
- })
-
-/* convert an index into an address */
-#define PROFADDR(idx, base, scale) \
- ((base) + ((((idx) << 16) / (scale)) << 1))
-
-/* convert a bin size into a scale */
-#define PROFSCALE(range, bins) (((bins) << 16) / ((range) >> 1))
-
-typedef void *_WINHANDLE;
-
-struct profinfo {
- _WINHANDLE targthr; /* thread to profile */
- _WINHANDLE profthr; /* profiling thread */
- u_short *counter; /* profiling counters */
- u_long lowpc, highpc; /* range to be profiled */
- u_int scale; /* scale value of bins */
-};
-
-int profile_ctl(struct profinfo *, char *, size_t, u_long, u_int);
-int profil(char *, size_t, u_long, u_int);
-
diff --git a/winsup/cygwin/pthread.cc b/winsup/cygwin/pthread.cc
deleted file mode 100644
index ab7fd1fbe..000000000
--- a/winsup/cygwin/pthread.cc
+++ /dev/null
@@ -1,489 +0,0 @@
-/* pthread.cc: posix pthread interface for Cygwin
-
- Copyright 1998, 1999, 2000, 2001 Red Hat, Inc.
-
- Originally written by Marco Fuykschot <marco@ddi.nl>
-
- 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 "winsup.h"
-#include "thread.h"
-
-extern "C"
-{
-/* ThreadCreation */
-int
-pthread_create (pthread_t * thread, const pthread_attr_t * attr,
- void *(*start_routine) (void *), void *arg)
-{
- return __pthread_create (thread, attr, start_routine, arg);
-}
-
-int
-pthread_once (pthread_once_t * once_control, void (*init_routine) (void))
-{
- return __pthread_once (once_control, init_routine);
-}
-
-int
-pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void))
-{
- return __pthread_atfork(prepare, parent, child);
-}
-
-int
-pthread_attr_init (pthread_attr_t * attr)
-{
- return __pthread_attr_init (attr);
-}
-
-int
-pthread_attr_destroy (pthread_attr_t * attr)
-{
- return __pthread_attr_destroy (attr);
-}
-
-int
-pthread_attr_setdetachstate (pthread_attr_t * attr, int detachstate)
-{
- return __pthread_attr_setdetachstate (attr, detachstate);
-}
-
-int
-pthread_attr_getdetachstate (const pthread_attr_t * attr, int *detachstate)
-{
- return __pthread_attr_getdetachstate (attr, detachstate);
-}
-
-
-int
-pthread_attr_setstacksize (pthread_attr_t * attr, size_t size)
-{
- return __pthread_attr_setstacksize (attr, size);
-}
-
-int
-pthread_attr_getstacksize (const pthread_attr_t * attr, size_t * size)
-{
- return __pthread_attr_getstacksize (attr, size);
-}
-
-int
-pthread_attr_setinheritsched (pthread_attr_t * attr, int inheritsched)
-{
- return __pthread_attr_setinheritsched (attr, inheritsched);
-}
-
-int
-pthread_attr_getinheritsched (const pthread_attr_t * attr, int *inheritsched)
-{
- return __pthread_attr_getinheritsched (attr, inheritsched);
-}
-
-int
-pthread_attr_setschedparam (pthread_attr_t * attr,
- const struct sched_param *param)
-{
- return __pthread_attr_setschedparam (attr, param);
-}
-
-int
-pthread_attr_getschedparam (const pthread_attr_t * attr,
- struct sched_param *param)
-{
- return __pthread_attr_getschedparam (attr, param);
-}
-
-int
-pthread_attr_setschedpolicy (pthread_attr_t * attr, int policy)
-{
- return __pthread_attr_setschedpolicy (attr, policy);
-}
-
-int
-pthread_attr_getschedpolicy (const pthread_attr_t * attr, int *policy)
-{
- return __pthread_attr_getschedpolicy (attr, policy);
-}
-
-int
-pthread_attr_setscope (pthread_attr_t * attr, int contentionscope)
-{
- return __pthread_attr_setscope (attr, contentionscope);
-}
-
-int
-pthread_attr_getscope (const pthread_attr_t * attr, int *contentionscope)
-{
- return __pthread_attr_getscope (attr, contentionscope);
-}
-
-#ifdef _POSIX_THREAD_ATTR_STACKADDR
-int
-pthread_attr_setstackaddr (pthread_attr_t * attr, void *stackaddr)
-{
- return __pthread_attr_setstackaddr (attr, stackaddr);
-}
-
-int
-pthread_attr_getstackaddr (const pthread_attr_t * attr, void **stackaddr)
-{
- return __pthread_attr_getstackaddr (attr, stackaddr);
-}
-#endif
-
-/* Thread Exit */
-void
-pthread_exit (void *value_ptr)
-{
- return __pthread_exit (value_ptr);
-}
-
-int
-pthread_join (pthread_t thread, void **return_val)
-{
- return __pthread_join (&thread, (void **) return_val);
-}
-
-int
-pthread_detach (pthread_t thread)
-{
- return __pthread_detach (&thread);
-}
-
-
-/* This isn't a posix call... should we keep it? */
-int
-pthread_suspend (pthread_t thread)
-{
- return __pthread_suspend (&thread);
-}
-
-/* same */
-int
-pthread_continue (pthread_t thread)
-{
- return __pthread_continue (&thread);
-}
-
-unsigned long
-pthread_getsequence_np (pthread_t * thread)
-{
- return __pthread_getsequence_np (thread);
-}
-
-/* Thread SpecificData */
-int
-pthread_key_create (pthread_key_t * key, void (*destructor) (void *))
-{
- return __pthread_key_create (key, destructor);
-}
-
-int
-pthread_key_delete (pthread_key_t key)
-{
- return __pthread_key_delete (key);
-}
-
-int
-pthread_setspecific (pthread_key_t key, const void *value)
-{
- return __pthread_setspecific (key, value);
-}
-
-void *
-pthread_getspecific (pthread_key_t key)
-{
- return (void *) __pthread_getspecific (key);
-}
-
-/* Thread signal */
-int
-pthread_kill (pthread_t thread, int sig)
-{
- return __pthread_kill (thread, sig);
-}
-
-int
-pthread_sigmask (int operation, const sigset_t * set, sigset_t * old_set)
-{
- return __pthread_sigmask (operation, set, old_set);
-}
-
-/* ID */
-
-pthread_t pthread_self ()
-{
- return pthread::self();
-}
-
-int
-pthread_equal (pthread_t t1, pthread_t t2)
-{
- return __pthread_equal (&t1, &t2);
-}
-
-/* Mutexes */
-int
-pthread_mutex_init (pthread_mutex_t * mutex, const pthread_mutexattr_t * attr)
-{
- return __pthread_mutex_init (mutex, attr);
-}
-
-int
-pthread_mutex_lock (pthread_mutex_t * mutex)
-{
- return __pthread_mutex_lock (mutex);
-}
-
-int
-pthread_mutex_trylock (pthread_mutex_t * mutex)
-{
- return __pthread_mutex_trylock (mutex);
-}
-
-int
-pthread_mutex_unlock (pthread_mutex_t * mutex)
-{
- return __pthread_mutex_unlock (mutex);
-}
-
-int
-pthread_mutex_destroy (pthread_mutex_t * mutex)
-{
- return __pthread_mutex_destroy (mutex);
-}
-
-int
-pthread_mutex_setprioceiling (pthread_mutex_t * mutex,
- int prioceiling, int *old_ceiling)
-{
- return __pthread_mutex_setprioceiling (mutex, prioceiling, old_ceiling);
-}
-
-int
-pthread_mutex_getprioceiling (const pthread_mutex_t * mutex, int *prioceiling)
-{
- return __pthread_mutex_getprioceiling (mutex, prioceiling);
-}
-
-
-
-int
-pthread_mutexattr_destroy (pthread_mutexattr_t * attr)
-{
- return __pthread_mutexattr_destroy (attr);
-}
-
-int
-pthread_mutexattr_getprioceiling (const pthread_mutexattr_t * attr,
- int *prioceiling)
-{
- return __pthread_mutexattr_getprioceiling (attr, prioceiling);
-}
-
-int
-pthread_mutexattr_getprotocol (const pthread_mutexattr_t * attr,
- int *protocol)
-{
- return __pthread_mutexattr_getprotocol (attr, protocol);
-}
-
-int
-pthread_mutexattr_getpshared (const pthread_mutexattr_t * attr, int *pshared)
-{
- return __pthread_mutexattr_getpshared (attr, pshared);
-}
-
-int
-pthread_mutexattr_gettype (const pthread_mutexattr_t * attr, int *type)
-{
- return __pthread_mutexattr_gettype (attr, type);
-}
-
-int
-pthread_mutexattr_init (pthread_mutexattr_t * attr)
-{
- return __pthread_mutexattr_init (attr);
-}
-
-int
-pthread_mutexattr_setprioceiling (pthread_mutexattr_t * attr, int prioceiling)
-{
- return __pthread_mutexattr_setprioceiling (attr, prioceiling);
-}
-
-int
-pthread_mutexattr_setprotocol (pthread_mutexattr_t * attr, int protocol)
-{
- return __pthread_mutexattr_setprotocol (attr, protocol);
-}
-
-int
-pthread_mutexattr_setpshared (pthread_mutexattr_t * attr, int pshared)
-{
- return __pthread_mutexattr_setpshared (attr, pshared);
-}
-
-int
-pthread_mutexattr_settype (pthread_mutexattr_t * attr, int type)
-{
- return __pthread_mutexattr_settype (attr, type);
-}
-
-/* Synchronisation */
-
-int
-pthread_cond_destroy (pthread_cond_t * cond)
-{
- return __pthread_cond_destroy (cond);
-}
-
-int
-pthread_cond_init (pthread_cond_t * cond, const pthread_condattr_t * attr)
-{
- return __pthread_cond_init (cond, attr);
-}
-
-int
-pthread_cond_signal (pthread_cond_t * cond)
-{
- return __pthread_cond_signal (cond);
-}
-
-int
-pthread_cond_broadcast (pthread_cond_t * cond)
-{
- return __pthread_cond_broadcast (cond);
-}
-
-int
-pthread_condattr_init (pthread_condattr_t * condattr)
-{
- return __pthread_condattr_init (condattr);
-}
-
-int
-pthread_condattr_destroy (pthread_condattr_t * condattr)
-{
- return __pthread_condattr_destroy (condattr);
-}
-
-int
-pthread_condattr_getpshared (const pthread_condattr_t * attr, int *pshared)
-{
- return __pthread_condattr_getpshared (attr, pshared);
-}
-
-int
-pthread_condattr_setpshared (pthread_condattr_t * attr, int pshared)
-{
- return __pthread_condattr_setpshared (attr, pshared);
-}
-
-/* Scheduling */
-
-int
-pthread_getconcurrency (void)
-{
- return __pthread_getconcurrency ();
-}
-
-int
-pthread_setconcurrency (int new_level)
-{
- return __pthread_setconcurrency (new_level);
-}
-
-
-
-
-int
-pthread_getschedparam (pthread_t thread, int *policy,
- struct sched_param *param)
-{
- return __pthread_getschedparam (thread, policy, param);
-}
-
-int
-pthread_setschedparam (pthread_t thread, int policy,
- const struct sched_param *param)
-{
- return __pthread_setschedparam (thread, policy, param);
-}
-
-
-/* Cancelability */
-
-int
-pthread_cancel (pthread_t thread)
-{
- return __pthread_cancel (thread);
-}
-
-int
-pthread_setcancelstate (int state, int *oldstate)
-{
- return __pthread_setcancelstate (state, oldstate);
-}
-
-int
-pthread_setcanceltype (int type, int *oldtype)
-{
- return __pthread_setcanceltype (type, oldtype);
-}
-
-void
-pthread_testcancel (void)
-{
- __pthread_testcancel ();
-}
-
-void
-_pthread_cleanup_push (__pthread_cleanup_handler *handler)
-{
- pthread::self()->push_cleanup_handler(handler);
-}
-
-void
-_pthread_cleanup_pop (int execute)
-{
- pthread::self()->pop_cleanup_handler (execute);
-}
-
-/* Semaphores */
-int
-sem_init (sem_t * sem, int pshared, unsigned int value)
-{
- return __sem_init (sem, pshared, value);
-}
-
-int
-sem_destroy (sem_t * sem)
-{
- return __sem_destroy (sem);
-}
-
-int
-sem_wait (sem_t * sem)
-{
- return __sem_wait (sem);
-}
-
-int
-sem_trywait (sem_t * sem)
-{
- return __sem_trywait (sem);
-}
-
-int
-sem_post (sem_t * sem)
-{
- return __sem_post (sem);
-}
-
-}
diff --git a/winsup/cygwin/pwdgrp.h b/winsup/cygwin/pwdgrp.h
deleted file mode 100644
index d2dcfcd1a..000000000
--- a/winsup/cygwin/pwdgrp.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/* pwdgrp.h
-
- Copyright 2001 Red Hat inc.
-
- Stuff common to pwd and grp handling.
-
-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. */
-
-enum pwdgrp_state {
- uninitialized = 0,
- initializing,
- emulated,
- loaded
-};
-
-class pwdgrp_check {
- pwdgrp_state state;
- FILETIME last_modified;
- char file_w32[MAX_PATH];
-
-public:
- pwdgrp_check () : state (uninitialized) {}
- operator pwdgrp_state ()
- {
- if (state != uninitialized && file_w32[0] && cygheap->etc_changed ())
- {
- HANDLE h;
- WIN32_FIND_DATA data;
-
- if ((h = FindFirstFile (file_w32, &data)) != INVALID_HANDLE_VALUE)
- {
- if (CompareFileTime (&data.ftLastWriteTime, &last_modified) > 0)
- state = uninitialized;
- FindClose (h);
- }
- }
- return state;
- }
- void operator = (pwdgrp_state nstate)
- {
- state = nstate;
- }
- void set_last_modified (HANDLE fh, const char *name)
- {
- if (!file_w32[0])
- strcpy (file_w32, name);
- GetFileTime (fh, NULL, NULL, &last_modified);
- }
-};
-
-class pwdgrp_read {
- path_conv pc;
- HANDLE fh;
- char *buf;
- char *lptr, *eptr;
-
-public:
- pwdgrp_read ()
- : fh (INVALID_HANDLE_VALUE), buf (NULL), lptr (NULL), eptr (NULL) {}
- virtual ~pwdgrp_read ()
- {
- close ();
- if (buf)
- free (buf);
- }
-
- bool open (const char *posix_fname)
- {
- if (buf)
- free (buf);
- buf = lptr = eptr = NULL;
-
- pc.check (posix_fname);
- if (pc.error || !pc.exists () || !pc.isdisk () || pc.isdir ())
- return false;
-
- fh = CreateFile (pc, GENERIC_READ, wincap.shared (), NULL, OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL, 0);
- if (fh)
- {
- DWORD size = GetFileSize (fh, NULL), read_bytes;
- buf = (char *) malloc (size + 1);
- if (!ReadFile (fh, buf, size, &read_bytes, NULL))
- {
- if (buf)
- free (buf);
- buf = NULL;
- CloseHandle (fh);
- fh = INVALID_HANDLE_VALUE;
- return false;
- }
- buf[read_bytes] = '\0';
- return true;
- }
- return false;
- }
- char *gets ()
- {
- if (!buf)
- return NULL;
- if (!lptr)
- lptr = buf;
- else if (!eptr)
- return lptr = NULL;
- else
- lptr = eptr;
- eptr = strchr (lptr, '\n');
- if (eptr)
- *eptr++ = '\0';
- return lptr;
- }
- inline HANDLE get_fhandle () { return fh; }
- inline const char *get_fname () { return pc; }
- void close ()
- {
- if (fh != INVALID_HANDLE_VALUE)
- CloseHandle (fh);
- fh = INVALID_HANDLE_VALUE;
- }
-};
diff --git a/winsup/cygwin/regex/COPYRIGHT b/winsup/cygwin/regex/COPYRIGHT
deleted file mode 100644
index 30c1f7a48..000000000
--- a/winsup/cygwin/regex/COPYRIGHT
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright 1992, 1993, 1994, 1997 Henry Spencer. All rights reserved.
-This software is not subject to any license of the American Telephone
-and Telegraph Company or of the Regents of the University of California.
-
-Permission is granted to anyone to use this software for any purpose on
-any computer system, and to alter it and redistribute it, subject
-to the following restrictions:
-
-1. The author is not responsible for the consequences of use of this
- software, no matter how awful, even if they arise from flaws in it.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission. Since few users ever read sources,
- credits must appear in the documentation.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software. Since few users
- ever read sources, credits must appear in the documentation.
-
-4. This notice may not be removed or altered.
diff --git a/winsup/cygwin/regex/cclass.h b/winsup/cygwin/regex/cclass.h
deleted file mode 100644
index 7ddb44afb..000000000
--- a/winsup/cygwin/regex/cclass.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* character-class table */
-static struct cclass {
- const char *name;
- const char *chars;
- const char *multis;
-} cclasses[] = {
- {"alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
-0123456789", ""},
- {"alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
- ""},
- {"blank", " \t", ""},
- {"cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\
- \25\26\27\30\31\32\33\34\35\36\37\177", ""},
- {"digit", "0123456789", ""},
- {"graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
- 0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
- ""},
- {"lower", "abcdefghijklmnopqrstuvwxyz",
- ""},
- {"print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
- 0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ",
- ""},
- {"punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
- ""},
- {"space", "\t\n\v\f\r ", ""},
- {"upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
- ""},
- {"xdigit", "0123456789ABCDEFabcdef",
- ""},
- {NULL, 0, ""}
-};
diff --git a/winsup/cygwin/regex/cname.h b/winsup/cygwin/regex/cname.h
deleted file mode 100644
index 1000f603e..000000000
--- a/winsup/cygwin/regex/cname.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* character-name table */
-static struct cname {
- const char *name;
- char code;
-} cnames[] = {
- {"NUL", '\0'},
- {"SOH", '\001'},
- {"STX", '\002'},
- {"ETX", '\003'},
- {"EOT", '\004'},
- {"ENQ", '\005'},
- {"ACK", '\006'},
- {"BEL", '\007'},
- {"alert", '\007'},
- {"BS", '\010'},
- {"backspace", '\b'},
- {"HT", '\011'},
- {"tab", '\t'},
- {"LF", '\012'},
- {"newline", '\n'},
- {"VT", '\013'},
- {"vertical-tab", '\v'},
- {"FF", '\014'},
- {"form-feed", '\f'},
- {"CR", '\015'},
- {"carriage-return", '\r'},
- {"SO", '\016'},
- {"SI", '\017'},
- {"DLE", '\020'},
- {"DC1", '\021'},
- {"DC2", '\022'},
- {"DC3", '\023'},
- {"DC4", '\024'},
- {"NAK", '\025'},
- {"SYN", '\026'},
- {"ETB", '\027'},
- {"CAN", '\030'},
- {"EM", '\031'},
- {"SUB", '\032'},
- {"ESC", '\033'},
- {"IS4", '\034'},
- {"FS", '\034'},
- {"IS3", '\035'},
- {"GS", '\035'},
- {"IS2", '\036'},
- {"RS", '\036'},
- {"IS1", '\037'},
- {"US", '\037'},
- {"space", ' '},
- {"exclamation-mark", '!'},
- {"quotation-mark", '"'},
- {"number-sign", '#'},
- {"dollar-sign", '$'},
- {"percent-sign", '%'},
- {"ampersand", '&'},
- {"apostrophe", '\''},
- {"left-parenthesis", '('},
- {"right-parenthesis", ')'},
- {"asterisk", '*'},
- {"plus-sign", '+'},
- {"comma", ','},
- {"hyphen", '-'},
- {"hyphen-minus", '-'},
- {"period", '.'},
- {"full-stop", '.'},
- {"slash", '/'},
- {"solidus", '/'},
- {"zero", '0'},
- {"one", '1'},
- {"two", '2'},
- {"three", '3'},
- {"four", '4'},
- {"five", '5'},
- {"six", '6'},
- {"seven", '7'},
- {"eight", '8'},
- {"nine", '9'},
- {"colon", ':'},
- {"semicolon", ';'},
- {"less-than-sign", '<'},
- {"equals-sign", '='},
- {"greater-than-sign", '>'},
- {"question-mark", '?'},
- {"commercial-at", '@'},
- {"left-square-bracket", '['},
- {"backslash", '\\'},
- {"reverse-solidus", '\\'},
- {"right-square-bracket", ']'},
- {"circumflex", '^'},
- {"circumflex-accent", '^'},
- {"underscore", '_'},
- {"low-line", '_'},
- {"grave-accent", '`'},
- {"left-brace", '{'},
- {"left-curly-bracket", '{'},
- {"vertical-line", '|'},
- {"right-brace", '}'},
- {"right-curly-bracket", '}'},
- {"tilde", '~'},
- {"DEL", '\177'},
- {NULL, 0}
-};
diff --git a/winsup/cygwin/regex/engine.c b/winsup/cygwin/regex/engine.c
deleted file mode 100644
index 919fe3f64..000000000
--- a/winsup/cygwin/regex/engine.c
+++ /dev/null
@@ -1,1019 +0,0 @@
-/*
- * The matching engine and friends. This file is #included by regexec.c
- * after suitable #defines of a variety of macros used herein, so that
- * different state representations can be used without duplicating masses
- * of code.
- */
-
-#ifdef SNAMES
-#define matcher smatcher
-#define fast sfast
-#define slow sslow
-#define dissect sdissect
-#define backref sbackref
-#define step sstep
-#define print sprint
-#define at sat
-#define match smat
-#endif
-#ifdef LNAMES
-#define matcher lmatcher
-#define fast lfast
-#define slow lslow
-#define dissect ldissect
-#define backref lbackref
-#define step lstep
-#define print lprint
-#define at lat
-#define match lmat
-#endif
-
-/* another structure passed up and down to avoid zillions of parameters */
-struct match {
- struct re_guts *g;
- int eflags;
- regmatch_t *pmatch; /* [nsub+1] (0 element unused) */
- char *offp; /* offsets work from here */
- char *beginp; /* start of string -- virtual NUL precedes */
- char *endp; /* end of string -- virtual NUL here */
- char *coldp; /* can be no match starting before here */
- char **lastpos; /* [nplus+1] */
- STATEVARS;
- states st; /* current states */
- states fresh; /* states for a fresh start */
- states tmp; /* temporary */
- states empty; /* empty set of states */
-};
-
-#include "engine.ih"
-
-#ifdef REDEBUG
-#define SP(t, s, c) print(m, t, s, c, stdout)
-#define AT(t, p1, p2, s1, s2) at(m, t, p1, p2, s1, s2)
-#define NOTE(str) { if (m->eflags&REG_TRACE) printf("=%s\n", (str)); }
-#else
-#define SP(t, s, c) /* nothing */
-#define AT(t, p1, p2, s1, s2) /* nothing */
-#define NOTE(s) /* nothing */
-#endif
-
-/*
- - matcher - the actual matching engine
- == static int matcher(register struct re_guts *g, char *string, \
- == size_t nmatch, regmatch_t pmatch[], int eflags);
- */
-static int /* 0 success, REG_NOMATCH failure */
-matcher(g, string, nmatch, pmatch, eflags)
-register struct re_guts *g;
-char *string;
-size_t nmatch;
-regmatch_t pmatch[];
-int eflags;
-{
- register char *endp;
- register int i;
- struct match mv;
- register struct match *m = &mv;
- register char *dp;
- const register sopno gf = g->firststate+1; /* +1 for OEND */
- const register sopno gl = g->laststate;
- char *start;
- char *stop;
-
- /* simplify the situation where possible */
- if (g->cflags&REG_NOSUB)
- nmatch = 0;
- if (eflags&REG_STARTEND) {
- start = string + pmatch[0].rm_so;
- stop = string + pmatch[0].rm_eo;
- } else {
- start = string;
- stop = start + strlen(start);
- }
- if (stop < start)
- return(REG_INVARG);
-
- /* prescreening; this does wonders for this rather slow code */
- if (g->must != NULL) {
- for (dp = start; dp < stop; dp++)
- if (*dp == g->must[0] && stop - dp >= g->mlen &&
- memcmp(dp, g->must, (size_t)g->mlen) == 0)
- break;
- if (dp == stop) /* we didn't find g->must */
- return(REG_NOMATCH);
- }
-
- /* match struct setup */
- m->g = g;
- m->eflags = eflags;
- m->pmatch = NULL;
- m->lastpos = NULL;
- m->offp = string;
- m->beginp = start;
- m->endp = stop;
- STATESETUP(m, 4);
- SETUP(m->st);
- SETUP(m->fresh);
- SETUP(m->tmp);
- SETUP(m->empty);
- CLEAR(m->empty);
-
- /* this loop does only one repetition except for backrefs */
- for (;;) {
- endp = fast(m, start, stop, gf, gl);
- if (endp == NULL) { /* a miss */
- STATETEARDOWN(m);
- return(REG_NOMATCH);
- }
- if (nmatch == 0 && !g->backrefs)
- break; /* no further info needed */
-
- /* where? */
- assert(m->coldp != NULL);
- for (;;) {
- NOTE("finding start");
- endp = slow(m, m->coldp, stop, gf, gl);
- if (endp != NULL)
- break;
- assert(m->coldp < m->endp);
- m->coldp++;
- }
- if (nmatch == 1 && !g->backrefs)
- break; /* no further info needed */
-
- /* oh my, he wants the subexpressions... */
- if (m->pmatch == NULL)
- m->pmatch = (regmatch_t *)malloc((m->g->nsub + 1) *
- sizeof(regmatch_t));
- if (m->pmatch == NULL) {
- STATETEARDOWN(m);
- return(REG_ESPACE);
- }
- for (i = 1; i <= m->g->nsub; i++)
- m->pmatch[i].rm_so = m->pmatch[i].rm_eo = -1;
- if (!g->backrefs && !(m->eflags&REG_BACKR)) {
- NOTE("dissecting");
- dp = dissect(m, m->coldp, endp, gf, gl);
- } else {
- if (g->nplus > 0 && m->lastpos == NULL)
- m->lastpos = (char **)malloc((g->nplus+1) *
- sizeof(char *));
- if (g->nplus > 0 && m->lastpos == NULL) {
- free(m->pmatch);
- STATETEARDOWN(m);
- return(REG_ESPACE);
- }
- NOTE("backref dissect");
- dp = backref(m, m->coldp, endp, gf, gl, (sopno)0);
- }
- if (dp != NULL)
- break;
-
- /* uh-oh... we couldn't find a subexpression-level match */
- assert(g->backrefs); /* must be back references doing it */
- assert(g->nplus == 0 || m->lastpos != NULL);
- for (;;) {
- if (dp != NULL || endp <= m->coldp)
- break; /* defeat */
- NOTE("backoff");
- endp = slow(m, m->coldp, endp-1, gf, gl);
- if (endp == NULL)
- break; /* defeat */
- /* try it on a shorter possibility */
-#ifndef NDEBUG
- for (i = 1; i <= m->g->nsub; i++) {
- assert(m->pmatch[i].rm_so == -1);
- assert(m->pmatch[i].rm_eo == -1);
- }
-#endif
- NOTE("backoff dissect");
- dp = backref(m, m->coldp, endp, gf, gl, (sopno)0);
- }
- assert(dp == NULL || dp == endp);
- if (dp != NULL) /* found a shorter one */
- break;
-
- /* despite initial appearances, there is no match here */
- NOTE("false alarm");
- start = m->coldp + 1; /* recycle starting later */
- assert(start <= stop);
- }
-
- /* fill in the details if requested */
- if (nmatch > 0) {
- pmatch[0].rm_so = m->coldp - m->offp;
- pmatch[0].rm_eo = endp - m->offp;
- }
- if (nmatch > 1) {
- assert(m->pmatch != NULL);
- for (i = 1; i < nmatch; i++)
- if (i <= m->g->nsub)
- pmatch[i] = m->pmatch[i];
- else {
- pmatch[i].rm_so = -1;
- pmatch[i].rm_eo = -1;
- }
- }
-
- if (m->pmatch != NULL)
- free((char *)m->pmatch);
- if (m->lastpos != NULL)
- free((char *)m->lastpos);
- STATETEARDOWN(m);
- return(0);
-}
-
-/*
- - dissect - figure out what matched what, no back references
- == static char *dissect(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst);
- */
-static char * /* == stop (success) always */
-dissect(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- register int i;
- register sopno ss; /* start sop of current subRE */
- register sopno es; /* end sop of current subRE */
- register char *sp; /* start of string matched by it */
- register char *stp; /* string matched by it cannot pass here */
- register char *rest; /* start of rest of string */
- register char *tail; /* string unmatched by rest of RE */
- register sopno ssub; /* start sop of subsubRE */
- register sopno esub; /* end sop of subsubRE */
- register char *ssp; /* start of string matched by subsubRE */
- register char *sep; /* end of string matched by subsubRE */
- register char *oldssp; /* previous ssp */
- register char *dp;
-
- AT("diss", start, stop, startst, stopst);
- sp = start;
- for (ss = startst; ss < stopst; ss = es) {
- /* identify end of subRE */
- es = ss;
- switch (OP(m->g->strip[es])) {
- case OPLUS_:
- case OQUEST_:
- es += OPND(m->g->strip[es]);
- break;
- case OCH_:
- while (OP(m->g->strip[es]) != O_CH)
- es += OPND(m->g->strip[es]);
- break;
- }
- es++;
-
- /* figure out what it matched */
- switch (OP(m->g->strip[ss])) {
- case OEND:
- assert(nope);
- break;
- case OCHAR:
- sp++;
- break;
- case OBOL:
- case OEOL:
- case OBOW:
- case OEOW:
- break;
- case OANY:
- case OANYOF:
- sp++;
- break;
- case OBACK_:
- case O_BACK:
- assert(nope);
- break;
- /* cases where length of match is hard to find */
- case OQUEST_:
- stp = stop;
- for (;;) {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = es - 1;
- /* did innards match? */
- if (slow(m, sp, rest, ssub, esub) != NULL) {
- dp = dissect(m, sp, rest, ssub, esub);
- assert(dp == rest);
- } else /* no */
- assert(sp == rest);
- sp = rest;
- break;
- case OPLUS_:
- stp = stop;
- for (;;) {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = es - 1;
- ssp = sp;
- oldssp = ssp;
- for (;;) { /* find last match of innards */
- sep = slow(m, ssp, rest, ssub, esub);
- if (sep == NULL || sep == ssp)
- break; /* failed or matched null */
- oldssp = ssp; /* on to next try */
- ssp = sep;
- }
- if (sep == NULL) {
- /* last successful match */
- sep = ssp;
- ssp = oldssp;
- }
- assert(sep == rest); /* must exhaust substring */
- assert(slow(m, ssp, sep, ssub, esub) == rest);
- dp = dissect(m, ssp, sep, ssub, esub);
- assert(dp == sep);
- sp = rest;
- break;
- case OCH_:
- stp = stop;
- for (;;) {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = ss + OPND(m->g->strip[ss]) - 1;
- assert(OP(m->g->strip[esub]) == OOR1);
- for (;;) { /* find first matching branch */
- if (slow(m, sp, rest, ssub, esub) == rest)
- break; /* it matched all of it */
- /* that one missed, try next one */
- assert(OP(m->g->strip[esub]) == OOR1);
- esub++;
- assert(OP(m->g->strip[esub]) == OOR2);
- ssub = esub + 1;
- esub += OPND(m->g->strip[esub]);
- if (OP(m->g->strip[esub]) == OOR2)
- esub--;
- else
- assert(OP(m->g->strip[esub]) == O_CH);
- }
- dp = dissect(m, sp, rest, ssub, esub);
- assert(dp == rest);
- sp = rest;
- break;
- case O_PLUS:
- case O_QUEST:
- case OOR1:
- case OOR2:
- case O_CH:
- assert(nope);
- break;
- case OLPAREN:
- i = OPND(m->g->strip[ss]);
- assert(0 < i && i <= m->g->nsub);
- m->pmatch[i].rm_so = sp - m->offp;
- break;
- case ORPAREN:
- i = OPND(m->g->strip[ss]);
- assert(0 < i && i <= m->g->nsub);
- m->pmatch[i].rm_eo = sp - m->offp;
- break;
- default: /* uh oh */
- assert(nope);
- break;
- }
- }
-
- assert(sp == stop);
- return(sp);
-}
-
-/*
- - backref - figure out what matched what, figuring in back references
- == static char *backref(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst, sopno lev);
- */
-static char * /* == stop (success) or NULL (failure) */
-backref(m, start, stop, startst, stopst, lev)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-sopno lev; /* PLUS nesting level */
-{
- register int i;
- register sopno ss; /* start sop of current subRE */
- register char *sp; /* start of string matched by it */
- register sopno ssub; /* start sop of subsubRE */
- register sopno esub; /* end sop of subsubRE */
- register char *ssp; /* start of string matched by subsubRE */
- register char *dp;
- register size_t len;
- register int hard;
- register sop s;
- register regoff_t offsave;
- register cset *cs;
-
- AT("back", start, stop, startst, stopst);
- sp = start;
-
- /* get as far as we can with easy stuff */
- hard = 0;
- for (ss = startst; !hard && ss < stopst; ss++)
- switch (OP(s = m->g->strip[ss])) {
- case OCHAR:
- if (sp == stop || *sp++ != (char)OPND(s))
- return(NULL);
- break;
- case OANY:
- if (sp == stop)
- return(NULL);
- sp++;
- break;
- case OANYOF:
- cs = &m->g->sets[OPND(s)];
- if (sp == stop || !CHIN(cs, *sp++))
- return(NULL);
- break;
- case OBOL:
- if ( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
- (sp < m->endp && *(sp-1) == '\n' &&
- (m->g->cflags&REG_NEWLINE)) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case OEOL:
- if ( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
- (sp < m->endp && *sp == '\n' &&
- (m->g->cflags&REG_NEWLINE)) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case OBOW:
- if (( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
- (sp < m->endp && *(sp-1) == '\n' &&
- (m->g->cflags&REG_NEWLINE)) ||
- (sp > m->beginp &&
- !ISWORD(*(sp-1))) ) &&
- (sp < m->endp && ISWORD(*sp)) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case OEOW:
- if (( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
- (sp < m->endp && *sp == '\n' &&
- (m->g->cflags&REG_NEWLINE)) ||
- (sp < m->endp && !ISWORD(*sp)) ) &&
- (sp > m->beginp && ISWORD(*(sp-1))) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case O_QUEST:
- break;
- case OOR1: /* matches null but needs to skip */
- ss++;
- s = m->g->strip[ss];
- do {
- assert(OP(s) == OOR2);
- ss += OPND(s);
- } while (OP(s = m->g->strip[ss]) != O_CH);
- /* note that the ss++ gets us past the O_CH */
- break;
- default: /* have to make a choice */
- hard = 1;
- break;
- }
- if (!hard) { /* that was it! */
- if (sp != stop)
- return(NULL);
- return(sp);
- }
- ss--; /* adjust for the for's final increment */
-
- /* the hard stuff */
- AT("hard", sp, stop, ss, stopst);
- s = m->g->strip[ss];
- switch (OP(s)) {
- case OBACK_: /* the vilest depths */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- if (m->pmatch[i].rm_eo == -1)
- return(NULL);
- assert(m->pmatch[i].rm_so != -1);
- len = m->pmatch[i].rm_eo - m->pmatch[i].rm_so;
- assert(stop - m->beginp >= len);
- if (sp > stop - len)
- return(NULL); /* not enough left to match */
- ssp = m->offp + m->pmatch[i].rm_so;
- if (memcmp(sp, ssp, len) != 0)
- return(NULL);
- while (m->g->strip[ss] != SOP(O_BACK, i))
- ss++;
- return(backref(m, sp+len, stop, ss+1, stopst, lev));
- break;
- case OQUEST_: /* to null or not */
- dp = backref(m, sp, stop, ss+1, stopst, lev);
- if (dp != NULL)
- return(dp); /* not */
- return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev));
- break;
- case OPLUS_:
- assert(m->lastpos != NULL);
- assert(lev+1 <= m->g->nplus);
- m->lastpos[lev+1] = sp;
- return(backref(m, sp, stop, ss+1, stopst, lev+1));
- break;
- case O_PLUS:
- if (sp == m->lastpos[lev]) /* last pass matched null */
- return(backref(m, sp, stop, ss+1, stopst, lev-1));
- /* try another pass */
- m->lastpos[lev] = sp;
- dp = backref(m, sp, stop, ss-OPND(s)+1, stopst, lev);
- if (dp == NULL)
- return(backref(m, sp, stop, ss+1, stopst, lev-1));
- else
- return(dp);
- break;
- case OCH_: /* find the right one, if any */
- ssub = ss + 1;
- esub = ss + OPND(s) - 1;
- assert(OP(m->g->strip[esub]) == OOR1);
- for (;;) { /* find first matching branch */
- dp = backref(m, sp, stop, ssub, esub, lev);
- if (dp != NULL)
- return(dp);
- /* that one missed, try next one */
- if (OP(m->g->strip[esub]) == O_CH)
- return(NULL); /* there is none */
- esub++;
- assert(OP(m->g->strip[esub]) == OOR2);
- ssub = esub + 1;
- esub += OPND(m->g->strip[esub]);
- if (OP(m->g->strip[esub]) == OOR2)
- esub--;
- else
- assert(OP(m->g->strip[esub]) == O_CH);
- }
- break;
- case OLPAREN: /* must undo assignment if rest fails */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- offsave = m->pmatch[i].rm_so;
- m->pmatch[i].rm_so = sp - m->offp;
- dp = backref(m, sp, stop, ss+1, stopst, lev);
- if (dp != NULL)
- return(dp);
- m->pmatch[i].rm_so = offsave;
- return(NULL);
- break;
- case ORPAREN: /* must undo assignment if rest fails */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- offsave = m->pmatch[i].rm_eo;
- m->pmatch[i].rm_eo = sp - m->offp;
- dp = backref(m, sp, stop, ss+1, stopst, lev);
- if (dp != NULL)
- return(dp);
- m->pmatch[i].rm_eo = offsave;
- return(NULL);
- break;
- default: /* uh oh */
- assert(nope);
- break;
- }
-
- /* "can't happen" */
- assert(nope);
- /* NOTREACHED */
- return((char *)NULL); /* dummy */
-}
-
-/*
- - fast - step through the string at top speed
- == static char *fast(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst);
- */
-static char * /* where tentative match ended, or NULL */
-fast(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- register states st = m->st;
- register states fresh = m->fresh;
- register states tmp = m->tmp;
- register char *p = start;
- register int c = (start == m->beginp) ? OUT : *(start-1);
- register int lastc; /* previous c */
- register int flagch;
- register int i;
- register char *coldp; /* last p after which no match was underway */
-
- CLEAR(st);
- SET1(st, startst);
- st = step(m->g, startst, stopst, st, NOTHING, st);
- ASSIGN(fresh, st);
- SP("start", st, *p);
- coldp = NULL;
- for (;;) {
- /* next character */
- lastc = c;
- c = (p == m->endp) ? OUT : *p;
- if (EQ(st, fresh))
- coldp = p;
-
- /* is there an EOL and/or BOL between lastc and c? */
- flagch = '\0';
- i = 0;
- if ( (lastc == '\n' && m->g->cflags&REG_NEWLINE) ||
- (lastc == OUT && !(m->eflags&REG_NOTBOL)) ) {
- flagch = BOL;
- i = m->g->nbol;
- }
- if ( (c == '\n' && m->g->cflags&REG_NEWLINE) ||
- (c == OUT && !(m->eflags&REG_NOTEOL)) ) {
- flagch = (flagch == BOL) ? BOLEOL : EOL;
- i += m->g->neol;
- }
- if (i != 0) {
- for (; i > 0; i--)
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("boleol", st, c);
- }
-
- /* how about a word boundary? */
- if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
- (c != OUT && ISWORD(c)) ) {
- flagch = BOW;
- }
- if ( (lastc != OUT && ISWORD(lastc)) &&
- (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
- flagch = EOW;
- }
- if (flagch == BOW || flagch == EOW) {
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("boweow", st, c);
- }
-
- /* are we done? */
- if (ISSET(st, stopst) || p == stop)
- break; /* NOTE BREAK OUT */
-
- /* no, we must deal with this character */
- ASSIGN(tmp, st);
- ASSIGN(st, fresh);
- assert(c != OUT);
- st = step(m->g, startst, stopst, tmp, c, st);
- SP("aft", st, c);
- assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
- p++;
- }
-
- assert(coldp != NULL);
- m->coldp = coldp;
- if (ISSET(st, stopst))
- return(p+1);
- else
- return(NULL);
-}
-
-/*
- - slow - step through the string more deliberately
- == static char *slow(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst);
- */
-static char * /* where it ended */
-slow(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- register states st = m->st;
- register states empty = m->empty;
- register states tmp = m->tmp;
- register char *p = start;
- register int c = (start == m->beginp) ? OUT : *(start-1);
- register int lastc; /* previous c */
- register int flagch;
- register int i;
- register char *matchp; /* last p at which a match ended */
-
- AT("slow", start, stop, startst, stopst);
- CLEAR(st);
- SET1(st, startst);
- SP("sstart", st, *p);
- st = step(m->g, startst, stopst, st, NOTHING, st);
- matchp = NULL;
- for (;;) {
- /* next character */
- lastc = c;
- c = (p == m->endp) ? OUT : *p;
-
- /* is there an EOL and/or BOL between lastc and c? */
- flagch = '\0';
- i = 0;
- if ( (lastc == '\n' && m->g->cflags&REG_NEWLINE) ||
- (lastc == OUT && !(m->eflags&REG_NOTBOL)) ) {
- flagch = BOL;
- i = m->g->nbol;
- }
- if ( (c == '\n' && m->g->cflags&REG_NEWLINE) ||
- (c == OUT && !(m->eflags&REG_NOTEOL)) ) {
- flagch = (flagch == BOL) ? BOLEOL : EOL;
- i += m->g->neol;
- }
- if (i != 0) {
- for (; i > 0; i--)
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("sboleol", st, c);
- }
-
- /* how about a word boundary? */
- if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
- (c != OUT && ISWORD(c)) ) {
- flagch = BOW;
- }
- if ( (lastc != OUT && ISWORD(lastc)) &&
- (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
- flagch = EOW;
- }
- if (flagch == BOW || flagch == EOW) {
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("sboweow", st, c);
- }
-
- /* are we done? */
- if (ISSET(st, stopst))
- matchp = p;
- if (EQ(st, empty) || p == stop)
- break; /* NOTE BREAK OUT */
-
- /* no, we must deal with this character */
- ASSIGN(tmp, st);
- ASSIGN(st, empty);
- assert(c != OUT);
- st = step(m->g, startst, stopst, tmp, c, st);
- SP("saft", st, c);
- assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
- p++;
- }
-
- return(matchp);
-}
-
-
-/*
- - step - map set of states reachable before char to set reachable after
- == static states step(register struct re_guts *g, sopno start, sopno stop, \
- == register states bef, int ch, register states aft);
- == #define BOL (OUT+1)
- == #define EOL (BOL+1)
- == #define BOLEOL (BOL+2)
- == #define NOTHING (BOL+3)
- == #define BOW (BOL+4)
- == #define EOW (BOL+5)
- == #define CODEMAX (BOL+5) // highest code used
- == #define NONCHAR(c) ((c) > CHAR_MAX)
- == #define NNONCHAR (CODEMAX-CHAR_MAX)
- */
-static states
-step(g, start, stop, bef, ch, aft)
-register struct re_guts *g;
-sopno start; /* start state within strip */
-sopno stop; /* state after stop state within strip */
-register states bef; /* states reachable before */
-int ch; /* character or NONCHAR code */
-register states aft; /* states already known reachable after */
-{
- register cset *cs;
- register sop s;
- register sopno pc;
- register onestate here; /* note, macros know this name */
- register sopno look;
- register long i;
-
- for (pc = start, INIT(here, pc); pc != stop; pc++, INC(here)) {
- s = g->strip[pc];
- switch (OP(s)) {
- case OEND:
- assert(pc == stop-1);
- break;
- case OCHAR:
- /* only characters can match */
- assert(!NONCHAR(ch) || ch != (char)OPND(s));
- if (ch == (char)OPND(s))
- FWD(aft, bef, 1);
- break;
- case OBOL:
- if (ch == BOL || ch == BOLEOL)
- FWD(aft, bef, 1);
- break;
- case OEOL:
- if (ch == EOL || ch == BOLEOL)
- FWD(aft, bef, 1);
- break;
- case OBOW:
- if (ch == BOW)
- FWD(aft, bef, 1);
- break;
- case OEOW:
- if (ch == EOW)
- FWD(aft, bef, 1);
- break;
- case OANY:
- if (!NONCHAR(ch))
- FWD(aft, bef, 1);
- break;
- case OANYOF:
- cs = &g->sets[OPND(s)];
- if (!NONCHAR(ch) && CHIN(cs, ch))
- FWD(aft, bef, 1);
- break;
- case OBACK_: /* ignored here */
- case O_BACK:
- FWD(aft, aft, 1);
- break;
- case OPLUS_: /* forward, this is just an empty */
- FWD(aft, aft, 1);
- break;
- case O_PLUS: /* both forward and back */
- FWD(aft, aft, 1);
- i = ISSETBACK(aft, OPND(s));
- BACK(aft, aft, OPND(s));
- if (!i && ISSETBACK(aft, OPND(s))) {
- /* oho, must reconsider loop body */
- pc -= OPND(s) + 1;
- INIT(here, pc);
- }
- break;
- case OQUEST_: /* two branches, both forward */
- FWD(aft, aft, 1);
- FWD(aft, aft, OPND(s));
- break;
- case O_QUEST: /* just an empty */
- FWD(aft, aft, 1);
- break;
- case OLPAREN: /* not significant here */
- case ORPAREN:
- FWD(aft, aft, 1);
- break;
- case OCH_: /* mark the first two branches */
- FWD(aft, aft, 1);
- assert(OP(g->strip[pc+OPND(s)]) == OOR2);
- FWD(aft, aft, OPND(s));
- break;
- case OOR1: /* done a branch, find the O_CH */
- if (ISSTATEIN(aft, here)) {
- for (look = 1;
- OP(s = g->strip[pc+look]) != O_CH;
- look += OPND(s))
- assert(OP(s) == OOR2);
- FWD(aft, aft, look);
- }
- break;
- case OOR2: /* propagate OCH_'s marking */
- FWD(aft, aft, 1);
- if (OP(g->strip[pc+OPND(s)]) != O_CH) {
- assert(OP(g->strip[pc+OPND(s)]) == OOR2);
- FWD(aft, aft, OPND(s));
- }
- break;
- case O_CH: /* just empty */
- FWD(aft, aft, 1);
- break;
- default: /* ooooops... */
- assert(nope);
- break;
- }
- }
-
- return(aft);
-}
-
-#ifdef REDEBUG
-/*
- - print - print a set of states
- == #ifdef REDEBUG
- == static void print(struct match *m, char *caption, states st, \
- == int ch, FILE *d);
- == #endif
- */
-static void
-print(m, caption, st, ch, d)
-struct match *m;
-char *caption;
-states st;
-int ch;
-FILE *d;
-{
- register struct re_guts *g = m->g;
- register int i;
- register int first = 1;
-
- if (!(m->eflags&REG_TRACE))
- return;
-
- fprintf(d, "%s", caption);
- if (ch != '\0')
- fprintf(d, " %s", pchar(ch));
- for (i = 0; i < g->nstates; i++)
- if (ISSET(st, i)) {
- fprintf(d, "%s%d", (first) ? "\t" : ", ", i);
- first = 0;
- }
- fprintf(d, "\n");
-}
-
-/*
- - at - print current situation
- == #ifdef REDEBUG
- == static void at(struct match *m, char *title, char *start, char *stop, \
- == sopno startst, sopno stopst);
- == #endif
- */
-static void
-at(m, title, start, stop, startst, stopst)
-struct match *m;
-char *title;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- if (!(m->eflags&REG_TRACE))
- return;
-
- printf("%s %s-", title, pchar(*start));
- printf("%s ", pchar(*stop));
- printf("%ld-%ld\n", (long)startst, (long)stopst);
-}
-
-#ifndef PCHARDONE
-#define PCHARDONE /* never again */
-/*
- - pchar - make a character printable
- == #ifdef REDEBUG
- == static char *pchar(int ch);
- == #endif
- *
- * Is this identical to regchar() over in debug.c? Well, yes. But a
- * duplicate here avoids having a debugging-capable regexec.o tied to
- * a matching debug.o, and this is convenient. It all disappears in
- * the non-debug compilation anyway, so it doesn't matter much.
- */
-static char * /* -> representation */
-pchar(ch)
-int ch;
-{
- static char pbuf[10];
-
- if (isprint(ch) || ch == ' ')
- sprintf(pbuf, "%c", ch);
- else
- sprintf(pbuf, "\\%o", ch);
- return(pbuf);
-}
-#endif
-#endif
-
-#undef matcher
-#undef fast
-#undef slow
-#undef dissect
-#undef backref
-#undef step
-#undef print
-#undef at
-#undef match
diff --git a/winsup/cygwin/regex/engine.ih b/winsup/cygwin/regex/engine.ih
deleted file mode 100644
index cc98334e7..000000000
--- a/winsup/cygwin/regex/engine.ih
+++ /dev/null
@@ -1,35 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === engine.c === */
-static int matcher(register struct re_guts *g, char *string, size_t nmatch, regmatch_t pmatch[], int eflags);
-static char *dissect(register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static char *backref(register struct match *m, char *start, char *stop, sopno startst, sopno stopst, sopno lev);
-static char *fast(register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static char *slow(register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static states step(register struct re_guts *g, sopno start, sopno stop, register states bef, int ch, register states aft);
-#define BOL (OUT+1)
-#define EOL (BOL+1)
-#define BOLEOL (BOL+2)
-#define NOTHING (BOL+3)
-#define BOW (BOL+4)
-#define EOW (BOL+5)
-#define CODEMAX (BOL+5) /* highest code used */
-#define NONCHAR(c) ((c) > CHAR_MAX)
-#define NNONCHAR (CODEMAX-CHAR_MAX)
-#ifdef REDEBUG
-static void print(struct match *m, char *caption, states st, int ch, FILE *d);
-#endif
-#ifdef REDEBUG
-static void at(struct match *m, char *title, char *start, char *stop, sopno startst, sopno stopst);
-#endif
-#ifdef REDEBUG
-static char *pchar(int ch);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/winsup/cygwin/regex/mkh b/winsup/cygwin/regex/mkh
deleted file mode 100755
index 252b246c7..000000000
--- a/winsup/cygwin/regex/mkh
+++ /dev/null
@@ -1,76 +0,0 @@
-#! /bin/sh
-# mkh - pull headers out of C source
-PATH=/bin:/usr/bin ; export PATH
-
-# egrep pattern to pick out marked lines
-egrep='^ =([ ]|$)'
-
-# Sed program to process marked lines into lines for the header file.
-# The markers have already been removed. Two things are done here: removal
-# of backslashed newlines, and some fudging of comments. The first is done
-# because -o needs to have prototypes on one line to strip them down.
-# Getting comments into the output is tricky; we turn C++-style // comments
-# into /* */ comments, after altering any existing */'s to avoid trouble.
-peel=' /\\$/N
- /\\\n[ ]*/s///g
- /\/\//s;\*/;* /;g
- /\/\//s;//\(.*\);/*\1 */;'
-
-for a
-do
- case "$a" in
- -o) # old (pre-function-prototype) compiler
- # add code to comment out argument lists
- peel="$peel
- "'/^\([^#\/][^\/]*[a-zA-Z0-9_)]\)(\(.*\))/s;;\1(/*\2*/);'
- shift
- ;;
- -b) # funny Berkeley __P macro
- peel="$peel
- "'/^\([^#\/][^\/]*[a-zA-Z0-9_)]\)(\(.*\))/s;;\1 __P((\2));'
- shift
- ;;
- -s) # compiler doesn't like `static foo();'
- # add code to get rid of the `static'
- peel="$peel
- "'/^static[ ][^\/]*[a-zA-Z0-9_)](.*)/s;static.;;'
- shift
- ;;
- -p) # private declarations
- egrep='^ ==([ ]|$)'
- shift
- ;;
- -i) # wrap in #ifndef, argument is name
- ifndef="$2"
- shift ; shift
- ;;
- *) break
- ;;
- esac
-done
-
-if test " $ifndef" != " "
-then
- echo "#ifndef $ifndef"
- echo "#define $ifndef /* never again */"
-fi
-echo "/* ========= begin header generated by $0 ========= */"
-echo '#ifdef __cplusplus'
-echo 'extern "C" {'
-echo '#endif'
-for f
-do
- echo
- echo "/* === $f === */"
- egrep "$egrep" $f | sed 's/^ ==*[ ]//;s/^ ==*$//' | sed "$peel"
- echo
-done
-echo '#ifdef __cplusplus'
-echo '}'
-echo '#endif'
-echo "/* ========= end header generated by $0 ========= */"
-if test " $ifndef" != " "
-then
- echo "#endif"
-fi
-exit 0
diff --git a/winsup/cygwin/regex/regcomp.c b/winsup/cygwin/regex/regcomp.c
deleted file mode 100644
index 52f9037de..000000000
--- a/winsup/cygwin/regex/regcomp.c
+++ /dev/null
@@ -1,1546 +0,0 @@
-#include "winsup.h"
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdlib.h>
-#include "regex.h"
-
-#include "utils.h"
-#include "regex2.h"
-
-#include "cclass.h"
-#include "cname.h"
-
-/*
- * parse structure, passed up and down to avoid global variables and
- * other clumsinesses
- */
-struct parse {
- char *next; /* next character in RE */
- char *end; /* end of string (-> NUL normally) */
- int error; /* has an error been seen? */
- sop *strip; /* malloced strip */
- sopno ssize; /* malloced strip size (allocated) */
- sopno slen; /* malloced strip length (used) */
- int ncsalloc; /* number of csets allocated */
- struct re_guts *g;
-# define NPAREN 10 /* we need to remember () 1-9 for back refs */
- sopno pbegin[NPAREN]; /* -> ( ([0] unused) */
- sopno pend[NPAREN]; /* -> ) ([0] unused) */
-};
-
-#include "regcomp.ih"
-
-static char nuls[10]; /* place to point scanner in event of error */
-
-/*
- * macros for use with parse structure
- * BEWARE: these know that the parse structure is named `p' !!!
- */
-#define PEEK() (*p->next)
-#define PEEK2() (*(p->next+1))
-#define MORE() (p->next < p->end)
-#define MORE2() (p->next+1 < p->end)
-#define SEE(c) (MORE() && PEEK() == (c))
-#define SEETWO(a, b) (MORE() && MORE2() && PEEK() == (a) && PEEK2() == (b))
-#define EAT(c) ((SEE(c)) ? (NEXT(), 1) : 0)
-#define EATTWO(a, b) ((SEETWO(a, b)) ? (NEXT2(), 1) : 0)
-#define NEXT() (p->next++)
-#define NEXT2() (p->next += 2)
-#define NEXTn(n) (p->next += (n))
-#define GETNEXT() (*p->next++)
-#define SETERROR(e) seterr(p, (e))
-#define REQUIRE(co, e) (void) ((co) || SETERROR(e))
-#define MUSTSEE(c, e) (REQUIRE(MORE() && PEEK() == (c), e))
-#define MUSTEAT(c, e) (REQUIRE(MORE() && GETNEXT() == (c), e))
-#define MUSTNOTSEE(c, e) (REQUIRE(!MORE() || PEEK() != (c), e))
-#define EMIT(op, sopnd) doemit(p, (sop)(op), (size_t)(sopnd))
-#define INSERT(op, pos) doinsert(p, (sop)(op), HERE()-(pos)+1, pos)
-#define AHEAD(pos) dofwd(p, pos, HERE()-(pos))
-#define ASTERN(sop, pos) EMIT(sop, HERE()-pos)
-#define HERE() (p->slen)
-#define THERE() (p->slen - 1)
-#define THERETHERE() (p->slen - 2)
-#define DROP(n) (p->slen -= (n))
-
-#ifndef NDEBUG
-static int never = 0; /* for use in asserts; shuts lint up */
-#else
-#define never 0 /* some <assert.h>s have bugs too */
-#endif
-
-/*
- - regcomp - interface for parser and compilation
- = extern int regcomp(regex_t *, const char *, int);
- = #define REG_BASIC 0000
- = #define REG_EXTENDED 0001
- = #define REG_ICASE 0002
- = #define REG_NOSUB 0004
- = #define REG_NEWLINE 0010
- = #define REG_NOSPEC 0020
- = #define REG_PEND 0040
- = #define REG_DUMP 0200
- */
-int /* 0 success, otherwise REG_something */
-regcomp(preg, pattern, cflags)
-regex_t *preg;
-const char *pattern;
-int cflags;
-{
- struct parse pa;
- register struct re_guts *g;
- register struct parse *p = &pa;
- register int i;
- register size_t len;
-#ifdef REDEBUG
-# define GOODFLAGS(f) (f)
-#else
-# define GOODFLAGS(f) ((f)&~REG_DUMP)
-#endif
-
- cflags = GOODFLAGS(cflags);
- if ((cflags&REG_EXTENDED) && (cflags&REG_NOSPEC))
- return(REG_INVARG);
-
- if (cflags&REG_PEND) {
- if (preg->re_endp < pattern)
- return(REG_INVARG);
- len = preg->re_endp - pattern;
- } else
- len = strlen((char *)pattern);
-
- /* do the mallocs early so failure handling is easy */
- g = (struct re_guts *)malloc(sizeof(struct re_guts) +
- (NC-1)*sizeof(cat_t));
- if (g == NULL)
- return(REG_ESPACE);
- p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */
- p->strip = (sop *)malloc(p->ssize * sizeof(sop));
- p->slen = 0;
- if (p->strip == NULL) {
- free((char *)g);
- return(REG_ESPACE);
- }
-
- /* set things up */
- p->g = g;
- p->next = (char *)pattern; /* convenience; we do not modify it */
- p->end = p->next + len;
- p->error = 0;
- p->ncsalloc = 0;
- for (i = 0; i < NPAREN; i++) {
- p->pbegin[i] = 0;
- p->pend[i] = 0;
- }
- g->csetsize = NC;
- g->sets = NULL;
- g->setbits = NULL;
- g->ncsets = 0;
- g->cflags = cflags;
- g->iflags = 0;
- g->nbol = 0;
- g->neol = 0;
- g->must = NULL;
- g->mlen = 0;
- g->nsub = 0;
- g->ncategories = 1; /* category 0 is "everything else" */
- g->categories = &g->catspace[-(CHAR_MIN)];
- (void) memset((char *)g->catspace, 0, NC*sizeof(cat_t));
- g->backrefs = 0;
-
- /* do it */
- EMIT(OEND, 0);
- g->firststate = THERE();
- if (cflags&REG_EXTENDED)
- p_ere(p, OUT);
- else if (cflags&REG_NOSPEC)
- p_str(p);
- else
- p_bre(p, OUT, OUT);
- EMIT(OEND, 0);
- g->laststate = THERE();
-
- /* tidy up loose ends and fill things in */
- categorize(p, g);
- stripsnug(p, g);
- findmust(p, g);
- g->nplus = pluscount(p, g);
- g->magic = MAGIC2;
- preg->re_nsub = g->nsub;
- preg->re_g = g;
- preg->re_magic = MAGIC1;
-#ifndef REDEBUG
- /* not debugging, so can't rely on the assert() in regexec() */
- if (g->iflags&BAD)
- SETERROR(REG_ASSERT);
-#endif
-
- /* win or lose, we're done */
- if (p->error != 0) /* lose */
- regfree(preg);
- return(p->error);
-}
-
-/*
- - p_ere - ERE parser top level, concatenation and alternation
- == static void p_ere(register struct parse *p, int stop);
- */
-static void
-p_ere(p, stop)
-register struct parse *p;
-int stop; /* character this ERE should end at */
-{
- register char c;
- register sopno prevback = 0;
- register sopno prevfwd = 0;
- register sopno conc = 0;
- register int first = 1; /* is this the first alternative? */
-
- for (;;) {
- /* do a bunch of concatenated expressions */
- conc = HERE();
- while (MORE() && (c = PEEK()) != '|' && c != stop)
- p_ere_exp(p);
- REQUIRE(HERE() != conc, REG_EMPTY); /* require nonempty */
-
- if (!EAT('|'))
- break; /* NOTE BREAK OUT */
-
- if (first) {
- INSERT(OCH_, conc); /* offset is wrong */
- prevfwd = conc;
- prevback = conc;
- first = 0;
- }
- ASTERN(OOR1, prevback);
- prevback = THERE();
- AHEAD(prevfwd); /* fix previous offset */
- prevfwd = HERE();
- EMIT(OOR2, 0); /* offset is very wrong */
- }
-
- if (!first) { /* tail-end fixups */
- AHEAD(prevfwd);
- ASTERN(O_CH, prevback);
- }
-
- assert(!MORE() || SEE(stop));
-}
-
-/*
- - p_ere_exp - parse one subERE, an atom possibly followed by a repetition op
- == static void p_ere_exp(register struct parse *p);
- */
-static void
-p_ere_exp(p)
-register struct parse *p;
-{
- register char c;
- register sopno pos;
- register int count;
- register int count2;
- register sopno subno;
- int wascaret = 0;
-
- assert(MORE()); /* caller should have ensured this */
- c = GETNEXT();
-
- pos = HERE();
- switch (c) {
- case '(':
- REQUIRE(MORE(), REG_EPAREN);
- p->g->nsub++;
- subno = p->g->nsub;
- if (subno < NPAREN)
- p->pbegin[subno] = HERE();
- EMIT(OLPAREN, subno);
- if (!SEE(')'))
- p_ere(p, ')');
- if (subno < NPAREN) {
- p->pend[subno] = HERE();
- assert(p->pend[subno] != 0);
- }
- EMIT(ORPAREN, subno);
- MUSTEAT(')', REG_EPAREN);
- break;
-#ifndef POSIX_MISTAKE
- case ')': /* happens only if no current unmatched ( */
- /*
- * You may ask, why the ifndef? Because I didn't notice
- * this until slightly too late for 1003.2, and none of the
- * other 1003.2 regular-expression reviewers noticed it at
- * all. So an unmatched ) is legal POSIX, at least until
- * we can get it fixed.
- */
- SETERROR(REG_EPAREN);
- break;
-#endif
- case '^':
- EMIT(OBOL, 0);
- p->g->iflags |= USEBOL;
- p->g->nbol++;
- wascaret = 1;
- break;
- case '$':
- EMIT(OEOL, 0);
- p->g->iflags |= USEEOL;
- p->g->neol++;
- break;
- case '|':
- SETERROR(REG_EMPTY);
- break;
- case '*':
- case '+':
- case '?':
- SETERROR(REG_BADRPT);
- break;
- case '.':
- if (p->g->cflags&REG_NEWLINE)
- nonnewline(p);
- else
- EMIT(OANY, 0);
- break;
- case '[':
- p_bracket(p);
- break;
- case '\\':
- REQUIRE(MORE(), REG_EESCAPE);
- c = GETNEXT();
- ordinary(p, c);
- break;
- case '{': /* okay as ordinary except if digit follows */
- REQUIRE(!MORE() || !isdigit(PEEK()), REG_BADRPT);
- /* FALLTHROUGH */
- default:
- ordinary(p, c);
- break;
- }
-
- if (!MORE())
- return;
- c = PEEK();
- /* we call { a repetition if followed by a digit */
- if (!( c == '*' || c == '+' || c == '?' ||
- (c == '{' && MORE2() && isdigit(PEEK2())) ))
- return; /* no repetition, we're done */
- NEXT();
-
- REQUIRE(!wascaret, REG_BADRPT);
- switch (c) {
- case '*': /* implemented as +? */
- /* this case does not require the (y|) trick, noKLUDGE */
- INSERT(OPLUS_, pos);
- ASTERN(O_PLUS, pos);
- INSERT(OQUEST_, pos);
- ASTERN(O_QUEST, pos);
- break;
- case '+':
- INSERT(OPLUS_, pos);
- ASTERN(O_PLUS, pos);
- break;
- case '?':
- /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
- INSERT(OCH_, pos); /* offset slightly wrong */
- ASTERN(OOR1, pos); /* this one's right */
- AHEAD(pos); /* fix the OCH_ */
- EMIT(OOR2, 0); /* offset very wrong... */
- AHEAD(THERE()); /* ...so fix it */
- ASTERN(O_CH, THERETHERE());
- break;
- case '{':
- count = p_count(p);
- if (EAT(',')) {
- if (isdigit(PEEK())) {
- count2 = p_count(p);
- REQUIRE(count <= count2, REG_BADBR);
- } else /* single number with comma */
- count2 = INFINITY;
- } else /* just a single number */
- count2 = count;
- repeat(p, pos, count, count2);
- if (!EAT('}')) { /* error heuristics */
- while (MORE() && PEEK() != '}')
- NEXT();
- REQUIRE(MORE(), REG_EBRACE);
- SETERROR(REG_BADBR);
- }
- break;
- }
-
- if (!MORE())
- return;
- c = PEEK();
- if (!( c == '*' || c == '+' || c == '?' ||
- (c == '{' && MORE2() && isdigit(PEEK2())) ) )
- return;
- SETERROR(REG_BADRPT);
-}
-
-/*
- - p_str - string (no metacharacters) "parser"
- == static void p_str(register struct parse *p);
- */
-static void
-p_str(p)
-register struct parse *p;
-{
- REQUIRE(MORE(), REG_EMPTY);
- while (MORE())
- ordinary(p, GETNEXT());
-}
-
-/*
- - p_bre - BRE parser top level, anchoring and concatenation
- == static void p_bre(register struct parse *p, register int end1, \
- == register int end2);
- * Giving end1 as OUT essentially eliminates the end1/end2 check.
- *
- * This implementation is a bit of a kludge, in that a trailing $ is first
- * taken as an ordinary character and then revised to be an anchor. The
- * only undesirable side effect is that '$' gets included as a character
- * category in such cases. This is fairly harmless; not worth fixing.
- * The amount of lookahead needed to avoid this kludge is excessive.
- */
-static void
-p_bre(p, end1, end2)
-register struct parse *p;
-register int end1; /* first terminating character */
-register int end2; /* second terminating character */
-{
- register sopno start = HERE();
- register int first = 1; /* first subexpression? */
- register int wasdollar = 0;
-
- if (EAT('^')) {
- EMIT(OBOL, 0);
- p->g->iflags |= USEBOL;
- p->g->nbol++;
- }
- while (MORE() && !SEETWO(end1, end2)) {
- wasdollar = p_simp_re(p, first);
- first = 0;
- }
- if (wasdollar) { /* oops, that was a trailing anchor */
- DROP(1);
- EMIT(OEOL, 0);
- p->g->iflags |= USEEOL;
- p->g->neol++;
- }
-
- REQUIRE(HERE() != start, REG_EMPTY); /* require nonempty */
-}
-
-/*
- - p_simp_re - parse a simple RE, an atom possibly followed by a repetition
- == static int p_simp_re(register struct parse *p, int starordinary);
- */
-static int /* was the simple RE an unbackslashed $? */
-p_simp_re(p, starordinary)
-register struct parse *p;
-int starordinary; /* is a leading * an ordinary character? */
-{
- register int c;
- register int count;
- register int count2;
- register sopno pos;
- register int i;
- register sopno subno;
-# define BACKSL (1<<CHAR_BIT)
-
- pos = HERE(); /* repetion op, if any, covers from here */
-
- assert(MORE()); /* caller should have ensured this */
- c = GETNEXT();
- if (c == '\\') {
- REQUIRE(MORE(), REG_EESCAPE);
- c = BACKSL | (unsigned char)GETNEXT();
- }
- switch (c) {
- case '.':
- if (p->g->cflags&REG_NEWLINE)
- nonnewline(p);
- else
- EMIT(OANY, 0);
- break;
- case '[':
- p_bracket(p);
- break;
- case BACKSL|'{':
- SETERROR(REG_BADRPT);
- break;
- case BACKSL|'(':
- p->g->nsub++;
- subno = p->g->nsub;
- if (subno < NPAREN)
- p->pbegin[subno] = HERE();
- EMIT(OLPAREN, subno);
- /* the MORE here is an error heuristic */
- if (MORE() && !SEETWO('\\', ')'))
- p_bre(p, '\\', ')');
- if (subno < NPAREN) {
- p->pend[subno] = HERE();
- assert(p->pend[subno] != 0);
- }
- EMIT(ORPAREN, subno);
- REQUIRE(EATTWO('\\', ')'), REG_EPAREN);
- break;
- case BACKSL|')': /* should not get here -- must be user */
- case BACKSL|'}':
- SETERROR(REG_EPAREN);
- break;
- case BACKSL|'1':
- case BACKSL|'2':
- case BACKSL|'3':
- case BACKSL|'4':
- case BACKSL|'5':
- case BACKSL|'6':
- case BACKSL|'7':
- case BACKSL|'8':
- case BACKSL|'9':
- i = (c&~BACKSL) - '0';
- assert(i < NPAREN);
- if (p->pend[i] != 0) {
- assert(i <= p->g->nsub);
- EMIT(OBACK_, i);
- assert(p->pbegin[i] != 0);
- assert(OP(p->strip[p->pbegin[i]]) == OLPAREN);
- assert(OP(p->strip[p->pend[i]]) == ORPAREN);
- (void) dupl(p, p->pbegin[i]+1, p->pend[i]);
- EMIT(O_BACK, i);
- } else
- SETERROR(REG_ESUBREG);
- p->g->backrefs = 1;
- break;
- case '*':
- REQUIRE(starordinary, REG_BADRPT);
- /* FALLTHROUGH */
- default:
- ordinary(p, (char)c); /* takes off BACKSL, if any */
- break;
- }
-
- if (EAT('*')) { /* implemented as +? */
- /* this case does not require the (y|) trick, noKLUDGE */
- INSERT(OPLUS_, pos);
- ASTERN(O_PLUS, pos);
- INSERT(OQUEST_, pos);
- ASTERN(O_QUEST, pos);
- } else if (EATTWO('\\', '{')) {
- count = p_count(p);
- if (EAT(',')) {
- if (MORE() && isdigit(PEEK())) {
- count2 = p_count(p);
- REQUIRE(count <= count2, REG_BADBR);
- } else /* single number with comma */
- count2 = INFINITY;
- } else /* just a single number */
- count2 = count;
- repeat(p, pos, count, count2);
- if (!EATTWO('\\', '}')) { /* error heuristics */
- while (MORE() && !SEETWO('\\', '}'))
- NEXT();
- REQUIRE(MORE(), REG_EBRACE);
- SETERROR(REG_BADBR);
- }
- } else if (c == (unsigned char)'$') /* $ (but not \$) ends it */
- return(1);
-
- return(0);
-}
-
-/*
- - p_count - parse a repetition count
- == static int p_count(register struct parse *p);
- */
-static int /* the value */
-p_count(p)
-register struct parse *p;
-{
- register int count = 0;
- register int ndigits = 0;
-
- while (MORE() && isdigit(PEEK()) && count <= DUPMAX) {
- count = count*10 + (GETNEXT() - '0');
- ndigits++;
- }
-
- REQUIRE(ndigits > 0 && count <= DUPMAX, REG_BADBR);
- return(count);
-}
-
-/*
- - p_bracket - parse a bracketed character list
- == static void p_bracket(register struct parse *p);
- *
- * Note a significant property of this code: if the allocset() did SETERROR,
- * no set operations are done.
- */
-static void
-p_bracket(p)
-register struct parse *p;
-{
- register cset *cs = allocset(p);
- register int invert = 0;
-
- /* Dept of Truly Sickening Special-Case Kludges */
- if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0) {
- EMIT(OBOW, 0);
- NEXTn(6);
- return;
- }
- if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0) {
- EMIT(OEOW, 0);
- NEXTn(6);
- return;
- }
-
- if (EAT('^'))
- invert++; /* make note to invert set at end */
- if (EAT(']'))
- CHadd(cs, ']');
- else if (EAT('-'))
- CHadd(cs, '-');
- while (MORE() && PEEK() != ']' && !SEETWO('-', ']'))
- p_b_term(p, cs);
- if (EAT('-'))
- CHadd(cs, '-');
- MUSTEAT(']', REG_EBRACK);
-
- if (p->error != 0) /* don't mess things up further */
- return;
-
- if (p->g->cflags&REG_ICASE) {
- register int i;
- register int ci;
-
- for (i = p->g->csetsize - 1; i >= 0; i--)
- if (CHIN(cs, i) && isalpha(i)) {
- ci = othercase(i);
- if (ci != i)
- CHadd(cs, ci);
- }
- if (cs->multis != NULL)
- mccase(p, cs);
- }
- if (invert) {
- register int i;
-
- for (i = p->g->csetsize - 1; i >= 0; i--)
- if (CHIN(cs, i))
- CHsub(cs, i);
- else
- CHadd(cs, i);
- if (p->g->cflags&REG_NEWLINE)
- CHsub(cs, '\n');
- if (cs->multis != NULL)
- mcinvert(p, cs);
- }
-
- assert(cs->multis == NULL); /* xxx */
-
- if (nch(p, cs) == 1) { /* optimize singleton sets */
- ordinary(p, firstch(p, cs));
- freeset(p, cs);
- } else
- EMIT(OANYOF, freezeset(p, cs));
-}
-
-/*
- - p_b_term - parse one term of a bracketed character list
- == static void p_b_term(register struct parse *p, register cset *cs);
- */
-static void
-p_b_term(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register char c;
- register char start, finish;
- register int i;
-
- /* classify what we've got */
- switch ((MORE()) ? PEEK() : '\0') {
- case '[':
- c = (MORE2()) ? PEEK2() : '\0';
- break;
- case '-':
- SETERROR(REG_ERANGE);
- return; /* NOTE RETURN */
- break;
- default:
- c = '\0';
- break;
- }
-
- switch (c) {
- case ':': /* character class */
- NEXT2();
- REQUIRE(MORE(), REG_EBRACK);
- c = PEEK();
- REQUIRE(c != '-' && c != ']', REG_ECTYPE);
- p_b_cclass(p, cs);
- REQUIRE(MORE(), REG_EBRACK);
- REQUIRE(EATTWO(':', ']'), REG_ECTYPE);
- break;
- case '=': /* equivalence class */
- NEXT2();
- REQUIRE(MORE(), REG_EBRACK);
- c = PEEK();
- REQUIRE(c != '-' && c != ']', REG_ECOLLATE);
- p_b_eclass(p, cs);
- REQUIRE(MORE(), REG_EBRACK);
- REQUIRE(EATTWO('=', ']'), REG_ECOLLATE);
- break;
- default: /* symbol, ordinary character, or range */
-/* xxx revision needed for multichar stuff */
- start = p_b_symbol(p);
- if (SEE('-') && MORE2() && PEEK2() != ']') {
- /* range */
- NEXT();
- if (EAT('-'))
- finish = '-';
- else
- finish = p_b_symbol(p);
- } else
- finish = start;
-/* xxx what about signed chars here... */
- REQUIRE(start <= finish, REG_ERANGE);
- for (i = start; i <= finish; i++)
- CHadd(cs, i);
- break;
- }
-}
-
-/*
- - p_b_cclass - parse a character-class name and deal with it
- == static void p_b_cclass(register struct parse *p, register cset *cs);
- */
-static void
-p_b_cclass(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register char *sp = p->next;
- register struct cclass *cp;
- register size_t len;
- register const char *u;
- register char c;
-
- while (MORE() && isalpha(PEEK()))
- NEXT();
- len = p->next - sp;
- for (cp = cclasses; cp->name != NULL; cp++)
- if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
- break;
- if (cp->name == NULL) {
- /* oops, didn't find it */
- SETERROR(REG_ECTYPE);
- return;
- }
-
- u = cp->chars;
- while ((c = *u++) != '\0')
- CHadd(cs, c);
- for (u = cp->multis; *u != '\0'; u += strlen(u) + 1)
- MCadd(p, cs, u);
-}
-
-/*
- - p_b_eclass - parse an equivalence-class name and deal with it
- == static void p_b_eclass(register struct parse *p, register cset *cs);
- *
- * This implementation is incomplete. xxx
- */
-static void
-p_b_eclass(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register char c;
-
- c = p_b_coll_elem(p, '=');
- CHadd(cs, c);
-}
-
-/*
- - p_b_symbol - parse a character or [..]ed multicharacter collating symbol
- == static char p_b_symbol(register struct parse *p);
- */
-static char /* value of symbol */
-p_b_symbol(p)
-register struct parse *p;
-{
- register char value;
-
- REQUIRE(MORE(), REG_EBRACK);
- if (!EATTWO('[', '.'))
- return(GETNEXT());
-
- /* collating symbol */
- value = p_b_coll_elem(p, '.');
- REQUIRE(EATTWO('.', ']'), REG_ECOLLATE);
- return(value);
-}
-
-/*
- - p_b_coll_elem - parse a collating-element name and look it up
- == static char p_b_coll_elem(register struct parse *p, int endc);
- */
-static char /* value of collating element */
-p_b_coll_elem(p, endc)
-register struct parse *p;
-int endc; /* name ended by endc,']' */
-{
- register char *sp = p->next;
- register struct cname *cp;
- register int len;
-
- while (MORE() && !SEETWO(endc, ']'))
- NEXT();
- if (!MORE()) {
- SETERROR(REG_EBRACK);
- return(0);
- }
- len = p->next - sp;
- for (cp = cnames; cp->name != NULL; cp++)
- if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
- return(cp->code); /* known name */
- if (len == 1)
- return(*sp); /* single character */
- SETERROR(REG_ECOLLATE); /* neither */
- return(0);
-}
-
-/*
- - othercase - return the case counterpart of an alphabetic
- == static char othercase(int ch);
- */
-static char /* if no counterpart, return ch */
-othercase(ch)
-int ch;
-{
- assert(isalpha(ch));
- if (isupper(ch))
- return(tolower(ch));
- else if (islower(ch))
- return(toupper(ch));
- else /* peculiar, but could happen */
- return(ch);
-}
-
-/*
- - bothcases - emit a dualcase version of a two-case character
- == static void bothcases(register struct parse *p, int ch);
- *
- * Boy, is this implementation ever a kludge...
- */
-static void
-bothcases(p, ch)
-register struct parse *p;
-int ch;
-{
- register char *oldnext = p->next;
- register char *oldend = p->end;
- char bracket[3];
-
- assert(othercase(ch) != ch); /* p_bracket() would recurse */
- p->next = bracket;
- p->end = bracket+2;
- bracket[0] = ch;
- bracket[1] = ']';
- bracket[2] = '\0';
- p_bracket(p);
- assert(p->next == bracket+2);
- p->next = oldnext;
- p->end = oldend;
-}
-
-/*
- - ordinary - emit an ordinary character
- == static void ordinary(register struct parse *p, register int ch);
- */
-static void
-ordinary(p, ch)
-register struct parse *p;
-register int ch;
-{
- register cat_t *cap = p->g->categories;
-
- if ((p->g->cflags&REG_ICASE) && isalpha(ch) && othercase(ch) != ch)
- bothcases(p, ch);
- else {
- EMIT(OCHAR, (unsigned char)ch);
- if (cap[ch] == 0)
- cap[ch] = p->g->ncategories++;
- }
-}
-
-/*
- - nonnewline - emit REG_NEWLINE version of OANY
- == static void nonnewline(register struct parse *p);
- *
- * Boy, is this implementation ever a kludge...
- */
-static void
-nonnewline(p)
-register struct parse *p;
-{
- register char *oldnext = p->next;
- register char *oldend = p->end;
- char bracket[4];
-
- p->next = bracket;
- p->end = bracket+3;
- bracket[0] = '^';
- bracket[1] = '\n';
- bracket[2] = ']';
- bracket[3] = '\0';
- p_bracket(p);
- assert(p->next == bracket+3);
- p->next = oldnext;
- p->end = oldend;
-}
-
-/*
- - repeat - generate code for a bounded repetition, recursively if needed
- == static void repeat(register struct parse *p, sopno start, int from, int to);
- */
-static void
-repeat(p, start, from, to)
-register struct parse *p;
-sopno start; /* operand from here to end of strip */
-int from; /* repeated from this number */
-int to; /* to this number of times (maybe INFINITY) */
-{
- register sopno finish = HERE();
-# define N 2
-# define INF 3
-# define REP(f, t) ((f)*8 + (t))
-# define MAP(n) (((n) <= 1) ? (n) : ((n) == INFINITY) ? INF : N)
- register sopno copy;
-
- if (p->error != 0) /* head off possible runaway recursion */
- return;
-
- assert(from <= to);
-
- switch (REP(MAP(from), MAP(to))) {
- case REP(0, 0): /* must be user doing this */
- DROP(finish-start); /* drop the operand */
- break;
- case REP(0, 1): /* as x{1,1}? */
- case REP(0, N): /* as x{1,n}? */
- case REP(0, INF): /* as x{1,}? */
- /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
- INSERT(OCH_, start); /* offset is wrong... */
- repeat(p, start+1, 1, to);
- ASTERN(OOR1, start);
- AHEAD(start); /* ... fix it */
- EMIT(OOR2, 0);
- AHEAD(THERE());
- ASTERN(O_CH, THERETHERE());
- break;
- case REP(1, 1): /* trivial case */
- /* done */
- break;
- case REP(1, N): /* as x?x{1,n-1} */
- /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
- INSERT(OCH_, start);
- ASTERN(OOR1, start);
- AHEAD(start);
- EMIT(OOR2, 0); /* offset very wrong... */
- AHEAD(THERE()); /* ...so fix it */
- ASTERN(O_CH, THERETHERE());
- copy = dupl(p, start+1, finish+1);
- assert(copy == finish+4);
- repeat(p, copy, 1, to-1);
- break;
- case REP(1, INF): /* as x+ */
- INSERT(OPLUS_, start);
- ASTERN(O_PLUS, start);
- break;
- case REP(N, N): /* as xx{m-1,n-1} */
- copy = dupl(p, start, finish);
- repeat(p, copy, from-1, to-1);
- break;
- case REP(N, INF): /* as xx{n-1,INF} */
- copy = dupl(p, start, finish);
- repeat(p, copy, from-1, to);
- break;
- default: /* "can't happen" */
- SETERROR(REG_ASSERT); /* just in case */
- break;
- }
-}
-
-/*
- - seterr - set an error condition
- == static int seterr(register struct parse *p, int e);
- */
-static int /* useless but makes type checking happy */
-seterr(p, e)
-register struct parse *p;
-int e;
-{
- if (p->error == 0) /* keep earliest error condition */
- p->error = e;
- p->next = nuls; /* try to bring things to a halt */
- p->end = nuls;
- return(0); /* make the return value well-defined */
-}
-
-/*
- - allocset - allocate a set of characters for []
- == static cset *allocset(register struct parse *p);
- */
-static cset *
-allocset(p)
-register struct parse *p;
-{
- register int no = p->g->ncsets++;
- register size_t nc;
- register size_t nbytes;
- register cset *cs;
- register size_t css = (size_t)p->g->csetsize;
- register int i;
-
- if (no >= p->ncsalloc) { /* need another column of space */
- p->ncsalloc += CHAR_BIT;
- nc = p->ncsalloc;
- assert(nc % CHAR_BIT == 0);
- nbytes = nc / CHAR_BIT * css;
- if (p->g->sets == NULL)
- p->g->sets = (cset *)malloc(nc * sizeof(cset));
- else
- p->g->sets = (cset *)realloc((char *)p->g->sets,
- nc * sizeof(cset));
- if (p->g->setbits == NULL)
- p->g->setbits = (uch *)malloc(nbytes);
- else {
- p->g->setbits = (uch *)realloc((char *)p->g->setbits,
- nbytes);
- /* xxx this isn't right if setbits is now NULL */
- for (i = 0; i < no; i++)
- p->g->sets[i].ptr = p->g->setbits + css*(i/CHAR_BIT);
- }
- if (p->g->sets != NULL && p->g->setbits != NULL)
- (void) memset((char *)p->g->setbits + (nbytes - css),
- 0, css);
- else {
- no = 0;
- SETERROR(REG_ESPACE);
- /* caller's responsibility not to do set ops */
- }
- }
-
- assert(p->g->sets != NULL); /* xxx */
- cs = &p->g->sets[no];
- cs->ptr = p->g->setbits + css*((no)/CHAR_BIT);
- cs->mask = 1 << ((no) % CHAR_BIT);
- cs->hash = 0;
- cs->smultis = 0;
- cs->multis = NULL;
-
- return(cs);
-}
-
-/*
- - freeset - free a now-unused set
- == static void freeset(register struct parse *p, register cset *cs);
- */
-static void
-freeset(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register int i;
- register cset *top = &p->g->sets[p->g->ncsets];
- register size_t css = (size_t)p->g->csetsize;
-
- for (i = 0; i < css; i++)
- CHsub(cs, i);
- if (cs == top-1) /* recover only the easy case */
- p->g->ncsets--;
-}
-
-/*
- - freezeset - final processing on a set of characters
- == static int freezeset(register struct parse *p, register cset *cs);
- *
- * The main task here is merging identical sets. This is usually a waste
- * of time (although the hash code minimizes the overhead), but can win
- * big if REG_ICASE is being used. REG_ICASE, by the way, is why the hash
- * is done using addition rather than xor -- all ASCII [aA] sets xor to
- * the same value!
- */
-static int /* set number */
-freezeset(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register uch h = cs->hash;
- register int i;
- register cset *top = &p->g->sets[p->g->ncsets];
- register cset *cs2;
- register size_t css = (size_t)p->g->csetsize;
-
- /* look for an earlier one which is the same */
- for (cs2 = &p->g->sets[0]; cs2 < top; cs2++)
- if (cs2->hash == h && cs2 != cs) {
- /* maybe */
- for (i = 0; i < css; i++)
- if (!!CHIN(cs2, i) != !!CHIN(cs, i))
- break; /* no */
- if (i == css)
- break; /* yes */
- }
-
- if (cs2 < top) { /* found one */
- freeset(p, cs);
- cs = cs2;
- }
-
- return((int)(cs - p->g->sets));
-}
-
-/*
- - firstch - return first character in a set (which must have at least one)
- == static int firstch(register struct parse *p, register cset *cs);
- */
-static int /* character; there is no "none" value */
-firstch(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register int i;
- register size_t css = (size_t)p->g->csetsize;
-
- for (i = 0; i < css; i++)
- if (CHIN(cs, i))
- return((char)i);
- assert(never);
- return(0); /* arbitrary */
-}
-
-/*
- - nch - number of characters in a set
- == static int nch(register struct parse *p, register cset *cs);
- */
-static int
-nch(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register int i;
- register size_t css = (size_t)p->g->csetsize;
- register int n = 0;
-
- for (i = 0; i < css; i++)
- if (CHIN(cs, i))
- n++;
- return(n);
-}
-
-/*
- - mcadd - add a collating element to a cset
- == static void mcadd(register struct parse *p, register cset *cs, \
- == register char *cp);
- */
-static void
-mcadd(p, cs, cp)
-register struct parse *p;
-register cset *cs;
-register const char *cp;
-{
- register size_t oldend = cs->smultis;
-
- cs->smultis += strlen(cp) + 1;
- if (cs->multis == NULL)
- cs->multis = malloc(cs->smultis);
- else
- cs->multis = realloc(cs->multis, cs->smultis);
- if (cs->multis == NULL) {
- SETERROR(REG_ESPACE);
- return;
- }
-
- (void) strcpy(cs->multis + oldend - 1, cp);
- cs->multis[cs->smultis - 1] = '\0';
-}
-
-/*
- - mcinvert - invert the list of collating elements in a cset
- == static void mcinvert(register struct parse *p, register cset *cs);
- *
- * This would have to know the set of possibilities. Implementation
- * is deferred.
- */
-static void
-mcinvert(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- assert(cs->multis == NULL); /* xxx */
-}
-
-/*
- - mccase - add case counterparts of the list of collating elements in a cset
- == static void mccase(register struct parse *p, register cset *cs);
- *
- * This would have to know the set of possibilities. Implementation
- * is deferred.
- */
-static void
-mccase(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- assert(cs->multis == NULL); /* xxx */
-}
-
-/*
- - isinsets - is this character in any sets?
- == static int isinsets(register struct re_guts *g, int c);
- */
-static int /* predicate */
-isinsets(g, c)
-register struct re_guts *g;
-int c;
-{
- register uch *col;
- register int i;
- register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
- register unsigned uc = (unsigned char)c;
-
- for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
- if (col[uc] != 0)
- return(1);
- return(0);
-}
-
-/*
- - samesets - are these two characters in exactly the same sets?
- == static int samesets(register struct re_guts *g, int c1, int c2);
- */
-static int /* predicate */
-samesets(g, c1, c2)
-register struct re_guts *g;
-int c1;
-int c2;
-{
- register uch *col;
- register int i;
- register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
- register unsigned uc1 = (unsigned char)c1;
- register unsigned uc2 = (unsigned char)c2;
-
- for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
- if (col[uc1] != col[uc2])
- return(0);
- return(1);
-}
-
-/*
- - categorize - sort out character categories
- == static void categorize(struct parse *p, register struct re_guts *g);
- */
-static void
-categorize(p, g)
-struct parse *p;
-register struct re_guts *g;
-{
- register cat_t *cats = g->categories;
- register int c;
- register int c2;
- register cat_t cat;
-
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- for (c = CHAR_MIN; c <= CHAR_MAX; c++)
- if (cats[c] == 0 && isinsets(g, c)) {
- cat = g->ncategories++;
- cats[c] = cat;
- for (c2 = c+1; c2 <= CHAR_MAX; c2++)
- if (cats[c2] == 0 && samesets(g, c, c2))
- cats[c2] = cat;
- }
-}
-
-/*
- - dupl - emit a duplicate of a bunch of sops
- == static sopno dupl(register struct parse *p, sopno start, sopno finish);
- */
-static sopno /* start of duplicate */
-dupl(p, start, finish)
-register struct parse *p;
-sopno start; /* from here */
-sopno finish; /* to this less one */
-{
- register sopno ret = HERE();
- register sopno len = finish - start;
-
- assert(finish >= start);
- if (len == 0)
- return(ret);
- enlarge(p, p->ssize + len); /* this many unexpected additions */
- assert(p->ssize >= p->slen + len);
- (void) memcpy((char *)(p->strip + p->slen),
- (char *)(p->strip + start), (size_t)len*sizeof(sop));
- p->slen += len;
- return(ret);
-}
-
-/*
- - doemit - emit a strip operator
- == static void doemit(register struct parse *p, sop op, size_t opnd);
- *
- * It might seem better to implement this as a macro with a function as
- * hard-case backup, but it's just too big and messy unless there are
- * some changes to the data structures. Maybe later.
- */
-static void
-doemit(p, op, opnd)
-register struct parse *p;
-sop op;
-size_t opnd;
-{
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- /* deal with oversize operands ("can't happen", more or less) */
- assert(opnd < 1<<OPSHIFT);
-
- /* deal with undersized strip */
- if (p->slen >= p->ssize)
- enlarge(p, (p->ssize+1) / 2 * 3); /* +50% */
- assert(p->slen < p->ssize);
-
- /* finally, it's all reduced to the easy case */
- p->strip[p->slen++] = SOP(op, opnd);
-}
-
-/*
- - doinsert - insert a sop into the strip
- == static void doinsert(register struct parse *p, sop op, size_t opnd, sopno pos);
- */
-static void
-doinsert(p, op, opnd, pos)
-register struct parse *p;
-sop op;
-size_t opnd;
-sopno pos;
-{
- register sopno sn;
- register sop s;
- register int i;
-
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- sn = HERE();
- EMIT(op, opnd); /* do checks, ensure space */
- assert(HERE() == sn+1);
- s = p->strip[sn];
-
- /* adjust paren pointers */
- assert(pos > 0);
- for (i = 1; i < NPAREN; i++) {
- if (p->pbegin[i] >= pos) {
- p->pbegin[i]++;
- }
- if (p->pend[i] >= pos) {
- p->pend[i]++;
- }
- }
-
- memmove((char *)&p->strip[pos+1], (char *)&p->strip[pos],
- (HERE()-pos-1)*sizeof(sop));
- p->strip[pos] = s;
-}
-
-/*
- - dofwd - complete a forward reference
- == static void dofwd(register struct parse *p, sopno pos, sop value);
- */
-static void
-dofwd(p, pos, value)
-register struct parse *p;
-register sopno pos;
-sop value;
-{
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- assert(value < 1<<OPSHIFT);
- p->strip[pos] = OP(p->strip[pos]) | value;
-}
-
-/*
- - enlarge - enlarge the strip
- == static void enlarge(register struct parse *p, sopno size);
- */
-static void
-enlarge(p, size)
-register struct parse *p;
-register sopno size;
-{
- register sop *sp;
-
- if (p->ssize >= size)
- return;
-
- sp = (sop *)realloc(p->strip, size*sizeof(sop));
- if (sp == NULL) {
- SETERROR(REG_ESPACE);
- return;
- }
- p->strip = sp;
- p->ssize = size;
-}
-
-/*
- - stripsnug - compact the strip
- == static void stripsnug(register struct parse *p, register struct re_guts *g);
- */
-static void
-stripsnug(p, g)
-register struct parse *p;
-register struct re_guts *g;
-{
- g->nstates = p->slen;
- g->strip = (sop *)realloc((char *)p->strip, p->slen * sizeof(sop));
- if (g->strip == NULL) {
- SETERROR(REG_ESPACE);
- g->strip = p->strip;
- }
-}
-
-/*
- - findmust - fill in must and mlen with longest mandatory literal string
- == static void findmust(register struct parse *p, register struct re_guts *g);
- *
- * This algorithm could do fancy things like analyzing the operands of |
- * for common subsequences. Someday. This code is simple and finds most
- * of the interesting cases.
- *
- * Note that must and mlen got initialized during setup.
- */
-static void
-findmust(p, g)
-struct parse *p;
-register struct re_guts *g;
-{
- register sop *scan;
- sop *start = NULL;
- register sop *newstart = NULL;
- register sopno newlen;
- register sop s;
- register char *cp;
- register sopno i;
-
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- /* find the longest OCHAR sequence in strip */
- newlen = 0;
- scan = g->strip + 1;
- do {
- s = *scan++;
- switch (OP(s)) {
- case OCHAR: /* sequence member */
- if (newlen == 0) /* new sequence */
- newstart = scan - 1;
- newlen++;
- break;
- case OPLUS_: /* things that don't break one */
- case OLPAREN:
- case ORPAREN:
- break;
- case OQUEST_: /* things that must be skipped */
- case OCH_:
- scan--;
- do {
- scan += OPND(s);
- s = *scan;
- /* assert() interferes w debug printouts */
- if (OP(s) != O_QUEST && OP(s) != O_CH &&
- OP(s) != OOR2) {
- g->iflags |= BAD;
- return;
- }
- } while (OP(s) != O_QUEST && OP(s) != O_CH);
- /* fallthrough */
- default: /* things that break a sequence */
- if (newlen > g->mlen) { /* ends one */
- start = newstart;
- g->mlen = newlen;
- }
- newlen = 0;
- break;
- }
- } while (OP(s) != OEND);
-
- if (g->mlen == 0) /* there isn't one */
- return;
-
- /* turn it into a character string */
- g->must = malloc((size_t)g->mlen + 1);
- if (g->must == NULL) { /* argh; just forget it */
- g->mlen = 0;
- return;
- }
- cp = g->must;
- scan = start;
- for (i = g->mlen; i > 0; i--) {
- while (OP(s = *scan++) != OCHAR)
- continue;
- assert(cp < g->must + g->mlen);
- *cp++ = (char)OPND(s);
- }
- assert(cp == g->must + g->mlen);
- *cp++ = '\0'; /* just on general principles */
-}
-
-/*
- - pluscount - count + nesting
- == static sopno pluscount(register struct parse *p, register struct re_guts *g);
- */
-static sopno /* nesting depth */
-pluscount(p, g)
-struct parse *p;
-register struct re_guts *g;
-{
- register sop *scan;
- register sop s;
- register sopno plusnest = 0;
- register sopno maxnest = 0;
-
- if (p->error != 0)
- return(0); /* there may not be an OEND */
-
- scan = g->strip + 1;
- do {
- s = *scan++;
- switch (OP(s)) {
- case OPLUS_:
- plusnest++;
- break;
- case O_PLUS:
- if (plusnest > maxnest)
- maxnest = plusnest;
- plusnest--;
- break;
- }
- } while (OP(s) != OEND);
- if (plusnest != 0)
- g->iflags |= BAD;
- return(maxnest);
-}
diff --git a/winsup/cygwin/regex/regcomp.ih b/winsup/cygwin/regex/regcomp.ih
deleted file mode 100644
index e16d5ab2f..000000000
--- a/winsup/cygwin/regex/regcomp.ih
+++ /dev/null
@@ -1,48 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === regcomp.c === */
-static void p_ere(register struct parse *p, int stop);
-static void p_ere_exp(register struct parse *p);
-static void p_str(register struct parse *p);
-static void p_bre(register struct parse *p, register int end1, register int end2);
-static int p_simp_re(register struct parse *p, int starordinary);
-static int p_count(register struct parse *p);
-static void p_bracket(register struct parse *p);
-static void p_b_term(register struct parse *p, register cset *cs);
-static void p_b_cclass(register struct parse *p, register cset *cs);
-static void p_b_eclass(register struct parse *p, register cset *cs);
-static char p_b_symbol(register struct parse *p);
-static char p_b_coll_elem(register struct parse *p, int endc);
-static char othercase(int ch);
-static void bothcases(register struct parse *p, int ch);
-static void ordinary(register struct parse *p, register int ch);
-static void nonnewline(register struct parse *p);
-static void repeat(register struct parse *p, sopno start, int from, int to);
-static int seterr(register struct parse *p, int e);
-static cset *allocset(register struct parse *p);
-static void freeset(register struct parse *p, register cset *cs);
-static int freezeset(register struct parse *p, register cset *cs);
-static int firstch(register struct parse *p, register cset *cs);
-static int nch(register struct parse *p, register cset *cs);
-static void mcadd(register struct parse *p, register cset *cs, register const char *cp);
-static void mcinvert(register struct parse *p, register cset *cs);
-static void mccase(register struct parse *p, register cset *cs);
-static int isinsets(register struct re_guts *g, int c);
-static int samesets(register struct re_guts *g, int c1, int c2);
-static void categorize(struct parse *p, register struct re_guts *g);
-static sopno dupl(register struct parse *p, sopno start, sopno finish);
-static void doemit(register struct parse *p, sop op, size_t opnd);
-static void doinsert(register struct parse *p, sop op, size_t opnd, sopno pos);
-static void dofwd(register struct parse *p, sopno pos, sop value);
-static void enlarge(register struct parse *p, sopno size);
-static void stripsnug(register struct parse *p, register struct re_guts *g);
-static void findmust(register struct parse *p, register struct re_guts *g);
-static sopno pluscount(register struct parse *p, register struct re_guts *g);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/winsup/cygwin/regex/regerror.c b/winsup/cygwin/regex/regerror.c
deleted file mode 100644
index 4d14ab231..000000000
--- a/winsup/cygwin/regex/regerror.c
+++ /dev/null
@@ -1,127 +0,0 @@
-#include "winsup.h"
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdlib.h>
-#include "regex.h"
-
-#include "utils.h"
-#include "regerror.ih"
-
-/*
- = #define REG_OKAY 0
- = #define REG_NOMATCH 1
- = #define REG_BADPAT 2
- = #define REG_ECOLLATE 3
- = #define REG_ECTYPE 4
- = #define REG_EESCAPE 5
- = #define REG_ESUBREG 6
- = #define REG_EBRACK 7
- = #define REG_EPAREN 8
- = #define REG_EBRACE 9
- = #define REG_BADBR 10
- = #define REG_ERANGE 11
- = #define REG_ESPACE 12
- = #define REG_BADRPT 13
- = #define REG_EMPTY 14
- = #define REG_ASSERT 15
- = #define REG_INVARG 16
- = #define REG_ATOI 255 // convert name to number (!)
- = #define REG_ITOA 0400 // convert number to name (!)
- */
-static struct rerr {
- int code;
- const char *name;
- const char *explain;
-} rerrs[] = {
- {REG_OKAY, "REG_OKAY", "no errors detected"},
- {REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match"},
- {REG_BADPAT, "REG_BADPAT", "invalid regular expression"},
- {REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element"},
- {REG_ECTYPE, "REG_ECTYPE", "invalid character class"},
- {REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)"},
- {REG_ESUBREG, "REG_ESUBREG", "invalid backreference number"},
- {REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced"},
- {REG_EPAREN, "REG_EPAREN", "parentheses not balanced"},
- {REG_EBRACE, "REG_EBRACE", "braces not balanced"},
- {REG_BADBR, "REG_BADBR", "invalid repetition count(s)"},
- {REG_ERANGE, "REG_ERANGE", "invalid character range"},
- {REG_ESPACE, "REG_ESPACE", "out of memory"},
- {REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid"},
- {REG_EMPTY, "REG_EMPTY", "empty (sub)expression"},
- {REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug"},
- {REG_INVARG, "REG_INVARG", "invalid argument to regex routine"},
- {-1, "", "*** unknown regexp error code ***"},
-};
-
-/*
- - regerror - the interface to error numbers
- = extern size_t regerror(int, const regex_t *, char *, size_t);
- */
-/* ARGSUSED */
-size_t
-regerror(errcode, preg, errbuf, errbuf_size)
-int errcode;
-const regex_t *preg;
-char *errbuf;
-size_t errbuf_size;
-{
- register struct rerr *r;
- register size_t len;
- register int target = errcode &~ REG_ITOA;
- register const char *s;
- char convbuf[50];
-
- if (errcode == REG_ATOI)
- s = regatoi(preg, convbuf);
- else {
- for (r = rerrs; r->code >= 0; r++)
- if (r->code == target)
- break;
-
- if (errcode&REG_ITOA) {
- if (r->code >= 0)
- (void) strcpy(convbuf, r->name);
- else
- sprintf(convbuf, "REG_0x%x", target);
- assert(strlen(convbuf) < sizeof(convbuf));
- s = convbuf;
- } else
- s = r->explain;
- }
-
- len = strlen(s) + 1;
- if (errbuf_size > 0) {
- if (errbuf_size > len)
- (void) strcpy(errbuf, s);
- else {
- (void) strncpy(errbuf, s, errbuf_size-1);
- errbuf[errbuf_size-1] = '\0';
- }
- }
-
- return(len);
-}
-
-/*
- - regatoi - internal routine to implement REG_ATOI
- == static char *regatoi(const regex_t *preg, char *localbuf);
- */
-static const char *
-regatoi(preg, localbuf)
-const regex_t *preg;
-char *localbuf;
-{
- register struct rerr *r;
-
- for (r = rerrs; r->code >= 0; r++)
- if (strcmp(r->name, preg->re_endp) == 0)
- break;
- if (r->code < 0)
- return("0");
-
- sprintf(localbuf, "%d", r->code);
- return(localbuf);
-}
diff --git a/winsup/cygwin/regex/regerror.ih b/winsup/cygwin/regex/regerror.ih
deleted file mode 100644
index d428544e3..000000000
--- a/winsup/cygwin/regex/regerror.ih
+++ /dev/null
@@ -1,12 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === regerror.c === */
-static const char *regatoi(const regex_t *preg, char *localbuf);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/winsup/cygwin/regex/regex.3 b/winsup/cygwin/regex/regex.3
deleted file mode 100644
index bc747096d..000000000
--- a/winsup/cygwin/regex/regex.3
+++ /dev/null
@@ -1,509 +0,0 @@
-.TH REGEX 3 "25 Sept 1997"
-.BY "Henry Spencer"
-.de ZR
-.\" one other place knows this name: the SEE ALSO section
-.IR regex (7) \\$1
-..
-.SH NAME
-regcomp, regexec, regerror, regfree \- regular-expression library
-.SH SYNOPSIS
-.ft B
-.\".na
-#include <sys/types.h>
-.br
-#include <regex.h>
-.HP 10
-int regcomp(regex_t\ *preg, const\ char\ *pattern, int\ cflags);
-.HP
-int\ regexec(const\ regex_t\ *preg, const\ char\ *string,
-size_t\ nmatch, regmatch_t\ pmatch[], int\ eflags);
-.HP
-size_t\ regerror(int\ errcode, const\ regex_t\ *preg,
-char\ *errbuf, size_t\ errbuf_size);
-.HP
-void\ regfree(regex_t\ *preg);
-.\".ad
-.ft
-.SH DESCRIPTION
-These routines implement POSIX 1003.2 regular expressions (``RE''s);
-see
-.ZR .
-.I Regcomp
-compiles an RE written as a string into an internal form,
-.I regexec
-matches that internal form against a string and reports results,
-.I regerror
-transforms error codes from either into human-readable messages,
-and
-.I regfree
-frees any dynamically-allocated storage used by the internal form
-of an RE.
-.PP
-The header
-.I <regex.h>
-declares two structure types,
-.I regex_t
-and
-.IR regmatch_t ,
-the former for compiled internal forms and the latter for match reporting.
-It also declares the four functions,
-a type
-.IR regoff_t ,
-and a number of constants with names starting with ``REG_''.
-.PP
-.I Regcomp
-compiles the regular expression contained in the
-.I pattern
-string,
-subject to the flags in
-.IR cflags ,
-and places the results in the
-.I regex_t
-structure pointed to by
-.IR preg .
-.I Cflags
-is the bitwise OR of zero or more of the following flags:
-.IP REG_EXTENDED \w'REG_EXTENDED'u+2n
-Compile modern (``extended'') REs,
-rather than the obsolete (``basic'') REs that
-are the default.
-.IP REG_BASIC
-This is a synonym for 0,
-provided as a counterpart to REG_EXTENDED to improve readability.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-.IP REG_NOSPEC
-Compile with recognition of all special characters turned off.
-All characters are thus considered ordinary,
-so the ``RE'' is a literal string.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-REG_EXTENDED and REG_NOSPEC may not be used
-in the same call to
-.IR regcomp .
-.IP REG_ICASE
-Compile for matching that ignores upper/lower case distinctions.
-See
-.ZR .
-.IP REG_NOSUB
-Compile for matching that need only report success or failure,
-not what was matched.
-.IP REG_NEWLINE
-Compile for newline-sensitive matching.
-By default, newline is a completely ordinary character with no special
-meaning in either REs or strings.
-With this flag,
-`[^' bracket expressions and `.' never match newline,
-a `^' anchor matches the null string after any newline in the string
-in addition to its normal function,
-and the `$' anchor matches the null string before any newline in the
-string in addition to its normal function.
-.IP REG_PEND
-The regular expression ends,
-not at the first NUL,
-but just before the character pointed to by the
-.I re_endp
-member of the structure pointed to by
-.IR preg .
-The
-.I re_endp
-member is of type
-.IR const\ char\ * .
-This flag permits inclusion of NULs in the RE;
-they are considered ordinary characters.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-.PP
-When successful,
-.I regcomp
-returns 0 and fills in the structure pointed to by
-.IR preg .
-One member of that structure
-(other than
-.IR re_endp )
-is publicized:
-.IR re_nsub ,
-of type
-.IR size_t ,
-contains the number of parenthesized subexpressions within the RE
-(except that the value of this member is undefined if the
-REG_NOSUB flag was used).
-If
-.I regcomp
-fails, it returns a non-zero error code;
-see DIAGNOSTICS.
-.PP
-.I Regexec
-matches the compiled RE pointed to by
-.I preg
-against the
-.IR string ,
-subject to the flags in
-.IR eflags ,
-and reports results using
-.IR nmatch ,
-.IR pmatch ,
-and the returned value.
-The RE must have been compiled by a previous invocation of
-.IR regcomp .
-The compiled form is not altered during execution of
-.IR regexec ,
-so a single compiled RE can be used simultaneously by multiple threads.
-.PP
-By default,
-the NUL-terminated string pointed to by
-.I string
-is considered to be the text of an entire line,
-with the NUL indicating the end of the line.
-(That is,
-any other end-of-line marker is considered to have been removed
-and replaced by the NUL.)
-The
-.I eflags
-argument is the bitwise OR of zero or more of the following flags:
-.IP REG_NOTBOL \w'REG_STARTEND'u+2n
-The first character of
-the string
-is not the beginning of a line, so the `^' anchor should not match before it.
-This does not affect the behavior of newlines under REG_NEWLINE.
-.IP REG_NOTEOL
-The NUL terminating
-the string
-does not end a line, so the `$' anchor should not match before it.
-This does not affect the behavior of newlines under REG_NEWLINE.
-.IP REG_STARTEND
-The string is considered to start at
-\fIstring\fR\ + \fIpmatch\fR[0].\fIrm_so\fR
-and to have a terminating NUL located at
-\fIstring\fR\ + \fIpmatch\fR[0].\fIrm_eo\fR
-(there need not actually be a NUL at that location),
-regardless of the value of
-.IR nmatch .
-See below for the definition of
-.IR pmatch
-and
-.IR nmatch .
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-Note that a non-zero \fIrm_so\fR does not imply REG_NOTBOL;
-REG_STARTEND affects only the location of the string,
-not how it is matched.
-.PP
-See
-.ZR
-for a discussion of what is matched in situations where an RE or a
-portion thereof could match any of several substrings of
-.IR string .
-.PP
-Normally,
-.I regexec
-returns 0 for success and the non-zero code REG_NOMATCH for failure.
-Other non-zero error codes may be returned in exceptional situations;
-see DIAGNOSTICS.
-.PP
-If REG_NOSUB was specified in the compilation of the RE,
-or if
-.I nmatch
-is 0,
-.I regexec
-ignores the
-.I pmatch
-argument (but see below for the case where REG_STARTEND is specified).
-Otherwise,
-.I pmatch
-points to an array of
-.I nmatch
-structures of type
-.IR regmatch_t .
-Such a structure has at least the members
-.I rm_so
-and
-.IR rm_eo ,
-both of type
-.I regoff_t
-(a signed arithmetic type at least as large as an
-.I off_t
-and a
-.IR ssize_t ),
-containing respectively the offset of the first character of a substring
-and the offset of the first character after the end of the substring.
-Offsets are measured from the beginning of the
-.I string
-argument given to
-.IR regexec .
-An empty substring is denoted by equal offsets,
-both indicating the character following the empty substring.
-.PP
-The 0th member of the
-.I pmatch
-array is filled in to indicate what substring of
-.I string
-was matched by the entire RE.
-Remaining members report what substring was matched by parenthesized
-subexpressions within the RE;
-member
-.I i
-reports subexpression
-.IR i ,
-with subexpressions counted (starting at 1) by the order of their opening
-parentheses in the RE, left to right.
-Unused entries in the array\(emcorresponding either to subexpressions that
-did not participate in the match at all, or to subexpressions that do not
-exist in the RE (that is, \fIi\fR\ > \fIpreg\fR\->\fIre_nsub\fR)\(emhave both
-.I rm_so
-and
-.I rm_eo
-set to \-1.
-If a subexpression participated in the match several times,
-the reported substring is the last one it matched.
-(Note, as an example in particular, that when the RE `(b*)+' matches `bbb',
-the parenthesized subexpression matches the three `b's and then
-an infinite number of empty strings following the last `b',
-so the reported substring is one of the empties.)
-.PP
-If REG_STARTEND is specified,
-.I pmatch
-must point to at least one
-.I regmatch_t
-(even if
-.I nmatch
-is 0 or REG_NOSUB was specified),
-to hold the input offsets for REG_STARTEND.
-Use for output is still entirely controlled by
-.IR nmatch ;
-if
-.I nmatch
-is 0 or REG_NOSUB was specified,
-the value of
-.IR pmatch [0]
-will not be changed by a successful
-.IR regexec .
-.PP
-.I Regerror
-maps a non-zero
-.I errcode
-from either
-.I regcomp
-or
-.I regexec
-to a human-readable, printable message.
-If
-.I preg
-is non-NULL,
-the error code should have arisen from use of
-the
-.I regex_t
-pointed to by
-.IR preg ,
-and if the error code came from
-.IR regcomp ,
-it should have been the result from the most recent
-.I regcomp
-using that
-.IR regex_t .
-.RI ( Regerror
-may be able to supply a more detailed message using information
-from the
-.IR regex_t .)
-.I Regerror
-places the NUL-terminated message into the buffer pointed to by
-.IR errbuf ,
-limiting the length (including the NUL) to at most
-.I errbuf_size
-bytes.
-If the whole message won't fit,
-as much of it as will fit before the terminating NUL is supplied.
-In any case,
-the returned value is the size of buffer needed to hold the whole
-message (including terminating NUL).
-If
-.I errbuf_size
-is 0,
-.I errbuf
-is ignored but the return value is still correct.
-.PP
-If the
-.I errcode
-given to
-.I regerror
-is first ORed with REG_ITOA,
-the ``message'' that results is the printable name of the error code,
-e.g. ``REG_NOMATCH'',
-rather than an explanation thereof.
-If
-.I errcode
-is REG_ATOI,
-then
-.I preg
-shall be non-NULL and the
-.I re_endp
-member of the structure it points to
-must point to the printable name of an error code;
-in this case, the result in
-.I errbuf
-is the decimal digits of
-the numeric value of the error code
-(0 if the name is not recognized).
-REG_ITOA and REG_ATOI are intended primarily as debugging facilities;
-they are extensions,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-Be warned also that they are considered experimental and changes are possible.
-.PP
-.I Regfree
-frees any dynamically-allocated storage associated with the compiled RE
-pointed to by
-.IR preg .
-The remaining
-.I regex_t
-is no longer a valid compiled RE
-and the effect of supplying it to
-.I regexec
-or
-.I regerror
-is undefined.
-.PP
-None of these functions references global variables except for tables
-of constants;
-all are safe for use from multiple threads if the arguments are safe.
-.SH IMPLEMENTATION CHOICES
-There are a number of decisions that 1003.2 leaves up to the implementor,
-either by explicitly saying ``undefined'' or by virtue of them being
-forbidden by the RE grammar.
-This implementation treats them as follows.
-.PP
-See
-.ZR
-for a discussion of the definition of case-independent matching.
-.PP
-There is no particular limit on the length of REs,
-except insofar as memory is limited.
-Memory usage is approximately linear in RE size, and largely insensitive
-to RE complexity, except for bounded repetitions.
-See BUGS for one short RE using them
-that will run almost any system out of memory.
-.PP
-A backslashed character other than one specifically given a magic meaning
-by 1003.2 (such magic meanings occur only in obsolete [``basic''] REs)
-is taken as an ordinary character.
-.PP
-Any unmatched [ is a REG_EBRACK error.
-.PP
-Equivalence classes cannot begin or end bracket-expression ranges.
-The endpoint of one range cannot begin another.
-.PP
-RE_DUP_MAX, the limit on repetition counts in bounded repetitions, is 255.
-.PP
-A repetition operator (?, *, +, or bounds) cannot follow another
-repetition operator.
-A repetition operator cannot begin an expression or subexpression
-or follow `^' or `|'.
-.PP
-`|' cannot appear first or last in a (sub)expression or after another `|',
-i.e. an operand of `|' cannot be an empty subexpression.
-An empty parenthesized subexpression, `()', is legal and matches an
-empty (sub)string.
-An empty string is not a legal RE.
-.PP
-A `{' followed by a digit is considered the beginning of bounds for a
-bounded repetition, which must then follow the syntax for bounds.
-A `{' \fInot\fR followed by a digit is considered an ordinary character.
-.PP
-`^' and `$' beginning and ending subexpressions in obsolete (``basic'')
-REs are anchors, not ordinary characters.
-.SH SEE ALSO
-grep(1), regex(7)
-.PP
-POSIX 1003.2, sections 2.8 (Regular Expression Notation)
-and
-B.5 (C Binding for Regular Expression Matching).
-.SH DIAGNOSTICS
-Non-zero error codes from
-.I regcomp
-and
-.I regexec
-include the following:
-.PP
-.nf
-.ta \w'REG_ECOLLATE'u+3n
-REG_NOMATCH regexec() failed to match
-REG_BADPAT invalid regular expression
-REG_ECOLLATE invalid collating element
-REG_ECTYPE invalid character class
-REG_EESCAPE \e applied to unescapable character
-REG_ESUBREG invalid backreference number
-REG_EBRACK brackets [ ] not balanced
-REG_EPAREN parentheses ( ) not balanced
-REG_EBRACE braces { } not balanced
-REG_BADBR invalid repetition count(s) in { }
-REG_ERANGE invalid character range in [ ]
-REG_ESPACE ran out of memory
-REG_BADRPT ?, *, or + operand invalid
-REG_EMPTY empty (sub)expression
-REG_ASSERT ``can't happen''\(emyou found a bug
-REG_INVARG invalid argument, e.g. negative-length string
-.fi
-.SH HISTORY
-Written by Henry Spencer,
-henry@zoo.toronto.edu.
-.SH BUGS
-This is an alpha release with known defects.
-Please report problems.
-.PP
-There is one known functionality bug.
-The implementation of internationalization is incomplete:
-the locale is always assumed to be the default one of 1003.2,
-and only the collating elements etc. of that locale are available.
-.PP
-The back-reference code is subtle and doubts linger about its correctness
-in complex cases.
-.PP
-.I Regexec
-performance is poor.
-This will improve with later releases.
-.I Nmatch
-exceeding 0 is expensive;
-.I nmatch
-exceeding 1 is worse.
-.I Regexec
-is largely insensitive to RE complexity \fIexcept\fR that back
-references are massively expensive.
-RE length does matter; in particular, there is a strong speed bonus
-for keeping RE length under about 30 characters,
-with most special characters counting roughly double.
-.PP
-.I Regcomp
-implements bounded repetitions by macro expansion,
-which is costly in time and space if counts are large
-or bounded repetitions are nested.
-An RE like, say,
-`((((a{1,100}){1,100}){1,100}){1,100}){1,100}'
-will (eventually) run almost any existing machine out of swap space.
-.PP
-There are suspected problems with response to obscure error conditions.
-Notably,
-certain kinds of internal overflow,
-produced only by truly enormous REs or by multiply nested bounded repetitions,
-are probably not handled well.
-.PP
-Due to a mistake in 1003.2, things like `a)b' are legal REs because `)' is
-a special character only in the presence of a previous unmatched `('.
-This can't be fixed until the spec is fixed.
-.PP
-The standard's definition of back references is vague.
-For example, does
-`a\e(\e(b\e)*\e2\e)*d' match `abbbd'?
-Until the standard is clarified,
-behavior in such cases should not be relied on.
-.PP
-The implementation of word-boundary matching is a bit of a kludge,
-and bugs may lurk in combinations of word-boundary matching and anchoring.
diff --git a/winsup/cygwin/regex/regex.7 b/winsup/cygwin/regex/regex.7
deleted file mode 100644
index 0fa180269..000000000
--- a/winsup/cygwin/regex/regex.7
+++ /dev/null
@@ -1,235 +0,0 @@
-.TH REGEX 7 "25 Oct 1995"
-.BY "Henry Spencer"
-.SH NAME
-regex \- POSIX 1003.2 regular expressions
-.SH DESCRIPTION
-Regular expressions (``RE''s),
-as defined in POSIX 1003.2, come in two forms:
-modern REs (roughly those of
-.IR egrep ;
-1003.2 calls these ``extended'' REs)
-and obsolete REs (roughly those of
-.IR ed ;
-1003.2 ``basic'' REs).
-Obsolete REs mostly exist for backward compatibility in some old programs;
-they will be discussed at the end.
-1003.2 leaves some aspects of RE syntax and semantics open;
-`\(dg' marks decisions on these aspects that
-may not be fully portable to other 1003.2 implementations.
-.PP
-A (modern) RE is one\(dg or more non-empty\(dg \fIbranches\fR,
-separated by `|'.
-It matches anything that matches one of the branches.
-.PP
-A branch is one\(dg or more \fIpieces\fR, concatenated.
-It matches a match for the first, followed by a match for the second, etc.
-.PP
-A piece is an \fIatom\fR possibly followed
-by a single\(dg `*', `+', `?', or \fIbound\fR.
-An atom followed by `*' matches a sequence of 0 or more matches of the atom.
-An atom followed by `+' matches a sequence of 1 or more matches of the atom.
-An atom followed by `?' matches a sequence of 0 or 1 matches of the atom.
-.PP
-A \fIbound\fR is `{' followed by an unsigned decimal integer,
-possibly followed by `,'
-possibly followed by another unsigned decimal integer,
-always followed by `}'.
-The integers must lie between 0 and RE_DUP_MAX (255\(dg) inclusive,
-and if there are two of them, the first may not exceed the second.
-An atom followed by a bound containing one integer \fIi\fR
-and no comma matches
-a sequence of exactly \fIi\fR matches of the atom.
-An atom followed by a bound
-containing one integer \fIi\fR and a comma matches
-a sequence of \fIi\fR or more matches of the atom.
-An atom followed by a bound
-containing two integers \fIi\fR and \fIj\fR matches
-a sequence of \fIi\fR through \fIj\fR (inclusive) matches of the atom.
-.PP
-An atom is a regular expression enclosed in `()' (matching a match for the
-regular expression),
-an empty set of `()' (matching the null string)\(dg,
-a \fIbracket expression\fR (see below), `.'
-(matching any single character), `^' (matching the null string at the
-beginning of a line), `$' (matching the null string at the
-end of a line), a `\e' followed by one of the characters
-`^.[$()|*+?{\e'
-(matching that character taken as an ordinary character),
-a `\e' followed by any other character\(dg
-(matching that character taken as an ordinary character,
-as if the `\e' had not been present\(dg),
-or a single character with no other significance (matching that character).
-A `{' followed by a character other than a digit is an ordinary
-character, not the beginning of a bound\(dg.
-It is illegal to end an RE with `\e'.
-.PP
-A \fIbracket expression\fR is a list of characters enclosed in `[]'.
-It normally matches any single character from the list (but see below).
-If the list begins with `^',
-it matches any single character
-(but see below) \fInot\fR from the rest of the list.
-If two characters in the list are separated by `\-', this is shorthand
-for the full \fIrange\fR of characters between those two (inclusive) in the
-collating sequence,
-e.g. `[0\-9]' in ASCII matches any decimal digit.
-It is illegal\(dg for two ranges to share an
-endpoint, e.g. `a\-c\-e'.
-Ranges are very collating-sequence-dependent,
-and portable programs should avoid relying on them.
-.PP
-To include a literal `]' in the list, make it the first character
-(following a possible `^').
-To include a literal `\-', make it the first or last character,
-or the second endpoint of a range.
-To use a literal `\-' as the first endpoint of a range,
-enclose it in `[.' and `.]' to make it a collating element (see below).
-With the exception of these and some combinations using `[' (see next
-paragraphs), all other special characters, including `\e', lose their
-special significance within a bracket expression.
-.PP
-Within a bracket expression, a collating element (a character,
-a multi-character sequence that collates as if it were a single character,
-or a collating-sequence name for either)
-enclosed in `[.' and `.]' stands for the
-sequence of characters of that collating element.
-The sequence is a single element of the bracket expression's list.
-A bracket expression containing a multi-character collating element
-can thus match more than one character,
-e.g. if the collating sequence includes a `ch' collating element,
-then the RE `[[.ch.]]*c' matches the first five characters
-of `chchcc'.
-.PP
-Within a bracket expression, a collating element enclosed in `[=' and
-`=]' is an equivalence class, standing for the sequences of characters
-of all collating elements equivalent to that one, including itself.
-(If there are no other equivalent collating elements,
-the treatment is as if the enclosing delimiters were `[.' and `.]'.)
-For example, if o and \o'o^' are the members of an equivalence class,
-then `[[=o=]]', `[[=\o'o^'=]]', and `[o\o'o^']' are all synonymous.
-An equivalence class may not\(dg be an endpoint
-of a range.
-.PP
-Within a bracket expression, the name of a \fIcharacter class\fR enclosed
-in `[:' and `:]' stands for the list of all characters belonging to that
-class.
-Standard character class names are:
-.PP
-.RS
-.nf
-.ta 3c 6c 9c
-alnum digit punct
-alpha graph space
-blank lower upper
-cntrl print xdigit
-.fi
-.RE
-.PP
-These stand for the character classes defined in
-.IR ctype (3).
-A locale may provide others.
-A character class may not be used as an endpoint of a range.
-.PP
-There are two special cases\(dg of bracket expressions:
-the bracket expressions `[[:<:]]' and `[[:>:]]' match the null string at
-the beginning and end of a word respectively.
-A word is defined as a sequence of
-word characters
-which is neither preceded nor followed by
-word characters.
-A word character is an
-.I alnum
-character (as defined by
-.IR ctype (3))
-or an underscore.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-.PP
-In the event that an RE could match more than one substring of a given
-string,
-the RE matches the one starting earliest in the string.
-If the RE could match more than one substring starting at that point,
-it matches the longest.
-Subexpressions also match the longest possible substrings, subject to
-the constraint that the whole match be as long as possible,
-with subexpressions starting earlier in the RE taking priority over
-ones starting later.
-Note that higher-level subexpressions thus take priority over
-their lower-level component subexpressions.
-.PP
-Match lengths are measured in characters, not collating elements.
-A null string is considered longer than no match at all.
-For example,
-`bb*' matches the three middle characters of `abbbc',
-`(wee|week)(knights|nights)' matches all ten characters of `weeknights',
-when `(.*).*' is matched against `abc' the parenthesized subexpression
-matches all three characters, and
-when `(a*)*' is matched against `bc' both the whole RE and the parenthesized
-subexpression match the null string.
-.PP
-If case-independent matching is specified,
-the effect is much as if all case distinctions had vanished from the
-alphabet.
-When an alphabetic that exists in multiple cases appears as an
-ordinary character outside a bracket expression, it is effectively
-transformed into a bracket expression containing both cases,
-e.g. `x' becomes `[xX]'.
-When it appears inside a bracket expression, all case counterparts
-of it are added to the bracket expression, so that (e.g.) `[x]'
-becomes `[xX]' and `[^x]' becomes `[^xX]'.
-.PP
-No particular limit is imposed on the length of REs\(dg.
-Programs intended to be portable should not employ REs longer
-than 256 bytes,
-as an implementation can refuse to accept such REs and remain
-POSIX-compliant.
-.PP
-Obsolete (``basic'') regular expressions differ in several respects.
-`|', `+', and `?' are ordinary characters and there is no equivalent
-for their functionality.
-The delimiters for bounds are `\e{' and `\e}',
-with `{' and `}' by themselves ordinary characters.
-The parentheses for nested subexpressions are `\e(' and `\e)',
-with `(' and `)' by themselves ordinary characters.
-`^' is an ordinary character except at the beginning of the
-RE or\(dg the beginning of a parenthesized subexpression,
-`$' is an ordinary character except at the end of the
-RE or\(dg the end of a parenthesized subexpression,
-and `*' is an ordinary character if it appears at the beginning of the
-RE or the beginning of a parenthesized subexpression
-(after a possible leading `^').
-Finally, there is one new type of atom, a \fIback reference\fR:
-`\e' followed by a non-zero decimal digit \fId\fR
-matches the same sequence of characters
-matched by the \fId\fRth parenthesized subexpression
-(numbering subexpressions by the positions of their opening parentheses,
-left to right),
-so that (e.g.) `\e([bc]\e)\e1' matches `bb' or `cc' but not `bc'.
-.SH SEE ALSO
-regex(3)
-.PP
-POSIX 1003.2, section 2.8 (Regular Expression Notation).
-.SH HISTORY
-Written by Henry Spencer, based on the 1003.2 spec.
-.SH BUGS
-Having two kinds of REs is a botch.
-.PP
-The current 1003.2 spec says that `)' is an ordinary character in
-the absence of an unmatched `(';
-this was an unintentional result of a wording error,
-and change is likely.
-Avoid relying on it.
-.PP
-Back references are a dreadful botch,
-posing major problems for efficient implementations.
-They are also somewhat vaguely defined
-(does
-`a\e(\e(b\e)*\e2\e)*d' match `abbbd'?).
-Avoid using them.
-.PP
-1003.2's specification of case-independent matching is vague.
-The ``one case implies all cases'' definition given above
-is current consensus among implementors as to the right interpretation.
-.PP
-The syntax for word boundaries is incredibly ugly.
diff --git a/winsup/cygwin/regex/regex.h b/winsup/cygwin/regex/regex.h
deleted file mode 100644
index 0ef0ace36..000000000
--- a/winsup/cygwin/regex/regex.h
+++ /dev/null
@@ -1,83 +0,0 @@
-#ifndef _REGEX_H_
-#define _REGEX_H_ /* never again */
-#include <sys/types.h>
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __INSIDE_CYGWIN__
-#define regcomp posix_regcomp
-#define regerror posix_regerror
-#define regexec posix_regexec
-#define regfree posix_regfree
-#endif
-
-/* === regex2.h === */
-typedef off_t regoff_t;
-typedef struct {
- int re_magic;
- size_t re_nsub; /* number of parenthesized subexpressions */
- const char *re_endp; /* end pointer for REG_PEND */
- struct re_guts *re_g; /* none of your business :-) */
-} regex_t;
-typedef struct {
- regoff_t rm_so; /* start of match */
- regoff_t rm_eo; /* end of match */
-} regmatch_t;
-
-
-/* === regcomp.c === */
-extern int regcomp(regex_t *, const char *, int);
-#define REG_BASIC 0000
-#define REG_EXTENDED 0001
-#define REG_ICASE 0002
-#define REG_NOSUB 0004
-#define REG_NEWLINE 0010
-#define REG_NOSPEC 0020
-#define REG_PEND 0040
-#define REG_DUMP 0200
-
-
-/* === regerror.c === */
-#define REG_OKAY 0
-#define REG_NOMATCH 1
-#define REG_BADPAT 2
-#define REG_ECOLLATE 3
-#define REG_ECTYPE 4
-#define REG_EESCAPE 5
-#define REG_ESUBREG 6
-#define REG_EBRACK 7
-#define REG_EPAREN 8
-#define REG_EBRACE 9
-#define REG_BADBR 10
-#define REG_ERANGE 11
-#define REG_ESPACE 12
-#define REG_BADRPT 13
-#define REG_EMPTY 14
-#define REG_ASSERT 15
-#define REG_INVARG 16
-#define REG_ATOI 255 /* convert name to number (!) */
-#define REG_ITOA 0400 /* convert number to name (!) */
-extern size_t regerror(int, const regex_t *, char *, size_t);
-
-
-/* === regexec.c === */
-extern int regexec(const regex_t *, const char *, size_t, regmatch_t [], int);
-#define REG_NOTBOL 00001
-#define REG_NOTEOL 00002
-#define REG_STARTEND 00004
-#define REG_TRACE 00400 /* tracing of execution */
-#define REG_LARGE 01000 /* force large representation */
-#define REG_BACKR 02000 /* force use of backref code */
-
-
-/* === regfree.c === */
-extern void regfree(regex_t *);
-
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
-#endif
diff --git a/winsup/cygwin/regex/regex2.h b/winsup/cygwin/regex/regex2.h
deleted file mode 100644
index 58fd8d8a4..000000000
--- a/winsup/cygwin/regex/regex2.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * First, the stuff that ends up in the outside-world include file
- = typedef off_t regoff_t;
- = typedef struct {
- = int re_magic;
- = size_t re_nsub; // number of parenthesized subexpressions
- = const char *re_endp; // end pointer for REG_PEND
- = struct re_guts *re_g; // none of your business :-)
- = } regex_t;
- = typedef struct {
- = regoff_t rm_so; // start of match
- = regoff_t rm_eo; // end of match
- = } regmatch_t;
- */
-/*
- * internals of regex_t
- */
-#define MAGIC1 ((('r'^0200)<<8) | 'e')
-
-/*
- * The internal representation is a *strip*, a sequence of
- * operators ending with an endmarker. (Some terminology etc. is a
- * historical relic of earlier versions which used multiple strips.)
- * Certain oddities in the representation are there to permit running
- * the machinery backwards; in particular, any deviation from sequential
- * flow must be marked at both its source and its destination. Some
- * fine points:
- *
- * - OPLUS_ and O_PLUS are *inside* the loop they create.
- * - OQUEST_ and O_QUEST are *outside* the bypass they create.
- * - OCH_ and O_CH are *outside* the multi-way branch they create, while
- * OOR1 and OOR2 are respectively the end and the beginning of one of
- * the branches. Note that there is an implicit OOR2 following OCH_
- * and an implicit OOR1 preceding O_CH.
- *
- * In state representations, an operator's bit is on to signify a state
- * immediately *preceding* "execution" of that operator.
- */
-typedef long sop; /* strip operator */
-typedef long sopno;
-#define OPRMASK 0x7c000000
-#define OPDMASK 0x03ffffff
-#define OPSHIFT (26)
-#define OP(n) ((n)&OPRMASK)
-#define OPND(n) ((n)&OPDMASK)
-#define SOP(op, opnd) ((op)|(opnd))
-/* operators meaning operand */
-/* (back, fwd are offsets) */
-#define OEND (1<<OPSHIFT) /* endmarker - */
-#define OCHAR (2<<OPSHIFT) /* character unsigned char */
-#define OBOL (3<<OPSHIFT) /* left anchor - */
-#define OEOL (4<<OPSHIFT) /* right anchor - */
-#define OANY (5<<OPSHIFT) /* . - */
-#define OANYOF (6<<OPSHIFT) /* [...] set number */
-#define OBACK_ (7<<OPSHIFT) /* begin \d paren number */
-#define O_BACK (8<<OPSHIFT) /* end \d paren number */
-#define OPLUS_ (9<<OPSHIFT) /* + prefix fwd to suffix */
-#define O_PLUS (10<<OPSHIFT) /* + suffix back to prefix */
-#define OQUEST_ (11<<OPSHIFT) /* ? prefix fwd to suffix */
-#define O_QUEST (12<<OPSHIFT) /* ? suffix back to prefix */
-#define OLPAREN (13<<OPSHIFT) /* ( fwd to ) */
-#define ORPAREN (14<<OPSHIFT) /* ) back to ( */
-#define OCH_ (15<<OPSHIFT) /* begin choice fwd to OOR2 */
-#define OOR1 (16<<OPSHIFT) /* | pt. 1 back to OOR1 or OCH_ */
-#define OOR2 (17<<OPSHIFT) /* | pt. 2 fwd to OOR2 or O_CH */
-#define O_CH (18<<OPSHIFT) /* end choice back to OOR1 */
-#define OBOW (19<<OPSHIFT) /* begin word - */
-#define OEOW (20<<OPSHIFT) /* end word - */
-
-/*
- * Structure for [] character-set representation. Character sets are
- * done as bit vectors, grouped 8 to a byte vector for compactness.
- * The individual set therefore has both a pointer to the byte vector
- * and a mask to pick out the relevant bit of each byte. A hash code
- * simplifies testing whether two sets could be identical.
- *
- * This will get trickier for multicharacter collating elements. As
- * preliminary hooks for dealing with such things, we also carry along
- * a string of multi-character elements, and decide the size of the
- * vectors at run time.
- */
-typedef struct {
- uch *ptr; /* -> uch [csetsize] */
- uch mask; /* bit within array */
- uch hash; /* hash code */
- size_t smultis;
- char *multis; /* -> char[smulti] ab\0cd\0ef\0\0 */
-} cset;
-/* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */
-#define CHadd(cs, c) ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (c))
-#define CHsub(cs, c) ((cs)->ptr[(uch)(c)] &= ~(cs)->mask, (cs)->hash -= (c))
-#define CHIN(cs, c) ((cs)->ptr[(uch)(c)] & (cs)->mask)
-#define MCadd(p, cs, cp) mcadd(p, cs, cp) /* regcomp() internal fns */
-#define MCsub(p, cs, cp) mcsub(p, cs, cp)
-#define MCin(p, cs, cp) mcin(p, cs, cp)
-
-/* stuff for character categories */
-typedef unsigned char cat_t;
-
-/*
- * main compiled-expression structure
- */
-struct re_guts {
- int magic;
-# define MAGIC2 ((('R'^0200)<<8)|'E')
- sop *strip; /* malloced area for strip */
- int csetsize; /* number of bits in a cset vector */
- int ncsets; /* number of csets in use */
- cset *sets; /* -> cset [ncsets] */
- uch *setbits; /* -> uch[csetsize][ncsets/CHAR_BIT] */
- int cflags; /* copy of regcomp() cflags argument */
- sopno nstates; /* = number of sops */
- sopno firststate; /* the initial OEND (normally 0) */
- sopno laststate; /* the final OEND */
- int iflags; /* internal flags */
-# define USEBOL 01 /* used ^ */
-# define USEEOL 02 /* used $ */
-# define BAD 04 /* something wrong */
- int nbol; /* number of ^ used */
- int neol; /* number of $ used */
- int ncategories; /* how many character categories */
- cat_t *categories; /* ->catspace[-CHAR_MIN] */
- char *must; /* match must contain this string */
- int mlen; /* length of must */
- size_t nsub; /* copy of re_nsub */
- int backrefs; /* does it use back references? */
- sopno nplus; /* how deep does it nest +s? */
- /* catspace must be last */
- cat_t catspace[1]; /* actually [NC] */
-};
-
-/* misc utilities */
-#define OUT (CHAR_MAX+1) /* a non-character value */
-#define ISWORD(c) (isalnum(c) || (c) == '_')
diff --git a/winsup/cygwin/regex/regexec.c b/winsup/cygwin/regex/regexec.c
deleted file mode 100644
index 5ab72e00e..000000000
--- a/winsup/cygwin/regex/regexec.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * the outer shell of regexec()
- *
- * This file includes engine.c *twice*, after muchos fiddling with the
- * macros that code uses. This lets the same code operate on two different
- * representations for state sets.
- */
-#include "winsup.h"
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <ctype.h>
-#include "regex.h"
-
-#include "utils.h"
-#include "regex2.h"
-
-#ifdef lint
-static int nope = 0; /* for use in asserts; shuts lint up */
-#endif
-
-/* macros for manipulating states, small version */
-#define states unsigned
-#define states1 unsigned /* for later use in regexec() decision */
-#define CLEAR(v) ((v) = 0)
-#define SET0(v, n) ((v) &= ~((unsigned)1 << (n)))
-#define SET1(v, n) ((v) |= (unsigned)1 << (n))
-#define ISSET(v, n) ((v) & ((unsigned)1 << (n)))
-#define ASSIGN(d, s) ((d) = (s))
-#define EQ(a, b) ((a) == (b))
-#define STATEVARS int dummy /* dummy version */
-#define STATESETUP(m, n) /* nothing */
-#define STATETEARDOWN(m) /* nothing */
-#define SETUP(v) ((v) = 0)
-#define onestate unsigned
-#define INIT(o, n) ((o) = (unsigned)1 << (n))
-#define INC(o) ((o) <<= 1)
-#define ISSTATEIN(v, o) ((v) & (o))
-/* some abbreviations; note that some of these know variable names! */
-/* do "if I'm here, I can also be there" etc without branches */
-#define FWD(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) << (n))
-#define BACK(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) >> (n))
-#define ISSETBACK(v, n) ((v) & ((unsigned)here >> (n)))
-/* function names */
-#define SNAMES /* engine.c looks after details */
-
-#include "engine.c"
-
-/* now undo things */
-#undef states
-#undef CLEAR
-#undef SET0
-#undef SET1
-#undef ISSET
-#undef ASSIGN
-#undef EQ
-#undef STATEVARS
-#undef STATESETUP
-#undef STATETEARDOWN
-#undef SETUP
-#undef onestate
-#undef INIT
-#undef INC
-#undef ISSTATEIN
-#undef FWD
-#undef BACK
-#undef ISSETBACK
-#undef SNAMES
-
-/* macros for manipulating states, large version */
-#define states char *
-#define CLEAR(v) memset(v, 0, m->g->nstates)
-#define SET0(v, n) ((v)[n] = 0)
-#define SET1(v, n) ((v)[n] = 1)
-#define ISSET(v, n) ((v)[n])
-#define ASSIGN(d, s) memcpy(d, s, m->g->nstates)
-#define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0)
-#define STATEVARS int vn; char *space
-#define STATESETUP(m, nv) { (m)->space = malloc((nv)*(m)->g->nstates); \
- if ((m)->space == NULL) return(REG_ESPACE); \
- (m)->vn = 0; }
-#define STATETEARDOWN(m) { free((m)->space); }
-#define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates])
-#define onestate int
-#define INIT(o, n) ((o) = (n))
-#define INC(o) ((o)++)
-#define ISSTATEIN(v, o) ((v)[o])
-/* some abbreviations; note that some of these know variable names! */
-/* do "if I'm here, I can also be there" etc without branches */
-#define FWD(dst, src, n) ((dst)[here+(n)] |= (src)[here])
-#define BACK(dst, src, n) ((dst)[here-(n)] |= (src)[here])
-#define ISSETBACK(v, n) ((v)[here - (n)])
-/* function names */
-#define LNAMES /* flag */
-
-#include "engine.c"
-
-/*
- - regexec - interface for matching
- = extern int regexec(const regex_t *, const char *, size_t, \
- = regmatch_t [], int);
- = #define REG_NOTBOL 00001
- = #define REG_NOTEOL 00002
- = #define REG_STARTEND 00004
- = #define REG_TRACE 00400 // tracing of execution
- = #define REG_LARGE 01000 // force large representation
- = #define REG_BACKR 02000 // force use of backref code
- *
- * We put this here so we can exploit knowledge of the state representation
- * when choosing which matcher to call. Also, by this point the matchers
- * have been prototyped.
- */
-int /* 0 success, REG_NOMATCH failure */
-regexec(preg, string, nmatch, pmatch, eflags)
-const regex_t *preg;
-const char *string;
-size_t nmatch;
-regmatch_t pmatch[];
-int eflags;
-{
- register struct re_guts *g = preg->re_g;
-#ifdef REDEBUG
-# define GOODFLAGS(f) (f)
-#else
-# define GOODFLAGS(f) ((f)&(REG_NOTBOL|REG_NOTEOL|REG_STARTEND))
-#endif
-
- if (preg->re_magic != MAGIC1 || g->magic != MAGIC2)
- return(REG_BADPAT);
- assert(!(g->iflags&BAD));
- if (g->iflags&BAD) /* backstop for no-debug case */
- return(REG_BADPAT);
- eflags = GOODFLAGS(eflags);
-
- if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags&REG_LARGE))
- return(smatcher(g, (char *)string, nmatch, pmatch, eflags));
- else
- return(lmatcher(g, (char *)string, nmatch, pmatch, eflags));
-}
diff --git a/winsup/cygwin/regex/regfree.c b/winsup/cygwin/regex/regfree.c
deleted file mode 100644
index b8be143d8..000000000
--- a/winsup/cygwin/regex/regfree.c
+++ /dev/null
@@ -1,38 +0,0 @@
-#include "winsup.h"
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "regex.h"
-
-#include "utils.h"
-#include "regex2.h"
-
-/*
- - regfree - free everything
- = extern void regfree(regex_t *);
- */
-void
-regfree(preg)
-regex_t *preg;
-{
- register struct re_guts *g;
-
- if (preg->re_magic != MAGIC1) /* oops */
- return; /* nice to complain, but hard */
-
- g = preg->re_g;
- if (g == NULL || g->magic != MAGIC2) /* oops again */
- return;
- preg->re_magic = 0; /* mark it invalid */
- g->magic = 0; /* mark it invalid */
-
- if (g->strip != NULL)
- free((char *)g->strip);
- if (g->sets != NULL)
- free((char *)g->sets);
- if (g->setbits != NULL)
- free((char *)g->setbits);
- if (g->must != NULL)
- free(g->must);
- free((char *)g);
-}
diff --git a/winsup/cygwin/regex/tests b/winsup/cygwin/regex/tests
deleted file mode 100644
index e4d928dad..000000000
--- a/winsup/cygwin/regex/tests
+++ /dev/null
@@ -1,477 +0,0 @@
-# regular expression test set
-# Lines are at least three fields, separated by one or more tabs. "" stands
-# for an empty field. First field is an RE. Second field is flags. If
-# C flag given, regcomp() is expected to fail, and the third field is the
-# error name (minus the leading REG_).
-#
-# Otherwise it is expected to succeed, and the third field is the string to
-# try matching it against. If there is no fourth field, the match is
-# expected to fail. If there is a fourth field, it is the substring that
-# the RE is expected to match. If there is a fifth field, it is a comma-
-# separated list of what the subexpressions should match, with - indicating
-# no match for that one. In both the fourth and fifth fields, a (sub)field
-# starting with @ indicates that the (sub)expression is expected to match
-# a null string followed by the stuff after the @; this provides a way to
-# test where null strings match. The character `N' in REs and strings
-# is newline, `S' is space, `T' is tab, `Z' is NUL.
-#
-# The full list of flags:
-# - placeholder, does nothing
-# b RE is a BRE, not an ERE
-# & try it as both an ERE and a BRE
-# C regcomp() error expected, third field is error name
-# i REG_ICASE
-# m ("mundane") REG_NOSPEC
-# s REG_NOSUB (not really testable)
-# n REG_NEWLINE
-# ^ REG_NOTBOL
-# $ REG_NOTEOL
-# # REG_STARTEND (see below)
-# p REG_PEND
-#
-# For REG_STARTEND, the start/end offsets are those of the substring
-# enclosed in ().
-
-# basics
-a & a a
-abc & abc abc
-abc|de - abc abc
-a|b|c - abc a
-
-# parentheses and perversions thereof
-a(b)c - abc abc
-a\(b\)c b abc abc
-a( C EPAREN
-a( b a( a(
-a\( - a( a(
-a\( bC EPAREN
-a\(b bC EPAREN
-a(b C EPAREN
-a(b b a(b a(b
-# gag me with a right parenthesis -- 1003.2 goofed here (my fault, partly)
-a) - a) a)
-) - ) )
-# end gagging (in a just world, those *should* give EPAREN)
-a) b a) a)
-a\) bC EPAREN
-\) bC EPAREN
-a()b - ab ab
-a\(\)b b ab ab
-
-# anchoring and REG_NEWLINE
-^abc$ & abc abc
-a^b - a^b
-a^b b a^b a^b
-a$b - a$b
-a$b b a$b a$b
-^ & abc @abc
-$ & abc @
-^$ & "" @
-$^ - "" @
-\($\)\(^\) b "" @
-# stop retching, those are legitimate (although disgusting)
-^^ - "" @
-$$ - "" @
-b$ & abNc
-b$ &n abNc b
-^b$ & aNbNc
-^b$ &n aNbNc b
-^$ &n aNNb @Nb
-^$ n abc
-^$ n abcN @
-$^ n aNNb @Nb
-\($\)\(^\) bn aNNb @Nb
-^^ n^ aNNb @Nb
-$$ n aNNb @NN
-^a ^ a
-a$ $ a
-^a ^n aNb
-^b ^n aNb b
-a$ $n bNa
-b$ $n bNa b
-a*(^b$)c* - b b
-a*\(^b$\)c* b b b
-
-# certain syntax errors and non-errors
-| C EMPTY
-| b | |
-* C BADRPT
-* b * *
-+ C BADRPT
-? C BADRPT
-"" &C EMPTY
-() - abc @abc
-\(\) b abc @abc
-a||b C EMPTY
-|ab C EMPTY
-ab| C EMPTY
-(|a)b C EMPTY
-(a|)b C EMPTY
-(*a) C BADRPT
-(+a) C BADRPT
-(?a) C BADRPT
-({1}a) C BADRPT
-\(\{1\}a\) bC BADRPT
-(a|*b) C BADRPT
-(a|+b) C BADRPT
-(a|?b) C BADRPT
-(a|{1}b) C BADRPT
-^* C BADRPT
-^* b * *
-^+ C BADRPT
-^? C BADRPT
-^{1} C BADRPT
-^\{1\} bC BADRPT
-
-# metacharacters, backslashes
-a.c & abc abc
-a[bc]d & abd abd
-a\*c & a*c a*c
-a\\b & a\b a\b
-a\\\*b & a\*b a\*b
-a\bc & abc abc
-a\ &C EESCAPE
-a\\bc & a\bc a\bc
-\{ bC BADRPT
-a\[b & a[b a[b
-a[b &C EBRACK
-# trailing $ is a peculiar special case for the BRE code
-a$ & a a
-a$ & a$
-a\$ & a
-a\$ & a$ a$
-a\\$ & a
-a\\$ & a$
-a\\$ & a\$
-a\\$ & a\ a\
-
-# back references, ugh
-a\(b\)\2c bC ESUBREG
-a\(b\1\)c bC ESUBREG
-a\(b*\)c\1d b abbcbbd abbcbbd bb
-a\(b*\)c\1d b abbcbd
-a\(b*\)c\1d b abbcbbbd
-^\(.\)\1 b abc
-a\([bc]\)\1d b abcdabbd abbd b
-a\(\([bc]\)\2\)*d b abbccd abbccd
-a\(\([bc]\)\2\)*d b abbcbd
-# actually, this next one probably ought to fail, but the spec is unclear
-a\(\(b\)*\2\)*d b abbbd abbbd
-# here is a case that no NFA implementation does right
-\(ab*\)[ab]*\1 b ababaaa ababaaa a
-# check out normal matching in the presence of back refs
-\(a\)\1bcd b aabcd aabcd
-\(a\)\1bc*d b aabcd aabcd
-\(a\)\1bc*d b aabd aabd
-\(a\)\1bc*d b aabcccd aabcccd
-\(a\)\1bc*[ce]d b aabcccd aabcccd
-^\(a\)\1b\(c\)*cd$ b aabcccd aabcccd
-
-# ordinary repetitions
-ab*c & abc abc
-ab+c - abc abc
-ab?c - abc abc
-a\(*\)b b a*b a*b
-a\(**\)b b ab ab
-a\(***\)b bC BADRPT
-*a b *a *a
-**a b a a
-***a bC BADRPT
-
-# the dreaded bounded repetitions
-{ & { {
-{abc & {abc {abc
-{1 C BADRPT
-{1} C BADRPT
-a{b & a{b a{b
-a{1}b - ab ab
-a\{1\}b b ab ab
-a{1,}b - ab ab
-a\{1,\}b b ab ab
-a{1,2}b - aab aab
-a\{1,2\}b b aab aab
-a{1 C EBRACE
-a\{1 bC EBRACE
-a{1a C EBRACE
-a\{1a bC EBRACE
-a{1a} C BADBR
-a\{1a\} bC BADBR
-a{,2} - a{,2} a{,2}
-a\{,2\} bC BADBR
-a{,} - a{,} a{,}
-a\{,\} bC BADBR
-a{1,x} C BADBR
-a\{1,x\} bC BADBR
-a{1,x C EBRACE
-a\{1,x bC EBRACE
-a{300} C BADBR
-a\{300\} bC BADBR
-a{1,0} C BADBR
-a\{1,0\} bC BADBR
-ab{0,0}c - abcac ac
-ab\{0,0\}c b abcac ac
-ab{0,1}c - abcac abc
-ab\{0,1\}c b abcac abc
-ab{0,3}c - abbcac abbc
-ab\{0,3\}c b abbcac abbc
-ab{1,1}c - acabc abc
-ab\{1,1\}c b acabc abc
-ab{1,3}c - acabc abc
-ab\{1,3\}c b acabc abc
-ab{2,2}c - abcabbc abbc
-ab\{2,2\}c b abcabbc abbc
-ab{2,4}c - abcabbc abbc
-ab\{2,4\}c b abcabbc abbc
-((a{1,10}){1,10}){1,10} - a a a,a
-
-# multiple repetitions
-a** &C BADRPT
-a++ C BADRPT
-a?? C BADRPT
-a*+ C BADRPT
-a*? C BADRPT
-a+* C BADRPT
-a+? C BADRPT
-a?* C BADRPT
-a?+ C BADRPT
-a{1}{1} C BADRPT
-a*{1} C BADRPT
-a+{1} C BADRPT
-a?{1} C BADRPT
-a{1}* C BADRPT
-a{1}+ C BADRPT
-a{1}? C BADRPT
-a*{b} - a{b} a{b}
-a\{1\}\{1\} bC BADRPT
-a*\{1\} bC BADRPT
-a\{1\}* bC BADRPT
-
-# brackets, and numerous perversions thereof
-a[b]c & abc abc
-a[ab]c & abc abc
-a[^ab]c & adc adc
-a[]b]c & a]c a]c
-a[[b]c & a[c a[c
-a[-b]c & a-c a-c
-a[^]b]c & adc adc
-a[^-b]c & adc adc
-a[b-]c & a-c a-c
-a[b &C EBRACK
-a[] &C EBRACK
-a[1-3]c & a2c a2c
-a[3-1]c &C ERANGE
-a[1-3-5]c &C ERANGE
-a[[.-.]--]c & a-c a-c
-a[1- &C ERANGE
-a[[. &C EBRACK
-a[[.x &C EBRACK
-a[[.x. &C EBRACK
-a[[.x.] &C EBRACK
-a[[.x.]] & ax ax
-a[[.x,.]] &C ECOLLATE
-a[[.one.]]b & a1b a1b
-a[[.notdef.]]b &C ECOLLATE
-a[[.].]]b & a]b a]b
-a[[:alpha:]]c & abc abc
-a[[:notdef:]]c &C ECTYPE
-a[[: &C EBRACK
-a[[:alpha &C EBRACK
-a[[:alpha:] &C EBRACK
-a[[:alpha,:] &C ECTYPE
-a[[:]:]]b &C ECTYPE
-a[[:-:]]b &C ECTYPE
-a[[:alph:]] &C ECTYPE
-a[[:alphabet:]] &C ECTYPE
-[[:alnum:]]+ - -%@a0X- a0X
-[[:alpha:]]+ - -%@aX0- aX
-[[:blank:]]+ - aSSTb SST
-[[:cntrl:]]+ - aNTb NT
-[[:digit:]]+ - a019b 019
-[[:graph:]]+ - Sa%bS a%b
-[[:lower:]]+ - AabC ab
-[[:print:]]+ - NaSbN aSb
-[[:punct:]]+ - S%-&T %-&
-[[:space:]]+ - aSNTb SNT
-[[:upper:]]+ - aBCd BC
-[[:xdigit:]]+ - p0f3Cq 0f3C
-a[[=b=]]c & abc abc
-a[[= &C EBRACK
-a[[=b &C EBRACK
-a[[=b= &C EBRACK
-a[[=b=] &C EBRACK
-a[[=b,=]] &C ECOLLATE
-a[[=one=]]b & a1b a1b
-
-# complexities
-a(((b)))c - abc abc
-a(b|(c))d - abd abd
-a(b*|c)d - abbd abbd
-# just gotta have one DFA-buster, of course
-a[ab]{20} - aaaaabaaaabaaaabaaaab aaaaabaaaabaaaabaaaab
-# and an inline expansion in case somebody gets tricky
-a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab] - aaaaabaaaabaaaabaaaab aaaaabaaaabaaaabaaaab
-# and in case somebody just slips in an NFA...
-a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night) - aaaaabaaaabaaaabaaaabweeknights aaaaabaaaabaaaabaaaabweeknights
-# fish for anomalies as the number of states passes 32
-12345678901234567890123456789 - a12345678901234567890123456789b 12345678901234567890123456789
-123456789012345678901234567890 - a123456789012345678901234567890b 123456789012345678901234567890
-1234567890123456789012345678901 - a1234567890123456789012345678901b 1234567890123456789012345678901
-12345678901234567890123456789012 - a12345678901234567890123456789012b 12345678901234567890123456789012
-123456789012345678901234567890123 - a123456789012345678901234567890123b 123456789012345678901234567890123
-# and one really big one, beyond any plausible word width
-1234567890123456789012345678901234567890123456789012345678901234567890 - a1234567890123456789012345678901234567890123456789012345678901234567890b 1234567890123456789012345678901234567890123456789012345678901234567890
-# fish for problems as brackets go past 8
-[ab][cd][ef][gh][ij][kl][mn] - xacegikmoq acegikm
-[ab][cd][ef][gh][ij][kl][mn][op] - xacegikmoq acegikmo
-[ab][cd][ef][gh][ij][kl][mn][op][qr] - xacegikmoqy acegikmoq
-[ab][cd][ef][gh][ij][kl][mn][op][q] - xacegikmoqy acegikmoq
-
-# subtleties of matching
-abc & xabcy abc
-a\(b\)?c\1d b acd
-aBc i Abc Abc
-a[Bc]*d i abBCcd abBCcd
-0[[:upper:]]1 &i 0a1 0a1
-0[[:lower:]]1 &i 0A1 0A1
-a[^b]c &i abc
-a[^b]c &i aBc
-a[^b]c &i adc adc
-[a]b[c] - abc abc
-[a]b[a] - aba aba
-[abc]b[abc] - abc abc
-[abc]b[abd] - abd abd
-a(b?c)+d - accd accd
-(wee|week)(knights|night) - weeknights weeknights
-(we|wee|week|frob)(knights|night|day) - weeknights weeknights
-a[bc]d - xyzaaabcaababdacd abd
-a[ab]c - aaabc abc
-abc s abc abc
-a* & b @b
-
-# Let's have some fun -- try to match a C comment.
-# first the obvious, which looks okay at first glance...
-/\*.*\*/ - /*x*/ /*x*/
-# but...
-/\*.*\*/ - /*x*/y/*z*/ /*x*/y/*z*/
-# okay, we must not match */ inside; try to do that...
-/\*([^*]|\*[^/])*\*/ - /*x*/ /*x*/
-/\*([^*]|\*[^/])*\*/ - /*x*/y/*z*/ /*x*/
-# but...
-/\*([^*]|\*[^/])*\*/ - /*x**/y/*z*/ /*x**/y/*z*/
-# and a still fancier version, which does it right (I think)...
-/\*([^*]|\*+[^*/])*\*+/ - /*x*/ /*x*/
-/\*([^*]|\*+[^*/])*\*+/ - /*x*/y/*z*/ /*x*/
-/\*([^*]|\*+[^*/])*\*+/ - /*x**/y/*z*/ /*x**/
-/\*([^*]|\*+[^*/])*\*+/ - /*x****/y/*z*/ /*x****/
-/\*([^*]|\*+[^*/])*\*+/ - /*x**x*/y/*z*/ /*x**x*/
-/\*([^*]|\*+[^*/])*\*+/ - /*x***x/y/*z*/ /*x***x/y/*z*/
-
-# subexpressions
-.* - abc abc -
-a(b)(c)d - abcd abcd b,c
-a(((b)))c - abc abc b,b,b
-a(b|(c))d - abd abd b,-
-a(b*|c|e)d - abbd abbd bb
-a(b*|c|e)d - acd acd c
-a(b*|c|e)d - ad ad @d
-a(b?)c - abc abc b
-a(b?)c - ac ac @c
-a(b+)c - abc abc b
-a(b+)c - abbbc abbbc bbb
-a(b*)c - ac ac @c
-(a|ab)(bc([de]+)f|cde) - abcdef abcdef a,bcdef,de
-# the regression tester only asks for 9 subexpressions
-a(b)(c)(d)(e)(f)(g)(h)(i)(j)k - abcdefghijk abcdefghijk b,c,d,e,f,g,h,i,j
-a(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)l - abcdefghijkl abcdefghijkl b,c,d,e,f,g,h,i,j,k
-a([bc]?)c - abc abc b
-a([bc]?)c - ac ac @c
-a([bc]+)c - abc abc b
-a([bc]+)c - abcc abcc bc
-a([bc]+)bc - abcbc abcbc bc
-a(bb+|b)b - abb abb b
-a(bbb+|bb+|b)b - abb abb b
-a(bbb+|bb+|b)b - abbb abbb bb
-a(bbb+|bb+|b)bb - abbb abbb b
-(.*).* - abcdef abcdef abcdef
-(a*)* - bc @b @b
-
-# do we get the right subexpression when it is used more than once?
-a(b|c)*d - ad ad -
-a(b|c)*d - abcd abcd c
-a(b|c)+d - abd abd b
-a(b|c)+d - abcd abcd c
-a(b|c?)+d - ad ad @d
-a(b|c?)+d - abcd abcd @d
-a(b|c){0,0}d - ad ad -
-a(b|c){0,1}d - ad ad -
-a(b|c){0,1}d - abd abd b
-a(b|c){0,2}d - ad ad -
-a(b|c){0,2}d - abcd abcd c
-a(b|c){0,}d - ad ad -
-a(b|c){0,}d - abcd abcd c
-a(b|c){1,1}d - abd abd b
-a(b|c){1,1}d - acd acd c
-a(b|c){1,2}d - abd abd b
-a(b|c){1,2}d - abcd abcd c
-a(b|c){1,}d - abd abd b
-a(b|c){1,}d - abcd abcd c
-a(b|c){2,2}d - acbd acbd b
-a(b|c){2,2}d - abcd abcd c
-a(b|c){2,4}d - abcd abcd c
-a(b|c){2,4}d - abcbd abcbd b
-a(b|c){2,4}d - abcbcd abcbcd c
-a(b|c){2,}d - abcd abcd c
-a(b|c){2,}d - abcbd abcbd b
-a(b+|((c)*))+d - abd abd @d,@d,-
-a(b+|((c)*))+d - abcd abcd @d,@d,-
-
-# check out the STARTEND option
-[abc] &# a(b)c b
-[abc] &# a(d)c
-[abc] &# a(bc)d b
-[abc] &# a(dc)d c
-. &# a()c
-b.*c &# b(bc)c bc
-b.* &# b(bc)c bc
-.*c &# b(bc)c bc
-
-# plain strings, with the NOSPEC flag
-abc m abc abc
-abc m xabcy abc
-abc m xyz
-a*b m aba*b a*b
-a*b m ab
-"" mC EMPTY
-
-# cases involving NULs
-aZb & a a
-aZb &p a
-aZb &p# (aZb) aZb
-aZ*b &p# (ab) ab
-a.b &# (aZb) aZb
-a.* &# (aZb)c aZb
-
-# word boundaries (ick)
-[[:<:]]a & a a
-[[:<:]]a & ba
-[[:<:]]a & -a a
-a[[:>:]] & a a
-a[[:>:]] & ab
-a[[:>:]] & a- a
-[[:<:]]a.c[[:>:]] & axcd-dayc-dazce-abc abc
-[[:<:]]a.c[[:>:]] & axcd-dayc-dazce-abc-q abc
-[[:<:]]a.c[[:>:]] & axc-dayc-dazce-abc axc
-[[:<:]]b.c[[:>:]] & a_bxc-byc_d-bzc-q bzc
-[[:<:]].x..[[:>:]] & y_xa_-_xb_y-_xc_-axdc _xc_
-[[:<:]]a_b[[:>:]] & x_a_b
-
-# past problems, and suspected problems
-(A[1])|(A[2])|(A[3])|(A[4])|(A[5])|(A[6])|(A[7])|(A[8])|(A[9])|(A[A]) - A1 A1
-abcdefghijklmnop i abcdefghijklmnop abcdefghijklmnop
-abcdefghijklmnopqrstuv i abcdefghijklmnopqrstuv abcdefghijklmnopqrstuv
-(ALAK)|(ALT[AB])|(CC[123]1)|(CM[123]1)|(GAMC)|(LC[23][EO ])|(SEM[1234])|(SL[ES][12])|(SLWW)|(SLF )|(SLDT)|(VWH[12])|(WH[34][EW])|(WP1[ESN]) - CC11 CC11
-CC[13]1|a{21}[23][EO][123][Es][12]a{15}aa[34][EW]aaaaaaa[X]a - CC11 CC11
-Char \([a-z0-9_]*\)\[.* b Char xyz[k Char xyz[k xyz
-a?b - ab ab
--\{0,1\}[0-9]*$ b -5 -5
-a*a*a*a*a*a*a* & aaaaaa aaaaaa
diff --git a/winsup/cygwin/regex/utils.h b/winsup/cygwin/regex/utils.h
deleted file mode 100644
index 1a997ac8f..000000000
--- a/winsup/cygwin/regex/utils.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* utility definitions */
-#ifdef _POSIX2_RE_DUP_MAX
-#define DUPMAX _POSIX2_RE_DUP_MAX
-#else
-#define DUPMAX 255
-#endif
-#define INFINITY (DUPMAX + 1)
-#define NC (CHAR_MAX - CHAR_MIN + 1)
-typedef unsigned char uch;
-
-/* switch off assertions (if not already off) if no REDEBUG */
-#ifndef REDEBUG
-#ifndef NDEBUG
-#define NDEBUG /* no assertions please */
-#endif
-#endif
-#include <assert.h>
-
-/* for old systems with bcopy() but no memmove() */
-#ifdef USEBCOPY
-#define memmove(d, s, c) bcopy(s, d, c)
-#endif
diff --git a/winsup/cygwin/regexp/COPYRIGHT b/winsup/cygwin/regexp/COPYRIGHT
deleted file mode 100644
index 48b3f4339..000000000
--- a/winsup/cygwin/regexp/COPYRIGHT
+++ /dev/null
@@ -1,22 +0,0 @@
-This entire subtree is copyright the University of Toronto.
-The following copyright notice applies to all files found here. None of
-these files contain AT&T proprietary source code.
-_____________________________________________________________________________
-
- Copyright (c) 1986 by University of Toronto.
- Written by Henry Spencer. Not derived from licensed software.
-
- Permission is granted to anyone to use this software for any
- purpose on any computer system, and to redistribute it freely,
- subject to the following restrictions:
-
- 1. The author is not responsible for the consequences of use of
- this software, no matter how awful, even if they arise
- from defects in it.
-
- 2. The origin of this software must not be misrepresented, either
- by explicit claim or by omission.
-
- 3. Altered versions must be plainly marked as such, and must not
- be misrepresented as being the original software.
-
diff --git a/winsup/cygwin/regexp/README b/winsup/cygwin/regexp/README
deleted file mode 100644
index 37d6f51c7..000000000
--- a/winsup/cygwin/regexp/README
+++ /dev/null
@@ -1,84 +0,0 @@
-This is a nearly-public-domain reimplementation of the V8 regexp(3) package.
-It gives C programs the ability to use egrep-style regular expressions, and
-does it in a much cleaner fashion than the analogous routines in SysV.
-
- Copyright (c) 1986 by University of Toronto.
- Written by Henry Spencer. Not derived from licensed software.
-
- Permission is granted to anyone to use this software for any
- purpose on any computer system, and to redistribute it freely,
- subject to the following restrictions:
-
- 1. The author is not responsible for the consequences of use of
- this software, no matter how awful, even if they arise
- from defects in it.
-
- 2. The origin of this software must not be misrepresented, either
- by explicit claim or by omission.
-
- 3. Altered versions must be plainly marked as such, and must not
- be misrepresented as being the original software.
-
-Barring a couple of small items in the BUGS list, this implementation is
-believed 100% compatible with V8. It should even be binary-compatible,
-sort of, since the only fields in a "struct regexp" that other people have
-any business touching are declared in exactly the same way at the same
-location in the struct (the beginning).
-
-This implementation is *NOT* AT&T/Bell code, and is not derived from licensed
-software. Even though U of T is a V8 licensee. This software is based on
-a V8 manual page sent to me by Dennis Ritchie (the manual page enclosed
-here is a complete rewrite and hence is not covered by AT&T copyright).
-The software was nearly complete at the time of arrival of our V8 tape.
-I haven't even looked at V8 yet, although a friend elsewhere at U of T has
-been kind enough to run a few test programs using the V8 regexp(3) to resolve
-a few fine points. I admit to some familiarity with regular-expression
-implementations of the past, but the only one that this code traces any
-ancestry to is the one published in Kernighan & Plauger (from which this
-one draws ideas but not code).
-
-Simplistically: put this stuff into a source directory, copy regexp.h into
-/usr/include, inspect Makefile for compilation options that need changing
-to suit your local environment, and then do "make r". This compiles the
-regexp(3) functions, compiles a test program, and runs a large set of
-regression tests. If there are no complaints, then put regexp.o, regsub.o,
-and regerror.o into your C library, and regexp.3 into your manual-pages
-directory.
-
-Note that if you don't put regexp.h into /usr/include *before* compiling,
-you'll have to add "-I." to CFLAGS before compiling.
-
-The files are:
-
-Makefile instructions to make everything
-regexp.3 manual page
-regexp.h header file, for /usr/include
-regexp.c source for regcomp() and regexec()
-regsub.c source for regsub()
-regerror.c source for default regerror()
-regmagic.h internal header file
-try.c source for test program
-timer.c source for timing program
-tests test list for try and timer
-
-This implementation uses nondeterministic automata rather than the
-deterministic ones found in some other implementations, which makes it
-simpler, smaller, and faster at compiling regular expressions, but slower
-at executing them. In theory, anyway. This implementation does employ
-some special-case optimizations to make the simpler cases (which do make
-up the bulk of regular expressions actually used) run quickly. In general,
-if you want blazing speed you're in the wrong place. Replacing the insides
-of egrep with this stuff is probably a mistake; if you want your own egrep
-you're going to have to do a lot more work. But if you want to use regular
-expressions a little bit in something else, you're in luck. Note that many
-existing text editors use nondeterministic regular-expression implementations,
-so you're in good company.
-
-This stuff should be pretty portable, given appropriate option settings.
-If your chars have less than 8 bits, you're going to have to change the
-internal representation of the automaton, although knowledge of the details
-of this is fairly localized. There are no "reserved" char values except for
-NUL, and no special significance is attached to the top bit of chars.
-The string(3) functions are used a fair bit, on the grounds that they are
-probably faster than coding the operations in line. Some attempts at code
-tuning have been made, but this is invariably a bit machine-specific.
diff --git a/winsup/cygwin/regexp/regexp.h b/winsup/cygwin/regexp/regexp.h
deleted file mode 100644
index 0850d70a4..000000000
--- a/winsup/cygwin/regexp/regexp.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* regexp.h
-
- Copyright 1996, 2001 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. */
-
-/*
- * Definitions etc. for regexp(3) routines.
- *
- * Caveat: this is V8 regexp(3) [actually, a reimplementation thereof],
- * not the System V one.
- *
- * $Id$
- */
-
-#define NSUBEXP 10
-typedef struct regexp {
- char *startp[NSUBEXP];
- char *endp[NSUBEXP];
- char regstart; /* Internal use only. */
- char reganch; /* Internal use only. */
- char *regmust; /* Internal use only. */
- int regmlen; /* Internal use only. */
- char program[1]; /* Unwarranted chumminess with compiler. */
-} regexp;
-
-extern regexp *regcomp();
-extern int regexec();
-extern void regsub();
-extern void regerror();
diff --git a/winsup/cygwin/regexp/regmagic.h b/winsup/cygwin/regexp/regmagic.h
deleted file mode 100644
index ea7835711..000000000
--- a/winsup/cygwin/regexp/regmagic.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* regmagic.h
-
- Copyright 1996, 2001 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. */
-
-/* $Id$ */
-
-/*
- * The first byte of the regexp internal "program" is actually this magic
- * number; the start node begins in the second byte.
- */
-#define MAGIC 0234
diff --git a/winsup/cygwin/regexp/v8_regerror.c b/winsup/cygwin/regexp/v8_regerror.c
deleted file mode 100644
index 56d63ff2f..000000000
--- a/winsup/cygwin/regexp/v8_regerror.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* regerror.c
-
- Copyright 1996, 1998, 2001 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 "winsup.h"
-#include "regexp.h"
-#include <stdio.h>
-
-void __declspec(dllexport)
-regerror(const char *s __attribute__ ((unused)))
-{
-#ifdef ERRAVAIL
- error("regexp: %s", s);
-#else
-/*
- fprintf(stderr, "regexp(3): %s\n", s);
- exit(1);
-*/
- return; /* let std. egrep handle errors */
-#endif
- /* NOTREACHED */
-}
diff --git a/winsup/cygwin/regexp/v8_regexp.c b/winsup/cygwin/regexp/v8_regexp.c
deleted file mode 100644
index fef1267a0..000000000
--- a/winsup/cygwin/regexp/v8_regexp.c
+++ /dev/null
@@ -1,1321 +0,0 @@
-/*
- * regcomp and regexec -- regsub and regerror are elsewhere
- *
- * Copyright (c) 1986 by University of Toronto.
- * Written by Henry Spencer. Not derived from licensed software.
- *
- * Permission is granted to anyone to use this software for any
- * purpose on any computer system, and to redistribute it freely,
- * subject to the following restrictions:
- *
- * 1. The author is not responsible for the consequences of use of
- * this software, no matter how awful, even if they arise
- * from defects in it.
- *
- * 2. The origin of this software must not be misrepresented, either
- * by explicit claim or by omission.
- *
- * 3. Altered versions must be plainly marked as such, and must not
- * be misrepresented as being the original software.
- *** THIS IS AN ALTERED VERSION. It was altered by John Gilmore,
- *** hoptoad!gnu, on 27 Dec 1986, to add \n as an alternative to |
- *** to assist in implementing egrep.
- *** THIS IS AN ALTERED VERSION. It was altered by John Gilmore,
- *** hoptoad!gnu, on 27 Dec 1986, to add \< and \> for word-matching
- *** as in BSD grep and ex.
- *** THIS IS AN ALTERED VERSION. It was altered by John Gilmore,
- *** hoptoad!gnu, on 28 Dec 1986, to optimize characters quoted with \.
- *** THIS IS AN ALTERED VERSION. It was altered by James A. Woods,
- *** ames!jaw, on 19 June 1987, to quash a regcomp() redundancy.
- *** THIS IS AN ALTERED VERSION. It was altered by Geoffrey Noer,
- *** noer@cygnus.com, on 6 Oct 1997, to change the prototype format
- *** for inclusion in the Cygwin32 library.
- *
- * Beware that some of this code is subtly aware of the way operator
- * precedence is structured in regular expressions. Serious changes in
- * regular-expression syntax might require a total rethink.
- */
-
-#include "winsup.h"
-#include "regexp.h"
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include "regmagic.h"
-
-/*
- * The "internal use only" fields in regexp.h are present to pass info from
- * compile to execute that permits the execute phase to run lots faster on
- * simple cases. They are:
- *
- * regstart char that must begin a match; '\0' if none obvious
- * reganch is the match anchored (at beginning-of-line only)?
- * regmust string (pointer into program) that match must include, or NULL
- * regmlen length of regmust string
- *
- * Regstart and reganch permit very fast decisions on suitable starting points
- * for a match, cutting down the work a lot. Regmust permits fast rejection
- * of lines that cannot possibly match. The regmust tests are costly enough
- * that regcomp() supplies a regmust only if the r.e. contains something
- * potentially expensive (at present, the only such thing detected is * or +
- * at the start of the r.e., which can involve a lot of backup). Regmlen is
- * supplied because the test in regexec() needs it and regcomp() is computing
- * it anyway.
- */
-
-/*
- * Structure for regexp "program". This is essentially a linear encoding
- * of a nondeterministic finite-state machine (aka syntax charts or
- * "railroad normal form" in parsing technology). Each node is an opcode
- * plus a "next" pointer, possibly plus an operand. "Next" pointers of
- * all nodes except BRANCH implement concatenation; a "next" pointer with
- * a BRANCH on both ends of it is connecting two alternatives. (Here we
- * have one of the subtle syntax dependencies: an individual BRANCH (as
- * opposed to a collection of them) is never concatenated with anything
- * because of operator precedence.) The operand of some types of node is
- * a literal string; for others, it is a node leading into a sub-FSM. In
- * particular, the operand of a BRANCH node is the first node of the branch.
- * (NB this is *not* a tree structure: the tail of the branch connects
- * to the thing following the set of BRANCHes.) The opcodes are:
- */
-
-/* definition number opnd? meaning */
-#define END 0 /* no End of program. */
-#define BOL 1 /* no Match "" at beginning of line. */
-#define EOL 2 /* no Match "" at end of line. */
-#define ANY 3 /* no Match any one character. */
-#define ANYOF 4 /* str Match any character in this string. */
-#define ANYBUT 5 /* str Match any character not in this string. */
-#define BRANCH 6 /* node Match this alternative, or the next... */
-#define BACK 7 /* no Match "", "next" ptr points backward. */
-#define EXACTLY 8 /* str Match this string. */
-#define NOTHING 9 /* no Match empty string. */
-#define STAR 10 /* node Match this (simple) thing 0 or more times. */
-#define PLUS 11 /* node Match this (simple) thing 1 or more times. */
-#define WORDA 12 /* no Match "" at wordchar, where prev is nonword */
-#define WORDZ 13 /* no Match "" at nonwordchar, where prev is word */
-#define OPEN 20 /* no Mark this point in input as start of #n. */
- /* OPEN+1 is number 1, etc. */
-#define CLOSE 30 /* no Analogous to OPEN. */
-
-/*
- * Opcode notes:
- *
- * BRANCH The set of branches constituting a single choice are hooked
- * together with their "next" pointers, since precedence prevents
- * anything being concatenated to any individual branch. The
- * "next" pointer of the last BRANCH in a choice points to the
- * thing following the whole choice. This is also where the
- * final "next" pointer of each individual branch points; each
- * branch starts with the operand node of a BRANCH node.
- *
- * BACK Normal "next" pointers all implicitly point forward; BACK
- * exists to make loop structures possible.
- *
- * STAR,PLUS '?', and complex '*' and '+', are implemented as circular
- * BRANCH structures using BACK. Simple cases (one character
- * per match) are implemented with STAR and PLUS for speed
- * and to minimize recursive plunges.
- *
- * OPEN,CLOSE ...are numbered at compile time.
- */
-
-/*
- * A node is one char of opcode followed by two chars of "next" pointer.
- * "Next" pointers are stored as two 8-bit pieces, high order first. The
- * value is a positive offset from the opcode of the node containing it.
- * An operand, if any, simply follows the node. (Note that much of the
- * code generation knows about this implicit relationship.)
- *
- * Using two bytes for the "next" pointer is vast overkill for most things,
- * but allows patterns to get big without disasters.
- */
-#define OP(p) (*(p))
-#define NEXT(p) (((*((p)+1)&0377)<<8) + (*((p)+2)&0377))
-#define OPERAND(p) ((p) + 3)
-
-/*
- * See regmagic.h for one further detail of program structure.
- */
-
-
-/*
- * Utility definitions.
- */
-#ifndef CHARBITS
-#define UCHARAT(p) ((int)*(unsigned char *)(p))
-#else
-#define UCHARAT(p) ((int)*(p)&CHARBITS)
-#endif
-
-#define FAIL(m) { regerror(m); return(NULL); }
-#define ISMULT(c) ((c) == '*' || (c) == '+' || (c) == '?')
-
-/*
- * Flags to be passed up and down.
- */
-#define HASWIDTH 01 /* Known never to match null string. */
-#define SIMPLE 02 /* Simple enough to be STAR/PLUS operand. */
-#define SPSTART 04 /* Starts with * or +. */
-#define WORST 0 /* Worst case. */
-
-/*
- * Global work variables for regcomp().
- */
-static char *regparse; /* Input-scan pointer. */
-static int regnpar; /* () count. */
-static char regdummy;
-static char *regcode; /* Code-emit pointer; &regdummy = don't. */
-static long regsize; /* Code size. */
-
-/*
- * Forward declarations for regcomp()'s friends.
- */
-#ifndef STATIC
-#define STATIC static
-#endif
-STATIC char *reg (int, int *);
-STATIC char *regbranch (int *);
-STATIC char *regpiece (int *);
-STATIC char *regatom (int *);
-STATIC char *regnode (char);
-STATIC char *regnext (char *);
-STATIC void regc (char);
-STATIC void reginsert (char, char *);
-STATIC void regtail (char *, char *);
-STATIC void regoptail (char *, char *);
-#ifdef STRCSPN
-STATIC int strcspn (char *, char *);
-#endif
-
-/*
- - regcomp - compile a regular expression into internal code
- *
- * We can't allocate space until we know how big the compiled form will be,
- * but we can't compile it (and thus know how big it is) until we've got a
- * place to put the code. So we cheat: we compile it twice, once with code
- * generation turned off and size counting turned on, and once "for real".
- * This also means that we don't allocate space until we are sure that the
- * thing really will compile successfully, and we never have to move the
- * code and thus invalidate pointers into it. (Note that it has to be in
- * one piece because free() must be able to free it all.)
- *
- * Beware that the optimization-preparation code in here knows about some
- * of the structure of the compiled regexp.
- */
-regexp * __declspec(dllexport)
-regcomp(exp)
-const char *exp;
-{
- register regexp *r;
- register char *scan;
- register char *longest;
- register int len;
- int flags;
-
- if (exp == NULL)
- FAIL("NULL argument");
-
- /* First pass: determine size, legality. */
-#ifdef notdef
- if (exp[0] == '.' && exp[1] == '*') exp += 2; /* aid grep */
-#endif
- regparse = (char *)exp;
- regnpar = 1;
- regsize = 0L;
- regcode = &regdummy;
- regc(MAGIC);
- if (reg(0, &flags) == NULL)
- return(NULL);
-
- /* Small enough for pointer-storage convention? */
- if (regsize >= 32767L) /* Probably could be 65535L. */
- FAIL("regexp too big");
-
- /* Allocate space. */
- r = (regexp *)malloc(sizeof(regexp) + (unsigned)regsize);
- if (r == NULL)
- FAIL("out of space");
-
- /* Second pass: emit code. */
- regparse = (char *)exp;
- regnpar = 1;
- regcode = r->program;
- regc(MAGIC);
- if (reg(0, &flags) == NULL)
- return(NULL);
-
- /* Dig out information for optimizations. */
- r->regstart = '\0'; /* Worst-case defaults. */
- r->reganch = 0;
- r->regmust = NULL;
- r->regmlen = 0;
- scan = r->program+1; /* First BRANCH. */
- if (OP(regnext(scan)) == END) { /* Only one top-level choice. */
- scan = OPERAND(scan);
-
- /* Starting-point info. */
- if (OP(scan) == EXACTLY)
- r->regstart = *OPERAND(scan);
- else if (OP(scan) == BOL)
- r->reganch++;
-
- /*
- * If there's something expensive in the r.e., find the
- * longest literal string that must appear and make it the
- * regmust. Resolve ties in favor of later strings, since
- * the regstart check works with the beginning of the r.e.
- * and avoiding duplication strengthens checking. Not a
- * strong reason, but sufficient in the absence of others.
- */
- if (flags&SPSTART) {
- longest = NULL;
- len = 0;
- for (; scan != NULL; scan = regnext(scan))
- if (OP(scan) == EXACTLY && (int) strlen(OPERAND(scan)) >= len) {
- longest = OPERAND(scan);
- len = strlen(OPERAND(scan));
- }
- r->regmust = longest;
- r->regmlen = len;
- }
- }
-
- return(r);
-}
-
-/*
- - reg - regular expression, i.e. main body or parenthesized thing
- *
- * Caller must absorb opening parenthesis.
- *
- * Combining parenthesis handling with the base level of regular expression
- * is a trifle forced, but the need to tie the tails of the branches to what
- * follows makes it hard to avoid.
- */
-static char *
-reg(paren, flagp)
-int paren; /* Parenthesized? */
-int *flagp;
-{
- register char *ret;
- register char *br;
- register char *ender;
- register int parno = 0;
- int flags;
-
- *flagp = HASWIDTH; /* Tentatively. */
-
- /* Make an OPEN node, if parenthesized. */
- if (paren) {
- if (regnpar >= NSUBEXP)
- FAIL("too many ()");
- parno = regnpar;
- regnpar++;
- ret = regnode(OPEN+parno);
- } else
- ret = NULL;
-
- /* Pick up the branches, linking them together. */
- br = regbranch(&flags);
- if (br == NULL)
- return(NULL);
- if (ret != NULL)
- regtail(ret, br); /* OPEN -> first. */
- else
- ret = br;
- if (!(flags&HASWIDTH))
- *flagp &= ~HASWIDTH;
- *flagp |= flags&SPSTART;
- while (*regparse == '|' || *regparse == '\n') {
- regparse++;
- br = regbranch(&flags);
- if (br == NULL)
- return(NULL);
- regtail(ret, br); /* BRANCH -> BRANCH. */
- if (!(flags&HASWIDTH))
- *flagp &= ~HASWIDTH;
- *flagp |= flags&SPSTART;
- }
-
- /* Make a closing node, and hook it on the end. */
- ender = regnode((paren) ? CLOSE+parno : END);
- regtail(ret, ender);
-
- /* Hook the tails of the branches to the closing node. */
- for (br = ret; br != NULL; br = regnext(br))
- regoptail(br, ender);
-
- /* Check for proper termination. */
- if (paren && *regparse++ != ')') {
- FAIL("unmatched ()");
- } else if (!paren && *regparse != '\0') {
- if (*regparse == ')') {
- FAIL("unmatched ()");
- } else
- FAIL("junk on end"); /* "Can't happen". */
- /* NOTREACHED */
- }
-
- return(ret);
-}
-
-/*
- - regbranch - one alternative of an | operator
- *
- * Implements the concatenation operator.
- */
-static char *
-regbranch(flagp)
-int *flagp;
-{
- register char *ret;
- register char *chain;
- register char *latest;
- int flags;
-
- *flagp = WORST; /* Tentatively. */
-
- ret = regnode(BRANCH);
- chain = NULL;
- while (*regparse != '\0' && *regparse != ')' &&
- *regparse != '\n' && *regparse != '|') {
- latest = regpiece(&flags);
- if (latest == NULL)
- return(NULL);
- *flagp |= flags&HASWIDTH;
- if (chain == NULL) /* First piece. */
- *flagp |= flags&SPSTART;
- else
- regtail(chain, latest);
- chain = latest;
- }
- if (chain == NULL) /* Loop ran zero times. */
- (void) regnode(NOTHING);
-
- return(ret);
-}
-
-/*
- - regpiece - something followed by possible [*+?]
- *
- * Note that the branching code sequences used for ? and the general cases
- * of * and + are somewhat optimized: they use the same NOTHING node as
- * both the endmarker for their branch list and the body of the last branch.
- * It might seem that this node could be dispensed with entirely, but the
- * endmarker role is not redundant.
- */
-static char *
-regpiece(flagp)
-int *flagp;
-{
- register char *ret;
- register char op;
- register char *next;
- int flags;
-
- ret = regatom(&flags);
- if (ret == NULL)
- return(NULL);
-
- op = *regparse;
- if (!ISMULT(op)) {
- *flagp = flags;
- return(ret);
- }
-
- if (!(flags&HASWIDTH) && op != '?')
- FAIL("*+ operand could be empty");
- *flagp = (op != '+') ? (WORST|SPSTART) : (WORST|HASWIDTH);
-
- if (op == '*' && (flags&SIMPLE))
- reginsert(STAR, ret);
- else if (op == '*') {
- /* Emit x* as (x&|), where & means "self". */
- reginsert(BRANCH, ret); /* Either x */
- regoptail(ret, regnode(BACK)); /* and loop */
- regoptail(ret, ret); /* back */
- regtail(ret, regnode(BRANCH)); /* or */
- regtail(ret, regnode(NOTHING)); /* null. */
- } else if (op == '+' && (flags&SIMPLE))
- reginsert(PLUS, ret);
- else if (op == '+') {
- /* Emit x+ as x(&|), where & means "self". */
- next = regnode(BRANCH); /* Either */
- regtail(ret, next);
- regtail(regnode(BACK), ret); /* loop back */
- regtail(next, regnode(BRANCH)); /* or */
- regtail(ret, regnode(NOTHING)); /* null. */
- } else if (op == '?') {
- /* Emit x? as (x|) */
- reginsert(BRANCH, ret); /* Either x */
- regtail(ret, regnode(BRANCH)); /* or */
- next = regnode(NOTHING); /* null. */
- regtail(ret, next);
- regoptail(ret, next);
- }
- regparse++;
- if (ISMULT(*regparse))
- FAIL("nested *?+");
-
- return(ret);
-}
-
-/*
- - regatom - the lowest level
- *
- * Optimization: gobbles an entire sequence of ordinary characters so that
- * it can turn them into a single node, which is smaller to store and
- * faster to run. Backslashed characters are exceptions, each becoming a
- * separate node; the code is simpler that way and it's not worth fixing.
- */
-static char *
-regatom(flagp)
-int *flagp;
-{
- register char *ret;
- int flags;
-
- *flagp = WORST; /* Tentatively. */
-
- switch (*regparse++) {
- /* FIXME: these chars only have meaning at beg/end of pat? */
- case '^':
- ret = regnode(BOL);
- break;
- case '$':
- ret = regnode(EOL);
- break;
- case '.':
- ret = regnode(ANY);
- *flagp |= HASWIDTH|SIMPLE;
- break;
- case '[': {
- register int class;
- register int classend;
-
- if (*regparse == '^') { /* Complement of range. */
- ret = regnode(ANYBUT);
- regparse++;
- } else
- ret = regnode(ANYOF);
- if (*regparse == ']' || *regparse == '-')
- regc(*regparse++);
- while (*regparse != '\0' && *regparse != ']') {
- if (*regparse == '-') {
- regparse++;
- if (*regparse == ']' || *regparse == '\0')
- regc('-');
- else {
- class = UCHARAT(regparse-2)+1;
- classend = UCHARAT(regparse);
- if (class > classend+1)
- FAIL("invalid [] range");
- for (; class <= classend; class++)
- regc(class);
- regparse++;
- }
- } else
- regc(*regparse++);
- }
- regc('\0');
- if (*regparse != ']')
- FAIL("unmatched []");
- regparse++;
- *flagp |= HASWIDTH|SIMPLE;
- }
- break;
- case '(':
- ret = reg(1, &flags);
- if (ret == NULL)
- return(NULL);
- *flagp |= flags&(HASWIDTH|SPSTART);
- break;
- case '\0':
- case '|':
- case '\n':
- case ')':
- FAIL("internal urp"); /* Supposed to be caught earlier. */
- break;
- case '?':
- case '+':
- case '*':
- FAIL("?+* follows nothing");
- break;
- case '\\':
- switch (*regparse++) {
- case '\0':
- FAIL("trailing \\");
- break;
- case '<':
- ret = regnode(WORDA);
- break;
- case '>':
- ret = regnode(WORDZ);
- break;
- /* FIXME: Someday handle \1, \2, ... */
- default:
- /* Handle general quoted chars in exact-match routine */
- goto de_fault;
- }
- break;
- de_fault:
- default:
- /*
- * Encode a string of characters to be matched exactly.
- *
- * This is a bit tricky due to quoted chars and due to
- * '*', '+', and '?' taking the SINGLE char previous
- * as their operand.
- *
- * On entry, the char at regparse[-1] is going to go
- * into the string, no matter what it is. (It could be
- * following a \ if we are entered from the '\' case.)
- *
- * Basic idea is to pick up a good char in ch and
- * examine the next char. If it's *+? then we twiddle.
- * If it's \ then we frozzle. If it's other magic char
- * we push ch and terminate the string. If none of the
- * above, we push ch on the string and go around again.
- *
- * regprev is used to remember where "the current char"
- * starts in the string, if due to a *+? we need to back
- * up and put the current char in a separate, 1-char, string.
- * When regprev is NULL, ch is the only char in the
- * string; this is used in *+? handling, and in setting
- * flags |= SIMPLE at the end.
- */
- {
- char *regprev;
- register char ch = 0;
-
- regparse--; /* Look at cur char */
- ret = regnode(EXACTLY);
- for ( regprev = 0 ; ; ) {
- ch = *regparse++; /* Get current char */
- switch (*regparse) { /* look at next one */
-
- default:
- regc(ch); /* Add cur to string */
- break;
-
- case '.': case '[': case '(':
- case ')': case '|': case '\n':
- case '$': case '^':
- case '\0':
- /* FIXME, $ and ^ should not always be magic */
- magic:
- regc(ch); /* dump cur char */
- goto done; /* and we are done */
-
- case '?': case '+': case '*':
- if (!regprev) /* If just ch in str, */
- goto magic; /* use it */
- /* End mult-char string one early */
- regparse = regprev; /* Back up parse */
- goto done;
-
- case '\\':
- regc(ch); /* Cur char OK */
- switch (regparse[1]){ /* Look after \ */
- case '\0':
- case '<':
- case '>':
- /* FIXME: Someday handle \1, \2, ... */
- goto done; /* Not quoted */
- default:
- /* Backup point is \, scan * point is after it. */
- regprev = regparse;
- regparse++;
- continue; /* NOT break; */
- }
- }
- regprev = regparse; /* Set backup point */
- }
- done:
- regc('\0');
- *flagp |= HASWIDTH;
- if (!regprev) /* One char? */
- *flagp |= SIMPLE;
- }
- break;
- }
-
- return(ret);
-}
-
-/*
- - regnode - emit a node
- */
-static char * /* Location. */
-regnode(op)
-char op;
-{
- register char *ret;
- register char *ptr;
-
- ret = regcode;
- if (ret == &regdummy) {
- regsize += 3;
- return(ret);
- }
-
- ptr = ret;
- *ptr++ = op;
- *ptr++ = '\0'; /* Null "next" pointer. */
- *ptr++ = '\0';
- regcode = ptr;
-
- return(ret);
-}
-
-/*
- - regc - emit (if appropriate) a byte of code
- */
-static void
-regc(b)
-char b;
-{
- if (regcode != &regdummy)
- *regcode++ = b;
- else
- regsize++;
-}
-
-/*
- - reginsert - insert an operator in front of already-emitted operand
- *
- * Means relocating the operand.
- */
-static void
-reginsert(op, opnd)
-char op;
-char *opnd;
-{
- register char *src;
- register char *dst;
- register char *place;
-
- if (regcode == &regdummy) {
- regsize += 3;
- return;
- }
-
- src = regcode;
- regcode += 3;
- dst = regcode;
- while (src > opnd)
- *--dst = *--src;
-
- place = opnd; /* Op node, where operand used to be. */
- *place++ = op;
- *place++ = '\0';
- *place++ = '\0';
-}
-
-/*
- - regtail - set the next-pointer at the end of a node chain
- */
-static void
-regtail(p, val)
-char *p;
-char *val;
-{
- register char *scan;
- register char *temp;
- register int offset;
-
- if (p == &regdummy)
- return;
-
- /* Find last node. */
- scan = p;
- for (;;) {
- temp = regnext(scan);
- if (temp == NULL)
- break;
- scan = temp;
- }
-
- if (OP(scan) == BACK)
- offset = scan - val;
- else
- offset = val - scan;
- *(scan+1) = (offset>>8)&0377;
- *(scan+2) = offset&0377;
-}
-
-/*
- - regoptail - regtail on operand of first argument; nop if operandless
- */
-static void
-regoptail(p, val)
-char *p;
-char *val;
-{
- /* "Operandless" and "op != BRANCH" are synonymous in practice. */
- if (p == NULL || p == &regdummy || OP(p) != BRANCH)
- return;
- regtail(OPERAND(p), val);
-}
-
-/*
- * regexec and friends
- */
-
-/*
- * Global work variables for regexec().
- */
-static char *reginput; /* String-input pointer. */
-static char *regbol; /* Beginning of input, for ^ check. */
-static char **regstartp; /* Pointer to startp array. */
-static char **regendp; /* Ditto for endp. */
-
-/*
- * Forwards.
- */
-STATIC int regtry (const regexp *, const char *);
-STATIC int regmatch (char *);
-STATIC int regrepeat (char *);
-
-#ifdef DEBUG
-int regnarrate = 0;
-void regdump __P((regexp *));
-STATIC char *regprop __P((char *));
-#endif
-
-/*
- - regexec - match a regexp against a string
- */
-int __declspec(dllexport)
-regexec(prog, string)
-register const regexp *prog;
-register const char *string;
-{
- register char *s;
-
- /* Be paranoid... */
- if (prog == NULL || string == NULL) {
- regerror("NULL parameter");
- return(0);
- }
-
- /* Check validity of program. */
- if (UCHARAT(prog->program) != MAGIC) {
- regerror("corrupted program");
- return(0);
- }
-
- /* If there is a "must appear" string, look for it. */
- if (prog->regmust != NULL) {
- s = (char *)string;
- while ((s = strchr(s, prog->regmust[0])) != NULL) {
- if (strncmp(s, prog->regmust, prog->regmlen) == 0)
- break; /* Found it. */
- s++;
- }
- if (s == NULL) /* Not present. */
- return(0);
- }
-
- /* Mark beginning of line for ^ . */
- regbol = (char *)string;
-
- /* Simplest case: anchored match need be tried only once. */
- if (prog->reganch)
- return(regtry(prog, string));
-
- /* Messy cases: unanchored match. */
- s = (char *)string;
- if (prog->regstart != '\0')
- /* We know what char it must start with. */
- while ((s = strchr(s, prog->regstart)) != NULL) {
- if (regtry(prog, s))
- return(1);
- s++;
- }
- else
- /* We don't -- general case. */
- do {
- if (regtry(prog, s))
- return(1);
- } while (*s++ != '\0');
-
- /* Failure. */
- return(0);
-}
-
-/*
- - regtry - try match at specific point
- */
-static int /* 0 failure, 1 success */
-regtry(prog, string)
-const regexp *prog;
-const char *string;
-{
- register int i;
- register char **sp;
- register char **ep;
-
- reginput = (char *)string; /* XXX */
- regstartp = (char **)prog->startp; /* XXX */
- regendp = (char **)prog->endp; /* XXX */
-
- sp = (char **)prog->startp; /* XXX */
- ep = (char **)prog->endp; /* XXX */
- for (i = NSUBEXP; i > 0; i--) {
- *sp++ = NULL;
- *ep++ = NULL;
- }
- if (regmatch((char *)prog->program + 1)) { /* XXX */
- ((regexp *)prog)->startp[0] = (char *)string; /* XXX */
- ((regexp *)prog)->endp[0] = reginput; /* XXX */
- return(1);
- } else
- return(0);
-}
-
-/*
- - regmatch - main matching routine
- *
- * Conceptually the strategy is simple: check to see whether the current
- * node matches, call self recursively to see whether the rest matches,
- * and then act accordingly. In practice we make some effort to avoid
- * recursion, in particular by going through "ordinary" nodes (that don't
- * need to know whether the rest of the match failed) by a loop instead of
- * by recursion.
- */
-static int /* 0 failure, 1 success */
-regmatch(prog)
-char *prog;
-{
- register char *scan; /* Current node. */
- char *next; /* Next node. */
-
- scan = prog;
-#ifdef DEBUG
- if (scan != NULL && regnarrate)
- fprintf(stderr, "%s(\n", regprop(scan));
-#endif
- while (scan != NULL) {
-#ifdef DEBUG
- if (regnarrate)
- fprintf(stderr, "%s...\n", regprop(scan));
-#endif
- next = regnext(scan);
-
- switch (OP(scan)) {
- case BOL:
- if (reginput != regbol)
- return(0);
- break;
- case EOL:
- if (*reginput != '\0')
- return(0);
- break;
- case WORDA:
- /* Must be looking at a letter, digit, or _ */
- if ((!isalnum(*reginput)) && *reginput != '_')
- return(0);
- /* Prev must be BOL or nonword */
- if (reginput > regbol &&
- (isalnum(reginput[-1]) || reginput[-1] == '_'))
- return(0);
- break;
- case WORDZ:
- /* Must be looking at non letter, digit, or _ */
- if (isalnum(*reginput) || *reginput == '_')
- return(0);
- /* We don't care what the previous char was */
- break;
- case ANY:
- if (*reginput == '\0')
- return(0);
- reginput++;
- break;
- case EXACTLY: {
- register int len;
- register char *opnd;
-
- opnd = OPERAND(scan);
- /* Inline the first character, for speed. */
- if (*opnd != *reginput)
- return(0);
- len = strlen(opnd);
- if (len > 1 && strncmp(opnd, reginput, len) != 0)
- return(0);
- reginput += len;
- }
- break;
- case ANYOF:
- if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) == NULL)
- return(0);
- reginput++;
- break;
- case ANYBUT:
- if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) != NULL)
- return(0);
- reginput++;
- break;
- case NOTHING:
- break;
- case BACK:
- break;
- case OPEN+1:
- case OPEN+2:
- case OPEN+3:
- case OPEN+4:
- case OPEN+5:
- case OPEN+6:
- case OPEN+7:
- case OPEN+8:
- case OPEN+9: {
- register int no;
- register char *save;
-
- no = OP(scan) - OPEN;
- save = reginput;
-
- if (regmatch(next)) {
- /*
- * Don't set startp if some later
- * invocation of the same parentheses
- * already has.
- */
- if (regstartp[no] == NULL)
- regstartp[no] = save;
- return(1);
- } else
- return(0);
- }
- break;
- case CLOSE+1:
- case CLOSE+2:
- case CLOSE+3:
- case CLOSE+4:
- case CLOSE+5:
- case CLOSE+6:
- case CLOSE+7:
- case CLOSE+8:
- case CLOSE+9: {
- register int no;
- register char *save;
-
- no = OP(scan) - CLOSE;
- save = reginput;
-
- if (regmatch(next)) {
- /*
- * Don't set endp if some later
- * invocation of the same parentheses
- * already has.
- */
- if (regendp[no] == NULL)
- regendp[no] = save;
- return(1);
- } else
- return(0);
- }
- break;
- case BRANCH: {
- register char *save;
-
- if (OP(next) != BRANCH) /* No choice. */
- next = OPERAND(scan); /* Avoid recursion. */
- else {
- do {
- save = reginput;
- if (regmatch(OPERAND(scan)))
- return(1);
- reginput = save;
- scan = regnext(scan);
- } while (scan != NULL && OP(scan) == BRANCH);
- return(0);
- /* NOTREACHED */
- }
- }
- break;
- case STAR:
- case PLUS: {
- register char nextch;
- register int no;
- register char *save;
- register int min;
-
- /*
- * Lookahead to avoid useless match attempts
- * when we know what character comes next.
- */
- nextch = '\0';
- if (OP(next) == EXACTLY)
- nextch = *OPERAND(next);
- min = (OP(scan) == STAR) ? 0 : 1;
- save = reginput;
- no = regrepeat(OPERAND(scan));
- while (no >= min) {
- /* If it could work, try it. */
- if (nextch == '\0' || *reginput == nextch)
- if (regmatch(next))
- return(1);
- /* Couldn't or didn't -- back up. */
- no--;
- reginput = save + no;
- }
- return(0);
- }
- break;
- case END:
- return(1); /* Success! */
- break;
- default:
- regerror("memory corruption");
- return(0);
- break;
- }
-
- scan = next;
- }
-
- /*
- * We get here only if there's trouble -- normally "case END" is
- * the terminating point.
- */
- regerror("corrupted pointers");
- return(0);
-}
-
-/*
- - regrepeat - repeatedly match something simple, report how many
- */
-static int
-regrepeat(p)
-char *p;
-{
- register int count = 0;
- register char *scan;
- register char *opnd;
-
- scan = reginput;
- opnd = OPERAND(p);
- switch (OP(p)) {
- case ANY:
- count = strlen(scan);
- scan += count;
- break;
- case EXACTLY:
- while (*opnd == *scan) {
- count++;
- scan++;
- }
- break;
- case ANYOF:
- while (*scan != '\0' && strchr(opnd, *scan) != NULL) {
- count++;
- scan++;
- }
- break;
- case ANYBUT:
- while (*scan != '\0' && strchr(opnd, *scan) == NULL) {
- count++;
- scan++;
- }
- break;
- default: /* Oh dear. Called inappropriately. */
- regerror("internal foulup");
- count = 0; /* Best compromise. */
- break;
- }
- reginput = scan;
-
- return(count);
-}
-
-/*
- - regnext - dig the "next" pointer out of a node
- */
-static char *
-regnext(p)
-register char *p;
-{
- register int offset;
-
- if (p == &regdummy)
- return(NULL);
-
- offset = NEXT(p);
- if (offset == 0)
- return(NULL);
-
- if (OP(p) == BACK)
- return(p-offset);
- else
- return(p+offset);
-}
-
-#ifdef DEBUG
-
-/*
- - regdump - dump a regexp onto stdout in vaguely comprehensible form
- */
-void
-regdump(r)
-regexp *r;
-{
- register char *s;
- register char op = EXACTLY; /* Arbitrary non-END op. */
- register char *next;
- extern char *strchr();
-
-
- s = r->program + 1;
- while (op != END) { /* While that wasn't END last time... */
- op = OP(s);
- printf("%2d%s", s-r->program, regprop(s)); /* Where, what. */
- next = regnext(s);
- if (next == NULL) /* Next ptr. */
- printf("(0)");
- else
- printf("(%d)", (s-r->program)+(next-s));
- s += 3;
- if (op == ANYOF || op == ANYBUT || op == EXACTLY) {
- /* Literal string, where present. */
- while (*s != '\0') {
- putchar(*s);
- s++;
- }
- s++;
- }
- putchar('\n');
- }
-
- /* Header fields of interest. */
- if (r->regstart != '\0')
- printf("start `%c' ", r->regstart);
- if (r->reganch)
- printf("anchored ");
- if (r->regmust != NULL)
- printf("must have \"%s\"", r->regmust);
- printf("\n");
-}
-
-/*
- - regprop - printable representation of opcode
- */
-static char *
-regprop(op)
-char *op;
-{
- register char *p;
- static char buf[50];
-
- (void) strcpy(buf, ":");
-
- switch (OP(op)) {
- case BOL:
- p = "BOL";
- break;
- case EOL:
- p = "EOL";
- break;
- case ANY:
- p = "ANY";
- break;
- case ANYOF:
- p = "ANYOF";
- break;
- case ANYBUT:
- p = "ANYBUT";
- break;
- case BRANCH:
- p = "BRANCH";
- break;
- case EXACTLY:
- p = "EXACTLY";
- break;
- case NOTHING:
- p = "NOTHING";
- break;
- case BACK:
- p = "BACK";
- break;
- case END:
- p = "END";
- break;
- case OPEN+1:
- case OPEN+2:
- case OPEN+3:
- case OPEN+4:
- case OPEN+5:
- case OPEN+6:
- case OPEN+7:
- case OPEN+8:
- case OPEN+9:
- sprintf(buf+strlen(buf), "OPEN%d", OP(op)-OPEN);
- p = NULL;
- break;
- case CLOSE+1:
- case CLOSE+2:
- case CLOSE+3:
- case CLOSE+4:
- case CLOSE+5:
- case CLOSE+6:
- case CLOSE+7:
- case CLOSE+8:
- case CLOSE+9:
- sprintf(buf+strlen(buf), "CLOSE%d", OP(op)-CLOSE);
- p = NULL;
- break;
- case STAR:
- p = "STAR";
- break;
- case PLUS:
- p = "PLUS";
- break;
- case WORDA:
- p = "WORDA";
- break;
- case WORDZ:
- p = "WORDZ";
- break;
- default:
- regerror("corrupted opcode");
- break;
- }
- if (p != NULL)
- (void) strcat(buf, p);
- return(buf);
-}
-#endif
-
-/*
- * The following is provided for those people who do not have strcspn() in
- * their C libraries. They should get off their butts and do something
- * about it; at least one public-domain implementation of those (highly
- * useful) string routines has been published on Usenet.
- */
-#ifdef STRCSPN
-/*
- * strcspn - find length of initial segment of s1 consisting entirely
- * of characters not from s2
- */
-
-static int
-strcspn(s1, s2)
-char *s1;
-char *s2;
-{
- register char *scan1;
- register char *scan2;
- register int count;
-
- count = 0;
- for (scan1 = s1; *scan1 != '\0'; scan1++) {
- for (scan2 = s2; *scan2 != '\0';) /* ++ moved down. */
- if (*scan1 == *scan2++)
- return(count);
- count++;
- }
- return(count);
-}
-#endif
diff --git a/winsup/cygwin/regexp/v8_regsub.c b/winsup/cygwin/regexp/v8_regsub.c
deleted file mode 100644
index aa95b876a..000000000
--- a/winsup/cygwin/regexp/v8_regsub.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * regsub
- *
- * Copyright (c) 1986 by University of Toronto.
- * Written by Henry Spencer. Not derived from licensed software.
- *
- * Permission is granted to anyone to use this software for any
- * purpose on any computer system, and to redistribute it freely,
- * subject to the following restrictions:
- *
- * 1. The author is not responsible for the consequences of use of
- * this software, no matter how awful, even if they arise
- * from defects in it.
- *
- * 2. The origin of this software must not be misrepresented, either
- * by explicit claim or by omission.
- *
- * 3. Altered versions must be plainly marked as such, and must not
- * be misrepresented as being the original software.
- */
-
-#if 0
-#ifndef lint
-static char *rcsid = "$Id$";
-#endif /* not lint */
-#endif
-
-#include "winsup.h"
-#include "regexp.h"
-#include <stdio.h>
-#include <string.h>
-#include "regmagic.h"
-
-#ifndef CHARBITS
-#define UCHARAT(p) ((int)*(unsigned char *)(p))
-#else
-#define UCHARAT(p) ((int)*(p)&CHARBITS)
-#endif
-
-/*
- - regsub - perform substitutions after a regexp match
- */
-void __declspec(dllexport)
-regsub(prog, source, dest)
-const regexp *prog;
-const char *source;
-char *dest;
-{
- register char *src;
- register char *dst;
- register char c;
- register int no;
- register int len;
-
- if (prog == NULL || source == NULL || dest == NULL) {
- regerror("NULL parm to regsub");
- return;
- }
- if (UCHARAT(prog->program) != MAGIC) {
- regerror("damaged regexp fed to regsub");
- return;
- }
-
- src = (char *)source;
- dst = dest;
- while ((c = *src++) != '\0') {
- if (c == '&')
- no = 0;
- else if (c == '\\' && '0' <= *src && *src <= '9')
- no = *src++ - '0';
- else
- no = -1;
- if (no < 0) { /* Ordinary character. */
- if (c == '\\' && (*src == '\\' || *src == '&'))
- c = *src++;
- *dst++ = c;
- } else if (prog->startp[no] != NULL && prog->endp[no] != NULL) {
- len = prog->endp[no] - prog->startp[no];
- (void) strncpy(dst, prog->startp[no], len);
- dst += len;
- if (len != 0 && *(dst-1) == '\0') { /* strncpy hit NUL. */
- regerror("damaged match string");
- return;
- }
- }
- }
- *dst++ = '\0';
-}
diff --git a/winsup/cygwin/registry.cc b/winsup/cygwin/registry.cc
deleted file mode 100644
index 22fa511a7..000000000
--- a/winsup/cygwin/registry.cc
+++ /dev/null
@@ -1,252 +0,0 @@
-/* registry.cc: registry interface
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include "shared_info.h"
-#include "registry.h"
-#include "security.h"
-#include <cygwin/version.h>
-
-static char NO_COPY cygnus_class[] = "cygnus";
-
-reg_key::reg_key (HKEY top, REGSAM access, ...)
-{
- va_list av;
- va_start (av, access);
- build_reg (top, access, av);
- va_end (av);
-}
-
-reg_key::reg_key (REGSAM access, ...)
-{
- va_list av;
-
- new (this) reg_key (HKEY_CURRENT_USER, access, "SOFTWARE",
- CYGWIN_INFO_CYGNUS_REGISTRY_NAME,
- CYGWIN_INFO_CYGWIN_REGISTRY_NAME, NULL);
-
- HKEY top = key;
- va_start (av, access);
- build_reg (top, KEY_READ, av);
- va_end (av);
- if (top != key)
- RegCloseKey (top);
-}
-
-reg_key::reg_key (REGSAM access)
-{
- new (this) reg_key (HKEY_CURRENT_USER, access, "SOFTWARE",
- CYGWIN_INFO_CYGNUS_REGISTRY_NAME,
- CYGWIN_INFO_CYGWIN_REGISTRY_NAME,
- CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, NULL);
-}
-
-void
-reg_key::build_reg (HKEY top, REGSAM access, va_list av)
-{
- char *name;
- HKEY r = top;
- key_is_invalid = 0;
-
- /* FIXME: Most of the time a valid mount area should exist. Perhaps
- we should just try an open of the correct key first and only resort
- to this method in the unlikely situation that it's the first time
- the current mount areas are being used. */
-
- while ((name = va_arg (av, char *)) != NULL)
- {
- DWORD disp;
- int res = RegCreateKeyExA (r,
- name,
- 0,
- cygnus_class,
- REG_OPTION_NON_VOLATILE,
- access,
- &sec_none_nih,
- &key,
- &disp);
- if (r != top)
- RegCloseKey (r);
- r = key;
- if (res != ERROR_SUCCESS)
- {
- key_is_invalid = res;
- debug_printf ("failed to create key %s in the registry", name);
- break;
- }
-
- /* If we're considering the mounts key, check if it had to
- be created and set had_to_create appropriately. */
- if (strcmp (name, CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME) == 0)
- if (disp == REG_CREATED_NEW_KEY)
- mount_table->had_to_create_mount_areas++;
- }
-}
-
-/* Given the current registry key, return the specific int value
- requested. Return def on failure. */
-
-int
-reg_key::get_int (const char *name, int def)
-{
- DWORD type;
- DWORD dst;
- DWORD size = sizeof (dst);
-
- if (key_is_invalid)
- return def;
-
- LONG res = RegQueryValueExA (key, name, 0, &type, (unsigned char *) &dst,
- &size);
-
- if (type != REG_DWORD || res != ERROR_SUCCESS)
- return def;
-
- return dst;
-}
-
-/* Given the current registry key, set a specific int value. */
-
-int
-reg_key::set_int (const char *name, int val)
-{
- DWORD value = val;
- if (key_is_invalid)
- return key_is_invalid;
-
- return (int) RegSetValueExA (key, name, 0, REG_DWORD,
- (unsigned char *) &value, sizeof (value));
-}
-
-/* Given the current registry key, return the specific string value
- requested. Return zero on success, non-zero on failure. */
-
-int
-reg_key::get_string (const char *name, char *dst, size_t max, const char * def)
-{
- DWORD size = max;
- DWORD type;
- LONG res;
-
- if (key_is_invalid)
- res = key_is_invalid;
- else
- res = RegQueryValueExA (key, name, 0, &type, (unsigned char *) dst, &size);
-
- if ((def != 0) && ((type != REG_SZ) || (res != ERROR_SUCCESS)))
- strcpy (dst, def);
- return (int) res;
-}
-
-/* Given the current registry key, set a specific string value. */
-
-int
-reg_key::set_string (const char *name, const char *src)
-{
- if (key_is_invalid)
- return key_is_invalid;
- return (int) RegSetValueExA (key, name, 0, REG_SZ, (unsigned char*) src,
- strlen (src) + 1);
-}
-
-/* Return the handle to key. */
-
-HKEY
-reg_key::get_key ()
-{
- return key;
-}
-
-/* Delete subkey of current key. Returns the error code from the
- RegDeleteKeyA invocation. */
-
-int
-reg_key::kill (const char *name)
-{
- if (key_is_invalid)
- return key_is_invalid;
- return RegDeleteKeyA (key, name);
-}
-
-/* Delete the value specified by name of current key. Returns the error code
- from the RegDeleteValueA invocation. */
-
-int
-reg_key::killvalue (const char *name)
-{
- if (key_is_invalid)
- return key_is_invalid;
- return RegDeleteValueA (key, name);
-}
-
-reg_key::~reg_key ()
-{
- if (!key_is_invalid)
- RegCloseKey (key);
- key_is_invalid = 1;
-}
-
-char *
-get_registry_hive_path (const PSID psid, char *path)
-{
- char sid[256];
- char key[256];
- HKEY hkey;
-
- if (!psid || !path)
- return NULL;
- cygsid csid (psid);
- csid.string (sid);
- strcpy (key,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\");
- strcat (key, sid);
- if (!RegOpenKeyExA (HKEY_LOCAL_MACHINE, key, 0, KEY_READ, &hkey))
- {
- char buf[256];
- DWORD type, siz;
-
- key[0] = '\0';
- if (!RegQueryValueExA (hkey, "ProfileImagePath", 0, &type,
- (BYTE *)buf, (siz = 256, &siz)))
- ExpandEnvironmentStringsA (buf, key, 256);
- RegCloseKey (hkey);
- if (key[0])
- return strcpy (path, key);
- }
- return NULL;
-}
-
-void
-load_registry_hive (PSID psid)
-{
- char sid[256];
- char path[MAX_PATH + 1];
- HKEY hkey;
- LONG ret;
-
- if (!psid)
- return;
- /* Check if user hive is already loaded. */
- cygsid csid (psid);
- csid.string (sid);
- if (!RegOpenKeyExA (HKEY_USERS, sid, 0, KEY_READ, &hkey))
- {
- debug_printf ("User registry hive for %s already exists", sid);
- RegCloseKey (hkey);
- return;
- }
- set_process_privilege (SE_RESTORE_NAME);
- if (get_registry_hive_path (psid, path))
- {
- strcat (path, "\\NTUSER.DAT");
- if ((ret = RegLoadKeyA (HKEY_USERS, sid, path)) != ERROR_SUCCESS)
- debug_printf ("Loading user registry hive for %s failed: %d", sid, ret);
- }
-}
-
diff --git a/winsup/cygwin/registry.h b/winsup/cygwin/registry.h
deleted file mode 100644
index f0c807941..000000000
--- a/winsup/cygwin/registry.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* registry.h: shared info for cygwin
-
- Copyright 2000, 2001 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. */
-
-class reg_key
-{
-private:
-
- HKEY key;
- LONG key_is_invalid;
-
-public:
-
- reg_key (HKEY toplev, REGSAM access, ...);
- reg_key (REGSAM access, ...);
- reg_key (REGSAM access = KEY_ALL_ACCESS);
-
- void *operator new (size_t, void *p) {return p;}
- void build_reg (HKEY key, REGSAM access, va_list av);
-
- int error () {return key == (HKEY) INVALID_HANDLE_VALUE;}
-
- int kill (const char *child);
- int killvalue (const char *name);
-
- HKEY get_key ();
- int get_int (const char *,int def);
- int get_string (const char *, char *buf, size_t len, const char *def);
- int set_string (const char *,const char *);
- int set_int (const char *, int val);
-
- ~reg_key ();
-};
-
-/* Evaluates path to the directory of the local user registry hive */
-char *__stdcall get_registry_hive_path (const PSID psid, char *path);
-void __stdcall load_registry_hive (PSID psid);
diff --git a/winsup/cygwin/resource.cc b/winsup/cygwin/resource.cc
deleted file mode 100644
index 8d9887158..000000000
--- a/winsup/cygwin/resource.cc
+++ /dev/null
@@ -1,190 +0,0 @@
-/* resource.cc: getrusage () and friends.
-
- Copyright 1996, 1997, 1998, 2000, 2001, 2002 Red Hat, Inc.
-
- Written by Steve Chamberlain (sac@cygnus.com), Doug Evans (dje@cygnus.com),
- Geoffrey Noer (noer@cygnus.com) of Cygnus Support.
- Rewritten by Sergey S. Okhapkin (sos@prospect.com.ru)
-
-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 "winsup.h"
-#include <errno.h>
-#include <unistd.h>
-#include <limits.h>
-#include "cygerrno.h"
-#include "pinfo.h"
-#include "psapi.h"
-
-/* add timeval values */
-static void
-add_timeval (struct timeval *tv1, struct timeval *tv2)
-{
- tv1->tv_sec += tv2->tv_sec;
- tv1->tv_usec += tv2->tv_usec;
- if (tv1->tv_usec >= 1000000)
- {
- tv1->tv_usec -= 1000000;
- tv1->tv_sec++;
- }
-}
-
-/* add rusage values of r2 to r1 */
-void __stdcall
-add_rusage (struct rusage *r1, struct rusage *r2)
-{
- add_timeval (&r1->ru_utime, &r2->ru_utime);
- add_timeval (&r1->ru_stime, &r2->ru_stime);
- r1->ru_maxrss += r2->ru_maxrss;
- r1->ru_ixrss += r2->ru_ixrss;
- r1->ru_idrss += r2->ru_idrss;
- r1->ru_isrss += r2->ru_isrss;
- r1->ru_minflt += r2->ru_minflt;
- r1->ru_majflt += r2->ru_majflt;
- r1->ru_nswap += r2->ru_nswap;
- r1->ru_inblock += r2->ru_inblock;
- r1->ru_oublock += r2->ru_oublock;
- r1->ru_msgsnd += r2->ru_msgsnd;
- r1->ru_msgrcv += r2->ru_msgrcv;
- r1->ru_nsignals += r2->ru_nsignals;
- r1->ru_nvcsw += r2->ru_nvcsw;
- r1->ru_nivcsw += r2->ru_nivcsw;
-}
-
-/* FIXME: what about other fields? */
-void __stdcall
-fill_rusage (struct rusage *r, HANDLE h)
-{
- FILETIME creation_time = {0,0};
- FILETIME exit_time = {0,0};
- FILETIME kernel_time = {0,0};
- FILETIME user_time = {0,0};
-
- struct timeval tv;
-
- memset (r, 0, sizeof (*r));
- GetProcessTimes (h, &creation_time, &exit_time, &kernel_time, &user_time);
- totimeval (&tv, &kernel_time, 0, 0);
- add_timeval (&r->ru_stime, &tv);
- totimeval (&tv, &user_time, 0, 0);
- add_timeval (&r->ru_utime, &tv);
-
- PROCESS_MEMORY_COUNTERS pmc;
-
- memset (&pmc, 0, sizeof (pmc));
- if (GetProcessMemoryInfo( h, &pmc, sizeof (pmc)))
- {
- r->ru_maxrss += (long) (pmc.WorkingSetSize /1024);
- r->ru_majflt += pmc.PageFaultCount;
- }
-}
-
-extern "C"
-int
-getrusage (int intwho, struct rusage *rusage_in)
-{
- int res = 0;
- struct rusage r;
-
- if (intwho == RUSAGE_SELF)
- {
- memset (&r, 0, sizeof (r));
- fill_rusage (&r, hMainProc);
- *rusage_in = r;
- }
- else if (intwho == RUSAGE_CHILDREN)
- *rusage_in = myself->rusage_children;
- else
- {
- set_errno (EINVAL);
- res = -1;
- }
-
- syscall_printf ("%d = getrusage (%d, %p)", res, intwho, rusage_in);
- return res;
-}
-
-unsigned long rlim_core = RLIM_INFINITY;
-
-extern "C" int
-getrlimit (int resource, struct rlimit *rlp)
-{
- MEMORY_BASIC_INFORMATION m;
-
- if (check_null_invalid_struct_errno (rlp))
- return -1;
-
- rlp->rlim_cur = RLIM_INFINITY;
- rlp->rlim_max = RLIM_INFINITY;
-
- switch (resource)
- {
- case RLIMIT_CPU:
- case RLIMIT_FSIZE:
- case RLIMIT_DATA:
- break;
- case RLIMIT_STACK:
- if (!VirtualQuery ((LPCVOID) &m, &m, sizeof m))
- debug_printf ("couldn't get stack info, returning def.values. %E");
- else
- {
- rlp->rlim_cur = (DWORD) &m - (DWORD) m.AllocationBase;
- rlp->rlim_max = (DWORD) m.BaseAddress + m.RegionSize
- - (DWORD) m.AllocationBase;
- }
- break;
- case RLIMIT_NOFILE:
- rlp->rlim_cur = getdtablesize ();
- break;
- case RLIMIT_CORE:
- rlp->rlim_cur = rlim_core;
- break;
- case RLIMIT_AS:
- rlp->rlim_cur = 0x80000000UL;
- rlp->rlim_max = 0x80000000UL;
- break;
- default:
- set_errno (EINVAL);
- return -1;
- }
- return 0;
-}
-
-extern "C" int
-setrlimit (int resource, const struct rlimit *rlp)
-{
- if (check_null_invalid_struct_errno (rlp))
- return -1;
-
- struct rlimit oldlimits;
-
- // Check if the request is to actually change the resource settings.
- // If it does not result in a change, take no action and do not
- // fail.
- if (getrlimit(resource, &oldlimits) < 0)
- return -1;
-
- if (oldlimits.rlim_cur == rlp->rlim_cur &&
- oldlimits.rlim_max == rlp->rlim_max)
- // No change in resource requirements, succeed immediately
- return 0;
-
- switch (resource)
- {
- case RLIMIT_CORE:
- rlim_core = rlp->rlim_cur;
- break;
- case RLIMIT_NOFILE:
- if (rlp->rlim_cur != RLIM_INFINITY)
- return setdtablesize (rlp->rlim_cur);
- break;
- default:
- set_errno (EINVAL);
- return -1;
- }
- return 0;
-}
diff --git a/winsup/cygwin/rmsym b/winsup/cygwin/rmsym
deleted file mode 100755
index 685802684..000000000
--- a/winsup/cygwin/rmsym
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-lib=$1; shift
-nm=$1; shift
-ar=$1; shift
-ranlib=$1; shift
-grepit=`echo $* | sed 's/ /|__imp__/g'`
-[ -n "$grepit" ] && grepit="__imp__$grepit"
-objs=`$nm $lib | awk -F: '/^d[0-9]*.o:/ {obj=$1} '"/$grepit/"'{print obj}'`
-[ -n "$objs" ] || exit 1
-$ar d $lib $objs
-$ranlib $lib
diff --git a/winsup/cygwin/scandir.cc b/winsup/cygwin/scandir.cc
deleted file mode 100644
index 52a36eab6..000000000
--- a/winsup/cygwin/scandir.cc
+++ /dev/null
@@ -1,100 +0,0 @@
-/* scandir.cc
-
- Copyright 1998, 1999, 2000, 2001 Red Hat, Inc.
-
- Written by Corinna Vinschen <corinna.vinschen@cityweb.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. */
-
-#include "winsup.h"
-#include <dirent.h>
-#include <stdlib.h>
-#include <errno.h>
-#include "cygerrno.h"
-
-extern "C" int
-alphasort (const struct dirent **a, const struct dirent **b)
-{
- return strcoll ((*a)->d_name, (*b)->d_name);
-}
-
-extern "C" int
-scandir (const char *dir,
- struct dirent ***namelist,
- int (*select) (const struct dirent *),
- int (*compar) (const struct dirent **, const struct dirent **))
-{
- DIR *dirp;
- struct dirent *ent, *etmp, **nl = NULL, **ntmp;
- int count = 0;
- int allocated = 0;
-
- if (!(dirp = opendir (dir)))
- return -1;
-
- int prior_errno = get_errno ();
- set_errno (0);
- if (!compar)
- compar = alphasort;
-
- while ((ent = readdir (dirp)))
- {
- if (!select || select (ent))
- {
-
- /* Ignore error from readdir/select. See POSIX specs. */
- set_errno (0);
-
- if (count == allocated)
- {
-
- if (allocated == 0)
- allocated = 10;
- else
- allocated *= 2;
-
- ntmp = (struct dirent **) realloc (nl, allocated * sizeof *nl);
- if (!ntmp)
- {
- set_errno (ENOMEM);
- break;
- }
- nl = ntmp;
- }
-
- if (!(etmp = (struct dirent *) malloc (sizeof *ent)))
- {
- set_errno (ENOMEM);
- break;
- }
- *etmp = *ent;
- nl[count++] = etmp;
- }
- }
-
- if ((prior_errno = get_errno ()) != 0)
- {
- closedir (dirp);
- if (nl)
- {
- while (count > 0)
- free (nl[--count]);
- free (nl);
- }
- /* Ignore errors from closedir() and what not else. */
- set_errno (prior_errno);
- return -1;
- }
-
- closedir (dirp);
- set_errno (prior_errno);
-
- qsort (nl, count, sizeof *nl, (int (*)(const void *, const void *)) compar);
- if (namelist)
- *namelist = nl;
- return count;
-}
diff --git a/winsup/cygwin/sched.cc b/winsup/cygwin/sched.cc
deleted file mode 100644
index 7b4074d7f..000000000
--- a/winsup/cygwin/sched.cc
+++ /dev/null
@@ -1,444 +0,0 @@
-/* sched.cc: scheduler interface for Cygwin
-
- Copyright 2001 Red Hat, Inc.
-
- Written by Robert Collins <rbtcollins@hotmail.com>
-
- 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 HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "winsup.h"
-#include <limits.h>
-#include <errno.h>
-#include "cygerrno.h"
-#include <assert.h>
-#include <stdlib.h>
-#include <syslog.h>
-#include <sched.h>
-#include "pinfo.h"
-/* for getpid */
-#include <unistd.h>
-
-/* Win32 priority to UNIX priority Mapping.
- For now, I'm just following the spec: any range of priorities is ok.
- There are probably many many issues with this...
-
- We don't want process's going realtime. Well, they probably could, but the issues
- with avoiding the priority values 17-22 and 27-30 (not supported before win2k)
- make that inefficient.
- However to complicate things most unixes use lower is better priorities.
-
- So we map -14 to 15, and 15 to 1 via (16- ((n+16) >> 1))
- we then map 1 to 15 to various process class and thread priority combinations
-
- Then we need to look at the threads vi process priority. As win95 98 and NT 4
- Don't support opening threads cross-process (unless a thread HANDLE is passed around)
- for now, we'll just use the priority class.
-
- The code and logic are present to calculate the priority for thread
- , if a thread handle can be obtained. Alternatively, if the symbols wouldn't be
- resolved until they are used
- we could support this on windows 2000 and ME now, and just fall back to the
- class only on pre win2000 machines.
-
- Lastly, because we can't assume that the pid we're given are Windows pids, we can't
- alter non-cygwin started programs.
-*/
-
-extern "C"
-{
-
-/* max priority for policy */
-int
-sched_get_priority_max (int policy)
-{
- if (policy < 1 || policy > 3)
- {
- set_errno (EINVAL);
- return -1;
- }
- return -14;
-}
-
-/* min priority for policy */
-int
-sched_get_priority_min (int policy)
-{
- if (policy < 1 || policy > 3)
- {
- set_errno (EINVAL);
- return -1;
- }
- return 15;
-}
-
-/* Check a scheduler parameter struct for valid settings */
-int
-valid_sched_parameters(const struct sched_param *param)
-{
- if (param->sched_priority < -14 || param->sched_priority > 15)
- {
- return 0;
- }
- return -1;
-
-}
-
-/* get sched params for process
-
- Note, I'm never returning EPERM,
- Always ESRCH. This is by design (If cygwin ever looks at paranoid security
- Walking the pid values is a known hole in some os's)
-*/
-int
-sched_getparam (pid_t pid, struct sched_param *param)
-{
- pid_t localpid;
- int winpri;
- if (!param || pid < 0)
- {
- set_errno (EINVAL);
- return -1;
- }
-
- localpid = pid ? pid : getpid ();
-
- DWORD Class;
- int ThreadPriority;
- HANDLE process;
- pinfo p (localpid);
-
- /* get the class */
-
- if (!p)
- {
- set_errno (ESRCH);
- return -1;
- }
- process = OpenProcess (PROCESS_QUERY_INFORMATION, FALSE, p->dwProcessId);
- if (!process)
- {
- set_errno (ESRCH);
- return -1;
- }
- Class = GetPriorityClass (process);
- CloseHandle (process);
- if (!Class)
- {
- set_errno (ESRCH);
- return -1;
- }
- ThreadPriority = THREAD_PRIORITY_NORMAL;
-
- /* calculate the unix priority.
-
- FIXME: windows 2000 supports ABOVE_NORMAL and BELOW_NORMAL class's
- So this logic just defaults those class factors to NORMAL in the calculations */
-
- switch (Class)
- {
- case IDLE_PRIORITY_CLASS:
- switch (ThreadPriority)
- {
- case THREAD_PRIORITY_IDLE:
- winpri = 1;
- break;
- case THREAD_PRIORITY_LOWEST:
- winpri = 2;
- break;
- case THREAD_PRIORITY_BELOW_NORMAL:
- winpri = 3;
- break;
- case THREAD_PRIORITY_NORMAL:
- winpri = 4;
- break;
- case THREAD_PRIORITY_ABOVE_NORMAL:
- winpri = 5;
- break;
- case THREAD_PRIORITY_HIGHEST:
- default:
- winpri = 6;
- break;
- }
- break;
- case HIGH_PRIORITY_CLASS:
- switch (ThreadPriority)
- {
- case THREAD_PRIORITY_IDLE:
- winpri = 1;
- break;
- case THREAD_PRIORITY_LOWEST:
- winpri = 11;
- break;
- case THREAD_PRIORITY_BELOW_NORMAL:
- winpri = 12;
- break;
- case THREAD_PRIORITY_NORMAL:
- winpri = 13;
- break;
- case THREAD_PRIORITY_ABOVE_NORMAL:
- winpri = 14;
- break;
- case THREAD_PRIORITY_HIGHEST:
- default:
- winpri = 15;
- break;
- }
- break;
- case NORMAL_PRIORITY_CLASS:
- default:
- switch (ThreadPriority)
- {
- case THREAD_PRIORITY_IDLE:
- winpri = 1;
- break;
- case THREAD_PRIORITY_LOWEST:
- winpri = 7;
- break;
- case THREAD_PRIORITY_BELOW_NORMAL:
- winpri = 8;
- break;
- case THREAD_PRIORITY_NORMAL:
- winpri = 9;
- break;
- case THREAD_PRIORITY_ABOVE_NORMAL:
- winpri = 10;
- break;
- case THREAD_PRIORITY_HIGHEST:
- default:
- winpri = 11;
- break;
- }
- break;
- }
-
- /* reverse out winpri = (16- ((unixpri+16) >> 1)) */
- /*
- winpri-16 = - (unixpri +16 ) >> 1
-
- -(winpri-16) = unixpri +16 >> 1
- (-(winpri-16)) << 1 = unixpri+16
- ((-(winpri - 16)) << 1) - 16 = unixpri
- */
-
- param->sched_priority = ((-(winpri - 16)) << 1) - 16;
-
- return 0;
-}
-
-/* get the scheduler for pid
-
- All process's on WIN32 run with SCHED_FIFO.
- So we just give an answer.
- (WIN32 uses a multi queue FIFO).
-*/
-int
-sched_getscheduler (pid_t pid)
-{
- if (pid < 0)
- return ESRCH;
- else
- return SCHED_FIFO;
-}
-
-/* get the time quantum for pid
-
- We can't return -11, errno ENOSYS, because that implies that
- sched_get_priority_max & min are also not supported (according to the spec)
- so some spec-driven autoconf tests will likely assume they aren't present either
-
- returning ESRCH might confuse some applications (if they assumed that when
- rr_get_interval is called on pid 0 it always works).
-
- If someone knows the time quanta for the various win32 platforms, then a
- simple check for the os we're running on will finish this function
-*/
-int
-sched_rr_get_interval (pid_t pid, struct timespec *interval)
-{
- set_errno (ESRCH);
- return -1;
-}
-
-/* set the scheduling parameters */
-int
-sched_setparam (pid_t pid, const struct sched_param *param)
-{
- pid_t localpid;
- int winpri;
- DWORD Class;
- int ThreadPriority;
- HANDLE process;
-
- if (!param || pid < 0)
- {
- set_errno (EINVAL);
- return -1;
- }
-
- if (!valid_sched_parameters(param))
- {
- set_errno (EINVAL);
- return -1;
- }
-
- /* winpri = (16- ((unixpri+16) >> 1)) */
- winpri = 16 - ((param->sched_priority + 16) >> 1);
-
- /* calculate our desired priority class and thread priority */
-
- if (winpri < 7)
- Class = IDLE_PRIORITY_CLASS;
- else if (winpri > 10)
- Class = HIGH_PRIORITY_CLASS;
- else
- Class = NORMAL_PRIORITY_CLASS;
-
- switch (Class)
- {
- case IDLE_PRIORITY_CLASS:
- switch (winpri)
- {
- case 1:
- ThreadPriority = THREAD_PRIORITY_IDLE;
- break;
- case 2:
- ThreadPriority = THREAD_PRIORITY_LOWEST;
- break;
- case 3:
- ThreadPriority = THREAD_PRIORITY_BELOW_NORMAL;
- break;
- case 4:
- ThreadPriority = THREAD_PRIORITY_NORMAL;
- break;
- case 5:
- ThreadPriority = THREAD_PRIORITY_ABOVE_NORMAL;
- break;
- case 6:
- ThreadPriority = THREAD_PRIORITY_HIGHEST;
- break;
- }
- break;
- case NORMAL_PRIORITY_CLASS:
- switch (winpri)
- {
- case 7:
- ThreadPriority = THREAD_PRIORITY_LOWEST;
- break;
- case 8:
- ThreadPriority = THREAD_PRIORITY_BELOW_NORMAL;
- break;
- case 9:
- ThreadPriority = THREAD_PRIORITY_NORMAL;
- break;
- case 10:
- ThreadPriority = THREAD_PRIORITY_ABOVE_NORMAL;
- break;
- case 11:
- ThreadPriority = THREAD_PRIORITY_HIGHEST;
- break;
- }
- break;
- case HIGH_PRIORITY_CLASS:
- switch (winpri)
- {
- case 12:
- ThreadPriority = THREAD_PRIORITY_BELOW_NORMAL;
- break;
- case 13:
- ThreadPriority = THREAD_PRIORITY_NORMAL;
- break;
- case 14:
- ThreadPriority = THREAD_PRIORITY_ABOVE_NORMAL;
- break;
- case 15:
- ThreadPriority = THREAD_PRIORITY_HIGHEST;
- break;
- }
- break;
- }
-
- localpid = pid ? pid : getpid ();
-
- pinfo p (localpid);
-
- /* set the class */
-
- if (!p)
- {
- set_errno (1); //ESRCH);
- return -1;
- }
- process =
- OpenProcess (PROCESS_SET_INFORMATION, FALSE, (DWORD) p->dwProcessId);
- if (!process)
- {
- set_errno (2); //ESRCH);
- return -1;
- }
- if (!SetPriorityClass (process, Class))
- {
- CloseHandle (process);
- set_errno (EPERM);
- return -1;
- }
- CloseHandle (process);
-
- return 0;
-}
-
-/* we map -14 to 15, and 15 to 1 via (16- ((n+16) >> 1)). This lines up with the allowed
- * valueswe return elsewhere in the sched* functions. We then map in groups of three to
- * allowed thread priority's. The reason for dropping accuracy while still returning
- * a wide range of values is to allow more flexible code in the future.
- */
-int
-sched_set_thread_priority(HANDLE thread, int priority)
-{
- int real_pri;
- real_pri = 16 - ((priority + 16) >> 1);
- if (real_pri <1 || real_pri > 15)
- return EINVAL;
-
- if (real_pri < 4)
- real_pri = THREAD_PRIORITY_LOWEST;
- else if (real_pri < 7)
- real_pri = THREAD_PRIORITY_BELOW_NORMAL;
- else if (real_pri < 10)
- real_pri = THREAD_PRIORITY_NORMAL;
- else if (real_pri < 13)
- real_pri = THREAD_PRIORITY_ABOVE_NORMAL;
- else
- real_pri = THREAD_PRIORITY_HIGHEST;
-
- if (!SetThreadPriority(thread, real_pri))
- /* invalid handle, no access are the only expected errors. */
- return EPERM;
- return 0;
-}
-
-/* set the scheduler */
-int
-sched_setscheduler (pid_t pid, int policy,
- const struct sched_param *param)
-{
- /* on win32, you can't change the scheduler. Doh! */
- set_errno (ENOSYS);
- return -1;
-}
-
-/* yield the cpu */
-int
-sched_yield (void)
-{
- Sleep (0);
- return 0;
-}
-}
diff --git a/winsup/cygwin/sec_acl.cc b/winsup/cygwin/sec_acl.cc
deleted file mode 100644
index e93073794..000000000
--- a/winsup/cygwin/sec_acl.cc
+++ /dev/null
@@ -1,1046 +0,0 @@
-/* secacl.cc: Sun compatible ACL functions.
-
- Copyright 2000, 2001, 2002 Red Hat, Inc.
-
- Written by Corinna Vinschen <corinna@vinschen.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. */
-
-#include "winsup.h"
-#include <grp.h>
-#include <pwd.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <limits.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/acl.h>
-#include <ctype.h>
-#include <wingdi.h>
-#include <winuser.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "pinfo.h"
-#include "cygheap.h"
-
-extern "C" int aclsort (int nentries, int, __aclent16_t *aclbufp);
-extern "C" int acl (const char *path, int cmd, int nentries, __aclent16_t *aclbufp);
-
-static int
-searchace (__aclent16_t *aclp, int nentries, int type, int id = -1)
-{
- 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;
-}
-
-static int
-setacl (const char *file, int nentries, __aclent16_t *aclbufp)
-{
- DWORD sd_size = 4096;
- char sd_buf[4096];
- PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR) sd_buf;
-
- if (read_sd (file, psd, &sd_size) <= 0)
- {
- debug_printf ("read_sd %E");
- return -1;
- }
-
- BOOL dummy;
-
- /* Get owner SID. */
- PSID owner_sid = NULL;
- if (!GetSecurityDescriptorOwner (psd, &owner_sid, &dummy))
- {
- __seterrno ();
- return -1;
- }
- cygsid owner (owner_sid);
-
- /* Get group SID. */
- PSID group_sid = NULL;
- if (!GetSecurityDescriptorGroup (psd, &group_sid, &dummy))
- {
- __seterrno ();
- return -1;
- }
- cygsid group (group_sid);
-
- /* Initialize local security descriptor. */
- SECURITY_DESCRIPTOR sd;
- if (!InitializeSecurityDescriptor (&sd, SECURITY_DESCRIPTOR_REVISION))
- {
- __seterrno ();
- return -1;
- }
- if (!SetSecurityDescriptorOwner(&sd, owner, FALSE))
- {
- __seterrno ();
- return -1;
- }
- if (group
- && !SetSecurityDescriptorGroup(&sd, group, FALSE))
- {
- __seterrno ();
- return -1;
- }
-
- /* Fill access control list. */
- char acl_buf[3072];
- PACL acl = (PACL) acl_buf;
- size_t acl_len = sizeof (ACL);
- int ace_off = 0;
-
- cygsid sid;
- struct passwd *pw;
- struct __group32 *gr;
- int pos;
-
- if (!InitializeAcl (acl, 3072, ACL_REVISION))
- {
- __seterrno ();
- return -1;
- }
- for (int i = 0; i < nentries; ++i)
- {
- DWORD allow = STANDARD_RIGHTS_READ
- | FILE_READ_ATTRIBUTES | FILE_READ_EA;
- if (aclbufp[i].a_perm & S_IROTH)
- allow |= FILE_GENERIC_READ;
- if (aclbufp[i].a_perm & S_IWOTH)
- allow |= STANDARD_RIGHTS_ALL | FILE_GENERIC_WRITE;
- if (aclbufp[i].a_perm & S_IXOTH)
- allow |= FILE_GENERIC_EXECUTE;
- if ((aclbufp[i].a_perm & (S_IWOTH | S_IXOTH)) == (S_IWOTH | S_IXOTH))
- allow |= FILE_DELETE_CHILD;
- /* Set inherit property. */
- DWORD inheritance = (aclbufp[i].a_type & ACL_DEFAULT)
- ? INHERIT_ONLY : DONT_INHERIT;
- /*
- * If a specific acl contains a corresponding default entry with
- * identical permissions, only one Windows ACE with proper
- * inheritance bits is created.
- */
- if (!(aclbufp[i].a_type & ACL_DEFAULT)
- && (pos = searchace (aclbufp, nentries,
- aclbufp[i].a_type | ACL_DEFAULT,
- (aclbufp[i].a_type & (USER|GROUP))
- ? aclbufp[i].a_id : -1)) >= 0
- && pos < nentries
- && aclbufp[i].a_perm == aclbufp[pos].a_perm)
- {
- inheritance = INHERIT_ALL;
- /* This eliminates the corresponding default entry. */
- aclbufp[pos].a_type = 0;
- }
- switch (aclbufp[i].a_type)
- {
- case USER_OBJ:
- case DEF_USER_OBJ:
- allow |= STANDARD_RIGHTS_ALL & ~DELETE;
- if (!add_access_allowed_ace (acl, ace_off++, allow,
- owner, acl_len, inheritance))
- return -1;
- break;
- case USER:
- case DEF_USER:
- if (!(pw = getpwuid32 (aclbufp[i].a_id))
- || !sid.getfrompw (pw)
- || !add_access_allowed_ace (acl, ace_off++, allow,
- sid, acl_len, inheritance))
- return -1;
- break;
- case GROUP_OBJ:
- case DEF_GROUP_OBJ:
- if (!add_access_allowed_ace (acl, ace_off++, allow,
- group, acl_len, inheritance))
- return -1;
- break;
- case GROUP:
- case DEF_GROUP:
- if (!(gr = getgrgid32 (aclbufp[i].a_id))
- || !sid.getfromgr (gr)
- || !add_access_allowed_ace (acl, ace_off++, allow,
- sid, acl_len, inheritance))
- return -1;
- break;
- case OTHER_OBJ:
- case DEF_OTHER_OBJ:
- if (!add_access_allowed_ace (acl, ace_off++, allow,
- well_known_world_sid,
- acl_len, inheritance))
- return -1;
- break;
- }
- }
- /* Set AclSize to computed value. */
- acl->AclSize = acl_len;
- debug_printf ("ACL-Size: %d", acl_len);
- /* Create DACL for local security descriptor. */
- if (!SetSecurityDescriptorDacl (&sd, TRUE, acl, FALSE))
- {
- __seterrno ();
- return -1;
- }
- /* Make self relative security descriptor in psd. */
- sd_size = 0;
- MakeSelfRelativeSD (&sd, psd, &sd_size);
- if (sd_size <= 0)
- {
- __seterrno ();
- return -1;
- }
- if (!MakeSelfRelativeSD (&sd, psd, &sd_size))
- {
- __seterrno ();
- return -1;
- }
- debug_printf ("Created SD-Size: %d", sd_size);
- return write_sd (file, psd, sd_size);
-}
-
-static void
-getace (__aclent16_t &acl, int type, int id, DWORD win_ace_mask, DWORD win_ace_type)
-{
- acl.a_type = type;
- acl.a_id = id;
-
- if (win_ace_mask & FILE_READ_DATA)
- if (win_ace_type == ACCESS_ALLOWED_ACE_TYPE)
- acl.a_perm |= (acl.a_perm & S_IRGRP) ? 0 : S_IRUSR;
- else if (win_ace_type == ACCESS_DENIED_ACE_TYPE)
- acl.a_perm &= ~S_IRGRP;
-
- if (win_ace_mask & FILE_WRITE_DATA)
- if (win_ace_type == ACCESS_ALLOWED_ACE_TYPE)
- acl.a_perm |= (acl.a_perm & S_IWGRP) ? 0 : S_IWUSR;
- else if (win_ace_type == ACCESS_DENIED_ACE_TYPE)
- acl.a_perm &= ~S_IWGRP;
-
- if (win_ace_mask & FILE_EXECUTE)
- if (win_ace_type == ACCESS_ALLOWED_ACE_TYPE)
- acl.a_perm |= (acl.a_perm & S_IXGRP) ? 0 : S_IXUSR;
- else if (win_ace_type == ACCESS_DENIED_ACE_TYPE)
- acl.a_perm &= ~S_IXGRP;
-}
-
-static int
-getacl (const char *file, DWORD attr, int nentries, __aclent16_t *aclbufp)
-{
- DWORD sd_size = 4096;
- char sd_buf[4096];
- PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR) sd_buf;
-
- int ret;
- if ((ret = read_sd (file, psd, &sd_size)) <= 0)
- {
- debug_printf ("read_sd %E");
- return ret;
- }
-
- PSID owner_sid;
- PSID group_sid;
- BOOL dummy;
- __uid32_t uid;
- __gid32_t gid;
-
- if (!GetSecurityDescriptorOwner (psd, &owner_sid, &dummy))
- {
- debug_printf ("GetSecurityDescriptorOwner %E");
- __seterrno ();
- return -1;
- }
- uid = cygsid (owner_sid).get_uid ();
-
- if (!GetSecurityDescriptorGroup (psd, &group_sid, &dummy))
- {
- debug_printf ("GetSecurityDescriptorGroup %E");
- __seterrno ();
- return -1;
- }
- gid = cygsid (group_sid).get_gid ();
-
- __aclent16_t lacl[MAX_ACL_ENTRIES];
- memset (&lacl, 0, MAX_ACL_ENTRIES * sizeof (__aclent16_t));
- lacl[0].a_type = USER_OBJ;
- lacl[0].a_id = uid;
- lacl[1].a_type = GROUP_OBJ;
- lacl[1].a_id = gid;
- lacl[2].a_type = OTHER_OBJ;
-
- PACL acl;
- BOOL acl_exists;
-
- if (!GetSecurityDescriptorDacl (psd, &acl_exists, &acl, &dummy))
- {
- __seterrno ();
- debug_printf ("GetSecurityDescriptorDacl %E");
- return -1;
- }
-
- int pos, i;
-
- if (!acl_exists || !acl)
- {
- for (pos = 0; pos < MIN_ACL_ENTRIES; ++pos)
- lacl[pos].a_perm = S_IRWXU | S_IRWXG | S_IRWXO;
- pos = nentries < MIN_ACL_ENTRIES ? nentries : MIN_ACL_ENTRIES;
- memcpy (aclbufp, lacl, pos * sizeof (__aclent16_t));
- return pos;
- }
-
- for (i = 0; i < acl->AceCount && (!nentries || i < nentries); ++i)
- {
- ACCESS_ALLOWED_ACE *ace;
-
- if (!GetAce (acl, i, (PVOID *) &ace))
- continue;
-
- cygsid ace_sid ((PSID) &ace->SidStart);
- int id;
- int type = 0;
-
- if (ace_sid == owner_sid)
- {
- type = USER_OBJ;
- id = uid;
- }
- else if (ace_sid == group_sid)
- {
- type = GROUP_OBJ;
- id = gid;
- }
- else if (ace_sid == well_known_world_sid)
- {
- type = OTHER_OBJ;
- id = 0;
- }
- else
- {
- id = ace_sid.get_id (FALSE, &type);
- if (type != GROUP)
- {
- int type2 = 0;
- int id2 = ace_sid.get_id (TRUE, &type2);
- if (type2 == GROUP)
- {
- id = id2;
- type = GROUP;
- }
- }
- }
- if (!type)
- continue;
- if (!(ace->Header.AceFlags & INHERIT_ONLY_ACE))
- {
- if ((pos = searchace (lacl, MAX_ACL_ENTRIES, type, id)) >= 0)
- getace (lacl[pos], type, id, ace->Mask, ace->Header.AceType);
- }
- if ((ace->Header.AceFlags & INHERIT_ALL)
- && (attr & FILE_ATTRIBUTE_DIRECTORY))
- {
- type |= ACL_DEFAULT;
- if ((pos = searchace (lacl, MAX_ACL_ENTRIES, type, id)) >= 0)
- getace (lacl[pos], type, id, ace->Mask, ace->Header.AceType);
- }
- }
- if ((pos = searchace (lacl, MAX_ACL_ENTRIES, 0)) < 0)
- pos = MAX_ACL_ENTRIES;
- for (i = 0; i < pos; ++i)
- {
- lacl[i].a_perm = (lacl[i].a_perm & S_IRWXU)
- & ~((lacl[i].a_perm & S_IRWXG) << 3);
- lacl[i].a_perm |= (lacl[i].a_perm & S_IRWXU) >> 3
- | (lacl[i].a_perm & S_IRWXU) >> 6;
- }
- if ((searchace (lacl, MAX_ACL_ENTRIES, USER) >= 0
- || searchace (lacl, MAX_ACL_ENTRIES, GROUP) >= 0)
- && (pos = searchace (lacl, MAX_ACL_ENTRIES, CLASS_OBJ)) >= 0)
- {
- lacl[pos].a_type = CLASS_OBJ;
- lacl[pos].a_perm =
- lacl[searchace (lacl, MAX_ACL_ENTRIES, GROUP_OBJ)].a_perm;
- }
- int dgpos;
- if ((searchace (lacl, MAX_ACL_ENTRIES, DEF_USER) >= 0
- || searchace (lacl, MAX_ACL_ENTRIES, DEF_GROUP) >= 0)
- && (dgpos = searchace (lacl, MAX_ACL_ENTRIES, DEF_GROUP_OBJ)) >= 0
- && (pos = searchace (lacl, MAX_ACL_ENTRIES, DEF_CLASS_OBJ)) >= 0
- && (attr & FILE_ATTRIBUTE_DIRECTORY))
- {
- lacl[pos].a_type = DEF_CLASS_OBJ;
- lacl[pos].a_perm = lacl[dgpos].a_perm;
- }
- if ((pos = searchace (lacl, MAX_ACL_ENTRIES, 0)) < 0)
- pos = MAX_ACL_ENTRIES;
- if (pos > nentries)
- pos = nentries;
- if (aclbufp)
- memcpy (aclbufp, lacl, pos * sizeof (__aclent16_t));
- aclsort (pos, 0, aclbufp);
- syscall_printf ("%d = getacl (%s)", pos, file);
- return pos;
-}
-
-int
-acl_access (const char *path, int flags)
-{
- __aclent16_t acls[MAX_ACL_ENTRIES];
- int cnt;
-
- if ((cnt = acl (path, GETACL, MAX_ACL_ENTRIES, acls)) < 1)
- return -1;
-
- /* Only check existance. */
- if (!(flags & (R_OK|W_OK|X_OK)))
- return 0;
-
- for (int i = 0; i < cnt; ++i)
- {
- switch (acls[i].a_type)
- {
- case USER_OBJ:
- case USER:
- if (acls[i].a_id != myself->uid)
- {
- /*
- * Check if user is a NT group:
- * Take SID from passwd, search SID in group, check is_grp_member.
- */
- cygsid owner;
- cygsid group;
- struct passwd *pw;
- struct __group32 *gr = NULL;
-
- if ((pw = getpwuid32 (acls[i].a_id)) != NULL
- && owner.getfrompw (pw))
- {
- for (int gidx = 0; (gr = internal_getgrent (gidx)); ++gidx)
- if (group.getfromgr (gr)
- && owner == group
- && is_grp_member (myself->uid, gr->gr_gid))
- break;
- }
- if (!gr)
- continue;
- }
- break;
- case GROUP_OBJ:
- case GROUP:
- if (acls[i].a_id != myself->gid &&
- !is_grp_member (myself->uid, acls[i].a_id))
- continue;
- break;
- case OTHER_OBJ:
- break;
- default:
- continue;
- }
- if ((!(flags & R_OK) || (acls[i].a_perm & S_IREAD))
- && (!(flags & W_OK) || (acls[i].a_perm & S_IWRITE))
- && (!(flags & X_OK) || (acls[i].a_perm & S_IEXEC)))
- return 0;
- }
- set_errno (EACCES);
- return -1;
-}
-
-static
-int
-acl_worker (const char *path, int cmd, int nentries, __aclent16_t *aclbufp,
- int nofollow)
-{
- extern suffix_info stat_suffixes[];
- path_conv real_path (path, (nofollow ? PC_SYM_NOFOLLOW : PC_SYM_FOLLOW) | PC_FULL, stat_suffixes);
- if (real_path.error)
- {
- set_errno (real_path.error);
- syscall_printf ("-1 = acl (%s)", path);
- return -1;
- }
- if (!real_path.has_acls ())
- {
- struct __stat64 st;
- int ret = -1;
-
- switch (cmd)
- {
- case SETACL:
- set_errno (ENOSYS);
- break;
- case GETACL:
- if (nentries < 1)
- set_errno (EINVAL);
- else if ((nofollow && !lstat64 (path, &st))
- || (!nofollow && !stat64 (path, &st)))
- {
- __aclent16_t lacl[4];
- if (nentries > 0)
- {
- lacl[0].a_type = USER_OBJ;
- lacl[0].a_id = st.st_uid;
- lacl[0].a_perm = (st.st_mode & S_IRWXU)
- | (st.st_mode & S_IRWXU) >> 3
- | (st.st_mode & S_IRWXU) >> 6;
- }
- if (nentries > 1)
- {
- lacl[1].a_type = GROUP_OBJ;
- lacl[1].a_id = st.st_gid;
- lacl[1].a_perm = (st.st_mode & S_IRWXG)
- | (st.st_mode & S_IRWXG) << 3
- | (st.st_mode & S_IRWXG) >> 3;
- }
- if (nentries > 2)
- {
- lacl[2].a_type = OTHER_OBJ;
- lacl[2].a_id = 0;
- lacl[2].a_perm = (st.st_mode & S_IRWXO)
- | (st.st_mode & S_IRWXO) << 6
- | (st.st_mode & S_IRWXO) << 3;
- }
- if (nentries > 3)
- {
- lacl[3].a_type = CLASS_OBJ;
- lacl[3].a_id = 0;
- lacl[3].a_perm = (st.st_mode & S_IRWXG)
- | (st.st_mode & S_IRWXG) << 3
- | (st.st_mode & S_IRWXG) >> 3;
- }
- if (nentries > 4)
- nentries = 4;
- if (aclbufp)
- memcpy (aclbufp, lacl, nentries * sizeof (__aclent16_t));
- ret = nentries;
- }
- break;
- case GETACLCNT:
- ret = 4;
- break;
- }
- syscall_printf ("%d = acl (%s)", ret, path);
- return ret;
- }
- switch (cmd)
- {
- case SETACL:
- if (!aclsort(nentries, 0, aclbufp))
- return setacl (real_path.get_win32 (),
- nentries, aclbufp);
- break;
- case GETACL:
- if (nentries < 1)
- break;
- return getacl (real_path.get_win32 (),
- real_path.file_attributes (),
- nentries, aclbufp);
- case GETACLCNT:
- return getacl (real_path.get_win32 (),
- real_path.file_attributes (),
- 0, NULL);
- default:
- break;
- }
- set_errno (EINVAL);
- syscall_printf ("-1 = acl (%s)", path);
- return -1;
-}
-
-extern "C"
-int
-acl (const char *path, int cmd, int nentries, __aclent16_t *aclbufp)
-{
- return acl_worker (path, cmd, nentries, aclbufp, 0);
-}
-
-extern "C"
-int
-lacl (const char *path, int cmd, int nentries, __aclent16_t *aclbufp)
-{
- return acl_worker (path, cmd, nentries, aclbufp, 1);
-}
-
-extern "C"
-int
-facl (int fd, int cmd, int nentries, __aclent16_t *aclbufp)
-{
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- {
- syscall_printf ("-1 = facl (%d)", fd);
- return -1;
- }
- const char *path = cfd->get_name ();
- if (path == NULL)
- {
- syscall_printf ("-1 = facl (%d) (no name)", fd);
- set_errno (ENOSYS);
- return -1;
- }
- syscall_printf ("facl (%d): calling acl (%s)", fd, path);
- return acl_worker (path, cmd, nentries, aclbufp, 0);
-}
-
-extern "C"
-int
-aclcheck (__aclent16_t *aclbufp, int nentries, int *which)
-{
- BOOL has_user_obj = FALSE;
- BOOL has_group_obj = FALSE;
- BOOL has_other_obj = FALSE;
- BOOL has_class_obj = FALSE;
- BOOL has_ug_objs = FALSE;
- BOOL has_def_user_obj = FALSE;
- BOOL has_def_group_obj = FALSE;
- BOOL has_def_other_obj = FALSE;
- BOOL has_def_class_obj = FALSE;
- BOOL has_def_ug_objs = FALSE;
- int pos2;
-
- for (int pos = 0; pos < nentries; ++pos)
- switch (aclbufp[pos].a_type)
- {
- case USER_OBJ:
- if (has_user_obj)
- {
- if (which)
- *which = pos;
- return USER_ERROR;
- }
- has_user_obj = TRUE;
- break;
- case GROUP_OBJ:
- if (has_group_obj)
- {
- if (which)
- *which = pos;
- return GRP_ERROR;
- }
- has_group_obj = TRUE;
- break;
- case OTHER_OBJ:
- if (has_other_obj)
- {
- if (which)
- *which = pos;
- return OTHER_ERROR;
- }
- has_other_obj = TRUE;
- break;
- case CLASS_OBJ:
- if (has_class_obj)
- {
- if (which)
- *which = pos;
- return CLASS_ERROR;
- }
- has_class_obj = TRUE;
- break;
- case USER:
- case GROUP:
- if ((pos2 = searchace (aclbufp + pos + 1, nentries - pos - 1,
- aclbufp[pos].a_type, aclbufp[pos].a_id)) >= 0)
- {
- if (which)
- *which = pos2;
- return DUPLICATE_ERROR;
- }
- has_ug_objs = TRUE;
- break;
- case DEF_USER_OBJ:
- if (has_def_user_obj)
- {
- if (which)
- *which = pos;
- return USER_ERROR;
- }
- has_def_user_obj = TRUE;
- break;
- case DEF_GROUP_OBJ:
- if (has_def_group_obj)
- {
- if (which)
- *which = pos;
- return GRP_ERROR;
- }
- has_def_group_obj = TRUE;
- break;
- case DEF_OTHER_OBJ:
- if (has_def_other_obj)
- {
- if (which)
- *which = pos;
- return OTHER_ERROR;
- }
- has_def_other_obj = TRUE;
- break;
- case DEF_CLASS_OBJ:
- if (has_def_class_obj)
- {
- if (which)
- *which = pos;
- return CLASS_ERROR;
- }
- has_def_class_obj = TRUE;
- break;
- case DEF_USER:
- case DEF_GROUP:
- if ((pos2 = searchace (aclbufp + pos + 1, nentries - pos - 1,
- aclbufp[pos].a_type, aclbufp[pos].a_id)) >= 0)
- {
- if (which)
- *which = pos2;
- return DUPLICATE_ERROR;
- }
- has_def_ug_objs = TRUE;
- break;
- default:
- return ENTRY_ERROR;
- }
- if (!has_user_obj
- || !has_group_obj
- || !has_other_obj
-#if 0
- /* These checks are not ok yet since CLASS_OBJ isn't fully implemented. */
- || (has_ug_objs && !has_class_obj)
- || (has_def_ug_objs && !has_def_class_obj)
-#endif
- )
- {
- if (which)
- *which = -1;
- return MISS_ERROR;
- }
- return 0;
-}
-
-extern "C"
-int acecmp (const void *a1, const void *a2)
-{
-#define ace(i) ((const __aclent16_t *) a##i)
- int ret = ace(1)->a_type - ace(2)->a_type;
- if (!ret)
- ret = ace(1)->a_id - ace(2)->a_id;
- return ret;
-#undef ace
-}
-
-extern "C"
-int
-aclsort (int nentries, int, __aclent16_t *aclbufp)
-{
- if (aclcheck (aclbufp, nentries, NULL))
- return -1;
- if (!aclbufp || nentries < 1)
- {
- set_errno (EINVAL);
- return -1;
- }
- qsort((void *) aclbufp, nentries, sizeof (__aclent16_t), acecmp);
- return 0;
-}
-
-extern "C"
-int
-acltomode (__aclent16_t *aclbufp, int nentries, mode_t *modep)
-{
- int pos;
-
- if (!aclbufp || nentries < 1 || !modep)
- {
- set_errno (EINVAL);
- return -1;
- }
- *modep = 0;
- if ((pos = searchace (aclbufp, nentries, USER_OBJ)) < 0)
- {
- set_errno (EINVAL);
- return -1;
- }
- *modep |= aclbufp[pos].a_perm & S_IRWXU;
- if ((pos = searchace (aclbufp, nentries, GROUP_OBJ)) < 0)
- {
- set_errno (EINVAL);
- return -1;
- }
- if (searchace (aclbufp, nentries, CLASS_OBJ) < 0)
- pos = searchace (aclbufp, nentries, CLASS_OBJ);
- *modep |= (aclbufp[pos].a_perm & S_IRWXU) >> 3;
- if ((pos = searchace (aclbufp, nentries, OTHER_OBJ)) < 0)
- {
- set_errno (EINVAL);
- return -1;
- }
- *modep |= (aclbufp[pos].a_perm & S_IRWXU) >> 6;
- return 0;
-}
-
-extern "C"
-int
-aclfrommode(__aclent16_t *aclbufp, int nentries, mode_t *modep)
-{
- int pos;
-
- if (!aclbufp || nentries < 1 || !modep)
- {
- set_errno (EINVAL);
- return -1;
- }
- if ((pos = searchace (aclbufp, nentries, USER_OBJ)) < 0)
- {
- set_errno (EINVAL);
- return -1;
- }
- aclbufp[pos].a_perm = (*modep & S_IRWXU)
- | (*modep & S_IRWXU) >> 3
- | (*modep & S_IRWXU) >> 6;
- if ((pos = searchace (aclbufp, nentries, GROUP_OBJ)) < 0)
- {
- set_errno (EINVAL);
- return -1;
- }
- if (searchace (aclbufp, nentries, CLASS_OBJ) < 0)
- pos = searchace (aclbufp, nentries, CLASS_OBJ);
- aclbufp[pos].a_perm = (*modep & S_IRWXG)
- | (*modep & S_IRWXG) << 3
- | (*modep & S_IRWXG) >> 3;
- if ((pos = searchace (aclbufp, nentries, OTHER_OBJ)) < 0)
- {
- set_errno (EINVAL);
- return -1;
- }
- aclbufp[pos].a_perm = (*modep & S_IRWXO)
- | (*modep & S_IRWXO) << 6
- | (*modep & S_IRWXO) << 3;
- return 0;
-}
-
-extern "C"
-int
-acltopbits (__aclent16_t *aclbufp, int nentries, mode_t *pbitsp)
-{
- return acltomode (aclbufp, nentries, pbitsp);
-}
-
-extern "C"
-int
-aclfrompbits (__aclent16_t *aclbufp, int nentries, mode_t *pbitsp)
-{
- return aclfrommode (aclbufp, nentries, pbitsp);
-}
-
-static char *
-permtostr (mode_t perm)
-{
- static char pbuf[4];
-
- pbuf[0] = (perm & S_IREAD) ? 'r' : '-';
- pbuf[1] = (perm & S_IWRITE) ? 'w' : '-';
- pbuf[2] = (perm & S_IEXEC) ? 'x' : '-';
- pbuf[3] = '\0';
- return pbuf;
-}
-
-extern "C"
-char *
-acltotext (__aclent16_t *aclbufp, int aclcnt)
-{
- if (!aclbufp || aclcnt < 1 || aclcnt > MAX_ACL_ENTRIES
- || aclcheck (aclbufp, aclcnt, NULL))
- {
- set_errno (EINVAL);
- return NULL;
- }
- char buf[32000];
- buf[0] = '\0';
- BOOL first = TRUE;
-
- for (int pos = 0; pos < aclcnt; ++pos)
- {
- if (!first)
- strcat (buf, ",");
- first = FALSE;
- if (aclbufp[pos].a_type & ACL_DEFAULT)
- strcat (buf, "default");
- switch (aclbufp[pos].a_type)
- {
- case USER_OBJ:
- __small_sprintf (buf + strlen (buf), "user::%s",
- permtostr (aclbufp[pos].a_perm));
- break;
- case USER:
- __small_sprintf (buf + strlen (buf), "user:%d:%s",
- aclbufp[pos].a_id, permtostr (aclbufp[pos].a_perm));
- break;
- case GROUP_OBJ:
- __small_sprintf (buf + strlen (buf), "group::%s",
- permtostr (aclbufp[pos].a_perm));
- break;
- case GROUP:
- __small_sprintf (buf + strlen (buf), "group:%d:%s",
- aclbufp[pos].a_id, permtostr (aclbufp[pos].a_perm));
- break;
- case CLASS_OBJ:
- __small_sprintf (buf + strlen (buf), "mask::%s",
- permtostr (aclbufp[pos].a_perm));
- break;
- case OTHER_OBJ:
- __small_sprintf (buf + strlen (buf), "other::%s",
- permtostr (aclbufp[pos].a_perm));
- break;
- default:
- set_errno (EINVAL);
- return NULL;
- }
- }
- return strdup (buf);
-}
-
-static mode_t
-permfromstr (char *perm)
-{
- mode_t mode = 0;
-
- if (strlen (perm) != 3)
- return 01000;
- if (perm[0] == 'r')
- mode |= S_IRUSR | S_IRGRP | S_IROTH;
- else if (perm[0] != '-')
- return 01000;
- if (perm[1] == 'w')
- mode |= S_IWUSR | S_IWGRP | S_IWOTH;
- else if (perm[1] != '-')
- return 01000;
- if (perm[2] == 'x')
- mode |= S_IXUSR | S_IXGRP | S_IXOTH;
- else if (perm[2] != '-')
- return 01000;
- return mode;
-}
-
-extern "C"
-__aclent16_t *
-aclfromtext (char *acltextp, int *)
-{
- if (!acltextp)
- {
- set_errno (EINVAL);
- return NULL;
- }
- char buf[strlen (acltextp) + 1];
- __aclent16_t lacl[MAX_ACL_ENTRIES];
- memset (lacl, 0, sizeof lacl);
- int pos = 0;
- strcpy (buf, acltextp);
- char *lasts;
- for (char *c = strtok_r (buf, ",", &lasts);
- c;
- c = strtok_r (NULL, ",", &lasts))
- {
- if (!strncmp (c, "default", 7))
- {
- lacl[pos].a_type |= ACL_DEFAULT;
- c += 7;
- }
- if (!strncmp (c, "user:", 5))
- {
- if (c[5] == ':')
- lacl[pos].a_type |= USER_OBJ;
- else
- {
- lacl[pos].a_type |= USER;
- c += 5;
- if (isalpha (*c))
- {
- struct passwd *pw = getpwnam (c);
- if (!pw)
- {
- set_errno (EINVAL);
- return NULL;
- }
- lacl[pos].a_id = pw->pw_uid;
- c = strchr (c, ':');
- }
- else if (isdigit (*c))
- lacl[pos].a_id = strtol (c, &c, 10);
- if (!c || *c != ':')
- {
- set_errno (EINVAL);
- return NULL;
- }
- }
- }
- else if (!strncmp (c, "group:", 6))
- {
- if (c[5] == ':')
- lacl[pos].a_type |= GROUP_OBJ;
- else
- {
- lacl[pos].a_type |= GROUP;
- c += 5;
- if (isalpha (*c))
- {
- struct __group32 *gr = getgrnam32 (c);
- if (!gr)
- {
- set_errno (EINVAL);
- return NULL;
- }
- lacl[pos].a_id = gr->gr_gid;
- c = strchr (c, ':');
- }
- else if (isdigit (*c))
- lacl[pos].a_id = strtol (c, &c, 10);
- if (!c || *c != ':')
- {
- set_errno (EINVAL);
- return NULL;
- }
- }
- }
- else if (!strncmp (c, "mask:", 5))
- {
- if (c[5] == ':')
- lacl[pos].a_type |= CLASS_OBJ;
- else
- {
- set_errno (EINVAL);
- return NULL;
- }
- }
- else if (!strncmp (c, "other:", 6))
- {
- if (c[5] == ':')
- lacl[pos].a_type |= OTHER_OBJ;
- else
- {
- set_errno (EINVAL);
- return NULL;
- }
- }
- if ((lacl[pos].a_perm = permfromstr (c)) == 01000)
- {
- set_errno (EINVAL);
- return NULL;
- }
- ++pos;
- }
- __aclent16_t *aclp = (__aclent16_t *) malloc (pos * sizeof (__aclent16_t));
- if (aclp)
- memcpy (aclp, lacl, pos * sizeof (__aclent16_t));
- return aclp;
-}
-
diff --git a/winsup/cygwin/sec_helper.cc b/winsup/cygwin/sec_helper.cc
deleted file mode 100644
index cfa0fafce..000000000
--- a/winsup/cygwin/sec_helper.cc
+++ /dev/null
@@ -1,389 +0,0 @@
-/* sec_helper.cc: NT security helper functions
-
- Copyright 2000, 2001, 2002 Red Hat, Inc.
-
- Written by Corinna Vinschen <corinna@vinschen.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. */
-
-#include "winsup.h"
-#include <grp.h>
-#include <pwd.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <limits.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/acl.h>
-#include <ctype.h>
-#include <wingdi.h>
-#include <winuser.h>
-#include <wininet.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "pinfo.h"
-#include "cygheap.h"
-
-SID_IDENTIFIER_AUTHORITY sid_auth[] = {
- {SECURITY_NULL_SID_AUTHORITY},
- {SECURITY_WORLD_SID_AUTHORITY},
- {SECURITY_LOCAL_SID_AUTHORITY},
- {SECURITY_CREATOR_SID_AUTHORITY},
- {SECURITY_NON_UNIQUE_AUTHORITY},
- {SECURITY_NT_AUTHORITY}
-};
-
-cygsid well_known_null_sid ("S-1-0-0");
-cygsid well_known_world_sid ("S-1-1-0");
-cygsid well_known_local_sid ("S-1-2-0");
-cygsid well_known_creator_owner_sid ("S-1-3-0");
-cygsid well_known_dialup_sid ("S-1-5-1");
-cygsid well_known_network_sid ("S-1-5-2");
-cygsid well_known_batch_sid ("S-1-5-3");
-cygsid well_known_interactive_sid ("S-1-5-4");
-cygsid well_known_service_sid ("S-1-5-6");
-cygsid well_known_authenticated_users_sid ("S-1-5-11");
-cygsid well_known_system_sid ("S-1-5-18");
-cygsid well_known_admins_sid ("S-1-5-32-544");
-
-char *
-cygsid::string (char *nsidstr) const
-{
- char t[32];
- DWORD i;
-
- if (!psid || !nsidstr)
- return NULL;
- strcpy (nsidstr, "S-1-");
- __small_sprintf(t, "%u", GetSidIdentifierAuthority (psid)->Value[5]);
- strcat (nsidstr, t);
- for (i = 0; i < *GetSidSubAuthorityCount (psid); ++i)
- {
- __small_sprintf(t, "-%lu", *GetSidSubAuthority (psid, i));
- strcat (nsidstr, t);
- }
- return nsidstr;
-}
-
-PSID
-cygsid::get_sid (DWORD s, DWORD cnt, DWORD *r)
-{
- DWORD i;
-
- if (s > 5 || cnt < 1 || cnt > 8)
- {
- psid = NO_SID;
- return NULL;
- }
- set ();
- InitializeSid(psid, &sid_auth[s], cnt);
- for (i = 0; i < cnt; ++i)
- memcpy ((char *) psid + 8 + sizeof (DWORD) * i, &r[i], sizeof (DWORD));
- return psid;
-}
-
-const PSID
-cygsid::getfromstr (const char *nsidstr)
-{
- char sid_buf[256];
- char *t, *lasts;
- DWORD cnt = 0;
- DWORD s = 0;
- DWORD i, r[8];
-
- if (!nsidstr || strncmp (nsidstr, "S-1-", 4))
- {
- psid = NO_SID;
- return NULL;
- }
-
- strcpy (sid_buf, nsidstr);
-
- for (t = sid_buf + 4, i = 0;
- cnt < 8 && (t = strtok_r (t, "-", &lasts));
- t = NULL, ++i)
- if (i == 0)
- s = strtoul (t, NULL, 10);
- else
- r[cnt++] = strtoul (t, NULL, 10);
-
- return get_sid (s, cnt, r);
-}
-
-BOOL
-cygsid::getfrompw (const struct passwd *pw)
-{
- char *sp = (pw && pw->pw_gecos) ? strrchr (pw->pw_gecos, ',') : NULL;
- return (*this = sp ? sp + 1 : "") != NULL;
-}
-
-BOOL
-cygsid::getfromgr (const struct __group32 *gr)
-{
- char *sp = (gr && gr->gr_passwd) ? gr->gr_passwd : NULL;
- return (*this = sp ?: "") != NULL;
-}
-
-int
-cygsid::get_id (BOOL search_grp, int *type)
-{
- if (!psid)
- {
- set_errno (EINVAL);
- return -1;
- }
- if (!IsValidSid (psid))
- {
- __seterrno ();
- small_printf ("IsValidSid failed with %E");
- return -1;
- }
-
- /* First try to get SID from passwd or group entry */
- if (allow_ntsec)
- {
- cygsid sid;
- int id = -1;
-
- if (!search_grp)
- {
- struct passwd *pw;
- for (int pidx = 0; (pw = internal_getpwent (pidx)); ++pidx)
- {
- if (sid.getfrompw (pw) && sid == psid)
- {
- id = pw->pw_uid;
- break;
- }
- }
- if (id >= 0)
- {
- if (type)
- *type = USER;
- return id;
- }
- }
- if (search_grp || type)
- {
- struct __group32 *gr;
- for (int gidx = 0; (gr = internal_getgrent (gidx)); ++gidx)
- {
- if (sid.getfromgr (gr) && sid == psid)
- {
- id = gr->gr_gid;
- break;
- }
- }
- if (id >= 0)
- {
- if (type)
- *type = GROUP;
- return id;
- }
- }
- }
-
- /* We use the RID as default UID/GID */
- int id = *GetSidSubAuthority(psid, *GetSidSubAuthorityCount(psid) - 1);
-
- /*
- * The RID maybe -1 if accountname == computername.
- * In this case we search for the accountname in the passwd and group files.
- * If type is needed, we search in each case.
- */
- if (id == -1 || type)
- {
- char account[UNLEN + 1];
- char domain[INTERNET_MAX_HOST_NAME_LENGTH + 1];
- DWORD acc_len = UNLEN + 1;
- DWORD dom_len = INTERNET_MAX_HOST_NAME_LENGTH + 1;
- SID_NAME_USE acc_type;
-
- if (!LookupAccountSid (NULL, psid, account, &acc_len,
- domain, &dom_len, &acc_type))
- {
- __seterrno ();
- return -1;
- }
-
- switch (acc_type)
- {
- case SidTypeGroup:
- case SidTypeAlias:
- case SidTypeWellKnownGroup:
- if (type)
- *type = GROUP;
- if (id == -1)
- {
- struct __group32 *gr = getgrnam32 (account);
- if (gr)
- id = gr->gr_gid;
- }
- break;
- case SidTypeUser:
- if (type)
- *type = USER;
- if (id == -1)
- {
- struct passwd *pw = getpwnam (account);
- if (pw)
- id = pw->pw_uid;
- }
- break;
- default:
- break;
- }
- }
- if (id == -1)
- id = getuid32 ();
- return id;
-}
-
-BOOL
-is_grp_member (__uid32_t uid, __gid32_t gid)
-{
- extern int getgroups32 (int, __gid32_t *, __gid32_t, const char *);
- BOOL grp_member = TRUE;
-
- struct passwd *pw = getpwuid32 (uid);
- __gid32_t grps[NGROUPS_MAX];
- int cnt = getgroups32 (NGROUPS_MAX, grps,
- pw ? pw->pw_gid : myself->gid,
- pw ? pw->pw_name : cygheap->user.name ());
- int i;
- for (i = 0; i < cnt; ++i)
- if (grps[i] == gid)
- break;
- grp_member = (i < cnt);
- return grp_member;
-}
-
-#if 0 // unused
-#define SIDLEN (sidlen = MAX_SID_LEN, &sidlen)
-#define DOMLEN (domlen = INTERNET_MAX_HOST_NAME_LENGTH, &domlen)
-
-BOOL
-lookup_name (const char *name, const char *logsrv, PSID ret_sid)
-{
- cygsid sid;
- DWORD sidlen;
- char domuser[INTERNET_MAX_HOST_NAME_LENGTH + UNLEN + 2];
- char dom[INTERNET_MAX_HOST_NAME_LENGTH + 1];
- DWORD domlen;
- SID_NAME_USE acc_type;
-
- debug_printf ("name : %s", name ? name : "NULL");
-
- if (!name)
- return FALSE;
-
- if (cygheap->user.domain ())
- {
- strcat (strcat (strcpy (domuser, cygheap->user.domain ()), "\\"), name);
- if (LookupAccountName (NULL, domuser, sid, SIDLEN, dom, DOMLEN, &acc_type)
- && legal_sid_type (acc_type))
- goto got_it;
- if (logsrv && *logsrv
- && LookupAccountName (logsrv, domuser, sid, SIDLEN,
- dom, DOMLEN, &acc_type)
- && legal_sid_type (acc_type))
- goto got_it;
- }
- if (logsrv && *logsrv)
- {
- if (LookupAccountName (logsrv, name, sid, SIDLEN, dom, DOMLEN, &acc_type)
- && legal_sid_type (acc_type))
- goto got_it;
- if (acc_type == SidTypeDomain)
- {
- strcat (strcat (strcpy (domuser, dom), "\\"), name);
- if (LookupAccountName (logsrv, domuser, sid, SIDLEN,
- dom, DOMLEN, &acc_type))
- goto got_it;
- }
- }
- if (LookupAccountName (NULL, name, sid, SIDLEN, dom, DOMLEN, &acc_type)
- && legal_sid_type (acc_type))
- goto got_it;
- if (acc_type == SidTypeDomain)
- {
- strcat (strcat (strcpy (domuser, dom), "\\"), name);
- if (LookupAccountName (NULL, domuser, sid, SIDLEN, dom, DOMLEN,&acc_type))
- goto got_it;
- }
- debug_printf ("LookupAccountName(%s) %E", name);
- __seterrno ();
- return FALSE;
-
-got_it:
- debug_printf ("sid : [%d]", *GetSidSubAuthority((PSID) sid,
- *GetSidSubAuthorityCount((PSID) sid) - 1));
-
- if (ret_sid)
- memcpy (ret_sid, sid, sidlen);
-
- return TRUE;
-}
-
-#undef SIDLEN
-#undef DOMLEN
-#endif //unused
-
-int
-set_process_privilege (const char *privilege, BOOL enable)
-{
- HANDLE hToken = NULL;
- LUID restore_priv;
- TOKEN_PRIVILEGES new_priv, orig_priv;
- int ret = -1;
- DWORD size;
-
- if (!OpenProcessToken (hMainProc, TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES,
- &hToken))
- {
- __seterrno ();
- goto out;
- }
-
- if (!LookupPrivilegeValue (NULL, privilege, &restore_priv))
- {
- __seterrno ();
- goto out;
- }
-
- new_priv.PrivilegeCount = 1;
- new_priv.Privileges[0].Luid = restore_priv;
- new_priv.Privileges[0].Attributes = enable ? SE_PRIVILEGE_ENABLED : 0;
-
- if (!AdjustTokenPrivileges (hToken, FALSE, &new_priv,
- sizeof orig_priv, &orig_priv, &size))
- {
- __seterrno ();
- goto out;
- }
- /* AdjustTokenPrivileges returns TRUE even if the privilege could not
- be enabled. GetLastError() returns an correct error code, though. */
- if (enable && GetLastError () == ERROR_NOT_ALL_ASSIGNED)
- {
- debug_printf ("Privilege %s couldn't be assigned", privilege);
- __seterrno ();
- goto out;
- }
-
- ret = orig_priv.Privileges[0].Attributes == SE_PRIVILEGE_ENABLED ? 1 : 0;
-
-out:
- if (hToken)
- CloseHandle (hToken);
-
- syscall_printf ("%d = set_process_privilege (%s, %d)",ret, privilege, enable);
- return ret;
-}
diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc
deleted file mode 100644
index 490938d50..000000000
--- a/winsup/cygwin/security.cc
+++ /dev/null
@@ -1,1670 +0,0 @@
-/* security.cc: NT security functions
-
- Copyright 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-
- Originaly written by Gunther Ebert, gunther.ebert@ixos-leipzig.de
- Completely rewritten by Corinna Vinschen <corinna@vinschen.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. */
-
-#include "winsup.h"
-#include <grp.h>
-#include <pwd.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <limits.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/acl.h>
-#include <ctype.h>
-#include <winnls.h>
-#include <wingdi.h>
-#include <winuser.h>
-#include <wininet.h>
-#include <ntsecapi.h>
-#include <subauth.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "pinfo.h"
-#include "cygheap.h"
-#include <ntdef.h>
-#include "ntdll.h"
-#include "lm.h"
-
-extern BOOL allow_ntea;
-BOOL allow_ntsec;
-/* allow_smbntsec is handled exclusively in path.cc (path_conv::check).
- It's defined here because of it's strong relationship to allow_ntsec.
- The default is TRUE to reflect the old behaviour. */
-BOOL allow_smbntsec = TRUE;
-
-extern "C" void
-cygwin_set_impersonation_token (const HANDLE hToken)
-{
- debug_printf ("set_impersonation_token (%d)", hToken);
- if (cygheap->user.token != hToken)
- {
- cygheap->user.token = hToken;
- cygheap->user.impersonated = FALSE;
- }
-}
-
-void
-extract_nt_dom_user (const struct passwd *pw, char *domain, char *user)
-{
- cygsid psid;
- DWORD ulen = UNLEN + 1;
- DWORD dlen = INTERNET_MAX_HOST_NAME_LENGTH + 1;
- SID_NAME_USE use;
- char buf[INTERNET_MAX_HOST_NAME_LENGTH + UNLEN + 2];
- char *c;
-
- strcpy (domain, "");
- strcpy (buf, pw->pw_name);
- debug_printf ("pw_gecos = %x (%s)", pw->pw_gecos, pw->pw_gecos);
-
- if (psid.getfrompw (pw) &&
- LookupAccountSid (NULL, psid, user, &ulen, domain, &dlen, &use))
- return;
-
- if (pw->pw_gecos)
- {
- if ((c = strstr (pw->pw_gecos, "U-")) != NULL &&
- (c == pw->pw_gecos || c[-1] == ','))
- {
- buf[0] = '\0';
- strncat (buf, c + 2, INTERNET_MAX_HOST_NAME_LENGTH + UNLEN + 1);
- if ((c = strchr (buf, ',')) != NULL)
- *c = '\0';
- }
- }
- if ((c = strchr (buf, '\\')) != NULL)
- {
- *c++ = '\0';
- strcpy (domain, buf);
- strcpy (user, c);
- }
- else
- {
- strcpy (domain, "");
- strcpy (user, buf);
- }
-}
-
-extern "C" HANDLE
-cygwin_logon_user (const struct passwd *pw, const char *password)
-{
- if (!wincap.has_security ())
- {
- set_errno (ENOSYS);
- return INVALID_HANDLE_VALUE;
- }
- if (!pw)
- {
- set_errno (EINVAL);
- return INVALID_HANDLE_VALUE;
- }
-
- char nt_domain[INTERNET_MAX_HOST_NAME_LENGTH + 1];
- char nt_user[UNLEN + 1];
- HANDLE hToken;
-
- extract_nt_dom_user (pw, nt_domain, nt_user);
- debug_printf ("LogonUserA (%s, %s, %s, ...)", nt_user, nt_domain, password);
- if (!LogonUserA (nt_user, *nt_domain ? nt_domain : NULL, (char *) password,
- LOGON32_LOGON_INTERACTIVE,
- LOGON32_PROVIDER_DEFAULT,
- &hToken)
- || !SetHandleInformation (hToken,
- HANDLE_FLAG_INHERIT,
- HANDLE_FLAG_INHERIT))
- {
- __seterrno ();
- return INVALID_HANDLE_VALUE;
- }
- debug_printf ("%d = logon_user(%s,...)", hToken, pw->pw_name);
- return hToken;
-}
-
-static void
-str2lsa (LSA_STRING &tgt, const char *srcstr)
-{
- tgt.Length = strlen (srcstr);
- tgt.MaximumLength = tgt.Length + 1;
- tgt.Buffer = (PCHAR) srcstr;
-}
-
-static void
-str2buf2lsa (LSA_STRING &tgt, char *buf, const char *srcstr)
-{
- tgt.Length = strlen (srcstr);
- tgt.MaximumLength = tgt.Length + 1;
- tgt.Buffer = (PCHAR) buf;
- memcpy(buf, srcstr, tgt.MaximumLength);
-}
-
-void
-str2buf2uni (UNICODE_STRING &tgt, WCHAR *buf, const char *srcstr)
-{
- tgt.Length = strlen (srcstr) * sizeof (WCHAR);
- tgt.MaximumLength = tgt.Length + sizeof(WCHAR);
- tgt.Buffer = (PWCHAR) buf;
- sys_mbstowcs (buf, srcstr, tgt.MaximumLength);
-}
-
-#if 0 //unused
-static void
-lsa2wchar (WCHAR *tgt, LSA_UNICODE_STRING &src, int size)
-{
- size = (size - 1) * sizeof (WCHAR);
- if (src.Length < size)
- size = src.Length;
- memcpy (tgt, src.Buffer, size);
- size >>= 1;
- tgt[size] = 0;
-}
-#endif
-
-static void
-lsa2str (char *tgt, LSA_UNICODE_STRING &src, int size)
-{
- if (src.Length / 2 < size)
- size = src.Length / 2;
- sys_wcstombs (tgt, src.Buffer, size);
- tgt[size] = 0;
-}
-
-static LSA_HANDLE
-open_local_policy ()
-{
- LSA_OBJECT_ATTRIBUTES oa = { 0, 0, 0, 0, 0, 0 };
- LSA_HANDLE lsa = INVALID_HANDLE_VALUE;
-
- NTSTATUS ret = LsaOpenPolicy(NULL, &oa, POLICY_EXECUTE, &lsa);
- if (ret != STATUS_SUCCESS)
- __seterrno_from_win_error (LsaNtStatusToWinError (ret));
- return lsa;
-}
-
-static void
-close_local_policy (LSA_HANDLE &lsa)
-{
- if (lsa != INVALID_HANDLE_VALUE)
- LsaClose (lsa);
- lsa = INVALID_HANDLE_VALUE;
-}
-
-#if 0 // unused
-static BOOL
-get_lsa_srv_inf (LSA_HANDLE lsa, char *logonserver, char *domain)
-{
- NET_API_STATUS ret;
- WCHAR *buf;
- char name[INTERNET_MAX_HOST_NAME_LENGTH + 1];
- WCHAR account[INTERNET_MAX_HOST_NAME_LENGTH + 1];
- WCHAR primary[INTERNET_MAX_HOST_NAME_LENGTH + 1];
- PPOLICY_ACCOUNT_DOMAIN_INFO adi;
- PPOLICY_PRIMARY_DOMAIN_INFO pdi;
-
- if ((ret = LsaQueryInformationPolicy (lsa, PolicyAccountDomainInformation,
- (PVOID *) &adi)) != STATUS_SUCCESS)
- {
- __seterrno_from_win_error (LsaNtStatusToWinError(ret));
- return FALSE;
- }
- lsa2wchar (account, adi->DomainName, INTERNET_MAX_HOST_NAME_LENGTH + 1);
- LsaFreeMemory (adi);
- if ((ret = LsaQueryInformationPolicy (lsa, PolicyPrimaryDomainInformation,
- (PVOID *) &pdi)) != STATUS_SUCCESS)
- {
- __seterrno_from_win_error (LsaNtStatusToWinError(ret));
- return FALSE;
- }
- lsa2wchar (primary, pdi->Name, INTERNET_MAX_HOST_NAME_LENGTH + 1);
- LsaFreeMemory (pdi);
- /* If the SID given in the primary domain info is NULL, the machine is
- not member of a domain. The name in the primary domain info is the
- name of the workgroup then. */
- if (pdi->Sid &&
- (ret = NetGetDCName(NULL, primary, (LPBYTE *) &buf)) == STATUS_SUCCESS)
- {
- sys_wcstombs (name, buf, INTERNET_MAX_HOST_NAME_LENGTH + 1);
- strcpy (logonserver, name);
- if (domain)
- sys_wcstombs (domain, primary, INTERNET_MAX_HOST_NAME_LENGTH + 1);
- }
- else
- {
- sys_wcstombs (name, account, INTERNET_MAX_HOST_NAME_LENGTH + 1);
- strcpy (logonserver, "\\\\");
- strcat (logonserver, name);
- if (domain)
- sys_wcstombs (domain, account, INTERNET_MAX_HOST_NAME_LENGTH + 1);
- }
- if (ret == STATUS_SUCCESS)
- NetApiBufferFree (buf);
- return TRUE;
-}
-#endif
-
-BOOL
-get_logon_server (const char *domain, char *server, WCHAR *wserver)
-{
- WCHAR wdomain[INTERNET_MAX_HOST_NAME_LENGTH + 1];
- NET_API_STATUS ret;
- WCHAR * buf;
- DWORD size = INTERNET_MAX_HOST_NAME_LENGTH + 1;
-
- if ((GetComputerName (server + 2, &size)) &&
- strcasematch (domain, server + 2))
- {
- server[0] = server[1] = '\\';
- if (wserver)
- sys_mbstowcs (wserver, server, INTERNET_MAX_HOST_NAME_LENGTH + 1);
- return TRUE;
- }
-
- /* Try to get the primary domain controller for the domain */
- sys_mbstowcs (wdomain, domain, INTERNET_MAX_HOST_NAME_LENGTH + 1);
- if ((ret = NetGetDCName (NULL, wdomain, (LPBYTE *) &buf)) == STATUS_SUCCESS)
- {
- sys_wcstombs (server, buf, INTERNET_MAX_HOST_NAME_LENGTH + 1);
- if (wserver)
- for (WCHAR * ptr1 = buf; (*wserver++ = *ptr1++); ) {}
- NetApiBufferFree (buf);
- return TRUE;
- }
- __seterrno_from_win_error (ret);
- return FALSE;
-}
-
-static BOOL
-get_user_groups (WCHAR *wlogonserver, cygsidlist &grp_list, char *user, char * domain)
-{
- char dgroup[INTERNET_MAX_HOST_NAME_LENGTH + GNLEN + 2];
- WCHAR wuser[UNLEN + 1];
- sys_mbstowcs (wuser, user, UNLEN + 1);
- LPGROUP_USERS_INFO_0 buf;
- DWORD cnt, tot, len;
- NET_API_STATUS ret;
-
- /* Look only on logonserver */
- ret = NetUserGetGroups (wlogonserver, wuser, 0, (LPBYTE *) &buf,
- MAX_PREFERRED_LENGTH, &cnt, &tot);
- if (ret)
- {
- __seterrno_from_win_error (ret);
- /* It's no error when the user name can't be found. */
- return ret == NERR_UserNotFound;
- }
-
- len = strlen(domain);
- strcpy(dgroup, domain);
- dgroup[len++] = '\\';
-
- for (DWORD i = 0; i < cnt; ++i)
- {
- cygsid gsid;
- DWORD glen = sizeof (gsid);
- char domain[INTERNET_MAX_HOST_NAME_LENGTH + 1];
- DWORD dlen = sizeof (domain);
- SID_NAME_USE use = SidTypeInvalid;
-
- sys_wcstombs (dgroup + len, buf[i].grui0_name, GNLEN + 1);
- if (!LookupAccountName (NULL, dgroup, gsid, &glen, domain, &dlen, &use))
- debug_printf ("LookupAccountName(%s): %E", dgroup);
- else if (legal_sid_type (use))
- grp_list += gsid;
- else debug_printf("Global group %s invalid. Domain: %s Use: %d",
- dgroup, domain, use);
- }
-
- NetApiBufferFree (buf);
- return TRUE;
-}
-
-static BOOL
-is_group_member (WCHAR *wgroup, PSID pusersid, cygsidlist &grp_list)
-{
- LPLOCALGROUP_MEMBERS_INFO_0 buf;
- DWORD cnt, tot;
- NET_API_STATUS ret;
- BOOL retval = FALSE;
-
- /* Members can be users or global groups */
- ret = NetLocalGroupGetMembers (NULL, wgroup, 0, (LPBYTE *) &buf,
- MAX_PREFERRED_LENGTH, &cnt, &tot, NULL);
- if (ret)
- return FALSE;
-
- for (DWORD bidx = 0; !retval && bidx < cnt; ++bidx)
- if (EqualSid (pusersid, buf[bidx].lgrmi0_sid))
- retval = TRUE;
- else
- for (int glidx = 0; !retval && glidx < grp_list.count; ++glidx)
- if (EqualSid (grp_list.sids[glidx], buf[bidx].lgrmi0_sid))
- retval = TRUE;
-
- NetApiBufferFree (buf);
- return retval;
-}
-
-static BOOL
-get_user_local_groups (cygsidlist &grp_list, PSID pusersid)
-{
- LPLOCALGROUP_INFO_0 buf;
- DWORD cnt, tot;
- NET_API_STATUS ret;
-
- ret = NetLocalGroupEnum (NULL, 0, (LPBYTE *) &buf,
- MAX_PREFERRED_LENGTH, &cnt, &tot, NULL);
- if (ret)
- {
- __seterrno_from_win_error (ret);
- return FALSE;
- }
-
- char bgroup[sizeof ("BUILTIN\\") + GNLEN] = "BUILTIN\\";
- char lgroup[INTERNET_MAX_HOST_NAME_LENGTH + GNLEN + 2];
- const DWORD blen = sizeof ("BUILTIN\\") - 1;
- DWORD llen = INTERNET_MAX_HOST_NAME_LENGTH + 1;
- if (!GetComputerNameA(lgroup, & llen))
- {
- __seterrno();
- return FALSE;
- }
- lgroup[llen++] = '\\';
-
- for (DWORD i = 0; i < cnt; ++i)
- if (is_group_member (buf[i].lgrpi0_name, pusersid, grp_list))
- {
- cygsid gsid;
- DWORD glen = sizeof (gsid);
- char domain[INTERNET_MAX_HOST_NAME_LENGTH + 1];
- DWORD dlen = sizeof (domain);
- SID_NAME_USE use = SidTypeInvalid;
-
- sys_wcstombs (bgroup + blen, buf[i].lgrpi0_name, GNLEN + 1);
- if (!LookupAccountName (NULL, bgroup, gsid, &glen, domain, &dlen, &use))
- {
- if (GetLastError () != ERROR_NONE_MAPPED)
- debug_printf ("LookupAccountName(%s): %E", bgroup);
- strcpy(lgroup + llen, bgroup + blen);
- if (!LookupAccountName (NULL, lgroup, gsid, &glen,
- domain, &dlen, &use))
- debug_printf ("LookupAccountName(%s): %E", lgroup);
- }
- if (legal_sid_type (use))
- grp_list += gsid;
- else debug_printf("Rejecting local %s. use: %d", bgroup + blen, use);
- }
-
- NetApiBufferFree (buf);
- return TRUE;
-}
-
-static BOOL
-sid_in_token_groups (PTOKEN_GROUPS grps, cygsid &sid)
-{
- if (!grps)
- return FALSE;
- for (DWORD i = 0; i < grps->GroupCount; ++i)
- if (sid == grps->Groups[i].Sid)
- return TRUE;
- return FALSE;
-}
-
-static BOOL
-get_user_primary_group (WCHAR *wlogonserver, const char *user,
- PSID pusersid, cygsid &pgrpsid)
-{
- LPUSER_INFO_3 buf;
- WCHAR wuser[UNLEN + 1];
- NET_API_STATUS ret;
- BOOL retval = FALSE;
- UCHAR count = 0;
-
- if (pusersid == well_known_system_sid)
- {
- pgrpsid = well_known_system_sid;
- return TRUE;
- }
-
- sys_mbstowcs (wuser, user, UNLEN + 1);
- ret = NetUserGetInfo (wlogonserver, wuser, 3, (LPBYTE *) &buf);
- if (ret)
- {
- __seterrno_from_win_error (ret);
- return FALSE;
- }
-
- pgrpsid = pusersid;
- if (IsValidSid (pgrpsid) && (count = *GetSidSubAuthorityCount (pgrpsid)) > 1)
- {
- *GetSidSubAuthority (pgrpsid, count - 1) = buf->usri3_primary_group_id;
- retval = TRUE;
- }
- NetApiBufferFree (buf);
- return retval;
-}
-
-static int
-get_supplementary_group_sidlist (const char *username, cygsidlist &grp_list)
-{
- struct __group32 *gr;
- int cnt = 0;
-
- for (int gidx = 0; (gr = internal_getgrent (gidx)); ++gidx)
- {
- if (gr->gr_mem)
- for (int gi = 0; gr->gr_mem[gi]; ++gi)
- if (strcasematch (username, gr->gr_mem[gi]))
- {
- if (gr->gr_passwd && *gr->gr_passwd)
- {
- cygsid sid (gr->gr_passwd);
- if ((PSID)sid && grp_list.add (sid))
- ++cnt;
- }
- break;
- }
- }
- return cnt;
-}
-
-static BOOL
-get_group_sidlist (cygsidlist &grp_list,
- cygsid &usersid, cygsid &pgrpsid,
- PTOKEN_GROUPS my_grps, LUID auth_luid, int &auth_pos,
- BOOL * special_pgrp)
-{
- char user[UNLEN + 1];
- char domain[INTERNET_MAX_HOST_NAME_LENGTH + 1];
- WCHAR wserver[INTERNET_MAX_HOST_NAME_LENGTH + 3];
- char server[INTERNET_MAX_HOST_NAME_LENGTH + 3];
- DWORD ulen = sizeof (user);
- DWORD dlen = sizeof (domain);
- SID_NAME_USE use;
- cygsidlist sup_list;
-
- auth_pos = -1;
- if (!LookupAccountSid (NULL, usersid, user, &ulen, domain, &dlen, &use))
- {
- debug_printf ("LookupAccountSid () %E");
- __seterrno ();
- return FALSE;
- }
-
- grp_list += well_known_world_sid;
- if (usersid == well_known_system_sid)
- {
- grp_list += well_known_system_sid;
- grp_list += well_known_admins_sid;
- }
- else
- {
- if (!get_logon_server (domain, server, wserver))
- return FALSE;
- if (my_grps)
- {
- if (sid_in_token_groups (my_grps, well_known_local_sid))
- grp_list += well_known_local_sid;
- if (sid_in_token_groups (my_grps, well_known_dialup_sid))
- grp_list += well_known_dialup_sid;
- if (sid_in_token_groups (my_grps, well_known_network_sid))
- grp_list += well_known_network_sid;
- if (sid_in_token_groups (my_grps, well_known_batch_sid))
- grp_list += well_known_batch_sid;
- if (sid_in_token_groups (my_grps, well_known_interactive_sid))
- grp_list += well_known_interactive_sid;
- if (sid_in_token_groups (my_grps, well_known_service_sid))
- grp_list += well_known_service_sid;
- grp_list += well_known_authenticated_users_sid;
- }
- else
- {
- grp_list += well_known_local_sid;
- grp_list += well_known_interactive_sid;
- grp_list += well_known_authenticated_users_sid;
- }
- if (auth_luid.QuadPart != 999) /* != SYSTEM_LUID */
- {
- char buf[64];
- __small_sprintf (buf, "S-1-5-5-%u-%u", auth_luid.HighPart,
- auth_luid.LowPart);
- grp_list += buf;
- auth_pos = grp_list.count - 1;
- }
- if (!get_user_groups (wserver, grp_list, user, domain) ||
- !get_user_local_groups (grp_list, usersid))
- return FALSE;
- }
- /* special_pgrp true if pgrpsid is not null and not in normal groups */
- if (!pgrpsid)
- {
- * special_pgrp = FALSE;
- get_user_primary_group (wserver, user, usersid, pgrpsid);
- }
- else * special_pgrp = TRUE;
- if (get_supplementary_group_sidlist (user, sup_list))
- {
- for (int i = 0; i < sup_list.count; ++i)
- if (!grp_list.contains (sup_list.sids[i]))
- grp_list += sup_list.sids[i];
- }
- if (!grp_list.contains (pgrpsid))
- grp_list += pgrpsid;
- else * special_pgrp = FALSE;
- return TRUE;
-}
-
-static const char *sys_privs[] = {
- SE_TCB_NAME,
- SE_ASSIGNPRIMARYTOKEN_NAME,
- SE_CREATE_TOKEN_NAME,
- SE_CHANGE_NOTIFY_NAME,
- SE_SECURITY_NAME,
- SE_BACKUP_NAME,
- SE_RESTORE_NAME,
- SE_SYSTEMTIME_NAME,
- SE_SHUTDOWN_NAME,
- SE_REMOTE_SHUTDOWN_NAME,
- SE_TAKE_OWNERSHIP_NAME,
- SE_DEBUG_NAME,
- SE_SYSTEM_ENVIRONMENT_NAME,
- SE_SYSTEM_PROFILE_NAME,
- SE_PROF_SINGLE_PROCESS_NAME,
- SE_INC_BASE_PRIORITY_NAME,
- SE_LOAD_DRIVER_NAME,
- SE_CREATE_PAGEFILE_NAME,
- SE_INCREASE_QUOTA_NAME
-};
-
-#define SYSTEM_PERMISSION_COUNT (sizeof sys_privs / sizeof (const char *))
-
-PTOKEN_PRIVILEGES
-get_system_priv_list (cygsidlist &grp_list)
-{
- LUID priv;
- PTOKEN_PRIVILEGES privs = (PTOKEN_PRIVILEGES) malloc (sizeof (ULONG) +
- 20 * sizeof (LUID_AND_ATTRIBUTES));
- if (!privs)
- {
- debug_printf ("malloc (system_privs) failed.");
- return NULL;
- }
- privs->PrivilegeCount = 0;
-
- for (DWORD i = 0; i < SYSTEM_PERMISSION_COUNT; ++i)
- if (LookupPrivilegeValue (NULL, sys_privs[i], &priv))
- {
- privs->Privileges[privs->PrivilegeCount].Luid = priv;
- privs->Privileges[privs->PrivilegeCount].Attributes =
- SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_ENABLED_BY_DEFAULT;
- ++privs->PrivilegeCount;
- }
- return privs;
-}
-
-PTOKEN_PRIVILEGES
-get_priv_list (LSA_HANDLE lsa, cygsid &usersid, cygsidlist &grp_list)
-{
- PLSA_UNICODE_STRING privstrs;
- ULONG cnt;
- PTOKEN_PRIVILEGES privs = NULL;
- NTSTATUS ret;
- char buf[INTERNET_MAX_HOST_NAME_LENGTH + 1];
-
- if (usersid == well_known_system_sid)
- return get_system_priv_list (grp_list);
-
- for (int grp = -1; grp < grp_list.count; ++grp)
- {
- if (grp == -1)
- {
- if ((ret = LsaEnumerateAccountRights (lsa, usersid, &privstrs, &cnt))
- != STATUS_SUCCESS)
- continue;
- }
- else if ((ret = LsaEnumerateAccountRights (lsa, grp_list.sids[grp],
- &privstrs, &cnt))
- != STATUS_SUCCESS)
- continue;
- for (ULONG i = 0; i < cnt; ++i)
- {
- LUID priv;
- PTOKEN_PRIVILEGES tmp;
- DWORD tmp_count;
-
- lsa2str (buf, privstrs[i], sizeof(buf) - 1);
- if (!LookupPrivilegeValue (NULL, buf, &priv))
- continue;
-
- for (DWORD p = 0; privs && p < privs->PrivilegeCount; ++p)
- if (!memcmp (&priv, &privs->Privileges[p].Luid, sizeof (LUID)))
- goto next_account_right;
-
- tmp_count = privs ? privs->PrivilegeCount : 0;
- tmp = (PTOKEN_PRIVILEGES)
- realloc (privs, sizeof (ULONG) +
- (tmp_count + 1) * sizeof (LUID_AND_ATTRIBUTES));
- if (!tmp)
- {
- if (privs)
- free (privs);
- LsaFreeMemory (privstrs);
- debug_printf ("realloc (privs) failed.");
- return NULL;
- }
- tmp->PrivilegeCount = tmp_count;
- privs = tmp;
- privs->Privileges[privs->PrivilegeCount].Luid = priv;
- privs->Privileges[privs->PrivilegeCount].Attributes =
- SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_ENABLED_BY_DEFAULT;
- ++privs->PrivilegeCount;
-
- next_account_right:
- ;
- }
- LsaFreeMemory (privstrs);
- }
- return privs;
-}
-
-BOOL
-verify_token (HANDLE token, cygsid &usersid, cygsid &pgrpsid, BOOL * pintern)
-{
- DWORD size;
- BOOL intern = FALSE;
-
- if (pintern)
- {
- TOKEN_SOURCE ts;
- if (!GetTokenInformation (cygheap->user.token, TokenSource,
- &ts, sizeof ts, &size))
- debug_printf ("GetTokenInformation(): %E");
- else *pintern = intern = !memcmp (ts.SourceName, "Cygwin.1", 8);
- }
- /* Verify usersid */
- cygsid tok_usersid = NO_SID;
- if (!GetTokenInformation (token, TokenUser,
- &tok_usersid, sizeof tok_usersid, &size))
- debug_printf ("GetTokenInformation(): %E");
- if (usersid != tok_usersid) return FALSE;
-
- /* In an internal token, if the sd group is not well_known_null_sid,
- it must match pgrpsid */
- if (intern)
- {
- char sd_buf[MAX_SID_LEN + sizeof (SECURITY_DESCRIPTOR)];
- PSID gsid = NO_SID;
- if (!GetKernelObjectSecurity(token, GROUP_SECURITY_INFORMATION,
- (PSECURITY_DESCRIPTOR) sd_buf,
- sizeof sd_buf, &size))
- debug_printf ("GetKernelObjectSecurity(): %E");
- else if (!GetSecurityDescriptorGroup((PSECURITY_DESCRIPTOR) sd_buf,
- &gsid, (BOOL *) &size))
- debug_printf ("GetSecurityDescriptorGroup(): %E");
- if (well_known_null_sid != gsid) return pgrpsid == gsid;
- }
- /* See if the pgrpsid is in the token groups */
- PTOKEN_GROUPS my_grps = NULL;
- BOOL ret = FALSE;
-
- if (!GetTokenInformation (token, TokenGroups, NULL, 0, &size) &&
- GetLastError () != ERROR_INSUFFICIENT_BUFFER)
- debug_printf ("GetTokenInformation(token, TokenGroups): %E\n");
- else if (!(my_grps = (PTOKEN_GROUPS) malloc (size)))
- debug_printf ("malloc (my_grps) failed.");
- else if (!GetTokenInformation (token, TokenGroups, my_grps, size, &size))
- debug_printf ("GetTokenInformation(my_token, TokenGroups): %E\n");
- else ret = sid_in_token_groups (my_grps, pgrpsid);
- if (my_grps) free (my_grps);
- return ret;
-}
-
-HANDLE
-create_token (cygsid &usersid, cygsid &pgrpsid)
-{
- NTSTATUS ret;
- LSA_HANDLE lsa = INVALID_HANDLE_VALUE;
- int old_priv_state;
-
- cygsidlist grpsids;
-
- SECURITY_QUALITY_OF_SERVICE sqos =
- { sizeof sqos, SecurityImpersonation, SECURITY_STATIC_TRACKING, FALSE };
- OBJECT_ATTRIBUTES oa =
- { sizeof oa, 0, 0, 0, 0, &sqos };
- PSECURITY_ATTRIBUTES psa;
- BOOL special_pgrp;
- char sa_buf[1024];
- LUID auth_luid = SYSTEM_LUID;
- LARGE_INTEGER exp = { QuadPart:0x7fffffffffffffffLL };
-
- TOKEN_USER user;
- PTOKEN_GROUPS grps = NULL;
- PTOKEN_PRIVILEGES privs = NULL;
- TOKEN_OWNER owner;
- TOKEN_PRIMARY_GROUP pgrp;
- char acl_buf[MAX_DACL_LEN(5)];
- TOKEN_DEFAULT_DACL dacl;
- TOKEN_SOURCE source;
- TOKEN_STATISTICS stats;
- memcpy(source.SourceName, "Cygwin.1", 8);
- source.SourceIdentifier.HighPart = 0;
- source.SourceIdentifier.LowPart = 0x0101;
-
- HANDLE token = INVALID_HANDLE_VALUE;
- HANDLE primary_token = INVALID_HANDLE_VALUE;
-
- HANDLE my_token = INVALID_HANDLE_VALUE;
- PTOKEN_GROUPS my_grps = NULL;
- DWORD size;
-
- /* SE_CREATE_TOKEN_NAME privilege needed to call NtCreateToken. */
- if ((old_priv_state = set_process_privilege (SE_CREATE_TOKEN_NAME)) < 0)
- goto out;
-
- /* Open policy object. */
- if ((lsa = open_local_policy ()) == INVALID_HANDLE_VALUE)
- goto out;
-
- /* User, owner, primary group. */
- user.User.Sid = usersid;
- user.User.Attributes = 0;
- owner.Owner = usersid;
-
- /* Retrieve authentication id and group list from own process. */
- if (!OpenProcessToken (GetCurrentProcess (), TOKEN_QUERY, &my_token))
- debug_printf ("OpenProcessToken(my_token): %E\n");
- else
- {
- /* Switching user context to SYSTEM doesn't inherit the authentication
- id of the user account running current process. */
- if (usersid != well_known_system_sid)
- if (!GetTokenInformation (my_token, TokenStatistics,
- &stats, sizeof stats, &size))
- debug_printf ("GetTokenInformation(my_token, TokenStatistics): %E\n");
- else
- auth_luid = stats.AuthenticationId;
-
- /* Retrieving current processes group list to be able to inherit
- some important well known group sids. */
- if (!GetTokenInformation (my_token, TokenGroups, NULL, 0, &size) &&
- GetLastError () != ERROR_INSUFFICIENT_BUFFER)
- debug_printf ("GetTokenInformation(my_token, TokenGroups): %E\n");
- else if (!(my_grps = (PTOKEN_GROUPS) malloc (size)))
- debug_printf ("malloc (my_grps) failed.");
- else if (!GetTokenInformation (my_token, TokenGroups, my_grps,
- size, &size))
- {
- debug_printf ("GetTokenInformation(my_token, TokenGroups): %E\n");
- free (my_grps);
- my_grps = NULL;
- }
- CloseHandle (my_token);
- }
-
- /* Create list of groups, the user is member in. */
- int auth_pos;
- if (!get_group_sidlist (grpsids, usersid, pgrpsid,
- my_grps, auth_luid, auth_pos, &special_pgrp))
- goto out;
-
- /* Primary group. */
- pgrp.PrimaryGroup = pgrpsid;
-
- /* Create a TOKEN_GROUPS list from the above retrieved list of sids. */
- char grps_buf[sizeof (ULONG) + grpsids.count * sizeof (SID_AND_ATTRIBUTES)];
- grps = (PTOKEN_GROUPS) grps_buf;
- grps->GroupCount = grpsids.count;
- for (DWORD i = 0; i < grps->GroupCount; ++i)
- {
- grps->Groups[i].Sid = grpsids.sids[i];
- grps->Groups[i].Attributes = SE_GROUP_MANDATORY |
- SE_GROUP_ENABLED_BY_DEFAULT |
- SE_GROUP_ENABLED;
- if (auth_pos >= 0 && i == (DWORD) auth_pos)
- grps->Groups[i].Attributes |= SE_GROUP_LOGON_ID;
- }
-
- /* Retrieve list of privileges of that user. */
- if (!(privs = get_priv_list (lsa, usersid, grpsids)))
- goto out;
-
- /* Create default dacl. */
- if (!sec_acl((PACL) acl_buf, FALSE,
- grpsids.contains (well_known_admins_sid)?well_known_admins_sid:usersid))
- goto out;
- dacl.DefaultDacl = (PACL) acl_buf;
-
- /* Let's be heroic... */
- ret = NtCreateToken (&token, TOKEN_ALL_ACCESS, &oa, TokenImpersonation,
- &auth_luid, &exp, &user, grps, privs, &owner, &pgrp,
- &dacl, &source);
- if (ret)
- __seterrno_from_win_error (RtlNtStatusToDosError (ret));
- else if (GetLastError () == ERROR_PROC_NOT_FOUND)
- {
- __seterrno ();
- debug_printf ("Loading NtCreateToken failed.");
- }
- else
- {
- /* Set security descriptor and primary group */
- psa = __sec_user (sa_buf, usersid, TRUE);
- if (psa->lpSecurityDescriptor &&
- !SetSecurityDescriptorGroup (
- (PSECURITY_DESCRIPTOR) psa->lpSecurityDescriptor,
- special_pgrp?pgrpsid:well_known_null_sid, FALSE))
- debug_printf ("SetSecurityDescriptorGroup %E");
- /* Convert to primary token. */
- if (!DuplicateTokenEx (token, MAXIMUM_ALLOWED, psa,
- SecurityImpersonation, TokenPrimary, &primary_token))
- {
- __seterrno ();
- debug_printf ("DuplicateTokenEx %E");
- }
- }
-
-out:
- if (old_priv_state >= 0)
- set_process_privilege (SE_CREATE_TOKEN_NAME, old_priv_state);
- if (token != INVALID_HANDLE_VALUE)
- CloseHandle (token);
- if (privs)
- free (privs);
- if (my_grps)
- free (my_grps);
- close_local_policy (lsa);
-
- debug_printf ("%d = create_token ()", primary_token);
- return primary_token;
-}
-
-int subauth_id = 255;
-
-HANDLE
-subauth (struct passwd *pw)
-{
- LSA_STRING name;
- HANDLE lsa_hdl;
- LSA_OPERATIONAL_MODE sec_mode;
- NTSTATUS ret, ret2;
- ULONG package_id, size;
- struct {
- LSA_STRING str;
- CHAR buf[16];
- } origin;
- struct {
- MSV1_0_LM20_LOGON auth;
- WCHAR dombuf[INTERNET_MAX_HOST_NAME_LENGTH + 1];
- WCHAR usrbuf[UNLEN + 1];
- WCHAR wkstbuf[1];
- CHAR authinf1[1];
- CHAR authinf2[1];
- } subbuf;
- TOKEN_SOURCE ts;
- PMSV1_0_LM20_LOGON_PROFILE profile;
- LUID luid;
- QUOTA_LIMITS quota;
- char nt_domain[INTERNET_MAX_HOST_NAME_LENGTH + 1];
- char nt_user[UNLEN + 1];
- SECURITY_ATTRIBUTES sa = { sizeof sa, NULL, TRUE };
- HANDLE user_token = INVALID_HANDLE_VALUE;
- HANDLE primary_token = INVALID_HANDLE_VALUE;
- int old_tcb_state;
-
- if ((old_tcb_state = set_process_privilege(SE_TCB_NAME)) < 0)
- return INVALID_HANDLE_VALUE;
-
- /* Register as logon process. */
- str2lsa (name, "Cygwin");
- SetLastError (0);
- ret = LsaRegisterLogonProcess(&name, &lsa_hdl, &sec_mode);
- if (ret != STATUS_SUCCESS)
- {
- debug_printf ("LsaRegisterLogonProcess: %d", ret);
- __seterrno_from_win_error (LsaNtStatusToWinError(ret));
- goto out;
- }
- else if (GetLastError () == ERROR_PROC_NOT_FOUND)
- {
- debug_printf ("Couldn't load Secur32.dll");
- goto out;
- }
- /* Get handle to MSV1_0 package. */
- str2lsa (name, MSV1_0_PACKAGE_NAME);
- ret = LsaLookupAuthenticationPackage(lsa_hdl, &name, &package_id);
- if (ret != STATUS_SUCCESS)
- {
- debug_printf ("LsaLookupAuthenticationPackage: %d", ret);
- __seterrno_from_win_error (LsaNtStatusToWinError(ret));
- LsaDeregisterLogonProcess(lsa_hdl);
- goto out;
- }
- /* Create origin. */
- str2buf2lsa (origin.str, origin.buf, "Cygwin");
- /* Create token source. */
- memcpy(ts.SourceName, "Cygwin.1", 8);
- ts.SourceIdentifier.HighPart = 0;
- ts.SourceIdentifier.LowPart = 0x0100;
- /* Get user information. */
- extract_nt_dom_user (pw, nt_domain, nt_user);
- /* Fill subauth with values. */
- subbuf.auth.MessageType = MsV1_0NetworkLogon;
- str2buf2uni(subbuf.auth.LogonDomainName, subbuf.dombuf, nt_domain);
- str2buf2uni(subbuf.auth.UserName, subbuf.usrbuf, nt_user);
- str2buf2uni(subbuf.auth.Workstation, subbuf.wkstbuf, "");
- memcpy(subbuf.auth.ChallengeToClient, "12345678", MSV1_0_CHALLENGE_LENGTH);
- str2buf2lsa(subbuf.auth.CaseSensitiveChallengeResponse, subbuf.authinf1, "");
- str2buf2lsa(subbuf.auth.CaseInsensitiveChallengeResponse, subbuf.authinf2,"");
- subbuf.auth.ParameterControl = 0 | (subauth_id << 24);
- /* Try to logon... */
- ret = LsaLogonUser(lsa_hdl, (PLSA_STRING) &origin, Network,
- package_id, &subbuf, sizeof subbuf,
- NULL, &ts, (PVOID *)&profile, &size,
- &luid, &user_token, &quota, &ret2);
- if (ret != STATUS_SUCCESS)
- {
- debug_printf ("LsaLogonUser: %d", ret);
- __seterrno_from_win_error (LsaNtStatusToWinError(ret));
- LsaDeregisterLogonProcess(lsa_hdl);
- goto out;
- }
- LsaFreeReturnBuffer(profile);
- /* Convert to primary token. */
- if (!DuplicateTokenEx (user_token, TOKEN_ALL_ACCESS, &sa,
- SecurityImpersonation, TokenPrimary,
- &primary_token))
- __seterrno ();
-
-out:
- set_process_privilege(SE_TCB_NAME, old_tcb_state);
- if (user_token != INVALID_HANDLE_VALUE)
- CloseHandle (user_token);
- return primary_token;
-}
-
-/* read_sd reads a security descriptor from a file.
- In case of error, -1 is returned and errno is set.
- If sd_buf is too small, 0 is returned and sd_size
- is set to the needed buffer size.
- On success, 1 is returned.
-
- GetFileSecurity() is used instead of BackupRead()
- to avoid access denied errors if the caller has
- not the permission to open that file for read.
-
- Originally the function should return the size
- of the SD on success. Unfortunately NT returns
- 0 in `len' on success, while W2K returns the
- correct size!
-*/
-
-LONG
-read_sd(const char *file, PSECURITY_DESCRIPTOR sd_buf, LPDWORD sd_size)
-{
- /* Check parameters */
- if (!sd_size)
- {
- set_errno (EINVAL);
- return -1;
- }
-
- debug_printf("file = %s", file);
-
- DWORD len = 0;
- const char *pfile = file;
- char fbuf [PATH_MAX];
- if (current_codepage == oem_cp)
- {
- DWORD fname_len = min (sizeof (fbuf) - 1, strlen (file));
- bzero (fbuf, sizeof (fbuf));
- OemToCharBuff(file, fbuf, fname_len);
- pfile = fbuf;
- }
-
- if (!GetFileSecurity (pfile,
- OWNER_SECURITY_INFORMATION
- | GROUP_SECURITY_INFORMATION
- | DACL_SECURITY_INFORMATION,
- sd_buf, *sd_size, &len))
- {
- __seterrno ();
- return -1;
- }
- debug_printf("file = %s: len=%d", file, len);
- if (len > *sd_size)
- {
- *sd_size = len;
- return 0;
- }
- return 1;
-}
-
-LONG
-write_sd(const char *file, PSECURITY_DESCRIPTOR sd_buf, DWORD sd_size)
-{
- /* Check parameters */
- if (!sd_buf || !sd_size)
- {
- set_errno (EINVAL);
- return -1;
- }
-
- /* No need to be thread save. */
- static BOOL first_time = TRUE;
- if (first_time)
- {
- set_process_privilege (SE_RESTORE_NAME);
- first_time = FALSE;
- }
-
- HANDLE fh;
- fh = CreateFile (file,
- WRITE_OWNER | WRITE_DAC,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- &sec_none_nih,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS,
- NULL);
-
- if (fh == INVALID_HANDLE_VALUE)
- {
- __seterrno ();
- return -1;
- }
-
- LPVOID context = NULL;
- DWORD bytes_written = 0;
- WIN32_STREAM_ID header;
-
- memset (&header, 0, sizeof (header));
- /* write new security info header */
- header.dwStreamId = BACKUP_SECURITY_DATA;
- header.dwStreamAttributes = STREAM_CONTAINS_SECURITY;
- header.Size.HighPart = 0;
- header.Size.LowPart = sd_size;
- header.dwStreamNameSize = 0;
- if (!BackupWrite (fh, (LPBYTE) &header,
- 3 * sizeof (DWORD) + sizeof (LARGE_INTEGER),
- &bytes_written, FALSE, TRUE, &context))
- {
- __seterrno ();
- CloseHandle (fh);
- return -1;
- }
-
- /* write new security descriptor */
- if (!BackupWrite (fh, (LPBYTE) sd_buf,
- header.Size.LowPart + header.dwStreamNameSize,
- &bytes_written, FALSE, TRUE, &context))
- {
- /* Samba returns ERROR_NOT_SUPPORTED.
- FAT returns ERROR_INVALID_SECURITY_DESCR.
- This shouldn't return as error, but better be ignored. */
- DWORD ret = GetLastError ();
- if (ret != ERROR_NOT_SUPPORTED && ret != ERROR_INVALID_SECURITY_DESCR)
- {
- __seterrno ();
- BackupWrite (fh, NULL, 0, &bytes_written, TRUE, TRUE, &context);
- CloseHandle (fh);
- return -1;
- }
- }
-
- /* terminate the restore process */
- BackupWrite (fh, NULL, 0, &bytes_written, TRUE, TRUE, &context);
- CloseHandle (fh);
- return 0;
-}
-
-static int
-get_nt_attribute (const char *file, int *attribute,
- __uid32_t *uidret, __gid32_t *gidret)
-{
- if (!wincap.has_security ())
- return 0;
-
- syscall_printf ("file: %s", file);
-
- /* Yeah, sounds too much, but I've seen SDs of 2100 bytes!*/
- DWORD sd_size = 4096;
- char sd_buf[4096];
- PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR) sd_buf;
-
- int ret;
- if ((ret = read_sd (file, psd, &sd_size)) <= 0)
- {
- debug_printf ("read_sd %E");
- return ret;
- }
-
- PSID owner_sid;
- PSID group_sid;
- BOOL dummy;
-
- if (!GetSecurityDescriptorOwner (psd, &owner_sid, &dummy))
- debug_printf ("GetSecurityDescriptorOwner %E");
- if (!GetSecurityDescriptorGroup (psd, &group_sid, &dummy))
- debug_printf ("GetSecurityDescriptorGroup %E");
-
- PACL acl;
- BOOL acl_exists;
-
- if (!GetSecurityDescriptorDacl (psd, &acl_exists, &acl, &dummy))
- {
- __seterrno ();
- debug_printf ("GetSecurityDescriptorDacl %E");
- return -1;
- }
-
- __uid32_t uid = cygsid(owner_sid).get_uid ();
- __gid32_t gid = cygsid(group_sid).get_gid ();
- if (uidret)
- *uidret = uid;
- if (gidret)
- *gidret = gid;
-
- if (!attribute)
- {
- syscall_printf ("file: %s uid %d, gid %d", file, uid, gid);
- return 0;
- }
-
- BOOL grp_member = is_grp_member (uid, gid);
-
- if (!acl_exists || !acl)
- {
- *attribute |= S_IRWXU | S_IRWXG | S_IRWXO;
- syscall_printf ("file: %s No ACL = %x, uid %d, gid %d",
- file, *attribute, uid, gid);
- return 0;
- }
-
- ACCESS_ALLOWED_ACE *ace;
- int allow = 0;
- int deny = 0;
- int *flags, *anti;
-
- for (DWORD i = 0; i < acl->AceCount; ++i)
- {
- if (!GetAce (acl, i, (PVOID *) &ace))
- continue;
- if (ace->Header.AceFlags & INHERIT_ONLY_ACE)
- continue;
- switch (ace->Header.AceType)
- {
- case ACCESS_ALLOWED_ACE_TYPE:
- flags = &allow;
- anti = &deny;
- break;
- case ACCESS_DENIED_ACE_TYPE:
- flags = &deny;
- anti = &allow;
- break;
- default:
- continue;
- }
-
- cygsid ace_sid ((PSID) &ace->SidStart);
- if (owner_sid && ace_sid == owner_sid)
- {
- if (ace->Mask & FILE_READ_DATA)
- *flags |= S_IRUSR;
- if (ace->Mask & FILE_WRITE_DATA)
- *flags |= S_IWUSR;
- if (ace->Mask & FILE_EXECUTE)
- *flags |= S_IXUSR;
- }
- else if (group_sid && ace_sid == group_sid)
- {
- if (ace->Mask & FILE_READ_DATA)
- *flags |= S_IRGRP
- | ((grp_member && !(*anti & S_IRUSR)) ? S_IRUSR : 0);
- if (ace->Mask & FILE_WRITE_DATA)
- *flags |= S_IWGRP
- | ((grp_member && !(*anti & S_IWUSR)) ? S_IWUSR : 0);
- if (ace->Mask & FILE_EXECUTE)
- *flags |= S_IXGRP
- | ((grp_member && !(*anti & S_IXUSR)) ? S_IXUSR : 0);
- }
- else if (ace_sid == well_known_world_sid)
- {
- if (ace->Mask & FILE_READ_DATA)
- *flags |= S_IROTH
- | ((!(*anti & S_IRGRP)) ? S_IRGRP : 0)
- | ((!(*anti & S_IRUSR)) ? S_IRUSR : 0);
- if (ace->Mask & FILE_WRITE_DATA)
- *flags |= S_IWOTH
- | ((!(*anti & S_IWGRP)) ? S_IWGRP : 0)
- | ((!(*anti & S_IWUSR)) ? S_IWUSR : 0);
- if (ace->Mask & FILE_EXECUTE)
- {
- *flags |= S_IXOTH
- | ((!(*anti & S_IXGRP)) ? S_IXGRP : 0)
- | ((!(*anti & S_IXUSR)) ? S_IXUSR : 0);
- }
- if ((*attribute & S_IFDIR) &&
- (ace->Mask & (FILE_WRITE_DATA | FILE_EXECUTE | FILE_DELETE_CHILD))
- == (FILE_WRITE_DATA | FILE_EXECUTE))
- *flags |= S_ISVTX;
- }
- else if (ace_sid == well_known_null_sid)
- {
- /* Read SUID, SGID and VTX bits from NULL ACE. */
- if (ace->Mask & FILE_READ_DATA)
- *flags |= S_ISVTX;
- if (ace->Mask & FILE_WRITE_DATA)
- *flags |= S_ISGID;
- if (ace->Mask & FILE_APPEND_DATA)
- *flags |= S_ISUID;
- }
- }
- *attribute &= ~(S_IRWXU | S_IRWXG | S_IRWXO | S_ISVTX | S_ISGID | S_ISUID);
- *attribute |= allow;
- *attribute &= ~deny;
- syscall_printf ("file: %s %x, uid %d, gid %d", file, *attribute, uid, gid);
- return 0;
-}
-
-int
-get_file_attribute (int use_ntsec, const char *file,
- int *attribute, __uid32_t *uidret, __gid32_t *gidret)
-{
- int res;
-
- if (use_ntsec && allow_ntsec)
- {
- res = get_nt_attribute (file, attribute, uidret, gidret);
- if (attribute && (*attribute & S_IFLNK) == S_IFLNK)
- *attribute |= S_IRWXU | S_IRWXG | S_IRWXO;
- return res;
- }
-
- if (uidret)
- *uidret = getuid32 ();
- if (gidret)
- *gidret = getgid32 ();
-
- if (!attribute)
- return 0;
-
- if (allow_ntea)
- {
- int oatt = *attribute;
- res = NTReadEA (file, ".UNIXATTR", (char *) attribute, sizeof (*attribute));
- *attribute |= oatt;
- }
- else
- res = 0;
-
- /* symlinks are everything for everyone!*/
- if ((*attribute & S_IFLNK) == S_IFLNK)
- *attribute |= S_IRWXU | S_IRWXG | S_IRWXO;
-
- return res > 0 ? 0 : -1;
-}
-
-BOOL
-add_access_allowed_ace (PACL acl, int offset, DWORD attributes,
- PSID sid, size_t &len_add, DWORD inherit)
-{
- if (!AddAccessAllowedAce (acl, ACL_REVISION, attributes, sid))
- {
- __seterrno ();
- return FALSE;
- }
- ACCESS_ALLOWED_ACE *ace;
- if (GetAce(acl, offset, (PVOID *) &ace))
- ace->Header.AceFlags |= inherit;
- len_add += sizeof (ACCESS_DENIED_ACE) - sizeof (DWORD)
- + GetLengthSid (sid);
- return TRUE;
-}
-
-BOOL
-add_access_denied_ace (PACL acl, int offset, DWORD attributes,
- PSID sid, size_t &len_add, DWORD inherit)
-{
- if (!AddAccessDeniedAce (acl, ACL_REVISION, attributes, sid))
- {
- __seterrno ();
- return FALSE;
- }
- ACCESS_DENIED_ACE *ace;
- if (GetAce(acl, offset, (PVOID *) &ace))
- ace->Header.AceFlags |= inherit;
- len_add += sizeof (ACCESS_DENIED_ACE) - sizeof (DWORD)
- + GetLengthSid (sid);
- return TRUE;
-}
-
-PSECURITY_DESCRIPTOR
-alloc_sd (__uid32_t uid, __gid32_t gid, int attribute,
- PSECURITY_DESCRIPTOR sd_ret, DWORD *sd_size_ret)
-{
- BOOL dummy;
-
- if (!wincap.has_security ())
- return NULL;
-
- if (!sd_ret || !sd_size_ret)
- {
- set_errno (EINVAL);
- return NULL;
- }
-
- /* Get SID and name of new owner. */
- char owner[UNLEN + 1];
- cygsid owner_sid;
- struct passwd *pw = getpwuid32 (uid);
- strcpy (owner, pw ? pw->pw_name : getlogin ());
- if (!pw || !owner_sid.getfrompw (pw))
- return NULL;
- debug_printf ("owner: %s [%d]", owner,
- *GetSidSubAuthority(owner_sid,
- *GetSidSubAuthorityCount(owner_sid) - 1));
-
- /* Get SID and name of new group. */
- cygsid group_sid (NO_SID);
- struct __group32 *grp = getgrgid32 (gid);
- if (grp)
- {
- if (!grp || !group_sid.getfromgr (grp))
- return NULL;
- }
- else
- debug_printf ("no group");
-
- /* Initialize local security descriptor. */
- SECURITY_DESCRIPTOR sd;
- PSECURITY_DESCRIPTOR psd = NULL;
- if (!InitializeSecurityDescriptor (&sd, SECURITY_DESCRIPTOR_REVISION))
- {
- __seterrno ();
- return NULL;
- }
-
- /*
- * We set the SE_DACL_PROTECTED flag here to prevent the DACL from being
- * modified by inheritable ACEs.
- * This flag as well as the SetSecurityDescriptorControl call are available
- * only since Win2K.
- */
- if (wincap.has_security_descriptor_control ())
- SetSecurityDescriptorControl (&sd, SE_DACL_PROTECTED, SE_DACL_PROTECTED);
-
- /* Create owner for local security descriptor. */
- if (!SetSecurityDescriptorOwner(&sd, owner_sid, FALSE))
- {
- __seterrno ();
- return NULL;
- }
-
- /* Create group for local security descriptor. */
- if (group_sid && !SetSecurityDescriptorGroup(&sd, group_sid, FALSE))
- {
- __seterrno ();
- return NULL;
- }
-
- /* Initialize local access control list. */
- char acl_buf[3072];
- PACL acl = (PACL) acl_buf;
- if (!InitializeAcl (acl, 3072, ACL_REVISION))
- {
- __seterrno ();
- return NULL;
- }
-
- /* From here fill ACL. */
- size_t acl_len = sizeof (ACL);
- int ace_off = 0;
-
- /* Construct allow attribute for owner. */
- DWORD owner_allow = (STANDARD_RIGHTS_ALL & ~DELETE)
- | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA;
- if (attribute & S_IRUSR)
- owner_allow |= FILE_GENERIC_READ;
- if (attribute & S_IWUSR)
- owner_allow |= FILE_GENERIC_WRITE | DELETE;
- if (attribute & S_IXUSR)
- owner_allow |= FILE_GENERIC_EXECUTE;
- if ((attribute & (S_IFDIR | S_IWUSR | S_IXUSR))
- == (S_IFDIR | S_IWUSR | S_IXUSR))
- owner_allow |= FILE_DELETE_CHILD;
-
- /* Construct allow attribute for group. */
- DWORD group_allow = STANDARD_RIGHTS_READ
- | FILE_READ_ATTRIBUTES | FILE_READ_EA;
- if (attribute & S_IRGRP)
- group_allow |= FILE_GENERIC_READ;
- if (attribute & S_IWGRP)
- group_allow |= STANDARD_RIGHTS_WRITE | FILE_GENERIC_WRITE;
- if (attribute & S_IXGRP)
- group_allow |= FILE_GENERIC_EXECUTE;
- if ((attribute & (S_IFDIR | S_IWGRP | S_IXGRP))
- == (S_IFDIR | S_IWGRP | S_IXGRP)
- && !(attribute & S_ISVTX))
- group_allow |= FILE_DELETE_CHILD;
-
- /* Construct allow attribute for everyone. */
- DWORD other_allow = STANDARD_RIGHTS_READ
- | FILE_READ_ATTRIBUTES | FILE_READ_EA;
- if (attribute & S_IROTH)
- other_allow |= FILE_GENERIC_READ;
- if (attribute & S_IWOTH)
- other_allow |= STANDARD_RIGHTS_WRITE | FILE_GENERIC_WRITE;
- if (attribute & S_IXOTH)
- other_allow |= FILE_GENERIC_EXECUTE;
- if ((attribute & (S_IFDIR | S_IWOTH | S_IXOTH))
- == (S_IFDIR | S_IWOTH | S_IXOTH)
- && !(attribute & S_ISVTX))
- other_allow |= FILE_DELETE_CHILD;
-
- /* Construct SUID, SGID and VTX bits in NULL ACE. */
- DWORD null_allow = 0L;
- if (attribute & (S_ISUID | S_ISGID | S_ISVTX))
- {
- if (attribute & S_ISUID)
- null_allow |= FILE_APPEND_DATA;
- if (attribute & S_ISGID)
- null_allow |= FILE_WRITE_DATA;
- if (attribute & S_ISVTX)
- null_allow |= FILE_READ_DATA;
- }
-
- /* Construct deny attributes for owner and group. */
- DWORD owner_deny = 0;
- if (is_grp_member (uid, gid))
- owner_deny = ~owner_allow & (group_allow | other_allow);
- else
- owner_deny = ~owner_allow & other_allow;
- owner_deny &= ~(STANDARD_RIGHTS_READ
- | FILE_READ_ATTRIBUTES | FILE_READ_EA
- | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA);
- DWORD group_deny = ~group_allow & other_allow;
- group_deny &= ~(STANDARD_RIGHTS_READ | FILE_READ_ATTRIBUTES | FILE_READ_EA);
-
- /* Construct appropriate inherit attribute. */
- DWORD inherit = (attribute & S_IFDIR) ? INHERIT_ALL : DONT_INHERIT;
-
- /* Set deny ACE for owner. */
- if (owner_deny
- && !add_access_denied_ace (acl, ace_off++, owner_deny,
- owner_sid, acl_len, inherit))
- return NULL;
- /* Set allow ACE for owner. */
- if (!add_access_allowed_ace (acl, ace_off++, owner_allow,
- owner_sid, acl_len, inherit))
- return NULL;
- /* Set deny ACE for group. */
- if (group_deny
- && !add_access_denied_ace (acl, ace_off++, group_deny,
- group_sid, acl_len, inherit))
- return NULL;
- /* Set allow ACE for group. */
- if (!add_access_allowed_ace (acl, ace_off++, group_allow,
- group_sid, acl_len, inherit))
- return NULL;
-
- /* Set allow ACE for everyone. */
- if (!add_access_allowed_ace (acl, ace_off++, other_allow,
- well_known_world_sid, acl_len, inherit))
- return NULL;
- /* Set null ACE for special bits. */
- if (null_allow
- && !add_access_allowed_ace (acl, ace_off++, null_allow,
- well_known_null_sid, acl_len, DONT_INHERIT))
- return NULL;
-
- /* Get owner and group from current security descriptor. */
- PSID cur_owner_sid = NULL;
- PSID cur_group_sid = NULL;
- if (!GetSecurityDescriptorOwner (sd_ret, &cur_owner_sid, &dummy))
- debug_printf ("GetSecurityDescriptorOwner %E");
- if (!GetSecurityDescriptorGroup (sd_ret, &cur_group_sid, &dummy))
- debug_printf ("GetSecurityDescriptorGroup %E");
-
- /* Fill ACL with unrelated ACEs from current security descriptor. */
- PACL oacl;
- BOOL acl_exists;
- ACCESS_ALLOWED_ACE *ace;
- if (GetSecurityDescriptorDacl (sd_ret, &acl_exists, &oacl, &dummy)
- && acl_exists && oacl)
- for (DWORD i = 0; i < oacl->AceCount; ++i)
- if (GetAce (oacl, i, (PVOID *) &ace))
- {
- cygsid ace_sid ((PSID) &ace->SidStart);
- /* Check for related ACEs. */
- if ((cur_owner_sid && ace_sid == cur_owner_sid)
- || (owner_sid && ace_sid == owner_sid)
- || (cur_group_sid && ace_sid == cur_group_sid)
- || (group_sid && ace_sid == group_sid)
- || (ace_sid == well_known_world_sid)
- || (ace_sid == well_known_null_sid))
- continue;
- /*
- * Add unrelated ACCESS_DENIED_ACE to the beginning but
- * behind the owner_deny, ACCESS_ALLOWED_ACE to the end.
- */
- if (!AddAce(acl, ACL_REVISION,
- ace->Header.AceType == ACCESS_DENIED_ACE_TYPE ?
- (owner_deny ? 1 : 0) : MAXDWORD,
- (LPVOID) ace, ace->Header.AceSize))
- {
- __seterrno ();
- return NULL;
- }
- acl_len += ace->Header.AceSize;
- }
-
- /* Set AclSize to computed value. */
- acl->AclSize = acl_len;
- debug_printf ("ACL-Size: %d", acl_len);
-
- /* Create DACL for local security descriptor. */
- if (!SetSecurityDescriptorDacl (&sd, TRUE, acl, FALSE))
- {
- __seterrno ();
- return NULL;
- }
-
- /* Make self relative security descriptor. */
- *sd_size_ret = 0;
- MakeSelfRelativeSD (&sd, sd_ret, sd_size_ret);
- if (*sd_size_ret <= 0)
- {
- __seterrno ();
- return NULL;
- }
- if (!MakeSelfRelativeSD (&sd, sd_ret, sd_size_ret))
- {
- __seterrno ();
- return NULL;
- }
- psd = sd_ret;
- debug_printf ("Created SD-Size: %d", *sd_size_ret);
-
- return psd;
-}
-
-void
-set_security_attribute (int attribute, PSECURITY_ATTRIBUTES psa,
- void *sd_buf, DWORD sd_buf_size)
-{
- /* symlinks are anything for everyone!*/
- if ((attribute & S_IFLNK) == S_IFLNK)
- attribute |= S_IRWXU | S_IRWXG | S_IRWXO;
-
- psa->lpSecurityDescriptor = sd_buf;
- InitializeSecurityDescriptor ((PSECURITY_DESCRIPTOR)sd_buf,
- SECURITY_DESCRIPTOR_REVISION);
- psa->lpSecurityDescriptor = alloc_sd (geteuid32 (), getegid32 (),
- attribute, (PSECURITY_DESCRIPTOR)sd_buf,
- &sd_buf_size);
-}
-
-static int
-set_nt_attribute (const char *file, __uid32_t uid, __gid32_t gid,
- int attribute)
-{
- if (!wincap.has_security ())
- return 0;
-
- DWORD sd_size = 4096;
- char sd_buf[4096];
- PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR) sd_buf;
-
- int ret;
- if ((ret = read_sd (file, psd, &sd_size)) <= 0)
- {
- debug_printf ("read_sd %E");
- return -1;
- }
-
- sd_size = 4096;
- if (!(psd = alloc_sd (uid, gid, attribute, psd, &sd_size)))
- return -1;
-
- return write_sd (file, psd, sd_size);
-}
-
-int
-set_file_attribute (int use_ntsec, const char *file,
- __uid32_t uid, __gid32_t gid,
- int attribute)
-{
- int ret = 0;
-
- if (use_ntsec && allow_ntsec)
- ret = set_nt_attribute (file, uid, gid, attribute);
- else if (allow_ntea && !NTWriteEA (file, ".UNIXATTR", (char *) &attribute,
- sizeof (attribute)))
- {
- __seterrno ();
- ret = -1;
- }
- syscall_printf ("%d = set_file_attribute (%s, %d, %d, %p)",
- ret, file, uid, gid, attribute);
- return ret;
-}
-
-int
-set_file_attribute (int use_ntsec, const char *file, int attribute)
-{
- return set_file_attribute (use_ntsec, file,
- myself->uid, myself->gid,
- attribute);
-}
diff --git a/winsup/cygwin/security.h b/winsup/cygwin/security.h
deleted file mode 100644
index af4b667f8..000000000
--- a/winsup/cygwin/security.h
+++ /dev/null
@@ -1,221 +0,0 @@
-/* security.h: security declarations
-
- Copyright 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. */
-
-#define DONT_INHERIT (0)
-#define INHERIT_ALL (CONTAINER_INHERIT_ACE|OBJECT_INHERIT_ACE)
-#define INHERIT_ONLY (INHERIT_ONLY_ACE|CONTAINER_INHERIT_ACE|OBJECT_INHERIT_ACE)
-
-#define DEFAULT_UID DOMAIN_USER_RID_ADMIN
-#define DEFAULT_GID DOMAIN_ALIAS_RID_ADMINS
-
-#define MAX_SID_LEN 40
-#define MAX_DACL_LEN(n) (sizeof (ACL) \
- + (n) * (sizeof (ACCESS_ALLOWED_ACE) - sizeof (DWORD) + MAX_SID_LEN))
-
-#define NO_SID ((PSID)NULL)
-
-class cygsid {
- PSID psid;
- char sbuf[MAX_SID_LEN];
-
- const PSID getfromstr (const char *nsidstr);
- PSID get_sid (DWORD s, DWORD cnt, DWORD *r);
-
- inline const PSID assign (const PSID nsid)
- {
- if (!nsid)
- psid = NO_SID;
- else
- {
- psid = (PSID) sbuf;
- CopySid (MAX_SID_LEN, psid, nsid);
- }
- return psid;
- }
-
-public:
- inline operator const PSID () { return psid; }
-
- inline const PSID operator= (cygsid &nsid)
- { return assign (nsid); }
- inline const PSID operator= (const PSID nsid)
- { return assign (nsid); }
- inline const PSID operator= (const char *nsidstr)
- { return getfromstr (nsidstr); }
-
- inline cygsid () : psid ((PSID) sbuf) {}
- inline cygsid (const PSID nsid) { *this = nsid; }
- inline cygsid (const char *nstrsid) { *this = nstrsid; }
-
- inline PSID set () { return psid = (PSID) sbuf; }
-
- BOOL getfrompw (const struct passwd *pw);
- BOOL getfromgr (const struct __group32 *gr);
-
- int get_id (BOOL search_grp, int *type = NULL);
- inline int get_uid () { return get_id (FALSE); }
- inline int get_gid () { return get_id (TRUE); }
-
- char *string (char *nsidstr) const;
-
- inline BOOL operator== (const PSID nsid) const
- {
- if (!psid || !nsid)
- return nsid == psid;
- return EqualSid (psid, nsid);
- }
- inline BOOL operator== (const char *nsidstr) const
- {
- cygsid nsid (nsidstr);
- return *this == nsid;
- }
- inline BOOL operator!= (const PSID nsid) const
- { return !(*this == nsid); }
- inline BOOL operator!= (const char *nsidstr) const
- { return !(*this == nsidstr); }
-
- void debug_print (const char *prefix = NULL) const
- {
- char buf[256];
- debug_printf ("%s %s", prefix ?: "", string (buf) ?: "NULL");
- }
-};
-
-class cygsidlist {
-public:
- int count;
- cygsid *sids;
-
- cygsidlist () : count (0), sids (NULL) {}
- ~cygsidlist () { delete [] sids; }
-
- BOOL add (cygsid &nsi)
- {
- cygsid *tmp = new cygsid [count + 1];
- if (!tmp)
- return FALSE;
- for (int i = 0; i < count; ++i)
- tmp[i] = sids[i];
- delete [] sids;
- sids = tmp;
- sids[count++] = nsi;
- return TRUE;
- }
- BOOL add (const PSID nsid) { return add (nsid); }
- BOOL add (const char *sidstr)
- { cygsid nsi (sidstr); return add (nsi); }
-
- BOOL operator+= (cygsid &si) { return add (si); }
- BOOL operator+= (const char *sidstr) { return add (sidstr); }
-
- BOOL contains (cygsid &sid) const
- {
- for (int i = 0; i < count; ++i)
- if (sids[i] == sid)
- return TRUE;
- return FALSE;
- }
- void debug_print (const char *prefix = NULL) const
- {
- debug_printf ("-- begin sidlist ---");
- if (!count)
- debug_printf ("No elements");
- for (int i = 0; i < count; ++i)
- sids[i].debug_print (prefix);
- debug_printf ("-- ende sidlist ---");
- }
-};
-
-extern cygsid well_known_null_sid;
-extern cygsid well_known_world_sid;
-extern cygsid well_known_local_sid;
-extern cygsid well_known_creator_owner_sid;
-extern cygsid well_known_dialup_sid;
-extern cygsid well_known_network_sid;
-extern cygsid well_known_batch_sid;
-extern cygsid well_known_interactive_sid;
-extern cygsid well_known_service_sid;
-extern cygsid well_known_authenticated_users_sid;
-extern cygsid well_known_system_sid;
-extern cygsid well_known_admins_sid;
-
-inline BOOL
-legal_sid_type (SID_NAME_USE type)
-{
- return type == SidTypeUser || type == SidTypeGroup
- || type == SidTypeAlias || type == SidTypeWellKnownGroup;
-}
-
-extern BOOL allow_ntea;
-extern BOOL allow_ntsec;
-extern BOOL allow_smbntsec;
-
-/* These both functions are needed to allow walking through the passwd
- and group lists so they are somehow security related. Besides that
- I didn't find a better place to declare them. */
-extern struct passwd *internal_getpwent (int);
-extern struct __group32 *internal_getgrent (int);
-
-/* File manipulation */
-int __stdcall set_process_privileges ();
-int __stdcall get_file_attribute (int, const char *, int *,
- __uid32_t * = NULL, __gid32_t * = NULL);
-int __stdcall set_file_attribute (int, const char *, int);
-int __stdcall set_file_attribute (int, const char *, __uid32_t, __gid32_t, int);
-LONG __stdcall read_sd(const char *file, PSECURITY_DESCRIPTOR sd_buf, LPDWORD sd_size);
-LONG __stdcall write_sd(const char *file, PSECURITY_DESCRIPTOR sd_buf, DWORD sd_size);
-BOOL __stdcall add_access_allowed_ace (PACL acl, int offset, DWORD attributes, PSID sid, size_t &len_add, DWORD inherit);
-BOOL __stdcall add_access_denied_ace (PACL acl, int offset, DWORD attributes, PSID sid, size_t &len_add, DWORD inherit);
-
-void set_security_attribute (int attribute, PSECURITY_ATTRIBUTES psa,
- void *sd_buf, DWORD sd_buf_size);
-
-/* Try a subauthentication. */
-HANDLE subauth (struct passwd *pw);
-/* Try creating a token directly. */
-HANDLE create_token (cygsid &usersid, cygsid &pgrpsid);
-/* Verify an existing token */
-BOOL verify_token (HANDLE token, cygsid &usersid, cygsid &pgrpsid, BOOL * pintern = NULL);
-
-/* Extract U-domain\user field from passwd entry. */
-void extract_nt_dom_user (const struct passwd *pw, char *domain, char *user);
-/* Get default logonserver for a domain. */
-BOOL get_logon_server (const char * domain, char * server, WCHAR *wserver = NULL);
-
-/* sec_helper.cc: Security helper functions. */
-BOOL __stdcall is_grp_member (__uid32_t uid, __gid32_t gid);
-int set_process_privilege (const char *privilege, BOOL enable = TRUE);
-
-/* shared.cc: */
-/* Retrieve a security descriptor that allows all access */
-SECURITY_DESCRIPTOR *__stdcall get_null_sd (void);
-
-/* Various types of security attributes for use in Create* functions. */
-extern SECURITY_ATTRIBUTES sec_none, sec_none_nih, sec_all, sec_all_nih;
-extern SECURITY_ATTRIBUTES *__stdcall __sec_user (PVOID sa_buf, PSID sid2, BOOL inherit)
- __attribute__ ((regparm (3)));
-extern BOOL sec_acl (PACL acl, BOOL admins, PSID sid1 = NO_SID, PSID sid2 = NO_SID);
-
-int __stdcall NTReadEA (const char *file, const char *attrname, char *buf, int len);
-BOOL __stdcall NTWriteEA (const char *file, const char *attrname, const char *buf, int len);
-PSECURITY_DESCRIPTOR alloc_sd (__uid32_t uid, __gid32_t gid, int attribute,
- PSECURITY_DESCRIPTOR sd_ret, DWORD *sd_size_ret);
-
-extern inline SECURITY_ATTRIBUTES *
-sec_user_nih (char sa_buf[], PSID sid = NULL)
-{
- return allow_ntsec ? __sec_user (sa_buf, sid, FALSE) : &sec_none_nih;
-}
-
-extern inline SECURITY_ATTRIBUTES *
-sec_user (char sa_buf[], PSID sid = NULL)
-{
- return allow_ntsec ? __sec_user (sa_buf, sid, TRUE) : &sec_none_nih;
-}
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
deleted file mode 100644
index b50ffb1f2..000000000
--- a/winsup/cygwin/select.cc
+++ /dev/null
@@ -1,1512 +0,0 @@
-/* select.cc
-
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-
- Written by Christopher Faylor of Cygnus Solutions
- cgf@cygnus.com
-
-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 following line means that the BSD socket
- * definitions for fd_set, FD_ISSET etc. are used in this
- * file.
- */
-
-#define __INSIDE_CYGWIN_NET__
-
-#include "winsup.h"
-#include <errno.h>
-#include <sys/socket.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-#include <wingdi.h>
-#include <winuser.h>
-#include <netdb.h>
-#include <unistd.h>
-#include <stdio.h>
-#define USE_SYS_TYPES_FD_SET
-#include <winsock.h>
-#include "select.h"
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygheap.h"
-#include "sigproc.h"
-#include "perthread.h"
-#include "tty.h"
-
-/*
- * All these defines below should be in sys/types.h
- * but because of the includes above, they may not have
- * been included. We create special UNIX_xxxx versions here.
- */
-
-#ifndef NBBY
-#define NBBY 8 /* number of bits in a byte */
-#endif /* NBBY */
-
-/*
- * Select uses bit masks of file descriptors in longs.
- * These macros manipulate such bit fields (the filesystem macros use chars).
- * FD_SETSIZE may be defined by the user, but the default here
- * should be >= NOFILE (param.h).
- */
-
-typedef long fd_mask;
-#define UNIX_NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */
-#ifndef unix_howmany
-#define unix_howmany(x,y) (((x)+((y)-1))/(y))
-#endif
-
-#define unix_fd_set fd_set
-
-#define NULL_fd_set ((fd_set *) NULL)
-#define sizeof_fd_set(n) \
- ((unsigned) (NULL_fd_set->fds_bits + unix_howmany((n), UNIX_NFDBITS)))
-#define UNIX_FD_SET(n, p) \
- ((p)->fds_bits[(n)/UNIX_NFDBITS] |= (1L << ((n) % UNIX_NFDBITS)))
-#define UNIX_FD_CLR(n, p) \
- ((p)->fds_bits[(n)/UNIX_NFDBITS] &= ~(1L << ((n) % UNIX_NFDBITS)))
-#define UNIX_FD_ISSET(n, p) \
- ((p)->fds_bits[(n)/UNIX_NFDBITS] & (1L << ((n) % UNIX_NFDBITS)))
-#define UNIX_FD_ZERO(p, n) \
- bzero ((caddr_t)(p), sizeof_fd_set ((n)))
-
-#define allocfd_set(n) ((fd_set *) memset (alloca (sizeof_fd_set (n)), 0, sizeof_fd_set (n)))
-#define copyfd_set(to, from, n) memcpy (to, from, sizeof_fd_set (n));
-
-#define set_handle_or_return_if_not_open(h, s) \
- h = (s)->fh->get_handle (); \
- if (cygheap->fdtab.not_open ((s)->fd)) \
- { \
- (s)->saw_error = true; \
- set_sig_errno (EBADF); \
- return -1; \
- } \
-
-/* The main select code.
- */
-extern "C"
-int
-cygwin_select (int maxfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
- struct timeval *to)
-{
- select_stuff sel;
- fd_set *dummy_readfds = allocfd_set (maxfds);
- fd_set *dummy_writefds = allocfd_set (maxfds);
- fd_set *dummy_exceptfds = allocfd_set (maxfds);
- sigframe thisframe (mainthread);
-
- select_printf ("%d, %p, %p, %p, %p", maxfds, readfds, writefds, exceptfds, to);
-
- if (!readfds)
- readfds = dummy_readfds;
- if (!writefds)
- writefds = dummy_writefds;
- if (!exceptfds)
- exceptfds = dummy_exceptfds;
-
- for (int i = 0; i < maxfds; i++)
- if (!sel.test_and_set (i, readfds, writefds, exceptfds))
- {
- select_printf ("aborting due to test_and_set error");
- return -1; /* Invalid fd, maybe? */
- }
-
- /* Convert to milliseconds or INFINITE if to == NULL */
- DWORD ms = to ? (to->tv_sec * 1000) + (to->tv_usec / 1000) : INFINITE;
- if (ms == 0 && to->tv_usec)
- ms = 1; /* At least 1 ms granularity */
-
- if (to)
- select_printf ("to->tv_sec %d, to->tv_usec %d, ms %d", to->tv_sec, to->tv_usec, ms);
- else
- select_printf ("to NULL, ms %x", ms);
-
- select_printf ("sel.always_ready %d", sel.always_ready);
-
- int timeout = 0;
- /* Allocate some fd_set structures using the number of fds as a guide. */
- fd_set *r = allocfd_set (maxfds);
- fd_set *w = allocfd_set (maxfds);
- fd_set *e = allocfd_set (maxfds);
-
- /* Degenerate case. No fds to wait for. Just wait. */
- if (sel.start.next == NULL)
- {
- if (WaitForSingleObject (signal_arrived, ms) == WAIT_OBJECT_0)
- {
- select_printf ("signal received");
- set_sig_errno (EINTR);
- return -1;
- }
- timeout = 1;
- }
- else if (sel.always_ready || ms == 0)
- /* Don't bother waiting. */;
- else if ((timeout = sel.wait (r, w, e, ms) < 0))
- return -1; /* some kind of error */
-
- sel.cleanup ();
- copyfd_set (readfds, r, maxfds);
- copyfd_set (writefds, w, maxfds);
- copyfd_set (exceptfds, e, maxfds);
- return timeout ? 0 : sel.poll (readfds, writefds, exceptfds);
-}
-
-/* Call cleanup functions for all inspected fds. Gets rid of any
- executing threads. */
-void
-select_stuff::cleanup ()
-{
- select_record *s = &start;
-
- select_printf ("calling cleanup routines");
- while ((s = s->next))
- if (s->cleanup)
- {
- s->cleanup (s, this);
- s->cleanup = NULL;
- }
-}
-
-/* Destroy all storage associated with select stuff. */
-select_stuff::~select_stuff ()
-{
- cleanup ();
- select_record *s = &start;
- select_record *snext = start.next;
-
- select_printf ("deleting select records");
- while ((s = snext))
- {
- snext = s->next;
- delete s;
- }
-}
-
-/* Add a record to the select chain */
-int
-select_stuff::test_and_set (int i, fd_set *readfds, fd_set *writefds,
- fd_set *exceptfds)
-{
- select_record *s = NULL;
- if (UNIX_FD_ISSET (i, readfds) && (s = cygheap->fdtab.select_read (i, s)) == NULL)
- return 0; /* error */
- if (UNIX_FD_ISSET (i, writefds) && (s = cygheap->fdtab.select_write (i, s)) == NULL)
- return 0; /* error */
- if (UNIX_FD_ISSET (i, exceptfds) && (s = cygheap->fdtab.select_except (i, s)) == NULL)
- return 0; /* error */
- if (s == NULL)
- return 1; /* nothing to do */
-
- if (s->read_ready || s->write_ready || s->except_ready)
- always_ready = true;
-
- if (s->windows_handle || s->windows_handle || s->windows_handle)
- windows_used = true;
-
- s->next = start.next;
- start.next = s;
- return 1;
-}
-
-/* The heart of select. Waits for an fd to do something interesting. */
-int
-select_stuff::wait (fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
- DWORD ms)
-{
- int wait_ret;
- HANDLE w4[MAXIMUM_WAIT_OBJECTS];
- select_record *s = &start;
- int m = 0;
- int res = 0;
-
- w4[m++] = signal_arrived; /* Always wait for the arrival of a signal. */
- /* Loop through the select chain, starting up anything appropriate and
- counting the number of active fds. */
- while ((s = s->next))
- {
- if (m > MAXIMUM_WAIT_OBJECTS)
- {
- set_sig_errno (EINVAL);
- return -1;
- }
- if (!s->startup (s, this))
- {
- __seterrno ();
- return -1;
- }
- if (s->h == NULL)
- continue;
- for (int i = 1; i < m; i++)
- if (w4[i] == s->h)
- goto next_while;
- w4[m++] = s->h;
- next_while:
- continue;
- }
-
- DWORD start_time = GetTickCount (); /* Record the current time for later use. */
-
- debug_printf ("m %d, ms %u", m, ms);
- for (;;)
- {
- if (!windows_used)
- wait_ret = WaitForMultipleObjects (m, w4, FALSE, ms);
- else
- wait_ret = MsgWaitForMultipleObjects (m, w4, FALSE, ms, QS_ALLINPUT);
-
- switch (wait_ret)
- {
- case WAIT_OBJECT_0:
- select_printf ("signal received");
- set_sig_errno (EINTR);
- return -1;
- case WAIT_FAILED:
- select_printf ("WaitForMultipleObjects failed");
- __seterrno ();
- return -1;
- case WAIT_TIMEOUT:
- select_printf ("timed out");
- res = 1;
- goto out;
- }
-
- select_printf ("woke up. wait_ret %d. verifying", wait_ret);
- s = &start;
- int gotone = FALSE;
- /* Some types of object (e.g., consoles) wake up on "inappropriate" events
- like mouse movements. The verify function will detect these situations.
- If it returns false, then this wakeup was a false alarm and we should go
- back to waiting. */
- while ((s = s->next))
- if (s->saw_error)
- return -1; /* Somebody detected an error */
- else if ((((wait_ret >= m && s->windows_handle) || s->h == w4[wait_ret])) &&
- s->verify (s, readfds, writefds, exceptfds))
- gotone = true;
-
- select_printf ("gotone %d", gotone);
- if (gotone)
- goto out;
-
- if (ms == INFINITE)
- {
- select_printf ("looping");
- continue;
- }
- select_printf ("recalculating ms");
-
- DWORD now = GetTickCount ();
- if (now > (start_time + ms))
- {
- select_printf ("timed out after verification");
- goto out;
- }
- ms -= (now - start_time);
- start_time = now;
- select_printf ("ms now %u", ms);
- }
-
-out:
- select_printf ("returning %d", res);
- return res;
-}
-
-static int
-set_bits (select_record *me, fd_set *readfds, fd_set *writefds,
- fd_set *exceptfds)
-{
- int ready = 0;
- select_printf ("me %p, testing fd %d (%s)", me, me->fd, me->fh->get_name ());
- if (me->read_selected && me->read_ready)
- {
- UNIX_FD_SET (me->fd, readfds);
- ready++;
- }
- if (me->write_selected && me->write_ready)
- {
- UNIX_FD_SET (me->fd, writefds);
- ready++;
- }
- if (me->except_selected && me->except_ready)
- {
- UNIX_FD_SET (me->fd, exceptfds);
- ready++;
- }
- select_printf ("ready %d", ready);
- return ready;
-}
-
-/* Poll every fd in the select chain. Set appropriate fd in mask. */
-int
-select_stuff::poll (fd_set *readfds, fd_set *writefds, fd_set *exceptfds)
-{
- int n = 0;
- select_record *s = &start;
- while ((s = s->next))
- n += (!s->peek || s->peek (s, true)) ?
- set_bits (s, readfds, writefds, exceptfds) : 0;
- select_printf ("returning %d", n);
- return n;
-}
-
-static int
-verify_true (select_record *, fd_set *, fd_set *, fd_set *)
-{
- return 1;
-}
-
-static int
-verify_ok (select_record *me, fd_set *readfds, fd_set *writefds,
- fd_set *exceptfds)
-{
- return set_bits (me, readfds, writefds, exceptfds);
-}
-
-static int
-no_startup (select_record *, select_stuff *)
-{
- return 1;
-}
-
-static int
-no_verify (select_record *, fd_set *, fd_set *, fd_set *)
-{
- return 0;
-}
-
-static int
-peek_pipe (select_record *s, bool from_select)
-{
- int n = 0;
- int gotone = 0;
- fhandler_base *fh = s->fh;
-
- HANDLE h;
- set_handle_or_return_if_not_open (h, s);
-
- /* pipes require a guard mutex to guard against the situation where multiple
- readers are attempting to read from the same pipe. In this scenario, it
- is possible for PeekNamedPipe to report available data to two readers but
- only one will actually get the data. This will result in the other reader
- entering fhandler_base::raw_read and blocking indefinitely in an interruptible
- state. This causes things like "make -j2" to hang. So, for the non-select case
- we use the pipe mutex, if it is available. */
- HANDLE guard_mutex = from_select ? NULL : fh->get_guard ();
-
- /* Don't perform complicated tests if we don't need to. */
- if (!s->read_selected && !s->except_selected)
- goto out;
-
- if (s->read_selected)
- {
- if (s->read_ready)
- {
- select_printf ("already ready");
- gotone = 1;
- goto out;
- }
-
- switch (fh->get_device ())
- {
- case FH_PTYM:
- case FH_TTYM:
- if (((fhandler_pty_master *)fh)->need_nl)
- {
- gotone = s->read_ready = true;
- goto out;
- }
- break;
- default:
- if (fh->get_readahead_valid ())
- {
- select_printf ("readahead");
- gotone = s->read_ready = true;
- goto out;
- }
- }
-
- if (fh->bg_check (SIGTTIN) <= bg_eof)
- {
- gotone = s->read_ready = true;
- goto out;
- }
- }
-
- if (fh->get_device () == FH_PIPEW)
- /* nothing */;
- else if (!PeekNamedPipe (h, NULL, 0, NULL, (DWORD *) &n, NULL))
- {
- select_printf ("%s, PeekNamedPipe failed, %E", fh->get_name ());
- n = -1;
- }
- else if (!n || !guard_mutex)
- /* no guard mutex or nothing to read from the pipe. */;
- else if (WaitForSingleObject (guard_mutex, 0) != WAIT_OBJECT_0)
- {
- select_printf ("%s, couldn't get mutex %p, %E", fh->get_name (),
- guard_mutex);
- n = 0;
- }
- else
- {
- /* Now that we have the mutex, make sure that no one else has snuck
- in and grabbed the data that we originally saw. */
- if (!PeekNamedPipe (h, NULL, 0, NULL, (DWORD *) &n, NULL))
- {
- select_printf ("%s, PeekNamedPipe failed, %E", fh->get_name ());
- n = -1;
- }
- if (n <= 0)
- ReleaseMutex (guard_mutex); /* Oops. We lost the race. */
- }
-
- if (n < 0)
- {
- fh->set_eof (); /* Flag that other end of pipe is gone */
- select_printf ("%s, n %d", fh->get_name (), n);
- if (s->except_selected)
- gotone += s->except_ready = true;
- if (s->read_selected)
- gotone += s->read_ready = true;
- }
- if (n > 0 && s->read_selected)
- {
- select_printf ("%s, ready for read", fh->get_name ());
- gotone += s->read_ready = true;
- }
- if (!gotone && s->fh->hit_eof ())
- {
- select_printf ("%s, saw EOF", fh->get_name ());
- if (s->except_selected)
- gotone = s->except_ready = true;
- if (s->read_selected)
- gotone += s->read_ready = true;
- select_printf ("saw eof on '%s'", fh->get_name ());
- }
-
-out:
- return gotone || s->write_ready;
-}
-
-static int start_thread_pipe (select_record *me, select_stuff *stuff);
-
-struct pipeinf
- {
- HANDLE thread;
- BOOL stop_thread_pipe;
- select_record *start;
- };
-
-static DWORD WINAPI
-thread_pipe (void *arg)
-{
- pipeinf *pi = (pipeinf *)arg;
- BOOL gotone = FALSE;
-
- for (;;)
- {
- select_record *s = pi->start;
- while ((s = s->next))
- if (s->startup == start_thread_pipe)
- {
- if (peek_pipe (s, true))
- gotone = true;
- if (pi->stop_thread_pipe)
- {
- select_printf ("stopping");
- goto out;
- }
- }
- /* Paranoid check */
- if (pi->stop_thread_pipe)
- {
- select_printf ("stopping from outer loop");
- break;
- }
- if (gotone)
- break;
- Sleep (10);
- }
-out:
- return 0;
-}
-
-static int
-start_thread_pipe (select_record *me, select_stuff *stuff)
-{
- if (stuff->device_specific[FHDEVN(FH_PIPE)])
- {
- me->h = ((pipeinf *) stuff->device_specific[FHDEVN(FH_PIPE)])->thread;
- return 1;
- }
- pipeinf *pi = new pipeinf;
- pi->start = &stuff->start;
- pi->stop_thread_pipe = FALSE;
- pi->thread = me->h = makethread (thread_pipe, (LPVOID)pi, 0, "select_pipe");
- if (!me->h)
- return 0;
- stuff->device_specific[FHDEVN(FH_PIPE)] = (void *)pi;
- return 1;
-}
-
-static void
-pipe_cleanup (select_record *, select_stuff *stuff)
-{
- pipeinf *pi = (pipeinf *)stuff->device_specific[FHDEVN(FH_PIPE)];
- if (pi && pi->thread)
- {
- pi->stop_thread_pipe = true;
- WaitForSingleObject (pi->thread, INFINITE);
- CloseHandle (pi->thread);
- delete pi;
- stuff->device_specific[FHDEVN(FH_PIPE)] = NULL;
- }
-}
-
-select_record *
-fhandler_pipe::select_read (select_record *s)
-{
- if (!s)
- s = new select_record;
- s->startup = start_thread_pipe;
- s->peek = peek_pipe;
- s->verify = verify_ok;
- s->read_selected = true;
- s->read_ready = false;
- s->cleanup = pipe_cleanup;
- return s;
-}
-
-select_record *
-fhandler_pipe::select_write (select_record *s)
-{
- if (!s)
- {
- s = new select_record;
- s->startup = no_startup;
- s->verify = no_verify;
- }
- s->peek = peek_pipe;
- s->write_selected = true;
- s->write_ready = true;
- return s;
-}
-
-select_record *
-fhandler_pipe::select_except (select_record *s)
-{
- if (!s)
- s = new select_record;
- s->startup = start_thread_pipe;
- s->peek = peek_pipe;
- s->verify = verify_ok;
- s->cleanup = pipe_cleanup;
- s->except_selected = true;
- s->except_ready = false;
- return s;
-}
-
-static int
-peek_console (select_record *me, bool)
-{
- extern const char * get_nonascii_key (INPUT_RECORD& input_rec, char *);
- fhandler_console *fh = (fhandler_console *)me->fh;
-
- if (!me->read_selected)
- return me->write_ready;
-
- if (fh->get_readahead_valid ())
- {
- select_printf ("readahead");
- return me->read_ready = true;
- }
-
- if (me->read_ready)
- {
- select_printf ("already ready");
- return 1;
- }
-
- INPUT_RECORD irec;
- DWORD events_read;
- HANDLE h;
- char tmpbuf[17];
- set_handle_or_return_if_not_open (h, me);
-
- for (;;)
- if (fh->bg_check (SIGTTIN) <= bg_eof)
- return me->read_ready = true;
- else if (!PeekConsoleInput (h, &irec, 1, &events_read) || !events_read)
- break;
- else
- {
- if (irec.EventType == WINDOW_BUFFER_SIZE_EVENT)
- kill_pgrp (fh->tc->getpgid (), SIGWINCH);
- else if (irec.EventType == MOUSE_EVENT &&
- (irec.Event.MouseEvent.dwEventFlags == 0 ||
- irec.Event.MouseEvent.dwEventFlags == DOUBLE_CLICK))
- {
- if (fh->mouse_aware ())
- return me->read_ready = true;
- }
- else if (irec.EventType == KEY_EVENT && irec.Event.KeyEvent.bKeyDown == true &&
- (irec.Event.KeyEvent.uChar.AsciiChar || get_nonascii_key (irec, tmpbuf)))
- return me->read_ready = true;
-
- /* Read and discard the event */
- ReadConsoleInput (h, &irec, 1, &events_read);
- }
-
- return me->write_ready;
-}
-
-static int
-verify_console (select_record *me, fd_set *rfds, fd_set *wfds,
- fd_set *efds)
-{
- return peek_console (me, true);
-}
-
-
-select_record *
-fhandler_console::select_read (select_record *s)
-{
- if (!s)
- {
- s = new select_record;
- s->startup = no_startup;
- s->verify = verify_console;
- set_cursor_maybe ();
- }
-
- s->peek = peek_console;
- s->h = get_handle ();
- s->read_selected = true;
- s->read_ready = false;
- return s;
-}
-
-select_record *
-fhandler_console::select_write (select_record *s)
-{
- if (!s)
- {
- s = new select_record;
- s->startup = no_startup;
- s->verify = no_verify;
- set_cursor_maybe ();
- }
-
- s->peek = peek_console;
- s->write_selected = true;
- s->write_ready = true;
- return s;
-}
-
-select_record *
-fhandler_console::select_except (select_record *s)
-{
- if (!s)
- {
- s = new select_record;
- s->startup = no_startup;
- s->verify = no_verify;
- set_cursor_maybe ();
- }
-
- s->peek = peek_console;
- s->except_selected = true;
- s->except_ready = false;
- return s;
-}
-
-select_record *
-fhandler_tty_common::select_read (select_record *s)
-{
- return ((fhandler_pipe*)this)->fhandler_pipe::select_read (s);
-}
-
-select_record *
-fhandler_tty_common::select_write (select_record *s)
-{
- return ((fhandler_pipe *)this)->fhandler_pipe::select_write (s);
-}
-
-select_record *
-fhandler_tty_common::select_except (select_record *s)
-{
- return ((fhandler_pipe *)this)->fhandler_pipe::select_except (s);
-}
-
-static int
-verify_tty_slave (select_record *me, fd_set *readfds, fd_set *writefds,
- fd_set *exceptfds)
-{
- if (WaitForSingleObject (me->h, 0) == WAIT_OBJECT_0)
- me->read_ready = true;
- return set_bits (me, readfds, writefds, exceptfds);
-}
-
-select_record *
-fhandler_tty_slave::select_read (select_record *s)
-{
- if (!s)
- s = new select_record;
- s->h = input_available_event;
- s->startup = no_startup;
- s->peek = peek_pipe;
- s->verify = verify_tty_slave;
- s->read_selected = true;
- s->read_ready = false;
- s->cleanup = NULL;
- return s;
-}
-
-int
-fhandler_tty_slave::ready_for_read (int fd, DWORD howlong)
-{
- HANDLE w4[2];
- if (cygheap->fdtab.not_open (fd))
- {
- set_sig_errno (EBADF);
- return 0;
- }
- if (get_readahead_valid ())
- {
- select_printf ("readahead");
- return 1;
- }
- w4[0] = signal_arrived;
- w4[1] = input_available_event;
- switch (WaitForMultipleObjects (2, w4, FALSE, howlong))
- {
- case WAIT_OBJECT_0:
- set_sig_errno (EINTR);
- return 0;
- case WAIT_OBJECT_0 + 1:
- return 1;
- case WAIT_FAILED:
- select_printf ("wait failed %E");
- set_sig_errno (EINVAL); /* FIXME: correct errno? */
- return 0;
- default:
- if (!howlong)
- set_sig_errno (EAGAIN);
- return 0;
- }
-}
-
-select_record *
-fhandler_dev_null::select_read (select_record *s)
-{
- if (!s)
- {
- s = new select_record;
- s->startup = no_startup;
- s->verify = no_verify;
- }
- s->h = get_handle ();
- s->read_selected = true;
- s->read_ready = true;
- return s;
-}
-
-select_record *
-fhandler_dev_null::select_write (select_record *s)
-{
- if (!s)
- {
- s = new select_record;
- s->startup = no_startup;
- s->verify = no_verify;
- }
- s->h = get_handle ();
- s->write_selected = true;
- s->write_ready = true;
- return s;
-}
-
-select_record *
-fhandler_dev_null::select_except (select_record *s)
-{
- if (!s)
- {
- s = new select_record;
- s->startup = no_startup;
- s->verify = no_verify;
- }
- s->h = get_handle ();
- s->except_selected = true;
- s->except_ready = true;
- return s;
-}
-
-static int start_thread_serial (select_record *me, select_stuff *stuff);
-
-struct serialinf
- {
- HANDLE thread;
- BOOL stop_thread_serial;
- select_record *start;
- };
-
-static int
-peek_serial (select_record *s, bool)
-{
- COMSTAT st;
-
- fhandler_serial *fh = (fhandler_serial *)s->fh;
-
- if (fh->get_readahead_valid () || fh->overlapped_armed < 0)
- return s->read_ready = true;
-
- select_printf ("fh->overlapped_armed %d", fh->overlapped_armed);
-
- HANDLE h;
- set_handle_or_return_if_not_open (h, s);
- int ready = 0;
-
- if (s->read_selected && s->read_ready || (s->write_selected && s->write_ready))
- {
- select_printf ("already ready");
- ready = 1;
- goto out;
- }
-
- (void) SetCommMask (h, EV_RXCHAR);
-
- if (!fh->overlapped_armed)
- {
- COMSTAT st;
-
- ResetEvent (fh->io_status.hEvent);
-
- if (!ClearCommError (h, &fh->ev, &st))
- {
- debug_printf ("ClearCommError");
- goto err;
- }
- else if (st.cbInQue)
- return s->read_ready = true;
- else if (WaitCommEvent (h, &fh->ev, &fh->io_status))
- return s->read_ready = true;
- else if (GetLastError () == ERROR_IO_PENDING)
- fh->overlapped_armed = 1;
- else
- {
- debug_printf ("WaitCommEvent");
- goto err;
- }
- }
-
- HANDLE w4[2];
- DWORD to;
-
- w4[0] = fh->io_status.hEvent;
- w4[1] = signal_arrived;
- to = 10;
-
- switch (WaitForMultipleObjects (2, w4, FALSE, to))
- {
- case WAIT_OBJECT_0:
- if (!ClearCommError (h, &fh->ev, &st))
- {
- debug_printf ("ClearCommError");
- goto err;
- }
- else if (!st.cbInQue)
- Sleep (to);
- else
- {
- return s->read_ready = true;
- select_printf ("got something");
- }
- PurgeComm (h, PURGE_TXABORT | PURGE_RXABORT);
- break;
- case WAIT_OBJECT_0 + 1:
- PurgeComm (h, PURGE_TXABORT | PURGE_RXABORT);
- select_printf ("interrupt");
- set_sig_errno (EINTR);
- ready = -1;
- break;
- case WAIT_TIMEOUT:
- PurgeComm (h, PURGE_TXABORT | PURGE_RXABORT);
- break;
- default:
- PurgeComm (h, PURGE_TXABORT | PURGE_RXABORT);
- debug_printf ("WaitForMultipleObjects");
- goto err;
- }
-
-out:
- return ready;
-
-err:
- if (GetLastError () == ERROR_OPERATION_ABORTED)
- {
- select_printf ("operation aborted");
- return ready;
- }
-
- __seterrno ();
- s->saw_error = true;
- select_printf ("error %E");
- return -1;
-}
-
-static DWORD WINAPI
-thread_serial (void *arg)
-{
- serialinf *si = (serialinf *)arg;
- BOOL gotone= FALSE;
-
- for (;;)
- {
- select_record *s = si->start;
- while ((s = s->next))
- if (s->startup == start_thread_serial)
- {
- if (peek_serial (s, true))
- gotone = true;
- }
- if (si->stop_thread_serial)
- {
- select_printf ("stopping");
- break;
- }
- if (gotone)
- break;
- }
-
- select_printf ("exiting");
- return 0;
-}
-
-static int
-start_thread_serial (select_record *me, select_stuff *stuff)
-{
- if (stuff->device_specific[FHDEVN(FH_SERIAL)])
- {
- me->h = ((pipeinf *) stuff->device_specific[FHDEVN(FH_SERIAL)])->thread;
- return 1;
- }
- serialinf *si = new serialinf;
- si->start = &stuff->start;
- si->stop_thread_serial = FALSE;
- si->thread = me->h = makethread (thread_serial, (LPVOID)si, 0, "select_serial");
- if (!me->h)
- return 0;
- stuff->device_specific[FHDEVN(FH_SERIAL)] = (void *)si;
- return 1;
-}
-
-static void
-serial_cleanup (select_record *, select_stuff *stuff)
-{
- serialinf *si = (serialinf *)stuff->device_specific[FHDEVN(FH_SERIAL)];
- if (si && si->thread)
- {
- si->stop_thread_serial = true;
- WaitForSingleObject (si->thread, INFINITE);
- CloseHandle (si->thread);
- delete si;
- stuff->device_specific[FHDEVN(FH_SERIAL)] = NULL;
- }
-}
-
-select_record *
-fhandler_serial::select_read (select_record *s)
-{
- if (!s)
- {
- s = new select_record;
- s->startup = start_thread_serial;
- s->verify = verify_ok;
- s->cleanup = serial_cleanup;
- }
- s->peek = peek_serial;
- s->read_selected = true;
- s->read_ready = false;
- return s;
-}
-
-select_record *
-fhandler_serial::select_write (select_record *s)
-{
- if (!s)
- {
- s = new select_record;
- s->startup = no_startup;
- s->verify = verify_ok;
- }
- s->peek = peek_serial;
- s->h = get_handle ();
- s->write_selected = true;
- s->write_ready = true;
- return s;
-}
-
-select_record *
-fhandler_serial::select_except (select_record *s)
-{
- if (!s)
- {
- s = new select_record;
- s->startup = no_startup;
- s->verify = verify_ok;
- }
- s->h = NULL;
- s->peek = peek_serial;
- s->except_selected = false; // Can't do this
- s->except_ready = false;
- return s;
-}
-
-int
-fhandler_base::ready_for_read (int fd, DWORD howlong)
-{
- int avail = 0;
- select_record me (this);
- me.fd = fd;
- while (!avail)
- {
- (void) select_read (&me);
- avail = me.read_ready ?: me.peek (&me, false);
-
- if (fd >= 0 && cygheap->fdtab.not_open (fd))
- {
- set_sig_errno (EBADF);
- avail = 0;
- break;
- }
-
- if (howlong != INFINITE)
- {
- if (!avail)
- set_sig_errno (EAGAIN);
- break;
- }
-
- if (WaitForSingleObject (signal_arrived, avail ? 0 : 10) == WAIT_OBJECT_0)
- {
- set_sig_errno (EINTR);
- avail = 0;
- break;
- }
- }
-
- if (get_guard () && !avail && me.read_ready)
- ReleaseMutex (get_guard ());
-
- select_printf ("read_ready %d, avail %d", me.read_ready, avail);
- return avail;
-}
-
-select_record *
-fhandler_base::select_read (select_record *s)
-{
- if (!s)
- {
- s = new select_record;
- s->startup = no_startup;
- s->verify = verify_ok;
- }
- s->h = get_handle ();
- s->read_selected = true;
- s->read_ready = true;
- return s;
-}
-
-select_record *
-fhandler_base::select_write (select_record *s)
-{
- if (!s)
- {
- s = new select_record;
- s->startup = no_startup;
- s->verify = verify_ok;
- }
- s->h = get_handle ();
- s->write_selected = true;
- s->write_ready = true;
- return s;
-}
-
-select_record *
-fhandler_base::select_except (select_record *s)
-{
- if (!s)
- {
- s = new select_record;
- s->startup = no_startup;
- s->verify = verify_ok;
- }
- s->h = NULL;
- s->except_selected = true;
- s->except_ready = false;
- return s;
-}
-
-struct socketinf
- {
- HANDLE thread;
- winsock_fd_set readfds, writefds, exceptfds;
- SOCKET exitsock;
- struct sockaddr_in sin;
- select_record *start;
- };
-
-static int
-peek_socket (select_record *me, bool)
-{
- winsock_fd_set ws_readfds, ws_writefds, ws_exceptfds;
- struct timeval tv = {0, 0};
- WINSOCK_FD_ZERO (&ws_readfds);
- WINSOCK_FD_ZERO (&ws_writefds);
- WINSOCK_FD_ZERO (&ws_exceptfds);
-
- HANDLE h;
- set_handle_or_return_if_not_open (h, me);
- select_printf ("considering handle %p", h);
-
- if (me->read_selected)
- {
- select_printf ("adding read fd_set %s, fd %d", me->fh->get_name (),
- me->fd);
- WINSOCK_FD_SET (h, &ws_readfds);
- }
- if (me->write_selected)
- {
- select_printf ("adding write fd_set %s, fd %d", me->fh->get_name (),
- me->fd);
- WINSOCK_FD_SET (h, &ws_writefds);
- }
- if (me->except_selected)
- {
- select_printf ("adding except fd_set %s, fd %d", me->fh->get_name (),
- me->fd);
- WINSOCK_FD_SET (h, &ws_exceptfds);
- }
- int r = WINSOCK_SELECT (0, &ws_readfds, &ws_writefds, &ws_exceptfds, &tv);
- select_printf ("WINSOCK_SELECT returned %d", r);
- if (r == -1)
- {
- select_printf ("error %d", WSAGetLastError ());
- set_winsock_errno ();
- return 0;
- }
-
- if (WINSOCK_FD_ISSET (h, &ws_readfds) || (me->read_selected && me->read_ready))
- me->read_ready = true;
- if (WINSOCK_FD_ISSET (h, &ws_writefds) || (me->write_selected && me->write_ready))
- me->write_ready = true;
- if (WINSOCK_FD_ISSET (h, &ws_exceptfds) || (me->except_selected && me->except_ready))
- me->except_ready = true;
- return me->read_ready || me->write_ready || me->except_ready;
-}
-
-static int start_thread_socket (select_record *, select_stuff *);
-
-static DWORD WINAPI
-thread_socket (void *arg)
-{
- socketinf *si = (socketinf *)arg;
-
- select_printf ("stuff_start %p", &si->start);
- int r = WINSOCK_SELECT (0, &si->readfds, &si->writefds, &si->exceptfds, NULL);
- select_printf ("Win32 select returned %d", r);
- if (r == -1)
- select_printf ("error %d", WSAGetLastError ());
- select_record *s = si->start;
- while ((s = s->next))
- if (s->startup == start_thread_socket)
- {
- HANDLE h = s->fh->get_handle ();
- select_printf ("s %p, testing fd %d (%s)", s, s->fd, s->fh->get_name ());
- if (WINSOCK_FD_ISSET (h, &si->readfds))
- {
- select_printf ("read_ready");
- s->read_ready = true;
- }
- if (WINSOCK_FD_ISSET (h, &si->writefds))
- {
- select_printf ("write_ready");
- s->write_ready = true;
- }
- if (WINSOCK_FD_ISSET (h, &si->exceptfds))
- {
- select_printf ("except_ready");
- s->except_ready = true;
- }
- }
-
- if (WINSOCK_FD_ISSET (si->exitsock, &si->readfds))
- select_printf ("saw exitsock read");
-
- return 0;
-}
-
-extern "C" unsigned long htonl (unsigned long);
-
-static int
-start_thread_socket (select_record *me, select_stuff *stuff)
-{
- socketinf *si;
-
- if ((si = (socketinf *)stuff->device_specific[FHDEVN(FH_SOCKET)]))
- {
- me->h = si->thread;
- return 1;
- }
-
- si = new socketinf;
- WINSOCK_FD_ZERO (&si->readfds);
- WINSOCK_FD_ZERO (&si->writefds);
- WINSOCK_FD_ZERO (&si->exceptfds);
- select_record *s = &stuff->start;
- while ((s = s->next))
- if (s->startup == start_thread_socket)
- {
- HANDLE h = s->fh->get_handle ();
- select_printf ("Handle %p", h);
- if (s->read_selected)
- {
- WINSOCK_FD_SET (h, &si->readfds);
- select_printf ("Added to readfds");
- }
- if (s->write_selected)
- {
- WINSOCK_FD_SET (h, &si->writefds);
- select_printf ("Added to writefds");
- }
- if (s->except_selected)
- {
- WINSOCK_FD_SET (h, &si->exceptfds);
- select_printf ("Added to exceptfds");
- }
- }
-
- if ((si->exitsock = socket (PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
- {
- set_winsock_errno ();
- select_printf ("cannot create socket, %E");
- return -1;
- }
- /* Allow rapid reuse of the port. */
- int tmp = 1;
- (void) setsockopt (si->exitsock, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp, sizeof (tmp));
-
- int sin_len = sizeof(si->sin);
- memset (&si->sin, 0, sizeof (si->sin));
- si->sin.sin_family = AF_INET;
- si->sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
- if (bind (si->exitsock, (struct sockaddr *) &si->sin, sizeof (si->sin)) < 0)
- {
- select_printf ("cannot bind socket, %E");
- goto err;
- }
-
- if (getsockname (si->exitsock, (struct sockaddr *) &si->sin, &sin_len) < 0)
- {
- select_printf ("getsockname error");
- goto err;
- }
-
- if (listen (si->exitsock, 1))
- {
- select_printf ("listen failed, %E");
- goto err;
- }
-
- select_printf ("exitsock %p", si->exitsock);
- WINSOCK_FD_SET ((HANDLE) si->exitsock, &si->readfds);
- WINSOCK_FD_SET ((HANDLE) si->exitsock, &si->exceptfds);
- stuff->device_specific[FHDEVN(FH_SOCKET)] = (void *) si;
- si->start = &stuff->start;
- select_printf ("stuff_start %p", &stuff->start);
- si->thread = me->h = makethread (thread_socket, (LPVOID)si, 0,
- "select_socket");
- return !!me->h;
-
-err:
- set_winsock_errno ();
- closesocket (si->exitsock);
- return -1;
-}
-
-void
-socket_cleanup (select_record *, select_stuff *stuff)
-{
- socketinf *si = (socketinf *)stuff->device_specific[FHDEVN(FH_SOCKET)];
- select_printf ("si %p si->thread %p", si, si ? si->thread : NULL);
- if (si && si->thread)
- {
- select_printf ("connection to si->exitsock %p", si->exitsock);
- SOCKET s = socket (AF_INET, SOCK_STREAM, 0);
-
- /* Set LINGER with 0 timeout for hard close */
- struct linger tmp = {1, 0}; /* On, 0 delay */
- (void) setsockopt (s, SOL_SOCKET, SO_LINGER, (char *)&tmp, sizeof(tmp));
- (void) setsockopt (si->exitsock, SOL_SOCKET, SO_LINGER, (char *)&tmp, sizeof(tmp));
-
- /* Connecting to si->exitsock will cause any executing select to wake
- up. When this happens then the exitsock condition will cause the
- thread to terminate. */
- if (connect (s, (struct sockaddr *) &si->sin, sizeof (si->sin)) < 0)
- {
- set_winsock_errno ();
- select_printf ("connect failed");
- /* FIXME: now what? */
- }
- shutdown (s, SD_BOTH);
- closesocket (s);
-
- /* Wait for thread to go away */
- WaitForSingleObject (si->thread, INFINITE);
- shutdown (si->exitsock, SD_BOTH);
- closesocket (si->exitsock);
- CloseHandle (si->thread);
- stuff->device_specific[FHDEVN(FH_SOCKET)] = NULL;
- delete si;
- }
- select_printf ("returning");
-}
-
-select_record *
-fhandler_socket::select_read (select_record *s)
-{
- if (!s)
- {
- s = new select_record;
- s->startup = start_thread_socket;
- s->verify = verify_true;
- s->cleanup = socket_cleanup;
- }
- s->peek = peek_socket;
- s->read_ready = saw_shutdown_read ();
- s->read_selected = true;
- return s;
-}
-
-select_record *
-fhandler_socket::select_write (select_record *s)
-{
- if (!s)
- {
- s = new select_record;
- s->startup = start_thread_socket;
- s->verify = verify_true;
- s->cleanup = socket_cleanup;
- }
- s->peek = peek_socket;
- s->write_ready = saw_shutdown_write ();
- s->write_selected = true;
- return s;
-}
-
-select_record *
-fhandler_socket::select_except (select_record *s)
-{
- if (!s)
- {
- s = new select_record;
- s->startup = start_thread_socket;
- s->verify = verify_true;
- s->cleanup = socket_cleanup;
- }
- s->peek = peek_socket;
- /* FIXME: Is this right? Should these be used as criteria for except? */
- s->except_ready = saw_shutdown_write () || saw_shutdown_read ();
- s->except_selected = true;
- return s;
-}
-
-static int
-peek_windows (select_record *me, bool)
-{
- MSG m;
- HANDLE h;
- set_handle_or_return_if_not_open (h, me);
-
- if (me->read_selected && me->read_ready)
- return 1;
-
- if (PeekMessage (&m, (HWND) h, 0, 0, PM_NOREMOVE))
- {
- me->read_ready = true;
- select_printf ("window %d(%p) ready", me->fd, me->fh->get_handle ());
- return 1;
- }
-
- select_printf ("window %d(%p) not ready", me->fd, me->fh->get_handle ());
- return me->write_ready;
-}
-
-static int
-verify_windows (select_record *me, fd_set *rfds, fd_set *wfds,
- fd_set *efds)
-{
- return peek_windows (me, true);
-}
-
-select_record *
-fhandler_windows::select_read (select_record *s)
-{
- if (!s)
- {
- s = new select_record;
- s->startup = no_startup;
- }
- s->verify = verify_windows;
- s->peek = peek_windows;
- s->read_selected = true;
- s->read_ready = false;
- s->h = get_handle ();
- s->windows_handle = true;
- return s;
-}
-
-select_record *
-fhandler_windows::select_write (select_record *s)
-{
- if (!s)
- {
- s = new select_record;
- s->startup = no_startup;
- s->verify = verify_ok;
- }
- s->peek = peek_windows;
- s->h = get_handle ();
- s->write_selected = true;
- s->write_ready = true;
- s->windows_handle = true;
- return s;
-}
-
-select_record *
-fhandler_windows::select_except (select_record *s)
-{
- if (!s)
- {
- s = new select_record;
- s->startup = no_startup;
- s->verify = verify_ok;
- }
- s->peek = peek_windows;
- s->h = get_handle ();
- s->except_selected = true;
- s->except_ready = true;
- s->windows_handle = true;
- return s;
-}
diff --git a/winsup/cygwin/select.h b/winsup/cygwin/select.h
deleted file mode 100644
index 30b59964f..000000000
--- a/winsup/cygwin/select.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* select.h
-
- Copyright 1998, 1999, 2000, 2001 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. */
-
-/* Winsock select() types and macros */
-
-/*
- * Use this struct to interface to
- * the system provided select.
- */
-typedef struct winsock_fd_set
-{
- unsigned int fd_count;
- HANDLE fd_array[1024]; /* Dynamically allocated. */
-} winsock_fd_set;
-
-/*
- * Define the Win32 winsock definitions to have a prefix WINSOCK_
- * so we can be explicit when we are using them.
- */
-#define WINSOCK_FD_ISSET(fd, set) __WSAFDIsSet ((SOCKET)fd, (fd_set *)set)
-#define WINSOCK_FD_SET(fd, set) do { \
- (set)->fd_array[(set)->fd_count++]=fd;\
-} while(0)
-#define WINSOCK_FD_ZERO(set) ((set)->fd_count = 0)
-#define WINSOCK_FD_CLR(fd, set) do { \
- u_int __i; \
- for (__i = 0; __i < (set)->fd_count ; __i++) { \
- if ((set)->fd_array[__i] == fd) { \
- while (__i < (set)->fd_count-1) { \
- (set)->fd_array[__i] = \
- (set)->fd_array[__i+1]; \
- __i++; \
- } \
- (set)->fd_count--; \
- break; \
- } \
- } \
-} while(0)
-
-extern "C" int PASCAL __WSAFDIsSet(SOCKET, fd_set*);
-extern "C" int PASCAL win32_select(int, fd_set*, fd_set*, fd_set*, const struct timeval*);
-
-/*
- * call to winsock's select() -
- * type coercion need to appease confused prototypes
- */
-#define WINSOCK_SELECT(nfd, rd, wr, ex, timeo) \
- win32_select (nfd, (fd_set *)rd, (fd_set *)wr, (fd_set *)ex, timeo)
-
diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc
deleted file mode 100644
index 2a536824d..000000000
--- a/winsup/cygwin/shared.cc
+++ /dev/null
@@ -1,304 +0,0 @@
-/* shared.cc: shared data area support.
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <grp.h>
-#include <pwd.h>
-#include <errno.h>
-#include "pinfo.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygerrno.h"
-#include "cygheap.h"
-#include "heap.h"
-#include "shared_info_magic.h"
-#include "registry.h"
-#include "cygwin_version.h"
-
-shared_info NO_COPY *cygwin_shared = NULL;
-mount_info NO_COPY *mount_table = NULL;
-HANDLE cygwin_mount_h;
-
-/* General purpose security attribute objects for global use. */
-SECURITY_ATTRIBUTES NO_COPY sec_none;
-SECURITY_ATTRIBUTES NO_COPY sec_none_nih;
-SECURITY_ATTRIBUTES NO_COPY sec_all;
-SECURITY_ATTRIBUTES NO_COPY sec_all_nih;
-
-char * __stdcall
-shared_name (const char *str, int num)
-{
- static NO_COPY char buf[MAX_PATH] = {0};
- extern bool _cygwin_testing;
-
- __small_sprintf (buf, "%s.%s.%d", cygwin_version.shared_id, str, num);
- if (!_cygwin_testing)
- strcat (buf, cygwin_version.dll_build_date);
- return buf;
-}
-
-void * __stdcall
-open_shared (const char *name, int n, HANDLE &shared_h, DWORD size, void *addr)
-{
- void *shared;
-
- if (!shared_h)
- {
- char *mapname;
- if (!name)
- mapname = NULL;
- else
- {
- mapname = shared_name (name, n);
- shared_h = OpenFileMappingA (FILE_MAP_READ | FILE_MAP_WRITE,
- TRUE, mapname);
- }
- if (!shared_h &&
- !(shared_h = CreateFileMappingA (INVALID_HANDLE_VALUE,
- &sec_all,
- PAGE_READWRITE,
- 0,
- size,
- mapname)))
- api_fatal ("CreateFileMappingA, %E. Terminating.");
- }
-
- shared = (shared_info *) MapViewOfFileEx (shared_h,
- FILE_MAP_READ | FILE_MAP_WRITE,
- 0, 0, 0, addr);
-
- if (!shared)
- {
- /* Probably win95, so try without specifying the address. */
- shared = (shared_info *) MapViewOfFileEx (shared_h,
- FILE_MAP_READ|FILE_MAP_WRITE,
- 0, 0, 0, 0);
- }
-
- if (!shared)
- api_fatal ("MapViewOfFileEx '%s'(%p), %E. Terminating.", name, shared_h);
-
- debug_printf ("name %s, shared %p (wanted %p), h %p", name, shared, addr, shared_h);
-
- /* FIXME: I couldn't find anywhere in the documentation a note about
- whether the memory is initialized to zero. The code assumes it does
- and since this part seems to be working, we'll leave it as is. */
- return shared;
-}
-
-void
-shared_info::initialize ()
-{
- if (version)
- {
- if (version != SHARED_VERSION_MAGIC)
- multiple_cygwin_problem ("shared", version, SHARED_VERSION);
- else if (cb != SHARED_INFO_CB)
- multiple_cygwin_problem ("shared size", cb, SHARED_INFO_CB);
- return;
- }
-
- /* Initialize the queue of deleted files. */
- delqueue.init ();
-
- /* Initialize tty table. */
- tty.init ();
- version = SHARED_VERSION_MAGIC;
- cb = sizeof (*this);
- if (cb != SHARED_INFO_CB)
- system_printf ("size of shared memory region changed from %u to %u",
- SHARED_INFO_CB, cb);
-}
-
-void __stdcall
-memory_init ()
-{
- /* Initialize general shared memory */
- HANDLE shared_h = cygheap ? cygheap->shared_h : NULL;
- cygwin_shared = (shared_info *) open_shared ("shared",
- CYGWIN_VERSION_SHARED_DATA,
- shared_h,
- sizeof (*cygwin_shared),
- cygwin_shared_address);
-
- cygwin_shared->initialize ();
-
- /* Allocate memory for the per-user mount table */
- char user_name[UNLEN + 1];
- DWORD user_name_len = UNLEN + 1;
-
- if (!GetUserName (user_name, &user_name_len))
- strcpy (user_name, "unknown");
-
- /* Initialize the Cygwin heap, if necessary */
- if (!cygheap)
- {
- cygheap_init ();
- cygheap->user.set_name (user_name);
- }
-
- cygheap->shared_h = shared_h;
- ProtectHandle (cygheap->shared_h);
-
- heap_init ();
- mount_table = (mount_info *) open_shared (user_name, MOUNT_VERSION,
- cygwin_mount_h,
- sizeof (mount_info), 0);
- debug_printf ("opening mount table for '%s' at %p", cygheap->user.name (),
- mount_table_address);
- ProtectHandle (cygwin_mount_h);
- debug_printf ("mount table version %x at %p", mount_table->version, mount_table);
-
- /* Initialize the Cygwin per-user mount table, if necessary */
- if (!mount_table->version)
- {
- mount_table->version = MOUNT_VERSION_MAGIC;
- debug_printf ("initializing mount table");
- mount_table->cb = sizeof (*mount_table);
- if (mount_table->cb != MOUNT_INFO_CB)
- system_printf ("size of mount table region changed from %u to %u",
- MOUNT_INFO_CB, mount_table->cb);
- mount_table->init (); /* Initialize the mount table. */
- }
- else if (mount_table->version != MOUNT_VERSION_MAGIC)
- multiple_cygwin_problem ("mount", mount_table->version, MOUNT_VERSION);
- else if (mount_table->cb != MOUNT_INFO_CB)
- multiple_cygwin_problem ("mount table size", mount_table->cb, MOUNT_INFO_CB);
-
-}
-
-void __stdcall
-shared_terminate ()
-{
- if (cygheap->shared_h)
- ForceCloseHandle (cygheap->shared_h);
- if (cygwin_mount_h)
- ForceCloseHandle (cygwin_mount_h);
-}
-
-unsigned
-shared_info::heap_chunk_size ()
-{
- if (!heap_chunk_in_mb)
- {
- /* Fetch misc. registry entries. */
-
- reg_key reg (KEY_READ, NULL);
-
- /* Note that reserving a huge amount of heap space does not result in
- the use of swap since we are not committing it. */
- /* FIXME: We should not be restricted to a fixed size heap no matter
- what the fixed size is. */
-
- heap_chunk_in_mb = reg.get_int ("heap_chunk_in_mb", 256);
- if (heap_chunk_in_mb < 4)
- {
- heap_chunk_in_mb = 4;
- reg.set_int ("heap_chunk_in_mb", heap_chunk_in_mb);
- }
- }
-
- return heap_chunk_in_mb << 20;
-}
-
-/*
- * Function to return a common SECURITY_DESCRIPTOR * that
- * allows all access.
- */
-
-static NO_COPY SECURITY_DESCRIPTOR *null_sdp = 0;
-
-SECURITY_DESCRIPTOR *__stdcall
-get_null_sd ()
-{
- static NO_COPY SECURITY_DESCRIPTOR sd;
-
- if (null_sdp == 0)
- {
- InitializeSecurityDescriptor (&sd, SECURITY_DESCRIPTOR_REVISION);
- SetSecurityDescriptorDacl (&sd, TRUE, 0, FALSE);
- null_sdp = &sd;
- }
- return null_sdp;
-}
-
-BOOL
-sec_acl (PACL acl, BOOL admins, PSID sid1, PSID sid2)
-{
- size_t acl_len = MAX_DACL_LEN(5);
-
- if (!InitializeAcl (acl, acl_len, ACL_REVISION))
- {
- debug_printf ("InitializeAcl %E");
- return FALSE;
- }
- if (sid2)
- if (!AddAccessAllowedAce (acl, ACL_REVISION,
- GENERIC_ALL, sid2))
- debug_printf ("AddAccessAllowedAce(sid2) %E");
- if (sid1)
- if (!AddAccessAllowedAce (acl, ACL_REVISION,
- GENERIC_ALL, sid1))
- debug_printf ("AddAccessAllowedAce(sid1) %E", sid1);
- if (admins)
- if (!AddAccessAllowedAce (acl, ACL_REVISION,
- GENERIC_ALL, well_known_admins_sid))
- debug_printf ("AddAccessAllowedAce(admin) %E");
- if (!AddAccessAllowedAce (acl, ACL_REVISION,
- GENERIC_ALL, well_known_system_sid))
- debug_printf ("AddAccessAllowedAce(system) %E");
-#if 0 /* Does not seem to help */
- if (!AddAccessAllowedAce (acl, ACL_REVISION,
- GENERIC_ALL, well_known_creator_owner_sid))
- debug_printf ("AddAccessAllowedAce(creator_owner) %E");
-#endif
- return TRUE;
-}
-
-PSECURITY_ATTRIBUTES __stdcall
-__sec_user (PVOID sa_buf, PSID sid2, BOOL inherit)
-{
- PSECURITY_ATTRIBUTES psa = (PSECURITY_ATTRIBUTES) sa_buf;
- PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR)
- ((char *) sa_buf + sizeof (*psa));
- PACL acl = (PACL) ((char *) sa_buf + sizeof (*psa) + sizeof (*psd));
-
- cygsid sid;
-
- if (!(sid = cygheap->user.orig_sid ()) ||
- (!sec_acl (acl, TRUE, sid, sid2)))
- return inherit ? &sec_none : &sec_none_nih;
-
- if (!InitializeSecurityDescriptor (psd, SECURITY_DESCRIPTOR_REVISION))
- debug_printf ("InitializeSecurityDescriptor %E");
-
-/*
- * Setting the owner lets the created security attribute not work
- * on NT4 SP3 Server. Don't know why, but the function still does
- * what it should do also if the owner isn't set.
-*/
-#if 0
- if (!SetSecurityDescriptorOwner (psd, sid, FALSE))
- debug_printf ("SetSecurityDescriptorOwner %E");
-#endif
-
- if (!SetSecurityDescriptorDacl (psd, TRUE, acl, FALSE))
- debug_printf ("SetSecurityDescriptorDacl %E");
-
- psa->nLength = sizeof (SECURITY_ATTRIBUTES);
- psa->lpSecurityDescriptor = psd;
- psa->bInheritHandle = inherit;
- return psa;
-}
diff --git a/winsup/cygwin/shared.sgml b/winsup/cygwin/shared.sgml
deleted file mode 100644
index f43d654e2..000000000
--- a/winsup/cygwin/shared.sgml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-<sect1 id="func-cygwin-getshared">
-<title>cygwin_getshared</title>
-
-<funcsynopsis>
-<funcdef>shared_info *
-<function>cygwin_getshared</function></funcdef>
-<void>
-</funcsynopsis>
-
-<para>Returns a pointer to an internal Cygwin memory structure
-containing shared information used by cooperating cygwin processes.
-This function is intended for use only by "system" programs like
-<filename>mount</filename> and <filename>ps</filename>.
-</para>
-
-</sect1>
diff --git a/winsup/cygwin/shared_info.h b/winsup/cygwin/shared_info.h
deleted file mode 100644
index 02a12fff5..000000000
--- a/winsup/cygwin/shared_info.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/* shared_info.h: shared info for cygwin
-
- Copyright 2000, 2001 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 "tty.h"
-
-/* Mount table entry */
-
-class mount_item
-{
- public:
- /* FIXME: Nasty static allocation. Need to have a heap in the shared
- area [with the user being able to configure at runtime the max size]. */
- /* Win32-style mounted partition source ("C:\foo\bar").
- native_path[0] == 0 for unused entries. */
- char native_path[MAX_PATH];
- int native_pathlen;
-
- /* POSIX-style mount point ("/foo/bar") */
- char posix_path[MAX_PATH];
- int posix_pathlen;
-
- unsigned flags;
-
- void init (const char *dev, const char *path, unsigned flags);
-
- struct mntent *getmntent ();
-};
-
-/* Warning: Decreasing this value will cause cygwin.dll to ignore existing
- higher numbered registry entries. Don't change this number willy-nilly.
- What we need is to have a more dynamic allocation scheme, but the current
- scheme should be satisfactory for a long while yet. */
-#define MAX_MOUNTS 30
-
-#define MOUNT_VERSION 27 // increment when mount table changes and
-#define MOUNT_VERSION_MAGIC CYGWIN_VERSION_MAGIC (MOUNT_MAGIC, MOUNT_VERSION)
-#define CURR_MOUNT_MAGIC 0xf4e5
-#define MOUNT_INFO_CB 16488
-
-class reg_key;
-
-/* NOTE: Do not make gratuitous changes to the names or organization of the
- below class. The layout is checksummed to determine compatibility between
- different cygwin versions. */
-class mount_info
-{
- public:
- DWORD version;
- unsigned cb;
- DWORD sys_mount_table_counter;
- int nmounts;
- mount_item mount[MAX_MOUNTS];
-
- /* cygdrive_prefix is used as the root of the path automatically
- prepended to a path when the path has no associated mount.
- cygdrive_flags are the default flags for the cygdrives. */
- char cygdrive[MAX_PATH];
- size_t cygdrive_len;
- unsigned cygdrive_flags;
- private:
- int posix_sorted[MAX_MOUNTS];
- int native_sorted[MAX_MOUNTS];
-
- public:
- /* Increment when setting up a reg_key if mounts area had to be
- created so we know when we need to import old mount tables. */
- int had_to_create_mount_areas;
-
- void init ();
- int add_item (const char *dev, const char *path, unsigned flags, int reg_p);
- int del_item (const char *path, unsigned flags, int reg_p);
-
- void from_registry ();
- int add_reg_mount (const char * native_path, const char * posix_path,
- unsigned mountflags);
- int del_reg_mount (const char * posix_path, unsigned mountflags);
-
- unsigned set_flags_from_win32_path (const char *path);
- int conv_to_win32_path (const char *src_path, char *dst, DWORD &devn,
- int &unit, unsigned *flags = NULL, bool no_normalize = 0);
- int conv_to_posix_path (const char *src_path, char *posix_path,
- int keep_rel_p);
- struct mntent *getmntent (int x);
-
- int write_cygdrive_info_to_registry (const char *cygdrive_prefix, unsigned flags);
- int remove_cygdrive_info_from_registry (const char *cygdrive_prefix, unsigned flags);
- int get_cygdrive_info (char *user, char *system, char* user_flags,
- char* system_flags);
-
- private:
-
- void sort ();
- void read_mounts (reg_key& r);
- void mount_slash ();
- void to_registry ();
-
- int cygdrive_win32_path (const char *src, char *dst, int& unit);
- void cygdrive_posix_path (const char *src, char *dst, int trailing_slash_p);
- void read_cygdrive_info_from_registry ();
-};
-
-/******** Close-on-delete queue ********/
-
-/* First pass at a file deletion queue structure.
-
- We can't keep this list in the per-process info, since
- one process may open a file, and outlive a process which
- wanted to unlink the file - and the data would go away.
-*/
-
-#define MAX_DELQUEUES_PENDING 100
-
-class delqueue_list
-{
- char name[MAX_DELQUEUES_PENDING][MAX_PATH];
- char inuse[MAX_DELQUEUES_PENDING];
- int empty;
-
-public:
- void init ();
- void queue_file (const char *dosname);
- void process_queue ();
-};
-
-/******** Shared Info ********/
-/* Data accessible to all tasks */
-
-#define SHARED_VERSION (unsigned)(cygwin_version.api_major << 8 | \
- cygwin_version.api_minor)
-#define SHARED_VERSION_MAGIC CYGWIN_VERSION_MAGIC (SHARED_MAGIC, SHARED_VERSION)
-
-#define SHARED_INFO_CB 47112
-
-#define CURR_SHARED_MAGIC 0x88e
-
-/* NOTE: Do not make gratuitous changes to the names or organization of the
- below class. The layout is checksummed to determine compatibility between
- different cygwin versions. */
-class shared_info
-{
- DWORD version;
- DWORD cb;
- public:
- int heap_chunk_in_mb;
- DWORD sys_mount_table_counter;
-
- tty_list tty;
- delqueue_list delqueue;
- void initialize ();
- unsigned heap_chunk_size ();
-};
-
-extern shared_info *cygwin_shared;
-extern mount_info *mount_table;
-extern HANDLE cygwin_mount_h;
-
-void __stdcall memory_init (void);
-void __stdcall shared_terminate (void);
-
-#define shared_align_past(p) \
- ((char *) (system_info.dwAllocationGranularity * \
- (((DWORD) ((p) + 1) + system_info.dwAllocationGranularity - 1) / \
- system_info.dwAllocationGranularity)))
-
-#define cygwin_shared_address ((void *) 0xa000000)
-#define mount_table_address shared_align_past (cygwin_shared)
-#define cygheap_address shared_align_past ((mount_info *) shared_align_past (cygwin_shared))
-
-char *__stdcall shared_name (const char *, int);
-void *__stdcall open_shared (const char *name, int n, HANDLE &shared_h, DWORD size, void *addr);
diff --git a/winsup/cygwin/shm.cc b/winsup/cygwin/shm.cc
deleted file mode 100644
index baea3a60e..000000000
--- a/winsup/cygwin/shm.cc
+++ /dev/null
@@ -1,558 +0,0 @@
-/* shm.cc: Single unix specification IPC interface for Cygwin
-
-Copyright 2001, 2002 Red Hat, Inc.
-
-Originally written by Robert Collins <robert.collins@hotmail.com>
-
-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 "winsup.h"
-#include <sys/stat.h>
-#include <errno.h>
-#include "cygerrno.h"
-#include <unistd.h>
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygheap.h"
-#include <stdio.h>
-#include "thread.h"
-#include <sys/shm.h>
-#include "cygserver_shm.h"
-
-// FIXME IS THIS CORRECT
-/* Implementation notes: We use two shared memory regions per key:
- * One for the control structure, and one for the shared memory.
- * While this has a higher overhead tham a single shared area,
- * It allows more flexability. As the entire code is transparent to the user
- * We can merge these in the future should it be needed.
- */
-extern "C" size_t
-getsystemallocgranularity ()
-{
- SYSTEM_INFO sysinfo;
- static size_t buffer_offset = 0;
- if (buffer_offset)
- return buffer_offset;
- GetSystemInfo (&sysinfo);
- buffer_offset = sysinfo.dwAllocationGranularity;
- return buffer_offset;
-}
-
-client_request_shm::client_request_shm (int ntype, int nshm_id):
-client_request (CYGSERVER_REQUEST_SHM_GET, sizeof (parameters))
-{
- buffer = (char *) &parameters;
- parameters.in.shm_id = nshm_id;
- parameters.in.type = SHM_REATTACH;
- parameters.in.pid = GetCurrentProcessId ();
-}
-
-client_request_shm::client_request_shm (int ntype, int nshm_id, pid_t npid):
-client_request (CYGSERVER_REQUEST_SHM_GET, sizeof (parameters))
-{
- buffer = (char *) &parameters;
- parameters.in.shm_id = nshm_id;
- parameters.in.type = ntype;
- parameters.in.pid = npid;
-}
-
-client_request_shm::client_request_shm (key_t nkey, size_t nsize,
- int nshmflg,
- char psdbuf[4096],
- pid_t npid):
-client_request (CYGSERVER_REQUEST_SHM_GET, sizeof (parameters))
-{
- buffer = (char *) &parameters;
- parameters.in.key = nkey;
- parameters.in.size = nsize;
- parameters.in.shmflg = nshmflg;
- parameters.in.type = SHM_CREATE;
- parameters.in.pid = npid;
- memcpy (parameters.in.sd_buf, psdbuf, 4096);
-}
-
-static shmnode *shm_head = NULL;
-
-static shmnode *
-build_inprocess_shmds (HANDLE hfilemap, HANDLE hattachmap, key_t key,
- int shm_id)
-{
- HANDLE filemap = hfilemap;
- void *mapptr = MapViewOfFile (filemap, FILE_MAP_WRITE, 0, 0, 0);
-
- if (!mapptr)
- {
- CloseHandle (hfilemap);
- CloseHandle (hattachmap);
- //FIXME: close filemap and free the mutex
- /* we couldn't access the mapped area with the requested permissions */
- set_errno (EACCES);
- return NULL;
- }
-
- /* Now get the user data */
- HANDLE attachmap = hattachmap;
- shmid_ds *shmtemp = new shmid_ds;
- if (!shmtemp)
- {
- system_printf ("failed to malloc shm node\n");
- set_errno (ENOMEM);
- UnmapViewOfFile (mapptr);
- CloseHandle (filemap);
- CloseHandle (attachmap);
- /* exit mutex */
- return NULL;
- }
-
- /* get the system node data */
- *shmtemp = *(shmid_ds *) mapptr;
-
- /* process local data */
- shmnode *tempnode = new shmnode;
-
- tempnode->filemap = filemap;
- tempnode->attachmap = attachmap;
- shmtemp->mapptr = mapptr;
-
- /* no need for InterlockedExchange here, we're serialised by the global mutex */
- tempnode->shmds = shmtemp;
- tempnode->shm_id = shm_id;
- tempnode->key = key;
- tempnode->next = shm_head;
- tempnode->attachhead = NULL;
- shm_head = tempnode;
-
- /* FIXME: leave the system wide shm mutex */
-
- return tempnode;
-}
-
-static void
-delete_inprocess_shmds (shmnode **nodeptr)
-{
- shmnode *node = *nodeptr;
-
- // remove from the list
- if (node == shm_head)
- shm_head = shm_head->next;
- else
- {
- shmnode *tempnode = shm_head;
- while (tempnode && tempnode->next != node)
- tempnode = tempnode->next;
- if (tempnode)
- tempnode->next = node->next;
- // else log the unexpected !
- }
-
- // release the shared data view
- UnmapViewOfFile (node->shmds);
- CloseHandle (node->filemap);
- CloseHandle (node->attachmap);
-
- // free the memory
- delete node;
- nodeptr = NULL;
-}
-
-int __stdcall
-fixup_shms_after_fork ()
-{
- shmnode *tempnode = shm_head;
- while (tempnode)
- {
- void *newshmds =
- MapViewOfFile (tempnode->filemap, FILE_MAP_WRITE, 0, 0, 0);
- if (!newshmds)
- {
- /* don't worry about handle cleanup, we're dying! */
- system_printf ("failed to reattach to shm control file view %x\n",
- tempnode);
- return 1;
- }
- tempnode->shmds = (class shmid_ds *) newshmds;
- tempnode->shmds->mapptr = newshmds;
- _shmattach *attachnode = tempnode->attachhead;
- while (attachnode)
- {
- void *newdata = MapViewOfFileEx (tempnode->attachmap,
- (attachnode->shmflg & SHM_RDONLY) ?
- FILE_MAP_READ : FILE_MAP_WRITE, 0,
- 0, 0, attachnode->data);
- if (newdata != attachnode->data)
- {
- /* don't worry about handle cleanup, we're dying! */
- system_printf ("failed to reattach to mapped file view %x\n",
- attachnode->data);
- return 1;
- }
- attachnode = attachnode->next;
- }
- tempnode = tempnode->next;
- }
- return 0;
-}
-
-/* this is ugly. Yes, I know that.
- * FIXME: abstract the lookup functionality,
- * So that it can be an array, list, whatever without us being worried
- */
-
-/* FIXME: after fork, every memory area needs to have the attach count
- * incremented. This should be done in the server?
- */
-
-/* FIXME: tell the daemon when we attach, so at process close it can clean up
- * the attach count
- */
-extern "C" void *
-shmat (int shmid, const void *shmaddr, int shmflg)
-{
- shmnode *tempnode = shm_head;
- while (tempnode && tempnode->shm_id != shmid)
- tempnode = tempnode->next;
-
- if (!tempnode)
- {
- /* couldn't find a currently open shm control area for the key - probably because
- * shmget hasn't been called.
- * Allocate a new control block - this has to be handled by the daemon */
- client_request_shm *req =
- new client_request_shm (SHM_REATTACH, shmid, GetCurrentProcessId ());
-
- int rc;
- if ((rc = cygserver_request (req)))
- {
- delete req;
- set_errno (ENOSYS); /* daemon communication failed */
- return (void *) -1;
- }
-
- if (req->header.error_code) /* shm_get failed in the daemon */
- {
- set_errno (req->header.error_code);
- delete req;
- return (void *) -1;
- }
-
- /* we've got the id, now we open the memory area ourselves.
- * This tests security automagically
- * FIXME: make this a method of shmnode ?
- */
- tempnode =
- build_inprocess_shmds (req->parameters.out.filemap,
- req->parameters.out.attachmap,
- req->parameters.out.key,
- req->parameters.out.shm_id);
- delete req;
- if (!tempnode)
- return (void *) -1;
-
- }
-
- // class shmid_ds *shm = tempnode->shmds;
-
- if (shmaddr)
- {
- //FIXME: requested base address ?! (Don't forget to fix the fixup_after_fork too)
- set_errno (EINVAL);
- return (void *) -1;
- }
-
- void *rv = MapViewOfFile (tempnode->attachmap,
- (shmflg & SHM_RDONLY) ? FILE_MAP_READ :
- FILE_MAP_WRITE, 0, 0, 0);
-
- if (!rv)
- {
- //FIXME: translate GetLastError()
- set_errno (EACCES);
- return (void *) -1;
- }
- /* tell the daemon we have attached */
- client_request_shm *req =
- new client_request_shm (SHM_ATTACH, shmid);
- int rc;
- if ((rc = cygserver_request (req)))
- {
- debug_printf ("failed to tell deaemon that we have attached\n");
- }
- delete req;
-
- _shmattach *attachnode = new _shmattach;
- attachnode->data = rv;
- attachnode->shmflg = shmflg;
- attachnode->next =
- (_shmattach *) InterlockedExchangePointer (&tempnode->attachhead,
- attachnode);
-
-
- return rv;
-}
-
-/* FIXME: tell the daemon when we detach so it doesn't cleanup incorrectly.
- */
-extern "C" int
-shmdt (const void *shmaddr)
-{
- /* this should be "rare" so a hefty search is ok. If this is common, then we
- * should alter the data structs to allow more optimisation
- */
- shmnode *tempnode = shm_head;
- _shmattach *attachnode;
- while (tempnode)
- {
- // FIXME: Race potential
- attachnode = tempnode->attachhead;
- while (attachnode && attachnode->data != shmaddr)
- attachnode = attachnode->next;
- if (attachnode)
- break;
- tempnode = tempnode->next;
- }
- if (!tempnode)
- {
- // dt cannot be called by an app that hasn't alreadu at'd
- set_errno (EINVAL);
- return -1;
- }
-
- UnmapViewOfFile (attachnode->data);
- /* tell the daemon we have attached */
- client_request_shm *req =
- new client_request_shm (SHM_DETACH, tempnode->shm_id);
- int rc;
- if ((rc = cygserver_request (req)))
- {
- debug_printf ("failed to tell deaemon that we have detached\n");
- }
- delete req;
-
- return 0;
-}
-
-//FIXME: who is allowed to perform STAT?
-extern "C" int
-shmctl (int shmid, int cmd, struct shmid_ds *buf)
-{
- shmnode *tempnode = shm_head;
- while (tempnode && tempnode->shm_id != shmid)
- tempnode = tempnode->next;
- if (!tempnode)
- {
- /* couldn't find a currently open shm control area for the key - probably because
- * shmget hasn't been called.
- * Allocate a new control block - this has to be handled by the daemon */
- client_request_shm *req =
- new client_request_shm (SHM_REATTACH, shmid, GetCurrentProcessId ());
-
- int rc;
- if ((rc = cygserver_request (req)))
- {
- delete req;
- set_errno (ENOSYS); /* daemon communication failed */
- return -1;
- }
-
- if (req->header.error_code) /* shm_get failed in the daemon */
- {
- set_errno (req->header.error_code);
- delete req;
- return -1;
- }
-
- /* we've got the id, now we open the memory area ourselves.
- * This tests security automagically
- * FIXME: make this a method of shmnode ?
- */
- tempnode =
- build_inprocess_shmds (req->parameters.out.filemap,
- req->parameters.out.attachmap,
- req->parameters.out.key,
- req->parameters.out.shm_id);
- delete req;
- if (!tempnode)
- return -1;
- }
-
- switch (cmd)
- {
- case IPC_STAT:
- buf->shm_perm = tempnode->shmds->shm_perm;
- buf->shm_segsz = tempnode->shmds->shm_segsz;
- buf->shm_lpid = tempnode->shmds->shm_lpid;
- buf->shm_cpid = tempnode->shmds->shm_cpid;
- buf->shm_nattch = tempnode->shmds->shm_nattch;
- buf->shm_atime = tempnode->shmds->shm_atime;
- buf->shm_dtime = tempnode->shmds->shm_dtime;
- buf->shm_ctime = tempnode->shmds->shm_ctime;
- break;
- case IPC_RMID:
- {
- /* TODO: check permissions. Or possibly, the daemon gets to be the only
- * one with write access to the memory area?
- */
- if (tempnode->shmds->shm_nattch)
- system_printf
- ("call to shmctl with cmd= IPC_RMID when memory area still has"
- " attachees\n");
- /* how does this work?
- * we mark the ds area as "deleted", and the at and get calls all fail from now on
- * on, when nattch becomes 0, the mapped data area is destroyed.
- * and each process, as they touch this area detaches. eventually only the
- * daemon has an attach. The daemon gets asked to detach immediately.
- */
- //waiting for the daemon to handle terminating process's
- client_request_shm *req =
- new client_request_shm (SHM_DEL, shmid, GetCurrentProcessId ());
- int rc;
- if ((rc = cygserver_request (req)))
- {
- delete req;
- set_errno (ENOSYS); /* daemon communication failed */
- return -1;
- }
-
- if (req->header.error_code) /* shm_del failed in the daemon */
- {
- set_errno (req->header.error_code);
- delete req;
- return -1;
- }
-
- /* the daemon has deleted it's references */
- /* now for us */
-
- // FIXME: create a destructor
- delete_inprocess_shmds (&tempnode);
-
- }
- break;
- case IPC_SET:
- default:
- set_errno (EINVAL);
- return -1;
- }
- return 0;
-}
-
-/* FIXME: evaluate getuid32() and getgid32() against the requested mode. Then
- * choose PAGE_READWRITE | PAGE_READONLY and FILE_MAP_WRITE | FILE_MAP_READ
- * appropriately
- */
-
-/* FIXME: shmid should be a verifyable object
- */
-
-/* FIXME: on NT we should check everything against the SD. On 95 we just emulate.
- */
-extern "C" int
-shmget (key_t key, size_t size, int shmflg)
-{
- DWORD sd_size = 4096;
- char sd_buf[4096];
- PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR) sd_buf;
- /* create a sd for our open requests based on shmflag & 0x01ff */
- InitializeSecurityDescriptor (psd,
- SECURITY_DESCRIPTOR_REVISION);
- psd = alloc_sd (getuid32 (), getgid32 (),
- shmflg & 0x01ff, psd, &sd_size);
-
- if (key == (key_t) - 1)
- {
- set_errno (ENOENT);
- return -1;
- }
-
- /* FIXME: enter the checking for existing keys mutex. This mutex _must_ be system wide
- * to prevent races on shmget.
- */
-
- /* walk the list of currently open keys and return the id if found
- */
- shmnode *tempnode = shm_head;
- while (tempnode)
- {
- if (tempnode->key == key && key != IPC_PRIVATE)
- {
- // FIXME: free the mutex
- if (size && tempnode->shmds->shm_segsz < size)
- {
- set_errno (EINVAL);
- return -1;
- }
- if ((shmflg & IPC_CREAT) && (shmflg & IPC_EXCL))
- {
- set_errno (EEXIST);
- // FIXME: free the mutex
- return -1;
- }
- // FIXME: do we need to other tests of the requested mode with the
- // tempnode->shmid mode ? testcase on unix needed.
- // FIXME do we need a security test? We are only examining the keys we already have open.
- // FIXME: what are the sec implications for fork () if we don't check here?
- return tempnode->shm_id;
- }
- tempnode = tempnode->next;
- }
- /* couldn't find a currently open shm control area for the key.
- * Allocate a new control block - this has to be handled by the daemon */
- client_request_shm *req =
- new client_request_shm (key, size, shmflg, sd_buf,
- GetCurrentProcessId ());
-
- int rc;
- if ((rc = cygserver_request (req)))
- {
- delete req;
- set_errno (ENOSYS); /* daemon communication failed */
- return -1;
- }
-
- if (req->header.error_code) /* shm_get failed in the daemon */
- {
- set_errno (req->header.error_code);
- delete req;
- return -1;
- }
-
- /* we've got the id, now we open the memory area ourselves.
- * This tests security automagically
- * FIXME: make this a method of shmnode ?
- */
- shmnode *shmtemp = build_inprocess_shmds (req->parameters.out.filemap,
- req->parameters.out.attachmap,
- key,
- req->parameters.out.shm_id);
- delete req;
- if (shmtemp)
- return shmtemp->shm_id;
- return -1;
-
-
-#if 0
- /* fill out the node data */
- shmtemp->shm_perm.cuid = getuid32 ();
- shmtemp->shm_perm.uid = shmtemp->shm_perm.cuid;
- shmtemp->shm_perm.cgid = getgid32 ();
- shmtemp->shm_perm.gid = shmtemp->shm_perm.cgid;
- shmtemp->shm_perm.mode = shmflg & 0x01ff;
- shmtemp->shm_lpid = 0;
- shmtemp->shm_nattch = 0;
- shmtemp->shm_atime = 0;
- shmtemp->shm_dtime = 0;
- shmtemp->shm_ctime = time (NULL);
- shmtemp->shm_segsz = size;
- *(shmid_ds *) mapptr = *shmtemp;
- shmtemp->filemap = filemap;
- shmtemp->attachmap = attachmap;
- shmtemp->mapptr = mapptr;
-
-#endif
-}
diff --git a/winsup/cygwin/shortcut.c b/winsup/cygwin/shortcut.c
deleted file mode 100644
index 55710e86b..000000000
--- a/winsup/cygwin/shortcut.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/* shortcut.c: Read shortcuts. This part of the code must be in C because
- the C++ interface to COM doesn't work without -fvtable-thunk
- which is too dangerous to use.
-
- Copyright 2001 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
-#include "winsup.h"
-#include <shlobj.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/mount.h>
-#include <errno.h>
-#include "shortcut.h"
-
-/* TODO:
- Currently duplicated from path.h. Later rearrangement of path.h
- to allow including from plain C would be better. */
-/* This is needed to avoid including path.h which is a pure C++ header. */
-#define PATH_SYMLINK MOUNT_SYMLINK
-#define PATH_EXEC MOUNT_EXEC
-#define PATH_CYGWIN_EXEC MOUNT_CYGWIN_EXEC
-#define PATH_ALL_EXEC (PATH_CYGWIN_EXEC | PATH_EXEC)
-
-/* TODO: Ditto. */
-static BOOL
-has_exec_chars (const char *buf, int len)
-{
- return len >= 2 &&
- ((buf[0] == '#' && buf[1] == '!') ||
- (buf[0] == ':' && buf[1] == '\n') ||
- (buf[0] == 'M' && buf[1] == 'Z'));
-}
-
-char shortcut_header[SHORTCUT_HDR_SIZE];
-BOOL shortcut_initalized;
-
-void
-create_shortcut_header (void)
-{
- if (!shortcut_initalized)
- {
- shortcut_header[0] = 'L';
- shortcut_header[4] = '\001';
- shortcut_header[5] = '\024';
- shortcut_header[6] = '\002';
- shortcut_header[12] = '\300';
- shortcut_header[19] = 'F';
- shortcut_header[20] = '\f';
- shortcut_header[60] = '\001';
- shortcut_initalized = TRUE;
- }
-}
-
-static BOOL
-cmp_shortcut_header (const char *file_header)
-{
- create_shortcut_header ();
- return memcmp (shortcut_header, file_header, SHORTCUT_HDR_SIZE);
-}
-
-int
-check_shortcut (const char *path, DWORD fileattr, HANDLE h,
- char *contents, int *error, unsigned *pflags)
-{
- HRESULT hres;
- IShellLink *psl = NULL;
- IPersistFile *ppf = NULL;
- WCHAR wc_path[MAX_PATH];
- char file_header[SHORTCUT_HDR_SIZE];
- DWORD len = 0;
- int res = 0;
- DWORD got = 0;
-
- /* Initialize COM library. */
- CoInitialize (NULL);
-
- /* Get a pointer to the IShellLink interface. */
- hres = CoCreateInstance (&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
- &IID_IShellLink, (void **)&psl);
- if (FAILED (hres))
- goto close_it;
- /* Get a pointer to the IPersistFile interface. */
- hres = psl->lpVtbl->QueryInterface (psl, &IID_IPersistFile, (void **)&ppf);
- if (FAILED (hres))
- goto close_it;
- /* Load the shortcut. */
- MultiByteToWideChar(CP_ACP, 0, path, -1, wc_path, MAX_PATH);
- hres = ppf->lpVtbl->Load (ppf, wc_path, STGM_READ);
- if (FAILED (hres))
- goto close_it;
- /* Read the files header information. This is used to check for a
- Cygwin or U/WIN shortcut or later to check for executable files. */
- if (!ReadFile (h, file_header, SHORTCUT_HDR_SIZE, &got, 0))
- {
- *error = EIO;
- goto close_it;
- }
- /* Try the description (containing a POSIX path) first. */
- if (fileattr & FILE_ATTRIBUTE_READONLY)
- {
- /* Check header if the shortcut is really created by Cygwin or U/WIN. */
- if (got == SHORTCUT_HDR_SIZE && !cmp_shortcut_header (file_header))
- {
- hres = psl->lpVtbl->GetDescription (psl, contents, MAX_PATH);
- if (FAILED (hres))
- goto file_not_symlink;
- len = strlen (contents);
- }
- }
-#if TREAT_NATIVE_SHORTCUTS_AS_SYMLINKS
- /* No description or not R/O: Check the "official" path. */
- if (len == 0)
- {
- char full_path[MAX_PATH];
- WIN32_FIND_DATA wfd;
-
- /* Convert to full path (easy way) */
- if ((path[0] == '\\' && path[1] == '\\')
- || (_toupper (path[0]) >= 'A' && _toupper (path[0]) <= 'Z'
- && path[1] == ':'))
- len = 0;
- else
- {
- len = GetCurrentDirectory (MAX_PATH, full_path);
- if (path[0] == '\\')
- len = 2;
- else if (full_path[len - 1] != '\\')
- strcpy (full_path + len++, "\\");
- }
- strcpy (full_path + len, path);
- /* Set relative path inside of IShellLink interface. */
- hres = psl->lpVtbl->SetRelativePath (psl, full_path, 0);
- if (FAILED (hres))
- goto file_not_symlink;
- /* Get the path to the shortcut target. */
- hres = psl->lpVtbl->GetPath (psl, contents, MAX_PATH, &wfd, 0);
- if (FAILED(hres))
- goto file_not_symlink;
- }
-#endif
- res = strlen (contents);
- if (res) /* It's a symlink. */
- *pflags = PATH_SYMLINK;
- goto close_it;
-
-file_not_symlink:
- /* Not a symlink, see if executable. */
- if (!(*pflags & PATH_ALL_EXEC) && has_exec_chars (file_header, got))
- *pflags |= PATH_EXEC;
-
-close_it:
- /* Release the pointer to IPersistFile. */
- if (ppf)
- ppf->lpVtbl->Release(ppf);
- /* Release the pointer to IShellLink. */
- if (psl)
- psl->lpVtbl->Release(psl);
- /* Uninitialize COM library. */
- CoUninitialize ();
- CloseHandle (h);
-
- return res;
-}
diff --git a/winsup/cygwin/shortcut.h b/winsup/cygwin/shortcut.h
deleted file mode 100644
index 447e320b4..000000000
--- a/winsup/cygwin/shortcut.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* shortcut.h: Header file for shortcut.c
-
- Copyright 2001 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 __cplusplus
-extern "C" {
-#endif
-
-/* The header written to a shortcut by Cygwin or U/WIN. */
-#define SHORTCUT_HDR_SIZE 76
-
-extern char shortcut_header[];
-extern BOOL shortcut_initalized;
-
-extern void create_shortcut_header ();
-
-int check_shortcut (const char *path, DWORD fileattr, HANDLE h,
- char *contents, int *error, unsigned *pflags);
-
-#ifdef __cplusplus
-};
-#endif
diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc
deleted file mode 100644
index 5b42a1ff1..000000000
--- a/winsup/cygwin/signal.cc
+++ /dev/null
@@ -1,410 +0,0 @@
-/* signal.cc
-
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-
- Written by Steve Chamberlain of Cygnus Support, sac@cygnus.com
- Significant changes by Sergey Okhapkin <sos@prospect.com.ru>
-
-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 "winsup.h"
-#include <errno.h>
-#include <stdlib.h>
-#include "cygerrno.h"
-#include <sys/cygwin.h>
-#include "sigproc.h"
-#include "pinfo.h"
-
-int sigcatchers; /* FIXME: Not thread safe. */
-
-#define sigtrapped(func) ((func) != SIG_IGN && (func) != SIG_DFL)
-
-static inline void
-set_sigcatchers (void (*oldsig) (int), void (*cursig) (int))
-{
-#ifdef DEBUGGING
- int last_sigcatchers = sigcatchers;
-#endif
- if (!sigtrapped (oldsig) && sigtrapped (cursig))
- sigcatchers++;
- else if (sigtrapped (oldsig) && !sigtrapped (cursig))
- sigcatchers--;
-#ifdef DEBUGGING
- if (last_sigcatchers != sigcatchers)
- sigproc_printf ("last %d, old %d, cur %p, cur %p", last_sigcatchers,
- sigcatchers, oldsig, cursig);
-#endif
-}
-
-extern "C" _sig_func_ptr
-signal (int sig, _sig_func_ptr func)
-{
- _sig_func_ptr prev;
-
- /* check that sig is in right range */
- if (sig < 0 || sig >= NSIG || sig == SIGKILL || sig == SIGSTOP)
- {
- set_errno (EINVAL);
- syscall_printf ("SIG_ERR = signal (%d, %p)", sig, func);
- return (_sig_func_ptr) SIG_ERR;
- }
-
- prev = myself->getsig (sig).sa_handler;
- myself->getsig (sig).sa_handler = func;
- myself->getsig (sig).sa_mask = 0;
- /* SA_RESTART is set to maintain BSD compatible signal behaviour by default.
- This is also compatible to the behaviour of signal(2) in Linux. */
- myself->getsig (sig).sa_flags |= SA_RESTART;
- set_sigcatchers (prev, func);
-
- syscall_printf ("%p = signal (%d, %p)", prev, sig, func);
- return prev;
-}
-
-extern "C" unsigned int
-sleep (unsigned int seconds)
-{
- int rc;
- sigframe thisframe (mainthread);
- DWORD ms, start_time, end_time;
-
- ms = seconds * 1000;
- start_time = GetTickCount ();
- end_time = start_time + (seconds * 1000);
- syscall_printf ("sleep (%d)", seconds);
-
- rc = WaitForSingleObject (signal_arrived, ms);
- DWORD now = GetTickCount ();
- if (rc == WAIT_TIMEOUT || now >= end_time)
- ms = 0;
- else
- ms = end_time - now;
- if (WaitForSingleObject (signal_arrived, 0) == WAIT_OBJECT_0)
- (void) thisframe.call_signal_handler ();
-
- DWORD res = (ms + 500) / 1000;
- syscall_printf ("%d = sleep (%d)", res, seconds);
-
- return res;
-}
-
-extern "C" unsigned int
-usleep (unsigned int useconds)
-{
- syscall_printf ("usleep (%d)", useconds);
- WaitForSingleObject (signal_arrived, (useconds + 500) / 1000);
- syscall_printf ("0 = usleep (%d)", useconds);
- return 0;
-}
-
-extern "C" int
-sigprocmask (int sig, const sigset_t *set, sigset_t *oldset)
-{
- /* check that sig is in right range */
- if (sig < 0 || sig >= NSIG)
- {
- set_errno (EINVAL);
- syscall_printf ("SIG_ERR = sigprocmask signal %d out of range", sig);
- return -1;
- }
-
- if (oldset)
- *oldset = myself->getsigmask ();
- if (set)
- {
- sigset_t newmask = myself->getsigmask ();
- switch (sig)
- {
- case SIG_BLOCK:
- /* add set to current mask */
- newmask |= *set;
- break;
- case SIG_UNBLOCK:
- /* remove set from current mask */
- newmask &= ~*set;
- break;
- case SIG_SETMASK:
- /* just set it */
- newmask = *set;
- break;
- default:
- set_errno (EINVAL);
- return -1;
- }
- (void) set_process_mask (newmask);
- }
- return 0;
-}
-
-static int
-kill_worker (pid_t pid, int sig)
-{
- int res = 0;
- pinfo dest (pid);
- BOOL sendSIGCONT;
-
- if (!dest)
- {
- set_errno (ESRCH);
- return -1;
- }
-
- dest->setthread2signal (NULL);
-
- if ((sendSIGCONT = (sig < 0)))
- sig = -sig;
-
-#if 0
- if (dest == myself && !sendSIGCONT)
- dest = myself_nowait_nonmain;
-#endif
- if (sig == 0)
- {
- res = proc_exists (dest) ? 0 : -1;
- if (res < 0)
- set_errno (ESRCH);
- }
- else if ((res = sig_send (dest, sig)))
- {
- sigproc_printf ("%d = sig_send, %E ", res);
- res = -1;
- }
- else if (sendSIGCONT)
- (void) sig_send (dest, SIGCONT);
-
- syscall_printf ("%d = kill_worker (%d, %d)", res, pid, sig);
- return res;
-}
-
-int
-_raise (int sig)
-{
- return _kill (myself->pid, sig);
-}
-
-/* This is called _kill because the real kill is in newlib. */
-int
-_kill (pid_t pid, int sig)
-{
- sigframe thisframe (mainthread);
- syscall_printf ("kill (%d, %d)", pid, sig);
- /* check that sig is in right range */
- if (sig < 0 || sig >= NSIG)
- {
- set_errno (EINVAL);
- syscall_printf ("signal %d out of range", sig);
- return -1;
- }
-
- /* Silently ignore stop signals from a member of orphaned process group.
- FIXME: Why??? */
- if (ISSTATE(myself, PID_ORPHANED) &&
- (sig == SIGTSTP || sig == SIGTTIN || sig == SIGTTOU))
- sig = 0;
-
- return (pid > 0) ? kill_worker (pid, sig) : kill_pgrp (-pid, sig);
-}
-
-int
-kill_pgrp (pid_t pid, int sig)
-{
- int res = 0;
- int found = 0;
- int killself = 0;
- sigframe thisframe (mainthread);
-
- sigproc_printf ("pid %d, signal %d", pid, sig);
-
- winpids pids;
- for (unsigned i = 0; i < pids.npids; i++)
- {
- _pinfo *p = pids[i];
-
- if (!proc_exists (p))
- continue;
-
- /* Is it a process we want to kill? */
- if ((pid == 0 && (p->pgid != myself->pgid || p->ctty != myself->ctty)) ||
- (pid > 1 && p->pgid != pid) ||
- (sig < 0 && NOTSTATE(p, PID_STOPPED)))
- continue;
- sigproc_printf ("killing pid %d, pgrp %d, p->ctty %d, myself->ctty %d",
- p->pid, p->pgid, p->ctty, myself->ctty);
- if (p == myself)
- killself++;
- else if (kill_worker (p->pid, sig))
- res = -1;
- found++;
- }
-
- if (killself && kill_worker (myself->pid, sig))
- res = -1;
-
- if (!found)
- {
- set_errno (ESRCH);
- res = -1;
- }
- syscall_printf ("%d = kill (%d, %d)", res, pid, sig);
- return res;
-}
-
-extern "C" int
-killpg (pid_t pgrp, int sig)
-{
- return _kill (-pgrp, sig);
-}
-
-extern "C" void
-abort (void)
-{
- sigframe thisframe (mainthread);
- /* Flush all streams as per SUSv2.
- From my reading of this document, this isn't strictly correct.
- The streams are supposed to be flushed prior to exit. However,
- if there is I/O in any signal handler that will not necessarily
- be flushed.
- However this is the way FreeBSD does it, and it is much easier to
- do things this way, so... */
- if (_reent_clib ()->__cleanup)
- _reent_clib ()->__cleanup (_reent_clib ());
-
- /* Ensure that SIGABRT can be caught regardless of blockage. */
- sigset_t sig_mask;
- sigfillset (&sig_mask);
- sigdelset (&sig_mask, SIGABRT);
- set_process_mask (sig_mask);
-
- _raise (SIGABRT);
- (void) thisframe.call_signal_handler (); /* Call any signal handler */
- do_exit (1); /* signal handler didn't exit. Goodbye. */
-}
-
-extern "C" int
-sigaction (int sig, const struct sigaction *newact, struct sigaction *oldact)
-{
- sigproc_printf ("signal %d, newact %p, oldact %p", sig, newact, oldact);
- /* check that sig is in right range */
- if (sig < 0 || sig >= NSIG)
- {
- set_errno (EINVAL);
- syscall_printf ("SIG_ERR = sigaction signal %d out of range", sig);
- return -1;
- }
-
- struct sigaction oa = myself->getsig (sig);
-
- if (newact)
- {
- if (sig == SIGKILL || sig == SIGSTOP)
- {
- set_errno (EINVAL);
- return -1;
- }
- myself->getsig (sig) = *newact;
- if (newact->sa_handler == SIG_IGN)
- sig_clear (sig);
- if (newact->sa_handler == SIG_DFL && sig == SIGCHLD)
- sig_clear (sig);
- set_sigcatchers (oa.sa_handler, newact->sa_handler);
- }
-
- if (oldact)
- *oldact = oa;
-
- return 0;
-}
-
-extern "C" int
-sigaddset (sigset_t *set, const int sig)
-{
- /* check that sig is in right range */
- if (sig <= 0 || sig >= NSIG)
- {
- set_errno (EINVAL);
- syscall_printf ("SIG_ERR = sigaddset signal %d out of range", sig);
- return -1;
- }
-
- *set |= SIGTOMASK (sig);
- return 0;
-}
-
-extern "C" int
-sigdelset (sigset_t *set, const int sig)
-{
- /* check that sig is in right range */
- if (sig <= 0 || sig >= NSIG)
- {
- set_errno (EINVAL);
- syscall_printf ("SIG_ERR = sigdelset signal %d out of range", sig);
- return -1;
- }
-
- *set &= ~SIGTOMASK (sig);
- return 0;
-}
-
-extern "C" int
-sigismember (const sigset_t *set, int sig)
-{
- /* check that sig is in right range */
- if (sig <= 0 || sig >= NSIG)
- {
- set_errno (EINVAL);
- syscall_printf ("SIG_ERR = sigdelset signal %d out of range", sig);
- return -1;
- }
-
- if (*set & SIGTOMASK (sig))
- return 1;
- else
- return 0;
-}
-
-extern "C" int
-sigemptyset (sigset_t *set)
-{
- *set = (sigset_t) 0;
- return 0;
-}
-
-extern "C" int
-sigfillset (sigset_t *set)
-{
- *set = ~((sigset_t) 0);
- return 0;
-}
-
-extern "C" int
-sigpending (sigset_t *set)
-{
- unsigned bit;
- *set = 0;
- for (int sig = 1; sig < NSIG; sig++)
- if (*myself->getsigtodo (sig) && myself->getsigmask () & (bit = SIGTOMASK (sig)))
- *set |= bit;
- return 0;
-}
-
-extern "C" int
-sigsuspend (const sigset_t *set)
-{
- return handle_sigsuspend (*set);
-}
-
-extern "C" int
-sigpause (int signal_mask)
-{
- return handle_sigsuspend ((sigset_t) signal_mask);
-}
-
-extern "C" int
-pause (void)
-{
- return handle_sigsuspend (myself->getsigmask ());
-}
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
deleted file mode 100644
index d8e5845e2..000000000
--- a/winsup/cygwin/sigproc.cc
+++ /dev/null
@@ -1,1341 +0,0 @@
-/* sigproc.cc: inter/intra signal and sub process handler
-
- Copyright 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-
- Written by Christopher Faylor <cgf@cygnus.com>
-
-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 "winsup.h"
-#include <stdlib.h>
-#include <time.h>
-#include <sys/wait.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <sys/cygwin.h>
-#include "cygerrno.h"
-#include "sync.h"
-#include "sigproc.h"
-#include "pinfo.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygheap.h"
-#include "child_info_magic.h"
-#define NEED_VFORK
-#include "perthread.h"
-#include <assert.h>
-#include "shared_info.h"
-
-/*
- * Convenience defines
- */
-#define WSSC 60000 // Wait for signal completion
-#define WPSP 40000 // Wait for proc_subproc mutex
-#define WSPX 20000 // Wait for wait_sig to terminate
-#define WWSP 20000 // Wait for wait_subproc to terminate
-
-#define WAIT_SIG_PRIORITY THREAD_PRIORITY_NORMAL
-
-#define TOTSIGS (NSIG + __SIGOFFSET)
-
-#define wake_wait_subproc() SetEvent (events[0])
-
-#define no_signals_available() (!hwait_sig || !sig_loop_wait)
-
-#define NZOMBIES 256
-
-/*
- * Global variables
- */
-const char *__sp_fn ;
-int __sp_ln;
-
-char NO_COPY myself_nowait_dummy[1] = {'0'};// Flag to sig_send that signal goes to
- // current process but no wait is required
-char NO_COPY myself_nowait_nonmain_dummy[1] = {'1'};// Flag to sig_send that signal goes to
- // current process but no wait is required
- // if this is not the main thread.
-
-HANDLE NO_COPY signal_arrived; // Event signaled when a signal has
- // resulted in a user-specified
- // function call
-/*
- * Common variables
- */
-
-
-/* How long to wait for message/signals. Normally this is infinite.
- * On termination, however, these are set to zero as a flag to exit.
- */
-
-#define Static static NO_COPY
-
-Static DWORD proc_loop_wait = 1000; // Wait for subprocesses to exit
-Static DWORD sig_loop_wait = INFINITE; // Wait for signals to arrive
-
-Static HANDLE sigcatch_nonmain = NULL; // The semaphore signaled when
- // signals are available for
- // processing from non-main thread
-Static HANDLE sigcatch_main = NULL; // Signalled when main thread sends a
- // signal
-Static HANDLE sigcatch_nosync = NULL; // Signal wait_sig to scan sigtodo
- // but not to bother with any
- // synchronization
-Static HANDLE sigcomplete_main = NULL; // Event signaled when a signal has
- // finished processing for the main
- // thread
-Static HANDLE sigcomplete_nonmain = NULL;// Semaphore raised for non-main
- // threads when a signal has finished
- // processing
-Static HANDLE hwait_sig = NULL; // Handle of wait_sig thread
-Static HANDLE hwait_subproc = NULL; // Handle of sig_subproc thread
-
-Static HANDLE wait_sig_inited = NULL; // Control synchronization of
- // message queue startup
-
-/* Used by WaitForMultipleObjects. These are handles to child processes.
- */
-Static HANDLE events[PSIZE + 1] = {0}; // All my children's handles++
-#define hchildren (events + 1) // Where the children handles begin
-Static char cpchildren[PSIZE * sizeof (pinfo)]; // All my children info
-Static int nchildren = 0; // Number of active children
-Static char czombies[NZOMBIES * sizeof (pinfo)]; // All my deceased children info
-Static int nzombies = 0; // Number of deceased children
-
-#define pchildren ((pinfo *) cpchildren)
-#define zombies ((pinfo *) czombies)
-
-Static waitq waitq_head = {0, 0, 0, 0, 0, 0, 0};// Start of queue for wait'ing threads
-Static waitq waitq_main; // Storage for main thread
-
-muto NO_COPY *sync_proc_subproc = NULL; // Control access to subproc stuff
-
-DWORD NO_COPY sigtid = 0; // ID of the signal thread
-
-int NO_COPY pending_signals = 0; // TRUE if signals pending
-
-/* Functions
- */
-static int __stdcall checkstate (waitq *);
-static __inline__ BOOL get_proc_lock (DWORD, DWORD);
-static HANDLE __stdcall getsem (_pinfo *, const char *, int, int);
-static void __stdcall remove_zombie (int);
-static DWORD WINAPI wait_sig (VOID *arg);
-static int __stdcall stopped_or_terminated (waitq *, _pinfo *);
-static DWORD WINAPI wait_subproc (VOID *);
-
-/* Determine if the parent process is alive.
- */
-
-BOOL __stdcall
-my_parent_is_alive ()
-{
- DWORD res;
- if (!myself->ppid_handle)
- {
- debug_printf ("No myself->ppid_handle");
- res = FALSE;
- }
- else
- for (int i = 0; i < 2; i++)
- switch (res = WaitForSingleObject (myself->ppid_handle, 0))
- {
- case WAIT_OBJECT_0:
- debug_printf ("parent dead.");
- res = FALSE;
- goto out;
- case WAIT_TIMEOUT:
- debug_printf ("parent still alive");
- res = TRUE;
- goto out;
- case WAIT_FAILED:
- DWORD werr = GetLastError ();
- if (werr == ERROR_INVALID_HANDLE && i == 0)
- continue;
- system_printf ("WFSO for myself->ppid_handle(%p) failed, error %d",
- myself->ppid_handle, werr);
- res = FALSE;
- goto out;
- }
-out:
- return res;
-}
-
-__inline static void
-wait_for_me ()
-{
- /* See if this is the first signal call after initialization.
- * If so, wait for notification that all initialization has completed.
- * Then set the handle to NULL to avoid checking this again.
- */
- if (wait_sig_inited)
- {
- (void) WaitForSingleObject (wait_sig_inited, INFINITE);
- (void) ForceCloseHandle (wait_sig_inited);
- wait_sig_inited = NULL;
- }
-}
-
-/* Get the sync_proc_subproc muto to control access to
- * children, zombie arrays.
- * Attempt to handle case where process is exiting as we try to grab
- * the mutex.
- */
-static BOOL
-get_proc_lock (DWORD what, DWORD val)
-{
- Static int lastwhat = -1;
- if (!sync_proc_subproc)
- return FALSE;
- if (sync_proc_subproc->acquire (WPSP))
- {
- lastwhat = what;
- return TRUE;
- }
- if (!sync_proc_subproc)
- return FALSE;
- system_printf ("Couldn't aquire sync_proc_subproc for(%d,%d), %E, last %d",
- what, val, lastwhat);
- return TRUE;
-}
-
-static BOOL __stdcall
-proc_can_be_signalled (_pinfo *p)
-{
- if (p == myself_nowait || p == myself_nowait_nonmain || p == myself)
- {
- wait_for_me ();
- return 1;
- }
-
- return ISSTATE (p, PID_INITIALIZING) ||
- (((p)->process_state & (PID_ACTIVE | PID_IN_USE)) ==
- (PID_ACTIVE | PID_IN_USE));
-}
-
-BOOL __stdcall
-pid_exists (pid_t pid)
-{
- pinfo p (pid);
- return proc_exists (p);
-}
-
-/* Test to determine if a process really exists and is processing signals.
- */
-BOOL __stdcall
-proc_exists (_pinfo *p)
-{
- return p && !(p->process_state & PID_EXITED);
-}
-
-/* Return 1 if this is one of our children, zero otherwise.
- FIXME: This really should be integrated with the rest of the proc_subproc
- testing. Scanning these lists twice is inefficient. */
-int __stdcall
-mychild (int pid)
-{
- for (int i = 0; i < nchildren; i++)
- if (pchildren[i]->pid == pid)
- return 1;
- for (int i = 0; i < nzombies; i++)
- if (zombies[i]->pid == pid)
- return 1;
- return 0;
-}
-
-/* Handle all subprocess requests
- */
-#define vchild (*((pinfo *) val))
-int __stdcall
-proc_subproc (DWORD what, DWORD val)
-{
- int rc = 1;
- int potential_match;
- _pinfo *child;
- int clearing;
- waitq *w;
-
-#define wval ((waitq *) val)
-
- sigproc_printf ("args: %x, %d", what, val);
-
- if (!get_proc_lock (what, val)) // Serialize access to this function
- {
- system_printf ("couldn't get proc lock. Something is wrong.");
- goto out1;
- }
-
- switch (what)
- {
- /* Add a new subprocess to the children arrays.
- * (usually called from the main thread)
- */
- case PROC_ADDCHILD:
- if (nchildren >= PSIZE - 1)
- {
- rc = 0;
- break;
- }
- pchildren[nchildren] = vchild;
- hchildren[nchildren] = vchild->hProcess;
- if (!DuplicateHandle (hMainProc, vchild->hProcess, hMainProc, &vchild->pid_handle,
- 0, 0, DUPLICATE_SAME_ACCESS))
- system_printf ("Couldn't duplicate child handle for pid %d, %E", vchild->pid);
- ProtectHandle1 (vchild->pid_handle, pid_handle);
-
- if (!DuplicateHandle (hMainProc, hMainProc, vchild->hProcess, &vchild->ppid_handle,
- 0, TRUE, DUPLICATE_SAME_ACCESS))
- system_printf ("Couldn't duplicate my handle<%p> for pid %d, %E", hMainProc, vchild->pid);
- vchild->ppid = myself->pid;
- vchild->uid = myself->uid;
- vchild->gid = myself->gid;
- vchild->pgid = myself->pgid;
- vchild->sid = myself->sid;
- vchild->ctty = myself->ctty;
- vchild->process_state |= PID_INITIALIZING | (myself->process_state & PID_USETTY);
-
- sigproc_printf ("added pid %d to wait list, slot %d, winpid %p, handle %p",
- vchild->pid, nchildren, vchild->dwProcessId,
- vchild->hProcess);
- nchildren++;
-
- wake_wait_subproc ();
- break;
-
- /* A child process had terminated.
- Possibly this is just due to an exec(). Cygwin implements an exec()
- as a "handoff" from one windows process to another. If child->hProcess
- is different from what is recorded in hchildren, then this is an exec().
- Otherwise this is a normal child termination event.
- (called from wait_subproc thread) */
- case PROC_CHILDTERMINATED:
- if (hchildren[val] != pchildren[val]->hProcess)
- {
- sigproc_printf ("pid %d[%d], reparented old hProcess %p, new %p",
- pchildren[val]->pid, val, hchildren[val], pchildren[val]->hProcess);
- HANDLE h = hchildren[val];
- hchildren[val] = pchildren[val]->hProcess; /* Filled out by child */
- sync_proc_subproc->release (); // Release the lock ASAP
- ForceCloseHandle1 (h, childhProc);
- ProtectHandle1 (pchildren[val]->hProcess, childhProc);
- rc = 0;
- goto out; // This was an exec()
- }
-
- sigproc_printf ("pid %d[%d] terminated, handle %p, nchildren %d, nzombies %d",
- pchildren[val]->pid, val, hchildren[val], nchildren, nzombies);
-
- int thiszombie;
- thiszombie = nzombies;
- zombies[nzombies] = pchildren[val]; // Add to zombie array
- zombies[nzombies++]->process_state = PID_ZOMBIE;// Walking dead
-
- sigproc_printf ("zombifying [%d], pid %d, handle %p, nchildren %d",
- val, pchildren[val]->pid, hchildren[val], nchildren);
- if ((int) val < --nchildren)
- {
- hchildren[val] = hchildren[nchildren];
- pchildren[val] = pchildren[nchildren];
- }
-
- /* See if we should care about the this terminated process. If we've
- filled up our table or if we're ignoring SIGCHLD, then we immediately
- remove the process and move on. Otherwise, this process becomes a zombie
- which must be reaped by a wait() call. */
- if (nzombies >= NZOMBIES
- || myself->getsig (SIGCHLD).sa_handler == (void *) SIG_IGN)
- {
- sigproc_printf ("automatically removing zombie %d", thiszombie);
- remove_zombie (thiszombie);
- }
-
- /* Don't scan the wait queue yet. Caller will send SIGCHLD to this process.
- This will cause an eventual scan of waiters. */
- break;
-
- /* Handle a wait4() operation. Allocates an event for the calling
- * thread which is signaled when the appropriate pid exits or stops.
- * (usually called from the main thread)
- */
- case PROC_WAIT:
- wval->ev = NULL; // Don't know event flag yet
-
- if (wval->pid <= 0)
- child = NULL; // Not looking for a specific pid
- else if (!mychild (wval->pid))
- goto out; // invalid pid. flag no such child
-
- wval->status = 0; // Don't know status yet
- sigproc_printf ("wval->pid %d, wval->options %d", wval->pid, wval->options);
-
- /* If the first time for this thread, create a new event, otherwise
- * reset the event.
- */
- if ((wval->ev = wval->thread_ev) == NULL)
- {
- wval->ev = wval->thread_ev = CreateEvent (&sec_none_nih, TRUE,
- FALSE, NULL);
- ProtectHandle (wval->ev);
- }
-
- ResetEvent (wval->ev);
- w = waitq_head.next;
- waitq_head.next = wval; /* Add at the beginning. */
- wval->next = w; /* Link in rest of the list. */
- clearing = 0;
- goto scan_wait;
-
- /* Clear all waiting threads. Called from exceptions.cc prior to
- * the main thread's dispatch to a signal handler function.
- * (called from wait_sig thread)
- */
- case PROC_CLEARWAIT:
- /* Clear all "wait"ing threads. */
- if (val)
- sigproc_printf ("clear waiting threads");
- else
- sigproc_printf ("looking for processes to reap");
- clearing = val;
-
- scan_wait:
- /* Scan the linked list of wait()ing threads. If a wait's parameters
- * match this pid, then activate it.
- */
- for (w = &waitq_head; w->next != NULL; w = w->next)
- {
- if ((potential_match = checkstate (w)) > 0)
- sigproc_printf ("released waiting thread");
- else if (!clearing && !(w->next->options & WNOHANG) && potential_match < 0)
- sigproc_printf ("only found non-terminated children");
- else if (potential_match <= 0) // nothing matched
- {
- sigproc_printf ("waiting thread found no children");
- HANDLE oldw = w->next->ev;
- w->next->pid = 0;
- if (clearing)
- w->next->status = -1; /* flag that a signal was received */
- else if (!potential_match || !(w->next->options & WNOHANG))
- w->next->ev = NULL;
- if (!SetEvent (oldw))
- system_printf ("couldn't wake up wait event %p, %E", oldw);
- w->next = w->next->next;
- }
- if (w->next == NULL)
- break;
- }
-
- if (!clearing)
- sigproc_printf ("finished processing terminated/stopped child");
- else
- {
- waitq_head.next = NULL;
- sigproc_printf ("finished clearing");
- }
- break;
- }
-
-out:
- sync_proc_subproc->release (); // Release the lock
-out1:
- sigproc_printf ("returning %d", rc);
- return rc;
-}
-
-/* Terminate the wait_subproc thread.
- * Called on process exit.
- * Also called by spawn_guts to disassociate any subprocesses from this
- * process. Subprocesses will then know to clean up after themselves and
- * will not become zombies.
- */
-void __stdcall
-proc_terminate (void)
-{
- sigproc_printf ("nchildren %d, nzombies %d", nchildren, nzombies);
- /* Signal processing is assumed to be blocked in this routine. */
- if (hwait_subproc)
- {
- int rc;
- proc_loop_wait = 0; // Tell wait_subproc thread to exit
- wake_wait_subproc (); // Wake wait_subproc loop
-
- /* Wait for wait_subproc thread to exit (but not *too* long) */
- if ((rc = WaitForSingleObject (hwait_subproc, WWSP)) != WAIT_OBJECT_0)
- if (rc == WAIT_TIMEOUT)
- system_printf ("WFSO(hwait_subproc) timed out");
- else
- system_printf ("WFSO(hwait_subproc), rc %d, %E", rc);
-
- HANDLE h = hwait_subproc;
- hwait_subproc = NULL;
- ForceCloseHandle1 (h, hwait_subproc);
-
- sync_proc_subproc->acquire(WPSP);
- (void) proc_subproc (PROC_CLEARWAIT, 1);
-
- /* Clean out zombie processes from the pid list. */
- int i;
- for (i = 0; i < nzombies; i++)
- {
- if (zombies[i]->hProcess)
- {
- ForceCloseHandle1 (zombies[i]->hProcess, childhProc);
- ForceCloseHandle1 (zombies[i]->pid_handle, pid_handle);
- }
- zombies[i]->process_state = PID_EXITED; /* CGF FIXME - still needed? */
- zombies[i].release(); // FIXME: this breaks older gccs for some reason
- }
-
- /* Disassociate my subprocesses */
- for (i = 0; i < nchildren; i++)
- {
- if (!pchildren[i]->hProcess)
- sigproc_printf ("%d(%d) hProcess cleared already?", pchildren[i]->pid,
- pchildren[i]->dwProcessId);
- else
- {
- ForceCloseHandle1 (pchildren[i]->hProcess, childhProc);
- sigproc_printf ("%d(%d) closed child handle", pchildren[i]->pid,
- pchildren[i]->dwProcessId);
- pchildren[i]->ppid = 1;
- if (pchildren[i]->pgid == myself->pid)
- pchildren[i]->process_state |= PID_ORPHANED;
- }
- pchildren[i].release ();
- }
- nchildren = nzombies = 0;
- /* Just zero sync_proc_subproc as the delete below seems to cause
- problems for older gccs. */
- sync_proc_subproc = NULL;
- }
- sigproc_printf ("leaving");
-}
-
-/* Clear pending signal from the sigtodo array
- */
-void __stdcall
-sig_clear (int sig)
-{
- (void) InterlockedExchange (myself->getsigtodo (sig), 0L);
- return;
-}
-
-/* Force the wait_sig thread to wake up and scan the sigtodo array.
- */
-extern "C" int __stdcall
-sig_dispatch_pending (int justwake)
-{
- if (!hwait_sig)
- return 0;
-
- int was_pending = pending_signals;
-#ifdef DEBUGGING
- sigproc_printf ("pending_signals %d", was_pending);
-#endif
- if (!was_pending && !justwake)
-#ifdef DEBUGGING
- sigproc_printf ("no need to wake anything up");
-#else
- ;
-#endif
- else
- {
- wait_for_me ();
- if (!justwake)
- (void) sig_send (myself, __SIGFLUSH);
- else if (ReleaseSemaphore (sigcatch_nosync, 1, NULL))
-#ifdef DEBUGGING
- sigproc_printf ("woke up wait_sig");
-#else
- ;
-#endif
- else if (no_signals_available ())
- /*sigproc_printf ("I'm going away now")*/;
- else
- system_printf ("%E releasing sigcatch_nosync(%p)", sigcatch_nosync);
-
- }
- return was_pending;
-}
-
-/* Message initialization. Called from dll_crt0_1
- *
- * This routine starts the signal handling thread. The wait_sig_inited
- * event is used to signal that the thread is ready to handle signals.
- * We don't wait for this during initialization but instead detect it
- * in sig_send to gain a little concurrency.
- */
-void __stdcall
-sigproc_init ()
-{
- wait_sig_inited = CreateEvent (&sec_none_nih, TRUE, FALSE, NULL);
- ProtectHandle (wait_sig_inited);
-
- /* local event signaled when main thread has been dispatched
- to a signal handler function. */
- signal_arrived = CreateEvent(&sec_none_nih, TRUE, FALSE, NULL);
- ProtectHandle (signal_arrived);
-
- if (!(hwait_sig = makethread (wait_sig, NULL, 0, "sig")))
- {
- system_printf ("cannot create wait_sig thread, %E");
- api_fatal ("terminating");
- }
-
- ProtectHandle (hwait_sig);
-
- /* sync_proc_subproc is used by proc_subproc. It serialises
- * access to the children and zombie arrays.
- */
- new_muto (sync_proc_subproc);
-
- /* Initialize waitq structure for main thread. A waitq structure is
- * allocated for each thread that executes a wait to allow multiple threads
- * to perform waits. Pre-allocate a waitq structure for the main thread.
- */
- waitq *w;
- if ((w = (waitq *)waitq_storage.get ()) == NULL)
- {
- w = &waitq_main;
- waitq_storage.set (w);
- }
- memset (w, 0, sizeof *w); // Just to be safe
-
- myself->getsig (SIGSTOP).sa_flags = SA_RESTART | SA_NODEFER;
- sigproc_printf ("process/signal handling enabled(%x)", myself->process_state);
- return;
-}
-
-/* Called on process termination to terminate signal and process threads.
- */
-void __stdcall
-sigproc_terminate (void)
-{
- HANDLE h = hwait_sig;
- hwait_sig = NULL;
-
- if (GetCurrentThreadId () == sigtid)
- {
- ForceCloseHandle (sigcomplete_main);
- for (int i = 0; i < 20; i++)
- (void) ReleaseSemaphore (sigcomplete_nonmain, 1, NULL);
- // ForceCloseHandle (sigcomplete_nonmain);
- // ForceCloseHandle (sigcatch_main);
- // ForceCloseHandle (sigcatch_nonmain);
- // ForceCloseHandle (sigcatch_nosync);
- }
- proc_terminate (); // Terminate process handling thread
-
- if (!sig_loop_wait)
- sigproc_printf ("sigproc_terminate: sigproc handling not active");
- else
- {
- sigproc_printf ("entering");
- sig_loop_wait = 0; // Tell wait_sig to exit when it is
- // finished with anything it is doing
- // sig_dispatch_pending (TRUE); // wake up and die
- /* In case of a sigsuspend */
- // SetEvent (signal_arrived);
-
- /* If !hwait_sig, then the process probably hasn't even finished
- * its initialization phase.
- */
- if (0 && hwait_sig)
- {
- if (GetCurrentThreadId () != sigtid)
- WaitForSingleObject (h, 10000);
- ForceCloseHandle1 (h, hwait_sig);
-
-
- if (GetCurrentThreadId () != sigtid)
- {
- ForceCloseHandle (sigcomplete_main);
- ForceCloseHandle (sigcomplete_nonmain);
- ForceCloseHandle (sigcatch_main);
- ForceCloseHandle (sigcatch_nonmain);
- ForceCloseHandle (sigcatch_nosync);
- }
- }
- sigproc_printf ("done");
- }
-
-#if 0
- /* Set this so that subsequent tests will succeed. */
- if (!myself->dwProcessId)
- myself->dwProcessId = GetCurrentProcessId ();
-#endif
-
- return;
-}
-
-/* Send a signal to another process by raising its signal semaphore.
- * If pinfo *p == NULL, send to the current process.
- * If sending to this process, wait for notification that a signal has
- * completed before returning.
- */
-int __stdcall
-sig_send (_pinfo *p, int sig, DWORD ebp, bool exception)
-{
- int rc = 1;
- DWORD tid = GetCurrentThreadId ();
- BOOL its_me;
- HANDLE thiscatch = NULL;
- HANDLE thiscomplete = NULL;
- BOOL wait_for_completion;
- sigframe thisframe;
-
- if (p == myself_nowait_nonmain)
- p = (tid == mainthread.id) ? (_pinfo *) myself : myself_nowait;
- if (!(its_me = (p == NULL || p == myself || p == myself_nowait)))
- wait_for_completion = FALSE;
- else
- {
- if (no_signals_available ())
- goto out; // Either exiting or not yet initializing
- wait_for_me ();
- wait_for_completion = p != myself_nowait;
- p = myself;
- }
-
- /* It is possible that the process is not yet ready to receive messages
- * or that it has exited. Detect this.
- */
- if (!proc_can_be_signalled (p)) /* Is the process accepting messages? */
- {
- sigproc_printf ("invalid pid %d(%x), signal %d",
- p->pid, p->process_state, sig);
- set_errno (ESRCH);
- goto out;
- }
-
- sigproc_printf ("pid %d, signal %d, its_me %d", p->pid, sig, its_me);
-
- if (its_me)
- {
- if (!wait_for_completion)
- thiscatch = sigcatch_nosync;
- else if (tid != mainthread.id)
- {
- thiscatch = sigcatch_nonmain;
- thiscomplete = sigcomplete_nonmain;
- }
- else
- {
- thiscatch = sigcatch_main;
- thiscomplete = sigcomplete_main;
- thisframe.set (mainthread, ebp, exception);
- }
- }
- else if (!(thiscatch = getsem (p, "sigcatch", 0, 0)))
- goto out; // Couldn't get the semaphore. getsem issued
- // an error, if appropriate.
-
-#if WHEN_MULTI_THREAD_SIGNALS_WORK
- signal_dispatch *sd;
- sd = signal_dispatch_storage.get ();
- if (sd == NULL)
- sd = signal_dispatch_storage.create ();
-#endif
-
- /* Increment the sigtodo array to signify which signal to assert.
- */
- (void) InterlockedIncrement (p->getsigtodo (sig));
-
- /* Notify the process that a signal has arrived.
- */
- SetLastError (0);
-
-#if 0
- int prio;
- prio = GetThreadPriority (GetCurrentThread ());
- (void) SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_TIME_CRITICAL);
-#endif
-
- if (!ReleaseSemaphore (thiscatch, 1, NULL) && (int) GetLastError () > 0)
- {
- /* Couldn't signal the semaphore. This probably means that the
- * process is exiting.
- */
- if (!its_me)
- ForceCloseHandle (thiscatch);
- else
- {
- if (no_signals_available ())
- sigproc_printf ("I'm going away now");
- else if ((int) GetLastError () == -1)
- rc = WaitForSingleObject (thiscomplete, 500);
- else
- system_printf ("error sending signal %d to pid %d, semaphore %p, %E",
- sig, p->pid, thiscatch);
- }
- goto out;
- }
-
- /* No need to wait for signal completion unless this was a signal to
- * this process.
- *
- * If it was a signal to this process, wait for a dispatched signal.
- * Otherwise just wait for the wait_sig to signal that it has finished
- * processing the signal.
- */
- if (!wait_for_completion)
- {
- rc = WAIT_OBJECT_0;
- sigproc_printf ("Not waiting for sigcomplete. its_me %d signal %d", its_me, sig);
- if (!its_me)
- ForceCloseHandle (thiscatch);
- }
- else
- {
- sigproc_printf ("Waiting for thiscomplete %p", thiscomplete);
-
- SetLastError (0);
- rc = WaitForSingleObject (thiscomplete, WSSC);
- /* Check for strangeness due to this thread being redirected by the
- signal handler. Sometimes a WAIT_TIMEOUT will occur when the
- thread hasn't really timed out. So, check again.
- FIXME: This isn't foolproof. */
- if (rc != WAIT_OBJECT_0 &&
- WaitForSingleObject (thiscomplete, 0) == WAIT_OBJECT_0)
- rc = WAIT_OBJECT_0;
- }
-
-#if 0
- SetThreadPriority (GetCurrentThread (), prio);
-#endif
-
- if (rc == WAIT_OBJECT_0)
- rc = 0; // Successful exit
- else
- {
- /* It's an error unless sig_loop_wait == 0 (the process is exiting). */
- if (!no_signals_available ())
- system_printf ("wait for sig_complete event failed, signal %d, rc %d, %E",
- sig, rc);
- set_errno (ENOSYS);
- rc = -1;
- }
-
-out:
- sigproc_printf ("returning %d from sending signal %d", rc, sig);
- return rc;
-}
-
-/* Set pending signal from the sigtodo array
- */
-void __stdcall
-sig_set_pending (int sig)
-{
- (void) InterlockedIncrement (myself->getsigtodo (sig));
- return;
-}
-
-/* Initialize the wait_subproc thread.
- * Called from fork() or spawn() to initialize the handling of subprocesses.
- */
-void __stdcall
-subproc_init (void)
-{
- if (hwait_subproc)
- return;
-
- /* A "wakeup" handle which can be toggled to make wait_subproc reexamine
- * the hchildren array.
- */
- events[0] = CreateEvent (&sec_none_nih, FALSE, FALSE, NULL);
- if (!(hwait_subproc = makethread (wait_subproc, NULL, 0, "proc")))
- system_printf ("cannot create wait_subproc thread, %E");
- ProtectHandle (events[0]);
- ProtectHandle (hwait_subproc);
- sigproc_printf ("started wait_subproc thread %p", hwait_subproc);
-}
-
-/* Initialize some of the memory block passed to child processes
- by fork/spawn/exec. */
-
-void __stdcall
-init_child_info (DWORD chtype, child_info *ch, pid_t pid, HANDLE subproc_ready)
-{
- memset (ch, 0, sizeof *ch);
- ch->cb = chtype == PROC_FORK ? sizeof (child_info_fork) : sizeof (child_info);
- ch->intro = PROC_MAGIC_GENERIC;
- ch->magic = CHILD_INFO_MAGIC;
- ch->type = chtype;
- ch->cygpid = pid;
- ch->subproc_ready = subproc_ready;
- ch->pppid_handle = myself->ppid_handle;
- ch->fhandler_union_cb = sizeof (fhandler_union);
-}
-
-/* Check the state of all of our children to see if any are stopped or
- * terminated.
- */
-static int __stdcall
-checkstate (waitq *parent_w)
-{
- int potential_match = 0;
-
- sigproc_printf ("nchildren %d, nzombies %d", nchildren, nzombies);
-
- /* Check already dead processes first to see if they match the criteria
- * given in w->next.
- */
- for (int i = 0; i < nzombies; i++)
- switch (stopped_or_terminated (parent_w, zombies[i]))
- {
- case -1:
- potential_match = -1;
- break;
- case 1:
- remove_zombie (i);
- potential_match = 1;
- goto out;
- }
-
- sigproc_printf ("checking alive children");
-
- /* No dead terminated children matched. Check for stopped children. */
- for (int i = 0; i < nchildren; i++)
- switch (stopped_or_terminated (parent_w, pchildren[i]))
- {
- case -1:
- potential_match = -1;
- break;
- case 1:
- potential_match = 1;
- goto out;
- }
-
-out:
- sigproc_printf ("returning %d", potential_match);
- return potential_match;
-}
-
-/* Get or create a process specific semaphore used in message passing.
- */
-static HANDLE __stdcall
-getsem (_pinfo *p, const char *str, int init, int max)
-{
- HANDLE h;
-
- if (p != NULL)
- {
- if (!proc_can_be_signalled (p))
- {
- set_errno (ESRCH);
- return NULL;
- }
- int wait = 1000;
- /* Wait for new process to generate its semaphores. */
- sigproc_printf ("pid %d, ppid %d, wait %d, initializing %x", p->pid, p->ppid, wait,
- ISSTATE (p, PID_INITIALIZING));
- for (int i = 0; ISSTATE (p, PID_INITIALIZING) && i < wait; i++)
- Sleep (1);
- }
-
- SetLastError (0);
- if (p == NULL)
- {
- char sa_buf[1024];
-
- DWORD winpid = GetCurrentProcessId ();
- h = CreateSemaphore (sec_user_nih (sa_buf), init, max,
- str = shared_name (str, winpid));
- p = myself;
- if (!h)
- {
- system_printf ("can't create semaphore %s, %E", str);
- __seterrno ();
- }
- }
- else
- {
- h = OpenSemaphore (SEMAPHORE_ALL_ACCESS, FALSE,
- shared_name (str, p->dwProcessId));
-
- if (!h)
- {
- if (GetLastError () == ERROR_FILE_NOT_FOUND && !proc_exists (p))
- set_errno (ESRCH); /* No such process */
- else
- set_errno (EPERM); /* Couldn't access the semaphore --
- different cygwin DLL maybe? */
- }
- }
-
- return h;
-}
-
-/* Remove a zombie from zombies by swapping it with the last child in the list.
- */
-static void __stdcall
-remove_zombie (int ci)
-{
- sigproc_printf ("removing %d, pid %d, nzombies %d", ci, zombies[ci]->pid,
- nzombies);
-
- if (zombies[ci])
- {
- ForceCloseHandle1 (zombies[ci]->hProcess, childhProc);
- ForceCloseHandle1 (zombies[ci]->pid_handle, pid_handle);
- zombies[ci].release ();
- }
-
- if (ci < --nzombies)
- zombies[ci] = zombies[nzombies];
-
- return;
-}
-
-/* Check status of child process vs. waitq member.
- *
- * parent_w is the pointer to the parent of the waitq member in question.
- * child is the subprocess being considered.
- *
- * Returns
- * 1 if stopped or terminated child matches parent_w->next criteria
- * -1 if a non-stopped/terminated child matches parent_w->next criteria
- * 0 if child does not match parent_w->next criteria
- */
-static int __stdcall
-stopped_or_terminated (waitq *parent_w, _pinfo *child)
-{
- int potential_match;
- waitq *w = parent_w->next;
-
- sigproc_printf ("considering pid %d", child->pid);
- if (w->pid == -1)
- potential_match = 1;
- else if (w->pid == 0)
- potential_match = child->pgid == myself->pgid;
- else if (w->pid < 0)
- potential_match = child->pgid == -w->pid;
- else
- potential_match = (w->pid == child->pid);
-
- if (!potential_match)
- return 0;
-
- BOOL terminated;
-
- if ((terminated = child->process_state == PID_ZOMBIE) ||
- ((w->options & WUNTRACED) && child->stopsig))
- {
- parent_w->next = w->next; /* successful wait. remove from wait queue */
- w->pid = child->pid;
-
- if (!terminated)
- {
- sigproc_printf ("stopped child");
- w->status = (child->stopsig << 8) | 0x7f;
- child->stopsig = 0;
- }
- else /* Should only get here when child has been moved to the zombies array */
- {
- DWORD status;
- if (!GetExitCodeProcess (child->hProcess, &status))
- status = 0xffff;
- if (status & EXIT_SIGNAL)
- w->status = (status >> 8) & 0xff; /* exited due to signal */
- else
- w->status = (status & 0xff) << 8; /* exited via "exit ()" */
-
- add_rusage (&myself->rusage_children, &child->rusage_children);
- add_rusage (&myself->rusage_children, &child->rusage_self);
-
- if (w->rusage)
- {
- add_rusage ((struct rusage *) w->rusage, &child->rusage_children);
- add_rusage ((struct rusage *) w->rusage, &child->rusage_self);
- }
- }
-
- if (!SetEvent (w->ev)) /* wake up wait4 () immediately */
- system_printf ("couldn't wake up wait event %p, %E", w->ev);
- return 1;
- }
-
- return -potential_match;
-}
-
-/* Process signals by waiting for a semaphore to become signaled.
- * Then scan an in-memory array representing queued signals.
- * Executes in a separate thread.
- *
- * Signals sent from this process are sent a completion signal so
- * that returns from kill/raise do not occur until the signal has
- * has been handled, as per POSIX.
- */
-static DWORD WINAPI
-wait_sig (VOID *)
-{
- /* Initialization */
- (void) SetThreadPriority (hwait_sig, WAIT_SIG_PRIORITY);
-
- /* sigcatch_nosync - semaphore incremented by sig_dispatch_pending and
- * by foreign processes to force an examination of
- * the sigtodo array.
- * sigcatch_main - ditto for local main thread.
- * sigcatch_nonmain - ditto for local non-main threads.
- *
- * sigcomplete_main - event used to signal main thread on signal
- * completion
- * sigcomplete_nonmain - semaphore signaled for non-main thread on signal
- * completion
- */
- sigcatch_nosync = getsem (NULL, "sigcatch", 0, MAXLONG);
- sigcatch_nonmain = CreateSemaphore (&sec_none_nih, 0, MAXLONG, NULL);
- sigcatch_main = CreateSemaphore (&sec_none_nih, 0, MAXLONG, NULL);
- sigcomplete_nonmain = CreateSemaphore (&sec_none_nih, 0, MAXLONG, NULL);
- sigcomplete_main = CreateEvent (&sec_none_nih, FALSE, FALSE, NULL);
- sigproc_printf ("sigcatch_nonmain %p, sigcatch_main %p", sigcatch_nonmain, sigcatch_main);
-
- /* Setting dwProcessId flags that this process is now capable of receiving
- * signals. Prior to this, dwProcessId was set to the windows pid of
- * of the original windows process which spawned us unless this was a
- * "toplevel" process.
- */
- myself->dwProcessId = GetCurrentProcessId ();
- myself->process_state |= PID_ACTIVE;
- myself->process_state &= ~PID_INITIALIZING;
-
- ProtectHandle (sigcatch_nosync);
- ProtectHandle (sigcatch_nonmain);
- ProtectHandle (sigcatch_main);
- ProtectHandle (sigcomplete_nonmain);
- ProtectHandle (sigcomplete_main);
-
- /* If we've been execed, then there is still a stub left in the previous
- * windows process waiting to see if it's started a cygwin process or not.
- * Signalling subproc_ready indicates that we are a cygwin process.
- */
- if (child_proc_info && child_proc_info->type == PROC_EXEC)
- {
- debug_printf ("subproc_ready %p", child_proc_info->subproc_ready);
- if (!SetEvent (child_proc_info->subproc_ready))
- system_printf ("SetEvent (subproc_ready) failed, %E");
- ForceCloseHandle (child_proc_info->subproc_ready);
- /* Initialize an "indirect" pid block so that if someone looks up this
- process via its Windows PID it will be redirected to the appropriate
- Cygwin PID shared memory block. */
- static pinfo NO_COPY myself_identity;
- myself_identity.init (cygwin_pid (myself->dwProcessId), PID_EXECED);
- }
-
- SetEvent (wait_sig_inited);
- sigtid = GetCurrentThreadId ();
-
- HANDLE catchem[] = {sigcatch_main, sigcatch_nonmain, sigcatch_nosync};
- sigproc_printf ("Ready. dwProcessid %d", myself->dwProcessId);
- for (;;)
- {
- DWORD rc = WaitForMultipleObjects (3, catchem, FALSE, sig_loop_wait);
-
- /* sigproc_terminate sets sig_loop_wait to zero to indicate that
- * this thread should terminate.
- */
- if (rc == WAIT_TIMEOUT)
- {
- if (!sig_loop_wait)
- break; // Exiting
- else
- continue;
- }
-
- if (rc == WAIT_FAILED)
- {
- if (sig_loop_wait != 0)
- system_printf ("WFMO failed, %E");
- break;
- }
-
- rc -= WAIT_OBJECT_0;
- sigproc_printf ("awake");
- /* A sigcatch semaphore has been signaled. Scan the sigtodo
- * array looking for any unprocessed signals.
- */
- pending_signals = -1;
- int saw_pending_signals = 0;
- int saw_sigchld = 0;
- int dispatched_sigchld = 0;
- for (int sig = -__SIGOFFSET; sig < NSIG; sig++)
- {
- while (InterlockedDecrement (myself->getsigtodo (sig)) >= 0)
- {
- if (sig == SIGCHLD)
- saw_sigchld = 1;
-
- if (sig > 0 && sig != SIGKILL && sig != SIGSTOP &&
- (sigismember (&myself->getsigmask (), sig) ||
- main_vfork->pid ||
- (sig != SIGCONT && ISSTATE (myself, PID_STOPPED))))
- {
- sigproc_printf ("signal %d blocked", sig);
- break;
- }
-
- /* Found a signal to process */
- sigproc_printf ("processing signal %d", sig);
- switch (sig)
- {
- case __SIGFLUSH:
- /* just forcing the loop */
- break;
-
- /* Internal signal to turn on stracing. */
- case __SIGSTRACE:
- strace.hello ();
- break;
-
- /* A normal UNIX signal */
- default:
- sigproc_printf ("Got signal %d", sig);
- int wasdispatched = sig_handle (sig, rc != 2);
- if (sig == SIGCHLD && wasdispatched)
- dispatched_sigchld = 1;
- /* Need to decrement again to offset increment below since
- we really do want to decrement in this case. */
- InterlockedDecrement (myself->getsigtodo (sig));
- goto nextsig; /* FIXME: shouldn't this allow the loop to continue? */
- }
- }
-
- nextsig:
- /* Decremented too far. */
- if (InterlockedIncrement (myself->getsigtodo (sig)) > 0)
- saw_pending_signals = 1;
- }
-
- if (pending_signals < 0 && !saw_pending_signals)
- pending_signals = 0;
-
- if (saw_sigchld)
- proc_subproc (PROC_CLEARWAIT, 0);
-
- /* Signal completion of signal handling depending on which semaphore
- * woke up the WaitForMultipleObjects above.
- */
- switch (rc)
- {
- case 0:
- SetEvent (sigcomplete_main);
- sigproc_printf ("set main thread completion event");
- break;
- case 1:
- ReleaseSemaphore (sigcomplete_nonmain, 1, NULL);
- break;
- default:
- /* Signal from another process. No need to synchronize. */
- break;
- }
- sigproc_printf ("looping");
- }
-
- sigproc_printf ("done");
- return 0;
-}
-
-/* Wait for subprocesses to terminate. Executes in a separate thread. */
-static DWORD WINAPI
-wait_subproc (VOID *)
-{
- sigproc_printf ("starting");
- int errloop = 0;
-
- for (;;)
- {
- DWORD rc = WaitForMultipleObjects (nchildren + 1, events, FALSE,
- proc_loop_wait);
- if (rc == WAIT_TIMEOUT)
- if (!proc_loop_wait)
- break; // Exiting
- else
- continue;
-
- if (rc == WAIT_FAILED)
- {
- if (!proc_loop_wait)
- break;
-
- /* It's ok to get an ERROR_INVALID_HANDLE since another thread may have
- closed a handle in the children[] array. So, we try looping a couple
- of times to stabilize. FIXME - this is not foolproof. Probably, this
- thread should be responsible for closing the children. */
- if (!errloop++)
- proc_subproc (PROC_NOTHING, 0); // Just synchronize and continue
- if (errloop < 10)
- continue;
-
- system_printf ("wait failed. nchildren %d, wait %d, %E",
- nchildren, proc_loop_wait);
-
- for (int i = 0; i <= nchildren; i++)
- if ((rc = WaitForSingleObject (events[i], 0)) == WAIT_OBJECT_0 ||
- rc == WAIT_TIMEOUT)
- continue;
- else if (i == 0)
- system_printf ("nchildren %d, event[%d] %p, %E", nchildren, i, events[i]);
- else
- {
- system_printf ("nchildren %d, event[%d] %p, pchildren[%d] %p, events[0] %p, %E",
- nchildren, i, events[i], i - 1, (_pinfo *) pchildren[i - 1], events[0]);
- system_printf ("pid %d, dwProcessId %u, hProcess %p, progname '%s'",
- pchildren[i - 1]->pid, pchildren[i - 1]->dwProcessId,
- pchildren[i - 1]->hProcess, pchildren[i - 1]->progname);
- }
- break;
- }
-
- errloop = 0;
- rc -= WAIT_OBJECT_0;
- if (rc-- != 0)
- {
- rc = proc_subproc (PROC_CHILDTERMINATED, rc);
- if (!proc_loop_wait) // Don't bother if wait_subproc is
- break; // exiting
-
- /* Send a SIGCHLD to myself. We do this here, rather than in proc_subproc
- to avoid the proc_subproc lock since the signal thread will eventually
- be calling proc_subproc and could unnecessarily block. */
- if (rc)
- sig_send (myself_nowait, SIGCHLD);
- }
- sigproc_printf ("looping");
- }
-
- ForceCloseHandle (events[0]);
- events[0] = NULL;
- sigproc_printf ("done");
- return 0;
-}
-
-extern "C" {
-/* Provide a stack frame when calling WaitFor* functions */
-
-#undef WaitForSingleObject
-
-DWORD __stdcall
-WFSO (HANDLE hHandle, DWORD dwMilliseconds)
-{
- DWORD ret;
- sigframe thisframe (mainthread);
- ret = WaitForSingleObject (hHandle, dwMilliseconds);
- return ret;
-}
-
-#undef WaitForMultipleObjects
-
-DWORD __stdcall
-WFMO (DWORD nCount, CONST HANDLE *lpHandles, BOOL fWaitAll, DWORD dwMilliseconds)
-{
- DWORD ret;
- sigframe thisframe (mainthread);
- ret = WaitForMultipleObjects (nCount, lpHandles, fWaitAll, dwMilliseconds);
- return ret;
-}
-}
diff --git a/winsup/cygwin/sigproc.h b/winsup/cygwin/sigproc.h
deleted file mode 100644
index 0960efae2..000000000
--- a/winsup/cygwin/sigproc.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* sigproc.h
-
- Copyright 1997, 1998, 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. */
-
-#ifndef _SIGPROC_H
-#define _SIGPROC_H
-#include <signal.h>
-
-#define EXIT_SIGNAL 0x010000
-#define EXIT_REPARENTING 0x020000
-#define EXIT_NOCLOSEALL 0x040000
-
-enum procstuff
-{
- PROC_ADDCHILD = 1, // add a new subprocess to list
- PROC_CHILDTERMINATED = 2, // a child died
- PROC_CLEARWAIT = 3, // clear all waits - signal arrived
- PROC_WAIT = 4, // setup for wait() for subproc
- PROC_NOTHING = 5 // nothing, really
-};
-
-typedef struct struct_waitq
-{
- int pid;
- int options;
- int status;
- HANDLE ev;
- void *rusage; /* pointer to potential rusage */
- struct struct_waitq *next;
- HANDLE thread_ev;
-} waitq;
-
-struct sigthread
-{
- DWORD id;
- DWORD frame;
- CRITICAL_SECTION lock;
- LONG winapi_lock;
- BOOL exception;
- bool get_winapi_lock (int test = 0);
- void release_winapi_lock ();
- void init (const char *s);
-};
-
-class sigframe
-{
-private:
- sigthread *st;
- inline bool unregister ()
- {
- if (!st)
- return 0;
- EnterCriticalSection (&st->lock);
- st->frame = 0;
- st->exception = 0;
- st->release_winapi_lock ();
- LeaveCriticalSection (&st->lock);
- st = NULL;
- return 1;
- }
-
-public:
- inline void set (sigthread &t, DWORD ebp, bool is_exception = 0)
- {
- DWORD oframe = t.frame;
- st = &t;
- t.frame = ebp;
- t.exception = is_exception;
- if (!oframe)
- t.get_winapi_lock ();
- }
- inline void init (sigthread &t, DWORD ebp = (DWORD) __builtin_frame_address (0))
- {
- if (!t.frame && t.id == GetCurrentThreadId ())
- set (t, ebp);
- else
- st = NULL;
- }
-
- sigframe (): st (NULL) {}
- sigframe (sigthread &t, DWORD ebp = (DWORD) __builtin_frame_address (0)) {init (t, ebp);}
- ~sigframe ()
- {
- unregister ();
- }
-
- int call_signal_handler ();
-};
-
-extern sigthread mainthread;
-extern HANDLE signal_arrived;
-
-BOOL __stdcall my_parent_is_alive ();
-extern "C" int __stdcall sig_dispatch_pending (int force = FALSE);
-extern "C" void __stdcall set_process_mask (sigset_t newmask);
-extern "C" void __stdcall reset_signal_arrived ();
-int __stdcall sig_handle (int, bool);
-void __stdcall sig_clear (int);
-void __stdcall sig_set_pending (int);
-int __stdcall handle_sigsuspend (sigset_t);
-
-int __stdcall proc_subproc (DWORD, DWORD);
-
-class _pinfo;
-void __stdcall proc_terminate ();
-void __stdcall sigproc_init ();
-void __stdcall subproc_init ();
-void __stdcall sigproc_terminate ();
-BOOL __stdcall proc_exists (_pinfo *) __attribute__ ((regparm(1)));
-BOOL __stdcall pid_exists (pid_t) __attribute__ ((regparm(1)));
-int __stdcall sig_send (_pinfo *, int, DWORD ebp = (DWORD) __builtin_frame_address (0),
- bool exception = 0) __attribute__ ((regparm(3)));
-void __stdcall signal_fixup_after_fork ();
-void __stdcall signal_fixup_after_exec (bool);
-
-extern char myself_nowait_dummy[];
-extern char myself_nowait_nonmain_dummy[];
-
-#define WAIT_SIG_EXITING (WAIT_OBJECT_0 + 1)
-
-#define myself_nowait ((_pinfo *)myself_nowait_dummy)
-#define myself_nowait_nonmain ((_pinfo *)myself_nowait_nonmain_dummy)
-#endif /*_SIGPROC_H*/
diff --git a/winsup/cygwin/smallprint.c b/winsup/cygwin/smallprint.c
deleted file mode 100644
index 247fcf942..000000000
--- a/winsup/cygwin/smallprint.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/* smallprint.c: small print routines for WIN32
-
- Copyright 1996, 1998, 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. */
-
-#include "winsup.h"
-#include <stdarg.h>
-#include <stdlib.h>
-#include <ctype.h>
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-int __small_sprintf (char *dst, const char *fmt,...);
-int __small_vsprintf (char *dst, const char *fmt, va_list ap);
-
-static char *
-rn (char *dst, int base, int dosign, long long val, int len, int pad)
-{
- /* longest number is ULLONG_MAX, 18446744073709551615, 20 digits */
- unsigned uval;
- char res[20];
- static const char str[16] = "0123456789ABCDEF";
- int l = 0;
-
- if (dosign && val < 0)
- {
- *dst++ = '-';
- uval = -val;
- }
- else if (dosign > 0 && val > 0)
- {
- *dst++ = '+';
- uval = val;
- }
- else
- {
- uval = val;
- }
-
- do
- {
- res[l++] = str[uval % base];
- uval /= base;
- }
- while (uval);
-
- while (len -- > l)
- *dst++ = pad;
-
- while (l > 0)
- {
- *dst++ = res[--l];
- }
-
- return dst;
-}
-
-int
-__small_vsprintf (char *dst, const char *fmt, va_list ap)
-{
- char tmp[MAX_PATH + 1];
- char *orig = dst;
- const char *s;
-
- while (*fmt)
- {
- int i, n = 0x7fff;
- if (*fmt != '%')
- *dst++ = *fmt++;
- else
- {
- int len = 0;
- char pad = ' ';
- int addsign = -1;
-
- switch (*++fmt)
- {
- case '+':
- addsign = 1;
- fmt++;
- break;
- case '%':
- *dst++ = *fmt++;
- continue;
- }
-
- for (;;)
- {
- char c = *fmt++;
- switch (c)
- {
- case '0':
- if (len == 0)
- {
- pad = '0';
- continue;
- }
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- len = len * 10 + (c - '0');
- continue;
- case 'l':
- continue;
- case 'c':
- {
- int c = va_arg (ap,int);
- if (c > ' ' && c <= 127)
- *dst++ = c;
- else
- {
- *dst++ = '0';
- *dst++ = 'x';
- dst = rn (dst, 16, 0, c, len, pad);
- }
- }
- break;
- case 'E':
- strcpy (dst, "Win32 error ");
- dst = rn (dst + sizeof ("Win32 error"), 10, 0, GetLastError (), len, pad);
- break;
- case 'd':
- dst = rn (dst, 10, addsign, va_arg (ap, int), len, pad);
- break;
- case 'D':
- dst = rn (dst, 10, addsign, va_arg (ap, long long), len, pad);
- break;
- case 'u':
- dst = rn (dst, 10, 0, va_arg (ap, int), len, pad);
- break;
- case 'U':
- dst = rn (dst, 10, 0, va_arg (ap, long long), len, pad);
- break;
- case 'o':
- dst = rn (dst, 8, 0, va_arg (ap, unsigned), len, pad);
- break;
- case 'p':
- *dst++ = '0';
- *dst++ = 'x';
- /* fall through */
- case 'x':
- dst = rn (dst, 16, 0, va_arg (ap, int), len, pad);
- break;
- case 'X':
- dst = rn (dst, 16, 0, va_arg (ap, long long), len, pad);
- break;
- case 'P':
- if (!GetModuleFileName (NULL, tmp, MAX_PATH))
- s = "cygwin program";
- else
- s = tmp;
- goto fillin;
- case '.':
- n = strtol (fmt, (char **)&fmt, 10);
- if (*fmt++ != 's')
- goto endfor;
- case 's':
- s = va_arg (ap, char *);
- if (s == NULL)
- s = "(null)";
- fillin:
- for (i = 0; *s && i < n; i++)
- *dst++ = *s++;
- break;
- default:
- *dst++ = '?';
- *dst++ = fmt[-1];
- }
- endfor:
- break;
- }
- }
- }
- *dst = 0;
- return dst - orig;
-}
-
-int
-__small_sprintf (char *dst, const char *fmt,...)
-{
- int r;
- va_list ap;
- va_start (ap, fmt);
- r = __small_vsprintf (dst, fmt, ap);
- va_end (ap);
- return r;
-}
-
-void
-small_printf (const char *fmt,...)
-{
- char buf[16384];
- va_list ap;
- DWORD done;
- int count;
-
-#if 0 /* Turn on to force console errors */
- extern SECURITY_ATTRIBUTES sec_none;
- HANDLE h = CreateFileA ("CONOUT$", GENERIC_READ|GENERIC_WRITE,
- FILE_SHARE_WRITE | FILE_SHARE_WRITE, &sec_none,
- OPEN_EXISTING, 0, 0);
- if (h)
- SetStdHandle (STD_ERROR_HANDLE, h);
-#endif
-
- va_start (ap, fmt);
- count = __small_vsprintf (buf, fmt, ap);
- va_end (ap);
-
- WriteFile (GetStdHandle (STD_ERROR_HANDLE), buf, count, &done, NULL);
- FlushFileBuffers (GetStdHandle (STD_ERROR_HANDLE));
-}
-
-#ifdef DEBUGGING
-static HANDLE NO_COPY console_handle = NULL;
-void
-console_printf (const char *fmt,...)
-{
- char buf[16384];
- va_list ap;
- DWORD done;
- int count;
-
- if (!console_handle)
- console_handle = CreateFileA ("CON", GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL, OPEN_EXISTING, 0, 0);
-
- if (console_handle == INVALID_HANDLE_VALUE)
- console_handle = GetStdHandle (STD_ERROR_HANDLE);
-
- va_start (ap, fmt);
- count = __small_vsprintf (buf, fmt, ap);
- va_end (ap);
-
- WriteFile (console_handle, buf, count, &done, NULL);
- FlushFileBuffers (console_handle);
-}
-#endif
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
deleted file mode 100644
index e5d9bfe86..000000000
--- a/winsup/cygwin/spawn.cc
+++ /dev/null
@@ -1,1040 +0,0 @@
-/* spawn.cc
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <stdlib.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <process.h>
-#include <sys/wait.h>
-#include <errno.h>
-#include <limits.h>
-#include <wingdi.h>
-#include <winuser.h>
-#include <ctype.h>
-#include "cygerrno.h"
-#include <sys/cygwin.h>
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "sigproc.h"
-#include "cygheap.h"
-#include "child_info.h"
-#include "shared_info.h"
-#include "pinfo.h"
-#define NEED_VFORK
-#include "perthread.h"
-#include "registry.h"
-#include "environ.h"
-
-#define LINE_BUF_CHUNK (MAX_PATH * 2)
-
-static suffix_info std_suffixes[] =
-{
- suffix_info (".exe", 1), suffix_info ("", 1),
- suffix_info (".com"), suffix_info (".cmd"),
- suffix_info (".bat"), suffix_info (".dll"),
- suffix_info (NULL)
-};
-
-HANDLE hExeced;
-DWORD dwExeced;
-
-/* Add .exe to PROG if not already present and see if that exists.
- If not, return PROG (converted from posix to win32 rules if necessary).
- The result is always BUF.
-
- Returns (possibly NULL) suffix */
-
-static const char *
-perhaps_suffix (const char *prog, path_conv& buf)
-{
- char *ext;
-
- debug_printf ("prog '%s'", prog);
- buf.check (prog, PC_SYM_FOLLOW | PC_FULL, std_suffixes);
-
- if (!buf.exists () || buf.isdir ())
- ext = NULL;
- else if (buf.known_suffix)
- ext = (char *) buf + (buf.known_suffix - buf.get_win32 ());
- else
- ext = strchr (buf, '\0');
-
- debug_printf ("buf %s, suffix found '%s'", (char *) buf, ext);
- return ext;
-}
-
-/* Find an executable name, possibly by appending known executable
- suffixes to it. The win32-translated name is placed in 'buf'.
- Any found suffix is returned in known_suffix.
-
- If the file is not found and !null_if_not_found then the win32 version
- of name is placed in buf and returned. Otherwise the contents of buf
- is undefined and NULL is returned. */
-
-const char * __stdcall
-find_exec (const char *name, path_conv& buf, const char *mywinenv,
- unsigned opt, const char **known_suffix)
-{
- const char *suffix = "";
- debug_printf ("find_exec (%s)", name);
- const char *retval = buf;
- char tmp[MAX_PATH];
- const char *posix = (opt & FE_NATIVE) ? NULL : name;
- bool has_slash = strchr (name, '/');
-
- /* Check to see if file can be opened as is first.
- Win32 systems always check . first, but PATH may not be set up to
- do this. */
- if ((has_slash || opt & FE_CWD)
- && (suffix = perhaps_suffix (name, buf)) != NULL)
- {
- if (posix && !has_slash)
- {
- tmp[0] = '.';
- tmp[1] = '/';
- strcpy (tmp + 2, name);
- posix = tmp;
- }
- goto out;
- }
-
- win_env *winpath;
- const char *path;
- const char *posix_path;
-
- /* Return the error condition if this is an absolute path or if there
- is no PATH to search. */
- if (strchr (name, '/') || strchr (name, '\\') ||
- isdrive (name) ||
- !(winpath = getwinenv (mywinenv)) ||
- !(path = winpath->get_native ()) ||
- *path == '\0')
- goto errout;
-
- debug_printf ("%s%s", mywinenv, path);
-
- posix = (opt & FE_NATIVE) ? NULL : tmp;
- posix_path = winpath->get_posix () - 1;
- /* Iterate over the specified path, looking for the file with and
- without executable extensions. */
- do
- {
- posix_path++;
- char *eotmp = strccpy (tmp, &path, ';');
- /* An empty path or '.' means the current directory, but we've
- already tried that. */
- if (opt & FE_CWD && (tmp[0] == '\0' || (tmp[0] == '.' && tmp[1] == '\0')))
- continue;
-
- *eotmp++ = '\\';
- strcpy (eotmp, name);
-
- debug_printf ("trying %s", tmp);
-
- if ((suffix = perhaps_suffix (tmp, buf)) != NULL)
- {
- if (posix == tmp)
- {
- eotmp = strccpy (tmp, &posix_path, ':');
- if (eotmp == tmp)
- *eotmp++ = '.';
- *eotmp++ = '/';
- strcpy (eotmp, name);
- }
- goto out;
- }
- }
- while (*path && *++path && (posix_path = strchr (posix_path, ':')));
-
- errout:
- posix = NULL;
- /* Couldn't find anything in the given path.
- Take the appropriate action based on null_if_not_found. */
- if (opt & FE_NNF)
- retval = NULL;
- else if (opt & FE_NATIVE)
- buf.check (name);
- else
- retval = name;
-
- out:
- if (posix)
- buf.set_path (posix);
- debug_printf ("%s = find_exec (%s)", (char *) buf, name);
- if (known_suffix)
- *known_suffix = suffix ?: strchr (buf, '\0');
- return retval;
-}
-
-/* Utility for spawn_guts. */
-
-static HANDLE
-handle (int n, int direction)
-{
- fhandler_base *fh = cygheap->fdtab[n];
-
- if (!fh)
- return INVALID_HANDLE_VALUE;
- if (fh->get_close_on_exec ())
- return INVALID_HANDLE_VALUE;
- if (direction == 0)
- return fh->get_handle ();
- return fh->get_output_handle ();
-}
-
-int
-iscmd (const char *argv0, const char *what)
-{
- int n;
- n = strlen (argv0) - strlen (what);
- if (n >= 2 && argv0[1] != ':')
- return 0;
- return n >= 0 && strcasematch (argv0 + n, what) &&
- (n == 0 || isdirsep (argv0[n - 1]));
-}
-
-class linebuf
-{
- public:
- size_t ix;
- char *buf;
- size_t alloced;
- linebuf () : ix (0), buf (NULL), alloced (0) {}
- ~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) >= alloced || !buf)
- {
- alloced += LINE_BUF_CHUNK + newix;
- buf = (char *) realloc (buf, alloced + 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) >= alloced)
- {
- alloced += LINE_BUF_CHUNK + newix;
- buf = (char *) realloc (buf, alloced + 1);
- buf[ix] = '\0';
- }
- if ((buflen = strlen (buf)))
- memmove (buf + len, buf, buflen + 1);
- else
- buf[newix] = '\0';
- memcpy (buf, what, len);
- ix = newix;
-}
-
-class av
-{
- char **argv;
- int calloced;
- public:
- int argc;
- av (int ac, const char * const *av) : calloced (0), argc (ac)
- {
- argv = (char **) cmalloc (HEAP_1_ARGV, (argc + 5) * sizeof (char *));
- memcpy (argv, av, (argc + 1) * sizeof (char *));
- }
- ~av ()
- {
- for (int i = 0; i < calloced; i++)
- cfree (argv[i]);
- cfree (argv);
- }
- int unshift (const char *what, int conv = 0);
- operator char **() {return argv;}
- void all_calloced () {calloced = argc;}
- void replace0_maybe (const char *arg0)
- {
- /* Note: Assumes that argv array has not yet been "unshifted" */
- if (!calloced)
- {
- argv[0] = cstrdup1 (arg0);
- calloced = 1;
- }
- }
- void dup_maybe (int i)
- {
- if (i >= calloced)
- argv[i] = cstrdup1 (argv[i]);
- }
- void dup_all ()
- {
- for (int i = calloced; i < argc; i++)
- argv[i] = cstrdup1 (argv[i]);
- }
-};
-
-int
-av::unshift (const char *what, int conv)
-{
- char **av;
- av = (char **) crealloc (argv, (argc + 2) * sizeof (char *));
- if (!av)
- return 0;
-
- argv = av;
- memmove (argv + 1, argv, (argc + 1) * sizeof (char *));
- char buf[MAX_PATH + 1];
- if (conv)
- {
- cygwin_conv_to_posix_path (what, buf);
- char *p = strchr (buf, '\0') - 4;
- if (p > buf && strcasematch (p, ".exe"))
- *p = '\0';
- what = buf;
- }
- *argv = cstrdup1 (what);
- argc++;
- calloced++;
- return 1;
-}
-
-static int __stdcall
-spawn_guts (const char * prog_arg, const char *const *argv,
- const char *const envp[], int mode)
-{
- BOOL rc;
- pid_t cygpid;
- sigframe thisframe (mainthread);
-
- MALLOC_CHECK;
-
- if (prog_arg == NULL)
- {
- syscall_printf ("prog_arg is NULL");
- set_errno (EINVAL);
- return -1;
- }
-
- syscall_printf ("spawn_guts (%d, %.132s)", mode, prog_arg);
-
- if (argv == NULL)
- {
- syscall_printf ("argv is NULL");
- set_errno (EINVAL);
- return (-1);
- }
-
- path_conv real_path;
-
- linebuf one_line;
-
- STARTUPINFO si = {0, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL};
-
- child_info_spawn ciresrv;
- si.lpReserved2 = (LPBYTE) &ciresrv;
- si.cbReserved2 = sizeof (ciresrv);
-
- DWORD chtype;
- if (mode != _P_OVERLAY)
- chtype = PROC_SPAWN;
- else
- chtype = PROC_EXEC;
-
- HANDLE spr;
- if (chtype != PROC_EXEC)
- spr = NULL;
- else
- {
- spr = CreateEvent (&sec_all, TRUE, FALSE, NULL);
- ProtectHandle (spr);
- }
-
- init_child_info (chtype, &ciresrv, (mode == _P_OVERLAY) ? myself->pid : 1,
- spr);
- if (!DuplicateHandle (hMainProc, hMainProc, hMainProc, &ciresrv.parent, 0, 1,
- DUPLICATE_SAME_ACCESS))
- {
- system_printf ("couldn't create handle to myself for child, %E");
- return -1;
- }
-
- ciresrv.moreinfo = (cygheap_exec_info *) ccalloc (HEAP_1_EXEC, 1, sizeof (cygheap_exec_info));
- ciresrv.moreinfo->old_title = NULL;
-
- /* CreateProcess takes one long string that is the command line (sigh).
- We need to quote any argument that has whitespace or embedded "'s. */
-
- int ac;
- for (ac = 0; argv[ac]; ac++)
- /* nothing */;
-
- av newargv (ac, argv);
-
- int null_app_name = 0;
- if (ac == 3 && argv[1][0] == '/' && argv[1][1] == 'c' &&
- (iscmd (argv[0], "command.com") || iscmd (argv[0], "cmd.exe")))
- {
- real_path.check (prog_arg);
- one_line.add ("\"");
- if (!real_path.error)
- one_line.add (real_path);
- else
- one_line.add (argv[0]);
- one_line.add ("\"");
- one_line.add (" ");
- one_line.add (argv[1]);
- one_line.add (" ");
- one_line.add (argv[2]);
- strcpy (real_path, argv[0]);
- null_app_name = 1;
- goto skip_arg_parsing;
- }
-
- const char *ext;
- if ((ext = perhaps_suffix (prog_arg, real_path)) == NULL)
- {
- set_errno (ENOENT);
- return -1;
- }
-
- MALLOC_CHECK;
-
- /* If the file name ends in either .exe, .com, .bat, or .cmd we assume
- that it is NOT a script file */
- while (*ext == '\0')
- {
- HANDLE hnd = CreateFileA (real_path,
- GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- &sec_none_nih,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL,
- 0);
- if (hnd == INVALID_HANDLE_VALUE)
- {
- __seterrno ();
- return -1;
- }
-
- DWORD done;
-
- char buf[2 * MAX_PATH + 1];
- buf[0] = buf[1] = buf[2] = buf[sizeof (buf) - 1] = '\0';
- if (!ReadFile (hnd, buf, sizeof (buf) - 1, &done, 0))
- {
- CloseHandle (hnd);
- __seterrno ();
- return -1;
- }
-
- CloseHandle (hnd);
-
- if (buf[0] == 'M' && buf[1] == 'Z')
- break;
-
- debug_printf ("%s is a script", (char *) real_path);
-
- char *pgm, *arg1;
-
- if (buf[0] != '#' || buf[1] != '!')
- {
- pgm = (char *) "/bin/sh";
- arg1 = NULL;
- }
- else
- {
- char *ptr;
- pgm = buf + 2;
- pgm += strspn (pgm, " \t");
- for (ptr = pgm, arg1 = NULL;
- *ptr && *ptr != '\r' && *ptr != '\n';
- ptr++)
- if (!arg1 && (*ptr == ' ' || *ptr == '\t'))
- {
- /* Null terminate the initial command and step over
- any additional white space. If we've hit the
- end of the line, exit the loop. Otherwise, we've
- found the first argument. Position the current
- pointer on the last known white space. */
- *ptr = '\0';
- char *newptr = ptr + 1;
- newptr += strspn (newptr, " \t");
- if (!*newptr || *newptr == '\r' || *newptr == '\n')
- break;
- arg1 = newptr;
- ptr = newptr - 1;
- }
-
- *ptr = '\0';
- }
-
- /* Replace argv[0] with the full path to the script if this is the
- first time through the loop. */
- newargv.replace0_maybe (prog_arg);
-
- /* pointers:
- * pgm interpreter name
- * arg1 optional string
- */
- if (arg1)
- newargv.unshift (arg1);
-
- /* FIXME: This should not be using FE_NATIVE. It should be putting
- the posix path on the argv list. */
- find_exec (pgm, real_path, "PATH=", FE_NATIVE, &ext);
- newargv.unshift (real_path, 1);
- }
-
- if (real_path.iscygexec ())
- newargv.dup_all ();
- else
- {
- for (int i = 0; i < newargv.argc; i++)
- {
- char *p = NULL;
- const char *a;
-
- newargv.dup_maybe (i);
- a = i ? newargv[i] : (char *) real_path;
- int len = strlen (a);
- if (len != 0 && !strpbrk (a, " \t\n\r\""))
- one_line.add (a, len);
- else
- {
- one_line.add ("\"", 1);
- /* Handle embedded special characters " and \.
- A " is always preceded by a \.
- A \ is not special unless it precedes a ". If it does,
- then all preceding \'s must be doubled to avoid having
- the Windows command line parser interpret the \ as quoting
- the ". This rule applies to a string of \'s before the end
- of the string, since cygwin/windows uses a " to delimit the
- argument. */
- for (; (p = strpbrk (a, "\"\\")); a = ++p)
- {
- one_line.add (a, p - a);
- /* Find length of string of backslashes */
- int n = strspn (p, "\\");
- if (!n)
- one_line.add ("\\\"", 2); /* No backslashes, so it must be a ".
- The " has to be protected with a backslash. */
- else
- {
- one_line.add (p, n); /* Add the run of backslashes */
- /* Need to double up all of the preceding
- backslashes if they precede a quote or EOS. */
- if (!p[n] || p[n] == '"')
- one_line.add (p, n);
- p += n - 1; /* Point to last backslash */
- }
- }
- if (*a)
- one_line.add (a);
- one_line.add ("\"", 1);
- }
- MALLOC_CHECK;
- one_line.add (" ", 1);
- MALLOC_CHECK;
- }
-
- MALLOC_CHECK;
- if (one_line.ix)
- one_line.buf[one_line.ix - 1] = '\0';
- else
- one_line.add ("", 1);
- MALLOC_CHECK;
- }
-
- char *envblock;
- newargv.all_calloced ();
- ciresrv.moreinfo->argc = newargv.argc;
- ciresrv.moreinfo->argv = newargv;
- ciresrv.hexec_proc = hexec_proc;
- ciresrv.moreinfo->envp = build_env (envp, envblock, ciresrv.moreinfo->envc,
- real_path.iscygexec ());
-
- if (mode != _P_OVERLAY ||
- !DuplicateHandle (hMainProc, myself.shared_handle (), hMainProc,
- &ciresrv.moreinfo->myself_pinfo, 0,
- TRUE, DUPLICATE_SAME_ACCESS))
- ciresrv.moreinfo->myself_pinfo = NULL;
-
- skip_arg_parsing:
- PROCESS_INFORMATION pi = {NULL, 0, 0, 0};
- si.lpReserved = NULL;
- si.lpDesktop = NULL;
- si.dwFlags = STARTF_USESTDHANDLES;
- si.hStdInput = handle (0, 0); /* Get input handle */
- si.hStdOutput = handle (1, 1); /* Get output handle */
- si.hStdError = handle (2, 1); /* Get output handle */
- si.cb = sizeof (si);
-
- int flags = CREATE_DEFAULT_ERROR_MODE | GetPriorityClass (hMainProc);
-
- if (mode == _P_DETACH || !set_console_state_for_spawn ())
- flags |= DETACHED_PROCESS;
- if (mode != _P_OVERLAY)
- flags |= CREATE_SUSPENDED;
-
- /* Some file types (currently only sockets) need extra effort in the
- parent after CreateProcess and before copying the datastructures
- to the child. So we have to start the child in suspend state,
- unfortunately, to avoid a race condition. */
- if (cygheap->fdtab.need_fixup_before ())
- flags |= CREATE_SUSPENDED;
-
-
- const char *runpath = null_app_name ? NULL : (const char *) real_path;
-
- syscall_printf ("null_app_name %d (%s, %.132s)", null_app_name, runpath, one_line.buf);
-
- void *newheap;
- /* Preallocated buffer for `sec_user' call */
- char sa_buf[1024];
-
- cygbench ("spawn-guts");
- if (!cygheap->user.impersonated || cygheap->user.token == INVALID_HANDLE_VALUE)
- {
- PSECURITY_ATTRIBUTES sec_attribs = sec_user_nih (sa_buf);
- ciresrv.moreinfo->uid = getuid32 ();
- /* FIXME: This leaks a handle in the CreateProcessAsUser case since the
- child process doesn't know about cygwin_mount_h. */
- ciresrv.mount_h = cygwin_mount_h;
- newheap = cygheap_setup_for_child (&ciresrv, cygheap->fdtab.need_fixup_before ());
- rc = CreateProcess (runpath, /* image name - with full path */
- one_line.buf, /* what was passed to exec */
- sec_attribs, /* process security attrs */
- sec_attribs, /* thread security attrs */
- TRUE, /* inherit handles from parent */
- flags,
- envblock, /* environment */
- 0, /* use current drive/directory */
- &si,
- &pi);
- }
- else
- {
- cygsid sid;
- DWORD ret_len;
- if (!GetTokenInformation (cygheap->user.token, TokenUser, &sid,
- sizeof sid, &ret_len))
- {
- sid = NO_SID;
- system_printf ("GetTokenInformation: %E");
- }
- /* Retrieve security attributes before setting psid to NULL
- since it's value is needed by `sec_user'. */
- PSECURITY_ATTRIBUTES sec_attribs = sec_user_nih (sa_buf, sid);
-
- RevertToSelf ();
-
- /* Load users registry hive. */
- load_registry_hive (sid);
-
- /* allow the child to interact with our window station/desktop */
- HANDLE hwst, hdsk;
- SECURITY_INFORMATION dsi = DACL_SECURITY_INFORMATION;
- DWORD n;
- char wstname[1024];
- char dskname[1024];
-
- ciresrv.moreinfo->uid = ILLEGAL_UID;
- hwst = GetProcessWindowStation ();
- SetUserObjectSecurity (hwst, &dsi, get_null_sd ());
- GetUserObjectInformation (hwst, UOI_NAME, wstname, 1024, &n);
- hdsk = GetThreadDesktop (GetCurrentThreadId ());
- SetUserObjectSecurity (hdsk, &dsi, get_null_sd ());
- GetUserObjectInformation (hdsk, UOI_NAME, dskname, 1024, &n);
- strcat (wstname, "\\");
- strcat (wstname, dskname);
- si.lpDesktop = wstname;
-
- newheap = cygheap_setup_for_child (&ciresrv, cygheap->fdtab.need_fixup_before ());
- rc = CreateProcessAsUser (cygheap->user.token,
- runpath, /* image name - with full path */
- one_line.buf, /* what was passed to exec */
- sec_attribs, /* process security attrs */
- sec_attribs, /* thread security attrs */
- TRUE, /* inherit handles from parent */
- flags,
- envblock, /* environment */
- 0, /* use current drive/directory */
- &si,
- &pi);
- /* Restore impersonation. In case of _P_OVERLAY this isn't
- allowed since it would overwrite child data. */
- if (mode != _P_OVERLAY)
- ImpersonateLoggedOnUser (cygheap->user.token);
- }
-
- MALLOC_CHECK;
- if (envblock)
- free (envblock);
- MALLOC_CHECK;
-
- /* Set errno now so that debugging messages from it appear before our
- final debugging message [this is a general rule for debugging
- messages]. */
- if (!rc)
- {
- __seterrno ();
- syscall_printf ("CreateProcess failed, %E");
- if (spr)
- ForceCloseHandle (spr);
- cygheap_setup_for_child_cleanup (newheap, &ciresrv, 0);
- return -1;
- }
-
- /* Fixup the parent datastructure if needed and resume the child's
- main thread. */
- if (!cygheap->fdtab.need_fixup_before ())
- cygheap_setup_for_child_cleanup (newheap, &ciresrv, 0);
- else
- {
- cygheap->fdtab.fixup_before_exec (pi.dwProcessId);
- cygheap_setup_for_child_cleanup (newheap, &ciresrv, 1);
- if (mode == _P_OVERLAY)
- ResumeThread (pi.hThread);
- }
-
- if (mode == _P_OVERLAY)
- cygpid = myself->pid;
- else
- cygpid = cygwin_pid (pi.dwProcessId);
-
- /* We print the original program name here so the user can see that too. */
- syscall_printf ("%d = spawn_guts (%s, %.132s)",
- rc ? cygpid : (unsigned int) -1, prog_arg, one_line.buf);
-
- /* Name the handle similarly to proc_subproc. */
- ProtectHandle1 (pi.hProcess, childhProc);
-
- if (mode == _P_OVERLAY)
- {
- /* These are both duplicated in the child code. We do this here,
- primarily for strace. */
- strace.execing = 1;
- hExeced = pi.hProcess;
- dwExeced = pi.dwProcessId;
- strcpy (myself->progname, real_path);
- close_all_files ();
- }
- else
- {
- myself->set_has_pgid_children ();
- ProtectHandle (pi.hThread);
- pinfo child (cygpid, 1);
- if (!child)
- {
- set_errno (EAGAIN);
- syscall_printf ("-1 = spawnve (), process table full");
- return -1;
- }
- child->dwProcessId = pi.dwProcessId;
- child->hProcess = pi.hProcess;
- child.remember ();
- strcpy (child->progname, real_path);
- /* FIXME: This introduces an unreferenced, open handle into the child.
- The purpose is to keep the pid shared memory open so that all of
- the fields filled out by child.remember do not disappear and so there
- is not a brief period during which the pid is not available.
- However, we should try to find another way to do this eventually. */
- (void) DuplicateHandle (hMainProc, child.shared_handle (), pi.hProcess,
- NULL, 0, 0, DUPLICATE_SAME_ACCESS);
- /* Start the child running */
- ResumeThread (pi.hThread);
- }
-
- ForceCloseHandle (pi.hThread);
-
- sigproc_printf ("spawned windows pid %d", pi.dwProcessId);
-
- DWORD res;
- BOOL exited;
-
- res = 0;
- exited = FALSE;
- MALLOC_CHECK;
- if (mode == _P_OVERLAY)
- {
- int nwait = 3;
- HANDLE waitbuf[3] = {pi.hProcess, signal_arrived, spr};
- for (int i = 0; i < 100; i++)
- {
- switch (WaitForMultipleObjects (nwait, waitbuf, FALSE, INFINITE))
- {
- case WAIT_OBJECT_0:
- sigproc_printf ("subprocess exited");
- DWORD exitcode;
- if (!GetExitCodeProcess (pi.hProcess, &exitcode))
- exitcode = 1;
- res |= exitcode;
- exited = TRUE;
- break;
- case WAIT_OBJECT_0 + 1:
- sigproc_printf ("signal arrived");
- reset_signal_arrived ();
- continue;
- case WAIT_OBJECT_0 + 2:
- if (myself->ppid_handle)
- res |= EXIT_REPARENTING;
- if (!my_parent_is_alive ())
- {
- nwait = 2;
- sigproc_terminate ();
- continue;
- }
- break;
- case WAIT_FAILED:
- system_printf ("wait failed: nwait %d, pid %d, winpid %d, %E",
- nwait, myself->pid, myself->dwProcessId);
- system_printf ("waitbuf[0] %p %d", waitbuf[0],
- WaitForSingleObject (waitbuf[0], 0));
- system_printf ("waitbuf[1] %p = %d", waitbuf[1],
- WaitForSingleObject (waitbuf[1], 0));
- system_printf ("waitbuf[w] %p = %d", waitbuf[2],
- WaitForSingleObject (waitbuf[2], 0));
- set_errno (ECHILD);
- try_to_debug ();
- return -1;
- }
- break;
- }
-
- ForceCloseHandle (spr);
-
- sigproc_printf ("res = %x", res);
-
- if (res & EXIT_REPARENTING)
- {
- /* Try to reparent child process.
- * Make handles to child available to parent process and exit with
- * EXIT_REPARENTING status. Wait() syscall in parent will then wait
- * for newly created child.
- */
- HANDLE oldh = myself->hProcess;
- HANDLE h = myself->ppid_handle;
- sigproc_printf ("parent handle %p", h);
- int rc = DuplicateHandle (hMainProc, pi.hProcess, h, &myself->hProcess,
- 0, FALSE, DUPLICATE_SAME_ACCESS);
- sigproc_printf ("%d = DuplicateHandle, oldh %p, newh %p",
- rc, oldh, myself->hProcess);
- if (!rc && my_parent_is_alive ())
- {
- system_printf ("Reparent failed, parent handle %p, %E", h);
- system_printf ("my dwProcessId %d, myself->dwProcessId %d",
- GetCurrentProcessId (), myself->dwProcessId);
- system_printf ("old hProcess %p, hProcess %p", oldh, myself->hProcess);
- }
- }
-
- }
-
- MALLOC_CHECK;
-
- switch (mode)
- {
- case _P_OVERLAY:
- ForceCloseHandle1 (pi.hProcess, childhProc);
- proc_terminate ();
- myself->exit (res, 1);
- break;
- case _P_WAIT:
- waitpid (cygpid, (int *) &res, 0);
- break;
- case _P_DETACH:
- res = 0; /* Lose all memory of this child. */
- break;
- case _P_NOWAIT:
- case _P_NOWAITO:
- case _P_VFORK:
- res = cygpid;
- break;
- default:
- break;
- }
-
- return (int) res;
-}
-
-extern "C" int
-cwait (int *result, int pid, int)
-{
- return waitpid (pid, result, 0);
-}
-
-/*
- * Helper function for spawn runtime calls.
- * Doesn't search the path.
- */
-
-extern "C" int
-spawnve (int mode, const char *path, const char *const *argv,
- const char *const *envp)
-{
- int ret;
- vfork_save *vf = vfork_storage.val ();
-
- if (vf != NULL && (vf->pid < 0) && mode == _P_OVERLAY)
- mode = _P_NOWAIT;
- else
- vf = NULL;
-
- syscall_printf ("spawnve (%s, %s, %x)", path, argv[0], envp);
-
- switch (mode)
- {
- case _P_OVERLAY:
- /* We do not pass _P_SEARCH_PATH here. execve doesn't search PATH.*/
- /* Just act as an exec if _P_OVERLAY set. */
- spawn_guts (path, argv, envp, mode);
- /* Errno should be set by spawn_guts. */
- ret = -1;
- break;
- case _P_VFORK:
- case _P_NOWAIT:
- case _P_NOWAITO:
- case _P_WAIT:
- case _P_DETACH:
- subproc_init ();
- ret = spawn_guts (path, argv, envp, mode);
- if (vf && ret > 0)
- {
- debug_printf ("longjmping due to vfork");
- vf->pid = ret;
- longjmp (vf->j, 1);
- }
- break;
- default:
- set_errno (EINVAL);
- ret = -1;
- break;
- }
- return ret;
-}
-
-/*
- * spawn functions as implemented in the MS runtime library.
- * Most of these based on (and copied from) newlib/libc/posix/execXX.c
- */
-
-extern "C" int
-spawnl (int mode, const char *path, const char *arg0, ...)
-{
- int i;
- va_list args;
- const char *argv[256];
-
- va_start (args, arg0);
- argv[0] = arg0;
- i = 1;
-
- do
- argv[i] = va_arg (args, const char *);
- while (argv[i++] != NULL);
-
- va_end (args);
-
- return spawnve (mode, path, (char * const *) argv, cur_environ ());
-}
-
-extern "C" int
-spawnle (int mode, const char *path, const char *arg0, ...)
-{
- int i;
- va_list args;
- const char * const *envp;
- const char *argv[256];
-
- va_start (args, arg0);
- argv[0] = arg0;
- i = 1;
-
- do
- argv[i] = va_arg (args, const char *);
- while (argv[i++] != NULL);
-
- envp = va_arg (args, const char * const *);
- va_end (args);
-
- return spawnve (mode, path, (char * const *) argv, (char * const *) envp);
-}
-
-extern "C" int
-spawnlp (int mode, const char *path, const char *arg0, ...)
-{
- int i;
- va_list args;
- const char *argv[256];
-
- va_start (args, arg0);
- argv[0] = arg0;
- i = 1;
-
- do
- argv[i] = va_arg (args, const char *);
- while (argv[i++] != NULL);
-
- va_end (args);
-
- return spawnvpe (mode, path, (char * const *) argv, cur_environ ());
-}
-
-extern "C" int
-spawnlpe (int mode, const char *path, const char *arg0, ...)
-{
- int i;
- va_list args;
- const char * const *envp;
- const char *argv[256];
-
- va_start (args, arg0);
- argv[0] = arg0;
- i = 1;
-
- do
- argv[i] = va_arg (args, const char *);
- while (argv[i++] != NULL);
-
- envp = va_arg (args, const char * const *);
- va_end (args);
-
- return spawnvpe (mode, path, (char * const *) argv, envp);
-}
-
-extern "C" int
-spawnv (int mode, const char *path, const char * const *argv)
-{
- return spawnve (mode, path, argv, cur_environ ());
-}
-
-extern "C" int
-spawnvp (int mode, const char *path, const char * const *argv)
-{
- return spawnvpe (mode, path, argv, cur_environ ());
-}
-
-extern "C" int
-spawnvpe (int mode, const char *file, const char * const *argv,
- const char * const *envp)
-{
- path_conv buf;
- return spawnve (mode, find_exec (file, buf), argv, envp);
-}
diff --git a/winsup/cygwin/speclib b/winsup/cygwin/speclib
deleted file mode 100755
index 6f8e0cd73..000000000
--- a/winsup/cygwin/speclib
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-# speclib - Make a special version of the cygwin import library.
-#
-# Copyright 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.
-
-case "$1" in
- -v) v="-v"; shift
-esac
-lib=$1; shift
-nm=$1; shift
-dlltool=$1; shift
-as=$1; shift
-def=$1; shift
-trap "rm -f /tmp/$$.def" 0 1 2 15
-(echo "LIBRARY cygwin1.dll
-EXPORTS"; $nm --extern-only --defined-only $* | sed -e '/^[ ]*$/d' -e '/:$/d' -e 's/^.* _\(.*\)/\1/' | grep $v -f - -w $def |egrep -vi '^library|exports|^$' | sort) > /tmp/$$.def
-$dlltool --as=$as -d /tmp/$$.def -l "$lib"
diff --git a/winsup/cygwin/stackdump.sgml b/winsup/cygwin/stackdump.sgml
deleted file mode 100644
index bff76bffd..000000000
--- a/winsup/cygwin/stackdump.sgml
+++ /dev/null
@@ -1,13 +0,0 @@
-<sect1 id="func-cygwin-stackdump">
-<title>cygwin_stackdump</title>
-
-<funcsynopsis>
-<funcdef>extern "C" void
-<function>cygwin_stackdump</function></funcdef>
-<void>
-</funcsynopsis>
-
-<para> Outputs a stackdump to stderr from the called location.
-</para>
-
-</sect1>
diff --git a/winsup/cygwin/strace.cc b/winsup/cygwin/strace.cc
deleted file mode 100644
index 5a4549161..000000000
--- a/winsup/cygwin/strace.cc
+++ /dev/null
@@ -1,413 +0,0 @@
-/* strace.cc: system/windows tracing
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <stdlib.h>
-#include <time.h>
-#include <wingdi.h>
-#include <winuser.h>
-#include <ctype.h>
-#include "pinfo.h"
-#include "perprocess.h"
-#include "cygwin_version.h"
-#include "hires.h"
-
-#define PROTECT(x) x[sizeof(x)-1] = 0
-#define CHECK(x) if (x[sizeof(x)-1] != 0) { small_printf("array bound exceeded %d\n", __LINE__); ExitProcess(1); }
-
-class NO_COPY strace strace;
-
-#ifndef NOSTRACE
-
-void
-strace::hello()
-{
- char buf[30];
-
- if (inited)
- {
- active ^= 1;
- return;
- }
-
- inited = 1;
- if (!being_debugged ())
- return;
-
- __small_sprintf (buf, "cYg%8x %x", _STRACE_INTERFACE_ACTIVATE_ADDR, &active);
- OutputDebugString (buf);
-
- if (active)
- {
- prntf (1, NULL, "**********************************************");
- prntf (1, NULL, "Program name: %s (%d)", myself->progname, myself->pid);
- prntf (1, NULL, "App version: %d.%d, api: %d.%d",
- user_data->dll_major, user_data->dll_minor,
- user_data->api_major, user_data->api_minor);
- prntf (1, NULL, "DLL version: %d.%d, api: %d.%d",
- cygwin_version.dll_major, cygwin_version.dll_minor,
- cygwin_version.api_major, cygwin_version.api_minor);
- prntf (1, NULL, "DLL build: %s", cygwin_version.dll_build_date);
- prntf (1, NULL, "OS version: Windows %s", wincap.osname ());
- prntf (1, NULL, "**********************************************");
- }
-}
-
-int
-strace::microseconds ()
-{
- static hires_us now;
- return (int) now.usecs (true);
-}
-
-static int __stdcall
-getfunc (char *in_dst, const char *func)
-{
- const char *p;
- const char *pe;
- char *dst = in_dst;
- for (p = func; (pe = strchr (p, '(')); p = pe + 1)
- if (isalnum ((int)pe[-1]) || pe[-1] == '_')
- break;
- else if (isspace((int)pe[-1]))
- {
- pe--;
- break;
- }
- if (!pe)
- pe = strchr (func, '\0');
- for (p = pe; p > func; p--)
- if (p != pe && *p == ' ')
- {
- p++;
- break;
- }
- if (*p == '*')
- p++;
- while (p < pe)
- *dst++ = *p++;
-
- *dst++ = ':';
- *dst++ = ' ';
- *dst = '\0';
-
- return dst - in_dst;
-}
-
-extern "C" char *__progname;
-
-/* sprintf analog for use by output routines. */
-int
-strace::vsprntf (char *buf, const char *func, const char *infmt, va_list ap)
-{
- int count;
- char fmt[80];
- static NO_COPY int nonewline = FALSE;
- DWORD err = GetLastError ();
- const char *tn = threadname (0);
- char *pn = __progname ?: myself->progname;
-
- int microsec = microseconds ();
- lmicrosec = microsec;
-
- __small_sprintf (fmt, "%7d [%s] %s ", microsec, tn, "%s %d%s");
-
- SetLastError (err);
-
- if (nonewline)
- count = 0;
- else
- {
- char *p, progname[MAX_PATH + 1];
- if (!pn)
- p = (char *) "*** unknown ***";
- else if ((p = strrchr (pn, '\\')) != NULL)
- p++;
- else if ((p = strrchr (pn, '/')) != NULL)
- p++;
- else
- p = pn;
- strcpy (progname, p);
- if ((p = strrchr (progname, '.')) != NULL && strcasematch (p, ".exe"))
- *p = '\000';
- p = progname;
- count = __small_sprintf (buf, fmt, p && *p ? p : "?", myself->pid,
- execing ? "!" : "");
- if (func)
- count += getfunc (buf + count, func);
- }
-
- count += __small_vsprintf (buf + count, infmt, ap);
- char *p;
- for (p = buf + count; p > buf; p--)
- switch (p[-1])
- {
- case '\n':
- p[-1] = '\0';
- break;
- case '\b':
- *--p = '\0';
- nonewline = TRUE;
- goto done;
- default:
- goto addnl;
- }
-
-addnl:
- *p++ = '\n';
- *p = '\0';
- nonewline = FALSE;
-
-done:
- return p - buf;
-}
-
-/* Write to strace file or strace queue. */
-void
-strace::write (unsigned category, const char *buf, int count)
-{
-# define PREFIX (3 + 8 + 1 + 8 + 1)
- char outbuf[PREFIX + 1 + count + 1];
-# define outstuff (outbuf + 12)
- __small_sprintf (outstuff, "%x %s", category, buf);
- __small_sprintf (outbuf, "cYg%08x", strlen (outstuff) + 1);
- outstuff[-1] = ' ';
- OutputDebugString (outbuf);
-#undef outstuff
-#undef PREFIX
-}
-
-/* Printf function used when tracing system calls.
- Warning: DO NOT SET ERRNO HERE! */
-
-void
-strace::vprntf (unsigned category, const char *func, const char *fmt, va_list ap)
-{
- DWORD err = GetLastError ();
- int count;
- char buf[10000];
-
- PROTECT(buf);
- SetLastError (err);
-
- count = this->vsprntf (buf, func, fmt, ap);
- CHECK(buf);
- if (category & _STRACE_SYSTEM)
- {
- DWORD done;
- WriteFile (GetStdHandle (STD_ERROR_HANDLE), buf, count, &done, 0);
- FlushFileBuffers (GetStdHandle (STD_ERROR_HANDLE));
- }
-
-#ifndef NOSTRACE
- if (active)
- this->write (category, buf, count);
-#endif
- SetLastError (err);
-}
-
-void
-strace::prntf (unsigned category, const char *func, const char *fmt, ...)
-{
- va_list ap;
-
- va_start (ap, fmt);
- this->vprntf (category, func, fmt, ap);
-}
-
-extern "C" void
-strace_printf (unsigned category, const char *func, const char *fmt, ...)
-{
- va_list ap;
-
- if ((category & _STRACE_SYSTEM) || strace.active)
- {
- va_start (ap, fmt);
- strace.vprntf (category, func, fmt, ap);
- }
-}
-
-static NO_COPY struct tab
-{
- int v;
- const char *n;
-}
-ta[] =
-{
- { WM_NULL, "WM_NULL" },
- { WM_CREATE, "WM_CREATE" },
- { WM_DESTROY, "WM_DESTROY" },
- { WM_MOVE, "WM_MOVE" },
- { WM_SIZE, "WM_SIZE" },
- { WM_ACTIVATE, "WM_ACTIVATE" },
- { WM_SETFOCUS, "WM_SETFOCUS" },
- { WM_KILLFOCUS, "WM_KILLFOCUS" },
- { WM_ENABLE, "WM_ENABLE" },
- { WM_SETREDRAW, "WM_SETREDRAW" },
- { WM_SETTEXT, "WM_SETTEXT" },
- { WM_GETTEXT, "WM_GETTEXT" },
- { WM_GETTEXTLENGTH, "WM_GETTEXTLENGTH" },
- { WM_PAINT, "WM_PAINT" },
- { WM_CLOSE, "WM_CLOSE" },
- { WM_QUERYENDSESSION, "WM_QUERYENDSESSION" },
- { WM_QUIT, "WM_QUIT" },
- { WM_QUERYOPEN, "WM_QUERYOPEN" },
- { WM_ERASEBKGND, "WM_ERASEBKGND" },
- { WM_SYSCOLORCHANGE, "WM_SYSCOLORCHANGE" },
- { WM_ENDSESSION, "WM_ENDSESSION" },
- { WM_SHOWWINDOW, "WM_SHOWWINDOW" },
- { WM_WININICHANGE, "WM_WININICHANGE" },
- { WM_DEVMODECHANGE, "WM_DEVMODECHANGE" },
- { WM_ACTIVATEAPP, "WM_ACTIVATEAPP" },
- { WM_FONTCHANGE, "WM_FONTCHANGE" },
- { WM_TIMECHANGE, "WM_TIMECHANGE" },
- { WM_CANCELMODE, "WM_CANCELMODE" },
- { WM_SETCURSOR, "WM_SETCURSOR" },
- { WM_MOUSEACTIVATE, "WM_MOUSEACTIVATE" },
- { WM_CHILDACTIVATE, "WM_CHILDACTIVATE" },
- { WM_QUEUESYNC, "WM_QUEUESYNC" },
- { WM_GETMINMAXINFO, "WM_GETMINMAXINFO" },
- { WM_PAINTICON, "WM_PAINTICON" },
- { WM_ICONERASEBKGND, "WM_ICONERASEBKGND" },
- { WM_NEXTDLGCTL, "WM_NEXTDLGCTL" },
- { WM_SPOOLERSTATUS, "WM_SPOOLERSTATUS" },
- { WM_DRAWITEM, "WM_DRAWITEM" },
- { WM_MEASUREITEM, "WM_MEASUREITEM" },
- { WM_DELETEITEM, "WM_DELETEITEM" },
- { WM_VKEYTOITEM, "WM_VKEYTOITEM" },
- { WM_CHARTOITEM, "WM_CHARTOITEM" },
- { WM_SETFONT, "WM_SETFONT" },
- { WM_GETFONT, "WM_GETFONT" },
- { WM_SETHOTKEY, "WM_SETHOTKEY" },
- { WM_GETHOTKEY, "WM_GETHOTKEY" },
- { WM_QUERYDRAGICON, "WM_QUERYDRAGICON" },
- { WM_COMPAREITEM, "WM_COMPAREITEM" },
- { WM_COMPACTING, "WM_COMPACTING" },
- { WM_WINDOWPOSCHANGING, "WM_WINDOWPOSCHANGING" },
- { WM_WINDOWPOSCHANGED, "WM_WINDOWPOSCHANGED" },
- { WM_POWER, "WM_POWER" },
- { WM_COPYDATA, "WM_COPYDATA" },
- { WM_CANCELJOURNAL, "WM_CANCELJOURNAL" },
- { WM_NCCREATE, "WM_NCCREATE" },
- { WM_NCDESTROY, "WM_NCDESTROY" },
- { WM_NCCALCSIZE, "WM_NCCALCSIZE" },
- { WM_NCHITTEST, "WM_NCHITTEST" },
- { WM_NCPAINT, "WM_NCPAINT" },
- { WM_NCACTIVATE, "WM_NCACTIVATE" },
- { WM_GETDLGCODE, "WM_GETDLGCODE" },
- { WM_NCMOUSEMOVE, "WM_NCMOUSEMOVE" },
- { WM_NCLBUTTONDOWN, "WM_NCLBUTTONDOWN" },
- { WM_NCLBUTTONUP, "WM_NCLBUTTONUP" },
- { WM_NCLBUTTONDBLCLK, "WM_NCLBUTTONDBLCLK" },
- { WM_NCRBUTTONDOWN, "WM_NCRBUTTONDOWN" },
- { WM_NCRBUTTONUP, "WM_NCRBUTTONUP" },
- { WM_NCRBUTTONDBLCLK, "WM_NCRBUTTONDBLCLK" },
- { WM_NCMBUTTONDOWN, "WM_NCMBUTTONDOWN" },
- { WM_NCMBUTTONUP, "WM_NCMBUTTONUP" },
- { WM_NCMBUTTONDBLCLK, "WM_NCMBUTTONDBLCLK" },
- { WM_KEYFIRST, "WM_KEYFIRST" },
- { WM_KEYDOWN, "WM_KEYDOWN" },
- { WM_KEYUP, "WM_KEYUP" },
- { WM_CHAR, "WM_CHAR" },
- { WM_DEADCHAR, "WM_DEADCHAR" },
- { WM_SYSKEYDOWN, "WM_SYSKEYDOWN" },
- { WM_SYSKEYUP, "WM_SYSKEYUP" },
- { WM_SYSCHAR, "WM_SYSCHAR" },
- { WM_SYSDEADCHAR, "WM_SYSDEADCHAR" },
- { WM_KEYLAST, "WM_KEYLAST" },
- { WM_INITDIALOG, "WM_INITDIALOG" },
- { WM_COMMAND, "WM_COMMAND" },
- { WM_SYSCOMMAND, "WM_SYSCOMMAND" },
- { WM_TIMER, "WM_TIMER" },
- { WM_HSCROLL, "WM_HSCROLL" },
- { WM_VSCROLL, "WM_VSCROLL" },
- { WM_INITMENU, "WM_INITMENU" },
- { WM_INITMENUPOPUP, "WM_INITMENUPOPUP" },
- { WM_MENUSELECT, "WM_MENUSELECT" },
- { WM_MENUCHAR, "WM_MENUCHAR" },
- { WM_ENTERIDLE, "WM_ENTERIDLE" },
- { WM_CTLCOLORMSGBOX, "WM_CTLCOLORMSGBOX" },
- { WM_CTLCOLOREDIT, "WM_CTLCOLOREDIT" },
- { WM_CTLCOLORLISTBOX, "WM_CTLCOLORLISTBOX" },
- { WM_CTLCOLORBTN, "WM_CTLCOLORBTN" },
- { WM_CTLCOLORDLG, "WM_CTLCOLORDLG" },
- { WM_CTLCOLORSCROLLBAR, "WM_CTLCOLORSCROLLBAR" },
- { WM_CTLCOLORSTATIC, "WM_CTLCOLORSTATIC" },
- { WM_MOUSEFIRST, "WM_MOUSEFIRST" },
- { WM_MOUSEMOVE, "WM_MOUSEMOVE" },
- { WM_LBUTTONDOWN, "WM_LBUTTONDOWN" },
- { WM_LBUTTONUP, "WM_LBUTTONUP" },
- { WM_LBUTTONDBLCLK, "WM_LBUTTONDBLCLK" },
- { WM_RBUTTONDOWN, "WM_RBUTTONDOWN" },
- { WM_RBUTTONUP, "WM_RBUTTONUP" },
- { WM_RBUTTONDBLCLK, "WM_RBUTTONDBLCLK" },
- { WM_MBUTTONDOWN, "WM_MBUTTONDOWN" },
- { WM_MBUTTONUP, "WM_MBUTTONUP" },
- { WM_MBUTTONDBLCLK, "WM_MBUTTONDBLCLK" },
- { WM_MOUSELAST, "WM_MOUSELAST" },
- { WM_PARENTNOTIFY, "WM_PARENTNOTIFY" },
- { WM_ENTERMENULOOP, "WM_ENTERMENULOOP" },
- { WM_EXITMENULOOP, "WM_EXITMENULOOP" },
- { WM_MDICREATE, "WM_MDICREATE" },
- { WM_MDIDESTROY, "WM_MDIDESTROY" },
- { WM_MDIACTIVATE, "WM_MDIACTIVATE" },
- { WM_MDIRESTORE, "WM_MDIRESTORE" },
- { WM_MDINEXT, "WM_MDINEXT" },
- { WM_MDIMAXIMIZE, "WM_MDIMAXIMIZE" },
- { WM_MDITILE, "WM_MDITILE" },
- { WM_MDICASCADE, "WM_MDICASCADE" },
- { WM_MDIICONARRANGE, "WM_MDIICONARRANGE" },
- { WM_MDIGETACTIVE, "WM_MDIGETACTIVE" },
- { WM_MDISETMENU, "WM_MDISETMENU" },
- { WM_DROPFILES, "WM_DROPFILES" },
- { WM_MDIREFRESHMENU, "WM_MDIREFRESHMENU" },
- { WM_CUT, "WM_CUT" },
- { WM_COPY, "WM_COPY" },
- { WM_PASTE, "WM_PASTE" },
- { WM_CLEAR, "WM_CLEAR" },
- { WM_UNDO, "WM_UNDO" },
- { WM_RENDERFORMAT, "WM_RENDERFORMAT" },
- { WM_RENDERALLFORMATS, "WM_RENDERALLFORMATS" },
- { WM_DESTROYCLIPBOARD, "WM_DESTROYCLIPBOARD" },
- { WM_DRAWCLIPBOARD, "WM_DRAWCLIPBOARD" },
- { WM_PAINTCLIPBOARD, "WM_PAINTCLIPBOARD" },
- { WM_VSCROLLCLIPBOARD, "WM_VSCROLLCLIPBOARD" },
- { WM_SIZECLIPBOARD, "WM_SIZECLIPBOARD" },
- { WM_ASKCBFORMATNAME, "WM_ASKCBFORMATNAME" },
- { WM_CHANGECBCHAIN, "WM_CHANGECBCHAIN" },
- { WM_HSCROLLCLIPBOARD, "WM_HSCROLLCLIPBOARD" },
- { WM_QUERYNEWPALETTE, "WM_QUERYNEWPALETTE" },
- { WM_PALETTEISCHANGING, "WM_PALETTEISCHANGING" },
- { WM_PALETTECHANGED, "WM_PALETTECHANGED" },
- { WM_HOTKEY, "WM_HOTKEY" },
- { WM_PENWINFIRST, "WM_PENWINFIRST" },
- { WM_PENWINLAST, "WM_PENWINLAST" },
- { WM_ASYNCIO, "ASYNCIO" },
- { 0, 0 }};
-
-void
-strace::wm (int message, int word, int lon)
-{
- if (active)
- {
- int i;
-
- for (i = 0; ta[i].n; i++)
- {
- if (ta[i].v == message)
- {
- this->prntf (_STRACE_WM, NULL, "wndproc %d %s %d %d", message, ta[i].n, word, lon);
- return;
- }
- }
- this->prntf (_STRACE_WM, NULL, "wndproc %d unknown %d %d", message, word, lon);
- }
-}
-#endif /*NOSTRACE*/
diff --git a/winsup/cygwin/string.h b/winsup/cygwin/string.h
deleted file mode 100644
index 84dc14cb7..000000000
--- a/winsup/cygwin/string.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* string.h: Extra string defs
-
- Copyright 2001 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 _CYGWIN_STRING_H
-#define _CYGWIN_STRING_H
-
-#include_next <string.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#undef strchr
-#define strchr cygwin_strchr
-static inline __stdcall char *
-strchr (const char *s, int c)
-{
- register char * res;
- __asm__ __volatile__ ("\
- movb %%al,%%ah\n\
- 1: movb (%1),%%al\n\
- cmpb %%ah,%%al\n\
- je 2f\n\
- incl %1\n\
- testb %%al,%%al\n\
- jne 1b\n\
- xorl %1,%1\n\
- 2: movl %1,%0\n\
- ":"=a" (res), "=r" (s)
- :"0" (c), "1" (s));
- return res;
-}
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* _CYGWIN_STRING_H */
diff --git a/winsup/cygwin/strsep.cc b/winsup/cygwin/strsep.cc
deleted file mode 100644
index 0a421f6e1..000000000
--- a/winsup/cygwin/strsep.cc
+++ /dev/null
@@ -1,65 +0,0 @@
-/* strsep.cc: strsep call */
-
-#include <stdio.h>
-
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-extern "C"
-char *
-strsep (char **stringp,
- const char *delim)
-{
- register char *s;
- register const char *spanp;
- register int c, sc;
- char *tok;
-
- if ((s = *stringp) == NULL)
- return (NULL);
- for (tok = s;;) {
- c = *s++;
- spanp = delim;
- do {
- if ((sc = *spanp++) == c) {
- if (c == 0)
- s = NULL;
- else
- s[-1] = 0;
- *stringp = s;
- return (tok);
- }
- } while (sc != 0);
- }
- /* NOTREACHED */
-}
diff --git a/winsup/cygwin/sync.cc b/winsup/cygwin/sync.cc
deleted file mode 100644
index b6dec83fa..000000000
--- a/winsup/cygwin/sync.cc
+++ /dev/null
@@ -1,149 +0,0 @@
-/* sync.cc: Synchronization functions for cygwin.
-
- This file implements the methods for controlling the "muto" class
- which is intended to operate similarly to a mutex but attempts to
- avoid making expensive calls to the kernel.
-
- Copyright 2000, 2001, 2002 Red Hat, Inc.
-
- Written by Christopher Faylor <cgf@cygnus.com>
-
-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 "winsup.h"
-#include <stdlib.h>
-#include <time.h>
-#include <sys/wait.h>
-#include <errno.h>
-#include <stdlib.h>
-#include "sync.h"
-#include "security.h"
-
-muto NO_COPY muto_start;
-
-#undef WaitForSingleObject
-
-/* Constructor */
-muto *
-muto::init (const char *s)
-{
- waiters = -1;
- /* Create event which is used in the fallback case when blocking is necessary */
- if (!(bruteforce = CreateEvent (&sec_none_nih, FALSE, FALSE, NULL)))
- {
- DWORD oerr = GetLastError ();
- SetLastError (oerr);
- return NULL;
- }
- name = s;
- next = muto_start.next;
- muto_start.next = this;
- return this;
-}
-
-#if 0 /* FIXME: Do we need this? mutos aren't destroyed until process exit */
-/* Destructor (racy?) */
-muto::~muto ()
-{
- while (visits)
- release ();
-
- HANDLE h = bruteforce;
- bruteforce = NULL;
- /* Just need to close the event handle */
- if (h)
- CloseHandle (h);
-}
-#endif
-
-/* Acquire the lock. Argument is the number of milliseconds to wait for
- the lock. Multiple visits from the same thread are allowed and should
- be handled correctly.
-
- Note: The goal here is to minimize, as much as possible, calls to the
- OS. Hence the use of InterlockedIncrement, etc., rather than (much) more
- expensive OS mutexes. */
-int
-muto::acquire (DWORD ms)
-{
- DWORD this_tid = GetCurrentThreadId ();
-
- if (tid != this_tid)
- {
- /* Increment the waiters part of the class. Need to do this first to
- avoid potential races. */
- LONG was_waiting = InterlockedIncrement (&waiters);
-
- /* This is deceptively simple. Basically, it allows multiple attempts to
- lock the same muto to succeed without attempting to manipulate sync.
- If the muto is already locked then this thread will wait for ms until
- it is signalled by muto::release. Then it will attempt to grab the
- sync field. If it succeeds, then this thread owns the muto.
-
- There is a pathological condition where a thread times out waiting for
- bruteforce but the release code triggers the bruteforce event. In this
- case, it is possible for a thread which is going to wait for bruteforce
- to wake up immediately. It will then attempt to grab sync but will fail
- and go back to waiting. */
- if (tid != this_tid && (was_waiting || InterlockedExchange (&sync, 1) != 0))
- {
- switch (WaitForSingleObject (bruteforce, ms))
- {
- case WAIT_OBJECT_0:
- goto gotit;
- break;
- default:
- InterlockedDecrement (&waiters);
- return 0; /* failed. */
- }
- }
- }
-
-gotit:
- tid = this_tid; /* register this thread. */
- return ++visits; /* Increment visit count. */
-}
-
-/* Return the muto lock. Needs to be called once per every acquire. */
-int
-muto::release ()
-{
- DWORD this_tid = GetCurrentThreadId ();
-
- if (tid != this_tid || !visits)
- {
- SetLastError (ERROR_NOT_OWNER); /* Didn't have the lock. */
- return 0; /* failed. */
- }
-
- /* FIXME: Need to check that other thread has not exited, too. */
- if (!--visits)
- {
- tid = 0; /* We were the last unlocker. */
- (void) InterlockedExchange (&sync, 0); /* Reset trigger. */
- /* This thread had incremented waiters but had never decremented it.
- Decrement it now. If it is >= 0 then there are possibly other
- threads waiting for the lock, so trigger bruteforce. */
- if (InterlockedDecrement (&waiters) >= 0)
- (void) SetEvent (bruteforce); /* Wake up one of the waiting threads */
- }
-
- return 1; /* success. */
-}
-
-/* Call only when we're exiting. This is not thread safe. */
-void
-muto::reset ()
-{
- visits = sync = tid = 0;
- InterlockedExchange (&waiters, -1);
- if (bruteforce)
- {
- CloseHandle (bruteforce);
- bruteforce = CreateEvent (&sec_none_nih, FALSE, FALSE, name);
- }
-}
diff --git a/winsup/cygwin/sync.h b/winsup/cygwin/sync.h
deleted file mode 100644
index d50ae1763..000000000
--- a/winsup/cygwin/sync.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* sync.h: Header file for cygwin synchronization primitives.
-
- Copyright 1999, 2000, 2001, 2002 Red Hat, Inc.
-
- Written by Christopher Faylor <cgf@cygnus.com>
-
-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. */
-
-/* FIXME: Note that currently this class cannot be allocated via `new' since
- there are issues with malloc and fork. */
-class muto
-{
- LONG sync; /* Used to serialize access to this class. */
- LONG visits; /* Count of number of times a thread has called acquire. */
- LONG waiters; /* Number of threads waiting for lock. */
- HANDLE bruteforce; /* event handle used to control waiting for lock. */
- DWORD tid; /* Thread Id of lock owner. */
-public:
- class muto *next;
- const char *name;
-
- /* The real constructor. */
- muto *init(const char *name) __attribute__ ((regparm (3)));
-
-#if 0 /* FIXME: See comment in sync.cc */
- ~muto ()
-#endif
- int acquire (DWORD ms = INFINITE) __attribute__ ((regparm (1))); /* Acquire the lock. */
- int release (); /* Release the lock. */
-
- /* Return true if caller thread owns the lock. */
- int ismine () {return tid == GetCurrentThreadId ();}
- DWORD owner () {return tid;}
- int unstable () {return !tid && (sync || waiters >= 0);}
- void reset ();
-};
-
-extern muto muto_start;
-
-/* Use a statically allocated buffer as the storage for a muto */
-#define new_muto(__name) \
-({ \
- static muto __name##_storage __attribute__((nocommon)) __attribute__((section(".data_cygwin_nocopy"))); \
- __name = __name##_storage.init (#__name); \
-})
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
deleted file mode 100644
index f9d9c94cb..000000000
--- a/winsup/cygwin/syscalls.cc
+++ /dev/null
@@ -1,2622 +0,0 @@
-/* syscalls.cc: syscalls
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <sys/stat.h>
-#include <sys/vfs.h> /* needed for statfs */
-#include <pwd.h>
-#include <grp.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <process.h>
-#include <utmp.h>
-#include <sys/uio.h>
-#include <errno.h>
-#include <limits.h>
-#include <winnls.h>
-#include <wininet.h>
-#include <lmcons.h> /* for UNLEN */
-#include <cygwin/version.h>
-#include <sys/cygwin.h>
-#include "cygerrno.h"
-#include "perprocess.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "sigproc.h"
-#include "pinfo.h"
-#include <unistd.h>
-#include "shared_info.h"
-#include "cygheap.h"
-
-SYSTEM_INFO system_info;
-
-/* Close all files and process any queued deletions.
- Lots of unix style applications will open a tmp file, unlink it,
- but never call close. This function is called by _exit to
- ensure we don't leave any such files lying around. */
-
-void __stdcall
-close_all_files (void)
-{
- SetResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "close_all_files");
-
- fhandler_base *fh;
- for (int i = 0; i < (int) cygheap->fdtab.size; i++)
- if ((fh = cygheap->fdtab[i]) != NULL)
- {
- fh->close ();
- cygheap->fdtab.release (i);
- }
-
- ReleaseResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "close_all_files");
- cygwin_shared->delqueue.process_queue ();
-}
-
-BOOL __stdcall
-check_pty_fds (void)
-{
- int res = FALSE;
- SetResourceLock (LOCK_FD_LIST, WRITE_LOCK, "check_pty_fds");
- fhandler_base *fh;
- for (int i = 0; i < (int) cygheap->fdtab.size; i++)
- if ((fh = cygheap->fdtab[i]) != NULL &&
- (fh->get_device () == FH_TTYS || fh->get_device () == FH_PTYM))
- {
- res = TRUE;
- break;
- }
- ReleaseResourceLock (LOCK_FD_LIST, WRITE_LOCK, "check_pty_fds");
- return res;
-}
-
-int
-dup (int fd)
-{
- return cygheap->fdtab.dup2 (fd, cygheap_fdnew ());
-}
-
-int
-dup2 (int oldfd, int newfd)
-{
- return cygheap->fdtab.dup2 (oldfd, newfd);
-}
-
-extern "C" int
-_unlink (const char *ourname)
-{
- int res = -1;
- DWORD devn;
- sigframe thisframe (mainthread);
-
- path_conv win32_name (ourname, PC_SYM_NOFOLLOW | PC_FULL);
-
- if (win32_name.error)
- {
- set_errno (win32_name.error);
- goto done;
- }
-
- if ((devn = win32_name.get_devn ()) == FH_PROC || devn == FH_REGISTRY
- || devn == FH_PROCESS)
- {
- set_errno (EROFS);
- goto done;
- }
-
- syscall_printf ("_unlink (%s)", win32_name.get_win32 ());
-
- if (!win32_name.exists ())
- {
- syscall_printf ("unlinking a nonexistent file");
- set_errno (ENOENT);
- goto done;
- }
- else if (win32_name.isdir ())
- {
- syscall_printf ("unlinking a directory");
- set_errno (EPERM);
- goto done;
- }
-
- /* Windows won't check the directory mode, so we do that ourselves. */
- if (!writable_directory (win32_name))
- {
- syscall_printf ("non-writable directory");
- goto done;
- }
-
- /* Check for shortcut as symlink condition. */
- if (win32_name.has_attribute (FILE_ATTRIBUTE_READONLY))
- {
- int len = strlen (win32_name);
- if (len > 4 && strcasematch ((char *) win32_name + len - 4, ".lnk"))
- SetFileAttributes (win32_name, (DWORD) win32_name & ~FILE_ATTRIBUTE_READONLY);
- }
-
- DWORD lasterr;
- lasterr = 0;
- for (int i = 0; i < 2; i++)
- {
- if (DeleteFile (win32_name))
- {
- syscall_printf ("DeleteFile succeeded");
- goto ok;
- }
-
- lasterr = GetLastError ();
- if (i || lasterr != ERROR_ACCESS_DENIED || win32_name.issymlink ())
- break; /* Couldn't delete it. */
-
- /* if access denied, chmod to be writable, in case it is not,
- and try again */
- (void) chmod (win32_name, 0777);
- }
-
- /* Windows 9x seems to report ERROR_ACCESS_DENIED rather than sharing
- violation. So, set lasterr to ERROR_SHARING_VIOLATION in this case
- to simplify tests. */
- if (wincap.access_denied_on_delete () && lasterr == ERROR_ACCESS_DENIED
- && !win32_name.isremote ())
- lasterr = ERROR_SHARING_VIOLATION;
-
- /* Tried to delete file by normal DeleteFile and by resetting protection
- and then deleting. That didn't work.
-
- There are two possible reasons for this: 1) The file may be opened and
- Windows is not allowing it to be deleted, or 2) We may not have permissions
- to delete the file.
-
- So, first assume that it may be 1) and try to remove the file using the
- Windows FILE_FLAG_DELETE_ON_CLOSE semantics. This seems to work only
- spottily on Windows 9x/Me but it does seem to work reliably on NT as
- long as the file doesn't exist on a remote drive. */
-
- bool delete_on_close_ok;
-
- delete_on_close_ok = !win32_name.isremote ()
- && wincap.has_delete_on_close ();
-
- /* Attempt to use "delete on close" semantics to handle removing
- a file which may be open. */
- HANDLE h;
- h = CreateFile (win32_name, GENERIC_READ, FILE_SHARE_READ, &sec_none_nih,
- OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, 0);
- if (h == INVALID_HANDLE_VALUE)
- {
- if (GetLastError () == ERROR_FILE_NOT_FOUND)
- goto ok;
- }
- else
- {
- CloseHandle (h);
- syscall_printf ("CreateFile/CloseHandle succeeded");
- /* Everything is fine if the file has disappeared or if we know that the
- FILE_FLAG_DELETE_ON_CLOSE will eventually work. */
- if (GetFileAttributes (win32_name) == INVALID_FILE_ATTRIBUTES
- || delete_on_close_ok)
- goto ok; /* The file is either gone already or will eventually be
- deleted by the OS. */
- }
-
- /* FILE_FLAGS_DELETE_ON_CLOSE was a bust. If this is a sharing
- violation, then queue the file for deletion when the process
- exits. Otherwise, punt. */
- if (lasterr != ERROR_SHARING_VIOLATION)
- goto err;
-
- syscall_printf ("couldn't delete file, err %d", lasterr);
-
- /* Add file to the "to be deleted" queue. */
- cygwin_shared->delqueue.queue_file (win32_name);
-
- /* Success condition. */
- ok:
- res = 0;
- goto done;
-
- /* Error condition. */
- err:
- __seterrno ();
- res = -1;
-
- done:
- syscall_printf ("%d = unlink (%s)", res, ourname);
- return res;
-}
-
-extern "C" int
-remove (const char *ourname)
-{
- path_conv win32_name (ourname, PC_SYM_NOFOLLOW | PC_FULL);
-
- if (win32_name.error)
- {
- set_errno (win32_name.error);
- syscall_printf ("-1 = remove (%s)", ourname);
- return -1;
- }
-
- return win32_name.isdir () ? rmdir (ourname) : _unlink (ourname);
-}
-
-extern "C" pid_t
-_getpid ()
-{
- return myself->pid;
-}
-
-/* getppid: POSIX 4.1.1.1 */
-extern "C" pid_t
-getppid ()
-{
- return myself->ppid;
-}
-
-/* setsid: POSIX 4.3.2.1 */
-extern "C" pid_t
-setsid (void)
-{
- if (myself->pgid != _getpid ())
- {
- if (myself->ctty == TTY_CONSOLE &&
- !cygheap->fdtab.has_console_fds () &&
- !check_pty_fds ())
- FreeConsole ();
- myself->ctty = -1;
- myself->sid = _getpid ();
- myself->pgid = _getpid ();
- syscall_printf ("sid %d, pgid %d, ctty %d", myself->sid, myself->pgid, myself->ctty);
- return myself->sid;
- }
- set_errno (EPERM);
- return -1;
-}
-
-extern "C" ssize_t
-_read (int fd, void *ptr, size_t len)
-{
- if (len == 0)
- return 0;
-
- if (__check_null_invalid_struct_errno (ptr, len))
- return -1;
-
- int res;
- extern int sigcatchers;
- int e = get_errno ();
-
- while (1)
- {
- sigframe thisframe (mainthread);
-
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- return -1;
-
- DWORD wait = cfd->is_nonblocking () ? 0 : INFINITE;
-
- /* Could block, so let user know we at least got here. */
- syscall_printf ("read (%d, %p, %d) %sblocking, sigcatchers %d", fd, ptr, len, wait ? "" : "non", sigcatchers);
-
- if (wait && (!cfd->is_slow () || cfd->get_r_no_interrupt ()))
- debug_printf ("non-interruptible read\n");
- else if (!cfd->ready_for_read (fd, wait))
- {
- res = -1;
- goto out;
- }
-
- /* FIXME: This is not thread safe. We need some method to
- ensure that an fd, closed in another thread, aborts I/O
- operations. */
- if (!cfd.isopen())
- return -1;
-
- /* Check to see if this is a background read from a "tty",
- sending a SIGTTIN, if appropriate */
- res = cfd->bg_check (SIGTTIN);
-
- if (!cfd.isopen())
- return -1;
-
- if (res > bg_eof)
- {
- myself->process_state |= PID_TTYIN;
- if (!cfd.isopen())
- return -1;
- res = cfd->read (ptr, len);
- myself->process_state &= ~PID_TTYIN;
- }
-
- out:
-
- if (res && get_errno () == EACCES &&
- !(cfd->get_flags () & (O_RDONLY | O_RDWR)))
- {
- set_errno (EBADF);
- break;
- }
-
- if (res >= 0 || get_errno () != EINTR || !thisframe.call_signal_handler ())
- break;
- set_errno (e);
- }
-
- syscall_printf ("%d = read (%d, %p, %d), errno %d", res, fd, ptr, len,
- get_errno ());
- MALLOC_CHECK;
- return res;
-}
-
-extern "C" ssize_t
-_write (int fd, const void *ptr, size_t len)
-{
- int res = -1;
-
- sigframe thisframe (mainthread);
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- goto done;
-
- /* No further action required for len == 0 */
- if (len == 0)
- {
- res = 0;
- goto done;
- }
-
- if (len && __check_invalid_read_ptr_errno (ptr, len))
- goto done;
-
- /* Could block, so let user know we at least got here. */
- if (fd == 1 || fd == 2)
- paranoid_printf ("write (%d, %p, %d)", fd, ptr, len);
- else
- syscall_printf ("write (%d, %p, %d)", fd, ptr, len);
-
- res = cfd->bg_check (SIGTTOU);
-
- if (res > bg_eof)
- {
- myself->process_state |= PID_TTYOU;
- res = cfd->write (ptr, len);
- myself->process_state &= ~PID_TTYOU;
- if (res && get_errno () == EACCES &&
- !(cfd->get_flags () & (O_WRONLY | O_RDWR)))
- set_errno (EBADF);
- }
-
-done:
- if (fd == 1 || fd == 2)
- paranoid_printf ("%d = write (%d, %p, %d)", res, fd, ptr, len);
- else
- syscall_printf ("%d = write (%d, %p, %d)", res, fd, ptr, len);
-
- return (ssize_t) res;
-}
-
-/*
- * FIXME - should really move this interface into fhandler, and implement
- * write in terms of it. There are devices in Win32 that could do this with
- * overlapped I/O much more efficiently - we should eventually use
- * these.
- */
-
-extern "C" ssize_t
-writev (int fd, const struct iovec *iov, int iovcnt)
-{
- int i;
- ssize_t len, total;
- char *base;
-
- if (iovcnt < 1 || iovcnt > IOV_MAX)
- {
- set_errno (EINVAL);
- return -1;
- }
-
- /* Ensure that the sum of the iov_len values is less than
- SSIZE_MAX (per spec), if so, we must fail with no output (per spec).
- */
- total = 0;
- for (i = 0; i < iovcnt; ++i)
- {
- total += iov[i].iov_len;
- if (total > SSIZE_MAX)
- {
- set_errno (EINVAL);
- return -1;
- }
- }
- /* Now write the data */
- for (i = 0, total = 0; i < iovcnt; i++, iov++)
- {
- len = iov->iov_len;
- base = iov->iov_base;
- while (len > 0)
- {
- register int nbytes;
- nbytes = write (fd, base, len);
- if (nbytes < 0 && total == 0)
- return -1;
- if (nbytes <= 0)
- return total;
- len -= nbytes;
- total += nbytes;
- base += nbytes;
- }
- }
- return total;
-}
-
-/*
- * FIXME - should really move this interface into fhandler, and implement
- * read in terms of it. There are devices in Win32 that could do this with
- * overlapped I/O much more efficiently - we should eventually use
- * these.
- */
-
-extern "C" ssize_t
-readv (int fd, const struct iovec *iov, int iovcnt)
-{
- int i;
- ssize_t len, total;
- char *base;
-
- for (i = 0, total = 0; i < iovcnt; i++, iov++)
- {
- len = iov->iov_len;
- base = iov->iov_base;
- while (len > 0)
- {
- register int nbytes;
- nbytes = read (fd, base, len);
- if (nbytes < 0 && total == 0)
- return -1;
- if (nbytes <= 0)
- return total;
- len -= nbytes;
- total += nbytes;
- base += nbytes;
- }
- }
- return total;
-}
-
-/* _open */
-/* newlib's fcntl.h defines _open as taking variable args so we must
- correspond. The third arg if it exists is: mode_t mode. */
-extern "C" int
-_open (const char *unix_path, int flags, ...)
-{
- int res = -1;
- va_list ap;
- mode_t mode = 0;
- sigframe thisframe (mainthread);
-
- syscall_printf ("open (%s, %p)", unix_path, flags);
- if (!check_null_empty_str_errno (unix_path))
- {
- /* check for optional mode argument */
- va_start (ap, flags);
- mode = va_arg (ap, mode_t);
- va_end (ap);
-
- fhandler_base *fh;
- cygheap_fdnew fd;
-
- if (fd >= 0)
- {
- path_conv pc;
- if (!(fh = cygheap->fdtab.build_fhandler_from_name (fd, unix_path,
- NULL, pc)))
- res = -1; // errno already set
- else if (!fh->open (&pc, flags, (mode & 07777) & ~cygheap->umask))
- {
- fd.release ();
- res = -1;
- }
- else if ((res = fd) <= 2)
- set_std_handle (res);
- }
- }
-
- syscall_printf ("%d = open (%s, %p)", res, unix_path, flags);
- return res;
-}
-
-extern "C" __off64_t
-lseek64 (int fd, __off64_t pos, int dir)
-{
- __off64_t res;
- sigframe thisframe (mainthread);
-
- if (dir != SEEK_SET && dir != SEEK_CUR && dir != SEEK_END)
- {
- set_errno (EINVAL);
- res = -1;
- }
- else
- {
- cygheap_fdget cfd (fd);
- if (cfd >= 0)
- res = cfd->lseek (pos, dir);
- else
- res = -1;
- }
- syscall_printf ("%d = lseek (%d, %D, %d)", res, fd, pos, dir);
-
- return res;
-}
-
-extern "C" __off32_t
-_lseek (int fd, __off32_t pos, int dir)
-{
- return lseek64 (fd, (__off64_t) pos, dir);
-}
-
-extern "C" int
-_close (int fd)
-{
- int res;
- sigframe thisframe (mainthread);
-
- syscall_printf ("close (%d)", fd);
-
- MALLOC_CHECK;
- cygheap_fdget cfd (fd, true);
- if (cfd < 0)
- res = -1;
- else
- {
- cfd->close ();
- cfd.release ();
- res = 0;
- }
-
- syscall_printf ("%d = close (%d)", res, fd);
- MALLOC_CHECK;
- return res;
-}
-
-extern "C" int
-isatty (int fd)
-{
- int res;
- sigframe thisframe (mainthread);
-
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- res = 0;
- else
- res = cfd->is_tty ();
- syscall_printf ("%d = isatty (%d)", res, fd);
- return res;
-}
-
-/* Under NT, try to make a hard link using backup API. If that
- fails or we are Win 95, just copy the file.
- FIXME: We should actually be checking partition type, not OS.
- Under NTFS, we should support hard links. On FAT partitions,
- we should just copy the file.
-*/
-
-extern "C" int
-_link (const char *a, const char *b)
-{
- int res = -1;
- sigframe thisframe (mainthread);
- path_conv real_a (a, PC_SYM_NOFOLLOW | PC_FULL);
- path_conv real_b (b, PC_SYM_NOFOLLOW | PC_FULL);
-
- if (real_a.error)
- {
- set_errno (real_a.error);
- goto done;
- }
- if (real_b.error)
- {
- set_errno (real_b.case_clash ? ECASECLASH : real_b.error);
- goto done;
- }
-
- if (real_b.exists ())
- {
- syscall_printf ("file '%s' exists?", (char *)real_b);
- set_errno (EEXIST);
- goto done;
- }
- if (real_b.get_win32 ()[strlen (real_b.get_win32 ()) - 1] == '.')
- {
- syscall_printf ("trailing dot, bailing out");
- set_errno (EINVAL);
- goto done;
- }
-
- /* Try to make hard link first on Windows NT */
- if (wincap.has_hard_links ())
- {
- if (CreateHardLinkA (real_b.get_win32 (), real_a.get_win32 (), NULL))
- {
- res = 0;
- goto done;
- }
-
- HANDLE hFileSource;
-
- WIN32_STREAM_ID StreamId;
- DWORD dwBytesWritten;
- LPVOID lpContext;
- DWORD cbPathLen;
- DWORD StreamSize;
- WCHAR wbuf[MAX_PATH];
-
- BOOL bSuccess;
-
- hFileSource = CreateFile (
- real_a.get_win32 (),
- FILE_WRITE_ATTRIBUTES,
- FILE_SHARE_READ | FILE_SHARE_WRITE /*| FILE_SHARE_DELETE*/,
- &sec_none_nih, // sa
- OPEN_EXISTING,
- 0,
- NULL
- );
-
- if (hFileSource == INVALID_HANDLE_VALUE)
- {
- syscall_printf ("cannot open source, %E");
- goto docopy;
- }
-
- lpContext = NULL;
- cbPathLen = sys_mbstowcs (wbuf, real_b.get_win32 (), MAX_PATH) * sizeof (WCHAR);
-
- StreamId.dwStreamId = BACKUP_LINK;
- StreamId.dwStreamAttributes = 0;
- StreamId.dwStreamNameSize = 0;
- StreamId.Size.HighPart = 0;
- StreamId.Size.LowPart = cbPathLen;
-
- StreamSize = sizeof (WIN32_STREAM_ID) - sizeof (WCHAR**) +
- StreamId.dwStreamNameSize;
-
- /* Write the WIN32_STREAM_ID */
- bSuccess = BackupWrite (
- hFileSource,
- (LPBYTE) &StreamId, // buffer to write
- StreamSize, // number of bytes to write
- &dwBytesWritten,
- FALSE, // don't abort yet
- FALSE, // don't process security
- &lpContext);
-
- if (bSuccess)
- {
- /* write the buffer containing the path */
- /* FIXME: BackupWrite sometimes traps if linkname is invalid.
- Need to handle. */
- bSuccess = BackupWrite (
- hFileSource,
- (LPBYTE) wbuf, // buffer to write
- cbPathLen, // number of bytes to write
- &dwBytesWritten,
- FALSE, // don't abort yet
- FALSE, // don't process security
- &lpContext
- );
-
- if (!bSuccess)
- syscall_printf ("cannot write linkname, %E");
-
- /* Free context */
- BackupWrite (
- hFileSource,
- NULL, // buffer to write
- 0, // number of bytes to write
- &dwBytesWritten,
- TRUE, // abort
- FALSE, // don't process security
- &lpContext);
- }
- else
- syscall_printf ("cannot write streamId, %E");
-
- CloseHandle (hFileSource);
-
- if (!bSuccess)
- goto docopy;
-
- res = 0;
- goto done;
- }
-docopy:
- /* do this with a copy */
- if (CopyFileA (real_a.get_win32 (), real_b.get_win32 (), 1))
- res = 0;
- else
- __seterrno ();
-
-done:
- syscall_printf ("%d = link (%s, %s)", res, a, b);
- return res;
-}
-
-/* chown: POSIX 5.6.5.1 */
-/*
- * chown () is only implemented for Windows NT. Under other operating
- * systems, it is only a stub that always returns zero.
- */
-static int
-chown_worker (const char *name, unsigned fmode, __uid32_t uid, __gid32_t gid)
-{
- int res;
- __uid32_t old_uid;
- __gid32_t old_gid;
-
- if (check_null_empty_str_errno (name))
- return -1;
-
- if (!wincap.has_security ()) // real chown only works on NT
- res = 0; // return zero (and do nothing) under Windows 9x
- else
- {
- /* we need Win32 path names because of usage of Win32 API functions */
- path_conv win32_path (PC_NONULLEMPTY, name, fmode);
-
- if (win32_path.error)
- {
- set_errno (win32_path.error);
- res = -1;
- goto done;
- }
-
- /* FIXME: This makes chown on a device succeed always. Someday we'll want
- to actually allow chown to work properly on devices. */
- if (win32_path.is_device ())
- {
- res = 0;
- goto done;
- }
-
- DWORD attrib = 0;
- if (win32_path.isdir ())
- attrib |= S_IFDIR;
- res = get_file_attribute (win32_path.has_acls (),
- win32_path.get_win32 (),
- (int *) &attrib,
- &old_uid,
- &old_gid);
- if (!res)
- {
- if (uid == ILLEGAL_UID)
- uid = old_uid;
- if (gid == ILLEGAL_GID)
- gid = old_gid;
- if (win32_path.isdir())
- attrib |= S_IFDIR;
- res = set_file_attribute (win32_path.has_acls (), win32_path, uid,
- gid, attrib);
- }
- if (res != 0 && (!win32_path.has_acls () || !allow_ntsec))
- {
- /* fake - if not supported, pretend we're like win95
- where it just works */
- res = 0;
- }
- }
-
-done:
- syscall_printf ("%d = %schown (%s,...)",
- res, (fmode & PC_SYM_NOFOLLOW) ? "l" : "", name);
- return res;
-}
-
-extern "C" int
-chown32 (const char * name, __uid32_t uid, __gid32_t gid)
-{
- sigframe thisframe (mainthread);
- return chown_worker (name, PC_SYM_FOLLOW, uid, gid);
-}
-
-extern "C" int
-chown (const char * name, __uid16_t uid, __gid16_t gid)
-{
- sigframe thisframe (mainthread);
- return chown_worker (name, PC_SYM_FOLLOW, uid, gid16togid32 (gid));
-}
-
-extern "C" int
-lchown32 (const char * name, __uid32_t uid, __gid32_t gid)
-{
- sigframe thisframe (mainthread);
- return chown_worker (name, PC_SYM_NOFOLLOW, uid, gid);
-}
-
-extern "C" int
-lchown (const char * name, __uid16_t uid, __gid16_t gid)
-{
- sigframe thisframe (mainthread);
- return chown_worker (name, PC_SYM_NOFOLLOW, uid, gid16togid32 (gid));
-}
-
-extern "C" int
-fchown32 (int fd, __uid32_t uid, __gid32_t gid)
-{
- sigframe thisframe (mainthread);
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- {
- syscall_printf ("-1 = fchown (%d,...)", fd);
- return -1;
- }
-
- const char *path = cfd->get_name ();
-
- if (path == NULL)
- {
- syscall_printf ("-1 = fchown (%d,...) (no name)", fd);
- set_errno (ENOSYS);
- return -1;
- }
-
- syscall_printf ("fchown (%d,...): calling chown_worker (%s,FOLLOW,...)",
- fd, path);
- return chown_worker (path, PC_SYM_FOLLOW, uid, gid);
-}
-
-extern "C" int
-fchown (int fd, __uid16_t uid, __gid16_t gid)
-{
- return fchown32 (fd, uid, gid16togid32 (gid));
-}
-
-/* umask: POSIX 5.3.3.1 */
-extern "C" mode_t
-umask (mode_t mask)
-{
- mode_t oldmask;
-
- oldmask = cygheap->umask;
- cygheap->umask = mask & 0777;
- return oldmask;
-}
-
-/* chmod: POSIX 5.6.4.1 */
-extern "C" int
-chmod (const char *path, mode_t mode)
-{
- int res = -1;
- sigframe thisframe (mainthread);
-
- path_conv win32_path (path);
-
- if (win32_path.error)
- {
- set_errno (win32_path.error);
- goto done;
- }
-
- /* FIXME: This makes chmod on a device succeed always. Someday we'll want
- to actually allow chmod to work properly on devices. */
- if (win32_path.is_device ())
- {
- res = 0;
- goto done;
- }
-
- if (!win32_path.exists ())
- __seterrno ();
- else
- {
- /* temporary erase read only bit, to be able to set file security */
- SetFileAttributes (win32_path, (DWORD) win32_path & ~FILE_ATTRIBUTE_READONLY);
-
- __uid32_t uid;
- __gid32_t gid;
-
- if (win32_path.isdir ())
- mode |= S_IFDIR;
- get_file_attribute (win32_path.has_acls (),
- win32_path.get_win32 (),
- NULL, &uid, &gid);
- /* FIXME: Do we really need this to be specified twice? */
- if (win32_path.isdir ())
- mode |= S_IFDIR;
- if (!set_file_attribute (win32_path.has_acls (), win32_path, uid, gid,
- mode)
- && allow_ntsec)
- res = 0;
-
- /* if the mode we want has any write bits set, we can't
- be read only. */
- if (mode & (S_IWUSR | S_IWGRP | S_IWOTH))
- (DWORD) win32_path &= ~FILE_ATTRIBUTE_READONLY;
- else
- (DWORD) win32_path |= FILE_ATTRIBUTE_READONLY;
-
- if (S_ISLNK (mode) || S_ISSOCK (mode))
- (DWORD) win32_path |= FILE_ATTRIBUTE_SYSTEM;
-
- if (!SetFileAttributes (win32_path, win32_path))
- __seterrno ();
- else
- {
- /* Correct NTFS security attributes have higher priority */
- if (res == 0 || !allow_ntsec)
- res = 0;
- }
- }
-
-done:
- syscall_printf ("%d = chmod (%s, %p)", res, path, mode);
- return res;
-}
-
-/* fchmod: P96 5.6.4.1 */
-
-extern "C" int
-fchmod (int fd, mode_t mode)
-{
- sigframe thisframe (mainthread);
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- {
- syscall_printf ("-1 = fchmod (%d, 0%o)", fd, mode);
- return -1;
- }
-
- const char *path = cfd->get_name ();
-
- if (path == NULL)
- {
- syscall_printf ("-1 = fchmod (%d, 0%o) (no name)", fd, mode);
- set_errno (ENOSYS);
- return -1;
- }
-
- syscall_printf ("fchmod (%d, 0%o): calling chmod (%s, 0%o)",
- fd, mode, path, mode);
- return chmod (path, mode);
-}
-
-static void
-stat64_to_stat32 (struct __stat64 *src, struct __stat32 *dst)
-{
- dst->st_dev = ((src->st_dev >> 8) & 0xff00) | (src->st_dev & 0xff);
- dst->st_ino = src->st_ino;
- dst->st_mode = src->st_mode;
- dst->st_nlink = src->st_nlink;
- dst->st_uid = src->st_uid;
- dst->st_gid = src->st_gid;
- dst->st_rdev = src->st_rdev;
- dst->st_size = src->st_size;
- dst->st_atim = src->st_atim;
- dst->st_mtim = src->st_mtim;
- dst->st_ctim = src->st_ctim;
- dst->st_blksize = src->st_blksize;
- dst->st_blocks = src->st_blocks;
-}
-
-extern "C" int
-fstat64 (int fd, struct __stat64 *buf)
-{
- int res;
- sigframe thisframe (mainthread);
-
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- res = -1;
- else
- {
- path_conv pc (cfd->get_win32_name ());
- memset (buf, 0, sizeof (struct __stat64));
- res = cfd->fstat (buf, &pc);
- if (!res)
- {
- if (!buf->st_ino)
- buf->st_ino = hash_path_name (0, cfd->get_win32_name ());
- if (!buf->st_dev)
- buf->st_dev = (cfd->get_device () << 16) | cfd->get_unit ();
- }
- }
-
- syscall_printf ("%d = fstat (%d, %p)", res, fd, buf);
- return res;
-}
-
-extern "C" int
-_fstat (int fd, struct __stat32 *buf)
-{
- struct __stat64 buf64;
- int ret = fstat64 (fd, &buf64);
- if (!ret)
- stat64_to_stat32 (&buf64, buf);
- return ret;
-}
-
-/* fsync: P96 6.6.1.1 */
-extern "C" int
-fsync (int fd)
-{
- sigframe thisframe (mainthread);
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- {
- syscall_printf ("-1 = fsync (%d)", fd);
- return -1;
- }
-
- if (FlushFileBuffers (cfd->get_handle ()) == 0)
- {
- __seterrno ();
- return -1;
- }
- return 0;
-}
-
-/* sync: standards? */
-extern "C" int
-sync ()
-{
- return 0;
-}
-
-suffix_info stat_suffixes[] =
-{
- suffix_info ("", 1),
- suffix_info (".exe", 1),
- suffix_info (NULL)
-};
-
-/* Cygwin internal */
-int __stdcall
-stat_worker (const char *name, struct __stat64 *buf, int nofollow,
- path_conv *pc)
-{
- int res = -1;
- path_conv real_path;
- fhandler_base *fh = NULL;
-
- if (check_null_invalid_struct_errno (buf))
- goto done;
-
- if (!pc)
- pc = &real_path;
-
- fh = cygheap->fdtab.build_fhandler_from_name (-1, name, NULL, *pc,
- (nofollow ? PC_SYM_NOFOLLOW
- : PC_SYM_FOLLOW)
- | PC_FULL, stat_suffixes);
-
- if (pc->error)
- {
- debug_printf ("got %d error from build_fhandler_from_name", pc->error);
- set_errno (pc->error);
- }
- else
- {
- debug_printf ("(%s, %p, %d, %p), file_attributes %d", name, buf, nofollow,
- pc, (DWORD) real_path);
- memset (buf, 0, sizeof (*buf));
- res = fh->fstat (buf, pc);
- if (!res)
- {
- if (!buf->st_ino)
- buf->st_ino = hash_path_name (0, fh->get_win32_name ());
- if (!buf->st_dev)
- buf->st_dev = (fh->get_device () << 16) | fh->get_unit ();
- }
- }
-
- done:
- if (fh)
- delete fh;
- MALLOC_CHECK;
- syscall_printf ("%d = (%s, %p)", res, name, buf);
- return res;
-}
-
-extern "C" int
-stat64 (const char *name, struct __stat64 *buf)
-{
- sigframe thisframe (mainthread);
- syscall_printf ("entering");
- return stat_worker (name, buf, 0);
-}
-
-extern "C" int
-_stat (const char *name, struct __stat32 *buf)
-{
- struct __stat64 buf64;
- int ret = stat64 (name, &buf64);
- if (!ret)
- stat64_to_stat32 (&buf64, buf);
- return ret;
-}
-
-/* lstat: Provided by SVR4 and 4.3+BSD, POSIX? */
-extern "C" int
-lstat64 (const char *name, struct __stat64 *buf)
-{
- sigframe thisframe (mainthread);
- syscall_printf ("entering");
- return stat_worker (name, buf, 1);
-}
-
-/* lstat: Provided by SVR4 and 4.3+BSD, POSIX? */
-extern "C" int
-cygwin_lstat (const char *name, struct __stat32 *buf)
-{
- struct __stat64 buf64;
- int ret = lstat64 (name, &buf64);
- if (!ret)
- stat64_to_stat32 (&buf64, buf);
- return ret;
-}
-
-extern int acl_access (const char *, int);
-
-extern "C" int
-access (const char *fn, int flags)
-{
- sigframe thisframe (mainthread);
- // flags were incorrectly specified
- if (flags & ~(F_OK|R_OK|W_OK|X_OK))
- {
- set_errno (EINVAL);
- return -1;
- }
-
- if (allow_ntsec)
- return acl_access (fn, flags);
-
- struct __stat64 st;
- int r = stat_worker (fn, &st, 0);
- if (r)
- return -1;
- r = -1;
- if (flags & R_OK)
- {
- if (st.st_uid == myself->uid)
- {
- if (!(st.st_mode & S_IRUSR))
- goto done;
- }
- else if (st.st_gid == myself->gid)
- {
- if (!(st.st_mode & S_IRGRP))
- goto done;
- }
- else if (!(st.st_mode & S_IROTH))
- goto done;
- }
- if (flags & W_OK)
- {
- if (st.st_uid == myself->uid)
- {
- if (!(st.st_mode & S_IWUSR))
- goto done;
- }
- else if (st.st_gid == myself->gid)
- {
- if (!(st.st_mode & S_IWGRP))
- goto done;
- }
- else if (!(st.st_mode & S_IWOTH))
- goto done;
- }
- if (flags & X_OK)
- {
- if (st.st_uid == myself->uid)
- {
- if (!(st.st_mode & S_IXUSR))
- goto done;
- }
- else if (st.st_gid == myself->gid)
- {
- if (!(st.st_mode & S_IXGRP))
- goto done;
- }
- else if (!(st.st_mode & S_IXOTH))
- goto done;
- }
- r = 0;
-done:
- if (r)
- set_errno (EACCES);
- return r;
-}
-
-extern "C" int
-_rename (const char *oldpath, const char *newpath)
-{
- sigframe thisframe (mainthread);
- int res = 0;
- char *lnk_suffix = NULL;
-
- path_conv real_old (oldpath, PC_SYM_NOFOLLOW);
-
- if (real_old.error)
- {
- syscall_printf ("-1 = rename (%s, %s)", oldpath, newpath);
- set_errno (real_old.error);
- return -1;
- }
-
- path_conv real_new (newpath, PC_SYM_NOFOLLOW);
-
- /* Shortcut hack. */
- char new_lnk_buf[MAX_PATH + 5];
- if (real_old.issymlink () && !real_new.error && !real_new.case_clash)
- {
- int len_old = strlen (real_old.get_win32 ());
- if (strcasematch (real_old.get_win32 () + len_old - 4, ".lnk"))
- {
- strcpy (new_lnk_buf, newpath);
- strcat (new_lnk_buf, ".lnk");
- newpath = new_lnk_buf;
- real_new.check (newpath, PC_SYM_NOFOLLOW);
- }
- }
-
- if (real_new.error || real_new.case_clash)
- {
- syscall_printf ("-1 = rename (%s, %s)", oldpath, newpath);
- set_errno (real_new.case_clash ? ECASECLASH : real_new.error);
- return -1;
- }
-
- if (!writable_directory (real_old) || !writable_directory (real_new))
- {
- syscall_printf ("-1 = rename (%s, %s)", oldpath, newpath);
- set_errno (EACCES);
- return -1;
- }
-
- if (!real_old.exists ()) /* file to move doesn't exist */
- {
- syscall_printf ("file to move doesn't exist");
- set_errno (ENOENT);
- return (-1);
- }
-
- /* Destination file exists and is read only, change that or else
- the rename won't work. */
- if (real_new.has_attribute (FILE_ATTRIBUTE_READONLY))
- SetFileAttributes (real_new, (DWORD) real_new & ~FILE_ATTRIBUTE_READONLY);
-
- /* Shortcut hack No. 2, part 1 */
- if (!real_old.issymlink () && !real_new.error && real_new.issymlink () &&
- real_new.known_suffix && strcasematch (real_new.known_suffix, ".lnk") &&
- (lnk_suffix = strrchr (real_new.get_win32 (), '.')))
- *lnk_suffix = '\0';
-
- if (!MoveFile (real_old, real_new))
- res = -1;
-
- if (res == 0 || (GetLastError () != ERROR_ALREADY_EXISTS
- && GetLastError () != ERROR_FILE_EXISTS))
- goto done;
-
- if (wincap.has_move_file_ex ())
- {
- if (MoveFileEx (real_old.get_win32 (), real_new.get_win32 (),
- MOVEFILE_REPLACE_EXISTING))
- res = 0;
- }
- else
- {
- syscall_printf ("try win95 hack");
- for (int i = 0; i < 2; i++)
- {
- if (!DeleteFileA (real_new.get_win32 ()) &&
- GetLastError () != ERROR_FILE_NOT_FOUND)
- {
- syscall_printf ("deleting %s to be paranoid",
- real_new.get_win32 ());
- break;
- }
- else if (MoveFile (real_old.get_win32 (), real_new.get_win32 ()))
- {
- res = 0;
- break;
- }
- }
- }
-
-done:
- if (res)
- {
- __seterrno ();
- /* Reset R/O attributes if neccessary. */
- if (real_new.has_attribute (FILE_ATTRIBUTE_READONLY))
- SetFileAttributes (real_new, real_new);
- }
- else
- {
- /* make the new file have the permissions of the old one */
- DWORD attr = real_old;
-#ifdef HIDDEN_DOT_FILES
- char *c = strrchr (real_old.get_win32 (), '\\');
- if ((c && c[1] == '.') || *real_old.get_win32 () == '.')
- attr &= ~FILE_ATTRIBUTE_HIDDEN;
- c = strrchr (real_new.get_win32 (), '\\');
- if ((c && c[1] == '.') || *real_new.get_win32 () == '.')
- attr |= FILE_ATTRIBUTE_HIDDEN;
-#endif
- SetFileAttributes (real_new, attr);
-
- /* Shortcut hack, No. 2, part 2 */
- /* if the new filename was an existing shortcut, remove it now if the
- new filename is equal to the shortcut name without .lnk suffix. */
- if (lnk_suffix)
- {
- *lnk_suffix = '.';
- DeleteFile (real_new);
- }
- }
-
- syscall_printf ("%d = rename (%s, %s)", res, (char *) real_old,
- (char *) real_new);
-
- return res;
-}
-
-extern "C" int
-system (const char *cmdstring)
-{
- if (check_null_empty_str_errno (cmdstring))
- return -1;
-
- sigframe thisframe (mainthread);
- int res;
- const char* command[4];
- _sig_func_ptr oldint, oldquit;
- sigset_t child_block, old_mask;
-
- if (cmdstring == (const char *) NULL)
- return 1;
-
- oldint = signal (SIGINT, SIG_IGN);
- oldquit = signal (SIGQUIT, SIG_IGN);
- sigemptyset (&child_block);
- sigaddset (&child_block, SIGCHLD);
- (void) sigprocmask (SIG_BLOCK, &child_block, &old_mask);
-
- command[0] = "sh";
- command[1] = "-c";
- command[2] = cmdstring;
- command[3] = (const char *) NULL;
-
- if ((res = spawnvp (_P_WAIT, "sh", command)) == -1)
- {
- // when exec fails, return value should be as if shell
- // executed exit (127)
- res = 127;
- }
-
- signal (SIGINT, oldint);
- signal (SIGQUIT, oldquit);
- (void) sigprocmask (SIG_SETMASK, &old_mask, 0);
- return res;
-}
-
-extern "C" int
-setdtablesize (int size)
-{
- if (size <= (int)cygheap->fdtab.size || cygheap->fdtab.extend (size - cygheap->fdtab.size))
- return 0;
-
- return -1;
-}
-
-extern "C" int
-getdtablesize ()
-{
- return cygheap->fdtab.size > OPEN_MAX ? cygheap->fdtab.size : OPEN_MAX;
-}
-
-extern "C" size_t
-getpagesize ()
-{
- if (!system_info.dwPageSize)
- GetSystemInfo (&system_info);
- return (int) system_info.dwPageSize;
-}
-
-static int
-check_posix_perm (const char *fname, int v)
-{
- extern int allow_ntea, allow_ntsec, allow_smbntsec;
-
- /* Windows 95/98/ME don't support file system security at all. */
- if (!wincap.has_security ())
- return 0;
-
- /* ntea is ok for supporting permission bits but it doesn't support
- full POSIX security settings. */
- if (v == _PC_POSIX_PERMISSIONS && allow_ntea)
- return 1;
-
- if (!allow_ntsec)
- return 0;
-
- char *root = rootdir (strcpy ((char *)alloca (strlen (fname)), fname));
-
- if (!allow_smbntsec
- && ((root[0] == '\\' && root[1] == '\\')
- || GetDriveType (root) == DRIVE_REMOTE))
- return 0;
-
- DWORD vsn, len, flags;
- if (!GetVolumeInformation (root, NULL, 0, &vsn, &len, &flags, NULL, 16))
- {
- __seterrno ();
- return 0;
- }
-
- return (flags & FS_PERSISTENT_ACLS) ? 1 : 0;
-}
-
-/* FIXME: not all values are correct... */
-extern "C" long int
-fpathconf (int fd, int v)
-{
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- return -1;
- switch (v)
- {
- case _PC_LINK_MAX:
- return _POSIX_LINK_MAX;
- case _PC_MAX_CANON:
- case _PC_MAX_INPUT:
- if (isatty (fd))
- return _POSIX_MAX_CANON;
- else
- {
- set_errno (EBADF);
- return -1;
- }
- case _PC_NAME_MAX:
- case _PC_PATH_MAX:
- return PATH_MAX;
- case _PC_PIPE_BUF:
- return PIPE_BUF;
- case _PC_CHOWN_RESTRICTED:
- case _PC_NO_TRUNC:
- return -1;
- case _PC_VDISABLE:
- if (cfd->is_tty ())
- return -1;
- else
- {
- set_errno (EBADF);
- return -1;
- }
- case _PC_POSIX_PERMISSIONS:
- case _PC_POSIX_SECURITY:
- if (cfd->get_device () == FH_DISK)
- return check_posix_perm (cfd->get_win32_name (), v);
- set_errno (EINVAL);
- return -1;
- default:
- set_errno (EINVAL);
- return -1;
- }
-}
-
-extern "C" long int
-pathconf (const char *file, int v)
-{
- switch (v)
- {
- case _PC_PATH_MAX:
- if (check_null_empty_str_errno (file))
- return -1;
- return PATH_MAX - strlen (file);
- case _PC_NAME_MAX:
- return PATH_MAX;
- case _PC_LINK_MAX:
- return _POSIX_LINK_MAX;
- case _PC_MAX_CANON:
- case _PC_MAX_INPUT:
- return _POSIX_MAX_CANON;
- case _PC_PIPE_BUF:
- return PIPE_BUF;
- case _PC_CHOWN_RESTRICTED:
- case _PC_NO_TRUNC:
- return -1;
- case _PC_VDISABLE:
- return -1;
- case _PC_POSIX_PERMISSIONS:
- case _PC_POSIX_SECURITY:
- {
- path_conv full_path (file, PC_SYM_FOLLOW | PC_FULL);
- if (full_path.error)
- {
- set_errno (full_path.error);
- return -1;
- }
- if (full_path.is_device ())
- {
- set_errno (EINVAL);
- return -1;
- }
- return check_posix_perm (full_path, v);
- }
- default:
- set_errno (EINVAL);
- return -1;
- }
-}
-
-extern "C" char *
-ttyname (int fd)
-{
- cygheap_fdget cfd (fd);
- if (cfd < 0 || !cfd->is_tty ())
- {
- return 0;
- }
- return (char *) (cfd->ttyname ());
-}
-
-extern "C" char *
-ctermid (char *str)
-{
- static NO_COPY char buf[16];
- if (str == NULL)
- str = buf;
- if (!real_tty_attached (myself))
- strcpy (str, "/dev/conin");
- else
- __small_sprintf (str, "/dev/tty%d", myself->ctty);
- return str;
-}
-
-/* Tells stdio if it should do the cr/lf conversion for this file */
-extern "C" int
-_cygwin_istext_for_stdio (int fd)
-{
- syscall_printf ("_cygwin_istext_for_stdio (%d)\n", fd);
- if (CYGWIN_VERSION_OLD_STDIO_CRLF_HANDLING)
- {
- syscall_printf (" _cifs: old API\n");
- return 0; /* we do it for old apps, due to getc/putc macros */
- }
-
- cygheap_fdget cfd (fd, false, false);
- if (cfd < 0)
- {
- syscall_printf (" _cifs: fd not open\n");
- return 0;
- }
-
- if (cfd->get_device () != FH_DISK)
- {
- syscall_printf (" _cifs: fd not disk file\n");
- return 0;
- }
-
- if (cfd->get_w_binary () || cfd->get_r_binary ())
- {
- syscall_printf (" _cifs: get_*_binary\n");
- return 0;
- }
-
- syscall_printf ("_cygwin_istext_for_stdio says yes\n");
- return 1;
-}
-
-/* internal newlib function */
-extern "C" int _fwalk (struct _reent *ptr, int (*function) (FILE *));
-
-static int setmode_mode;
-static int setmode_file;
-
-static int
-setmode_helper (FILE *f)
-{
- if (fileno (f) != setmode_file)
- return 0;
- syscall_printf ("setmode: file was %s now %s\n",
- f->_flags & __SCLE ? "text" : "raw",
- setmode_mode & O_TEXT ? "text" : "raw");
- if (setmode_mode & O_TEXT)
- f->_flags |= __SCLE;
- else
- f->_flags &= ~__SCLE;
- return 0;
-}
-
-extern "C" int
-getmode (int fd)
-{
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- return -1;
-
- return cfd->get_flags () & (O_BINARY | O_TEXT);
-}
-
-/* Set a file descriptor into text or binary mode, returning the
- previous mode. */
-
-extern "C" int
-setmode (int fd, int mode)
-{
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- return -1;
- if (mode != O_BINARY && mode != O_TEXT && mode != 0)
- {
- set_errno (EINVAL);
- return -1;
- }
-
- /* Note that we have no way to indicate the case that writes are
- binary but not reads, or vice-versa. These cases can arise when
- using the tty or console interface. People using those
- interfaces should not use setmode. */
-
- int res;
- if (cfd->get_w_binary () && cfd->get_r_binary ())
- res = O_BINARY;
- else if (cfd->get_w_binset () && cfd->get_r_binset ())
- res = O_TEXT; /* Specifically set O_TEXT */
- else
- res = 0;
-
- if (!mode)
- cfd->reset_to_open_binmode ();
- else
- cfd->set_flags ((cfd->get_flags () & ~(O_TEXT | O_BINARY)) | mode);
-
- if (_cygwin_istext_for_stdio (fd))
- setmode_mode = O_TEXT;
- else
- setmode_mode = O_BINARY;
- setmode_file = fd;
- _fwalk (_REENT, setmode_helper);
-
- syscall_printf ("setmode (%d<%s>, %p) returns %s\n", fd, cfd->get_name (),
- mode, res & O_TEXT ? "text" : "binary");
- return res;
-}
-
-extern "C" int
-ftruncate64 (int fd, __off64_t length)
-{
- sigframe thisframe (mainthread);
- int res = -1;
-
- if (length < 0)
- set_errno (EINVAL);
- else
- {
- cygheap_fdget cfd (fd);
- if (cfd >= 0)
- {
- HANDLE h = cygheap->fdtab[fd]->get_handle ();
-
- if (cfd->get_handle ())
- {
- /* remember curr file pointer location */
- __off64_t prev_loc = cfd->lseek (0, SEEK_CUR);
-
- cfd->lseek (length, SEEK_SET);
- if (!SetEndOfFile (h))
- __seterrno ();
- else
- res = 0;
-
- /* restore original file pointer location */
- cfd->lseek (prev_loc, SEEK_SET);
- }
- }
- }
-
- syscall_printf ("%d = ftruncate (%d, %d)", res, fd, length);
- return res;
-}
-
-/* ftruncate: P96 5.6.7.1 */
-extern "C" int
-ftruncate (int fd, __off32_t length)
-{
- return ftruncate64 (fd, (__off64_t)length);
-}
-
-/* truncate: Provided by SVR4 and 4.3+BSD. Not part of POSIX.1 or XPG3 */
-extern "C" int
-truncate64 (const char *pathname, __off64_t length)
-{
- sigframe thisframe (mainthread);
- int fd;
- int res = -1;
-
- fd = open (pathname, O_RDWR);
-
- if (fd == -1)
- set_errno (EBADF);
- else
- {
- res = ftruncate64 (fd, length);
- close (fd);
- }
- syscall_printf ("%d = truncate (%s, %d)", res, pathname, length);
-
- return res;
-}
-
-/* truncate: Provided by SVR4 and 4.3+BSD. Not part of POSIX.1 or XPG3 */
-extern "C" int
-truncate (const char *pathname, __off32_t length)
-{
- return truncate64 (pathname, (__off64_t)length);
-}
-
-extern "C" long
-get_osfhandle (int fd)
-{
- long res;
-
- cygheap_fdget cfd (fd);
- if (cfd >= 0)
- res = (long) cfd->get_handle ();
- else
- res = -1;
-
- syscall_printf ("%d = get_osfhandle (%d)", res, fd);
- return res;
-}
-
-extern "C" int
-statfs (const char *fname, struct statfs *sfs)
-{
- sigframe thisframe (mainthread);
- if (!sfs)
- {
- set_errno (EFAULT);
- return -1;
- }
-
- path_conv full_path (fname, PC_SYM_FOLLOW | PC_FULL);
- char *root = rootdir (full_path);
-
- syscall_printf ("statfs %s", root);
-
- DWORD spc, bps, freec, totalc;
-
- if (!GetDiskFreeSpace (root, &spc, &bps, &freec, &totalc))
- {
- __seterrno ();
- return -1;
- }
-
- DWORD vsn, maxlen, flags;
-
- if (!GetVolumeInformation (root, NULL, 0, &vsn, &maxlen, &flags, NULL, 0))
- {
- __seterrno ();
- return -1;
- }
- sfs->f_type = flags;
- sfs->f_bsize = spc*bps;
- sfs->f_blocks = totalc;
- sfs->f_bfree = sfs->f_bavail = freec;
- sfs->f_files = -1;
- sfs->f_ffree = -1;
- sfs->f_fsid = vsn;
- sfs->f_namelen = maxlen;
- return 0;
-}
-
-extern "C" int
-fstatfs (int fd, struct statfs *sfs)
-{
- sigframe thisframe (mainthread);
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- return -1;
- return statfs (cfd->get_name (), sfs);
-}
-
-/* setpgid: POSIX 4.3.3.1 */
-extern "C" int
-setpgid (pid_t pid, pid_t pgid)
-{
- sigframe thisframe (mainthread);
- int res = -1;
- if (pid == 0)
- pid = getpid ();
- if (pgid == 0)
- pgid = pid;
-
- if (pgid < 0)
- {
- set_errno (EINVAL);
- goto out;
- }
- else
- {
- pinfo p (pid);
- if (!p)
- {
- set_errno (ESRCH);
- goto out;
- }
- /* A process may only change the process group of itself and its children */
- if (p == myself || p->ppid == myself->pid)
- {
- p->pgid = pgid;
- if (p->pid != p->pgid)
- p->set_has_pgid_children (0);
- res = 0;
- }
- else
- {
- set_errno (EPERM);
- goto out;
- }
- }
-out:
- syscall_printf ("pid %d, pgid %d, res %d", pid, pgid, res);
- return res;
-}
-
-extern "C" pid_t
-getpgid (pid_t pid)
-{
- sigframe thisframe (mainthread);
- if (pid == 0)
- pid = getpid ();
-
- pinfo p (pid);
- if (p == 0)
- {
- set_errno (ESRCH);
- return -1;
- }
- return p->pgid;
-}
-
-extern "C" int
-setpgrp (void)
-{
- sigframe thisframe (mainthread);
- return setpgid (0, 0);
-}
-
-extern "C" pid_t
-getpgrp (void)
-{
- sigframe thisframe (mainthread);
- return getpgid (0);
-}
-
-extern "C" char *
-ptsname (int fd)
-{
- sigframe thisframe (mainthread);
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- return 0;
- return (char *) (cfd->ptsname ());
-}
-
-/* FIXME: what is this? */
-extern "C" int __declspec(dllexport)
-regfree ()
-{
- return 0;
-}
-
-/* mknod was the call to create directories before the introduction
- of mkdir in 4.2BSD and SVR3. Use of mknod required superuser privs
- so the mkdir command had to be setuid root.
- Although mknod hasn't been implemented yet, some GNU tools (e.g. the
- fileutils) assume its existence so we must provide a stub that always
- fails. */
-extern "C" int
-mknod (const char *_path, mode_t mode, dev_t dev)
-{
- set_errno (ENOSYS);
- return -1;
-}
-
-extern "C" int
-mkfifo (const char *_path, mode_t mode)
-{
- set_errno (ENOSYS);
- return -1;
-}
-
-extern struct passwd *internal_getlogin (cygheap_user &user);
-
-/* seteuid: standards? */
-extern "C" int
-seteuid32 (__uid32_t uid)
-{
- if (!wincap.has_security ()) return 0;
-
- if (uid == ILLEGAL_UID)
- {
- debug_printf ("new euid == illegal euid, nothing happens");
- return 0;
- }
-
- sigframe thisframe (mainthread);
- DWORD ulen = UNLEN + 1;
- DWORD dlen = INTERNET_MAX_HOST_NAME_LENGTH + 1;
- char orig_username[UNLEN + 1];
- char orig_domain[INTERNET_MAX_HOST_NAME_LENGTH + 1];
- char username[UNLEN + 1];
- char domain[INTERNET_MAX_HOST_NAME_LENGTH + 1];
- cygsid usersid, pgrpsid;
- HANDLE ptok, sav_token;
- BOOL sav_impersonated, sav_token_is_internal_token;
- BOOL process_ok, explicitly_created_token = FALSE;
- struct passwd * pw_new, * pw_cur;
- cygheap_user user;
- PSID origpsid, psid2 = NO_SID;
-
- debug_printf ("uid: %d myself->gid: %d", uid, myself->gid);
-
- pw_new = getpwuid32 (uid);
- if (!usersid.getfrompw (pw_new) ||
- (!pgrpsid.getfromgr (getgrgid32 (myself->gid))))
- {
- set_errno (EINVAL);
- return -1;
- }
- /* Save current information */
- sav_token = cygheap->user.token;
- sav_impersonated = cygheap->user.impersonated;
- char *env;
- orig_username[0] = orig_domain[0] = '\0';
- if ((env = getenv ("USERNAME")))
- strlcpy (orig_username, env, sizeof(orig_username));
- if ((env = getenv ("USERDOMAIN")))
- strlcpy (orig_domain, env, sizeof(orig_domain));
-
- RevertToSelf();
- if (!OpenProcessToken (GetCurrentProcess (),
- TOKEN_QUERY | TOKEN_ADJUST_DEFAULT, &ptok))
- {
- __seterrno ();
- goto failed;
- }
- /* Verify if the process token is suitable.
- Currently we do not try to differentiate between
- internal tokens and others */
- process_ok = verify_token(ptok, usersid, pgrpsid);
- debug_printf("Process token %sverified", process_ok?"":"not ");
- if (process_ok)
- {
- if (cygheap->user.token == INVALID_HANDLE_VALUE ||
- !cygheap->user.impersonated)
- {
- CloseHandle (ptok);
- return 0; /* No change */
- }
- else cygheap->user.impersonated = FALSE;
- }
-
- if (!process_ok && cygheap->user.token != INVALID_HANDLE_VALUE)
- {
- /* Verify if the current tokem is suitable */
- BOOL token_ok = verify_token (cygheap->user.token, usersid, pgrpsid,
- & sav_token_is_internal_token);
- debug_printf("Thread token %d %sverified",
- cygheap->user.token, token_ok?"":"not ");
- if (token_ok)
- {
- /* Return if current token is valid */
- if (cygheap->user.impersonated)
- {
- CloseHandle (ptok);
- if (!ImpersonateLoggedOnUser (cygheap->user.token))
- system_printf ("Impersonating in seteuid failed: %E");
- return 0; /* No change */
- }
- }
- else cygheap->user.token = INVALID_HANDLE_VALUE;
- }
-
- /* Set process def dacl to allow access to impersonated token */
- char dacl_buf[MAX_DACL_LEN(5)];
- if (usersid != (origpsid = cygheap->user.orig_sid())) psid2 = usersid;
- if (sec_acl ((PACL) dacl_buf, FALSE, origpsid, psid2))
- {
- TOKEN_DEFAULT_DACL tdacl;
- tdacl.DefaultDacl = (PACL) dacl_buf;
- if (!SetTokenInformation (ptok, TokenDefaultDacl,
- &tdacl, sizeof dacl_buf))
- debug_printf ("SetTokenInformation"
- "(TokenDefaultDacl): %E");
- }
- CloseHandle (ptok);
-
- if (!process_ok && cygheap->user.token == INVALID_HANDLE_VALUE)
- {
- /* If no impersonation token is available, try to
- authenticate using NtCreateToken() or subauthentication. */
- cygheap->user.token = create_token (usersid, pgrpsid);
- if (cygheap->user.token != INVALID_HANDLE_VALUE)
- explicitly_created_token = TRUE;
- else
- {
- /* create_token failed. Try subauthentication. */
- debug_printf ("create token failed, try subauthentication.");
- cygheap->user.token = subauth (pw_new);
- if (cygheap->user.token == INVALID_HANDLE_VALUE) goto failed;
- }
- }
-
- /* Lookup username and domain before impersonating,
- LookupAccountSid() returns a different answer afterwards. */
- SID_NAME_USE use;
- if (!LookupAccountSid (NULL, usersid, username, &ulen,
- domain, &dlen, &use))
- {
- debug_printf ("LookupAccountSid (): %E");
- __seterrno ();
- goto failed;
- }
- /* If using the token, set info and impersonate */
- if (!process_ok)
- {
- /* If the token was explicitly created, all information has
- already been set correctly. */
- if (!explicitly_created_token)
- {
- /* Try setting owner to same value as user. */
- if (!SetTokenInformation (cygheap->user.token, TokenOwner,
- &usersid, sizeof usersid))
- debug_printf ("SetTokenInformation(user.token, "
- "TokenOwner): %E");
- /* Try setting primary group in token to current group */
- if (!SetTokenInformation (cygheap->user.token,
- TokenPrimaryGroup,
- &pgrpsid, sizeof pgrpsid))
- debug_printf ("SetTokenInformation(user.token, "
- "TokenPrimaryGroup): %E");
- }
- /* Now try to impersonate. */
- if (!ImpersonateLoggedOnUser (cygheap->user.token))
- {
- debug_printf ("ImpersonateLoggedOnUser %E");
- __seterrno ();
- goto failed;
- }
- cygheap->user.impersonated = TRUE;
- }
-
- /* user.token is used in internal_getlogin () to determine if
- impersonation is active. If so, the token is used for
- retrieving user's SID. */
- user.token = cygheap->user.impersonated ? cygheap->user.token
- : INVALID_HANDLE_VALUE;
- /* Unsetting these two env vars is necessary to get NetUserGetInfo()
- called in internal_getlogin (). Otherwise the wrong path is used
- after a user switch, probably. */
- unsetenv ("HOMEDRIVE");
- unsetenv ("HOMEPATH");
- setenv ("USERDOMAIN", domain, 1);
- setenv ("USERNAME", username, 1);
- pw_cur = internal_getlogin (user);
- if (pw_cur == pw_new)
- {
- /* If sav_token was internally created and is replaced, destroy it. */
- if (sav_token != INVALID_HANDLE_VALUE &&
- sav_token != cygheap->user.token &&
- sav_token_is_internal_token)
- CloseHandle (sav_token);
- myself->uid = uid;
- cygheap->user = user;
- return 0;
- }
- debug_printf ("Diffs!!! token: %d, cur: %d, new: %d, orig: %d",
- cygheap->user.token, pw_cur->pw_uid,
- pw_new->pw_uid, cygheap->user.orig_uid);
- set_errno (EPERM);
-
- failed:
- setenv ("USERNAME", orig_username, 1);
- setenv ("USERDOMAIN", orig_domain, 1);
- cygheap->user.token = sav_token;
- cygheap->user.impersonated = sav_impersonated;
- if ( cygheap->user.token != INVALID_HANDLE_VALUE &&
- cygheap->user.impersonated &&
- !ImpersonateLoggedOnUser (cygheap->user.token))
- system_printf ("Impersonating in seteuid failed: %E");
- return -1;
-}
-
-extern "C" int
-seteuid (__uid16_t uid)
-{
- return seteuid32 (uid16touid32 (uid));
-}
-
-/* setuid: POSIX 4.2.2.1 */
-extern "C" int
-setuid32 (__uid32_t uid)
-{
- int ret = seteuid32 (uid);
- if (!ret)
- cygheap->user.real_uid = myself->uid;
- debug_printf ("real: %d, effective: %d", cygheap->user.real_uid, myself->uid);
- return ret;
-}
-
-extern "C" int
-setuid (__uid16_t uid)
-{
- return setuid32 (uid16touid32 (uid));
-}
-
-/* setegid: from System V. */
-extern "C" int
-setegid32 (__gid32_t gid)
-{
- if ((!wincap.has_security ()) ||
- (gid == ILLEGAL_GID))
- return 0;
-
- sigframe thisframe (mainthread);
- cygsid gsid;
- HANDLE ptok;
-
- struct __group32 * gr = getgrgid32 (gid);
- if (!gr || gr->gr_gid != gid || !gsid.getfromgr (gr))
- {
- set_errno (EINVAL);
- return -1;
- }
- myself->gid = gid;
-
- /* If impersonated, update primary group and revert */
- if (cygheap->user.token != INVALID_HANDLE_VALUE
- && cygheap->user.impersonated)
- {
- if (!SetTokenInformation (cygheap->user.token,
- TokenPrimaryGroup,
- &gsid, sizeof gsid))
- debug_printf ("SetTokenInformation(thread, "
- "TokenPrimaryGroup): %E");
- RevertToSelf ();
- }
- if (!OpenProcessToken (GetCurrentProcess (),
- TOKEN_ADJUST_DEFAULT,
- &ptok))
- debug_printf ("OpenProcessToken(): %E\n");
- else
- {
- if (!SetTokenInformation (ptok, TokenPrimaryGroup,
- &gsid, sizeof gsid))
- debug_printf ("SetTokenInformation(process, "
- "TokenPrimaryGroup): %E");
- CloseHandle (ptok);
- }
- if (cygheap->user.token != INVALID_HANDLE_VALUE
- && cygheap->user.impersonated
- && !ImpersonateLoggedOnUser (cygheap->user.token))
- system_printf ("Impersonating in setegid failed: %E");
- return 0;
-}
-
-extern "C" int
-setegid (__gid16_t gid)
-{
- return setegid32 (gid16togid32 (gid));
-}
-
-/* setgid: POSIX 4.2.2.1 */
-extern "C" int
-setgid32 (__gid32_t gid)
-{
- int ret = setegid32 (gid);
- if (!ret)
- cygheap->user.real_gid = myself->gid;
- return ret;
-}
-
-extern "C" int
-setgid (__gid16_t gid)
-{
- int ret = setegid32 (gid16togid32 (gid));
- if (!ret)
- cygheap->user.real_gid = myself->gid;
- return ret;
-}
-
-/* chroot: privileged Unix system call. */
-/* FIXME: Not privileged here. How should this be done? */
-extern "C" int
-chroot (const char *newroot)
-{
- sigframe thisframe (mainthread);
- path_conv path (newroot, PC_SYM_FOLLOW | PC_FULL | PC_POSIX);
-
- int ret;
- if (path.error)
- ret = -1;
- else if (!path.exists ())
- {
- set_errno (ENOENT);
- ret = -1;
- }
- else if (!path.isdir ())
- {
- set_errno (ENOTDIR);
- ret = -1;
- }
- else
- {
- cygheap->root.set (path.normalized_path, path);
- ret = 0;
- }
-
- syscall_printf ("%d = chroot (%s)", ret ? get_errno () : 0,
- newroot ? newroot : "NULL");
- return ret;
-}
-
-extern "C" int
-creat (const char *path, mode_t mode)
-{
- sigframe thisframe (mainthread);
- return open (path, O_WRONLY | O_CREAT | O_TRUNC, mode);
-}
-
-extern "C" void
-__assertfail ()
-{
- exit (99);
-}
-
-extern "C" int
-getw (FILE *fp)
-{
- sigframe thisframe (mainthread);
- int w, ret;
- ret = fread (&w, sizeof (int), 1, fp);
- return ret != 1 ? EOF : w;
-}
-
-extern "C" int
-putw (int w, FILE *fp)
-{
- sigframe thisframe (mainthread);
- int ret;
- ret = fwrite (&w, sizeof (int), 1, fp);
- if (feof (fp) || ferror (fp))
- return -1;
- return 0;
-}
-
-extern "C" int
-wcscmp (const wchar_t *s1, const wchar_t *s2)
-{
- while (*s1 && *s1 == *s2)
- {
- s1++;
- s2++;
- }
-
- return (* (unsigned short *) s1) - (* (unsigned short *) s2);
-}
-
-extern "C" size_t
-wcslen (const wchar_t *s1)
-{
- int l = 0;
- while (s1[l])
- l++;
- return l;
-}
-
-/* FIXME: to do this right, maybe work out the usoft va_list machine
- and use wsvprintfW instead?
-*/
-extern "C" int
-wprintf (const char *fmt, ...)
-{
- va_list ap;
- int ret;
-
- va_start (ap, fmt);
- ret = vprintf (fmt, ap);
- va_end (ap);
- return ret;
-}
-
-extern "C" int
-vhangup ()
-{
- set_errno (ENOSYS);
- return -1;
-}
-
-extern "C" _PTR
-memccpy (_PTR out, const _PTR in, int c, size_t len)
-{
- const char *inc = (char *) in;
- char *outc = (char *) out;
-
- while (len)
- {
- char x = *inc++;
- *outc++ = x;
- if (x == c)
- return outc;
- len --;
- }
- return 0;
-}
-
-extern "C" int
-nice (int incr)
-{
- sigframe thisframe (mainthread);
- DWORD priority[] =
- {
- IDLE_PRIORITY_CLASS,
- IDLE_PRIORITY_CLASS,
- NORMAL_PRIORITY_CLASS,
- HIGH_PRIORITY_CLASS,
- REALTIME_PRIORITY_CLASS,
- REALTIME_PRIORITY_CLASS
- };
- int curr = 2;
-
- switch (GetPriorityClass (hMainProc))
- {
- case IDLE_PRIORITY_CLASS:
- curr = 1;
- break;
- case NORMAL_PRIORITY_CLASS:
- curr = 2;
- break;
- case HIGH_PRIORITY_CLASS:
- curr = 3;
- break;
- case REALTIME_PRIORITY_CLASS:
- curr = 4;
- break;
- }
- if (incr > 0)
- incr = -1;
- else if (incr < 0)
- incr = 1;
-
- if (SetPriorityClass (hMainProc, priority[curr + incr]) == FALSE)
- {
- __seterrno ();
- return -1;
- }
-
- return 0;
-}
-
-/*
- * Find the first bit set in I.
- */
-
-extern "C" int
-ffs (int i)
-{
- static const unsigned char table[] =
- {
- 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
- 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
- 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
- 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
- };
- unsigned long int a;
- unsigned long int x = i & -i;
-
- a = x <= 0xffff ? (x <= 0xff ? 0 : 8) : (x <= 0xffffff ? 16 : 24);
-
- return table[x >> a] + a;
-}
-
-extern "C" void
-login (struct utmp *ut)
-{
- sigframe thisframe (mainthread);
- register int fd;
- int currtty = ttyslot ();
-
- if (currtty >= 0 && (fd = open (_PATH_UTMP, O_WRONLY | O_CREAT | O_BINARY,
- 0644)) >= 0)
- {
- (void) lseek (fd, (long) (currtty * sizeof (struct utmp)), SEEK_SET);
- (void) write (fd, (char *) ut, sizeof (struct utmp));
- (void) close (fd);
- }
- if ((fd = open (_PATH_WTMP, O_WRONLY | O_APPEND | O_BINARY, 0)) >= 0)
- {
- (void) write (fd, (char *) ut, sizeof (struct utmp));
- (void) close (fd);
- }
-}
-
-/* It isn't possible to use unix-style I/O function in logout code because
-cygwin's I/O subsystem may be inaccessible at logout () call time.
-FIXME (cgf): huh?
-*/
-extern "C" int
-logout (char *line)
-{
- sigframe thisframe (mainthread);
- int res = 0;
- HANDLE ut_fd;
- static const char path_utmp[] = _PATH_UTMP;
-
- path_conv win32_path (path_utmp);
- if (win32_path.error)
- return 0;
-
- ut_fd = CreateFile (win32_path.get_win32 (),
- GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- &sec_none_nih,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL,
- NULL);
- if (ut_fd != INVALID_HANDLE_VALUE)
- {
- struct utmp *ut;
- struct utmp ut_buf[100];
- /* FIXME: utmp file access is not 64 bit clean for now. */
- __off32_t pos = 0; /* Position in file */
- DWORD rd;
-
- while (!res && ReadFile (ut_fd, ut_buf, sizeof ut_buf, &rd, NULL)
- && rd != 0)
- {
- struct utmp *ut_end = (struct utmp *) ((char *) ut_buf + rd);
-
- for (ut = ut_buf; ut < ut_end; ut++, pos += sizeof (*ut))
- if (ut->ut_name[0]
- && strncmp (ut->ut_line, line, sizeof (ut->ut_line)) == 0)
- /* Found the entry for LINE; mark it as logged out. */
- {
- /* Zero out entries describing who's logged in. */
- bzero (ut->ut_name, sizeof (ut->ut_name));
- bzero (ut->ut_host, sizeof (ut->ut_host));
- time (&ut->ut_time);
-
- /* Now seek back to the position in utmp at which UT occured,
- and write the new version of UT there. */
- if ((SetFilePointer (ut_fd, pos, 0, FILE_BEGIN) != 0xFFFFFFFF)
- && (WriteFile (ut_fd, (char *) ut, sizeof (*ut),
- &rd, NULL)))
- {
- res = 1;
- break;
- }
- }
- }
-
- CloseHandle (ut_fd);
- }
-
- return res;
-}
-
-static int utmp_fd = -2;
-static char *utmp_file = (char *) _PATH_UTMP;
-
-static struct utmp utmp_data;
-
-extern "C" void
-setutent ()
-{
- sigframe thisframe (mainthread);
- if (utmp_fd == -2)
- {
- utmp_fd = _open (utmp_file, O_RDONLY);
- }
- _lseek (utmp_fd, 0, SEEK_SET);
-}
-
-extern "C" void
-endutent ()
-{
- sigframe thisframe (mainthread);
- _close (utmp_fd);
- utmp_fd = -2;
-}
-
-extern "C" void
-utmpname (_CONST char *file)
-{
- sigframe thisframe (mainthread);
- if (check_null_empty_str (file))
- {
- debug_printf ("Invalid file");
- return;
- }
- utmp_file = strdup (file);
- debug_printf ("New UTMP file: %s", utmp_file);
-}
-
-extern "C" struct utmp *
-getutent ()
-{
- sigframe thisframe (mainthread);
- if (utmp_fd == -2)
- setutent ();
- if (_read (utmp_fd, &utmp_data, sizeof (utmp_data)) != sizeof (utmp_data))
- return NULL;
- return &utmp_data;
-}
-
-extern "C" struct utmp *
-getutid (struct utmp *id)
-{
- sigframe thisframe (mainthread);
- if (check_null_invalid_struct_errno (id))
- return NULL;
- while (_read (utmp_fd, &utmp_data, sizeof (utmp_data)) == sizeof (utmp_data))
- {
- switch (id->ut_type)
- {
-#if 0 /* Not available in Cygwin. */
- case RUN_LVL:
- case BOOT_TIME:
- case OLD_TIME:
- case NEW_TIME:
- if (id->ut_type == utmp_data.ut_type)
- return &utmp_data;
- break;
-#endif
- case INIT_PROCESS:
- case LOGIN_PROCESS:
- case USER_PROCESS:
- case DEAD_PROCESS:
- if (id->ut_id == utmp_data.ut_id)
- return &utmp_data;
- break;
- default:
- return NULL;
- }
- }
- return NULL;
-}
-
-extern "C" struct utmp *
-getutline (struct utmp *line)
-{
- sigframe thisframe (mainthread);
- if (check_null_invalid_struct_errno (line))
- return NULL;
- while (_read (utmp_fd, &utmp_data, sizeof (utmp_data)) == sizeof (utmp_data))
- {
- if ((utmp_data.ut_type == LOGIN_PROCESS ||
- utmp_data.ut_type == USER_PROCESS) &&
- !strncmp (utmp_data.ut_line, line->ut_line,
- sizeof (utmp_data.ut_line)))
- return &utmp_data;
- }
- return NULL;
-}
diff --git a/winsup/cygwin/sysconf.cc b/winsup/cygwin/sysconf.cc
deleted file mode 100644
index 67099c282..000000000
--- a/winsup/cygwin/sysconf.cc
+++ /dev/null
@@ -1,98 +0,0 @@
-/* sysconf.cc
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <unistd.h>
-#include <errno.h>
-#include <time.h>
-#include <limits.h>
-#include <ntdef.h>
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygerrno.h"
-#include "cygheap.h"
-#include "ntdll.h"
-
-/* sysconf: POSIX 4.8.1.1 */
-/* Allows a portable app to determine quantities of resources or
- presence of an option at execution time. */
-long int
-sysconf (int in)
-{
- switch (in)
- {
- case _SC_ARG_MAX:
- /* FIXME: what's the right value? _POSIX_ARG_MAX is only 4K */
- return 1048576;
- case _SC_OPEN_MAX:
- return getdtablesize ();
- case _SC_PAGESIZE:
- return getpagesize ();
- case _SC_CLK_TCK:
- return CLOCKS_PER_SEC;
- case _SC_JOB_CONTROL:
- return _POSIX_JOB_CONTROL;
- case _SC_CHILD_MAX:
- return CHILD_MAX;
- case _SC_NGROUPS_MAX:
- return NGROUPS_MAX;
- case _SC_SAVED_IDS:
- return _POSIX_SAVED_IDS;
- case _SC_VERSION:
- return _POSIX_VERSION;
-#if 0 /* FIXME -- unimplemented */
- case _SC_TZNAME_MAX:
- return _POSIX_TZNAME_MAX;
- case _SC_STREAM_MAX:
- return _POSIX_STREAM_MAX;
-#endif
- case _SC_NPROCESSORS_CONF:
- case _SC_NPROCESSORS_ONLN:
- if (!wincap.supports_smp ())
- return 1;
- /*FALLTHRU*/
- case _SC_PHYS_PAGES:
- case _SC_AVPHYS_PAGES:
- if (wincap.supports_smp ())
- {
- NTSTATUS ret;
- SYSTEM_BASIC_INFORMATION sbi;
- if ((ret = NtQuerySystemInformation (SystemBasicInformation,
- (PVOID) &sbi,
- sizeof sbi, NULL))
- != STATUS_SUCCESS)
- {
- __seterrno_from_win_error (RtlNtStatusToDosError (ret));
- debug_printf("NtQuerySystemInformation: ret = %d, "
- "Dos(ret) = %d",
- ret, RtlNtStatusToDosError (ret));
- return -1;
- }
- switch (in)
- {
- case _SC_NPROCESSORS_CONF:
- return sbi.NumberProcessors;
- case _SC_NPROCESSORS_ONLN:
- return sbi.ActiveProcessors;
- case _SC_PHYS_PAGES:
- return sbi.NumberOfPhysicalPages;
- case _SC_AVPHYS_PAGES:
- return sbi.HighestPhysicalPage - sbi.LowestPhysicalPage + 1;
- }
- }
- break;
- }
-
- /* Invalid input or unimplemented sysconf name */
- set_errno (EINVAL);
- return -1;
-}
diff --git a/winsup/cygwin/syslog.cc b/winsup/cygwin/syslog.cc
deleted file mode 100644
index 11ae4b46c..000000000
--- a/winsup/cygwin/syslog.cc
+++ /dev/null
@@ -1,412 +0,0 @@
-/* syslog.cc
-
- Copyright 1996, 1997, 1998, 1999, 2000, 2001 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 "winsup.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include <syslog.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <errno.h>
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygerrno.h"
-#include "cygheap.h"
-#include "thread.h"
-
-/* FIXME: These should probably be in the registry. */
-/* FIXME: The Win95 path should be whatever slash is */
-
-#define WIN95_EVENT_LOG_PATH "C:\\CYGWIN_SYSLOG.TXT"
-#define CYGWIN_LOG_NAME "Cygwin"
-
-/*
- * Utility function to help enable moving
- * WIN95_EVENT_LOG_PATH into registry later.
- */
-static const char *
-get_win95_event_log_path ()
-{
- return WIN95_EVENT_LOG_PATH;
-}
-
-/* FIXME: For MT safe code these will need to be replaced */
-
-#ifdef _MT_SAFE
-#define process_ident _reent_winsup()->_process_ident
-#define process_logopt _reent_winsup()->_process_logopt
-#define process_facility _reent_winsup()->_process_facility
- /* Default priority logmask */
-#define process_logmask _reent_winsup()->_process_logmask
-#else
-static char *process_ident = 0;
-static int process_logopt = 0;
-static int process_facility = 0;
-
-/* Default priority logmask */
-static int process_logmask = LOG_UPTO (LOG_DEBUG);
-#endif
-
-/*
- * openlog: save the passed args. Don't open the
- * system log (NT) or log file (95) yet.
- */
-extern "C"
-void
-openlog (const char *ident, int logopt, int facility)
-{
- debug_printf ("openlog called with (%s, %d, %d)",
- ident ? ident : "<NULL>", logopt, facility);
-
- if (process_ident != NULL)
- {
- free (process_ident);
- process_ident = 0;
- }
- if (ident)
- {
- process_ident = (char *) malloc (strlen (ident) + 1);
- if (process_ident == NULL)
- {
- debug_printf ("failed to allocate memory for process_ident");
- return;
- }
- strcpy (process_ident, ident);
- }
- process_logopt = logopt;
- process_facility = facility;
-}
-
-/* setlogmask: set the log priority mask and return previous mask.
- If maskpri is zero, just return previous. */
-int
-setlogmask (int maskpri)
-{
- if (maskpri == 0)
- return process_logmask;
-
- int old_mask = process_logmask;
- process_logmask = maskpri & LOG_PRIMASK;
-
- return old_mask;
-}
-
-/* Private class used to handle formatting of syslog message */
-/* It is named pass_handler because it does a two-pass handling of log
- strings. The first pass counts the length of the string, and the second
- one builds the string. */
-
-class pass_handler
-{
- private:
- FILE *fp_;
- char *message_;
- int total_len_;
-
- void shutdown ();
-
- /* Explicitly disallow copies */
- pass_handler (const pass_handler &);
- pass_handler & operator = (const pass_handler &);
-
- public:
- pass_handler ();
- ~pass_handler ();
-
- int initialize (int);
-
- int print (const char *,...);
- int print_va (const char *, va_list);
- char *get_message () const { return message_; }
- void set_message (char *s) { message_ = s; *message_ = '\0'; }
-};
-
-pass_handler::pass_handler () : fp_ (0), message_ (0), total_len_ (0)
-{
- ;
-}
-
-pass_handler::~pass_handler ()
-{
- shutdown ();
-}
-
-void
-pass_handler::shutdown ()
-{
- if (fp_ != NULL)
- {
- fclose (fp_);
- fp_ = 0;
- }
-}
-
-int
-pass_handler::initialize (int pass_number)
-{
- shutdown ();
- if (pass_number)
- return total_len_ + 1;
-
- fp_ = fopen ("/dev/null", "wb");
- if (fp_ == NULL)
- {
- debug_printf ("failed to open /dev/null");
- return -1;
- }
- total_len_ = 0;
- return 0;
-}
-
-int
-pass_handler::print (const char *fmt, ...)
-{
- va_list ap;
- va_start (ap, fmt);
- int ret = print_va (fmt, ap);
- va_end (ap);
- return ret;
-}
-
-int
-pass_handler::print_va (const char *fmt, va_list list)
-{
- if (fp_ != NULL)
- {
- int len = vfprintf (fp_, fmt, list);
- if (len < 0)
- return -1;
- total_len_ += len;
- return 0;
- }
- else if (message_ != NULL)
- {
- char *printpos = &message_[strlen (message_)];
- vsprintf (printpos, fmt, list);
- return 0;
- }
- debug_printf ("FAILURE ! fp_ and message_ both 0!! ");
- return -1;
-}
-
-/*
- * syslog: creates the log message and writes to system
- * log (NT) or log file (95). FIXME. WinNT log error messages
- * don't look pretty, but in order to fix this we have to
- * embed resources in the code and tell the NT registry
- * where we are, blech (what happens if we move ?).
- * We could, however, add the resources in Cygwin and
- * always point to that.
- */
-
-extern "C"
-void
-syslog (int priority, const char *message, ...)
-{
- debug_printf ("%x %s", priority, message);
- /* If the priority fails the current mask, reject */
- if (((priority & LOG_PRIMASK) & process_logmask) == 0)
- {
- debug_printf ("failing message %x due to priority mask %x",
- priority, process_logmask);
- return;
- }
-
- /* Translate %m in the message to error text */
- char *errtext = strerror (get_errno ());
- int errlen = strlen (errtext);
- int numfound = 0;
-
- for (const char *cp = message; *cp; cp++)
- if (*cp == '%' && cp[1] == 'm')
- numfound++;
-
- char *newmessage = (char *) alloca (strlen (message) +
- (errlen * numfound) + 1);
-
- if (newmessage == NULL)
- {
- debug_printf ("failed to allocate newmessage");
- return;
- }
-
- char *dst = newmessage;
- for (const char *cp2 = message; *cp2; cp2++)
- if (*cp2 == '%' && cp2[1] == 'm')
- {
- cp2++;
- strcpy (dst, errtext);
- while (*dst)
- dst++;
- }
- else
- *dst++ = *cp2;
-
- *dst = '\0';
- message = newmessage;
-
- /* Work out the priority type - we ignore the facility for now.. */
- WORD eventType;
- switch (LOG_PRI (priority))
- {
- case LOG_EMERG:
- case LOG_ALERT:
- case LOG_CRIT:
- case LOG_ERR:
- eventType = EVENTLOG_ERROR_TYPE;
- break;
- case LOG_WARNING:
- eventType = EVENTLOG_WARNING_TYPE;
- break;
- case LOG_NOTICE:
- case LOG_INFO:
- case LOG_DEBUG:
- eventType = EVENTLOG_INFORMATION_TYPE;
- break;
- default:
- eventType = EVENTLOG_ERROR_TYPE;
- break;
- }
-
- /* We need to know how long the buffer needs to be.
- The only legal way I can see of doing this is to
- do a vfprintf to /dev/null, and count the bytes
- output, then do it again to a malloc'ed string. This
- is ugly, slow, but prevents core dumps :-).
- */
- va_list ap;
-
- pass_handler pass;
- for (int pass_number = 0; pass_number < 2; ++pass_number)
- {
- int n = pass.initialize (pass_number);
- if (n == -1)
- return;
- else if (n > 0)
- pass.set_message ((char *) alloca (n));
-
- /* Deal with ident_string */
- if (process_ident != NULL)
- {
- if (pass.print ("%s : ", process_ident) == -1)
- return;
- }
- if (process_logopt & LOG_PID)
- {
- if (pass.print ("Win32 Process Id = 0x%X : Cygwin Process Id = 0x%X : ",
- GetCurrentProcessId(), getpid ()) == -1)
- return;
- }
-
- if (!wincap.has_eventlog ())
- {
- /* Add a priority string - not needed for systems with
- eventlog capability. */
- switch (LOG_PRI (priority))
- {
- case LOG_EMERG:
- pass.print ("%s : ", "LOG_EMERG");
- break;
- case LOG_ALERT:
- pass.print ("%s : ", "LOG_ALERT");
- break;
- case LOG_CRIT:
- pass.print ("%s : ", "LOG_CRIT");
- break;
- case LOG_ERR:
- pass.print ("%s : ", "LOG_ERR");
- break;
- case LOG_WARNING:
- pass.print ("%s : ", "LOG_WARNING");
- break;
- case LOG_NOTICE:
- pass.print ("%s : ", "LOG_NOTICE");
- break;
- case LOG_INFO:
- pass.print ("%s : ", "LOG_INFO");
- break;
- case LOG_DEBUG:
- pass.print ("%s : ", "LOG_DEBUG");
- break;
- default:
- pass.print ("%s : ", "LOG_ERR");
- break;
- }
- }
-
- /* Print out the variable part */
- va_start (ap, message);
- if (pass.print_va (message, ap) == -1)
- return;
- va_end (ap);
-
- }
- const char *msg_strings[1];
- char *total_msg = pass.get_message ();
- int len = strlen (total_msg);
- if (len != 0 && (total_msg[len - 1] == '\n'))
- total_msg[len - 1] = '\0';
-
- msg_strings[0] = total_msg;
-
- if (wincap.has_eventlog ())
- {
- /* For NT, open the event log and send the message */
- HANDLE hEventSrc = RegisterEventSourceA (NULL, (process_ident != NULL) ?
- process_ident : CYGWIN_LOG_NAME);
- if (hEventSrc == NULL)
- {
- debug_printf ("RegisterEventSourceA failed with %E");
- return;
- }
- ReportEventA (hEventSrc, eventType, 0, 0,
- cygheap->user.sid (), 1, 0, msg_strings, NULL);
- DeregisterEventSource (hEventSrc);
- }
- else
- {
- /* Under Windows 95, append the message to the log file */
- FILE *fp = fopen (get_win95_event_log_path (), "a");
- if (fp == NULL)
- {
- debug_printf ("failed to open file %s",
- get_win95_event_log_path ());
- return;
- }
- /* Now to prevent several syslog messages from being
- interleaved, we must lock the first byte of the file
- This works on Win32 even if we created the file above.
- */
- HANDLE fHandle = cygheap->fdtab[fileno (fp)]->get_handle ();
- if (LockFile (fHandle, 0, 0, 1, 0) == FALSE)
- {
- debug_printf ("failed to lock file %s", get_win95_event_log_path());
- fclose (fp);
- return;
- }
- fputs (msg_strings[0], fp);
- fputc ('\n', fp);
- UnlockFile (fHandle, 0, 0, 1, 0);
- if (ferror (fp))
- {
- debug_printf ("error in writing syslog");
- }
- fclose (fp);
- }
-}
-
-extern "C"
-void
-closelog (void)
-{
- ;
-}
diff --git a/winsup/cygwin/termios.cc b/winsup/cygwin/termios.cc
deleted file mode 100644
index c44ccbdc3..000000000
--- a/winsup/cygwin/termios.cc
+++ /dev/null
@@ -1,234 +0,0 @@
-/* termios.cc: termios for WIN32.
-
- Copyright 1996, 1997, 1998, 2000, 2001, 2002 Red Hat, Inc.
-
- Written by Doug Evans and Steve Chamberlain of Cygnus Support
- dje@cygnus.com, sac@cygnus.com
-
-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 "winsup.h"
-#include <errno.h>
-#include <signal.h>
-#include <stdlib.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygheap.h"
-#include "cygwin/version.h"
-#include "perprocess.h"
-#include <sys/termios.h>
-
-/* tcsendbreak: POSIX 7.2.2.1 */
-extern "C" int
-tcsendbreak (int fd, int duration)
-{
- int res = -1;
-
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- goto out;
-
- if (!cfd->is_tty ())
- set_errno (ENOTTY);
- else if ((res = cfd->bg_check (-SIGTTOU)) > bg_eof)
- res = cfd->tcsendbreak (duration);
-
-out:
- syscall_printf ("%d = tcsendbreak (%d, %d)", res, fd, duration);
- return res;
-}
-
-/* tcdrain: POSIX 7.2.2.1 */
-extern "C" int
-tcdrain (int fd)
-{
- int res = -1;
-
- termios_printf ("tcdrain");
-
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- goto out;
-
- if (!cfd->is_tty ())
- set_errno (ENOTTY);
- else if ((res = cfd->bg_check (-SIGTTOU)) > bg_eof)
- res = cfd->tcdrain ();
-
-out:
- syscall_printf ("%d = tcdrain (%d)", res, fd);
- return res;
-}
-
-/* tcflush: POSIX 7.2.2.1 */
-extern "C" int
-tcflush (int fd, int queue)
-{
- int res = -1;
-
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- goto out;
-
- if (!cfd->is_tty ())
- set_errno (ENOTTY);
- else if ((res = cfd->bg_check (-SIGTTOU)) > bg_eof)
- res = cfd->tcflush (queue);
-
-out:
- termios_printf ("%d = tcflush (%d, %d)", res, fd, queue);
- return res;
-}
-
-/* tcflow: POSIX 7.2.2.1 */
-extern "C" int
-tcflow (int fd, int action)
-{
- int res = -1;
-
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- goto out;
-
- if (!cfd->is_tty ())
- set_errno (ENOTTY);
- else if ((res = cfd->bg_check (-SIGTTOU)) > bg_eof)
- res = cfd->tcflow (action);
-
-out:
- syscall_printf ("%d = tcflow (%d, %d)", res, fd, action);
- return res;
-}
-
-/* tcsetattr: POSIX96 7.2.1.1 */
-extern "C" int
-tcsetattr (int fd, int a, const struct termios *t)
-{
- int res = -1;
-
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- goto out;
-
- t = __tonew_termios (t);
-
- if (!cfd->is_tty ())
- set_errno (ENOTTY);
- else if ((res = cfd->bg_check (-SIGTTOU)) > bg_eof)
- res = cfd->tcsetattr (a, t);
-
-out:
- termios_printf ("iflag %x, oflag %x, cflag %x, lflag %x, VMIN %d, VTIME %d",
- t->c_iflag, t->c_oflag, t->c_cflag, t->c_lflag, t->c_cc[VMIN],
- t->c_cc[VTIME]);
- termios_printf ("%d = tcsetattr (%d, %d, %x)", res, fd, a, t);
- return res;
-}
-
-/* tcgetattr: POSIX 7.2.1.1 */
-extern "C" int
-tcgetattr (int fd, struct termios *in_t)
-{
- int res = -1;
- struct termios *t = __makenew_termios (in_t);
-
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- /* saw an error */;
- else if (!cfd->is_tty ())
- set_errno (ENOTTY);
- else if ((res = cfd->tcgetattr (t)) == 0)
- (void) __toapp_termios (in_t, t);
-
- if (res)
- termios_printf ("%d = tcgetattr (%d, %p)", res, fd, in_t);
- else
- termios_printf ("iflag %x, oflag %x, cflag %x, lflag %x, VMIN %d, VTIME %d",
- t->c_iflag, t->c_oflag, t->c_cflag, t->c_lflag, t->c_cc[VMIN],
- t->c_cc[VTIME]);
-
- return res;
-}
-
-/* tcgetpgrp: POSIX 7.2.3.1 */
-extern "C" int
-tcgetpgrp (int fd)
-{
- int res = -1;
-
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- /* saw an error */;
- else if (!cfd->is_tty ())
- set_errno (ENOTTY);
- else
- res = cfd->tcgetpgrp ();
-
- termios_printf ("%d = tcgetpgrp (%d)", res, fd);
- return res;
-}
-
-/* tcsetpgrp: POSIX 7.2.4.1 */
-extern "C" int
-tcsetpgrp (int fd, pid_t pgid)
-{
- int res = -1;
-
- cygheap_fdget cfd (fd);
- if (cfd < 0)
- /* saw an error */;
- else if (!cfd->is_tty ())
- set_errno (ENOTTY);
- else
- res = cfd->tcsetpgrp (pgid);
-
- termios_printf ("%d = tcsetpgrp (%d, %x)", res, fd, pgid);
- return res;
-}
-
-/* NIST PCTS requires not macro-only implementation */
-#undef cfgetospeed
-#undef cfgetispeed
-#undef cfsetospeed
-#undef cfsetispeed
-
-/* cfgetospeed: POSIX96 7.1.3.1 */
-extern "C" speed_t
-cfgetospeed (struct termios *tp)
-{
- return __tonew_termios(tp)->c_ospeed;
-}
-
-/* cfgetispeed: POSIX96 7.1.3.1 */
-extern "C" speed_t
-cfgetispeed (struct termios *tp)
-{
- return __tonew_termios(tp)->c_ispeed;
-}
-
-/* cfsetospeed: POSIX96 7.1.3.1 */
-extern "C" int
-cfsetospeed (struct termios *in_tp, speed_t speed)
-{
- struct termios *tp = __tonew_termios (in_tp);
- tp->c_ospeed = speed;
- (void) __toapp_termios (in_tp, tp);
- return 0;
-}
-
-/* cfsetispeed: POSIX96 7.1.3.1 */
-extern "C" int
-cfsetispeed (struct termios *in_tp, speed_t speed)
-{
- struct termios *tp = __tonew_termios (in_tp);
- tp->c_ispeed = speed;
- (void) __toapp_termios (in_tp, tp);
- return 0;
-}
diff --git a/winsup/cygwin/textmode.c b/winsup/cygwin/textmode.c
deleted file mode 100644
index 6d52d50f8..000000000
--- a/winsup/cygwin/textmode.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* binmode.c
-
- Copyright 2000 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 <windows.h>
-#include <sys/fcntl.h>
-#include <sys/cygwin.h>
-
-extern int _fmode;
-void
-cygwin_premain0 (int argc, char **argv, struct per_process *myself)
-{
- _fmode &= ~_O_BINARY;
- _fmode |= _O_TEXT;
-}
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
deleted file mode 100644
index cc24fdca6..000000000
--- a/winsup/cygwin/thread.cc
+++ /dev/null
@@ -1,2347 +0,0 @@
-/* thread.cc: Locking and threading module functions
-
- Copyright 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-
- Originally written by Marco Fuykschot <marco@ddi.nl>
- Substantialy enhanced by Robert Collins <rbtcollins@hotmail.com>
-
-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. */
-
-/* Implementation overview and caveats:
-
- Win32 puts some contraints on what can and cannot be implemented. Where
- possible we work around those contrainsts. Where we cannot work around
- the constraints we either pretend to be conformant, or return an error
- code.
-
- Some caveats: PROCESS_SHARED objects while they pretend to be process
- shared, may not actually work. Some test cases are needed to determine
- win32's behaviour. My suspicion is that the win32 handle needs to be
- opened with different flags for proper operation.
-
- R.Collins, April 2001. */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef _MT_SAFE
-#include "winsup.h"
-#include <limits.h>
-#include <errno.h>
-#include "cygerrno.h"
-#include <assert.h>
-#include <stdlib.h>
-#include <syslog.h>
-#include "pinfo.h"
-#include "perprocess.h"
-#include "security.h"
-#include <semaphore.h>
-#include <stdio.h>
-#include <sys/timeb.h>
-
-extern int threadsafe;
-
-/*pthread_key_destructor_list class: to-be threadsafe single linked list
- *FIXME: Put me in a dedicated file, or a least a tools area !
- */
-
-pthread_key_destructor *
-pthread_key_destructor::InsertAfter (pthread_key_destructor *node)
-{
- pthread_key_destructor *temp = next;
- next = node;
- return temp;
-}
-
-pthread_key_destructor *
-pthread_key_destructor::UnlinkNext ()
-{
- pthread_key_destructor *temp = next;
- if (next)
- next = next->Next ();
- return temp;
-}
-
-pthread_key_destructor *
-pthread_key_destructor::Next ()
-{
- return next;
-}
-
-void
-pthread_key_destructor_list::Insert (pthread_key_destructor *node)
-{
- if (!node)
- return;
- head = node->InsertAfter (head);
- if (!head)
- head = node; /*first node special case */
-}
-
- /*remove a given dataitem, wherever in the list it is */
-pthread_key_destructor *
-pthread_key_destructor_list::Remove (pthread_key *key)
-{
- if (!key)
- return NULL;
- if (!head)
- return NULL;
- if (key == head->key)
- return Pop ();
- pthread_key_destructor *temp = head;
- while (temp && temp->Next () && !(key == temp->Next ()->key))
- {
- temp = temp->Next ();
- }
- if (temp)
- return temp->UnlinkNext ();
- return NULL;
-}
-
- /*get the first item and remove at the same time */
-pthread_key_destructor *
-pthread_key_destructor_list::Pop ()
-{
- pthread_key_destructor *temp = head;
- head = head->Next ();
- return temp;
-}
-
-pthread_key_destructor::
-pthread_key_destructor (void (*thedestructor) (void *), pthread_key *key)
-{
- destructor = thedestructor;
- next = NULL;
- this->key = key;
-}
-
-void
-pthread_key_destructor_list::IterateNull ()
-{
- pthread_key_destructor *temp = head;
- while (temp)
- {
- temp->destructor ((temp->key)->get ());
- temp = temp->Next ();
- }
-}
-
-
-#define MT_INTERFACE user_data->threadinterface
-
-struct _reent *
-_reent_clib ()
-{
- int tmp = GetLastError ();
- struct __reent_t *_r =
- (struct __reent_t *) TlsGetValue (MT_INTERFACE->reent_index);
-
-#ifdef _CYG_THREAD_FAILSAFE
- if (_r == 0)
- system_printf ("local thread storage not inited");
-#endif
-
- SetLastError (tmp);
- return _r->_clib;
-}
-
-struct _winsup_t *
-_reent_winsup ()
-{
- int tmp = GetLastError ();
- struct __reent_t *_r;
- _r = (struct __reent_t *) TlsGetValue (MT_INTERFACE->reent_index);
-#ifdef _CYG_THREAD_FAILSAFE
- if (_r == 0)
- system_printf ("local thread storage not inited");
-#endif
- SetLastError (tmp);
- return _r->_winsup;
-}
-
-inline LPCRITICAL_SECTION
-ResourceLocks::Lock (int _resid)
-{
-#ifdef _CYG_THREAD_FAILSAFE
- if (!inited)
- system_printf ("lock called before initialization");
-
- thread_printf
- ("Get Resource lock %d ==> %p for %p , real : %d , threadid %d ", _resid,
- &lock, user_data, myself->pid, GetCurrentThreadId ());
-#endif
- return &lock;
-}
-
-void
-SetResourceLock (int _res_id, int _mode, const char *_function)
-{
-#ifdef _CYG_THREAD_FAILSAFE
- thread_printf ("Set resource lock %d mode %d for %s start",
- _res_id, _mode, _function);
-#endif
- EnterCriticalSection (user_data->resourcelocks->Lock (_res_id));
-
-#ifdef _CYG_THREAD_FAILSAFE
- user_data->resourcelocks->owner = GetCurrentThreadId ();
- user_data->resourcelocks->count++;
-#endif
-}
-
-void
-ReleaseResourceLock (int _res_id, int _mode, const char *_function)
-{
-#ifdef _CYG_THREAD_FAILSAFE
- thread_printf ("Release resource lock %d mode %d for %s done", _res_id,
- _mode, _function);
-
- AssertResourceOwner (_res_id, _mode);
- user_data->resourcelocks->count--;
- if (user_data->resourcelocks->count == 0)
- user_data->resourcelocks->owner = 0;
-#endif
-
- LeaveCriticalSection (user_data->resourcelocks->Lock (_res_id));
-}
-
-#ifdef _CYG_THREAD_FAILSAFE
-void
-AssertResourceOwner (int _res_id, int _mode)
-{
-
- thread_printf
- ("Assert Resource lock %d ==> for %p , real : %d , threadid %d count %d owner %d",
- _res_id, user_data, myself->pid, GetCurrentThreadId (),
- user_data->resourcelocks->count, user_data->resourcelocks->owner);
- if (user_data && (user_data->resourcelocks->owner != GetCurrentThreadId ()))
- system_printf ("assertion failed, not the resource owner");
-}
-
-#endif
-
-void
-ResourceLocks::Init ()
-{
- InitializeCriticalSection (&lock);
- inited = true;
-
-#ifdef _CYG_THREAD_FAILSAFE
- owner = 0;
- count = 0;
-#endif
-
- thread_printf ("lock %p inited by %p , %d", &lock, user_data, myself->pid);
-}
-
-void
-ResourceLocks::Delete ()
-{
- if (inited)
- {
- thread_printf ("Close Resource Locks %p ", &lock);
- DeleteCriticalSection (&lock);
- inited = false;
- }
-}
-
-void
-MTinterface::Init (int forked)
-{
-#if 0
- for (int i = 0; i < MT_MAX_ITEMS; i++)
- {
- threadlist.items[i] = NULL;
- mutexlist.items[i] = NULL;
- semalist.items[i] = NULL;
- }
-
- threadlist.index = 0;
- mutexlist.index = 0;
- semalist.index = 0;
-#endif
-
- reent_index = TlsAlloc ();
- reents._clib = _impure_ptr;
- reents._winsup = &winsup_reent;
-
- winsup_reent._process_logmask = LOG_UPTO (LOG_DEBUG);
-#if 0
- winsup_reent._grp_pos = 0;
- winsup_reent._process_ident = 0;
- winsup_reent._process_logopt = 0;
- winsup_reent._process_facility = 0;
-#endif
-
- TlsSetValue (reent_index, &reents);
- // the static reent_data will be used in the main thread
-
-
- if (!indexallocated)
- {
- indexallocated = (-1);
- thread_self_dwTlsIndex = TlsAlloc ();
- if (thread_self_dwTlsIndex == TLS_OUT_OF_INDEXES)
- system_printf
- ("local storage for thread couldn't be set\nThis means that we are not thread safe!");
- }
-
- concurrency = 0;
- threadcount = 1; /*1 current thread when Init occurs.*/
-
- mainthread.win32_obj_id = myself->hProcess;
- mainthread.setThreadIdtoCurrent ();
- /*store the main thread's self pointer */
- TlsSetValue (thread_self_dwTlsIndex, &mainthread);
-
- if (forked)
- return;
-
- mutexs = NULL;
- conds = NULL;
- semaphores = NULL;
-
- /*possible the atfork lists should be inited here as well */
-
-#if 0
- item->function = NULL;
-
- item->sigs = NULL;
- item->sigmask = NULL;
- item->sigtodo = NULL;
-#endif
-}
-
-/* This function is called from a single threaded process */
-void
-MTinterface::fixup_after_fork (void)
-{
- pthread_mutex *mutex = mutexs;
- debug_printf ("mutexs is %x",mutexs);
- while (mutex)
- {
- mutex->fixup_after_fork ();
- mutex = mutex->next;
- }
- pthread_cond *cond = conds;
- debug_printf ("conds is %x",conds);
- while (cond)
- {
- cond->fixup_after_fork ();
- cond = cond->next;
- }
- semaphore *sem = semaphores;
- debug_printf ("semaphores is %x",semaphores);
- while (sem)
- {
- sem->fixup_after_fork ();
- sem = sem->next;
- }
-}
-
-/* pthread calls */
-
-/* static methods */
-
-pthread *
-pthread::self ()
-{
- return (pthread *) TlsGetValue (MT_INTERFACE->thread_self_dwTlsIndex);
-}
-
-/* member methods */
-pthread::pthread ():verifyable_object (PTHREAD_MAGIC), win32_obj_id (0),
-cancelstate (0), canceltype (0), joiner (NULL), cleanup_handlers(NULL)
-{
-}
-
-pthread::~pthread ()
-{
- if (win32_obj_id)
- CloseHandle (win32_obj_id);
-}
-
-
-void
-pthread::create (void *(*func) (void *), pthread_attr *newattr,
- void *threadarg)
-{
- /*already running ? */
- if (win32_obj_id)
- return;
-
- if (newattr)
- {
- attr.joinable = newattr->joinable;
- attr.contentionscope = newattr->contentionscope;
- attr.inheritsched = newattr->inheritsched;
- attr.stacksize = newattr->stacksize;
- }
- function = func;
- arg = threadarg;
-
- if (verifyable_object_isvalid (&mutex, PTHREAD_MUTEX_MAGIC) != VALID_OBJECT)
- {
- thread_printf ("New thread object access mutex is not valid. this %p",
- this);
- magic = 0;
- return;
- }
-
- win32_obj_id = ::CreateThread (&sec_none_nih, attr.stacksize,
- (LPTHREAD_START_ROUTINE) thread_init_wrapper,
- this, CREATE_SUSPENDED, &thread_id);
-
- if (!win32_obj_id)
- magic = 0;
- else
- {
- InterlockedIncrement (&MT_INTERFACE->threadcount);
- /*FIXME: set the priority appropriately for system contention scope */
- if (attr.inheritsched == PTHREAD_EXPLICIT_SCHED)
- {
- /*FIXME: set the scheduling settings for the new thread */
- /*sched_thread_setparam (win32_obj_id, attr.schedparam); */
- }
- ResumeThread (win32_obj_id);
- }
-}
-
-void
-pthread::push_cleanup_handler (__pthread_cleanup_handler *handler)
-{
- if (this != self ())
- // TODO: do it?
- api_fatal ("Attempt to push a cleanup handler across threads");
- mutex.Lock();
- handler->next = cleanup_handlers;
- cleanup_handlers = handler;
- mutex.UnLock();
-}
-
-void
-pthread::pop_cleanup_handler (int const execute)
-{
- if (this != self ())
- // TODO: send a signal or something to the thread ?
- api_fatal ("Attempt to execute a cleanup handler across threads");
-
- if (cleanup_handlers != NULL )
- {
- __pthread_cleanup_handler *handler = cleanup_handlers;
-
- if (execute)
- (*handler->function) (handler->arg);
-
- cleanup_handlers = handler->next;
- }
-}
-
-void
-pthread::pop_all_cleanup_handlers ()
-{
- while (cleanup_handlers != NULL)
- pop_cleanup_handler (1);
-}
-
-pthread_attr::pthread_attr ():verifyable_object (PTHREAD_ATTR_MAGIC),
-joinable (PTHREAD_CREATE_JOINABLE), contentionscope (PTHREAD_SCOPE_PROCESS),
-inheritsched (PTHREAD_INHERIT_SCHED), stacksize (0)
-{
- schedparam.sched_priority = 0;
-}
-
-pthread_attr::~pthread_attr ()
-{
-}
-
-pthread_condattr::pthread_condattr ():verifyable_object
- (PTHREAD_CONDATTR_MAGIC), shared (PTHREAD_PROCESS_PRIVATE)
-{
-}
-
-pthread_condattr::~pthread_condattr ()
-{
-}
-
-pthread_cond::pthread_cond (pthread_condattr *attr):verifyable_object (PTHREAD_COND_MAGIC)
-{
- int temperr;
- this->shared = attr ? attr->shared : PTHREAD_PROCESS_PRIVATE;
- this->mutex = NULL;
- this->waiting = 0;
-
- this->win32_obj_id = ::CreateEvent (&sec_none_nih, false, /*auto signal reset - which I think is pthreads like ? */
- false, /*start non signaled */
- NULL /*no name */);
- /*TODO: make a shared mem mutex if out attributes request shared mem cond */
- cond_access = NULL;
- if ((temperr = pthread_mutex_init (&this->cond_access, NULL)))
- {
- system_printf ("couldn't init mutex, this %p errno %d", this, temperr);
- /*we need the mutex for correct behaviour */
- magic = 0;
- }
-
- if (!this->win32_obj_id)
- magic = 0;
- /* threadsafe addition is easy */
- next = (pthread_cond *) InterlockedExchangePointer (&MT_INTERFACE->conds, this);
-}
-
-pthread_cond::~pthread_cond ()
-{
- if (win32_obj_id)
- CloseHandle (win32_obj_id);
- pthread_mutex_destroy (&cond_access);
- /* I'm not 100% sure the next bit is threadsafe. I think it is... */
- if (MT_INTERFACE->conds == this)
- InterlockedExchangePointer (&MT_INTERFACE->conds, this->next);
- else
- {
- pthread_cond *tempcond = MT_INTERFACE->conds;
- while (tempcond->next && tempcond->next != this)
- tempcond = tempcond->next;
- /* but there may be a race between the loop above and this statement */
- InterlockedExchangePointer (&tempcond->next, this->next);
- }
-}
-
-void
-pthread_cond::BroadCast ()
-{
- /* TODO: implement the same race fix as Signal has */
- if (pthread_mutex_lock (&cond_access))
- system_printf ("Failed to lock condition variable access mutex, this %p", this);
- int count = waiting;
- if (verifyable_object_isvalid (&mutex, PTHREAD_MUTEX_MAGIC) != VALID_OBJECT)
- {
- if (pthread_mutex_unlock (&cond_access))
- system_printf ("Failed to unlock condition variable access mutex, this %p", this);
- /*This isn't and API error - users are allowed to call this when no threads
- are waiting
- system_printf ("Broadcast called with invalid mutex");
- */
- return;
- }
- while (count--)
- PulseEvent (win32_obj_id);
- if (pthread_mutex_unlock (&cond_access))
- system_printf ("Failed to unlock condition variable access mutex, this %p", this);
-}
-
-void
-pthread_cond::Signal ()
-{
- if (pthread_mutex_lock (&cond_access))
- system_printf ("Failed to lock condition variable access mutex, this %p", this);
- if (verifyable_object_isvalid (&mutex, PTHREAD_MUTEX_MAGIC) != VALID_OBJECT)
- {
- if (pthread_mutex_unlock (&cond_access))
- system_printf ("Failed to unlock condition variable access mutex, this %p",
- this);
- return;
- }
- int temp = waiting;
- if (!temp)
- /* nothing to signal */
- {
- if (pthread_mutex_unlock (&cond_access))
- system_printf ("Failed to unlock condition variable access mutex, this %p", this);
- return;
- }
- /* Prime the detection flag */
- ExitingWait = 1;
- /* Signal any waiting thread */
- PulseEvent (win32_obj_id);
- /* No one can start waiting until we release the condition access mutex */
- /* The released thread will decrement waiting when it gets a time slice...
- without waiting for the access mutex
- * InterLockedIncrement on 98 +, NT4 + returns the incremented value.
- * On 95, nt 3.51 < it returns a sign correct number - 0=0, + for greater than 0, -
- * for less than 0.
- * Because of this we cannot spin on the waiting count, but rather we need a
- * dedicated flag for a thread exiting the Wait function.
- * Also not that Interlocked* sync CPU caches with memory.
- */
- int spins = 10;
- /* When ExitingWait is nonzero after a decrement, the leaving thread has
- * done it's thing
- */
- while (InterlockedDecrement (&ExitingWait) == 0 && spins)
- {
- InterlockedIncrement (&ExitingWait);
- /* give up the cpu to force a context switch. */
- Sleep (0);
- if (spins == 5)
- /* we've had 5 timeslices, and the woken thread still hasn't done it's
- * thing - maybe we raced it with the event? */
- PulseEvent (win32_obj_id);
- spins--;
- }
- if (waiting + 1 != temp)
- system_printf ("Released too many threads - %d now %d originally", waiting, temp);
- if (pthread_mutex_unlock (&cond_access))
- system_printf ("Failed to unlock condition variable access mutex, this %p", this);
-}
-
-int
-pthread_cond::TimedWait (DWORD dwMilliseconds)
-{
- DWORD rv;
- if (!wincap.has_signal_object_and_wait ())
- {
- // FIXME: race condition (potentially drop events
- // Possible solution (single process only) - place this in a critical section.
- ReleaseMutex (mutex->win32_obj_id);
- rv = WaitForSingleObject (win32_obj_id, dwMilliseconds);
- }
- else
- {
- LeaveCriticalSection (&mutex->criticalsection);
- rv = WaitForSingleObject (win32_obj_id, dwMilliseconds);
-#if 0
- /* we need to use native win32 mutex's here, because the cygwin ones now use
- * critical sections, which are faster, but introduce a race _here_. Until then
- * The NT variant of the code is redundant.
- */
-
- rv = SignalObjectAndWait (mutex->win32_obj_id, win32_obj_id, dwMilliseconds,
- false);
-#endif
- }
- switch (rv)
- {
- case WAIT_FAILED:
- return 0; /*POSIX doesn't allow errors after we modify the mutex state */
- case WAIT_ABANDONED:
- case WAIT_TIMEOUT:
- return ETIMEDOUT;
- case WAIT_OBJECT_0:
- return 0; /*we have been signaled */
- default:
- return 0;
- }
-}
-
-void
-pthread_cond::fixup_after_fork ()
-{
- debug_printf ("cond %x in fixup_after_fork", this);
- if (shared != PTHREAD_PROCESS_PRIVATE)
- api_fatal ("doesn't understand PROCESS_SHARED condition variables");
- /* FIXME: duplicate code here and in the constructor. */
- this->win32_obj_id = ::CreateEvent (&sec_none_nih, false, false, NULL);
- if (!win32_obj_id)
- api_fatal ("failed to create new win32 mutex");
-#if DETECT_BAD_APPS
- if (waiting)
- api_fatal ("Forked () while a condition variable has waiting threads.\nReport to cygwin@cygwin.com");
-#else
- waiting = 0;
- mutex = NULL;
-#endif
-}
-
-
-pthread_key::pthread_key (void (*destructor) (void *)):verifyable_object (PTHREAD_KEY_MAGIC)
-{
- dwTlsIndex = TlsAlloc ();
- if (dwTlsIndex == TLS_OUT_OF_INDEXES)
- magic = 0;
- else if (destructor)
- {
- MT_INTERFACE->destructors.
- Insert (new pthread_key_destructor (destructor, this));
- }
-}
-
-pthread_key::~pthread_key ()
-{
- if (pthread_key_destructor *dest = MT_INTERFACE->destructors.Remove (this))
- delete dest;
- TlsFree (dwTlsIndex);
-}
-
-int
-pthread_key::set (const void *value)
-{
- /*the OS function doesn't perform error checking */
- TlsSetValue (dwTlsIndex, (void *) value);
- return 0;
-}
-
-void *
-pthread_key::get ()
-{
- set_errno (0);
- return TlsGetValue (dwTlsIndex);
-}
-
-/*pshared mutexs:
-
- * REMOVED FROM CURRENT. These can be reinstated with the daemon, when all the
- gymnastics can be a lot easier.
-
- *the mutex_t (size 4) is not used as a verifyable object because we cannot
- *guarantee the same address space for all processes.
- *we use the following:
- *high bit set (never a valid address).
- *second byte is reserved for the priority.
- *third byte is reserved
- *fourth byte is the mutex id. (max 255 cygwin mutexs system wide).
- *creating mutex's does get slower and slower, but as creation is a one time
- *job, it should never become an issue
- *
- *And if you're looking at this and thinking, why not an array in cygwin for all mutexs,
- *- you incur a penalty on _every_ mutex call and you have toserialise them all.
- *... Bad karma.
- *
- *option 2? put everything in userspace and update the ABI?
- *- bad karma as well - the HANDLE, while identical across process's,
- *Isn't duplicated, it's reopened.
- */
-
-pthread_mutex::pthread_mutex (pthread_mutexattr *attr):verifyable_object (PTHREAD_MUTEX_MAGIC)
-{
- /*attr checked in the C call */
- if (attr && attr->pshared == PTHREAD_PROCESS_SHARED)
- {
- // fail
- magic = 0;
- return;
- }
- if (wincap.has_try_enter_critical_section ())
- InitializeCriticalSection (&criticalsection);
- else
- {
- this->win32_obj_id = ::CreateMutex (&sec_none_nih, false, NULL);
- if (!win32_obj_id)
- magic = 0;
- }
- condwaits = 0;
- pshared = PTHREAD_PROCESS_PRIVATE;
- /* threadsafe addition is easy */
- next = (pthread_mutex *) InterlockedExchangePointer (&MT_INTERFACE->mutexs, this);
-}
-
-pthread_mutex::~pthread_mutex ()
-{
- if (wincap.has_try_enter_critical_section ())
- DeleteCriticalSection (&criticalsection);
- else
- {
- if (win32_obj_id)
- CloseHandle (win32_obj_id);
- win32_obj_id = NULL;
- }
- /* I'm not 100% sure the next bit is threadsafe. I think it is... */
- if (MT_INTERFACE->mutexs == this)
- /* TODO: printf an error if the return value != this */
- InterlockedExchangePointer (&MT_INTERFACE->mutexs, next);
- else
- {
- pthread_mutex *tempmutex = MT_INTERFACE->mutexs;
- while (tempmutex->next && tempmutex->next != this)
- tempmutex = tempmutex->next;
- /* but there may be a race between the loop above and this statement */
- /* TODO: printf an error if the return value != this */
- InterlockedExchangePointer (&tempmutex->next, this->next);
- }
-}
-
-int
-pthread_mutex::Lock ()
-{
- if (wincap.has_try_enter_critical_section ())
- {
- EnterCriticalSection (&criticalsection);
- return 0;
- }
- /* FIXME: Return 0 on success */
- return WaitForSingleObject (win32_obj_id, INFINITE);
-}
-
-/* returns non-zero on failure */
-int
-pthread_mutex::TryLock ()
-{
- if (wincap.has_try_enter_critical_section ())
- return (!TryEnterCriticalSection (&criticalsection));
- return (WaitForSingleObject (win32_obj_id, 0) == WAIT_TIMEOUT);
-}
-
-int
-pthread_mutex::UnLock ()
-{
- if (wincap.has_try_enter_critical_section ())
- {
- LeaveCriticalSection (&criticalsection);
- return 0;
- }
- return (!ReleaseMutex (win32_obj_id));
-}
-
-void
-pthread_mutex::fixup_after_fork ()
-{
- debug_printf ("mutex %x in fixup_after_fork", this);
- if (pshared != PTHREAD_PROCESS_PRIVATE)
- api_fatal ("pthread_mutex::fixup_after_fork () doesn'tunderstand PROCESS_SHARED mutex's");
- /* FIXME: duplicate code here and in the constructor. */
- if (wincap.has_try_enter_critical_section ())
- InitializeCriticalSection (&criticalsection);
- else
- {
- win32_obj_id = ::CreateMutex (&sec_none_nih, false, NULL);
- if (!win32_obj_id)
- api_fatal ("pthread_mutex::fixup_after_fork () failed to create new win32 mutex");
- }
-#if DETECT_BAD_APPS
- if (condwaits)
- api_fatal ("Forked () while a mutex has condition variables waiting on it.\nReport to cygwin@cygwin.com");
-#else
- condwaits = 0;
-#endif
-}
-
-pthread_mutexattr::pthread_mutexattr ():verifyable_object (PTHREAD_MUTEXATTR_MAGIC),
-pshared (PTHREAD_PROCESS_PRIVATE), mutextype (PTHREAD_MUTEX_DEFAULT)
-{
-}
-
-pthread_mutexattr::~pthread_mutexattr ()
-{
-}
-
-semaphore::semaphore (int pshared, unsigned int value):verifyable_object (SEM_MAGIC)
-{
- this->win32_obj_id = ::CreateSemaphore (&sec_none_nih, value, LONG_MAX,
- NULL);
- if (!this->win32_obj_id)
- magic = 0;
- this->shared = pshared;
- currentvalue = value;
- /* threadsafe addition is easy */
- next = (semaphore *) InterlockedExchangePointer (&MT_INTERFACE->semaphores, this);
-}
-
-semaphore::~semaphore ()
-{
- if (win32_obj_id)
- CloseHandle (win32_obj_id);
- /* I'm not 100% sure the next bit is threadsafe. I think it is... */
- if (MT_INTERFACE->semaphores == this)
- InterlockedExchangePointer (&MT_INTERFACE->semaphores, this->next);
- else
- {
- semaphore *tempsem = MT_INTERFACE->semaphores;
- while (tempsem->next && tempsem->next != this)
- tempsem = tempsem->next;
- /* but there may be a race between the loop above and this statement */
- InterlockedExchangePointer (&tempsem->next, this->next);
- }
-}
-
-void
-semaphore::Post ()
-{
- /* we can't use the currentvalue, because the wait functions don't let us access it */
- ReleaseSemaphore (win32_obj_id, 1, NULL);
- currentvalue++;
-}
-
-int
-semaphore::TryWait ()
-{
- /*FIXME: signals should be able to interrupt semaphores...
- *We probably need WaitForMultipleObjects here.
- */
- if (WaitForSingleObject (win32_obj_id, 0) == WAIT_TIMEOUT)
- {
- set_errno (EAGAIN);
- return -1;
- }
- currentvalue--;
- return 0;
-}
-
-void
-semaphore::Wait ()
-{
- WaitForSingleObject (win32_obj_id, INFINITE);
- currentvalue--;
-}
-
-void
-semaphore::fixup_after_fork ()
-{
- debug_printf ("sem %x in fixup_after_fork", this);
- if (shared != PTHREAD_PROCESS_PRIVATE)
- api_fatal ("doesn't understand PROCESS_SHARED semaphores variables");
- /* FIXME: duplicate code here and in the constructor. */
- this->win32_obj_id = ::CreateSemaphore (&sec_none_nih, currentvalue, LONG_MAX, NULL);
- if (!win32_obj_id)
- api_fatal ("failed to create new win32 semaphore");
-}
-
-verifyable_object::verifyable_object (long verifyer):
-magic (verifyer)
-{
-}
-
-verifyable_object::~verifyable_object ()
-{
- magic = 0;
-}
-
-/*Generic memory acccess routine - where should it live ? */
-int __stdcall
-check_valid_pointer (void const *pointer)
-{
- if (!pointer || IsBadWritePtr ((void *) pointer, sizeof (verifyable_object)))
- return EFAULT;
- return 0;
-}
-
-verifyable_object_state
-verifyable_object_isvalid (void const * objectptr, long magic, void *static_ptr)
-{
- verifyable_object **object = (verifyable_object **)objectptr;
- if (check_valid_pointer (object))
- return INVALID_OBJECT;
- if (!*object)
- return INVALID_OBJECT;
- if (static_ptr && *object == static_ptr)
- return VALID_STATIC_OBJECT;
- if (check_valid_pointer (*object))
- return INVALID_OBJECT;
- if ((*object)->magic != magic)
- return INVALID_OBJECT;
- return VALID_OBJECT;
-}
-
-verifyable_object_state
-verifyable_object_isvalid (void const * objectptr, long magic)
-{
- return verifyable_object_isvalid (objectptr, magic, NULL);
-}
-
-/* Pthreads */
-void *
-pthread::thread_init_wrapper (void *_arg)
-{
- // Setup the local/global storage of this thread
-
- pthread *thread = (pthread *) _arg;
- struct __reent_t local_reent;
- struct _winsup_t local_winsup;
- struct _reent local_clib = _REENT_INIT(local_clib);
-
- struct sigaction _sigs[NSIG];
- sigset_t _sig_mask; /*one set for everything to ignore. */
- LONG _sigtodo[NSIG + __SIGOFFSET];
-
- // setup signal structures
- thread->sigs = _sigs;
- thread->sigmask = &_sig_mask;
- thread->sigtodo = _sigtodo;
-
- memset (&local_winsup, 0, sizeof (struct _winsup_t));
-
- local_reent._clib = &local_clib;
- local_reent._winsup = &local_winsup;
-
- local_winsup._process_logmask = LOG_UPTO (LOG_DEBUG);
-
- /*This is not checked by the OS !! */
- if (!TlsSetValue (MT_INTERFACE->reent_index, &local_reent))
- system_printf ("local storage for thread couldn't be set");
-
- /*the OS doesn't check this for <= 64 Tls entries (pre win2k) */
- TlsSetValue (MT_INTERFACE->thread_self_dwTlsIndex, thread);
-
- thread->mutex.Lock();
- // if thread is detached force cleanup on exit
- if (thread->attr.joinable == PTHREAD_CREATE_DETACHED && thread->joiner == NULL)
- thread->joiner = pthread::self ();
- thread->mutex.UnLock();
-
-#ifdef _CYG_THREAD_FAILSAFE
- if (_REENT == _impure_ptr)
- system_printf ("local storage for thread isn't setup correctly");
-#endif
-
- thread_printf ("started thread %p %p %p %p %p %p", _arg, &local_clib,
- _impure_ptr, thread, thread->function, thread->arg);
-
- // call the user's thread
- void *ret = thread->function (thread->arg);
-
- __pthread_exit (ret);
-
-#if 0
-// ??? This code only runs if the thread exits by returning.
-// it's all now in __pthread_exit ();
-#endif
- /*never reached */
- return 0;
-}
-
-int
-__pthread_create (pthread_t *thread, const pthread_attr_t *attr,
- void *(*start_routine) (void *), void *arg)
-{
- DECLARE_TLS_STORAGE;
- if (attr && verifyable_object_isvalid (attr, PTHREAD_ATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
-
- *thread = new pthread ();
- (*thread)->create (start_routine, attr ? *attr : NULL, arg);
- if (verifyable_object_isvalid (thread, PTHREAD_MAGIC) != VALID_OBJECT)
- {
- delete (*thread);
- *thread = NULL;
- return EAGAIN;
- }
-
- return 0;
-}
-
-int
-__pthread_once (pthread_once_t *once_control, void (*init_routine) (void))
-{
- pthread_mutex_lock (&once_control->mutex);
- /*Here we must set a cancellation handler to unlock the mutex if needed */
- /*but a cancellation handler is not the right thing. We need this in the thread
- *cleanup routine. Assumption: a thread can only be in one pthread_once routine
- *at a time. Stote a mutex_t *in the pthread_structure. if that's non null unlock
- *on pthread_exit ();
- */
- if (once_control->state == 0)
- {
- init_routine ();
- once_control->state = 1;
- }
- /*Here we must remove our cancellation handler */
- pthread_mutex_unlock (&once_control->mutex);
- return 0;
-}
-
-/*Cancelability states */
-
-
-/*Perform the actual cancel */
-void
-__pthread_cleanup (pthread_t thread)
-{
-}
-
-
-int
-__pthread_cancel (pthread_t thread)
-{
- if (verifyable_object_isvalid (&thread, PTHREAD_MAGIC) != VALID_OBJECT)
- return ESRCH;
- if (thread->cancelstate == PTHREAD_CANCEL_ENABLE)
- {
-#if 0
- /*once all the functions call testcancel (), we will do this */
- if (thread->canceltype == PTHREAD_CANCEL_DEFERRED)
- {
- }
- else
- {
- /*possible FIXME: this function is meant to return asynchronously
- *from the cancellation routine actually firing. So we may need some sort
- *of signal to be sent that is immediately recieved and acted on.
- */
- __pthread_cleanup (thread);
- }
-#endif
- }
-/* return 0;
-*/
-
- return ESRCH;
-/*
- we return ESRCH until all the required functions call testcancel ();
- this will give applications predictable behaviour.
-
- the required function list is: *indicates done, X indicates not present in cygwin.
-aio_suspend ()
-*close ()
-*creat ()
-fcntl ()
-fsync ()
-getmsg ()
-getpmsg ()
-lockf ()
-mq_receive ()
-mq_send ()
-msgrcv ()
-msgsnd ()
-msync ()
-nanosleep ()
-open ()
-pause ()
-poll ()
-pread ()
-pthread_cond_timedwait ()
-pthread_cond_wait ()
-*pthread_join ()
-pthread_testcancel ()
-putmsg ()
-putpmsg ()
-pwrite ()
-read ()
-readv ()
-select ()
-sem_wait ()
-sigpause ()
-sigsuspend ()
-sigtimedwait ()
-sigwait ()
-sigwaitinfo ()
-*sleep ()
-system ()
-tcdrain ()
-*usleep ()
-wait ()
-wait3()
-waitid ()
-waitpid ()
-write ()
-writev ()
-
-the optional list is:
-catclose ()
-catgets ()
-catopen ()
-closedir ()
-closelog ()
-ctermid ()
-dbm_close ()
-dbm_delete ()
-dbm_fetch ()
-dbm_nextkey ()
-dbm_open ()
-dbm_store ()
-dlclose ()
-dlopen ()
-endgrent ()
-endpwent ()
-endutxent ()
-fclose ()
-fcntl ()
-fflush ()
-fgetc ()
-fgetpos ()
-fgets ()
-fgetwc ()
-fgetws ()
-fopen ()
-fprintf ()
-fputc ()
-fputs ()
-fputwc ()
-fputws ()
-fread ()
-freopen ()
-fscanf ()
-fseek ()
-fseeko ()
-fsetpos ()
-ftell ()
-ftello ()
-ftw ()
-fwprintf ()
-fwrite ()
-fwscanf ()
-getc ()
-getc_unlocked ()
-getchar ()
-getchar_unlocked ()
-getcwd ()
-getdate ()
-getgrent ()
-getgrgid ()
-getgrgid_r ()
-getgrnam ()
-getgrnam_r ()
-getlogin ()
-getlogin_r ()
-getpwent ()
-*getpwnam ()
-*getpwnam_r ()
-*getpwuid ()
-*getpwuid_r ()
-gets ()
-getutxent ()
-getutxid ()
-getutxline ()
-getw ()
-getwc ()
-getwchar ()
-getwd ()
-glob ()
-iconv_close ()
-iconv_open ()
-ioctl ()
-lseek ()
-mkstemp ()
-nftw ()
-opendir ()
-openlog ()
-pclose ()
-perror ()
-popen ()
-printf ()
-putc ()
-putc_unlocked ()
-putchar ()
-putchar_unlocked ()
-puts ()
-pututxline ()
-putw ()
-putwc ()
-putwchar ()
-readdir ()
-readdir_r ()
-remove ()
-rename ()
-rewind ()
-rewinddir ()
-scanf ()
-seekdir ()
-semop ()
-setgrent ()
-setpwent ()
-setutxent ()
-strerror ()
-syslog ()
-tmpfile ()
-tmpnam ()
-ttyname ()
-ttyname_r ()
-ungetc ()
-ungetwc ()
-unlink ()
-vfprintf ()
-vfwprintf ()
-vprintf ()
-vwprintf ()
-wprintf ()
-wscanf ()
-
-Note, that for fcntl (), for any value of the cmd argument.
-
-And we must not introduce cancellation points anywhere else that's part of the posix or
-opengroup specs.
- */
-}
-
-/*no races in these three functions: they are all current-thread-only */
-int
-__pthread_setcancelstate (int state, int *oldstate)
-{
- class pthread *thread = pthread::self ();
- if (state != PTHREAD_CANCEL_ENABLE && state != PTHREAD_CANCEL_DISABLE)
- return EINVAL;
- *oldstate = thread->cancelstate;
- thread->cancelstate = state;
- return 0;
-}
-
-int
-__pthread_setcanceltype (int type, int *oldtype)
-{
- class pthread *thread = pthread::self ();
- if (type != PTHREAD_CANCEL_DEFERRED && type != PTHREAD_CANCEL_ASYNCHRONOUS)
- return EINVAL;
- *oldtype = thread->canceltype;
- thread->canceltype = type;
- return 0;
-}
-
-/*deferred cancellation request handler */
-void
-__pthread_testcancel (void)
-{
- class pthread *thread = pthread::self ();
- if (thread->cancelstate == PTHREAD_CANCEL_DISABLE)
- return;
- /*check the cancellation event object here - not neededuntil pthread_cancel actually
- *does something*/
-}
-
-/*
- *Races in pthread_atfork:
- *We are race safe in that any additions to the lists are made via
- *InterlockedExchangePointer.
- *However, if the user application doesn't perform syncronisation of some sort
- *It's not guaranteed that a near simultaneous call to pthread_atfork and fork
- *will result in the new atfork handlers being calls.
- *More rigorous internal syncronisation isn't needed as the user program isn't
- *guaranteeing their own state.
- *
- *as far as multiple calls to pthread_atfork, the worst case is simultaneous calls
- *will result in an indeterminate order for parent and child calls (what gets inserted
- *first isn't guaranteed.)
- *
- *There is one potential race... Does the result of InterlockedExchangePointer
- *get committed to the return location _before_ any context switches can occur?
- *If yes, we're safe, if no, we're not.
- */
-void
-__pthread_atforkprepare (void)
-{
- callback *cb = MT_INTERFACE->pthread_prepare;
- while (cb)
- {
- cb->cb ();
- cb = cb->next;
- }
-}
-
-void
-__pthread_atforkparent (void)
-{
- callback *cb = MT_INTERFACE->pthread_parent;
- while (cb)
- {
- cb->cb ();
- cb = cb->next;
- }
-}
-
-void
-__pthread_atforkchild (void)
-{
- callback *cb = MT_INTERFACE->pthread_child;
- while (cb)
- {
- cb->cb ();
- cb = cb->next;
- }
-}
-
-/*Register a set of functions to run before and after fork.
- *prepare calls are called in LI-FC order.
- *parent and child calls are called in FI-FC order.
- */
-int
-__pthread_atfork (void (*prepare)(void), void (*parent)(void), void (*child)(void))
-{
- callback *prepcb = NULL, *parentcb = NULL, *childcb = NULL;
- if (prepare)
- {
- prepcb = new callback;
- if (!prepcb)
- return ENOMEM;
- }
- if (parent)
- {
- parentcb = new callback;
- if (!parentcb)
- {
- if (prepcb)
- delete prepcb;
- return ENOMEM;
- }
- }
- if (child)
- {
- childcb = new callback;
- if (!childcb)
- {
- if (prepcb)
- delete prepcb;
- if (parentcb)
- delete parentcb;
- return ENOMEM;
- }
- }
-
- if (prepcb)
- {
- prepcb->cb = prepare;
- prepcb->next = (callback *) InterlockedExchangePointer ((LONG *) &MT_INTERFACE->pthread_prepare, (long int) prepcb);
- }
- if (parentcb)
- {
- parentcb->cb = parent;
- callback **t = &MT_INTERFACE->pthread_parent;
- while (*t)
- t = &(*t)->next;
- /*t = pointer to last next in the list */
- parentcb->next = (callback *) InterlockedExchangePointer ((LONG *) t, (long int) parentcb);
- }
- if (childcb)
- {
- childcb->cb = child;
- callback **t = &MT_INTERFACE->pthread_child;
- while (*t)
- t = &(*t)->next;
- /*t = pointer to last next in the list */
- childcb->next = (callback *) InterlockedExchangePointer ((LONG *) t, (long int) childcb);
- }
- return 0;
-}
-
-int
-__pthread_attr_init (pthread_attr_t *attr)
-{
- if (check_valid_pointer (attr))
- return EINVAL;
- *attr = new pthread_attr;
- if (verifyable_object_isvalid (attr, PTHREAD_ATTR_MAGIC) != VALID_OBJECT)
- {
- delete (*attr);
- *attr = NULL;
- return EAGAIN;
- }
- return 0;
-}
-
-int
-__pthread_attr_getinheritsched (const pthread_attr_t *attr,
- int *inheritsched)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_ATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- *inheritsched = (*attr)->inheritsched;
- return 0;
-}
-
-int
-__pthread_attr_getschedparam (const pthread_attr_t *attr,
- struct sched_param *param)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_ATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- *param = (*attr)->schedparam;
- return 0;
-}
-
-/*From a pure code point of view, this should call a helper in sched.cc,
- *to allow for someone adding scheduler policy changes to win32 in the future.
- *However that's extremely unlikely, so short and sweet will do us
- */
-int
-__pthread_attr_getschedpolicy (const pthread_attr_t *attr, int *policy)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_ATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- *policy = SCHED_FIFO;
- return 0;
-}
-
-
-int
-__pthread_attr_getscope (const pthread_attr_t *attr, int *contentionscope)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_ATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- *contentionscope = (*attr)->contentionscope;
- return 0;
-}
-
-int
-__pthread_attr_setdetachstate (pthread_attr_t *attr, int detachstate)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_ATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- if (detachstate < 0 || detachstate > 1)
- return EINVAL;
- (*attr)->joinable = detachstate;
- return 0;
-}
-
-int
-__pthread_attr_getdetachstate (const pthread_attr_t *attr, int *detachstate)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_ATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- *detachstate = (*attr)->joinable;
- return 0;
-}
-
-int
-__pthread_attr_setinheritsched (pthread_attr_t *attr, int inheritsched)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_ATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- if (inheritsched != PTHREAD_INHERIT_SCHED
- && inheritsched != PTHREAD_EXPLICIT_SCHED)
- return ENOTSUP;
- (*attr)->inheritsched = inheritsched;
- return 0;
-}
-
-int
-__pthread_attr_setschedparam (pthread_attr_t *attr,
- const struct sched_param *param)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_ATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- if (!valid_sched_parameters (param))
- return ENOTSUP;
- (*attr)->schedparam = *param;
- return 0;
-}
-
-/*See __pthread_attr_getschedpolicy for some notes */
-int
-__pthread_attr_setschedpolicy (pthread_attr_t *attr, int policy)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_ATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- if (policy != SCHED_FIFO)
- return ENOTSUP;
- return 0;
-}
-
-int
-__pthread_attr_setscope (pthread_attr_t *attr, int contentionscope)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_ATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- if (contentionscope != PTHREAD_SCOPE_SYSTEM
- && contentionscope != PTHREAD_SCOPE_PROCESS)
- return EINVAL;
- /*In future, we may be able to support system scope by escalating the thread
- *priority to exceed the priority class. For now we only support PROCESS scope. */
- if (contentionscope != PTHREAD_SCOPE_PROCESS)
- return ENOTSUP;
- (*attr)->contentionscope = contentionscope;
- return 0;
-}
-
-int
-__pthread_attr_setstacksize (pthread_attr_t *attr, size_t size)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_ATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- (*attr)->stacksize = size;
- return 0;
-}
-
-int
-__pthread_attr_getstacksize (const pthread_attr_t *attr, size_t *size)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_ATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- *size = (*attr)->stacksize;
- return 0;
-}
-
-int
-__pthread_attr_destroy (pthread_attr_t *attr)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_ATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- delete (*attr);
- *attr = NULL;
- return 0;
-}
-
-void
-__pthread_exit (void *value_ptr)
-{
- pthread * thread = pthread::self ();
-
- // run cleanup handlers
- thread->pop_all_cleanup_handlers();
-
- MT_INTERFACE->destructors.IterateNull ();
-
- thread->mutex.Lock();
- // cleanup if thread is in detached state and not joined
- if( __pthread_equal(&thread->joiner, &thread ) )
- delete thread;
- else
- {
- thread->return_ptr = value_ptr;
- thread->mutex.UnLock();
- }
-
- if (InterlockedDecrement (&MT_INTERFACE->threadcount) == 0)
- exit (0);
- else
- ExitThread (0);
-}
-
-int
-__pthread_join (pthread_t *thread, void **return_val)
-{
- pthread_t joiner = pthread::self ();
-
- /*FIXME: wait on the thread cancellation event as well - we are a cancellation point*/
- if (verifyable_object_isvalid (thread, PTHREAD_MAGIC) != VALID_OBJECT)
- return ESRCH;
-
- if ( joiner == *thread)
- {
- if (return_val)
- *return_val = NULL;
- return EDEADLK;
- }
-
- (*thread)->mutex.Lock ();
-
- if((*thread)->attr.joinable == PTHREAD_CREATE_DETACHED)
- {
- if (return_val)
- *return_val = NULL;
- (*thread)->mutex.UnLock ();
- return EINVAL;
- }
- else
- {
- (*thread)->joiner = joiner;
- (*thread)->attr.joinable = PTHREAD_CREATE_DETACHED;
- (*thread)->mutex.UnLock ();
- WaitForSingleObject ((*thread)->win32_obj_id, INFINITE);
- if (return_val)
- *return_val = (*thread)->return_ptr;
- // cleanup
- delete (*thread);
- } /*End if */
-
- pthread_testcancel ();
-
- return 0;
-}
-
-int
-__pthread_detach (pthread_t *thread)
-{
- if (verifyable_object_isvalid (thread, PTHREAD_MAGIC) != VALID_OBJECT)
- return ESRCH;
-
- (*thread)->mutex.Lock ();
- if ((*thread)->attr.joinable == PTHREAD_CREATE_DETACHED)
- {
- (*thread)->mutex.UnLock ();
- return EINVAL;
- }
-
- // check if thread is still alive
- if (WAIT_TIMEOUT == WaitForSingleObject ((*thread)->win32_obj_id, 0) )
- {
- // force cleanup on exit
- (*thread)->joiner = *thread;
- (*thread)->attr.joinable = PTHREAD_CREATE_DETACHED;
- (*thread)->mutex.UnLock ();
- }
- else
- // thread has already terminated.
- delete (*thread);
-
- return 0;
-}
-
-int
-__pthread_suspend (pthread_t *thread)
-{
- if (verifyable_object_isvalid (thread, PTHREAD_MAGIC) != VALID_OBJECT)
- return ESRCH;
-
- if ((*thread)->suspended == false)
- {
- (*thread)->suspended = true;
- SuspendThread ((*thread)->win32_obj_id);
- }
-
- return 0;
-}
-
-
-int
-__pthread_continue (pthread_t *thread)
-{
- if (verifyable_object_isvalid (thread, PTHREAD_MAGIC) != VALID_OBJECT)
- return ESRCH;
-
- if ((*thread)->suspended == true)
- ResumeThread ((*thread)->win32_obj_id);
- (*thread)->suspended = false;
-
- return 0;
-}
-
-/*provided for source level compatability.
- *See http://www.opengroup.org/onlinepubs/007908799/xsh/pthread_getconcurrency.html
- */
-int
-__pthread_getconcurrency (void)
-{
- return MT_INTERFACE->concurrency;
-}
-
-/*keep this in sync with sched.cc */
-int
-__pthread_getschedparam (pthread_t thread, int *policy,
- struct sched_param *param)
-{
- if (verifyable_object_isvalid (&thread, PTHREAD_MAGIC) != VALID_OBJECT)
- return ESRCH;
- *policy = SCHED_FIFO;
- /*we don't return the current effective priority, we return the current requested
- *priority */
- *param = thread->attr.schedparam;
- return 0;
-}
-
-
-unsigned long
-__pthread_getsequence_np (pthread_t *thread)
-{
- if (verifyable_object_isvalid (thread, PTHREAD_MAGIC) != VALID_OBJECT)
- return EINVAL;
- return (*thread)->GetThreadId ();
-}
-
-/*Thread SpecificData */
-int
-__pthread_key_create (pthread_key_t *key, void (*destructor) (void *))
-{
- /*The opengroup docs don't define if we should check this or not,
- *but creation is relatively rare..
- */
- if (verifyable_object_isvalid (key, PTHREAD_KEY_MAGIC) == VALID_OBJECT)
- return EBUSY;
-
- *key = new pthread_key (destructor);
-
- if (verifyable_object_isvalid (key, PTHREAD_KEY_MAGIC) != VALID_OBJECT)
- {
- delete (*key);
- *key = NULL;
- return EAGAIN;
- }
- return 0;
-}
-
-int
-__pthread_key_delete (pthread_key_t key)
-{
- if (verifyable_object_isvalid (&key, PTHREAD_KEY_MAGIC) != VALID_OBJECT)
- return EINVAL;
-
- delete (key);
- return 0;
-}
-
-/*provided for source level compatability.
- *See http://www.opengroup.org/onlinepubs/007908799/xsh/pthread_getconcurrency.html
- */
-int
-__pthread_setconcurrency (int new_level)
-{
- if (new_level < 0)
- return EINVAL;
- MT_INTERFACE->concurrency = new_level;
- return 0;
-}
-
-/*keep syncronised with sched.cc */
-int
-__pthread_setschedparam (pthread_t thread, int policy,
- const struct sched_param *param)
-{
- if (verifyable_object_isvalid (&thread, PTHREAD_MAGIC) != VALID_OBJECT)
- return ESRCH;
- if (policy != SCHED_FIFO)
- return ENOTSUP;
- if (!param)
- return EINVAL;
- int rv =
- sched_set_thread_priority (thread->win32_obj_id, param->sched_priority);
- if (!rv)
- thread->attr.schedparam.sched_priority = param->sched_priority;
- return rv;
-}
-
-
-int
-__pthread_setspecific (pthread_key_t key, const void *value)
-{
- if (verifyable_object_isvalid (&key, PTHREAD_KEY_MAGIC) != VALID_OBJECT)
- return EINVAL;
- (key)->set (value);
- return 0;
-}
-
-void *
-__pthread_getspecific (pthread_key_t key)
-{
- if (verifyable_object_isvalid (&key, PTHREAD_KEY_MAGIC) != VALID_OBJECT)
- return NULL;
-
- return (key)->get ();
-
-}
-
-/*Thread synchronisation */
-
-int
-__pthread_cond_destroy (pthread_cond_t *cond)
-{
- if (check_valid_pointer (cond) && (*cond == PTHREAD_COND_INITIALIZER))
- return 0;
- if (verifyable_object_isvalid (cond, PTHREAD_COND_MAGIC) != VALID_OBJECT)
- return EINVAL;
-
- /*reads are atomic */
- if ((*cond)->waiting)
- return EBUSY;
-
- delete (*cond);
- *cond = NULL;
-
- return 0;
-}
-
-int
-__pthread_cond_init (pthread_cond_t *cond, const pthread_condattr_t *attr)
-{
- if (attr && verifyable_object_isvalid (attr, PTHREAD_CONDATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
-
- if (verifyable_object_isvalid (cond, PTHREAD_COND_MAGIC, PTHREAD_COND_INITIALIZER) == VALID_OBJECT)
- return EBUSY;
-
- *cond = new pthread_cond (attr ? (*attr) : NULL);
-
- if (verifyable_object_isvalid (cond, PTHREAD_COND_MAGIC) != VALID_OBJECT)
- {
- delete (*cond);
- *cond = NULL;
- return EAGAIN;
- }
-
- return 0;
-}
-
-int
-__pthread_cond_broadcast (pthread_cond_t *cond)
-{
- if (*cond == PTHREAD_COND_INITIALIZER)
- __pthread_cond_init (cond, NULL);
- if (verifyable_object_isvalid (cond, PTHREAD_COND_MAGIC) != VALID_OBJECT)
- return EINVAL;
-
- (*cond)->BroadCast ();
-
- return 0;
-}
-
-int
-__pthread_cond_signal (pthread_cond_t *cond)
-{
- if (*cond == PTHREAD_COND_INITIALIZER)
- __pthread_cond_init (cond, NULL);
- if (verifyable_object_isvalid (cond, PTHREAD_COND_MAGIC) != VALID_OBJECT)
- return EINVAL;
-
- (*cond)->Signal ();
-
- return 0;
-}
-
-int
-__pthread_cond_dowait (pthread_cond_t *cond, pthread_mutex_t *mutex,
- long waitlength)
-{
-// and yes cond_access here is still open to a race. (we increment, context swap,
-// broadcast occurs - we miss the broadcast. the functions aren't split properly.
- int rv;
- pthread_mutex **themutex = NULL;
- if (*mutex == PTHREAD_MUTEX_INITIALIZER)
- __pthread_mutex_init (mutex, NULL);
- themutex = mutex;
- if (*cond == PTHREAD_COND_INITIALIZER)
- __pthread_cond_init (cond, NULL);
-
- if (verifyable_object_isvalid (themutex, PTHREAD_MUTEX_MAGIC) != VALID_OBJECT)
- return EINVAL;
- if (verifyable_object_isvalid (cond, PTHREAD_COND_MAGIC) != VALID_OBJECT)
- return EINVAL;
-
- /*if the cond variable is blocked, then the above timer test maybe wrong. *shrug**/
- if (pthread_mutex_lock (&(*cond)->cond_access))
- system_printf ("Failed to lock condition variable access mutex, this %p", *cond);
-
- if ((*cond)->waiting)
- if ((*cond)->mutex && ((*cond)->mutex != (*themutex)))
- {
- if (pthread_mutex_unlock (&(*cond)->cond_access))
- system_printf ("Failed to unlock condition variable access mutex, this %p", *cond);
- return EINVAL;
- }
- InterlockedIncrement (&((*cond)->waiting));
-
- (*cond)->mutex = (*themutex);
- InterlockedIncrement (&((*themutex)->condwaits));
- if (pthread_mutex_unlock (&(*cond)->cond_access))
- system_printf ("Failed to unlock condition variable access mutex, this %p", *cond);
- /* At this point calls to Signal will progress evebn if we aren' yet waiting
- * However, the loop there should allow us to get scheduled and call wait,
- * and have them call PulseEvent again if we dont' respond.
- */
- rv = (*cond)->TimedWait (waitlength);
- /* this may allow a race on the mutex acquisition and waits..
- * But doing this within the cond access mutex creates a different race
- */
- InterlockedDecrement (&((*cond)->waiting));
- /* Tell Signal that we have been released */
- InterlockedDecrement (&((*cond)->ExitingWait));
- (*themutex)->Lock ();
- if (pthread_mutex_lock (&(*cond)->cond_access))
- system_printf ("Failed to lock condition variable access mutex, this %p", *cond);
- if ((*cond)->waiting == 0)
- (*cond)->mutex = NULL;
- InterlockedDecrement (&((*themutex)->condwaits));
- if (pthread_mutex_unlock (&(*cond)->cond_access))
- system_printf ("Failed to unlock condition variable access mutex, this %p", *cond);
-
- return rv;
-}
-
-extern "C" int
-pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
- const struct timespec *abstime)
-{
- if (check_valid_pointer (abstime))
- return EINVAL;
- struct timeb currSysTime;
- long waitlength;
- ftime (&currSysTime);
- waitlength = (abstime->tv_sec - currSysTime.time) *1000;
- if (waitlength < 0)
- return ETIMEDOUT;
- return __pthread_cond_dowait (cond, mutex, waitlength);
-}
-
-extern "C" int
-pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex)
-{
- return __pthread_cond_dowait (cond, mutex, INFINITE);
-}
-
-int
-__pthread_condattr_init (pthread_condattr_t *condattr)
-{
- *condattr = new pthread_condattr;
- if (verifyable_object_isvalid (condattr, PTHREAD_CONDATTR_MAGIC) != VALID_OBJECT)
- {
- delete (*condattr);
- *condattr = NULL;
- return EAGAIN;
- }
- return 0;
-}
-
-int
-__pthread_condattr_getpshared (const pthread_condattr_t *attr, int *pshared)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_CONDATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- *pshared = (*attr)->shared;
- return 0;
-}
-
-int
-__pthread_condattr_setpshared (pthread_condattr_t *attr, int pshared)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_CONDATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- if ((pshared < 0) || (pshared > 1))
- return EINVAL;
- /*shared cond vars not currently supported */
- if (pshared != PTHREAD_PROCESS_PRIVATE)
- return EINVAL;
- (*attr)->shared = pshared;
- return 0;
-}
-
-int
-__pthread_condattr_destroy (pthread_condattr_t *condattr)
-{
- if (verifyable_object_isvalid (condattr, PTHREAD_CONDATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- delete (*condattr);
- *condattr = NULL;
- return 0;
-}
-
-/*Thread signal */
-int
-__pthread_kill (pthread_t thread, int sig)
-{
-// lock myself, for the use of thread2signal
- // two different kills might clash: FIXME
-
- if (verifyable_object_isvalid (&thread, PTHREAD_MAGIC) != VALID_OBJECT)
- return EINVAL;
-
- if (thread->sigs)
- myself->setthread2signal (thread);
-
- int rval = _kill (myself->pid, sig);
-
- // unlock myself
- return rval;
-}
-
-int
-__pthread_sigmask (int operation, const sigset_t *set, sigset_t *old_set)
-{
- pthread *thread = pthread::self ();
-
- // lock this myself, for the use of thread2signal
- // two differt kills might clash: FIXME
-
- if (thread->sigs)
- myself->setthread2signal (thread);
-
- int rval = sigprocmask (operation, set, old_set);
-
- // unlock this myself
-
- return rval;
-}
-
-/* ID */
-
-int
-__pthread_equal (pthread_t *t1, pthread_t *t2)
-{
- return (*t1 == *t2);
-}
-
-/*Mutexes */
-
-/*FIXME: there's a potential race with PTHREAD_MUTEX_INITALIZER:
- *the mutex is not actually inited until the first use.
- *So two threads trying to lock/trylock may collide.
- *Solution: we need a global mutex on mutex creation, or possibly simply
- *on all constructors that allow INITIALIZER macros.
- *the lock should be very small: only around the init routine, not
- *every test, or all mutex access will be synchronised.
- */
-
-int
-__pthread_mutex_init (pthread_mutex_t *mutex,
- const pthread_mutexattr_t *attr)
-{
- if (attr && verifyable_object_isvalid (attr, PTHREAD_MUTEXATTR_MAGIC) != VALID_OBJECT || check_valid_pointer (mutex))
- return EINVAL;
-
- if (verifyable_object_isvalid (mutex, PTHREAD_MUTEX_MAGIC, PTHREAD_MUTEX_INITIALIZER) == VALID_OBJECT)
- return EBUSY;
-
- *mutex = new pthread_mutex (attr ? (*attr) : NULL);
- if (verifyable_object_isvalid (mutex, PTHREAD_MUTEX_MAGIC) != VALID_OBJECT)
- {
- delete (*mutex);
- *mutex = NULL;
- return EAGAIN;
- }
- return 0;
-}
-
-int
-__pthread_mutex_getprioceiling (const pthread_mutex_t *mutex,
- int *prioceiling)
-{
- pthread_mutex_t *themutex = (pthread_mutex_t *) mutex;
- if (*mutex == PTHREAD_MUTEX_INITIALIZER)
- __pthread_mutex_init ((pthread_mutex_t *) mutex, NULL);
- if (verifyable_object_isvalid (themutex, PTHREAD_MUTEX_MAGIC) != VALID_OBJECT)
- return EINVAL;
- /*We don't define _POSIX_THREAD_PRIO_PROTECT because we do't currently support
- *mutex priorities.
- *
- *We can support mutex priorities in the future though:
- *Store a priority with each mutex.
- *When the mutex is optained, set the thread priority as appropriate
- *When the mutex is released, reset the thread priority.
- */
- return ENOSYS;
-}
-
-int
-__pthread_mutex_lock (pthread_mutex_t *mutex)
-{
- pthread_mutex_t *themutex = mutex;
- switch (verifyable_object_isvalid (themutex, PTHREAD_MUTEX_MAGIC, PTHREAD_MUTEX_INITIALIZER))
- {
- case INVALID_OBJECT:
- return EINVAL;
- break;
- case VALID_STATIC_OBJECT:
- if (*mutex == PTHREAD_MUTEX_INITIALIZER)
- {
- int rv = __pthread_mutex_init (mutex, NULL);
- if (rv)
- return rv;
- }
- break;
- case VALID_OBJECT:
- break;
- }
- (*themutex)->Lock ();
- return 0;
-}
-
-int
-__pthread_mutex_trylock (pthread_mutex_t *mutex)
-{
- pthread_mutex_t *themutex = mutex;
- if (*mutex == PTHREAD_MUTEX_INITIALIZER)
- __pthread_mutex_init (mutex, NULL);
- if (verifyable_object_isvalid (themutex, PTHREAD_MUTEX_MAGIC) != VALID_OBJECT)
- return EINVAL;
- if ((*themutex)->TryLock ())
- return EBUSY;
- return 0;
-}
-
-int
-__pthread_mutex_unlock (pthread_mutex_t *mutex)
-{
- if (*mutex == PTHREAD_MUTEX_INITIALIZER)
- __pthread_mutex_init (mutex, NULL);
- if (verifyable_object_isvalid (mutex, PTHREAD_MUTEX_MAGIC) != VALID_OBJECT)
- return EINVAL;
- (*mutex)->UnLock ();
- return 0;
-}
-
-int
-__pthread_mutex_destroy (pthread_mutex_t *mutex)
-{
- if (check_valid_pointer (mutex) && (*mutex == PTHREAD_MUTEX_INITIALIZER))
- return 0;
- if (verifyable_object_isvalid (mutex, PTHREAD_MUTEX_MAGIC) != VALID_OBJECT)
- return EINVAL;
-
- /*reading a word is atomic */
- if ((*mutex)->condwaits)
- return EBUSY;
-
- delete (*mutex);
- *mutex = NULL;
- return 0;
-}
-
-int
-__pthread_mutex_setprioceiling (pthread_mutex_t *mutex, int prioceiling,
- int *old_ceiling)
-{
- pthread_mutex_t *themutex = mutex;
- if (*mutex == PTHREAD_MUTEX_INITIALIZER)
- __pthread_mutex_init (mutex, NULL);
- if (verifyable_object_isvalid (themutex, PTHREAD_MUTEX_MAGIC) != VALID_OBJECT)
- return EINVAL;
- return ENOSYS;
-}
-
-/*Win32 doesn't support mutex priorities - see __pthread_mutex_getprioceiling
- *for more detail */
-int
-__pthread_mutexattr_getprotocol (const pthread_mutexattr_t *attr,
- int *protocol)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_MUTEXATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- return ENOSYS;
-}
-
-int
-__pthread_mutexattr_getpshared (const pthread_mutexattr_t *attr,
- int *pshared)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_MUTEXATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- *pshared = (*attr)->pshared;
- return 0;
-}
-
-/*Win32 mutex's are equivalent to posix RECURSIVE mutexs.
- *We need to put glue in place to support other types of mutex's. We map
- *PTHREAD_MUTEX_DEFAULT to PTHREAD_MUTEX_RECURSIVE and return EINVAL for other types.
- */
-int
-__pthread_mutexattr_gettype (const pthread_mutexattr_t *attr, int *type)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_MUTEXATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- *type = (*attr)->mutextype;
- return 0;
-}
-
-/*Currently pthread_mutex_init ignores the attr variable, this is because
- *none of the variables have any impact on it's behaviour.
- *
- *FIXME: write and test process shared mutex's.
- */
-int
-__pthread_mutexattr_init (pthread_mutexattr_t *attr)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_MUTEXATTR_MAGIC) != INVALID_OBJECT)
- return EBUSY;
-
- *attr = new pthread_mutexattr ();
- if (verifyable_object_isvalid (attr, PTHREAD_MUTEXATTR_MAGIC) != VALID_OBJECT)
- {
- delete (*attr);
- *attr = NULL;
- return ENOMEM;
- }
- return 0;
-}
-
-int
-__pthread_mutexattr_destroy (pthread_mutexattr_t *attr)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_MUTEXATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- delete (*attr);
- *attr = NULL;
- return 0;
-}
-
-
-/*Win32 doesn't support mutex priorities */
-int
-__pthread_mutexattr_setprotocol (pthread_mutexattr_t *attr, int protocol)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_MUTEXATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- return ENOSYS;
-}
-
-/*Win32 doesn't support mutex priorities */
-int
-__pthread_mutexattr_setprioceiling (pthread_mutexattr_t *attr,
- int prioceiling)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_MUTEXATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- return ENOSYS;
-}
-
-int
-__pthread_mutexattr_getprioceiling (const pthread_mutexattr_t *attr,
- int *prioceiling)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_MUTEXATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- return ENOSYS;
-}
-
-int
-__pthread_mutexattr_setpshared (pthread_mutexattr_t *attr, int pshared)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_MUTEXATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- /*we don't use pshared for anything as yet. We need to test PROCESS_SHARED
- *functionality
- */
- if (pshared != PTHREAD_PROCESS_PRIVATE)
- return EINVAL;
- (*attr)->pshared = pshared;
- return 0;
-}
-
-/*see __pthread_mutex_gettype */
-int
-__pthread_mutexattr_settype (pthread_mutexattr_t *attr, int type)
-{
- if (verifyable_object_isvalid (attr, PTHREAD_MUTEXATTR_MAGIC) != VALID_OBJECT)
- return EINVAL;
- if (type != PTHREAD_MUTEX_RECURSIVE)
- return EINVAL;
- (*attr)->mutextype = type;
- return 0;
-}
-
-/*Semaphores */
-int
-__sem_init (sem_t *sem, int pshared, unsigned int value)
-{
- /*opengroup calls this undefined */
- if (verifyable_object_isvalid (sem, SEM_MAGIC) != INVALID_OBJECT)
- return EBUSY;
-
- if (value > SEM_VALUE_MAX)
- return EINVAL;
-
- *sem = new semaphore (pshared, value);
-
- if (verifyable_object_isvalid (sem, SEM_MAGIC) != VALID_OBJECT)
- {
- delete (*sem);
- *sem = NULL;
- return EAGAIN;
- }
- return 0;
-}
-
-int
-__sem_destroy (sem_t *sem)
-{
- if (verifyable_object_isvalid (sem, SEM_MAGIC) != VALID_OBJECT)
- return EINVAL;
-
- /*FIXME - new feature - test for busy against threads... */
-
- delete (*sem);
- *sem = NULL;
- return 0;
-}
-
-int
-__sem_wait (sem_t *sem)
-{
- if (verifyable_object_isvalid (sem, SEM_MAGIC) != VALID_OBJECT)
- {
- set_errno (EINVAL);
- return -1;
- }
-
- (*sem)->Wait ();
- return 0;
-}
-
-int
-__sem_trywait (sem_t *sem)
-{
- if (verifyable_object_isvalid (sem, SEM_MAGIC) != VALID_OBJECT)
- {
- set_errno (EINVAL);
- return -1;
- }
-
- return (*sem)->TryWait ();
-}
-
-int
-__sem_post (sem_t *sem)
-{
- if (verifyable_object_isvalid (sem, SEM_MAGIC) != VALID_OBJECT)
- return EINVAL;
-
- (*sem)->Post ();
- return 0;
-}
-
-#endif // MT_SAFE
diff --git a/winsup/cygwin/thread.h b/winsup/cygwin/thread.h
deleted file mode 100644
index ee4dfbb8e..000000000
--- a/winsup/cygwin/thread.h
+++ /dev/null
@@ -1,522 +0,0 @@
-/* thread.h: Locking and threading module definitions
-
- Copyright 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-
- Written by Marco Fuykschot <marco@ddi.nl>
- Major update 2001 Robert Collins <rbtcollins@hotmail.com>
-
-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 _CYGNUS_THREADS_
-#define _CYGNUS_THREADS_
-
-#define LOCK_FD_LIST 1
-#define LOCK_MEMORY_LIST 2
-#define LOCK_MMAP_LIST 3
-#define LOCK_DLL_LIST 4
-
-#define WRITE_LOCK 1
-#define READ_LOCK 2
-
-extern "C"
-{
-#if defined (_CYG_THREAD_FAILSAFE) && defined (_MT_SAFE)
- void AssertResourceOwner (int, int);
-#else
-#define AssertResourceOwner(i,ii)
-#endif
-}
-
-#ifndef _MT_SAFE
-
-#define SetResourceLock(i,n,c)
-#define ReleaseResourceLock(i,n,c)
-
-#else
-
-#include <pthread.h>
-#include <signal.h>
-#include <pwd.h>
-#include <grp.h>
-#define _NOMNTENT_FUNCS
-#include <mntent.h>
-
-extern "C"
-{
-
-struct _winsup_t
-{
- /*
- Needed for the group functions
- */
- struct __group16 _grp;
- char *_namearray[2];
- int _grp_pos;
-
- /* console.cc */
- unsigned _rarg;
-
- /* dlfcn.cc */
- int _dl_error;
- char _dl_buffer[256];
-
- /* passwd.cc */
- struct passwd _res;
- char _pass[_PASSWORD_LEN];
- int _pw_pos;
-
- /* path.cc */
- struct mntent mntbuf;
- int _iteration;
- DWORD available_drives;
- char mnt_type[80];
- char mnt_opts[80];
- char mnt_fsname[MAX_PATH];
- char mnt_dir[MAX_PATH];
-
- /* strerror */
- char _strerror_buf[20];
-
- /* sysloc.cc */
- char *_process_ident;
- int _process_logopt;
- int _process_facility;
- int _process_logmask;
-
- /* times.cc */
- char timezone_buf[20];
- struct tm _localtime_buf;
-
- /* uinfo.cc */
- char _username[UNLEN + 1];
-
- /* net.cc */
- char *_ntoa_buf;
- struct protoent *_protoent_buf;
- struct servent *_servent_buf;
- struct hostent *_hostent_buf;
-};
-
-
-struct __reent_t
-{
- struct _reent *_clib;
- struct _winsup_t *_winsup;
-};
-
-_reent *_reent_clib ();
-_winsup_t *_reent_winsup ();
-void SetResourceLock (int, int, const char *) __attribute__ ((regparm (3)));
-void ReleaseResourceLock (int, int, const char *)
- __attribute__ ((regparm (3)));
-
-#ifdef _CYG_THREAD_FAILSAFE
-void AssertResourceOwner (int, int);
-#else
-#define AssertResourceOwner(i,ii)
-#endif
-}
-
-class per_process;
-class pinfo;
-
-class ResourceLocks
-{
-public:
- ResourceLocks ()
- {
- }
- LPCRITICAL_SECTION Lock (int);
- void Init ();
- void Delete ();
-#ifdef _CYG_THREAD_FAILSAFE
- DWORD owner;
- DWORD count;
-#endif
-private:
- CRITICAL_SECTION lock;
- bool inited;
-};
-
-#define PTHREAD_MAGIC 0xdf0df045
-#define PTHREAD_MUTEX_MAGIC PTHREAD_MAGIC+1
-#define PTHREAD_KEY_MAGIC PTHREAD_MAGIC+2
-#define PTHREAD_ATTR_MAGIC PTHREAD_MAGIC+3
-#define PTHREAD_MUTEXATTR_MAGIC PTHREAD_MAGIC+4
-#define PTHREAD_COND_MAGIC PTHREAD_MAGIC+5
-#define PTHREAD_CONDATTR_MAGIC PTHREAD_MAGIC+6
-#define SEM_MAGIC PTHREAD_MAGIC+7
-#define PTHREAD_ONCE_MAGIC PTHREAD_MAGIC+8;
-
-/* verifyable_object should not be defined here - it's a general purpose class */
-
-class verifyable_object
-{
-public:
- long magic;
-
- verifyable_object (long);
- ~verifyable_object ();
-};
-
-typedef enum
-{
- VALID_OBJECT,
- INVALID_OBJECT,
- VALID_STATIC_OBJECT
-} verifyable_object_state;
-
-verifyable_object_state verifyable_object_isvalid (void const *, long);
-verifyable_object_state verifyable_object_isvalid (void const *, long, void *);
-
-class pthread_key:public verifyable_object
-{
-public:
-
- DWORD dwTlsIndex;
- int set (const void *);
- void *get ();
-
- pthread_key (void (*)(void *));
- ~pthread_key ();
-};
-
-/* FIXME: test using multiple inheritance and merging key_destructor into pthread_key
- * for efficiency */
-class pthread_key_destructor
-{
-public:
- void (*destructor) (void *);
- pthread_key_destructor *InsertAfter (pthread_key_destructor * node);
- pthread_key_destructor *UnlinkNext ();
- pthread_key_destructor *Next ();
-
- pthread_key_destructor (void (*thedestructor) (void *), pthread_key * key);
- pthread_key_destructor *next;
- pthread_key *key;
-};
-
-class pthread_key_destructor_list
-{
-public:
- void Insert (pthread_key_destructor * node);
-/* remove a given dataitem, wherever in the list it is */
- pthread_key_destructor *Remove (pthread_key_destructor * item);
-/* get the first item and remove at the same time */
- pthread_key_destructor *Pop ();
- pthread_key_destructor *Remove (pthread_key * key);
- void IterateNull ();
-private:
- pthread_key_destructor * head;
-};
-
-
-class pthread_attr:public verifyable_object
-{
-public:
- int joinable;
- int contentionscope;
- int inheritsched;
- struct sched_param schedparam;
- size_t stacksize;
-
- pthread_attr ();
- ~pthread_attr ();
-};
-
-class pthread_mutexattr:public verifyable_object
-{
-public:
- int pshared;
- int mutextype;
- pthread_mutexattr ();
- ~pthread_mutexattr ();
-};
-
-class pthread_mutex:public verifyable_object
-{
-public:
- CRITICAL_SECTION criticalsection;
- HANDLE win32_obj_id;
- LONG condwaits;
- int pshared;
- class pthread_mutex * next;
-
- int Lock ();
- int TryLock ();
- int UnLock ();
- void fixup_after_fork ();
-
- pthread_mutex (pthread_mutexattr * = NULL);
- pthread_mutex (pthread_mutex_t *, pthread_mutexattr *);
- ~pthread_mutex ();
-};
-
-class pthread:public verifyable_object
-{
-public:
- HANDLE win32_obj_id;
- class pthread_attr attr;
- void *(*function) (void *);
- void *arg;
- void *return_ptr;
- bool suspended;
- int cancelstate, canceltype;
- pthread_t joiner;
- // int joinable;
-
- DWORD GetThreadId ()
- {
- return thread_id;
- }
- void setThreadIdtoCurrent ()
- {
- thread_id = GetCurrentThreadId ();
- }
-
- /* signal handling */
- struct sigaction *sigs;
- sigset_t *sigmask;
- LONG *sigtodo;
- void create (void *(*)(void *), pthread_attr *, void *);
-
- pthread ();
- ~pthread ();
-
- void push_cleanup_handler (__pthread_cleanup_handler *handler);
- void pop_cleanup_handler (int const execute);
-
- static pthread* self ();
- static void *thread_init_wrapper (void *);
-
-private:
- DWORD thread_id;
- __pthread_cleanup_handler *cleanup_handlers;
- pthread_mutex mutex;
-
- friend void __pthread_exit (void *value_ptr);
- friend int __pthread_join (pthread_t * thread, void **return_val);
- friend int __pthread_detach (pthread_t * thread);
-
- void pop_all_cleanup_handlers (void);
-};
-
-class pthread_condattr:public verifyable_object
-{
-public:
- int shared;
-
- pthread_condattr ();
- ~pthread_condattr ();
-};
-
-class pthread_cond:public verifyable_object
-{
-public:
- int shared;
- LONG waiting;
- LONG ExitingWait;
- pthread_mutex *mutex;
- /* to allow atomic behaviour for cond_broadcast */
- pthread_mutex_t cond_access;
- HANDLE win32_obj_id;
- class pthread_cond * next;
- int TimedWait (DWORD dwMilliseconds);
- void BroadCast ();
- void Signal ();
- void fixup_after_fork ();
-
- pthread_cond (pthread_condattr *);
- ~pthread_cond ();
-};
-
-class pthread_once
-{
-public:
- pthread_mutex_t mutex;
- int state;
-};
-
-/* shouldn't be here */
-class semaphore:public verifyable_object
-{
-public:
- HANDLE win32_obj_id;
- class semaphore * next;
- int shared;
- long currentvalue;
- void Wait ();
- void Post ();
- int TryWait ();
- void fixup_after_fork ();
-
- semaphore (int, unsigned int);
- ~semaphore ();
-};
-
-class callback
-{
-public:
- void (*cb)(void);
- class callback * next;
-};
-
-class MTinterface
-{
-public:
- // General
- DWORD reent_index;
- DWORD thread_self_dwTlsIndex;
- /* we may get 0 for the Tls index.. grrr */
- int indexallocated;
- int concurrency;
- long int threadcount;
-
- // Used for main thread data, and sigproc thread
- struct __reent_t reents;
- struct _winsup_t winsup_reent;
- pthread mainthread;
-
- pthread_key_destructor_list destructors;
- callback *pthread_prepare;
- callback *pthread_child;
- callback *pthread_parent;
-
- // list of mutex's. USE THREADSAFE INSERTS AND DELETES.
- class pthread_mutex * mutexs;
- class pthread_cond * conds;
- class semaphore * semaphores;
-
- void Init (int);
- void fixup_after_fork (void);
-
- MTinterface ():reent_index (0), indexallocated (0), threadcount (1)
- {
- pthread_prepare = NULL;
- pthread_child = NULL;
- pthread_parent = NULL;
- }
-};
-
-void __pthread_atforkprepare(void);
-void __pthread_atforkparent(void);
-void __pthread_atforkchild(void);
-
-/* Thread Exit */
-void __pthread_exit (void *value_ptr);
-int __pthread_join (pthread_t * thread, void **return_val);
-int __pthread_detach (pthread_t * thread);
-
-extern "C"
-{
-/* ThreadCreation */
-int __pthread_create (pthread_t * thread, const pthread_attr_t * attr,
- void *(*start_routine) (void *), void *arg);
-int __pthread_once (pthread_once_t *, void (*)(void));
-int __pthread_atfork(void (*)(void), void (*)(void), void (*)(void));
-
-int __pthread_attr_init (pthread_attr_t * attr);
-int __pthread_attr_destroy (pthread_attr_t * attr);
-int __pthread_attr_setdetachstate (pthread_attr_t *, int);
-int __pthread_attr_getdetachstate (const pthread_attr_t *, int *);
-int __pthread_attr_setstacksize (pthread_attr_t * attr, size_t size);
-int __pthread_attr_getstacksize (const pthread_attr_t * attr, size_t * size);
-
-int __pthread_attr_getinheritsched (const pthread_attr_t *, int *);
-int __pthread_attr_getschedparam (const pthread_attr_t *,
- struct sched_param *);
-int __pthread_attr_getschedpolicy (const pthread_attr_t *, int *);
-int __pthread_attr_getscope (const pthread_attr_t *, int *);
-int __pthread_attr_getstackaddr (const pthread_attr_t *, void **);
-int __pthread_attr_setinheritsched (pthread_attr_t *, int);
-int __pthread_attr_setschedparam (pthread_attr_t *,
- const struct sched_param *);
-int __pthread_attr_setschedpolicy (pthread_attr_t *, int);
-int __pthread_attr_setscope (pthread_attr_t *, int);
-int __pthread_attr_setstackaddr (pthread_attr_t *, void *);
-
-/* Thread suspend */
-int __pthread_suspend (pthread_t * thread);
-int __pthread_continue (pthread_t * thread);
-
-unsigned long __pthread_getsequence_np (pthread_t * thread);
-
-/* Thread SpecificData */
-int __pthread_key_create (pthread_key_t * key, void (*destructor) (void *));
-int __pthread_key_delete (pthread_key_t key);
-int __pthread_setspecific (pthread_key_t key, const void *value);
-void *__pthread_getspecific (pthread_key_t key);
-
-/* Thead synchroniation */
-int __pthread_cond_destroy (pthread_cond_t * cond);
-int __pthread_cond_init (pthread_cond_t * cond,
- const pthread_condattr_t * attr);
-int __pthread_cond_signal (pthread_cond_t * cond);
-int __pthread_cond_broadcast (pthread_cond_t * cond);
-int __pthread_condattr_init (pthread_condattr_t * condattr);
-int __pthread_condattr_destroy (pthread_condattr_t * condattr);
-int __pthread_condattr_getpshared (const pthread_condattr_t * attr,
- int *pshared);
-int __pthread_condattr_setpshared (pthread_condattr_t * attr, int pshared);
-
-/* Thread signal */
-int __pthread_kill (pthread_t thread, int sig);
-int __pthread_sigmask (int operation, const sigset_t * set,
- sigset_t * old_set);
-
-/* ID */
-int __pthread_equal (pthread_t * t1, pthread_t * t2);
-
-/* Mutexes */
-int __pthread_mutex_init (pthread_mutex_t *, const pthread_mutexattr_t *);
-int __pthread_mutex_lock (pthread_mutex_t *);
-int __pthread_mutex_trylock (pthread_mutex_t *);
-int __pthread_mutex_unlock (pthread_mutex_t *);
-int __pthread_mutex_destroy (pthread_mutex_t *);
-int __pthread_mutex_setprioceiling (pthread_mutex_t * mutex,
- int prioceiling, int *old_ceiling);
-int __pthread_mutex_getprioceiling (const pthread_mutex_t * mutex,
- int *prioceiling);
-
-
-int __pthread_mutexattr_destroy (pthread_mutexattr_t *);
-int __pthread_mutexattr_getprioceiling (const pthread_mutexattr_t *, int *);
-int __pthread_mutexattr_getprotocol (const pthread_mutexattr_t *, int *);
-int __pthread_mutexattr_getpshared (const pthread_mutexattr_t *, int *);
-int __pthread_mutexattr_gettype (const pthread_mutexattr_t *, int *);
-int __pthread_mutexattr_init (pthread_mutexattr_t *);
-int __pthread_mutexattr_setprioceiling (pthread_mutexattr_t *, int);
-int __pthread_mutexattr_setprotocol (pthread_mutexattr_t *, int);
-int __pthread_mutexattr_setpshared (pthread_mutexattr_t *, int);
-int __pthread_mutexattr_settype (pthread_mutexattr_t *, int);
-
-
-/* Scheduling */
-int __pthread_getconcurrency (void);
-int __pthread_setconcurrency (int new_level);
-int __pthread_getschedparam (pthread_t thread, int *policy,
- struct sched_param *param);
-int __pthread_setschedparam (pthread_t thread, int policy,
- const struct sched_param *param);
-
-/* cancelability states */
-int __pthread_cancel (pthread_t thread);
-int __pthread_setcancelstate (int state, int *oldstate);
-int __pthread_setcanceltype (int type, int *oldtype);
-void __pthread_testcancel (void);
-
-/* Semaphores */
-int __sem_init (sem_t * sem, int pshared, unsigned int value);
-int __sem_destroy (sem_t * sem);
-int __sem_wait (sem_t * sem);
-int __sem_trywait (sem_t * sem);
-int __sem_post (sem_t * sem);
-};
-
-#endif // MT_SAFE
-
-#endif // _CYGNUS_THREADS_
diff --git a/winsup/cygwin/threaded_queue.cc b/winsup/cygwin/threaded_queue.cc
deleted file mode 100755
index 321fa1612..000000000
--- a/winsup/cygwin/threaded_queue.cc
+++ /dev/null
@@ -1,250 +0,0 @@
-/* threaded_queue.cc
-
- Copyright 2001, 2002 Red Hat Inc.
-
- Written by Robert Collins <rbtcollins@hotmail.com>
-
- 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 <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <windows.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include "wincap.h"
-#include "threaded_queue.h"
-#define DEBUG 1
-#define debug_printf if (DEBUG) printf
-
-/* threaded_queue */
-
-DWORD WINAPI
-worker_function (LPVOID LpParam)
-{
- class threaded_queue *queue = (class threaded_queue *) LpParam;
- class queue_request *request;
- /* FIXME use a threadsafe pop instead for speed? */
- while (queue->active)
- {
- EnterCriticalSection (&queue->queuelock);
- while (!queue->request && queue->active)
- {
- LeaveCriticalSection (&queue->queuelock);
- DWORD rc = WaitForSingleObject (queue->event, INFINITE);
- if (rc == WAIT_FAILED)
- {
- printf ("Wait for event failed\n");
- queue->running--;
- ExitThread (0);
- }
- EnterCriticalSection (&queue->queuelock);
- }
- if (!queue->active)
- {
- queue->running--;
- LeaveCriticalSection (&queue->queuelock);
- ExitThread (0);
- }
- /* not needed, but it is efficient */
- request =
- (class queue_request *) InterlockedExchangePointer (&queue->request,
- queue->request->
- next);
- LeaveCriticalSection (&queue->queuelock);
- request->process ();
- delete request;
- }
- queue->running--;
- ExitThread (0);
-}
-
-void
-threaded_queue::create_workers ()
-{
- InitializeCriticalSection (&queuelock);
- if ((event = CreateEvent (NULL, FALSE, FALSE, NULL)) == NULL)
- {
- printf ("Failed to create event queue (%lu), terminating\n",
- GetLastError ());
- exit (1);
- }
- active = true;
-
- /* FIXME: Use a stack pair and create threads on the fly whenever
- * we have to to service a request.
- */
- for (unsigned int i = 0; i < initial_workers; i++)
- {
- HANDLE hThread;
- DWORD tid;
- hThread = CreateThread (NULL, 0, worker_function, this, 0, &tid);
- if (hThread == NULL)
- {
- printf ("Failed to create thread (%lu), terminating\n",
- GetLastError ());
- exit (1);
- }
- CloseHandle (hThread);
- running++;
- }
-}
-
-void
-threaded_queue::cleanup ()
-{
- /* harvest the threads */
- active = false;
- /* kill the request processing loops */
- queue_process_param *reqloop;
- /* make sure we don't race with a incoming request creation */
- EnterCriticalSection (&queuelock);
- reqloop =
- (queue_process_param *) InterlockedExchangePointer (&process_head, NULL);
- while (reqloop)
- {
- queue_process_param *t = reqloop;
- reqloop = reqloop->next;
- delete t;
- }
- LeaveCriticalSection (&queuelock);
- if (!running)
- return;
- printf ("Waiting for current queue threads to terminate\n");
- for (int n = running; n; n--)
- PulseEvent (event);
- while (running)
- sleep (1);
- DeleteCriticalSection (&queuelock);
- CloseHandle (event);
-}
-
-/* FIXME: return success or failure */
-void
-threaded_queue::add (queue_request * therequest)
-{
- /* safe to not "Try" because workers don't hog this, they wait on the event
- */
- EnterCriticalSection (&queuelock);
- if (!running)
- {
- printf ("No worker threads to handle request!\n");
- }
- if (!request)
- request = therequest;
- else
- {
- /* add to the queue end. */
- queue_request *listrequest = request;
- while (listrequest->next)
- listrequest = listrequest->next;
- listrequest->next = therequest;
- }
- PulseEvent (event);
- LeaveCriticalSection (&queuelock);
-}
-
-/* FIXME: return success or failure rather than quitting */
-void
-threaded_queue::process_requests (queue_process_param * params,
- threaded_queue_thread_function *
- request_loop)
-{
- if (params->start (request_loop, this) == false)
- exit (1);
- params->next =
- (queue_process_param *) InterlockedExchangePointer (&process_head,
- params);
-}
-
-/* queue_process_param */
-/* How does a constructor return an error? */
-queue_process_param::queue_process_param (bool ninterruptible):running (false), shutdown (false),
-interruptible
-(ninterruptible)
-{
- if (!interruptible)
- return;
- debug_printf ("creating an interruptible processing thread\n");
- if ((interrupt = CreateEvent (NULL, FALSE, FALSE, NULL)) == NULL)
- {
- printf ("Failed to create interrupt event (%lu), terminating\n",
- GetLastError ());
- exit (1);
- }
-}
-
-queue_process_param::~queue_process_param ()
-{
- if (running)
- stop ();
- if (!interruptible)
- return;
- CloseHandle (interrupt);
-}
-
-bool
- queue_process_param::start (threaded_queue_thread_function * request_loop,
- threaded_queue * thequeue)
-{
- queue = thequeue;
- hThread = CreateThread (NULL, 0, request_loop, this, 0, &tid);
- if (hThread)
- {
- running = true;
- return true;
- }
- printf ("Failed to create thread (%lu), terminating\n", GetLastError ());
- return false;
-}
-
-void
-queue_process_param::stop ()
-{
- if (interruptible)
- {
- InterlockedExchange (&shutdown, true);
- PulseEvent (interrupt);
- /* Wait up to 50 ms for the thread to exit. If it doesn't _and_ we get
- * scheduled again, we print an error and exit. We _should_ loop or
- * try resignalling. We don't want to hand here though...
- */
- int n = 5;
- while (n-- && WaitForSingleObject (hThread, 1000) == WAIT_TIMEOUT);
- if (!n)
- {
- printf ("Process thread didn't shutdown cleanly after 200ms!\n");
- exit (1);
- }
- else
- running = false;
- }
- else
- {
- printf ("killing request loop thread %ld\n", tid);
- int rc;
- if (!(rc = TerminateThread (hThread, 0)))
- {
- printf ("error shutting down request loop worker thread\n");
- }
- running = false;
- }
- CloseHandle (hThread);
-}
-
-/* queue_request */
-queue_request::queue_request ():next (NULL)
-{
-}
-
-void
-queue_request::process (void)
-{
- printf ("\n**********************************************\n"
- "Oh no! we've hit the base queue_request process() function, and this indicates a coding\n"
- "fault !!!\n" "***********************************************\n");
-}
diff --git a/winsup/cygwin/threaded_queue.h b/winsup/cygwin/threaded_queue.h
deleted file mode 100755
index d72541e22..000000000
--- a/winsup/cygwin/threaded_queue.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* threaded_queue.h
-
- Copyright 2001, 2002 Red Hat Inc.
-
- Written by Robert Collins <rbtcollins@hotmail.com>
-
- 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:
- class queue_request *next;
- virtual void process ();
- queue_request();
-};
-
-
-typedef DWORD WINAPI threaded_queue_thread_function (LPVOID);
-/* parameters for a request finding and submitting loop */
-
-class queue_process_param
-{
- public:
- bool start (threaded_queue_thread_function *, class threaded_queue *);
- void stop ();
- bool running;
- long int shutdown;
- class queue_process_param * next;
- class threaded_queue *queue;
- queue_process_param (bool ninterruptible);
- ~queue_process_param ();
- bool interruptible;
- HANDLE interrupt;
- HANDLE hThread;
- DWORD tid;
-};
-
-/* a queue to allocate requests from n submission loops to x worker threads */
-
-class threaded_queue
-{
- public:
- CRITICAL_SECTION queuelock;
- HANDLE event;
- bool active;
- queue_request * request;
- unsigned int initial_workers;
- unsigned int running;
- void create_workers ();
- void cleanup ();
- void add (queue_request *);
- void process_requests (queue_process_param *, threaded_queue_thread_function *);
- threaded_queue () : active (false), request (NULL), initial_workers (1), running (0), process_head (NULL) {};
- private:
- queue_request *process_head;
-};
-
-#endif /* _THREADED_QUEUE_ */
diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc
deleted file mode 100644
index 7a9a3eb33..000000000
--- a/winsup/cygwin/times.cc
+++ /dev/null
@@ -1,678 +0,0 @@
-/* times.cc
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <time.h>
-#include <sys/times.h>
-#include <sys/timeb.h>
-#include <utime.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "pinfo.h"
-#include "hires.h"
-
-#define FACTOR (0x19db1ded53e8000LL)
-#define NSPERSEC 10000000LL
-
-static void __stdcall timeval_to_filetime (timeval *time, FILETIME *out);
-
-/* Cygwin internal */
-static unsigned long long __stdcall
-__to_clock_t (FILETIME * src, int flag)
-{
- unsigned long long total = ((unsigned long long) src->dwHighDateTime << 32) + ((unsigned)src->dwLowDateTime);
- syscall_printf ("dwHighDateTime %u, dwLowDateTime %u", src->dwHighDateTime, src->dwLowDateTime);
-
- /* Convert into clock ticks - the total is in 10ths of a usec. */
- if (flag)
- total -= FACTOR;
-
- total /= (unsigned long long) (NSPERSEC / CLOCKS_PER_SEC);
- syscall_printf ("total %08x %08x\n", (unsigned)(total>>32), (unsigned)(total));
- return total;
-}
-
-/* times: POSIX 4.5.2.1 */
-extern "C" clock_t
-_times (struct tms * buf)
-{
- FILETIME creation_time, exit_time, kernel_time, user_time;
-
- if (check_null_invalid_struct_errno (buf))
- return ((clock_t) -1);
-
- DWORD ticks = GetTickCount ();
- /* Ticks is in milliseconds, convert to our ticks. Use long long to prevent
- overflow. */
- clock_t tc = (clock_t) ((long long) ticks * CLOCKS_PER_SEC / 1000);
- if (wincap.has_get_process_times ())
- {
- GetProcessTimes (hMainProc, &creation_time, &exit_time,
- &kernel_time, &user_time);
-
- syscall_printf ("ticks %d, CLOCKS_PER_SEC %d", ticks, CLOCKS_PER_SEC);
- syscall_printf ("user_time %d, kernel_time %d, creation_time %d, exit_time %d",
- user_time, kernel_time, creation_time, exit_time);
- buf->tms_stime = __to_clock_t (&kernel_time, 0);
- buf->tms_utime = __to_clock_t (&user_time, 0);
- timeval_to_filetime (&myself->rusage_children.ru_stime, &kernel_time);
- buf->tms_cstime = __to_clock_t (&kernel_time, 1);
- timeval_to_filetime (&myself->rusage_children.ru_utime, &user_time);
- buf->tms_cutime = __to_clock_t (&user_time, 1);
- }
- else
- /* GetProcessTimes() does not work for non-NT versions of Windows. The
- return values are undefined, so instead just copy the ticks value
- into utime so that clock() will work properly on these systems */
- {
- buf->tms_utime = tc;
- buf->tms_stime = 0;
- buf->tms_cstime = 0;
- buf->tms_cutime = 0;
- }
-
- return tc;
-}
-
-/* settimeofday: BSD */
-extern "C" int
-settimeofday (const struct timeval *tv, const struct timezone *tz)
-{
- SYSTEMTIME st;
- struct tm *ptm;
- int res;
-
- tz = tz; /* silence warning about unused variable */
-
- ptm = gmtime(&tv->tv_sec);
- st.wYear = ptm->tm_year + 1900;
- st.wMonth = ptm->tm_mon + 1;
- st.wDayOfWeek = ptm->tm_wday;
- st.wDay = ptm->tm_mday;
- st.wHour = ptm->tm_hour;
- st.wMinute = ptm->tm_min;
- st.wSecond = ptm->tm_sec;
- st.wMilliseconds = tv->tv_usec / 1000;
-
- res = !SetSystemTime(&st);
-
- syscall_printf ("%d = settimeofday (%x, %x)", res, tv, tz);
-
- return res;
-}
-
-/* timezone: standards? */
-extern "C" char *
-timezone ()
-{
-#ifdef _MT_SAFE
- char *b=_reent_winsup()->timezone_buf;
-#else
- static NO_COPY char b[20] = {0};
-#endif
-
- tzset();
- __small_sprintf (b,"GMT%+d:%02d", (int) (-_timezone / 3600), (int) (abs(_timezone / 60) % 60));
- return b;
-}
-
-/* Cygwin internal */
-void __stdcall
-totimeval (struct timeval *dst, FILETIME *src, int sub, int flag)
-{
- long long x = __to_clock_t (src, flag);
-
- x *= (int) (1e6) / CLOCKS_PER_SEC; /* Turn x into usecs */
- x -= (long long) sub * (int) (1e6);
-
- dst->tv_usec = x % (long long) (1e6); /* And split */
- dst->tv_sec = x / (long long) (1e6);
-}
-
-/* FIXME: Make thread safe */
-extern "C" int
-gettimeofday (struct timeval *tv, struct timezone *tz)
-{
- static hires_ms gtod;
- static bool tzflag;
- LONGLONG now = gtod.usecs (false);
- if (now == (LONGLONG) -1)
- return -1;
-
- tv->tv_sec = now / 1000000;
- tv->tv_usec = now % 1000000;
-
- if (tz != NULL)
- {
- if (!tzflag)
- {
- tzset();
- tzflag = true;
- }
- tz->tz_minuteswest = _timezone / 60;
- tz->tz_dsttime = _daylight;
- }
-
- return 0;
-}
-
-extern "C" int
-_gettimeofday (struct timeval *p, struct timezone *z)
-{
- return gettimeofday (p, z);
-}
-
-/* Cygwin internal */
-void
-time_t_to_filetime (time_t time_in, FILETIME *out)
-{
- long long x = time_in * NSPERSEC + FACTOR;
- out->dwHighDateTime = x >> 32;
- out->dwLowDateTime = x;
-}
-
-/* Cygwin internal */
-static void __stdcall
-timeval_to_filetime (timeval *time_in, FILETIME *out)
-{
- long long x = time_in->tv_sec * NSPERSEC +
- time_in->tv_usec * (NSPERSEC/1000000) + FACTOR;
- out->dwHighDateTime = x >> 32;
- out->dwLowDateTime = x;
-}
-
-/* Cygwin internal */
-static timeval __stdcall
-time_t_to_timeval (time_t in)
-{
- timeval res;
- res.tv_sec = in;
- res.tv_usec = 0;
- return res;
-}
-
-/* Cygwin internal */
-/* 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);
-
- /* pass "no time" as epoch */
- if (x == 0)
- return 0;
-
- 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;
-}
-
-/* Cygwin internal */
-/* Convert a Win32 time to "UNIX" timestruc_t format. */
-void __stdcall
-to_timestruc_t (FILETIME *ptr, timestruc_t *out)
-{
- /* A file time is the number of 100ns since jan 1 1601
- stuffed into two long words.
- A timestruc_t is the number of seconds and microseconds since jan 1 1970
- stuffed into a time_t and a long. */
-
- long rem;
- long long x = ((long long) ptr->dwHighDateTime << 32) + ((unsigned)ptr->dwLowDateTime);
-
- /* pass "no time" as epoch */
- if (x == 0)
- {
- out->tv_sec = 0;
- out->tv_nsec = 0;
- return;
- }
-
- x -= FACTOR; /* number of 100ns between 1601 and 1970 */
- rem = x % ((long long)NSPERSEC);
- x /= (long long) NSPERSEC; /* number of 100ns in a second */
- out->tv_nsec = rem * 100; /* as tv_nsec is in nanoseconds */
- out->tv_sec = x;
-}
-
-/* Cygwin internal */
-/* Get the current time as a "UNIX" timestruc_t format. */
-void __stdcall
-time_as_timestruc_t (timestruc_t * out)
-{
- SYSTEMTIME systemtime;
- FILETIME filetime;
-
- GetSystemTime (&systemtime);
- SystemTimeToFileTime (&systemtime, &filetime);
- to_timestruc_t (&filetime, out);
-}
-
-/* time: POSIX 4.5.1.1, C 4.12.2.4 */
-/* Return number of seconds since 00:00 UTC on jan 1, 1970 */
-extern "C"
-time_t
-time (time_t * ptr)
-{
- time_t res;
- SYSTEMTIME systemtime;
- FILETIME filetime;
-
- GetSystemTime (&systemtime);
- SystemTimeToFileTime (&systemtime, &filetime);
- res = to_time_t (&filetime);
- if (ptr)
- *ptr = res;
-
- syscall_printf ("%d = time (%x)", res, ptr);
-
- return res;
-}
-
-/*
- * localtime_r.c
- * Original Author: Adapted from tzcode maintained by Arthur David Olson.
- *
- * Converts the calendar time pointed to by tim_p into a broken-down time
- * expressed as local time. Returns a pointer to a structure containing the
- * broken-down time.
- */
-
-#define SECSPERMIN 60
-#define MINSPERHOUR 60
-#define HOURSPERDAY 24
-#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR)
-#define SECSPERDAY (SECSPERHOUR * HOURSPERDAY)
-#define DAYSPERWEEK 7
-#define MONSPERYEAR 12
-
-#define YEAR_BASE 1900
-#define EPOCH_YEAR 1970
-#define EPOCH_WDAY 4
-
-#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
-
-#if 0 /* POSIX_LOCALTIME */
-
-static _CONST int mon_lengths[2][MONSPERYEAR] = {
- {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
- {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
-};
-
-static _CONST int year_lengths[2] = {
- 365,
- 366
-};
-
-/*
- * Convert a time_t into a struct tm *.
- * Does NO timezone conversion.
- */
-
-/* Cygwin internal */
-static struct tm * __stdcall
-corelocaltime (const time_t * tim_p)
-{
- long days, rem;
- int y;
- int yleap;
- _CONST int *ip;
-#ifdef _MT_SAFE
- struct tm &localtime_buf=_reent_winsup()->_localtime_buf;
-#else
- static NO_COPY struct tm localtime_buf = {0};
-#endif
-
- time_t tim = *tim_p;
- struct tm *res = &localtime_buf;
-
- days = ((long) tim) / SECSPERDAY;
- rem = ((long) tim) % SECSPERDAY;
-
- while (rem < 0)
- {
- rem += SECSPERDAY;
- --days;
- }
- while (rem >= SECSPERDAY)
- {
- rem -= SECSPERDAY;
- ++days;
- }
-
- /* compute hour, min, and sec */
- res->tm_hour = (int) (rem / SECSPERHOUR);
- rem %= SECSPERHOUR;
- res->tm_min = (int) (rem / SECSPERMIN);
- res->tm_sec = (int) (rem % SECSPERMIN);
-
- /* compute day of week */
- if ((res->tm_wday = ((EPOCH_WDAY + days) % DAYSPERWEEK)) < 0)
- res->tm_wday += DAYSPERWEEK;
-
- /* compute year & day of year */
- y = EPOCH_YEAR;
- if (days >= 0)
- {
- for (;;)
- {
- yleap = isleap (y);
- if (days < year_lengths[yleap])
- break;
- y++;
- days -= year_lengths[yleap];
- }
- }
- else
- {
- do
- {
- --y;
- yleap = isleap (y);
- days += year_lengths[yleap];
- } while (days < 0);
- }
-
- res->tm_year = y - YEAR_BASE;
- res->tm_yday = days;
- ip = mon_lengths[yleap];
- for (res->tm_mon = 0; days >= ip[res->tm_mon]; ++res->tm_mon)
- days -= ip[res->tm_mon];
- res->tm_mday = days + 1;
-
- /* set daylight saving time flag */
- res->tm_isdst = -1;
-
- syscall_printf ("%d = corelocaltime (%x)", res, tim_p);
-
- return (res);
-}
-
-/* localtime: POSIX 8.1.1, C 4.12.3.4 */
-/*
- * localtime takes a time_t (which is in UTC)
- * and formats it into a struct tm as a local time.
- */
-extern "C"
-struct tm *
-localtime (const time_t *tim_p)
-{
- time_t tim = *tim_p;
- struct tm *rtm;
-
- tzset();
-
- tim -= _timezone;
-
- rtm = corelocaltime (&tim);
-
- rtm->tm_isdst = _daylight;
-
- syscall_printf ("%x = localtime (%x)", rtm, tim_p);
-
- return rtm;
-}
-
-/* gmtime: C 4.12.3.3 */
-/*
- * gmtime takes a time_t (which is already in UTC)
- * and just puts it into a struct tm.
- */
-extern "C"
-struct tm *
-gmtime (const time_t *tim_p)
-{
- time_t tim = *tim_p;
-
- struct tm *rtm = corelocaltime (&tim);
- /* UTC has no daylight savings time */
- rtm->tm_isdst = 0;
-
- syscall_printf ("%x = gmtime (%x)", rtm, tim_p);
-
- return rtm;
-}
-
-#endif /* POSIX_LOCALTIME */
-
-/* utimes: standards? */
-extern "C"
-int
-utimes (const char *path, struct timeval *tvp)
-{
- int res = 0;
- struct timeval tmp[2];
- path_conv win32 (path);
-
- if (win32.error)
- {
- set_errno (win32.error);
- syscall_printf ("-1 = utimes (%s, %x)", path, tvp);
- return -1;
- }
-
- /* MSDN suggests using FILE_FLAG_BACKUP_SEMANTICS for accessing
- the times of directories. */
- /* Note: It's not documented in MSDN that FILE_WRITE_ATTRIBUTES is
- sufficient to change the timestamps... */
- HANDLE h = CreateFileA (win32.get_win32 (),
- FILE_WRITE_ATTRIBUTES,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- &sec_none_nih,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS,
- 0);
-
- if (h == INVALID_HANDLE_VALUE)
- {
- if (win32.isdir ())
- {
- /* What we can do with directories more? */
- res = 0;
- }
- else
- {
- res = -1;
- __seterrno ();
- }
- }
- else
- {
- if (tvp == 0)
- {
- gettimeofday (&tmp[0], 0);
- tmp[1] = tmp[0];
- tvp = tmp;
- }
-
- FILETIME lastaccess;
- FILETIME lastwrite;
-
- timeval_to_filetime (tvp + 0, &lastaccess);
- timeval_to_filetime (tvp + 1, &lastwrite);
-
- debug_printf ("incoming lastaccess %08x %08x",
- tvp->tv_sec,
- tvp->tv_usec);
-
-// dump_filetime (lastaccess);
-// dump_filetime (lastwrite);
-
- /* FIXME: SetFileTime needs a handle with a write lock
- on the file whose time is being modified. So calls to utime()
- fail for read only files. */
-
- if (!SetFileTime (h, 0, &lastaccess, &lastwrite))
- {
- __seterrno ();
- res = -1;
- }
- else
- res = 0;
- CloseHandle (h);
- }
-
- syscall_printf ("%d = utimes (%s, %x); (h%d)",
- res, path, tvp, h);
- return res;
-}
-
-/* utime: POSIX 5.6.6.1 */
-extern "C"
-int
-utime (const char *path, struct utimbuf *buf)
-{
- struct timeval tmp[2];
-
- if (buf == 0)
- return utimes (path, 0);
-
- debug_printf ("incoming utime act %x", buf->actime);
- tmp[0] = time_t_to_timeval (buf->actime);
- tmp[1] = time_t_to_timeval (buf->modtime);
-
- return utimes (path, tmp);
-}
-
-/* ftime: standards? */
-extern "C"
-int
-ftime (struct timeb *tp)
-{
- struct timeval tv;
- struct timezone tz;
-
- if (gettimeofday (&tv, &tz) < 0)
- return -1;
-
- tp->time = tv.tv_sec;
- tp->millitm = tv.tv_usec / 1000;
- tp->timezone = tz.tz_minuteswest;
- tp->dstflag = tz.tz_dsttime;
-
- return 0;
-}
-
-/* obsolete, changed to cygwin_tzset when localtime.c was added - dj */
-extern "C" void
-cygwin_tzset ()
-{
-}
-
-void
-hires_us::prime ()
-{
- LARGE_INTEGER ifreq;
- if (!QueryPerformanceFrequency (&ifreq))
- {
- inited = -1;
- return;
- }
-
- FILETIME f;
- int priority = GetThreadPriority (GetCurrentThread ());
- SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_TIME_CRITICAL);
- if (!QueryPerformanceCounter (&primed_pc))
- {
- SetThreadPriority (GetCurrentThread (), priority);
- inited = -1;
- return;
- }
-
- GetSystemTimeAsFileTime (&f);
- SetThreadPriority (GetCurrentThread (), priority);
-
- inited = 1;
- primed_ft.HighPart = f.dwHighDateTime;
- primed_ft.LowPart = f.dwLowDateTime;
- primed_ft.QuadPart -= FACTOR;
- primed_ft.QuadPart /= 10;
- freq = (double) ((double) 1000000. / (double) ifreq.QuadPart);
- return;
-}
-
-LONGLONG
-hires_us::usecs (bool justdelta)
-{
- if (!inited)
- prime ();
- if (inited < 0)
- {
- set_errno (ENOSYS);
- return (long long) -1;
- }
-
- LARGE_INTEGER now;
- if (!QueryPerformanceCounter (&now))
- {
- set_errno (ENOSYS);
- return -1;
- }
-
- // FIXME: Use round() here?
- now.QuadPart = (LONGLONG) (freq * (double) (now.QuadPart - primed_pc.QuadPart));
- return justdelta ? now.QuadPart : primed_ft.QuadPart + now.QuadPart;
-}
-
-void
-hires_ms::prime ()
-{
- TIMECAPS tc;
- FILETIME f;
- int priority = GetThreadPriority (GetCurrentThread ());
- SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_TIME_CRITICAL);
-
- if (timeGetDevCaps (&tc, sizeof (tc)) != TIMERR_NOERROR)
- minperiod = 0;
- else
- {
- minperiod = min (max (tc.wPeriodMin, 1), tc.wPeriodMax);
- timeBeginPeriod (minperiod);
- }
-
- initime_ms = timeGetTime ();
- GetSystemTimeAsFileTime (&f);
- SetThreadPriority (GetCurrentThread (), priority);
-
- inited = 1;
- initime_us.HighPart = f.dwHighDateTime;
- initime_us.LowPart = f.dwLowDateTime;
- initime_us.QuadPart -= FACTOR;
- initime_us.QuadPart /= 10;
-}
-
-LONGLONG
-hires_ms::usecs (bool justdelta)
-{
- if (!inited)
- prime ();
- DWORD now = timeGetTime ();
- // FIXME: Not sure how this will handle the 49.71 day wrap around
- LONGLONG res = initime_us.QuadPart + ((LONGLONG) (now - initime_ms) * 1000);
- return res;
-}
-
-hires_ms::~hires_ms ()
-{
- timeEndPeriod (minperiod);
-}
diff --git a/winsup/cygwin/tty.cc b/winsup/cygwin/tty.cc
deleted file mode 100644
index 418b816f3..000000000
--- a/winsup/cygwin/tty.cc
+++ /dev/null
@@ -1,451 +0,0 @@
-/* tty.cc
-
- Copyright 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <errno.h>
-#include <unistd.h>
-#include <utmp.h>
-#include <wingdi.h>
-#include <winuser.h>
-#include <sys/cygwin.h>
-#include "cygerrno.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygheap.h"
-#include "pinfo.h"
-#include "cygwin/cygserver_transport.h"
-#include "cygwin/cygserver.h"
-#include "shared_info.h"
-
-extern fhandler_tty_master *tty_master;
-
-extern "C"
-int
-grantpt (int fd)
-{
- return 0;
-}
-
-extern "C"
-int
-unlockpt (int fd)
-{
- return 0;
-}
-
-extern "C"
-int
-ttyslot (void)
-{
- if (NOTSTATE (myself, PID_USETTY))
- return -1;
- return myself->ctty;
-}
-
-void __stdcall
-tty_init (void)
-{
- if (!myself->ppid_handle && NOTSTATE (myself, PID_CYGPARENT))
- cygheap->fdtab.get_debugger_info ();
-
- if (NOTSTATE (myself, PID_USETTY))
- return;
- if (myself->ctty == -1)
- if (NOTSTATE (myself, PID_CYGPARENT))
- myself->ctty = attach_tty (myself->ctty);
- else
- return;
- if (myself->ctty == -1)
- termios_printf ("Can't attach to tty");
-}
-
-/* Create session's master tty */
-
-void __stdcall
-create_tty_master (int ttynum)
-{
- tty_master = (fhandler_tty_master *)
- cygheap->fdtab.build_fhandler (-1, FH_TTYM, "/dev/ttym", NULL, ttynum);
- if (tty_master->init (ttynum))
- api_fatal ("Can't create master tty");
- else
- {
- /* Log utmp entry */
- struct utmp our_utmp;
-
- bzero ((char *) &our_utmp, sizeof (utmp));
- (void) time (&our_utmp.ut_time);
- strncpy (our_utmp.ut_name, getlogin (), sizeof (our_utmp.ut_name));
- cygwin_gethostname (our_utmp.ut_host, sizeof (our_utmp.ut_host));
- __small_sprintf (our_utmp.ut_line, "tty%d", ttynum);
- our_utmp.ut_type = USER_PROCESS;
- myself->ctty = ttynum;
- login (&our_utmp);
- }
-}
-
-void __stdcall
-tty_terminate (void)
-{
- if (NOTSTATE (myself, PID_USETTY))
- return;
- cygwin_shared->tty.terminate ();
-}
-
-int __stdcall
-attach_tty (int num)
-{
- if (num != -1)
- {
- return cygwin_shared->tty.connect_tty (num);
- }
- if (NOTSTATE (myself, PID_USETTY))
- return -1;
- return cygwin_shared->tty.allocate_tty (1);
-}
-
-void
-tty_list::terminate (void)
-{
- int ttynum = myself->ctty;
-
- /* Keep master running till there are connected clients */
- if (ttynum != -1 && ttys[ttynum].master_pid == GetCurrentProcessId ())
- {
- tty *t = ttys + ttynum;
- CloseHandle (t->from_master);
- CloseHandle (t->to_master);
- /* Wait for children which rely on tty handling in this process to
- go away */
- for (int i = 0; ; i++)
- {
- if (!t->slave_alive ())
- break;
- if (i >= 100)
- {
- small_printf ("waiting for children using tty%d to terminate\n",
- ttynum);
- i = 0;
- }
-
- Sleep (200);
- }
-
- termios_printf ("tty %d master about to finish", ttynum);
- ForceCloseHandle1 (t->to_slave, to_pty);
- ForceCloseHandle1 (t->from_slave, from_pty);
- CloseHandle (tty_master->inuse);
- WaitForSingleObject (tty_master->hThread, INFINITE);
- t->init ();
-
- char buf[20];
- __small_sprintf (buf, "tty%d", ttynum);
- logout (buf);
- }
-}
-
-int
-tty_list::connect_tty (int ttynum)
-{
- if (ttynum < 0 || ttynum >= NTTYS)
- {
- termios_printf ("ttynum (%d) out of range", ttynum);
- return -1;
- }
- if (!ttys[ttynum].exists ())
- {
- termios_printf ("tty %d was not allocated", ttynum);
- return -1;
- }
-
- return ttynum;
-}
-
-void
-tty_list::init (void)
-{
- for (int i = 0; i < NTTYS; i++)
- {
- ttys[i].init ();
- ttys[i].setntty (i);
- }
-}
-
-/* Search for tty class for our console. Allocate new tty if our process is
- the only cygwin process in the current console.
- Return tty number or -1 if error.
- If flag == 0, just find a free tty.
- */
-int
-tty_list::allocate_tty (int with_console)
-{
- HWND console;
-
- /* FIXME: This whole function needs a protective mutex. */
-
- if (!with_console)
- console = NULL;
- else
- {
- char *oldtitle = new char [TITLESIZE];
-
- if (!oldtitle)
- {
- termios_printf ("Can't *allocate console title buffer");
- return -1;
- }
- if (!GetConsoleTitle (oldtitle, TITLESIZE))
- {
- termios_printf ("Can't read console title");
- return -1;
- }
-
- if (WaitForSingleObject (title_mutex, INFINITE) == WAIT_FAILED)
- termios_printf ("WFSO for title_mutext %p failed, %E", title_mutex);
-
- char buf[40];
-
- __small_sprintf (buf, "cygwin.find.console.%d", myself->pid);
- SetConsoleTitle (buf);
- Sleep (40);
- console = FindWindow (NULL, buf);
- SetConsoleTitle (oldtitle);
- Sleep (40);
- ReleaseMutex (title_mutex);
- if (console == NULL)
- {
- termios_printf ("Can't find console window");
- return -1;
- }
- }
- /* Is a tty allocated for console? */
-
- int freetty = -1;
- for (int i = 0; i < NTTYS; i++)
- {
- if (!ttys[i].exists ())
- {
- if (freetty < 0) /* Scanning? */
- freetty = i; /* Yes. */
- if (!with_console) /* Do we want to attach this to a console? */
- break; /* No. We've got one. */
- }
-
- if (with_console && ttys[i].gethwnd () == console)
- {
- termios_printf ("console %x already associated with tty%d",
- console, i);
- /* Is the master alive? */
- HANDLE hMaster;
- hMaster = OpenProcess (PROCESS_DUP_HANDLE, FALSE, ttys[i].master_pid);
- if (hMaster)
- {
- CloseHandle (hMaster);
- return i;
- }
- /* Master is dead */
- freetty = i;
- break;
- }
- }
-
- /* There is no tty allocated to console, allocate the first free found */
- if (freetty == -1)
- {
- system_printf ("No free ttys available");
- return -1;
- }
- tty *t = ttys + freetty;
- t->init ();
- t->setsid (-1);
- t->setpgid (myself->pgid);
- t->sethwnd (console);
-
- if (with_console)
- {
- termios_printf ("console %x associated with tty%d", console, freetty);
- create_tty_master (freetty);
- }
- else
- termios_printf ("tty%d allocated", freetty);
- return freetty;
-}
-
-BOOL
-tty::slave_alive ()
-{
- return alive (TTY_SLAVE_ALIVE);
-}
-
-BOOL
-tty::master_alive ()
-{
- return alive (TTY_MASTER_ALIVE);
-}
-
-BOOL
-tty::alive (const char *fmt)
-{
- HANDLE ev;
- char buf[sizeof (TTY_MASTER_ALIVE) + 16];
-
- __small_sprintf (buf, fmt, ntty);
- if ((ev = OpenEvent (EVENT_ALL_ACCESS, FALSE, buf)))
- CloseHandle (ev);
- return ev != NULL;
-}
-
-HANDLE
-tty::create_inuse (const char *fmt)
-{
- HANDLE h;
- char buf[sizeof (TTY_MASTER_ALIVE) + 16];
-
- __small_sprintf (buf, fmt, ntty);
- h = CreateEvent (&sec_all, TRUE, FALSE, buf);
- termios_printf ("%s = %p", buf, h);
- if (!h)
- termios_printf ("couldn't open inuse event, %E", buf);
- return h;
-}
-
-void
-tty::init (void)
-{
- output_stopped = 0;
- setsid (0);
- pgid = 0;
- hwnd = NULL;
- to_slave = NULL;
- from_slave = NULL;
- was_opened = 0;
-}
-
-HANDLE
-tty::get_event (const char *fmt, BOOL manual_reset)
-{
- HANDLE hev;
- char buf[40];
-
- __small_sprintf (buf, fmt, ntty);
- if (!(hev = CreateEvent (&sec_all, manual_reset, FALSE, buf)))
- {
- termios_printf ("couldn't create %s", buf);
- set_errno (ENOENT); /* FIXME this can't be the right errno */
- return NULL;
- }
-
- termios_printf ("created event %s", buf);
- return hev;
-}
-
-int
-tty::make_pipes (fhandler_pty_master *ptym)
-{
- /* Create communication pipes */
-
- /* FIXME: should this be sec_none_nih? */
- if (CreatePipe (&from_master, &to_slave, &sec_all, 0) == FALSE)
- {
- termios_printf ("can't create input pipe");
- set_errno (ENOENT);
- return FALSE;
- }
-
- ProtectHandle1 (to_slave, to_pty);
- if (CreatePipe (&from_slave, &to_master, &sec_all, 0) == FALSE)
- {
- termios_printf ("can't create output pipe");
- set_errno (ENOENT);
- return FALSE;
- }
- ProtectHandle1 (from_slave, from_pty);
- termios_printf ("tty%d from_slave %p, to_slave %p", ntty, from_slave,
- to_slave);
-
- DWORD pipe_mode = PIPE_NOWAIT;
- if (!SetNamedPipeHandleState (to_slave, &pipe_mode, NULL, NULL))
- termios_printf ("can't set to_slave to non-blocking mode");
- ptym->set_io_handle (from_slave);
- ptym->set_output_handle (to_slave);
- return TRUE;
-}
-
-BOOL
-tty::common_init (fhandler_pty_master *ptym)
-{
- /* Set termios information. Force initialization. */
- ptym->tcinit (this, TRUE);
-
- if (!make_pipes (ptym))
- return FALSE;
- ptym->need_nl = 0;
-
- /* Save our pid */
-
- master_pid = GetCurrentProcessId ();
-
- /* Allow the others to open us (for handle duplication) */
-
- /* FIXME: we shold NOT set the security wide open when the
- daemon is running
- */
- if (wincap.has_security () && cygserver_running==CYGSERVER_OK &&
- (SetKernelObjectSecurity (hMainProc, DACL_SECURITY_INFORMATION,
- get_null_sd ()) == FALSE))
- small_printf ("Can't set process security, %E");
-
- /* Create synchronisation events */
-
- if (ptym->get_device () != FH_TTYM)
- {
- ptym->output_done_event = ptym->ioctl_done_event =
- ptym->ioctl_request_event = NULL;
- }
- else
- {
- if (!(ptym->output_done_event = get_event (OUTPUT_DONE_EVENT)))
- return FALSE;
- if (!(ptym->ioctl_done_event = get_event (IOCTL_DONE_EVENT)))
- return FALSE;
- if (!(ptym->ioctl_request_event = get_event (IOCTL_REQUEST_EVENT)))
- return FALSE;
- }
-
- if (!(ptym->input_available_event = get_event (INPUT_AVAILABLE_EVENT, TRUE)))
- return FALSE;
-
- char buf[40];
- __small_sprintf (buf, OUTPUT_MUTEX, ntty);
- if (!(ptym->output_mutex = CreateMutex (&sec_all, FALSE, buf)))
- {
- termios_printf ("can't create %s", buf);
- set_errno (ENOENT);
- return FALSE;
- }
-
- __small_sprintf (buf, INPUT_MUTEX, ntty);
- if (!(ptym->input_mutex = CreateMutex (&sec_all, FALSE, buf)))
- {
- termios_printf ("can't create %s", buf);
- set_errno (ENOENT);
- return FALSE;
- }
-
- ProtectHandle1 (ptym->output_mutex, output_mutex);
- ProtectHandle1 (ptym->input_mutex, input_mutex);
- winsize.ws_col = 80;
- winsize.ws_row = 25;
-
- termios_printf ("tty%d opened", ntty);
- return TRUE;
-}
diff --git a/winsup/cygwin/tty.h b/winsup/cygwin/tty.h
deleted file mode 100644
index 30d8bb03b..000000000
--- a/winsup/cygwin/tty.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/* tty.h: shared tty info for cygwin
-
- Copyright 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. */
-
-
-/* tty tables */
-
-#define INP_BUFFER_SIZE 256
-#define OUT_BUFFER_SIZE 256
-#define NTTYS 128
-#define real_tty_attached(p) ((p)->ctty >= 0 && (p)->ctty != TTY_CONSOLE)
-
-/* Input/Output/ioctl events */
-
-#define OUTPUT_DONE_EVENT "cygtty%d.output.done"
-#define IOCTL_REQUEST_EVENT "cygtty%d.ioctl.request"
-#define IOCTL_DONE_EVENT "cygtty%d.ioctl.done"
-#define RESTART_OUTPUT_EVENT "cygtty%d.output.restart"
-#define INPUT_AVAILABLE_EVENT "cygtty%d.input.avail"
-#define OUTPUT_MUTEX "cygtty%d.output.mutex"
-#define INPUT_MUTEX "cygtty%d.input.mutex"
-#define TTY_SLAVE_ALIVE "cygtty%x.slave_alive"
-#define TTY_MASTER_ALIVE "cygtty%x.master_alive"
-
-#include <sys/termios.h>
-
-enum
-{
- TTY_INITIALIZED = 1, /* Set if tty is initialized */
- TTY_RSTCONS = 2 /* Set if console needs to be set to "non-cooked" */
-};
-
-#define TTYISSETF(x) __ISSETF (tc, x, TTY)
-#define TTYSETF(x) __SETF (tc, x, TTY)
-#define TTYCLEARF(x) __CLEARF (tc, x, TTY)
-#define TTYCONDSETF(n, x) __CONDSETF(n, tc, x, TTY)
-
-#ifndef MIN_CTRL_C_SLOP
-#define MIN_CTRL_C_SLOP 50
-#endif
-
-class tty_min
-{
- pid_t sid; /* Session ID of tty */
-public:
- DWORD status;
- pid_t pgid;
- int output_stopped;
- int ntty;
- DWORD last_ctrl_c; // tick count of last ctrl-c
-
- tty_min (int t = -1, pid_t s = -1) : sid (s), ntty (t) {}
- void setntty (int n) {ntty = n;}
- pid_t getpgid () {return pgid;}
- void setpgid (int pid) {pgid = pid;}
- int getsid () {return sid;}
- void setsid (pid_t tsid) {sid = tsid;}
- void set_ctty (int ttynum, int flags);
- void kill_pgrp (int sig);
- struct termios ti;
- struct winsize winsize;
-
- /* ioctl requests buffer */
- int cmd;
- union
- {
- struct termios termios;
- struct winsize winsize;
- int value;
- pid_t pid;
- } arg;
- /* XXX_retval variables holds master's completion codes. Error are stored as
- * -ERRNO
- */
- int ioctl_retval;
-
- int write_error;
-};
-
-class fhandler_pty_master;
-
-class tty: public tty_min
-{
- HANDLE get_event (const char *fmt, BOOL manual_reset = FALSE)
- __attribute__ ((regparm (2)));
-public:
- HWND hwnd; /* Console window handle tty belongs to */
-
- DWORD master_pid; /* Win32 PID of tty master process */
-
- HANDLE from_master, to_slave;
- HANDLE from_slave, to_master;
-
- int read_retval;
- BOOL was_opened; /* True if opened at least once. */
-
- void init ();
- HANDLE create_inuse (const char *);
- BOOL common_init (fhandler_pty_master *);
- BOOL alive (const char *fmt);
- BOOL slave_alive ();
- BOOL master_alive ();
- HWND gethwnd () {return hwnd;}
- void sethwnd (HWND wnd) {hwnd = wnd;}
- int make_pipes (fhandler_pty_master *ptym);
- HANDLE open_output_mutex ()
- {
- char buf[80];
- __small_sprintf (buf, OUTPUT_MUTEX, ntty);
- return OpenMutex (MUTEX_ALL_ACCESS, TRUE, buf);
- }
- HANDLE open_input_mutex ()
- {
- char buf[80];
- __small_sprintf (buf, INPUT_MUTEX, ntty);
- return OpenMutex (MUTEX_ALL_ACCESS, TRUE, buf);
- }
- BOOL exists ()
- {
- HANDLE h = open_output_mutex ();
- if (h)
- {
- CloseHandle (h);
- return 1;
- }
- return slave_alive ();
- }
-};
-
-class tty_list
-{
- tty ttys[NTTYS];
-
-public:
- tty * operator [](int n) {return ttys + n;}
- int allocate_tty (int n); /* n non zero if allocate a tty, pty otherwise */
- int connect_tty (int);
- void terminate ();
- void init ();
- tty_min *get_tty (int n);
-};
-
-void __stdcall tty_init ();
-void __stdcall tty_terminate ();
-int __stdcall attach_tty (int);
-void __stdcall create_tty_master (int);
-extern "C" int ttyslot (void);
diff --git a/winsup/cygwin/tz_posixrules.h b/winsup/cygwin/tz_posixrules.h
deleted file mode 100644
index dea668e2f..000000000
--- a/winsup/cygwin/tz_posixrules.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* generated with bin2h from zoneinfo/posixrules */
-
-static NO_COPY unsigned char _posixrules_data[] = {
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,
-0,1,16,0,0,0,2,0,0,0,8,0,151,254,240,1,135,225,224,2,119,224,240,3,112,254,96,4,96,253,112,5,80,
-224,96,6,64,223,112,7,48,194,96,7,141,25,112,9,16,164,96,9,173,148,240,10,240,134,96,11,224,133,112,12,217,162,
-224,13,192,103,112,14,185,132,224,15,169,131,240,16,153,102,224,17,137,101,240,18,121,72,224,19,105,71,240,20,89,42,224,
-21,73,41,240,22,57,12,224,23,41,11,240,24,34,41,96,25,8,237,240,26,2,11,96,26,242,10,112,27,225,237,96,28,
-209,236,112,29,193,207,96,30,177,206,112,31,161,177,96,32,118,0,240,33,129,147,96,34,85,226,240,35,106,175,224,36,53,
-196,240,37,74,145,224,38,21,166,240,39,42,115,224,39,254,195,112,41,10,85,224,41,222,165,112,42,234,55,224,43,190,135,
-112,44,211,84,96,45,158,105,112,46,179,54,96,47,126,75,112,48,147,24,96,49,103,103,240,50,114,250,96,51,71,73,240,
-52,82,220,96,53,39,43,240,54,50,190,96,55,7,13,240,56,27,218,224,56,230,239,240,57,251,188,224,58,198,209,240,59,
-219,158,224,60,175,238,112,61,187,128,224,62,143,208,112,63,155,98,224,64,111,178,112,65,132,127,96,66,79,148,112,67,100,
-97,96,68,47,118,112,69,68,67,96,70,15,88,112,71,36,37,96,71,248,116,240,73,4,7,96,73,216,86,240,74,227,233,
-96,75,184,56,240,76,205,5,224,77,152,26,240,78,172,231,224,79,119,252,240,80,140,201,224,81,97,25,112,82,108,171,224,
-83,64,251,112,84,76,141,224,85,32,221,112,86,44,111,224,87,0,191,112,88,21,140,96,88,224,161,112,89,245,110,96,90,
-192,131,112,91,213,80,96,92,169,159,240,93,181,50,96,94,137,129,240,95,149,20,96,96,105,99,240,97,126,48,224,98,73,
-69,240,99,94,18,224,100,41,39,240,101,61,244,224,102,18,68,112,103,29,214,224,103,242,38,112,104,253,184,224,105,210,8,
-112,106,221,154,224,107,177,234,112,108,198,183,96,109,145,204,112,110,166,153,96,111,113,174,112,112,134,123,96,113,90,202,240,
-114,102,93,96,115,58,172,240,116,70,63,96,117,26,142,240,118,47,91,224,118,250,112,240,120,15,61,224,120,218,82,240,121,
-239,31,224,122,186,52,240,123,207,1,224,124,163,81,112,125,174,227,224,126,131,51,112,127,142,197,224,128,99,21,112,129,119,
-226,96,130,66,247,112,131,87,196,96,132,34,217,112,133,55,166,96,134,11,245,240,135,23,136,96,135,235,215,240,136,247,106,
-96,137,203,185,240,138,215,76,96,139,171,155,240,140,192,104,224,141,139,125,240,142,160,74,224,143,107,95,240,144,128,44,224,
-145,84,124,112,146,96,14,224,147,52,94,112,148,63,240,224,149,20,64,112,150,41,13,96,150,244,34,112,152,8,239,96,152,
-212,4,112,153,232,209,96,154,189,32,240,155,200,179,96,156,157,2,240,157,168,149,96,158,124,228,240,159,136,119,96,160,92,
-198,240,161,113,147,224,162,60,168,240,163,81,117,224,164,28,138,240,165,49,87,224,166,5,167,112,167,17,57,224,167,229,137,
-112,168,241,27,224,169,197,107,112,170,218,56,96,171,165,77,112,172,186,26,96,173,133,47,112,174,153,252,96,175,101,17,112,
-176,121,222,96,177,78,45,240,178,89,192,96,179,46,15,240,180,57,162,96,181,13,241,240,182,34,190,224,182,237,211,240,184,
-2,160,224,184,205,181,240,185,226,130,224,186,182,210,112,187,194,100,224,188,150,180,112,189,162,70,224,190,118,150,112,191,130,
-40,224,192,86,120,112,193,107,69,96,194,54,90,112,195,75,39,96,196,22,60,112,197,43,9,96,197,255,88,240,199,10,235,
-96,199,223,58,240,200,234,205,96,201,191,28,240,202,211,233,224,203,158,254,240,204,179,203,224,205,126,224,240,206,147,173,224,
-207,103,253,112,208,115,143,224,209,71,223,112,210,83,113,224,211,39,193,112,212,51,83,224,213,7,163,112,214,28,112,96,214,
-231,133,112,215,252,82,96,216,199,103,112,217,220,52,96,218,176,131,240,219,188,22,96,220,144,101,240,221,155,248,96,222,112,
-71,240,223,133,20,224,224,80,41,240,225,100,246,224,226,48,11,240,227,68,216,224,228,15,237,240,229,36,186,224,229,249,10,
-112,231,4,156,224,231,216,236,112,232,228,126,224,233,184,206,112,234,205,155,96,235,152,176,112,236,173,125,96,237,120,146,112,
-238,141,95,96,239,97,174,240,240,109,65,96,241,65,144,240,242,77,35,96,243,33,114,240,244,45,5,96,245,1,84,240,246,
-22,33,224,246,225,54,240,247,246,3,224,248,193,24,240,249,213,229,224,250,160,250,240,251,181,199,224,252,138,23,112,253,149,
-169,224,254,105,249,112,255,117,139,224,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
-1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,
-0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
-1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,
-0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
-1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,
-0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
-1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,
-0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,255,255,199,192,1,0,255,255,185,176,0,4,69,68,84,
-0,69,83,84,0,0,0
-};
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
deleted file mode 100644
index 1f28e92e4..000000000
--- a/winsup/cygwin/uinfo.cc
+++ /dev/null
@@ -1,415 +0,0 @@
-/* uinfo.cc: user info (uid, gid, etc...)
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <pwd.h>
-#include <unistd.h>
-#include <winnls.h>
-#include <wininet.h>
-#include <utmp.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <lm.h>
-#include <errno.h>
-#include <sys/cygwin.h>
-#include "pinfo.h"
-#include "security.h"
-#include "fhandler.h"
-#include "path.h"
-#include "dtable.h"
-#include "cygerrno.h"
-#include "cygheap.h"
-#include "registry.h"
-
-struct passwd *
-internal_getlogin (cygheap_user &user)
-{
- char buf[512];
- char username[UNLEN + 1];
- DWORD username_len = UNLEN + 1;
- struct passwd *pw = NULL;
-
- if (!GetUserName (username, &username_len))
- user.set_name (NULL);
- else
- user.set_name (username);
- debug_printf ("GetUserName() = %s", user.name ());
-
- if (wincap.has_security ())
- {
- LPWKSTA_USER_INFO_1 wui;
- NET_API_STATUS ret;
- char *env;
-
- user.set_logsrv (NULL);
- /* First trying to get logon info from environment */
- if (!*user.name () && (env = getenv ("USERNAME")) != NULL)
- user.set_name (env);
- if ((env = getenv ("USERDOMAIN")) != NULL)
- user.set_domain (env);
- if ((env = getenv ("LOGONSERVER")) != NULL)
- user.set_logsrv (env + 2); /* filter leading double backslashes */
- if (user.name () && user.domain ())
- debug_printf ("User: %s, Domain: %s, Logon Server: %s",
- user.name (), user.domain (), user.logsrv ());
- else if (!(ret = NetWkstaUserGetInfo (NULL, 1, (LPBYTE *) &wui)))
- {
- sys_wcstombs (buf, wui->wkui1_username, UNLEN + 1);
- user.set_name (buf);
- sys_wcstombs (buf, wui->wkui1_logon_server,
- INTERNET_MAX_HOST_NAME_LENGTH + 1);
- user.set_logsrv (buf);
- sys_wcstombs (buf, wui->wkui1_logon_domain,
- INTERNET_MAX_HOST_NAME_LENGTH + 1);
- user.set_domain (buf);
- NetApiBufferFree (wui);
- }
- if (!user.logsrv () && user.domain () &&
- get_logon_server (user.domain (), buf, NULL))
- user.set_logsrv (buf + 2);
- debug_printf ("Domain: %s, Logon Server: %s, Windows Username: %s",
- user.domain (), user.logsrv (), user.name ());
-
-
- HANDLE ptok = user.token; /* Which is INVALID_HANDLE_VALUE if no
- impersonation took place. */
- DWORD siz;
- cygsid tu;
- ret = 0;
-
- /* Try to get the SID either from already impersonated token
- or from current process first. To differ that two cases is
- important, because you can't rely on the user information
- in a process token of a currently impersonated process. */
- if (ptok == INVALID_HANDLE_VALUE
- && !OpenProcessToken (GetCurrentProcess (),
- TOKEN_ADJUST_DEFAULT | TOKEN_QUERY,
- &ptok))
- debug_printf ("OpenProcessToken(): %E\n");
- else if (!GetTokenInformation (ptok, TokenUser, &tu, sizeof tu, &siz))
- debug_printf ("GetTokenInformation(): %E");
- else if (!(ret = user.set_sid (tu)))
- debug_printf ("Couldn't retrieve SID from access token!");
- /* If that failes, try to get the SID from localhost. This can only
- be done if a domain is given because there's a chance that a local
- and a domain user may have the same name. */
- if (!ret && user.domain ())
- {
- char domain[DNLEN + 1];
- DWORD dlen = sizeof (domain);
- siz = sizeof (tu);
- SID_NAME_USE use = SidTypeInvalid;
- /* Concat DOMAIN\USERNAME for the next lookup */
- strcat (strcat (strcpy (buf, user.domain ()), "\\"), user.name ());
- if (!LookupAccountName (NULL, buf, tu, &siz,
- domain, &dlen, &use) ||
- !legal_sid_type (use))
- debug_printf ("Couldn't retrieve SID locally!");
- else user.set_sid (tu);
-
- }
-
- /* If we have a SID, try to get the corresponding Cygwin user name
- which can be different from the Windows user name. */
- cygsid gsid (NO_SID);
- if (ret)
- {
- cygsid psid;
-
- for (int pidx = 0; (pw = internal_getpwent (pidx)); ++pidx)
- if (psid.getfrompw (pw) && EqualSid (user.sid (), psid))
- {
- user.set_name (pw->pw_name);
- struct __group32 *gr = getgrgid32 (pw->pw_gid);
- if (gr)
- if (!gsid.getfromgr (gr))
- gsid = NO_SID;
- break;
- }
- }
-
- /* If this process is started from a non Cygwin process,
- set token owner to the same value as token user and
- primary group to the group which is set as primary group
- in /etc/passwd. */
- if (ptok != INVALID_HANDLE_VALUE && !myself->ppid_handle)
- {
- if (!SetTokenInformation (ptok, TokenOwner, &tu, sizeof tu))
- debug_printf ("SetTokenInformation(TokenOwner): %E");
- if (gsid && !SetTokenInformation (ptok, TokenPrimaryGroup,
- &gsid, sizeof gsid))
- debug_printf ("SetTokenInformation(TokenPrimaryGroup): %E");
- }
-
- /* Close token only if it's a result from OpenProcessToken(). */
- if (ptok != INVALID_HANDLE_VALUE
- && user.token == INVALID_HANDLE_VALUE)
- CloseHandle (ptok);
- }
-
- debug_printf ("Cygwins Username: %s", user.name ());
-
- if (!pw)
- pw = getpwnam (user.name ());
-
- if (!myself->ppid_handle)
- (void) cygheap->user.ontherange (CH_HOME, pw);
-
- return pw;
-}
-
-void
-uinfo_init ()
-{
- struct passwd *p;
-
- /* Initialize to non impersonated values.
- Setting `impersonated' to TRUE seems to be wrong but it
- isn't. Impersonated is thought as "Current User and `token'
- are coincident". See seteuid() for the mechanism behind that. */
- if (cygheap->user.token != INVALID_HANDLE_VALUE && cygheap->user.token != NULL)
- CloseHandle (cygheap->user.token);
- cygheap->user.token = INVALID_HANDLE_VALUE;
- cygheap->user.impersonated = TRUE;
-
- /* If uid is ILLEGAL_UID, the process is started from a non cygwin
- process or the user context was changed in spawn.cc */
- if (myself->uid == ILLEGAL_UID)
- if ((p = internal_getlogin (cygheap->user)) != NULL)
- {
- myself->uid = p->pw_uid;
- /* Set primary group only if process has been started from a
- non cygwin process. */
- if (!myself->ppid_handle)
- myself->gid = p->pw_gid;
- }
- else
- {
- myself->uid = DEFAULT_UID;
- myself->gid = DEFAULT_GID;
- }
- /* Real and effective uid/gid are always identical on process start up.
- This is at least true for NT/W2K. */
- cygheap->user.orig_uid = cygheap->user.real_uid = myself->uid;
- cygheap->user.orig_gid = cygheap->user.real_gid = myself->gid;
-}
-
-extern "C" char *
-getlogin (void)
-{
-#ifdef _MT_SAFE
- char *this_username=_reent_winsup ()->_username;
-#else
- static char this_username[UNLEN + 1] NO_COPY;
-#endif
-
- return strcpy (this_username, cygheap->user.name ());
-}
-
-extern "C" __uid32_t
-getuid32 (void)
-{
- return cygheap->user.real_uid;
-}
-
-extern "C" __uid16_t
-getuid (void)
-{
- return cygheap->user.real_uid;
-}
-
-extern "C" __gid32_t
-getgid32 (void)
-{
- return cygheap->user.real_gid;
-}
-
-extern "C" __gid16_t
-getgid (void)
-{
- return cygheap->user.real_gid;
-}
-
-extern "C" __uid32_t
-geteuid32 (void)
-{
- return myself->uid;
-}
-
-extern "C" __uid16_t
-geteuid (void)
-{
- return myself->uid;
-}
-
-extern "C" __gid32_t
-getegid32 (void)
-{
- return myself->gid;
-}
-
-extern "C" __gid16_t
-getegid (void)
-{
- return myself->gid;
-}
-
-/* Not quite right - cuserid can change, getlogin can't */
-extern "C" char *
-cuserid (char *src)
-{
- if (!src)
- return getlogin ();
-
- strcpy (src, getlogin ());
- return src;
-}
-
-const char *
-cygheap_user::ontherange (homebodies what, struct passwd *pw)
-{
- static char buf[MAX_PATH + 1];
- static char homedrive_buf[3];
- LPUSER_INFO_3 ui = NULL;
- WCHAR wuser[UNLEN + 1];
- NET_API_STATUS ret;
-
- if (what == CH_HOME)
- {
- char *p;
- if ((p = getenv ("HOMEDRIVE")))
- {
- memcpy (homedrive_buf, p, 2);
- homedrive = homedrive_buf;
- }
- if ((p = getenv ("HOMEPATH")))
- {
- strcpy (buf, p);
- homepath = buf;
- }
- if ((p = getenv ("HOME")))
- debug_printf ("HOME is already in the environment %s", p);
- else
- {
- if (!pw)
- pw = getpwnam (name ());
- if (pw && pw->pw_dir && *pw->pw_dir)
- {
- setenv ("HOME", pw->pw_dir, 1);
- debug_printf ("Set HOME (from /etc/passwd) to %s", pw->pw_dir);
- }
- else if (homedrive && homepath)
- {
- char home[MAX_PATH];
- strcpy (buf, homedrive);
- strcat (buf, homepath);
- cygwin_conv_to_full_posix_path (buf, home);
- setenv ("HOME", home, 1);
- debug_printf ("Set HOME (from HOMEDRIVE/HOMEPATH) to %s", home);
- }
- }
- }
-
- if (homedrive == NULL)
- {
- if (!pw)
- pw = getpwnam (name ());
- if (pw && pw->pw_dir && *pw->pw_dir)
- cygwin_conv_to_full_win32_path (pw->pw_dir, buf);
- else
- {
- sys_mbstowcs (wuser, name (), sizeof (wuser) / sizeof (*wuser));
- if ((ret = NetUserGetInfo (NULL, wuser, 3, (LPBYTE *)&ui)))
- {
- if (logsrv ())
- {
- WCHAR wlogsrv[INTERNET_MAX_HOST_NAME_LENGTH + 3];
- strcat (strcpy (buf, "\\\\"), logsrv ());
- sys_mbstowcs (wlogsrv, buf, sizeof (wlogsrv) / sizeof(*wlogsrv));
- ret = NetUserGetInfo (wlogsrv, wuser, 3,(LPBYTE *)&ui);
- }
- }
- if (!ret)
- {
- char *p;
- sys_wcstombs (buf, ui->usri3_home_dir, MAX_PATH);
- if (!buf[0])
- {
- sys_wcstombs (buf, ui->usri3_home_dir_drive, MAX_PATH);
- if (buf[0])
- strcat (buf, "\\");
- else if (!GetSystemDirectory (buf, MAX_PATH))
- strcpy (buf, "c:\\");
- else if ((p = strchr (buf, '\\')))
- p[1] = '\0';
- }
- }
- if (ui)
- NetApiBufferFree (ui);
- }
-
- if (buf[1] != ':')
- {
- homedrive_buf[0] = homedrive_buf[1] = '\0';
- homepath = buf;
- }
- else
- {
- homedrive_buf[0] = buf[0];
- homedrive_buf[1] = buf[1];
- homepath = buf + 2;
- }
- homedrive = homedrive_buf;
- }
-
- switch (what)
- {
- case CH_HOMEDRIVE:
- return homedrive;
- case CH_HOMEPATH:
- return homepath;
- default:
- return homepath;
- }
-}
-
-const char *
-cygheap_user::env_logsrv ()
-{
- char *p = plogsrv - 2;
-
- *p = p[1] = '\\';
- return p;
-}
-
-const char *
-cygheap_user::env_userprofile ()
-{
- static char buf[512]; /* FIXME: This shouldn't be static. */
- if (strcasematch (name (), "SYSTEM") || !domain () || !logsrv ())
- return NULL;
-
- if (get_registry_hive_path (sid (), buf))
- return buf;
- else
- return NULL;
-}
-
-const char *
-cygheap_user::env_homepath ()
-{
- return ontherange (CH_HOMEPATH);
-}
-
-const char *
-cygheap_user::env_homedrive ()
-{
- return ontherange (CH_HOMEDRIVE);
-}
diff --git a/winsup/cygwin/uname.cc b/winsup/cygwin/uname.cc
deleted file mode 100644
index de7b9000c..000000000
--- a/winsup/cygwin/uname.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-/* uname.cc
-
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
- Written by Steve Chamberlain of Cygnus Support, sac@cygnus.com
- Rewritten by Geoffrey Noer of Cygnus Solutions, noer@cygnus.com
-
-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 "winsup.h"
-#include <stdio.h>
-#include <sys/utsname.h>
-#include "cygwin_version.h"
-
-/* uname: POSIX 4.4.1.1 */
-extern "C" int
-uname (struct utsname *name)
-{
- DWORD len;
- SYSTEM_INFO sysinfo;
-
- if (check_null_invalid_struct_errno (name))
- return -1;
-
- char *snp = strstr (cygwin_version.dll_build_date, "SNP");
-
- memset (name, 0, sizeof (*name));
- __small_sprintf (name->sysname, "CYGWIN_%s", wincap.osname ());
-
- GetSystemInfo (&sysinfo);
-
- /* Computer name */
- len = sizeof (name->nodename) - 1;
- GetComputerNameA (name->nodename, &len);
-
- /* Cygwin dll release */
- __small_sprintf (name->release, "%d.%d.%d%s(%d.%d/%d/%d)",
- cygwin_version.dll_major / 1000,
- cygwin_version.dll_major % 1000,
- cygwin_version.dll_minor,
- snp ? "s" : "",
- cygwin_version.api_major,
- cygwin_version.api_minor,
- cygwin_version.shared_data,
- cygwin_version.mount_registry);
-
- /* Cygwin "version" aka build date */
- strcpy (name->version, cygwin_version.dll_build_date);
- if (snp)
- name->version[snp - cygwin_version.dll_build_date] = '\0';
-
- /* CPU type */
- switch (sysinfo.wProcessorArchitecture)
- {
- case PROCESSOR_ARCHITECTURE_INTEL:
- unsigned int ptype;
- if (wincap.has_valid_processorlevel ())
- {
- if (sysinfo.wProcessorLevel < 3) /* Shouldn't happen. */
- ptype = 3;
- else if (sysinfo.wProcessorLevel > 9) /* P4 */
- ptype = 6;
- else
- ptype = sysinfo.wProcessorLevel;
- }
- else
- {
- if (sysinfo.dwProcessorType == PROCESSOR_INTEL_386 ||
- sysinfo.dwProcessorType == PROCESSOR_INTEL_486)
- ptype = sysinfo.dwProcessorType / 100;
- else
- ptype = PROCESSOR_INTEL_PENTIUM / 100;
- }
- __small_sprintf (name->machine, "i%d86", ptype);
- break;
- case PROCESSOR_ARCHITECTURE_ALPHA:
- strcpy (name->machine, "alpha");
- break;
- case PROCESSOR_ARCHITECTURE_MIPS:
- strcpy (name->machine, "mips");
- break;
- default:
- strcpy (name->machine, "unknown");
- break;
- }
-
- return 0;
-}
diff --git a/winsup/cygwin/wait.cc b/winsup/cygwin/wait.cc
deleted file mode 100644
index d9588e87a..000000000
--- a/winsup/cygwin/wait.cc
+++ /dev/null
@@ -1,126 +0,0 @@
-/* wait.cc: Posix wait routines.
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include "winsup.h"
-#include <sys/wait.h>
-#include <stdlib.h>
-#include <errno.h>
-#include "cygerrno.h"
-#include "sigproc.h"
-#include "perthread.h"
-
-/* This is called _wait and not wait because the real wait is defined
- in libc/syscalls/syswait.c. It calls us. */
-
-extern "C"
-pid_t
-_wait (int *status)
-{
- return wait4 (-1, status, 0, NULL);
-}
-
-pid_t
-waitpid (pid_t intpid, int *status, int options)
-{
- return wait4 (intpid, status, options, NULL);
-}
-
-pid_t
-wait3 (int *status, int options, struct rusage *r)
-{
- return wait4 (-1, status, options, r);
-}
-
-/* Wait for any child to complete.
- * Note: this is not thread safe. Use of wait in multiple threads will
- * not work correctly.
- */
-
-pid_t
-wait4 (int intpid, int *status, int options, struct rusage *r)
-{
- int res;
- waitq *w;
- HANDLE waitfor;
- bool sawsig;
-
- while (1)
- {
- sigframe thisframe (mainthread);
- sawsig = 0;
- if (options & ~(WNOHANG | WUNTRACED))
- {
- set_errno (EINVAL);
- return -1;
- }
-
- if (r)
- memset (r, 0, sizeof (*r));
-
- if ((w = (waitq *) waitq_storage.get ()) == NULL)
- w = (waitq *) waitq_storage.create ();
-
- w->pid = intpid;
- w->options = options;
- w->rusage = r;
- sigproc_printf ("calling proc_subproc, pid %d, options %d",
- w->pid, w->options);
- if (!proc_subproc (PROC_WAIT, (DWORD)w))
- {
- set_errno (ENOSYS);
- paranoid_printf ("proc_subproc returned 0");
- res = -1;
- goto done;
- }
-
- if ((waitfor = w->ev) == NULL)
- goto nochildren;
-
- res = WaitForSingleObject (waitfor, INFINITE);
-
- sigproc_printf ("%d = WaitForSingleObject (...)", res);
-
- if (w->ev == NULL)
- {
- nochildren:
- /* found no children */
- set_errno (ECHILD);
- res = -1;
- goto done;
- }
-
- if (w->status == -1)
- {
- set_sig_errno (EINTR);
- sawsig = 1;
- res = -1;
- }
- else if (res != WAIT_OBJECT_0)
- {
- /* We shouldn't set errno to any random value if we can help it.
- See the Posix manual for a list of valid values for `errno'. */
- set_errno (EINVAL);
- res = -1;
- }
- else if ((res = w->pid) != 0 && status)
- *status = w->status;
-
- done:
- if (!sawsig || !thisframe.call_signal_handler ())
- break;
- }
-
- sigproc_printf ("intpid %d, status %p, w->status %d, options %d, res %d",
- intpid, status, w->status, options, res);
- w->status = -1;
- if (res < 0)
- sigproc_printf ("*** errno = %d", get_errno ());
- return res;
-}
diff --git a/winsup/cygwin/winbase.h b/winsup/cygwin/winbase.h
deleted file mode 100644
index d72bb0893..000000000
--- a/winsup/cygwin/winbase.h
+++ /dev/null
@@ -1,83 +0,0 @@
-#include_next "winbase.h"
-
-#ifndef _WINBASE2_H
-#define _WINBASE2_H
-
-extern __inline__ long ilockincr (long *m)
-{
- register int __res;
- __asm__ __volatile__ ("\n\
- movl $1,%0\n\
- lock xadd %0,(%1)\n\
- inc %0\n\
- ": "=a" (__res), "=r" (m): "1" (m));
- return __res;
-}
-extern __inline__ long ilockdecr (long *m)
-{
- register int __res;
- __asm__ __volatile__ ("\n\
- movl $0xffffffff,%0\n\
- lock xadd %0,(%1)\n\
- dec %0\n\
- ": "=a" (__res), "=r" (m): "1" (m));
- return __res;
-}
-extern __inline__ long ilockexch (long *t, long v)
-{
- register int __res;
- __asm__ __volatile__ ("\n\
- movl (%2),%0\n\
-1: lock cmpxchgl %3,(%1)\n\
- jne 1b\n\
- ": "=a" (__res), "=c" (t): "1" (t), "d" (v));
- return __res;
-}
-
-#undef InterlockedIncrement
-#define InterlockedIncrement ilockincr
-#undef InterlockedDecrement
-#define InterlockedDecrement ilockdecr
-#undef InterlockedExchange
-#define InterlockedExchange ilockexch
-
-extern long tls_ix;
-extern char * volatile *__stackbase __asm__ ("%fs:4");
-
-extern __inline__ DWORD
-my_tlsalloc ()
-{
- DWORD n = ilockdecr (&tls_ix);
- __stackbase[tls_ix] = NULL;
- return n;
-}
-
-extern __inline__ BOOL
-my_tlssetvalue (DWORD ix, void *val)
-{
- __stackbase[ix] = (char *) val;
- return 1;
-}
-
-extern __inline__ void *
-my_tlsgetvalue (DWORD ix)
-{
- return __stackbase[ix];
-}
-
-extern __inline__ BOOL
-my_tlsfree (DWORD ix)
-{
- /* nothing for now */
- return 1;
-}
-
-#undef TlsAlloc
-#define TlsAlloc my_tlsalloc
-#undef TlsGetValue
-#define TlsGetValue my_tlsgetvalue
-#undef TlsSetValue
-#define TlsSetValue my_tlssetvalue
-#undef TlsFree
-#define TlsFree my_tlsfree
-#endif /*_WINBASE2_H*/
diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc
deleted file mode 100644
index 29e33b626..000000000
--- a/winsup/cygwin/wincap.cc
+++ /dev/null
@@ -1,504 +0,0 @@
-/* wincap.cc -- figure out on which OS we're running. Set the
- capability class to the appropriate values.
-
- Copyright 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. */
-
-#include "winsup.h"
-
-static NO_COPY wincaps wincap_unknown = {
- lock_file_highword:0x0,
- chunksize:0x0,
- shared:FILE_SHARE_READ | FILE_SHARE_WRITE,
- is_winnt:false,
- access_denied_on_delete:false,
- has_delete_on_close:false,
- has_page_guard:false,
- has_security:false,
- has_security_descriptor_control:false,
- has_get_process_times:false,
- has_lseek_bug:false,
- has_lock_file_ex:false,
- has_signal_object_and_wait:false,
- has_eventlog:false,
- has_ip_helper_lib:false,
- has_set_handle_information:false,
- has_set_handle_information_on_console_handles:false,
- supports_smp:false,
- map_view_of_file_ex_sucks:false,
- altgr_is_ctrl_alt:false,
- has_physical_mem_access:false,
- has_working_copy_on_write:false,
- share_mmaps_only_by_name:false,
- virtual_protect_works_on_shared_pages:false,
- has_hard_links:false,
- can_open_directories:false,
- has_move_file_ex:false,
- has_negative_pids:false,
- has_unreliable_pipes:false,
- has_try_enter_critical_section:false,
- has_raw_devices:false,
- has_valid_processorlevel:false,
- has_64bit_file_access:false,
- has_process_io_counters:false,
-};
-
-static NO_COPY wincaps wincap_95 = {
- lock_file_highword:0x0,
- chunksize:32 * 1024 * 1024,
- shared:FILE_SHARE_READ | FILE_SHARE_WRITE,
- is_winnt:false,
- access_denied_on_delete:true,
- has_delete_on_close:false,
- has_page_guard:false,
- has_security:false,
- has_security_descriptor_control:false,
- has_get_process_times:false,
- has_lseek_bug:true,
- has_lock_file_ex:false,
- has_signal_object_and_wait:false,
- has_eventlog:false,
- has_ip_helper_lib:false,
- has_set_handle_information:false,
- has_set_handle_information_on_console_handles:false,
- supports_smp:false,
- map_view_of_file_ex_sucks:true,
- altgr_is_ctrl_alt:false,
- has_physical_mem_access:false,
- has_working_copy_on_write:false,
- share_mmaps_only_by_name:true,
- virtual_protect_works_on_shared_pages:false,
- has_hard_links:false,
- can_open_directories:false,
- has_move_file_ex:false,
- has_negative_pids:true,
- has_unreliable_pipes:true,
- has_try_enter_critical_section:false,
- has_raw_devices:false,
- has_valid_processorlevel:false,
- has_64bit_file_access:false,
- has_process_io_counters:false,
-};
-
-static NO_COPY wincaps wincap_95osr2 = {
- lock_file_highword:0x0,
- chunksize:32 * 1024 * 1024,
- shared:FILE_SHARE_READ | FILE_SHARE_WRITE,
- is_winnt:false,
- access_denied_on_delete:true,
- has_delete_on_close:false,
- has_page_guard:false,
- has_security:false,
- has_security_descriptor_control:false,
- has_get_process_times:false,
- has_lseek_bug:true,
- has_lock_file_ex:false,
- has_signal_object_and_wait:false,
- has_eventlog:false,
- has_ip_helper_lib:false,
- has_set_handle_information:false,
- has_set_handle_information_on_console_handles:false,
- supports_smp:false,
- map_view_of_file_ex_sucks:true,
- altgr_is_ctrl_alt:false,
- has_physical_mem_access:false,
- has_working_copy_on_write:false,
- share_mmaps_only_by_name:true,
- virtual_protect_works_on_shared_pages:false,
- has_hard_links:false,
- can_open_directories:false,
- has_move_file_ex:false,
- has_negative_pids:true,
- has_unreliable_pipes:true,
- has_try_enter_critical_section:false,
- has_raw_devices:false,
- has_valid_processorlevel:false,
- has_64bit_file_access:false,
- has_process_io_counters:false,
-};
-
-static NO_COPY wincaps wincap_98 = {
- lock_file_highword:0x0,
- chunksize:32 * 1024 * 1024,
- shared:FILE_SHARE_READ | FILE_SHARE_WRITE,
- is_winnt:false,
- access_denied_on_delete:true,
- has_delete_on_close:false,
- has_page_guard:false,
- has_security:false,
- has_security_descriptor_control:false,
- has_get_process_times:false,
- has_lseek_bug:true,
- has_lock_file_ex:false,
- has_signal_object_and_wait:false,
- has_eventlog:false,
- has_ip_helper_lib:true,
- has_set_handle_information:false,
- has_set_handle_information_on_console_handles:false,
- supports_smp:false,
- map_view_of_file_ex_sucks:true,
- altgr_is_ctrl_alt:false,
- has_physical_mem_access:false,
- has_working_copy_on_write:false,
- share_mmaps_only_by_name:true,
- virtual_protect_works_on_shared_pages:false,
- has_hard_links:false,
- can_open_directories:false,
- has_move_file_ex:false,
- has_negative_pids:true,
- has_unreliable_pipes:true,
- has_try_enter_critical_section:false,
- has_raw_devices:false,
- has_valid_processorlevel:true,
- has_64bit_file_access:false,
- has_process_io_counters:false,
-};
-
-static NO_COPY wincaps wincap_98se = {
- lock_file_highword:0x0,
- chunksize:32 * 1024 * 1024,
- shared:FILE_SHARE_READ | FILE_SHARE_WRITE,
- is_winnt:false,
- access_denied_on_delete:true,
- has_delete_on_close:false,
- has_page_guard:false,
- has_security:false,
- has_security_descriptor_control:false,
- has_get_process_times:false,
- has_lseek_bug:true,
- has_lock_file_ex:false,
- has_signal_object_and_wait:false,
- has_eventlog:false,
- has_ip_helper_lib:true,
- has_set_handle_information:false,
- has_set_handle_information_on_console_handles:false,
- supports_smp:false,
- map_view_of_file_ex_sucks:true,
- altgr_is_ctrl_alt:false,
- has_physical_mem_access:false,
- has_working_copy_on_write:false,
- share_mmaps_only_by_name:true,
- virtual_protect_works_on_shared_pages:false,
- has_hard_links:false,
- can_open_directories:false,
- has_move_file_ex:false,
- has_negative_pids:true,
- has_unreliable_pipes:true,
- has_try_enter_critical_section:false,
- has_raw_devices:false,
- has_valid_processorlevel:true,
- has_64bit_file_access:false,
- has_process_io_counters:false,
-};
-
-static NO_COPY wincaps wincap_me = {
- lock_file_highword:0x0,
- chunksize:32 * 1024 * 1024,
- shared:FILE_SHARE_READ | FILE_SHARE_WRITE,
- is_winnt:false,
- access_denied_on_delete:true,
- has_delete_on_close:false,
- has_page_guard:false,
- has_security:false,
- has_security_descriptor_control:false,
- has_get_process_times:false,
- has_lseek_bug:true,
- has_lock_file_ex:false,
- has_signal_object_and_wait:false,
- has_eventlog:false,
- has_ip_helper_lib:true,
- has_set_handle_information:false,
- has_set_handle_information_on_console_handles:false,
- supports_smp:false,
- map_view_of_file_ex_sucks:true,
- altgr_is_ctrl_alt:false,
- has_physical_mem_access:false,
- has_working_copy_on_write:false,
- share_mmaps_only_by_name:true,
- virtual_protect_works_on_shared_pages:false,
- has_hard_links:false,
- can_open_directories:false,
- has_move_file_ex:false,
- has_negative_pids:true,
- has_unreliable_pipes:true,
- has_try_enter_critical_section:false,
- has_raw_devices:false,
- has_valid_processorlevel:true,
- has_64bit_file_access:false,
- has_process_io_counters:false,
-};
-
-static NO_COPY wincaps wincap_nt3 = {
- lock_file_highword:0xffffffff,
- chunksize:0,
- shared:FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
- is_winnt:true,
- access_denied_on_delete:false,
- has_delete_on_close:true,
- has_page_guard:true,
- has_security:true,
- has_security_descriptor_control:false,
- has_get_process_times:true,
- has_lseek_bug:false,
- has_lock_file_ex:true,
- has_signal_object_and_wait:false,
- has_eventlog:true,
- has_ip_helper_lib:false,
- has_set_handle_information:true,
- has_set_handle_information_on_console_handles:false,
- supports_smp:false,
- map_view_of_file_ex_sucks:false,
- altgr_is_ctrl_alt:true,
- has_physical_mem_access:true,
- has_working_copy_on_write:true,
- share_mmaps_only_by_name:false,
- virtual_protect_works_on_shared_pages:true,
- has_hard_links:true,
- can_open_directories:true,
- has_move_file_ex:true,
- has_negative_pids:false,
- has_unreliable_pipes:false,
- has_try_enter_critical_section:false,
- has_raw_devices:true,
- has_valid_processorlevel:true,
- has_64bit_file_access:true,
- has_process_io_counters:false,
-};
-
-static NO_COPY wincaps wincap_nt4 = {
- lock_file_highword:0xffffffff,
- chunksize:0,
- shared:FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
- is_winnt:true,
- access_denied_on_delete:false,
- has_delete_on_close:true,
- has_page_guard:true,
- has_security:true,
- has_security_descriptor_control:false,
- has_get_process_times:true,
- has_lseek_bug:false,
- has_lock_file_ex:true,
- has_signal_object_and_wait:true,
- has_eventlog:true,
- has_ip_helper_lib:false,
- has_set_handle_information:true,
- has_set_handle_information_on_console_handles:false,
- supports_smp:true,
- map_view_of_file_ex_sucks:false,
- altgr_is_ctrl_alt:true,
- has_physical_mem_access:true,
- has_working_copy_on_write:true,
- share_mmaps_only_by_name:false,
- virtual_protect_works_on_shared_pages:true,
- has_hard_links:true,
- can_open_directories:true,
- has_move_file_ex:true,
- has_negative_pids:false,
- has_unreliable_pipes:false,
- has_try_enter_critical_section:true,
- has_raw_devices:true,
- has_valid_processorlevel:true,
- has_64bit_file_access:true,
- has_process_io_counters:false,
-};
-
-static NO_COPY wincaps wincap_nt4sp4 = {
- lock_file_highword:0xffffffff,
- chunksize:0,
- shared:FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
- is_winnt:true,
- access_denied_on_delete:false,
- has_delete_on_close:true,
- has_page_guard:true,
- has_security:true,
- has_security_descriptor_control:false,
- has_get_process_times:true,
- has_lseek_bug:false,
- has_lock_file_ex:true,
- has_signal_object_and_wait:true,
- has_eventlog:true,
- has_ip_helper_lib:true,
- has_set_handle_information:true,
- has_set_handle_information_on_console_handles:false,
- supports_smp:true,
- map_view_of_file_ex_sucks:false,
- altgr_is_ctrl_alt:true,
- has_physical_mem_access:true,
- has_working_copy_on_write:true,
- share_mmaps_only_by_name:false,
- virtual_protect_works_on_shared_pages:true,
- has_hard_links:true,
- can_open_directories:true,
- has_move_file_ex:true,
- has_negative_pids:false,
- has_unreliable_pipes:false,
- has_try_enter_critical_section:true,
- has_raw_devices:true,
- has_valid_processorlevel:true,
- has_64bit_file_access:true,
- has_process_io_counters:false,
-};
-
-static NO_COPY wincaps wincap_2000 = {
- lock_file_highword:0xffffffff,
- chunksize:0,
- shared:FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
- is_winnt:true,
- access_denied_on_delete:false,
- has_delete_on_close:true,
- has_page_guard:true,
- has_security:true,
- has_security_descriptor_control:true,
- has_get_process_times:true,
- has_lseek_bug:false,
- has_lock_file_ex:true,
- has_signal_object_and_wait:true,
- has_eventlog:true,
- has_ip_helper_lib:true,
- has_set_handle_information:true,
- has_set_handle_information_on_console_handles:true,
- supports_smp:true,
- map_view_of_file_ex_sucks:false,
- altgr_is_ctrl_alt:true,
- has_physical_mem_access:true,
- has_working_copy_on_write:true,
- share_mmaps_only_by_name:false,
- virtual_protect_works_on_shared_pages:true,
- has_hard_links:true,
- can_open_directories:true,
- has_move_file_ex:true,
- has_negative_pids:false,
- has_unreliable_pipes:false,
- has_try_enter_critical_section:true,
- has_raw_devices:true,
- has_valid_processorlevel:true,
- has_64bit_file_access:true,
- has_process_io_counters:true,
-};
-
-static NO_COPY wincaps wincap_xp = {
- lock_file_highword:0xffffffff,
- chunksize:0,
- shared:FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
- is_winnt:true,
- access_denied_on_delete:false,
- has_delete_on_close:true,
- has_page_guard:true,
- has_security:true,
- has_security_descriptor_control:true,
- has_get_process_times:true,
- has_lseek_bug:false,
- has_lock_file_ex:true,
- has_signal_object_and_wait:true,
- has_eventlog:true,
- has_ip_helper_lib:true,
- has_set_handle_information:true,
- has_set_handle_information_on_console_handles:true,
- supports_smp:true,
- map_view_of_file_ex_sucks:false,
- altgr_is_ctrl_alt:true,
- has_physical_mem_access:true,
- has_working_copy_on_write:true,
- share_mmaps_only_by_name:false,
- virtual_protect_works_on_shared_pages:true,
- has_hard_links:true,
- can_open_directories:true,
- has_move_file_ex:true,
- has_negative_pids:false,
- has_unreliable_pipes:false,
- has_try_enter_critical_section:true,
- has_raw_devices:true,
- has_valid_processorlevel:true,
- has_64bit_file_access:true,
- has_process_io_counters:true,
-};
-
-wincapc wincap;
-
-void
-wincapc::init ()
-{
- const char *os;
-
- if (caps)
- return; // already initialized
-
- memset (&version, 0, sizeof version);
- version.dwOSVersionInfoSize = sizeof version;
- GetVersionEx (&version);
-
- switch (version.dwPlatformId)
- {
- case VER_PLATFORM_WIN32_NT:
- switch (version.dwMajorVersion)
- {
- case 3:
- os = "NT";
- caps = &wincap_nt3;
- break;
- case 4:
- os = "NT";
- if (strcmp (version.szCSDVersion, "Service Pack 4") < 0)
- caps = &wincap_nt4;
- else
- caps = &wincap_nt4sp4;
- break;
- case 5:
- os = "NT";
- if (version.dwMinorVersion == 0)
- caps = &wincap_2000;
- else
- caps = &wincap_xp;
- break;
- default:
- os = "??";
- caps = &wincap_unknown;
- break;
- }
- break;
- case VER_PLATFORM_WIN32_WINDOWS:
- switch (version.dwMinorVersion)
- {
- case 0:
- os = "95";
- if (strchr(version.szCSDVersion, 'C'))
- caps = &wincap_95osr2;
- else
- caps = &wincap_95;
- break;
- case 10:
- os = "98";
- if (strchr(version.szCSDVersion, 'A'))
- caps = &wincap_98se;
- else
- caps = &wincap_98;
- break;
- case 90:
- os = "ME";
- caps = &wincap_me;
- break;
- default:
- os = "??";
- caps = &wincap_unknown;
- break;
- }
- break;
- default:
- os = "??";
- caps = &wincap_unknown;
- break;
- }
- __small_sprintf (osnam, "%s-%d.%d", os, version.dwMajorVersion,
- version.dwMinorVersion);
-}
-
-void
-wincapc::set_chunksize (DWORD nchunksize)
-{
- ((wincaps *)this->caps)->chunksize = nchunksize;
-}
diff --git a/winsup/cygwin/wincap.h b/winsup/cygwin/wincap.h
deleted file mode 100644
index 5820124b7..000000000
--- a/winsup/cygwin/wincap.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* wincap.h: Header for OS capability class.
-
- Copyright 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. */
-
-#ifndef _WINCAP_H
-#define _WINCAP_H
-
-struct wincaps
-{
- DWORD lock_file_highword;
- DWORD chunksize;
- int shared;
- unsigned is_winnt : 1;
- unsigned access_denied_on_delete : 1;
- unsigned has_delete_on_close : 1;
- unsigned has_page_guard : 1;
- unsigned has_security : 1;
- unsigned has_security_descriptor_control : 1;
- unsigned has_get_process_times : 1;
- unsigned has_lseek_bug : 1;
- unsigned has_lock_file_ex : 1;
- unsigned has_signal_object_and_wait : 1;
- unsigned has_eventlog : 1;
- unsigned has_ip_helper_lib : 1;
- unsigned has_set_handle_information : 1;
- unsigned has_set_handle_information_on_console_handles: 1;
- unsigned supports_smp : 1;
- unsigned map_view_of_file_ex_sucks : 1;
- unsigned altgr_is_ctrl_alt : 1;
- unsigned has_physical_mem_access : 1;
- unsigned has_working_copy_on_write : 1;
- unsigned share_mmaps_only_by_name : 1;
- unsigned virtual_protect_works_on_shared_pages : 1;
- unsigned has_hard_links : 1;
- unsigned can_open_directories : 1;
- unsigned has_move_file_ex : 1;
- unsigned has_negative_pids : 1;
- unsigned has_unreliable_pipes : 1;
- unsigned has_try_enter_critical_section : 1;
- unsigned has_raw_devices : 1;
- unsigned has_valid_processorlevel : 1;
- unsigned has_64bit_file_access : 1;
- unsigned has_process_io_counters : 1;
-};
-
-class wincapc
-{
- OSVERSIONINFO version;
- char osnam[40];
- void *caps;
-
-public:
- void init ();
-
- void set_chunksize (DWORD nchunksize);
-
- const char *osname () const { return osnam; }
-
-#define IMPLEMENT(cap) cap() const { return ((wincaps *)this->caps)->cap; }
-
- DWORD IMPLEMENT (lock_file_highword)
- DWORD IMPLEMENT (chunksize)
- int IMPLEMENT (shared)
- bool IMPLEMENT (is_winnt)
- bool IMPLEMENT (access_denied_on_delete)
- bool IMPLEMENT (has_delete_on_close)
- bool IMPLEMENT (has_page_guard)
- bool IMPLEMENT (has_security)
- bool IMPLEMENT (has_security_descriptor_control)
- bool IMPLEMENT (has_get_process_times)
- bool IMPLEMENT (has_lseek_bug)
- bool IMPLEMENT (has_lock_file_ex)
- bool IMPLEMENT (has_signal_object_and_wait)
- bool IMPLEMENT (has_eventlog)
- bool IMPLEMENT (has_ip_helper_lib)
- bool IMPLEMENT (has_set_handle_information)
- bool IMPLEMENT (has_set_handle_information_on_console_handles)
- bool IMPLEMENT (supports_smp)
- bool IMPLEMENT (map_view_of_file_ex_sucks)
- bool IMPLEMENT (altgr_is_ctrl_alt)
- bool IMPLEMENT (has_physical_mem_access)
- bool IMPLEMENT (has_working_copy_on_write)
- bool IMPLEMENT (share_mmaps_only_by_name)
- bool IMPLEMENT (virtual_protect_works_on_shared_pages)
- bool IMPLEMENT (has_hard_links)
- bool IMPLEMENT (can_open_directories)
- bool IMPLEMENT (has_move_file_ex)
- bool IMPLEMENT (has_negative_pids)
- bool IMPLEMENT (has_unreliable_pipes)
- bool IMPLEMENT (has_try_enter_critical_section)
- bool IMPLEMENT (has_raw_devices)
- bool IMPLEMENT (has_valid_processorlevel)
- bool IMPLEMENT (has_64bit_file_access)
- bool IMPLEMENT (has_process_io_counters)
-
-#undef IMPLEMENT
-};
-
-extern wincapc wincap;
-
-#endif /* _WINCAP_H */
diff --git a/winsup/cygwin/window.cc b/winsup/cygwin/window.cc
deleted file mode 100644
index 38b19c418..000000000
--- a/winsup/cygwin/window.cc
+++ /dev/null
@@ -1,265 +0,0 @@
-/* window.cc: hidden windows for signals/itimer support
-
- Copyright 1997, 1998, 2000, 2001, 2002 Red Hat, Inc.
-
- Written by Sergey Okhapkin <sos@prospect.com.ru>
-
-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 "winsup.h"
-#include <sys/time.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <signal.h>
-#include <limits.h>
-#include <wingdi.h>
-#include <winuser.h>
-#define USE_SYS_TYPES_FD_SET
-#include <winsock2.h>
-#include <unistd.h>
-#include "cygerrno.h"
-#include "perprocess.h"
-#include "security.h"
-
-static NO_COPY UINT timer_active = 0;
-static NO_COPY struct itimerval itv;
-static NO_COPY DWORD start_time;
-static NO_COPY HWND ourhwnd = NULL;
-
-static LRESULT CALLBACK
-WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
-#ifndef NOSTRACE
- strace.wm (uMsg, wParam, lParam);
-#endif
- switch (uMsg)
- {
- case WM_PAINT:
- return 0;
- case WM_DESTROY:
- PostQuitMessage (0);
- return 0;
- case WM_TIMER:
- if (wParam == timer_active)
- {
- UINT elapse = itv.it_interval.tv_sec * 1000 +
- itv.it_interval.tv_usec / 1000;
- KillTimer (hwnd, timer_active);
- if (!elapse)
- {
- timer_active = 0;
- }
- else
- {
- timer_active = SetTimer (hwnd, 1, elapse, NULL);
- start_time = GetTickCount ();
- itv.it_value = itv.it_interval;
- }
- raise (SIGALRM);
- }
- return 0;
- case WM_ASYNCIO:
- if (WSAGETSELECTEVENT(lParam) == FD_OOB)
- raise (SIGURG);
- else
- raise (SIGIO);
- return 0;
- default:
- return DefWindowProc (hwnd, uMsg, wParam, lParam);
- }
-}
-
-static HANDLE window_started;
-
-static DWORD WINAPI
-Winmain (VOID *)
-{
- MSG msg;
- WNDCLASS wc;
- static NO_COPY char classname[] = "CygwinWndClass";
-
- /* Register the window class for the main window. */
-
- wc.style = 0;
- wc.lpfnWndProc = (WNDPROC) WndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = user_data->hmodule;
- wc.hIcon = NULL;
- wc.hCursor = NULL;
- wc.hbrBackground = NULL;
- wc.lpszMenuName = NULL;
- wc.lpszClassName = classname;
-
- if (!RegisterClass (&wc))
- {
- system_printf ("Cannot register window class");
- return FALSE;
- }
-
- /* Create hidden window. */
- ourhwnd = CreateWindow (classname, classname,
- WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT, (HWND) NULL,
- (HMENU) NULL, user_data->hmodule, (LPVOID) NULL);
-
- SetEvent (window_started);
-
- if (!ourhwnd)
- {
- system_printf ("Cannot create window");
- return FALSE;
- }
-
- /* Start the message loop. */
-
- while (GetMessage (&msg, ourhwnd, 0, 0) == TRUE)
- {
- DispatchMessage (&msg);
- }
-
- return msg.wParam;
-}
-
-HWND __stdcall
-gethwnd ()
-{
- if (ourhwnd != NULL)
- return ourhwnd;
-
- HANDLE hThread;
-
- window_started = CreateEvent (&sec_none_nih, TRUE, FALSE, NULL);
- hThread = makethread (Winmain, NULL, 0, "win");
- if (!hThread)
- {
- system_printf ("Cannot start window thread");
- }
- else
- {
- SetThreadPriority (hThread, THREAD_PRIORITY_HIGHEST);
- CloseHandle (hThread);
- }
- WaitForSingleObject (window_started, INFINITE);
- CloseHandle (window_started);
- return ourhwnd;
-}
-
-void __stdcall
-window_terminate ()
-{
- if (ourhwnd)
- SendMessage (ourhwnd, WM_DESTROY, 0, 0);
-}
-
-extern "C" int
-setitimer (int which, const struct itimerval *value, struct itimerval *oldvalue)
-{
- UINT elapse;
-
- if (which != ITIMER_REAL)
- {
- set_errno (EINVAL);
- return -1;
- }
- /* Check if we will wrap */
- if (itv.it_value.tv_sec >= (long) (UINT_MAX / 1000))
- {
- set_errno (EINVAL);
- return -1;
- }
- if (timer_active)
- {
- KillTimer (gethwnd (), timer_active);
- timer_active = 0;
- }
- if (oldvalue)
- *oldvalue = itv;
- if (value == NULL)
- {
- set_errno (EFAULT);
- return -1;
- }
- itv = *value;
- elapse = itv.it_value.tv_sec * 1000 + itv.it_value.tv_usec / 1000;
- if (elapse == 0)
- if (itv.it_value.tv_usec)
- elapse = 1;
- else
- return 0;
- if (!(timer_active = SetTimer (gethwnd (), 1, elapse, NULL)))
- {
- __seterrno ();
- return -1;
- }
- start_time = GetTickCount ();
- return 0;
-}
-
-extern "C" int
-getitimer (int which, struct itimerval *value)
-{
- UINT elapse, val;
-
- if (which != ITIMER_REAL)
- {
- set_errno (EINVAL);
- return -1;
- }
- if (value == NULL)
- {
- set_errno (EFAULT);
- return -1;
- }
- *value = itv;
- if (!timer_active)
- {
- value->it_value.tv_sec = 0;
- value->it_value.tv_usec = 0;
- return 0;
- }
- elapse = GetTickCount () - start_time;
- val = itv.it_value.tv_sec * 1000 + itv.it_value.tv_usec / 1000;
- val -= elapse;
- value->it_value.tv_sec = val / 1000;
- value->it_value.tv_usec = val % 1000;
- return 0;
-}
-
-extern "C" unsigned int
-alarm (unsigned int seconds)
-{
- int ret;
- struct itimerval newt, oldt;
-
- newt.it_value.tv_sec = seconds;
- newt.it_value.tv_usec = 0;
- newt.it_interval.tv_sec = 0;
- newt.it_interval.tv_usec = 0;
- setitimer (ITIMER_REAL, &newt, &oldt);
- ret = oldt.it_value.tv_sec;
- if (ret == 0 && oldt.it_value.tv_usec)
- ret = 1;
- return ret;
-}
-
-extern "C" useconds_t
-ualarm (useconds_t value, useconds_t interval)
-{
- struct itimerval timer, otimer;
-
- timer.it_value.tv_sec = 0;
- timer.it_value.tv_usec = value;
- timer.it_interval.tv_sec = 0;
- timer.it_interval.tv_usec = interval;
-
- if (setitimer (ITIMER_REAL, &timer, &otimer) < 0)
- return (u_int)-1;
-
- return (otimer.it_value.tv_sec * 1000000) + otimer.it_value.tv_usec;
-}
-
diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h
deleted file mode 100644
index 2758569a5..000000000
--- a/winsup/cygwin/winsup.h
+++ /dev/null
@@ -1,299 +0,0 @@
-/* winsup.h: main Cygwin header file.
-
- Copyright 1996, 1997, 1998, 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. */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#define __INSIDE_CYGWIN__
-
-#define strlen __builtin_strlen
-#define strcmp __builtin_strcmp
-#define strcpy __builtin_strcpy
-#define memcpy __builtin_memcpy
-#define memcmp __builtin_memcmp
-#ifdef HAVE_BUILTIN_MEMSET
-# define memset __builtin_memset
-#endif
-
-#define NO_COPY __attribute__((nocommon)) __attribute__((section(".data_cygwin_nocopy")))
-
-#ifdef EXPCGF
-#define DECLARE_TLS_STORAGE char **tls[4096] __attribute__ ((unused))
-#else
-#define DECLARE_TLS_STORAGE do {} while (0)
-#define _WINBASE2_H
-#endif
-
-#ifdef __cplusplus
-
-#if !defined(__STDC_VERSION__) || __STDC_VERSION__ >= 199900L
-#define NEW_MACRO_VARARGS
-#endif
-
-#include <sys/types.h>
-#include <sys/strace.h>
-
-extern const char case_folded_lower[];
-#define cyg_tolower(c) (case_folded_lower[(unsigned char)(c)])
-extern const char case_folded_upper[];
-#define cyg_toupper(c) (case_folded_upper[(unsigned char)(c)])
-
-#ifndef MALLOC_DEBUG
-#define cfree newlib_cfree_dont_use
-#endif
-
-#define WIN32_LEAN_AND_MEAN 1
-#define _WINGDI_H
-#define _WINUSER_H
-#define _WINNLS_H
-#define _WINVER_H
-#define _WINNETWK_H
-#define _WINSVC_H
-#include <windows.h>
-#include <wincrypt.h>
-#include <lmcons.h>
-#undef _WINGDI_H
-#undef _WINUSER_H
-#undef _WINNLS_H
-#undef _WINVER_H
-#undef _WINNETWK_H
-#undef _WINSVC_H
-
-#include "wincap.h"
-
-/* The one function we use from winuser.h most of the time */
-extern "C" DWORD WINAPI GetLastError (void);
-
-enum codepage_type {ansi_cp, oem_cp};
-extern codepage_type current_codepage;
-
-extern int cygserver_running;
-
-/* Used to check if Cygwin DLL is dynamically loaded. */
-extern int dynamically_loaded;
-
-#define sys_wcstombs(tgt,src,len) \
- WideCharToMultiByte((current_codepage==ansi_cp?CP_ACP:CP_OEMCP),0,(src),-1,(tgt),(len),NULL,NULL)
-#define sys_mbstowcs(tgt,src,len) \
- MultiByteToWideChar((current_codepage==ansi_cp?CP_ACP:CP_OEMCP),0,(src),-1,(tgt),(len))
-
-#define TITLESIZE 1024
-
-/* status bit manipulation */
-#define __ISSETF(what, x, prefix) \
- ((what)->status & prefix##_##x)
-#define __SETF(what, x, prefix) \
- ((what)->status |= prefix##_##x)
-#define __CLEARF(what, x, prefix) \
- ((what)->status &= ~prefix##_##x)
-#define __CONDSETF(n, what, x, prefix) \
- ((n) ? __SETF (what, x, prefix) : __CLEARF (what, x, prefix))
-
-#include "debug.h"
-
-/* Events/mutexes */
-extern HANDLE title_mutex;
-
-/**************************** Convenience ******************************/
-
-/* Used when treating / and \ as equivalent. */
-#define SLASH_P(ch) \
- ({ \
- char __c = (ch); \
- ((__c) == '/' || (__c) == '\\'); \
- })
-
-/* Convert a signal to a signal mask */
-#define SIGTOMASK(sig) (1<<((sig) - signal_shift_subtract))
-extern unsigned int signal_shift_subtract;
-
-#ifdef NEW_MACRO_VARARGS
-# define api_fatal(...) __api_fatal ("%P: *** " __VA_ARGS__)
-#else
-# define api_fatal(fmt, args...) __api_fatal ("%P: *** " fmt,## args)
-#endif
-
-#undef issep
-#define issep(ch) (strchr (" \t\n\r", (ch)) != NULL)
-
-#define isdirsep SLASH_P
-#define isabspath(p) \
- (isdirsep (*(p)) || (isalpha (*(p)) && (p)[1] == ':' && (!(p)[2] || isdirsep ((p)[2]))))
-
-/******************** Initialization/Termination **********************/
-
-class per_process;
-/* cygwin .dll initialization */
-void dll_crt0 (per_process *) __asm__ ("_dll_crt0__FP11per_process");
-extern "C" void __stdcall _dll_crt0 ();
-
-/* dynamically loaded dll initialization */
-extern "C" int dll_dllcrt0 (HMODULE, per_process *);
-
-/* dynamically loaded dll initialization for non-cygwin apps */
-extern "C" int dll_noncygwin_dllcrt0 (HMODULE, per_process *);
-
-/* exit the program */
-extern "C" void __stdcall do_exit (int) __attribute__ ((noreturn));
-
-/* UID/GID */
-void uinfo_init (void);
-
-#define ILLEGAL_UID16 ((__uid16_t)-1)
-#define ILLEGAL_UID ((__uid32_t)-1)
-#define ILLEGAL_GID16 ((__gid16_t)-1)
-#define ILLEGAL_GID ((__gid32_t)-1)
-#define ILLEGAL_SEEK ((__off64_t)-1)
-
-#define uid16touid32(u16) ((u16)==ILLEGAL_UID16?ILLEGAL_UID:(__uid32_t)(u16))
-#define gid16togid32(g16) ((g16)==ILLEGAL_GID16?ILLEGAL_GID:(__gid32_t)(g16))
-
-extern "C" __uid32_t getuid32 (void);
-extern "C" __uid32_t geteuid32 (void);
-extern "C" struct passwd *getpwuid32 (__uid32_t);
-
-/* various events */
-void events_init (void);
-void events_terminate (void);
-
-void __stdcall close_all_files (void);
-BOOL __stdcall check_pty_fds (void);
-
-/* Invisible window initialization/termination. */
-HWND __stdcall gethwnd (void);
-void __stdcall window_terminate (void);
-
-/* Globals that handle initialization of winsock in a child process. */
-extern HANDLE wsock32_handle;
-extern HANDLE ws2_32_handle;
-
-/* Globals that handle initialization of netapi in a child process. */
-extern HANDLE netapi32_handle;
-
-/* debug_on_trap support. see exceptions.cc:try_to_debug() */
-extern "C" void error_start_init (const char*);
-extern "C" int try_to_debug (bool waitloop = 1);
-
-void set_file_api_mode (codepage_type);
-
-extern int cygwin_finished_initializing;
-
-/**************************** Miscellaneous ******************************/
-
-void __stdcall set_std_handle (int);
-int __stdcall writable_directory (const char *file);
-int __stdcall stat_dev (DWORD, int, unsigned long, struct __stat64 *);
-extern BOOL allow_ntsec;
-
-unsigned long __stdcall hash_path_name (unsigned long hash, const char *name) __attribute__ ((regparm(2)));
-void __stdcall nofinalslash (const char *src, char *dst) __attribute__ ((regparm(2)));
-extern "C" char *__stdcall rootdir (char *full_path) __attribute__ ((regparm(1)));
-
-/* String manipulation */
-extern "C" char *__stdcall strccpy (char *s1, const char **s2, char c);
-extern "C" int __stdcall strcasematch (const char *s1, const char *s2) __attribute__ ((regparm(2)));
-extern "C" int __stdcall strncasematch (const char *s1, const char *s2, size_t n) __attribute__ ((regparm(3)));
-extern "C" char *__stdcall strcasestr (const char *searchee, const char *lookfor) __attribute__ ((regparm(2)));
-
-/* Time related */
-void __stdcall totimeval (struct timeval *dst, FILETIME * src, int sub, int flag);
-long __stdcall to_time_t (FILETIME * ptr);
-void __stdcall to_timestruc_t (FILETIME * ptr, timestruc_t * out);
-void __stdcall time_as_timestruc_t (timestruc_t * out);
-
-void __stdcall set_console_title (char *);
-void early_stuff_init ();
-
-int __stdcall check_null_str (const char *name) __attribute__ ((regparm(1)));
-int __stdcall check_null_empty_str (const char *name) __attribute__ ((regparm(1)));
-int __stdcall check_null_empty_str_errno (const char *name) __attribute__ ((regparm(1)));
-int __stdcall check_null_str_errno (const char *name) __attribute__ ((regparm(1)));
-int __stdcall __check_null_invalid_struct (const void *s, unsigned sz) __attribute__ ((regparm(2)));
-int __stdcall __check_null_invalid_struct_errno (const void *s, unsigned sz) __attribute__ ((regparm(2)));
-int __stdcall __check_invalid_read_ptr_errno (const void *s, unsigned sz) __attribute__ ((regparm(2)));
-
-#define check_null_invalid_struct(s) \
- __check_null_invalid_struct ((s), sizeof (*(s)))
-#define check_null_invalid_struct_errno(s) \
- __check_null_invalid_struct_errno ((s), sizeof (*(s)))
-
-#define set_winsock_errno() __set_winsock_errno (__FUNCTION__, __LINE__)
-void __set_winsock_errno (const char *fn, int ln) __attribute__ ((regparm(2)));
-
-extern bool wsock_started;
-
-/* Printf type functions */
-extern "C" void __api_fatal (const char *, ...) __attribute__ ((noreturn));
-extern "C" int __small_sprintf (char *dst, const char *fmt, ...) /*__attribute__ ((regparm (2)))*/;
-extern "C" int __small_vsprintf (char *dst, const char *fmt, va_list ap) /*__attribute__ ((regparm (3)))*/;
-extern void multiple_cygwin_problem (const char *, unsigned, unsigned);
-
-extern "C" void __malloc_lock (struct _reent *);
-extern "C" void __malloc_unlock (struct _reent *);
-
-class path_conv;
-int __stdcall stat_worker (const char *name, struct __stat64 *buf, int nofollow,
- path_conv *pc = NULL) __attribute__ ((regparm (3)));
-
-/**************************** Exports ******************************/
-
-extern "C" {
-int cygwin_select (int , fd_set *, fd_set *, fd_set *,
- struct timeval *to);
-int cygwin_gethostname (char *__name, size_t __len);
-
-int kill_pgrp (pid_t, int);
-int _kill (int, int);
-int _raise (int sig);
-
-extern DWORD binmode;
-extern char _data_start__, _data_end__, _bss_start__, _bss_end__;
-extern void (*__CTOR_LIST__) (void);
-extern void (*__DTOR_LIST__) (void);
-extern SYSTEM_INFO system_info;
-};
-
-/*************************** Unsorted ******************************/
-
-#define WM_ASYNCIO 0x8000 // WM_APP
-
-/* Note that MAX_PATH is defined in the windows headers */
-/* There is also PATH_MAX and MAXPATHLEN.
- PATH_MAX is from Posix and does *not* include the trailing NUL.
- MAXPATHLEN is from Unix.
-
- Thou shalt use MAX_PATH throughout. It avoids the NUL vs no-NUL
- issue and is neither of the Unixy ones [so we can punt on which
- one is the right one to use]. */
-
-#define STD_RBITS (S_IRUSR | S_IRGRP | S_IROTH)
-#define STD_WBITS (S_IWUSR)
-#define STD_XBITS (S_IXUSR | S_IXGRP | S_IXOTH)
-#define NO_W ~(S_IWUSR | S_IWGRP | S_IWOTH)
-#define NO_R ~(S_IRUSR | S_IRGRP | S_IROTH)
-#define NO_X ~(S_IXUSR | S_IXGRP | S_IXOTH)
-
-/* The title on program start. */
-extern char *old_title;
-extern BOOL display_title;
-
-extern HANDLE hMainThread;
-extern HANDLE hMainProc;
-
-extern bool cygwin_testing;
-extern unsigned _cygwin_testing_magic;
-extern HMODULE cygwin_hmodule;
-
-#define winsock2_active (wsadata.wVersion >= 512)
-#define winsock_active (wsadata.wVersion < 512)
-extern struct WSAData wsadata;
-
-#endif /* defined __cplusplus */
diff --git a/winsup/cygwin/winver.rc b/winsup/cygwin/winver.rc
deleted file mode 100644
index 6a265cbd7..000000000
--- a/winsup/cygwin/winver.rc
+++ /dev/null
@@ -1,53 +0,0 @@
-#include <winver.h>
-#include <cygwin/version.h>
-
-#define STRINGIFY1(x) #x
-#define STRINGIFY(x) STRINGIFY1(x)
-
-#define CYGWIN_DLL_NAME CYGWIN_VERSION_DLL_IDENTIFIER STRINGIFY(.dll)
-
-#define CYGWIN_REGISTRY_KEY CYGWIN_INFO_CYGNUS_REGISTRY_NAME "\\" \
- CYGWIN_INFO_CYGWIN_REGISTRY_NAME
-
-#define CYGWIN_API_VERSION STRINGIFY(CYGWIN_VERSION_API_MAJOR) "." \
- STRINGIFY(CYGWIN_VERSION_API_MINOR)
-
-#define CYGWIN_BUILD_DATE_TIME STRINGIFY(CYGWIN_BUILD_DATE) " " \
- STRINGIFY(CYGWIN_BUILD_TIME)
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION CYGWIN_VERSION_DLL_MAJOR,CYGWIN_VERSION_DLL_MINOR,0,0
- PRODUCTVERSION CYGWIN_VERSION_DLL_MAJOR,CYGWIN_VERSION_DLL_MINOR,0,0
- FILEFLAGSMASK 0x3fL
-#ifdef DEBUGGING
- FILEFLAGS VS_FF_DEBUG
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS VOS__WINDOWS32
- FILETYPE VFT_DLL
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904B0"
- BEGIN
- VALUE "CompanyName", "Red Hat"
- VALUE "FileDescription", "Cygwin\256 POSIX Emulation DLL"
- VALUE "FileVersion", STRINGIFY(CYGWIN_VERSION)
- VALUE "InternalName", CYGWIN_DLL_NAME
- VALUE "LegalCopyright", "Copyright \251 Red Hat, Inc. 1996-2002"
- VALUE "OriginalFilename", CYGWIN_DLL_NAME
- VALUE "ProductName", "Cygwin"
- VALUE "ProductVersion", STRINGIFY(CYGWIN_VERSION)
- VALUE "APIVersion", CYGWIN_API_VERSION
- VALUE "SharedMemoryVersion", STRINGIFY(CYGWIN_VERSION_SHARED_DATA)
- VALUE "RegistryKey", CYGWIN_REGISTRY_KEY
- VALUE "BuildDate", CYGWIN_BUILD_DATE_TIME
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
diff --git a/winsup/cygwin/wsock_event.h b/winsup/cygwin/wsock_event.h
deleted file mode 100644
index 3f8638134..000000000
--- a/winsup/cygwin/wsock_event.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* wsock_event.h: Defining the wsock_event class
-
- Copyright 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. */
-
-#ifndef __WSOCK_EVENT_H__
-#define __WSOCK_EVENT_H__
-
-class wsock_event
-{
- WSAEVENT event;
- WSAOVERLAPPED ovr;
-public:
- wsock_event () : event (NULL) {};
- ~wsock_event ()
- {
- if (event)
- WSACloseEvent (event);
- event = NULL;
- };
-
- /* The methods are implemented in net.cc */
- LPWSAOVERLAPPED prepare ();
- int wait (int socket, LPDWORD flags);
-};
-
-#endif /* __WSOCK_EVENT_H__ */
diff --git a/winsup/doc/ChangeLog b/winsup/doc/ChangeLog
deleted file mode 100644
index 2e76ede2f..000000000
--- a/winsup/doc/ChangeLog
+++ /dev/null
@@ -1,123 +0,0 @@
-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 4be5f06e5..000000000
--- a/winsup/doc/Makefile.in
+++ /dev/null
@@ -1,121 +0,0 @@
-# -*- Makefile -*- for winsup/doc
-# Copyright (c) 1998-2000,2001 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@
-
-SGMLDIRS = -d $(srcdir) -d $(utils_source) -d $(cygwin_source)
-
-# These *.info targets don't actually work, so remove them for now.
-# Put them back when we figure out what to do with them. (davisb)
-#DOC=faq.txt faq.info readme.txt readme.info
-DOC=faq.txt readme.txt
-HTMLDOC=faq.html readme.html
-
-CC:=@CC@
-CC_FOR_TARGET:=@CC@
-exeext:=@build_exeext@
-
-MAKEINFO:=makeinfo
-TEXI2DVI:=texi2dvi
-TEXI2HTML:=texi2html
-
-include $(srcdir)/../Makefile.common
-
-TOCLEAN:=faq.txt ./*.html readme.txt doctool.o doctool \
- cygwin-ug.sgml cygwin-ug-net.sgml
-
-.SUFFIXES:
-
-# You can add cygwin-api/cygwin-api.html if you want to.
-all : \
- cygwin-ug/cygwin-ug.html \
- cygwin-ug-net/cygwin-ug-net.html \
- cygwin-api-int/cygwin-api-int.html \
- cygwin-api/cygwin-api.html \
- $(DOC) \
- $(HTMLDOC)
-
-clean:
- rm -f $(TOCLEAN)
-
-install: all
-
-cygwin-ug/cygwin-ug.html : cygwin-ug.sgml doctool
- -db2html $<
-
-cygwin-ug.sgml : cygwin-ug.in.sgml ./doctool Makefile
- -./doctool -m $(SGMLDIRS) -s $(srcdir) -o $@ $<
-
-cygwin-ug-net/cygwin-ug-net.html : cygwin-ug-net.sgml doctool
- -db2html $<
-
-cygwin-ug-net.sgml : cygwin-ug-net.in.sgml ./doctool Makefile
- -./doctool -m $(SGMLDIRS) -s $(srcdir) -o $@ $<
-
-cygwin-api/cygwin-api.html : cygwin-api.sgml
- -db2html $<
-
-cygwin-api.sgml : cygwin-api.in.sgml ./doctool Makefile
- -./doctool -m $(SGMLDIRS) -s $(srcdir) -o $@ $<
-
-cygwin-api-int/cygwin-api-int.html : cygwin-api-int.sgml
- -db2html $<
-
-cygwin-api-int.sgml : cygwin-api.in.sgml ./doctool Makefile
- -./doctool -i -m $(SGMLDIRS) -s $(srcdir) -b cygwin-api-int -o $@ $<
-
-./doctool : doctool.c
- gcc -g $< -o $@
-
-%.dvi: %.sgml
- -db2dvi $<
-
-%.rtf: %.sgml
- -db2rtf $<
-
-%.ps: %.sgml
- -db2ps $<
-
-%.pdf: %.ps
- -ps2pdf $< $@
-
-%.info: %.texinfo
- -$(MAKEINFO) -I $(srcdir) $<
-
-%.txt: %.texinfo
- -$(MAKEINFO) -I $(srcdir) $<
-
-%.html: %.texinfo
- -$(TEXI2HTML) -I $(srcdir) $<
-
-readme.txt: $(srcdir)/readme.texinfo $(srcdir)/*.texinfo
- -$(MAKEINFO) -I$(srcdir) --no-split --no-headers $< -o - |\
- sed '/^Concept Index/,$$d' > $@
-
-faq.html: $(srcdir)/faq.texinfo $(srcdir)/*.texinfo
- -rm -f faq_toc.html; \
- for i in $(srcdir)/*.texinfo ; do \
- sed < $$i -e 's?@file{\([fth]*p://[^}]*\)}?@strong{<A HREF="\1">\1</A>}?' \
- -e 's?\([.+a-zA-Z0-9-]*@@[.a-zA-Z0-9-]*[a-zA-Z0-9]\)?<A HREF="mailto:\1">\1</A>?' >./`basename $$i` ; done; \
- $(TEXI2HTML) -split_chapter ./faq.texinfo; \
- rm -f *.texinfo; \
- [ -r faq_toc.html ] && mv faq_toc.html faq.html; exit 0
-
-TBFILES = cygwin-ug-net.dvi cygwin-ug-net.rtf cygwin-ug-net.ps \
- cygwin-ug-net.pdf cygwin-ug-net.sgml \
- cygwin-api.dvi cygwin-api.rtf cygwin-api.ps \
- cygwin-api.pdf cygwin-api.sgml
-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
diff --git a/winsup/doc/calls.texinfo b/winsup/doc/calls.texinfo
deleted file mode 100644
index 244f8fc2e..000000000
--- a/winsup/doc/calls.texinfo
+++ /dev/null
@@ -1,707 +0,0 @@
-@chapter What Unix API calls are supported by Cygwin?
-
-This is the beginning of documentation listing the calls supported
-by the Cygwin library.
-
-All POSIX.1/1996 and ANSI C calls are listed in this file. Note that
-while almost all POSIX.1/1990 calls are included in Cygwin, most
-POSIX.1/1996 calls are not (yet at least!). Additional Unix
-compatibility calls and extended libc/libm calls are provided by
-Cygwin but may or may not be listed yet.
-
-To see if a function is implemented but not listed here, check for the
-presence of the call in the file winsup/cygwin.din in the sources. In
-addition, you may want to read the source code corresponding to the call
-to verify that it is not a stub. Finally, libc/libm functions
-(including extended calls not listed here) may be documented in the
-newlib texinfo documentation.
-
-Calls are implemented on both Windows 95 and NT unless otherwise
-noted. Included are references to relevant standards, if any.
-Calls starting with "cygwin_" are Cygwin-specific calls.
-
-@section ANSI C Library Functions
-
-@strong{(Please note: This section has not yet been updated for the latest
-net release.)}
-
-@itemize @code
-
-@item libc stdio (newlib/libc/stdio)
-@itemize @code
-@item clearerr: C 4.9.10.1
-@item fclose: C 4.9.5.1, P 8.2.3.2
-@item feof: C 4.9.10.2
-@item ferror: C 4.9.10.3
-@item fflush: C 4.9.5.2, P 8.2.3.4
-@item fgetc: C 4.9.7.1, P 8.2.3.5
-@item fgetpos: C 4.9.9.1
-@item fgets: C 4.9.7.2, P 8.2.3.5
-@item fopen: C 4.9.5.3, P 8.2.3.1
-@item fprintf: C 4.9.7.3, P 8.2.3.6
-@item fputc: C 4.9.7.3, P 8.2.3.6
-@item fputs: C 4.9.7.4, P 8.2.3.6
-@item fread: C 4.9.8.1, P 8.2.3.5
-@item freopen: C 4.9.5.4, P 8.2.3.3
-@item fscanf: C 4.9.6.2, P 8.2.3.7
-@item fseek: C 4.9.9.2, P 8.2.3.7
-@item fsetpos: C 4.9.9.3
-@item ftell: C 4.9.9.4, P 8.2.3.10
-@item fwrite: C 4.9.8.2, P 8.2.3.6
-@item getc: C 4.9.7.5, P 8.2.3.5
-@item getchar: C 4.9.7.6, P 8.2.3.5
-@item gets: C 4.9.7.7, P 8.2.3.5
-@item perror: C 4.9.10.4, P 8.2.3.8
-@item printf: C 4.9.6.3, P 8.2.3.6
-@item putc: C 4.9.7.8, P 8.2.3.6
-@item putchar: C 4.9.7.9, P 8.2.3.6
-@item puts: C 4.9.7.10, P 8.2.3.6
-@item remove: C 4.9.4.1, P 8.2.4
-@item rename: C 4.9.4.2, P 5.5.3.1
-@item rewind: C 4.9.9.5, P 8.2.3.7
-@item scanf: C 4.9.6.4, P 8.2.3.5
-@item setbuf: C 4.9.5.5
-@item setvbuf: C 4.9.5.6
-@item sprintf: C 4.9.6.5
-@item sscanf: C 4.9.6.6
-@item tmpfile: C 4.9.4.3, P 8.2.3.9
-@item tmpnam: C 4.9.4.4, P 8.2.5
-@item vfprintf: C 4.9.6.7
-@item ungetc: C 4.9.7.11
-@item vprintf: C 4.9.6.8
-@item vsprintf: C 4.9.6.9
-@end itemize
-
-@item libc string (newlib/libc/string)
-@itemize @code
-@item memchr: C 4.11.5.1
-@item memcmp: C 4.11.4.1
-@item memcpy: C 4.11.2.1
-@item memmove: C 4.11.2.2
-@item memset: C 4.11.6.1
-@item strcat: C 4.11.3.1
-@item strchr: C 4.11.5.2
-@item strcmp: C 4.11.4.2
-@item strcoll: C 4.11.4.3
-@item strcpy: C 4.11.2.3
-@item strcspn: C 4.11.5.3
-@item strerror: C 4.11.6.2
-@item strlen: C 4.11.6.3
-@item strncat: C 4.11.3.2
-@item strncmp: C 4.11.3.2
-@item strncpy: C 4.11.2.4
-@item strpbrk: C 4.11.5.4
-@item strrchr: C 4.11.5.5
-@item strspn: C 4.11.5.6
-@item strstr: C 4.11.5.7
-@item strtok: C 4.11.5.8
-@item strxfrm: C 4.11.4.5
-@end itemize
-
-@item libc stdlib (newlib/libc/stdlib, environ.cc, newlib/libc/include/machine/setjmp.h newlib/libc/include/assert.h)
-@itemize @code
-@item abort: C 4.10.4.1, P 8.2.3.12
-@item abs: C 4.10.6.1
-@item assert: C 4.2.1.1
-@item atexit: C 4.10.4.2
-@item atof: C 4.10.1.1
-@item atoi: C 4.10.1.2
-@item atol: C 4.10.1.3
-@item bsearch: C 4.10.5.1
-@item calloc: C 4.10.3.1
-@item div: C 4.10.6.2
-@item exit: C 4.10.4.3, P 8.2.3.12
-@item free: C 4.10.3.2
-@item getenv: C 4.10.4.4, P 4.6.1.1
-@item labs: C 4.10.6.3
-@item ldiv: C 4.10.6.2
-@item longjmp: C 4.6.2.1
-@item malloc: C 4.10.3.3
-@item mblen: C 4.10.7.1
-@item mbstowcs: C 4.10.8.1
-@item mbtowc: C 4.10.7.2
-@item qsort: 4.10.5.2
-@item rand: C 4.10.2.1
-@item realloc: C 4.10.3.4
-@item setjmp: C 4.6.1.1
-@item srand: C 4.10.2.2
-@item strtod: C 4.10.1.4
-@item strtol: C 4.10.1.5
-@item strtoul: C 4.10.1.6
-@item system: C 4.10.4.5
-@item wcstombs: C 4.10.8.2
-@item wctomb: C 4.10.7.3
-@end itemize
-
-@item libc time (times.cc, newlib/libc/time)
-@itemize @code
-@item asctime: C 4.12.3.1
-@item gmtime: C 4.12.3.3
-@item localtime: C 4.12.3.4, P 8.1.1
-@item time: C 4.12.2.4, P 4.5.1.1
-@item clock: C 4.12.2.1
-@item ctime: C 4.12.3.2
-@item difftime: C 4.12.2.2
-@item mktime: C 4.12.2.3, P 8.1.1
-@item strftime: C 4.11.6.2
-@end itemize
-
-@item libc signals (signal.cc, newlib/libc/signal)
-@itemize @code
-@item raise: C 4.7.2.1
-@item signal: C 4.7.1.1
-@end itemize
-
-@item libc ctype (newlib/libc/ctype)
-@itemize @code
-@item isalnum: C 4.3.1.1
-@item isalpha: C 4.3.1.2
-@item iscntrl: C 4.3.1.3
-@item isdigit: C 4.3.1.4
-@item isgraph: C 4.3.1.5
-@item islower: C 4.3.1.6
-@item isprint: C 4.3.1.7
-@item ispunct: C 4.3.1.8
-@item isspace: C 4.3.1.9
-@item isupper: C 4.3.1.10
-@item isxdigit: C 4.3.1.11
-@item tolower: C 4.3.2.1
-@item toupper: C 4.3.2.2
-@end itemize
-
-@item libm math (newlib/libm/math)
-@itemize @code
-@item acos: C 4.5.2.1
-@item asin: C 4.5.2.2
-@item atan: C 4.5.2.3
-@item atan2: C 4.5.2.4
-@item ceil: C 4.5.6.1
-@item cos: C 4.5.2.5
-@item cosh: C 4.5.3.2
-@item exp: C 4.5.4.1
-@item fabs: C 4.5.6.2
-@item floor: C 4.5.6.3
-@item fmod: C 4.5.6.4
-@item frexp: C 4.5.4.2
-@item ldexp: C 4.5.4.3
-@item log: C 4.5.4.4
-@item log10: C 4.5.4.5
-@item modf: C 4.5.4.6
-@item pow: C 4.5.5.1
-@item sin: C 4.5.2.6
-@item sinh: C 4.5.3.2
-@item sqrt: C 4.5.5.2
-@item tan: C 4.5.2.7
-@item tanh: C 4.5.3.3
-@end itemize
-
-@item libc misc (newlib/libc/locale, gcc/ginclude/stdarg.h)
-@itemize @code
-@item localeconv: C 4.4.2.1
-@item setlocale: C 4.4.1.1, P 8.1.2.1
-@item va_arg: C 4.8.1.2
-@item va_end: C 4.8.1.3
-@item va_start: C 4.8.1.1
-@end itemize
-
-@section POSIX.1/96 Functions
-
-@strong{(Please note: This section has not yet been updated for the latest
-net release.)}
-
-@item Process Primitives (Section 3)
-@itemize @code
-@item fork: P 3.1.1.1
-@item execl: P 3.1.2.1
-@item execle: P 3.1.2.1
-@item execlp: P 3.1.2.1
-@item execv: P 3.1.2.1
-@item execve: P 3.1.2.1
-@item execvp: P 3.1.2.1
-@item pthread_atfork: P96 3.1.3.1 -- unimplemented
-@item wait: P 3.2.1.1
-@item waitpid: P 3.2.1.1
-@item _exit: P 3.2.2.1
-@item kill: P 3.3.2.1
-@item sigemptyset: P 3.3.3.1
-@item sigfillset: P 3.3.3.1
-@item sigaddset: P 3.3.3.1
-@item sigdelset: P 3.3.3.1
-@item sigismember: P 3.3.3.1
-@item sigaction: P 3.3.4.1
-@item pthread_sigmask: P96 3.3.5.1
-@item sigprocmask: P 3.3.5.1
-@item sigpending: P 3.3.6.1
-@item sigsuspend: P 3.3.7.1
-@item sigwait: P96 3.3.8.1 -- unimplemented
-@item sigwaitinfo: P96 3.3.8.1 -- unimplemented
-@item sigtimedwait: P96 3.3.8.1 -- unimplemented
-@item sigqueue: P96 3.3.9.1 -- unimplemented
-@item pthread_kill: P96 3.3.10.1
-@item alarm: P 3.4.1.1
-@item pause: P 3.4.2.1
-@item sleep: P 3.4.3.1
-@end itemize
-
-@item Process Environment (Section 4)
-@itemize @code
-@item getpid: P 4.1.1.1
-@item getppid: P 4.1.1.1
-@item getuid: P 4.2.1.1
-@item geteuid: P 4.2.1.1
-@item getgid: P 4.2.1.1
-@item getegid: P 4.2.1.1
-@item setuid: P 4.2.2.1 (stub on 9X, sets ENOSYS, returns zero)
-@item setgid: P 4.2.2.1 (stub on 9X, sets ENOSYS, returns zero)
-@item getgroups: P 4.2.3.1
-@item getlogin: P 4.2.4.1
-@item getlogin_r: P 4.2.4.1 -- unimplemented
-@item getpgrp: P 4.3.1.1
-@item setsid: P 4.3.2.1
-@item setpgid: P 4.3.3.1
-@item uname: P 4.4.1.1
-@item time: C 4.12.2.4, P 4.5.1.1
-@item times: P 4.5.2.1
-@item getenv: C 4.10.4.4, P 4.6.1.1
-@item ctermid: P 4.7.1.1
-@item ttyname: P 4.7.2.1
-@item ttyname_r: P 4.7.2.1 -- unimplemented
-@item isatty: P 4.7.2.1
-@item sysconf: P 4.8.1.1
-@end itemize
-
-@item Files and Directories (Section 5)
-@itemize @code
-@item opendir: P 5.1.2.1
-@item readdir: P 5.1.2.1
-@item readdir_r: P96 5.1.2.1 -- unimplemented
-@item rewinddir: P 5.1.2.1
-@item closedir: P 5.1.2.1
-@item chdir: P 5.2.1.1
-@item getcwd: P 5.2.2.1
-@item open: P 5.3.1.1
-@item creat: P 5.3.2.1
-@item umask: P 5.3.3.1
-@item link: P 5.3.4.1 (copy file in Win 95, and when link fails in NT)
-@item mkdir: P 5.4.1.1
-@item mkfifo: P 5.4.2.1 -- unimplemented!!!
-@item unlink: P 5.5.1.1
-@item rmdir: P 5.5.2.1
-@item rename: C 4.9.4.2, P 5.5.3.1
-@item stat: P 5.6.2.1
-@item fstat: P 5.6.2.1
-@item access: P 5.6.3.1
-@item chmod: P 5.6.4.1
-@item fchmod: P96 5.6.4.1
-@item chown: P 5.6.5.1 (stub in Win 95; always returns zero)
-@item utime: P 5.6.6.1
-@item ftruncate: P96 5.6.7.1
-@item pathconf: P 5.7.1.1
-@item fpathconf: P 5.7.1.1
-@end itemize
-
-@item Input and Output Primitives (Section 6)
-@itemize @code
-@item pipe: P 6.1.1.1
-@item dup: P 6.2.1.1
-@item dup2: P 6.2.1.1
-@item close: P 6.3.1.1
-@item read: P 6.4.1.1
-@item write: P 6.4.2.1
-@item fcntl: P 6.5.2.1 (note: fcntl(fd, F_GETLK,...) is not implemented (returns -1 with errno set to ENOSYS)).
-@item lseek: P 6.5.3.1 (note: only works correctly on binary files)
-@item fsync: P96 6.6.1.1
-@item fdatasync: P96 6.6.2.1 -- unimplemented
-@item aio_read: P96 6.7.2.1 -- unimplemented
-@item aio_write: P96 6.7.3.1 -- unimplemented
-@item lio_listio: P96 6.7.4.1 -- unimplemented
-@item aio_error: P96 6.7.5.1 -- unimplemented
-@item aio_return: P96 6.7.6.1 -- unimplemented
-@item aio_cancel: P96 6.7.7.1 -- unimplemented
-@item aio_suspend: P96 6.7.8.1 -- unimplemented
-@item aio_fsync: P96 6.7.9.1 -- unimplemented
-@end itemize
-
-@item Device- and Class-Specific Functions (Section 7)
-@itemize @code
-@item cfgetispeed: P96 7.1.3.1
-@item cfgetospeed: P96 7.1.3.1
-@item cfsetispeed: P96 7.1.3.1
-@item cfsetospeed: P96 7.1.3.1
-@item tcdrain: P 7.2.2.1
-@item tcflow: P 7.2.2.1
-@item tcflush: P 7.2.2.1
-@item tcgetattr: P96 7.2.1.1
-@item tcgetpgrp: P 7.2.3.1
-@item tcsendbreak: P 7.2.2.1
-@item tcsetattr: P96 7.2.1.1
-@item tcsetpgrp: P 7.2.4.1
-@end itemize
-
-@item Language-Specific Services for the C Programming Language
-(Section 8)
-@itemize @code
-@item abort: C 4.10.4.1, P 8.2.3.12
-@item asctime_r: P96 8.3.4.1 -- unimplemented
-@item ctime_r: P96 8.3.5.1 -- unimplemented
-@item exit: C 4.10.4.3, P 8.2.3.12
-@item fclose: C 4.9.5.1, P 8.2.3.2
-@item fdopen: P 8.2.2.1
-@item fflush: C 4.9.5.2, P 8.2.3.4
-@item fgetc: C 4.9.7.1, P 8.2.3.5
-@item fgets: C 4.9.7.2, P 8.2.3.5
-@item fileno: P 8.2.1.1
-@item flockfile: P96 8.2.6.1 -- unimplemented
-@item fopen: C 4.9.5.3, P 8.2.3.1
-@item fprintf: C 4.9.7.3, P 8.2.3.6
-@item fputc: C 4.9.7.3, P 8.2.3.6
-@item fputs: C 4.9.7.4, P 8.2.3.6
-@item fread: C 4.9.8.1, P 8.2.3.5
-@item freopen: C 4.9.5.4, P 8.2.3.3
-@item fscanf: C 4.9.6.2, P 8.2.3.7
-@item fseek: C 4.9.9.2, P 8.2.3.7
-@item ftell: C 4.9.9.4, P 8.2.3.10
-@item ftrylockfile: P96 8.2.6.1 -- unimplemented
-@item funlockfile: P96 8.2.6.1 -- unimplemented
-@item fwrite: C 4.9.8.2, P 8.2.3.6
-@item getc: C 4.9.7.5, P 8.2.3.5
-@item getc_unlocked: P96 8.2.7.1 -- unimplemented
-@item getchar: C 4.9.7.6, P 8.2.3.5
-@item getchar_unlocked: P96 8.2.7.1 -- unimplemented
-@item gets: C 4.9.7.7, P 8.2.3.5
-@item gmtime_r: P96 8.3.6.1 -- unimplemented
-@item localtime_r: P96 8.3.7.1 -- unimplemented
-@item perror: C 4.9.10.4, P 8.2.3.8
-@item printf: C 4.9.6.3, P 8.2.3.6
-@item putc: C 4.9.7.8, P 8.2.3.6
-@item putc_unlocked: P96 8.2.7.1 -- unimplemented
-@item putchar: C 4.9.7.9, P 8.2.3.6
-@item putchar_unlocked: P96 8.2.7.1 -- unimplemented
-@item puts: C 4.9.7.10, P 8.2.3.6
-@item rand_r: P96 8.3.8.1 -- unimplemented
-@item remove: C 4.9.4.1, P 8.2.4
-@item rewind: C 4.9.9.5, P 8.2.3.7
-@item scanf: C 4.9.6.4, P 8.2.3.5
-@item setlocale: C 4.4.1.1, P 8.1.2.1
-@item siglongjmp: P 8.3.1.1
-@item sigsetjmp: P 8.3.1.1
-@item strtok_r: P96 8.3.3.1 -- unimplemented
-@item tmpfile: C 4.9.4.3, P 8.2.3.9
-@item tmpnam: C 4.9.4.4, P 8.2.5
-@item tzset: P 8.3.2.1
-@end itemize
-
-@item System Databases (Section 9)
-@itemize @code
-@item getgrgid: P 9.2.1.1
-@item getgrgid_r: P96 9.2.1.1 -- unimplemented
-@item getgrnam: P 9.2.1.1
-@item getgrnam_r: P96 9.2.1.1 -- unimplemented
-@item getpwnam: P 9.2.2.1
-@item getpwnam_r: P96 9.2.2.1 -- unimplemented
-@item getpwuid: P 9.2.2.1
-@item getpwuid_r: P96 9.2.2.1 -- unimplemented
-@end itemize
-
-@item Synchronization (Section 11)
-@itemize @code
-@item pthread_cond_broadcast: P96 11.4.3.1
-@item pthread_cond_destroy: P96 11.4.2.1
-@item pthread_cond_init: P96 11.4.2.1
-@item pthread_cond_signal: P96 11.4.3.1
-@item pthread_cond_timedwait: P96 11.4.4.1
-@item pthread_cond_wait: P96 11.4.4.1
-@item pthread_condattr_destroy: P96 11.4.1.1 -- unimplemented
-@item pthread_condattr_getpshared: P96 11.4.1.1 -- unimplemented
-@item pthread_condattr_init: P96 11.4.1.1 -- unimplemented
-@item pthread_condattr_setpshared: P96 11.4.1.1 -- unimplemented
-@item pthread_mutex_destroy: P96 11.3.2.1
-@item pthread_mutex_init: P96 11.3.2.1
-@item pthread_mutex_lock: P96 11.3.3.1
-@item pthread_mutex_trylock: P96 11.3.3.1
-@item pthread_mutex_unlock: P96 11.3.3.1
-@item sem_close: P96 11.2.4.1 -- unimplemented
-@item sem_destroy: P96 11.2.2.1
-@item sem_getvalue: P96 11.2.8.1 -- unimplemented
-@item sem_init: P96 11.2.1.1
-@item sem_open: P96 11.2.3.1 -- unimplemented
-@item sem_post: P96 11.2.7.1
-@item sem_trywait: P96 11.2.6.1
-@item sem_unlink: P96 11.2.5.1 -- unimplemented
-@item sem_wait: P96 11.2.6.1
-@end itemize
-
-@item Memory Management (Section 12)
-@itemize @code
-@item mlock: P96 12.1.2.1 -- unimplemented
-@item mlockall: P96 12.1.1.1 -- unimplemented
-@item mmap: P96 12.2.1.1
-@item mprotect: P96 12.2.3.1
-@item msync: P96 12.2.4.1
-@item munlock: P96 12.1.2.1 -- unimplemented
-@item munlockall: P96 12.1.1.1 -- unimplemented
-@item munmap: P96 12.2.2.1
-@item shm_open: P96 12.3.1.1 -- unimplemented
-@item shm_unlink: P96 12.3.2.1 -- unimplemented
-@end itemize
-
-@item Execution Scheduling (Section 13)
-@itemize @code
-@item pthread_attr_getinheritsched: P96 13.5.1.1 -- unimplemented
-@item pthread_attr_getschedparam: P96 13.5.1.1 -- unimplemented
-@item pthread_attr_getschedpolicy: P96 13.5.1.1 -- unimplemented
-@item pthread_attr_getscope: P96 13.5.1.1 -- unimplemented
-@item pthread_attr_setinheritsched: P96 13.5.1.1
-@item pthread_attr_setschedparam: P96 13.5.1.1 -- unimplemented
-@item pthread_attr_setschedpolicy: P96 13.5.1.1 -- unimplemented
-@item pthread_attr_setscope: P96 13.5.1.1 -- unimplemented
-@item pthread_getschedparam: P96 13.5.2.1
-@item pthread_mutex_getprioceiling: P96 13.6.2.1 -- unimplemented
-@item pthread_mutex_setprioceiling: P96 13.6.2.1 -- unimplemented
-@item pthread_mutexattr_getprioceiling: P96 13.6.1.1 -- unimplemented
-@item pthread_mutexattr_getprotocol: P96 13.6.1.1 -- unimplemented
-@item pthread_mutexattr_setprioceiling: P96 13.6.1.1 -- unimplemented
-@item pthread_mutexattr_setprotocol: P96 13.6.1.1 -- unimplemented
-@item pthread_setschedparam: P96 13.5.2.1
-@item sched_get_priority_max: P96 13.3.6.1 -- unimplemented
-@item sched_get_priority_min: P96 13.3.6.1 -- unimplemented
-@item sched_getparam: P96 13.3.2.1 -- unimplemented
-@item sched_getscheduler: P96 13.3.4.1 -- unimplemented
-@item sched_rr_get_interval: P96 13.3.6.1 -- unimplemented
-@item sched_setparam: P96 13.3.1.1 -- unimplemented
-@item sched_setscheduler: P96 13.3.3.1 -- unimplemented
-@item sched_yield: P96 13.3.5.1 -- unimplemented
-@end itemize
-
-@item Clocks and Timers (Section 14)
-@itemize @code
-@item clock_getres: P96 14.2.1.1 -- unimplemented
-@item clock_gettime: P96 14.2.1.1 -- unimplemented
-@item clock_settime: P96 14.2.1.1 -- unimplemented
-@item nanosleep: P96 14.2.5.1 -- unimplemented
-@item timer_create: P96 14.2.2.1 -- unimplemented
-@item timer_delete: P96 14.2.3.1 -- unimplemented
-@item timer_getoverrun: P96 14.2.4.1 -- unimplemented
-@item timer_gettime: P96 14.2.4.1 -- unimplemented
-@item timer_settime: P96 14.2.4.1 -- unimplemented
-@end itemize
-
-@item Message Passing (Section 15)
-@itemize @code
-@item mq_close: P96 15.2.2.1 -- unimplemented
-@item mq_getattr: P96 15.2.8.1 -- unimplemented
-@item mq_notify: P96 15.2.6.1 -- unimplemented
-@item mq_open: P96 15.2.1.1 -- unimplemented
-@item mq_receive: P96 15.2.5.1 -- unimplemented
-@item mq_send: P96 15.2.4.1 -- unimplemented
-@item mq_setattr: P96 15.2.7.1 -- unimplemented
-@item mq_unlink: P96 15.2.3.1 -- unimplemented
-@end itemize
-
-@item Thread Management (Section 16)
-@itemize @code
-@item pthread_attr_destroy: P96 16.2.1.1
-@item pthread_attr_getdetachstate: P96 16.2.1.1 -- unimplemented
-@item pthread_attr_getstackaddr: P96 16.2.1.1 -- unimplemented
-@item pthread_attr_getstacksize: P96 16.2.1.1
-@item pthread_attr_init: P96 16.2.1.1
-@item pthread_attr_setdetachstate: P96 16.2.1.1 -- unimplemented
-@item pthread_attr_setstackaddr: P96 16.2.1.1 -- unimplemented
-@item pthread_attr_setstacksize: P96 16.2.1.1
-@item pthread_create: P96 16.2.2.1
-@item pthread_detach: P96 16.2.4.1 -- unimplemented
-@item pthread_equal: P96 16.2.7.1
-@item pthread_exit: P96 16.2.5.1
-@item pthread_join: P96 16.2.3.1 -- unimplemented
-@item pthread_once: P96 16.2.8.1 -- unimplemented
-@item pthread_self: P96 16.2.6.1
-@end itemize
-
-@item Thread-Specific Data (Section 17)
-@itemize @code
-@item pthread_getspecific: P96 17.1.2.1
-@item pthread_key_create: P96 17.1.1.1
-@item pthread_key_delete: P96 17.1.3.1
-@item pthread_setspecific: P96 17.1.2.1
-@end itemize
-
-@item Thread Cancellation (Section 18)
-@itemize @code
-@item pthread_cancel: P96 18.2.1.1 -- unimplemented
-@item pthread_cleanup_pop: P96 18.2.3.1 -- unimplemented
-@item pthread_cleanup_push: P96 18.2.3.1 -- unimplemented
-@item pthread_setcancelstate: P96 18.2.2.1 -- unimplemented
-@item pthread_setcanceltype: P96 18.2.2.1 -- unimplemented
-@item pthread_testcancel: P96 18.2.2.1 -- unimplemented
-@end itemize
-
-@section Misc Functions
-
-@strong{(Please note: This section has not yet been updated for the latest
-net release.)}
-
-@item Networking (net.cc) (Standardized by POSIX 1.g, which is probably still in draft?)
-@itemize @code
-@item accept
-@item bind
-@item connect
-@item getdomainname
-@item gethostbyaddr
-@item gethostbyname
-@item getpeername
-@item getprotobyname
-@item getprotobynumber
-@item getservbyname
-@item getservbyport
-@item getsockname
-@item getsockopt
-@item herror
-@item htonl
-@item htons
-@item inet_addr
-@item inet_makeaddr
-@item inet_netof
-@item inet_ntoa
-@item listen
-@item ntohl
-@item ntohs
-@item rcmd
-@item recv
-@item recvfrom
-@item rexec
-@item rresvport
-@item send
-@item sendto
-@item setsockopt
-@item shutdown
-@item socket
-@item socketpair
-@end itemize
-
-Of these networking calls, rexec, rcmd and rresvport are implemented
-in MS IP stack but may not be implemented in other vendors' stacks.
-
-@item Other
-@itemize @code
-@item acl
-@item aclcheck
-@item aclfrommode
-@item aclfrompbits
-@item aclfromtext
-@item aclsort
-@item acltomode
-@item acltopbits
-@item acltotext
-@item chroot (with restrictions)
-@item closelog
-@item cwait
-@item cygwin_conv_to_full_posix_path
-@item cygwin_conv_to_full_win32_path
-@item cygwin_conv_to_posix_path
-@item cygwin_conv_to_win32_path
-@item cygwin_logon_user
-@item cygwin_posix_path_list_p
-@item cygwin_posix_to_win32_path_list
-@item cygwin_posix_to_win32_path_list_buf_size
-@item cygwin_set_impersonation_token
-@item cygwin_split_path
-@item cygwin_win32_to_posix_path_list
-@item cygwin_win32_to_posix_path_list_buf_size
-@item cygwin_winpid_to_pid
-@item dlclose
-@item dlerror
-@item dlfork
-@item dlopen
-@item dlsym
-@item endgrent
-@item endhostent
-@item facl
-@item ffs
-@item fstatfs
-@item ftime
-@item get_osfhandle
-@item getdtablesize
-@item getgrent
-@item gethostname
-@item getitimer
-@item getmntent
-@item getpagesize
-@item getpgid
-@item getpwent
-@item gettimeofday: BSD
-@item grantpt
-@item initgroups (stub)
-@item ioctl
-@item killpg
-@item login
-@item logout
-@item lstat
-@item mknod (stub, sets ENOSYS, returns -1)
-@item memccpy
-@item nice
-@item openlog
-@item pclose
-@item popen
-@item ptsname
-@item putenv
-@item random
-@item readv
-@item realpath
-@item regfree
-@item rexec
-@item select
-@item setegid: SVR4 (stub on 9X, sets ENOSYS, returns zero)@item endpwent
-@item setenv
-@item seterrno
-@item seteuid (stub on 9X, sets ENOSYS, returns zero)
-@item sethostent
-@item setitimer
-@item setmntent
-@item setmode
-@item setpassent
-@item setpgrp
-@item setpwent
-@item settimeofday: BSD (stub, set ENOSYS, return -1)
-@item sexecl
-@item sexecle
-@item sexeclp
-@item sexeclpe
-@item sexeclpe
-@item sexecp
-@item sexecv
-@item sexecve
-@item sexecvpe
-@item sigpause
-@item spawnl (spawn calls are from Windows C library)
-@item spawnle
-@item spawnlp
-@item spawnlpe
-@item spawnv
-@item spawnve
-@item spawnvp
-@item spawnvpe
-@item srandom
-@item statfs
-@item strsignal
-@item strtosigno
-@item swab
-@item syslog
-@item timezone
-@item truncate (SVR4/4.3+BSD)
-@item ttyslot
-@item unlockpt
-@item unsetenv
-@item usleep
-@item utimes
-@item vfork: stub that calls fork
-@item vhangup (stub, sets ENOSYS, returns -1)
-@item wait3
-@item wait4
-@item wcscmp
-@item wcslen
-@item wprintf
-@item writev
-@end itemize
-
-@end itemize
-
diff --git a/winsup/doc/changes.texinfo b/winsup/doc/changes.texinfo
deleted file mode 100644
index 6e464784d..000000000
--- a/winsup/doc/changes.texinfo
+++ /dev/null
@@ -1,202 +0,0 @@
-@section Release Beta 20.1 (Dec 4 1998)
-
-This is a bug fix update to the Beta 20 release.
-
-The main change is an improved version of the Cygwin library although
-there are also a couple of other minor changes to the tools.
-
-@subsection Changes in specific tools:
-
-The "-mno-cygwin" flag to gcc now include the correct headers. In 20.0,
-it included the Cygwin headers which was incorrect.
-
-The "-pipe" flag to gcc works correctly now.
-
-The cygcheck program now reassures users that not finding cpp is the
-correct behavior.
-
-The "-b" flag to md5sum can now be used to generate correct checksums
-of binary files.
-
-The libtermcap library has been added to the compiler tools sources.
-It is the new source of the termcap library and /etc/termcap file.
-
-The less pager (using libtermcap) has been added to the binary
-distribution.
-
-@subsection Changes in the Cygwin API (cygwin.dll):
-
-This version of Cygwin is backwards-compatible with the beta 20 and 19
-releases. The library is now much more stable under Windows 9x and the
-bugs affecting configures under 9x (and NT to a lesser extent) have
-also been fixed.
-
-The bug that made it necessary to start the value of the CYGWIN
-environment variable with two leading spaces has been fixed.
-
-The serial support in the select call has been fixed.
-
-Handling of DLLs loaded by non-cygwin apps has been improved. Bugs in
-dlopen have been fixed.
-
-Passing _SC_CHILD_MAX to the sysconf function now yields CHILD_MAX (63)
-instead of _POSIX_CHILD_MAX (3).
-
-Several minor path bugs have been fixed. Including the one that
-caused "mkdir a/" to fail.
-
-The include file sys/sysmacros.h has been added. Added missing protos
-for wcslen and wcscmp to wchar.h.
-
-__P is now defined in include/sys/cdefs.h. To support that last change,
-the top-level Makefile.in now sets CC_FOR_TARGET and CXX_FOR_TARGET
-differently.
-
-Cygwin now exports the following newlib bessel functions: j1, jn, y1,
-yn.
-
-Several tty ioctl options have been added: TCGETA, TCSETA, TCSETAW, and
-TCSETAF.
-
-Several functions cope with NULL pointer references more gracefully.
-
-Problems with execution of relative paths via #! should be fixed.
-
-@section Release Beta 20 (Oct 30 1998)
-
-This is a significant update to the Beta 19 release. In addition to an
-EGCS-based compiler and updated tools, this release includes a new
-version of the Cygwin library that contains many improvements and
-bugfixes over the last one.
-
-@subsection The project has a new name!
-
-Starting with this release, we are retiring the "GNU-Win32" name for the
-releases. We have also dropped the "32" from Cygwin32. This means that
-you should now refer to the tools as "the Cygwin toolset", the library
-as "the Cygwin library" or "the Cygwin DLL", and the library's interface
-as "the Cygwin API".
-
-Because of this name change, we have changed any aspects of the library
-that involved the name "Cygwin32". For example, the CYGWIN32
-environment variable is now the CYGWIN environment variable. API
-functions starting with cygwin32_ are still available under that form
-for backwards-compatibility as well as under the new cygwin_-prefixed
-names. The same goes for the change of preprocessor define from
-__CYGWIN32__ to __CYGWIN__. We will remove the old names in a future
-release so please take the minute or two that it will take to remove
-those "32"s. Thanks and I apologize for the hassle this may cause
-people. We would have changed the name to "Bob" but that name's already
-taken by Microsoft... :-)
-
-Why change it? For one thing, not all of the software included in the
-distributions is GNU software, including the Cygwin library itself. So
-calling the project "GNU-Win32" has always been a bit of a misnomer. In
-addition, we think that calling the tools the "Cygwin tools" that use
-the "Cygwin library" will be less confusing to people.
-
-Also notice that we are now on the spiffy new sourceware.cygnus.com
-web/ftp site. The old address will work for some unknown period of
-time (hopefully at least until we get all of the mirrors adjusted).
-
-@subsection Changes in specific tools:
-
-The latest public EGCS release is now the basis for the compiler used
-in Cygwin distributions. As a result, EGCS 1.1 is the compiler in this
-release, with a few additional x86/Cygwin-related patches.
-
-Those of you who are more interested in native Windows development than
-in porting Unix programs will be glad to know that a new gcc flag
-"-mno-cygwin" will link in the latest Mingw32 libs and produce an
-executable that does not use Cygwin.
-
-All of the other development tools have been updated to their latest
-versions. The linker (ld) includes many important bug fixes. It is now
-possible to safely strip a DLL with a .reloc section. The windres
-resource compiler is significantly improved.
-
-Beta 20 also includes upgrades to a number of packages: ash-0.3.2-4,
-bash 2.02.1, grep-2.2, ncurses 4.2, and less 332. We have added bzip2
-0.9.0 to the distribution. And you'll now find that the df utility
-has joined its other friends from the fileutils package.
-
-The sh executable is still ash from the Debian Linux distribution but no
-longer has the problematic quoting bug that was present in the Beta 19
-release. Control-Cs in the bash shell no longer kill background tasks.
-
-Tcl/tk are upgraded to version 8.1a2 (with additional patches).
-Compatible versions of tix and itcl are included. These all include
-Cygwin-compatible configury files so you can do a Unix-style build of
-the Win32 ports of tcl/tk. expect has been upgraded to 5.26 with some
-additional Cygwin patches.
-
-In response to customer requests and feedback, Cygnus has developed a
-better graphical front end to GDB than GDBtk or WinGDB. This tcl-based
-GUI is shipping today to customers of the GNUPro Toolkit. The
-instrumentation changes to GDB and the tcl interpreter that was built
-into GDB are part of the GPL'd source base. But the tcl scripts are not
-being made available to the net at this time. For this reason, you will
-only find a command-line version of gdb in this Cygwin release.
-
-DJ Delorie has written a new "cygcheck" program that will print out
-useful information about how your Cygwin environment is set up, what
-DLLs a named executable is loading from where, etc. We hope this will
-make it easier to help diagnose common setup problems.
-
-The ps utility has been upgraded. It now has several options including
-shorter and longer output formats.
-
-@subsection Changes in the Cygwin API (cygwin.dll):
-
-This version of Cygwin is backwards-compatible with the beta 19 release.
-You can use the new "cygwin1.dll" with your old B19-compiled executables
-if you move the old "cygwinb19.dll" out of the way and install a copy
-of "cygwin1.dll" as "cygwinb19.dll".
-
-Quite a lot of the Cygwin internals have been rewritten or modified to
-address various issues. If you have a question about specific changes,
-the winsup/ChangeLog file in the development tools sources lists all
-changes made to the DLL over the last three years. Following are a few
-highlights:
-
-We are now using a new versioning scheme for Cygwin. There is now a
-separate version number for the DLL, the API, the shared memory region
-interfaces, and the registry interface. This will hopefully make it
-easier for multiple Cygwin toolsets to coexist in one user environment.
-
-Windows 98 is now supported (it is like Windows 95 from Cygwin's
-perspective). We still recommend upgrading to Windows NT.
-
-While there is still a lot left to do in improving Cygwin's runtime
-performance, we have put some effort into this prior to the B20 release.
-Hopefully you will find that the latest version of Cygwin is faster than
-ever. In addition, we have plugged several nasty handle leaks
-associated with opening/closing files and with using ttys.
-
-The lseek call now uses WriteFile to fill gaps with zeros whenever a
-write is done past an EOF, rather than leaving "undefined" data as Win32
-specifies.
-
-Significant work has been done to improve the Cygwin header files.
-
-The Cygwin Support for Unix-style serial I/O is much improved.
-
-Path handling has had another round of fixes/rewrites. We no longer use
-NT Extended Attributes by default for storing Unix permissions/execute
-status because the file NT creates on FAT partitions is not scalable to
-thousands of files (everything slows to a crawl).
-
-Signal handling has also gotten a fair amount of attention.
-Unfortunately, there are still some problems combining itimers and
-Windows 9x.
-
-The number of ttys has been upped from 16 to 128.
-
-New API calls included in the DLL: sethostent, endhostent.
-
-As mentioned earlier, all cygwin32_-prefixed functions are now exported
-with a cygwin_ prefix instead. Please adjust your code to call the
-newly named functions.
-
-reads of `slow' devices are now correctly interrupted by signals, i.e.
-a read will receive an EINTR.
diff --git a/winsup/doc/configure b/winsup/doc/configure
deleted file mode 100755
index eea87df57..000000000
--- a/winsup/doc/configure
+++ /dev/null
@@ -1,1067 +0,0 @@
-#! /bin/sh
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-
-# Defaults:
-ac_help=
-ac_default_prefix=/usr/local
-# Any additions from configure.in:
-
-# Initialize some variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
-exec_prefix=NONE
-host=NONE
-no_create=
-nonopt=NONE
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-target=NONE
-verbose=
-x_includes=NONE
-x_libraries=NONE
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
-ac_prev=
-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=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case "$ac_option" in
-
- -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 ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$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" ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir="$ac_optarg" ;;
-
- -disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_${ac_feature}='$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)
- # 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 << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --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
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host="$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" ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- 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)
- 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" ;;
-
- -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 ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
- exit 0 ;;
-
- -with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "with_${ac_package}='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=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" ;;
-
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
- ;;
-
- *)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
-
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
-do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
- esac
-done
-
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
-
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=cygwin-api.in.sgml
-
-# 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 its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
- 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
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
- else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
- fi
-fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
-else
- echo "creating cache $cache_file"
- > $cache_file
-fi
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
-
-
-
-
-
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-
-# Do some error checking and defaulting for the host and target type.
-# The inputs are:
-# configure --host=HOST --target=TARGET --build=BUILD NONOPT
-#
-# The rules are:
-# 1. You are not allowed to specify --host, --target, and nonopt at the
-# same time.
-# 2. Host defaults to nonopt.
-# 3. If nonopt is not specified, then host defaults to the current host,
-# as determined by config.guess.
-# 4. Target and build default to nonopt.
-# 5. If nonopt is not specified, then target and build default to host.
-
-# The aliases save the names the user supplied, while $host etc.
-# will get canonicalized.
-case $host---$target---$nonopt in
-NONE---*---* | *---NONE---* | *---*---NONE) ;;
-*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
-esac
-
-
-# Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:575: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
- case $nonopt in
- NONE)
- if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
- else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
- fi ;;
- *) host_alias=$nonopt ;;
- esac ;;
-esac
-
-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
-
-echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:596: checking target system type" >&5
-
-target_alias=$target
-case "$target_alias" in
-NONE)
- case $nonopt in
- NONE) target_alias=$host_alias ;;
- *) target_alias=$nonopt ;;
- esac ;;
-esac
-
-target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
-target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$target" 1>&6
-
-echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:614: checking build system type" >&5
-
-build_alias=$build
-case "$build_alias" in
-NONE)
- case $nonopt in
- NONE) build_alias=$host_alias ;;
- *) build_alias=$nonopt ;;
- esac ;;
-esac
-
-build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
-build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$build" 1>&6
-
-test "$host_alias" != "$target_alias" &&
- test "$program_prefix$program_suffix$program_transform_name" = \
- NONENONEs,x,x, &&
- program_prefix=${target_alias}-
-
-
-if test $host != $build; then
- ac_tool_prefix=${host_alias}-
-else
- ac_tool_prefix=
-fi
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:646: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="${ac_tool_prefix}gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_CC"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:678: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="gcc"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- CC="gcc"
-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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:714: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_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 $# -gt 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
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
- fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:768: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
-else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-O2"
- fi
- if test "$ac_test_CXXFLAGS" != set; then
- CXXFLAGS='$(CFLAGS)'
- fi
-else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
-fi
-
-
-
-
-trap '' 1 2 15
-cat > confcache <<\EOF
-# 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. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# 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.
-(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
- if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
-fi
-
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
-s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
-s%\[%\\&%g
-s%\]%\\&%g
-s%\$%$$%g
-EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-rm -f conftest.defs
-
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
-
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
-# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
-# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
-
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
-do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
-done
-
-ac_given_srcdir=$srcdir
-
-trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@host@%$host%g
-s%@host_alias@%$host_alias%g
-s%@host_cpu@%$host_cpu%g
-s%@host_vendor@%$host_vendor%g
-s%@host_os@%$host_os%g
-s%@target@%$target%g
-s%@target_alias@%$target_alias%g
-s%@target_cpu@%$target_cpu%g
-s%@target_vendor@%$target_vendor%g
-s%@target_os@%$target_os%g
-s%@build@%$build%g
-s%@build_alias@%$build_alias%g
-s%@build_cpu@%$build_cpu%g
-s%@build_vendor@%$build_vendor%g
-s%@build_os@%$build_os%g
-s%@CC@%$CC%g
-s%@build_exeext@%$build_exeext%g
-
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
- else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
- fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
- else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
- fi
-done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
-fi
-EOF
-
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
- fi
-
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
-
-
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
- esac
-
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
diff --git a/winsup/doc/configure.in b/winsup/doc/configure.in
deleted file mode 100644
index 503777724..000000000
--- a/winsup/doc/configure.in
+++ /dev/null
@@ -1,54 +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.12)
-AC_INIT(cygwin-api.in.sgml)
-
-AC_DEFUN(LIB_AC_PROG_CC,
-[AC_BEFORE([$0], [AC_PROG_CPP])dnl
-AC_CHECK_TOOL(CC, gcc, gcc)
-if test -z "$CC"; then
- AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
- test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
-fi
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-dnl Check whether -g works, even if CFLAGS is set, in case the package
-dnl plays around with CFLAGS (such as to build both debugging and
-dnl normal versions of a library), tasteless as that idea is.
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- AC_PROG_CC_G
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-O2"
- fi
- if test "$ac_test_CXXFLAGS" != set; then
- CXXFLAGS='$(CFLAGS)'
- fi
-else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
-fi
-])
-
-AC_CANONICAL_SYSTEM
-
-LIB_AC_PROG_CC
-
-AC_SUBST(build_exeext)
-
-AC_OUTPUT(Makefile)
diff --git a/winsup/doc/copy.texinfo b/winsup/doc/copy.texinfo
deleted file mode 100644
index 90dc078d1..000000000
--- a/winsup/doc/copy.texinfo
+++ /dev/null
@@ -1,382 +0,0 @@
-@chapter What are the copyrights ?
-
-@section The general idea
-
-Most of the tools are covered by the GNU General Public License (GPL),
-although some are public domain, and others have a X11-style
-copyright. To cover the GNU GPL
-requirements, the basic rule is if you give out any binaries, you must
-also make the source available. For the full details, be sure to
-read the text of the GNU GPL which follows.
-
-The Cygwin API library found in the winsup subdirectory of the
-source code is also covered by the GNU GPL. By default, all
-executables link against this library (and in the process include GPL'd
-Cygwin glue code). This means that unless you modify the tools
-so that compiled executables do not make use of the Cygwin library,
-your compiled programs will also have to be free software distributed
-under the GPL with source code available to all.
-
-Cygwin is currently available for proprietary use only through a
-proprietary-use license. Please contact sales@@cygnus.com for
-more information.
-
-In accordance with section 10 of the GPL, Cygnus permits programs whose
-sources are distributed under a license that complies with the Open
-Source definition to be linked with libcygwin.a without libcygwin.a
-itself causing the resulting program to be covered by the GNU GPL.
-
-This means that you can port an Open Source(tm) 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 DLL
-you must adhere to the terms of the GPL, i.e., you must provide sources
-for the cygwin DLL.
-
-See http://www.opensource.org/osd.html for the precise Open Source
-Definition referenced above.
-
-@section GNU GENERAL PUBLIC LICENSE
-@example
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 675 Mass Ave, Cambridge, MA 02139, 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
-
- Appendix: 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.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
-
- 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., 675 Mass Ave, Cambridge, MA 02139, 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) 19yy 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.
-
- <signature of Ty Coon>, 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.
-
-@end example
-
diff --git a/winsup/doc/cygwin-api.in.sgml b/winsup/doc/cygwin-api.in.sgml
deleted file mode 100644
index 06baf5247..000000000
--- a/winsup/doc/cygwin-api.in.sgml
+++ /dev/null
@@ -1,67 +0,0 @@
-<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
- <!ENTITY cygnus-copyright "<YEAR>1998</YEAR><HOLDER>Red Hat, Inc.</HOLDER>">
- <!ENTITY cygnus-code-copyright "
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-Copyright (C) 1998,2001 Red Hat, Inc.
-
-This is copyrighted software that may only
-be reproduced, modified, or distributed
-under license from Red Hat, Inc.
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-">
- ]>
-
-<book id="cygwin-api">
-
- <bookinfo>
- <date>1998-08-31</date>
- <title>Cygwin API Reference</title>
- <authorgroup>
- <author>
- <firstname>DJ</firstname>
- <surname>Delorie</surname>
- </author>
- <author>
- <firstname>Geoffrey</firstname>
- <surname>Noer</surname>
- </author>
- </authorgroup>
-
- DOCTOOL-INSERT-legal
-
- <revhistory>
- <revision>
- <revnumber>0.0</revnumber>
- <date>1998-08-31</date>
- <authorinitials>dj</authorinitials>
- <revremark>Initial revision</revremark>
- </revision>
- <revision>
- <revnumber>0.5.0</revnumber>
- <date>1998-12-17</date>
- <authorinitials>noer</authorinitials>
- <revremark>Add pthread, sem calls. Change revnumber to
- three-part number: Cygwin API major, Cygwin API minor, Doc rev
- number. Starts out at 0.5.0.</revremark>
- </revision>
- </revhistory>
- </bookinfo>
-
- <toc></toc>
-
-<chapter id="compatibility"><title>Compatibility</title>
-DOCTOOL-INSERT-std-ansi
-DOCTOOL-INSERT-std-posix
-DOCTOOL-INSERT-std-misc
-</chapter>
-
-<chapter id="cygwin-functions"><title>Cygwin Functions</title>
-
-<para>These functions are specific to Cygwin itself, and probably
-won't be found anywhere else. </para>
-
-DOCTOOL-INSERT-func-
-
-</chapter>
-
-</book>
diff --git a/winsup/doc/cygwin-ug-net.in.sgml b/winsup/doc/cygwin-ug-net.in.sgml
deleted file mode 100644
index 41e876f22..000000000
--- a/winsup/doc/cygwin-ug-net.in.sgml
+++ /dev/null
@@ -1,72 +0,0 @@
-<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
- <!ENTITY cygnus-copyright
- "<YEAR>1999,2000,2001</YEAR>
- <HOLDER>Red Hat, Inc.</HOLDER>">
- <!ENTITY cygnus-code-copyright "
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-Copyright (C) 1998, 1999,2000,2001 Red Hat, Inc.
-
-This is copyrighted software that may only
-be reproduced, modified, or distributed
-under license from Red Hat, Inc.
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-">
- ]>
-
-<book id="cygwin-ug-net">
-
- <bookinfo>
- <date>2001-22-03</date>
- <title>Cygwin User's Guide</title>
- <authorgroup>
- <author>
- <firstname>Corinna</firstname>
- <surname>Vinschen</surname>
- </author>
- <author>
- <firstname>Christopher</firstname>
- <surname>Faylor</surname>
- </author>
- <author>
- <firstname>DJ</firstname>
- <surname>Delorie</surname>
- </author>
- <author>
- <firstname>Pierre</firstname>
- <surname>Humblet</surname>
- </author>
- <author>
- <firstname>Geoffrey</firstname>
- <surname>Noer</surname>
- </author>
- </authorgroup>
-
-DOCTOOL-INSERT-legal
-
- <revhistory>
- <revision>
- <revnumber>0.0</revnumber>
- <date>1998-10-06</date>
- <authorinitials>noer</authorinitials>
- <revremark>Initial revision</revremark>
- </revision>
- <revision>
- <revnumber>20.1.0</revnumber>
- <date>1999-02-08</date>
- <authorinitials>Pierre.Humblet@eurecom.fr</authorinitials>
- <revremark>Expand, describe Cygwin 20.1</revremark>
- </revision>
- </revhistory>
- </bookinfo>
-
- <toc></toc>
-
-DOCTOOL-INSERT-overview
-
-DOCTOOL-INSERT-setup-net
-
-DOCTOOL-INSERT-using
-
-DOCTOOL-INSERT-programming
-
-</book>
diff --git a/winsup/doc/cygwin-ug.in.sgml b/winsup/doc/cygwin-ug.in.sgml
deleted file mode 100644
index 91054f324..000000000
--- a/winsup/doc/cygwin-ug.in.sgml
+++ /dev/null
@@ -1,71 +0,0 @@
-<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
- <!ENTITY cygnus-copyright "<YEAR>1999,2000,2001</YEAR>
- <HOLDER>Red Hat, Inc.</HOLDER>">
- <!ENTITY cygnus-code-copyright "
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.
-
-This is copyrighted software that may only
-be reproduced, modified, or distributed
-under license from Red Hat, Inc.
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-">
- ]>
-
-<book id="cygwin-ug">
-
- <bookinfo>
- <date>2001-22-03</date>
- <title>Cygwin User's Guide</title>
- <authorgroup>
- <author>
- <firstname>Corinna</firstname>
- <surname>Vinschen</surname>
- </author>
- <author>
- <firstname>Christopher</firstname>
- <surname>Faylor</surname>
- </author>
- <author>
- <firstname>DJ</firstname>
- <surname>Delorie</surname>
- </author>
- <author>
- <firstname>Pierre</firstname>
- <surname>Humblet</surname>
- </author>
- <author>
- <firstname>Geoffrey</firstname>
- <surname>Noer</surname>
- </author>
- </authorgroup>
-
-DOCTOOL-INSERT-legal
-
- <revhistory>
- <revision>
- <revnumber>0.0</revnumber>
- <date>1998-08-31</date>
- <authorinitials>dj</authorinitials>
- <revremark>Initial revision</revremark>
- </revision>
- <revision>
- <revnumber>20.1.0</revnumber>
- <date>1999-02-08</date>
- <authorinitials>Pierre.Humblet@eurecom.fr</authorinitials>
- <revremark>Expand, describe Cygwin 20.1</revremark>
- </revision>
- </revhistory>
- </bookinfo>
-
- <toc></toc>
-
-DOCTOOL-INSERT-overview
-
-DOCTOOL-INSERT-setup
-
-DOCTOOL-INSERT-using
-
-DOCTOOL-INSERT-programming
-
-</book>
diff --git a/winsup/doc/cygwinenv.sgml b/winsup/doc/cygwinenv.sgml
deleted file mode 100644
index bb391a592..000000000
--- a/winsup/doc/cygwinenv.sgml
+++ /dev/null
@@ -1,130 +0,0 @@
-<sect1 id="using-cygwinenv"><title>The <EnVar>CYGWIN</EnVar> environment
-variable</title>
-
-<para>The <EnVar>CYGWIN</EnVar> 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 <literal>no </literal>.</para>
-
-<itemizedlist Mark="bullet">
-<listitem>
-<para><FirstTerm>(no)binmode</FirstTerm> - if set, non-disk
-(e.g. pipe and COM ports) file opens default to binary mode
-(no CR/LF/Ctrl-Z translations) instead of text mode.
-Defaults to set (binary mode). This option must be set
-before starting a Cygwin shell to have an effect on redirection.
-</para>
-<warning><title>Warning!</title><para>If set in 12/98 b20.1, all files
-always open in binary mode.</para></warning>
-</listitem>
-<listitem>
-<para><FirstTerm>check_case:level</FirstTerm> - Controls the behaviour of
-Cygwin when a user tries to open or create a file using a case different from
-the case of the path as asved on the disk.
-<literal>level</literal> is one of <literal>relaxed</literal>,
-<literal>adjust</literal> and <literal>strict</literal>.</para>
-<itemizedlist Mark="bullet">
-<listitem>
-<para><FirstTerm>relaxed</FirstTerm> which is the default behaviour simply
-ignores case. That's the default for native Windows applications as well.</para>
-</listitem>
-<listitem>
-<para><FirstTerm>adjust</FirstTerm> behaves mostly invisible. The POSIX input
-path is internally adjusted in case, so that the resulting DOS path uses the
-correct case throughout. You can see the result when changing the directory
-using a wrong case and calling <command>/bin/pwd</command> afterwards.</para>
-</listitem>
-<listitem>
-<para><FirstTerm>strict</FirstTerm> results in a error message if the case
-isn't correct. Trying to open a file <filename>Foo</filename> while a file
-<filename>fOo</filename> exists results in a "no such file or directory"
-error. Trying to create a file <filename>BAR</filename> while a file
-<filename>Bar</filename> exists results in a "Filename exists with different
-case" error.</para>
-</listitem>
-</itemizedlist>
-</listitem>
-<listitem>
-<para><FirstTerm>(no)envcache</FirstTerm> - If set, environment variable
-conversions (between Win32 and POSIX) are cached. Note that this is may
-cause problems if the mount table changes, as the cache is not invalidated
-and may contain values that depend on the previous mount table
-contents. Defaults to set.</para>
-</listitem>
-<listitem>
-<para><FirstTerm>(no)export</FirstTerm> - if set, the final values of these
-settings are re-exported to the environment as $CYGWIN again.</para>
-</listitem>
-<listitem>
-<para><FirstTerm>error_start:filepath</FirstTerm> - if set, runs <filename>filepath</filename>
-when cygwin encounters a fatal error. This is useful for debugging.
-<filename>filepath</filename> is usually set to the path to the <filename>gdb</filename>
-program.</para>
-<para><FirstTerm>(no)glob[:ignorecase]</FirstTerm> - if set, command line arguments
-containing UNIX-style file wildcard characters (brackets, question mark,
-asterisk, escaped with \) are expanded into lists of files that match
-those wildcards.
-This is applicable only to programs running from a DOS command line prompt.
-Default is set.</para>
-<para>This option also accepts an optional <literal>[no]ignorecase</literal> modifer.
-If supplied, wildcard matching is case insensitive. The default is <literal>noignorecase</literal></para>
-</listitem>
-<listitem>
-<para><FirstTerm>(no)ntea</FirstTerm> - if set, use the full NT Extended
-Attributes to store UNIX-like inode information.
-This option only operates under Windows NT. Defaults to not set. </para>
-<Warning><Title>Warning!</Title> <para>This may create additional
-<emphasis>large</emphasis> files on non-NTFS partitions.</para></Warning>
-</listitem>
-<listitem>
-<para><FirstTerm>(no)ntsec</FirstTerm> - if set, use the NT security
-model to set UNIX-like permissions on files and processes. The
-file permissions can only be set on NTFS partitions. FAT doesn't
-support the NT file security. For more information, read the documentation
-in <citation>ntsec.sgml</citation>.</para>
-</listitem>
-<listitem>
-<para><FirstTerm>(no)smbntsec</FirstTerm> - if set, use `ntsec' on remote
-drives as well (this is the default). If you encounter problems with NT shares
-or Samba drives, setting this to `nosmbntsec' could help. In that case the
-permission and owner/group information is faked as on FAT partitions.
-A reason for a non working ntsec on remote drives could be insufficient
-permissions of the users. Since the needed user rights are somewhat dangerous
-(SeRestorePrivilege) it's not always an option to grant that rights to users.
-However, this shouldn't be a problem in NT domain environments.</para>
-</listitem>
-<listitem>
-<para><FirstTerm>(no)reset_com</FirstTerm> - 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.</para>
-</listitem>
-<listitem>
-<para><FirstTerm>(no)strip_title</FirstTerm> - if set, strips the directory
-part off the window title, if any. Default is not set.</para>
-</listitem>
-<listitem>
-<para><FirstTerm>(no)title</FirstTerm> - if set, the title bar
-reflects the name of the program currently running. Default is not
-set. Note that under Win9x the title bar is always enabled and it is
-stripped by default, but this is because of the way Win9x works. In
-order not to strip, specify <literal>title</literal> or <literal>title
-nostrip_title</literal>.</para>
-</listitem>
-<listitem>
-<para><FirstTerm>(no)tty</FirstTerm> - if set, Cygwin enables extra support
-(i.e., termios) for UNIX-like ttys.
-It is not compatible with some Windows programs.
-Defaults to not set, in which case the tty is opened in text mode
-with ^Z as EOF. Note that this has been changed such that ^D works as
-expected instead of ^Z, and is settable via stty.
-This option must be specified before starting a Cygwin shell
-and it cannot be changed in the shell.</para>
-</listitem>
-<listitem>
-<para><FirstTerm>(no)winsymlinks</FirstTerm> - if set, Cygwin creates
-symlinks as Windows shortcuts with a special header and the R/O attribute
-set. If not set, Cygwin creates symlinks as plain files with a magic number,
-a path and the system attribute set. Defaults to set.</para>
-</listitem>
-</itemizedlist>
-</sect1>
diff --git a/winsup/doc/dll.sgml b/winsup/doc/dll.sgml
deleted file mode 100644
index 274f12926..000000000
--- a/winsup/doc/dll.sgml
+++ /dev/null
@@ -1,120 +0,0 @@
-<sect1 id="dll"><title>Building and Using DLLs</title>
-
-<para>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:</para>
-
-<itemizedlist spacing="compact">
-<listitem><para> the exports </para></listitem>
-<listitem><para> the code and data </para></listitem>
-<listitem><para> the import library </para></listitem>
-</itemizedlist>
-
-<para>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.</para>
-
-<para>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
-<filename>dlltool</filename> program creates the exports section of
-the dll from your text file of exported symbols.</para>
-
-<para>The import library is a regular UNIX-like
-<filename>.a</filename> 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
-<filename>.exe</filename>. This is also generated by
-<filename>dlltool</filename>.</para>
-
-<sect2 id="dll-build"><title>Building DLLs</title>
-
-<para>OK, let's go through a simple example of how to build a dll.
-For this example, we'll use a single file
-<filename>myprog.c</filename> for the program
-(<filename>myprog.exe</filename>) and a single file
-<filename>mydll.c</filename> for the contents of the dll
-(<filename>mydll.dll</filename>).</para>
-
-<para>Now compile everything to objects:</para>
-
-<screen>
-gcc -c myprog.c
-gcc -c mydll.c
-</screen>
-
-<para>Unfortunately, the process for building a dll is, well, convoluted.
-You have to run five commands, like this:</para>
-
-<screen>
-gcc -s -Wl,--base-file,mydll.base -o mydll.dll mydll.o -Wl,-e,_mydll_init@12
-dlltool --base-file mydll.base --def mydll.def --output-exp mydll.exp --dllname mydll.dll
-gcc -s -Wl,--base-file,mydll.base,mydll.exp -o mydll.dll mydll.o -Wl,-e,_mydll_init@12
-dlltool --base-file mydll.base --def mydll.def --output-exp mydll.exp --dllname mydll.dll
-gcc -Wl,mydll.exp -o mydll.dll mydll.o -Wl,-e,_mydll_init@12
-</screen>
-
-<para>The extra steps give <filename>dlltool</filename> the
-opportunity to generate the extra sections (exports and relocation)
-that a dll needs. After this, you build the import library:</para>
-
-<screen>
-dlltool --def mydll.def --dllname mydll.dll --output-lib mydll.a
-</screen>
-
-<para>Now, when you build your program, you link against the import
-library:</para>
-
-<screen>
-gcc -o myprog myprog.o mydll.a
-</screen>
-
-<para>Note that we linked with <command>-e _mydll_init@12</command>.
-This tells the OS what the DLL's "entry point" is, and this is a
-special function that coordinates bringing the dll to life withing the
-OS. The minimum function looks like this:</para>
-
-<screen>
-#include &lt;windows.h&gt;
-
-int WINAPI
-mydll_init(HANDLE h, DWORD reason, void *foo)
-{
- return 1;
-}
-</screen>
-
-</sect2>
-
-<sect2 id="dll-link"><title>Linking Against DLLs</title>
-
-<para>If you have an existing DLL already, you need to build a
-Cygwin-compatible import library (The supplied ones should work, but
-you might not have them) to link against. Unfortunately, there is not
-yet any tool to do this automatically. However, you can get most of
-the way by creating a .def file with these commands (you might need to
-do this in <filename>bash</filename> for the quoting to work
-correctly):</para>
-
-<screen>
-echo EXPORTS > foo.def
-nm foo.dll | grep ' T _' | sed 's/.* T _//' >> foo.def
-</screen>
-
-<para>Note that this will only work if the DLL is not stripped.
-Otherwise you will get an error message: "No symbols in
-foo.dll".</para>
-
-<para>Once you have the <filename>.def</filename> file, you can create
-an import library from it like this:</para>
-
-<screen>
-dlltool --def foo.def --dllname foo.dll --output-lib foo.a
-</screen>
-
-</sect2>
-
-</sect1>
diff --git a/winsup/doc/doctool.c b/winsup/doc/doctool.c
deleted file mode 100644
index ae034f345..000000000
--- a/winsup/doc/doctool.c
+++ /dev/null
@@ -1,622 +0,0 @@
-/* doctool.c
-
- Copyright 1998,1999,2000,2001 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <dirent.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <utime.h>
-
-/* 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 <book id=\"book_id\">\n");
- printf("\n");
- printf("doctool looks for DOCTOOL-START and DOCTOOL-END lines in source,\n");
- printf("saves <foo id=\"bar\"> 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))
- {
- 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
-
-<sect1 id="dt-tags">
-this is the doctool tags section.
-</sect1>
-
- 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, "<book") || starts_with(line, "<BOOK")))
- {
- cmd = strchr(line, '>');
- if (cmd)
- {
- cmd++;
- fprintf(output_file, "<book id=\"%s\">", 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, "<!-- %s -->\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; i<count; i++)
- {
- s = sections[i];
- s->file->used = 1;
- fprintf(output_file, "<!-- %s -->\n", unprefix(s->file->filename));
- for (l=addend; l<s->num_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", &times);
-
- 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 = "<stdout>";
- }
-
- 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 <dj@cygnus.com>
-
-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 <book> 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:
-
-<foo id="frob-45">
- stuff goes here
-</foo>
-<bar id="frob-48">
- stuff goes here
-</bar>
-
-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 <sect1> 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
-<foo id="frob-45">
- stuff goes here
-</foo>
-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:
-
-<sect1 id="frob-45">
- some text
-</sect1>
-<sect1 id="add-frob-45">
- more text
-</sect1>
-
-This would yield:
-
-<sect1 id="frob-45">
- some text
- more text
-</sect1>
-
-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 <book> tag. db2html uses the <book> 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/faq.texinfo b/winsup/doc/faq.texinfo
deleted file mode 100644
index 3908f637a..000000000
--- a/winsup/doc/faq.texinfo
+++ /dev/null
@@ -1,18 +0,0 @@
-\input texinfo
-
-@title The Cygwin FAQ
-
-@subtitle (Not @emph{completely} updated for the latest net release, but still useful!)
-
-@author You can always find the latest version of this FAQ at @file{http://cygwin.com/faq/}.
-
-@setfilename faq.txt
-
-@include what.texinfo
-@include install.texinfo
-@include calls.texinfo
-@include how.texinfo
-@include relnotes.texinfo
-@include history.texinfo
-@include who.texinfo
-@include copy.texinfo
diff --git a/winsup/doc/fhandler-tut.txt b/winsup/doc/fhandler-tut.txt
deleted file mode 100644
index 213b32b20..000000000
--- a/winsup/doc/fhandler-tut.txt
+++ /dev/null
@@ -1,83 +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_*
-path.cc - 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 fhandler.h.
-
-First, update the comment about which files are where. We're adding
-fhandler_dev_zero as FH_DEV_ZERO. We're adding this as a "fast"
-device (it will never block) so we have to adjust FH_NDEV also.
-
-Later 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 path.cc to recognize when the user is trying
-to open "/dev/zero". Look in get_device_number; there's a long list
-of cases, just add one (I added one after "null"). Also remember to
-add an entry to the windows_device_names list in the right spot.
-
-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.sgml b/winsup/doc/filemodes.sgml
deleted file mode 100644
index b0bac2eef..000000000
--- a/winsup/doc/filemodes.sgml
+++ /dev/null
@@ -1,34 +0,0 @@
-<sect1 id="using-filemodes"><title>File permissions</title>
-
-<para>On Windows 9x systems, files are always readable, and Cygwin uses the
-native read-only mode 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 <command>chmod</command> can
-only affect the "w" mode, it silently ignores actions involving the other
-modes. This means that <command>ls -l</command>
-needs to open and read files. It can thus be relatively slow.</para>
-
-<para>Under NT, file permissions default to the same behavior as Windows
-9x but there is optional functionality in Cygwin that can make file
-systems behave more like on UNIX systems. This is turned on by adding
-the "ntea" option to the <EnVar>CYGWIN</EnVar> environment variable.</para>
-
-<para>When the "ntea" feature is activated, Cygwin will start with basic
-permissions as determined above, but can store POSIX file permissions in NT
-Extended Attributes. This feature works quite well on NTFS partitions
-because the attributes can be stored sensibly inside the normal NTFS
-filesystem structure. However, on a FAT partition, NT stores extended
-attributes in a flat file at the root of the partition called <filename>EA
-DATA. SF</filename>. This file can grow to extremely large sizes if you
-have a large number of files on the partition in question, slowing the
-system to a crawl. In addition, the <filename>EA DATA. SF</filename> file
-can only be deleted outside of Windows because of its "in use" status. For
-these reasons, the use of NT Extended Attributes is off by default in
-Cygwin. Finally, note that specifying "ntea" in <EnVar>CYGWIN</EnVar> has no
-effect under Windows 9x. </para>
-
-<para>Under NT, the test "[ -w filename]" is only true if filename is
-writable across the board, e.g. <command>chmod +w filename</command>. </para>
-
-</sect1>
-
diff --git a/winsup/doc/gcc.sgml b/winsup/doc/gcc.sgml
deleted file mode 100644
index 238babfa3..000000000
--- a/winsup/doc/gcc.sgml
+++ /dev/null
@@ -1,78 +0,0 @@
-<sect1 id="gcc"><title>Using GCC with Cygwin</title>
-
-<sect2 id="gcc-cons"><title>Console Mode Applications</title>
-
-<para>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:</para>
-
-<example>
-<title>Building Hello World with GCC</title>
-<screen>
-<prompt>C:\&gt;</prompt> <userinput>gcc hello.c -o hello.exe</userinput>
-<prompt>C:\&gt;</prompt> <userinput>hello.exe</userinput>
-Hello, World
-
-<prompt>C:\&gt;</prompt>
-</screen>
-</example>
-
-</sect2>
-
-<sect2 id="gcc-gui"><title>GUI Mode Applications</title>
-
-<para>Cygwin allows you to build programs with full access to the
-standard Windows 32-bit API, including the GUI functions as defined in
-any Microsoft or off-the-shelf publication. However, the process of
-building those applications is slightly different, as you'll be using
-the GNU tools instead of the Microsoft tools.</para>
-
-<para>For the most part, your sources won't need to change at all.
-However, you should remove all __export attributes from functions
-and replace them like this:</para>
-
-<screen>
-int foo (int) __attribute__ ((__dllexport__));
-
-int
-foo (int i)
-</screen>
-
-<para>For most cases, you can just remove the __export and leave it at
-that. For convenience sake, you might want to include the following
-code snippet when compiling GUI programs. If you don't, you will want
-to add "-e _mainCRTStartup" to your link line in your Makefile.</para>
-
-<screen>
-#ifdef __CYGWIN__
-WinMainCRTStartup() { mainCRTStartup(); }
-#endif
-</screen>
-
-<para>The Makefile is similar to any other UNIX-like Makefile,
-and like any other Cygwin makefile. The only difference is that you use
-<command>gcc -mwindows</command> to link your program into a GUI
-application instead of a command-line application. Here's an example:</para>
-
-<screen>
-myapp.exe : myapp.o myapp.res
- gcc -mwindows myapp.o myapp.res -o $@
-
-myapp.res : myapp.rc resource.h
- windres $< -O coff -o $@
-</screen>
-
-<para>Note the use of <filename>windres</filename> to compile the
-Windows resources into a COFF-format <filename>.res</filename> file.
-That will include all the bitmaps, icons, and other resources you
-need, into one handy object file. Normally, if you omitted the "-O
-coff" it would create a Windows <filename>.res</filename> format file,
-but we can only link COFF objects. So, we tell
-<filename>windres</filename> to produce a COFF object, but for
-compatibility with the many examples that assume your linker can
-handle Windows resource files directly, we maintain the
-<filename>.res</filename> naming convention. For more information on
-<filename>windres</filename>, consult the Binutils manual. </para>
-
-</sect2>
-</sect1>
diff --git a/winsup/doc/gdb.sgml b/winsup/doc/gdb.sgml
deleted file mode 100644
index 732004f49..000000000
--- a/winsup/doc/gdb.sgml
+++ /dev/null
@@ -1,88 +0,0 @@
-
-<sect1 id="gdb"><title>Debugging Cygwin Programs</title>
-
-<para>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
-<emphasis>debuggers</emphasis>. 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.
-</para>
-
-<para>Before you can debug your program, you need to prepare your
-program for debugging. What you need to do is add
-<literal>-g</literal> to all the other flags you use when compiling
-your sources to objects.</para>
-
-<example><title>Compiling with -g</title>
-<screen>
-<prompt>$</prompt> gcc -g -O2 -c myapp.c
-<prompt>$</prompt> gcc -g myapp.c -o myapp
-</screen>
-</example>
-
-<para>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.</para>
-
-<para>In Windows versions of GNUPro, GDB comes with a full-featured
-graphical interface. In Cygwin Net distributions, GDB is only
-available as a command-line tool. To invoke GDB, simply type
-<command>gdb myapp.exe</command> at the command prompt. It will
-display some text telling you about itself, then
-<literal>(gdb)</literal> 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 <command>run</command> or
-<command>help</command>. Oh <literal>:-)</literal> type
-<command>help</command> to get help on the commands you can type in,
-or read the <citation>GDB User's Manual</citation> for a complete
-description of GDB and how to use it.</para>
-
-<para>If your program crashes and you're trying to figure out why it
-crashed, the best thing to do is type <command>run</command> and let
-your program run. After it crashes, you can type
-<command>where</command> to find out where it crashed, or
-<command>info locals</command> to see the values of all the local
-variables. There's also a <command>print</command> that lets you look
-at individual variables or what pointers point to.</para>
-
-<para>If your program is doing something unexpected, you can use the
-<command>break</command> command to tell gdb to stop your program when it
-gets to a specific function or line number:</para>
-
-<example><title>"break" in gdb</title>
-<screen>
-<prompt>(gdb)</prompt> break my_function
-<prompt>(gdb)</prompt> break 47
-</screen>
-</example>
-
-<para>Now, when you type <command>run</command> 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
-<command>step</command> through your program's statements one at a
-time.</para>
-
-<para>Note that you may specify additional arguments to the
-<command>run</command> command to provide command-line arguments to
-your program. These two cases are the same as far as your program is
-concerned:</para>
-
-<example><title>Debugging with command line arguments</title>
-<screen>
-<prompt>$</prompt> myprog -t foo --queue 47
-
-<prompt>$</prompt> gdb myprog
-<prompt>(gdb)</prompt> run -t foo --queue 47
-</screen>
-</example>
-
-
-</sect1>
diff --git a/winsup/doc/history.texinfo b/winsup/doc/history.texinfo
deleted file mode 100644
index f5ae98780..000000000
--- a/winsup/doc/history.texinfo
+++ /dev/null
@@ -1,5 +0,0 @@
-@chapter History
-
-This section of the FAQ is no longer maintained.
-
-Instead, see @file{http://cygwin.com/history.html}.
diff --git a/winsup/doc/how-api.texinfo b/winsup/doc/how-api.texinfo
deleted file mode 100644
index b35ab4202..000000000
--- a/winsup/doc/how-api.texinfo
+++ /dev/null
@@ -1,293 +0,0 @@
-@section Cygwin API Questions
-
-@subsection How does everything work?
-
-There's a C library which provides a Unix-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 run on Unix 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/Unix translation
-layer, providing that dll changes stay backward-compatible.
-
-For a good overview of Cygwin, you may want to read the paper on Cygwin
-published by the Usenix Association in conjunction with the 2d Usenix NT
-Symposium in August 1998. It is available in html format on the project
-WWW site.
-
-@subsection 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/
-
-
-@subsection How is the DOS/Unix CR/LF thing handled?
-
-Let's start with some background.
-
-In UNIX, 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) written to the file will prepend a \r
-(carriage return) 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 dependant 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 easily mix Cygwin-ported
-Unix programs with generic Windows programs. As a result, Cygwin opens
-files in text mode as is normal under Windows. In the accompanying
-tools, tools that deal with binaries (e.g. objdump) operate in unix
-binary mode and tools that deal with text files (e.g. bash) operate in
-text mode.
-
-Some people push the notion of globally setting the default processing
-mode to binary via mount point options or by setting the CYGWIN
-environment variable. But that creates a different problem. In
-binary mode, the program receives all of the data in the file, including
-a \r. Since the programs will no longer deal with these properly for
-you, you would have to remove the \r from the relevant text files,
-especially scripts and startup resource files. This is a porter "cop
-out", forcing the user to deal with the \r for the porter.
-
-It is rather easy for the porter 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 @code{O_BINARY} to
-the second argument of an @code{open} call, or @code{"b"} to second
-argument of an @code{fopen} call. You can also call @code{setmode (fd,
-O_BINARY)}.
-
-Note that because the open/fopen switches are defined by ANSI, they
-exist under most flavors of Unix; open/fopen will just ignore the switch
-since they have no meaning to UNIX.
-
-Also note that @code{lseek} only works in binary mode.
-
-Explanation adapted from mailing list email by Earnie Boyd
-<earnie_boyd@@yahoo.com>.
-
-@subsection Is the Cygwin library multi-thread-safe?
-
-Multi-thread-safe support is turned on by default in 1.1.x releases
-(i.e., in the latest net release). That does not mean that it is bug
-free!
-
-There is also limited support for 'POSIX threads', see the file
-@code{cygwin.din} for the list of POSIX thread functions provided.
-
-@subsection Why is some functionality only supported in Windows NT?
-
-Windows 9x: n.
-32 bit extensions and a graphical shell for a 16 bit patch to an
-8 bit operating system originally coded for a 4 bit microprocessor,
-written by a 2 bit company that can't stand 1 bit of competition.
-
-But seriously, Windows 9x lacks most of the security-related calls and
-has several other deficiencies with respect to its version of the Win32
-API. See the calls.texinfo document for more information as to what
-is not supported in Win 9x.
-
-@subsection 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 childs
-.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.
-
-@subsection 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 @code{LS *.EXE} from DOS, it will do what you might
-expect.
-
-Beware: globbing uses @code{malloc}. If your application defines
-@code{malloc}, that will get used. This may do horrible things to you.
-
-@subsection How do symbolic links work?
-
-Cygwin knows of two ways to create symlinks.
-
-The old method is the only valid one up to but not including version 1.3.0.
-If it's enabled (from 1.3.0 on by setting `nowinsymlinks' in the environment
-variable CYGWIN) Cygwin 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.
-
-The new method which is introduced with Cygwin version 1.3.0 is enabled
-by default or 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, the old and the new symlinks can live peacefully together since Cygwin
-treats both as symlinks regardless of the setting of `(no)winsymlinks' in
-the environment variable CYGWIN.
-
-@subsection Why do some files, which are not executables have the 'x' type.
-
-When working out the unix-style attribute bits on a file, the library
-has to fill out some information not provided by the WIN32 API.
-
-It guesses that files ending in .exe and .bat are executable, as are
-ones which have a "#!" as their first characters.
-
-@subsection How secure is Cygwin in a multi-user environment?
-
-Cygwin is not secure in a multi-user environment. For
-example if you have a long running daemon such as "inetd"
-running as admin while ordinary users are logged in, or if
-you have a user logged in remotely while another user is logged
-into the console, one cygwin client can trick another into
-running code for it. In this way one user may gain the
-priveledge of another cygwin program running on the machine.
-This is because cygwin has shared state that is accessible by
-all processes.
-
-(Thanks to Tim Newsham (newsham@@lava.net) for this explanation).
-
-@subsection How do the net-related functions work?
-
-@strong{(Please note: This section has not yet been updated for the latest
-net release.)}
-
-The network support in Cygwin is supposed to provide the Unix API, not
-the Winsock API.
-
-There are differences between the semantics of functions with the same
-name under the API.
-
-E.g., the select system call on Unix can wait on a standard file handles
-and handles to sockets. The select call in winsock can only wait on
-sockets. Because of this, 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
-using the net support in Cygwin is wrong.
-
-But you can still use native Winsock, and use Cygwin. The functions
-which cygwin.dll exports are called 'cygwin_<name>'. There
-are a load of defines which map the standard Unix names to the names
-exported by the dll -- check out include/netdb.h:
-
-@example
-..etc..
-void cygwin_setprotoent (int);
-void cygwin_setservent (int);
-void cygwin_setrpcent (int);
-..etc..
-#ifndef __INSIDE_CYGWIN_NET__
-#define endprotoent cygwin_endprotoent
-#define endservent cygwin_endservent
-#define endrpcent cygwin_endrpcent
-..etc..
-@end example
-
-The idea is that you'll get the Unix->Cygwin mapping if you include
-the standard Unix header files. If you use this, you won't need to
-link with libwinsock.a - all the net stuff is inside the dll.
-
-The mywinsock.h file is a standard winsock.h which has been hacked to
-remove the bits which conflict with the standard Unix API, or are
-defined in other headers. E.g., in mywinsock.h, the definition of
-struct hostent is removed. This is because on a Unix box, it lives in
-netdb. It isn't a good idea to use it in your applications.
-
-As of the b19 release, this information may be slightly out of date.
-
-@subsection I don't want Unix sockets, how do I use normal Win32 winsock?
-
-@strong{(Please note: This section has not yet been updated for the latest
-net release.)}
-
-To use the vanilla Win32 winsock, you just need to #define Win32_Winsock
-and #include "windows.h" at the top of your source file(s). You'll also
-want to add -lwsock32 to the compiler's command line so you link against
-libwsock32.a.
-
-@subsection What version numbers are associated with Cygwin?
-
-@strong{(Please note: This section has not yet been updated for the latest
-net release.)}
-
-There is a cygwin.dll major version number that gets incremented
-every time we make a new Cygwin release available. This
-corresponds to the name of the release (e.g. beta 19's major
-number is "19"). There is also a cygwin.dll minor version number. If
-we release an update of the library for an existing release, the minor
-number would be incremented.
-
-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 compatibity version number. It is
-incremented when incompatible changes are made to the shared memory
-region or to any named shared mutexes, semaphores, etc.
-
-Finally there is a mount point registry version number which keeps track
-of non-backwards-compatible changes to the registry mount table layout.
-This has been "B15.0" since the beta 15 release.
-
-@subsection Why isn't _timezone set correctly?
-
-@strong{(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.
-
-@subsection Is there a mouse interface?
-
-There is no way to capture mouse events from Cygwin. There are
-currently no plans to add support for this.
-
diff --git a/winsup/doc/how-programming.texinfo b/winsup/doc/how-programming.texinfo
deleted file mode 100644
index aa23b186f..000000000
--- a/winsup/doc/how-programming.texinfo
+++ /dev/null
@@ -1,593 +0,0 @@
-@section Programming Questions
-
-@subsection 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.
-
-There will be a separate web page where all the details are documented,
-but this is not prepared yet. Meanwhile, pore through the cygwin-apps
-mailing archives (start at @file{http://cygwin.com/lists.html}), and
-subscribe. Charles Wilson posted a short recipe of what's involved,
-using texinfo as an example,
-at @file{http://cygwin.com/ml/cygwin-apps/2000-11/msg00055.html}. This
-should give you an idea of what is required.
-
-You should announce your intentions to the general cygwin list, in case
-others were thinking the same thing.
-
-@subsection How do I contribute to Cygwin?
-
-If you want to contribute to Cygwin itself, see
-@file{http://cygwin.com/contrib.html}.
-
-@subsection 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 @samp{-s} option to gcc.
-
-@subsection 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.
-
-@subsection Where is Objective C?
-
-Objective C is not distributed with the Cygwin version of gcc, and there
-are no plans to do so. The gcc package maintainer had difficulty
-building it, and once built there were problems using it. It appears
-that there is only minimual support for the Objective C front-end in the
-main GCC distribution, anyway.
-
-@subsection Why is make behaving badly?
-
-First of all, if you are using @samp{make -j[N]}, then stop. It doesn't
-work well.
-
-Otherwise, read on...
-
-Make has two operating modes, UNIX and WIN32. You need to make sure
-that you are operating in the right mode.
-
-In UNIX mode, make uses sh.exe as a subshell. The path list separator
-is ':', '\' is the escape character, POSIX paths are expected, and
-Cygwin mounts will be understood. Use this for Makefiles written for
-UNIX.
-
-In WIN32 mode, make uses the "native" command shell (cmd.exe or
-command.com), with all the restrictions that implies. The path list
-separator is ';', the path separator is '\', "copy" and "del" work, but
-the Cygwin mount table is not understood. Use this for nmake-style
-Makefiles.
-
-The default mode for the Net Release of make (the one installed by
-@code{setup.exe}) is UNIX. The default mode for commercial releases to
-Redhat (formerly Cygnus) customers is WIN32.
-
-You can override the default by setting the environment variable
-MAKE_MODE to "UNIX" (actually case is not significant) or "WIN32"
-(actually anything other than "UNIX"). You can also specify the options
---unix or --win32 on the make command line.
-
-@subsection Why the undefined reference to @samp{WinMain@@16}?
-
-Try adding an empty main() function to one of your sources.
-
-Or, perhaps you have @samp{-lm} too early in the link command line. It
-should be at the end:
-
-@example
- bash$ gcc hello.c -lm
- bash$ ./a.exe
- Hello World!
-@end example
-
-works, but
-
-@example
- 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
-@end example
-
-This is an artifact of libm.a being a symbolic link to libcygwin.a.
-
-@subsection How do I use Win32 API calls?
-
-@strong{(Please note: This section has not yet been updated for the latest
-net release.)}
-
-It's pretty simple actually. 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 following libraries are available for use in this way:
-
-advapi32 largeint ole32 scrnsave vfw32
-cap lz32 oleaut32 shell32 win32spl
-comctl32 mapi32 oledlg snmp winmm
-comdlg32 mfcuia32 olepro32 svrapi winserve
-ctl3d32 mgmtapi opengl32 tapi32 winspool
-dlcapi mpr penwin32 th32 winstrm
-gdi32 msacm32 pkpd32 thunk32 wow32
-glaux nddeapi rasapi32 url wsock32
-glu32 netapi32 rpcdce4 user32 wst
-icmp odbc32 rpcndr uuid
-imm32 odbccp32 rpcns4 vdmdbg
-kernel32 oldnames rpcrt4 version
-
-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, IIRC, comdlg32.
-
-Note that you should never include -lkernel32 on your link line
-unless you are invoking ld directly. Do not include the same import
-library twice on your link line. Finally, 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.
-
-The first two are related to problems the linker has (as of b18 at least)
-when import libraries are referenced twice. Tables get messed up and
-programs crash randomly. The last point has to do with the fact that
-gcc processes the files listed on the command line in sequence and
-will only resolve references to libraries if they are given after
-the file that makes the reference.
-
-@subsection How do I compile a Win32 executable that doesn't use Cygwin?
-
-The -mno-cygwin flag to gcc makes gcc 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
-@file{http://www.mingw.org/index.shtml}.
-
-@subsection 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
-@file{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.
-
-@subsection Can I link with both MSVCRT*.DLL and cygwin1.dll?
-
-No, you must use one or the other, they are mutually exclusive.
-
-@subsection 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 commandline.
-
-@subsection 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.
-
-@subsection 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 Cygnus (err... Red Hat) can't agree to. Fortunately, we
-have our own Win32 headers which are pretty complete.
-
-@subsection How do I link against .lib files?
-
-@strong{(Please note: This section has not yet been updated for the latest
-net release.)}
-
-1. 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.
-2. Build a dummy 'LibMain'.
-3. Build a .def with all the exports you need.
-4. Link with your .lib using link.exe.
-
-or
-
-1. Extract all the object files from the .lib using LIB.EXE.
-2. Build a dummy C file referencing all the functions you need, either
-with a direct call or through an initialized function pointer.
-3. Build a dummy LibMain.
-4. Link all the objects with this file+LibMain.
-5. Write a .def.
-6. 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@@jacob.remcomp.fr) for this explanation)
-
-@subsection How do I rebuild the tools on my NT box?
-
-Install all required components in one directory (we'll call it /src).
-Ideally, you should check out what you need from CVS (@file{http://cygwin.com/cvs.html}) but
-otherwise, you can install the appropriate source packages from the
-cygwin distribution.
-
-As of this writing, you need to install at least the cygwin source
-package and the w32api source package.
-
-It is possible that the cygwin source package may require a newer
-version of the w32api package since the release of the packages is
-not always in lock step (another reason to just use CVS).
-
-You @emph{must} build cygwin in a separate directory from the source.
-So, create something like a /obj directory. You'll be performing
-your build in that directory:
-
-@example
-bash
-cd /obj
-/src/configure --prefix=/install -v > configure.log 2>&1
-make > make.log 2>&1
-make install > install.log 2>&1
-@end example
-
-Normally, this procedure will also attempt to build the documentation,
-which additionally requires db2html, and possibly other tools, which are
-not included in the Cygwin distribution. You can get db2html as part of
-docbook, from @file{http://sources.redhat.com/docbook-tools/}.
-
-To check a cygwin1.dll, run "make check" in the winsup/cygwin directory.
-If that works, install everything @emph{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 @emph{all} the
-places where the old dll was (if there is more than one on your
-machine). Then start up a bash window and see what happens. (Or better,
-run a cygwin program from the Windows command prompt.)
-
-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.
-
-@subsection How can I compile a powerpc NT toolchain?
-
-@strong{(Please note: This section has not yet been updated for the latest
-net release.)}
-
-Unfortunately, this will be difficult. It hasn't been built for
-some time (late 1996) since Microsoft has dropped development of
-powerpc NT. Exception handling/signals support semantics/args have been
-changed for x86 and not updated for ppc so the ppc specific support would
-have to be rewritten. We don't know of any other incompatibilities.
-Please send us patches if you do this work!
-
-@subsection How can I compile an Alpha NT toolchain?
-
-@strong{(Please note: This section has not yet been updated for the latest
-net release.)}
-
-We have not ported the tools to Alpha NT and do not have plans to
-do so at the present time. We would be happy to add support
-for Alpha NT if someone contributes the changes to us.
-
-@subsection How can I adjust the heap/stack size of an application?
-
-@strong{(Please note: This section has not yet been updated for the latest
-net release.)}
-
-Pass heap/stack linker arguments to gcc. To create foo.exe with
-a heap size of 1024 and a stack size of 4096, you would invoke
-gcc as:
-
-@code{gcc -Wl,--heap,1024,--stack,4096 -o foo foo.c}
-
-@subsection How can I find out which dlls are needed by an executable?
-
-@samp{objdump -p} provides this information, but is rather verbose.
-
-@samp{cygcheck} will do this much more concisely, and operates
-recursively, provided the command is in your path.
-
-Note there is currently a bug in cygcheck in that it will not report
-on a program in a Windows system dir (e.g., C:\Windows or C:\WINNT) even
-if it's in your path. To work around this, supply the full Win32 path
-to the executable, including the .exe extension:
-
-@example
-cygcheck c:\\winnt\\system32\\cmd.exe
-@end example
-
-(Note the windows path separator must be escaped if this is typed in
-bash.)
-
-@subsection How do I build a DLL?
-
-@strong{(Please note: This section has not yet been updated for the latest
-net release.)}
-
-There's documentation that explains the process on the main Cygwin
-project web page (http://cygwin.com/).
-
-@subsection How can I set a breakpoint at MainCRTStartup?
-
-@strong{(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.
-
-@subsection How can I build a relocatable dll?
-
-@strong{(Please note: This section has not yet been updated for the
-latest net release. However, there was a discussion on the cygwin
-mailing list recently that addresses this issue. Read
-@file{http://cygwin.com/ml/cygwin/2000-06/msg00688.html} and
-related messages.)}
-
-You must execute the following sequence of five commands, in this
-order:
-
-@example
-$(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
-@end example
-
-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.
-Tcl links against -lcygwin -ladvapi32 -luser32 -lgdi32 -lcomdlg32
--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 @samp{startup}, the string you should
-use for ENTRY in the above examples would be @samp{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 @samp{_impure_ptr}, and then initializing it in the
-entry function. Be careful not to export the global variable
-@samp{_impure_ptr} from your DLL; that is, do not put it in DEFFILE.
-
-@example
-/* 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. */
-@}
-@end example
-
-You may put an optional `--subsystem windows' on the $(LD) lines. The
-Tcl build does this, but I admit that I no longer remember whether
-this is important. 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.
-
-@subsection How can I debug what's going on?
-
-You can debug your application using @code{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).
-
-@subsection Can I use a system trace mechanism instead?
-
-Yes. You can use the @code{strace.exe} utility to run other cygwin
-programs with various debug and trace messages enabled. For information
-on using @code{strace}, see the Cygwin User's Guide or the file
-@code{winsup/utils/utils.sgml}.
-
-@subsection 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.
-
-@subsection The linker complains that it can't find something.
-
-@strong{(Please note: This section has not yet been updated for the latest
-net release.)}
-
-A common error is to put the library on the command line before
-the thing that needs things from it.
-
-This is wrong @code{gcc -lstdc++ hello.cc}.
-This is right @code{gcc hello.cc -lstdc++}.
-
-@subsection I use a function I know is in the API, but I still get a link error.
-
-@strong{(Please note: This section has not yet been updated for the latest
-net release.)}
-
-The function probably isn't declared in the header files, or
-the UNICODE stuff for it isn't filled in.
-
-@subsection Can you make DLLs that are linked against libc ?
-
-@strong{(Please note: This section has not yet been updated for the latest
-net release.)}
-
-Yes.
-
-@subsection Where is malloc.h?
-
-@strong{(Please note: This section has not yet been updated for the latest
-net release.)}
-
-Include stdlib.h instead of malloc.h.
-
-@subsection Can I use my own malloc?
-
-If you define a function called @code{malloc} in your own code, and link
-with the DLL, the DLL @emph{will} call your @code{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 @code{malloc} @emph{before} your main line is started.
-If you have written your own @code{malloc} to need some initialization
-to occur after @code{main} is called, then this will surely break.
-
-Moreover, there is an outstanding issue with @code{_malloc_r} in
-@code{newlib}. This re-entrant version of @code{malloc} will be called
-directly from within @code{newlib}, by-passing your custom version, and
-is probably incompatible with it. But it may not be possible to replace
-@code{_malloc_r} too, because @code{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.
-
-@subsection 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.
-
-@subsection 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.
-
-@subsection Where can I find info on x86 assembly?
-
-CPU reference manuals for Intel's current chips are available in
-downloadable PDF form on Intel's web site:
-
-@file{http://developer.intel.com/design/pro/manuals/}
-
-@subsection Shell scripts aren't running properly from my makefiles?
-
-If your scripts are in the current directory, you must have @samp{.}
-(dot) in your $PATH. (It is not normally there by default.) Otherwise,
-you would need to add /bin/sh in front of each and every shell script
-invoked in your Makefiles.
-
-@subsection What preprocessor do I need to know about?
-
-We use _WIN32 to signify access to the Win32 API and __CYGWIN__ for
-access to the Cygwin environment provided by the dll.
-
-We chose _WIN32 because this is what Microsoft defines in VC++ and
-we thought it would be a good idea for compatibility with VC++ code
-to follow their example. We use _MFC_VER to indicate code that should
-be compiled with VC++.
-
-@subsection How should I port my Unix GUI to Windows?
-
-There are two basic strategies for porting Unix GUIs to Windows.
-
-The first is to use a portable graphics library such as tcl/tk, X11, or
-V (and others?). Typically, you will end up with a GUI on Windows that
-requires some runtime support. With tcl/tk, you'll want to include the
-necessary library files and the tcl/tk DLLs. In the case of X11, you'll
-need everyone using your program to have an X11 server installed.
-
-The second method is to rewrite your GUI using Win32 API calls (or MFC
-with VC++). If your program is written in a fairly modular fashion, you
-may still want to use Cygwin if your program contains a lot of shared
-(non-GUI-related) code. That way you still gain some of the portability
-advantages inherent in using Cygwin.
-
-@subsection Why not use DJGPP ?
-
-DJGPP is a similar idea, but for DOS instead of Win32. DJGPP uses a
-"DOS extender" to provide a more reasonable operating interface for its
-applications. The Cygwin toolset doesn't have to do this since all of
-the applications are native WIN32. Applications compiled with the
-Cygwin tools can access the Win32 API functions, so you can write
-programs which use the Windows GUI.
-
-You can get more info on DJGPP by following
-@file{http://www.delorie.com/}.
diff --git a/winsup/doc/how-resources.texinfo b/winsup/doc/how-resources.texinfo
deleted file mode 100644
index c1236f7bc..000000000
--- a/winsup/doc/how-resources.texinfo
+++ /dev/null
@@ -1,123 +0,0 @@
-@section Where can I get more information?
-
-@subsection Where's the documentation?
-
-If you have installed Cygwin, you can find lots of documentation in
-@samp{/usr/doc/}. Many packages ship with standard documentation, you
-can find this in a directory @samp{/usr/doc/@emph{package_name}}. In
-addition, some packages have Cygwin specific instructions in a file
-@samp{/usr/doc/Cygwin/@emph{package_name}.README}.
-
-There are links to quite a lot of it on the main Cygwin project web
-page: @file{http://cygwin.com/}. 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
-@file{http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html}
-and an API Reference at
-@file{http://cygwin.com/cygwin-api/cygwin-api.html}.
-
-There is an interesting paper about Cygwin from the 1998 USENIX Windows
-NT Workshop Proceedings at
-@file{http://cygwin.com/usenix-98/cygwin.html}.
-
-You can find documentation for the individual GNU tools at
-@file{http://www.fsf.org/manual/}. (You should read GNU manuals from a
-local mirror, check @file{http://www.fsf.org/server/list-mirrors.html}
-for a list of them.)
-
-@subsection What Cygwin mailing lists can I join?
-
-Comprehensive information about the Cygwin mailing lists can be found at
-@file{http://cygwin.com/lists.html}.
-
-To subscribe to the main list, send a message to
-cygwin-subscribe@@cygwin.com. To unsubscribe from the
-main list, send a message to cygwin-unsubscribe@@cygwin.com.
-In both cases, the subject and body of the message are ignored.
-
-Similarly, to subscribe to the Cygwin annoucements list, send a message
-to cygwin-announce-subscribe@@cygwin.com. To unsubscribe,
-send a message to cygwin-announce-unsubscribe@@cygwin.com.
-
-If you are going to help develop the Cygwin library by volunteering for
-the project, you will want to subscribe to the Cygwin developers list,
-called cygwin-developers. If you are contributing to Cygwin tools &
-applications, rather than the library itself, then you should subscribe
-to cygwin-apps. The same mechanism as described for the first two lists
-works for these as well. Both cygwin-developers and cygwin-apps are
-by-approval lists.
-
-There is a searchable archive of the main mailing list at
-@file{http://cygwin.com/ml/cygwin/}. There is an alternate
-archive, also searchable, at @file{http://www.delorie.com/archives/}.
-You can also search at @file{http://www.google.com/} and include
-"cygwin" in the list of search terms.
-
-Cygwin mailing lists are not gatewayed to USENET, so anti-spam measures
-in your email address are neither required nor appreciated. Also, avoid
-sending HTML content to Cygwin mailing lists.
-
-@subsection Posting Guidelines (Or: Why won't you/the mailing list answer my questions?)
-
-If you follow these guidelines, you are much more likely to get a
-helpful response from the Cygwin developers and/or the Cygwin community at
-large:
-
-@itemize @bullet
-@item Read the User's Guide and the FAQ first.
-@item Check the mailing list archives. Your topic may have come up
-before. (It may even have been answered!) Use the search facilities
-at the links above. Try the alternate site if the main archive is not
-producing search results.
-@item Explain your problem carefully and completely. "I installed Blah
-and it doesn't work!" wastes everybody's time. It provides no
-information for anyone to help you with your problem. You should
-provide:
-
-@itemize @bullet
-@item A problem statement: How does it behave, how do you think it
-should behave, and what makes you think it's broken? (Oh yeah, and what
-is @emph{"it"}?)
-@item Information about your Windows OS ("Win95 OSR2" or "NT4/SP3" or
-"Win2K" or "Win98 SE" or ...).
-@item Details about your installation process, or attempts at same. (Internet or
-Directory install? If the former, exactly when and from what mirror?
-If the latter, which packages did you download? Which version of
-setup.exe? Any subsequent updates?)
-@item Details about your Cygwin setup, accomplished by @emph{pasting}
-the output of 'cygcheck -s -v -r' into your message. (Do not send the
-output as a file attachment.)
-@item A valid return address, so that a reply doesn't require manual editing of
-the 'To:' header.
-@end itemize
-
-@item Your message must be relevant to the list. Messages that are
-@emph{not} directly related to Cygwin are considered off-topic and are
-unwelcome. For example, the following are off-topic:
-
-@itemize @bullet
-@item General programming language questions
-@item General Windows programming questions
-@item General UNIX shell programming questions
-@item General application usage questions
-@item How to make millions by working at home
-@item Announcements from LaserJet toner cartridge suppliers
-@end itemize
-
-@end itemize
-
-If you do not follow the above guidelines, you may still elicit a
-response, but you may not appreciate it!
-
-Inquiries about support contracts and commercial licensing should go to
-info@@cygnus.com. If you want to purchase the Cygwin 1.0 CD-ROM, visit
-@file{http://www.cygnus.com/cygwin/} or write to
-cygwin-info@@cygnus.com. While not strictly @emph{unappreciated} in the
-main cygwin list, you'll get the information you need more quickly if
-you write to the correct address in the first place.
-
-Beyond that, perhaps nobody has time to answer your question. Perhaps
-nobody knows the answer.
-
diff --git a/winsup/doc/how-using.texinfo b/winsup/doc/how-using.texinfo
deleted file mode 100644
index e79d722f0..000000000
--- a/winsup/doc/how-using.texinfo
+++ /dev/null
@@ -1,706 +0,0 @@
-@section Using Cygwin
-
-@subsection Why can't my application locate cygncurses5.dll? or cygintl.dll? or cygreadline5.dll? or ...?
-
-If you upgraded recently, and suddenly vim (or some other Cygwin
-application) cannot find @code{cygncurses5.dll}, it means that you did
-not follow these instructions properly:
-@file{http://cygwin.com/ml/cygwin-announce/2001/msg00124.html}. To
-repair the damage, you must run Cygwin Setup again, and re-install the
-@samp{libncurses5} package.
-
-Note that Cygwin Setup won't show this option by default. In the
-``Select packages to install'' dialogue, click on the @samp{Full/Part}
-button. This lists all packages, even those that are already
-installed. Scroll down to locate the @samp{libncurses5} package.
-Click on the ``cycle'' glyph until it says ``Reinstall''. Continue
-with the installation.
-
-Similarly, if something cannot find @code{cygintl.dll}, then run
-Cygwin Setup and re-install the @samp{libintl} and @samp{libintl1}
-packages.
-
-For a detailed explanation of the general problem, and how to extend
-it to other missing DLLs (like cygreadline5.dll) and identify their
-containing packages, see
-@file{http://cygwin.com/ml/cygwin/2002-01/msg01619.html}.
-
-@subsection Why is Cygwin suddenly @emph{so} slow?
-
-If you recently upgraded the @samp{cygwin} package and suddenly
-@emph{every} command takes a @emph{very} long time, then you probably
-have the obsolete @code{//c} notation in your PATH. This now means
-the @emph{network share} @code{c}, which will slow things down
-tremendously if it does not exist. See then next FAQ entry.
-
-@subsection Why doesn't //c (for C:) work anymore?
-
-(Similarly for any drive letter, e.g. @code{//z} for @code{Z:})
-
-This ``feature'' has long been deprecated, and no longer works at all
-in the latest release. As of release 1.3.3, @code{//c} now means the
-@emph{network share} @code{c}.
-
-For a detailed discussion of why this change was made, and how deal
-with it now, refer to
-@file{http://sources.redhat.com/ml/cygwin/2001-09/msg00014.html}.
-
-@subsection 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
-@code{setup.exe}. The line is
-
-@example
- PATH="/usr/local/bin:/usr/bin:/bin:$PATH"
-@end example
-
-Effectively, this @strong{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 @strong{must} have @code{/usr/bin} in your PATH
-@strong{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.
-
-@subsection Bash says "command not found", but it's right there!
-
-If you compile a program, you might find that you can't run it:
-
-@example
- bash$ gcc -o hello hello.c
- bash$ hello
- bash: hello: command not found
-@end example
-
-Unlike Windows, bash does not look for programs in @samp{.} (the current
-directory) by default. You can add @samp{.} 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:
-
-@example
- bash$ gcc -o hello hello.c
- bash$ ./hello
- Hello World!
-@end example
-
-@subsection How do I convert between Windows and UNIX paths?
-
-Use the 'cygpath' utility. Type '@code{cygpath}' with no arguments to
-get usage information. For example (on my installation):
-@example
- bash$ cygpath --windows ~/.bashrc
- D:\starksb\.bashrc
- bash$ cygpath --unix C:/cygwin/bin/cygwin.bat
- /usr/bin/cygwin.bat
- bash$ cygpath --unix C:\\cygwin\\bin\\cygwin.bat
- /usr/bin/cygwin.bat
-@end example
-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.
-
-@subsection 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 correctly, or move your .bashrc to the top of the drive
-mounted as / in Cygwin.
-
-@subsection How can I get bash filename completion to be case insensitive?
-
-Add the following to your @code{~/.bashrc} file:
-
-@example
- shopt -s nocaseglob
-@end example
-
-and add the following to your @code{~/.inputrc} file:
-
-@example
- set completion-ignore-case on
-@end example
-
-@subsection 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:
-@example
- bash-2.03$ cd '/cygdrive/c/Program Files'
-@end example
-or
-@example
- bash-2.03$ cd /cygdrive/c/Program\ Files
-@end example
-
-@subsection Why can't I cd into a shortcut to a directory?
-
-This is only valid up to but not including version 1.3.0:
-
-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.
-
-Some people have suggested replacing the current symbolic link scheme
-with shortcuts. The major problem with this is that .LNK files would
-then be used to symlink Cygwin paths that may or may not be valid
-under native Win32 non-Cygwin applications such as Explorer.
-
-Since version 1.3.0, Cygwin treats shortcuts as symlinks.
-
-@subsection 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 @samp{-follow} option. This behavior is different than most
-other UNIX implementations, but is not likely to change.
-
-@subsection Where is the @samp{su} command?
-
-The @samp{su} command is not ported to Cygwin, so it is no longer
-provided in the distribution. You may be able to use @samp{login}
-instead, but you should read
-@file{http://www.cygwin.com/ml/cygwin/2001-03/msg00337.html} first.
-
-If you have a copy of su, then it's from an old Cygwin distribution, and
-it probably doesn't work properly anyway.
-
-@subsection Why doesn't man (or apropos) work?
-
-Even after installing the @samp{man} package, you get an error like this:
-
-@example
- bash-2.04$ man man
- Error executing formatting or display command.
- System command (cd /usr/man ; (echo -e ".pl 1100i"; cat /usr/man/man1/man.1; echo ".pl \n(nlu+10") | /usr/bin/tbl | /usr/bin/groff -Tascii -mandoc | less -is) exited with status 32512.
- No manual entry for man
-@end example
-
-You also need /bin/sh, which is found in the @samp{ash} package.
-You must install this too.
-
-In addition, before you can use @samp{man -k} or @samp{apropos}, you
-must create the whatis database. Just run the command
-
-@example
- /usr/sbin/makewhatis
-@end example
-
-(it may take a minute to complete).
-
-@subsection Why doesn't chmod work?
-
-@samp{ntsec} will allow UNIX permissions in Windows NT on NTFS file systems.
-
-@samp{ntea} works on NTFS @emph{and} FAT but it creates a huge,
-@strong{undeletable} file on FAT filesystems.
-
-(The @samp{ntsec} and @samp{ntea} settings are values for the
-@samp{CYGWIN} environment variable. See the Cygwin User's Guide at
-@file{http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html} for more
-information on this variable and its settings.)
-
-There is no solution at all for Windows 9x.
-
-If you have an application that requires a certain permission mode on a
-file, you may be able to work around this requirement by modifying the
-application's source code. For a hint, based on work done by Corinna
-Vinschen for OpenSSH, see this message from the cygwin mailing list:
-@file{http://cygwin.com/ml/cygwin/2000-11/msg01176.html}.
-
-@subsection Why doesn't @samp{mkdir -p} work on a network share?
-
-Unfortunately, you cannot do something like this:
-
-@example
-bash$ mkdir -p //MACHINE/Share/path/to/new/dir
-mkdir: cannot create directory `//MACHINE': No such file or directory
-@end example
-
-This is because mkdir checks for the existence of each directory on the
-path, creating them as necessary. Since @samp{//MACHINE} is not a
-directory (you can't cd to it either), mkdir tries to create it, and
-fails.
-
-This might get fixed someday, but for now, you have to work around it:
-
-@example
-bash$ cd //MACHINE/Share
-bash$ mkdir -p path/to/new/dir
-@end example
-
-@subsection 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 ash, and is missing some features you might expect
-in /bin/sh, particularly if you are used to /bin/sh actually being
-bash (Linux) or ksh (Tru64). For example:
-
-@itemize bullet
-@item No job control
-@item No getopts
-@item No let
-@item No functions exported
-@item Must use `.' instead of `source' (true of sh and ksh too, not just ash)
-@end itemize
-
-Or, it could be a permission problem, and Cygwin doesn't understand that
-your script is executable. Because @samp{chmod} may not work (see FAQ
-entry above), Cygwin must read the contents of files to determine if
-they are executable. If your script does not start with
-
-@example
- #! /bin/sh
-@end example
-
-(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
-
-@example
- :
- # This is the 2nd line, assume processing by /bin/sh
-@end example
-
-also works.
-
-Note that you can use @samp{mount -x} 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.
-
-@subsection How do I print under Cygwin?
-
-There is no working lp or lpr system as you would find on UNIX.
-
-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
-@file{http://cygwin.com/ml/cygwin/2001-04/msg00657.html}. Note that the
-@samp{file} command is now available as part of Cygwin setup.
-
-Alternatively, on NT, you can use the Windows @samp{print} command. (It
-does not seem to be available on Win9x.) Type
-
-@example
- bash$ print /\?
-@end example
-
-for usage instructions (note the @samp{?} must be escaped from the
-shell).
-
-Finally, you can simply @samp{cat} the file to the printer's share name:
-
-@example
- bash$ cat myfile > //host/printer
-@end example
-
-You may need to press the formfeed button on your printer or append the
-formfeed character to your file.
-
-@subsection Why don't international (8-bit) characters work?
-
-Before you can type international characters (£åäö) in bash, you must
-add the following lines to your @code{~/.inputrc} file:
-
-@example
- set meta-flag on
- set convert-meta off
- set output-meta on
-@end example
-
-These are options to the @code{readline} library, which you can read
-about in the @code{bash(1)} man page.
-
-@subsection Why don't cursor keys work under Win95/Win98?
-
-@strong{(Please note: This section has not yet been updated for the latest
-net release.)}
-
-Careful examination shows that they not just non-functional, but
-rather behave strangely, for example, with NumLock off, keys on numeric
-keyboard work, until you press usual cursor keys, when even numeric
-stop working, but they start working again after hitting alphanumeric
-key, etc. This reported to happen on localized versions of Win98 and
-Win95, and not specific to Cygwin (there're known cases of Alt+Enter
-(fullscreen/windowed toggle) not working and shifts sticking with
-other programs). The cause of this problem is Microsoft keyboard
-localizer which by default installed in 'autoexec.bat'. Corresponding
-line looks like:
-
-@example
-keyb ru,,C:\WINDOWS\COMMAND\keybrd3.sys
-@end example
-
-(That's for russian locale.) You should comment that line if you want
-your keys working properly. Of course, this will deprive you of your
-local alphabet keyboard support, so you should think about
-another localizer. exUSSR users are of course knowledgeable of Keyrus
-localizer, and it might work for other locales too, since it has keyboard
-layout editor. But it has russian messages and documentation ;-(
-Reference URL is http://www.hnet.ru/software/contrib/Utils/KeyRus/
-(note the you may need to turn off Windows logo for Keyrus to operate
-properly).
-
-@subsection Is it OK to have multiple copies of the DLL?
-
-You should only have one copy of the Cygwin DLL on your system. If you
-have multiple versions, they will conflict and cause problems.
-
-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. This could happen, for example, if you update
-cygwin1.dll without exiting @emph{all} Cygwin apps (including inetd)
-beforehand.
-
-If you're trying to find multiple versions of the DLL that are causing
-this problem, reboot first, in case DLL's 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).
-
-@subsection Where can I find "more"?
-
-If you are looking for the "more" pager, you should use the "less" pager
-instead.
-
-@subsection Why isn't package XXXX available in Cygwin? (Or, why is your package so out of date?)
-
-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 below.
-
-@subsection 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:
-@example
- bash$ cd C:/Windows
- bash$ pwd
- /cygdrive/c/Windows
-@end example
-and
-@example
- bash$ cd C:/cygwin
- bash$ pwd
- /
-@end example
-for a default setup. You could also use backward-slashes in the
-Windows path, but these would have to be escaped from the shell.
-
-@strong{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:
-@example
- bash$ mkdir /c
- bash$ mount c:/ /c
- bash$ ls /c
-@end example
-Then @samp{/cygdrive/c/Windows} becomes @samp{/c/Windows} which is a
-little less typing.
-
-Note that you only need to mount drives once. The mapping is kept
-in the registry so mounts stay valid pretty much indefinitely.
-You can only get rid of them with umount, or the registry editor.
-
-The '-b' option to mount mounts the mountpoint in binary mode
-("binmode") where text and binary files are treated equivalently. This
-should only be necessary for badly ported Unix programs where binary
-flags are missing from open calls. It is also the setting for /,
-/usr/bin and /usr/lib in a default Cygwin installation. The default for
-new mounts is text mode ("textmode"), which is also the mode for all
-"cygdrive" mounts.
-
-You can change the default @samp{cygdrive} prefix and whether it is
-binmode or textmode using the @code{mount} command. For example,
-@example
- bash$ mount -b --change-cygdrive-prefix cygdrive
-@end example
-will change all @code{/cygdrive/...} mounts to binmode.
-
-@subsection How can I copy and paste into Cygwin console windows?
-
-Under Windows NT, open the properties dialog of the console window.
-The options contain a toggle button, named "Quick edit mode". It must
-be ON. Save the properties.
-
-Under Windows 9x, open the properties dialog of the console window.
-Select the Misc tab. Uncheck Fast Pasting. Check QuickEdit.
-
-You can also bind the insert key to paste from the clipboard by adding
-the following line to your .inputrc file:
-@example
- "\e[2~": paste-from-clipboard
-@end example
-
-
-@subsection What does "mount failed: Device or resource busy" mean?
-
-@strong{(Please note: This section has not yet been updated for the latest
-net release.)}
-
-This usually means that you are trying to mount to a location
-already in use by mount. For example, if c: is mounted as '/'
-and you try to mount d: there as well, you will get this error
-message. First "umount" the old location, then "mount" the new one and
-you should have better luck.
-
-If you are trying to umount '/' and are getting this message, you may
-need to run @code{regedit.exe} and change the "native" key for the '/'
-mount in one of the mount points kept under
-HKEY_CURRENT_USER/Software/Red Hat, Inc./CYGWIN.DLL setup/<version>
-where <version> is the latest registry version associated with the
-Cygwin library.
-
-@subsection How can I share files between Unix and Windows?
-
-During development, we have both Unix boxes running Samba and
-NT/Windows 95/98 machines. We often build with cross-compilers
-under Unix and copy binaries and source to the Windows system
-or just toy with them directly off the Samba-mounted partition.
-On dual-boot NT/Windows 9x machines, we usually use the FAT
-filesystem so we can also access the files under Windows 9x.
-
-@subsection Are mixed-case filenames possible with Cygwin?
-
-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 @code{Makefile} and
-@code{makefile}. WIN32 can't tell the difference between files with
-just different case, so the configuration fails.
-
-In releases prior to beta 16, mount had a special mixed case option
-which renamed files in such a way as to allow mixed case filenames. We
-chose to remove the support when we rewrote the path handling code for
-beta 16. The standard Windows apps -- explorer.exe,
-cmd.exe/command.com, etc. -- do not distinguish filenames that differed
-only in case, resulting in some (very) undesirable behavior.
-
-Sergey Okhapkin had maintained a mixed-case patch ('coolview') until
-about B20.1, but this has not been updated to recent versions of Cygwin.
-
-@subsection What about DOS special filenames?
-
-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
-@code{aux.sh}. The perl configuration tries to make sure that
-@code{aux.sh} is there, but an operation on a file with the magic
-letters 'aux' in it will hang.
-
-@subsection 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.
-This should never be necessary under Windows NT.
-
-@subsection 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:
-
-@example
- bash$ mount
- C:\cygwin\bin on /usr/bin type system (binmode)
- C:\cygwin\lib on /usr/lib type system (binmode)
- C:\cygwin on / type system (binmode)
-@end example
-
-(Exactly what you see depends on what options you gave to @code{setup.exe}.)
-
-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 @emph{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. @emph{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?)
-
-@subsection 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 @samp{@code{C:\cygwin\bin}}. Obviously, this could be
-exploited by a hostile non-Cygwin program, so do this at your own risk.
-
-@subsection How do I run bash as a shell under NT Emacs?
-
-The Windows port of GNU Emacs (aka "NT emacs") uses the Windows command
-shell by default. Also, since Emacs 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
-bash. This is particularly useful for the JDEE package
-(@file{http://jdee.sunsite.dk/}). The following settings are for
-Emacs 21.1:
-
-@example
- ;; 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")))
- ;;
- ;; NT-emacs assumes a Windows command shell, which you change
- ;; here.
- ;;
- (setq process-coding-system-alist '(("bash" . undecided-unix)))
- (setq shell-file-name "bash")
- (setenv "SHELL" shell-file-name)
- (setq explicit-shell-file-name shell-file-name)
- ;;
- ;; This removes unsightly ^M characters that would otherwise
- ;; appear in the output of java applications.
- ;;
- (add-hook 'comint-output-filter-functions
- 'comint-strip-ctrl-m)
-@end example
-
-@subsection Is there a Cygwin port of GNU Emacs?
-
-No. If you want NT Emacs to understand Cygwin paths, get
-cygwin-mount.el from @file{http://www.emacswiki.org/elisp/index.html}.
-
-If you want to run ``emacs -nw'', say from a remote login shell, you
-can't. (The error is ``emacs: standard input is not a tty''.)
-Instead, use a Cygwin version of XEmacs, from
-@file{http://www.xemacs.org/}. Using ``xemacs -nw'' from a remote
-shell works fine.
-
-@subsection info error "dir: No such file or directory"
-
-Cygwin packages install their info documentation in the /usr/info
-directory. But you need to create a @code{dir} file there before the
-standalone info program (probably @code{/usr/bin/info}) can be used to
-read those info files. This is how you do it:
-@example
- bash$ cd /usr/info
- bash$ for f in *.info ; do install-info $f dir ; done
-@end example
-This may generate warnings:
-@example
- install-info: warning: no info dir entry in `gzip.info'
- install-info: warning: no info dir entry in `time.info'
-@end example
-The @code{install-info} command cannot parse these files, so you will
-have to add their entries to @code{/usr/info/dir} by hand.
-
-Even if the dir file already exists, you may have to update it when
-you install new Cygwin packages. Some packages update the dir file
-for you, but many don't.
-
-@subsection Why do I get a message saying Out of Queue slots?
-
-"Out of queue slots!" generally occurs when you're trying to remove
-many files that you do not have permission to remove (either because
-you don't have permission, they are opened exclusively, etc). What
-happens is Cygwin queues up these files with the supposition that it
-will be possible to delete these files in the future. Assuming that
-the permission of an affected file does change later on, the file will
-be deleted as requested. However, if too many requests come in to
-delete inaccessible files, the queue overflows and you get the message
-you're asking about. Usually you can remedy this with a quick chmod,
-close of a file, or other such thing. (Thanks to Larry Hall for
-this explanation).
-
-@subsection 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:
-
-@smallexample
- map system = yes
- create mask = 0775
-@end smallexample
-
-Note that the 0775 can be anything as long as the 0010 bit is set.
-
-@subsection Why does df report sizes incorrectly.
-
-There is a bug in the Win32 API function GetFreeDiskSpace that
-makes it return incorrect values for disks larger than 2 GB in size.
-Perhaps that may be your problem?
-
-@subsection Why doesn't Cygwin tcl/tk understand Cygwin paths?
-
-The versions of Tcl/Tk distributed with Cygwin (e.g. cygtclsh80.exe,
-cygwish80.exe) are not actually "Cygwin versions" of those tools.
-They are built with the @samp{-mno-cygwin} option to @code{gcc}, which
-means they do not understand Cygwin mounts or symbolic links.
-
-See the entry "How do I convert between Windows and UNIX paths?"
-elsewhere in this FAQ.
diff --git a/winsup/doc/how.texinfo b/winsup/doc/how.texinfo
deleted file mode 100644
index 4c7385ba4..000000000
--- a/winsup/doc/how.texinfo
+++ /dev/null
@@ -1,6 +0,0 @@
-@chapter Question and Answers
-
-@include how-resources.texinfo
-@include how-using.texinfo
-@include how-api.texinfo
-@include how-programming.texinfo
diff --git a/winsup/doc/install.texinfo b/winsup/doc/install.texinfo
deleted file mode 100644
index c90b11a53..000000000
--- a/winsup/doc/install.texinfo
+++ /dev/null
@@ -1,274 +0,0 @@
-@chapter Installation Instructions
-@section Contents
-
-Unlike previous net releases such as B20.1 and earlier, there is no
-monolithic "full" or "usertools" installation. Rather, you can pick and
-choose the packages you wish to install, and update them individually.
-
-For a searchable list of packages that can be installed with Cygwin,
-see @file{http://cygwin.com/packages/}.
-
-Full source code is available for all packages and tools.
-
-There is only one recommended way to install Cygwin, which is to use the GUI
-installer ``Cygwin Setup''. It is flexible and easy to use.
-
-Do it any other way, and you're on your own! That said, keep in mind
-that the GUI installer is a "work in progress", so there might be a few
-difficulties, especially if you are behind a firewall or have other
-specific requirements. If something doesn't work right for you, and
-it's not covered here or elsewhere, then by all means report it to the
-mailing list.
-
-@section Installation using ``Cygwin Setup''
-
-The Cygwin Setup program is the only recommended way to install Cygwin,
-but it is still a work in progress. Expect features and functionality
-to change. For this reason, it is a good idea to note the version and
-build time reported by Cygwin Setup when you run it. This will help
-diagnose problems, should you have any. Check the cygwin mailing list
-for the latest news about Cygwin Setup.
-
-@subsection Why not install in C:\?
-
-The Cygwin Setup program will prompt you for a "root" directory.
-The default is @samp{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.)
-
-@subsection Can I use Cygwin Setup to update a B18, B19, B20, B20.1 or CD-ROM (1.0) installation of Cygwin?
-
-No, you must start from scratch with the new Cygwin Setup. The
-overall structure has changed so much that it would be pointless to
-try to accomodate old installations of Cygwin. You will probably be
-much better off with a whole new installation anyway. You may backup
-or rename your old installation first, or just install the new one
-somewhere else. Be sure to make note of your current mount table,
-because this will be overwritten during the new setup. Make sure you
-don't end up with two different versions of @samp{cygwin1.dll} in your
-path.
-
-Once you've installed the latest net release, Cygwin Setup will update
-just the individual packages that need it.
-
-@subsection 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 @code{setup}. Read the next entry for a fairly safe way to do
-this.
-
-@subsection 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:
-
-@enumerate
-@item Download @code{setup.exe} and scan it explicitly.
-
-@item Turn off the anti-virus software.
-
-@item Run setup to download and extract all the tar files.
-
-@item Re-activate your anti-virus software and scan everything
-in C:\cygwin (or wherever you chose to install). If you're concerned
-about a malicious package, say if a mirror is compromised, then you
-should scan your entire hard disk after running Cygwin Setup.
-
-@end enumerate
-
-This should be safe, but only if Cygwin Setup is not substituted by
-something malicious.
-
-@subsection What packages should I download?
-
-When using Cygwin Setup for the first time, the default is to install
-a minimal subset of packages. If you want anything beyond that, you
-will have to select it explicitly. See
-@file{http://cygwin.com/packages/} for a searchable list of available
-packages.
-
-If you want to build programs, of course you'll need @samp{gcc},
-@samp{binutils}, @samp{make} and probably other packages from the
-``Devel'' category.
-
-@subsection How do I just get everything?
-
-In the past, the default was to install everything, much to the
-irritation of many users. Now the default is to install only a basic
-core of packages. At the moment, there is no easy way to get
-everything. In the current version of Cygwin Setup, if you want
-everything, you must do the following:
-
-@enumerate
-
-@item When the Cygwin Setup says ``Select packages to install'', click on the
-``View'' button until it says ``Full''.
-
-@item Wherever it says ``Skip'', click twice until it gives the
-version number of the package. That means it will be downloaded and
-installed.
-
-@end enumerate
-
-If a package you've selected for installation has prerequisites, those
-will automatically be installed too. It's a lot of clicking but only
-the first time. Once you install a package, any subsequent updates to
-that package will be installed by default. Note that new packages are
-added regularly, so you will always have to check the list for any
-``Skip'' entries if you want to stay up to date with a complete
-installation.
-
-This should become much easier in a future version of Cygwin Setup.
-
-@subsection How much disk space does Cygwin require?
-
-That depends, obviously, on what you've chosen to download and install.
-A full installation is probably 250-300MB installed, not including the
-package archives themselves or the source code.
-
-After installation, the package archives remain in your ``Local Package
-Directory'', by default the location of @code{setup.exe}. You may
-conserve disk space by deleting the @code{contrib} and @code{latest}
-subdirectories there.
-
-@subsection What if setup fails?
-
-First, make sure that you are using the latest version of Cygwin
-Setup. It is a work in progress, with improvements and bugfixes being
-made often. The latest version is always available from the 'Install
-Cygwin now' link on the Cygwin Home Page at @file{http://cygwin.com/}.
-
-If you are downloading from the internet, setup will fail if it cannot
-download the list of mirrors at
-@file{http://cygwin.com/mirrors.html}. It could be that
-the network is too busy. Similarly for an ftp download site that isn't
-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
-@samp{setup.log} and @samp{setup.log.full} in the Cygwin root directory
-(@code{C:\cygwin} 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.
-
-@subsection What's the difference between packages in @samp{latest} and @samp{contrib}?
-
-There is no difference as far as Cygwin Setup is concerned. The
-distinction is historical, not practical.
-
-@subsection 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.
-
-In particular, the environment variables @samp{USER} and @samp{HOME} are
-set for you in /etc/profile. By default these derive from your Windows
-logon name. You may edit this file and set them explicitly to something
-without spaces.
-
-(If you use the @samp{login} package or anything else that reads
-/etc/passwd, you may need to make corresponding changes there. See the
-README file for that package.)
-
-@subsection 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''.
-
-@subsection How do I uninstall @strong{all} of Cygwin?
-
-Setup has no automatic uninstall facility. Just delete everything
-manually:
-
-@itemize @bullet
-@item Cygwin shortcuts on the Desktop and Start Menu
-
-@item The registry tree @samp{Software\Cygnus Solutions} under
-@code{HKEY_LOCAL_MACHINE} and/or @code{HKEY_CURRENT_USER}.
-
-@item Anything under the Cygwin root folder, @samp{C:\cygwin} by
-default.
-
-@item Anything created by setup in its temporary working directory.
-
-@end itemize
-
-It's up to you to deal with other changes you made to your system, such
-as installing the inetd service, altering system paths, etc. Setup
-would not have done any of these things for you.
-
-@subsection Can I use setup to install snapshots?
-
-No. It used to be possible, but not any more.
-
-If experimenting with developer snapshots from
-@file{http://cygwin.com/snapshots/}, you should generally install the
-full @code{cygwin-inst-YYYYMMDD.tar.bz2} update, rather than just the
-DLL, otherwise some components may be out of sync. Cygwin tar won't be
-able to update @code{/usr/bin/cygwin1.dll}, but it should succeed with
-everything else. The following steps should work:
-
-@enumerate
-
-@item Download the snapshot, and run:
-@example
- cd /
- tar jxvf /posix/path/to/cygwin-inst-YYYYMMDD.tar.bz2 --exclude=usr/bin/cygwin1.dll
- cd /tmp
- tar jxvf /posix/path/to/cygwin-inst-YYYYMMDD.tar.bz2 usr/bin/cygwin1.dll
-@end example
-
-@item After closing all Cygwin apps (see below), use Explorer or the
-Windows command shell to move @code{C:\cygwin\tmp\usr\bin\cygwin1.dll}
-to @code{C:\cygwin\bin\cygwin1.dll}.
-
-@end enumerate
-
-The obvious warnings about updating the cygwin package and using developer
-snapshots apply:
-
-@enumerate
-
-@item Close @strong{all} Cygwin applications, including shells and services
-(e.g. inetd), before updating @code{cygwin1.dll}. You may have to
-restart Windows to clear the DLL from memory.
-
-@item Snapshots are risky. They have not been tested. Use them
-@strong{only} if there is a feature or bugfix that you need to try,
-and you are willing to deal with any problems.
-
-@item If you cannot download a snapshot from the main ftp distribution
-site, use a mirror, and look in the @samp{snapshots} directory. You may
-have to hunt for one that has a copy of the latest snapshot. Start at
-@file{http://cygwin.com/mirrors.html}.
-
-@end enumerate
diff --git a/winsup/doc/legal.sgml b/winsup/doc/legal.sgml
deleted file mode 100644
index 1190ecce1..000000000
--- a/winsup/doc/legal.sgml
+++ /dev/null
@@ -1,30 +0,0 @@
-<LegalNotice id="legal">
-
-<Para>Copyright &copy; 1998,1999,2000,2001 Red Hat, Inc.</Para>
-
-<!--
-
-<Para>GNUPro&trade;, the GNUPro&trade; logo, and the Red Hat
-logo are trademarks of Red Hat, Inc. All other brand and product
-names are trademarks of their respective owners.</Para>
-
-<Para>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.</Para>
-
-<Para>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.</Para>
-
-<Para>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.</Para>
-
-<Para>This documentation has been prepared by Red Hat, Inc.
-Technical Publications.</para>
--->
-
-</LegalNotice>
diff --git a/winsup/doc/ntsec.sgml b/winsup/doc/ntsec.sgml
deleted file mode 100644
index 1741b8046..000000000
--- a/winsup/doc/ntsec.sgml
+++ /dev/null
@@ -1,663 +0,0 @@
-<sect1 id="ntsec"><title>NT security and the <literal>ntsec</literal> usage</title>
-
-<para>The design goal of the ntsec patch was to get a more UNIX like
-permission structure based upon the security features of Windows NT.
-To describe the changes, I will give a short overview of NT security
-in chapter one.</para>
-<para>Chapter two discusses the changes in ntsec related to privileges on
-processes.</para>
-<para>Chapter three shows the basics of UNIX like setting of
-file permissions.</para>
-<para>Chapter four talks about the advanced settings introduced in
-release 1.1</para>
-<para>Chapter five illustrates the permission mapping leak of Windows NT.</para>
-<para>Chapter six describes the new support of a setuid concept introduced
-with release 1.1.3.</para>
-
-<para>Chapter six describes in short the new acl API since release 1.1</para>
-
-<para>The setting of UNIX like object permissions is controlled by the new
-<EnVar>CYGWIN</EnVar> variable setting <literal>(no)ntsec</literal>.</para>
-
-<sect2 id="ntsec-common"><title>NT security</title>
-
-<para>The NT security allows a process to allow or deny access of
-different kind to `objects'. `Objects' are files, processes,
-threads, semaphores, etc.</para>
-
-<para>The main data structure of NT security is the `security descriptor'
-(SD) structure. It explains the permissions, that are granted (or denied)
-to an object and contains information, that is related to so called
-`security identifiers' (SID).</para>
-
-<para>A SID is a unique identifier for users, groups and domains.
-SIDs are comparable to UNIX UIDs and GIDs, but are more complicated
-because they are unique across networks. Example:</para>
-
-<para>SID of a system `foo':</para>
-
-<screen>
- S-1-5-21-165875785-1005667432-441284377
-</screen>
-
-<para>SID of a user `johndoe' of the system `foo':</para>
-
-<screen>
- S-1-5-21-165875785-1005667432-441284377-1023
-</screen>
-
-<para>The above example shows the convention for printing SIDs. The leading
-`S' should show that it is a SID. The next number is a version number which
-is always 1. The next number is the so called `top-level authority' that
-identifies the source that issued the SID.</para>
-
-<para>While each system in a NT network has it's own SID, the situation
-is modified in NT domains: The SID of the domain controller is the
-base SID for each domain user. If an NT user has one account as domain
-user and another account on his local machine, this accounts are under
-any circumstances DIFFERENT, regardless of the usage of the same user
-name and password!</para>
-
-<para>SID of a domain `bar':</para>
-
-<screen>
- S-1-5-21-186985262-1144665072-740312968
-</screen>
-
-<para>SID of a user `johndoe' in the domain `bar':</para>
-
-<screen>
- S-1-5-21-186985262-1144665072-740312968-1207
-</screen>
-
-<para>The last part of the SID, the so called `relative identifier' (RID),
-is by default used as UID and/or GID under cygwin. As the name and the
-above example implies, this id is unique only relative to one system or
-domain.</para>
-
-<para>Note, that it's possible, that an user has the same RID on two
-different systems. The resulting SIDs are nevertheless different, so
-the SIDs are representing different users in an NT network.</para>
-
-<para>There is a big difference between UNIX IDs and NT SIDs, the existence of
-the so called `well known groups'. For example UNIX has no GID for the
-group of `all users'. NT has an SID for them, called `Everyone' in the
-English versions. The SIDs of well-known groups are not unique across
-an NT network but their meanings are unmistakable.
-Examples of well-known groups:</para>
-
-<screen>
-everyone S-1-1-0
-creator/owner S-1-3-0
-batch process (via `at') S-1-5-3
-authenticated users S-1-5-11
-system S-1-5-18
-</screen>
-
-<para>The last important group of SIDs are the `predefined groups'. This
-groups are used mainly on systems outside of domains to simplify the
-administration of user permissions. The corresponding SIDs are not unique
-across the network so they are interpreted only locally:</para>
-
-<screen>
-administrators S-1-5-32-544
-users S-1-5-32-545
-guests S-1-5-32-546
-...
-</screen>
-
-<para>Now, how are permissions given to objects? A process may assign an SD
-to the object. The SD of an object consists of three parts:</para>
-
-<itemizedlist spacing="compact">
-<listitem><para>the SID of the owner </para></listitem>
-<listitem><para>the SID of the group </para></listitem>
-<listitem><para>a list of SIDs with their permissions, called
-`access control list' (ACL) </para></listitem>
-</itemizedlist>
-
-<para>UNIX is able to create three different permissions, the permissions
-for the owner, for the group and for the world. In contrast the ACL
-has a potentially infinite number of members. Every member is a so called
-`access control element' (ACE). An ACE contains three parts:</para>
-
-<itemizedlist spacing="compact">
-<listitem><para>the type of the ACE </para></listitem>
-<listitem><para>permissions, described with a DWORD </para></listitem>
-<listitem><para>the SID, for which the above mentioned permissions are
-set </para></listitem>
-</itemizedlist>
-
-<para>The two important types of ACEs are the `access allowed ACE' and the
-`access denied ACE'. The ntsec patch only used `access allowed ACEs' up
-to Cygwin version 1.1.0. Later versions use `access denied ACEs' as well
-to reflect the UNIX permissions as good as possible.</para>
-
-<para>The possible permissions on objects are more detailed than in
-UNIX. For example, the permission to delete an object is different
-from the write permission.</para>
-
-<para>With the aforementioned method NT is able to grant or revoke permissions
-to objects in a far more specific way. But what about cygwin? In a POSIX
-environment it would be fine to have the security behavior of a POSIX
-system. The NT security model is MOSTLY able to reproduce the POSIX model.
-The ntsec patch tries to do this in cygwin.</para>
-
-<para>You ask "Mostly? Why mostly???" Because there's a leak in the NT model.
-I will describe that in detail in chapter 4.</para>
-
-<para>Creating explicit object security is not that easy so you will often
-see only two simple variations in use:</para>
-
-<itemizedlist spacing="compact">
-<listitem><para>default permissions, computed by the operating system </para></listitem>
-<listitem><para>each permission to everyone </para></listitem>
-</itemizedlist>
-
-<para>For parameters to functions that create or open securable objects another
-data structure is used, the `security attributes' (SA). This structure
-contains an SD and a flag that specifies whether the returned handle
-to the object is inherited to child processes or not.
-This property is not important for the ntsec patch description so in
-this document the difference between SDs and SAs is ignored.</para>
-
-</sect2>
-
-<sect2 id="ntsec-processes"><title>Process privileges</title>
-
-<para>Any process started under control of cygwin has a semaphore attached
-to it, that is used for signaling purposes. The creation of this semaphore
-can be found in sigproc.cc, function `getsem'. The first parameter to the
-function call `CreateSemaphore' is an SA. Without ntsec patch this SA
-assigns default security to the semaphore. There is a simple disadvantage:
-Only the owner of the process may send signals to it. Or, in other words,
-if the owner of the process is not a member of the administrators' group,
-no administrator may kill the process! This is especially annoying, if
-processes are started via service manager.</para>
-
-<para>The ntsec patch now assigns an SA to the process control semaphore, that
-has each permission set for the user of the process, for the
-administrators' group and for `system', which is a synonym for the
-operating system itself. The creation of this SA is done by the function
-`sec_user', that can be found in `shared.cc'. Each member of the
-administrators' group is now allowed to send signals to any process
-created in cygwin, regardless of the process owner.</para>
-
-<para>Moreover, each process now has the appropriate security settings, when
-it is started via `CreateProcess'. You will find this in function
-`spawn_guts' in module `spawn.cc'. The security settings for starting a
-process in another user context have to add the sid of the new user, too.
-In the case of the `CreateProcessAsUser' call, sec_user creates an SA with
-an additional entry for the sid of the new user.</para>
-
-</sect2>
-
-<sect2 id="ntsec-files"><title>File permissions</title>
-
-<para>If ntsec is turned on, file permissions are set as in UNIX. An SD is
-assigned to the file containing the owner and group and ACEs for the
-owner, the group and `Everyone'.</para>
-
-<para>The complete settings of UNIX like permissions can be found in the file
-`security.cc'. The two functions `get_nt_attribute' and `set_nt_attribute'
-are the main code. The reading and writing of the SDs is done by the
-functions `read_sd' and `write_sd'. `write_sd' uses the function `BackupRead'
-instead of the simpler function `SetFileSecurity' because the latter is
-unable to set owners different from the caller.</para>
-
-<para>If you are creating a file `foo' outside of cygwin, you will see something
-like the following on <command>ls -ln</command>:</para>
-
-<para>If your login is member of the administrators' group:</para>
-<screen>
- rwxrwxrwx 1 544 513 ... foo
-</screen>
-<para>if not:</para>
-<screen>
- rwxrwxrwx 1 1000 513 ... foo
-</screen>
-
-<para>Note the user and group IDs. 544 is the UID of the administrators' group.
-This is a `feature' <literal>:-P</literal> of WinNT. If one is a member of
-the administrators' group, every file, that he has created is owned by the
-administrators' group, instead by him.</para>
-
-<para>The second example shows the UID of the first user, that has been
-created with NT's the user administration tool. The users and groups are
-sequentially numbered, starting with 1000. Users and groups are using the
-same numbering scheme, so a user and a group don't share the same ID.</para>
-
-<para>In both examples the GID 513 is of special interest. This GID is a
-well known group with different naming in local systems and domains.
-Outside of domains the group is named 'None' (`Kein' in German, `Aucun'
-in French, etc.), in domains it is named 'Domain Users'. Unfortunately,
-the group `None' is never shown in the user admin tool outside of domains!
-This is very confusing but it seems that this has no negativ influences.</para>
-
-<para>To work correctly the ntsec patch depends on reasoned files
-<filename>/etc/passwd/</filename> and <filename>/etc/group</filename>.
-In cygwin release 1.0 the names and the IDs must correspond to the
-appropriate NT IDs! The IDs used in cygwin are the RID of the NT SID, as
-mentioned earlier.
-An SID of e.g. the user `corinna' on my NT workstation:</para>
-
-<screen>
- S-1-5-21-165875785-1005667432-441284377-1000
-</screen>
-
-<para>Note the last number: It's the RID 1000, the cygwin's UID.</para>
-
-<para>Unfortunately, workstations and servers outside of domains are not
-able to set primary groups! In these cases, where there is no correlation
-of users to primary groups, NT returns 513 (None) as primary group,
-regardless of the membership to existing local groups.</para>
-
-<para>when using <command>mkpasswd -l -g</command> on such systems, you
-have to change the primary group by hand if `None' as primary group is
-not what you want (and I'm sure, it's not what you want!)</para>
-
-<para>To get help in creating correct passwd and group files, look at
-the following examples, that are part of my files. With the exception
-of my personal user entry, all entries are well known entries. For a
-better understanding, the names are translated to the equivalents of the
-English NT version.</para>
-<example>
-<title>/etc/passwd</title>
-<screen>
-everyone:*:0:0:::
-system:*:18:18:::
-administrator::500:544::/home/root:/bin/bash
-guest:*:501:546:::
-administrators:*:544:544::/home/root:
-corinna::1000:547:Corinna Vinschen:/home/corinna:/bin/tcsh
-</screen>
-</example>
-
-<example>
-<title>/etc/group</title>
-<screen>
-everyone::0:
-system::18:
-none::513:
-administrators::544:
-users::545:
-guests::546:
-powerusers::547:
-</screen>
-</example>
-
-<para>Groups may be mentioned in the passwd file, too. This has two
-advantages:</para>
-<itemizedlist spacing="compact">
-<listitem><para>Because NT assigns them to files as owners, a
-<command>ls -l</command> is often better readable.</para></listitem>
-<listitem><para>Moreover it's possible to assigned them to files as
-owners with cygwin's <command>chown</command>.</para></listitem>
-</itemizedlist>
-
-<para>The group `system' is the aforementioned synonym for the operating system
-itself and is normally the owner of processes, that are started through
-service manager. The same is true for files, that are created by
-processes, which are started through service manager.</para>
-
-</sect2>
-
-<sect2 id="ntsec-release1.1"><title>New since Cygwin release 1.1</title>
-
-<para>In Cygwin release 1.1 a new technique of using the
-<filename>/etc/passwd</filename> and <filename>/etc/group</filename>
- is introduced.</para>
-
-<para>Both files may now contain SIDs of users and groups. They
-are saved in the last field of pw_gecos in <filename>/etc/passwd</filename>
-and in the gr_passwd field in <filename>/etc/group</filename>.</para>
-
-<para>This has the following advantages:</para>
-<itemizedlist spacing="compact">
-<listitem><para>ntsec works better in domain environments.</para></listitem>
-<listitem><para>Accounts (users and groups) may get another name in
-cygwin than their NT account name. The name in <filename>/etc/passwd</filename>
-or <filename>/etc/group</filename> is transparently used by cygwin
-applications (eg. <command>chown</command>, <command>chmod</command>,
-<command>ls</command>):</para>
-
-<screen>
-root::500:513::/home/root:/bin/sh
-</screen>
-
-<para>instead of</para>
-
-<screen>
-adminstrator::500:513::/home/root:/bin/sh
-</screen>
-
-<para>Caution: If you like to use the account as login account via
-<command>telnet</command> etc. you have to remain the name unchanged or
-you have to use the special version of <command>login</command> which is
-part of the standard Cygwin distribution since 1.1.</para></listitem>
-<listitem><para>Cygwin UIDs and GIDs are now not necessarily the RID
-part of the NT SID:</para>
-
-<screen>
-root::0:513:S-1-5-21-54355234-56236534-345635656-500:/home/root:/bin/sh
-</screen>
-
-<para>instead of</para>
-
-<screen>
-root::500:513::/home/root:/bin/sh
-</screen>
-
-</listitem>
-<listitem><para>As in U*X systems UIDs and GIDs numbering scheme now
-don't influence each other. So it's possible to have same Id's for a
-user and a group:</para>
-<example>
-<title>/etc/passwd:</title>
-<screen>
-root::0:0:S-1-5-21-54355234-56236534-345635656-500:/home/root:/bin/sh
-</screen>
-</example>
-
-<example>
-<title>/etc/group:</title>
-<screen>
-root:S-1-5-32-544:0:
-</screen>
-</example>
-</listitem>
-</itemizedlist>
-
-<para>The tools <command>mkpasswd</command> and <command>mkgroup</command>
-create the needed entries by default. If you don't want that you can use
-the options <literal>-s</literal> or <literal>--no-sids</literal>. In this
-case ntsec behaves like the previous version.</para>
-
-<para>Please note that the pw_gecos field in <filename>/etc/passwd</filename>
-is defined as a comma seperated list. The SID has to be the last field!</para>
-
-<para>As aforementioned you are able to use cygwin account names different
-from the NT account names. If you want to login thru `telnet' or something
-else you have to use the special <command>login</command>. You may then
-add another field to pw_gecos which contains the NT user name including
-it's domain. So you are able to login as each domain user. The syntax
-is easy: Just add an entry of the form U-ntdomain\ntusername to the pw_gecos
-field. Note that the SID must still remain the last field in pw_gecos!</para>
-
-<screen>
-the_king::1:1:Elvis Presley,U-STILLHERE\elvis,S-1-5-21-1234-5678-9012-1000:/bin/sh
-</screen>
-
-<para>For a local user just drop the domain:</para>
-
-<screen>
-the_king::1:1:Elvis Presley,U-elvis,S-1-5-21-1234-5678-9012-1000:/bin/sh
-</screen>
-
-<para>In each case the password of the user is taken from the NT user
-database, NOT from the passwd file!</para>
-
-</sect2>
-
-<sect2 id="ntsec-mapping"><title>The mapping leak</title>
-
-<para>Now its time to point out the leak in the NT permissions.
-The official documentation explains in short the following:</para>
-<itemizedlist spacing="compact">
-<listitem><para>access allow ACEs are accumulated regarding to the
-group membership of the caller.</para></listitem>
-<listitem><para>The order of ACEs is important. The system reads them
-in sequence until either any needed right is denied or all needed rights
-are granted. Later ACEs are then not taken into account.</para></listitem>
-<listitem><para>All access denied ACEs _should_ precede any
-access allowed ACE.</para></listitem>
-</itemizedlist>
-
-<para>Note that the last rule is a preference, not a law. NT will correctly
-deal with the ACL regardless of the sequence order. The second rule is
-not modified to get the ACEs in the prefered order.</para>
-
-<para>Unfortunately the security tab of the NT4 explorer is completely
-unable to deal with access denied ACEs while the explorer of W2K rearranges
-the order of the ACEs before you can read them. Thank God, the sort order
-remains unchanged if one presses the Cancel button.</para>
-
-<para>You still ask "Where is the leak?" NT ACLs are unable to reflect each
-possible combination of POSIX permissions. Example:</para>
-
-<screen>
-rw-r-xrw-
-</screen>
-
-<para>1st try:</para>
-
-<screen>
-UserAllow: 110
-GroupAllow: 101
-OthersAllow: 110
-</screen>
-
-<para>Hmm, because of the accumulation of allow rights the user may
-execute because the group may execute.</para>
-
-<para>2st try:</para>
-
-<screen>
-UserDeny: 001
-GroupAllow: 101
-OthersAllow: 110
-</screen>
-
-<para>Now the user may read and write but not execute. Better? No!
-Unfortunately the group may write now because others may write.</para>
-
-<para>3rd try:</para>
-
-<screen>
-UserDeny: 001
-GroupDeny: 010
-GroupAllow: 001
-OthersAllow: 110
-</screen>
-
-<para>Now the group may not write as intended but unfortunately the user may
-not write anymore, too. How should this problem be solved? According to
-the official rules a UserAllow has to follow the GroupDeny but it's
-easy to see that this can never be solved that way.</para>
-
-<para>The only chance:</para>
-
-<screen>
-UserDeny: 001
-UserAllow: 010
-GroupDeny: 010
-GroupAllow: 001
-OthersAllow: 110
-</screen>
-
-<para>Again: This works for both, NT4 and W2K. Only the GUIs aren't
-able to deal with that order.</para>
-
-</sect2>
-
-<sect2 id="ntsec-aclfuncs"><title>New acl API</title>
-
-<para>For dealing with ACLs Cygwin now has the acl API as it's
-implemented in newer versions of Solaris. The new data structure
-for a single ACL entry (ACE in NT terminology) is defined in
-<filename>sys/acl.h</filename> as:</para>
-
-<screen>
-typedef struct acl {
- int a_type; /* entry type */
- uid_t a_id; /* UID | GID */
- mode_t a_perm; /* permissions */
-} aclent_t;
-</screen>
-
-<para>The a_perm member of the aclent_t type contains only the bits
-for read, write and execute as in the file mode. If eg. read permission
-is granted, all read bits (S_IRUSR, S_IRGRP, S_IROTH) are set.
-CLASS_OBJ or MASK ACL entries are not fully implemented yet.</para>
-
-<para>The new API calls are</para>
-
-<screen>
-acl(2), facl(2)
-aclcheck(3),
-aclsort(3),
-acltomode(3), aclfrommode(3),
-acltopbits(3), aclfrompbits(3),
-acltotext(3), aclfromtext(3)
-</screen>
-
-<para>Like in Solaris, Cygwin has two new commands for working with
-ACLs on the command line: <command>getfacl</command> and
-<command>setfacl</command>.</para>
-
-<para>Online man pages for the aforementioned commands and API calls
-can be found on eg. http://docs.sun.com</para>
-
-</sect2>
-
-<sect2 id="ntsec-setuid"><title>New setuid concept</title>
-
-<para>UNIX applications which have to switch the user context are using
-the <command>setuid</command> and <command>seteuid</command> calls which
-are not part of the Windows API.
-Nevertheless these calls are supported under Windows NT/W2K since Cygwin
-release 1.1.3. Because of the nature of NT security an application which
-needs the ability has to be patched, though.</para>
-
-<para>NT uses so called `access tokens' to identify a user and it's
-permissions. To switch the user context the application has to request
-such an `access token'. This is typically done by calling the NT API
-function <command>LogonUser</command>. The access token is returned and
-either used in <command>ImpersonateLoggedOnUser</command> to change user
-context of the current process or in <command>CreateProcessAsUser</command>
-to change user context of a spawned child process. An important restriction
-is that the application using <command>LogonUser</command> must have special
-permissions:</para>
-
-<screen>
-"Act as part of the operating system"
-"Replace process level token"
-"Increase quotas"
-</screen>
-
-<para>Note that administrators do not have all that user rights set by default.</para>
-
-<para>Two new Cygwin calls are introduced to support porting
-<command>setuid</command> applications with a minimum of effort. You only
-have to care to give Cygwin the right access token and then you can call
-<command>seteuid</command> or <command>setuid</command> as usual in POSIX
-applications. The call to <command>sexec</command> is not needed
-anymore. Porting a <command>setuid</command> application is illustrated by
-a short example:</para>
-
-<screen>
-
-/* First include all needed cygwin stuff. */
-#ifdef __CYGWIN__
-#include &lt;windows.h&gt;
-#include &lt;sys/cygwin.h&gt;
-/* Use the following define to determine the Windows version */
-#define is_winnt (GetVersion() < 0x80000000)
-#endif
-
-[...]
-
- struct passwd *user_pwd_entry = getpwnam (username);
- char *cleartext_password = getpass ("Password:");
-
-[...]
-
-#ifdef __CYGWIN__
- /* Patch the typical password test. */
- if (is_winnt)
- {
- HANDLE token;
-
- /* Try to get the access token from NT. */
- token = cygwin_logon_user (user_pwd_entry, cleartext_password);
- if (token == INVALID_HANDLE_VALUE)
- error_exit;
- /* Inform Cygwin about the new impersonation token.
- Cygwin is able now, to switch to that user context by
- setuid or seteuid calls. */
- cygwin_set_impersonation_token (token);
- }
- else
-#endif /* CYGWIN */
- /* Use standard method for W9X as well. */
- hashed_password = crypt (cleartext_password, salt);
- if (!user_pwd_entry ||
- strcmp (hashed_password, user_pwd_entry-&gt;pw_password))
- error_exit;
-
-[...]
-
- /* Everything else remains the same! */
-
- setegid (user_pwd_entry-&gt;pw_gid);
- seteuid (user_pwd_entry-&gt;pw_uid);
- execl ("/bin/sh", ...);
-
-</screen>
-
-<para>The new Cygwin call to retrive an access token is defined as follows:</para>
-
-<screen>
-#include &lt;windows.h&gt;
-#include &lt;sys/cygwin.h&gt;
-
-HANDLE
-cygwin_logon_user (struct passwd *pw, const char *cleartext_password)
-</screen>
-
-<para>You can call that function as often as you want for different user
-logons and remeber the access tokens for further calls to the second function.</para>
-
-<screen>
-#include &lt;windows.h&gt;
-#include &lt;sys/cygwin.h&gt;
-
-void
-cygwin_set_impersonation_token (HANDLE hToken);
-</screen>
-
-<para> is the call to inform Cygwin about the user context to which further
-calls to <command>setuid</command>/<command>seteuid</command> should switch to.
-While you need always the correct access token to do a
-<command>setuid</command>/<command>seteuid</command> to another users context,
-you are always able to use <command>setuid</command>/<command>seteuid</command>
-to return to your own user context by giving your own uid as parameter.</para>
-
-<para>If you have remembered several access tokens from calls to
-<command>cygwin_logon_user</command> you can switch to different user
-contexts by observing the following order:</para>
-
-<screen>
-
- cygwin_set_impersonation_token (user1_token);
- seteuid (user1_uid);
-
-[...]
-
- seteuid (own_uid);
- cygwin_set_impersonation_token (user2_token);
- seteuid (user2_uid);
-
-[...]
-
- seteuid (own_uid);
- cygwin_set_impersonation_token (user1_token);
- seteuid (user1_uid);
-
-etc.
-
-</screen>
-
-</sect2>
-
-</sect1>
diff --git a/winsup/doc/overview.sgml b/winsup/doc/overview.sgml
deleted file mode 100644
index a9ce8955b..000000000
--- a/winsup/doc/overview.sgml
+++ /dev/null
@@ -1,88 +0,0 @@
-<chapter id="overview"><title>Cygwin Overview</title>
-
-<sect1 id="what-is-it"><title>What is it?</title>
-
-<para>The Cygwin tools are ports of the popular GNU development
-tools and utilities for Windows NT and 9x. They function through the
-use of the Cygwin library which provides the UNIX system calls and
-environment that these programs require.</para>
-
-<para>With the tools installed, 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 distributions). Even if the
-compiler tools are of little to no use to you, you may have
-interest in the many standard UNIX utilities. They can be used both
-from the bash shell (provided) or from the command.com.</para>
-
-</sect1>
-
-<sect1 id="are-free"><title>Are the Cygwin tools free software?</title>
-
-<para>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 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. 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
-<ulink URL="http://www.redhat.com/software/tools/cygwin/">http://www.redhat.com/software/tools/cygwin/
-</ulink>. Customers of the native Win32 GNUPro should feel free to submit bug
-reports and ask questions through the normal channels. All other
-questions should be sent to the project mailing list
-<email>cygwin@cygwin.com</email>.</para>
-
-</sect1>
-
-<sect1 id="brief-history"><title>A brief history of the Cygwin project</title>
-
-<para>The first thing done was to enhance the development tools (gcc,
-gdb, gas, et al) so that they could generate/interpret Win32 native
-object files.</para>
-
-<para>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.</para>
-
-<para>From this point, we pursued the goal of producing native 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. Most 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. Running bash with the development tools and user tools in place,
-Windows 9x and NT look like a flavor of UNIX from the perspective of
-the GNU configure mechanism. Self hosting was achieved as of the beta
-17.1 release.</para>
-
-</sect1>
-
-DOCTOOL-INSERT-ov-ex-unix
-DOCTOOL-INSERT-ov-ex-win
-<sect1 id="highlights"><title>Highlights of Cygwin Functionality</title>
-DOCTOOL-INSERT-ov-hi-intro
-DOCTOOL-INSERT-ov-hi-win9xnt
-DOCTOOL-INSERT-ov-hi-perm
-DOCTOOL-INSERT-ov-hi-files
-DOCTOOL-INSERT-ov-hi-textvsbinary
-DOCTOOL-INSERT-ov-hi-ansiclib
-DOCTOOL-INSERT-ov-hi-process
-DOCTOOL-INSERT-ov-hi-signals
-DOCTOOL-INSERT-ov-hi-sockets
-DOCTOOL-INSERT-ov-hi-select
-</sect1>
-</chapter>
diff --git a/winsup/doc/overview2.sgml b/winsup/doc/overview2.sgml
deleted file mode 100644
index 755b4c42c..000000000
--- a/winsup/doc/overview2.sgml
+++ /dev/null
@@ -1,322 +0,0 @@
-<sect1 id="ov-ex-unix"><title>Expectations for UNIX Programmers</title>
-
-<para>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 or 9x will find that the Cygwin library provides
-an easy way to port many UNIX packages, with only minimal source code
-changes.</para>
-</sect1>
-
-<sect1 id="ov-ex-win"><title>Expectations for Windows Programmers</title>
-<para>Developers coming from a Windows background will find a set of tools capable
-of writing console or GUI executables that rely on the Microsoft Win32 API.
-The linker and dlltool utility may be used to write Windows Dynamically Linked
-Libraries (DLLs). The resource compiler "windres" is also provided with the
-native Windows GNUPro tools. All tools may be used from the Microsoft command
-line prompt, with full support for normal Windows pathnames.</para>
-</sect1>
-
-<sect2 id="ov-hi-intro"><title>Introduction</title> <para>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 that other processes using separate instances
-of the DLL can access. This is used to keep track of open file descriptors and
-assist fork and exec, among other purposes. In addition to the shared memory
-regions, 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.</para>
-
-<para>The DLL is implemented using the Win32 API, which allows it to run on all
-Win32 hosts. Because processes run under the standard Win32 subsystem, they
-can access both the UNIX compatibility calls provided by Cygwin as well as
-any of the Win32 API calls. This gives the programmer complete flexibility in
-designing the structure of their program in terms of the APIs used. For
-example, they could write a Win32-specific GUI using Win32 API calls on top of
-a UNIX back-end that uses Cygwin.</para>
-
-<para>Early on in the development process, we made the important design
-decision that it would not be necessary to strictly adhere to existing UNIX
-standards like POSIX.1 if it was not possible or if it would significantly
-diminish the usability of the tools on the Win32 platform. In many cases, an
-environment variable can be set to override the default behavior and force
-standards compliance.</para>
-</sect2>
-
-<sect2 id="ov-hi-win9xnt"><title>Supporting both Windows NT and 9x</title>
-<para>While Windows 95 and Windows 98 are similar enough to each other that we
-can safely ignore the distinction when implementing Cygwin, Windows NT is an
-extremely different operating system. For this reason, whenever the DLL is
-loaded, the library checks which operating system is active so that it can act
-accordingly.</para>
-
-<para>In some cases, the Win32 API is only different for
-historical reasons. In this situation, the same basic functionality is
-available under Windows 9x and NT but the method used to gain this
-functionality differs. A trivial example: in our implementation of
-uname, the library examines the sysinfo.dwProcessorType structure
-member to figure out the processor type under Windows 9x. This field
-is not supported in NT, which has its own operating system-specific
-structure member called sysinfo.wProcessorLevel.</para>
-
-<para>Other differences between NT and 9x are much more fundamental in
-nature. The best example is that only NT provides a security model.</para>
-</sect2>
-
-<sect2 id="ov-hi-perm"><title>Permissions and Security</title>
-<para>Windows NT includes a sophisticated security model based on Access
-Control Lists (ACLs). Cygwin maps Win32 file ownership and permissions to the
-more standard, older UNIX model by default. Cygwin version 1.1 introduces
-support for ACLs according to the system calls used on newer versions of
-Solaris. This ability is used when the `ntsec' feature is switched on which
-is described in another chapter.
-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.</para>
-
-<para>Under Windows NT, the administrator is permitted to chown files. There
-is no mechanism to support the setuid concept or API call since Cygwin version
-1.1.2. With version 1.1.3 Cygwin introduces a mechanism for setting real
-and effective UIDs under Windows NT/W2K. This is described in the ntsec
-section.</para>
-
-<para>Under Windows 9x, the situation is considerably different. Since a
-security model is not provided, Cygwin fakes file ownership by making all
-files look like they are owned by a default user and group id. As under NT,
-file permissions can still be determined by examining their read/write/execute
-status. Rather than return an unimplemented error, under Windows 9x, the
-chown call succeeds immediately without actually performing any action
-whatsoever. This is appropriate since essentially all users jointly own the
-files when no concept of file ownership exists.</para>
-
-<para>It is important that we discuss the implications of our "kernel" using
-shared memory areas to store information about Cygwin processes. Because
-these areas are not yet protected in any way, in principle a malicious user
-could modify them to cause unexpected behavior in Cygwin processes. While
-this is not a new problem under Windows 9x (because of the lack of operating
-system security), it does constitute a security hole under Windows NT.
-This is because one user could affect the Cygwin programs run by
-another user by changing the shared memory information in ways that
-they could not in a more typical WinNT program. For this reason, it
-is not appropriate to use Cygwin in high-security applications. In
-practice, this will not be a major problem for most uses of the
-library.</para>
-</sect2>
-
-<sect2 id="ov-hi-files"><title>File Access</title> <para>Cygwin supports
-both Win32- and POSIX-style paths, using either forward or back slashes as the
-directory delimiter. Paths coming into the DLL are translated from Win32 to
-POSIX as needed. As a result, the library believes that the file system is a
-POSIX-compliant one, translating paths back to Win32 paths whenever it calls a
-Win32 API function. UNC pathnames (starting with two slashes) are
-supported.</para>
-
-<para>The layout of this POSIX view of the Windows file system space is stored
-in the Windows registry. While the slash ('/') directory points to the system
-partition by default, this is easy to change with the Cygwin mount utility.
-In addition to selecting the slash partition, it allows mounting arbitrary
-Win32 paths into the POSIX file system space. Many people use the utility to
-mount each drive letter under the slash partition (e.g. C:\ to /c, D:\ to /d,
-etc...).</para>
-
-<para>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.</para>
-
-<para>Win32 file systems are case preserving but case insensitive. Cygwin
-does not currently support case distinction because, in practice, few UNIX
-programs actually rely on it. While we could mangle file names to support case
-distinction, this would add unnecessary overhead to the library and make it
-more difficult for non-Cygwin applications to access those files.</para>
-
-<para>Symbolic links are emulated by files containing a magic cookie followed
-by the path to which the link points. They are marked with the System
-attribute so that only files with that attribute have to be read to determine
-whether or not the file is a symbolic link. Hard links are fully supported
-under Windows NT on NTFS file systems. On a FAT file system, the call falls
-back to simply copying the file, a strategy that works in many cases.</para>
-
-<para>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.</para>
-
-<para>Chroot is supported since release 1.1.3. Note that chroot isn't
-supported native by Windows. This implies some restrictions. First of all,
-the chroot call isn't a privileged call. Each user may call it. Second, the
-chroot environment isn't safe against native windows processes. If you
-want to support a chroot environment as, for example, by allowing an
-anonymous ftp with restricted access, you'll have to care that only
-native Cygwin applications are accessible inside of the chroot environment.
-Since that applications are only using the Cygwin POSIX API to access the
-file system their access can be restricted as it is intended. This includes
-not only POSIX paths but Win32 paths (containing drive letter and/or
-backslashes) and CIFS paths (//server/share or \\server\share) as well.</para>
-</sect2>
-
-<sect2 id="ov-hi-textvsbinary"><title>Text Mode vs. Binary Mode</title>
-<para>Interoperability with other Win32 programs such as text editors was
-critical to the success of the port of the development tools. Most Red Hat
-customers upgrading from the older DOS-hosted toolchains expected the new
-Win32-hosted ones to continue to work with their old development
-sources.</para>
-
-<para>Unfortunately, UNIX and Win32 use different end-of-line terminators in
-text files. Consequently, carriage-return newlines have to be translated on
-the fly by Cygwin into a single newline when reading in text mode. The
-control-z character is interpreted as a valid end-of-file character for a
-similar reason.</para>
-
-<para>This solution addresses the compatibility requirement at the expense of
-violating the POSIX standard that states that text and binary mode will be
-identical. Consequently, processes that attempt to lseek through text files can
-no longer rely on the number of bytes read as an accurate indicator of position
-in the file. For this reason, the CYGWIN environment variable can be
-set to override this behavior.</para>
-</sect2>
-
-<sect2 id="ov-hi-ansiclib"><title>ANSI C Library</title>
-<para>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.</para>
-
-<para>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.</para>
-</sect2>
-
-<sect2 id="ov-hi-process"><title>Process Creation</title>
-<para>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.</para>
-
-<para>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.</para>
-
-<para>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.</para>
-
-<para>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.</para>
-</sect2>
-
-<sect2 id="ov-hi-signals"><title>Signals</title>
-<para>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.</para>
-
-<para>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.</para>
-
-<para>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.</para>
-
-<para>Most standard UNIX signals are provided. Job
-control works as expected in shells that support
-it.</para>
-</sect2>
-
-<sect2 id="ov-hi-sockets"><title>Sockets</title>
-<para>Socket-related calls in Cygwin simply
-call the functions by the same name in Winsock, Microsoft's
-implementation of Berkeley sockets. Only a few changes were needed to
-match the expected UNIX semantics - one of the most troublesome
-differences was that Winsock must be initialized before the first
-socket function is called. As a result, Cygwin has to perform this
-initialization when appropriate. In order to support sockets across
-fork calls, child processes initialize Winsock if any inherited file
-descriptor is a socket.</para>
-
-<para>Unfortunately, implicitly loading DLLs
-at process startup is usually a slow affair. Because many processes
-do not use sockets, Cygwin explicitly loads the Winsock DLL the
-first time it calls the Winsock initialization routine. This single
-change sped up GNU configure times by thirty
-percent.</para>
-</sect2>
-
-<sect2 id="ov-hi-select"><title>Select</title>
-<para>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).</para>
-
-<para>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.</para>
-</sect2>
diff --git a/winsup/doc/pathnames.sgml b/winsup/doc/pathnames.sgml
deleted file mode 100644
index 00b216e92..000000000
--- a/winsup/doc/pathnames.sgml
+++ /dev/null
@@ -1,361 +0,0 @@
-<sect1 id="using-pathnames"><title>Mapping path names</title>
-
-<sect2><title>Introduction</title>
-
-<para>Cygwin supports both Win32- and POSIX-style paths, where
-directory delimiters may be either forward or back slashes. UNC
-pathnames (starting with two slashes and a network name) are also
-supported.</para>
-
-<para>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 <filename>/disk2</filename> directory).</para>
-
-<para>Because many programs written to run on UNIX systems assume
-the existance 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 between Win32 and POSIX paths as
-necessary.</para>
-
-</sect2>
-
-<sect2 id="mount-table"><title>The Cygwin Mount Table</title>
-
-<para>The <command>mount</command> utility program is used to
-to map Win32 drives and network shares into Cygwin's internal POSIX
-directory tree. This is a similar concept to the typical UNIX mount
-program. For those people coming from a Windows background, the
-<command>mount</command> utility is very similar to the old DOS
-<command>join</command>, in that it makes your drive letters appear as
-subdirectories somewhere else.</para>
-
-<para>The mapping is stored in the current user's Cygwin
-<FirstTerm>mount table</FirstTerm> in the Windows registry so that the
-information will be retrieved next time the user logs in. Because it
-is sometimes desirable to have system-wide as well as user-specific
-mounts, there is also a system-wide mount table that all Cygwin users
-inherit. The system-wide table may only be modified by a user with
-the appropriate priviledges (Administrator priviledges in Windows
-NT).</para>
-
-<para>The current user's table is located under
-"HKEY_CURRENT_USER/Software/Red Hat, Inc./Cygwin/mounts
-v&lt;version&gt;"
-where &lt;version&gt; is the latest registry version associated with
-the Cygwin library (this version is not the same as the release
-number). The system-wide table is located under the same subkeys
-under HKEY_LOCAL_SYSTEM.</para>
-
-<para>By default, the POSIX root <filename>/</filename> points to the
-system partition but it can be relocated to any directory in the
-Windows file system using the <command>mount</command> command.
-Whenever Cygwin generates a POSIX path from a Win32 one, it uses the
-longest matching prefix in the mount table. Thus, if
-<filename>C:</filename> is mounted as <filename>/c</filename> and also
-as <filename>/</filename>, then Cygwin would translate
-<filename>C:/foo/bar</filename> to <filename>/c/foo/bar</filename>.</para>
-
-<para>Invoking <command>mount</command> without any arguments displays
-Cygwin's current set of mount points.
-In the following example, the C
-drive is the POSIX root and D drive is mapped to
-<filename>/d</filename>. 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 <filename>/d</filename> mount is only visible
-to the current user.</para>
-
-<example>
-<title>Displaying the current set of mount points</title>
-<screen>
-<prompt>c:\&gt;</prompt> <userinput>mount</userinput>
-f:\cygwin\bin on /usr/bin type system (binmode)
-f:\cygwin\lib on /usr/lib type system (binmode)
-f:\cygwin on / type system (binmode)
-e:\src on /usr/src type system (binmode)
-c: on /cygdrive/c type user (binmode,noumount)
-e: on /cygdrive/e type user (binmode,noumount)
-</screen>
-</example>
-
-<para>You can also use the <command>mount</command> command to add
-new mount points, and the <command>umount</command> to delete
-them. See <Xref Linkend="mount"> and <Xref Linkend="umount"> for more
-information on how to use these utilities to set up your Cygwin POSIX
-file system.</para>
-
-<para>Whenever Cygwin cannot use any of the existing mounts to convert
-from a particular Win32 path to a POSIX one, Cygwin will
-automatically default to an imaginary mount point under the default POSIX
-path <filename>/cygdrive</filename>. For example, if Cygwin accesses
-<filename>Z:\foo</filename> and the Z drive is not currently in the
-mount table, then <filename>Z:\</filename> would be automatically
-converted to <filename>/cygdrive/Z</filename>. The default
-prefix of <filename>/cygdrive</filename> may be changed (see the
-<Xref Linkend="mount"> for more information).</para>
-
-<para>It is possible to assign some special attributes to each mount
-point. Automatically mounted partitions are displayed as "auto"
-mounts. Mounts can also be marked as either "textmode" or "binmode"
--- whether text files are read in the same manner as binary files by
-default or not (see <Xref Linkend="using-textbinary"> for more
-information on text and binary modes.</para>
-
-</sect2>
-
-<sect2><title>Additional Path-related Information</title>
-
-<para>The <command>cygpath</command> program provides the ability to
-translate between Win32 and POSIX pathnames in shell scripts. See
-<Xref Linkend="cygpath"> for the details.</para>
-
-<para>The <EnVar>HOME</EnVar>, <EnVar>PATH</EnVar>, and
-<EnVar>LD_LIBRARY_PATH</EnVar> environment variables are automatically
-converted from Win32 format to POSIX format (e.g. from
-<filename>c:\cygwin\bin</filename> to <filename>/bin</filename>, if
-there was a mount from that Win32 path to that POSIX path) when a Cygwin
-process first starts.</para>
-
-<para>Symbolic links can also be used to map Win32 pathnames to POSIX.
-For example, the command
-<command>ln -s //pollux/home/joe/data /data</command> would have about
-the same effect as creating a mount point from
-<filename>//pollux/home/joe/data</filename> to <filename>/data</filename>
-using <command>mount</command>, 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).</para>
-
-</sect2>
-
-</sect1>
-
-<sect1 id="using-specialnames"><title>Special filenames</title>
-
-<sect2> <title>DOS devices</title>
-
-<para>Windows filenames invalid under Windows are also invalid under
-Cygwin. This means that base filenames such as
-<filename>AUX</filename>, <filename>COM1</filename>,
-<filename>LPT1</filename> or <filename>PRN</filename> (to name a few)
-cannot be used in a regular Cygwin Windows or POSIX path, even with an
-extension (<filename>prn.txt</filename>). However the special names can be
-used as filename extensions (<filename>file.aux</filename>). You can use
-the special names as you would under DOS, for example you can print on your
-default printer with the command <command>cat filename > PRN</command>
-(make sure to end with a Form Feed).
-</para>
-
-</sect2>
-
-<sect2> <Title>POSIX devices</title>
-<para>There is no need to create a POSIX <filename>/dev</filename>
-directory as it is simulated within Cygwin automatically.
-It supports the following devices: <filename>/dev/null</filename>,
-<filename>/dev/zero</filename>, <filename>/dev/tty</filename>,
-<filename>/dev/ttyX</filename>, <filename>/dev/ptmx</filename>,
-<filename>/dev/comX</filename> (the serial ports),
-<filename>/dev/windows</filename> (the windows message queue),
-<filename>/dev/random</filename> and <filename>/dev/urandom</filename>.
-These devices cannot be seen with the command <command>ls /dev</command>
-although commands such as <command>ls /dev/tty</command> work fine.
-</para>
-
-<para>Windows NT/W2K/XP additionally support raw devices like floppies,
-disks, partitions and tapes. These are accessed from Cygwin applications
-using POSIX device names which are supported in two different ways.
-Up to 1.3.3, Cygwin only uses Win32 device names, since 1.3.4
-it additionally uses NT internal device names.
-</para>
-
-<para>Up to Cygwin 1.3.3 the only way to access those devices is
-to mount the Win32 device names to a POSIX device name.
-</para>
-
-<para>
-The Win32 device name for a partition is the drive letter
-with leading <filename>\\.\</filename>, so the floppy would be
-<filename>\\.\A:</filename>, the first partition typically
-<filename>\\.\C:</filename>. Complete drives (except floppies and CD-ROMS
-which are supported as partitions only) are named
-<filename>\\.\PHYSICALDRIVEx</filename>. The <literal>x</literal>
-is the drive number which you can check in the disk manager.
-Each drive line has prepended the text "Disk x".
-</para>
-
-<para>To access tape drives the Win32 file name <filename>\\.\TAPEx</filename>
-is used. For example the first installed tape device is named
-<filename>\\.\tape0</filename>.
-</para>
-
-<para>
-The naming convention is simple: The name of the POSIX device has to begin with
-<filename>/dev/</filename> and the rest is as you like. The only
-exception are tape devices. To identify if the tape device is
-used as a rewind or a no-rewind device the name must not begin with
-<literal>n</literal> (rewind) or has to begin with <literal>n</literal>
-(no-rewind).
-</para>
-
-<para>Some examples:</para>
-
-<screen>
-mount -b //./A: /dev/fd0 # mount floppy as raw block special
-mount -b //./physicaldrive1 /dev/hdb # mount "Disk 1"
-mount -b //./tape0 /dev/st0 # mount first tape as the rewind device...
-mount -b //./tape0 /dev/nst0 # ...and as the no-rewind device
-</screen>
-
-<para>Note the usage of the <literal>-b</literal> option. It is best to
-include the -b option when mounting these devices to ensure that all
-file I/O is in "binary mode".
-</para>
-
-<para>
-Since Cygwin 1.3.4 raw devices are accessible from inside of Cygwin processes
-using fixed POSIX device names. That means, you don't have to mount the devices
-anymore which results in a more cleaner mount table.
-</para>
-
-<para>
-These new fixed 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.
-</para>
-
-<para>The new fixed POSIX names are mapped to NT internal devices as
-follows:</para>
-
-<screen>
-/dev/st0 \device\tape0, rewind
-/dev/nst0 \device\tape0, no-rewind
-/dev/st1 \device\tape1
-...
-
-/dev/fd0 \device\floppy0
-/dev/fd1 \device\floppy1
-...
-
-/dev/scd0 \device\cdrom0
-/dev/scd1 \device\cdrom1
-...
-
-/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/sdl \device\harddisk11\partition0
-/dev/sdl1 \device\harddisk11\partition1
-...
-/dev/sdl15 \device\harddisk11\partition15
-</screen>
-
-<para>
-if you don't like these device names, feel free to create symbolic
-links as they are created on Linux systems for convenience:
-</para>
-
-<screen>
-ln -s /dev/scd0 /dev/cdrom
-ln -s /dev/st0 /dev/tape
-...
-</screen>
-
-<para>
-Note that you can't use the mount table to map from fixed device name
-to your own device name or to map from internal NT device name to
-your own device name. The following two examples will not work:
-</para>
-
-<screen>
-mount -s -f -b /dev/st0 /dev/tape
-mount -s -f -b /device/tape0 /dev/tape
-</screen>
-
-</sect2>
-
-<sect2><title>The .exe extension</title>
-
-<para> Executable program 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.
-</para>
-
-<para>As a side effect, the <command> ls filename</command> gives
-information about <filename>filename.exe</filename> if
-<filename>filename.exe</filename> exists and <filename>filename</filename>
-does not. In the same situation the function call
-<function>stat("filename",..)</function> gives information about
-<filename>filename.exe</filename>. The two files can be distinguished
-by examining their inodes, as demonstrated below.
-<screen>
-<prompt>C:\&gt;</prompt> <userinput>ls * </userinput>
-a a.exe b.exe
-<prompt>C:\&gt;</prompt> <userinput>ls -i a a.exe</userinput>
-445885548 a 435996602 a.exe
-<prompt>C:\&gt;</prompt> <userinput>ls -i b b.exe</userinput>
-432961010 b 432961010 b.exe
-</screen>
-If a shell script <filename>myprog</filename> and a program
-<filename>myprog.exe</filename> coexist in a directory, the program
-has precedence and is selected for execution of
-<command>myprog</command>.</para>
-
-<para>The <command>gcc</command> compiler produces an executable named
-<filename>filename.exe</filename> when asked to produce
-<filename>filename</filename>. This allows many makefiles written
-for UNIX systems to work well under Cygwin.</para>
-
-<para>Unfortunately, the <command>install</command> and
-<command>strip</command> commands do distinguish between
-<filename>filename</filename> and <filename>filename.exe</filename>. They
-fail when working on a non-existing <filename>filename</filename> even if
-<filename>filename.exe</filename> exists, thus breaking some makefiles.
-This problem can be solved by writing <command>install</command> and
-<command>strip</command> shell scripts to provide the extension ".exe"
-when needed.
-</para>
-</sect2>
-
-<sect2><title>The @pathnames</title>
-<para>To circumvent the limitations on shell line length in the native
-Windows command shells, Cygwin programs expand their arguments
-starting with "@" in a special way. If a file
-<filename>pathname</filename> exists, the argument
-<filename>@pathname</filename> expands recursively to the content of
-<filename>pathname</filename>. Double quotes can be used inside the
-file to delimit strings containing blank space.
-Embedded double quotes must be repeated.
-In the following example compare the behaviors of the bash built-in
-<command>echo</command> and of the program <command>/bin/echo</command>.</para>
-
-<example><title> Using @pathname</title>
-<screen>
-<prompt>bash$</prompt> <userinput>echo 'This is "a long" line' > mylist</userinput>
-<prompt>bash$</prompt> <userinput>echo @mylist</userinput>
-@mylist
-<prompt>bash$</prompt> <userinput>/bin/echo @mylist</userinput>
-This is a long line
-<prompt>bash$</prompt> <userinput>rm mylist</userinput>
-<prompt>bash$</prompt> <userinput>/bin/echo @mylist</userinput>
-@mylist
-</screen>
-</example>
-</sect2>
-</sect1>
diff --git a/winsup/doc/programming.sgml b/winsup/doc/programming.sgml
deleted file mode 100644
index 45f26f4fa..000000000
--- a/winsup/doc/programming.sgml
+++ /dev/null
@@ -1,11 +0,0 @@
-<chapter id="programming"><title>Programming with Cygwin</title>
-
-DOCTOOL-INSERT-gcc
-
-DOCTOOL-INSERT-gdb
-
-DOCTOOL-INSERT-dll
-
-DOCTOOL-INSERT-windres
-
-</chapter>
diff --git a/winsup/doc/readme.texinfo b/winsup/doc/readme.texinfo
deleted file mode 100644
index bcd32a633..000000000
--- a/winsup/doc/readme.texinfo
+++ /dev/null
@@ -1,17 +0,0 @@
-\input texinfo
-@title The Cygwin README
-
-@subtitle (Only partially updated for the latest net release.)
-
-@setfilename readme.txt
-
-@include install.texinfo
-
-@chapter Release Information
-
-@strong{(Please note: This section has not yet been updated for the latest
-net release.)}
-
-@include changes.texinfo
-
-@include relnotes.texinfo
diff --git a/winsup/doc/relnotes.texinfo b/winsup/doc/relnotes.texinfo
deleted file mode 100644
index f18c591d6..000000000
--- a/winsup/doc/relnotes.texinfo
+++ /dev/null
@@ -1,24 +0,0 @@
-@chapter Known Problems in the Latest Net Release
-
-@section Aware of the problem, no solution known.
-
-@subsection Pipe key (@samp{|}) doesn't work on non-US keyboards in Win9x/ME
-
-This might get fixed someday, but meanwhile, just use rxvt, which does
-not have this problem. This is no real loss, because rxvt has many
-other advantages. (Do not attempt to use the "broken" pipe key
-(@samp{¦}) as a substitute, it is a different character.)
-
-@subsection Cannot access tape devices with mt on Win9x
-
-Win9x does not support the API used by the Cygwin fhandler_dev_tape
-class. Details at
-@file{http://sources.redhat.com/ml/cygwin/2000-12/msg00331.html}.
-
-@subsection On Win9x, scp leaves ssh processes running.
-
-@section Fixed in the Next Release
-
-(Nothing to report.)
-
-
diff --git a/winsup/doc/setup-net.sgml b/winsup/doc/setup-net.sgml
deleted file mode 100644
index cc40f312b..000000000
--- a/winsup/doc/setup-net.sgml
+++ /dev/null
@@ -1,15 +0,0 @@
-<chapter id="setup-net"><title>Setting Up Cygwin</title>
-
-<sect1><title>Internet Setup</title>
-<para>To install the Cygwin net release, go to <ulink
-URL="http://cygwin.com/">http://cygwin.com/</ulink> and click on <ulink
-URL="http://cygwin.com/">"Install Cygwin Now!"</ulink>. This will
-download a GUI installer called <command>setup.exe</command> which can
-be run to download a complete cygwin installation via the internet.
-Follow the instructions on each screen to install Cygwin.</para>
-</sect1>
-
-DOCTOOL-INSERT-setup-env
-DOCTOOL-INSERT-ntsec
-DOCTOOL-INSERT-setup-files
-</chapter>
diff --git a/winsup/doc/setup.sgml b/winsup/doc/setup.sgml
deleted file mode 100644
index 1ba28abb5..000000000
--- a/winsup/doc/setup.sgml
+++ /dev/null
@@ -1,47 +0,0 @@
-<chapter id="setup"><title>Setting Up Cygwin</title>
-
-<sect1><title>Cygwin Contents</title>
-
-<para>The following packages are included in the native Win32
-release of GNUPro:</para>
-
-<para>GNUPro development tools: binutils, bison, byacc, dejagnu,
-diff, expect, flex, gas, gcc, gdb, itcl, ld, libstdc++, make, patch,
-tcl, tix, tk</para>
-
-<para>GNUPro unsupported tools: ash, bash, bzip2, diff, fileutils,
-findutils, gawk, grep, gzip, m4, sed, shellutils, tar, textutils,
-time</para>
-
-</sect1>
-
-<sect1 id="installing-binaries"><title>Installing the binary release</title>
-
-<para>Load the GNUPro CD-ROM and run the installer. It will
-take you through the installation process, starting with asking for
-your install location. Once the installation is complete, there will
-be a new Program Files folder that you can use to obtain a shell
-from which you can run the tools.</para>
-
-<para>There are two remaining thing you should do from this
-prompt. First, you need to type <command>mkdir -p /tmp</command> to
-ensure that a temp directory exists for programs that expect to find
-one there.</para>
-
-<para>Second, depending on how you intend to use the tools, various
-programs may need to be able to find `/bin/sh'. You should `mkdir -p
-/bin' and put a copy of `sh.exe' there, removing the older version, if
-present. Note that you can use the `mount' utility to select which
-drive letter is mounted as `/'.</para>
-
-<para>If you should ever want to uninstall the tools, you may do so
-via the "Add/Remove Programs" control panel.</para>
-
-</sect1>
-
-DOCTOOL-INSERT-setup-dir
-DOCTOOL-INSERT-setup-env
-DOCTOOL-INSERT-ntsec
-DOCTOOL-INSERT-setup-reg
-DOCTOOL-INSERT-setup-mount
-</chapter>
diff --git a/winsup/doc/setup2.sgml b/winsup/doc/setup2.sgml
deleted file mode 100644
index 4b2ecf6ef..000000000
--- a/winsup/doc/setup2.sgml
+++ /dev/null
@@ -1,133 +0,0 @@
-<sect1 id="setup-env"><title>Environment Variables</title>
-
-<para>
-Before starting bash, you may set some environment variables. A .bat
-file is provided where the most important ones are set before bash in
-launched. This is the safest way to launch bash initially. The .bat
-file is installed in the root directory that you specified during setup
-and pointed to in the Start Menu under the "Cygwin" option. You can
-edit it this file your liking.</para>
-
-<para>
-The <envar>CYGWIN</envar> variable is used to configure many global
-settings for the Cygwin runtime system. Initially you can leave
-<envar>CYGWIN</envar> unset or set it to <literal>tty</literal> (e.g.
-to support job control with ^Z etc...) using a syntax like this in the
-DOS shell, before launching bash. </para>
-
-<screen>
-<prompt>C:\&gt;</prompt> <userinput>set CYGWIN=tty notitle glob</userinput>
-</screen>
-
-<para>
-The <envar>PATH</envar> 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. <filename>C:\WinNT\system32;C:\WinNT</filename>) to UNIX format
-(e.g., <filename>/WinNT/system32:/WinNT</filename>) when a Cygwin
-process first starts.
-Set it so that it contains at least the <filename>x:\cygwin\bin</filename>
-directory where "<filename>x:\cygwin</filename> is the "root" of your
-cygwin installation if you wish to use cygwin tools outside of bash.
-</para>
-
-<para>
-The <envar>HOME</envar> 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. Set it to point to your home directory
-before launching bash.
-</para>
-
-<para>
-The <envar>TERM</envar> environment variable specifies your terminal
-type. It is automatically set to <literal>cygwin</literal> if you have
-not set it to something else.
-</para>
-
-<para>The <envar>LD_LIBRARY_PATH</envar> environment variable is used by
-the Cygwin function <function>dlopen ()</function> 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
-<function>dlopen ()</function> call and do not need this variable.
-</para>
-
-</sect1>
-
-<sect1 id="setup-files"><title>Customizing bash</title>
-
-<para>
-To set bash up so that cut and paste work properly, click on the
-"Properties" button of the window, then on the "Misc" tab. Make sure
-that "Quick Edit" is checked and "Fast Pasting" isn't. 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.
-</para>
-
-<para>
-Your home directory should contain three initialization files
-that control the behavior of bash. They are
-<filename>.profile</filename>, <filename>.bashrc</filename> and
-<filename>.inputrc</filename>. These initialization files will only
-be read if <envar>HOME</envar> is defined before starting bash.
-</para>
-
-<para>
-<filename>.profile</filename> (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 <command>bash --login</command> (the provided
-.bat file does not set the switch). 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
-<envar>PATH</envar> if needed. We recommend adding a ":." to the end of
-<envar>PATH</envar> 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 <command>unset</command> <envar>MAILCHECK</envar>
-or define <envar>MAILPATH</envar> to point to your existing mail inbox.
-</para>
-
-<para>
-<filename>.bashrc</filename> is similar to
-<filename>.profile</filename> 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
-<filename>.profile</filename> as discussed above in this file
-instead.
-</para>
-
-<para>
-<screen>
-shopt -s nocaseglob
-</screen>
-will allow bash to glob filenames in a case-insensitive manner.
-Note that <filename>.bashrc</filename> is not called automatically for login
-shells. You can source it from <filename>.profile</filename>.
-</para>
-
-<para>
-<filename>.inputrc</filename> controls how programs using the readline
-library (including bash) behave. It is loaded automatically. The
-full details are in the <filename>readline.info</filename>.
-Due to a bug in the current readline version,
-<filename>.inputrc</filename> cannot contain \r,
-even on text mounted systems.
-Consider the following settings:
-<screen>
-# Make Bash 8bit clean
-set meta-flag on
-set convert-meta off
-set output-meta on
-# Ignore case while completing
-set completion-ignore-case on
-</screen>
-The first three commands allow bash to display 8-bit characters,
-useful for languages with accented characters. The last line makes
-filename completion case insensitive, which can be convenient in a
-Windows environment.
-</para>
-
-</sect1>
-
diff --git a/winsup/doc/textbinary.sgml b/winsup/doc/textbinary.sgml
deleted file mode 100644
index a58bd0231..000000000
--- a/winsup/doc/textbinary.sgml
+++ /dev/null
@@ -1,181 +0,0 @@
-<sect1 id="using-textbinary"><title>Text and Binary modes</title>
-
-<sect2> <title>The Issue</title>
-
-<para>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 in text mode there are
-major differences:</para>
-<OrderedList Numeration="Loweralpha" Spacing="Compact">
-<listitem>
-<para>
-On writing in text mode, a NL (\n, ^J) is transformed into the
-sequence CR (\r, ^M) NL.</para>
-</listitem>
-<listitem>
-<para>
-On reading in text mode, a CR followed by an NL is deleted and a ^Z
-character signals the end of file.</para>
-</listitem>
-</OrderedList>
-
-<para>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.</para>
-
-<para>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 <command>bash</command>, <command>make</command>,
-<command>sed</command> ...) would open files (and change the mode of their
-standard input and output) as text. All other programs (such as
-<command>cat</command>, <command>cmp</command>, <command>tr</command> ...)
-would use binary mode. In practice with Cygwin, programs that deal
-explicitly with object files specify binary mode (this is the case of
-<command>od</command>, which is helpful to diagnose CR problems). Most
-other programs (such as <command>cat</command>, <command>cmp</command>,
-<command>tr</command>) use the default mode.</para>
-
-</sect2>
-
-<sect2><title>The default Cygwin behavior</title>
-
-<para>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.</para>
-<OrderedList Numeration="Loweralpha">
-<listitem>
-<para>If the file appears to reside on a file system that is mounted
-(i.e. if its pathname starts with a directory displayed by
-<command>mount</command>), then the default is specified by the mount
-flag. If the file is a symbolic link, the mode of the target file system
-applies.</para>
-</listitem>
-<listitem>
-<para>If the file appears to reside on a file system that is not mounted
-(as can happen when the path contains a drive letter), the default is text.
-</para>
-</listitem>
-<listitem>
-<para>Pipes and non-file devices are opened in binary mode,
-except if the <EnVar>CYGWIN</EnVar> environment variable contains
-<literal>nobinmode</literal>.</para>
-<warning><Title>Warning!</Title><para>In b20.1 of 12/98, a file will be opened
-in binary mode if any of the following conditions hold:</para>
-<OrderedList Numeration="arabic" Spacing="Compact">
-<listitem><para>binary mode is specified in the open call</para>
-</listitem>
-<listitem><para><envar>CYGWIN</envar> contains <literal>binmode</literal></para>
-</listitem>
-<listitem><para>the file resides in a binary mounted partition</para>
-</listitem>
-<listitem><para>the file is not a disk file</para>
-</listitem>
-</OrderedList>
-</warning>
-</listitem>
-
-<listitem>
-<para>When a Cygwin program is launched by a shell, its standard input,
-output and error are in binary mode if the <envar>CYGWIN</envar> variable
-contains <literal>tty</literal>, else in text mode, except if they are piped
-or redirected.</para>
-<para> When redirecting, the Cygwin shells uses rules (a-c). For
-these shells the relevant value of <envar>CYGWIN</envar> is that at the time
-the shell was launched and not that at the time the program is executed.
-Non-Cygwin shells always pipe and redirect with binary mode. With
-non-Cygwin shells the commands <command> cat filename | program </command>
-and <command> program &lt filename </command> are not equivalent when
-<filename>filename</filename> is on a text-mounted partition. </para>
-</listitem>
-</OrderedList>
-</sect2>
-
-<sect2><title>Example</title>
-<para>To illustrate the various rules, we provide scripts to delete CRs
-from files by using the <command>tr</command> program, which can only write
-to standard output.
-The script</para>
-<screen>
-#!/bin/sh
-# Remove \r from the file given as argument
-tr -d '\r' < "$1" > "$1".nocr
-</screen>
-<para> will not work on a text mounted systems because the \r will be
-reintroduced on writing. However scripts such as </para>
-<screen>
-#!/bin/sh
-# Remove \r from the file given as argument
-tr -d '\r' | gzip | gunzip > "$1".nocr
-</screen>
-<para>and the .bat file</para>
-<screen>
-REM Remove \r from the file given as argument
-@echo off
-tr -d \r < %1 > %1.nocr
-</screen>
-<para> work fine. In the first case (assuming the pipes are binary)
-we rely on <command>gunzip</command> to set its output to binary mode,
-possibly overriding the mode used by the shell.
-In the second case we rely on the DOS shell to redirect in binary mode.
-</para>
-</sect2>
-
-<sect2><title>Binary or text?</title>
-
-<para>UNIX programs that have been written for maximum portability
-will know the difference between text and binary files and act
-appropriately under Cygwin. For those programs, the text mode default
-is a good choice. Programs included in official Cygwin distributions
-should work well in the default mode. </para>
-
-<para>Text mode makes it much easier to mix files between Cygwin and
-Windows programs, since Windows programs will usually use the CRLF
-format. Unfortunately you may still have some problems with text
-mode. First, some of the utilities included with Cygwin do not yet
-specify binary mode when they should, e.g. <command>cat</command> will
-not work with binary files (input will stop at ^Z, CRs will be
-introduced in the output). Second, you will introduce CRs in text
-files you write, which can cause problems when moving them back to a
-UNIX system. </para>
-
-<para>If you are mounting a remote file system from a UNIX machine,
-or moving files back and forth to a UNIX machine, you may want to
-access the files in binary mode. The text files found there will normally
-be in UNIX NL format, and you would want any files put there by Cygwin
-programs to be stored in a format understood by UNIX.
-Be sure to remove CRs from all Makefiles and
-shell scripts and make sure that you only edit the files with
-DOS/Windows editors that can cope with and preserve NL terminated lines.
-</para>
-
-<para>Note that you can decide this on a disk by disk basis (for
-example, mounting local disks in text mode and network disks in binary
-mode). You can also partition a disk, for example by mounting
-<filename>c:</filename> in text mode, and <filename>c:\home</filename>
-in binary mode.</para>
-
-</sect2>
-
-<sect2><title>Programming</title>
-
-<para>In the <function>open()</function> function call, binary mode can be
-specified with the flag <literal>O_BINARY</literal> and text mode with
-<literal>O_TEXT</literal>. These symbols are defined in
-<filename>fcntl.h</filename>.</para>
-
-<para>In the <function>fopen()</function> function call, binary mode can be
-specified by adding a <literal>b</literal> to the mode string. There is no
-direct way to specify text mode.</para>
-
-<para>The mode of a file can be changed by the call
-<function>setmode(fd,mode)</function> where <literal>fd</literal> is a file
-descriptor (an integer) and <literal>mode</literal> is
-<literal>O_BINARY</literal> or <literal>O_TEXT</literal>. The function
-returns <literal>O_BINARY</literal> or <literal>O_TEXT</literal> depending
-on the mode before the call, and <literal>EOF</literal> on error.</para>
-
-</sect2>
-
-</sect1>
diff --git a/winsup/doc/using.sgml b/winsup/doc/using.sgml
deleted file mode 100644
index 9d60e77bf..000000000
--- a/winsup/doc/using.sgml
+++ /dev/null
@@ -1,19 +0,0 @@
-<chapter id="using"><title>Using Cygwin</title>
-
-<para>This chapter explains some key differences between the Cygwin
-environment and traditional UNIX systems. It assumes a working
-knowledge of standard UNIX commands.</para>
-
-DOCTOOL-INSERT-using-pathnames
-
-DOCTOOL-INSERT-using-textbinary
-
-DOCTOOL-INSERT-using-filemodes
-
-DOCTOOL-INSERT-using-specialnames
-
-DOCTOOL-INSERT-using-cygwinenv
-
-DOCTOOL-INSERT-using-utils
-
-</chapter>
diff --git a/winsup/doc/what.texinfo b/winsup/doc/what.texinfo
deleted file mode 100644
index cc0ec246d..000000000
--- a/winsup/doc/what.texinfo
+++ /dev/null
@@ -1,160 +0,0 @@
-@chapter 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 UNIX system calls and environment these programs expect.
-
-With these tools installed, it is possible to 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 packages
-included with the Cygwin development tools themselves). Even if
-the development tools are of little to no use to you, you may have
-interest in the many standard Unix utilities provided with the package.
-They can be used both from the bash shell (provided) or from the
-standard Windows command shell.
-
-@section What versions of Windows are supported?
-
-Wait a minute... Cygwin is only @emph{supported} if you are paying for
-it, such as through a support contract with Red Hat. For information
-about getting a Red Hat support contract, see
-@file{http://www.redhat.com/software/tools/cygwin/}.
-
-That said, Cygwin can be expected to run on all modern 32 bit versions of
-Windows, except Windows CE. This includes Windows 95/98/ME/NT/2000/XP.
-
-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.
-
-@section Where can I get it?
-
-The main WWW page for the Cygwin project is
-@file{http://cygwin.com/}. There you should find
-everything you need for Cygwin, including links for download and setup,
-a current list of ftp 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 at
-@file{http://www.fsf.org/manual/}. (You should read GNU manuals from a
-local mirror. Check @file{http://www.fsf.org/server/list-mirrors.html}
-for a list of them.)
-
-
-@section 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 Cygnus 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 more 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; please
-contact sales@@cygnus.com for more information.
-All other questions should be sent to the 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.
-
-The Cygwin 1.0 product was a "commercial" distribution of cygwin. As
-such, it included such non-software things as printed manuals, support,
-and aggregation of useful utilities. There was nothing (software-wise)
-in there that you couldn't get off the net already, if you took the time
-to find and download everything (and usually, build it yourself),
-although the @emph{versions} available for download may have been
-different than those distributed with the commercial product. We tested
-it all to make sure it worked together, and packaged it in a convenient
-form. We considered such testing and packaging to be a valuable service
-and thus charged a fee for it. Plus, it provided income for the cygwin
-project so we could continue working on it. However, Red Hat is no
-longer offering Cygwin 1.0 on CD. There are tentative plans to offer a
-new Cygwin CD sometime in early 2001. So far, however, there are no
-definite plans. The latest news about this can be found at
-@file{http://cygwin.com/cygwin-cd.html}.
-
-
-@section Recent history of the project: What version @emph{is} this, anyway?
-
-Starting on April 17, 2000, the Cygwin team changed the procedure for
-doing net releases.
-
-Previously, net releases entailed downloading one or two large files
-(called something like @code{FULL.EXE} or @code{USER.EXE}). These files
-unpacked a "Cygwin Distribution" to a static (and arcane) directory
-structure. This distribution contained lots of .exe, .a, .h, and other
-files.
-
-These distributions were named after the version of the Cygwin DLL which
-they contained. The last version released with this method was Cygwin
-B20.1.
-
-This distribution method has the advantage that everything was "all in
-one place". You could copy the huge FULL.EXE file around and know that
-you were getting the complete "Cygwin Distribution".
-
-The method had several disadvantages, however. 1) it was huge, 2) it
-was hard to download in one error-free piece, and 3) it was hard to
-update.
-
-Why was it hard to update? Because any change to any package in
-FULL.EXE meant re-generating all of FULL.EXE. This process was not easy
-to automate since FULL.EXE was an InstallShield executable. As a
-result, until recently, Cygwin development was relatively static.
-
-To rectify these problems, the Cygwin team decided, early in January
-2000, to break up the packages in the release and make a small program
-(@code{setup.exe}) available to use in downloading packages. After much
-development and internal discussion on the cygwin-developers mailing
-list, the new, improved version of a Cygwin release was made available
-on April 17, 2000.
-
-This new release also had a new version of the Cygwin DLL -- 1.1.0.
-Most of the other packages were updated and some packages from the
-Cygwin CD were included. Meanwhile, the Cygwin DLL continues to be
-updated, and since release 1.3.1, is more generically referred to as
-"1.3.x".
-
-Users obtain this package by first downloading a version of
-@code{setup.exe}. This program started as a simple command line tool,
-has metamorphosed into a GUI, and is in the process of continual
-improvement. However, its purpose is simple -- it is designed to
-install packages from the cygwin web site at @file{http://cygwin.com/}.
-In effect, it is a smaller, more intelligent replacement for FULL.EXE.
-It does not require the downloading a huge executable but rather
-downloads individual small packages.
-
-Does this mean that the new net release of the Cygwin package is 1.3.x?
-No. We no longer label the releases with the Cygwin version number.
-Each package in the cygwin release has its own version now.
-
-Does this mean that Cygwin 1.3.x is newer than B20.1? Yes! The cygwin
-1.3.x versions all represent continual improvement in the Cygwin DLL.
-Although the 1.3.x code is still considered "beta quality", the Cygwin
-team felt comfortable enough with the cygwin technology to bump the
-version number to "1".
-
-The other packages in the latest directory are also 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 setup.exe program from your closest mirror. This program
-will handle the task of updating the packages on your system to the
-latest version. The Cygwin team frequently updates and adds new
-packages to the soureware web site. The setup.exe program is the
-easiest way to determine what you need on your system.
-
-For some "ancient" history of the project (rather, just woefully out of
-date), visit the Project History page at
-@file{http://cygwin.com/history.html}.
diff --git a/winsup/doc/who.texinfo b/winsup/doc/who.texinfo
deleted file mode 100644
index cc93ceaa1..000000000
--- a/winsup/doc/who.texinfo
+++ /dev/null
@@ -1,88 +0,0 @@
-@chapter Who's behind the project?
-
-@strong{(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.)}
-
-Chris Faylor is behind many of the recent changes in Cygwin. Prior to
-joining Cygnus, he contributed significant fixes to the process control
-and environ code, reworked the strace mechanism, and rewrote the
-signal-related code from scratch as a Net contributor. In addition to
-continuing to make technical contributions, Chris is also currently the
-group's manager.
-
-Corinna Vinschen has contributed several useful fixes to the path
-handling code, console support, improved security handling, and raw
-device support. Corinna is currently employed by Red Hat as a
-GDB/Cygwin engineer.
-
-DJ Delorie has done important work in profiling Cygwin,
-worked on the Dejagnu automated testing framework, merged the dlltool
-functionality into ld, wrote a good deal of the Cygwin Users' Guide,
-authored the cygcheck utility, and made automated snapshots available
-from our project WWW page. DJ is currently employed by Red Hat as
-a GCC engineer.
-
-Egor Duda has contributed many useful fixes. He is responsible for
-Cygwin's ability to start a debugger on detection of a fatal error
-as well as produce core dumps.
-
-Robert Collins has contributed many improvements to thread handling
-as well as generic fixes to cygwin itself.
-
-Kazuhiro Fujieda has contributed many bug fixes and bug reports.
-
-Earnie Boyd has contributed many bug fixes and is the mingw and w32api
-maintainer.
-
-David Starks-Browning is our dedicated FAQ maintainer.
-
-Geoffrey Noer took over the Cygwin project from its initial author Steve
-Chamberlain in mid-1996. As maintainer, he produced Net releases beta
-16 through 20; made the development snapshots; worked with Net
-contributors to fix bugs; made many various code improvements himself;
-wrote a paper on Cygwin for the 1998 Usenix NT Symposium; authored the
-project WWW pages, FAQ, README; etc. Geoffrey is not currently employed
-by Red Hat.
-
-Steve Chamberlain designed and implemented
-Cygwin in 1995-1996 while working for Cygnus. He worked with the Net
-to improve the technology, ported/integrated many of the user tools
-for the first time to Cygwin, and produced all of the releases up to
-beta 14. Steve is not currently employed by Red Hat.
-
-Marco Fuykschot and Peter Boncz of Data Distilleries contributed nearly
-all of the changes required to make Cygwin thread-safe. They also
-provided the pthreads interface.
-
-Sergey Okhapkin has been an invaluable Net contributor. He implemented
-the tty/pty support, has played a significant role in revamping signal
-and exception handling, and has made countless contributions throughout
-the library. He also provided binaries of the development snapshots to
-the Net after the beta 19 release.
-
-Mumit Khan has been most helpful on the EGCS end of things, providing
-quite a large number of stabilizing patches to the compiler tools for
-the B20 release.
-
-Philippe Giacinti contributed the implementation of dlopen, dlclose,
-dlsym, dlfork, and dlerror in Cygwin.
-
-Ian Lance Taylor did a much-needed rework of the path handling code for
-beta 18, and has made many assorted fixes throughout the code. Jeremy
-Allison made significant contributions in the area of file handling and
-process control, and rewrote select from scratch. Doug Evans rewrote
-the path-handling code in beta 16, among other things. Kim Knuttila and
-Michael Meissner put in many long hours working on the now-defunct
-PowerPC port. Jason Molenda and Mark Eichin have also made important
-contributions.
-
-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/windres.sgml b/winsup/doc/windres.sgml
deleted file mode 100644
index 2d5410639..000000000
--- a/winsup/doc/windres.sgml
+++ /dev/null
@@ -1,167 +0,0 @@
-
-<sect1 id="windres"><title>Defining Windows Resources</title>
-
-<para><filename>windres</filename> reads a Windows resource file
-(<filename>*.rc</filename>) 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
-<filename>windres</filename> program itself is fully documented in the
-Binutils manual. Here's an example of using it in a project:</para>
-
-<screen>
-myapp.exe : myapp.o myapp.res
- gcc -mwindows myapp.o myapp.res -o $@
-
-myapp.res : myapp.rc resource.h
- windres $< -O coff -o $@
-</screen>
-
-
-<para>What follows is a quick-reference to the syntax
-<filename>windres</filename> supports.</para>
-
-<screen>
-
-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
-
-</screen>
-
-</sect1>
diff --git a/winsup/mingw/CRT_fp10.c b/winsup/mingw/CRT_fp10.c
deleted file mode 100644
index a13fb0096..000000000
--- a/winsup/mingw/CRT_fp10.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * CRT_FP10.c
- *
- * This defines _fpreset as asm ("fnint"). Calls to _fpreset
- * will set default floating point precesion to 64-bit mantissa
- * at app startup.
- *
- * Linking in CRT_FP10.o before libmingw.a will override the definition
- * set in CRT_FP8.o.
- */
-
-/* Override library _fpreset() with asm fninit */
-void _fpreset (void)
- { __asm__ ( "fninit" ) ;}
-
-void __attribute__ ((alias ("_fpreset"))) fpreset(void);
diff --git a/winsup/mingw/CRT_fp8.c b/winsup/mingw/CRT_fp8.c
deleted file mode 100644
index d772d759a..000000000
--- a/winsup/mingw/CRT_fp8.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * CRT_FP8.c
- *
- * This forces calls of _fpreset to the MSVCRT function
- * exported from dll. Effectively it make default
- * precison same as apps built with MSVC (53-bit mantissa).
-
- *
- * To change to 64-bit mantissa, link in CRT_FP10.o before libmingw.a.
- */
-
-/* Link against the _fpreset visible in import lib */
-
-extern void (*_imp___fpreset)(void) ;
-void _fpreset (void)
-{ (*_imp___fpreset)(); }
-
-void __attribute__ ((alias ("_fpreset"))) fpreset(void);
diff --git a/winsup/mingw/CRT_noglob.c b/winsup/mingw/CRT_noglob.c
deleted file mode 100644
index 442820cd8..000000000
--- a/winsup/mingw/CRT_noglob.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * noglob.c
- *
- * This file defines _CRT_glob to have a value of 0, which will
- * turn off command line globbing. It is compiled into a separate object
- * file which you can add to your link line to turn off globbing like
- * this:
- *
- * gcc -o foo.exe foo.o noglob.o
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-int _CRT_glob = 0;
diff --git a/winsup/mingw/CRTfmode.c b/winsup/mingw/CRTfmode.c
deleted file mode 100644
index d0db222f0..000000000
--- a/winsup/mingw/CRTfmode.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * CRTfmode.c
- *
- * Sets _CRT_fmode to be zero, which will cause _mingw32_init_fmode to leave
- * all file modes in their default state (basically text mode).
- *
- * This file is part of the Mingw32 package.
- *
- * THIS FILE IS IN THE PUBLIC DOMAIN.
- *
- * Contributers:
- * Created by Colin Peters <colin@fu.is.saga-u.ac.jp>
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-unsigned int _CRT_fmode = 0;
diff --git a/winsup/mingw/CRTglob.c b/winsup/mingw/CRTglob.c
deleted file mode 100644
index 09f858146..000000000
--- a/winsup/mingw/CRTglob.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * CRTglob.c
- *
- * This object file defines _CRT_glob to have a value of -1, which will
- * turn on command line globbing by default. If you want to turn off
- * command line globbing include a line
- *
- * int _CRT_glob = 0;
- *
- * in one of your source modules.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-int _CRT_glob = -1;
diff --git a/winsup/mingw/CRTinit.c b/winsup/mingw/CRTinit.c
deleted file mode 100644
index fa0e7ba1f..000000000
--- a/winsup/mingw/CRTinit.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * CRTinit.c
- *
- * A dummy version of _CRT_INIT for MS compatibility. Programs, or more often
- * dlls, which use the static version of the MSVC run time are supposed to
- * call _CRT_INIT to initialize the run time library in DllMain. This does
- * not appear to be necessary when using crtdll or the dll versions of the
- * MSVC runtime, so the dummy call simply does nothing.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAMED. This includes but is not limited to warrenties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-void
-_CRT_INIT ()
-{
-}
diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog
deleted file mode 100644
index f85feb074..000000000
--- a/winsup/mingw/ChangeLog
+++ /dev/null
@@ -1,1262 +0,0 @@
-2002-06-13 Danny Smith <dannysmith@users.sourceforge.net>
-
- * include/_mingw.h: Increment version to 2.0.
- * Makefile.in: Ditto.
-
- Merge in mingwex branch.
-
- 2002-06-11 Danny Smith <dannysmith@users.sourceforge.net>
- * include/math.h (fdim, fdimf, fdiml): Add prototypes.
- * mingwex/fdim.c: New file.
- * mingwex/fdimf.c: New file.
- * mingwex/fdiml.c: New file.
- * mingwex/Makefile.in (DISTFILES): Add fdim.c, fdimf.c,
- fdiml.c.
- (MATHOBJS):Add fdim.o, fdimf.o. fdiml.o.
-
- 2002-05-23 Danny Smith <dannysmith@users.sourceforge.net>
- * mingwex/Makefile.in (DISTFILES): Add truncf.c, truncl.c.
-
- 2002-05-22 Danny Smith <dannysmith@users.sourceforge.net>
- * mingwex/isnanl.c: New file.
-
- 2002-05-21 Danny Smith <dannysmith@users.sourceforge.net>
- * include/stdint.h: Include stddef.h to get
- wchar_t and wint_t.
- (WINT_MAX): Define to ((wint_t)-1).
-
- 2002-05-21 Danny Smith <dannysmith@users.sourceforge.net>
- * include/wctype.h: Replace 'inline' with '__inline__'.
- * include/inttypes.h: Likewise.
-
- 2002-05-16 Danny Smith <dannysmith@users.sourceforge.net>
- * include/_mingw.h (__MINGW_IMPORT): Put extern at start
- to avoid warnings. Thanks to: Oscar Fuentes <ofv@wanadoo.es>.
-
- 2002-05-16 Danny Smith <dannysmith@users.sourceforge.net>
- * mingwex/snprintf.c: Split out vsnprintf to....
- * mingwex/vsnprintf.c: New file.
- * mingwex/snwprintf.c: Split out vsnwprintf to...
- * mingwex/vsnwprintf.c: New file.
- * mingwex/Makefile.in: Adjust DISTFILES and STDIO_STUB_OBJS.
-
- 2002-05-15 Pascal Obry <obry@gnat.com>
- * include/dirent.h (DIR): Change dd_stat type to int.
- (_WDIR): Likewise.
-
- 2002-05-07 Danny Smith <dannysmith@users.sourceforge.net>
- * include/stdio.h (vsnprintf): Change inline to __inline__;
- (vsnwprintf): Likewise.
- * include/wchar.h (vsnwprintf): Likewise.
- (wcstof): Likewise.
- (fwide): Likewise.
- (mbsinit): Likewise.
-
- 2002-04-29 Danny Smith <dannysmith@users.sourceforge.net>
- Change FP default precison from 53 to 64-bit mantissa.
- * Makefile.in (CRT0S): Add CRT_fp8.o.
- (MINGW_OBJS): Replace CRT_fp8.o with CRT_fp10.o.
- * include/float.h: Replace standard float.h defines with
- #include_next<float.h> to use GCC's defines. Adjust comments
- to reflect change.
-
- 2002-04-26 Danny Smith <dannysmith@users.sourceforge.net>
- * include/dos.h: Change prefix "__imp_" to "_imp__" for
- __GNUC__ without __DECLSPEC_SUPPORTED.
- * include/fnctl.h: Likewise.
- * include/math.h: Likewise.
- * include/stdio.h: Likewise.
- * include/stdlib.h: Likewise.
- * include/time.h: Likewise.
- * include/wctype.h: Likewise.
- * include/ctype.h: Likewise.
-
- 2002-04-26 Danny Smith <dannysmith@users.sourceforge.net>
- Add atexit support for dlls.
- * crt1.c (atexit): Force thunk to _imp__atexit.
- (_onexit): Force thunk to _imp___onexit.
- * dllcrt1.c (DllMainCRTStartup): Initialise private atexit
- table on DLL_PROCESS_ATTACH, clean it up on DLL_PROCESS_DETACH.
- (__dll_exit): New function to run atexit-registered functions
- and flush output buffers on DLL_PROCESS_DETACH or failed
- DLL_PROCESS_ATTACH.
- (atexit): Force use of private atexit table via _dllonexit,
- (_onexit): New function. Force use of private atexit table via
- _dllonexit,
- * mscvrt.def (atexit, _onexit): Add DATA keyword so that only
- _imp_<_symbol> is visible in import lib.
- * mscvrt20.def: Likewise.
- * mscvrt40.def: Likewise.
- * crtdll.def: Likewise.
-
- 2002-04-26 Danny Smith <dannysmith@users.sourceforge.net>
- * include/fenv.h: Change header guard macro to _FENV_H_.
- (fenv_t, fexcept_t): Move into block protected by
- #ifndef RC_INVOKED.
- Cleanup some whitespace.
- * include/inttypes.h: Change header guard macro to
- _INTTYPES_H_.
-
- 2002-04-26 Danny Smith <dannysmith@users.sourceforge.net>
- * include/math.h (copysignl): Declare.
- * mingwex/Makefile.in (DISTFILES): Add copysignl.S.
- (MATHOBJS):Add copysignl.o.
-
- 2002-04-24 Danny Smith <dannysmith@users.sourceforge.net>
- * include/math.h (__signbitl, __isnanl): Declare.
-
- 2002-04-24 Danny Smith <dannysmith@users.sourceforge.net>
- * include/math.h (nanl, __fpcassifyl, fminl, fmaxl, rintl,
- roundl, truncl, fmal, log2l): Declare.
- Protect C99 declarations with _STDC_VERSION__ >= 199901L)
- || !defined __STRICT_ANSI__.
- * mingwex/fmax.c (fmax): Call __isnan, not _isnan.
- * mingwex/fmin.c (fmin): Likewise.
- * mingwex/fmaxf.c (fmaxf): Call __isnanf, not _isnan.
- * mingwex/fminf.c (fminf): Likewise.
- * mingwex/fmaxl.c: New file.
- * mingwex/fminl.c: New file.
- * mingwex/fpclassify.c (__fpclassifyf): Split out to ...
- * mingwex/fpclassifyf.c: New file.
- * mingwex/fpclassifyl.c: New file.
- * mingwex/rint.c (rintf): Split out to...
- * mingwex/rintf.c: New file.
- * mingwex/rintl.c: New file.
- * mingwex/round.c (roundf): Split out to...
- * mingwex/roundf.c: New file.
- * mingwex/roundl.c: New file.
- * mingwex/trunc.c (truncf): Split out to...
- * mingwex/truncf.c: New file.
- * mingwex/truncl.c: New file.
- * mingwex/signbit.c (signbitf): Split out to...
- * mingwex/signbitf.c: New file.
- * mingwex/signbitl.c: New file.
- * mingwex/fmal.c: New file.
- * mingwex/copysignl.S: New file.
- * mingwex/log2l.c: New file.
- * mingwex/fp_consts.c: Add nanl definition.
- Comment out unused constants.
- * mingwex/Makefile.in (DISTFILES): Add fmaxl.c, fminl.c,
- fpclassifyf.c, fpclassifyl.c, rintf.c, rintl.c, roundf.c,
- roundl.c, truncf.c truncl.c, signbitf.c signbitl.c,
- fmal.c, log2l.c
- (MATHOBJS): Add fmaxl.o, fminl.o, fpclassifyf.o,
- fpclassifyl.o, rintf.o, rintl.o, roundf.o, roundl.o,
- truncf.o truncl.o, signbitf.o signbitl.o, fmal.o,
- log2l.o.
- * mingwex/snwprintf.c (snwprintf, vsnwprintf): Correct typo.
-
- 2002-04-23 Danny Smith <dannysmith@users.sourceforge.net>
- Make wide char versions of opendir and friends.
- * include/dirent.h (_wdirent, _WDIR): Define wide versions of
- struct dirent, DIR.
- (_wopendir,_wreaddir,_wclosedir,_wrewinddir,_wtelldir,
- _wseekdir): Add prototypes for wide versions of corresponding
- standard functions.
- * include/tchar.h; Add _UNICODE mappings for dirent.h
- structures and functions.
- * mingwex/dirent.c: Make _UNICODE neutral.
- * mingwex/wdirent.c: New file to define _UNICODE before
- including dirent.c.
- * mingwex/Makefile.in (DISTFILES): Add wdirent.c.
- (POSIX_OBJS): Add wdirent.o.
- (wdirent.o): Specify dependency on dirent.c as well as
- wdirent.c.
- * samples/dirent/wtest.c: New file, wide version of test.c.
-
- 2002-04-17 Danny Smith <dannysmith@users.sourceforge.net>
- * Makefile.in (INCLUDES): Add "-iwithprefixbefore include" to
- ensure gcc include dir is searched despite -nostdinc.
- * profile/Makefile.in (INCLUDES): Likewise.
- * mingwex/Makefile.in (INCLUDES): Likewise.
- * include/stdarg.h: Replace with stub that just guards the
- real gcc system header with #ifndef RC_INVOKED
- * include/varargs.h: Likewise.
- * include/stddef.h: Likewise.
- * include/stdio.h: Include stdarg.h after defining
- __need___va_list.
- (__VALIST): Define as __gnuc_va_list if __GNUC__, else char*.
- Replace va_list with __VALIST throughout.
-
- 2002-04-17 Danny Smith <dannysmith@users.sourceforge.net>
- * crt1.c: Revert changes of 2002-04-16. Use _fpreset again.
- * msvcrt.def (_fpreset): Mark as DATA so that only
- _imp___fpreset is exported.
- * msvcrt20.def (_fpreset): Likewise.
- * msvcrt40.def (_fpreset): Likewise.
- * crtdll.def (_fpreset): Likewise.
- * CRT_fp10.c (_fpreset): Overide library _fpreset with one
- that calls fninit.
- (fpreset): Add alias.
- (__CRT_PC): Delete definition. _fpreset does it now.
- * CRT_fp8.c (_fpreset): Force use of library _imp___fpreset.
- (fpreset): Add alias.
- (__CRT_PC): Delete definition.
- * moldname.def.in: Comment out fpreset.
- * moldname-msvcrt.def: Regenerate.
- * moldname-crtdll.def: Regenerate.
- * include/fenv.h (FE_DFL_ENV): Define as (fenv_t*)0.
- * mingwex/fesetenv.c (FE_DFL_ENV): Use it to set environment
- with the _fpreset determined by startup CRT_fp object.
-
- 2002-04-16 Danny Smith <dannysmith@users.sourceforge.net>
- * CRT_fp8.c: New file.
- * CRT_fp10.c: New file.
- * crt1.c (__CRT_PC) Declare.
- (__CRT_fesetenv): New static function, using _CRT_PC.
- (__mingw_CRTStartup):Use __CRT_fesetenv instead of _fpreset.
- (_gnu_exception_handler): Likewise.
- * Makefile.in (CRT0S): Add CRT_fp10.o.
- (MINGW_OBJS): Add CRT_fp8.o.
- (SRCDIST_FILES): Add CRT_fp8.c, CRT_fp10.c.
- Add CRT_fp8.o, CRT_fp10.o dependancies.
- * include/float.h (_fpreset): Expand comment.
- * include/fenv.h (FE_PC64_ENV): New define for Intel x87
- (extended precison) environmemt.
- (FE_PC53_ENV): New define for MSVCRT default environmemt.
- (FE_DFL_ENV): Define as FE_PC53_ENV.
- * mingwex/fesetenv.c: Use FE_PC53_ENV, FE_PC64_ENV to determine
- precision control for default environment.
-
- * include/math.h: Fix long comment line.
- * profile/configure.in (CRT0S): Set to both gcrt1.o and gcrt2.o
- for mingw.
- * profile/configure: Regenerate.
-
- 2002-04-12 Danny Smith <dannysmith@users.sourceforge.net>
- * mingwex/Makefile.in (DISTFILES): Add suffix to wcstof.c.
-
- 2002-04-10 Danny Smith <dannysmith@users.sourceforge.net>
- * mingwex/mingw-fseek.c: New file, based on Mumit Khan
- mingw-local patch to binutils.
- Sun Nov 7 04:27:07 1999 Mumit Khan <khan@xraylith.wisc.edu>
- (__mingw_fseek): New function to work around Win9x f/lseek bug.
- (__mingw_fwrite): Likewise.
- (__mingw_is_win9x): New helper function.
- * include/stdio.h (__USE_MINGW_FSEEK): New define,guarding...
- (__mingw_fseek): New prototype and define to replace fseek.
- (__mingw_fwrite): New prototype and define to replace fwrite.
- * mingwex/Makefile.in: Add mingw-fseek.o to libmingwex.a.
- * moldname-crtdll.def: Remove CR from end of line.
- * moldname-msvcrt.def: Ditto.
-
- 2002-04-09 Danny Smith <dannysmith@users.sourceforge.net>
- * profile/configure.in (CRT0S): Configure name of gcrt?.o
- based on target, building gcrt0.o for cygwin -mno-cygwin.
- * profile/configure: Regenerate.
- * profile/Makefile.in (CRT0S): Use name from configure.
- (gcrt0.o): New rule.
- (ALL_CRT0S): New define, used to cleanup all gcrt?.o's.
-
- 2002-04-04 Danny Smith <dannysmith@users.sourceforge.net>
- * include/math.h (_controlfp, _control87, _clearfp, _statusfp, _fpreset,
- _fpecode): Remove prototypes copied from float.h.
- (nan, nanf): Move into block protected against RC_INVOKED
- and __cplusplus.
- * include/stdlib.h (_Exit): Change from static inline to
- extern inline.
- * mingwex/_Exit.c : New file.
- * mingwex/Makefile.in: Add _Exit.o to libmingwex.a.
-
- 2002-04-04 Danny Smith <dannysmith@users.sourceforge.net>
- Add libgmon.a and libmingwex.a for cygwin -mno-cygwin.
- * configure.in (SUBDIRS): Add profile and mingwex to cygwin target.
- (configdirs): Likewise.
- (LIBGMON_A): Define for cygwin target as well.
- * configure: Regenerate.
- * profile/configure.in (THREAD_DLL): Remove define.
- (LIBM_A): Remove define.
- (LIBGMON_A): Define for cygwin target as well.
- * profile/configure: Regenerate.
- * profile/makefile.in (install): Install to inst_libdir and
- inst_includedir.
- * mingwex/makefile.in (CFLAGS): Move -fomit-frame-pointer to...
- (OPTFLAGS): New define.
- (ALL_CFLAGS): Add $(OPTFLAGS).
- (ALL_CXXFLAGS): Same.
- (.c.o:): Remove ALL_CXXFLAGS.
-
- 2002-03-29 Danny Smith <dannysmith@users.sourceforge.net>
- * include/stdint.h: Add missing newline at eof.
- * include/stdio.h (snprintf): Add prototype.
- (vsnprintf): Add prototype and inline definition.
- (snwprintf): Add prototype.
- (vsnwprintf): Add prototype and inline definition.
- * include/wchar.h (snwprintf): Add prototype.
- (vsnwprintf): Add prototype and inline definition.
- * mingwex/Makefile.in: Add snprintf.o, snwprintf.o
- to libmingwex.a.
- * mingwex/snprintf.c: New file.
- * mingwex/snwprintf.c: New file.
-
- 2002-03-22 Danny Smith <dannysmith@users.sourceforge.net>
- * configure.in: Add mingwex as SUBDIRS and configdirs.
- * configure: Regenerate.
- * Makefile.in (MINGW_OBJS): Remove dirent.o.
- (SRC_DIST_FILES): Remove dirent.c.
- * dirent.c: Remove.
- * include/stdlib.h (_Exit): Add static inline
- function.
- (struct lldiv_t): Define.
- (lldiv): Add prototype.
- (llabs): Add extern inline function.
- (strtoll,strtoull): Add prototypes.
- (wcstol, wcstoul, wcstod): Group together.
- (strtof, wcstof): Add extern inline definitions.
- (atoll,lltoa,ulltoa, wtoll, lltow ulltow): Add prototypes
- and extern inline definitions.
- * include/wchar.h (fwide, wcstoll,wcstoull, wmemchr
- wmemcmp, wmemcpy, wmemmove, wmemset. mbsinit): Add
- prototypes.
- (wcstol, wcstoul,wcstod): Copy prototypes from stdlib.h.
- (wcstof): Add extern inline definition.
- * include/math.h (nan, nanf): Add prototypes.
- (NAN, INFINITE): Define constants.
- (fpclassify, isnan ,signbit): Add macros and supporting float
- and double functions.
- (isfinite, isinf, isnormal): Add macros.
- (isgreater, isless, isgreaterequal, islessequal,islessgreater):
- Add macros.
- (rint, rintf, round, roundf, trunc. truncf, fmax, fmaxf,
- fmin, fminf, fma, fmaf, log2, log2f): Add prototypes.
- (copysign, logb, nextafter, scalb): Add prototypes and
- inline stubs for underscored versions in msvcrt.dll.
- * include/inttypes.h: New file.
- * include/fenv.h: New file
-
- Add new mingwex subdir and files.
- * mingwex: New directory.
- * mingwex/Makefile.in: New file.
- * mingwex/configure.in: New file.
- * mingwex/configure: Generate.
- * mingwex/dirent.c: Moved here from parent dir.
- * mingwex/atoll.c: New file.
- * mingwex/feclearexcept.c: New file.
- * mingwex/fegetenv.c: New file.
- * mingwex/fegetexceptflag.c: New file.
- * mingwex/fegetround.c: New file.
- * mingwex/feholdexcept.c: New file.
- * mingwex/feraiseexcept.c: New file.
- * mingwex/fesetenv.c: New file.
- * mingwex/fesetexceptflag.c: New file.
- * mingwex/fesetround.o: New file.
- * mingwex/fetestexcept.c: New file.
- * mingwex/feupdateenv.c: New file.
- * mingwex/fma.S: New file.
- * mingwex/fmaf.S: New file.
- * mingwex/fmax.c: New file.
- * mingwex/fmaxf.c: New file.
- * mingwex/fmin.c: New file.
- * mingwex/fminf.c: New file.
- * mingwex/fp_consts.c: New file.
- * mingwex/fpclassify.c: New file.
- * mingwex/fucom.c: New file.
- * mingwex/fwide.c: New file.
- * mingwex/imaxabs.c: New file.
- * mingwex/imaxdiv.c: New file.
- * mingwex/isnan.c: New file.
- * mingwex/isnanf.c: New file.
- * mingwex/lltoa.c: New file.
- * mingwex/lltow.c: New file.
- * mingwex/log2.c: New file.
- * mingwex/log2f.c: New file.
- * mingwex/math_stubs.c: New file.
- * mingwex/mbsinit.c: New file.
- * mingwex/rint.c: New file.
- * mingwex/round.c: New file.
- * mingwex/signbit.c: New file.
- * mingwex/sitest.c: New file.
- * mingwex/strtof.c: New file.
- * mingwex/strtoimax.c: New file.
- * mingwex/strtoumax.c: New file.
- * mingwex/testwmem.c: New file.
- * mingwex/trunc.c: New file.
- * mingwex/ulltoa.c: New file.
- * mingwex/ulltow.c: New file.
- * mingwex/wcstof.c: New file.
- * mingwex/wcstoimax.c: New file.
- * mingwex/wcstoumax.c: New file.
- * mingwex/wmemchr.c: New file.
- * mingwex/wmemcmp.c: New file.
- * mingwex/wmemcpy.c: New file.
- * mingwex/wmemmove.c: New file.
- * mingwex/wmemset.c: New file.
- * mingwex/wtoll.c: New file.
-
-2002-04-20 Danny Smith <dannysmith@users.sourceforge.net>
-
- * include/mbstring.h: New file.
- * include/mbctype.h: New file.
-
-2002-04-20 Danny Smith <dannysmith@users.sourceforge.net>
-
- * include/tchar.h (__TEXT): Make same as define in
- w32api/include/winnt.h.
-
-2002-04-20 Danny Smith <dannysmith@users.sourceforge.net>
-
- * include/tchar.h (_tputenv): Add UNICODE mappings.
- (_tsearchenv): Likewise.
- (_tmakepath): Likewise.
- (_tsplitpath): Likewise.
- (_tfullpath): Likewise.
-
-2002-04-18 Pascal Obry <obry@gnat.com>
-
- * dirent.c (opendir): Convert given pathname to
- absolute pathname.
-
-2002-04-09 Earnie Boyd <earnie@users.sf.net>
-
- * include/_mingw.h: Increment version.
- * Makefile.in: Ditto.
-
-2002-04-09 Earnie Boyd <earnie@users.sf.net>
-
- * moldname-crtdll.def: Remove CR from end of line.
- * moldname-msvcrt.def: Ditto.
- * Makefile.in: Use bzip2 compression for Cygwin target.
-
-2002-04-04 Danny Smith <dannysmith@sourceforge.users.net>
-
- * include/math.h (DOMAIN, SING, OVERFLOW, UNDERFLOW,
- TLOSS, PLOSS): Move oldname defines back, following
- the underscored names.
-
-2002-03-29 Danny Smith <dannysmith@sourceforge.users.net>
-
- * include/stdio.h (_snwprintf): Correct spelling.
- (_vsnwprintf): Likewise.
- * include/wchar.h (_snwprintf): Correct spelling.
- (_vsnwprintf): Likewise.
-
-2002-03-26 Danny Smith <dannysmith@users.sourceforge.net>
-
- * moldname.def.in (__MSVCRT__): Replace with !(__CRTDLL__).
- (wpopen): Add if !(__CRTDLL__).
- * Makefile.in (moldname-msvcrt.def rule): Use -C, not -c to
- preserve comments.
- (moldname-crtdll.def rule): Likewise.
- * moldname-msvcrt.def: Regenerate.
- * moldname-crtdll.def: Regenerate.
- * include/stdio.h (wpopen):Use prototype, not a define.
- (_swnprintf): Add prototype.
- (_vswnprintf): Likewise.
- Tidy up whitespace.
- * include/wchar.h (_swnprintf): Add prototype.
- (_vswnprintf): Likewise.
- Tidy up whitespace.
-
-2002-01-28 Danny Smith <dannysmith@users.sourceforge.net>
-
- * include/malloc.h (_heapinfo): Correct structure definition.
- (_USEDENTRY,_FREEENTRY): Add defines.
- Add comment on platform support for _heap* functions.
- (_get_sbh_threshold): Add prototype.
- (_set_sbh_threshold): Likewise.
- (_expand): Likewise.
-
-2002-01-25 Danny Smith <dannysmith@users.sourceforge.net>
-
- * profile/profil.c: Update copyright info.
- * profile/profil.h: Likewise.
- * profile/gcrt0.c: Likewise.
-
-2002-01-25 Pascal Obry <obry@gnat.com>
-
- * profile/profil.h (PROFADDR): Cast idx to unsigned long long to
- avoid overflow.
- * profile/gmon.c: Define bzero as memset if mingw32.
- (monstartup): Use it.
-
-2002-01-25 Danny Smith <dannysmith@users.sourceforge.net>
-
- * include/tchar.h (_TCHAR): Add missing ;.
-
-2002-01-25 Danny Smith <dannysmith@users.sourceforge.net>
-
- * include/tchar.h (_TCHAR): Add typedefs.
-
-2002-01-16 Danny Smith <dannysmith@users.sourceforge.net>
-
- * include/stdlib.h (_onexit_t): Add typedef.
- (_onexit): Add prototype.
-
-2002-01-12 Danny Smith <dannysmith@users.sourceforge.net>
-
- * msvcrt.def: Revert accidental change.
- * include/stdlib.h: Ditto.
-
-2001-12-07 Earnie Boyd <earnie@users.sf.net>
-
- * Makefile.in: Increment VERSION.
- * include/_mingw.h: Ditto.
-
-2001-12-05 Earnie Boyd <earnie@users.sf.net>
-
- * include/strings.h: New File.
-
-2001-12-02 Danny Smith <dannysmith@users.sourceforge.net>
-
- Apply patches from:
- 2001-06-21 Mumit Khan <khan@nanotech.wisc.edu>
-
- * include/math.h (_FPCLASS* ): Add defines from float.h.
- (IEEE recommended functions): Add declarations from float.h.
- * include/float.h (_FPCLASS* ): Protect against redefinition.
-
-2001-11-29 Wu Yongwei <adah@netstd.com>
-
- * include/_mingw.h,assert.h,conio.h,ctype.h,dir.h,direct.h
- dirent.h,dos.h,errno.h,excpt.h,fcntl.h,float.h,io.h,
- limits.h,locale.h,malloc.h,math.h,process.h,setjmp.h,
- share.h,signal.h,stdarg.h,stddef.h,stdint.h,stdio.h,
- stdlib.h,string.h,tchar.h,time.h,varargs.h,wchar.h,
- wctype.h,sys/stat.h,sys/timeb.h,sys/types.h,sys/utime.h:
- Correct spelling of "disclaimed" in comments.
- * include/excpt.h: Another spelling correction.
-
-2001-11-08 Robert Collins <rbtcollins@hotmail.com>
-
- * include/errno.h: Fix "errno is not a prototype" warning.
-
-2001-11-07 Danny Smith <dannysmith@users.sourceforge.net>
-
- * include/ctype.h (tolower, toupper,_tolower,_toupper): Comment
- differences between ANSI and non-ANSI versions.
- (_ctype[],_pctype): Declare vars.
- (__ISCTYPE): New helper macro using _pctype.
- (is* ctype functions): Use __ISCTYPE to define inline versions.
- (_toupper, _tolower, __isascii, __toascii, __iscsym, __iscsymf):
- Inline definitions.
- (isw* ctype functions): Inline definitions.
- * include/wctype.h (_ctype[],_pctype): Declare vars.
- (isw* ctype functions): Inline definitions.
-
-
-2001-11-06 Danny Smith <dannysmith@users.sourceforge.net>
-
- * include/float.h (_clearfp, _statusfp, _fpreset, fpreset,
- __fpecode): Use __STDC__ prototypes.
-
-
-2001-11-06 Thomas Pfaff <tpfaff@gmx.net>
-
- * mthr_stub.c (__mingwthr_remove_key_dtor) New.
- * mthr_init.c (DllMain) Run dtors if a process terminates.
- * mthr.c (__mingwthr_add_key_dtor) Removed.
- (___mingwthr_add_key_dtor) New.
- (___mingwthr_remove_key_dtor) New.
- (__mingwthr_run_key_dtors) Complete rewrite.
- (__mingwthr_remove_key_dtor) New.
-
-2001-11-05 Egor Duda <deo@logos-m.ru>
-
- * Makefile.in: Delete unused executable after creating base-files.
-
-2001-11-06 Danny Smith <dannysmith@users.sourceforge.net>
-
- * include/errno.h (_errno): Use __STDC__ prototype.
- Thanks to: Jim Barton.
-
-2001-11-04 "stefan" <stefan@lkcc.org>
-
- * include/sys/locking.h (_LK_UNLCK, LK_UNLCK): Correct names.
-
-2001-10-30 Danny Smith <dannysmith@users.sourceforge.net>
-
- * include/io.h (_commit): Add declaration.
- Thanks to: "stefan" <stefan@lkcc.org>
-
-2001-10-30 Danny Smith <dannysmith@users.sourceforge.net>
-
- * include/sys/stat.h: Make S_IS* macros safer.
-
-2001-10-27 Danny Smith <dannysmith@users.sourceforge.net>
-
- * include/stdlib.h (EXIT_FAILURE): Change value to 1.
-
-2001-10-12 Danny Smith <dannysmith@users.sourceforge.net>
-
- * include/stdlib.h (__p__environ, __p__wenviron): Use
- __STDC__ prototypes.
-
-2001-09-19 Earnie Boyd <earnie@SF.net>
-
- * Makefile.in: Remove the /usr from the install target.
- (VERSION): Increment.
- include/_mingw.h: Ditto.
-
-2001-09-17 Earnie Boyd <earnie@SF.net>
-
- * Makefile.in: Increment version.
- * include/_mingw.h: Ditto.
-
-2001-09-10 Earnie Boyd <earnie@SF.net>
-
- * dossh: Remove inadvertantly imported file.
-
-2001-09-10 Danny Smith <dannysmith@users.sourceforge.net>
-
- * dirent.c (opendir): Use GetFileAttributes rather than stat
- to determine if input arg is dir.
-
-2001-08-29 Danny Smith <dannysmith@users.sourceforge.net>
-
- * include/stdarg.h (va_list): Typedef as __builtin_va_list if
- __GNUC__ >= 3.
- * include/varargs.h (va_list): Ditto.
- * include/stdio.h (va_list): Ditto.
-
-2001-08-01 Danny Smith <dannysmith@users.sourceforge.net>
-
- * include/stdlib.h (_wpgmptr): Don't declare ifndef __MSVCRT__.
- * include/stdio.h (_IORW): Change constant to 0x0080.
- (TMP_MAX): Add new define.
- (_P_tmpdir): Ditto.
- (_wP_tmpdir): Ditto.
- (L_tmpnam): Change constant to 16.
-
-2001-06-28 Danny Smith <dannysmith@users.sourceforge.net>
-
- * include/malloc.h: Fix non-ANSI comment after #endif.
-
-2001-06-11 Danny Smith <danny_r_smith_2001@yahoo.co.nz>
-
- * profile/configure.in: Make msvcrt.dll version default.
- * profile/makefile.in: Build both gcrt1.o and gcrt2.o.
- * provile/configure: Regenerate.
-
-2001-06-11 Mattia Barbon <mbarbon@dsi.unive.it>
-
- * include/stdio.h (swscanf): Make first arugument const.
- * include/wchar.h (swscanf): Ditto.
- * include/tchar.h (_tfopen): New _UNICODE define.
- (_tgetenv): Ditto.
- (_tsetlocale): Ditto.
-
-2001-06-04 Earnie Boyd <earnie@users.sourceforge.net>
-
- * profile/Makefile.in (mkinstalldirs): Correct relative path.
-
-2001-06-04 Earnie Boyd <earnie@users.sourceforge.net>
-
- * include/_mingw.h: Change version to 1.0.
- Makefile.in: Ditto.
-
-2000-02-21 Earnie Boyd <earnie@users.sourceforge.net>
-
- * include/tchar.h: (__TEXT): Remove undef.
- (_TEXT): Ditto.
- (_T): Ditto.
-
-Fri Feb 2 10:34:07 2001 Earnie Boyd <earnie@users.sourceforge.net>
-
- * include/tchar.h: (__TEXT): Add private macro.
- (_TEXT): Modify definition to use __TEXT.
- (_T): Ditto.
- This change allows the passing of a MACRO as an argument and have that
- MACRO resolved first.
- Thanks to: Eric PAIRE <eric.paire@ri.silicomp.com>
-
-Wed Jan 31 17:12:51 2001 Earnie Boyd <earnie@users.sourceforge.net>
-
- * Makefile.in: Increment version to 0.5
- * include/_mingw.h: Increment minor version
-
-Tue Jan 30 13:01:01 2001 Earnie Boyd <earnie@users.sourceforge.net>
-
- * include/assert.h: (assert): Remove ; from end of definition
- Thanks to: AJ Reins <tbisp@qwest.net>
-
-Tue Jan 30 07:31:22 2001 Earnie Boyd <earnie@users.sourceforge.net>
-
- * include/time.h: (CLOCKS_PER_SEC): Type cast the constant.
- Thanks to: Cosmin Truta <cosmin@cs.toronto.edu>
-
-Mon Jan 29 14:03:07 2001 Earnie Boyd <earnie@users.sourceforge.net>
-
- * time.h: (CLOCKS_PER_SEC) Change from FP to integer constant.
-
-Sun Jan 28 13:01:08 2001 Earnie Boyd <earnie@users.sourceforge.net>
-
- * include/wchar.h: The 2001.01.18 Change was incorrect. The functions
- are actually C functions. These functions are resolved via the
- -lmsvcp60 library and comments were placed in the header.
-
-2001-01-28 Danny Smith <danny_r_smith_2001@yahoo.co.nz>
-
- *include/stdlib.h (__p__pgmptr): add prototype.
- (__p__wpgmptr): likewise.
- (_pgmptr_dll): move declaration from dos.h.
- (_wpgmptr_dll): likewise.
- (_pgmptr): conditional define (MSVCT/CRTDLL).
- (_wpgmptr): likewise.
- *include/dos.h (_base*_dll variables): declare only for CRTDLL.
- (_os*_dll variables): likewise.
- (_pgmptr_dll): remove declaration and associated defines to stdlib.h.
- (_wpgmptr_dll): likewise.
-
-2001-01-22 Danny Smith <danny_r_smith_2001@yahoo.co.nz>
-
- * include/stdint.h: New file.
-
-Thu Jan 18 10:33:01 2001 Earnie Boyd <earnie@users.sourceforge.net>
-
- * include/wchar.h: Protect prototypes only declared in the C++ STL
- from being declared unless __cplusplus is defined.
-
-Tue Jan 16 11:37:31 2001 Earnie Boyd <earnie@users.sourceforge.net>
-
- * include/stdlib.h: Apply Danny Smith patch 102730
- 2000-12-09 Danny Smith <danny_r_smith_2001@yahoo.co.nz>
- (_wgetenv) Correction to return type.
-
-Tue Jan 16 09:41:41 2001 Earnie Boyd <earnie@users.sourceforge.net>
-
- * include/locale.h: Apply Danny Smith patch 101834
- 2000-11-23 Danny Smith <danny_r_smith_2001@yahoo.co.nz>
- (LC_MIN) Add definition.
- (LC_MAX) ditto.
- (_wsetlocale) Add prototype.
-
-2000-11-29 Earnie Boyd <earnie_boyd@yahoo.com>
-
- * Makefile.in: eliminate the need for RUNTIME and CRT_ID.
- Always build crt1.o, dllcrt1.o, crt2.o and dllcrt2.o.
- Create a libcoldname.a for the oldname library for CRTDLL.
- Restrict libmoldname.a for the oldname library for MSVCRT.
- * configure.in: eliminate setting RUNTIME and CRT_ID variables.
- Restructure the $target_os case logic.
- Always name the MinGW thread dll helper mingwm.
- Change Cygwin's HEADER_SUBDIR value from mingw32 to mingw.
- * configure: regenerate.
-
-2000-11-22 Earnie Boyd <earnie_boyd@yahoo.com>
-
- * Makefile.in: Fix bindist target to distribute the correct files.
- Remove the use of SNAPSHOT variable and test SNAPDATE instead.
- Set SNAPDATE within the snapshot target on recursive call to $(MAKE).
-
-2000-11-21 Earnie Boyd <earnie_boyd@yahoo.com>
-
- * Makefile.in: Add missing line continuation `\' for $(SUBDIRS) target.
- Add variables and targets to control binary and source distributions.
- Add variables and targets to control snapshot distribution.
- * profile/gmon.h: Add missing #endif for #ifndef.
- * profile/ChangeLog: Merge entries here and remove.
- * profile/Makefile.in: Add variables and targets to control
- distribution.
- * README: Add.
- * TODO: ditto.
- * config.guess: ditto.
- * config.sub: ditto.
- * mkinstalldirs: ditto.
- * install-sh: ditto.
- * configure: regenerate.
- * profile/configure: ditto.
-
-2000-11-20 Earnie Boyd <earnie_boyd@yahoo.com>
-
- * Merge in changes from
- 2000-10-23 Danny Smith <danny_r_smith_2001@yahoo.co.nz>
- * include/direct.h: add guard around MSVCRT-only prototytpes
- * include/io.h: add __int64 struct definitions and function prototypes;
- add guard for MSVCRT-only prototypes
- * include/limits.h: add ISO C9x macros LLONG_MIN, LLONG_MAX, ULLONG_MAX
- * include/stdio.h: add wchar function prototypes (__MSVCRT__);
- put wchar functions together to make sync with wchar.h easier
- * include/stdlib.h: add wide char functions (__MSVCRT__)
- * include/string.h: add string collation functions ( __MSVCRT__)
- * include/sys/stat.h: add __int64 struct and function ( __MSVCRT__)
- * include/tchar.h: add macros and macro function definitions
- * include/wchar.h: add wide char function prototypes ( __MSVCRT__ );
- enclose more functions in __MSVCRT__ guard;
- some oldname wide char function prototypes #if (0)'d
- * profile/gmon.h: add guard around BSD-ish typedefs
-
-Mon Nov 20 18:58:12 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Use a different variable name for subdirectory since the
- previous one was used by the top level make.
-
-Sun Nov 19 20:50:51 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Install mingw stuff in a subdirectory if building under
- cygwin.
-
-Sat Jun 17 21:48:23 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in (subdirs): Eliminate for loop.
-
-Sat Jun 17 18:27:59 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in (subdirs): Previous change did not fix problem in
- broken shells.
-
-Sat Jun 17 13:49:12 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Avoid installing dll if we're cross building and the
- cross-host system isn't a Windows system.
- * configure.in: Detect cross-hosting situation and set appropriate
- variables in Makefile.in.
- * configure: Regenerate.
-
-Wed Apr 19 13:10:54 2000 Christopher Faylor <cgf@cygnus.com>
-
- * configure.in: Change HEADER_SUBDIR to mingw32.
- * configure: Regenerate.
-
-Mon Apr 10 17:24:28 2000 Christopher Faylor <cgf@cygnus.com>
-
- * include/string.h: Use proper prototype for _strerror.
-
-2000-03-30 Mumit Khan <khan@xraylith.wisc.edu>
-
- * Makefile.in (subdirs): Workaround for broken shells.
-
-2000-02-03 Mumit Khan <khan@xraylith.wisc.edu>
-
- * Snapshot 2000-02-03.
-
- * include/{assert.h, conio.h, ctype.h, direct.h, dirent.h, fcntl.h,
- float.h, io.h, locale.h, malloc.h, math.h, process.h, signal.h,
- stdio.h, stdlib.h, string.h, time.h, wctype.h, sys/stat.h,
- sys/timeb.h, sys/utime.h}: Remove parameter names to avoid namespace
- pollution.
-
- * Makefile.in (all): Build CRT0S first.
- (libmingwthrd.a): Remove thread support DLL from dependency.
-
-2000-01-21 Mumit Khan <khan@xraylith.wisc.edu>
-
- * Snapshot 2000-01-21.
-
-2000-01-20 Mumit Khan <khan@xraylith.wisc.edu>
-
- Merge in changes from Cygwin:
- * configure.in (HEADER_SUBDIRS): New variable. Substitute.
- (SUBDIRS): Likewise.
- * Makefile.in (HEADER_SUBDIRS): New variable.
- (install): Use to install Mingw headers to a subdirectory if building
- under Cygwin.
- (DLL_CC_STUFF): Add DLL entry point.
- * configure: Regenerate.
-
-2000-01-19 Mumit Khan <khan@xraylith.wisc.edu>
-
- * include/stdio.h (fsetpos): Fix prototype.
- (fpos_t): Fix for MSVCRT.
- * include/float.h (fpreset): Add prototype.
- * include/limits.h: Define UINT_MAX, USHRT_MAX and ULONG_MAX with
- constant values.
- * include/time.h: Don't define tzname as a macro for CRTDLL, and
- export using libmoldname.a.
- * crtdll.def: Add DATA tags.
- * msvcrt.def: Likewise.
- * moldname.def.in: Likewise. Add fpreset. Export tzname for
- both MSVCRT and CRTDLL.
- * moldname-crtdll.def: Regenerate.
- * moldname-msvcrt.def: Regenerate.
-
-Tue Dec 21 02:22:14 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * Snapshot 1999-12-21.
-
- * include/wctype.h: New file.
- * include/ctype.h (MB_CUR_MAX): Define.
- (wctype_t): Guard.
- * include/stdlib.h (MB_CUR_MAX): Define.
- * include/wchar.h: Define stat, _stat structures here as well.
- * include/float.h: Add invalid subconditions (_SW) and floating
- point error (_FPE) macros.
- * include/time.h (_CLOCK_T): Rename macro to _CLOCK_T_DEFINED.
- (_TIME_T): Rename macro to _TIME_T_DEFINED.
- * include/sys/types.h: Likewise.
-
-Thu Nov 18 00:22:26 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * profile/profil.c (profile_on): Set the profiler thread priority to
- be time critical. Thanks to Pascal Obry <pascal_obry@csi.com>.
- * Snapshot 1999-11-18.
-
-Sun Nov 7 02:50:09 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- Released 1999-11-07.
-
- * Makefile.in (CRT0S): Add crtst.o.
- (install): Install in subdirs as well.
- * dirent.h (struct _stat): Rename from struct stat.
- * include/tchar.h: Add some new macros. Thanks to
- Eric Kohl <ekohl@abo.rhein-zeitung.de>.
- * profile/Makefile.in (install): Fix target.
-
-Thu Nov 4 14:32:58 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * Makefile.in: Add support for profile directory.
- * configure.in: Likewise.
- * configure: Regenerate.
-
- * profile: Imported profiling sources from winsup-19991026 snapshot.
- * profile/Makefile.in: New file.
- * profile/configure.in: New file.
- * profile/configure: Generate.
- * profile/gcrt0.c (u_char, u_short, u_int, u_long): typedef for Mingw.
- * profile/gmon.h (u_char, u_short, u_int, u_long): Likewise.
- * profile/gmon.c (unistd.h): Include conditionally.
- (sys/param.h): Likewise.
- * profile/mcount.c (sys/param.h): Likewise.
- * profile/profil.c (profile_on): thread id is DWORD, not int.
-
-
-Wed Nov 3 16:26:44 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * include/stdlib.h: Add wide character version of argv/environ.
- Formatting changes.
- * include/wchar.h: More wide character prototypes.
- * include/sys/stat.h: Likewise. Add struct stat as well as _stat.
-
- * dllcrt1.c (init.c): Don't include.
- (DllMainCRTStartup): Don't call _mingw32_init_mainargs().
- * Makefile.in: Remove init.c from dllcrt{1,2}.c dependency lists.
-
-Sat Oct 30 03:06:26 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * moldname.def: Remove file.
- * moldname.def.in: And add this.
- * moldname-msvcrt.def: Generate from moldname.def.in.
- * moldname-crtdll.def: Likewise.
-
- * mthr.c: New file for -mthread (thread-safe C++ EH) support.
- * mthr_init.c: New file for -mthread (thread-safe C++ EH) support.
- * mthr_stub.c: New file for -mthread (thread-safe C++ EH) support.
-
- * Makefile.in: Update.
- * configure.in: Likewise. Also add *cygwin* target for building
- under Cygwin winsup.
- * configure: Regenerate.
-
-Fri Oct 1 11:10:30 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * include/_mingw.h: Add version macros.
- * include/direct.h (_diskfree_t, getdiskfree, getdrives): Add.
- Also add wide character versions shared with wchar.h.
- * include/dos.h (_diskfree_t, getdiskfree, getdrives): Add.
- * include/io.h (sopen, _sopen): Fix prototype.
- Add wide character prototypes.
- * include/wchar.h: Likewise.
- * include/stdlib.h (beep, seterrormode, sleep): Remove non-
- underscored versions. Potential incompatibility.
- * include/time.h (daylight, timezone, tzname): Fix MSVCRT cases.
- Add wide character prototypes.
- * include/sys/timeb.h (struct _timeb): Don't use macro, but real
- definition.
-
-Wed Aug 18 18:38:39 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * configure.in (RUNTIME, CRT_ID): Add to differentiate between
- crtdll and msvcrt runtimes. Remove DLL_ENTRY and DEF_DLL_ENTRY
- macros.
- * configure: Rengerate.
- * Makefile.in (RUNTIME, CRT_ID): Use to generate the correct
- dll name and crt's. CRTDLL and MSVCRT are meant to created
- separately, so remove all the *-msvcrt* targets.
- (libmingwthr.a): New target. Dummy thread support archive.
- (LIBS): Add libmingwthr.a.
- (CRT0S): Use CRT_ID. Add crtmt.o.
- (MINGW_OBJS): Add crtst.o.
- * main.c (WinMain): Fix prototype.
- * crtmt.c: New file.
- * crtst.c: New file.
-
- * include/process.h (_beginthreadex): Fix prototype.
- * include/_mingw.h (__int64): Define for __GNUC__.
- * include/tchar.h (_ttol): Add macro.
- * include/stdlib.h (_wtoi, _wtol, _i64toa, _ui64toa, _atoi64,
- _i64tow, _ui64tow, _wtoi64): Add prototypes.
-
- Reported by Emanuele Aliberti <ea@iol.it>:
- * include/tchar.h (_ttoi): Add macro.
-
- Reported by Ulf Moeller <3umoelle@informatik.uni-hamburg.de>:
- * include/stdio.h (_snprintf): Add prototype.
- (_vsnprintf): Likewise.
-
-Sat Aug 7 18:00:00 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- Reported by Tor Lillqvist <tml@iki.fi>:
- * include/stdlib.h (__p___argv): Fix return type.
-
-Fri Jul 30 22:07:06 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- Add UWIN support.
- * include/errno.h (errno): It's linked in from startup, not imported.
- * include/stdlib.h (errno): Likewise.
- * include/io.h: Guard against conflicting macros and prototypes in
- system headers.
- * include/stdlib.h: Likewise.
- * include/string.h: Likewise.
- * include/time.h: Likewise.
-
-Fri Jul 30 13:47:34 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * include/io.h (X_OK): Fix definition. Thanks to Jan Nijtmans.
- * include/dos.h: Fix typo __MINGW_EXPORT->__MINGW_IMPORT.
- * Makefile.in (INCLUDES): Remove old windows32 include directory.
-
- * crt1.c (_gnu_exception_handler): Fix prototype.
- (__mingw_CRTStartup): New function based on mainCRTStartup.
- (mainCRTStartup): Set the app type for MSVCRT and call
- __mingw_CRTStartup.
- (WinMainCRTStartup): Likewise.
- * init.c (_startupinfo): Define.
- (_getmainargs): Add 5th parameter.
- (_mingw32_init_mainargs): Use.
-
- * ALL *.c files: Reformat according to GNU coding style.
-
-Fri Jul 16 00:46:04 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * Makefile.in (INCLUDES): Add w32api include directory.
-
- * include/_mingw.h: New file.
- * include/{assert.h,conio.h,ctype.h,direct.h,dirent.h,dos.h,
- errno.h,excpt.h,fcntl.h,float.h,io.h,limits.h,locale.h,malloc.h,
- math.h,process.h,setjmp.h,share.h,signal.h,stdarg.h,stdio.h,
- stdlib.h,string.h,tchar.h,time.h,varargs.h,sys/locking.h,
- sys/stat.h,sys/timeb.h,sys/types.h,sys/utime.h}: Include and
- use the macros __DECLSPEC_SUPPORTED and __MINGW_IMPORT.
-
- * include/stdlib.h (atexit): Fix prototype.
-
-Mon Jun 14 18:38:49 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * include/stdio.h (_tempnam): Fix prototype.
- (tempnam): Likewise.
- * include/stdlib.h: Replace with GCC's version, and guard
- with RC_INVOKED.
-
- From Anders Norlander <anorland@hem2.passagen.se>:
- * include/stdlib.h (__argc): Declare.
- (__argv): Likewise.
-
-Mon Apr 5 13:49:17 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * crt1.c (_gnu_exception_handler): Acknowledge Jacob Navia's
- contribution.
- * Makefile.in (_libm_dummy.o): New target.
- (libm.a): Use.
-
-Tue Mar 16 18:15:26 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * Released 1999-03-16 along with egcs-1.1.2.
-
-Wed Feb 17 17:15:56 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * Makefile.in (LIBS): Add libm.a.
- (libm.a): Dummy libm.a.
-
- * Makefile.in: Update from winsup 1999-02-08 snapshot.
- Preserve local changes.
- (mkinstalldirs): In ../, not ../../.
- (INCLUDES): Point to local windows32api headers and use -nostdinc.
- (LIBGCC): Delete.
- (LIBS): Add libmoldname-msvc.a.
- (libmoldname-msvc.a): Add target.
- (distclean): Add target.
-
-Tue Feb 9 00:26:05 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * include/dir.h: Reintroduce as an obsolescent header.
- * crt1.c (signal.h): Include.
- (_gnu_exception_handler): New function to properly handle win32
- asynchronous signals.
- (mainCRTStartup): Use.
-
-Sun Jan 3 23:52:25 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * include/direct.h: Include io.h instead of dir.h
- * include/dirent.h: Likewise.
- * include/dos.h: Likewise.
- * include/stdio.h: Replace reference to dir.h with io.h.
-
-Thu Dec 31 16:04:55 1998 Mumit Khan <khan@xraylith.wisc.edu>
-
- * 1999-01-01 release bundled with egcs-1.1.1.
-
- * include/io.h: Incorporate dir.h.
- * include/dir.h: Remove.
- * include/signal.h: Move RC_INVOKED up a bit.
-
-Tue Dec 29 15:04:38 1998 Mumit Khan <khan@xraylith.wisc.edu>
-
- * include/signal.h (sig_atomic_t): Define.
- (NSIG): Define.
- * include/malloc.h: Import defs from deprecated alloc.h.
- * include/alloc.h: Remove.
-
- From "Daniel J. Rodriksson" <djr@dit.upm.es>:
- * include/sys/types.h (_dev_t): Should be unsigned int for MSVCRT.
- * include/sys/stat.h (struct stat): st_uid is of type short. Use
- _off_t instead of long for st_size.
-
-Thu Sep 10 22:28:49 1998 Mumit Khan <khan@xraylith.wisc.edu>
-
- * include/errno.h (sys_errlist, sys_nerr): Move from here ...
- * include/stdlib.h: Here.
-
- * include/netdb.h: Remove.
- * include/arpa/inet.h: Remove.
- * include/netinet/in.h: Remove.
- * include/sys/socket.h: Remove.
-
-Fri Sep 4 15:09:11 1998 Mumit Khan <khan@xraylith.wisc.edu>
-
- * Release egcs-1.1.
-
- * include/{ctype.h,dos.h,io.h,string.h,time.h,sys/types.h,
- sys/utime.h}: Protect stddef.h in RC_INVOKED macro.
-
-Thu Sep 3 10:43:29 1998 Mumit Khan <khan@xraylith.wisc.edu>
-
- * setjmp.h (_JBTYPE, _JBLEN): Define correctly.
- (jmpbuf): typedef using above.
- (setjmp, longjmp): Prototype using jmpbuf.
-
- Merge with Colin Peters' 980701 snapshot. I've ignored changes to
- obsolescent imported names, ie., from __imp__ to _imp___.
-
- Also ignored empty include/sys/param.h and incorrect
- include/sys/times.h.
-
- * CRTinit.c: New file.
- * include/{errno.h,fcntl.h,math.h,process.h} (__MSVCRT__): Use #ifdef
- instead of #if.
- * include/io.h (umask): Fix prototype.
- * include/stdlib.h (OS constants): Replace with Colin's.
- * include/time.h (tzset, daylight, timezone): Replace with Colin's.
- * include/sys/state.h: Merge.
-
-Thu Sep 3 09:49:07 1998 Mumit Khan <khan@xraylith.wisc.edu>
-
- * include/assert.h (assert): Lose the trailing semicolon.
-
-Thu Jul 30 21:18:49 1998 Mumit Khan <khan@xraylith.wisc.edu>
-
- * include/math.h (matherr): Declare.
- * include/stdio.h (fileno, _fileno): Declare.
- * include/stdlib.h (environ, _environ): Fix to use runtime DLL.
-
- From Earnie Boyd:
- * include/stdio.h (fdopen, _fdopen): Add const.
- (getw, putw): Declare.
- * include/stdlib.h (MAX_{DRIVE,DIR,FNAME,EXT}): Fix.
-
-Sat Jun 13 18:19:41 1998 Mumit Khan <khan@xraylith.wisc.edu>
-
- * include/time.h (_timezone): Undefine.
- * include/sys/timeb.h (struct timeb): Rename _timezone to timezone.
-
- * include/time.h (_daylight, _timezone, _tzname, _tzset): Remove
- __cdecl for MSVCRT.
- * include/stdlib.h (environ): Use DLL version.
- * init.c (environ): Undefine it before use.
-
-Sun Mar 22 19:59:30 1998 Mumit Khan <khan@xraylith.wisc.edu>
-
- * Update to 980309 snapshot from Colin Peters.
-
- * include/utime.h: remove
- * include/stdlib.h (__imp__osver_dll, __imp__winver_dll,
- __imp__winmajor_dll, __imp__winminor_dll): Apply Jan-Jaap's
- patches to define these.
- * include/time.h (CLK_TCK): Renamed from CLK_TICK.
- (_daylight, _timezone, _tzname, _tzset): Define.
-
- * include/netdb.h: Add from Colin's windows32api changes.
- * include/sys/socket.h: Likewise.
- * include/arpa/inet.h: Likewise.
- * include/netinet/in.h: Likewise.
-
-Wed Feb 4 14:16:44 1998 Mumit Khan <khan@xraylith.wisc.edu>
-
- * Update to 980128 snapshot from Colin Peters.
-
-Sat Dec 6 21:30:35 1997 Mumit Khan <khan@xraylith.wisc.edu>
-
- * configure.in (AC_INIT): Use dllmain.c instead of defunct
- oldnames.c
- * configure: Regenerate.
-
-Fri Dec 5 15:57:36 1997 Mumit Khan <khan@xraylith.wisc.edu>
-
- * Update to 971205 snapshot from Colin Peters. Lots of changes.
- Files renamed and include hierarchy loses directories named
- nonansi.
-
- * include/dos.h: from Jan-Jaap.
-
-Thu Dec 4 21:48:13 1997 Mumit Khan <khan@xraylith.wisc.edu>
-
- Changes to conform to FSF tree.
-
- * crt1.c: Renamed from mcrt0.c.
- * dllcrt1.c: Renamed from dllcrt0.c.
- * Makefile.in: Update above. Also renamed libmoldnames.a to
- libmoldname.a.
-
-Mon Dec 1 16:51:30 1997 Mumit Khan <khan@xraylith.wisc.edu>
-
- * crtdll.def: Export all functions but the ones with funny names.
- * moldnames.def: Add fdopen since fileno is already there.
- * include/nonansi/dos.h: New file from Jan-Jaap.
- * include/errno.h: Add extern decl + various additions from JJ.
- * include/stdio.h: Likewise.
- * include/stdlib.h: Likewise.
- * include/nonansi/io.h: Likewise.
- * include/nonansi/process.h: Likewise.
- * include/sys/types.h: Likewise.
-
-Tue Nov 4 14:51:01 1997 Mumit Khan <khan@xraylith.wisc.edu>
-
- * include/time.h (CLK_TCK): Renamed from CLK_TICK.
- (CLK_TICK): Delete.
- * include/stdlib.h (free): Fix prototype to return void, not void*.
- * include/nonansi/process.h: Add P_* and WAIT_* defs.
-
- * dllcrt0.c: Delete now-unneeded '.section .idata$3' asm hack.
- * mcrt0.c: Likewise.
-
- * Makefile.in (LIBS): Delete moldnames.dll from target libs.
- (libmoldnames.a): Add explicit rule to create it.
-
-Fri Aug 15 18:23:43 1997 Rob Savoye <rob@cygnus.com>
-
- New directory for the minimalist cygwin environment.
-
- * crtglob.c: New file. Turn on file globbing support.
- * crt_noglob.c: New file. Turn off file globbing support.
- * ctype_old.c: New file. Wrappers for functions that don't
- have an underscore.
- * dirent.c: New file. Directory routines readdir, opendir, closedir.
- * dllcrt0.c: New file. Initialization code to use crtdll.dll.
- * dllmain.c: New file. A stub DllMain function.
- * hugeval.c: New file. A gross hack to define HUGE_VAL.
- * init.c: New file. Common code to initialize standard file
- handles and command line arguments.
- * main.c: New file. A main for programs that only call WinMain.
- * mcrt0.c: New file. Default crt0 for mingw32.
- * oldnames.c: New File. Wrappers for functions that don't
- have an underscore.
- * string_old.c: New File.
- * include/{assert.h,ctype.h,errno.h,float.h,limits.h,locale.h
- math.h,nonansi,setjmp.h,signal.h,stdarg.h,stddef.h,stdio.h,stdlib.h
- string.h,tchar.h,time.h,wchar.h}: New header files for mingw.
- * include/sys/types.h: New header file for mingw.
- * include/nonansi/{alloc.h,conio.h,dir.h,direct.h,dirent.h
- fcntl.h,io.h,malloc.h,mem.h,memory.h,process.h,share.h,unistd.h
- utime.h,values.h,varargs.h}: New header files for mingw.
- * include/nonansi/sys/{fcntl.h,locking.h,stat.h,time.h
- timeb.h,unistd.h}: New header files for mingw.
- * Makefile.in,configure.in: Build and configure support.
- * configure: Generated from autoconf 2.12 with Cygnus patches.
diff --git a/winsup/mingw/Makefile.in b/winsup/mingw/Makefile.in
deleted file mode 100644
index 5f7c3e455..000000000
--- a/winsup/mingw/Makefile.in
+++ /dev/null
@@ -1,406 +0,0 @@
-# Makefile.in for the winsup/mingw directory.
-# Copyright (c) 1995, 1996, 1997, 1998 Cygnus Solutions
-
-# 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 makefile requires GNU make.
-
-PACKAGE = mingw-runtime
-VERSION = 2.0
-CYGRELEASE = 1
-
-VPATH = @srcdir@
-srcdir = @srcdir@
-objdir = .
-
-host_alias = @host_alias@
-build_alias = @build_alias@
-target_alias = @target_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@
-ifneq (,$(findstring cygwin,$(target_alias)))
-inst_bindir:=$(tooldir)/bin
-inst_includedir:=$(tooldir)/include/mingw
-inst_libdir:=$(tooldir)/lib/mingw
-else
-inst_bindir:=$(bindir)
-inst_includedir:=$(includedir)
-inst_libdir:=$(libdir)
-endif
-
-# The Mingw headers are installed under a subdirectory of
-# $(tooldir)/include when configuring in Cygwin.
-HEADER_SUBDIR = @HEADER_SUBDIR@
-
-SHELL = /bin/sh
-
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-mkinstalldirs = $(SHELL) @MKINSTALLDIRS@
-
-CC = @CC@
-# FIXME: Which is it, CC or CC_FOR_TARGET?
-CC_FOR_TARGET = $(CC)
-AS_FOR_TARGET = $(AS)
-CFLAGS = @CFLAGS@
-CXXFLAGS = @CXXFLAGS@
-
-# compiling with Cygwin?
-MNO_CYGWIN = @MNO_CYGWIN@
-ifdef MNO_CYGWIN
- subdirforlib=/mingw
-else
- libdir=
-endif
-
-# Either crtdll (CRT_ID 1) or msvcrt (CRT_ID 2).
-RUNTIME = @RUNTIME@
-CRT_ID = @CRT_ID@
-
-# Needed for threading dll.
-THREAD_DLL = @THREAD_DLL@
-THREAD_DLL_VERSION = 10
-THREAD_DLL_NAME = $(THREAD_DLL)$(THREAD_DLL_VERSION).dll
-
-# Various libraries.
-LIBM_A=@LIBM_A@
-
-INCLUDES = -I$(srcdir)/include -I$(srcdir)/../w32api/include \
- -I$(srcdir)/../include \
- -nostdinc -nostdinc++ \
- -iwithprefixbefore include
-ALL_CFLAGS = $(CFLAGS) $(INCLUDES) $(MNO_CYGWIN)
-ALL_CXXFLAGS = $(CXXFLAGS) $(INCLUDES) $(MNO_CYGWIN)
-
-AS = @AS@
-AR = @AR@
-LD = @LD@
-AR_FLAGS = rcv
-RANLIB = @RANLIB@
-DLLTOOL = @DLLTOOL@
-DLLTOOLFLAGS =
-DLLTOOL_FOR_TARGET = $(DLLTOOL)
-DLLTOOL_FLAGS = --as $(AS_FOR_TARGET)
-DLLWRAP = @DLLWRAP@
-DLLWRAP_FOR_TARGET = $(DLLWRAP)
-DLLWRAP_FLAGS = --dlltool $(DLLTOOL) --as $(AS) --driver-name $(CC)
-
-TAR = tar
-TARFLAGS = z
-TARFILEEXT = .tar.gz
-
-SUBDIRS := @SUBDIRS@
-
-FLAGS_TO_PASS:=\
- AS="$(AS)" \
- CC="$(CC)" \
- CFLAGS="$(CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_CONFIG)" \
- CXXFLAGS="$(CXXFLAGS) $(CFLAGS_COMMON) $(CFLAGS_CONFIG)" \
- EXE_LDFLAGS="$(EXE_LDFLAGS)" \
- AR="$(AR)" \
- RANLIB="$(RANLIB)" \
- LD="$(LD)" \
- DLLTOOL="$(DLLTOOL)" \
- exec_prefix="$(exec_prefix)" \
- bindir="$(bindir)" \
- libdir="$(libdir)" \
- tooldir="$(tooldir)" \
- datadir="$(datadir)" \
- infodir="$(infodir)" \
- includedir="$(includedir)" \
- inst_bindir="$(inst_bindir)" \
- inst_includedir="$(inst_includedir)" \
- inst_libdir="$(inst_libdir)" \
- prefix="$(prefix)" \
- target_alias="$(target_alias)" \
- TAR="$(TAR)" \
- TARFLAGS="$(TARFLAGS)" \
- TARFILEEXT="$(TARFILEEXT)"
-
-CRT0S = crt1.o dllcrt1.o crt2.o dllcrt2.o CRT_noglob.o crtmt.o crtst.o \
- CRT_fp8.o CRT_fp10.o
-MINGW_OBJS = CRTglob.o CRTfmode.o CRTinit.o dllmain.o gccmain.o \
- main.o crtst.o mthr_stub.o CRT_fp10.o
-MOLD_OBJS = ctype_old.o string_old.o
-
-LIBS = libcrtdll.a libmsvcrt.a libmsvcrt20.a libmsvcrt40.a libmingw32.a \
- libcoldname.a libmoldname.a $(LIBM_A) libmingwthrd.a
-
-DLLS = $(THREAD_DLL_NAME)
-
-SRCDIST_FILES = CRT_noglob.c CRTfmode.c CRTglob.c CRTinit.c ChangeLog \
-Makefile.in README TODO config.guess config.sub configure configure.in \
-crt1.c crtdll.def crtmt.c crtst.c ctype_old.c dllcrt1.c dllmain.c \
-gccmain.c init.c install-sh jamfile main.c mkinstalldirs moldname-crtdll.def \
-moldname-msvcrt.def moldname.def moldname.def.in msvcrt.def msvcrt20.def \
-msvcrt40.def mthr.c mthr_init.c mthr_stub.c readme.txt string_old.c \
-CRT_fp8.c CRT_fp10.c
-
-all_dlls_host = @all_dlls_host@
-install_dlls_host = @install_dlls_host@
-
-all: $(CRT0S) $(LIBS) $(all_dlls_host)
- @$(MAKE) subdirs DO=$@ $(FLAGS_TO_PASS)
-
-all_dlls_host: $(DLLS)
-
-install_dlls_host:
- for i in $(DLLS); do \
- $(INSTALL_PROGRAM) $$i $(inst_bindir)/$$i ; \
- done
-
-_libm_dummy.o:
- rm -f _libm_dummy.c
- echo "static int __mingw_libm_dummy;" > _libm_dummy.c
- $(CC) -c $(ALL_CFLAGS) _libm_dummy.c
- rm -f _libm_dummy.c
-
-libm.a: _libm_dummy.o
- $(AR) rc $@ _libm_dummy.o
- $(RANLIB) $@
-
-libmingwthrd.a: crtmt.o mingwthrd.def
- $(DLLTOOL) $(DLLTOOL_FLAGS) --dllname $(THREAD_DLL_NAME) \
- --def mingwthrd.def --output-lib $@
- $(AR) $(ARFLAGS) $@ crtmt.o
- $(RANLIB) $@
-
-# Using dllwrap would be so much easier, but Cygnus top-level configure
-# Makefile.in etc don't pass the right variables yet.
-xx_$(THREAD_DLL_NAME) xx_mingwthrd.def: mthr.o mthr_init.o
- $(DLLWRAP) $(DLLWRAP_FLAGS) -o $(THREAD_DLL_NAME) \
- --output-def mingwthrd.def \
- mthr.o mthr_init.o
-
-DLL_OFILES = mthr.o mthr_init.o
-DLL_CC_STUFF = -B./ -mdll $(MNO_CYGWIN) -Wl,--image-base,0x6FBC0000 \
- -Wl,--entry,_DllMainCRTStartup@12 \
- $(DLL_OFILES)
-DLL_DLLTOOL_STUFF = --as=$(AS) --dllname $(THREAD_DLL_NAME) \
- --def mingwthrd.def \
- --base-file mingwthrd.base --output-exp mingwthrd.exp
-
-$(THREAD_DLL_NAME) mingwthrd.def: $(DLL_OFILES) Makefile
- $(DLLTOOL) --as $(AS) --output-def mingwthrd.def $(DLL_OFILES)
- $(CC) -Wl,--base-file=mingwthrd.base $(DLL_CC_STUFF) \
- -o mingwthrd_dummy.exe
- $(DLLTOOL) $(DLL_DLLTOOL_STUFF)
- $(CC) -Wl,--base-file=mingwthrd.base mingwthrd.exp $(DLL_CC_STUFF) \
- -o mingwthrd_dummy.exe
- $(DLLTOOL) $(DLL_DLLTOOL_STUFF)
- $(CC) mingwthrd.exp -o $(THREAD_DLL_NAME) $(DLL_CC_STUFF)
- rm -f mingwthrd_dummy.exe
-
-libmingw32.a: $(MINGW_OBJS)
- $(AR) rc $@ $(MINGW_OBJS)
- $(RANLIB) $@
-
-$(srcdir)/moldname-crtdll.def: moldname.def.in
- $(CC) -DRUNTIME=crtdll \
- -D__FILENAME__=moldname-crtdll.def \
- -D__CRTDLL__ -C -E -P \
- -xc-header $? > $@
-
-$(srcdir)/moldname-msvcrt.def: moldname.def.in
- $(CC) -DRUNTIME=msvcrt \
- -D__FILENAME__=moldname-msvcrt.def \
- -D__MSVCRT__ -C -E -P \
- -xc-header $? > $@
-
-libcoldname.a: $(srcdir)/moldname-crtdll.def $(MOLD_OBJS)
- $(DLLTOOL) --as $(AS) -k -U \
- --dllname crtdll.dll \
- --def $(srcdir)/moldname-crtdll.def \
- --output-lib $@
- $(AR) rc $@ $(MOLD_OBJS)
- $(RANLIB) $@
-
-libmoldname.a: $(srcdir)/moldname-msvcrt.def $(MOLD_OBJS)
- $(DLLTOOL) --as $(AS) -k -U \
- --dllname msvcrt.dll \
- --def $(srcdir)/moldname-msvcrt.def \
- --output-lib $@
- $(AR) rc $@ $(MOLD_OBJS)
- $(RANLIB) $@
-
-# The special rules are necessary.
-crt1.o dllcrt1.o:
- $(CC) -c -D__CRTDLL__ -U__MSVCRT__ $(ALL_CFLAGS) $< -o $@
-
-crt2.o dllcrt2.o:
- $(CC) -c -D__MSVCRT__ -U__CRTDLL__ $(ALL_CFLAGS) $< -o $@
-
-clean:
- -rm -f *.o *.a *~ core a.out mingwthrd.def mingwthrd.base mingwthrd.exp
- -rm -f $(THREAD_DLL_NAME) mingwthrd_dummy.exe
- @$(MAKE) subdirs DO=$@ $(FLAGS_TO_PASS)
-
-distclean:
- @$(MAKE) subdirs DO=$@ $(FLAGS_TO_PASS)
- -rm -f *.o *.a *~ core a.out mingwthrd.def mingwthrd.base mingwthrd.exp
- -rm -f $(THREAD_DLL_NAME)
- -rm -f config.cache config.status config.log
- -rm -f Makefile
-
-ifdef SNAPDATE
- distdir=$(PACKAGE)-$(VERSION)-$(SNAPDATE)
-else
- ifneq (,$(findstring cygwin, $(target_alias)))
- distdir=$(PACKAGE)-$(VERSION)-$(CYGRELEASE)
- else
- distdir=$(PACKAGE)-$(VERSION)
- endif
-endif
-
-ifneq (,$(findstring cygwin, $(target_alias)))
- TARFLAGS = j
- TARFILEEXT = .tar.bz2
-endif
-
-dist: srcdist bindist
-
-srcdist:
- rm -rf $(distdir)
- mkdir $(distdir)
- chmod 755 $(distdir)
- for i in $(SRCDIST_FILES); do \
- cp -p $(srcdir)/$$i $(distdir)/$$i ; \
- done
- for i in $(SUBDIRS); do \
- (cd $$i; $(MAKE) distdir=../$(distdir) dist); \
- done
-#FIXME this needs to be done with SUBDIRS and Makefiles.
- mkdir $(distdir)/include
- mkdir $(distdir)/include/sys
- cp $(srcdir)/include/*.h $(distdir)/include/
- cp $(srcdir)/include/sys/*.h $(distdir)/include/sys/
-#end FIXME
- rm -f $(distdir)-src.tar.gz
- $(TAR) $(TARFLAGS)cf $(distdir)-src$(TARFILEEXT) $(distdir)
-
-
-bindist:
- rm -rf $(distdir)
- mkdir $(distdir)
- chmod 755 $(distdir)
- $(MAKE) install prefix=$(shell pwd)/$(distdir)
- rm -f $(distdir).tar.gz
- cd $(distdir); \
- $(TAR) $(TARFLAGS)cf ../$(distdir)$(TARFILEEXT) *
-
-snapshot:
- make dist SNAPDATE=$(shell date '+%Y%m%d')
-
-info:
-
-info-html:
-
-install-info: info
-
-install-dirs:
- $(mkinstalldirs) $(inst_bindir)
- $(mkinstalldirs) $(inst_includedir)
- $(mkinstalldirs) $(inst_libdir)
-
-install: all install-dirs $(install_dlls_host)
- for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
- done
- for i in $(CRT0S); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
- done
- for sub in . sys ; do \
- dstdir=$(inst_includedir)/$$sub ; \
- $(mkinstalldirs) $$dstdir ; \
- for i in $(srcdir)/include/$$sub/*.h ; do \
- $(INSTALL_DATA) $$i $$dstdir/`basename $$i` ; \
- done ; \
- done
- @$(MAKE) subdirs DO=$@ $(FLAGS_TO_PASS)
-
-subdirs: $(SUBDIRS)
- @true
-
-# The . is here because SUBDIRS may be empty
-
-. $(SUBDIRS): force
- @if [ -d ./$@ ]; then \
- echo "Making $(DO) in $@..." ; \
- if (rootme=`pwd`/ ; export rootme ; \
- rootsrc=`cd $(srcdir); pwd`/ ; export rootsrc ; \
- cd ./$@; \
- $(MAKE) $(FLAGS_TO_PASS) $(DO)) ; then true ; \
- else exit 1 ; fi ; \
- else true ; fi ; \
-
-force:
-
-#
-# Dependancies
-#
-libcrtdll.a: $(srcdir)/crtdll.def
-libmsvcrt.a: $(srcdir)/msvcrt.def
-libmsvcrt20.a: $(srcdir)/msvcrt20.def
-libmsvcrt40.a: $(srcdir)/msvcrt40.def
-CRT_noglob.o: $(srcdir)/CRT_noglob.c
-CRTfmode.o: $(srcdir)/CRTfmode.c
-CRTglob.o: $(srcdir)/CRTglob.c
-CRTinit.o: $(srcdir)/CRTinit.c
-crt1.o: $(srcdir)/crt1.c $(srcdir)/init.c
-crt2.o: $(srcdir)/crt1.c $(srcdir)/init.c
-crtmt.o: $(srcdir)/crtmt.c
-crtst.o: $(srcdir)/crtst.c
-ctype_old.o: $(srcdir)/ctype_old.c
-dllcrt1.o: $(srcdir)/dllcrt1.c
-dllcrt2.o: $(srcdir)/dllcrt1.c
-dllmain.o: $(srcdir)/dllmain.c
-main.o: $(srcdir)/main.c
-oldnames.o: $(srcdir)/oldnames.c
-string_old.o: $(srcdir)/string_old.c
-CRT_fp8.o: $(srcdir)/CRT_fp8.c
-CRT_fp10.o: $(srcdir)/CRT_fp10.c
-
-
-Makefile: Makefile.in config.status configure
- $(SHELL) config.status
-
-config.status: configure
- $(SHELL) config.status --recheck
-
-.SUFFIXES: .y $(SUFFIXES) .cc .def .a
-
-lib%.a:%.def
- $(DLLTOOL) --as=$(AS) -k --dllname $*.dll --output-lib lib$*.a --def $<
-
-.c.o:
- $(CC) -c $(ALL_CFLAGS) $< -o $@
-
diff --git a/winsup/mingw/README b/winsup/mingw/README
deleted file mode 100644
index 936819172..000000000
--- a/winsup/mingw/README
+++ /dev/null
@@ -1,10 +0,0 @@
- Free Win32 runtime and import library definitions
-
- Maintained by MinGW Developers
- Send bug reports and questions to MinGW-users@lists.sourceforge.net
- URL: http://www.mingw.org
-
-A historical readme.txt exists and is distributed for your edification. The
-references within may or may not be correct. Please do not rely on them. See
-http://www.mingw.org for a list of valid references.
-
diff --git a/winsup/mingw/TODO b/winsup/mingw/TODO
deleted file mode 100644
index 60f6bc2af..000000000
--- a/winsup/mingw/TODO
+++ /dev/null
@@ -1 +0,0 @@
-Finish the README.
diff --git a/winsup/mingw/config.guess b/winsup/mingw/config.guess
deleted file mode 100755
index 5432d5898..000000000
--- a/winsup/mingw/config.guess
+++ /dev/null
@@ -1,1342 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
-# Free Software Foundation, Inc.
-
-version='2000-11-16'
-
-# 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, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Written by Per Bothner <bothner@cygnus.com>.
-# Please send patches to <config-patches@gnu.org>.
-#
-# 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.
-#
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit system type (host/target name).
-#
-# Only a few systems have been added to this list; please add others
-# (but try to keep the structure clean).
-#
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of this system.
-
-Operation modes:
- -h, --help print this help, then exit
- -V, --version print version number, then exit"
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case "$1" in
- --version | --vers* | -V )
- echo "$version" ; exit 0 ;;
- --help | --h* | -h )
- echo "$usage"; exit 0 ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- exec >&2
- echo "$me: invalid option $1"
- echo "$help"
- exit 1 ;;
- * )
- break ;;
- esac
-done
-
-if test $# != 0; then
- echo "$me: too many arguments$help" >&2
- exit 1
-fi
-
-
-dummy=dummy-$$
-trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
-
-# Use $HOST_CC if defined. $CC may point to a cross-compiler
-if test x"$CC_FOR_BUILD" = x; then
- if test x"$HOST_CC" != x; then
- CC_FOR_BUILD="$HOST_CC"
- else
- if test x"$CC" != x; then
- CC_FOR_BUILD="$CC"
- else
- echo 'int dummy(){}' >$dummy.c
- for c in cc c89 gcc; do
- ($c $dummy.c -c) >/dev/null 2>&1
- if test $? = 0; then
- CC_FOR_BUILD="$c"; break
- fi
- done
- rm -f $dummy.c $dummy.o
- if test x"$CC_FOR_BUILD" = x; then
- CC_FOR_BUILD=no_compiler_found
- fi
- fi
- fi
-fi
-
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 8/24/94.)
-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 tupples: *-*-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.
- # Determine the machine/vendor (is the vendor relevant).
- case "${UNAME_MACHINE}" in
- amiga) machine=m68k-unknown ;;
- arm32) machine=arm-unknown ;;
- atari*) machine=m68k-atari ;;
- sun3*) machine=m68k-sun ;;
- mac68k) machine=m68k-apple ;;
- macppc) machine=powerpc-apple ;;
- hp3[0-9][05]) machine=m68k-hp ;;
- ibmrt|romp-ibm) machine=romp-ibm ;;
- *) machine=${UNAME_MACHINE}-unknown ;;
- esac
- # The Operating System including object format.
- if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep __ELF__ >/dev/null
- then
- # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
- # Return netbsd for either. FIX?
- os=netbsd
- else
- os=netbsdelf
- fi
- # The OS release
- release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- # 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 0 ;;
- alpha:OSF1:*:*)
- if test $UNAME_RELEASE = "V4.0"; then
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- fi
- # 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.
- cat <<EOF >$dummy.s
- .data
-\$Lformat:
- .byte 37,100,45,37,120,10,0 # "%d-%x\n"
-
- .text
- .globl main
- .align 4
- .ent main
-main:
- .frame \$30,16,\$26,0
- ldgp \$29,0(\$27)
- .prologue 1
- .long 0x47e03d80 # implver \$0
- lda \$2,-1
- .long 0x47e20c21 # amask \$2,\$1
- lda \$16,\$Lformat
- mov \$0,\$17
- not \$1,\$18
- jsr \$26,printf
- ldgp \$29,0(\$26)
- mov 0,\$16
- jsr \$26,exit
- .end main
-EOF
- $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
- if test "$?" = 0 ; then
- case `./$dummy` in
- 0-0)
- UNAME_MACHINE="alpha"
- ;;
- 1-0)
- UNAME_MACHINE="alphaev5"
- ;;
- 1-1)
- UNAME_MACHINE="alphaev56"
- ;;
- 1-101)
- UNAME_MACHINE="alphapca56"
- ;;
- 2-303)
- UNAME_MACHINE="alphaev6"
- ;;
- 2-307)
- UNAME_MACHINE="alphaev67"
- ;;
- esac
- fi
- rm -f $dummy.s $dummy
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- exit 0 ;;
- 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 0 ;;
- 21064:Windows_NT:50:3)
- echo alpha-dec-winnt3.5
- exit 0 ;;
- Amiga*:UNIX_System_V:4.0:*)
- echo m68k-unknown-sysv4
- exit 0;;
- amiga:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- *:[Aa]miga[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-amigaos
- exit 0 ;;
- arc64:OpenBSD:*:*)
- echo mips64el-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- arc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- hkmips:OpenBSD:*:*)
- echo mips-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- pmax:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- sgi:OpenBSD:*:*)
- echo mips-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- wgrisc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- *:OS/390:*:*)
- echo i370-ibm-openedition
- exit 0 ;;
- arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- echo arm-acorn-riscix${UNAME_RELEASE}
- exit 0;;
- SR2?01:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit 0;;
- 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 0 ;;
- NILE*:*:*:dcosx)
- echo pyramid-pyramid-svr4
- exit 0 ;;
- sun4H:SunOS:5.*:*)
- echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- i86pc:SunOS:5.*:*)
- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- 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 0 ;;
- 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 0 ;;
- sun3*:SunOS:*:*)
- echo m68k-sun-sunos${UNAME_RELEASE}
- exit 0 ;;
- sun*:*:4.2BSD:*)
- UNAME_RELEASE=`(head -1 /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 0 ;;
- aushp:SunOS:*:*)
- echo sparc-auspex-sunos${UNAME_RELEASE}
- exit 0 ;;
- atari*:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- # 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 0 ;;
- atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit 0 ;;
- *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit 0 ;;
- milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint${UNAME_RELEASE}
- exit 0 ;;
- hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint${UNAME_RELEASE}
- exit 0 ;;
- *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint${UNAME_RELEASE}
- exit 0 ;;
- sun3*:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mac68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme88k:OpenBSD:*:*)
- echo m88k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- powerpc:machten:*:*)
- echo powerpc-apple-machten${UNAME_RELEASE}
- exit 0 ;;
- RISC*:Mach:*:*)
- echo mips-dec-mach_bsd4.3
- exit 0 ;;
- RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix${UNAME_RELEASE}
- exit 0 ;;
- VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix${UNAME_RELEASE}
- exit 0 ;;
- 2020:CLIX:*:* | 2430:CLIX:*:*)
- echo clipper-intergraph-clix${UNAME_RELEASE}
- exit 0 ;;
- mips:*:*:UMIPS | mips:*:*:RISCos)
- sed 's/^ //' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h> /* 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 $dummy.c -o $dummy \
- && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
- && rm $dummy.c $dummy && exit 0
- rm -f $dummy.c $dummy
- echo mips-mips-riscos${UNAME_RELEASE}
- exit 0 ;;
- Night_Hawk:Power_UNIX:*:*)
- echo powerpc-harris-powerunix
- exit 0 ;;
- m88k:CX/UX:7*:*)
- echo m88k-harris-cxux7
- exit 0 ;;
- m88k:*:4*:R4*)
- echo m88k-motorola-sysv4
- exit 0 ;;
- m88k:*:3*:R3*)
- echo m88k-motorola-sysv3
- exit 0 ;;
- 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 0 ;;
- M88*:DolphinOS:*:*) # DolphinOS (SVR3)
- echo m88k-dolphin-sysv3
- exit 0 ;;
- M88*:*:R3*:*)
- # Delta 88k system running SVR3
- echo m88k-motorola-sysv3
- exit 0 ;;
- XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
- echo m88k-tektronix-sysv3
- exit 0 ;;
- Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
- echo m68k-tektronix-bsd
- exit 0 ;;
- *:IRIX*:*:*)
- echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit 0 ;;
- ????????: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 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
- i?86:AIX:*:*)
- echo i386-ibm-aix
- exit 0 ;;
- *:AIX:2:3)
- if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- sed 's/^ //' << EOF >$dummy.c
- #include <sys/systemcfg.h>
-
- main()
- {
- if (!__power_pc())
- exit(1);
- puts("powerpc-ibm-aix3.2.5");
- exit(0);
- }
-EOF
- $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
- rm -f $dummy.c $dummy
- echo rs6000-ibm-aix3.2.5
- 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 0 ;;
- *:AIX:*:4)
- IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
- if /usr/sbin/lsattr -EHl ${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=4.${UNAME_RELEASE}
- fi
- echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit 0 ;;
- *:AIX:*:*)
- echo rs6000-ibm-aix
- exit 0 ;;
- ibmrt:4.4BSD:*|romp-ibm:BSD:*)
- echo romp-ibm-bsd4.4
- exit 0 ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit 0 ;; # report: romp-ibm BSD 4.3
- *:BOSX:*:*)
- echo rs6000-bull-bosx
- exit 0 ;;
- DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit 0 ;;
- 9000/[34]??:4.3bsd:1.*:*)
- echo m68k-hp-bsd
- exit 0 ;;
- hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- echo m68k-hp-bsd4.4
- exit 0 ;;
- 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])
- case "${HPUX_REV}" in
- 11.[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" ;;
- esac ;;
- esac
- fi ;;
- esac
- if [ "${HP_ARCH}" = "" ]; then
- sed 's/^ //' << EOF >$dummy.c
-
- #define _HPUX_SOURCE
- #include <stdlib.h>
- #include <unistd.h>
-
- 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 $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
- if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
- rm -f $dummy.c $dummy
- fi ;;
- esac
- echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit 0 ;;
- 3050*:HI-UX:*:*)
- sed 's/^ //' << EOF >$dummy.c
- #include <unistd.h>
- 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 $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
- rm -f $dummy.c $dummy
- echo unknown-hitachi-hiuxwe2
- exit 0 ;;
- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
- echo hppa1.1-hp-bsd
- exit 0 ;;
- 9000/8??:4.3bsd:*:*)
- echo hppa1.0-hp-bsd
- exit 0 ;;
- *9??*:MPE/iX:*:*)
- echo hppa1.0-hp-mpeix
- exit 0 ;;
- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
- echo hppa1.1-hp-osf
- exit 0 ;;
- hp8??:OSF1:*:*)
- echo hppa1.0-hp-osf
- exit 0 ;;
- i?86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
- echo ${UNAME_MACHINE}-unknown-osf1mk
- else
- echo ${UNAME_MACHINE}-unknown-osf1
- fi
- exit 0 ;;
- parisc*:Lites*:*:*)
- echo hppa1.1-hp-lites
- exit 0 ;;
- hppa*:OpenBSD:*:*)
- echo hppa-unknown-openbsd
- exit 0 ;;
- C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- echo c1-convex-bsd
- exit 0 ;;
- C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit 0 ;;
- C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- echo c34-convex-bsd
- exit 0 ;;
- C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- echo c38-convex-bsd
- exit 0 ;;
- C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- echo c4-convex-bsd
- exit 0 ;;
- CRAY*X-MP:*:*:*)
- echo xmp-cray-unicos
- exit 0 ;;
- CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE}
- exit 0 ;;
- CRAY*[A-Z]90:*:*:*)
- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
- | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
- exit 0 ;;
- CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
- CRAY*T3D:*:*:*)
- echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
- CRAY*T3E:*:*:*)
- echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
- CRAY*SV1:*:*:*)
- echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
- CRAY-2:*:*:*)
- echo cray2-cray-unicos
- exit 0 ;;
- F300:UNIX_System_V:*:*)
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit 0 ;;
- F301:UNIX_System_V:*:*)
- echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
- exit 0 ;;
- hp300:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- i?86:BSD/386:*:* | i?86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit 0 ;;
- sparc*:BSD/OS:*:*)
- echo sparc-unknown-bsdi${UNAME_RELEASE}
- exit 0 ;;
- *:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
- exit 0 ;;
- *:FreeBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit 0 ;;
- *:OpenBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- exit 0 ;;
- i*:CYGWIN*:*)
- echo ${UNAME_MACHINE}-pc-cygwin
- exit 0 ;;
- i*:MINGW*:*)
- echo ${UNAME_MACHINE}-pc-mingw32
- exit 0 ;;
- i*:PW*:*)
- echo ${UNAME_MACHINE}-pc-pw32
- exit 0 ;;
- 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 i386-pc-interix
- exit 0 ;;
- i*:UWIN*:*)
- echo ${UNAME_MACHINE}-pc-uwin
- exit 0 ;;
- p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin
- exit 0 ;;
- prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- *:GNU:*:*)
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit 0 ;;
- i*86:Minix:*:*)
- echo ${UNAME_MACHINE}-pc-minix
- exit 0 ;;
- *:Linux:*:*)
-
- # The BFD linker knows what the default object file format is, so
- # first see if it will tell us. cd to the root directory to prevent
- # problems with other programs or directories called `ld' in the path.
- ld_supported_emulations=`cd /; ld --help 2>&1 \
- | sed -ne '/supported emulations:/!d
- s/[ ][ ]*/ /g
- s/.*supported emulations: *//
- s/ .*//
- p'`
- case "$ld_supported_emulations" in
- *ia64)
- echo "${UNAME_MACHINE}-unknown-linux"
- exit 0
- ;;
- i?86linux)
- echo "${UNAME_MACHINE}-pc-linux-gnuaout"
- exit 0
- ;;
- elf_i?86)
- TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
- ;;
- i?86coff)
- echo "${UNAME_MACHINE}-pc-linux-gnucoff"
- exit 0
- ;;
- sparclinux)
- echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
- exit 0
- ;;
- elf32_sparc)
- echo "${UNAME_MACHINE}-unknown-linux-gnu"
- exit 0
- ;;
- armlinux)
- echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
- exit 0
- ;;
- elf32arm*)
- echo "${UNAME_MACHINE}-unknown-linux-gnuoldld"
- exit 0
- ;;
- armelf_linux*)
- echo "${UNAME_MACHINE}-unknown-linux-gnu"
- exit 0
- ;;
- m68klinux)
- echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
- exit 0
- ;;
- elf32ppc | elf32ppclinux)
- # Determine Lib Version
- cat >$dummy.c <<EOF
-#include <features.h>
-#if defined(__GLIBC__)
-extern char __libc_version[];
-extern char __libc_release[];
-#endif
-main(argc, argv)
- int argc;
- char *argv[];
-{
-#if defined(__GLIBC__)
- printf("%s %s\n", __libc_version, __libc_release);
-#else
- printf("unkown\n");
-#endif
- return 0;
-}
-EOF
- LIBC=""
- $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
- if test "$?" = 0 ; then
- ./$dummy | grep 1\.99 > /dev/null
- if test "$?" = 0 ; then
- LIBC="libc1"
- fi
- fi
- rm -f $dummy.c $dummy
- echo powerpc-unknown-linux-gnu${LIBC}
- exit 0
- ;;
- shelf_linux)
- echo "${UNAME_MACHINE}-unknown-linux-gnu"
- exit 0
- ;;
- esac
-
- if test "${UNAME_MACHINE}" = "alpha" ; then
- cat <<EOF >$dummy.s
- .data
- \$Lformat:
- .byte 37,100,45,37,120,10,0 # "%d-%x\n"
-
- .text
- .globl main
- .align 4
- .ent main
- main:
- .frame \$30,16,\$26,0
- ldgp \$29,0(\$27)
- .prologue 1
- .long 0x47e03d80 # implver \$0
- lda \$2,-1
- .long 0x47e20c21 # amask \$2,\$1
- lda \$16,\$Lformat
- mov \$0,\$17
- not \$1,\$18
- jsr \$26,printf
- ldgp \$29,0(\$26)
- mov 0,\$16
- jsr \$26,exit
- .end main
-EOF
- LIBC=""
- $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
- if test "$?" = 0 ; then
- case `./$dummy` in
- 0-0)
- UNAME_MACHINE="alpha"
- ;;
- 1-0)
- UNAME_MACHINE="alphaev5"
- ;;
- 1-1)
- UNAME_MACHINE="alphaev56"
- ;;
- 1-101)
- UNAME_MACHINE="alphapca56"
- ;;
- 2-303)
- UNAME_MACHINE="alphaev6"
- ;;
- 2-307)
- UNAME_MACHINE="alphaev67"
- ;;
- esac
-
- objdump --private-headers $dummy | \
- grep ld.so.1 > /dev/null
- if test "$?" = 0 ; then
- LIBC="libc1"
- fi
- fi
- rm -f $dummy.s $dummy
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
- elif test "${UNAME_MACHINE}" = "mips" ; then
- cat >$dummy.c <<EOF
-#ifdef __cplusplus
-#include <stdio.h> /* for printf() prototype */
- int main (int argc, char *argv[]) {
-#else
- int main (argc, argv) int argc; char *argv[]; {
-#endif
-#ifdef __MIPSEB__
- printf ("%s-unknown-linux-gnu\n", argv[1]);
-#endif
-#ifdef __MIPSEL__
- printf ("%sel-unknown-linux-gnu\n", argv[1]);
-#endif
- return 0;
-}
-EOF
- $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
- rm -f $dummy.c $dummy
- elif test "${UNAME_MACHINE}" = "s390"; then
- echo s390-ibm-linux && exit 0
- elif test "${UNAME_MACHINE}" = "x86_64"; then
- echo x86_64-unknown-linux-gnu && exit 0
- elif test "${UNAME_MACHINE}" = "parisc" -o "${UNAME_MACHINE}" = "hppa"; then
- # 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 0
- else
- # Either a pre-BFD a.out linker (linux-gnuoldld)
- # or one that does not give us useful --help.
- # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
- # If ld does not provide *any* "supported emulations:"
- # that means it is gnuoldld.
- test -z "$ld_supported_emulations" \
- && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
-
- case "${UNAME_MACHINE}" in
- i?86)
- VENDOR=pc;
- ;;
- *)
- VENDOR=unknown;
- ;;
- esac
- # Determine whether the default compiler is a.out or elf
- cat >$dummy.c <<EOF
-#include <features.h>
-#ifdef __cplusplus
-#include <stdio.h> /* for printf() prototype */
- int main (int argc, char *argv[]) {
-#else
- int main (argc, argv) int argc; char *argv[]; {
-#endif
-#ifdef __ELF__
-# ifdef __GLIBC__
-# if __GLIBC__ >= 2
- printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
-# else
- printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
-# endif
-# else
- printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
-# endif
-#else
- printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
-#endif
- return 0;
-}
-EOF
- $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
- rm -f $dummy.c $dummy
- test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
- fi ;;
-# 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.
- i?86:DYNIX/ptx:4*:*)
- echo i386-sequent-sysv4
- exit 0 ;;
- 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 0 ;;
- 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 0 ;;
- i?86:*:5:7*)
- # Fixed at (any) Pentium or better
- UNAME_MACHINE=i586
- if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then
- echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION}
- else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
- fi
- exit 0 ;;
- i?86:*:3.2:*)
- if test -f /usr/options/cb.name; then
- UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
- elif /bin/uname -X 2>/dev/null >/dev/null ; then
- UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
- (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
- (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
- && UNAME_MACHINE=i586
- (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
- && UNAME_MACHINE=i686
- (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
- && UNAME_MACHINE=i686
- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
- else
- echo ${UNAME_MACHINE}-pc-sysv32
- fi
- exit 0 ;;
- i?86:*DOS:*:*)
- echo ${UNAME_MACHINE}-pc-msdosdjgpp
- exit 0 ;;
- 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 i386.
- echo i386-pc-msdosdjgpp
- exit 0 ;;
- Intel:Mach:3*:*)
- echo i386-pc-mach3
- exit 0 ;;
- paragon:*:*:*)
- echo i860-intel-osf1
- exit 0 ;;
- 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 0 ;;
- mini*:CTIX:SYS*5:*)
- # "miniframe"
- echo m68010-convergent-sysv
- exit 0 ;;
- M68*:*:R3V[567]*:*)
- test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
- 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*: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 0
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
- 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && echo i486-ncr-sysv4 && exit 0 ;;
- m68*:LynxOS:2.*:*)
- echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- mc68030:UNIX_System_V:4.*:*)
- echo m68k-atari-sysv4
- exit 0 ;;
- i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv${UNAME_RELEASE}
- exit 0 ;;
- RM*:ReliantUNIX-*:*:*)
- echo mips-sni-sysv4
- exit 0 ;;
- RM*:SINIX-*:*:*)
- echo mips-sni-sysv4
- exit 0 ;;
- *: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 0 ;;
- PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit 0 ;;
- *:UNIX_System_V:4*:FTX*)
- # From Gerald Hewes <hewes@openmarket.com>.
- # How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit 0 ;;
- *:*:*:FTX*)
- # From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit 0 ;;
- mc68*:A/UX:*:*)
- echo m68k-apple-aux${UNAME_RELEASE}
- exit 0 ;;
- news*:NEWS-OS:6*:*)
- echo mips-sony-newsos6
- exit 0 ;;
- 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 0 ;;
- BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
- echo powerpc-be-beos
- exit 0 ;;
- BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
- echo powerpc-apple-beos
- exit 0 ;;
- BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
- echo i586-pc-beos
- exit 0 ;;
- SX-4:SUPER-UX:*:*)
- echo sx4-nec-superux${UNAME_RELEASE}
- exit 0 ;;
- SX-5:SUPER-UX:*:*)
- echo sx5-nec-superux${UNAME_RELEASE}
- exit 0 ;;
- Power*:Rhapsody:*:*)
- echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit 0 ;;
- *:Rhapsody:*:*)
- echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
- exit 0 ;;
- *:Darwin:*:*)
- echo `uname -p`-apple-darwin${UNAME_RELEASE}
- exit 0 ;;
- *:procnto*:*:* | *:QNX:[0123456789]*:*)
- if test "${UNAME_MACHINE}" = "x86pc"; then
- UNAME_MACHINE=pc
- fi
- echo `uname -p`-${UNAME_MACHINE}-nto-qnx
- exit 0 ;;
- *:QNX:*:4*)
- echo i386-pc-qnx
- exit 0 ;;
- NSR-[KW]:NONSTOP_KERNEL:*:*)
- echo nsr-tandem-nsk${UNAME_RELEASE}
- exit 0 ;;
- *:NonStop-UX:*:*)
- echo mips-compaq-nonstopux
- exit 0 ;;
- BS2000:POSIX*:*:*)
- echo bs2000-siemens-sysv
- exit 0 ;;
- DS/*:UNIX_System_V:*:*)
- echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
- exit 0 ;;
- *: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 0 ;;
-esac
-
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#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 <sys/param.h>
- 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"); 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)
- printf ("vax-dec-bsd\n"); exit (0);
-#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 $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
-rm -f $dummy.c $dummy
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
-
-# 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 0 ;;
- c2*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit 0 ;;
- c34*)
- echo c34-convex-bsd
- exit 0 ;;
- c38*)
- echo c38-convex-bsd
- exit 0 ;;
- c4*)
- echo c4-convex-bsd
- exit 0 ;;
- esac
-fi
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-The $version version of this script cannot recognize your system type.
-Please download the most up to date version of the config scripts:
-
- ftp://ftp.gnu.org/pub/gnu/config/
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
-
-config.guess version = $version
-
-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: "version='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/winsup/mingw/config.sub b/winsup/mingw/config.sub
deleted file mode 100755
index 3cccc5acd..000000000
--- a/winsup/mingw/config.sub
+++ /dev/null
@@ -1,1332 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script, version 1.1.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
-# Free Software Foundation, Inc.
-
-version='2000-11-15'
-
-# 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, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Please send patches to <config-patches@gnu.org>.
-#
-# 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.
-
-# 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
- -V, --version print version number, then exit"
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case "$1" in
- --version | --vers* | -V )
- echo "$version" ; exit 0 ;;
- --help | --h* | -h )
- echo "$usage"; exit 0 ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- exec >&2
- echo "$me: invalid option $1"
- echo "$help"
- exit 1 ;;
-
- *local*)
- # First pass through any local machine types.
- echo $1
- exit 0;;
-
- * )
- 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* | storm-chaos*)
- os=-$maybe_os
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
- ;;
- *)
- 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)
- os=
- basic_machine=$1
- ;;
- -sim | -cisco | -oki | -wec | -winbond)
- os=
- basic_machine=$1
- ;;
- -scout)
- ;;
- -wrs)
- os=-vxworks
- basic_machine=$1
- ;;
- -hiux*)
- os=-hiuxwe2
- ;;
- -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/'`
- ;;
- -sco*)
- os=-sco3.2v2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -udk*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -isc)
- os=-isc2.2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -clix*)
- basic_machine=clipper-intergraph
- ;;
- -isc*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -lynx*)
- os=-lynxos
- ;;
- -ptx*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
- ;;
- -windowsnt*)
- os=`echo $os | sed -e 's/windowsnt/winnt/'`
- ;;
- -psos*)
- os=-psos
- ;;
- -mint | -mint[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
- # Recognize the basic CPU types without company name.
- # Some are omitted here because they have special meanings below.
- tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
- | arme[lb] | armv[2345] | armv[345][lb] | pyramid | mn10200 | mn10300 | tron | a29k \
- | 580 | i960 | h8300 \
- | x86 | ppcbe | mipsbe | mipsle | shbe | shle | armbe | armle \
- | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
- | hppa64 \
- | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \
- | alphaev6[78] \
- | we32k | ns16k | clipper | i370 | sh | sh[34] \
- | powerpc | powerpcle \
- | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \
- | mips64orion | mips64orionel | mipstx39 | mipstx39el \
- | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
- | mips64vr5000 | miprs64vr5000el | mcore \
- | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
- | thumb | d10v | d30v | fr30 | avr)
- basic_machine=$basic_machine-unknown
- ;;
- m6811 | m68hc11 | m6812 | m68hc12)
- # Motorola 68HC11/12.
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl)
- ;;
-
- # 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[234567]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.
- # FIXME: clean up the formatting here.
- vax-* | tahoe-* | i[234567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
- | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
- | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
- | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
- | xmp-* | ymp-* \
- | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* | armbe-* | armle-* \
- | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \
- | hppa2.0n-* | hppa64-* \
- | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \
- | alphaev6[78]-* \
- | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
- | clipper-* | orion-* \
- | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
- | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \
- | mips64el-* | mips64orion-* | mips64orionel-* \
- | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
- | mipstx39-* | mipstx39el-* | mcore-* \
- | f301-* | armv*-* | s390-* | sv1-* | t3e-* \
- | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
- | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \
- | bs2000-* | tic54x-* | c54x-* | x86_64-*)
- ;;
- # 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
- ;;
- 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
- ;;
- 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
- ;;
- aux)
- basic_machine=m68k-apple
- os=-aux
- ;;
- balance)
- basic_machine=ns32k-sequent
- os=-dynix
- ;;
- 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 | ymp)
- basic_machine=ymp-cray
- os=-unicos
- ;;
- cray2)
- basic_machine=cray2-cray
- os=-unicos
- ;;
- [ctj]90-cray)
- basic_machine=c90-cray
- os=-unicos
- ;;
- crds | unos)
- basic_machine=m68k-crds
- ;;
- cris | cris-* | etrax*)
- basic_machine=cris-axis
- ;;
- da30 | da30-*)
- basic_machine=m68k-da30
- ;;
- decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
- basic_machine=mips-dec
- ;;
- delta | 3300 | motorola-3300 | motorola-delta \
- | 3300-motorola | delta-motorola)
- basic_machine=m68k-motorola
- ;;
- delta88)
- basic_machine=m88k-motorola
- os=-sysv3
- ;;
- 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
- ;;
- 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'm not sure what "Sysv32" means. Should this be sysv3.2?
- i[34567]86v32)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv32
- ;;
- i[34567]86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv4
- ;;
- i[34567]86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv
- ;;
- i[34567]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
- ;;
- i386-go32 | go32)
- basic_machine=i386-unknown
- os=-go32
- ;;
- i386-mingw32 | mingw32)
- basic_machine=i386-unknown
- os=-mingw32
- ;;
- i[34567]86-pw32 | pw32)
- basic_machine=i586-unknown
- os=-pw32
- ;;
- iris | iris4d)
- basic_machine=mips-sgi
- case $os in
- -irix*)
- ;;
- *)
- os=-irix4
- ;;
- esac
- ;;
- isi68 | isi)
- basic_machine=m68k-isi
- os=-sysv
- ;;
- m88k-omron*)
- basic_machine=m88k-omron
- ;;
- magnum | m3230)
- basic_machine=mips-mips
- os=-sysv
- ;;
- merlin)
- basic_machine=ns32k-utek
- os=-sysv
- ;;
- miniframe)
- basic_machine=m68000-convergent
- ;;
- *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
- mipsel*-linux*)
- basic_machine=mipsel-unknown
- os=-linux-gnu
- ;;
- mips*-linux*)
- basic_machine=mips-unknown
- os=-linux-gnu
- ;;
- mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
- ;;
- mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
- ;;
- mmix*)
- basic_machine=mmix-knuth
- os=-mmixware
- ;;
- monitor)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- msdos)
- basic_machine=i386-unknown
- os=-msdos
- ;;
- mvs)
- basic_machine=i370-ibm
- os=-mvs
- ;;
- 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
- ;;
- nsr-tandem)
- basic_machine=nsr-tandem
- ;;
- op50n-* | op60c-*)
- basic_machine=hppa1.1-oki
- os=-proelf
- ;;
- 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
- ;;
- pbd)
- basic_machine=sparc-tti
- ;;
- pbb)
- basic_machine=m68k-tti
- ;;
- pc532 | pc532-*)
- basic_machine=ns32k-pc532
- ;;
- pentium | p5 | k5 | k6 | nexgen)
- basic_machine=i586-pc
- ;;
- pentiumpro | p6 | 6x86 | athlon)
- basic_machine=i686-pc
- ;;
- pentiumii | pentium2)
- basic_machine=i686-pc
- ;;
- pentium-* | p5-* | k5-* | k6-* | nexgen-*)
- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumpro-* | p6-* | 6x86-* | athlon-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumii-* | pentium2-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pn)
- basic_machine=pn-gould
- ;;
- power) basic_machine=power-ibm
- ;;
- ppc) basic_machine=powerpc-unknown
- ;;
- ppc-*) 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/^[^-]*-//'`
- ;;
- ps2)
- basic_machine=i386-ibm
- ;;
- rom68k)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- rm[46]00)
- basic_machine=mips-siemens
- ;;
- rtpc | rtpc-*)
- basic_machine=romp-ibm
- ;;
- sa29200)
- basic_machine=a29k-amd
- os=-udi
- ;;
- sequent)
- basic_machine=i386-sequent
- ;;
- sh)
- basic_machine=sh-hitachi
- os=-hms
- ;;
- sparclite-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
- ;;
- 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=t3e-cray
- os=-unicos
- ;;
- tic54x | c54x*)
- basic_machine=tic54x-unknown
- os=-coff
- ;;
- tx39)
- basic_machine=mipstx39-unknown
- ;;
- tx39el)
- basic_machine=mipstx39el-unknown
- ;;
- tower | tower-32)
- basic_machine=m68k-ncr
- ;;
- 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
- ;;
- xmp)
- basic_machine=xmp-cray
- os=-unicos
- ;;
- xps | xps100)
- basic_machine=xps100-honeywell
- ;;
- z8k-*-coff)
- basic_machine=z8k-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
- ;;
- mips)
- if [ x$os = x-linux-gnu ]; then
- basic_machine=mips-unknown
- else
- basic_machine=mips-mips
- fi
- ;;
- romp)
- basic_machine=romp-ibm
- ;;
- rs6000)
- basic_machine=rs6000-ibm
- ;;
- vax)
- basic_machine=vax-dec
- ;;
- pdp11)
- basic_machine=pdp11-dec
- ;;
- we32k)
- basic_machine=we32k-att
- ;;
- sh3 | sh4)
- basic_machine=sh-unknown
- ;;
- sparc | sparcv9)
- 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
- ;;
- c4x*)
- basic_machine=c4x-none
- os=-coff
- ;;
- *)
- 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.
- -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* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
- | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* \
- | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
- | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
- | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
- | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
- | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* | -storm-chaos*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
- -qnx*)
- case $basic_machine in
- x86-* | i[34567]86-*)
- ;;
- *)
- os=-nto$os
- ;;
- esac
- ;;
- -nto*)
- os=-nto-qnx
- ;;
- -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
- | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
- | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
- ;;
- -mac*)
- os=`echo $os | sed -e 's|mac|macos|'`
- ;;
- -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
- ;;
- -wince*)
- os=-wince
- ;;
- -osfrose*)
- os=-osfrose
- ;;
- -osf*)
- os=-osf
- ;;
- -utek*)
- os=-bsd
- ;;
- -dynix*)
- os=-bsd
- ;;
- -acis*)
- os=-aos
- ;;
- -386bsd)
- os=-bsd
- ;;
- -ctix* | -uts*)
- os=-sysv
- ;;
- -ns2 )
- os=-nextstep2
- ;;
- -nsk*)
- os=-nsk
- ;;
- # Preserve the version number of sinix5.
- -sinix5.*)
- os=`echo $os | sed -e 's|sinix|sysv|'`
- ;;
- -sinix*)
- os=-sysv4
- ;;
- -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)
- os=-mint
- ;;
- -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
- *-acorn)
- os=-riscix1.2
- ;;
- arm*-rebel)
- os=-linux
- ;;
- arm*-semi)
- os=-aout
- ;;
- pdp11-*)
- os=-none
- ;;
- *-dec | vax-*)
- os=-ultrix4.2
- ;;
- m68*-apollo)
- os=-domain
- ;;
- i386-sun)
- os=-sunos4.0.2
- ;;
- m68000-sun)
- os=-sunos3
- # This also exists in the configure program, but was not the
- # default.
- # os=-sunos4
- ;;
- m68*-cisco)
- os=-aout
- ;;
- mips*-cisco)
- os=-elf
- ;;
- mips*-*)
- os=-elf
- ;;
- *-tti) # must be before sparc entry or we get the wrong os.
- os=-sysv3
- ;;
- sparc-* | *-sun)
- os=-sunos4.1.1
- ;;
- *-be)
- os=-beos
- ;;
- *-ibm)
- os=-aix
- ;;
- *-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
- ;;
- f301-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
- ;;
- -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
- ;;
- -ptx*)
- vendor=sequent
- ;;
- -vxsim* | -vxworks*)
- vendor=wrs
- ;;
- -aux*)
- vendor=apple
- ;;
- -hms*)
- vendor=hitachi
- ;;
- -mpw* | -macos*)
- vendor=apple
- ;;
- -*mint | -*MiNT)
- vendor=atari
- ;;
- esac
- basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
- ;;
-esac
-
-echo $basic_machine$os
-exit 0
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "version='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/winsup/mingw/configure b/winsup/mingw/configure
deleted file mode 100755
index 1d976f360..000000000
--- a/winsup/mingw/configure
+++ /dev/null
@@ -1,2159 +0,0 @@
-#! /bin/sh
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-
-# Defaults:
-ac_help=
-ac_default_prefix=/usr/local
-# Any additions from configure.in:
-
-# Initialize some variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
-exec_prefix=NONE
-host=NONE
-no_create=
-nonopt=NONE
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-target=NONE
-verbose=
-x_includes=NONE
-x_libraries=NONE
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
-ac_prev=
-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=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case "$ac_option" in
-
- -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 ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$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" ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir="$ac_optarg" ;;
-
- -disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_${ac_feature}='$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)
- # 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 << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --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
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host="$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" ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- 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)
- 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" ;;
-
- -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 ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
- exit 0 ;;
-
- -with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "with_${ac_package}='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=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" ;;
-
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
- ;;
-
- *)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
-
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
-do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
- esac
-done
-
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
-
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=dllmain.c
-
-# 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 its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
- 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
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
- else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
- fi
-fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
-else
- echo "creating cache $cache_file"
- > $cache_file
-fi
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
-
-
-
-
-
-
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-
-# Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:555: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
- case $nonopt in
- NONE)
- if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
- else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
- fi ;;
- *) host_alias=$nonopt ;;
- esac ;;
-esac
-
-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
-
-echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:576: checking build system type" >&5
-
-build_alias=$build
-case "$build_alias" in
-NONE)
- case $nonopt in
- NONE) build_alias=$host_alias ;;
- *) build_alias=$nonopt ;;
- esac ;;
-esac
-
-build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
-build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$build" 1>&6
-
-if test $host != $build; then
- ac_tool_prefix=${host_alias}-
-else
- ac_tool_prefix=
-fi
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:602: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="${ac_tool_prefix}gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_CC"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:634: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="gcc"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- CC="gcc"
-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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:670: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_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 $# -gt 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
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
- fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:719: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:728: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
-else
- ac_cv_prog_gcc=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:743: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
-else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-O2"
- fi
- if test "$ac_test_CXXFLAGS" != set; then
- CXXFLAGS='$(CFLAGS)'
- fi
-else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
-fi
-
-
-case "$with_cross_host" in
- ""|*cygwin*) all_dlls_host='all_dlls_host'
- install_dlls_host='install_dlls_host';;
-esac
-
-
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:784: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$AR"; then
- ac_cv_prog_AR="$AR" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_AR="${ac_tool_prefix}ar"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-AR="$ac_cv_prog_AR"
-if test -n "$AR"; then
- echo "$ac_t""$AR" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_AR"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "ar", so it can be a program name with args.
-set dummy ar; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:816: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$AR"; then
- ac_cv_prog_AR="$AR" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_AR="ar"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
-fi
-fi
-AR="$ac_cv_prog_AR"
-if test -n "$AR"; then
- echo "$ac_t""$AR" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- AR="ar"
-fi
-fi
-
-
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:853: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$AS"; then
- ac_cv_prog_AS="$AS" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_AS="${ac_tool_prefix}as"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-AS="$ac_cv_prog_AS"
-if test -n "$AS"; then
- echo "$ac_t""$AS" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_AS"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "as", so it can be a program name with args.
-set dummy as; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:885: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$AS"; then
- ac_cv_prog_AS="$AS" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_AS="as"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="as"
-fi
-fi
-AS="$ac_cv_prog_AS"
-if test -n "$AS"; then
- echo "$ac_t""$AS" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- AS="as"
-fi
-fi
-
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:921: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_RANLIB"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:953: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB="ranlib"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- RANLIB="ranlib"
-fi
-fi
-
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:989: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$LD"; then
- ac_cv_prog_LD="$LD" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_LD="${ac_tool_prefix}ld"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-LD="$ac_cv_prog_LD"
-if test -n "$LD"; then
- echo "$ac_t""$LD" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_LD"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "ld", so it can be a program name with args.
-set dummy ld; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1021: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$LD"; then
- ac_cv_prog_LD="$LD" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_LD="ld"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_LD" && ac_cv_prog_LD="ld"
-fi
-fi
-LD="$ac_cv_prog_LD"
-if test -n "$LD"; then
- echo "$ac_t""$LD" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- LD="ld"
-fi
-fi
-
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1057: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$DLLTOOL"; then
- ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-DLLTOOL="$ac_cv_prog_DLLTOOL"
-if test -n "$DLLTOOL"; then
- echo "$ac_t""$DLLTOOL" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_DLLTOOL"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "dlltool", so it can be a program name with args.
-set dummy dlltool; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1089: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$DLLTOOL"; then
- ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_DLLTOOL="dlltool"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="dlltool"
-fi
-fi
-DLLTOOL="$ac_cv_prog_DLLTOOL"
-if test -n "$DLLTOOL"; then
- echo "$ac_t""$DLLTOOL" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- DLLTOOL="dlltool"
-fi
-fi
-
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1125: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_DLLWRAP'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$DLLWRAP"; then
- ac_cv_prog_DLLWRAP="$DLLWRAP" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_DLLWRAP="${ac_tool_prefix}dlltool"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-DLLWRAP="$ac_cv_prog_DLLWRAP"
-if test -n "$DLLWRAP"; then
- echo "$ac_t""$DLLWRAP" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_DLLWRAP"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "dlltool", so it can be a program name with args.
-set dummy dlltool; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1157: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_DLLWRAP'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$DLLWRAP"; then
- ac_cv_prog_DLLWRAP="$DLLWRAP" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_DLLWRAP="dlltool"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_DLLWRAP" && ac_cv_prog_DLLWRAP="dlltool"
-fi
-fi
-DLLWRAP="$ac_cv_prog_DLLWRAP"
-if test -n "$DLLWRAP"; then
- echo "$ac_t""$DLLWRAP" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- DLLWRAP="dlltool"
-fi
-fi
-
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1193: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$WINDRES"; then
- ac_cv_prog_WINDRES="$WINDRES" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_WINDRES="${ac_tool_prefix}windres"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-WINDRES="$ac_cv_prog_WINDRES"
-if test -n "$WINDRES"; then
- echo "$ac_t""$WINDRES" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_WINDRES"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "windres", so it can be a program name with args.
-set dummy windres; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1225: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$WINDRES"; then
- ac_cv_prog_WINDRES="$WINDRES" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_WINDRES="windres"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_WINDRES" && ac_cv_prog_WINDRES="windres"
-fi
-fi
-WINDRES="$ac_cv_prog_WINDRES"
-if test -n "$WINDRES"; then
- echo "$ac_t""$WINDRES" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- WINDRES="windres"
-fi
-fi
-
-
-
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1260: checking how to run the C preprocessor" >&5
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- # This must be in double quotes, not single quotes, because CPP may get
- # substituted into the Makefile and "${CC-cc}" will confuse make.
- CPP="${CC-cc} -E"
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp.
- cat > conftest.$ac_ext <<EOF
-#line 1275 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1281: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -E -traditional-cpp"
- cat > conftest.$ac_ext <<EOF
-#line 1292 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1298: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -nologo -E"
- cat > conftest.$ac_ext <<EOF
-#line 1309 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1315: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP=/lib/cpp
-fi
-rm -f conftest*
-fi
-rm -f conftest*
-fi
-rm -f conftest*
- ac_cv_prog_CPP="$CPP"
-fi
- CPP="$ac_cv_prog_CPP"
-else
- ac_cv_prog_CPP="$CPP"
-fi
-echo "$ac_t""$CPP" 1>&6
-
-# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
-# for constant arguments. Useless!
-echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:1342: checking for working alloca.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1347 "configure"
-#include "confdefs.h"
-#include <alloca.h>
-int main() {
-char *p = alloca(2 * sizeof(int));
-; return 0; }
-EOF
-if { (eval echo configure:1354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- ac_cv_header_alloca_h=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_alloca_h=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
-if test $ac_cv_header_alloca_h = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_ALLOCA_H 1
-EOF
-
-fi
-
-echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:1375: checking for alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1380 "configure"
-#include "confdefs.h"
-
-#ifdef __GNUC__
-# define alloca __builtin_alloca
-#else
-# ifdef _MSC_VER
-# include <malloc.h>
-# define alloca _alloca
-# else
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# ifdef _AIX
- #pragma alloca
-# else
-# ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-# endif
-# endif
-# endif
-# endif
-#endif
-
-int main() {
-char *p = (char *) alloca(1);
-; return 0; }
-EOF
-if { (eval echo configure:1408: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- ac_cv_func_alloca_works=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_func_alloca_works=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
-if test $ac_cv_func_alloca_works = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_ALLOCA 1
-EOF
-
-fi
-
-if test $ac_cv_func_alloca_works = no; then
- # The SVR3 libPW and SVR4 libucb both contain incompatible functions
- # that cause trouble. Some versions do not even contain alloca or
- # contain a buggy version. If you still want to use their alloca,
- # use ar to extract alloca.o from them instead of compiling alloca.c.
- ALLOCA=alloca.${ac_objext}
- cat >> confdefs.h <<\EOF
-#define C_ALLOCA 1
-EOF
-
-
-echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:1440: checking whether alloca needs Cray hooks" >&5
-if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1445 "configure"
-#include "confdefs.h"
-#if defined(CRAY) && ! defined(CRAY2)
-webecray
-#else
-wenotbecray
-#endif
-
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "webecray" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_os_cray=yes
-else
- rm -rf conftest*
- ac_cv_os_cray=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_os_cray" 1>&6
-if test $ac_cv_os_cray = yes; then
-for ac_func in _getb67 GETB67 getb67; do
- echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1470: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1475 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:1498: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<EOF
-#define CRAY_STACKSEG_END $ac_func
-EOF
-
- break
-else
- echo "$ac_t""no" 1>&6
-fi
-
-done
-fi
-
-echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:1525: checking stack direction for C alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- ac_cv_c_stack_direction=0
-else
- cat > conftest.$ac_ext <<EOF
-#line 1533 "configure"
-#include "confdefs.h"
-find_stack_direction ()
-{
- static char *addr = 0;
- auto char dummy;
- if (addr == 0)
- {
- addr = &dummy;
- return find_stack_direction ();
- }
- else
- return (&dummy > addr) ? 1 : -1;
-}
-main ()
-{
- exit (find_stack_direction() < 0);
-}
-EOF
-if { (eval echo configure:1552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- ac_cv_c_stack_direction=1
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_c_stack_direction=-1
-fi
-rm -fr conftest*
-fi
-
-fi
-
-echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
-cat >> confdefs.h <<EOF
-#define STACK_DIRECTION $ac_cv_c_stack_direction
-EOF
-
-fi
-
-
-
-# Do some error checking and defaulting for the host and target type.
-# The inputs are:
-# configure --host=HOST --target=TARGET --build=BUILD NONOPT
-#
-# The rules are:
-# 1. You are not allowed to specify --host, --target, and nonopt at the
-# same time.
-# 2. Host defaults to nonopt.
-# 3. If nonopt is not specified, then host defaults to the current host,
-# as determined by config.guess.
-# 4. Target and build default to nonopt.
-# 5. If nonopt is not specified, then target and build default to host.
-
-# The aliases save the names the user supplied, while $host etc.
-# will get canonicalized.
-case $host---$target---$nonopt in
-NONE---*---* | *---NONE---* | *---*---NONE) ;;
-*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
-esac
-
-
-# Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:1602: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
- case $nonopt in
- NONE)
- if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
- else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
- fi ;;
- *) host_alias=$nonopt ;;
- esac ;;
-esac
-
-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
-
-echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:1623: checking target system type" >&5
-
-target_alias=$target
-case "$target_alias" in
-NONE)
- case $nonopt in
- NONE) target_alias=$host_alias ;;
- *) target_alias=$nonopt ;;
- esac ;;
-esac
-
-target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
-target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$target" 1>&6
-
-echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1641: checking build system type" >&5
-
-build_alias=$build
-case "$build_alias" in
-NONE)
- case $nonopt in
- NONE) build_alias=$host_alias ;;
- *) build_alias=$nonopt ;;
- esac ;;
-esac
-
-build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
-build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$build" 1>&6
-
-test "$host_alias" != "$target_alias" &&
- test "$program_prefix$program_suffix$program_transform_name" = \
- NONENONEs,x,x, &&
- program_prefix=${target_alias}-
-
-SUBDIRS="profile mingwex"
-configdirs="profile mingwex"
-HEADER_SUBDIR=""
-
-LIBGMON_A=libgmon.a
-
-case "$target_os" in
-*cygwin*)
- MNO_CYGWIN=-mno-cygwin
- LIBM_A=
- # Install mingw headers in mingw subdirectory.
- HEADER_SUBDIR="mingw"
- ;;
-*)
- # Build it for MSVCRT by default.
- MNO_CYGWIN=
- LIBM_A=libm.a
- ;;
-esac
-
-# THREAD_DLL used to be set within the above case and was mingwc for CRTDLL.
-# I can find no reason to do this.
-#
-# FIXME: In the future I would like to change the dll name to mingwthrd to
-# to match the libmingwthrd.a name.
-THREAD_DLL=mingwm
-
-if test -n "$configdirs"; then
- subdirs="$configdirs"
-
-fi
-
-MKINSTALLDIRS=$ac_aux_dir/mkinstalldirs
-
-
-
-
-
-
-
-
-# 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
-# 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"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1716: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/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
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
-
-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. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL="$ac_install_sh"
- fi
-fi
-echo "$ac_t""$INSTALL" 1>&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_PROGRAM}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-trap '' 1 2 15
-cat > confcache <<\EOF
-# 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. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# 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.
-(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
- if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
-fi
-
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
-s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
-s%\[%\\&%g
-s%\]%\\&%g
-s%\$%$$%g
-EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-rm -f conftest.defs
-
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
-
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
-# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
-# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
-
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
-do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
-done
-
-ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
-
-trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@host@%$host%g
-s%@host_alias@%$host_alias%g
-s%@host_cpu@%$host_cpu%g
-s%@host_vendor@%$host_vendor%g
-s%@host_os@%$host_os%g
-s%@build@%$build%g
-s%@build_alias@%$build_alias%g
-s%@build_cpu@%$build_cpu%g
-s%@build_vendor@%$build_vendor%g
-s%@build_os@%$build_os%g
-s%@CC@%$CC%g
-s%@all_dlls_host@%$all_dlls_host%g
-s%@install_dlls_host@%$install_dlls_host%g
-s%@AR@%$AR%g
-s%@AS@%$AS%g
-s%@RANLIB@%$RANLIB%g
-s%@LD@%$LD%g
-s%@DLLTOOL@%$DLLTOOL%g
-s%@DLLWRAP@%$DLLWRAP%g
-s%@WINDRES@%$WINDRES%g
-s%@CPP@%$CPP%g
-s%@ALLOCA@%$ALLOCA%g
-s%@target@%$target%g
-s%@target_alias@%$target_alias%g
-s%@target_cpu@%$target_cpu%g
-s%@target_vendor@%$target_vendor%g
-s%@target_os@%$target_os%g
-s%@subdirs@%$subdirs%g
-s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g
-s%@MNO_CYGWIN@%$MNO_CYGWIN%g
-s%@THREAD_DLL@%$THREAD_DLL%g
-s%@LIBM_A@%$LIBM_A%g
-s%@LIBGMON_A@%$LIBGMON_A%g
-s%@SUBDIRS@%$SUBDIRS%g
-s%@HEADER_SUBDIR@%$HEADER_SUBDIR%g
-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
-s%@INSTALL_DATA@%$INSTALL_DATA%g
-
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
- else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
- fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
- else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
- fi
-done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
-fi
-EOF
-
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
- fi
-
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
-
- case "$ac_given_INSTALL" in
- [/$]*) INSTALL="$ac_given_INSTALL" ;;
- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
- esac
-
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
- esac
-
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-s%@INSTALL@%$INSTALL%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
-if test "$no_recursion" != yes; then
-
- # Remove --cache-file and --srcdir arguments so they do not pile up.
- ac_sub_configure_args=
- ac_prev=
- for ac_arg in $ac_configure_args; 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=*)
- ;;
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- ;;
- *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
- esac
- done
-
- for ac_config_dir in $configdirs; do
-
- # Do not complain, so a configure script can configure whichever
- # parts of a large source tree are present.
- if test ! -d $srcdir/$ac_config_dir; then
- continue
- fi
-
- echo configuring in $ac_config_dir
-
- case "$srcdir" in
- .) ;;
- *)
- if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :;
- else
- { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; }
- fi
- ;;
- esac
-
- ac_popdir=`pwd`
- cd $ac_config_dir
-
- # A "../" for each directory in /$ac_config_dir.
- ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`
-
- case "$srcdir" in
- .) # No --srcdir option. We are building in place.
- ac_sub_srcdir=$srcdir ;;
- /*) # Absolute path.
- ac_sub_srcdir=$srcdir/$ac_config_dir ;;
- *) # Relative path.
- ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;;
- esac
-
- # Check for guested configure; otherwise get Cygnus style configure.
- if test -f $ac_sub_srcdir/configure; then
- ac_sub_configure=$ac_sub_srcdir/configure
- elif test -f $ac_sub_srcdir/configure.in; then
- ac_sub_configure=$ac_configure
- else
- echo "configure: warning: no configuration information is in $ac_config_dir" 1>&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 path.
- ac_sub_cache_file="$ac_dots$cache_file" ;;
- esac
- case "$ac_given_INSTALL" in
- [/$]*) INSTALL="$ac_given_INSTALL" ;;
- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
- esac
-
- echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir"
- # The eval makes quoting arguments work.
- if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir
- then :
- else
- { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; }
- fi
- fi
-
- cd $ac_popdir
- done
-fi
-
-
diff --git a/winsup/mingw/configure.in b/winsup/mingw/configure.in
deleted file mode 100644
index 3fe9e1b55..000000000
--- a/winsup/mingw/configure.in
+++ /dev/null
@@ -1,133 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-
-dnl This file is part of winsup/mingw
-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 This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-AC_PREREQ(2.12)
-AC_INIT(dllmain.c)
-
-dnl FIXME: We temporarily define our own version of AC_PROG_CC. This is
-dnl copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
-dnl are probably using a cross compiler, which will not be able to fully
-dnl link an executable. This should really be fixed in autoconf
-dnl itself.
-
-AC_DEFUN(LIB_AC_PROG_CC,
-[AC_BEFORE([$0], [AC_PROG_CPP])dnl
-AC_CHECK_TOOL(CC, gcc, gcc)
-if test -z "$CC"; then
- AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
- test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
-fi
-
-AC_PROG_CC_GNU
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-dnl Check whether -g works, even if CFLAGS is set, in case the package
-dnl plays around with CFLAGS (such as to build both debugging and
-dnl normal versions of a library), tasteless as that idea is.
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- AC_PROG_CC_G
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-O2"
- fi
- if test "$ac_test_CXXFLAGS" != set; then
- CXXFLAGS='$(CFLAGS)'
- fi
-else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
-fi
-])
-
-LIB_AC_PROG_CC
-
-case "$with_cross_host" in
- ""|*cygwin*) all_dlls_host='all_dlls_host'
- install_dlls_host='install_dlls_host';;
-esac
-AC_SUBST(all_dlls_host)
-AC_SUBST(install_dlls_host)
-
-AC_CHECK_TOOL(AR, ar, ar)
-
-AC_SUBST(AR)
-AC_CHECK_TOOL(AS, as, as)
-AC_SUBST(AS)
-AC_CHECK_TOOL(RANLIB, ranlib, ranlib)
-AC_SUBST(RANLIB)
-AC_CHECK_TOOL(LD, ld, ld)
-AC_SUBST(LD)
-AC_CHECK_TOOL(DLLTOOL, dlltool, dlltool)
-AC_SUBST(DLLTOOL)
-AC_CHECK_TOOL(DLLWRAP, dlltool, dlltool)
-AC_SUBST(DLLWRAP)
-AC_CHECK_TOOL(WINDRES, windres, windres)
-AC_SUBST(WINDRES)
-
-AC_ALLOCA
-
-AC_CANONICAL_SYSTEM
-SUBDIRS="profile mingwex"
-configdirs="profile mingwex"
-HEADER_SUBDIR=""
-
-LIBGMON_A=libgmon.a
-
-case "$target_os" in
-*cygwin*)
- MNO_CYGWIN=-mno-cygwin
- LIBM_A=
- # Install mingw headers in mingw subdirectory.
- HEADER_SUBDIR="mingw"
- ;;
-*)
- # Build it for MSVCRT by default.
- MNO_CYGWIN=
- LIBM_A=libm.a
- ;;
-esac
-
-# THREAD_DLL used to be set within the above case and was mingwc for CRTDLL.
-# I can find no reason to do this.
-#
-# FIXME: In the future I would like to change the dll name to mingwthrd to
-# to match the libmingwthrd.a name.
-THREAD_DLL=mingwm
-
-if test -n "$configdirs"; then
- AC_CONFIG_SUBDIRS($configdirs)
-fi
-
-MKINSTALLDIRS=$ac_aux_dir/mkinstalldirs
-AC_SUBST(MKINSTALLDIRS)
-AC_SUBST(MNO_CYGWIN)
-AC_SUBST(THREAD_DLL)
-AC_SUBST(LIBM_A)
-AC_SUBST(LIBGMON_A)
-AC_SUBST(SUBDIRS)
-AC_SUBST(HEADER_SUBDIR)
-
-AC_PROG_INSTALL
-AC_OUTPUT(Makefile)
-
diff --git a/winsup/mingw/crt1.c b/winsup/mingw/crt1.c
deleted file mode 100644
index a11c2fb03..000000000
--- a/winsup/mingw/crt1.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * crt1.c
- *
- * Source code for the startup proceedures used by all programs. This code
- * is compiled to make crt1.o, which should be located in the library path.
- *
- * This code is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- * Maintained by Mumit Khan <khan@xraylith.wisc.EDU>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAMED. This includes but is not limited to warrenties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <io.h>
-#include <fcntl.h>
-#include <process.h>
-#include <float.h>
-#include <windows.h>
-#include <signal.h>
-
-/* NOTE: The code for initializing the _argv, _argc, and environ variables
- * has been moved to a separate .c file which is included in both
- * crt1.c and dllcrt1.c. This means changes in the code don't have to
- * be manually synchronized, but it does lead to this not-generally-
- * a-good-idea use of include. */
-#include "init.c"
-
-extern int main (int, char **, char **);
-
-/*
- * Must have the correct app type for MSVCRT.
- */
-
-#ifdef __MSVCRT__
-#define __UNKNOWN_APP 0
-#define __CONSOLE_APP 1
-#define __GUI_APP 2
-__MINGW_IMPORT void __set_app_type(int);
-#endif /* __MSVCRT__ */
-
-/*
- * Setup the default file handles to have the _CRT_fmode mode, as well as
- * any new files created by the user.
- */
-extern unsigned int _CRT_fmode;
-
-static void
-_mingw32_init_fmode ()
-{
- /* Don't set the file mode if the user hasn't set any value for it. */
- if (_CRT_fmode)
- {
- _fmode = _CRT_fmode;
-
- /*
- * This overrides the default file mode settings for stdin,
- * stdout and stderr. At first I thought you would have to
- * test with isatty, but it seems that the DOS console at
- * least is smart enough to handle _O_BINARY stdout and
- * still display correctly.
- */
- if (stdin)
- {
- _setmode (_fileno (stdin), _CRT_fmode);
- }
- if (stdout)
- {
- _setmode (_fileno (stdout), _CRT_fmode);
- }
- if (stderr)
- {
- _setmode (_fileno (stderr), _CRT_fmode);
- }
- }
-}
-
-/* This function will be called when a trap occurs. Thanks to Jacob
- Navia for his contribution. */
-static CALLBACK long
-_gnu_exception_handler (EXCEPTION_POINTERS * exception_data)
-{
- void (*old_handler) (int);
- long action = EXCEPTION_CONTINUE_SEARCH;
- int reset_fpu = 0;
-
- switch (exception_data->ExceptionRecord->ExceptionCode)
- {
- case EXCEPTION_ACCESS_VIOLATION:
- /* test if the user has set SIGSEGV */
- old_handler = signal (SIGSEGV, SIG_DFL);
- if (old_handler == SIG_IGN)
- {
- /* this is undefined if the signal was raised by anything other
- than raise (). */
- signal (SIGSEGV, SIG_IGN);
- action = EXCEPTION_CONTINUE_EXECUTION;
- }
- else if (old_handler != SIG_DFL)
- {
- /* This means 'old' is a user defined function. Call it */
- (*old_handler) (SIGSEGV);
- action = EXCEPTION_CONTINUE_EXECUTION;
- }
- break;
-
- case EXCEPTION_FLT_INVALID_OPERATION:
- case EXCEPTION_FLT_DIVIDE_BY_ZERO:
- case EXCEPTION_FLT_DENORMAL_OPERAND:
- case EXCEPTION_FLT_OVERFLOW:
- case EXCEPTION_FLT_UNDERFLOW:
- case EXCEPTION_FLT_INEXACT_RESULT:
- reset_fpu = 1;
- /* fall through. */
-
- case EXCEPTION_INT_DIVIDE_BY_ZERO:
- /* test if the user has set SIGFPE */
- old_handler = signal (SIGFPE, SIG_DFL);
- if (old_handler == SIG_IGN)
- {
- signal (SIGFPE, SIG_IGN);
- if (reset_fpu)
- _fpreset ();
- action = EXCEPTION_CONTINUE_EXECUTION;
- }
- else if (old_handler != SIG_DFL)
- {
- /* This means 'old' is a user defined function. Call it */
- (*old_handler) (SIGFPE);
- action = EXCEPTION_CONTINUE_EXECUTION;
- }
- break;
-
- default:
- break;
- }
- return action;
-}
-
-/*
- * The function mainCRTStartup is the entry point for all console programs.
- */
-static int
-__mingw_CRTStartup ()
-{
- int nRet;
-
- /*
- * Set up the top-level exception handler so that signal handling
- * works as expected. The mapping between ANSI/POSIX signals and
- * Win32 SE is not 1-to-1, so caveat emptore.
- *
- */
- SetUnhandledExceptionFilter (_gnu_exception_handler);
-
- /*
- * Initialize floating point unit.
- */
- _fpreset (); /* Supplied by the runtime library. */
-
- /*
- * Set up __argc, __argv and _environ.
- */
- _mingw32_init_mainargs ();
-
- /*
- * Sets the default file mode for stdin, stdout and stderr, as well
- * as files later opened by the user, to _CRT_fmode.
- * NOTE: DLLs don't do this because that would be rude!
- */
- _mingw32_init_fmode ();
-
- /*
- * Call the main function. If the user does not supply one
- * the one in the 'libmingw32.a' library will be linked in, and
- * that one calls WinMain. See main.c in the 'lib' dir
- * for more details.
- */
- nRet = main (_argc, _argv, environ);
-
- /*
- * Perform exit processing for the C library. This means
- * flushing output and calling 'atexit' registered functions.
- */
- _cexit ();
-
- ExitProcess (nRet);
-
- return 0;
-}
-
-/*
- * The function mainCRTStartup is the entry point for all console programs.
- */
-int
-mainCRTStartup ()
-{
-#ifdef __MSVCRT__
- __set_app_type (__CONSOLE_APP);
-#endif
- __mingw_CRTStartup ();
- return 0;
-}
-
-/*
- * For now the GUI startup function is the same as the console one.
- * This simply gets rid of the annoying warning about not being able
- * to find WinMainCRTStartup when linking GUI applications.
- */
-int
-WinMainCRTStartup ()
-{
-#ifdef __MSVCRT__
- __set_app_type (__GUI_APP);
-#endif
- __mingw_CRTStartup ();
-}
-
-/*
- * We force use of library version of atexit, which is only
- * visible in import lib as _imp__atexit
- */
-extern int (*_imp__atexit)(void (*)(void));
-int atexit (void (* pfn )(void) )
-{
- return ( (*_imp__atexit)(pfn));
-}
-
-/* Likewise for non-ANSI _onexit */
-extern _onexit_t (*_imp___onexit)(_onexit_t);
-_onexit_t
-_onexit (_onexit_t pfn )
-{
- return (*_imp___onexit)(pfn);
-}
diff --git a/winsup/mingw/crtdll.def b/winsup/mingw/crtdll.def
deleted file mode 100644
index 6f924fb7b..000000000
--- a/winsup/mingw/crtdll.def
+++ /dev/null
@@ -1,704 +0,0 @@
-;
-; crtdll.def
-;
-; Exports from crtdll.dll from Windows 95 SYSTEM directory. Hopefully this
-; should also work with the crtdll provided with Windows NT.
-;
-; Contributors:
-; Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
-;
-; THIS SOFTWARE IS NOT COPYRIGHTED
-;
-; This source code is offered for use in the public domain. You may
-; use, modify or distribute it freely.
-;
-; This code is distributed in the hope that it will be useful but
-; WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
-; DISCLAMED. This includes but is not limited to warrenties of
-; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-;
-; $Revision$
-; $Author$
-; $Date$
-;
-; These three functions appear to be name mangled in some way, so GCC is
-; probably not going to be able to use them in any case.
-;
-; ??2@YAPAXI@Z
-; ??3@YAXPAX@Z
-; ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z
-;
-; These are functions for which I have not yet written prototypes or
-; otherwise set up (they are still included below though unlike those
-; first three).
-;
-; _CIacos
-; _CIasin
-; _CIatan
-; _CIatan2
-; _CIcos
-; _CIcosh
-; _CIexp
-; _CIfmod
-; _CIlog
-; _CIlog10
-; _CIpow
-; _CIsin
-; _CIsinh
-; _CIsqrt
-; _CItan
-; _CItanh
-; __dllonexit
-; __mb_cur_max_dll
-; __threadhandle
-; __threadid
-; _abnormal_termination
-; _acmdln_dll
-; _aexit_rtn_dll
-; _amsg_exit
-; _commit
-; _commode_dll
-; _cpumode_dll
-; _ctype
-; _expand
-; _fcloseall
-; _filbuf
-; _fileinfo_dll
-; _flsbuf
-; _flushall
-; _fmode_dll
-; _fpieee_flt
-; _fsopen
-; _ftol
-; _getdiskfree
-; _getdllprocaddr
-; _getdrive
-; _getdrives
-; _getsystime
-; _initterm
-; _ismbbalnum
-; _ismbbalpha
-; _ismbbgraph
-; _ismbbkalnum
-; _ismbbkana
-; _ismbbkpunct
-; _ismbblead
-; _ismbbprint
-; _ismbbpunct
-; _ismbbtrail
-; _ismbcalpha
-; _ismbcdigit
-; _ismbchira
-; _ismbckata
-; _ismbcl0
-; _ismbcl1
-; _ismbcl2
-; _ismbclegal
-; _ismbclower
-; _ismbcprint
-; _ismbcspace
-; _ismbcsymbol
-; _ismbcupper
-; _ismbslead
-; _ismbstrail
-; _lfind
-; _loaddll
-; _lrotl
-; _lrotr
-; _lsearch
-; _makepath
-; _matherr
-; _mbbtombc
-; _mbbtype
-; _mbccpy
-; _mbcjistojms
-; _mbcjmstojis
-; _mbclen
-; _mbctohira
-; _mbctokata
-; _mbctolower
-; _mbctombb
-; _mbctoupper
-; _mbctype
-; _mbsbtype
-; _mbscat
-; _mbscmp
-; _mbscpy
-; _mbscspn
-; _mbsdec
-; _mbsdup
-; _mbsicmp
-; _mbsinc
-; _mbslen
-; _mbslwr
-; _mbsnbcat
-; _mbsnbcmp
-; _mbsnbcnt
-; _mbsnbcpy
-; _mbsnbicmp
-; _mbsnbset
-; _mbsnccnt
-; _mbsncmp
-; _mbsncpy
-; _mbsnextc
-; _mbsnicmp
-; _mbsninc
-; _mbsnset
-; _mbspbrk
-; _mbsrchr
-; _mbsrev
-; _mbsset
-; _mbsspn
-; _mbsspnp
-; _mbsstr
-; _mbstrlen
-; _mbsupr
-; _onexit
-; _osversion_dll
-; _pctype_dll
-; _purecall
-; _pwctype_dll
-; _rmtmp
-; _rotl
-; _rotr
-; _setsystime
-; _snprintf
-; _snwprintf
-; _splitpath
-; _strdate
-; _strdec
-; _strinc
-; _strncnt
-; _strnextc
-; _strninc
-; _strspnp
-; _strtime
-; _tempnam
-; _ultoa
-; _unloaddll
-; _vsnprintf
-; _vsnwprintf
-; _wtoi
-; _wtol
-;
-EXPORTS
-_CIacos
-_CIasin
-_CIatan
-_CIatan2
-_CIcos
-_CIcosh
-_CIexp
-_CIfmod
-_CIlog
-_CIlog10
-_CIpow
-_CIsin
-_CIsinh
-_CIsqrt
-_CItan
-_CItanh
-_HUGE_dll DATA
-_XcptFilter
-__GetMainArgs
-__argc_dll DATA
-__argv_dll DATA
-__dllonexit
-__doserrno
-__fpecode
-__isascii
-__iscsym
-__iscsymf
-__mb_cur_max_dll DATA
-__pxcptinfoptrs
-__threadhandle
-__threadid
-__toascii
-_abnormal_termination
-_access
-_acmdln_dll DATA
-_aexit_rtn_dll DATA
-_amsg_exit
-_assert
-_basemajor_dll DATA
-_baseminor_dll DATA
-_baseversion_dll DATA
-_beep
-_beginthread
-_c_exit
-_cabs
-_cexit
-_cgets
-_chdir
-_chdrive
-_chgsign
-_chmod
-_chsize
-_clearfp
-_close
-_commit
-_commode_dll DATA
-_control87
-_controlfp
-_copysign
-_cprintf
-_cpumode_dll DATA
-_cputs
-_creat
-_cscanf
-_ctype
-_cwait
-_daylight_dll DATA
-_dup
-_dup2
-_ecvt
-_endthread
-_environ_dll DATA
-_eof
-_errno
-_except_handler2
-_execl
-_execle
-_execlp
-_execlpe
-_execv
-_execve
-_execvp
-_execvpe
-_exit
-_expand
-_fcloseall
-_fcvt
-_fdopen
-_fgetchar
-_fgetwchar
-_filbuf
-_fileinfo_dll DATA
-_filelength
-_fileno
-_findclose
-_findfirst
-_findnext
-_finite
-_flsbuf
-_flushall
-_fmode_dll DATA
-_fpclass
-_fpieee_flt
-_fpreset DATA
-_fputchar
-_fputwchar
-_fsopen
-_fstat
-_ftime
-_ftol
-_fullpath
-_futime
-_gcvt
-_get_osfhandle
-_getch
-_getche
-_getcwd
-_getdcwd
-_getdiskfree
-_getdllprocaddr
-_getdrive
-_getdrives
-_getpid
-_getsystime
-_getw
-_global_unwind2
-_heapchk
-_heapmin
-_heapset
-_heapwalk
-_hypot
-_initterm
-_iob DATA
-_isatty
-_isctype
-_ismbbalnum
-_ismbbalpha
-_ismbbgraph
-_ismbbkalnum
-_ismbbkana
-_ismbbkpunct
-_ismbblead
-_ismbbprint
-_ismbbpunct
-_ismbbtrail
-_ismbcalpha
-_ismbcdigit
-_ismbchira
-_ismbckata
-_ismbcl0
-_ismbcl1
-_ismbcl2
-_ismbclegal
-_ismbclower
-_ismbcprint
-_ismbcspace
-_ismbcsymbol
-_ismbcupper
-_ismbslead
-_ismbstrail
-_isnan
-_itoa
-_j0
-_j1
-_jn
-_kbhit
-_lfind
-_loaddll
-_local_unwind2
-_locking
-_logb
-_lrotl
-_lrotr
-_lsearch
-_lseek
-_ltoa
-_makepath
-_matherr
-_mbbtombc
-_mbbtype
-_mbccpy
-_mbcjistojms
-_mbcjmstojis
-_mbclen
-_mbctohira
-_mbctokata
-_mbctolower
-_mbctombb
-_mbctoupper
-_mbctype
-_mbsbtype
-_mbscat
-_mbschr
-_mbscmp
-_mbscpy
-_mbscspn
-_mbsdec
-_mbsdup
-_mbsicmp
-_mbsinc
-_mbslen
-_mbslwr
-_mbsnbcat
-_mbsnbcmp
-_mbsnbcnt
-_mbsnbcpy
-_mbsnbicmp
-_mbsnbset
-_mbsncat
-_mbsnccnt
-_mbsncmp
-_mbsncpy
-_mbsnextc
-_mbsnicmp
-_mbsninc
-_mbsnset
-_mbspbrk
-_mbsrchr
-_mbsrev
-_mbsset
-_mbsspn
-_mbsspnp
-_mbsstr
-_mbstok
-_mbstrlen
-_mbsupr
-_memccpy
-_memicmp
-_mkdir
-_mktemp
-_msize
-_nextafter
-_onexit DATA
-_open
-_open_osfhandle
-_osmajor_dll DATA
-_osminor_dll DATA
-_osmode_dll DATA
-_osver_dll DATA
-_osversion_dll DATA
-_pclose
-_pctype_dll DATA
-_pgmptr_dll DATA
-_pipe
-_popen
-_purecall
-_putch
-_putenv
-_putw
-_pwctype_dll DATA
-_read
-_rmdir
-_rmtmp
-_rotl
-_rotr
-_scalb
-_searchenv
-_seterrormode
-_setjmp
-_setmode
-_setsystime
-_sleep
-_snprintf
-_snwprintf
-_sopen
-_spawnl
-_spawnle
-_spawnlp
-_spawnlpe
-_spawnv
-_spawnve
-_spawnvp
-_spawnvpe
-_splitpath
-_stat
-_statusfp
-_strcmpi
-_strdate
-_strdec
-_strdup
-_strerror
-_stricmp
-_stricoll
-_strinc
-_strlwr
-_strncnt
-_strnextc
-_strnicmp
-_strninc
-_strnset
-_strrev
-_strset
-_strspnp
-_strtime
-_strupr
-_swab
-_sys_errlist DATA
-_sys_nerr_dll DATA
-_tell
-_tempnam
-_timezone_dll DATA
-_tolower
-_toupper
-_tzname DATA
-_tzset
-_ultoa
-_umask
-_ungetch
-_unlink
-_unloaddll
-_utime
-_vsnprintf
-_vsnwprintf
-_wcsdup
-_wcsicmp
-_wcsicoll
-_wcslwr
-_wcsnicmp
-_wcsnset
-_wcsrev
-_wcsset
-_wcsupr
-_winmajor_dll DATA
-_winminor_dll DATA
-_winver_dll DATA
-_write
-_wtoi
-_wtol
-_y0
-_y1
-_yn
-abort
-abs
-acos
-asctime
-asin
-atan
-atan2
-atexit DATA
-atof
-atoi
-atol
-bsearch
-calloc
-ceil
-clearerr
-clock
-cos
-cosh
-ctime
-difftime
-div
-exit
-exp
-fabs
-fclose
-feof
-ferror
-fflush
-fgetc
-fgetpos
-fgets
-fgetwc
-floor
-fmod
-fopen
-fprintf
-fputc
-fputs
-fputwc
-fread
-free
-freopen
-frexp
-fscanf
-fseek
-fsetpos
-ftell
-fwprintf
-fwrite
-fwscanf
-getc
-getchar
-getenv
-gets
-gmtime
-is_wctype
-isalnum
-isalpha
-iscntrl
-isdigit
-isgraph
-isleadbyte
-islower
-isprint
-ispunct
-isspace
-isupper
-iswalnum
-iswalpha
-iswascii
-iswcntrl
-iswctype
-iswdigit
-iswgraph
-iswlower
-iswprint
-iswpunct
-iswspace
-iswupper
-iswxdigit
-isxdigit
-labs
-ldexp
-ldiv
-localeconv
-localtime
-log
-log10
-longjmp
-malloc
-mblen
-mbstowcs
-mbtowc
-memchr
-memcmp
-memcpy
-memmove
-memset
-mktime
-modf
-perror
-pow
-printf
-putc
-putchar
-puts
-qsort
-raise
-rand
-realloc
-remove
-rename
-rewind
-scanf
-setbuf
-setlocale
-setvbuf
-signal
-sin
-sinh
-sprintf
-sqrt
-srand
-sscanf
-strcat
-strchr
-strcmp
-strcoll
-strcpy
-strcspn
-strerror
-strftime
-strlen
-strncat
-strncmp
-strncpy
-strpbrk
-strrchr
-strspn
-strstr
-strtod
-strtok
-strtol
-strtoul
-strxfrm
-swprintf
-swscanf
-system
-tan
-tanh
-time
-tmpfile
-tmpnam
-tolower
-toupper
-towlower
-towupper
-ungetc
-ungetwc
-vfprintf
-vfwprintf
-vprintf
-vsprintf
-vswprintf
-vwprintf
-wcscat
-wcschr
-wcscmp
-wcscoll
-wcscpy
-wcscspn
-wcsftime
-wcslen
-wcsncat
-wcsncmp
-wcsncpy
-wcspbrk
-wcsrchr
-wcsspn
-wcsstr
-wcstod
-wcstok
-wcstol
-wcstombs
-wcstoul
-wcsxfrm
-wctomb
-wprintf
-wscanf
diff --git a/winsup/mingw/crtmt.c b/winsup/mingw/crtmt.c
deleted file mode 100644
index 116d850f0..000000000
--- a/winsup/mingw/crtmt.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * crtmt.c
- *
- * This object file defines _CRT_MT to have a value of 1, which will
- * turn on MT support in GCC runtime. This is only linked in when
- * you specify -mthreads when linking with gcc. The Mingw support
- * library, libmingw32.a, contains the complement, crtst.o, which
- * sets this variable to 0.
- *
- * Mumit Khan <khan@nanotech.wisc.edu>
- *
- */
-
-int _CRT_MT = 1;
diff --git a/winsup/mingw/crtst.c b/winsup/mingw/crtst.c
deleted file mode 100644
index 4835b0963..000000000
--- a/winsup/mingw/crtst.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * crtst.c
- *
- * This object file defines _CRT_MT to have a value of 0, which will
- * turn off MT support in GCC runtime. This is linked by default unless
- * you specify -mthreads when linking with gcc.
- *
- * Mumit Khan <khan@nanotech.wisc.edu>
- *
- */
-
-int _CRT_MT = 0;
diff --git a/winsup/mingw/ctype_old.c b/winsup/mingw/ctype_old.c
deleted file mode 100644
index 07eaec1d8..000000000
--- a/winsup/mingw/ctype_old.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * ctype_old.c
- *
- * Oldnames from ANSI header ctype.h
- *
- * Some wrapper functions for those old name functions whose appropriate
- * equivalents are not simply underscore prefixed.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAMED. This includes but is not limited to warrenties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#include <ctype.h>
-
-int
-isascii (int c)
-{
- return __isascii(c);
-}
-
-int
-toascii (int c)
-{
- return __toascii(c);
-}
-
-int
-iscsymf (int c)
-{
- return __iscsymf(c);
-}
-
-int
-iscsym (int c)
-{
- return __iscsym(c);
-}
diff --git a/winsup/mingw/dllcrt1.c b/winsup/mingw/dllcrt1.c
deleted file mode 100644
index fe351eb10..000000000
--- a/winsup/mingw/dllcrt1.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * dllcrt1.c
- *
- * Initialization code for DLLs.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- * DLL support adapted from Gunther Ebert <gunther.ebert@ixos-leipzig.de>
- * Maintained by Mumit Khan <khan@xraylith.wisc.EDU>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAMED. This includes but is not limited to warrenties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <io.h>
-#include <process.h>
-#include <errno.h>
-#include <windows.h>
-
-/* Unlike normal crt1, I don't initialize the FPU, because the process
- * should have done that already. I also don't set the file handle modes,
- * because that would be rude. */
-
-#ifdef __GNUC__
-extern void __main ();
-extern void __do_global_dtors ();
-#endif
-
-typedef void (* p_atexit_fn )(void);
-static p_atexit_fn* first_atexit;
-static p_atexit_fn* next_atexit;
-
-static void
-__dll_exit (void);
-
-/* This is based on the function in the Wine project's exit.c */
-p_atexit_fn __dllonexit (p_atexit_fn, p_atexit_fn**, p_atexit_fn**);
-
-
-extern BOOL WINAPI DllMain (HANDLE, DWORD, LPVOID);
-
-
-BOOL WINAPI
-DllMainCRTStartup (HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
-{
- BOOL bRet;
-
- if (dwReason == DLL_PROCESS_ATTACH)
- {
- /* Initialize private atexit table for this dll.
- 32 is min size required by ANSI */
-
- first_atexit = (p_atexit_fn*) malloc (32 * sizeof (p_atexit_fn));
- if (first_atexit == NULL ) /* can't allocate memory */
- {
- errno=ENOMEM;
- return FALSE;
- }
- *first_atexit = NULL;
- next_atexit = first_atexit;
-
-#ifdef DEBUG
- printf ("%s: DLL_PROCESS_ATTACH (%d)\n", __FUNCTION__);
-#endif
-
-
-#ifdef __GNUC__
- /* From libgcc.a, __main calls global class constructors,
- __do_global_ctors, which registers __do_global_dtors
- as the first entry of the private atexit table we
- have just initialised */
- __main ();
-
-#endif
- }
-
- /*
- * Call the user-supplied DllMain subroutine.
- * This has to come after initialization of atexit table and
- * registration of global constructors.
- * NOTE: DllMain is optional, so libmingw32.a includes a stub
- * which will be used if the user does not supply one.
- */
-
- bRet = DllMain (hDll, dwReason, lpReserved);
- /* Handle case where DllMain returns FALSE on attachment attempt. */
-
- if ( (dwReason == DLL_PROCESS_ATTACH) && !bRet)
- {
-#ifdef DEBUG
- printf ("%s: DLL_PROCESS_ATTACH failed, cleaning up\n", __FUNCTION__);
-#endif
-
- __dll_exit (); /* Cleanup now. This will set first_atexit to NULL so we
- know we've cleaned up */
- }
-
- if (dwReason == DLL_PROCESS_DETACH)
- {
-#ifdef DEBUG
- printf ("%s: DLL_PROCESS_DETACH (%d)\n", __FUNCTION__);
-#endif
- /* If not attached, return FALSE. Cleanup already done above
- if failed attachment attempt. */
- if (! first_atexit )
- bRet = FALSE;
- else
- /*
- * We used to call __do_global_dtors () here. This is
- * no longer necessary since __do_global_dtors is now
- * registered at start (last out) of private atexit table.
- */
- __dll_exit ();
- }
- return bRet;
-}
-
-static
-void
-__dll_exit(void)
-/* Run LIFO terminators registered in private atexit table */
-{
- if ( first_atexit )
- {
- p_atexit_fn* __last = next_atexit - 1;
- while ( __last >= first_atexit )
- {
- if ( *__last != NULL )
- {
-#ifdef DEBUG
- printf ("%s: Calling exit function 0x%x from 0x%x\n",
- __FUNCTION__, (unsigned)(*__last),(unsigned)__last);
-#endif
- (**__last) ();
- }
- __last--;
- }
- free ( first_atexit ) ;
- first_atexit = NULL ;
- }
- /*
- Make sure output buffers opened by DllMain or
- atexit-registered functions are flushed before detaching,
- otherwise we can have problems with redirected output.
- */
- fflush (NULL);
-}
-
-/*
- * The atexit exported from msvcrt.dll causes problems in DLLs.
- * Here, we override the exported version of atexit with one that passes the
- * private table initialised in DllMainCRTStartup to __dllonexit.
- * That means we have to hide the mscvrt.dll atexit because the
- * atexit defined here gets __dllonexit from the same lib.
- */
-
-int
-atexit (p_atexit_fn pfn )
-{
-#ifdef DEBUG
- printf ("%s: registering exit function 0x%x at 0x%x\n",
- __FUNCTION__, (unsigned)pfn, (unsigned)next_atexit);
-#endif
- return (__dllonexit (pfn, &first_atexit, &next_atexit)
- == NULL ? -1 : 0 );
-}
-
-/*
- * Likewise for non-ANSI function _onexit that may be called by
- * code in the dll.
- */
-
-_onexit_t
-_onexit (_onexit_t pfn )
-{
-#ifdef DEBUG
- printf ("%s: registering exit function 0x%x at 0x%x\n",
- __FUNCTION__, (unsigned)pfn, (unsigned)next_atexit);
-#endif
- return ((_onexit_t) __dllonexit ((p_atexit_fn)pfn, &first_atexit, &next_atexit));
-}
diff --git a/winsup/mingw/dllmain.c b/winsup/mingw/dllmain.c
deleted file mode 100644
index 40c4f4f37..000000000
--- a/winsup/mingw/dllmain.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * dllmain.c
- *
- * A stub DllMain function which will be called by DLLs which do not
- * have a user supplied DllMain.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAMED. This includes but is not limited to warrenties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#include <windows.h>
-
-BOOL WINAPI
-DllMain (HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
-{
- return TRUE;
-}
-
diff --git a/winsup/mingw/gccmain.c b/winsup/mingw/gccmain.c
deleted file mode 100644
index 5c438e98a..000000000
--- a/winsup/mingw/gccmain.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * gccmain.c
- *
- * A separate version of __main, __do_global_ctors and __do_global_dtors for
- * Mingw32 for use with Cygwin32 b19. Hopefully this object file will only
- * be linked if the libgcc.a doesn't include __main, __do_global_dtors and
- * __do_global_ctors.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Code supplied by Stan Cox <scox@cygnus.com>
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-/* Needed for the atexit prototype. */
-#include <stdlib.h>
-
-typedef void (*func_ptr) (void);
-extern func_ptr __CTOR_LIST__[];
-extern func_ptr __DTOR_LIST__[];
-
-void
-__do_global_dtors (void)
-{
- static func_ptr *p = __DTOR_LIST__ + 1;
-
- /*
- * Call each destructor in the destructor list until a null pointer
- * is encountered.
- */
- while (*p)
- {
- (*(p)) ();
- p++;
- }
-}
-
-void
-__do_global_ctors (void)
-{
- unsigned long nptrs = (unsigned long) __CTOR_LIST__[0];
- unsigned i;
-
- /*
- * If the first entry in the constructor list is -1 then the list
- * is terminated with a null entry. Otherwise the first entry was
- * the number of pointers in the list.
- */
- if (nptrs == -1)
- {
- for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++)
- ;
- }
-
- /*
- * Go through the list backwards calling constructors.
- */
- for (i = nptrs; i >= 1; i--)
- {
- __CTOR_LIST__[i] ();
- }
-
- /*
- * Register the destructors for processing on exit.
- */
- atexit (__do_global_dtors);
-}
-
-static int initialized = 0;
-
-void
-__main (void)
-{
- if (!initialized)
- {
- initialized = 1;
- __do_global_ctors ();
- }
-}
-
diff --git a/winsup/mingw/include/_mingw.h b/winsup/mingw/include/_mingw.h
deleted file mode 100644
index f8b126142..000000000
--- a/winsup/mingw/include/_mingw.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * _mingw.h
- *
- * Mingw specific macros included by ALL include files.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Mumit Khan <khan@xraylith.wisc.edu>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- */
-
-#ifndef __MINGW_H
-#define __MINGW_H
-
-/* These are defined by the user (or the compiler)
- to specify how identifiers are imported from a DLL.
-
- __DECLSPEC_SUPPORTED Defined if dllimport attribute is supported.
- __MINGW_IMPORT The attribute definition to specify imported
- variables/functions.
- __MINGW32_VERSION Runtime version.
- __MINGW32_MAJOR_VERSION Runtime major version.
- __MINGW32_MINOR_VERSION Runtime minor version.
- __MINGW32_BUILD_DATE Runtime build date.
-
- Other macros:
-
- __int64 define to be long long. Using a typedef can
- tweak bugs in the C++ parser.
-
- All headers should include this first, and then use __DECLSPEC_SUPPORTED
- to choose between the old ``__imp__name'' style or __MINGW_IMPORT
- style declarations. */
-
-#ifndef __GNUC__
-# define __MINGW_IMPORT __declspec(dllimport)
-# define __DECLSPEC_SUPPORTED
-#else /* __GNUC__ */
-# ifdef __declspec
- /* Note the extern. This is needed to work around GCC's
- limitations in handling dllimport attribute. */
-# define __MINGW_IMPORT extern __attribute__((dllimport))
-# define __DECLSPEC_SUPPORTED
-# else
-# undef __DECLSPEC_SUPPORTED
-# undef __MINGW_IMPORT
-# endif
-# undef __int64
-# define __int64 long long
-#endif /* __GNUC__ */
-
-#define __MINGW32_VERSION 2.0
-#define __MINGW32_MAJOR_VERSION 2
-#define __MINGW32_MINOR_VERSION 0
-
-#endif /* __MINGW_H */
-
diff --git a/winsup/mingw/include/assert.h b/winsup/mingw/include/assert.h
deleted file mode 100644
index 07a7d1ffe..000000000
--- a/winsup/mingw/include/assert.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * assert.h
- *
- * Define the assert macro for debug output.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef _ASSERT_H_
-#define _ASSERT_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-#ifndef RC_INVOKED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef NDEBUG
-
-/*
- * If not debugging, assert does nothing.
- */
-#define assert(x) ((void)0)
-
-#else /* debugging enabled */
-
-/*
- * CRTDLL nicely supplies a function which does the actual output and
- * call to abort.
- */
-void _assert (const char*, const char*, int)
-#ifdef __GNUC__
- __attribute__ ((noreturn))
-#endif
- ;
-
-/*
- * Definition of the assert macro.
- */
-#define assert(e) ((e) ? (void)0 : _assert(#e, __FILE__, __LINE__))
-#endif /* NDEBUG */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not _ASSERT_H_ */
-
diff --git a/winsup/mingw/include/conio.h b/winsup/mingw/include/conio.h
deleted file mode 100644
index 4e8d55ab6..000000000
--- a/winsup/mingw/include/conio.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * conio.h
- *
- * Low level console I/O functions. Pretty please try to use the ANSI
- * standard ones if you are writing new code.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef __STRICT_ANSI__
-
-#ifndef _CONIO_H_
-#define _CONIO_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-#ifndef RC_INVOKED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-char* _cgets (char*);
-int _cprintf (const char*, ...);
-int _cputs (const char*);
-int _cscanf (char*, ...);
-
-int _getch (void);
-int _getche (void);
-int _kbhit (void);
-int _putch (int);
-int _ungetch (int);
-
-
-#ifndef _NO_OLDNAMES
-
-int getch (void);
-int getche (void);
-int kbhit (void);
-int putch (int);
-int ungetch (int);
-
-#endif /* Not _NO_OLDNAMES */
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not _CONIO_H_ */
-
-#endif /* Not __STRICT_ANSI__ */
diff --git a/winsup/mingw/include/ctype.h b/winsup/mingw/include/ctype.h
deleted file mode 100644
index 35a577b4c..000000000
--- a/winsup/mingw/include/ctype.h
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * ctype.h
- *
- * Functions for testing character types and converting characters.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef _CTYPE_H_
-#define _CTYPE_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-#define __need_wchar_t
-#define __need_wint_t
-#ifndef RC_INVOKED
-#include <stddef.h>
-#endif /* Not RC_INVOKED */
-
-
-/*
- * The following flags are used to tell iswctype and _isctype what character
- * types you are looking for.
- */
-#define _UPPER 0x0001
-#define _LOWER 0x0002
-#define _DIGIT 0x0004
-#define _SPACE 0x0008 /* HT LF VT FF CR SP */
-#define _PUNCT 0x0010
-#define _CONTROL 0x0020
-#define _BLANK 0x0040 /* this is SP only, not SP and HT as in C99 */
-#define _HEX 0x0080
-#define _LEADBYTE 0x8000
-
-#define _ALPHA 0x0103
-
-#ifndef RC_INVOKED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int isalnum(int);
-int isalpha(int);
-int iscntrl(int);
-int isdigit(int);
-int isgraph(int);
-int islower(int);
-int isprint(int);
-int ispunct(int);
-int isspace(int);
-int isupper(int);
-int isxdigit(int);
-
-#ifndef __STRICT_ANSI__
-int _isctype (int, int);
-#endif
-
-/* These are the ANSI versions, with correct checking of argument */
-int tolower(int);
-int toupper(int);
-
-/*
- * NOTE: The above are not old name type wrappers, but functions exported
- * explicitly by MSVCRT/CRTDLL. However, underscored versions are also
- * exported.
- */
-#ifndef __STRICT_ANSI__
-/*
- * These are the cheap non-std versions: The return values are undefined
- * if the argument is not ASCII char or is not of appropriate case
- */
-int _tolower(int);
-int _toupper(int);
-#endif
-
-/* Also defined in stdlib.h */
-#ifndef MB_CUR_MAX
-#ifdef __DECLSPEC_SUPPORTED
-# ifdef __MSVCRT__
-# define MB_CUR_MAX __mb_cur_max
- __MINGW_IMPORT int __mb_cur_max;
-# else /* not __MSVCRT */
-# define MB_CUR_MAX __mb_cur_max_dll
- __MINGW_IMPORT int __mb_cur_max_dll;
-# endif /* not __MSVCRT */
-
-#else /* ! __DECLSPEC_SUPPORTED */
-# ifdef __MSVCRT__
- extern int* _imp____mbcur_max
-# define MB_CUR_MAX (*_imp____mb_cur_max)
-# else /* not __MSVCRT */
- extern int* _imp____mbcur_max_dll
-# define MB_CUR_MAX (*_imp____mb_cur_max_dll)
-# endif /* not __MSVCRT */
-#endif /* __DECLSPEC_SUPPORTED */
-#endif /* MB_CUR_MAX */
-
-
-#ifdef __DECLSPEC_SUPPORTED
-__MINGW_IMPORT unsigned short _ctype[];
-# ifdef __MSVCRT__
- __MINGW_IMPORT unsigned short* _pctype;
-# else /* CRTDLL */
- __MINGW_IMPORT unsigned short* _pctype_dll;
-# define _pctype _pctype_dll
-# endif
-
-#else /* __DECLSPEC_SUPPORTED */
-extern unsigned short** _imp___ctype;
-#define _ctype (*_imp___ctype)
-# ifdef __MSVCRT__
- extern unsigned short** _imp___pctype;
-# define _pctype (*_imp___pctype)
-# else /* CRTDLL */
- extern unsigned short** _imp___pctype_dll;
-# define _pctype (*_imp___pctype_dll)
-# endif /* CRTDLL */
-#endif /* __DECLSPEC_SUPPORTED */
-
-/*
- * Use inlines here rather than macros, because macros will upset
- * C++ usage (eg, ::isalnum), and so usually get undefined
- *
- * According to standard for SB chars, these function are defined only
- * for input values representable by unsigned char or EOF.
- * Thus, there is no range test.
- * This reproduces behaviour of MSVCRT.dll lib implemention for SB chars.
- *
- * If no MB char support is needed, these can be simplified even
- * more by command line define -DMB_CUR_MAX=1. The compiler will then
- * optimise away the constant condition.
- */
-
-
-#if ! (defined (__NO_CTYPE_INLINES) || defined (__STRICT_ANSI__ ))
-/* use simple lookup if SB locale, else _isctype() */
-#define __ISCTYPE(c, mask) (MB_CUR_MAX == 1 ? (_pctype[c] & mask) : _isctype(c, mask))
-extern __inline__ int isalnum(int c) {return __ISCTYPE(c, (_ALPHA|_DIGIT));}
-extern __inline__ int isalpha(int c) {return __ISCTYPE(c, _ALPHA);}
-extern __inline__ int iscntrl(int c) {return __ISCTYPE(c, _CONTROL);}
-extern __inline__ int isdigit(int c) {return __ISCTYPE(c, _DIGIT);}
-extern __inline__ int isgraph(int c) {return __ISCTYPE(c, (_PUNCT|_ALPHA|_DIGIT));}
-extern __inline__ int islower(int c) {return __ISCTYPE(c, _LOWER);}
-extern __inline__ int isprint(int c) {return __ISCTYPE(c, (_BLANK|_PUNCT|_ALPHA|_DIGIT));}
-extern __inline__ int ispunct(int c) {return __ISCTYPE(c, _PUNCT);}
-extern __inline__ int isspace(int c) {return __ISCTYPE(c, _SPACE);}
-extern __inline__ int isupper(int c) {return __ISCTYPE(c, _UPPER);}
-extern __inline__ int isxdigit(int c) {return __ISCTYPE(c, _HEX);}
-
-/* these reproduce behaviour of lib underscored versions */
-extern __inline__ int _tolower(int c) {return ( c -'A'+'a');}
-extern __inline__ int _toupper(int c) {return ( c -'a'+'A');}
-
-/* TODO? Is it worth inlining ANSI tolower, toupper? Probably only
- if we only want C-locale. */
-
-#endif /* _NO_CTYPE_INLINES */
-
-/* Wide character equivalents */
-
-#ifndef WEOF
-#define WEOF (wchar_t)(0xFFFF)
-#endif
-
-#ifndef _WCTYPE_T_DEFINED
-typedef wchar_t wctype_t;
-#define _WCTYPE_T_DEFINED
-#endif
-
-int iswalnum(wint_t);
-int iswalpha(wint_t);
-int iswascii(wint_t);
-int iswcntrl(wint_t);
-int iswctype(wint_t, wctype_t);
-int is_wctype(wint_t, wctype_t); /* Obsolete! */
-int iswdigit(wint_t);
-int iswgraph(wint_t);
-int iswlower(wint_t);
-int iswprint(wint_t);
-int iswpunct(wint_t);
-int iswspace(wint_t);
-int iswupper(wint_t);
-int iswxdigit(wint_t);
-
-wchar_t towlower(wchar_t);
-wchar_t towupper(wchar_t);
-
-int isleadbyte (int);
-
-/* Also in wctype.h */
-#if ! (defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED))
-#define __WCTYPE_INLINES_DEFINED
-extern __inline__ int iswalnum(wint_t wc) {return (iswctype(wc,_ALPHA|_DIGIT));}
-extern __inline__ int iswalpha(wint_t wc) {return (iswctype(wc,_ALPHA));}
-extern __inline__ int iswascii(wint_t wc) {return (((unsigned)wc & 0x7F) ==0);}
-extern __inline__ int iswcntrl(wint_t wc) {return (iswctype(wc,_CONTROL));}
-extern __inline__ int iswdigit(wint_t wc) {return (iswctype(wc,_DIGIT));}
-extern __inline__ int iswgraph(wint_t wc) {return (iswctype(wc,_PUNCT|_ALPHA|_DIGIT));}
-extern __inline__ int iswlower(wint_t wc) {return (iswctype(wc,_LOWER));}
-extern __inline__ int iswprint(wint_t wc) {return (iswctype(wc,_BLANK|_PUNCT|_ALPHA|_DIGIT));}
-extern __inline__ int iswpunct(wint_t wc) {return (iswctype(wc,_PUNCT));}
-extern __inline__ int iswspace(wint_t wc) {return (iswctype(wc,_SPACE));}
-extern __inline__ int iswupper(wint_t wc) {return (iswctype(wc,_UPPER));}
-extern __inline__ int iswxdigit(wint_t wc) {return (iswctype(wc,_HEX));}
-extern __inline__ int isleadbyte(int c) {return (_pctype[(unsigned char)(c)] & _LEADBYTE);}
-#endif /* !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) */
-
-#ifndef __STRICT_ANSI__
-int __isascii (int);
-int __toascii (int);
-int __iscsymf (int); /* Valid first character in C symbol */
-int __iscsym (int); /* Valid character in C symbol (after first) */
-
-#ifndef __NO_CTYPE_INLINES
-extern __inline__ int __isascii(int c) {return (((unsigned)c & ~0x7F) == 0);}
-extern __inline__ int __toascii(int c) {return (c & 0x7F);}
-extern __inline__ int __iscsymf(int c) {return (isalpha(c) || (c == '_'));}
-extern __inline__ int __iscsym(int c) {return (isalnum(c) || (c == '_'));}
-#endif /* __NO_CTYPE_INLINES */
-
-#ifndef _NO_OLDNAMES
-int isascii (int);
-int toascii (int);
-int iscsymf (int);
-int iscsym (int);
-#endif /* Not _NO_OLDNAMES */
-
-#endif /* Not __STRICT_ANSI__ */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not _CTYPE_H_ */
-
diff --git a/winsup/mingw/include/dir.h b/winsup/mingw/include/dir.h
deleted file mode 100644
index d759a0a61..000000000
--- a/winsup/mingw/include/dir.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * dir.h
- *
- * This file OBSOLESCENT and only provided for backward compatibility.
- * Please use io.h instead.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- * Mumit Khan <khan@xraylith.wisc.edu>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- */
-
-#include <io.h>
-
diff --git a/winsup/mingw/include/direct.h b/winsup/mingw/include/direct.h
deleted file mode 100644
index cbd8e9fe1..000000000
--- a/winsup/mingw/include/direct.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * direct.h
- *
- * Functions for manipulating paths and directories (included from io.h)
- * plus functions for setting the current drive.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef __STRICT_ANSI__
-
-#ifndef _DIRECT_H_
-#define _DIRECT_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-#define __need_wchar_t
-#ifndef RC_INVOKED
-#include <stddef.h>
-#endif /* Not RC_INVOKED */
-
-#include <io.h>
-
-#ifndef RC_INVOKED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _DISKFREE_T_DEFINED
-/* needed by _getdiskfree (also in dos.h) */
-struct _diskfree_t {
- unsigned total_clusters;
- unsigned avail_clusters;
- unsigned sectors_per_cluster;
- unsigned bytes_per_sector;
-};
-#define _DISKFREE_T_DEFINED
-#endif
-
-/*
- * You really shouldn't be using these. Use the Win32 API functions instead.
- * However, it does make it easier to port older code.
- */
-int _getdrive (void);
-unsigned long _getdrives(void);
-int _chdrive (int);
-char* _getdcwd (int, char*, int);
-unsigned _getdiskfree (unsigned, struct _diskfree_t *);
-
-#ifndef _NO_OLDNAMES
-# define diskfree_t _diskfree_t
-#endif
-
-#ifndef _WDIRECT_DEFINED
-/* wide character versions. Also in wchar.h */
-#ifdef __MSVCRT__
-int _wchdir(const wchar_t*);
-wchar_t* _wgetcwd(wchar_t*, int);
-wchar_t* _wgetdcwd(int, wchar_t*, int);
-int _wmkdir(const wchar_t*);
-int _wrmdir(const wchar_t*);
-#endif /* __MSVCRT__ */
-#define _WDIRECT_DEFINED
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not _DIRECT_H_ */
-
-#endif /* Not __STRICT_ANSI__ */
-
diff --git a/winsup/mingw/include/dirent.h b/winsup/mingw/include/dirent.h
deleted file mode 100644
index 4df6bd997..000000000
--- a/winsup/mingw/include/dirent.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * DIRENT.H (formerly DIRLIB.H)
- *
- * by M. J. Weinstein Released to public domain 1-Jan-89
- *
- * Because I have heard that this feature (opendir, readdir, closedir)
- * it so useful for programmers coming from UNIX or attempting to port
- * UNIX code, and because it is reasonably light weight, I have included
- * it in the Mingw32 package. I have also added an implementation of
- * rewinddir, seekdir and telldir.
- * - Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * This code is distributed in the hope that is will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includeds but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef __STRICT_ANSI__
-
-#ifndef _DIRENT_H_
-#define _DIRENT_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-#include <io.h>
-
-#ifndef RC_INVOKED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct dirent
-{
- long d_ino; /* Always zero. */
- unsigned short d_reclen; /* Always zero. */
- unsigned short d_namlen; /* Length of name in d_name. */
- char* d_name; /* File name. */
- /* NOTE: The name in the dirent structure points to the name in the
- * finddata_t structure in the DIR. */
-};
-
-/*
- * This is an internal data structure. Good programmers will not use it
- * except as an argument to one of the functions below.
- * dd_stat field is now int (was short in older versions).
- */
-typedef struct
-{
- /* disk transfer area for this dir */
- struct _finddata_t dd_dta;
-
- /* dirent struct to return from dir (NOTE: this makes this thread
- * safe as long as only one thread uses a particular DIR struct at
- * a time) */
- struct dirent dd_dir;
-
- /* _findnext handle */
- long dd_handle;
-
- /*
- * Status of search:
- * 0 = not started yet (next entry to read is first entry)
- * -1 = off the end
- * positive = 0 based index of next entry
- */
- int dd_stat;
-
- /* given path for dir with search pattern (struct is extended) */
- char dd_name[1];
-} DIR;
-
-DIR* opendir (const char*);
-struct dirent* readdir (DIR*);
-int closedir (DIR*);
-void rewinddir (DIR*);
-long telldir (DIR*);
-void seekdir (DIR*, long);
-
-
-/* wide char versions */
-
-struct _wdirent
-{
- long d_ino; /* Always zero. */
- unsigned short d_reclen; /* Always zero. */
- unsigned short d_namlen; /* Length of name in d_name. */
- wchar_t* d_name; /* File name. */
- /* NOTE: The name in the dirent structure points to the name in the * wfinddata_t structure in the _WDIR. */
-};
-
-/*
- * This is an internal data structure. Good programmers will not use it
- * except as an argument to one of the functions below.
- */
-typedef struct
-{
- /* disk transfer area for this dir */
- struct _wfinddata_t dd_dta;
-
- /* dirent struct to return from dir (NOTE: this makes this thread
- * safe as long as only one thread uses a particular DIR struct at
- * a time) */
- struct _wdirent dd_dir;
-
- /* _findnext handle */
- long dd_handle;
-
- /*
- * Status of search:
- * 0 = not started yet (next entry to read is first entry)
- * -1 = off the end
- * positive = 0 based index of next entry
- */
- int dd_stat;
-
- /* given path for dir with search pattern (struct is extended) */
- wchar_t dd_name[1];
-} _WDIR;
-
-
-
-_WDIR* _wopendir (const wchar_t*);
-struct _wdirent* _wreaddir (_WDIR*);
-int _wclosedir (_WDIR*);
-void _wrewinddir (_WDIR*);
-long _wtelldir (_WDIR*);
-void _wseekdir (_WDIR*, long);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not _DIRENT_H_ */
-
-#endif /* Not __STRICT_ANSI__ */
-
diff --git a/winsup/mingw/include/dos.h b/winsup/mingw/include/dos.h
deleted file mode 100644
index 5374a7a52..000000000
--- a/winsup/mingw/include/dos.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * dos.h
- *
- * DOS-specific functions and structures.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by J.J. van der Heijden <J.J.vanderHeijden@student.utwente.nl>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef __STRICT_ANSI__
-
-#ifndef _DOS_H_
-#define _DOS_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-#define __need_wchar_t
-#ifndef RC_INVOKED
-#include <stddef.h>
-#endif /* Not RC_INVOKED */
-
-/* For DOS file attributes */
-#include <io.h>
-
-#ifndef RC_INVOKED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef __MSVCRT__ /* these are in CRTDLL, but not MSVCRT */
-#ifndef __DECLSPEC_SUPPORTED
-extern unsigned int *_imp___basemajor_dll;
-extern unsigned int *_imp___baseminor_dll;
-extern unsigned int *_imp___baseversion_dll;
-extern unsigned int *_imp___osmajor_dll;
-extern unsigned int *_imp___osminor_dll;
-extern unsigned int *_imp___osmode_dll;
-
-#define _basemajor (*_imp___basemajor_dll)
-#define _baseminor (*_imp___baseminor_dll)
-#define _baseversion (*_imp___baseversion_dll)
-#define _osmajor (*_imp___osmajor_dll)
-#define _osminor (*_imp___osminor_dll)
-#define _osmode (*_imp___osmode_dll)
-
-#else /* __DECLSPEC_SUPPORTED */
-
-__MINGW_IMPORT unsigned int _basemajor_dll;
-__MINGW_IMPORT unsigned int _baseminor_dll;
-__MINGW_IMPORT unsigned int _baseversion_dll;
-__MINGW_IMPORT unsigned int _osmajor_dll;
-__MINGW_IMPORT unsigned int _osminor_dll;
-__MINGW_IMPORT unsigned int _osmode_dll;
-
-#define _basemajor _basemajor_dll
-#define _baseminor _baseminor_dll
-#define _baseversion _baseversion_dll
-#define _osmajor _osmajor_dll
-#define _osminor _osminor_dll
-#define _osmode _osmode_dll
-
-#endif /* __DECLSPEC_SUPPORTED */
-#endif /* ! __MSVCRT__ */
-
-#ifndef _DISKFREE_T_DEFINED
-/* needed by _getdiskfree (also in direct.h) */
-struct _diskfree_t {
- unsigned total_clusters;
- unsigned avail_clusters;
- unsigned sectors_per_cluster;
- unsigned bytes_per_sector;
-};
-#define _DISKFREE_T_DEFINED
-#endif
-
-unsigned _getdiskfree (unsigned, struct _diskfree_t *);
-
-#ifndef _NO_OLDNAMES
-# define diskfree_t _diskfree_t
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not _DOS_H_ */
-
-#endif /* Not __STRICT_ANSI__ */
-
diff --git a/winsup/mingw/include/errno.h b/winsup/mingw/include/errno.h
deleted file mode 100644
index fdeb8e375..000000000
--- a/winsup/mingw/include/errno.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * errno.h
- *
- * Error numbers and access to error reporting.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef _ERRNO_H_
-#define _ERRNO_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-/*
- * Error numbers.
- * TODO: Can't be sure of some of these assignments, I guessed from the
- * names given by strerror and the defines in the Cygnus errno.h. A lot
- * of the names from the Cygnus errno.h are not represented, and a few
- * of the descriptions returned by strerror do not obviously match
- * their error naming.
- */
-#define EPERM 1 /* Operation not permitted */
-#define ENOFILE 2 /* No such file or directory */
-#define ENOENT 2
-#define ESRCH 3 /* No such process */
-#define EINTR 4 /* Interrupted function call */
-#define EIO 5 /* Input/output error */
-#define ENXIO 6 /* No such device or address */
-#define E2BIG 7 /* Arg list too long */
-#define ENOEXEC 8 /* Exec format error */
-#define EBADF 9 /* Bad file descriptor */
-#define ECHILD 10 /* No child processes */
-#define EAGAIN 11 /* Resource temporarily unavailable */
-#define ENOMEM 12 /* Not enough space */
-#define EACCES 13 /* Permission denied */
-#define EFAULT 14 /* Bad address */
-/* 15 - Unknown Error */
-#define EBUSY 16 /* strerror reports "Resource device" */
-#define EEXIST 17 /* File exists */
-#define EXDEV 18 /* Improper link (cross-device link?) */
-#define ENODEV 19 /* No such device */
-#define ENOTDIR 20 /* Not a directory */
-#define EISDIR 21 /* Is a directory */
-#define EINVAL 22 /* Invalid argument */
-#define ENFILE 23 /* Too many open files in system */
-#define EMFILE 24 /* Too many open files */
-#define ENOTTY 25 /* Inappropriate I/O control operation */
-/* 26 - Unknown Error */
-#define EFBIG 27 /* File too large */
-#define ENOSPC 28 /* No space left on device */
-#define ESPIPE 29 /* Invalid seek (seek on a pipe?) */
-#define EROFS 30 /* Read-only file system */
-#define EMLINK 31 /* Too many links */
-#define EPIPE 32 /* Broken pipe */
-#define EDOM 33 /* Domain error (math functions) */
-#define ERANGE 34 /* Result too large (possibly too small) */
-/* 35 - Unknown Error */
-#define EDEADLOCK 36 /* Resource deadlock avoided (non-Cyg) */
-#define EDEADLK 36
-/* 37 - Unknown Error */
-#define ENAMETOOLONG 38 /* Filename too long (91 in Cyg?) */
-#define ENOLCK 39 /* No locks available (46 in Cyg?) */
-#define ENOSYS 40 /* Function not implemented (88 in Cyg?) */
-#define ENOTEMPTY 41 /* Directory not empty (90 in Cyg?) */
-#define EILSEQ 42 /* Illegal byte sequence */
-
-/*
- * NOTE: ENAMETOOLONG and ENOTEMPTY conflict with definitions in the
- * sockets.h header provided with windows32api-0.1.2.
- * You should go and put an #if 0 ... #endif around the whole block
- * of errors (look at the comment above them).
- */
-
-#ifndef RC_INVOKED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Definitions of errno. For _doserrno, sys_nerr and * sys_errlist, see
- * stdlib.h.
- */
-#ifdef _UWIN
-#undef errno
-extern int errno;
-#else
-int* _errno(void);
-#define errno (*_errno())
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not _ERRNO_H_ */
diff --git a/winsup/mingw/include/excpt.h b/winsup/mingw/include/excpt.h
deleted file mode 100644
index 0947b2291..000000000
--- a/winsup/mingw/include/excpt.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * excpt.h
- *
- * Support for operating system level structured exception handling.
- *
- * NOTE: This is very preliminary stuff. I am also pretty sure it is
- * completely Intel specific.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- * Based on code by Mikey <jeffdb@netzone.com>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef _EXCPT_H_
-#define _EXCPT_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-#ifndef __STRICT_ANSI__
-
-#include <windows.h>
-
-/*
- * NOTE: The constants structs and typedefs below should be defined in the
- * Win32 API headers.
- */
-#define EH_NONCONTINUABLE 0x01
-#define EH_UNWINDING 0x02
-#define EH_EXIT_UNWIND 0x04
-#define EH_STACK_INVALID 0x08
-#define EH_NESTED_CALL 0x10
-
-#ifndef RC_INVOKED
-
-typedef enum {
- ExceptionContinueExecution,
- ExceptionContinueSearch,
- ExceptionNestedException,
- ExceptionCollidedUnwind
-} EXCEPTION_DISPOSITION;
-
-
-/*
- * End of stuff that should be in the Win32 API files.
- */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * The type of function that is expected as an exception handler to be
- * installed with _try1.
- */
-typedef EXCEPTION_DISPOSITION (*PEXCEPTION_HANDLER)
- (struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*);
-
-/*
- * This is not entirely necessary, but it is the structure installed by
- * the _try1 primitive below.
- */
-typedef struct _EXCEPTION_REGISTRATION
-{
- struct _EXCEPTION_REGISTRATION* prev;
- PEXCEPTION_HANDLER handler;
-} EXCEPTION_REGISTRATION, *PEXCEPTION_REGISTRATION;
-
-typedef EXCEPTION_REGISTRATION EXCEPTION_REGISTRATION_RECORD;
-typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD;
-
-/*
- * A macro which installs the supplied exception handler.
- * Push the pointer to the new handler onto the stack,
- * then push the pointer to the old registration structure (at fs:0)
- * onto the stack, then put a pointer to the new registration
- * structure (i.e. the current stack pointer) at fs:0.
- */
-#define __try1(pHandler) \
- __asm__ ("pushl %0;pushl %%fs:0;movl %%esp,%%fs:0;" : : "g" (pHandler));
-
-/*
- * A macro which (despite its name) *removes* an installed
- * exception handler. Should be used only in conjunction with the above
- * install routine __try1.
- * Move the pointer to the old reg. struct (at the current stack
- * position) to fs:0, replacing the pointer we installed above,
- * then add 8 to the stack pointer to get rid of the space we
- * used when we pushed on our new reg. struct above. Notice that
- * the stack must be in the exact state at this point that it was
- * after we did _try1 or this will smash things.
- */
-#define __except1 \
- __asm__ ("movl (%%esp),%%eax;movl %%eax,%%fs:0;addl $8,%%esp;" \
- : : : "%eax");
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not strict ANSI */
-
-#endif /* _EXCPT_H_ not defined */
diff --git a/winsup/mingw/include/fcntl.h b/winsup/mingw/include/fcntl.h
deleted file mode 100644
index bcc7bca47..000000000
--- a/winsup/mingw/include/fcntl.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * fcntl.h
- *
- * Access constants for _open. Note that the permissions constants are
- * in sys/stat.h (ick).
- *
- * This code is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef __STRICT_ANSI__
-
-#ifndef _FCNTL_H_
-#define _FCNTL_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-/*
- * It appears that fcntl.h should include io.h for compatibility...
- */
-#include <io.h>
-
-/* Specifiy one of these flags to define the access mode. */
-#define _O_RDONLY 0
-#define _O_WRONLY 1
-#define _O_RDWR 2
-
-/* Mask for access mode bits in the _open flags. */
-#define _O_ACCMODE (_O_RDONLY|_O_WRONLY|_O_RDWR)
-
-#define _O_APPEND 0x0008 /* Writes will add to the end of the file. */
-
-#define _O_RANDOM 0x0010
-#define _O_SEQUENTIAL 0x0020
-#define _O_TEMPORARY 0x0040 /* Make the file dissappear after closing.
- * WARNING: Even if not created by _open! */
-#define _O_NOINHERIT 0x0080
-
-#define _O_CREAT 0x0100 /* Create the file if it does not exist. */
-#define _O_TRUNC 0x0200 /* Truncate the file if it does exist. */
-#define _O_EXCL 0x0400 /* Open only if the file does not exist. */
-
-/* NOTE: Text is the default even if the given _O_TEXT bit is not on. */
-#define _O_TEXT 0x4000 /* CR-LF in file becomes LF in memory. */
-#define _O_BINARY 0x8000 /* Input and output is not translated. */
-#define _O_RAW _O_BINARY
-
-#ifndef _NO_OLDNAMES
-
-/* POSIX/Non-ANSI names for increased portability */
-#define O_RDONLY _O_RDONLY
-#define O_WRONLY _O_WRONLY
-#define O_RDWR _O_RDWR
-#define O_ACCMODE _O_ACCMODE
-#define O_APPEND _O_APPEND
-#define O_CREAT _O_CREAT
-#define O_TRUNC _O_TRUNC
-#define O_EXCL _O_EXCL
-#define O_TEXT _O_TEXT
-#define O_BINARY _O_BINARY
-#define O_TEMPORARY _O_TEMPORARY
-#define O_NOINHERIT _O_NOINHERIT
-#define O_SEQENTIAL _O_SEQUENTIAL
-#define O_RANDOM _O_RANDOM
-
-#endif /* Not _NO_OLDNAMES */
-
-
-#ifndef RC_INVOKED
-
-/*
- * This variable determines the default file mode.
- * TODO: Which flags work?
- */
-#ifndef __DECLSPEC_SUPPORTED
-
-#ifdef __MSVCRT__
-extern unsigned int* _imp___fmode;
-#define _fmode (*_imp___fmode)
-#else
-/* CRTDLL */
-extern unsigned int* _imp___fmode_dll;
-#define _fmode (*_imp___fmode_dll)
-#endif
-
-#else /* __DECLSPEC_SUPPORTED */
-
-#ifdef __MSVCRT__
-__MINGW_IMPORT unsigned int _fmode;
-#else /* ! __MSVCRT__ */
-__MINGW_IMPORT unsigned int _fmode_dll;
-#define _fmode _fmode_dll
-#endif /* ! __MSVCRT__ */
-
-#endif /* __DECLSPEC_SUPPORTED */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int _setmode (int, int);
-
-#ifndef _NO_OLDNAMES
-int setmode (int, int);
-#endif /* Not _NO_OLDNAMES */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not _FCNTL_H_ */
-
-#endif /* Not __STRICT_ANSI__ */
-
diff --git a/winsup/mingw/include/fenv.h b/winsup/mingw/include/fenv.h
deleted file mode 100644
index e27095ff8..000000000
--- a/winsup/mingw/include/fenv.h
+++ /dev/null
@@ -1,91 +0,0 @@
-#ifndef _FENV_H_
-#define _FENV_H_
-
-
-/* FPU status word exception flags */
-#define FE_INVALID 0x01
-#define FE_DENORMAL 0x02
-#define FE_DIVBYZERO 0x04
-#define FE_OVERFLOW 0x08
-#define FE_UNDERFLOW 0x10
-#define FE_INEXACT 0x20
-#define FE_ALL_EXCEPT (FE_INVALID | FE_DENORMAL | FE_DIVBYZERO \
- | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT)
-
-/* FPU control word rounding flags */
-#define FE_TONEAREST 0x0000
-#define FE_DOWNWARD 0x0400
-#define FE_UPWARD 0x0800
-#define FE_TOWARDZERO 0x0c00
-
-#ifndef RC_INVOKED
-/*
- For now, support only for the basic abstraction of flags that are
- either set or clear. fexcept_t could be structure that holds more
- info about the fp environment.
-*/
-typedef unsigned short fexcept_t;
-
-/* This 28-byte struct represents the entire floating point
- environment as stored by fnstenv or fstenv */
-typedef struct
-{
- unsigned short __control_word;
- unsigned short __unused0;
- unsigned short __status_word;
- unsigned short __unused1;
- unsigned short __tag_word;
- unsigned short __unused2;
- unsigned int __ip_offset; /* instruction pointer offset */
- unsigned short __ip_selector;
- unsigned short __opcode;
- unsigned int __data_offset;
- unsigned short __data_selector;
- unsigned short __unused3;
-} fenv_t;
-
-
-/*The C99 standard (7.6.9) allows us to define implementation-specific macros for
- different fp environments */
-
-/* The default Intel x87 floating point environment (64-bit mantissa) */
-#define FE_PC64_ENV ((const fenv_t *)-1)
-
-/* The floating point environment set by MSVCRT _fpreset (53-bit mantissa) */
-#define FE_PC53_ENV ((const fenv_t *)-2)
-
-/* The FE_DFL_ENV macro is required by standard.
- fesetenv will use the environment set at app startup.*/
-#define FE_DFL_ENV ((const fenv_t *) 0)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*TODO: Some of these could be inlined */
-/* 7.6.2 Exception */
-
-extern int feclearexcept (int);
-extern int fegetexceptflag (fexcept_t * flagp, int excepts);
-extern int feraiseexcept (int excepts );
-extern int fesetexceptflag (const fexcept_t *, int);
-extern int fetestexcept (int excepts);
-
-/* 7.6.3 Rounding */
-
-extern int fegetround (void);
-extern int fesetround (int mode);
-
-/* 7.6.4 Environment */
-
-extern int fegetenv (fenv_t * envp);
-extern int fesetenv (const fenv_t * );
-extern int feupdateenv (const fenv_t *);
-extern int feholdexcept (fenv_t *);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* Not RC_INVOKED */
-
-#endif /* ndef _FENV_H */
diff --git a/winsup/mingw/include/float.h b/winsup/mingw/include/float.h
deleted file mode 100644
index dbd044155..000000000
--- a/winsup/mingw/include/float.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * float.h
- *
- * Constants related to floating point arithmetic.
- *
- * Also included here are some non-ANSI bits for accessing the floating
- * point controller.
- *
- * NOTE: GCC provides float.h, but it doesn't include the non-standard
- * stuff for accessing the fp controller. We include_next the
- * GCC-supplied header and just define the MS-specific extensions
- * here.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef _MINGW_FLOAT_H_
-#define _MINGW_FLOAT_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-#include_next<float.h>
-
-/*
- * Functions and definitions for controlling the FPU.
- */
-#ifndef __STRICT_ANSI__
-
-/* TODO: These constants are only valid for x86 machines */
-
-/* Control word masks for unMask */
-#define _MCW_EM 0x0008001F /* Error masks */
-#define _MCW_IC 0x00040000 /* Infinity */
-#define _MCW_RC 0x00000300 /* Rounding */
-#define _MCW_PC 0x00030000 /* Precision */
-
-/* Control word values for unNew (use with related unMask above) */
-#define _EM_INVALID 0x00000010
-#define _EM_DENORMAL 0x00080000
-#define _EM_ZERODIVIDE 0x00000008
-#define _EM_OVERFLOW 0x00000004
-#define _EM_UNDERFLOW 0x00000002
-#define _EM_INEXACT 0x00000001
-#define _IC_AFFINE 0x00040000
-#define _IC_PROJECTIVE 0x00000000
-#define _RC_CHOP 0x00000300
-#define _RC_UP 0x00000200
-#define _RC_DOWN 0x00000100
-#define _RC_NEAR 0x00000000
-#define _PC_24 0x00020000
-#define _PC_53 0x00010000
-#define _PC_64 0x00000000
-
-/* These are also defined in Mingw math.h, needed to work around
- GCC build issues. */
-/* Return values for fpclass. */
-#ifndef __MINGW_FPCLASS_DEFINED
-#define __MINGW_FPCLASS_DEFINED 1
-#define _FPCLASS_SNAN 0x0001 /* Signaling "Not a Number" */
-#define _FPCLASS_QNAN 0x0002 /* Quiet "Not a Number" */
-#define _FPCLASS_NINF 0x0004 /* Negative Infinity */
-#define _FPCLASS_NN 0x0008 /* Negative Normal */
-#define _FPCLASS_ND 0x0010 /* Negative Denormal */
-#define _FPCLASS_NZ 0x0020 /* Negative Zero */
-#define _FPCLASS_PZ 0x0040 /* Positive Zero */
-#define _FPCLASS_PD 0x0080 /* Positive Denormal */
-#define _FPCLASS_PN 0x0100 /* Positive Normal */
-#define _FPCLASS_PINF 0x0200 /* Positive Infinity */
-#endif /* __MINGW_FPCLASS_DEFINED */
-
-/* invalid subconditions (_SW_INVALID also set) */
-#define _SW_UNEMULATED 0x0040 /* unemulated instruction */
-#define _SW_SQRTNEG 0x0080 /* square root of a neg number */
-#define _SW_STACKOVERFLOW 0x0200 /* FP stack overflow */
-#define _SW_STACKUNDERFLOW 0x0400 /* FP stack underflow */
-
-/* Floating point error signals and return codes */
-#define _FPE_INVALID 0x81
-#define _FPE_DENORMAL 0x82
-#define _FPE_ZERODIVIDE 0x83
-#define _FPE_OVERFLOW 0x84
-#define _FPE_UNDERFLOW 0x85
-#define _FPE_INEXACT 0x86
-#define _FPE_UNEMULATED 0x87
-#define _FPE_SQRTNEG 0x88
-#define _FPE_STACKOVERFLOW 0x8a
-#define _FPE_STACKUNDERFLOW 0x8b
-#define _FPE_EXPLICITGEN 0x8c /* raise( SIGFPE ); */
-
-#ifndef RC_INVOKED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Set the FPU control word as cw = (cw & ~unMask) | (unNew & unMask),
- * i.e. change the bits in unMask to have the values they have in unNew,
- * leaving other bits unchanged. */
-unsigned int _controlfp (unsigned int unNew, unsigned int unMask);
-unsigned int _control87 (unsigned int unNew, unsigned int unMask);
-
-
-unsigned int _clearfp (void); /* Clear the FPU status word */
-unsigned int _statusfp (void); /* Report the FPU status word */
-#define _clear87 _clearfp
-#define _status87 _statusfp
-
-
-/*
- MSVCRT.dll _fpreset initializes the control register to 0x27f,
- the status register to zero and the tag word to 0FFFFh.
- This differs from asm instruction finit/fninit which set control
- word to 0x37f (64 bit mantissa precison rather than 53 bit).
- By default, the mingw version of _fpreset sets fp control as
- per fninit. To use the MSVCRT.dll _fpreset, include CRT_fp8.o when
- building your application.
-*/
-void _fpreset (void);
-void fpreset (void);
-
-/* Global 'variable' for the current floating point error code. */
-int * __fpecode(void);
-#define _fpecode (*(__fpecode()))
-
-/*
- * IEEE recommended functions. MS puts them in float.h
- * but they really belong in math.h.
- */
-
-double _chgsign (double);
-double _copysign (double, double);
-double _logb (double);
-double _nextafter (double, double);
-double _scalb (double, long);
-
-int _finite (double);
-int _fpclass (double);
-int _isnan (double);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not __STRICT_ANSI__ */
-
-#endif /* _FLOAT_H_ */
-
diff --git a/winsup/mingw/include/inttypes.h b/winsup/mingw/include/inttypes.h
deleted file mode 100644
index 70efb5f59..000000000
--- a/winsup/mingw/include/inttypes.h
+++ /dev/null
@@ -1,275 +0,0 @@
-/* 7.8 Format conversion of integer types <inttypes.h> */
-
-#ifndef _INTTYPES_H_
-#define _INTTYPES_H_
-
-#include <stdint.h>
-#define __need_wchar_t
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
- intmax_t quot;
- intmax_t rem;
- } imaxdiv_t;
-
-#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS)
-
-/* 7.8.1 Macros for format specifiers
- *
- * MS runtime does not yet understand C9x standard "ll"
- * length specifier. It appears to treat "ll" as "l".
- * The non-standard I64 length specifier causes warning in GCC,
- * but understood by MS runtime functions.
- */
-
-/* fprintf macros for signed types */
-#define PRId8 "d"
-#define PRId16 "d"
-#define PRId32 "d"
-#define PRId64 "I64d"
-
-#define PRIdLEAST8 "d"
-#define PRIdLEAST16 "d"
-#define PRIdLEAST32 "d"
-#define PRIdLEAST64 "I64d"
-
-#define PRIdFAST8 "d"
-#define PRIdFAST16 "d"
-#define PRIdFAST32 "d"
-#define PRIdFAST64 "I64d"
-
-#define PRIdMAX "I64d"
-#define PRIdPTR "d"
-
-#define PRIi8 "i"
-#define PRIi16 "i"
-#define PRIi32 "i"
-#define PRIi64 "I64i"
-
-#define PRIiLEAST8 "i"
-#define PRIiLEAST16 "i"
-#define PRIiLEAST32 "i"
-#define PRIiLEAST64 "I64i"
-
-#define PRIiFAST8 "i"
-#define PRIiFAST16 "i"
-#define PRIiFAST32 "i"
-#define PRIiFAST64 "I64i"
-
-#define PRIiMAX "I64i"
-#define PRIiPTR "i"
-
-#define PRIo8 "o"
-#define PRIo16 "o"
-#define PRIo32 "o"
-#define PRIo64 "I64o"
-
-#define PRIoLEAST8 "o"
-#define PRIoLEAST16 "o"
-#define PRIoLEAST32 "o"
-#define PRIoLEAST64 "I64o"
-
-#define PRIoFAST8 "o"
-#define PRIoFAST16 "o"
-#define PRIoFAST32 "o"
-#define PRIoFAST64 "I64o"
-
-#define PRIoMAX "I64o"
-
-#define PRIoPTR "o"
-
-/* fprintf macros for unsigned types */
-#define PRIu8 "u"
-#define PRIu16 "u"
-#define PRIu32 "u"
-#define PRIu64 "I64u"
-
-
-#define PRIuLEAST8 "u"
-#define PRIuLEAST16 "u"
-#define PRIuLEAST32 "u"
-#define PRIuLEAST64 "I64u"
-
-#define PRIuFAST8 "u"
-#define PRIuFAST16 "u"
-#define PRIuFAST32 "u"
-#define PRIuFAST64 "I64u"
-
-#define PRIuMAX "I64u"
-#define PRIuPTR "u"
-
-#define PRIx8 "x"
-#define PRIx16 "x"
-#define PRIx32 "x"
-#define PRIx64 "I64x"
-
-#define PRIxLEAST8 "x"
-#define PRIxLEAST16 "x"
-#define PRIxLEAST32 "x"
-#define PRIxLEAST64 "I64x"
-
-#define PRIxFAST8 "x"
-#define PRIxFAST16 "x"
-#define PRIxFAST32 "x"
-#define PRIxFAST64 "I64x"
-
-#define PRIxMAX "I64x"
-#define PRIxPTR "x"
-
-#define PRIX8 "X"
-#define PRIX16 "X"
-#define PRIX32 "X"
-#define PRIX64 "I64X"
-
-#define PRIXLEAST8 "X"
-#define PRIXLEAST16 "X"
-#define PRIXLEAST32 "X"
-#define PRIXLEAST64 "I64X"
-
-#define PRIXFAST8 "X"
-#define PRIXFAST16 "X"
-#define PRIXFAST32 "X"
-#define PRIXFAST64 "I64X"
-
-#define PRIXMAX "I64X"
-#define PRIXPTR "X"
-
-/*
- * fscanf macros for signed int types
- * NOTE: if 32-bit int is used for int_fast8_t and int_fast16_t
- * (see stdint.h, 7.18.1.3), FAST8 and FAST16 should have
- * no length identifiers
- */
-
-#define SCNd16 "hd"
-#define SCNd32 "d"
-#define SCNd64 "I64d"
-
-#define SCNdLEAST16 "hd"
-#define SCNdLEAST32 "d"
-#define SCNdLEAST64 "I64d"
-
-#define SCNdFAST16 "hd"
-#define SCNdFAST32 "d"
-#define SCNdFAST64 "I64d"
-
-#define SCNdMAX "I64d"
-#define SCNdPTR "d"
-
-#define SCNi16 "hi"
-#define SCNi32 "i"
-#define SCNi64 "I64i"
-
-#define SCNiLEAST16 "hi"
-#define SCNiLEAST32 "i"
-#define SCNiLEAST64 "I64i"
-
-#define SCNiFAST16 "hi"
-#define SCNiFAST32 "i"
-#define SCNiFAST64 "I64i"
-
-#define SCNiMAX "I64i"
-#define SCNiPTR "i"
-
-#define SCNo16 "ho"
-#define SCNo32 "o"
-#define SCNo64 "I64o"
-
-#define SCNoLEAST16 "ho"
-#define SCNoLEAST32 "o"
-#define SCNoLEAST64 "I64o"
-
-#define SCNoFAST16 "ho"
-#define SCNoFAST32 "o"
-#define SCNoFAST64 "I64o"
-
-#define SCNoMAX "I64o"
-#define SCNoPTR "o"
-
-#define SCNx16 "hx"
-#define SCNx32 "x"
-#define SCNx64 "I64x"
-
-#define SCNxLEAST16 "hx"
-#define SCNxLEAST32 "x"
-#define SCNxLEAST64 "I64x"
-
-#define SCNxFAST16 "hx"
-#define SCNxFAST32 "x"
-#define SCNxFAST64 "I64x"
-
-#define SCNxMAX "I64x"
-#define SCNxPTR "x"
-
-
-/* fscanf macros for unsigned int types */
-
-#define SCNu16 "hu"
-#define SCNu32 "u"
-#define SCNu64 "I64u"
-
-#define SCNuLEAST16 "hu"
-#define SCNuLEAST32 "u"
-#define SCNuLEAST64 "I64u"
-
-#define SCNuFAST16 "hu"
-#define SCNuFAST32 "u"
-#define SCNuFAST64 "I64u"
-
-#define SCNuMAX "I64u"
-#define SCNuPTR "u"
-
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-/*
- * no length modifier for char types prior to C9x
- * MS runtime scanf appears to treat "hh" as "h"
- */
-
-/* signed char */
-#define SCNd8 "hhd"
-#define SCNdLEAST8 "hhd"
-#define SCNdFAST8 "hhd"
-
-#define SCNi8 "hhi"
-#define SCNiLEAST8 "hhi"
-#define SCNiFAST8 "hhi"
-
-#define SCNo8 "hho"
-#define SCNoLEAST8 "hho"
-#define SCNoFAST8 "hho"
-
-#define SCNx8 "hhx"
-#define SCNxLEAST8 "hhx"
-#define SCNxFAST8 "hhx"
-
-/* unsigned char */
-#define SCNu8 "hhu"
-#define SCNuLEAST8 "hhu"
-#define SCNuFAST8 "hhu"
-#endif /* __STDC_VERSION__ >= 199901 */
-
-#endif /* !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) */
-
-extern __inline__ intmax_t imaxabs (intmax_t j)
- {return (j >= 0 ? j : -j);}
-imaxdiv_t imaxdiv (intmax_t numer, intmax_t denom);
-
-/* 7.8.2 Conversion functions for greatest-width integer types */
-
-intmax_t strtoimax (const char* __restrict__ nptr, char** __restrict__ endptr, int base);
-uintmax_t strtoumax (const char* __restrict__ nptr, char** __restrict__ endptr, int base);
-
-intmax_t wcstoimax (const wchar_t* __restrict__ nptr, wchar_t** __restrict__ endptr,
- int base);
-uintmax_t wcstoumax (const wchar_t* __restrict__ nptr, wchar_t** __restrict__ endptr,
- int base);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ndef _INTTYPES_H */
diff --git a/winsup/mingw/include/io.h b/winsup/mingw/include/io.h
deleted file mode 100644
index ea86ffa0c..000000000
--- a/winsup/mingw/include/io.h
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * io.h
- *
- * System level I/O functions and types.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef __STRICT_ANSI__
-
-#ifndef _IO_H_
-#define _IO_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-/* We need the definition of FILE anyway... */
-#include <stdio.h>
-
-/* MSVC's io.h contains the stuff from dir.h, so I will too.
- * NOTE: This also defines off_t, the file offset type, through
- * an inclusion of sys/types.h */
-#ifndef __STRICT_ANSI__
-
-#include <sys/types.h> /* To get time_t. */
-
-/*
- * Attributes of files as returned by _findfirst et al.
- */
-#define _A_NORMAL 0x00000000
-#define _A_RDONLY 0x00000001
-#define _A_HIDDEN 0x00000002
-#define _A_SYSTEM 0x00000004
-#define _A_VOLID 0x00000008
-#define _A_SUBDIR 0x00000010
-#define _A_ARCH 0x00000020
-
-
-#ifndef RC_INVOKED
-
-#ifndef _FSIZE_T_DEFINED
-typedef unsigned long _fsize_t;
-#define _FSIZE_T_DEFINED
-#endif
-
-/*
- * The following structure is filled in by _findfirst or _findnext when
- * they succeed in finding a match.
- */
-struct _finddata_t
-{
- unsigned attrib; /* Attributes, see constants above. */
- time_t time_create;
- time_t time_access; /* always midnight local time */
- time_t time_write;
- _fsize_t size;
- char name[FILENAME_MAX]; /* may include spaces. */
-};
-
-struct _finddatai64_t {
- unsigned attrib;
- time_t time_create;
- time_t time_access;
- time_t time_write;
- __int64 size;
- char name[FILENAME_MAX];
-};
-
-
-#ifndef _WFINDDATA_T_DEFINED
-struct _wfinddata_t {
- unsigned attrib;
- time_t time_create; /* -1 for FAT file systems */
- time_t time_access; /* -1 for FAT file systems */
- time_t time_write;
- _fsize_t size;
- wchar_t name[FILENAME_MAX]; /* may include spaces. */
-};
-struct _wfinddatai64_t {
- unsigned attrib;
- time_t time_create;
- time_t time_access;
- time_t time_write;
- __int64 size;
- wchar_t name[FILENAME_MAX];
-};
-
-#define _WFINDDATA_T_DEFINED
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Functions for searching for files. _findfirst returns -1 if no match
- * is found. Otherwise it returns a handle to be used in _findnext and
- * _findclose calls. _findnext also returns -1 if no match could be found,
- * and 0 if a match was found. Call _findclose when you are finished.
- */
-int _findfirst (const char*, struct _finddata_t*);
-int _findnext (int, struct _finddata_t*);
-int _findclose (int);
-
-int _chdir (const char*);
-char* _getcwd (char*, int);
-int _mkdir (const char*);
-char* _mktemp (char*);
-int _rmdir (const char*);
-
-
-#ifdef __MSVCRT__
-__int64 _filelengthi64(int);
-long _findfirsti64(const char*, struct _finddatai64_t*);
-int _findnexti64(long, struct _finddatai64_t*);
-__int64 _lseeki64(int, __int64, int);
-__int64 _telli64(int);
-#endif /* __MSVCRT__ */
-
-
-#ifndef _NO_OLDNAMES
-
-#ifndef _UWIN
-int chdir (const char*);
-char* getcwd (char*, int);
-int mkdir (const char*);
-char* mktemp (char*);
-int rmdir (const char*);
-#endif /* _UWIN */
-
-#endif /* Not _NO_OLDNAMES */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not __STRICT_ANSI__ */
-
-/* TODO: Maximum number of open handles has not been tested, I just set
- * it the same as FOPEN_MAX. */
-#define HANDLE_MAX FOPEN_MAX
-
-
-/* Some defines for _access nAccessMode (MS doesn't define them, but
- * it doesn't seem to hurt to add them). */
-#define F_OK 0 /* Check for file existence */
-#define X_OK 1 /* Check for execute permission. */
-#define W_OK 2 /* Check for write permission */
-#define R_OK 4 /* Check for read permission */
-
-#ifndef RC_INVOKED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int _access (const char*, int);
-int _chsize (int, long);
-int _close (int);
-int _commit(int);
-
-/* NOTE: The only significant bit in unPermissions appears to be bit 7 (0x80),
- * the "owner write permission" bit (on FAT). */
-int _creat (const char*, unsigned);
-
-int _dup (int);
-int _dup2 (int, int);
-long _filelength (int);
-int _fileno (FILE*);
-long _get_osfhandle (int);
-int _isatty (int);
-
-/* In a very odd turn of events this function is excluded from those
- * files which define _STREAM_COMPAT. This is required in order to
- * build GNU libio because of a conflict with _eof in streambuf.h
- * line 107. Actually I might just be able to change the name of
- * the enum member in streambuf.h... we'll see. TODO */
-#ifndef _STREAM_COMPAT
-int _eof (int);
-#endif
-
-/* LK_... locking commands defined in sys/locking.h. */
-int _locking (int, int, long);
-
-long _lseek (int, long, int);
-
-/* Optional third argument is unsigned unPermissions. */
-int _open (const char*, int, ...);
-
-int _open_osfhandle (long, int);
-int _pipe (int *, unsigned int, int);
-int _read (int, void*, unsigned int);
-
-/* SH_... flags for nShFlags defined in share.h
- * Optional fourth argument is unsigned unPermissions */
-int _sopen (const char*, int, int, ...);
-
-long _tell (int);
-/* Should umask be in sys/stat.h and/or sys/types.h instead? */
-int _umask (int);
-int _unlink (const char*);
-int _write (int, const void*, unsigned int);
-
-/* Wide character versions. Also declared in wchar.h. */
-/* Not in crtdll.dll */
-#if !defined (_WIO_DEFINED)
-#if defined (__MSVCRT__)
-int _waccess(const wchar_t*, int);
-int _wchmod(const wchar_t*, int);
-int _wcreat(const wchar_t*, int);
-long _wfindfirst(wchar_t*, struct _wfinddata_t*);
-int _wfindnext(long, struct _wfinddata_t *);
-int _wunlink(const wchar_t*);
-int _wopen(const wchar_t*, int, ...);
-int _wsopen(const wchar_t*, int, int, ...);
-wchar_t * _wmktemp(wchar_t*);
-long _wfindfirsti64(const wchar_t*, struct _wfinddatai64_t*);
-int _wfindnexti64(long, struct _wfinddatai64_t*);
-#endif /* defined (__MSVCRT__) */
-#define _WIO_DEFINED
-#endif /* _WIO_DEFINED */
-
-#ifndef _NO_OLDNAMES
-/*
- * Non-underscored versions of non-ANSI functions to improve portability.
- * These functions live in libmoldname.a.
- */
-
-#ifndef _UWIN
-int access (const char*, int);
-int chsize (int, long );
-int close (int);
-int creat (const char*, int);
-int dup (int);
-int dup2 (int, int);
-int eof (int);
-long filelength (int);
-int fileno (FILE*);
-int isatty (int);
-long lseek (int, long, int);
-int open (const char*, int, ...);
-int read (int, void*, unsigned int);
-int sopen (const char*, int, int, ...);
-long tell (int);
-int umask (int);
-int unlink (const char*);
-int write (int, const void*, unsigned int);
-#endif /* _UWIN */
-
-/* Wide character versions. Also declared in wchar.h. */
-/* Where do these live? Not in libmoldname.a nor in libmsvcrt.a */
-#if 0
-int waccess(const wchar_t *, int);
-int wchmod(const wchar_t *, int);
-int wcreat(const wchar_t *, int);
-long wfindfirst(wchar_t *, struct _wfinddata_t *);
-int wfindnext(long, struct _wfinddata_t *);
-int wunlink(const wchar_t *);
-int wrename(const wchar_t *, const wchar_t *);
-int wopen(const wchar_t *, int, ...);
-int wsopen(const wchar_t *, int, int, ...);
-wchar_t * wmktemp(wchar_t *);
-#endif
-
-#endif /* Not _NO_OLDNAMES */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* _IO_H_ not defined */
-
-#endif /* Not strict ANSI */
-
diff --git a/winsup/mingw/include/limits.h b/winsup/mingw/include/limits.h
deleted file mode 100644
index a1901fc9d..000000000
--- a/winsup/mingw/include/limits.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * limits.h
- *
- * Defines constants for the sizes of integral types.
- *
- * NOTE: GCC should supply a version of this header and it should be safe to
- * use that version instead of this one (maybe safer).
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef _LIMITS_H_
-#define _LIMITS_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-/*
- * File system limits
- *
- * TODO: NAME_MAX and OPEN_MAX are file system limits or not? Are they the
- * same as FILENAME_MAX and FOPEN_MAX from stdio.h?
- * NOTE: Apparently the actual size of PATH_MAX is 260, but a space is
- * required for the NUL. TODO: Test?
- */
-#define PATH_MAX (259)
-
-/*
- * Characteristics of the char data type.
- *
- * TODO: Is MB_LEN_MAX correct?
- */
-#define CHAR_BIT 8
-#define MB_LEN_MAX 2
-
-#define SCHAR_MIN (-128)
-#define SCHAR_MAX 127
-
-#define UCHAR_MAX 255
-
-/* TODO: Is this safe? I think it might just be testing the preprocessor,
- * not the compiler itself... */
-#if ('\x80' < 0)
-#define CHAR_MIN SCHAR_MIN
-#define CHAR_MAX SCHAR_MAX
-#else
-#define CHAR_MIN 0
-#define CHAR_MAX UCHAR_MAX
-#endif
-
-/*
- * Maximum and minimum values for ints.
- */
-#define INT_MAX 2147483647
-#define INT_MIN (-INT_MAX-1)
-
-#define UINT_MAX 0xffffffff
-
-/*
- * Maximum and minimum values for shorts.
- */
-#define SHRT_MAX 32767
-#define SHRT_MIN (-SHRT_MAX-1)
-
-#define USHRT_MAX 0xffff
-
-/*
- * Maximum and minimum values for longs and unsigned longs.
- *
- * TODO: This is not correct for Alphas, which have 64 bit longs.
- */
-#define LONG_MAX 2147483647L
-
-#define LONG_MIN (-LONG_MAX-1)
-
-#define ULONG_MAX 0xffffffffUL
-
-
-/*
- * The GNU C compiler also allows 'long long int'
- */
-#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
-
-#define LONG_LONG_MAX 9223372036854775807LL
-#define LONG_LONG_MIN (-LONG_LONG_MAX-1)
-
-#define ULONG_LONG_MAX (2ULL * LONG_LONG_MAX + 1)
-
-/* ISO C9x macro names */
-#define LLONG_MAX LONG_LONG_MAX
-#define LLONG_MIN LONG_LONG_MIN
-#define ULLONG_MAX ULONG_LONG_MAX
-
-#endif /* Not Strict ANSI and GNU C compiler */
-
-
-#endif /* not _LIMITS_H_ */
diff --git a/winsup/mingw/include/locale.h b/winsup/mingw/include/locale.h
deleted file mode 100644
index 06db31a3d..000000000
--- a/winsup/mingw/include/locale.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * locale.h
- *
- * Functions and types for localization (ie. changing the appearance of
- * output based on the standards of a certain country).
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef _LOCALE_H_
-#define _LOCALE_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-/*
- * NOTE: I have tried to test this, but I am limited by my knowledge of
- * locale issues. The structure does not bomb if you look at the
- * values, and 'decimal_point' even seems to be correct. But the
- * rest of the values are, by default, not particularly useful
- * (read meaningless and not related to the international settings
- * of the system).
- */
-
-#define LC_ALL 0
-#define LC_COLLATE 1
-#define LC_CTYPE 2
-#define LC_MONETARY 3
-#define LC_NUMERIC 4
-#define LC_TIME 5
-#define LC_MIN LC_ALL
-#define LC_MAX LC_TIME
-
-#ifndef RC_INVOKED
-
-/*
- * The structure returned by 'localeconv'.
- */
-struct lconv
-{
- char* decimal_point;
- char* thousands_sep;
- char* grouping;
- char* int_curr_symbol;
- char* currency_symbol;
- char* mon_decimal_point;
- char* mon_thousands_sep;
- char* mon_grouping;
- char* positive_sign;
- char* negative_sign;
- char int_frac_digits;
- char frac_digits;
- char p_cs_precedes;
- char p_sep_by_space;
- char n_cs_precedes;
- char n_sep_by_space;
- char p_sign_posn;
- char n_sign_posn;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-char* setlocale (int, const char*);
-struct lconv* localeconv (void);
-
-#ifndef _WLOCALE_DEFINED /* also declared in wchar.h */
-# define __need_wchar_t
-# include <stddef.h>
- wchar_t* _wsetlocale(int, const wchar_t*);
-# define _WLOCALE_DEFINED
-#endif /* ndef _WLOCALE_DEFINED */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not _LOCALE_H_ */
-
diff --git a/winsup/mingw/include/malloc.h b/winsup/mingw/include/malloc.h
deleted file mode 100644
index 9c412404b..000000000
--- a/winsup/mingw/include/malloc.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * malloc.h
- *
- * Support for programs which want to use malloc.h to get memory management
- * functions. Unless you absolutely need some of these functions and they are
- * not in the ANSI headers you should use the ANSI standard header files
- * instead.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef __STRICT_ANSI__
-
-#ifndef _MALLOC_H_
-#define _MALLOC_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-#include <stdlib.h>
-
-#ifndef RC_INVOKED
-
-/*
- * The structure used to walk through the heap with _heapwalk.
- */
-typedef struct _heapinfo
-{
- int* _pentry;
- size_t _size;
- int _useflag;
-} _HEAPINFO;
-
-/* Values for _heapinfo.useflag */
-#define _USEDENTRY 0
-#define _FREEENTRY 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- The _heap* memory allocation functions are supported on NT
- but not W9x. On latter, they always set errno to ENOSYS.
-*/
-int _heapwalk (_HEAPINFO*);
-
-#ifndef _NO_OLDNAMES
-int heapwalk (_HEAPINFO*);
-#endif /* Not _NO_OLDNAMES */
-
-int _heapchk (void); /* Verify heap integrety. */
-int _heapmin (void); /* Return unused heap to the OS. */
-int _heapset (unsigned int);
-
-size_t _msize (void*);
-size_t _get_sbh_threshold (void);
-int _set_sbh_threshold (size_t);
-void * _expand (void*, size_t);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* RC_INVOKED */
-
-#endif /* Not _MALLOC_H_ */
-
-#endif /* Not __STRICT_ANSI__ */
-
diff --git a/winsup/mingw/include/math.h b/winsup/mingw/include/math.h
deleted file mode 100644
index c87b6163b..000000000
--- a/winsup/mingw/include/math.h
+++ /dev/null
@@ -1,485 +0,0 @@
-/*
- * math.h
- *
- * Mathematical functions.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef _MATH_H_
-#define _MATH_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-/*
- * Types for the _exception structure.
- */
-
-#define _DOMAIN 1 /* domain error in argument */
-#define _SING 2 /* singularity */
-#define _OVERFLOW 3 /* range overflow */
-#define _UNDERFLOW 4 /* range underflow */
-#define _TLOSS 5 /* total loss of precision */
-#define _PLOSS 6 /* partial loss of precision */
-
-/*
- * Exception types with non-ANSI names for compatibility.
- */
-
-#ifndef __STRICT_ANSI__
-#ifndef _NO_OLDNAMES
-
-#define DOMAIN _DOMAIN
-#define SING _SING
-#define OVERFLOW _OVERFLOW
-#define UNDERFLOW _UNDERFLOW
-#define TLOSS _TLOSS
-#define PLOSS _PLOSS
-
-#endif /* Not _NO_OLDNAMES */
-#endif /* Not __STRICT_ANSI__ */
-
-
-/* These are also defined in Mingw float.h; needed here as well to work
- around GCC build issues. */
-#ifndef __STRICT_ANSI__
-#ifndef __MINGW_FPCLASS_DEFINED
-#define __MINGW_FPCLASS_DEFINED 1
-/* IEEE 754 classication */
-#define _FPCLASS_SNAN 0x0001 /* Signaling "Not a Number" */
-#define _FPCLASS_QNAN 0x0002 /* Quiet "Not a Number" */
-#define _FPCLASS_NINF 0x0004 /* Negative Infinity */
-#define _FPCLASS_NN 0x0008 /* Negative Normal */
-#define _FPCLASS_ND 0x0010 /* Negative Denormal */
-#define _FPCLASS_NZ 0x0020 /* Negative Zero */
-#define _FPCLASS_PZ 0x0040 /* Positive Zero */
-#define _FPCLASS_PD 0x0080 /* Positive Denormal */
-#define _FPCLASS_PN 0x0100 /* Positive Normal */
-#define _FPCLASS_PINF 0x0200 /* Positive Infinity */
-#endif /* __MINGW_FPCLASS_DEFINED */
-#endif /* Not __STRICT_ANSI__ */
-
-#ifndef RC_INVOKED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * HUGE_VAL is returned by strtod when the value would overflow the
- * representation of 'double'. There are other uses as well.
- *
- * __imp__HUGE is a pointer to the actual variable _HUGE in
- * MSVCRT.DLL. If we used _HUGE directly we would get a pointer
- * to a thunk function.
- *
- * NOTE: The CRTDLL version uses _HUGE_dll instead.
- */
-
-#ifndef __DECLSPEC_SUPPORTED
-
-#ifdef __MSVCRT__
-extern double* _imp___HUGE;
-#define HUGE_VAL (*_imp___HUGE)
-#else
-/* CRTDLL */
-extern double* _imp___HUGE_dll;
-#define HUGE_VAL (*_imp___HUGE_dll)
-#endif
-
-#else /* __DECLSPEC_SUPPORTED */
-
-#ifdef __MSVCRT__
-__MINGW_IMPORT double _HUGE;
-#define HUGE_VAL _HUGE
-#else
-/* CRTDLL */
-__MINGW_IMPORT double _HUGE_dll;
-#define HUGE_VAL _HUGE_dll
-#endif
-
-#endif /* __DECLSPEC_SUPPORTED */
-
-struct _exception
-{
- int type;
- char *name;
- double arg1;
- double arg2;
- double retval;
-};
-
-
-double sin (double);
-double cos (double);
-double tan (double);
-double sinh (double);
-double cosh (double);
-double tanh (double);
-double asin (double);
-double acos (double);
-double atan (double);
-double atan2 (double, double);
-double exp (double);
-double log (double);
-double log10 (double);
-double pow (double, double);
-double sqrt (double);
-double ceil (double);
-double floor (double);
-double fabs (double);
-double ldexp (double, int);
-double frexp (double, int*);
-double modf (double, double*);
-double fmod (double, double);
-
-#ifndef __STRICT_ANSI__
-
-/* Complex number (for cabs) */
-struct _complex
-{
- double x; /* Real part */
- double y; /* Imaginary part */
-};
-
-double _cabs (struct _complex);
-double _hypot (double, double);
-double _j0 (double);
-double _j1 (double);
-double _jn (int, double);
-double _y0 (double);
-double _y1 (double);
-double _yn (int, double);
-int _matherr (struct _exception *);
-
-/* These are also declared in Mingw float.h; needed here as well to work
- around GCC build issues. */
-/* BEGIN FLOAT.H COPY */
-/*
- * IEEE recommended functions
- */
-
-double _chgsign (double);
-double _copysign (double, double);
-double _logb (double);
-double _nextafter (double, double);
-double _scalb (double, long);
-
-int _finite (double);
-int _fpclass (double);
-int _isnan (double);
-
-/* END FLOAT.H COPY */
-
-#if !defined (_NO_OLDNAMES) \
- || (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L )
-
-/*
- * Non-underscored versions of non-ANSI functions. These reside in
- * liboldnames.a. They are now also ISO C99 standand names.
- * Provided for extra portability.
- */
-
-double cabs (struct _complex);
-double hypot (double, double);
-double j0 (double);
-double j1 (double);
-double jn (int, double);
-double y0 (double);
-double y1 (double);
-double yn (int, double);
-
-#endif /* Not _NO_OLDNAMES */
-
-#endif /* Not __STRICT_ANSI__ */
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* Not RC_INVOKED */
-
-
-#ifndef __NO_ISOCEXT
-#ifndef RC_INVOKED
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
- || !defined __STRICT_ANSI__
-
-#define INFINITY HUGE_VAL
-#define NAN (0.0F/0.0F)
-
-/*
- Return values for fpclassify.
- These are based on Intel x87 fpu condition codes
- in the high byte of status word and differ from
- the return values for MS IEEE 754 extension _fpclass()
-*/
-#define FP_NAN 0x0100
-#define FP_NORMAL 0x0400
-#define FP_INFINITE (FP_NAN | FP_NORMAL)
-#define FP_ZERO 0x4000
-#define FP_SUBNORMAL (FP_NORMAL | FP_ZERO)
-/* 0x0200 is signbit mask */
-
-
-/* Return a NaN */
-double nan(const char *tagp);
-float nanf(const char *tagp);
-long double nanl(const char *tagp);
-
-#ifndef __STRICT_ANSI__
-#define nan() nan("")
-#define nanf() nanf("")
-#define nanl() nanl("")
-#endif
-
-/*
- We can't inline float or double, because we want to ensure truncation
- to semantic type before classification.
- (A normal long double value might become subnormal when
- converted to double, and zero when converted to float.)
-*/
-
-extern int __fpclassifyf (float);
-extern int __fpclassify (double);
-
-extern __inline__ int __fpclassifyl (long double x){
- unsigned short sw;
- __asm__ ("fxam; fstsw %%ax;" : "=a" (sw): "t" (x));
- return sw & (FP_NAN | FP_NORMAL | FP_ZERO );
-}
-
-#define fpclassify(x) (sizeof (x) == sizeof (float) ? __fpclassifyf (x) \
- : sizeof (x) == sizeof (double) ? __fpclassify (x) \
- : __fpclassifyl (x))
-
-/* We don't need to worry about trucation here:
- A NaN stays a NaN. */
-extern __inline__ int __isnan (double _x)
-{
- unsigned short sw;
- __asm__ ("fxam;"
- "fstsw %%ax": "=a" (sw) : "t" (_x));
- return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL))
- == FP_NAN;
-}
-
-extern __inline__ int __isnanf (float _x)
-{
- unsigned short sw;
- __asm__ ("fxam;"
- "fstsw %%ax": "=a" (sw) : "t" (_x));
- return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL))
- == FP_NAN;
-}
-
-extern __inline__ int __isnanl (long double _x)
-{
- unsigned short sw;
- __asm__ ("fxam;"
- "fstsw %%ax": "=a" (sw) : "t" (_x));
- return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL))
- == FP_NAN;
-}
-
-#define isnan(x) (sizeof (x) == sizeof (float) ? __isnanf (x) \
- : sizeof (x) == sizeof (double) ? __isnan (x) \
- : __isnanl (x))
-
-#define isfinite(x) ((fpclassify(x) & FP_NAN) == 0)
-#define isinf(x) (fpclassify(x) == FP_INFINITE)
-#define isnormal(x) (fpclassify(x) == FP_NORMAL)
-
-
-extern __inline__ int __signbit (double x) {
- unsigned short stw;
- __asm__ ( "fxam; fstsw %%ax;": "=a" (stw) : "t" (x));
- return stw & 0x0200;
-}
-
-extern __inline__ int __signbitf (float x) {
- unsigned short stw;
- __asm__ ("fxam; fstsw %%ax;": "=a" (stw) : "t" (x));
- return stw & 0x0200;
-}
-extern __inline__ int __signbitl (long double x) {
- unsigned short stw;
- __asm__ ("fxam; fstsw %%ax;": "=a" (stw) : "t" (x));
- return stw & 0x0200;
-}
-
-
-#define signbit(x) (sizeof (x) == sizeof (float) ? __signbitf (x) \
- : sizeof (x) == sizeof (double) ? __signbit (x) \
- : __signbitl (x))
-
-/*
- * With these functions, comparisons involving quiet NaNs set the FP
- * condition code to "unordered". The IEEE floating-point spec
- * dictates that the result of floating-point comparisons should be
- * false whenever a NaN is involved, with the exception of the !=,
- * which always returns true: yes, (NaN != NaN) is true).
- */
-
-#if __GNUC__ >= 3
-
-#define isgreater(x, y) __builtin_isgreater(x, y)
-#define isgreaterequal(x, y) __builtin_isgreaterequal(x, y)
-#define isless(x, y) __builtin_isless(x, y)
-#define islessequal(x, y) __builtin_islessequal(x, y)
-#define islessgreater(x, y) __builtin_islessgreater(x, y)
-#define isunordered(x, y) __builtin_isunordered(x, y)
-
-#else
-/* helper */
-extern __inline__ int
-__fp_unordered_compare (long double x, long double y){
- unsigned short retval;
- __asm__ ("fucom %%st(1);"
- "fnstsw;": "=a" (retval) : "t" (x), "u" (y));
- return retval;
-}
-
-#define isgreater(x, y) ((__fp_unordered_compare(x, y) \
- & 0x4500) == 0)
-#define isless(x, y) ((__fp_unordered_compare (y, x) \
- & 0x4500) == 0)
-#define isgreaterequal(x, y) ((__fp_unordered_compare (x, y) \
- & FP_INFINITE) == 0)
-#define islessequal(x, y) ((__fp_unordered_compare(y, x) \
- & FP_INFINITE) == 0)
-#define islessgreater(x, y) ((__fp_unordered_compare(x, y) \
- & FP_SUBNORMAL) == 0)
-#define isunordered(x, y) ((__fp_unordered_compare(x, y) \
- & 0x4500) == 0x4500)
-
-#endif
-
-/* round, using fpu control word settings */
-extern __inline__ double rint (double x)
-{
- double retval;
- __asm__ ("frndint;": "=t" (retval) : "0" (x));
- return retval;
-}
-
-extern __inline__ float rintf (float x)
-{
- float retval;
- __asm__ ("frndint;" : "=t" (retval) : "0" (x) );
- return retval;
-}
-
-extern __inline__ long double rintl (long double x)
-{
- long double retval;
- __asm__ ("frndint;" : "=t" (retval) : "0" (x) );
- return retval;
-}
-
-/* round away from zero, regardless of fpu control word settings */
-extern double round (double);
-extern float roundf (float);
-extern long double roundl (long double);
-
-
-/* round towards zero, regardless of fpu control word settings */
-extern double trunc (double);
-extern float truncf (float);
-extern long double truncl (long double);
-
-
-/* fmax and fmin.
- NaN arguments are treated as missing data: if one argument is a NaN
- and the other numeric, then these functions choose the numeric
- value. */
-
-extern double fmax (double, double);
-extern float fmaxf (float, float);
-extern long double fmaxl (long double, long double);
-
-extern double fmin (double, double);
-extern float fminf (float, float);
-extern long double fminl (long double, long double);
-
-/* return x * y + z as a ternary op */
-extern double fma (double, double, double);
-extern float fmaf (float, float, float);
-extern long double fmal (long double, long double, long double);
-
-/* x > y ? (x - y) : 0.0 */
-extern double fdim (double, double);
-extern float fdimf (float, float);
-extern long double fdiml (long double, long double);
-
-/* one lonely transcendental */
-extern double log2 (double _x);
-extern float log2f (float _x);
-extern long double log2l (long double _x);
-#endif /* __STDC_VERSION__ >= 199901L */
-
-
-/* The underscored versions for double are in MSVCRT.dll.
- The stubs for float and double versions are in libmingwex.a */
-
-double copysign (double, double);
-float copysignf (float, float);
-long double copysignl (long double, long double);
-
-double logb (double);
-float logbf (float);
-double nextafter (double, double);
-float nextafterf (float, float);
-double scalb (double, long);
-float scalbf (float, long);
-
-#if !defined (__STRICT_ANSI__) /* inline using non-ANSI functions */
-extern __inline__ double copysign (double x, double y)
- { return _copysign(x, y); }
-extern __inline__ float copysignf (float x, float y)
- { return _copysign(x, y); }
-extern __inline__ double logb (double x)
- { return _logb(x); }
-extern __inline__ float logbf (float x)
- { return _logb(x); }
-extern __inline__ double nextafter(double x, double y)
- { return _nextafter(x, y); }
-extern __inline__ float nextafterf(float x, float y)
- { return _nextafter(x, y); }
-extern __inline__ double scalb (double x, long i)
- { return _scalb (x, i); }
-extern __inline__ float scalbf (float x, long i)
- { return _scalb(x, i); }
-#endif /* (__STRICT_ANSI__) */
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* Not RC_INVOKED */
-
-#endif /* __NO_ISOCEXT */
-
-#endif /* Not _MATH_H_ */
-
diff --git a/winsup/mingw/include/mbctype.h b/winsup/mingw/include/mbctype.h
deleted file mode 100644
index 346e6d790..000000000
--- a/winsup/mingw/include/mbctype.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * mbctype.h
- *
- * Functions for testing multibyte character types and converting characters.
- *
- * This file is part of the Mingw32 package.
- *
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- */
-
-#ifndef _MBCTYPE_H_
-#define _MBCTYPE_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-/* return values for _mbsbtype and _mbbtype in mbstring.h */
-#define _MBC_SINGLE 0
-#define _MBC_LEAD 1
-#define _MBC_TRAIL 2
-#define _MBC_ILLEGAL (-1)
-
-/* args for setmbcp (in lieu of actual codepage) */
-#define _MB_CP_SBCS 0
-#define _MB_CP_OEM (-2)
-#define _MB_CP_ANSI (-3)
-#define _MB_CP_LOCALE (-4)
-
-/* TODO: bit masks */
-/*
-#define _MS
-#define _MP
-#define _M1
-#define _M2
-#define _SBUP
-#define _SBLOW
-*/
-
-#ifndef RC_INVOKED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef __STRICT_ANSI__
-
-int _setmbcp (int);
-int _getmbcp (void);
-
-/* byte classification */
-/* NB: Corresponding _ismbc* functions are in mbstring.h */
-
-int _ismbbalpha (unsigned int);
-int _ismbbalnum (unsigned int);
-int _ismbbgraph (unsigned int);
-int _ismbbprint (unsigned int);
-int _ismbbpunct (unsigned int);
-
-int _ismbbkana (unsigned int);
-int _ismbbkalnum (unsigned int);
-int _ismbbkprint (unsigned int);
-int _ismbbkpunct (unsigned int);
-
-
-/* these are also in mbstring.h */
-int _ismbblead (unsigned int);
-int _ismbbtrail (unsigned int);
-int _ismbslead (const unsigned char*, const unsigned char*);
-int _ismbstrail (const unsigned char*, const unsigned char*);
-
-#ifdef __DECLSPEC_SUPPORTED
-__MINGW_IMPORT unsigned char _mbctype[];
-__MINGW_IMPORT unsigned char _mbcasemap[];
-#endif
-
-/* TODO : _MBCS_ mappings go in tchar.h */
-
-#endif /* Not strict ANSI */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not _MCTYPE_H_ */
-
diff --git a/winsup/mingw/include/mbstring.h b/winsup/mingw/include/mbstring.h
deleted file mode 100644
index d4afc1a54..000000000
--- a/winsup/mingw/include/mbstring.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * mbstring.h
- *
- * Protototypes for string functions supporting multibyte characters.
- *
- * This file is part of the Mingw32 package.
- *
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- */
-
-#ifndef _MBSTRING_H_
-#define _MBSTRING_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-#ifndef RC_INVOKED
-
-#define __need_size_t
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef __STRICT_ANSI__
-
-/* character classification */
-int _ismbcalnum (unsigned int);
-int _ismbcalpha (unsigned int);
-int _ismbcdigit (unsigned int);
-int _ismbcgraph (unsigned int);
-int _ismbcprint (unsigned int);
-int _ismbcpunct (unsigned int);
-int _ismbcspace (unsigned int);
-int _ismbclower (unsigned int);
-int _ismbcupper (unsigned int);
-int _ismbclegal (unsigned int);
-int _ismbcsymbol (unsigned int);
-
-
-/* also in mbctype.h */
-int _ismbblead (unsigned int );
-int _ismbbtrail (unsigned int );
-int _ismbslead ( const unsigned char*, const unsigned char*);
-int _ismbstrail ( const unsigned char*, const unsigned char*);
-
-unsigned int _mbctolower (unsigned int);
-unsigned int _mbctoupper (unsigned int);
-
-void _mbccpy (unsigned char*, const unsigned char*);
-size_t _mbclen (const unsigned char*);
-
-unsigned int _mbbtombc (unsigned int);
-unsigned int _mbctombb (unsigned int);
-
-/* Return value constants for these are defined in mbctype.h. */
-int _mbbtype (unsigned char, int);
-int _mbsbtype (const unsigned char*, size_t);
-
-unsigned char* _mbscpy (unsigned char*, const unsigned char*);
-unsigned char* _mbsncpy (unsigned char*, const unsigned char*, size_t);
-unsigned char* _mbsnbcpy (unsigned char*, const unsigned char*, size_t);
-unsigned char* _mbsset (unsigned char*, unsigned int);
-unsigned char* _mbsnset (unsigned char*, unsigned int, size_t);
-unsigned char* _mbsnbset (unsigned char*, unsigned int, size_t);
-unsigned char* _mbsdup (const unsigned char*);
-unsigned char* _mbsrev (unsigned char*);
-unsigned char* _mbscat (unsigned char*, const unsigned char*); /* also in string.h */
-unsigned char* _mbsncat (unsigned char*, const unsigned char*, size_t);
-unsigned char* _mbsnbcat (unsigned char*, const unsigned char*, size_t);
-size_t _mbslen (const unsigned char*);
-size_t _mbsnbcnt (const unsigned char*, size_t);
-size_t _mbsnccnt (const unsigned char*, size_t);
-unsigned char* _mbschr (const unsigned char*, unsigned int); /* also in string.h */
-unsigned char* _mbsrchr (const unsigned char*, unsigned int);
-size_t _mbsspn (const unsigned char*, const unsigned char*);
-size_t _mbscspn (const unsigned char*, const unsigned char*);
-unsigned char* _mbsspnp (const unsigned char*, const unsigned char*);
-unsigned char* _mbspbrk (const unsigned char*, const unsigned char*);
-int _mbscmp (const unsigned char*, const unsigned char*);
-int _mbsicmp (const unsigned char*, const unsigned char*);
-int _mbsncmp (const unsigned char*, const unsigned char*, size_t);
-int _mbsnicmp (const unsigned char*, const unsigned char*, size_t);
-int _mbsnbcmp (const unsigned char*, const unsigned char*, size_t);
-int _mbsnbicmp (const unsigned char*, const unsigned char*, size_t);
-int _mbscoll (const unsigned char*, const unsigned char*);
-int _mbsicoll (const unsigned char*, const unsigned char*);
-int _mbsncoll (const unsigned char*, const unsigned char*, size_t);
-int _mbsnicoll (const unsigned char*, const unsigned char*, size_t);
-int _mbsnbcoll (const unsigned char*, const unsigned char*, size_t);
-int _mbsnbicoll (const unsigned char*, const unsigned char*, size_t);
-
-unsigned char* _mbsinc (const unsigned char*);
-unsigned char* _mbsninc (const unsigned char*, size_t);
-unsigned char* _mbsdec (const unsigned char*, const unsigned char*);
-unsigned int _mbsnextc (const unsigned char*);
-unsigned char* _mbslwr (unsigned char*);
-unsigned char* _mbsupr (unsigned char*);
-unsigned char* _mbstok (unsigned char*, const unsigned char*); /* also in string.h */
-
-/* Kanji */
-int _ismbchira (unsigned int);
-int _ismbckata (unsigned int);
-int _ismbcl0 (unsigned int);
-int _ismbcl1 (unsigned int);
-int _ismbcl2 (unsigned int);
-unsigned int _mbcjistojms (unsigned int);
-unsigned int _mbcjmstojis (unsigned int);
-unsigned int _mbctohira (unsigned int);
-unsigned int _mbctokata (unsigned int);
-
-#endif /* Not strict ANSI */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-#endif /* Not _MBSTRING_H_ */
-
-
diff --git a/winsup/mingw/include/mem.h b/winsup/mingw/include/mem.h
deleted file mode 100644
index 20c8fa4a5..000000000
--- a/winsup/mingw/include/mem.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * This file is part of the Mingw32 package.
- *
- * mem.h maps to string.h
- */
-#ifndef __STRICT_ANSI__
-#include <string.h>
-#endif
diff --git a/winsup/mingw/include/memory.h b/winsup/mingw/include/memory.h
deleted file mode 100644
index e0c91d635..000000000
--- a/winsup/mingw/include/memory.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * This file is part of the Mingw32 package.
- *
- * memory.h maps to the standard string.h header.
- */
-#ifndef __STRICT_ANSI__
-#include <string.h>
-#endif
-
diff --git a/winsup/mingw/include/process.h b/winsup/mingw/include/process.h
deleted file mode 100644
index adf19e8cd..000000000
--- a/winsup/mingw/include/process.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * process.h
- *
- * Function calls for spawning child processes.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef __STRICT_ANSI__
-
-#ifndef _PROCESS_H_
-#define _PROCESS_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-/* Includes a definition of _pid_t and pid_t */
-#include <sys/types.h>
-
-/*
- * Constants for cwait actions.
- * Obsolete for Win32.
- */
-#define _WAIT_CHILD 0
-#define _WAIT_GRANDCHILD 1
-
-#ifndef _NO_OLDNAMES
-#define WAIT_CHILD _WAIT_CHILD
-#define WAIT_GRANDCHILD _WAIT_GRANDCHILD
-#endif /* Not _NO_OLDNAMES */
-
-/*
- * Mode constants for spawn functions.
- */
-#define _P_WAIT 0
-#define _P_NOWAIT 1
-#define _P_OVERLAY 2
-#define _OLD_P_OVERLAY _P_OVERLAY
-#define _P_NOWAITO 3
-#define _P_DETACH 4
-
-#ifndef _NO_OLDNAMES
-#define P_WAIT _P_WAIT
-#define P_NOWAIT _P_NOWAIT
-#define P_OVERLAY _P_OVERLAY
-#define OLD_P_OVERLAY _OLD_P_OVERLAY
-#define P_NOWAITO _P_NOWAITO
-#define P_DETACH _P_DETACH
-#endif /* Not _NO_OLDNAMES */
-
-
-#ifndef RC_INVOKED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void _cexit(void);
-void _c_exit(void);
-
-int _cwait (int*, _pid_t, int);
-
-_pid_t _getpid(void);
-
-int _execl (const char*, const char*, ...);
-int _execle (const char*, const char*, ...);
-int _execlp (const char*, const char*, ...);
-int _execlpe (const char*, const char*, ...);
-int _execv (const char*, char* const*);
-int _execve (const char*, char* const*, char* const*);
-int _execvp (const char*, char* const*);
-int _execvpe (const char*, char* const*, char* const*);
-
-int _spawnl (int, const char*, const char*, ...);
-int _spawnle (int, const char*, const char*, ...);
-int _spawnlp (int, const char*, const char*, ...);
-int _spawnlpe (int, const char*, const char*, ...);
-int _spawnv (int, const char*, char* const*);
-int _spawnve (int, const char*, char* const*, char* const*);
-int _spawnvp (int, const char*, char* const*);
-int _spawnvpe (int, const char*, char* const*, char* const*);
-
-/*
- * The functions _beginthreadex and _endthreadex are not provided by CRTDLL.
- * They are provided by MSVCRT.
- *
- * NOTE: Apparently _endthread calls CloseHandle on the handle of the thread,
- * making for race conditions if you are not careful. Basically you have to
- * make sure that no-one is going to do *anything* with the thread handle
- * after the thread calls _endthread or returns from the thread function.
- *
- * NOTE: No old names for these functions. Use the underscore.
- */
-unsigned long
- _beginthread (void (*)(void *), unsigned, void*);
-void _endthread (void);
-
-#ifdef __MSVCRT__
-unsigned long
- _beginthreadex (void *, unsigned, unsigned (__stdcall *) (void *),
- void*, unsigned, unsigned*);
-void _endthreadex (unsigned);
-#endif
-
-
-#ifndef _NO_OLDNAMES
-/*
- * Functions without the leading underscore, for portability. These functions
- * live in liboldnames.a.
- */
-int cwait (int*, pid_t, int);
-pid_t getpid (void);
-int execl (const char*, const char*, ...);
-int execle (const char*, const char*, ...);
-int execlp (const char*, const char*, ...);
-int execlpe (const char*, const char*, ...);
-int execv (const char*, char* const*);
-int execve (const char*, char* const*, char* const*);
-int execvp (const char*, char* const*);
-int execvpe (const char*, char* const*, char* const*);
-int spawnl (int, const char*, const char*, ...);
-int spawnle (int, const char*, const char*, ...);
-int spawnlp (int, const char*, const char*, ...);
-int spawnlpe (int, const char*, const char*, ...);
-int spawnv (int, const char*, char* const*);
-int spawnve (int, const char*, char* const*, char* const*);
-int spawnvp (int, const char*, char* const*);
-int spawnvpe (int, const char*, char* const*, char* const*);
-#endif /* Not _NO_OLDNAMES */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* _PROCESS_H_ not defined */
-
-#endif /* Not __STRICT_ANSI__ */
-
diff --git a/winsup/mingw/include/setjmp.h b/winsup/mingw/include/setjmp.h
deleted file mode 100644
index 89f045f60..000000000
--- a/winsup/mingw/include/setjmp.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * setjmp.h
- *
- * Declarations supporting setjmp and longjump, a method for avoiding
- * the normal function call return sequence. (Bleah!)
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef _SETJMP_H_
-#define _SETJMP_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-#ifndef RC_INVOKED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * The buffer used by setjmp to store the information used by longjmp
- * to perform it's evil goto-like work. The size of this buffer was
- * determined through experimentation; it's contents are a mystery.
- * NOTE: This was determined on an i386 (actually a Pentium). The
- * contents could be different on an Alpha or something else.
- */
-#define _JBLEN 16
-#define _JBTYPE int
-typedef _JBTYPE jmp_buf[_JBLEN];
-
-/*
- * The function provided by CRTDLL which appears to do the actual work
- * of setjmp.
- */
-int _setjmp (jmp_buf);
-
-#define setjmp(x) _setjmp(x)
-
-/*
- * Return to the last setjmp call and act as if setjmp had returned
- * nVal (which had better be non-zero!).
- */
-void longjmp (jmp_buf, int);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not _SETJMP_H_ */
-
diff --git a/winsup/mingw/include/share.h b/winsup/mingw/include/share.h
deleted file mode 100644
index 7c4b1c6b0..000000000
--- a/winsup/mingw/include/share.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * share.h
- *
- * Constants for file sharing functions.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef __STRICT_ANSI__
-
-#ifndef _SHARE_H_
-#define _SHARE_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-#define SH_COMPAT 0x00 /* Compatibility */
-#define SH_DENYRW 0x10 /* Deny read/write */
-#define SH_DENYWR 0x20 /* Deny write */
-#define SH_DENYRD 0x30 /* Deny read */
-#define SH_DENYNO 0x40 /* Deny nothing */
-
-#endif /* Not _SHARE_H_ */
-
-#endif /* Not __STRICT_ANSI__ */
-
diff --git a/winsup/mingw/include/signal.h b/winsup/mingw/include/signal.h
deleted file mode 100644
index 4298accb7..000000000
--- a/winsup/mingw/include/signal.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * signal.h
- *
- * A way to set handlers for exceptional conditions (also known as signals).
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef _SIGNAL_H_
-#define _SIGNAL_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-/*
- * The actual signal values. Using other values with signal
- * produces a SIG_ERR return value.
- *
- * NOTE: SIGINT is produced when the user presses Ctrl-C.
- * SIGILL has not been tested.
- * SIGFPE doesn't seem to work?
- * SIGSEGV does not catch writing to a NULL pointer (that shuts down
- * your app; can you say "segmentation violation core dump"?).
- * SIGTERM comes from what kind of termination request exactly?
- * SIGBREAK is indeed produced by pressing Ctrl-Break.
- * SIGABRT is produced by calling abort.
- * TODO: The above results may be related to not installing an appropriate
- * structured exception handling frame. Results may be better if I ever
- * manage to get the SEH stuff down.
- */
-#define SIGINT 2 /* Interactive attention */
-#define SIGILL 4 /* Illegal instruction */
-#define SIGFPE 8 /* Floating point error */
-#define SIGSEGV 11 /* Segmentation violation */
-#define SIGTERM 15 /* Termination request */
-#define SIGBREAK 21 /* Control-break */
-#define SIGABRT 22 /* Abnormal termination (abort) */
-
-#define NSIG 23 /* maximum signal number + 1 */
-
-#ifndef RC_INVOKED
-
-#ifndef _SIG_ATOMIC_T_DEFINED
-typedef int sig_atomic_t;
-#define _SIG_ATOMIC_T_DEFINED
-#endif
-
-/*
- * The prototypes (below) are the easy part. The hard part is figuring
- * out what signals are available and what numbers they are assigned
- * along with appropriate values of SIG_DFL and SIG_IGN.
- */
-
-/*
- * A pointer to a signal handler function. A signal handler takes a
- * single int, which is the signal it handles.
- */
-typedef void (*__p_sig_fn_t)(int);
-
-/*
- * These are special values of signal handler pointers which are
- * used to send a signal to the default handler (SIG_DFL), ignore
- * the signal (SIG_IGN), or indicate an error return (SIG_ERR).
- */
-#define SIG_DFL ((__p_sig_fn_t) 0)
-#define SIG_IGN ((__p_sig_fn_t) 1)
-#define SIG_ERR ((__p_sig_fn_t) -1)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Call signal to set the signal handler for signal sig to the
- * function pointed to by handler. Returns a pointer to the
- * previous handler, or SIG_ERR if an error occurs. Initially
- * unhandled signals defined above will return SIG_DFL.
- */
-__p_sig_fn_t signal(int, __p_sig_fn_t);
-
-/*
- * Raise the signal indicated by sig. Returns non-zero on success.
- */
-int raise (int);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not _SIGNAL_H_ */
-
diff --git a/winsup/mingw/include/stdarg.h b/winsup/mingw/include/stdarg.h
deleted file mode 100644
index 90a2d95a0..000000000
--- a/winsup/mingw/include/stdarg.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * This is just an RC_INVOKED guard for the real stdarg.h
- * fixincluded in gcc system dir. One day we will delete this file.
- */
-#ifndef RC_INVOKED
-#include_next<stdarg.h>
-#endif
diff --git a/winsup/mingw/include/stddef.h b/winsup/mingw/include/stddef.h
deleted file mode 100644
index ef9d5ffe4..000000000
--- a/winsup/mingw/include/stddef.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * This is just an RC_INVOKED guard for the real stddef.h
- * fixincluded in gcc system dir. One day we will delete this file.
- */
-#ifndef RC_INVOKED
-#include_next<stddef.h>
-#endif
diff --git a/winsup/mingw/include/stdint.h b/winsup/mingw/include/stdint.h
deleted file mode 100644
index ec1566db2..000000000
--- a/winsup/mingw/include/stdint.h
+++ /dev/null
@@ -1,186 +0,0 @@
-/* ISO C9x 7.18 Integer types <stdint.h>
- * Based on ISO/IEC SC22/WG14 9899 Committee draft (SC22 N2794)
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * Contributor: Danny Smith <danny_r_smith_2001@yahoo.co.nz>
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Date: 2000-12-02
- */
-
-
-#ifndef _STDINT_H
-#define _STDINT_H
-#define __need_wint_t
-#define __need_wchar_t
-#include <stddef.h>
-
-/* 7.18.1.1 Exact-width integer types */
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef short int16_t;
-typedef unsigned short uint16_t;
-typedef int int32_t;
-typedef unsigned uint32_t;
-typedef long long int64_t;
-typedef unsigned long long uint64_t;
-
-/* 7.18.1.2 Minimum-width integer types */
-typedef signed char int_least8_t;
-typedef unsigned char uint_least8_t;
-typedef short int_least16_t;
-typedef unsigned short uint_least16_t;
-typedef int int_least32_t;
-typedef unsigned uint_least32_t;
-typedef long long int_least64_t;
-typedef unsigned long long uint_least64_t;
-
-/* 7.18.1.3 Fastest minimum-width integer types
- * Not actually guaranteed to be fastest for all purposes
- * Here we use the exact-width types for 8 and 16-bit ints.
- */
-typedef char int_fast8_t;
-typedef unsigned char uint_fast8_t;
-typedef short int_fast16_t;
-typedef unsigned short uint_fast16_t;
-typedef int int_fast32_t;
-typedef unsigned int uint_fast32_t;
-typedef long long int_fast64_t;
-typedef unsigned long long uint_fast64_t;
-
-/* 7.18.1.4 Integer types capable of holding object pointers */
-typedef int intptr_t;
-typedef unsigned uintptr_t;
-
-/* 7.18.1.5 Greatest-width integer types */
-typedef long long intmax_t;
-typedef unsigned long long uintmax_t;
-
-/* 7.18.2 Limits of specified-width integer types */
-#if !defined ( __cplusplus) || defined (__STDC_LIMIT_MACROS)
-
-/* 7.18.2.1 Limits of exact-width integer types */
-#define INT8_MIN (-128)
-#define INT16_MIN (-32768)
-#define INT32_MIN (-2147483647 - 1)
-#define INT64_MIN (-9223372036854775807LL - 1)
-
-#define INT8_MAX 127
-#define INT16_MAX 32767
-#define INT32_MAX 2147483647
-#define INT64_MAX 9223372036854775807LL
-
-#define UINT8_MAX 0xff /* 255U */
-#define UINT16_MAX 0xffff /* 65535U */
-#define UINT32_MAX 0xffffffff /* 4294967295U */
-#define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */
-
-/* 7.18.2.2 Limits of minimum-width integer types */
-#define INT_LEAST8_MIN INT8_MIN
-#define INT_LEAST16_MIN INT16_MIN
-#define INT_LEAST32_MIN INT32_MIN
-#define INT_LEAST64_MIN INT64_MIN
-
-#define INT_LEAST8_MAX INT8_MAX
-#define INT_LEAST16_MAX INT16_MAX
-#define INT_LEAST32_MAX INT32_MAX
-#define INT_LEAST64_MAX INT64_MAX
-
-#define UINT_LEAST8_MAX UINT8_MAX
-#define UINT_LEAST16_MAX UINT16_MAX
-#define UINT_LEAST32_MAX UINT32_MAX
-#define UINT_LEAST64_MAX UINT64_MAX
-
-/* 7.18.2.3 Limits of fastest minimum-width integer types */
-#define INT_FAST8_MIN INT8_MIN
-#define INT_FAST16_MIN INT16_MIN
-#define INT_FAST32_MIN INT32_MIN
-#define INT_FAST64_MIN INT64_MIN
-
-#define INT_FAST8_MAX INT8_MAX
-#define INT_FAST16_MAX INT16_MAX
-#define INT_FAST32_MAX INT32_MAX
-#define INT_FAST64_MAX INT64_MAX
-
-#define UINT_FAST8_MAX UINT8_MAX
-#define UINT_FAST16_MAX UINT16_MAX
-#define UINT_FAST32_MAX UINT32_MAX
-#define UINT_FAST64_MAX UINT64_MAX
-
-/* 7.18.2.4 Limits of integer types capable of holding
- object pointers */
-#define INTPTR_MIN INT32_MIN
-#define INTPTR_MAX INT32_MAX
-#define UINTPTR_MAX UINT32_MAX
-
-/* 7.18.2.5 Limits of greatest-width integer types */
-#define INTMAX_MIN INT64_MIN
-#define INTMAX_MAX INT64_MAX
-#define UINTMAX_MAX UINT64_MAX
-
-/* 7.18.3 Limits of other integer types */
-#define PTRDIFF_MIN INT32_MIN
-#define PTRDIFF_MAX INT32_MAX
-
-#define SIG_ATOMIC_MIN INT32_MIN
-#define SIG_ATOMIC_MAX INT32_MAX
-
-#define SIZE_MAX UINT32_MAX
-
-#ifndef WCHAR_MIN /* also in wchar.h */
-#define WCHAR_MIN 0
-#define WCHAR_MAX ((wchar_t)-1) /* UINT16_MAX */
-#endif
-
-/*
- * wint_t is unsigned short for compatibility with MS runtime
- */
-#define WINT_MIN 0
-#define WINT_MAX ((wint_t)-1) /* UINT16_MAX */
-
-#endif /* !defined ( __cplusplus) || defined __STDC_LIMIT_MACROS */
-
-
-/* 7.18.4 Macros for integer constants */
-#if !defined ( __cplusplus) || defined (__STDC_CONSTANT_MACROS)
-
-/* 7.18.4.1 Macros for minimum-width integer constants
-
- Accoding to Douglas Gwyn <gwyn@arl.mil>:
- "This spec was changed in ISO/IEC 9899:1999 TC1; in ISO/IEC
- 9899:1999 as initially published, the expansion was required
- to be an integer constant of precisely matching type, which
- is impossible to accomplish for the shorter types on most
- platforms, because C99 provides no standard way to designate
- an integer constant with width less than that of type int.
- TC1 changed this to require just an integer constant
- *expression* with *promoted* type."
-
- The trick used here is from Clive D W Feather.
-*/
-
-#define INT8_C(val) (INT_LEAST8_MAX-INT_LEAST8_MAX+(val))
-#define INT16_C(val) (INT_LEAST16_MAX-INT_LEAST16_MAX+(val))
-#define INT32_C(val) (INT_LEAST32_MAX-INT_LEAST32_MAX+(val))
-#define INT64_C(val) (INT_LEAST64_MAX-INT_LEAST64_MAX+(val))
-
-#define UINT8_C(val) (UINT_LEAST8_MAX-UINT_LEAST8_MAX+(val))
-#define UINT16_C(val) (UINT_LEAST16_MAX-UINT_LEAST16_MAX+(val))
-#define UINT32_C(val) (UINT_LEAST32_MAX-UINT_LEAST32_MAX+(val))
-#define UINT64_C(val) (UINT_LEAST64_MAX-UINT_LEAST64_MAX+(val))
-
-/* 7.18.4.2 Macros for greatest-width integer constants */
-#define INTMAX_C(val) (INTMAX_MAX-INTMAX_MAX+(val))
-#define UINTMAX_C(val) (UINTMAX_MAX-UINTMAX_MAX+(val))
-
-#endif /* !defined ( __cplusplus) || defined __STDC_CONSTANT_MACROS */
-
-#endif
diff --git a/winsup/mingw/include/stdio.h b/winsup/mingw/include/stdio.h
deleted file mode 100644
index fd5827ad0..000000000
--- a/winsup/mingw/include/stdio.h
+++ /dev/null
@@ -1,407 +0,0 @@
-/*
- * stdio.h
- *
- * Definitions of types and prototypes of functions for standard input and
- * output.
- *
- * NOTE: The file manipulation functions provided by Microsoft seem to
- * work with either slash (/) or backslash (\) as the path separator.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef _STDIO_H_
-#define _STDIO_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-#ifndef RC_INVOKED
-#define __need_size_t
-#define __need_NULL
-#define __need_wchar_t
-#define __need_wint_t
-#include <stddef.h>
-#define __need___va_list
-#include <stdarg.h>
-#endif /* Not RC_INVOKED */
-
-
-/* Flags for the iobuf structure */
-#define _IOREAD 1
-#define _IOWRT 2
-#define _IORW 0x0080 /* opened as "r+w" */
-
-
-/*
- * The three standard file pointers provided by the run time library.
- * NOTE: These will go to the bit-bucket silently in GUI applications!
- */
-#define STDIN_FILENO 0
-#define STDOUT_FILENO 1
-#define STDERR_FILENO 2
-
-/* Returned by various functions on end of file condition or error. */
-#define EOF (-1)
-
-/*
- * The maximum length of a file name. You should use GetVolumeInformation
- * instead of this constant. But hey, this works.
- *
- * NOTE: This is used in the structure _finddata_t (see io.h) so changing it
- * is probably not a good idea.
- */
-#define FILENAME_MAX (260)
-
-/*
- * The maximum number of files that may be open at once. I have set this to
- * a conservative number. The actual value may be higher.
- */
-#define FOPEN_MAX (20)
-
-/* After creating this many names, tmpnam and tmpfile return NULL */
-#define TMP_MAX 32767
-/*
- * Tmpnam, tmpfile and, sometimes, _tempnam try to create
- * temp files in the root directory of the current drive
- * (not in pwd, as suggested by some older MS doc's).
- * Redefining these macros does not effect the CRT functions.
- */
-#define _P_tmpdir "\\"
-#define _wP_tmpdir L"\\"
-
-/*
- * The maximum size of name (including NUL) that will be put in the user
- * supplied buffer caName for tmpnam.
- * Inferred from the size of the static buffer returned by tmpnam
- * when passed a NULL argument. May actually be smaller.
- */
-#define L_tmpnam (16)
-
-#define _IOFBF 0x0000
-#define _IOLBF 0x0040
-#define _IONBF 0x0004
-
-/*
- * The buffer size as used by setbuf such that it is equivalent to
- * (void) setvbuf(fileSetBuffer, caBuffer, _IOFBF, BUFSIZ).
- */
-#define BUFSIZ 512
-
-/* Constants for nOrigin indicating the position relative to which fseek
- * sets the file position. Enclosed in ifdefs because io.h could also
- * define them. (Though not anymore since io.h includes this file now.) */
-#ifndef SEEK_SET
-#define SEEK_SET (0)
-#endif
-
-#ifndef SEEK_CUR
-#define SEEK_CUR (1)
-#endif
-
-#ifndef SEEK_END
-#define SEEK_END (2)
-#endif
-
-
-#ifndef RC_INVOKED
-
-#ifdef __GNUC__
-#define __VALIST __gnuc_va_list
-#else
-#define __VALIST char*
-#endif
-
-/*
- * The structure underlying the FILE type.
- *
- * I still believe that nobody in their right mind should make use of the
- * internals of this structure. Provided by Pedro A. Aranda Gutiirrez
- * <paag@tid.es>.
- */
-#ifndef _FILE_DEFINED
-#define _FILE_DEFINED
-typedef struct _iobuf
-{
- char* _ptr;
- int _cnt;
- char* _base;
- int _flag;
- int _file;
- int _charbuf;
- int _bufsiz;
- char* _tmpfname;
-} FILE;
-#endif /* Not _FILE_DEFINED */
-
-
-/*
- * The standard file handles
- */
-#ifndef __DECLSPEC_SUPPORTED
-
-extern FILE (*_imp___iob)[]; /* A pointer to an array of FILE */
-
-#define _iob (*_imp___iob) /* An array of FILE */
-
-#else /* __DECLSPEC_SUPPORTED */
-
-__MINGW_IMPORT FILE _iob[]; /* An array of FILE imported from DLL. */
-
-#endif /* __DECLSPEC_SUPPORTED */
-
-#define stdin (&_iob[STDIN_FILENO])
-#define stdout (&_iob[STDOUT_FILENO])
-#define stderr (&_iob[STDERR_FILENO])
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * File Operations
- */
-FILE* fopen (const char*, const char*);
-FILE* freopen (const char*, const char*, FILE*);
-int fflush (FILE*);
-int fclose (FILE*);
-/* MS puts remove & rename (but not wide versions) in io.h also */
-int remove (const char*);
-int rename (const char*, const char*);
-FILE* tmpfile (void);
-char* tmpnam (char*);
-char* _tempnam (const char*, const char*);
-
-#ifndef NO_OLDNAMES
-char* tempnam (const char*, const char*);
-#endif
-
-int setvbuf (FILE*, char*, int, size_t);
-
-void setbuf (FILE*, char*);
-
-/*
- * Formatted Output
- */
-
-int fprintf (FILE*, const char*, ...);
-int printf (const char*, ...);
-int sprintf (char*, const char*, ...);
-int _snprintf (char*, size_t, const char*, ...);
-int vfprintf (FILE*, const char*, __VALIST);
-int vprintf (const char*, __VALIST);
-int vsprintf (char*, const char*, __VALIST);
-int _vsnprintf (char*, size_t, const char*, __VALIST);
-
-#ifndef __NO_ISOCEXT /* externs in libmingwex.a */
-int snprintf(char* s, size_t n, const char* format, ...);
-extern __inline__ int vsnprintf (char* s, size_t n, const char* format,
- __VALIST arg)
- { return _vsnprintf ( s, n, format, arg); }
-#endif
-
-/*
- * Formatted Input
- */
-
-int fscanf (FILE*, const char*, ...);
-int scanf (const char*, ...);
-int sscanf (const char*, const char*, ...);
-/*
- * Character Input and Output Functions
- */
-
-int fgetc (FILE*);
-char* fgets (char*, int, FILE*);
-int fputc (int, FILE*);
-int fputs (const char*, FILE*);
-int getc (FILE*);
-int getchar (void);
-char* gets (char*);
-int putc (int, FILE*);
-int putchar (int);
-int puts (const char*);
-int ungetc (int, FILE*);
-
-/*
- * Direct Input and Output Functions
- */
-
-size_t fread (void*, size_t, size_t, FILE*);
-size_t fwrite (const void*, size_t, size_t, FILE*);
-
-/*
- * File Positioning Functions
- */
-
-int fseek (FILE*, long, int);
-long ftell (FILE*);
-void rewind (FILE*);
-
-#ifdef __USE_MINGW_FSEEK /* These are in libmingwex.a */
-/*
- * Workaround for limitations on win9x where a file contents are
- * not zero'd out if you seek past the end and then write.
- */
-
-int __mingw_fseek (FILE *, long, int);
-int __mingw_fwrite (const void*, size_t, size_t, FILE*);
-#define fseek(fp, offset, whence) __mingw_fseek(fp, offset, whence)
-#define fwrite(buffer, size, count, fp) __mingw_fwrite(buffer, size, count, fp)
-#endif /* __USE_MINGW_FSEEK */
-
-/*
- * An opaque data type used for storing file positions... The contents of
- * this type are unknown, but we (the compiler) need to know the size
- * because the programmer using fgetpos and fsetpos will be setting aside
- * storage for fpos_t structres. Actually I tested using a byte array and
- * it is fairly evident that the fpos_t type is a long (in CRTDLL.DLL).
- * Perhaps an unsigned long? TODO? It's definitely a 64-bit number in
- * MSVCRT however, and for now `long long' will do.
- */
-#ifdef __MSVCRT__
-typedef long long fpos_t;
-#else
-typedef long fpos_t;
-#endif
-
-int fgetpos (FILE*, fpos_t*);
-int fsetpos (FILE*, const fpos_t*);
-
-/*
- * Error Functions
- */
-
-void clearerr (FILE*);
-int feof (FILE*);
-int ferror (FILE*);
-void perror (const char*);
-
-
-#ifndef __STRICT_ANSI__
-/*
- * Pipes
- */
-FILE* _popen (const char*, const char*);
-int _pclose (FILE*);
-
-#ifndef NO_OLDNAMES
-FILE* popen (const char*, const char*);
-int pclose (FILE*);
-#endif
-
-/*
- * Other Non ANSI functions
- */
-int _flushall (void);
-int _fgetchar (void);
-int _fputchar (int);
-FILE* _fdopen (int, const char*);
-int _fileno (FILE*);
-
-#ifndef _NO_OLDNAMES
-int fgetchar (void);
-int fputchar (int);
-FILE* fdopen (int, const char*);
-int fileno (FILE*);
-#endif /* Not _NO_OLDNAMES */
-
-#endif /* Not __STRICT_ANSI__ */
-
-/* Wide versions */
-
-#ifndef _WSTDIO_DEFINED
-/* also in wchar.h - keep in sync */
-int fwprintf (FILE*, const wchar_t*, ...);
-int wprintf (const wchar_t*, ...);
-int swprintf (wchar_t*, const wchar_t*, ...);
-int _snwprintf (wchar_t*, size_t, const wchar_t*, ...);
-int vfwprintf (FILE*, const wchar_t*, __VALIST);
-int vwprintf (const wchar_t*, __VALIST);
-int vswprintf (wchar_t*, const wchar_t*, __VALIST);
-int _vsnwprintf (wchar_t*, size_t, const wchar_t*, __VALIST);
-int fwscanf (FILE*, const wchar_t*, ...);
-int wscanf (const wchar_t*, ...);
-int swscanf (const wchar_t*, const wchar_t*, ...);
-wint_t fgetwc (FILE*);
-wint_t fputwc (wchar_t, FILE*);
-wint_t ungetwc (wchar_t, FILE*);
-#ifdef __MSVCRT__
-wchar_t* fgetws (wchar_t*, int, FILE*);
-int fputws (const wchar_t*, FILE*);
-wint_t getwc (FILE*);
-wint_t getwchar (void);
-wchar_t* _getws (wchar_t*);
-wint_t putwc (wint_t, FILE*);
-int _putws (const wchar_t*);
-wint_t putwchar (wint_t);
-FILE* _wfopen (const wchar_t*, const wchar_t*);
-FILE* _wfreopen (const wchar_t*, const wchar_t*, FILE*);
-FILE* _wfsopen (const wchar_t*, const wchar_t*, int);
-wchar_t* _wtmpnam (wchar_t*);
-wchar_t* _wtempnam (const wchar_t*, const wchar_t*);
-int _wrename (const wchar_t*, const wchar_t*);
-int _wremove (const wchar_t*);
-void _wperror (const wchar_t*);
-FILE* _wpopen (const wchar_t*, const wchar_t*);
-#endif /* __MSVCRT__ */
-
-#ifndef __NO_ISOCEXT /* externs in libmingwex.a */
-int snwprintf(wchar_t* s, size_t n, const wchar_t* format, ...);
-extern __inline__ int
-vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, __VALIST arg)
- { return _vsnwprintf ( s, n, format, arg);}
-#endif
-
-#define _WSTDIO_DEFINED
-#endif /* _WSTDIO_DEFINED */
-
-#ifndef __STRICT_ANSI__
-#ifdef __MSVCRT__
-#ifndef NO_OLDNAMES
-FILE* wpopen (const wchar_t*, const wchar_t*);
-#endif /* not NO_OLDNAMES */
-#endif /* MSVCRT runtime */
-
-/*
- * Other Non ANSI wide functions
- */
-wint_t _fgetwchar (void);
-wint_t _fputwchar (wint_t);
-int _getw (FILE*);
-int _putw (int, FILE*);
-
-#ifndef _NO_OLDNAMES
-wint_t fgetwchar (void);
-wint_t fputwchar (wint_t);
-int getw (FILE*);
-int putw (int, FILE*);
-#endif /* Not _NO_OLDNAMES */
-
-#endif /* __STRICT_ANSI */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* _STDIO_H_ */
diff --git a/winsup/mingw/include/stdlib.h b/winsup/mingw/include/stdlib.h
deleted file mode 100644
index bc5884278..000000000
--- a/winsup/mingw/include/stdlib.h
+++ /dev/null
@@ -1,493 +0,0 @@
-/*
- * stdlib.h
- *
- * Definitions for common types, variables, and functions.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef _STDLIB_H_
-#define _STDLIB_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-
-#define __need_size_t
-#define __need_wchar_t
-#define __need_NULL
-#ifndef RC_INVOKED
-#include <stddef.h>
-#endif /* RC_INVOKED */
-
-/*
- * RAND_MAX is the maximum value that may be returned by rand.
- * The minimum is zero.
- */
-#define RAND_MAX 0x7FFF
-
-/*
- * These values may be used as exit status codes.
- */
-#define EXIT_SUCCESS 0
-#define EXIT_FAILURE 1
-
-/*
- * Definitions for path name functions.
- * NOTE: All of these values have simply been chosen to be conservatively high.
- * Remember that with long file names we can no longer depend on
- * extensions being short.
- */
-#ifndef __STRICT_ANSI__
-
-#ifndef MAX_PATH
-#define MAX_PATH (260)
-#endif
-
-#define _MAX_PATH MAX_PATH
-#define _MAX_DRIVE (3)
-#define _MAX_DIR 256
-#define _MAX_FNAME 256
-#define _MAX_EXT 256
-
-#endif /* Not __STRICT_ANSI__ */
-
-
-#ifndef RC_INVOKED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * This seems like a convenient place to declare these variables, which
- * give programs using WinMain (or main for that matter) access to main-ish
- * argc and argv. environ is a pointer to a table of environment variables.
- * NOTE: Strings in _argv and environ are ANSI strings.
- */
-extern int _argc;
-extern char** _argv;
-
-/* imports from runtime dll of the above variables */
-#ifdef __MSVCRT__
-
-extern int* __p___argc(void);
-extern char*** __p___argv(void);
-extern wchar_t*** __p___wargv(void);
-
-#define __argc (*__p___argc())
-#define __argv (*__p___argv())
-#define __wargv (*__p___wargv())
-
-#else /* !MSVCRT */
-
-#ifndef __DECLSPEC_SUPPORTED
-
-extern int* _imp____argc_dll;
-extern char*** _imp____argv_dll;
-#define __argc (*_imp____argc_dll)
-#define __argv (*_imp____argv_dll)
-
-#else /* __DECLSPEC_SUPPORTED */
-
-__MINGW_IMPORT int __argc_dll;
-__MINGW_IMPORT char** __argv_dll;
-#define __argc __argc_dll
-#define __argv __argv_dll
-
-#endif /* __DECLSPEC_SUPPORTED */
-
-#endif /* __MSVCRT */
-
-/*
- * Also defined in ctype.h.
- */
-
-/* Also defined in stdlib.h */
-#ifndef MB_CUR_MAX
-#ifdef __DECLSPEC_SUPPORTED
-# ifdef __MSVCRT__
-# define MB_CUR_MAX __mb_cur_max
- __MINGW_IMPORT int __mb_cur_max;
-# else /* not __MSVCRT */
-# define MB_CUR_MAX __mb_cur_max_dll
- __MINGW_IMPORT int __mb_cur_max_dll;
-# endif /* not __MSVCRT */
-
-#else /* ! __DECLSPEC_SUPPORTED */
-# ifdef __MSVCRT__
- extern int* _imp____mbcur_max
-# define MB_CUR_MAX (*_imp____mb_cur_max)
-# else /* not __MSVCRT */
- extern int* _imp____mbcur_max_dll
-# define MB_CUR_MAX (*_imp____mb_cur_max_dll)
-# endif /* not __MSVCRT */
-#endif /* __DECLSPEC_SUPPORTED */
-#endif /* MB_CUR_MAX */
-/*
- * MS likes to declare errno in stdlib.h as well.
- */
-
-#ifdef _UWIN
-#undef errno
-extern int errno;
-#else
-int* _errno(void);
-#define errno (*_errno())
-#endif
-int* __doserrno(void);
-#define _doserrno (*__doserrno())
-
-/*
- * Use environ from the DLL, not as a global.
- */
-
-#ifdef __MSVCRT__
- extern char *** __p__environ(void);
- extern wchar_t *** __p__wenviron(void);
-# define _environ (*__p__environ())
-# define _wenviron (*__p__wenviron())
-#else /* ! __MSVCRT__ */
-# ifndef __DECLSPEC_SUPPORTED
- extern char *** _imp___environ_dll;
-# define _environ (*_imp___environ_dll)
-# else /* __DECLSPEC_SUPPORTED */
- __MINGW_IMPORT char ** _environ_dll;
-# define _environ _environ_dll
-# endif /* __DECLSPEC_SUPPORTED */
-#endif /* ! __MSVCRT__ */
-
-#define environ _environ
-
-#ifdef __MSVCRT__
-/* One of the MSVCRTxx libraries */
-
-#ifndef __DECLSPEC_SUPPORTED
- extern int* _imp___sys_nerr;
-# define sys_nerr (*_imp___sys_nerr)
-#else /* __DECLSPEC_SUPPORTED */
- __MINGW_IMPORT int _sys_nerr;
-# ifndef _UWIN
-# define sys_nerr _sys_nerr
-# endif /* _UWIN */
-#endif /* __DECLSPEC_SUPPORTED */
-
-#else /* ! __MSVCRT__ */
-
-/* CRTDLL run time library */
-
-#ifndef __DECLSPEC_SUPPORTED
- extern int* _imp___sys_nerr_dll;
-# define sys_nerr (*_imp___sys_nerr_dll)
-#else /* __DECLSPEC_SUPPORTED */
- __MINGW_IMPORT int _sys_nerr_dll;
-# define sys_nerr _sys_nerr_dll
-#endif /* __DECLSPEC_SUPPORTED */
-
-#endif /* ! __MSVCRT__ */
-
-#ifndef __DECLSPEC_SUPPORTED
-extern char*** _imp__sys_errlist;
-#define sys_errlist (*_imp___sys_errlist)
-#else /* __DECLSPEC_SUPPORTED */
-__MINGW_IMPORT char* _sys_errlist[];
-#ifndef _UWIN
-#define sys_errlist _sys_errlist
-#endif /* _UWIN */
-#endif /* __DECLSPEC_SUPPORTED */
-
-/*
- * OS version and such constants.
- */
-#ifndef __STRICT_ANSI__
-
-#ifdef __MSVCRT__
-/* msvcrtxx.dll */
-
-extern unsigned int* __p__osver(void);
-extern unsigned int* __p__winver(void);
-extern unsigned int* __p__winmajor(void);
-extern unsigned int* __p__winminor(void);
-
-#define _osver (*__p__osver())
-#define _winver (*__p__winver())
-#define _winmajor (*__p__winmajor())
-#define _winminor (*__p__winminor())
-
-#else
-/* Not msvcrtxx.dll, thus crtdll.dll */
-
-#ifndef __DECLSPEC_SUPPORTED
-
-extern unsigned int* _imp___osver_dll;
-extern unsigned int* _imp___winver_dll;
-extern unsigned int* _imp___winmajor_dll;
-extern unsigned int* _imp___winminor_dll;
-
-#define _osver (*_imp___osver_dll)
-#define _winver (*_imp___winver_dll)
-#define _winmajor (*_imp___winmajor_dll)
-#define _winminor (*_imp___winminor_dll)
-
-#else /* __DECLSPEC_SUPPORTED */
-
-__MINGW_IMPORT unsigned int _osver_dll;
-__MINGW_IMPORT unsigned int _winver_dll;
-__MINGW_IMPORT unsigned int _winmajor_dll;
-__MINGW_IMPORT unsigned int _winminor_dll;
-
-#define _osver _osver_dll
-#define _winver _winver_dll
-#define _winmajor _winmajor_dll
-#define _winminor _winminor_dll
-
-#endif /* __DECLSPEC_SUPPORTED */
-
-#endif
-
-#if defined __MSVCRT__
-/* although the _pgmptr is exported as DATA,
- * be safe and use the access function __p__pgmptr() to get it. */
-char** __p__pgmptr(void);
-#define _pgmptr (*__p__pgmptr())
-wchar_t** __p__wpgmptr(void);
-#define _wpgmptr (*__p__wpgmptr())
-#else /* ! __MSVCRT__ */
-# ifndef __DECLSPEC_SUPPORTED
- extern char** __imp__pgmptr_dll;
-# define _pgmptr (*_imp___pgmptr_dll)
-# else /* __DECLSPEC_SUPPORTED */
- __MINGW_IMPORT char* _pgmptr_dll;
-# define _pgmptr _pgmptr_dll
-# endif /* __DECLSPEC_SUPPORTED */
-/* no wide version in CRTDLL */
-#endif /* __MSVCRT__ */
-
-#endif /* Not __STRICT_ANSI__ */
-
-#ifdef __GNUC__
-#define _ATTRIB_NORETURN __attribute__ ((noreturn))
-#else /* Not __GNUC__ */
-#define _ATTRIB_NORETURN
-#endif /* __GNUC__ */
-
-double atof (const char*);
-int atoi (const char*);
-long atol (const char*);
-int _wtoi (const wchar_t *);
-long _wtol (const wchar_t *);
-
-double strtod (const char*, char**);
-#if !defined __NO_ISOCEXT /* extern stubs in static libmingwex.a */
-extern __inline__ float strtof (const char *nptr, char **endptr)
- { return (strtod (nptr, endptr));}
-#endif /* __NO_ISOCEXT */
-
-long strtol (const char*, char**, int);
-unsigned long strtoul (const char*, char**, int);
-
-#ifndef _WSTDLIB_DEFINED
-/* also declared in wchar.h */
-double wcstod (const wchar_t*, wchar_t**);
-#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */
-extern __inline__ float wcstof( const wchar_t *nptr, wchar_t **endptr)
-{ return (wcstod(nptr, endptr)); }
-#endif /* __NO_ISOCEXT */
-
-long wcstol (const wchar_t*, wchar_t**, int);
-unsigned long wcstoul (const wchar_t*, wchar_t**, int);
-#define _WSTDLIB_DEFINED
-#endif
-
-size_t wcstombs (char*, const wchar_t*, size_t);
-int wctomb (char*, wchar_t);
-
-int mblen (const char*, size_t);
-size_t mbstowcs (wchar_t*, const char*, size_t);
-int mbtowc (wchar_t*, const char*, size_t);
-
-int rand (void);
-void srand (unsigned int);
-
-void* calloc (size_t, size_t);
-void* malloc (size_t);
-void* realloc (void*, size_t);
-void free (void*);
-
-void abort (void) _ATTRIB_NORETURN;
-void exit (int) _ATTRIB_NORETURN;
-int atexit (void (*)(void));
-
-int system (const char*);
-char* getenv (const char*);
-
-void* bsearch (const void*, const void*, size_t, size_t,
- int (*)(const void*, const void*));
-void qsort (const void*, size_t, size_t,
- int (*)(const void*, const void*));
-
-int abs (int);
-long labs (long);
-
-/*
- * div_t and ldiv_t are structures used to return the results of div and
- * ldiv.
- *
- * NOTE: div and ldiv appear not to work correctly unless
- * -fno-pcc-struct-return is specified. This is included in the
- * mingw32 specs file.
- */
-typedef struct { int quot, rem; } div_t;
-typedef struct { long quot, rem; } ldiv_t;
-
-div_t div (int, int);
-ldiv_t ldiv (long, long);
-
-#ifndef __STRICT_ANSI__
-
-/*
- * NOTE: Officially the three following functions are obsolete. The Win32 API
- * functions SetErrorMode, Beep and Sleep are their replacements.
- */
-void _beep (unsigned int, unsigned int);
-void _seterrormode (int);
-void _sleep (unsigned long);
-
-void _exit (int) _ATTRIB_NORETURN;
-#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */
-/* C99 function name */
-void _Exit(int) _ATTRIB_NORETURN; /* Declare to get noreturn attribute. */
-extern __inline__ void _Exit(int status)
- { _exit(status); }
-#endif
-/* _onexit is MS extension. Use atexit for portability. */
-typedef int (* _onexit_t)(void);
-_onexit_t _onexit( _onexit_t );
-
-int _putenv (const char*);
-void _searchenv (const char*, const char*, char*);
-
-
-char* _ecvt (double, int, int*, int*);
-char* _fcvt (double, int, int*, int*);
-char* _gcvt (double, int, char*);
-
-void _makepath (char*, const char*, const char*, const char*, const char*);
-void _splitpath (const char*, char*, char*, char*, char*);
-char* _fullpath (char*, const char*, size_t);
-
-
-char* _itoa (int, char*, int);
-char* _ltoa (long, char*, int);
-char* _ultoa(unsigned long, char*, int);
-wchar_t* _itow (int, wchar_t*, int);
-wchar_t* _ltow (long, wchar_t*, int);
-wchar_t* _ultow (unsigned long, wchar_t*, int);
-
-#ifdef __MSVCRT__
-__int64 _atoi64(const char *);
-char* _i64toa(__int64, char *, int);
-char* _ui64toa(unsigned __int64, char *, int);
-__int64 _wtoi64(const wchar_t *);
-wchar_t* _i64tow(__int64, wchar_t *, int);
-wchar_t* _ui64tow(unsigned __int64, wchar_t *, int);
-
-wchar_t* _wgetenv(const wchar_t*);
-int _wputenv(const wchar_t*);
-void _wsearchenv(const wchar_t*, const wchar_t*, wchar_t*);
-void _wmakepath(wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*);
-void _wsplitpath (const wchar_t*, wchar_t*, wchar_t*, wchar_t*, wchar_t*);
-wchar_t* _wfullpath (wchar_t*, const wchar_t*, size_t);
-#endif
-
-#ifndef _NO_OLDNAMES
-
-int putenv (const char*);
-void searchenv (const char*, const char*, char*);
-
-char* itoa (int, char*, int);
-char* ltoa (long, char*, int);
-
-#ifndef _UWIN
-char* ecvt (double, int, int*, int*);
-char* fcvt (double, int, int*, int*);
-char* gcvt (double, int, char*);
-#endif /* _UWIN */
-#endif /* Not _NO_OLDNAMES */
-
-#endif /* Not __STRICT_ANSI__ */
-
-/* C99 names */
-
-#if !defined __NO_ISOCEXT /* externs in static libmingwex.a */
-
-typedef struct { long long quot, rem; } lldiv_t;
-
-lldiv_t lldiv (long long, long long);
-
-extern __inline__ long long llabs(long long _j)
- {return (_j >= 0 ? _j : -_j);}
-
-long long strtoll (const char* __restrict__, char** __restrict, int);
-unsigned long long strtoull (const char* __restrict__, char** __restrict__, int);
-
-#if defined (__MSVCRT__) /* these are stubs for MS _i64 versions */
-long long atoll (const char *);
-
-#if !defined (__STRICT_ANSI__)
-long long wtoll(const wchar_t *);
-char* lltoa(long long, char *, int);
-char* ulltoa(unsigned long long , char *, int);
-wchar_t* lltow(long long, wchar_t *, int);
-wchar_t* ulltow(unsigned long long, wchar_t *, int);
-
- /* inline using non-ansi functions */
-extern __inline__ long long atoll (const char * _c)
- { return _atoi64 (_c); }
-extern __inline__ char* lltoa(long long _n, char * _c, int _i)
- { return _i64toa (_n, _c, _i); }
-extern __inline__ char* ulltoa(unsigned long long _n, char * _c, int _i)
- { return _ui64toa (_n, _c, _i); }
-extern __inline__ long long wtoll(const wchar_t * _w)
- { return _wtoi64 (_w); }
-extern __inline__ wchar_t* lltow(long long _n, wchar_t * _w, int _i)
- { return _i64tow (_n, _w, _i); }
-extern __inline__ wchar_t* ulltow(unsigned long long _n, wchar_t * _w, int _i)
- { return _ui64tow (_n, _w, _i); }
-#endif /* (__STRICT_ANSI__) */
-
-#endif /* __MSVCRT__ */
-
-#endif /* !__NO_ISOCEXT */
-
-/*
- * Undefine the no return attribute used in some function definitions
- */
-#undef _ATTRIB_NORETURN
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not _STDLIB_H_ */
-
diff --git a/winsup/mingw/include/string.h b/winsup/mingw/include/string.h
deleted file mode 100644
index 038487b0c..000000000
--- a/winsup/mingw/include/string.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * string.h
- *
- * Definitions for memory and string functions.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef _STRING_H_
-#define _STRING_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-/*
- * Define size_t, wchar_t and NULL
- */
-#define __need_size_t
-#define __need_wchar_t
-#define __need_NULL
-#ifndef RC_INVOKED
-#include <stddef.h>
-#endif /* Not RC_INVOKED */
-
-#ifndef RC_INVOKED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Prototypes of the ANSI Standard C library string functions.
- */
-void* memchr (const void*, int, size_t);
-int memcmp (const void*, const void*, size_t);
-void* memcpy (void*, const void*, size_t);
-void* memmove (void*, const void*, size_t);
-void* memset (void*, int, size_t);
-char* strcat (char*, const char*);
-char* strchr (const char*, int);
-int strcmp (const char*, const char*);
-int strcoll (const char*, const char*); /* Compare using locale */
-char* strcpy (char*, const char*);
-size_t strcspn (const char*, const char*);
-char* strerror (int); /* NOTE: NOT an old name wrapper. */
-char* _strerror (const char *);
-size_t strlen (const char*);
-char* strncat (char*, const char*, size_t);
-int strncmp (const char*, const char*, size_t);
-char* strncpy (char*, const char*, size_t);
-char* strpbrk (const char*, const char*);
-char* strrchr (const char*, int);
-size_t strspn (const char*, const char*);
-char* strstr (const char*, const char*);
-char* strtok (char*, const char*);
-size_t strxfrm (char*, const char*, size_t);
-
-#ifndef __STRICT_ANSI__
-/*
- * Extra non-ANSI functions provided by the CRTDLL library
- */
-void* _memccpy (void*, const void*, int, size_t);
-int _memicmp (const void*, const void*, size_t);
-char* _strdup (const char*);
-int _strcmpi (const char*, const char*);
-int _stricmp (const char*, const char*);
-int _stricoll (const char*, const char*);
-char* _strlwr (char*);
-int _strnicmp (const char*, const char*, size_t);
-char* _strnset (char*, int, size_t);
-char* _strrev (char*);
-char* _strset (char*, int);
-char* _strupr (char*);
-void _swab (const char*, char*, size_t);
-
-/*
- * Multi-byte character functions
- */
-unsigned char* _mbschr (unsigned char*, unsigned char*);
-unsigned char* _mbsncat (unsigned char*, const unsigned char*, size_t);
-unsigned char* _mbstok (unsigned char*, unsigned char*);
-
-#ifdef __MSVCRT__
-int _strncoll(const char*, const char*, size_t);
-int _strnicoll(const char*, const char*, size_t);
-#endif
-
-#endif /* Not __STRICT_ANSI__ */
-
-/*
- * Unicode versions of the standard calls.
- */
-wchar_t* wcscat (wchar_t*, const wchar_t*);
-wchar_t* wcschr (const wchar_t*, wchar_t);
-int wcscmp (const wchar_t*, const wchar_t*);
-int wcscoll (const wchar_t*, const wchar_t*);
-wchar_t* wcscpy (wchar_t*, const wchar_t*);
-size_t wcscspn (const wchar_t*, const wchar_t*);
-/* Note: No wcserror in CRTDLL. */
-size_t wcslen (const wchar_t*);
-wchar_t* wcsncat (wchar_t*, const wchar_t*, size_t);
-int wcsncmp(const wchar_t*, const wchar_t*, size_t);
-wchar_t* wcsncpy(wchar_t*, const wchar_t*, size_t);
-wchar_t* wcspbrk(const wchar_t*, const wchar_t*);
-wchar_t* wcsrchr(const wchar_t*, wchar_t);
-size_t wcsspn(const wchar_t*, const wchar_t*);
-wchar_t* wcsstr(const wchar_t*, const wchar_t*);
-wchar_t* wcstok(wchar_t*, const wchar_t*);
-size_t wcsxfrm(wchar_t*, const wchar_t*, size_t);
-
-#ifndef __STRICT_ANSI__
-/*
- * Unicode versions of non-ANSI functions provided by CRTDLL.
- */
-
-/* NOTE: _wcscmpi not provided by CRTDLL, this define is for portability */
-#define _wcscmpi _wcsicmp
-
-wchar_t* _wcsdup (wchar_t*);
-int _wcsicmp (const wchar_t*, const wchar_t*);
-int _wcsicoll (const wchar_t*, const wchar_t*);
-wchar_t* _wcslwr (wchar_t*);
-int _wcsnicmp (const wchar_t*, const wchar_t*, size_t);
-wchar_t* _wcsnset (wchar_t*, wchar_t, size_t);
-wchar_t* _wcsrev (wchar_t*);
-wchar_t* _wcsset (wchar_t*, wchar_t);
-wchar_t* _wcsupr (wchar_t*);
-
-#ifdef __MSVCRT__
-int _wcsncoll(const wchar_t*, const wchar_t*, size_t);
-int _wcsnicoll(const wchar_t*, const wchar_t*, size_t);
-#endif
-
-
-#endif /* Not __STRICT_ANSI__ */
-
-
-#ifndef __STRICT_ANSI__
-#ifndef _NO_OLDNAMES
-
-/*
- * Non-underscored versions of non-ANSI functions. They live in liboldnames.a
- * and provide a little extra portability. Also a few extra UNIX-isms like
- * strcasecmp.
- */
-
-void* memccpy (void*, const void*, int, size_t);
-int memicmp (const void*, const void*, size_t);
-char* strdup (const char*);
-int strcmpi (const char*, const char*);
-int stricmp (const char*, const char*);
-int strcasecmp (const char*, const char*);
-int stricoll (const char*, const char*);
-char* strlwr (char*);
-int strnicmp (const char*, const char*, size_t);
-int strncasecmp (const char*, const char*, size_t);
-char* strnset (char*, int, size_t);
-char* strrev (char*);
-char* strset (char*, int);
-char* strupr (char*);
-#ifndef _UWIN
-void swab (const char*, char*, size_t);
-#endif /* _UWIN */
-
-/* NOTE: There is no _wcscmpi, but this is for compatibility. */
-int wcscmpi (const wchar_t*, const wchar_t*);
-wchar_t* wcsdup (wchar_t*);
-int wcsicmp (const wchar_t*, const wchar_t*);
-int wcsicoll (const wchar_t*, const wchar_t*);
-wchar_t* wcslwr (wchar_t*);
-int wcsnicmp (const wchar_t*, const wchar_t*, size_t);
-wchar_t* wcsnset (wchar_t*, wchar_t, size_t);
-wchar_t* wcsrev (wchar_t*);
-wchar_t* wcsset (wchar_t*, wchar_t);
-wchar_t* wcsupr (wchar_t*);
-
-#endif /* Not _NO_OLDNAMES */
-#endif /* Not strict ANSI */
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not _STRING_H_ */
-
diff --git a/winsup/mingw/include/strings.h b/winsup/mingw/include/strings.h
deleted file mode 100644
index 2a777c2d7..000000000
--- a/winsup/mingw/include/strings.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- File: strings.h
- Copyright: Public Domain
-
- This file is provided because non ANSI fuctions are described in string.h
- that belong in strings.h. These functions are provided for in the OLDNAME
- libraries.
-*/
-#if !defined(_STRINGS_H_)
-# define _STRINGS_H_ 1
-# include <string.h>
-#endif
diff --git a/winsup/mingw/include/sys/fcntl.h b/winsup/mingw/include/sys/fcntl.h
deleted file mode 100644
index b343f272f..000000000
--- a/winsup/mingw/include/sys/fcntl.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * This file is part of the Mingw32 package.
- *
- * This fcntl.h maps to the root fcntl.h
- */
-#ifndef __STRICT_ANSI__
-#include <fcntl.h>
-#endif
diff --git a/winsup/mingw/include/sys/file.h b/winsup/mingw/include/sys/file.h
deleted file mode 100644
index 96c49e117..000000000
--- a/winsup/mingw/include/sys/file.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * This file is part of the Mingw32 package.
- *
- * This file.h maps to the root fcntl.h
- * TODO?
- */
-#ifndef __STRICT_ANSI__
-#include <fcntl.h>
-#endif
diff --git a/winsup/mingw/include/sys/locking.h b/winsup/mingw/include/sys/locking.h
deleted file mode 100644
index 48e08e2c1..000000000
--- a/winsup/mingw/include/sys/locking.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * locking.h
- *
- * Constants for the mode parameter of the locking function.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef __STRICT_ANSI__
-
-#ifndef _LOCKING_H_
-#define _LOCKING_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-#define _LK_UNLCK 0 /* Unlock */
-#define _LK_LOCK 1 /* Lock */
-#define _LK_NBLCK 2 /* Non-blocking lock */
-#define _LK_RLCK 3 /* Lock for read only */
-#define _LK_NBRLCK 4 /* Non-blocking lock for read only */
-
-#ifndef NO_OLDNAMES
-#define LK_UNLCK _LK_UNLCK
-#define LK_LOCK _LK_LOCK
-#define LK_NBLCK _LK_NBLCK
-#define LK_RLCK _LK_RLCK
-#define LK_NBRLCK _LK_NBRLCK
-#endif /* Not NO_OLDNAMES */
-
-#endif /* Not _LOCKING_H_ */
-
-#endif /* Not __STRICT_ANSI__ */
-
diff --git a/winsup/mingw/include/sys/stat.h b/winsup/mingw/include/sys/stat.h
deleted file mode 100644
index 1620b0684..000000000
--- a/winsup/mingw/include/sys/stat.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * stat.h
- *
- * Symbolic constants for opening and creating files, also stat, fstat and
- * chmod functions.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef __STRICT_ANSI__
-
-#ifndef _STAT_H_
-#define _STAT_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-#define __need_size_t
-#define __need_wchar_t
-#ifndef RC_INVOKED
-#include <stddef.h>
-#endif /* Not RC_INVOKED */
-
-#include <sys/types.h>
-
-/*
- * Constants for the stat st_mode member.
- */
-#define _S_IFIFO 0x1000 /* FIFO */
-#define _S_IFCHR 0x2000 /* Character */
-#define _S_IFBLK 0x3000 /* Block: Is this ever set under w32? */
-#define _S_IFDIR 0x4000 /* Directory */
-#define _S_IFREG 0x8000 /* Regular */
-
-#define _S_IFMT 0xF000 /* File type mask */
-
-#define _S_IEXEC 0x0040
-#define _S_IWRITE 0x0080
-#define _S_IREAD 0x0100
-
-#define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC)
-#define _S_IXUSR _S_IEXEC
-#define _S_IWUSR _S_IWRITE
-#define _S_IRUSR _S_IREAD
-
-#define _S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
-#define _S_ISFIFO(m) (((m) & _S_IFMT) == _S_IFIFO)
-#define _S_ISCHR(m) (((m) & _S_IFMT) == _S_IFCHR)
-#define _S_ISBLK(m) (((m) & _S_IFMT) == _S_IFBLK)
-#define _S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
-
-#ifndef _NO_OLDNAMES
-
-#define S_IFIFO _S_IFIFO
-#define S_IFCHR _S_IFCHR
-#define S_IFBLK _S_IFBLK
-#define S_IFDIR _S_IFDIR
-#define S_IFREG _S_IFREG
-#define S_IFMT _S_IFMT
-#define S_IEXEC _S_IEXEC
-#define S_IWRITE _S_IWRITE
-#define S_IREAD _S_IREAD
-#define S_IRWXU _S_IRWXU
-#define S_IXUSR _S_IXUSR
-#define S_IWUSR _S_IWUSR
-#define S_IRUSR _S_IRUSR
-
-#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
-#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
-#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
-#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
-
-#endif /* Not _NO_OLDNAMES */
-
-#ifndef RC_INVOKED
-
-#ifndef _STAT_DEFINED
-/*
- * The structure manipulated and returned by stat and fstat.
- *
- * NOTE: If called on a directory the values in the time fields are not only
- * invalid, they will cause localtime et. al. to return NULL. And calling
- * asctime with a NULL pointer causes an Invalid Page Fault. So watch it!
- */
-struct _stat
-{
- _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */
- _ino_t st_ino; /* Always zero ? */
- _mode_t st_mode; /* See above constants */
- short st_nlink; /* Number of links. */
- short st_uid; /* User: Maybe significant on NT ? */
- short st_gid; /* Group: Ditto */
- _dev_t st_rdev; /* Seems useless (not even filled in) */
- _off_t st_size; /* File size in bytes */
- time_t st_atime; /* Accessed date (always 00:00 hrs local
- * on FAT) */
- time_t st_mtime; /* Modified time */
- time_t st_ctime; /* Creation time */
-};
-
-struct stat
-{
- _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */
- _ino_t st_ino; /* Always zero ? */
- _mode_t st_mode; /* See above constants */
- short st_nlink; /* Number of links. */
- short st_uid; /* User: Maybe significant on NT ? */
- short st_gid; /* Group: Ditto */
- _dev_t st_rdev; /* Seems useless (not even filled in) */
- _off_t st_size; /* File size in bytes */
- time_t st_atime; /* Accessed date (always 00:00 hrs local
- * on FAT) */
- time_t st_mtime; /* Modified time */
- time_t st_ctime; /* Creation time */
-};
-#if defined (__MSVCRT__)
-struct _stati64 {
- _dev_t st_dev;
- _ino_t st_ino;
- unsigned short st_mode;
- short st_nlink;
- short st_uid;
- short st_gid;
- _dev_t st_rdev;
- __int64 st_size;
- time_t st_atime;
- time_t st_mtime;
- time_t st_ctime;
-};
-#endif /* __MSVCRT__ */
-#define _STAT_DEFINED
-#endif /* _STAT_DEFINED */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int _fstat (int, struct _stat*);
-int _chmod (const char*, int);
-int _stat (const char*, struct _stat*);
-
-#if defined (__MSVCRT__)
-int _fstati64(int, struct _stati64 *);
-int _stati64(const char *, struct _stati64 *);
-#if !defined ( _WSTAT_DEFINED) /* also declared in wchar.h */
-int _wstat(const wchar_t*, struct _stat*);
-int _wstati64 (const wchar_t*, struct _stati64*);
-#define _WSTAT_DEFINED
-#endif /* _WSTAT_DEFIND */
-#endif /* __MSVCRT__ */
-
-#ifndef _NO_OLDNAMES
-
-/* These functions live in liboldnames.a. */
-int fstat (int, struct stat*);
-int chmod (const char*, int);
-int stat (const char*, struct stat*);
-
-#endif /* Not _NO_OLDNAMES */
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not _STAT_H_ */
-
-#endif /* Not __STRICT_ANSI__ */
-
diff --git a/winsup/mingw/include/sys/time.h b/winsup/mingw/include/sys/time.h
deleted file mode 100644
index 39d85f67b..000000000
--- a/winsup/mingw/include/sys/time.h
+++ /dev/null
@@ -1,3 +0,0 @@
-
-#include <time.h>
-
diff --git a/winsup/mingw/include/sys/timeb.h b/winsup/mingw/include/sys/timeb.h
deleted file mode 100644
index 201116275..000000000
--- a/winsup/mingw/include/sys/timeb.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * timeb.h
- *
- * Support for the UNIX System V ftime system call.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef __STRICT_ANSI__
-
-#ifndef _TIMEB_H_
-#define _TIMEB_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-#ifndef RC_INVOKED
-
-/*
- * TODO: Structure not tested.
- */
-struct _timeb
-{
- long time;
- short millitm;
- short timezone;
- short dstflag;
-};
-
-#ifndef _NO_OLDNAMES
-/*
- * TODO: Structure not tested.
- */
-struct timeb
-{
- long time;
- short millitm;
- short timezone;
- short dstflag;
-};
-#endif
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* TODO: Not tested. */
-void _ftime (struct _timeb*);
-
-#ifndef _NO_OLDNAMES
-void ftime (struct timeb*);
-#endif /* Not _NO_OLDNAMES */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not _TIMEB_H_ */
-
-#endif /* Not __STRICT_ANSI__ */
-
diff --git a/winsup/mingw/include/sys/types.h b/winsup/mingw/include/sys/types.h
deleted file mode 100644
index 76c3d8dc3..000000000
--- a/winsup/mingw/include/sys/types.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * types.h
- *
- * The definition of constants, data types and global variables.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- * Lots of types supplied by Pedro A. Aranda <paag@tid.es>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warrenties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef _TYPES_H_
-#define _TYPES_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-#define __need_wchar_t
-#define __need_size_t
-#define __need_ptrdiff_t
-#ifndef RC_INVOKED
-#include <stddef.h>
-#endif /* Not RC_INVOKED */
-
-#ifndef RC_INVOKED
-
-#ifndef _TIME_T_DEFINED
-typedef long time_t;
-#define _TIME_T_DEFINED
-#endif
-
-
-#ifndef __STRICT_ANSI__
-
-#ifndef _OFF_T_
-#define _OFF_T_
-typedef long _off_t;
-
-#ifndef _NO_OLDNAMES
-typedef _off_t off_t;
-#endif
-#endif /* Not _OFF_T_ */
-
-
-#ifndef _DEV_T_
-#define _DEV_T_
-#ifdef __MSVCRT__
-typedef unsigned int _dev_t;
-#else
-typedef short _dev_t;
-#endif
-
-#ifndef _NO_OLDNAMES
-typedef _dev_t dev_t;
-#endif
-#endif /* Not _DEV_T_ */
-
-
-#ifndef _INO_T_
-#define _INO_T_
-typedef short _ino_t;
-
-#ifndef _NO_OLDNAMES
-typedef _ino_t ino_t;
-#endif
-#endif /* Not _INO_T_ */
-
-
-#ifndef _PID_T_
-#define _PID_T_
-typedef int _pid_t;
-
-#ifndef _NO_OLDNAMES
-typedef _pid_t pid_t;
-#endif
-#endif /* Not _PID_T_ */
-
-
-#ifndef _MODE_T_
-#define _MODE_T_
-typedef unsigned short _mode_t;
-
-#ifndef _NO_OLDNAMES
-typedef _mode_t mode_t;
-#endif
-#endif /* Not _MODE_T_ */
-
-
-#ifndef _SIGSET_T_
-#define _SIGSET_T_
-typedef int _sigset_t;
-
-#ifndef _NO_OLDNAMES
-typedef _sigset_t sigset_t;
-#endif
-#endif /* Not _SIGSET_T_ */
-
-#endif /* Not __STRICT_ANSI__ */
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not _TYPES_H_ */
diff --git a/winsup/mingw/include/sys/unistd.h b/winsup/mingw/include/sys/unistd.h
deleted file mode 100644
index ed122d9dd..000000000
--- a/winsup/mingw/include/sys/unistd.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * This file is part of the Mingw32 package.
- *
- * unistd.h maps (roughly) to io.h
- */
-#ifndef __STRICT_ANSI__
-#include <io.h>
-#endif
-
diff --git a/winsup/mingw/include/sys/utime.h b/winsup/mingw/include/sys/utime.h
deleted file mode 100644
index 7c907f32a..000000000
--- a/winsup/mingw/include/sys/utime.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * utime.h
- *
- * Support for the utime function.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef __STRICT_ANSI__
-
-#ifndef _UTIME_H_
-#define _UTIME_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-#define __need_wchar_t
-#define __need_size_t
-#ifndef RC_INVOKED
-#include <stddef.h>
-#endif /* Not RC_INVOKED */
-#include <sys/types.h>
-
-#ifndef RC_INVOKED
-
-/*
- * Structure used by _utime function.
- */
-struct _utimbuf
-{
- time_t actime; /* Access time */
- time_t modtime; /* Modification time */
-};
-
-
-#ifndef _NO_OLDNAMES
-/* NOTE: Must be the same as _utimbuf above. */
-struct utimbuf
-{
- time_t actime;
- time_t modtime;
-};
-#endif /* Not _NO_OLDNAMES */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int _utime (const char*, struct _utimbuf*);
-int _futime (int, struct _utimbuf*);
-
-/* The wide character version, only available for MSVCRT versions of the
- * C runtime library. */
-#ifdef __MSVCRT__
-int _wutime (const wchar_t*, struct _utimbuf*);
-#endif /* MSVCRT runtime */
-#ifndef _NO_OLDNAMES
-int utime (const char*, struct utimbuf*);
-#endif /* Not _NO_OLDNAMES */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not _UTIME_H_ */
-
-#endif /* Not __STRICT_ANSI__ */
-
diff --git a/winsup/mingw/include/tchar.h b/winsup/mingw/include/tchar.h
deleted file mode 100644
index bc6f28f5c..000000000
--- a/winsup/mingw/include/tchar.h
+++ /dev/null
@@ -1,396 +0,0 @@
-/*
- * tchar.h
- *
- * Unicode mapping layer for the standard C library. By including this
- * file and using the 't' names for string functions
- * (eg. _tprintf) you can make code which can be easily adapted to both
- * Unicode and non-unicode environments. In a unicode enabled compile define
- * _UNICODE before including tchar.h, otherwise the standard non-unicode
- * library functions will be used.
- *
- * Note that you still need to include string.h or stdlib.h etc. to define
- * the appropriate functions. Also note that there are several defines
- * included for non-ANSI functions which are commonly available (but using
- * the convention of prepending an underscore to non-ANSI library function
- * names).
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef _TCHAR_H_
-#define _TCHAR_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-/*
- * NOTE: This tests _UNICODE, which is different from the UNICODE define
- * used to differentiate Win32 API calls.
- */
-#ifdef _UNICODE
-
-
-/*
- * Use TCHAR instead of char or wchar_t. It will be appropriately translated
- * if _UNICODE is correctly defined (or not).
- */
-#ifndef _TCHAR_DEFINED
-#ifndef RC_INVOKED
-typedef wchar_t TCHAR;
-typedef wchar_t _TCHAR;
-#endif /* Not RC_INVOKED */
-#define _TCHAR_DEFINED
-#endif
-
-
-/*
- * __TEXT is a private macro whose specific use is to force the expansion of a
- * macro passed as an argument to the macros _T or _TEXT. DO NOT use this
- * macro within your programs. It's name and function could change without
- * notice.
- */
-#define __TEXT(q) L##q
-
-/* for porting from other Windows compilers */
-#if 0 // no wide startup module
-#define _tmain wmain
-#define _tWinMain wWinMain
-#define _tenviron _wenviron
-#define __targv __wargv
-#endif
-
-/*
- * Unicode functions
- */
-#define _tprintf wprintf
-#define _ftprintf fwprintf
-#define _stprintf swprintf
-#define _sntprintf _snwprintf
-#define _vtprintf vwprintf
-#define _vftprintf vfwprintf
-#define _vstprintf vswprintf
-#define _vsntprintf _vsnwprintf
-#define _tscanf wscanf
-#define _ftscanf fwscanf
-#define _stscanf swscanf
-#define _fgettc fgetwc
-#define _fgettchar _fgetwchar
-#define _fgetts fgetws
-#define _fputtc fputwc
-#define _fputtchar _fputwchar
-#define _fputts fputws
-#define _gettc getwc
-#define _getts getws
-#define _puttc putwc
-#define _putts putws
-#define _ungettc ungetwc
-#define _tcstod wcstod
-#define _tcstol wcstol
-#define _tcstoul wcstoul
-#define _itot _itow
-#define _ltot _ltow
-#define _ultot _ultow
-#define _ttoi _wtoi
-#define _ttol _wtol
-#define _tcscat wcscat
-#define _tcschr wcschr
-#define _tcscmp wcscmp
-#define _tcscpy wcscpy
-#define _tcscspn wcscspn
-#define _tcslen wcslen
-#define _tcsncat wcsncat
-#define _tcsncmp wcsncmp
-#define _tcsncpy wcsncpy
-#define _tcspbrk wcspbrk
-#define _tcsrchr wcsrchr
-#define _tcsspn wcsspn
-#define _tcsstr wcsstr
-#define _tcstok wcstok
-#define _tcsdup _wcsdup
-#define _tcsicmp _wcsicmp
-#define _tcsnicmp _wcsnicmp
-#define _tcsnset _wcsnset
-#define _tcsrev _wcsrev
-#define _tcsset _wcsset
-#define _tcslwr _wcslwr
-#define _tcsupr _wcsupr
-#define _tcsxfrm wcsxfrm
-#define _tcscoll wcscoll
-#define _tcsicoll _wcsicoll
-#define _istalpha iswalpha
-#define _istupper iswupper
-#define _istlower iswlower
-#define _istdigit iswdigit
-#define _istxdigit iswxdigit
-#define _istspace iswspace
-#define _istpunct iswpunct
-#define _istalnum iswalnum
-#define _istprint iswprint
-#define _istgraph iswgraph
-#define _istcntrl iswcntrl
-#define _istascii iswascii
-#define _totupper towupper
-#define _totlower towlower
-#define _tcsftime wcsftime
-/* Macro functions */
-#define _tcsdec _wcsdec
-#define _tcsinc _wcsinc
-#define _tcsnbcnt _wcsncnt
-#define _tcsnccnt _wcsncnt
-#define _tcsnextc _wcsnextc
-#define _tcsninc _wcsninc
-#define _tcsspnp _wcsspnp
-#define _wcsdec(_wcs1, _wcs2) ((_wcs1)>=(_wcs2) ? NULL : (_wcs2)-1)
-#define _wcsinc(_wcs) ((_wcs)+1)
-#define _wcsnextc(_wcs) ((unsigned int) *(_wcs))
-#define _wcsninc(_wcs, _inc) (((_wcs)+(_inc)))
-#define _wcsncnt(_wcs, _cnt) ((wcslen(_wcs)>_cnt) ? _count : wcslen(_wcs))
-#define _wcsspnp(_wcs1, _wcs2) ((*((_wcs1)+wcsspn(_wcs1,_wcs2))) ? ((_wcs1)+wcsspn(_wcs1,_wcs2)) : NULL)
-
-#if 1 // defined __MSVCRT__
-/*
- * These wide functions not in crtdll.dll.
- * Define macros anyway so that _wfoo rather than _tfoo is undefined
- */
-#define _ttoi64 _wtoi64
-#define _i64tot _i64tow
-#define _ui64tot _ui64tow
-#define _tasctime _wasctime
-#define _tctime _wctime
-#define _tstrdate _wstrdate
-#define _tstrtime _wstrtime
-#define _tutime _wutime
-#define _tcsnccoll _wcsncoll
-#define _tcsncoll _wcsncoll
-#define _tcsncicoll _wcsnicoll
-#define _tcsnicoll _wcsnicoll
-#define _taccess _waccess
-#define _tchmod _wchmod
-#define _tcreat _wcreat
-#define _tfindfirst _wfindfirst
-#define _tfindnext _wfindnext
-#define _tfopen _wfopen
-#define _tgetenv _wgetenv
-#define _tputenv _wputenv
-#define _tsearchenv _wsearchenv
-#define _tmakepath _wmakepath
-#define _tsplitpath _wsplitpath
-#define _tfullpath _wfullpath
-#define _tmktemp _wmktemp
-#define _topen _wopen
-#define _tremove _wremove
-#define _trename _wrename
-#define _tsopen _wsopen
-#define _tsetlocale _wsetlocale
-#define _tunlink _wunlink
-#define _tfinddata_t _wfinddata_t
-#define _tfindfirsti64 _wfindfirsti64
-#define _tfindnexti64 _wfindnexti64
-#define _tfinddatai64_t _wfinddatai64_t
-#endif /* __MSVCRT__ */
-
-/* dirent structures and functions */
-#define _tdirent _wdirent
-#define _TDIR _WDIR
-#define _topendir _wopendir
-#define _tclosedir _wclosedir
-#define _treaddir _wreaddir
-#define _trewinddir _wrewinddir
-#define _ttelldir _wtelldir
-#define _tseekdir _wseekdir
-#else /* Not _UNICODE */
-
-/*
- * TCHAR, the type you should use instead of char.
- */
-#ifndef _TCHAR_DEFINED
-#ifndef RC_INVOKED
-typedef char TCHAR;
-typedef char _TCHAR;
-#endif
-#define _TCHAR_DEFINED
-#endif
-
-/*
- * __TEXT is a private macro whose specific use is to force the expansion of a
- * macro passed as an argument to the macros _T or _TEXT. DO NOT use this
- * macro within your programs. It's name and function could change without
- * notice.
- */
-#define __TEXT(q) q
-
-/* for porting from other Windows compilers */
-#define _tmain main
-#define _tWinMain WinMain
-#define _tenviron _environ
-#define __targv __argv
-
-/*
- * Non-unicode (standard) functions
- */
-
-#define _tprintf printf
-#define _ftprintf fprintf
-#define _stprintf sprintf
-#define _sntprintf _snprintf
-#define _vtprintf vprintf
-#define _vftprintf vfprintf
-#define _vstprintf vsprintf
-#define _vsntprintf _vsnprintf
-#define _tscanf scanf
-#define _ftscanf fscanf
-#define _stscanf sscanf
-#define _fgettc fgetc
-#define _fgettchar _fgetchar
-#define _fgetts fgets
-#define _fputtc fputc
-#define _fputtchar _fputchar
-#define _fputts fputs
-#define _tfopen fopen
-#define _tgetenv getenv
-#define _tputenv _putenv
-#define _tsearchenv _searchenv
-#define _tmakepath _makepath
-#define _tsplitpath _splitpath
-#define _tfullpath _fullpath
-#define _gettc getc
-#define _getts gets
-#define _puttc putc
-#define _putts puts
-#define _ungettc ungetc
-#define _tcstod strtod
-#define _tcstol strtol
-#define _tcstoul strtoul
-#define _itot _itoa
-#define _ltot _ltoa
-#define _ultot _ultoa
-#define _ttoi atoi
-#define _ttol atol
-#define _tcscat strcat
-#define _tcschr strchr
-#define _tcscmp strcmp
-#define _tcscpy strcpy
-#define _tcscspn strcspn
-#define _tcslen strlen
-#define _tcsncat strncat
-#define _tcsncmp strncmp
-#define _tcsncpy strncpy
-#define _tcspbrk strpbrk
-#define _tcsrchr strrchr
-#define _tcsspn strspn
-#define _tcsstr strstr
-#define _tcstok strtok
-#define _tcsdup _strdup
-#define _tcsicmp _stricmp
-#define _tcsnicmp _strnicmp
-#define _tcsnset _strnset
-#define _tcsrev _strrev
-#define _tcsset _strset
-#define _tcslwr _strlwr
-#define _tcsupr _strupr
-#define _tcsxfrm strxfrm
-#define _tcscoll strcoll
-#define _tcsicoll _stricoll
-#define _istalpha isalpha
-#define _istupper isupper
-#define _istlower islower
-#define _istdigit isdigit
-#define _istxdigit isxdigit
-#define _istspace isspace
-#define _istpunct ispunct
-#define _istalnum isalnum
-#define _istprint isprint
-#define _istgraph isgraph
-#define _istcntrl iscntrl
-#define _istascii isascii
-#define _totupper toupper
-#define _totlower tolower
-#define _tasctime asctime
-#define _tctime ctime
-#define _tstrdate _strdate
-#define _tstrtime _strtime
-#define _tutime _utime
-#define _tcsftime strftime
-/* Macro functions */
-#define _tcsdec _strdec
-#define _tcsinc _strinc
-#define _tcsnbcnt _strncnt
-#define _tcsnccnt _strncnt
-#define _tcsnextc _strnextc
-#define _tcsninc _strninc
-#define _tcsspnp _strspnp
-#define _strdec(_str1, _str2) ((_str1)>=(_str2) ? NULL : (_str2)-1)
-#define _strinc(_str) ((_str)+1)
-#define _strnextc(_str) ((unsigned int) *(_str))
-#define _strninc(_str, _inc) (((_str)+(_inc)))
-#define _strncnt(_str, _cnt) ((strlen(_str)>_cnt) ? _count : strlen(_str))
-#define _strspnp(_str1, _str2) ((*((_str1)+strspn(_str1,_str2))) ? ((_str1)+strspn(_str1,_str2)) : NULL)
-
-#define _tchmod _chmod
-#define _tcreat _creat
-#define _tfindfirst _findfirst
-#define _tfindnext _findnext
-#define _tmktemp _mktemp
-#define _topen _open
-#define _taccess _access
-#define _tremove remove
-#define _trename rename
-#define _tsopen _sopen
-#define _tsetlocale setlocale
-#define _tunlink _unlink
-#define _tfinddata_t _finddata_t
-
-
-#if 1 // defined __MSVCRT__
-/* Not in crtdll.dll. Define macros anyway? */
-#define _ttoi64 _atoi64
-#define _i64tot _i64toa
-#define _ui64tot _ui64toa
-#define _tcsnccoll _strncoll
-#define _tcsncoll _strncoll
-#define _tcsncicoll _strnicoll
-#define _tcsnicoll _strnicoll
-#define _tfindfirsti64 _findfirsti64
-#define _tfindnexti64 _findnexti64
-#define _tfinddatai64_t _finddatai64_t
-#endif /* __MSVCRT__ */
-
-/* dirent structures and functions */
-#define _tdirent dirent
-#define _TDIR DIR
-#define _topendir opendir
-#define _tclosedir closedir
-#define _treaddir readdir
-#define _trewinddir rewinddir
-#define _ttelldir telldir
-#define _tseekdir seekdir
-
-#endif /* Not _UNICODE */
-
-/*
- * UNICODE a constant string when _UNICODE is defined else returns the string
- * unmodified. Also defined in w32api/winnt.h.
- */
-#define _TEXT(x) __TEXT(x)
-#define _T(x) __TEXT(x)
-
-#endif /* Not _TCHAR_H_ */
-
diff --git a/winsup/mingw/include/time.h b/winsup/mingw/include/time.h
deleted file mode 100644
index f2f7b5024..000000000
--- a/winsup/mingw/include/time.h
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * time.h
- *
- * Date and time functions and types.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef _TIME_H_
-#define _TIME_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-#define __need_wchar_t
-#define __need_size_t
-#ifndef RC_INVOKED
-#include <stddef.h>
-#endif /* Not RC_INVOKED */
-
-/*
- * Need a definition of time_t.
- */
-#include <sys/types.h>
-
-/*
- * Number of clock ticks per second. A clock tick is the unit by which
- * processor time is measured and is returned by 'clock'.
- */
-#define CLOCKS_PER_SEC ((clock_t)1000)
-#define CLK_TCK CLOCKS_PER_SEC
-
-
-#ifndef RC_INVOKED
-
-/*
- * A type for storing the current time and date. This is the number of
- * seconds since midnight Jan 1, 1970.
- * NOTE: Normally this is defined by the above include of sys/types.h
- */
-#ifndef _TIME_T_DEFINED
-typedef long time_t;
-#define _TIME_T_DEFINED
-#endif
-
-/*
- * A type for measuring processor time (in clock ticks).
- */
-#ifndef _CLOCK_T_DEFINED
-typedef long clock_t;
-#define _CLOCK_T_DEFINED
-#endif
-
-
-/*
- * A structure for storing all kinds of useful information about the
- * current (or another) time.
- */
-struct tm
-{
- int tm_sec; /* Seconds: 0-59 (K&R says 0-61?) */
- int tm_min; /* Minutes: 0-59 */
- int tm_hour; /* Hours since midnight: 0-23 */
- int tm_mday; /* Day of the month: 1-31 */
- int tm_mon; /* Months *since* january: 0-11 */
- int tm_year; /* Years since 1900 */
- int tm_wday; /* Days since Sunday (0-6) */
- int tm_yday; /* Days since Jan. 1: 0-365 */
- int tm_isdst; /* +1 Daylight Savings Time, 0 No DST,
- * -1 don't know */
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-clock_t clock (void);
-time_t time (time_t*);
-double difftime (time_t, time_t);
-time_t mktime (struct tm*);
-
-/*
- * These functions write to and return pointers to static buffers that may
- * be overwritten by other function calls. Yikes!
- *
- * NOTE: localtime, and perhaps the others of the four functions grouped
- * below may return NULL if their argument is not 'acceptable'. Also note
- * that calling asctime with a NULL pointer will produce an Invalid Page
- * Fault and crap out your program. Guess how I know. Hint: stat called on
- * a directory gives 'invalid' times in st_atime etc...
- */
-char* asctime (const struct tm*);
-char* ctime (const time_t*);
-struct tm* gmtime (const time_t*);
-struct tm* localtime (const time_t*);
-
-
-size_t strftime (char*, size_t, const char*, const struct tm*);
-
-size_t wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*);
-
-#ifndef __STRICT_ANSI__
-extern void _tzset (void);
-
-#ifndef _NO_OLDNAMES
-extern void tzset (void);
-#endif
-
-size_t strftime(char*, size_t, const char*, const struct tm*);
-char* _strdate(char*);
-char* _strtime(char*);
-
-#endif /* Not __STRICT_ANSI__ */
-
-/*
- * _daylight: non zero if daylight savings time is used.
- * _timezone: difference in seconds between GMT and local time.
- * _tzname: standard/daylight savings time zone names (an array with two
- * elements).
- */
-#ifdef __MSVCRT__
-
-/* These are for compatibility with pre-VC 5.0 suppied MSVCRT. */
-extern int* __p__daylight (void);
-extern long* __p__timezone (void);
-extern char** __p__tzname (void);
-
-__MINGW_IMPORT int _daylight;
-__MINGW_IMPORT long _timezone;
-__MINGW_IMPORT char *_tzname[2];
-
-#else /* not __MSVCRT (ie. crtdll) */
-
-#ifndef __DECLSPEC_SUPPORTED
-
-extern int* _imp___daylight_dll;
-extern long* _imp___timezone_dll;
-extern char** _imp___tzname;
-
-#define _daylight (*_imp___daylight_dll)
-#define _timezone (*_imp___timezone_dll)
-#define _tzname (*_imp___tzname)
-
-#else /* __DECLSPEC_SUPPORTED */
-
-__MINGW_IMPORT int _daylight_dll;
-__MINGW_IMPORT long _timezone_dll;
-__MINGW_IMPORT char* _tzname[2];
-
-#define _daylight _daylight_dll
-#define _timezone _timezone_dll
-
-#endif /* __DECLSPEC_SUPPORTED */
-
-#endif /* not __MSVCRT__ */
-
-#ifndef _NO_OLDNAMES
-
-#ifdef __MSVCRT__
-
-/* These go in the oldnames import library for MSVCRT. */
-__MINGW_IMPORT int daylight;
-__MINGW_IMPORT long timezone;
-__MINGW_IMPORT char *tzname[2];
-
-#ifndef _WTIME_DEFINED
-
-/* wide function prototypes, also declared in wchar.h */
-
-wchar_t * _wasctime(const struct tm*);
-wchar_t * _wctime(const time_t*);
-wchar_t* _wstrdate(wchar_t*);
-wchar_t* _wstrtime(wchar_t*);
-
-#define _WTIME_DEFINED
-#endif /* _WTIME_DEFINED */
-
-
-#else /* not __MSVCRT__ */
-
-/* CRTDLL is royally messed up when it comes to these macros.
- TODO: import and alias these via oldnames import library instead
- of macros. */
-
-#define daylight _daylight
-/* NOTE: timezone not defined because it would conflict with sys/timeb.h.
- Also, tzname used to a be macro, but now it's in moldname. */
-__MINGW_IMPORT char *tzname[2];
-
-#endif /* not __MSVCRT__ */
-
-#endif /* Not _NO_OLDNAMES */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not _TIME_H_ */
-
diff --git a/winsup/mingw/include/unistd.h b/winsup/mingw/include/unistd.h
deleted file mode 100644
index 8f51f7661..000000000
--- a/winsup/mingw/include/unistd.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * This file is part of the Mingw32 package.
- *
- * unistd.h maps (roughly) to io.h
- */
-
-#ifndef __STRICT_ANSI__
-#include <io.h>
-#endif
-
diff --git a/winsup/mingw/include/values.h b/winsup/mingw/include/values.h
deleted file mode 100644
index 10e16a281..000000000
--- a/winsup/mingw/include/values.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/*
- * TODO: Nothing here yet. Should provide UNIX compatibility constants
- * comparible to those in limits.h and float.h.
- */
diff --git a/winsup/mingw/include/varargs.h b/winsup/mingw/include/varargs.h
deleted file mode 100644
index c1197e97e..000000000
--- a/winsup/mingw/include/varargs.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * This is just an RC_INVOKED guard for the real varargs.h
- * fixincluded in gcc system dir. One day we will delete this file.
- */
-#ifndef RC_INVOKED
-#include_next<varargs.h>
-#endif
diff --git a/winsup/mingw/include/wchar.h b/winsup/mingw/include/wchar.h
deleted file mode 100644
index 61408e98e..000000000
--- a/winsup/mingw/include/wchar.h
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * wchar.h
- *
- * Defines of all functions for supporting wide characters. Actually it
- * just includes all those headers, which is not a good thing to do from a
- * processing time point of view, but it does mean that everything will be
- * in sync.
- *
- * This file is part of the Mingw32 package.
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef _WCHAR_H_
-#define _WCHAR_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <sys/types.h>
-
-#define __need_size_t
-#define __need_wint_t
-#define __need_wchar_t
-#ifndef RC_INVOKED
-#include <stddef.h>
-#endif /* Not RC_INVOKED */
-
-#define WCHAR_MIN 0
-#define WCHAR_MAX ((wchar_t)-1)
-
-#ifndef RC_INVOKED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef __STRICT_ANSI__
-
-#ifndef _FSIZE_T_DEFINED
-typedef unsigned long _fsize_t;
-#define _FSIZE_T_DEFINED
-#endif
-
-#ifndef _WFINDDATA_T_DEFINED
-struct _wfinddata_t {
- unsigned attrib;
- time_t time_create; /* -1 for FAT file systems */
- time_t time_access; /* -1 for FAT file systems */
- time_t time_write;
- _fsize_t size;
- wchar_t name[FILENAME_MAX]; /* may include spaces. */
-};
-struct _wfinddatai64_t {
- unsigned attrib;
- time_t time_create;
- time_t time_access;
- time_t time_write;
- __int64 size;
- wchar_t name[FILENAME_MAX];
-};
-#define _WFINDDATA_T_DEFINED
-#endif
-
-/* Wide character versions. Also defined in io.h. */
-/* CHECK: I believe these only exist in MSVCRT, and not in CRTDLL. Also
- applies to other wide character versions? */
-#if !defined (_WIO_DEFINED)
-#if defined (__MSVCRT__)
-int _waccess (const wchar_t*, int);
-int _wchmod (const wchar_t*, int);
-int _wcreat (const wchar_t*, int);
-long _wfindfirst (wchar_t*, struct _wfinddata_t *);
-int _wfindnext (long, struct _wfinddata_t *);
-int _wunlink (const wchar_t*);
-int _wopen (const wchar_t*, int, ...);
-int _wsopen (const wchar_t*, int, int, ...);
-wchar_t* _wmktemp (wchar_t*);
-long _wfindfirsti64 (const wchar_t*, struct _wfinddatai64_t*);
-int _wfindnexti64 (long, struct _wfinddatai64_t*);
-#endif /* defined (__MSVCRT__) */
-#define _WIO_DEFINED
-#endif /* _WIO_DEFINED */
-
-#ifndef _WSTDIO_DEFINED
-/* also in stdio.h - keep in sync */
-int fwprintf (FILE*, const wchar_t*, ...);
-int wprintf (const wchar_t*, ...);
-int swprintf (wchar_t*, const wchar_t*, ...);
-int _snwprintf (wchar_t*, size_t, const wchar_t*, ...);
-int vfwprintf (FILE*, const wchar_t*, va_list);
-int vwprintf (const wchar_t*, va_list);
-int vswprintf (wchar_t*, const wchar_t*, va_list);
-int _vsnwprintf (wchar_t*, size_t, const wchar_t*, va_list);
-int fwscanf (FILE*, const wchar_t*, ...);
-int wscanf (const wchar_t*, ...);
-int swscanf (const wchar_t*, const wchar_t*, ...);
-wint_t fgetwc (FILE*);
-wint_t fputwc (wchar_t, FILE*);
-wint_t ungetwc (wchar_t, FILE*);
-
-#ifndef __NO_ISOCEXT /* externs in libmingwex.a */
-int snwprintf(wchar_t* s, size_t n, const wchar_t* format, ...);
-extern __inline__ int vsnwprintf (wchar_t* s, size_t n, const wchar_t* format,
- va_list arg)
- { return _vsnwprintf ( s, n, format, arg); }
-#endif
-
-#ifdef __MSVCRT__
-wchar_t* fgetws (wchar_t*, int, FILE*);
-int fputws (const wchar_t*, FILE*);
-wint_t getwc (FILE*);
-wint_t getwchar (void);
-wchar_t* _getws (wchar_t*);
-wint_t putwc (wint_t, FILE*);
-int _putws (const wchar_t*);
-wint_t putwchar (wint_t);
-
-FILE* _wfopen (const wchar_t*, const wchar_t*);
-FILE* _wfreopen (const wchar_t*, const wchar_t*, FILE*);
-FILE* _wfsopen (const wchar_t*, const wchar_t*, int);
-wchar_t* _wtmpnam (wchar_t*);
-wchar_t* _wtempnam (const wchar_t*, const wchar_t*);
-int _wrename (const wchar_t*, const wchar_t*);
-int _wremove (const wchar_t*)
-
-FILE* _wpopen (const wchar_t*, const wchar_t*)
-void _wperror (const wchar_t*);
-#endif /* __MSVCRT__ */
-#define _WSTDIO_DEFINED
-#endif /* _WSTDIO_DEFINED */
-
-#ifndef _WDIRECT_DEFINED
-/* Also in direct.h */
-#ifdef __MSVCRT__
-int _wchdir (const wchar_t*);
-wchar_t* _wgetcwd (wchar_t*, int);
-wchar_t* _wgetdcwd (int, wchar_t*, int);
-int _wmkdir (const wchar_t*);
-int _wrmdir (const wchar_t*);
-#endif /* __MSVCRT__ */
-#define _WDIRECT_DEFINED
-#endif /* _WDIRECT_DEFINED */
-
-#ifndef _STAT_DEFINED
-/*
- * The structure manipulated and returned by stat and fstat.
- *
- * NOTE: If called on a directory the values in the time fields are not only
- * invalid, they will cause localtime et. al. to return NULL. And calling
- * asctime with a NULL pointer causes an Invalid Page Fault. So watch it!
- */
-struct _stat
-{
- _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */
- _ino_t st_ino; /* Always zero ? */
- _mode_t st_mode; /* See above constants */
- short st_nlink; /* Number of links. */
- short st_uid; /* User: Maybe significant on NT ? */
- short st_gid; /* Group: Ditto */
- _dev_t st_rdev; /* Seems useless (not even filled in) */
- _off_t st_size; /* File size in bytes */
- time_t st_atime; /* Accessed date (always 00:00 hrs local
- * on FAT) */
- time_t st_mtime; /* Modified time */
- time_t st_ctime; /* Creation time */
-};
-
-struct stat
-{
- _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */
- _ino_t st_ino; /* Always zero ? */
- _mode_t st_mode; /* See above constants */
- short st_nlink; /* Number of links. */
- short st_uid; /* User: Maybe significant on NT ? */
- short st_gid; /* Group: Ditto */
- _dev_t st_rdev; /* Seems useless (not even filled in) */
- _off_t st_size; /* File size in bytes */
- time_t st_atime; /* Accessed date (always 00:00 hrs local
- * on FAT) */
- time_t st_mtime; /* Modified time */
- time_t st_ctime; /* Creation time */
-};
-#if defined (__MSVCRT__)
-struct _stati64 {
- _dev_t st_dev;
- _ino_t st_ino;
- unsigned short st_mode;
- short st_nlink;
- short st_uid;
- short st_gid;
- _dev_t st_rdev;
- __int64 st_size;
- time_t st_atime;
- time_t st_mtime;
- time_t st_ctime;
- };
-#endif /* __MSVCRT__ */
-#define _STAT_DEFINED
-#endif /* _STAT_DEFINED */
-
-#if !defined ( _WSTAT_DEFINED)
-/* also declared in sys/stat.h */
-#if defined __MSVCRT__
-int _wstat (const wchar_t*, struct _stat*);
-int _wstati64 (const wchar_t*, struct _stati64*);
-#endif /* __MSVCRT__ */
-#define _WSTAT_DEFINED
-#endif /* ! _WSTAT_DEFIND */
-
-#ifndef _WTIME_DEFINED
-#ifdef __MSVCRT__
-/* wide function prototypes, also declared in time.h */
-wchar_t* _wasctime (const struct tm*);
-wchar_t* _wctime (const time_t*);
-wchar_t* _wstrdate (wchar_t*);
-wchar_t* _wstrtime (wchar_t*);
-#endif /* __MSVCRT__ */
-size_t wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*);
-#define _WTIME_DEFINED
-#endif /* _WTIME_DEFINED */
-
-#ifndef _WLOCALE_DEFINED /* also declared in locale.h */
-wchar_t* _wsetlocale (int, const wchar_t*);
-#define _WLOCALE_DEFINED
-#endif
-
-#ifndef _WSTDLIB_DEFINED /* also declared in stdlib.h */
-long wcstol (const wchar_t*, wchar_t**, int);
-unsigned long wcstoul (const wchar_t*, wchar_t**, int);
-double wcstod (const wchar_t*, wchar_t**);
-#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */
-extern __inline__ float wcstof( const wchar_t *nptr, wchar_t **endptr)
-{ return (wcstod(nptr, endptr)); }
-#endif /* __NO_ISOCEXT */
-#define _WSTDLIB_DEFINED
-#endif
-
-
-#ifndef _NO_OLDNAMES
-
-/* Wide character versions. Also declared in io.h. */
-/* CHECK: Are these in the oldnames??? NO! */
-#if (0)
-int waccess (const wchar_t *, int);
-int wchmod (const wchar_t *, int);
-int wcreat (const wchar_t *, int);
-long wfindfirst (wchar_t *, struct _wfinddata_t *);
-int wfindnext (long, struct _wfinddata_t *);
-int wunlink (const wchar_t *);
-int wrename (const wchar_t *, const wchar_t *);
-int wremove (const wchar_t *);
-int wopen (const wchar_t *, int, ...);
-int wsopen (const wchar_t *, int, int, ...);
-wchar_t* wmktemp (wchar_t *);
-#endif
-#endif /* _NO_OLDNAMES */
-
-#endif /* not __STRICT_ANSI__ */
-
-/* These are resolved by -lmsvcp60 */
-/* If you don't have msvcp60.dll in your windows system directory, you can
- easily obtain it with a search from your favorite search engine. */
-typedef int mbstate_t;
-typedef wchar_t _Wint_t;
-
-wint_t btowc(int);
-size_t mbrlen(const char *, size_t, mbstate_t *);
-size_t mbrtowc(wchar_t *, const char *, size_t, mbstate_t *);
-size_t mbsrtowcs(wchar_t *, const char **, size_t, mbstate_t *);
-
-size_t wcrtomb(char *, wchar_t, mbstate_t *);
-size_t wcsrtombs(char *, const wchar_t **, size_t, mbstate_t *);
-int wctob(wint_t);
-
-#ifndef __NO_ISOCEXT /* these need static lib libmingwex.a */
-extern __inline__ int fwide(FILE* stream, int mode) {return -1;} /* limited to byte orientation */
-extern __inline__ int mbsinit(const mbstate_t* ps) {return 1;}
-wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n);
-wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n);
-int wmemcmp(const wchar_t* s1, const wchar_t * s2, size_t n);
-wchar_t* wmemcpy(wchar_t* __restrict__ s1, const wchar_t* __restrict__ s2,
- size_t n);
-wchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n);
-long long wcstoll(const wchar_t* __restrict__ nptr,
- wchar_t** __restrict__ endptr, int base);
-unsigned long long wcstoull(const wchar_t* __restrict__ nptr,
- wchar_t ** __restrict__ endptr, int base);
-
-#endif /* __NO_ISOCEXT */
-
-
-#ifdef __cplusplus
-} /* end of extern "C" */
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* not _WCHAR_H_ */
-
diff --git a/winsup/mingw/include/wctype.h b/winsup/mingw/include/wctype.h
deleted file mode 100644
index f39ef6496..000000000
--- a/winsup/mingw/include/wctype.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * wctype.h
- *
- * Functions for testing wide character types and converting characters.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Mumit Khan <khan@xraylith.wisc.edu>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- */
-
-#ifndef _WCTYPE_H_
-#define _WCTYPE_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
-
-#define __need_wchar_t
-#define __need_wint_t
-#ifndef RC_INVOKED
-#include <stddef.h>
-#endif /* Not RC_INVOKED */
-
-/*
- * The following flags are used to tell iswctype and _isctype what character
- * types you are looking for.
- */
-#define _UPPER 0x0001
-#define _LOWER 0x0002
-#define _DIGIT 0x0004
-#define _SPACE 0x0008
-#define _PUNCT 0x0010
-#define _CONTROL 0x0020
-#define _BLANK 0x0040
-#define _HEX 0x0080
-#define _LEADBYTE 0x8000
-
-#define _ALPHA 0x0103
-
-#ifndef RC_INVOKED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef WEOF
-#define WEOF (wchar_t)(0xFFFF)
-#endif
-
-#ifndef _WCTYPE_T_DEFINED
-typedef wchar_t wctype_t;
-#define _WCTYPE_T_DEFINED
-#endif
-
-/* Wide character equivalents - also in ctype.h */
-int iswalnum(wint_t);
-int iswalpha(wint_t);
-int iswascii(wint_t);
-int iswcntrl(wint_t);
-int iswctype(wint_t, wctype_t);
-int is_wctype(wint_t, wctype_t); /* Obsolete! */
-int iswdigit(wint_t);
-int iswgraph(wint_t);
-int iswlower(wint_t);
-int iswprint(wint_t);
-int iswpunct(wint_t);
-int iswspace(wint_t);
-int iswupper(wint_t);
-int iswxdigit(wint_t);
-
-wchar_t towlower(wchar_t);
-wchar_t towupper(wchar_t);
-
-int isleadbyte (int);
-
-/* Also in ctype.h */
-
-#ifdef __DECLSPEC_SUPPORTED
-__MINGW_IMPORT unsigned short _ctype[];
-# ifdef __MSVCRT__
- __MINGW_IMPORT unsigned short* _pctype;
-# else /* CRTDLL */
- __MINGW_IMPORT unsigned short* _pctype_dll;
-# define _pctype _pctype_dll
-# endif
-
-#else /* ! __DECLSPEC_SUPPORTED */
-extern unsigned short** _imp___ctype;
-#define _ctype (*_imp___ctype)
-# ifdef __MSVCRT__
- extern unsigned short** _imp___pctype;
-# define _pctype (*_imp___pctype)
-# else /* CRTDLL */
- extern unsigned short** _imp___pctype_dll;
-# define _pctype (*_imp___pctype_dll)
-# endif /* CRTDLL */
-#endif /* __DECLSPEC_SUPPORTED */
-
-
-#if !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED))
-#define __WCTYPE_INLINES_DEFINED
-extern __inline__ int iswalnum(wint_t wc) {return (iswctype(wc,_ALPHA|_DIGIT));}
-extern __inline__ int iswalpha(wint_t wc) {return (iswctype(wc,_ALPHA));}
-extern __inline__ int iswascii(wint_t wc) {return (((unsigned)wc & 0x7F) ==0);}
-extern __inline__ int iswcntrl(wint_t wc) {return (iswctype(wc,_CONTROL));}
-extern __inline__ int iswdigit(wint_t wc) {return (iswctype(wc,_DIGIT));}
-extern __inline__ int iswgraph(wint_t wc) {return (iswctype(wc,_PUNCT|_ALPHA|_DIGIT));}
-extern __inline__ int iswlower(wint_t wc) {return (iswctype(wc,_LOWER));}
-extern __inline__ int iswprint(wint_t wc) {return (iswctype(wc,_BLANK|_PUNCT|_ALPHA|_DIGIT));}
-extern __inline__ int iswpunct(wint_t wc) {return (iswctype(wc,_PUNCT));}
-extern __inline__ int iswspace(wint_t wc) {return (iswctype(wc,_SPACE));}
-extern __inline__ int iswupper(wint_t wc) {return (iswctype(wc,_UPPER));}
-extern __inline__ int iswxdigit(wint_t wc) {return (iswctype(wc,_HEX));}
-extern __inline__ int isleadbyte(int c) {return (_pctype[(unsigned char)(c)] & _LEADBYTE);}
-#endif /* !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) */
-
-
-typedef wchar_t wctrans_t;
-wint_t towctrans(wint_t, wctrans_t);
-wctrans_t wctrans(const char*);
-wctype_t wctype(const char*);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* Not RC_INVOKED */
-
-#endif /* Not _WCTYPE_H_ */
-
diff --git a/winsup/mingw/init.c b/winsup/mingw/init.c
deleted file mode 100644
index 8fa4652fa..000000000
--- a/winsup/mingw/init.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * init.c
- *
- * Code to initialize standard file handles and command line arguments.
- * This file is #included in both crt1.c and dllcrt1.c.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- * Maintained by Mumit Khan <khan@xraylith.wisc.EDU>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAMED. This includes but is not limited to warrenties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-/*
- * Access to a standard 'main'-like argument count and list. Also included
- * is a table of environment variables.
- */
-int _argc = 0;
-char **_argv = 0;
-
-/* NOTE: Thanks to Pedro A. Aranda Gutiirrez <paag@tid.es> for pointing
- * this out to me. GetMainArgs (used below) takes a fourth argument
- * which is an int that controls the globbing of the command line. If
- * _CRT_glob is non-zero the command line will be globbed (e.g. *.*
- * expanded to be all files in the startup directory). In the mingw32
- * library a _CRT_glob variable is defined as being -1, enabling
- * this command line globbing by default. To turn it off and do all
- * command line processing yourself (and possibly escape bogons in
- * MS's globbing code) include a line in one of your source modules
- * defining _CRT_glob and setting it to zero, like this:
- * int _CRT_glob = 0;
- */
-extern int _CRT_glob;
-
-#ifdef __MSVCRT__
-typedef struct {
- int newmode;
-} _startupinfo;
-extern void __getmainargs (int *, char ***, char ***, int, _startupinfo *);
-#else
-extern void __GetMainArgs (int *, char ***, char ***, int);
-#endif
-
-/*
- * Initialize the _argc, _argv and environ variables.
- */
-static void
-_mingw32_init_mainargs ()
-{
- /* The environ variable is provided directly in stdlib.h through
- * a dll function call. */
- char **dummy_environ;
-#ifdef __MSVCRT__
- _startupinfo start_info;
- start_info.newmode = 0;
-#endif
-
- /*
- * Microsoft's runtime provides a function for doing just that.
- */
-#ifdef __MSVCRT__
- (void) __getmainargs (&_argc, &_argv, &dummy_environ, _CRT_glob,
- &start_info);
-#else
- /* CRTDLL version */
- (void) __GetMainArgs (&_argc, &_argv, &dummy_environ, _CRT_glob);
-#endif
-}
-
diff --git a/winsup/mingw/install-sh b/winsup/mingw/install-sh
deleted file mode 100755
index 9344e52bc..000000000
--- a/winsup/mingw/install-sh
+++ /dev/null
@@ -1,253 +0,0 @@
-#!/bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5 (mit/util/scripts/install.sh).
-#
-# Copyright 1991 by the Massachusetts Institute of Technology
-#
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation, and that the name of M.I.T. not be used in advertising or
-# publicity pertaining to distribution of the software without specific,
-# written prior permission. M.I.T. makes no representations about the
-# suitability of this software for any purpose. It is provided "as is"
-# without express or implied warranty.
-#
-# 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. It can only install one file at a time, a restriction
-# shared with many OS's install programs.
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd="$cpprog"
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd="$stripprog"
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "install: no input file specified"
- exit 1
-else
- true
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d $dst ]; then
- instcmd=:
- chmodcmd=""
- else
- instcmd=mkdir
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f $src -o -d $src ]
- then
- true
- else
- echo "install: $src does not exist"
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "install: no destination specified"
- exit 1
- else
- true
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d $dst ]
- then
- dst="$dst"/`basename $src`
- else
- true
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp="${pathcomp}${1}"
- shift
-
- if [ ! -d "${pathcomp}" ] ;
- then
- $mkdirprog "${pathcomp}"
- else
- true
- fi
-
- pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd $dst &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
- else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
- else
- true
- fi
-
-# Make a temp file name in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd $src $dsttmp &&
-
- trap "rm -f ${dsttmp}" 0 &&
-
-# 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 $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
- $doit $rmcmd -f $dstdir/$dstfile
- ([ -f $dstdir/$dstfile ] &&
- $doit $mvcmd $dstdir/$dstfile $dstdir/$dstfile.$$ );
- exec $doit $mvcmd $dsttmp $dstdir/$dstfile
-
-fi &&
-
-
-exit 0
diff --git a/winsup/mingw/jamfile b/winsup/mingw/jamfile
deleted file mode 100644
index 1769d952d..000000000
--- a/winsup/mingw/jamfile
+++ /dev/null
@@ -1,72 +0,0 @@
-#
-# Jamfile for building various libraries and object files for the
-# Minimalist GNU-Win32 package.
-#
-# $Revision$
-# $Author$
-# $Date$
-#
-
-# Change this line if you have installed Mingw32 in another directory.
-#
-LOCATE_TARGET = /mingw32/lib ;
-
-RUNTIME default = crtdll ;
-
-# Build the mingw32 library which contains startup code and extra support
-# routines.
-#
-Library libmingw32.a :
- CRTglob.c
- CRTfmode.c
- CRTinit.c
- dirent.c
- dllmain.c
- gccmain.c
- main.c
- ;
-
-
-# Build the startup object files for normal applications and for DLLs.
-# The crt2 and dllcrt2 versions are for MSVCRTxx.DLL runtimes. crt1 and
-# dllcrt1 are for the CRTDLL.DLL runtime.
-#
-Object crt1.o : crt1.c ;
-Object crt2.o : crt1.c ;
-
-CCFLAGS on crt2.o += -D__MSVCRT__ ;
-
-Object dllcrt1.o : dllcrt1.c ;
-Object dllcrt2.o : dllcrt1.c ;
-
-CCFLAGS on dllcrt2.o += -D__MSVCRT__ ;
-
-DEPENDS all : crt1.o dllcrt1.o crt2.o dllcrt2.o ;
-
-
-# Build an object file which contains a single global variable initialized
-# so that globbing will not be performed on the command line.
-#
-Object CRT_noglob.o : CRT_noglob.c ;
-LOCATE on CRT_noglob.o = $(LOCATE_TARGET) ;
-
-DEPENDS all : CRT_noglob.o ;
-
-
-# Build a special import library which contains mostly the imports defined
-# in moldname.def, but with their leading underscores stripped off, plus the
-# extra code in the C modules included.
-#
-ImportLib libmoldname.a : moldname.def ctype_old.c string_old.c ;
-
-DLLNAME on libmoldname.a = $(RUNTIME).dll ;
-DLLTOOLFLAGS on libmoldname.a += -U ;
-
-
-# Build import libraries for the various runtimes.
-#
-ImportLib libcrtdll.a : crtdll.def ;
-ImportLib libmsvcrt.a : msvcrt.def ;
-ImportLib libmsvcrt20.a : msvcrt20.def ;
-ImportLib libmsvcrt40.a : msvcrt40.def ;
-
diff --git a/winsup/mingw/main.c b/winsup/mingw/main.c
deleted file mode 100644
index ea1dcd85e..000000000
--- a/winsup/mingw/main.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * main.c
- *
- * Extra startup code for applications which do not have a main function
- * of their own (but do have a WinMain). Generally these are GUI
- * applications, but they don't *have* to be.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- * Maintained by Mumit Khan <khan@xraylith.wisc.EDU>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAMED. This includes but is not limited to warrenties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#include <stdlib.h>
-#include <process.h>
-#include <windows.h>
-
-#define ISSPACE(a) (a == ' ' || a == '\t')
-
-extern int PASCAL WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
- LPSTR szCmdLine, int nShow);
-
-int
-main (int argc, char *argv[], char *environ[])
-{
- char *szCmd;
- STARTUPINFO startinfo;
- int nRet;
-
- /* Get the command line passed to the process. */
- szCmd = GetCommandLineA ();
- GetStartupInfoA (&startinfo);
-
- /* Strip off the name of the application and any leading
- * whitespace. */
- if (szCmd)
- {
- while (ISSPACE (*szCmd))
- {
- szCmd++;
- }
-
- /* On my system I always get the app name enclosed
- * in quotes... */
- if (*szCmd == '\"')
- {
- do
- {
- szCmd++;
- }
- while (*szCmd != '\"' && *szCmd != '\0');
-
- if (*szCmd == '\"')
- {
- szCmd++;
- }
- }
- else
- {
- /* If no quotes then assume first token is program
- * name. */
- while (!ISSPACE (*szCmd) && *szCmd != '\0')
- {
- szCmd++;
- }
- }
-
- while (ISSPACE (*szCmd))
- {
- szCmd++;
- }
- }
-
- nRet = WinMain (GetModuleHandle (NULL), NULL, szCmd,
- (startinfo.dwFlags & STARTF_USESHOWWINDOW) ?
- startinfo.wShowWindow : SW_SHOWDEFAULT);
-
- return nRet;
-}
-
diff --git a/winsup/mingw/mingwex/Makefile.in b/winsup/mingw/mingwex/Makefile.in
deleted file mode 100644
index 59f8e40e4..000000000
--- a/winsup/mingw/mingwex/Makefile.in
+++ /dev/null
@@ -1,236 +0,0 @@
-#
-# mingw/mingwex/Makefile.in: This file is part of Mingw runtime.
-#
-# This makefile requires GNU make.
-
-VPATH = @srcdir@
-srcdir = @srcdir@
-objdir = .
-
-target_alias = @target_alias@
-prefix = @prefix@
-
-program_transform_name = @program_transform_name@
-exec_prefix = @exec_prefix@
-bindir = @bindir@
-libdir = @libdir@
-tooldir = $(exec_prefix)/$(target_alias)
-datadir = @datadir@
-infodir = @infodir@
-includedir = @includedir@
-
-SHELL = /bin/sh
-
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-mkinstalldirs = $(SHELL) $(srcdir)/../mkinstalldirs
-DISTFILES = Makefile.in configure configure.in \
- mingw-fseek.c \
- _Exit.c \
- atoll.c \
- copysignl.S \
- dirent.c \
- fdim.c \
- fdimf.c \
- fdiml.c \
- feclearexcept.c \
- fegetenv.c \
- fegetexceptflag.c \
- fegetround.c \
- feholdexcept.c \
- feraiseexcept.c \
- fesetenv.c \
- fesetround.c \
- fetestexcept.c \
- fesetexceptflag.c \
- feupdateenv.c \
- fma.S \
- fmaf.S \
- fmal.c \
- fmax.c \
- fmaxf.c \
- fmaxl.c \
- fmin.c \
- fminf.c \
- fminl.c \
- fp_consts.c \
- fpclassify.c \
- fpclassifyf.c \
- fpclassifyl.c \
- fucom.c \
- fwide.c \
- imaxabs.c \
- imaxdiv.c \
- isnan.c \
- isnanf.c \
- isnanl.c \
- lltoa.c \
- lltow.c \
- log2.c \
- log2f.c \
- log2l.c \
- math_stubs.c \
- mbsinit.c \
- rint.c \
- rintf.c \
- rintl.c \
- round.c \
- roundf.c \
- roundl.c \
- signbit.c \
- signbitf.c \
- signbitl.c \
- sitest.c \
- snprintf.c \
- snwprintf.c \
- strtof.c \
- strtoimax.c \
- strtoumax.c \
- testwmem.c \
- trunc.c \
- truncf.c \
- truncl.c \
- ulltoa.c \
- ulltow.c \
- vsnprintf.c \
- vsnwprintf.c \
- wcstof.c \
- wcstoimax.c \
- wcstoumax.c \
- wdirent.c \
- wmemchr.c \
- wmemcmp.c \
- wmemcpy.c \
- wmemmove.c \
- wmemset.c \
- wtoll.c
-
-CC = @CC@
-# FIXME: Which is it, CC or CC_FOR_TARGET?
-CC_FOR_TARGET = $(CC)
-AS_FOR_TARGET = $(AS)
-CFLAGS = @CFLAGS@ -Wall
-CXXFLAGS = @CXXFLAGS@
-OPTFLAGS= -fomit-frame-pointer
-
-# compiling with Cygwin?
-MNO_CYGWIN = @MNO_CYGWIN@
-
-
-INCLUDES = -I$(srcdir) -I$(srcdir)/../include \
- -I$(srcdir)/../../w32api/include \
- -nostdinc -nostdinc++ \
- -iwithprefixbefore include
-ALL_CFLAGS = $(CFLAGS) $(OPTFLAGS) $(INCLUDES) $(MNO_CYGWIN)
-ALL_CXXFLAGS = $(CXXFLAGS) $(OPTFLAGS) $(INCLUDES) $(MNO_CYGWIN)
-
-AS = @AS@
-AR = @AR@
-LD = @LD@
-AR_FLAGS = rcv
-RANLIB = @RANLIB@
-DLLTOOL = @DLLTOOL@
-DLLTOOLFLAGS =
-DLLTOOL_FOR_TARGET = $(DLLTOOL)
-DLLTOOL_FLAGS = --as $(AS_FOR_TARGET)
-
-LIBMINGWEX_A = libmingwex.a
-
-Q8_OBJS = \
- fwide.o imaxabs.o imaxdiv.o mbsinit.o \
- strtoimax.o strtoumax.o wcstoimax.o wcstoumax.o \
- wmemchr.o wmemcmp.o wmemcpy.o wmemmove.o wmemset.o
-STDLIB_STUB_OBJS = \
- lltoa.o ulltoa.o \
- lltow.o ulltow.o \
- atoll.o wtoll.o \
- strtof.o wcstof.o \
- _Exit.o
-STDIO_STUB_OBJS = \
- snprintf.o vsnprintf.o snwprintf.o vsnwprintf.o
-MATH_OBJS = \
- fpclassify.o fpclassifyf.o fpclassifyl.o \
- fucom.o \
- round.o roundf.o roundl.o \
- rint.o rintf.o rintl.o \
- signbit.o signbitf.o signbitl.o \
- trunc.o truncf.o truncl.o \
- isnan.o isnanf.o isnanl.o \
- fp_consts.o \
- fdim.o fdimf.o fdiml.o \
- fmax.o fmaxf.o fmaxl.o \
- fmin.o fminf.o fminl.o \
- fma.o fmaf.o fmal.o \
- log2.o log2f.o log2l.o \
- copysignl.o
-MATH_STUB_OBJS = \
- math_stubs.o
-FENV_OBJS = fesetround.o fegetround.o \
- fegetenv.o fesetenv.o feupdateenv.o \
- feclearexcept.o feholdexcept.o fegetexceptflag.o \
- feraiseexcept.o fetestexcept.o fesetexceptflag.o
-POSIX_OBJS = \
- dirent.o wdirent.o
-REPLACE_OBJS = \
- mingw-fseek.o
-
-LIB_OBJS = $(Q8_OBJS) $(STDLIB_STUB_OBJS) $(STDIO_STUB_OBJS) \
- $(MATH_OBJS) $(MATH_STUB_OBJS) $(FENV_OBJS) $(POSIX_OBJS) \
- $(REPLACE_OBJS)
-
-LIBS = $(LIBMINGWEX_A)
-DLLS =
-
-all: $(LIBMINGWEX_A)
-
-$(LIBMINGWEX_A): $(LIB_OBJS)
- $(AR) $(ARFLAGS) $@ $(LIB_OBJS)
- $(RANLIB) $@
-
-
-Makefile: Makefile.in config.status configure
- $(SHELL) config.status
-
-config.status: configure
- $(SHELL) config.status --recheck
-
-info:
-
-info-html:
-
-install-info: info
-
-install: all
- $(mkinstalldirs) $(inst_libdir)
- for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
- done
-
-clean:
- -rm -f $(LIB_OBJS) $(LIBMINGWEX_A)
-
-distclean:
- -rm -f *.o *.a *~ core a.out
- -rm -f config.cache config.status config.log
- -rm -f Makefile
-.c.o:
- $(CC) -c $(ALL_CFLAGS) $< -o $@
-.S.o:
- $(CC) -c $< -o $@
-.s.o:
- $(CC) -c $< -o $@
-
-
-#
-# Dependancies
-#
-wdirent.o: $(srcdir)/dirent.c $(srcdir)/wdirent.c
-
-
-dist:
- mkdir $(distdir)/mingwex
- chmod 755 $(distdir)/mingwex
- @for i in $(DISTFILES); do\
- cp -p $(srcdir)/$$i $(distdir)/mingwex/$$i ; \
- done
diff --git a/winsup/mingw/mingwex/_Exit.c b/winsup/mingw/mingwex/_Exit.c
deleted file mode 100644
index 38f7e182e..000000000
--- a/winsup/mingw/mingwex/_Exit.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <stdlib.h>
-void _Exit(int status)
- { _exit(status); }
diff --git a/winsup/mingw/mingwex/atoll.c b/winsup/mingw/mingwex/atoll.c
deleted file mode 100644
index 97920b4ee..000000000
--- a/winsup/mingw/mingwex/atoll.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <stdlib.h>
-long long atoll (const char * _c)
- { return _atoi64 (_c); }
diff --git a/winsup/mingw/mingwex/configure b/winsup/mingw/mingwex/configure
deleted file mode 100755
index 746c6fedc..000000000
--- a/winsup/mingw/mingwex/configure
+++ /dev/null
@@ -1,1007 +0,0 @@
-#! /bin/sh
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-
-# Defaults:
-ac_help=
-ac_default_prefix=/usr/local
-# Any additions from configure.in:
-
-# Initialize some variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
-exec_prefix=NONE
-host=NONE
-no_create=
-nonopt=NONE
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-target=NONE
-verbose=
-x_includes=NONE
-x_libraries=NONE
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
-ac_prev=
-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=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case "$ac_option" in
-
- -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 ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$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" ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir="$ac_optarg" ;;
-
- -disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_${ac_feature}='$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)
- # 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 << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --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
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host="$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" ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- 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)
- 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" ;;
-
- -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 ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
- exit 0 ;;
-
- -with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "with_${ac_package}='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=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" ;;
-
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
- ;;
-
- *)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
-
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
-do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
- esac
-done
-
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
-
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=imaxabs.c
-
-# 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 its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
- 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
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
- else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
- fi
-fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
-else
- echo "creating cache $cache_file"
- > $cache_file
-fi
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
-
-
-
-CC=${CC-cc}
-
-AS=${AS-as}
-
-AR=${AR-ar}
-
-LD=${LD-ld}
-
-RANLIB=${RANLIB-ranlib}
-
-DLLTOOL=${DLLTOOL-dlltool}
-
-DLLWRAP=${DLLWRAP-dllwrap}
-
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-
-# Do some error checking and defaulting for the host and target type.
-# The inputs are:
-# configure --host=HOST --target=TARGET --build=BUILD NONOPT
-#
-# The rules are:
-# 1. You are not allowed to specify --host, --target, and nonopt at the
-# same time.
-# 2. Host defaults to nonopt.
-# 3. If nonopt is not specified, then host defaults to the current host,
-# as determined by config.guess.
-# 4. Target and build default to nonopt.
-# 5. If nonopt is not specified, then target and build default to host.
-
-# The aliases save the names the user supplied, while $host etc.
-# will get canonicalized.
-case $host---$target---$nonopt in
-NONE---*---* | *---NONE---* | *---*---NONE) ;;
-*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
-esac
-
-
-# Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:587: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
- case $nonopt in
- NONE)
- if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
- else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
- fi ;;
- *) host_alias=$nonopt ;;
- esac ;;
-esac
-
-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
-
-echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:608: checking target system type" >&5
-
-target_alias=$target
-case "$target_alias" in
-NONE)
- case $nonopt in
- NONE) target_alias=$host_alias ;;
- *) target_alias=$nonopt ;;
- esac ;;
-esac
-
-target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
-target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$target" 1>&6
-
-echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:626: checking build system type" >&5
-
-build_alias=$build
-case "$build_alias" in
-NONE)
- case $nonopt in
- NONE) build_alias=$host_alias ;;
- *) build_alias=$nonopt ;;
- esac ;;
-esac
-
-build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
-build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$build" 1>&6
-
-test "$host_alias" != "$target_alias" &&
- test "$program_prefix$program_suffix$program_transform_name" = \
- NONENONEs,x,x, &&
- program_prefix=${target_alias}-
-
-
-case "$target_os" in
-*cygwin*)
- MNO_CYGWIN=-mno-cygwin
- ;;
-*)
- # Build it for MSVCRT by default.
- MNO_CYGWIN=
- ;;
-esac
-
-
-
-# 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
-# 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"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:673: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/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
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
-
-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. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL="$ac_install_sh"
- fi
-fi
-echo "$ac_t""$INSTALL" 1>&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_PROGRAM}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-trap '' 1 2 15
-cat > confcache <<\EOF
-# 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. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# 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.
-(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
- if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
-fi
-
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
-s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
-s%\[%\\&%g
-s%\]%\\&%g
-s%\$%$$%g
-EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-rm -f conftest.defs
-
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
-
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
-# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
-# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
-
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
-do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
-done
-
-ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
-
-trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@CC@%$CC%g
-s%@AS@%$AS%g
-s%@AR@%$AR%g
-s%@LD@%$LD%g
-s%@RANLIB@%$RANLIB%g
-s%@DLLTOOL@%$DLLTOOL%g
-s%@DLLWRAP@%$DLLWRAP%g
-s%@host@%$host%g
-s%@host_alias@%$host_alias%g
-s%@host_cpu@%$host_cpu%g
-s%@host_vendor@%$host_vendor%g
-s%@host_os@%$host_os%g
-s%@target@%$target%g
-s%@target_alias@%$target_alias%g
-s%@target_cpu@%$target_cpu%g
-s%@target_vendor@%$target_vendor%g
-s%@target_os@%$target_os%g
-s%@build@%$build%g
-s%@build_alias@%$build_alias%g
-s%@build_cpu@%$build_cpu%g
-s%@build_vendor@%$build_vendor%g
-s%@build_os@%$build_os%g
-s%@MNO_CYGWIN@%$MNO_CYGWIN%g
-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
-s%@INSTALL_DATA@%$INSTALL_DATA%g
-
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
- else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
- fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
- else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
- fi
-done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
-fi
-EOF
-
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
- fi
-
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
-
- case "$ac_given_INSTALL" in
- [/$]*) INSTALL="$ac_given_INSTALL" ;;
- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
- esac
-
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
- esac
-
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-s%@INSTALL@%$INSTALL%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
-
diff --git a/winsup/mingw/mingwex/configure.in b/winsup/mingw/mingwex/configure.in
deleted file mode 100644
index 4c0ed4207..000000000
--- a/winsup/mingw/mingwex/configure.in
+++ /dev/null
@@ -1,52 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-
-dnl This file is part of Mingw runtime.
-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 This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-AC_PREREQ(2.13)
-AC_INIT(imaxabs.c)
-
-CC=${CC-cc}
-AC_SUBST(CC)
-AS=${AS-as}
-AC_SUBST(AS)
-AR=${AR-ar}
-AC_SUBST(AR)
-LD=${LD-ld}
-AC_SUBST(LD)
-RANLIB=${RANLIB-ranlib}
-AC_SUBST(RANLIB)
-DLLTOOL=${DLLTOOL-dlltool}
-AC_SUBST(DLLTOOL)
-DLLWRAP=${DLLWRAP-dllwrap}
-AC_SUBST(DLLWRAP)
-AC_CANONICAL_SYSTEM
-
-case "$target_os" in
-*cygwin*)
- MNO_CYGWIN=-mno-cygwin
- ;;
-*)
- # Build it for MSVCRT by default.
- MNO_CYGWIN=
- ;;
-esac
-
-AC_SUBST(MNO_CYGWIN)
-
-AC_PROG_INSTALL
-AC_OUTPUT(Makefile)
-
diff --git a/winsup/mingw/mingwex/copysignl.S b/winsup/mingw/mingwex/copysignl.S
deleted file mode 100644
index 500607e24..000000000
--- a/winsup/mingw/mingwex/copysignl.S
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
- * Public domain.
- */
-
- .file "copysignl.S"
- .text
- .align 2
- .p2align 4,,15
-.globl _copysignl
- .def _copysignl; .scl 2; .type 32; .endef
-_copysignl:
- movl 24(%esp),%edx
- movl 12(%esp),%eax
- andl $0x8000,%edx
- andl $0x7fff,%eax
- orl %edx,%eax
- movl %eax,12(%esp)
- fldt 4(%esp)
- ret
diff --git a/winsup/mingw/mingwex/dirent.c b/winsup/mingw/mingwex/dirent.c
deleted file mode 100644
index 91c170619..000000000
--- a/winsup/mingw/mingwex/dirent.c
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * dirent.c
- *
- * Derived from DIRLIB.C by Matt J. Weinstein
- * This note appears in the DIRLIB.H
- * DIRLIB.H by M. J. Weinstein Released to public domain 1-Jan-89
- *
- * Updated by Jeremy Bettis <jeremy@hksys.com>
- * Significantly revised and rewinddir, seekdir and telldir added by Colin
- * Peters <colin@fu.is.saga-u.ac.jp>
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <io.h>
-#include <direct.h>
-#include <dirent.h>
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h> /* for GetFileAttributes */
-
-#include <tchar.h>
-#define SUFFIX _T("*")
-#define SLASH _T("\\")
-
-/*
- * opendir
- *
- * Returns a pointer to a DIR structure appropriately filled in to begin
- * searching a directory.
- */
-_TDIR *
-_topendir (const _TCHAR *szPath)
-{
- _TDIR *nd;
- unsigned int rc;
- _TCHAR szFullPath[MAX_PATH];
-
- errno = 0;
-
- if (!szPath)
- {
- errno = EFAULT;
- return (_TDIR *) 0;
- }
-
- if (szPath[0] == _T('\0'))
- {
- errno = ENOTDIR;
- return (_TDIR *) 0;
- }
-
- /* Attempt to determine if the given path really is a directory. */
- rc = GetFileAttributes (szPath);
- if (rc == -1)
- {
- /* call GetLastError for more error info */
- errno = ENOENT;
- return (_TDIR *) 0;
- }
- if (!(rc & FILE_ATTRIBUTE_DIRECTORY))
- {
- /* Error, entry exists but not a directory. */
- errno = ENOTDIR;
- return (_TDIR *) 0;
- }
-
- /* Make an absolute pathname. */
- _tfullpath (szFullPath, szPath, MAX_PATH);
-
- /* Allocate enough space to store DIR structure and the complete
- * directory path given. */
- nd = (_TDIR *) malloc (sizeof (_TDIR) + _tcslen (szFullPath) + _tcslen (SLASH) +
- _tcslen (SUFFIX));
-
- if (!nd)
- {
- /* Error, out of memory. */
- errno = ENOMEM;
- return (_TDIR *) 0;
- }
-
- /* Create the search expression. */
- _tcscpy (nd->dd_name, szFullPath);
-
- /* Add on a slash if the path does not end with one. */
- if (nd->dd_name[0] != _T('\0') &&
- nd->dd_name[_tcslen (nd->dd_name) - 1] != _T('/') &&
- nd->dd_name[_tcslen (nd->dd_name) - 1] != _T('\\'))
- {
- _tcscat (nd->dd_name, SLASH);
- }
-
- /* Add on the search pattern */
- _tcscat (nd->dd_name, SUFFIX);
-
- /* Initialize handle to -1 so that a premature closedir doesn't try
- * to call _findclose on it. */
- nd->dd_handle = -1;
-
- /* Initialize the status. */
- nd->dd_stat = 0;
-
- /* Initialize the dirent structure. ino and reclen are invalid under
- * Win32, and name simply points at the appropriate part of the
- * findfirst_t structure. */
- nd->dd_dir.d_ino = 0;
- nd->dd_dir.d_reclen = 0;
- nd->dd_dir.d_namlen = 0;
- nd->dd_dir.d_name = nd->dd_dta.name;
-
- return nd;
-}
-
-
-/*
- * readdir
- *
- * Return a pointer to a dirent structure filled with the information on the
- * next entry in the directory.
- */
-struct _tdirent *
-_treaddir (_TDIR * dirp)
-{
- errno = 0;
-
- /* Check for valid DIR struct. */
- if (!dirp)
- {
- errno = EFAULT;
- return (struct _tdirent *) 0;
- }
-
- if (dirp->dd_dir.d_name != dirp->dd_dta.name)
- {
- /* The structure does not seem to be set up correctly. */
- errno = EINVAL;
- return (struct _tdirent *) 0;
- }
-
- if (dirp->dd_stat < 0)
- {
- /* We have already returned all files in the directory
- * (or the structure has an invalid dd_stat). */
- return (struct _tdirent *) 0;
- }
- else if (dirp->dd_stat == 0)
- {
- /* We haven't started the search yet. */
- /* Start the search */
- dirp->dd_handle = _tfindfirst (dirp->dd_name, &(dirp->dd_dta));
-
- if (dirp->dd_handle == -1)
- {
- /* Whoops! Seems there are no files in that
- * directory. */
- dirp->dd_stat = -1;
- }
- else
- {
- dirp->dd_stat = 1;
- }
- }
- else
- {
- /* Get the next search entry. */
- if (_tfindnext (dirp->dd_handle, &(dirp->dd_dta)))
- {
- /* We are off the end or otherwise error. */
- _findclose (dirp->dd_handle);
- dirp->dd_handle = -1;
- dirp->dd_stat = -1;
- }
- else
- {
- /* Update the status to indicate the correct
- * number. */
- dirp->dd_stat++;
- }
- }
-
- if (dirp->dd_stat > 0)
- {
- /* Successfully got an entry. Everything about the file is
- * already appropriately filled in except the length of the
- * file name. */
- dirp->dd_dir.d_namlen = _tcslen (dirp->dd_dir.d_name);
- return &dirp->dd_dir;
- }
-
- return (struct _tdirent *) 0;
-}
-
-
-/*
- * closedir
- *
- * Frees up resources allocated by opendir.
- */
-int
-_tclosedir (_TDIR * dirp)
-{
- int rc;
-
- errno = 0;
- rc = 0;
-
- if (!dirp)
- {
- errno = EFAULT;
- return -1;
- }
-
- if (dirp->dd_handle != -1)
- {
- rc = _findclose (dirp->dd_handle);
- }
-
- /* Delete the dir structure. */
- free (dirp);
-
- return rc;
-}
-
-/*
- * rewinddir
- *
- * Return to the beginning of the directory "stream". We simply call findclose
- * and then reset things like an opendir.
- */
-void
-_trewinddir (_TDIR * dirp)
-{
- errno = 0;
-
- if (!dirp)
- {
- errno = EFAULT;
- return;
- }
-
- if (dirp->dd_handle != -1)
- {
- _findclose (dirp->dd_handle);
- }
-
- dirp->dd_handle = -1;
- dirp->dd_stat = 0;
-}
-
-/*
- * telldir
- *
- * Returns the "position" in the "directory stream" which can be used with
- * seekdir to go back to an old entry. We simply return the value in stat.
- */
-long
-_ttelldir (_TDIR * dirp)
-{
- errno = 0;
-
- if (!dirp)
- {
- errno = EFAULT;
- return -1;
- }
- return dirp->dd_stat;
-}
-
-/*
- * seekdir
- *
- * Seek to an entry previously returned by telldir. We rewind the directory
- * and call readdir repeatedly until either dd_stat is the position number
- * or -1 (off the end). This is not perfect, in that the directory may
- * have changed while we weren't looking. But that is probably the case with
- * any such system.
- */
-void
-_tseekdir (_TDIR * dirp, long lPos)
-{
- errno = 0;
-
- if (!dirp)
- {
- errno = EFAULT;
- return;
- }
-
- if (lPos < -1)
- {
- /* Seeking to an invalid position. */
- errno = EINVAL;
- return;
- }
- else if (lPos == -1)
- {
- /* Seek past end. */
- if (dirp->dd_handle != -1)
- {
- _findclose (dirp->dd_handle);
- }
- dirp->dd_handle = -1;
- dirp->dd_stat = -1;
- }
- else
- {
- /* Rewind and read forward to the appropriate index. */
- _trewinddir (dirp);
-
- while ((dirp->dd_stat < lPos) && _treaddir (dirp))
- ;
- }
-}
diff --git a/winsup/mingw/mingwex/fdim.c b/winsup/mingw/mingwex/fdim.c
deleted file mode 100644
index 330b09241..000000000
--- a/winsup/mingw/mingwex/fdim.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <math.h>
-
-double
-fdim (double x, double y)
-{
- return (isgreater(x, y) ? (x - y) : 0.0);
-}
diff --git a/winsup/mingw/mingwex/fdimf.c b/winsup/mingw/mingwex/fdimf.c
deleted file mode 100644
index 02bfc6e5e..000000000
--- a/winsup/mingw/mingwex/fdimf.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <math.h>
-
-float
-fdimf (float x, float y)
-{
- return (isgreater(x, y) ? (x - y) : 0.0F);
-}
diff --git a/winsup/mingw/mingwex/fdiml.c b/winsup/mingw/mingwex/fdiml.c
deleted file mode 100644
index 1c3d0aaaa..000000000
--- a/winsup/mingw/mingwex/fdiml.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <math.h>
-
-long double
-fdiml (long double x, long double y)
-{
- return (isgreater(x, y) ? (x - y) : 0.0L);
-}
diff --git a/winsup/mingw/mingwex/feclearexcept.c b/winsup/mingw/mingwex/feclearexcept.c
deleted file mode 100644
index e6017fc9d..000000000
--- a/winsup/mingw/mingwex/feclearexcept.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <fenv.h>
-
-/* 7.6.2.1
- The feclearexcept function clears the supported exceptions
- represented by its argument. */
-
-int feclearexcept (int excepts)
-{
- fenv_t _env;
- __asm__ volatile ("fnstenv %0;" : "=m" (_env)); /* get the env */
- _env.__status_word &= ~(excepts & FE_ALL_EXCEPT); /* clear the except */
- __asm__ volatile ("fldenv %0;" :: "m" (_env)); /*set the env */
- return 0;
-}
diff --git a/winsup/mingw/mingwex/fegetenv.c b/winsup/mingw/mingwex/fegetenv.c
deleted file mode 100644
index 8af510337..000000000
--- a/winsup/mingw/mingwex/fegetenv.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <fenv.h>
-
-/* 7.6.4.1
- The fegetenv function stores the current floating-point environment
- in the object pointed to by envp. */
-
-int fegetenv (fenv_t * envp)
-{
- __asm__ ("fnstenv %0;": "=m" (*envp));
- return 0;
-}
-
diff --git a/winsup/mingw/mingwex/fegetexceptflag.c b/winsup/mingw/mingwex/fegetexceptflag.c
deleted file mode 100644
index 353e90dfa..000000000
--- a/winsup/mingw/mingwex/fegetexceptflag.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <fenv.h>
-
-
-/* 7.6.2.2
- The fegetexceptflag function stores an implementation-defined
- representation of the exception flags indicated by the argument
- excepts in the object pointed to by the argument flagp. */
-
-int fegetexceptflag (fexcept_t * flagp, int excepts)
-{
- unsigned short _sw;
- __asm__ ("fnstsw %%ax;": "=a" (_sw));
- *flagp = _sw & excepts & FE_ALL_EXCEPT;
- return 0;
-}
diff --git a/winsup/mingw/mingwex/fegetround.c b/winsup/mingw/mingwex/fegetround.c
deleted file mode 100644
index 076b1068c..000000000
--- a/winsup/mingw/mingwex/fegetround.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <fenv.h>
-
-/* 7.6.3.1
- The fegetround function returns the value of the rounding direction
- macro representing the current rounding direction. */
-
-int
-fegetround (void)
-{
- unsigned short _cw;
- __asm__ ("fnstcw %0;" : "=m" (_cw));
- return _cw
- & (FE_TONEAREST | FE_DOWNWARD | FE_UPWARD | FE_TOWARDZERO);
-}
diff --git a/winsup/mingw/mingwex/feholdexcept.c b/winsup/mingw/mingwex/feholdexcept.c
deleted file mode 100644
index df486afb3..000000000
--- a/winsup/mingw/mingwex/feholdexcept.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <fenv.h>
-
-/* 7.6.4.2
- The feholdexcept function saves the current floating-point
- environment in the object pointed to by envp, clears the exception
- flags, and then installs a non-stop (continue on exceptions) mode,
- if available, for all exceptions. */
-
-int feholdexcept (fenv_t * envp)
-{
- fenv_t tmp_env;
- __asm__ ("fnstenv %0;" : "=m" (* envp)); /* save current into envp */
- tmp_env = * envp;
- tmp_env.__status_word &= ~FE_ALL_EXCEPT; /* clear exception flags */
- tmp_env.__control_word |= FE_ALL_EXCEPT; /* set cw to non-stop */
- __asm__ volatile ("fldenv %0;" : : "m" (tmp_env)); /* install the copy */
- return 0;
-}
diff --git a/winsup/mingw/mingwex/feraiseexcept.c b/winsup/mingw/mingwex/feraiseexcept.c
deleted file mode 100644
index b1ba87006..000000000
--- a/winsup/mingw/mingwex/feraiseexcept.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <fenv.h>
-
-/* 7.6.2.3
- The feraiseexcept function raises the supported exceptions
- represented by its argument The order in which these exceptions
- are raised is unspecified, except as stated in F.7.6.
- Whether the feraiseexcept function additionally raises
- the inexact exception whenever it raises the overflow
- or underflow exception is implementation-defined. */
-
-int feraiseexcept (int excepts)
-{
- fenv_t _env;
- __asm__ volatile ("fnstenv %0;" : "=m" (_env));
- _env.__status_word |= excepts & FE_ALL_EXCEPT;
- __asm__ volatile ("fldenv %0;"
- "fwait;" : : "m" (_env));
- return 0;
-}
diff --git a/winsup/mingw/mingwex/fesetenv.c b/winsup/mingw/mingwex/fesetenv.c
deleted file mode 100644
index b3d5c5f05..000000000
--- a/winsup/mingw/mingwex/fesetenv.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#include <fenv.h>
-
-/* 7.6.4.3
- The fesetenv function establishes the floating-point environment
- represented by the object pointed to by envp. The argument envp
- points to an object set by a call to fegetenv or feholdexcept, or
- equal the macro FE_DFL_ENV or an implementation-defined environment
- macro. Note that fesetenv merely installs the state of the exception
- flags represented through its argument, and does not raise these
- exceptions.
- */
-
-extern void (*_imp___fpreset)( void ) ;
-
-int fesetenv (const fenv_t * envp)
-{
- if (envp == FE_PC64_ENV)
- /*
- * fninit initializes the control register to 0x37f,
- * the status register to zero and the tag word to 0FFFFh.
- * The other registers are unaffected.
- */
- __asm__ ("fninit");
-
- else if (envp == FE_PC53_ENV)
- /*
- * MS _fpreset() does same *except* it sets control word
- * to 0x27f (53-bit precison).
- * We force calling _fpreset in msvcrt.dll
- */
-
- (*_imp___fpreset)();
-
- else if (envp == FE_DFL_ENV)
- /* Use the choice made at app startup */
- _fpreset();
-
- else
- __asm__ ("fldenv %0;" : : "m" (*envp));
- return 0;
-}
diff --git a/winsup/mingw/mingwex/fesetexceptflag.c b/winsup/mingw/mingwex/fesetexceptflag.c
deleted file mode 100644
index 7f4b8e562..000000000
--- a/winsup/mingw/mingwex/fesetexceptflag.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <fenv.h>
-
-/* 7.6.2.4
- The fesetexceptflag function sets the complete status for those
- exception flags indicated by the argument excepts, according to the
- representation in the object pointed to by flagp. The value of
- *flagp shall have been set by a previous call to fegetexceptflag
- whose second argument represented at least those exceptions
- represented by the argument excepts. This function does not raise
- exceptions, but only sets the state of the flags. */
-
-int fesetexceptflag (const fexcept_t * flagp, int excepts)
-{
- fenv_t _env;
-
- excepts &= FE_ALL_EXCEPT;
- __asm__ volatile ("fnstenv %0;" : "=m" (_env));
- _env.__status_word &= ~excepts;
- _env.__status_word |= (*flagp & excepts);
- __asm__ volatile ("fldenv %0;" : : "m" (_env));
- return 0;
-}
diff --git a/winsup/mingw/mingwex/fesetround.c b/winsup/mingw/mingwex/fesetround.c
deleted file mode 100644
index a8cef86a4..000000000
--- a/winsup/mingw/mingwex/fesetround.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <fenv.h>
- /* 7.6.3.2
- The fesetround function establishes the rounding direction
- represented by its argument round. If the argument is not equal
- to the value of a rounding direction macro, the rounding direction
- is not changed. */
-
-int fesetround (int mode)
-{
- unsigned short _cw;
- if ((mode & ~(FE_TONEAREST | FE_DOWNWARD | FE_UPWARD | FE_TOWARDZERO))
- != 0)
- return -1;
- __asm__ volatile ("fnstcw %0;": "=m" (_cw));
- _cw &= ~(FE_TONEAREST | FE_DOWNWARD | FE_UPWARD | FE_TOWARDZERO);
- _cw |= mode;
- __asm__ volatile ("fldcw %0;" : : "m" (_cw));
- return 0;
-}
diff --git a/winsup/mingw/mingwex/fetestexcept.c b/winsup/mingw/mingwex/fetestexcept.c
deleted file mode 100644
index 6934ed925..000000000
--- a/winsup/mingw/mingwex/fetestexcept.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <fenv.h>
-/* 7.6.2.5
- The fetestexcept function determines which of a specified subset of
- the exception flags are currently set. The excepts argument
- specifies the exception flags to be queried.
- The fetestexcept function returns the value of the bitwise OR of the
- exception macros corresponding to the currently set exceptions
- included in excepts. */
-
-int fetestexcept (int excepts)
-{
- unsigned short _sw;
- __asm__ ("fnstsw %%ax" : "=a" (_sw));
- return _sw & excepts & FE_ALL_EXCEPT;
-}
diff --git a/winsup/mingw/mingwex/feupdateenv.c b/winsup/mingw/mingwex/feupdateenv.c
deleted file mode 100644
index f414837f5..000000000
--- a/winsup/mingw/mingwex/feupdateenv.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <fenv.h>
-
-/* 7.6.4.4
- The feupdateenv function saves the currently raised exceptions in
- its automatic storage, installs the floating-point environment
- represented by the object pointed to by envp, and then raises the
- saved exceptions. The argument envp shall point to an object
- set by a call to feholdexcept or fegetenv, or equal the macro
- FE_DFL_ENV or an implementation-defined environment macro. */
-
-/* FIXME: this works but surely there must be a better way. */
-
-int feupdateenv (const fenv_t * envp)
-{
- unsigned int _fexcept = fetestexcept (FE_ALL_EXCEPT); /*save excepts */
- fesetenv (envp); /* install the env */
- feraiseexcept (_fexcept); /* raise the execept */
- return 0;
-}
-
diff --git a/winsup/mingw/mingwex/fma.S b/winsup/mingw/mingwex/fma.S
deleted file mode 100644
index d6226653c..000000000
--- a/winsup/mingw/mingwex/fma.S
+++ /dev/null
@@ -1,12 +0,0 @@
- .file "fma.S"
- .text
- .align 2
- .p2align 4,,15
-.globl _fma
- .def _fma; .scl 2; .type 32; .endef
-_fma:
- fldl 4(%esp)
- fmull 12(%esp)
- fldl 20(%esp)
- faddp
- ret
diff --git a/winsup/mingw/mingwex/fmaf.S b/winsup/mingw/mingwex/fmaf.S
deleted file mode 100644
index 0d64ac2f1..000000000
--- a/winsup/mingw/mingwex/fmaf.S
+++ /dev/null
@@ -1,12 +0,0 @@
- .file "fmaf.S"
- .text
- .align 2
- .p2align 4,,15
-.globl _fmaf
- .def _fmaf; .scl 2; .type 32; .endef
-_fmaf:
- flds 4(%esp)
- fmuls 8(%esp)
- flds 12(%esp)
- faddp
- ret
diff --git a/winsup/mingw/mingwex/fmal.c b/winsup/mingw/mingwex/fmal.c
deleted file mode 100644
index b827875bf..000000000
--- a/winsup/mingw/mingwex/fmal.c
+++ /dev/null
@@ -1,4 +0,0 @@
-long double
-fmal ( long double _x, long double _y, long double _z){
-return ((_x * _y) + _z);
-}
diff --git a/winsup/mingw/mingwex/fmax.c b/winsup/mingw/mingwex/fmax.c
deleted file mode 100644
index 35c1f45e5..000000000
--- a/winsup/mingw/mingwex/fmax.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <math.h>
-
-double
-fmax (double _x, double _y)
-{
- return ( isgreaterequal (_x, _y)|| __isnan (_y) ? _x : _y );
-}
diff --git a/winsup/mingw/mingwex/fmaxf.c b/winsup/mingw/mingwex/fmaxf.c
deleted file mode 100644
index 079a7e746..000000000
--- a/winsup/mingw/mingwex/fmaxf.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <math.h>
-
-float
-fmaxf (float _x, float _y)
-{
- return (( isgreaterequal(_x, _y) || __isnanf (_y)) ? _x : _y );
-}
diff --git a/winsup/mingw/mingwex/fmaxl.c b/winsup/mingw/mingwex/fmaxl.c
deleted file mode 100644
index 4e38da476..000000000
--- a/winsup/mingw/mingwex/fmaxl.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <math.h>
-
-long double
-fmaxl (long double _x, long double _y)
-{
- return (( isgreaterequal(_x, _y) || __isnanl (_y)) ? _x : _y );
-}
diff --git a/winsup/mingw/mingwex/fmin.c b/winsup/mingw/mingwex/fmin.c
deleted file mode 100644
index 96a6ed111..000000000
--- a/winsup/mingw/mingwex/fmin.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <math.h>
-
-double
-fmin (double _x, double _y)
-{
- return ((islessequal(_x, _y) || __isnan (_y)) ? _x : _y );
-}
diff --git a/winsup/mingw/mingwex/fminf.c b/winsup/mingw/mingwex/fminf.c
deleted file mode 100644
index f3d71480d..000000000
--- a/winsup/mingw/mingwex/fminf.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <math.h>
-
-float
-fminf (float _x, float _y)
-{
- return ((islessequal(_x, _y) || _isnan (_y)) ? _x : _y );
-}
diff --git a/winsup/mingw/mingwex/fminl.c b/winsup/mingw/mingwex/fminl.c
deleted file mode 100644
index d8a3fea2c..000000000
--- a/winsup/mingw/mingwex/fminl.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <math.h>
-
-long double
-fminl (long double _x, long double _y)
-{
- return ((islessequal(_x, _y) || __isnanl (_y)) ? _x : _y );
-}
diff --git a/winsup/mingw/mingwex/fp_consts.c b/winsup/mingw/mingwex/fp_consts.c
deleted file mode 100644
index 9293eeda4..000000000
--- a/winsup/mingw/mingwex/fp_consts.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Floating point consts needed by STL class mumeric_limits<float>
- and numeric_limits<double>. Also used as return values by nan, inf */
-
-#include <math.h>
-/*
-According to IEEE 754 a QNaN has exponent bits of all 1 values and
-initial significand bit of 1. A SNaN has has an exponent of all 1
-values and initial significand bit of 0 (with one or more other
-significand bits of 1). An Inf has significand of 0 and
-exponent of all 1 values. A denormal value has all exponent bits of 0.
-
-The following does _not_ follow those rules, but uses values
-equal to those exported from MS C++ runtime lib, msvcprt.dll
-for float and double. MSVC however, does not have long doubles.
-*/
-
-
-#define __DOUBLE_INF_REP { 0, 0, 0, 0x7ff0 }
-#define __DOUBLE_QNAN_REP { 0, 0, 0, 0xfff8 } /* { 0, 0, 0, 0x7ff8 } */
-#define __DOUBLE_SNAN_REP { 0, 0, 0, 0xfff0 } /* { 1, 0, 0, 0x7ff0 } */
-#define __DOUBLE_DENORM_REP {1, 0, 0, 0}
-#define D_NAN_MASK 0x7ff0000000000000LL /* this will mask NaN's and Inf's */
-
-#define __FLOAT_INF_REP { 0, 0x7f80 }
-#define __FLOAT_QNAN_REP { 0, 0xffc0 } /* { 0, 0x7fc0 } */
-#define __FLOAT_SNAN_REP { 0, 0xff80 } /* { 1, 0x7f80 } */
-#define __FLOAT_DENORM_REP {1,0}
-#define F_NAN_MASK 0x7f800000
-
-/* This assumes no implicit (hidden) bit in extended mode */
-#define __LONG_DOUBLE_INF_REP { 0, 0, 0, 0x8000, 0x7fff }
-#define __LONG_DOUBLE_QNAN_REP { 0, 0, 0, 0xc000, 0xffff }
-#define __LONG_DOUBLE_SNAN_REP { 0, 0, 0, 0x8000, 0xffff }
-#define __LONG_DOUBLE_DENORM_REP {1, 0, 0, 0, 0}
-
-union _ieee_rep
-{
- unsigned short rep[5];
- float float_val;
- double double_val;
- long double ldouble_val;
-} ;
-
-const union _ieee_rep __QNAN = { __DOUBLE_QNAN_REP };
-/*
-const union _ieee_rep __SNAN = { __DOUBLE_SNAN_REP };
-const union _ieee_rep __INF = { __DOUBLE_INF_REP };
-const union _ieee_rep __DENORM = { __DOUBLE_DENORM_REP };
-*/
-/* ISO C99 */
-
-#undef nan
-/* FIXME */
-double nan (const char * tagp __attribute__((unused)) )
- { return __QNAN.double_val; }
-
-
-const union _ieee_rep __QNANF = { __FLOAT_QNAN_REP };
-/*
-const union _ieee_rep __SNANF = { __FLOAT_SNAN_REP };
-const union _ieee_rep __INFF = { __FLOAT_INF_REP };
-const union _ieee_rep __DENORMF = { __FLOAT_DENORM_REP };
-*/
-
-#undef nanf
-/* FIXME */
-float nanf(const char * tagp __attribute__((unused)) )
- { return __QNANF.float_val;}
-
-
-const union _ieee_rep __QNANL = { __LONG_DOUBLE_QNAN_REP };
-/*
-const union _ieee_rep __SNANL = { __LONG_DOUBLE_SNAN_REP };
-const union _ieee_rep __INFL = { __LONG_DOUBLE_INF_REP };
-const union _ieee_rep __DENORML = { __LONG_DOUBLE_DENORM_REP };
-*/
-
-#undef nanl
-/* FIXME */
-long double nanl (const char * tagp __attribute__((unused)) )
- { return __QNANL.ldouble_val;}
diff --git a/winsup/mingw/mingwex/fpclassify.c b/winsup/mingw/mingwex/fpclassify.c
deleted file mode 100644
index f8cd8cb44..000000000
--- a/winsup/mingw/mingwex/fpclassify.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <math.h>
-
-/* 'fxam' sets FPU flags C3,C2,C0 'fstsw' stores:
- FP_NAN 001 0x0100
- FP_NORMAL 010 0x0400
- FP_INFINITE 011 0x0500
- FP_ZERO 100 0x4000
- FP_SUBNORMAL 110 0x4400
-
-and sets C1 flag (signbit) if neg */
-
-int __fpclassify (double _x){
- unsigned short sw;
- __asm__ (
- "fxam; fstsw %%ax;"
- : "=a" (sw)
- : "t" (_x)
- );
- return sw & (FP_NAN | FP_NORMAL | FP_ZERO );
-}
diff --git a/winsup/mingw/mingwex/fpclassifyf.c b/winsup/mingw/mingwex/fpclassifyf.c
deleted file mode 100644
index aca4e59f1..000000000
--- a/winsup/mingw/mingwex/fpclassifyf.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <math.h>
-int __fpclassifyf (float _x){
- unsigned short sw;
- __asm__ (
- "fxam; fstsw %%ax;"
- : "=a" (sw)
- : "t" (_x)
- );
- return sw & (FP_NAN | FP_NORMAL | FP_ZERO );
-}
diff --git a/winsup/mingw/mingwex/fpclassifyl.c b/winsup/mingw/mingwex/fpclassifyl.c
deleted file mode 100644
index 9979d6278..000000000
--- a/winsup/mingw/mingwex/fpclassifyl.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <math.h>
-int __fpclassifyl (long double _x){
- unsigned short sw;
- __asm__ (
- "fxam; fstsw %%ax;"
- : "=a" (sw)
- : "t" (_x)
- );
- return sw & (FP_NAN | FP_NORMAL | FP_ZERO );
-}
diff --git a/winsup/mingw/mingwex/fucom.c b/winsup/mingw/mingwex/fucom.c
deleted file mode 100644
index 80c937262..000000000
--- a/winsup/mingw/mingwex/fucom.c
+++ /dev/null
@@ -1,11 +0,0 @@
-int
-__fp_unordered_compare (long double x, long double y){
- unsigned short retval;
- __asm__ (
- "fucom %%st(1);"
- "fnstsw;"
- : "=a" (retval)
- : "t" (x), "u" (y)
- );
- return retval;
-}
diff --git a/winsup/mingw/mingwex/fwide.c b/winsup/mingw/mingwex/fwide.c
deleted file mode 100644
index fc8bf5bf5..000000000
--- a/winsup/mingw/mingwex/fwide.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* This source code was extracted from the Q8 package created and placed
- in the PUBLIC DOMAIN by Doug Gwyn <gwyn@arl.mil>
- last edit: 1999/11/05 gwyn@arl.mil
-
- Implements subclause 7.24 of ISO/IEC 9899:1999 (E).
-
- This is a minimal implementation for environments where
- internationalization is not considered important.
-
- It supports an encoding where all char codes are mapped
- to the *same* code values within a wchar_t or wint_t,
- so long as no other wchar_t codes are used by the program.
-
-*/
-
-#include <wchar.h>
-
-int
-fwide(stream, mode)
- FILE *stream;
- int mode;
- {
- return -1; /* limited to byte orientation */
- }
-
diff --git a/winsup/mingw/mingwex/imaxabs.c b/winsup/mingw/mingwex/imaxabs.c
deleted file mode 100644
index b643ceab6..000000000
--- a/winsup/mingw/mingwex/imaxabs.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- This source code was extracted from the Q8 package created and
- placed in the PUBLIC DOMAIN by Doug Gwyn <gwyn@arl.mil>
- last edit: 1999/11/05 gwyn@arl.mil
-
- Implements subclause 7.8.2 of ISO/IEC 9899:1999 (E).
-
- This particular implementation requires the matching <inttypes.h>.
-*/
-
-#include <inttypes.h>
-
-intmax_t
-imaxabs (intmax_t _j)
- { return _j >= 0 ? _j : -_j; }
-
-long long __attribute__ ((alias ("imaxabs"))) llabs (long long);
diff --git a/winsup/mingw/mingwex/imaxdiv.c b/winsup/mingw/mingwex/imaxdiv.c
deleted file mode 100644
index 6acfcf6cb..000000000
--- a/winsup/mingw/mingwex/imaxdiv.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- This source code was extracted from the Q8 package created and
- placed in the PUBLIC DOMAIN by Doug Gwyn <gwyn@arl.mil>
- last edit: 1999/11/05 gwyn@arl.mil
-
-
- last edit: 1999/11/05 gwyn@arl.mil
-
- Implements subclause 7.8.2 of ISO/IEC 9899:1999 (E).
-
-*/
-
-#include <inttypes.h>
-
-imaxdiv_t
-imaxdiv(intmax_t numer, intmax_t denom)
-{
- imaxdiv_t result;
- result.quot = numer / denom;
- result.rem = numer % denom;
- return result;
-}
-
-long long __attribute__ ((alias ("imaxdiv")))
-lldiv (long long, long long);
diff --git a/winsup/mingw/mingwex/isnan.c b/winsup/mingw/mingwex/isnan.c
deleted file mode 100644
index b38bc290e..000000000
--- a/winsup/mingw/mingwex/isnan.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <math.h>
-
-int
-__isnan (double _x)
-{
- unsigned short _sw;
- __asm__ ("fxam;"
- "fstsw %%ax": "=a" (_sw) : "t" (_x));
- return (_sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL))
- == FP_NAN;
-}
-
-#undef isnan
-int __attribute__ ((alias ("__isnan"))) isnan (double);
diff --git a/winsup/mingw/mingwex/isnanf.c b/winsup/mingw/mingwex/isnanf.c
deleted file mode 100644
index 73fe0eb02..000000000
--- a/winsup/mingw/mingwex/isnanf.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <math.h>
-int
-__isnanf (float _x)
-{
- unsigned short _sw;
- __asm__ ("fxam;"
- "fstsw %%ax": "=a" (_sw) : "t" (_x) );
- return (_sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL))
- == FP_NAN;
-}
-
-int __attribute__ ((alias ("__isnanf"))) isnanf (float);
diff --git a/winsup/mingw/mingwex/isnanl.c b/winsup/mingw/mingwex/isnanl.c
deleted file mode 100644
index 86d0088b4..000000000
--- a/winsup/mingw/mingwex/isnanl.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <math.h>
-
-int
-__isnanl (long double _x)
-{
- unsigned short _sw;
- __asm__ ("fxam;"
- "fstsw %%ax": "=a" (_sw) : "t" (_x));
- return (_sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL))
- == FP_NAN;
-}
-
-int __attribute__ ((alias ("__isnanl"))) isnanl (long double);
diff --git a/winsup/mingw/mingwex/lltoa.c b/winsup/mingw/mingwex/lltoa.c
deleted file mode 100644
index 28248a834..000000000
--- a/winsup/mingw/mingwex/lltoa.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <stdlib.h>
-char* lltoa(long long _n, char * _c, int _i)
- { return _i64toa (_n, _c, _i); }
diff --git a/winsup/mingw/mingwex/lltow.c b/winsup/mingw/mingwex/lltow.c
deleted file mode 100644
index cdf45b742..000000000
--- a/winsup/mingw/mingwex/lltow.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <stdlib.h>
-wchar_t* lltow(long long _n, wchar_t * _w, int _i)
- { return _i64tow (_n, _w, _i); }
diff --git a/winsup/mingw/mingwex/log2.c b/winsup/mingw/mingwex/log2.c
deleted file mode 100644
index 4f14f2614..000000000
--- a/winsup/mingw/mingwex/log2.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <math.h>
-double
-log2 (double _x)
-{
- double retval;
- __asm__ ("fyl2x;" : "=t" (retval) : "0" (_x), "u" (1.0L) : "st(1)");
- return retval;
-}
diff --git a/winsup/mingw/mingwex/log2f.c b/winsup/mingw/mingwex/log2f.c
deleted file mode 100644
index 576396c59..000000000
--- a/winsup/mingw/mingwex/log2f.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <math.h>
-float
-log2f (float _x)
-{
- float retval;
- __asm__ ("fyl2x;" : "=t" (retval) : "0" (_x), "u" (1.0L) : "st(1)");
- return retval;
-}
diff --git a/winsup/mingw/mingwex/log2l.c b/winsup/mingw/mingwex/log2l.c
deleted file mode 100644
index c67d7701d..000000000
--- a/winsup/mingw/mingwex/log2l.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <math.h>
-long double
-log2l (long double _x)
-{
- long double retval;
- __asm__ ("fyl2x;" : "=t" (retval) : "0" (_x), "u" (1.0L) : "st(1)");
- return retval;
-}
diff --git a/winsup/mingw/mingwex/math_stubs.c b/winsup/mingw/mingwex/math_stubs.c
deleted file mode 100644
index 225439846..000000000
--- a/winsup/mingw/mingwex/math_stubs.c
+++ /dev/null
@@ -1,12 +0,0 @@
-
-#include <math.h>
-
-double copysign (double x, double y) {return _copysign(x, y);}
-float copysignf (float x, float y) {return _copysign(x, y);}
-double logb (double x) {return _logb(x);}
-float logbf (float x) {return _logb( x );}
-double nextafter(double x, double y) {return _nextafter(x, y);}
-float nextafterf(float x, float y) {return _nextafter(x, y);}
-double scalb (double x, long i) {return _scalb (x, i);}
-float scalbf (float x, long i) {return _scalb(x, i);}
-
diff --git a/winsup/mingw/mingwex/mbsinit.c b/winsup/mingw/mingwex/mbsinit.c
deleted file mode 100644
index c130afebd..000000000
--- a/winsup/mingw/mingwex/mbsinit.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* This source code was extracted from the Q8 package created and placed
- in the PUBLIC DOMAIN by Doug Gwyn <gwyn@arl.mil>
- last edit: 1999/11/05 gwyn@arl.mil
-
- Implements subclause 7.24 of ISO/IEC 9899:1999 (E).
-
- It supports an encoding where all char codes are mapped
- to the *same* code values within a wchar_t or wint_t,
- so long as no other wchar_t codes are used by the program.
-
-*/
-
-#include <wchar.h>
-
-int
-mbsinit(ps)
- const mbstate_t *ps;
- {
- return 1; /* don't have shift states */
- }
-
diff --git a/winsup/mingw/mingwex/mingw-fseek.c b/winsup/mingw/mingwex/mingw-fseek.c
deleted file mode 100644
index 6a3b66119..000000000
--- a/winsup/mingw/mingwex/mingw-fseek.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Workaround for limitations on win9x where a file contents are
- * not zero'd out if you seek past the end and then write.
- * Copied from ming local-patch to binutils/bfd/libbfd.c written by
- * Mumit Khan <khan@xraylith.wisc.edu>
- */
-
-#include <windows.h>
-#include <stdio.h>
-#include <io.h>
-
-#ifdef __GNUC__
-# define INLINE __inline__
-#elif defined _MSC_VER
-# define INLINE __inline
-#else
-# define INLINE
-#endif
-
-#define ZEROBLOCKSIZE 512
-static int __mingw_fseek_called;
-
-/* FIXME: put this in startup code and make os_platform_id global?
- Or just get _osver from msvcrt.dll and bitest (_osver & 0x8000)? */
-
-INLINE
-static
-int
-__mingw_is_win9x (void)
-{
- static DWORD os_platform_id = -1 ;
-
- if (os_platform_id == -1)
- {
- OSVERSIONINFO os_version_info;
- memset (&os_version_info, 0, sizeof (OSVERSIONINFO));
- os_version_info.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
- GetVersionEx (&os_version_info);
-
- os_platform_id = os_version_info.dwPlatformId;
- }
-
- /* Don't even bother to check for Win32s. */
- return os_platform_id == VER_PLATFORM_WIN32_WINDOWS;
-}
-
-/* The fseek in Win9x runtime does not zero out the file if seeking past
- the end; if you don't want random stuff from your disk included in your
- output DLL/executable, use this version instead. On WinNT/Win2k, it
- just calls runtime fseek().
-
- CHECK/FIXME: Does this work for both text and binary modes?? */
-
-
-int
-__mingw_fseek (FILE *fp, long offset, int whence)
-{
-# undef fseek
- __mingw_fseek_called = 1;
- return fseek (fp, offset, whence);
-}
-
-int
-__mingw_fwrite (const void *buffer, size_t size, size_t count, FILE *fp)
-{
-# undef fwrite
- if ( __mingw_is_win9x () && __mingw_fseek_called)
- {
- DWORD actual_length, current_position;
- __mingw_fseek_called = 0;
- fflush (fp);
- actual_length = GetFileSize ((HANDLE) _get_osfhandle (fileno (fp)),
- NULL);
- current_position = SetFilePointer ((HANDLE) _get_osfhandle (fileno (fp)),
- 0, 0, FILE_CURRENT);
-#ifdef DEBUG
- printf ("__mingw_fwrite: current %ld, actual %ld\n",
- current_position, actual_length);
-#endif /* DEBUG */
- if (current_position > actual_length)
- {
- static char __mingw_zeros[ZEROBLOCKSIZE];
- long numleft;
-
- SetFilePointer ((HANDLE) _get_osfhandle (fileno (fp)),
- 0, 0, FILE_END);
- numleft = current_position - actual_length;
-
-#ifdef DEBUG
- printf ("__mingw_fwrite: Seeking %ld bytes past end\n", numleft);
-#endif /* DEBUG */
- while (numleft > 0)
- {
- DWORD nzeros = (numleft > ZEROBLOCKSIZE)
- ? ZEROBLOCKSIZE : numleft;
- DWORD written;
- if (! WriteFile ((HANDLE) _get_osfhandle (fileno (fp)),
- __mingw_zeros, nzeros, &written, NULL))
- {
- /* Best we can hope for, or at least DJ says so. */
- SetFilePointer ((HANDLE) _get_osfhandle (fileno (fp)),
- 0, 0, FILE_BEGIN);
- return -1;
- }
- if (written < nzeros)
- {
- /* Likewise. */
- SetFilePointer ((HANDLE) _get_osfhandle (fileno (fp)),
- 0, 0, FILE_BEGIN);
- return -1;
- }
-
- numleft -= written;
- }
- FlushFileBuffers ((HANDLE) _get_osfhandle (fileno (fp)));
- }
- }
- return fwrite (buffer, size, count, fp);
-}
diff --git a/winsup/mingw/mingwex/rint.c b/winsup/mingw/mingwex/rint.c
deleted file mode 100644
index 3198f4b26..000000000
--- a/winsup/mingw/mingwex/rint.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <math.h>
-double rint (double x){
- double retval;
- __asm__ ("frndint;" : "=t" (retval) : "0" (x));
- return retval;
-}
diff --git a/winsup/mingw/mingwex/rintf.c b/winsup/mingw/mingwex/rintf.c
deleted file mode 100644
index 0b05e8f89..000000000
--- a/winsup/mingw/mingwex/rintf.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <math.h>
-
-float rintf (float x){
- float retval;
- __asm__ ("frndint;": "=t" (retval) : "0" (x));
- return retval;
-}
diff --git a/winsup/mingw/mingwex/rintl.c b/winsup/mingw/mingwex/rintl.c
deleted file mode 100644
index ffc9d1107..000000000
--- a/winsup/mingw/mingwex/rintl.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <math.h>
-
-long double rintl (long double x){
- long double retval;
- __asm__ ("frndint;": "=t" (retval) : "0" (x));
- return retval;
-}
diff --git a/winsup/mingw/mingwex/round.c b/winsup/mingw/mingwex/round.c
deleted file mode 100644
index 9d8e949e4..000000000
--- a/winsup/mingw/mingwex/round.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <fenv.h>
-
-double
-round (double x) {
- double retval;
- unsigned short saved_cw, _cw;
- __asm__ (
- "fnstcw %0;"
- : "=m" (saved_cw)
- ); /* save control word */
- _cw = ~(FE_TONEAREST | FE_DOWNWARD | FE_UPWARD | FE_TOWARDZERO)
- | (x > 0.0 ? FE_UPWARD : FE_DOWNWARD); /* round away from zero */
- __asm__ (
- "fldcw %0;"
- :
- : "m" (_cw)
- ); /* load the rounding control */
- __asm__ (
- "frndint;"
- : "=t" (retval)
- : "0" (x)
- ); /* do the rounding */
- __asm__ (
- "fldcw %0;"
- :
- : "m" (saved_cw)
- ); /* restore control word */
- return retval;
-}
diff --git a/winsup/mingw/mingwex/roundf.c b/winsup/mingw/mingwex/roundf.c
deleted file mode 100644
index 6ae81bdd8..000000000
--- a/winsup/mingw/mingwex/roundf.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <fenv.h>
-
-float
-roundf (float x) {
- double retval;
- unsigned short saved_cw, _cw;
- __asm__ (
- "fnstcw %0;"
- : "=m" (saved_cw)
- ); /* save control word */
- _cw = ~(FE_TONEAREST | FE_DOWNWARD | FE_UPWARD | FE_TOWARDZERO)
- | (x > 0.0 ? FE_UPWARD : FE_DOWNWARD); /* round away from zero */
- __asm__ (
- "fldcw %0;"
- :
- : "m" (_cw)
- ); /* load the rounding control */
- __asm__ (
- "frndint;"
- : "=t" (retval)
- : "0" (x)
- ); /* do the rounding */
- __asm__ (
- "fldcw %0;"
- :
- : "m" (saved_cw)
- ); /* restore control word */
- return retval;
-}
diff --git a/winsup/mingw/mingwex/roundl.c b/winsup/mingw/mingwex/roundl.c
deleted file mode 100644
index de3334a62..000000000
--- a/winsup/mingw/mingwex/roundl.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <fenv.h>
-
-long double
-roundl (long double x) {
- long double retval;
- unsigned short saved_cw, _cw;
- __asm__ (
- "fnstcw %0;"
- : "=m" (saved_cw)
- ); /* save control word */
- _cw = ~(FE_TONEAREST | FE_DOWNWARD | FE_UPWARD | FE_TOWARDZERO)
- | (x > 0.0 ? FE_UPWARD : FE_DOWNWARD); /* round away from zero */
- __asm__ (
- "fldcw %0;"
- :
- : "m" (_cw)
- ); /* load the rounding control */
- __asm__ (
- "frndint;"
- : "=t" (retval)
- : "0" (x)
- ); /* do the rounding */
- __asm__ (
- "fldcw %0;"
- :
- : "m" (saved_cw)
- ); /* restore control word */
- return retval;
-}
-
diff --git a/winsup/mingw/mingwex/signbit.c b/winsup/mingw/mingwex/signbit.c
deleted file mode 100644
index 7f86c86a3..000000000
--- a/winsup/mingw/mingwex/signbit.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#define __FP_SIGNBIT 0x0200
-
-int __signbit (double x) {
- unsigned short sw;
- __asm__ ("fxam; fstsw %%ax;"
- : "=a" (sw)
- : "t" (x) );
- return sw & __FP_SIGNBIT;
-}
-
-#undef signbit
-int __attribute__ ((alias ("__signbit"))) signbit (double);
-
diff --git a/winsup/mingw/mingwex/signbitf.c b/winsup/mingw/mingwex/signbitf.c
deleted file mode 100644
index 5bbf675ad..000000000
--- a/winsup/mingw/mingwex/signbitf.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#define __FP_SIGNBIT 0x0200
-
-int __signbitf (float x) {
- unsigned short sw;
- __asm__ ("fxam; fstsw %%ax;"
- : "=a" (sw)
- : "t" (x) );
- return sw & __FP_SIGNBIT;
-}
-int __attribute__ ((alias ("__signbitf"))) signbitf (float);
diff --git a/winsup/mingw/mingwex/signbitl.c b/winsup/mingw/mingwex/signbitl.c
deleted file mode 100644
index 78f990350..000000000
--- a/winsup/mingw/mingwex/signbitl.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#define __FP_SIGNBIT 0x0200
-
-int __signbitl (long double x) {
- unsigned short sw;
- __asm__ ("fxam; fstsw %%ax;"
- : "=a" (sw)
- : "t" (x) );
- return sw & __FP_SIGNBIT;
-}
-
-int __attribute__ ((alias ("__signbitl"))) signbitl (long double);
diff --git a/winsup/mingw/mingwex/sitest.c b/winsup/mingw/mingwex/sitest.c
deleted file mode 100644
index 9e06bf164..000000000
--- a/winsup/mingw/mingwex/sitest.c
+++ /dev/null
@@ -1,1527 +0,0 @@
-/*
- sitest -- exercise features of C99 <stdint.h> and <inttypes.h>
-
- This source code has been placed into the PUBLIC DOMAIN by its author.
-
- last edit: 1999/11/05 gwyn@arl.mil
-
- Tries to accommodate pre-C99 versions of <inttypes.h>.
-
- Takes advantage of __Q8_* symbols defined by a particular
- implementation of <stdint.h>, but doesn't require them.
-
- NOTE: This is not a thorough validation test of the facilities.
-*/
-
-#include <errno.h>
-#include <limits.h> /* for CHAR_BIT */
-#include <stdio.h>
-#include <stddef.h> /* for ptrdiff_t */
-#include <stdlib.h>
-#include <string.h>
-
-#include <inttypes.h> /* embeds <stdint.h> */
-#include <signal.h> /* for sig_atomic_t */
-#if defined(INTMAX_MAX) /* <inttypes.h> has C99 features */
-#include <wchar.h>
-#endif
-
-#include <inttypes.h> /* test idempotency */
-
-#if 1 /* __STDC_VERSION__ >= 199901 */
-#ifndef __Q8_QT
-#define __Q8_QT long long
-#endif
-#endif
-
-#ifdef PRIdMAX
-#define HAVE_PRIdMAX
-#ifndef __Q8_MT
-#define __Q8_MT intmax_t
-#endif
-#else
-#ifdef PRIdLEAST64
-#ifndef __Q8_MT
-#define __Q8_MT int_least64_t
-#endif
-#define PRIdMAX PRIdLEAST64
-#else
-#ifndef __Q8_MT
-#define __Q8_MT long
-#endif
-#define PRIdMAX "ld"
-#endif
-#endif
-
-#ifdef PRIuMAX
-#define HAVE_PRIuMAX
-#define U__Q8_MT uintmax_t
-#else
-#ifdef PRIuLEAST64
-#define U__Q8_MT uint_least64_t
-#define PRIuMAX PRIuLEAST64
-#else
-#define U__Q8_MT unsigned long
-#define PRIuMAX "lu"
-#endif
-#endif
-
-#define STR_SUB(s) #s
-#define STRINGIZE(s) STR_SUB(s) /* extra level to expand argument */
-
-#if defined(SCNo32) || defined(PRIo32)
-static int32_t int32;
-#endif
-static int_least16_t intl16;
-static uint_least16_t uintl16;
-static uint_fast16_t uintf16;
-static intmax_t intmax;
-static uintmax_t uintmax;
-
-int
-main() {
- int status = 0; /* exit status to be returned */
-
- /* <stdint.h> features: */
-
- printf("CHAR_BIT=%u\n", (unsigned)CHAR_BIT );
- printf("sizeof(char)=%u\n", (unsigned)sizeof(char)); /* s.b. 1 */
- printf("sizeof(short)=%u\n", (unsigned)sizeof(short));
- printf("sizeof(int)=%u\n", (unsigned)sizeof(int));
- printf("sizeof(long)=%u\n", (unsigned)sizeof(long));
-#ifdef __Q8_QT
- printf("sizeof(long long)=%u\n", (unsigned)sizeof(__Q8_QT));
-#endif
- printf("sizeof(intmax_t)=%u\n", (unsigned)sizeof(intmax_t));
- printf("sizeof(ptrdiff_t)=%u\n", (unsigned)sizeof(ptrdiff_t));
- printf("sizeof(size_t)=%u\n", (unsigned)sizeof(size_t));
- printf("sizeof(sig_atomic_t)=%u\n", (unsigned)sizeof(sig_atomic_t));
- printf("sizeof(wchar_t)=%u\n", (unsigned)sizeof(wchar_t));
-#if defined(WINT_MAX) || __STDC_VERSION__ >= 199901
- printf("sizeof(wint_t)=%u\n", (unsigned)sizeof(wint_t));
-#else
- printf("*** wint_t isn't defined ***\n");
- status = EXIT_FAILURE;
-#endif
-#ifdef INT8_MAX
- printf("sizeof(int8_t)=%u\n", (unsigned)sizeof(int8_t));
- printf("sizeof(uint8_t)=%u\n", (unsigned)sizeof(uint8_t));
-#endif
-#ifdef INT9_MAX
- printf("sizeof(int9_t)=%u\n", (unsigned)sizeof(int9_t));
- printf("sizeof(uint9_t)=%u\n", (unsigned)sizeof(uint9_t));
-#endif
-#ifdef INT12_MAX
- printf("sizeof(int12_t)=%u\n", (unsigned)sizeof(int12_t));
- printf("sizeof(uint12_t)=%u\n", (unsigned)sizeof(uint12_t));
-#endif
-#ifdef INT16_MAX
- printf("sizeof(int16_t)=%u\n", (unsigned)sizeof(int16_t));
- printf("sizeof(uint16_t)=%u\n", (unsigned)sizeof(uint16_t));
-#endif
-#ifdef INT18_MAX
- printf("sizeof(int18_t)=%u\n", (unsigned)sizeof(int18_t));
- printf("sizeof(uint18_t)=%u\n", (unsigned)sizeof(uint18_t));
-#endif
-#ifdef INT24_MAX
- printf("sizeof(int24_t)=%u\n", (unsigned)sizeof(int24_t));
- printf("sizeof(uint24_t)=%u\n", (unsigned)sizeof(uint24_t));
-#endif
-#ifdef INT32_MAX
- printf("sizeof(int32_t)=%u\n", (unsigned)sizeof(int32_t));
- printf("sizeof(uint32_t)=%u\n", (unsigned)sizeof(uint32_t));
-#endif
-#ifdef INT36_MAX
- printf("sizeof(int36_t)=%u\n", (unsigned)sizeof(int36_t));
- printf("sizeof(uint36_t)=%u\n", (unsigned)sizeof(uint36_t));
-#endif
-#ifdef INT40_MAX
- printf("sizeof(int40_t)=%u\n", (unsigned)sizeof(int40_t));
- printf("sizeof(uint40_t)=%u\n", (unsigned)sizeof(uint40_t));
-#endif
-#ifdef INT48_MAX
- printf("sizeof(int48_t)=%u\n", (unsigned)sizeof(int48_t));
- printf("sizeof(uint48_t)=%u\n", (unsigned)sizeof(uint48_t));
-#endif
-#ifdef INT60_MAX
- printf("sizeof(int60_t)=%u\n", (unsigned)sizeof(int60_t));
- printf("sizeof(uint60_t)=%u\n", (unsigned)sizeof(uint60_t));
-#endif
-#ifdef INT64_MAX
- printf("sizeof(int64_t)=%u\n", (unsigned)sizeof(int64_t));
- printf("sizeof(uint64_t)=%u\n", (unsigned)sizeof(uint64_t));
-#endif
-#ifdef INT72_MAX
- printf("sizeof(int72_t)=%u\n", (unsigned)sizeof(int72_t));
- printf("sizeof(uint72_t)=%u\n", (unsigned)sizeof(uint72_t));
-#endif
-#ifdef INT128_MAX
- printf("sizeof(int128_t)=%u\n", (unsigned)sizeof(int128_t));
- printf("sizeof(uint128_t)=%u\n", (unsigned)sizeof(uint128_t));
-#endif
- printf("sizeof(int_least8_t)=%u\n", (unsigned)sizeof(int_least8_t));
- printf("sizeof(uint_least8_t)=%u\n", (unsigned)sizeof(uint_least8_t));
- printf("sizeof(int_least16_t)=%u\n", (unsigned)sizeof(int_least16_t));
- printf("sizeof(uint_least16_t)=%u\n", (unsigned)sizeof(uint_least16_t));
- printf("sizeof(int_least32_t)=%u\n", (unsigned)sizeof(int_least32_t));
- printf("sizeof(uint_least32_t)=%u\n", (unsigned)sizeof(uint_least32_t));
-#ifdef INT_LEAST64_MAX
- printf("sizeof(int_least64_t)=%u\n", (unsigned)sizeof(int_least64_t));
- printf("sizeof(uint_least64_t)=%u\n", (unsigned)sizeof(uint_least64_t));
-#else
- printf("*** uint_least64_t isn't defined ***\n");
- status = EXIT_FAILURE;
-#endif
-#ifdef INT_LEAST128_MAX
- printf("sizeof(int_least128_t)=%u\n", (unsigned)sizeof(int_least128_t));
- printf("sizeof(uint_least128_t)=%u\n",
- (unsigned)sizeof(uint_least128_t));
-#endif
- printf("sizeof(int_fast8_t)=%u\n", (unsigned)sizeof(int_fast8_t));
- printf("sizeof(uint_fast8_t)=%u\n", (unsigned)sizeof(uint_fast8_t));
- printf("sizeof(int_fast16_t)=%u\n", (unsigned)sizeof(int_fast16_t));
- printf("sizeof(uint_fast16_t)=%u\n", (unsigned)sizeof(uint_fast16_t));
- printf("sizeof(int_fast32_t)=%u\n", (unsigned)sizeof(int_fast32_t));
- printf("sizeof(uint_fast32_t)=%u\n", (unsigned)sizeof(uint_fast32_t));
-#ifdef INT_FAST64_MAX
- printf("sizeof(int_fast64_t)=%u\n", (unsigned)sizeof(int_fast64_t));
- printf("sizeof(uint_fast64_t)=%u\n", (unsigned)sizeof(uint_fast64_t));
-#else
- printf("*** int_fast64_t isn't defined ***\n");
- status = EXIT_FAILURE;
-#endif
-#ifdef INT_FAST128_MAX
- printf("sizeof(int_fast128_t)=%u\n", (unsigned)sizeof(int_fast128_t));
- printf("sizeof(uint_fast128_t)=%u\n", (unsigned)sizeof(uint_fast128_t));
-#endif
-#if defined(INTPTR_MAX)
- printf("sizeof(intptr_t)=%u\n", (unsigned)sizeof(intptr_t));
-#if defined(UINTPTR_MAX)
- printf("sizeof(uintptr_t)=%u\n", (unsigned)sizeof(uintptr_t));
-#else
- printf("*** intptr_t is defined but uintptr_t isn't ***\n");
- status = EXIT_FAILURE;
-#endif
-#elif defined(UINTPTR_MAX)
- printf("sizeof(uintptr_t)=%u\n", (unsigned)sizeof(uintptr_t));
- printf("*** uintptr_t is defined but intptr_t isn't ***\n");
- status = EXIT_FAILURE;
-#else
- printf("*** neither intptr_t nor uintptr_t is defined ***\n");
- status = EXIT_FAILURE;
-#endif
-#ifdef INTMAX_MAX
- printf("sizeof(intmax_t)=%u\n", (unsigned)sizeof(intmax_t));
- printf("sizeof(uintmax_t)=%u\n", (unsigned)sizeof(uintmax_t));
-#else
- printf("*** intmax_t isn't defined ***\n");
- status = EXIT_FAILURE;
-#endif
-
-#ifdef INT8_MAX
- printf("INT8_MIN=%"PRIdMAX"\n", (__Q8_MT)INT8_MIN);
- printf("INT8_MAX=%"PRIdMAX"\n", (__Q8_MT)INT8_MAX);
- printf("UINT8_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT8_MAX);
-#endif
-#ifdef INT9_MAX
- printf("INT9_MIN=%"PRIdMAX"\n", (__Q8_MT)INT9_MIN);
- printf("INT9_MAX=%"PRIdMAX"\n", (__Q8_MT)INT9_MAX);
- printf("UINT9_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT9_MAX);
-#endif
-#ifdef INT12_MAX
- printf("INT12_MIN=%"PRIdMAX"\n", (__Q8_MT)INT12_MIN);
- printf("INT12_MAX=%"PRIdMAX"\n", (__Q8_MT)INT12_MAX);
- printf("UINT12_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT12_MAX);
-#endif
-#ifdef INT16_MAX
- printf("INT16_MIN=%"PRIdMAX"\n", (__Q8_MT)INT16_MIN);
- printf("INT16_MAX=%"PRIdMAX"\n", (__Q8_MT)INT16_MAX);
- printf("UINT16_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT16_MAX);
-#endif
-#ifdef INT18_MAX
- printf("INT18_MIN=%"PRIdMAX"\n", (__Q8_MT)INT18_MIN);
- printf("INT18_MAX=%"PRIdMAX"\n", (__Q8_MT)INT18_MAX);
- printf("UINT18_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT18_MAX);
-#endif
-#ifdef INT24_MAX
- printf("INT24_MIN=%"PRIdMAX"\n", (__Q8_MT)INT24_MIN);
- printf("INT24_MAX=%"PRIdMAX"\n", (__Q8_MT)INT24_MAX);
- printf("UINT24_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT24_MAX);
-#endif
-#ifdef INT32_MAX
- printf("INT32_MIN=%"PRIdMAX"\n", (__Q8_MT)INT32_MIN);
- printf("INT32_MAX=%"PRIdMAX"\n", (__Q8_MT)INT32_MAX);
- printf("UINT32_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT32_MAX);
-#endif
-#ifdef INT36_MAX
- printf("INT36_MIN=%"PRIdMAX"\n", (__Q8_MT)INT36_MIN);
- printf("INT36_MAX=%"PRIdMAX"\n", (__Q8_MT)INT36_MAX);
- printf("UINT36_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT36_MAX);
-#endif
-#ifdef INT40_MAX
- printf("INT40_MIN=%"PRIdMAX"\n", (__Q8_MT)INT40_MIN);
- printf("INT40_MAX=%"PRIdMAX"\n", (__Q8_MT)INT40_MAX);
- printf("UINT40_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT40_MAX);
-#endif
-#ifdef INT48_MAX
- printf("INT48_MIN=%"PRIdMAX"\n", (__Q8_MT)INT48_MIN);
- printf("INT48_MAX=%"PRIdMAX"\n", (__Q8_MT)INT48_MAX);
- printf("UINT48_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT48_MAX);
-#endif
-#ifdef INT60_MAX
- printf("INT60_MIN=%"PRIdMAX"\n", (__Q8_MT)INT60_MIN);
- printf("INT60_MAX=%"PRIdMAX"\n", (__Q8_MT)INT60_MAX);
- printf("UINT60_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT60_MAX);
-#endif
-#ifdef INT64_MAX
- printf("INT64_MIN=%"PRIdMAX"\n", (__Q8_MT)INT64_MIN);
- printf("INT64_MAX=%"PRIdMAX"\n", (__Q8_MT)INT64_MAX);
- printf("UINT64_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT64_MAX);
-#endif
-#ifdef INT72_MAX
- printf("INT72_MIN=%"PRIdMAX"\n", (__Q8_MT)INT72_MIN);
- printf("INT72_MAX=%"PRIdMAX"\n", (__Q8_MT)INT72_MAX);
- printf("UINT72_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT72_MAX);
-#endif
-#ifdef INT128_MAX
- printf("INT128_MIN=%"PRIdMAX"\n", (__Q8_MT)INT128_MIN);
- printf("INT128_MAX=%"PRIdMAX"\n", (__Q8_MT)INT128_MAX);
- printf("UINT128_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT128_MAX);
-#endif
- printf("INT_LEAST8_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST8_MIN);
- printf("INT_LEAST8_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST8_MAX);
- printf("UINT_LEAST8_MAX=%"PRIuMAX"\n",
- (U__Q8_MT)UINT_LEAST8_MAX);
- printf("INT_LEAST16_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST16_MIN);
- printf("INT_LEAST16_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST16_MAX);
- printf("UINT_LEAST16_MAX=%"PRIuMAX"\n",
- (U__Q8_MT)UINT_LEAST16_MAX);
- printf("INT_LEAST32_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST32_MIN);
- printf("INT_LEAST32_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST32_MAX);
- printf("UINT_LEAST32_MAX=%"PRIuMAX"\n",
- (U__Q8_MT)UINT_LEAST32_MAX);
-#ifdef INT_LEAST64_MAX
- printf("INT_LEAST64_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST64_MIN);
- printf("INT_LEAST64_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST64_MAX);
- printf("UINT_LEAST64_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT_LEAST64_MAX);
-#endif
-#ifdef INT_LEAST128_MAX
- printf("INT_LEAST128_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST128_MIN);
- printf("INT_LEAST128_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_LEAST128_MAX);
- printf("UINT_LEAST128_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT_LEAST128_MAX);
-#endif
- printf("INT_FAST8_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_FAST8_MIN);
- printf("INT_FAST8_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_FAST8_MAX);
- printf("UINT_FAST8_MAX=%"PRIuMAX"\n",
- (U__Q8_MT)UINT_FAST8_MAX);
- printf("INT_FAST16_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_FAST16_MIN);
- printf("INT_FAST16_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_FAST16_MAX);
- printf("UINT_FAST16_MAX=%"PRIuMAX"\n",
- (U__Q8_MT)UINT_FAST16_MAX);
- printf("INT_FAST32_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_FAST32_MIN);
- printf("INT_FAST32_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_FAST32_MAX);
- printf("UINT_FAST32_MAX=%"PRIuMAX"\n",
- (U__Q8_MT)UINT_FAST32_MAX);
-#ifdef INT_FAST64_MAX
- printf("INT_FAST64_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_FAST64_MIN);
- printf("INT_FAST64_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_FAST64_MAX);
- printf("UINT_FAST64_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT_FAST64_MAX);
-#endif
-#ifdef INT_FAST128_MAX
- printf("INT_FAST128_MIN=%"PRIdMAX"\n", (__Q8_MT)INT_FAST128_MIN);
- printf("INT_FAST128_MAX=%"PRIdMAX"\n", (__Q8_MT)INT_FAST128_MAX);
- printf("UINT_FAST128_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINT_FAST128_MAX);
-#endif
-#ifdef INTPTR_MAX
- printf("INTPTR_MIN=%"PRIdMAX"\n", (__Q8_MT)INTPTR_MIN);
- printf("INTPTR_MAX=%"PRIdMAX"\n", (__Q8_MT)INTPTR_MAX);
-#endif
-#ifdef UINTPTR_MAX
- printf("UINTPTR_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINTPTR_MAX);
-#endif
-#ifdef INTMAX_MAX
- printf("INTMAX_MIN=%"PRIdMAX"\n", (__Q8_MT)INTMAX_MIN);
- printf("INTMAX_MAX=%"PRIdMAX"\n", (__Q8_MT)INTMAX_MAX);
- printf("UINTMAX_MAX=%"PRIuMAX"\n", (U__Q8_MT)UINTMAX_MAX);
-#endif
-#ifdef PTRDIFF_MAX
- printf("PTRDIFF_MIN=%"PRIdMAX"\n", (__Q8_MT)PTRDIFF_MIN);
- printf("PTRDIFF_MAX=%"PRIdMAX"\n", (__Q8_MT)PTRDIFF_MAX);
-#endif
-#ifdef SIG_ATOMIC_MAX
-#if SIG_ATOMIC_MIN < 0
- printf("SIG_ATOMIC_MIN=%"PRIdMAX"\n", (__Q8_MT)SIG_ATOMIC_MIN);
- printf("SIG_ATOMIC_MAX=%"PRIdMAX"\n", (__Q8_MT)SIG_ATOMIC_MAX);
-#else
- printf("SIG_ATOMIC_MIN=%"PRIuMAX"\n", (U__Q8_MT)SIG_ATOMIC_MIN);
- printf("SIG_ATOMIC_MAX=%"PRIuMAX"\n", (U__Q8_MT)SIG_ATOMIC_MAX);
-#endif
-#endif
-#ifdef SIZE_MAX
- printf("SIZE_MAX=%"PRIuMAX"\n", (U__Q8_MT)SIZE_MAX);
-#endif
-
-#ifdef WCHAR_MAX
-#if WCHAR_MIN < 0
- printf("WCHAR_MIN=%"PRIdMAX"\n", (__Q8_MT)WCHAR_MIN);
- printf("WCHAR_MAX=%"PRIdMAX"\n", (__Q8_MT)WCHAR_MAX);
-#else
- printf("WCHAR_MIN=%"PRIuMAX"\n", (U__Q8_MT)WCHAR_MIN);
- printf("WCHAR_MAX=%"PRIuMAX"\n", (U__Q8_MT)WCHAR_MAX);
-#endif
-#endif
-#ifdef WINT_MAX
-#if WINT_MIN < 0
- printf("WINT_MIN=%"PRIdMAX"\n", (__Q8_MT)WINT_MIN);
- printf("WINT_MAX=%"PRIdMAX"\n", (__Q8_MT)WINT_MAX);
-#else
- printf("WINT_MIN=%"PRIuMAX"\n", (U__Q8_MT)WINT_MIN);
- printf("WINT_MAX=%"PRIuMAX"\n", (U__Q8_MT)WINT_MAX);
-#endif
-#endif
-
- /*
- 7.18.4 Macros for integer constants
- */
-
- /* INTn_C for n=8 and 16 were at one point unimplementable
- on most platforms, so they're treated as "optional": */
-#ifdef INT8_C
- if ( INT8_C(-123) != -123 )
- printf("*** INT8_C(-123) produced %"PRIdMAX" ***\n",
- (__Q8_MT)INT8_C(-123)
- );
- if ( UINT8_C(123) != 123 )
- printf("*** UINT8_C(123) produced %"PRIuMAX" ***\n",
- (U__Q8_MT)UINT8_C(123)
- );
-#endif
-#ifdef INT16_C
- if ( INT16_C(-12345) != -12345 )
- printf("*** INT16_C(-12345) produced %"PRIdMAX" ***\n",
- (__Q8_MT)INT16_C(-12345)
- );
- if ( UINT16_C(12345) != 12345 )
- printf("*** UINT16_C(12345) produced %"PRIuMAX" ***\n",
- (U__Q8_MT)UINT16_C(12345)
- );
-#endif
- if ( INT32_C(-123456789) != -123456789 )
- printf("*** INT32_C(-123456789) produced %"PRIdMAX" ***\n",
- (__Q8_MT)INT32_C(-123456789)
- );
- if ( UINT32_C(123456789) != 123456789 )
- printf("*** UINT32_C(123456789) produced %"PRIuMAX" ***\n",
- (U__Q8_MT)UINT32_C(123456789)
- );
-#ifdef INT_LEAST64_MAX
- if ( INT64_C(-1234567890123456789) != -1234567890123456789 )
- printf("*** INT64_C(-1234567890123456789) produced %"PRIdMAX
- " ***\n",
- (__Q8_MT)INT64_C(-1234567890123456789)
- );
- if ( UINT64_C(1234567890123456789) != 1234567890123456789 )
- printf("*** UINT64_C(1234567890123456789) produced %"PRIuMAX
- " ***\n",
- (U__Q8_MT)UINT64_C(1234567890123456789)
- );
-#endif
-#ifdef INTMAX_MAX
- if ( INTMAX_C(-1234567890123456789) != -1234567890123456789 )
- printf("*** INTMAX_C(-1234567890123456789) produced %"PRIdMAX
- " ***\n",
- (__Q8_MT)INTMAX_C(-1234567890123456789)
- );
- if ( UINTMAX_C(1234567890123456789) != 1234567890123456789 )
- printf("*** UINTMAX_C(1234567890123456789) produced %"PRIuMAX
- " ***\n",
- (U__Q8_MT)UINTMAX_C(1234567890123456789)
- );
-#endif
-
- /* <inttypes.h> features: */
-
-#if __STDC_VERSION__ >= 199901
- printf("sizeof(imaxdiv_t)=%u\n", (unsigned)sizeof(imaxdiv_t));
-#endif
-
- /*
- 7.8.1 Macros for format specifiers
- */
-
- {
- /* scanf these strings */
- static const char in_dn[] = "Z119bZ";
- static const char in_dmo[] = "Z-0119bZ";
- static const char in_dspx[] = "Z \t\n +0X119bZ";
- static const char in_dsmx[] = "Z \t\n -0x119bZ";
- static const char in_dsn[] = "Z \t\n 119bZ";
- static const char in_dp[] = "Z+119bZ";
- static const char in_dpx[] = "Z+0X119bz";
-
- /* sprintf into this */
- static char buffer[1024];
-
-#define SCAN(buf,fs,var,exp) if ( sscanf(buf, "Z%" fs, &var) != 1 ) \
- { \
- printf("*** " #fs "=" STR_SUB(fs) \
- " failed ***\n" \
- ); \
- status = EXIT_FAILURE; \
- } \
- else if ( var != (exp) ) \
- { \
- printf("*** " #fs "=" STR_SUB(fs) \
- " should be: " STR_SUB(exp) \
- ", was: %" fs " ***\n", var \
- ); \
- status = EXIT_FAILURE; \
- } \
- else
-
-#define PRINT(fs,var,exp) if ( sprintf(buffer, "%" fs, var ) <= 0 ) \
- { \
- printf("*** " #fs "=" STR_SUB(fs) \
- " failed ***\n" \
- ); \
- status = EXIT_FAILURE; \
- } \
- else if ( strcmp(buffer, STR_SUB(exp)) != 0 ) \
- { \
- printf("*** " #fs "=" STR_SUB(fs) \
- " should be: " STR_SUB(exp) \
- ", was: %s ***\n", buffer \
- ); \
- status = EXIT_FAILURE; \
- } \
- else
-
-#ifdef SCNo32
- SCAN(in_dn, SCNo32, int32, 9);
-#endif
-#ifdef PRIo32
- PRINT(PRIo32, int32, 11);
-#endif
- SCAN(in_dmo, SCNiLEAST16, intl16, -9);
- SCAN(in_dspx, SCNdLEAST16, intl16, 0);
- SCAN(in_dsmx, SCNiLEAST16, intl16, -4507);
- PRINT(PRIdLEAST16, intl16, -4507);
- PRINT(PRIiLEAST16, intl16, -4507);
- SCAN(in_dsn, SCNxLEAST16, uintl16, 4507);
- PRINT(PRIoLEAST16, uintl16, 10633);
- PRINT(PRIuLEAST16, uintl16, 4507);
- PRINT(PRIxLEAST16, uintl16, 119b);
- PRINT(PRIXLEAST16, uintl16, 119B);
- SCAN(in_dp, SCNxFAST16, uintf16, 4507);
- PRINT(PRIxFAST16, uintf16, 119b);
-#ifdef SCNdMAX
- SCAN(in_dp, SCNdMAX, intmax, 119);
-#endif
-#ifdef PRIiMAX
- PRINT(PRIiMAX, intmax, 119);
-#endif
-#ifdef SCNoMAX
- SCAN(in_dpx, SCNoMAX, uintmax, 0);
-#endif
-#ifdef PRIxMAX
- PRINT(PRIxMAX, uintmax, 0);
-#endif
- /* Obviously there should be a much larger battery of such tests. */
- }
-
-#if defined(INTMAX_MAX) /* <inttypes.h> has C99 features */
- /*
- 7.8.2 Functions for greatest-width integer types
- */
-
- {
- static struct
- {
- intmax_t input;
- intmax_t expect;
- } abs_data[] =
- {
-#ifdef INT8_MAX
- {INT8_MAX, INT8_MAX},
- {-INT8_MAX, INT8_MAX},
- {UINT8_MAX, UINT8_MAX},
-#endif
-
-#ifdef INT16_MAX
- { INT16_MAX, INT16_MAX},
- { -INT16_MAX, INT16_MAX},
- { UINT16_MAX, UINT16_MAX},
-#endif
-#ifdef INT32_MAX
- { INT32_MAX, INT32_MAX},
- { -INT32_MAX, INT32_MAX},
-#ifdef INT_LEAST64_MAX
- { UINT32_MAX, UINT32_MAX},
-#endif
-#endif
-#ifdef INT64_MAX
- { INT64_MAX, INT64_MAX},
- { -INT64_MAX, INT64_MAX},
-#endif
- { INT_LEAST8_MAX, INT_LEAST8_MAX},
- { -INT_LEAST8_MAX, INT_LEAST8_MAX},
- { UINT_LEAST8_MAX, UINT_LEAST8_MAX},
- { INT_LEAST16_MAX, INT_LEAST16_MAX},
- { -INT_LEAST16_MAX, INT_LEAST16_MAX},
- { UINT_LEAST16_MAX, UINT_LEAST16_MAX},
- { INT_LEAST32_MAX, INT_LEAST32_MAX},
- { -INT_LEAST32_MAX, INT_LEAST32_MAX},
-#ifdef INT_LEAST64_MAX
- { UINT_LEAST32_MAX, UINT_LEAST32_MAX},
- { INT_LEAST64_MAX, INT_LEAST64_MAX},
- { -INT_LEAST64_MAX, INT_LEAST64_MAX},
-#endif
- { INT_FAST8_MAX, INT_FAST8_MAX},
- { -INT_FAST8_MAX, INT_FAST8_MAX},
- { UINT_FAST8_MAX, UINT_FAST8_MAX},
- { INT_FAST16_MAX, INT_FAST16_MAX},
- { -INT_FAST16_MAX, INT_FAST16_MAX},
- { UINT_FAST16_MAX, UINT_FAST16_MAX},
- { INT_FAST32_MAX, INT_FAST32_MAX},
- { -INT_FAST32_MAX, INT_FAST32_MAX},
-#ifdef INT_FAST64_MAX
- { UINT_FAST32_MAX, UINT_FAST32_MAX},
- { INT_FAST64_MAX, INT_FAST64_MAX},
- { -INT_FAST64_MAX, INT_FAST64_MAX},
-#endif
-#ifdef INTPTR_MAX
- { INTPTR_MAX, INTPTR_MAX},
- { -INTPTR_MAX, INTPTR_MAX},
-#endif
-#ifdef UINTPTR_MAX
- { UINTPTR_MAX, UINTPTR_MAX},
-#endif
- { INTMAX_MAX, INTMAX_MAX},
-#ifdef PTRDIFF_MAX
- { PTRDIFF_MAX, PTRDIFF_MAX},
-#endif
-#ifdef SIG_ATOMIC_MAX
- { SIG_ATOMIC_MAX, SIG_ATOMIC_MAX},
-#if SIG_ATOMIC_MIN < 0
- { -SIG_ATOMIC_MAX, SIG_ATOMIC_MAX},
-#endif
-#endif
-#ifdef SIZE_MAX
- { SIZE_MAX, SIZE_MAX},
-#endif
-#ifdef WCHAR_MAX
- { WCHAR_MAX, WCHAR_MAX},
-#if WCHAR_MIN < 0
- { -WCHAR_MAX, WCHAR_MAX},
-#endif
-#endif
-#ifdef WINT_MAX
- { WINT_MAX, WINT_MAX},
-#if WINT_MIN < 0
- { -WINT_MAX, WINT_MAX},
-#endif
-#endif
- { 127, 127},
- { -127, 127},
- { 128, 128},
- { -127-1, 128},
- { 255, 255},
- { -256+1, 255},
- { 256, 256},
- { -256, 256},
- { 32767, 32767},
- { -32767, 32767},
- { 32768, 32768},
- { -32767-1, 32768},
- { 65535, 65535},
- { -65536+1, 65535},
- { 65536, 65536},
- { -65536, 65536},
- { 2147483647, 2147483647},
- { -2147483647, 2147483647},
- { 2147483648LL, 2147483648LL},
- { -2147483647LL-1, 2147483648LL},
-#ifdef INT_LEAST64_MAX
- { 4294967295LL, 4294967295LL},
- { -4294967296LL+1, 4294967295LL},
- { 4294967296LL, 4294967296LL},
- { -4294967296LL, 4294967296LL},
- { 9223372036854775807LL, 9223372036854775807LL},
- { -9223372036854775807LL, 9223372036854775807LL},
- { 1234567890123456789LL, 1234567890123456789LL},
- { -1234567890123456789LL, 1234567890123456789LL},
-#endif
- { 1, 1},
- { -1, 1},
- { 2, 2},
- { -2, 2},
- { 10, 10},
- { -10, 10},
- { 16, 16},
- { -16, 16},
- /* Other test cases can be added here. */
- {0, 0} /* terminates the list */
- }, *adp=abs_data;
- int count=0;
- do{
- intmax = imaxabs(adp->input);
- count++;
- if (intmax != adp->expect )
- {
-
- printf("*** imaxabs(%"PRIdMAX") failed; should be: %"
- PRIdMAX", was: %"PRIdMAX" ***\n",
- adp->input, adp->expect, intmax
- );
- status = EXIT_FAILURE;
- }
- }
- while ( adp++->input != 0 );
- }
-
- {
- imaxdiv_t result;
- static struct
- {
- intmax_t numer;
- intmax_t denom;
- intmax_t exp_quot;
- intmax_t exp_rem;
- } div_data[] =
- {
- { 0, 1, 0, 0},
- { 0, -1, 0, 0},
- { 0, 2, 0, 0},
- { 0, -2, 0, 0},
- { 0, 5, 0, 0},
- { 0, -5, 0, 0},
- { 1, 1, 1, 0},
- { 1, -1, -1, 0},
- { 1, 2, 0, 1},
- { 1, -2, 0, 1},
- { 1, 5, 0, 1},
- { 1, -5, 0, 1},
- { -1, 1, -1, 0},
- { -1, -1, 1, 0},
- { -1, 2, 0, -1},
- { -1, -2, 0, -1},
- { -1, 5, 0, -1},
- { -1, -5, 0, -1},
- { 2, 1, 2, 0},
- { 2, -1, -2, 0},
- { 2, 2, 1, 0},
- { 2, -2, -1, 0},
- { 2, 5, 0, 2},
- { 2, -5, 0, 2},
- { -2, 1, -2, 0},
- { -2, -1, 2, 0},
- { -2, 2, -1, 0},
- { -2, -2, 1, 0},
- { -2, 5, 0, -2},
- { -2, -5, 0, -2},
- { 17, 5, 3, 2},
- { -17, -5, 3, -2},
- { 17, -5, -3, 2},
- { -17, 5, -3, -2},
- { 2147483647, 1, 2147483647, 0},
- { -2147483647LL, 1, -2147483647LL, 0},
- { 2147483648LL, 1LL, 2147483648LL, 0LL},
- { -2147483647-1LL, 1LL, -2147483647-1LL, 0LL},
- { 2147483647LL, 2LL, 1073741823LL, 1LL},
- { -2147483647LL, 2LL, -1073741823LL, -1LL},
- { 2147483648LL, 2LL, 1073741824LL, 0LL},
- { -2147483647-1LL, 2LL, -1073741824LL, 0LL},
-#ifdef INT_LEAST64_MAX /* else might support only 32 bits */
- { 4294967295LL, 1LL, 4294967295LL, 0LL},
- { -4294967296LL+1LL, 1LL, -4294967296LL+1, 0},
- { 4294967296LL, 1, 4294967296LL, 0},
- { -4294967296LL, 1LL, -4294967296LL, 0LL},
- { 4294967295LL, -1LL, -4294967296+1LL, 0LL},
- { -4294967296+1LL, -1LL, 4294967295LL, 0LL},
- { 4294967296LL, -1LL, -4294967296LL, 0LL},
- { -4294967296LL, -1LL, 4294967296LL, 0LL},
- { 4294967295LL, 2LL, 2147483647LL, 1LL},
- { -4294967296+1LL, 2LL, -2147483647LL, -1LL},
- { 4294967296LL, 2LL, 2147483648LL, 0LL},
- { -4294967296LL, 2LL, -2147483647-1LL, 0LL},
- { 4294967295LL, 2147483647LL, 2LL, 1LL},
- { -4294967296+1LL, 2147483647LL, -2LL, -1LL},
- { 4294967296LL, 2147483647LL, 2LL, 2LL},
- { -4294967296LL, 2147483647LL, -2LL, -2LL},
- { 4294967295LL, -2147483647LL, -2LL, 1LL},
- { -4294967296+1LL, -2147483647LL, 2LL, -1LL},
- { 4294967296LL, -2147483647LL, -2LL, 2LL},
- { -4294967296LL, -2147483647LL, 2LL, -2LL},
- { 4294967295LL, 2147483648LL, 1LL, 2147483647LL},
- { -4294967296+1LL, 2147483648LL, -1LL, -2147483647LL},
- { 4294967296LL, 2147483648LL, 2LL, 0LL},
- { -4294967296LL, 2147483648LL, -2LL, 0LL},
- { 4294967295LL, -2147483647-1LL, -1LL, 2147483647LL},
- { -4294967296+1LL, -2147483647-1LL, 1LL, -2147483647LL},
- { 4294967296LL, -2147483647-1LL, -2LL, 0LL},
- { -4294967296LL, -2147483647-1LL, 2LL, 0LL},
- { 9223372036854775807LL, 1LL, 9223372036854775807LL, 0LL},
- { -9223372036854775807LL, 1LL, -9223372036854775807LL, 0LL},
- { 9223372036854775807LL, 2LL, 4611686018427387903LL, 1LL},
- { -9223372036854775807LL, 2LL, -4611686018427387903LL, -1LL},
-#endif
- /* There should be a much larger battery of such tests. */
- { 0, 0, 0, 0} /* 0 denom terminates the list */
- }, *ddp;
-
- for ( ddp = div_data; ddp->denom != 0; ++ddp )
- if ( (result = imaxdiv(ddp->numer, ddp->denom)).quot
- != ddp->exp_quot || result.rem != ddp->exp_rem
- ) {
- printf("*** imaxdiv(%"PRIdMAX",%"PRIdMAX
- ") failed; should be: (%"PRIdMAX",%"PRIdMAX
- "), was: (%"PRIdMAX",%"PRIdMAX") ***\n",
- ddp->numer, ddp->denom, ddp->exp_quot,
- ddp->exp_rem, result.quot, result.rem
- );
- status = EXIT_FAILURE;
- }
- }
-
- {
- char *endptr;
- wchar_t *wendptr;
- static char saved[64]; /* holds copy of input string */
- static wchar_t wnptr[64]; /* holds wide copy of test string */
- static int warned; /* "warned for null endptr" flag */
- register int i;
- static struct
- {
- char * nptr;
- int base;
- intmax_t exp_val;
- int exp_len;
- } str_data[] =
- {
- { "", 0, 0, 0},
- { "", 2, 0, 0},
- { "", 8, 0, 0},
- { "", 9, 0, 0},
- { "", 10, 0, 0},
- { "", 16, 0, 0},
- { "", 36, 0, 0},
- { "0", 0, 0, 1},
- { "0", 2, 0, 1},
- { "0", 8, 0, 1},
- { "0", 9, 0, 1},
- { "0", 10, 0, 1},
- { "0", 16, 0, 1},
- { "0", 36, 0, 1},
- { "+0", 0, 0, 2},
- { "+0", 2, 0, 2},
- { "+0", 8, 0, 2},
- { "+0", 9, 0, 2},
- { "+0", 10, 0, 2},
- { "+0", 16, 0, 2},
- { "+0", 36, 0, 2},
- { "-0", 0, 0, 2},
- { "-0", 2, 0, 2},
- { "-0", 8, 0, 2},
- { "-0", 9, 0, 2},
- { "-0", 10, 0, 2},
- { "-0", 16, 0, 2},
- { "-0", 36, 0, 2},
- { "Inf", 0, 0, 0},
- { "Inf", 2, 0, 0},
- { "Inf", 8, 0, 0},
- { "Inf", 9, 0, 0},
- { "Inf", 10, 0, 0},
- { "Inf", 16, 0, 0},
- { "Inf", 36, 24171, 3},
- { "+Inf", 0, 0, 0},
- { "+Inf", 2, 0, 0},
- { "+Inf", 8, 0, 0},
- { "+Inf", 9, 0, 0},
- { "+Inf", 10, 0, 0},
- { "+Inf", 16, 0, 0},
- { "+Inf", 36, 24171, 4},
- { "-Inf", 0, 0, 0},
- { "-Inf", 2, 0, 0},
- { "-Inf", 8, 0, 0},
- { "-Inf", 9, 0, 0},
- { "-Inf", 10, 0, 0},
- { "-Inf", 16, 0, 0},
- { "-Inf", 36, -24171, 4},
- { "inf", 0, 0, 0},
- { "inf", 2, 0, 0},
- { "inf", 8, 0, 0},
- { "inf", 9, 0, 0},
- { "inf", 10, 0, 0},
- { "inf", 16, 0, 0},
- { "inf", 36, 24171, 3},
- { "+inf", 0, 0, 0},
- { "+inf", 2, 0, 0},
- { "+inf", 8, 0, 0},
- { "+inf", 9, 0, 0},
- { "+inf", 10, 0, 0},
- { "+inf", 16, 0, 0},
- { "+inf", 36, 24171, 4},
- { "-inf", 0, 0, 0},
- { "-inf", 2, 0, 0},
- { "-inf", 8, 0, 0},
- { "-inf", 9, 0, 0},
- { "-inf", 10, 0, 0},
- { "-inf", 16, 0, 0},
- { "-inf", 36, -24171, 4},
- { "119b8Z", 0, 119, 3},
- { "119bZ", 0, 119, 3},
- { "-0119bZ", 0, -9, 4},
- { " \t\n 0X119bZ", 0, 4507, 10},
- { " \t\n +0X119bZ", 0, 4507, 11},
- { " \t\n -0x119bZ", 0, -4507, 11},
- { " \t\n 119bZ", 0, 119, 7},
- { "+119bZ", 0, 119, 4},
- { "+0X119bz", 0, 4507, 7},
- { "119b8Z", 2, 3, 2},
- { "119bZ", 2, 3, 2},
- { "-0119bZ", 2, -3, 4},
- { " \t\n 0X119bZ", 2, 0, 5},
- { " \t\n +0X119bZ", 2, 0, 6},
- { " \t\n -0x119bZ", 2, 0, 6},
- { " \t\n 119bZ", 2, 3, 6},
- { "+119bZ", 2, 3, 3},
- { "+0X119bz", 2, 0, 2},
- { "119b8Z", 8, 9, 2},
- { "119bZ", 8, 9, 2},
- { "-0119bZ", 8, -9, 4},
- { " \t\n 0X119bZ", 8, 0, 5},
- { " \t\n +0X119bZ", 8, 0, 6},
- { " \t\n -0x119bZ", 8, 0, 6},
- { " \t\n 119bZ", 8, 9, 6},
- { "+119bZ", 8, 9, 3},
- { "+0X119bz", 8, 0, 2},
- { "119b8Z", 9, 10, 2},
- { "119bZ", 9, 10, 2},
- { "-0119bZ", 9, -10, 4},
- { " \t\n 0X119bZ", 9, 0, 5},
- { " \t\n +0X119bZ", 9, 0, 6},
- { " \t\n -0x119bZ", 9, 0, 6},
- { " \t\n 119bZ", 9, 10, 6},
- { "+119bZ", 9, 10, 3},
- { "+0X119bz", 9, 0, 2},
- { "119b8Z", 10, 119, 3},
- { "119bZ", 10, 119, 3},
- { "-0119bZ", 10, -119, 5},
- { " \t\n 0X119bZ", 10, 0, 5},
- { " \t\n +0X119bZ", 10, 0, 6},
- { " \t\n -0x119bZ", 10, 0, 6},
- { " \t\n 119bZ", 10, 119, 7},
- { "+119bZ", 10, 119, 4},
- { "+0X119bz", 10, 0, 2},
- { "119b8Z", 16, 72120, 5},
- { "119bZ", 16, 4507, 4},
- { "-0119bZ", 16, -4507, 6},
- { " \t\n 0X119bZ", 16, 4507, 10},
- { " \t\n +0X119bZ", 16, 4507, 11},
- { " \t\n -0x119bZ", 16, -4507, 11},
- { " \t\n 119bZ", 16, 4507,8},
- { "+119bZ", 16, 4507, 5},
- { "+0X119bz", 16, 4507, 7},
- { "119b8Z", 36, 62580275, 6},
- { "119bZ", 36, 1738367, 5},
- { "-0119bZ", 36, -1738367, 7},
- { " \t\n 0X119bZ", 36, 1997122175, 11},
- { " \t\n +0X119bZ", 36, 1997122175, 12},
- { " \t\n -0x119bZ", 36, -1997122175, 12},
- { " \t\n 119bZ", 36, 1738367, 9},
- { "+119bZ", 36, 1738367, 6},
- { "+0X119bz", 36, 1997122175, 8},
- /* There should be a much larger battery of such tests. */
- { "127", 0, 127, 3},
- { "-127", 0, -127, 4},
- { "128", 0, 128, 3},
- { "-128", 0, -127-1, 4},
- { "255", 0, 255, 3},
- { "-255", 0, -255, 4},
- { "256", 0, 256, 3},
- { "-256", 0, -255-1, 4},
- { "32767", 0, 32767, 5},
- { "-32767", 0, -32767, 6},
- { "32768", 0, 32768, 5},
- { "-32768", 0, -32767-1, 6},
- { "65535", 0, 65535, 5},
- { "-65535", 0, -65536+1, 6},
- { "65536", 0, 65536, 5},
- { "-65536", 0, -65536, 6},
- { "2147483647", 0, 2147483647, 10},
- { "-2147483647", 0, -2147483647, 11},
- { "2147483648", 0, 2147483648LL, 10},
- { "-2147483648", 0, -2147483647LL-1, 11},
- { "4294967295", 0, 4294967295LL, 10},
- { "-4294967295", 0, -4294967296LL+1, 11},
- { "4294967296", 0, 4294967296LL, 10},
- { "-4294967296", 0, -4294967296L, 11},
- { "9223372036854775807", 0, 9223372036854775807LL, 19},
- { "-9223372036854775807", 0, -9223372036854775807LL, 20},
- { "1234567890123456789", 0, 1234567890123456789LL, 19},
- { "-1234567890123456789", 0, -1234567890123456789LL, 20},
- { "1", 0, 1, 1},
- { "-1", 0, -1, 2},
- { "2", 0, 2, 1},
- { "-2", 0, -2, 2},
- { "10", 0, 10, 2},
- { "-10", 0, -10, 3},
- { "16", 0, 16, 2},
- { "-16", 0, -16, 3},
- /* Other test cases can be added here. */
- { NULL, 0, 0, 0 } /* terminates the list */
- }, *sdp;
-
- for ( sdp = str_data; sdp->nptr != NULL ; ++sdp )
- {
- /*
- 7.8.2.3 The strtoimax and strtoumax functions
- */
-
- strcpy(saved, sdp->nptr);
-
- errno = 0; /* shouldn't be changed */
-
- if ( (intmax = strtoimax(sdp->nptr, &endptr, sdp->base))
- != sdp->exp_val
- ) {
- int save = errno;
-
- printf("*** strtoimax(%s,,%d) failed; should be: %"
- PRIdMAX", was: %"PRIdMAX" ***\n", sdp->nptr,
- sdp->base, sdp->exp_val, intmax
- );
- status = EXIT_FAILURE;
- errno = save;
- }
- else if ( endptr != sdp->nptr + sdp->exp_len )
- {
- int save = errno;
-
- printf("*** strtoimax(%s,,%d) returned wrong endptr"
- " ***\n", sdp->nptr, sdp->base
- );
- status = EXIT_FAILURE;
- errno = save;
- }
-
- if ( errno != 0 )
- {
- printf("*** strtoimax modified errno ***\n");
- status = EXIT_FAILURE;
- }
-
- if ( strcmp(sdp->nptr, saved) != 0 )
- {
- printf("*** strtoimax modified its input ***\n");
- status = EXIT_FAILURE;
- strcpy(saved, sdp->nptr);
- }
-
- if ( sdp->exp_val >= 0 ) /* else some sign extension */
- {
- errno = 0; /* shouldn't be changed */
-
- if ( (uintmax = strtoumax(sdp->nptr, &endptr, sdp->base
- )
- ) != sdp->exp_val
- ) {
- int save = errno;
-
- printf("*** strtoumax(%s,,%d) failed; "
- "should be: %"PRIuMAX", was: %"PRIuMAX
- " ***\n", sdp->nptr, sdp->base,
- sdp->exp_val, uintmax
- );
- status = EXIT_FAILURE;
- errno = save;
- }
- else if ( endptr != sdp->nptr + sdp->exp_len )
- {
- int save = errno;
-
- printf("*** strtoumax(%s,,%d) returned wrong "
- "endptr ***\n", sdp->nptr, sdp->base
- );
- status = EXIT_FAILURE;
- errno = save;
- }
-
- if ( errno != 0 )
- {
- printf("*** strtoumax modified errno ***\n");
- status = EXIT_FAILURE;
- }
-
- if ( strcmp(sdp->nptr, saved) != 0 )
- {
- printf("*** strtoumax"
- " modified its input ***\n"
- );
- status = EXIT_FAILURE;
- strcpy(saved, sdp->nptr);
- }
- }
-
- /* tests for null endptr */
-
-#define WARN() if (!warned) warned = 1, printf("*** Using null endptr: ***\n")
-
- warned = 0;
- errno = 0; /* shouldn't be changed */
-
- if ( (intmax = strtoimax(sdp->nptr, (char **)NULL, sdp->base))
- != sdp->exp_val
- ) {
- int save = errno;
-
- WARN();
- printf("*** strtoimax(%s,NULL,%d) failed; "
- "should be: %"PRIdMAX", was: %"PRIdMAX" ***\n",
- sdp->nptr, sdp->base, sdp->exp_val, intmax
- );
- status = EXIT_FAILURE;
- errno = save;
- }
-
- if ( errno != 0 )
- {
- WARN();
- printf("*** strtoimax modified errno ***\n");
- status = EXIT_FAILURE;
- }
-
- if ( strcmp(sdp->nptr, saved) != 0 )
- {
- WARN();
- printf("*** strtoimax modified its input ***\n");
- status = EXIT_FAILURE;
- strcpy(saved, sdp->nptr);
- }
-
- if ( sdp->exp_val >= 0 ) /* else some sign extension */
- {
- errno = 0; /* shouldn't be changed */
-
- if ( (uintmax = strtoumax(sdp->nptr, (char **)NULL,
- sdp->base
- )
- ) != sdp->exp_val
- ) {
- int save = errno;
-
- WARN();
- printf("*** strtoumax(%s,NULL,%d) failed; "
- "should be: %"PRIuMAX", was: %"PRIuMAX
- " ***\n", sdp->nptr, sdp->base,
- sdp->exp_val, uintmax
- );
- status = EXIT_FAILURE;
- errno = save;
- }
-
- if ( errno != 0 )
- {
- WARN();
- printf("*** strtoumax modified errno ***\n");
- status = EXIT_FAILURE;
- }
-
- if ( strcmp(sdp->nptr, saved) != 0 )
- {
- WARN();
- printf("*** strtoumax"
- " modified its input ***\n"
- );
- status = EXIT_FAILURE;
- strcpy(saved, sdp->nptr);
- }
- }
-
- /*
- 7.8.2.4 The wcstoimax and wcstoumax functions
- */
-
- for ( i = 0; i < 64; ++i )
- if ( (wnptr[i] = sdp->nptr[i]) == '\0' )
- break;
-
- errno = 0; /* shouldn't be changed */
-
- if ( (intmax = wcstoimax(wnptr, &wendptr, sdp->base))
- != sdp->exp_val
- ) {
- int save = errno;
-
- printf("*** wcstoimax(%s,,%d) failed; should be: %"
- PRIdMAX", was: %"PRIdMAX" ***\n", sdp->nptr,
- sdp->base, sdp->exp_val, intmax
- );
- status = EXIT_FAILURE;
- errno = save;
- }
- else if ( wendptr != wnptr + sdp->exp_len )
- {
- int save = errno;
-
- printf("*** wcstoimax(%s,,%d) returned wrong endptr"
- " ***\n", sdp->nptr, sdp->base
- );
- status = EXIT_FAILURE;
- errno = save;
- }
-
- if ( errno != 0 )
- {
- printf("*** wcstoimax modified errno ***\n");
- status = EXIT_FAILURE;
- }
-
- for ( i = 0; i < 64; ++i )
- if ( wnptr[i] != sdp->nptr[i] )
- {
- printf("*** wcstoimax modified its input ***\n"
- );
- status = EXIT_FAILURE;
-
- for ( ; i < 64; ++i )
- if ( (wnptr[i] = sdp->nptr[i]) == '\0' )
- break;
-
- break;
- }
- else if ( wnptr[i] == '\0' )
- break;
-
- if ( sdp->exp_val >= 0 ) /* else some sign extension */
- {
- errno = 0; /* shouldn't be changed */
-
- if ( (uintmax = wcstoumax(wnptr, &wendptr, sdp->base)
- ) != sdp->exp_val
- ) {
- int save = errno;
-
- printf("*** wcstoumax(%s,,%d) failed; "
- "should be: %"PRIuMAX", was: %"PRIuMAX
- " ***\n", sdp->nptr, sdp->base,
- sdp->exp_val, uintmax
- );
- status = EXIT_FAILURE;
- errno = save;
- }
- else if ( wendptr != wnptr + sdp->exp_len )
- {
- int save = errno;
-
- printf("*** wcstoumax(%s,,%d) returned wrong "
- "endptr ***\n", sdp->nptr, sdp->base
- );
- status = EXIT_FAILURE;
- errno = save;
- }
-
- if ( errno != 0 )
- {
- printf("*** wcstoumax modified errno ***\n");
- status = EXIT_FAILURE;
- }
-
- for ( i = 0; i < 64; ++i )
- if ( wnptr[i] != sdp->nptr[i] )
- {
- printf("*** wcstoumax"
- " modified its input ***\n"
- );
- status = EXIT_FAILURE;
-
- for ( ; i < 64; ++i )
- if ( (wnptr[i] = sdp->nptr[i])
- == '\0'
- )
- break;
-
- break;
- }
- else if ( wnptr[i] == '\0' )
- break;
- }
-
- /* tests for null endptr */
-
- warned = 0;
- errno = 0; /* shouldn't be changed */
-
- if ( (intmax = wcstoimax(wnptr, (wchar_t **)NULL, sdp->base))
- != sdp->exp_val
- ) {
- int save = errno;
-
- WARN();
- printf("*** wcstoimax(%s,NULL,%d) failed; should be: %"
- PRIdMAX", was: %"PRIdMAX" ***\n", sdp->nptr,
- sdp->base, sdp->exp_val, intmax
- );
- status = EXIT_FAILURE;
- errno = save;
- }
-
- if ( errno != 0 )
- {
- WARN();
- printf("*** wcstoimax modified errno ***\n");
- status = EXIT_FAILURE;
- }
-
- for ( i = 0; i < 64; ++i )
- if ( wnptr[i] != sdp->nptr[i] )
- {
- WARN();
- printf("*** wcstoimax modified its input ***\n"
- );
- status = EXIT_FAILURE;
-
- for ( ; i < 64; ++i )
- if ( (wnptr[i] = sdp->nptr[i])
- == '\0'
- )
- break;
-
- break;
- }
- else if ( wnptr[i] == '\0' )
- break;
-
- if ( sdp->exp_val >= 0 ) /* else some sign extension */
- {
- errno = 0; /* shouldn't be changed */
-
- if ( (uintmax = wcstoumax(wnptr, (wchar_t **)NULL,
- sdp->base
- )
- ) != sdp->exp_val
- ) {
- int save = errno;
-
- WARN();
- printf("*** wcstoumax(%s,NULL,%d) failed; "
- "should be: %"PRIuMAX", was: %"PRIuMAX
- " ***\n", sdp->nptr, sdp->base,
- sdp->exp_val, uintmax
- );
- status = EXIT_FAILURE;
- errno = save;
- }
-
- if ( errno != 0 )
- {
- WARN();
- printf("*** wcstoumax modified errno ***\n");
- status = EXIT_FAILURE;
- }
-
- for ( i = 0; i < 64; ++i )
- if ( wnptr[i] != sdp->nptr[i] )
- {
- WARN();
- printf("*** wcstoumax"
- " modified its input ***\n"
- );
- status = EXIT_FAILURE;
-
- for ( ; i < 64; ++i )
- if ( (wnptr[i] = sdp->nptr[i])
- == '\0'
- )
- break;
-
- break;
- }
- else if ( wnptr[i] == '\0' )
- break;
- }
- }
-
- /*
- 7.8.2.3 The strtoimax and strtoumax functions (continued)
- */
-
- if ( (intmax = strtoimax("1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890",
- &endptr, 0
- )
- ) != INTMAX_MAX || errno != ERANGE
- ) {
- printf("*** strtoimax failed overflow test ***\n");
- status = EXIT_FAILURE;
- }
-
- if ( (intmax = strtoimax("+1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890",
- &endptr, 0
- )
- ) != INTMAX_MAX || errno != ERANGE
- ) {
- printf("*** strtoimax failed +overflow test ***\n");
- status = EXIT_FAILURE;
- }
-
- if ( (intmax = strtoimax("-1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890",
- &endptr, 0
- )
- ) != INTMAX_MIN || errno != ERANGE
- ) {
- printf("*** strtoimax failed -overflow test ***\n");
- status = EXIT_FAILURE;
- }
-
- if ( (uintmax = strtoumax("1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890",
- &endptr, 0
- )
- ) != UINTMAX_MAX || errno != ERANGE
- ) {
- printf("*** strtoumax failed overflow test ***\n");
- status = EXIT_FAILURE;
- }
-
- if ( (uintmax = strtoumax("+1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890",
- &endptr, 0
- )
- ) != UINTMAX_MAX || errno != ERANGE
- ) {
- printf("*** strtoumax failed +overflow test ***\n");
- status = EXIT_FAILURE;
- }
-
- if ( (uintmax = strtoumax("-1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890"
- "1234567890123456789012345678901234567890",
- &endptr, 0
- )
- ) != UINTMAX_MAX || errno != ERANGE
- ) {
- printf("*** strtoumax failed -overflow test ***\n");
- status = EXIT_FAILURE;
- }
-
- /*
- 7.8.2.4 The wcstoimax and wcstoumax functions (continued)
- */
-
- if ( (intmax = wcstoimax(L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890",
- &wendptr, 0
- )
- ) != INTMAX_MAX || errno != ERANGE
- ) {
- printf("*** wcstoimax failed overflow test ***\n");
- status = EXIT_FAILURE;
- }
-
- if ( (intmax = wcstoimax(L"+1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890",
- &wendptr, 0
- )
- ) != INTMAX_MAX || errno != ERANGE
- ) {
- printf("*** wcstoimax failed +overflow test ***\n");
- status = EXIT_FAILURE;
- }
-
- if ( (intmax = wcstoimax(L"-1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890",
- &wendptr, 0
- )
- ) != INTMAX_MIN || errno != ERANGE
- ) {
- printf("*** wcstoimax failed -overflow test ***\n");
- status = EXIT_FAILURE;
- }
-
- if ( (uintmax = wcstoumax(L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890",
- &wendptr, 0
- )
- ) != UINTMAX_MAX || errno != ERANGE
- ) {
- printf("*** wcstoumax failed overflow test ***\n");
- status = EXIT_FAILURE;
- }
-
- if ( (uintmax = wcstoumax(L"+1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890",
- &wendptr, 0
- )
- ) != UINTMAX_MAX || errno != ERANGE
- ) {
- printf("*** wcstoumax failed +overflow test ***\n");
- status = EXIT_FAILURE;
- }
-
- if ( (uintmax = wcstoumax(L"-1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890"
- L"1234567890123456789012345678901234567890",
- &wendptr, 0
- )
- ) != UINTMAX_MAX || errno != ERANGE
- ) {
- printf("*** wcstoumax failed -overflow test ***\n");
- status = EXIT_FAILURE;
- }
- }
-#endif /* defined(INTMAX_MAX) */
-
- if ( status != 0 )
- fprintf(stderr, "sitest failed; see stdout for details\n");
-
- return status;
- }
diff --git a/winsup/mingw/mingwex/snprintf.c b/winsup/mingw/mingwex/snprintf.c
deleted file mode 100644
index c8d2a7b20..000000000
--- a/winsup/mingw/mingwex/snprintf.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-
-int snprintf(char* buffer, size_t n, const char* format, ...)
-{
- int retval;
- va_list argptr;
-
- va_start( argptr, format );
- retval = _vsnprintf( buffer, n, format, argptr );
- va_end( argptr );
- return retval;
-}
diff --git a/winsup/mingw/mingwex/snwprintf.c b/winsup/mingw/mingwex/snwprintf.c
deleted file mode 100644
index 42b05b292..000000000
--- a/winsup/mingw/mingwex/snwprintf.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <stdarg.h>
-#include <wchar.h>
-
-int snwprintf(wchar_t* buffer, size_t n, const wchar_t* format, ...)
-{
- int retval;
- va_list argptr;
-
- va_start( argptr, format );
- retval = _vsnwprintf( buffer, n, format, argptr );
- va_end( argptr );
- return retval;
-}
diff --git a/winsup/mingw/mingwex/strtof.c b/winsup/mingw/mingwex/strtof.c
deleted file mode 100644
index 62907cb19..000000000
--- a/winsup/mingw/mingwex/strtof.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <stdlib.h>
-
-float strtof( const char *nptr, char **endptr)
-{
- return (strtod(nptr, endptr));
-}
diff --git a/winsup/mingw/mingwex/strtoimax.c b/winsup/mingw/mingwex/strtoimax.c
deleted file mode 100644
index 0cf2c01ed..000000000
--- a/winsup/mingw/mingwex/strtoimax.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- This source code was extracted from the Q8 package created and
- placed in the PUBLIC DOMAIN by Doug Gwyn <gwyn@arl.mil>
- last edit: 1999/11/05 gwyn@arl.mil
-
- Implements subclause 7.8.2 of ISO/IEC 9899:1999 (E).
-
- This particular implementation requires the matching <inttypes.h>.
- It also assumes that character codes for A..Z and a..z are in
- contiguous ascending order; this is true for ASCII but not EBCDIC.
-*/
-#include <stdlib.h>
-#include <errno.h>
-#include <ctype.h>
-#include <inttypes.h>
-
-/* Helper macros */
-
-/* convert digit character to number, in any base */
-#define ToNumber(c) (isdigit(c) ? (c) - '0' : \
- isupper(c) ? (c) - 'A' + 10 : \
- islower(c) ? (c) - 'a' + 10 : \
- -1 /* "invalid" flag */ \
- )
-/* validate converted digit character for specific base */
-#define valid(n, b) ((n) >= 0 && (n) < (b))
-
-intmax_t
-strtoimax(nptr, endptr, base)
- register const char * __restrict__ nptr;
- char ** __restrict__ endptr;
- register int base;
- {
- register uintmax_t accum; /* accumulates converted value */
- register int n; /* numeral from digit character */
- int minus; /* set iff minus sign seen */
- int toobig; /* set iff value overflows */
-
- if ( endptr != NULL )
- *endptr = (char *)nptr; /* in case no conversion's performed */
-
- if ( base < 0 || base == 1 || base > 36 )
- {
- errno = EDOM;
- return 0; /* unspecified behavior */
- }
-
- /* skip initial, possibly empty sequence of white-space characters */
-
- while ( isspace(*nptr) )
- ++nptr;
-
- /* process subject sequence: */
-
- /* optional sign */
- if ( (minus = *nptr == '-') || *nptr == '+' )
- ++nptr;
-
- if ( base == 0 ) {
- if ( *nptr == '0' ) {
- if ( nptr[1] == 'X' || nptr[1] == 'x' )
- base = 16;
- else
- base = 8;
- }
- else
- base = 10;
- }
- /* optional "0x" or "0X" for base 16 */
-
- if ( base == 16 && *nptr == '0' && (nptr[1] == 'X' || nptr[1] == 'x') )
- nptr += 2; /* skip past this prefix */
-
- /* check whether there is at least one valid digit */
-
- n = ToNumber(*nptr);
- ++nptr;
-
- if ( !valid(n, base) )
- return 0; /* subject seq. not of expected form */
-
- accum = n;
-
- for ( toobig = 0; n = ToNumber(*nptr), valid(n, base); ++nptr )
- if ( accum > INTMAX_MAX / base + 2 ) /* major wrap-around */
- toobig = 1; /* but keep scanning */
- else
- accum = base * accum + n;
-
- if ( endptr != NULL )
- *endptr = (char *)nptr; /* points to first not-valid-digit */
-
- if ( minus )
- {
- if ( accum > (uintmax_t)INTMAX_MAX + 1 )
- toobig = 1;
- }
- else
- if ( accum > (uintmax_t)INTMAX_MAX )
- toobig = 1;
-
- if ( toobig )
- {
- errno = ERANGE;
- return minus ? INTMAX_MIN : INTMAX_MAX;
- }
- else
- return (intmax_t)(minus ? -accum : accum);
- }
-
-long long __attribute__ ((alias ("strtoimax")))
-strtoll (const char* __restrict__ nptr, char ** __restrict__ endptr, int base);
diff --git a/winsup/mingw/mingwex/strtoumax.c b/winsup/mingw/mingwex/strtoumax.c
deleted file mode 100644
index 2c052ac06..000000000
--- a/winsup/mingw/mingwex/strtoumax.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- This source code was extracted from the Q8 package created and
- placed in the PUBLIC DOMAIN by Doug Gwyn <gwyn@arl.mil>
- last edit: 1999/11/05 gwyn@arl.mil
-
- Implements subclause 7.8.2 of ISO/IEC 9899:1999 (E).
-
- This particular implementation requires the matching <inttypes.h>.
- It also assumes that character codes for A..Z and a..z are in
- contiguous ascending order; this is true for ASCII but not EBCDIC.
-*/
-#include <stdlib.h>
-#include <errno.h>
-#include <ctype.h>
-#include <inttypes.h>
-
-/* Helper macros */
-
-/* convert digit character to number, in any base */
-#define ToNumber(c) (isdigit(c) ? (c) - '0' : \
- isupper(c) ? (c) - 'A' + 10 : \
- islower(c) ? (c) - 'a' + 10 : \
- -1 /* "invalid" flag */ \
- )
-/* validate converted digit character for specific base */
-#define valid(n, b) ((n) >= 0 && (n) < (b))
-
-uintmax_t
-strtoumax(nptr, endptr, base)
- register const char * __restrict__ nptr;
- char ** __restrict__ endptr;
- register int base;
- {
- register uintmax_t accum; /* accumulates converted value */
- register uintmax_t next; /* for computing next value of accum */
- register int n; /* numeral from digit character */
- int minus; /* set iff minus sign seen (yes!) */
- int toobig; /* set iff value overflows */
-
- if ( endptr != NULL )
- *endptr = (char *)nptr; /* in case no conversion's performed */
-
- if ( base < 0 || base == 1 || base > 36 )
- {
- errno = EDOM;
- return 0; /* unspecified behavior */
- }
-
- /* skip initial, possibly empty sequence of white-space characters */
-
- while ( isspace(*nptr) )
- ++nptr;
-
- /* process subject sequence: */
-
- /* optional sign (yes!) */
-
- if ( (minus = *nptr == '-') || *nptr == '+' )
- ++nptr;
-
- if ( base == 0 )
- {
- if ( *nptr == '0' )
- {
- if ( nptr[1] == 'X' || nptr[1] == 'x' )
- base = 16;
- else
- base = 8;
- }
- else
- base = 10;
- }
-
- /* optional "0x" or "0X" for base 16 */
-
- if ( base == 16 && *nptr == '0' && (nptr[1] == 'X' || nptr[1] == 'x') )
- nptr += 2; /* skip past this prefix */
-
- /* check whether there is at least one valid digit */
-
- n = ToNumber(*nptr);
- ++nptr;
-
- if ( !valid(n, base) )
- return 0; /* subject seq. not of expected form */
-
- accum = n;
-
- for ( toobig = 0; n = ToNumber(*nptr), valid(n, base); ++nptr )
- if ( accum > UINTMAX_MAX / base + 1 /* major wrap-around */
- || (next = base * accum + n) < accum /* minor wrap-around */
- )
- toobig = 1; /* but keep scanning */
- else
- accum = next;
-
- if ( endptr != NULL )
- *endptr = (char *)nptr; /* points to first not-valid-digit */
-
- if ( toobig )
- {
- errno = ERANGE;
- return UINTMAX_MAX;
- }
- else
- return minus ? -accum : accum; /* (yes!) */
- }
-
-unsigned long long __attribute__ ((alias ("strtoumax")))
-strtoull (const char* __restrict__ nptr, char ** __restrict__ endptr, int base);
diff --git a/winsup/mingw/mingwex/testwmem.c b/winsup/mingw/mingwex/testwmem.c
deleted file mode 100644
index 1310718c9..000000000
--- a/winsup/mingw/mingwex/testwmem.c
+++ /dev/null
@@ -1,104 +0,0 @@
-#include <memory.h>
-#include <wchar.h>
-#include <stdio.h>
-
-wchar_t fmt1[] = L" 1 2 3 4 5";
-wchar_t fmt2[] = L"12345678901234567890123456789012345678901234567890";
-
-void test_wmemchr( void )
-{
- wchar_t* dest;
- wint_t result;
- wint_t ch = L'r';
- wchar_t str[] = L"lazy";
- wchar_t string1[60] = L"The quick brown dog jumps over the lazy fox";
-
- wprintf( L"Wmemchr\n" );
- wprintf( L"String to be searched:\n\t\t%s\n", string1 );
- wprintf( L"\t\t%s\n\t\t%s\n\n", fmt1, fmt2 );
-
- wprintf( L"Search char:\t%c\n", ch );
- dest = wmemchr( string1, ch, sizeof( string1 ) );
- result = dest - string1 + 1;
- if( dest != NULL )
- wprintf( L"Result:\t\t%c found at position %d\n\n", ch, result );
- else
- wprintf( L"Result:\t\t%c not found\n\n" );
-return;
-}
-void test_wmemset( void )
-{/* 1 2
- 0123456789012345678901234567890 */
- wchar_t buffer[] = L"This is a test of the wmemset function";
- wprintf( L"Before: %s\n", buffer );
- wmemset( buffer+22, L'*', 7 );
- wprintf( L"After: %s\n\n", buffer );
-return;
-}
-
-void test_wmemmove( void )
-{
- wchar_t string1[60] = L"The quick brown dog jumps over the lazy fox";
- wchar_t string2[60] = L"The quick brown fox jumps over the lazy dog";
-
- wprintf( L"Wmemcpy without overlap\n" );
- wprintf( L"Source:\t\t%s\n", string1 + 40 );
- wprintf( L"Destination:\t%s\n", string1 + 16 );
- wmemcpy( string1 + 16, string1 + 40, 3 );
- wprintf( L"Result:\t\t%s\n", string1 );
- wprintf( L"Length:\t\t%d characters\n\n", wcslen( string1 ) );
- wmemcpy( string1 + 16, string2 + 40, 3 );
-
- wprintf( L"Wmemmove with overlap\n" );
- wprintf( L"Source:\t\t%s\n", string2 + 4 );
- wprintf( L"Destination:\t%s\n", string2 + 10 );
- wmemmove( string2 + 10, string2 + 4, 40 );
- wprintf( L"Result:\t\t%s\n", string2 );
- wprintf( L"Length:\t\t%d characters\n\n", wcslen( string2 ) );
-
- wprintf( L"Wmemcpy with overlap\n" );
- wprintf( L"Source:\t\t%s\n", string1 + 4 );
- wprintf( L"Destination:\t%s\n", string1 + 10 );
- wmemcpy( string1 + 10, string1 + 4, 40 );
- wprintf( L"Result:\t\t%s\n", string1 );
- wprintf( L"Length:\t\t%d characters\n\n", wcslen( string1 ) );
-}
-
-
-void test_wmemcmp( void )
-{
- wchar_t first[] = L"12345678901234567890";
- wchar_t second[] = L"12345678901234567891";
- wint_t result;
- wprintf(L"Wmemcmp\n");
- wprintf( L"Compare '%.19s' to '%.19s':\n", first, second );
- result = wmemcmp( first, second, 19 );
- if( result < 0 )
- wprintf( L"First is less than second.\n" );
- else if( result == 0 )
- wprintf( L"First is equal to second.\n" );
- else if( result > 0 )
- wprintf( L"First is greater than second.\n" );
- wprintf( L"\nCompare '%.20s' to '%.20s':\n", first, second );
- result = wmemcmp( first, second, 20 );
- if( result < 0 )
- wprintf( L"First is less than second.\n\n" );
- else if( result == 0 )
- wprintf( L"First is equal to second.\n\n" );
- else if( result > 0 )
- wprintf( L"First is greater than second.\n\n" );
-}
-
-
-
-int main(){
-test_wmemset();
-test_wmemmove();
-test_wmemchr();
-test_wmemcmp();
-return 0;
-}
-
-
-
-
diff --git a/winsup/mingw/mingwex/trunc.c b/winsup/mingw/mingwex/trunc.c
deleted file mode 100644
index 2b9931255..000000000
--- a/winsup/mingw/mingwex/trunc.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <fenv.h>
-#include <math.h>
-
-double
-trunc (double _x){
- double retval;
- unsigned short saved_cw;
- __asm__ ("fnstcw %0;": "=m" (saved_cw)); /* save FPU control word */
- __asm__ ("fldcw %0;"
- :
- : "m" ((saved_cw & ~(FE_TONEAREST | FE_DOWNWARD | FE_UPWARD
- | FE_TOWARDZERO)) | FE_TOWARDZERO)
- );
- __asm__ ("frndint;" : "=t" (retval) : "0" (_x)); /* round towards zero */
- __asm__ ("fldcw %0;" : : "m" (saved_cw) ); /* restore saved control word */
- return retval;
-}
diff --git a/winsup/mingw/mingwex/truncf.c b/winsup/mingw/mingwex/truncf.c
deleted file mode 100644
index 53fccb153..000000000
--- a/winsup/mingw/mingwex/truncf.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <fenv.h>
-#include <math.h>
-
-float
-truncf (float _x){
- float retval;
- unsigned short saved_cw;
- __asm__ ("fnstcw %0;": "=m" (saved_cw)); /* save FPU control word */
- __asm__ ("fldcw %0;"
- :
- : "m" ((saved_cw & ~(FE_TONEAREST | FE_DOWNWARD | FE_UPWARD
- | FE_TOWARDZERO)) | FE_TOWARDZERO)
- );
- __asm__ ("frndint;" : "=t" (retval) : "0" (_x)); /* round towards zero */
- __asm__ ("fldcw %0;" : : "m" (saved_cw) ); /* restore saved control word */
- return retval;
-}
diff --git a/winsup/mingw/mingwex/truncl.c b/winsup/mingw/mingwex/truncl.c
deleted file mode 100644
index 908197acc..000000000
--- a/winsup/mingw/mingwex/truncl.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <fenv.h>
-#include <math.h>
-
-long double
-truncl (long double _x){
- long double retval;
- unsigned short saved_cw;
- __asm__ ("fnstcw %0;": "=m" (saved_cw)); /* save FPU control word */
- __asm__ ("fldcw %0;"
- :
- : "m" ((saved_cw & ~(FE_TONEAREST | FE_DOWNWARD | FE_UPWARD
- | FE_TOWARDZERO)) | FE_TOWARDZERO)
- );
- __asm__ ("frndint;" : "=t" (retval) : "0" (_x)); /* round towards zero */
- __asm__ ("fldcw %0;" : : "m" (saved_cw) ); /* restore saved control word */
- return retval;
-}
diff --git a/winsup/mingw/mingwex/ulltoa.c b/winsup/mingw/mingwex/ulltoa.c
deleted file mode 100644
index 8e90de764..000000000
--- a/winsup/mingw/mingwex/ulltoa.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <stdlib.h>
-char* ulltoa(unsigned long long _n, char * _c, int _i)
- { return _ui64toa (_n, _c, _i); }
diff --git a/winsup/mingw/mingwex/ulltow.c b/winsup/mingw/mingwex/ulltow.c
deleted file mode 100644
index 8e4f228f1..000000000
--- a/winsup/mingw/mingwex/ulltow.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <stdlib.h>
-wchar_t* ulltow(unsigned long long _n, wchar_t * _w, int _i)
- { return _ui64tow (_n, _w, _i); }
diff --git a/winsup/mingw/mingwex/vsnprintf.c b/winsup/mingw/mingwex/vsnprintf.c
deleted file mode 100644
index 466e064e9..000000000
--- a/winsup/mingw/mingwex/vsnprintf.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-
-int vsnprintf (char* s, size_t n, const char* format, va_list arg)
- { return _vsnprintf ( s, n, format, arg); }
diff --git a/winsup/mingw/mingwex/vsnwprintf.c b/winsup/mingw/mingwex/vsnwprintf.c
deleted file mode 100644
index 05a1ec9b0..000000000
--- a/winsup/mingw/mingwex/vsnwprintf.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <stdarg.h>
-#include <wchar.h>
-
-int vsnwprintf(wchar_t *buffer, size_t n, const wchar_t * format, va_list argptr)
- { return _vsnwprintf( buffer, n, format, argptr );}
diff --git a/winsup/mingw/mingwex/wcstof.c b/winsup/mingw/mingwex/wcstof.c
deleted file mode 100644
index 830f79416..000000000
--- a/winsup/mingw/mingwex/wcstof.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <wchar.h>
-
-float wcstof( const wchar_t *nptr, wchar_t **endptr)
-{
- return (wcstod(nptr, endptr));
-}
diff --git a/winsup/mingw/mingwex/wcstoimax.c b/winsup/mingw/mingwex/wcstoimax.c
deleted file mode 100644
index 4b82b14a2..000000000
--- a/winsup/mingw/mingwex/wcstoimax.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- This source code was extracted from the Q8 package created and
- placed in the PUBLIC DOMAIN by Doug Gwyn <gwyn@arl.mil>
-
- last edit: 1999/11/05 gwyn@arl.mil
-
- Implements subclause 7.8.2 of ISO/IEC 9899:1999 (E).
-
- This particular implementation requires the matching <inttypes.h>.
- It also assumes that character codes for A..Z and a..z are in
- contiguous ascending order; this is true for ASCII but not EBCDIC.
-*/
-
-#include <wchar.h>
-#include <errno.h>
-#include <ctype.h>
-#include <inttypes.h>
-
-/* convert digit wide character to number, in any base */
-
-#define ToWNumber(c) (iswdigit(c) ? (c) - L'0' : \
- iswupper(c) ? (c) - L'A' + 10 : \
- iswlower(c) ? (c) - L'a' + 10 : \
- -1 /* "invalid" flag */ \
- )
-
-/* validate converted digit character for specific base */
-#define valid(n, b) ((n) >= 0 && (n) < (b))
-
-intmax_t
-wcstoimax(nptr, endptr, base)
- register const wchar_t * __restrict__ nptr;
- wchar_t ** __restrict__ endptr;
- register int base;
- {
- register uintmax_t accum; /* accumulates converted value */
- register int n; /* numeral from digit character */
- int minus; /* set iff minus sign seen */
- int toobig; /* set iff value overflows */
-
- if ( endptr != NULL )
- *endptr = (wchar_t *)nptr; /* in case no conv performed */
-
- if ( base < 0 || base == 1 || base > 36 )
- {
- errno = EDOM;
- return 0; /* unspecified behavior */
- }
-
- /* skip initial, possibly empty sequence of white-space w.characters */
-
- while ( iswspace(*nptr) )
- ++nptr;
-
- /* process subject sequence: */
-
- /* optional sign */
-
- if ( (minus = *nptr == L'-') || *nptr == L'+' )
- ++nptr;
-
- if ( base == 0 )
- {
- if ( *nptr == L'0' )
- {
- if ( nptr[1] == L'X' || nptr[1] == L'x' )
- base = 16;
- else
- base = 8;
- }
- else
- base = 10;
- }
- /* optional "0x" or "0X" for base 16 */
-
- if ( base == 16 && *nptr == L'0'
- && (nptr[1] == L'X' || nptr[1] == L'x')
- )
- nptr += 2; /* skip past this prefix */
-
- /* check whether there is at least one valid digit */
-
- n = ToWNumber(*nptr);
- ++nptr;
-
- if ( !valid(n, base) )
- return 0; /* subject seq. not of expected form */
-
- accum = n;
-
- for ( toobig = 0; n = ToWNumber(*nptr), valid(n, base); ++nptr )
- if ( accum > INTMAX_MAX / base + 2 ) /* major wrap-around */
- toobig = 1; /* but keep scanning */
- else
- accum = base * accum + n;
-
- if ( endptr != NULL )
- *endptr = (wchar_t *)nptr; /* -> first not-valid-digit */
-
- if ( minus )
- {
- if ( accum > (uintmax_t)INTMAX_MAX + 1 )
- toobig = 1;
- }
- else
- if ( accum > (uintmax_t)INTMAX_MAX )
- toobig = 1;
-
- if ( toobig )
- {
- errno = ERANGE;
- return minus ? INTMAX_MIN : INTMAX_MAX;
- }
- else
- return (intmax_t)(minus ? -accum : accum);
- }
-
-long long __attribute__ ((alias ("wcstoimax")))
-wcstoll (const wchar_t* __restrict__ nptr, wchar_t ** __restrict__ endptr, int base);
diff --git a/winsup/mingw/mingwex/wcstoumax.c b/winsup/mingw/mingwex/wcstoumax.c
deleted file mode 100644
index 9bd6cd704..000000000
--- a/winsup/mingw/mingwex/wcstoumax.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- This source code was extracted from the Q8 package created and
- placed in the PUBLIC DOMAIN by Doug Gwyn <gwyn@arl.mil>
-
- last edit: 1999/11/05 gwyn@arl.mil
-
- Implements subclause 7.8.2 of ISO/IEC 9899:1999 (E).
-
- This particular implementation requires the matching <inttypes.h>.
- It also assumes that character codes for A..Z and a..z are in
- contiguous ascending order; this is true for ASCII but not EBCDIC.
-*/
-
-#include <wchar.h>
-#include <errno.h>
-#include <ctype.h>
-#include <inttypes.h>
-
-/* convert digit wide character to number, in any base */
-
-#define ToWNumber(c) (iswdigit(c) ? (c) - L'0' : \
- iswupper(c) ? (c) - L'A' + 10 : \
- iswlower(c) ? (c) - L'a' + 10 : \
- -1 /* "invalid" flag */ \
- )
-
-/* validate converted digit character for specific base */
-#define valid(n, b) ((n) >= 0 && (n) < (b))
-
-uintmax_t
-wcstoumax(nptr, endptr, base)
- register const wchar_t * __restrict__ nptr;
- wchar_t ** __restrict__ endptr;
- register int base;
- {
- register uintmax_t accum; /* accumulates converted value */
- register uintmax_t next; /* for computing next value of accum */
- register int n; /* numeral from digit character */
- int minus; /* set iff minus sign seen (yes!) */
- int toobig; /* set iff value overflows */
-
- if ( endptr != NULL )
- *endptr = (wchar_t *)nptr; /* in case no conv performed */
-
- if ( base < 0 || base == 1 || base > 36 )
- {
- errno = EDOM;
- return 0; /* unspecified behavior */
- }
-
- /* skip initial, possibly empty sequence of white-space w.characters */
-
- while ( iswspace(*nptr) )
- ++nptr;
-
- /* process subject sequence: */
-
- /* optional sign */
-
- if ( (minus = *nptr == L'-') || *nptr == L'+' )
- ++nptr;
-
- if ( base == 0 )
- {
- if ( *nptr == L'0' )
- {
- if ( nptr[1] == L'X' || nptr[1] == L'x' )
- base = 16;
- else
- base = 8;
- }
- else
- base = 10;
- }
- /* optional "0x" or "0X" for base 16 */
-
- if ( base == 16 && *nptr == L'0'
- && (nptr[1] == L'X' || nptr[1] == L'x')
- )
- nptr += 2; /* skip past this prefix */
-
- /* check whether there is at least one valid digit */
-
- n = ToWNumber(*nptr);
- ++nptr;
-
- if ( !valid(n, base) )
- return 0; /* subject seq. not of expected form */
-
- accum = n;
-
- for ( toobig = 0; n = ToWNumber(*nptr), valid(n, base); ++nptr )
- if ( accum > UINTMAX_MAX / base + 1 /* major wrap-around */
- || (next = base * accum + n) < accum /* minor wrap-around */
- )
- toobig = 1; /* but keep scanning */
- else
- accum = next;
-
- if ( endptr != NULL )
- *endptr = (wchar_t *)nptr; /* -> first not-valid-digit */
-
- if ( toobig )
- {
- errno = ERANGE;
- return UINTMAX_MAX;
- }
- else
- return minus ? -accum : accum; /* (yes!) */
- }
-
-unsigned long long __attribute__ ((alias ("wcstoumax")))
-wcstoull (const wchar_t* __restrict__ nptr, wchar_t ** __restrict__ endptr, int base);
diff --git a/winsup/mingw/mingwex/wdirent.c b/winsup/mingw/mingwex/wdirent.c
deleted file mode 100644
index 4b8cc5054..000000000
--- a/winsup/mingw/mingwex/wdirent.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define _UNICODE 1
-#define UNICODE 1
-#include "dirent.c"
diff --git a/winsup/mingw/mingwex/wmemchr.c b/winsup/mingw/mingwex/wmemchr.c
deleted file mode 100644
index dc5cedd23..000000000
--- a/winsup/mingw/mingwex/wmemchr.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* This source code was extracted from the Q8 package created and placed
- in the PUBLIC DOMAIN by Doug Gwyn <gwyn@arl.mil>
- last edit: 1999/11/05 gwyn@arl.mil
-
- Implements subclause 7.24 of ISO/IEC 9899:1999 (E).
-
- It supports an encoding where all char codes are mapped
- to the *same* code values within a wchar_t or wint_t,
- so long as no other wchar_t codes are used by the program.
-
-*/
-
-#include <wchar.h>
-
-wchar_t*
-wmemchr(s, c, n)
- register const wchar_t *s;
- register wchar_t c;
- register size_t n;
- {
- if ( s != NULL )
- for ( ; n > 0; ++s, --n )
- if ( *s == c )
- return (wchar_t *)s;
-
- return NULL;
- }
-
diff --git a/winsup/mingw/mingwex/wmemcmp.c b/winsup/mingw/mingwex/wmemcmp.c
deleted file mode 100644
index e1e034c7b..000000000
--- a/winsup/mingw/mingwex/wmemcmp.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* This source code was extracted from the Q8 package created and placed
- in the PUBLIC DOMAIN by Doug Gwyn <gwyn@arl.mil>
- last edit: 1999/11/05 gwyn@arl.mil
-
- Implements subclause 7.24 of ISO/IEC 9899:1999 (E).
-
- It supports an encoding where all char codes are mapped
- to the *same* code values within a wchar_t or wint_t,
- so long as no other wchar_t codes are used by the program.
-
-*/
-
-#include <wchar.h>
-
-int
-wmemcmp(s1, s2, n)
- register const wchar_t *s1;
- register const wchar_t *s2;
- size_t n;
- {
- if ( n == 0 || s1 == s2 )
- return 0; /* even for NULL pointers */
-
- if ( (s1 != NULL) != (s2 != NULL) )
- return s2 == NULL ? 1 : -1; /* robust */
-
- for ( ; n > 0; ++s1, ++s2, --n )
- if ( *s1 != *s2 )
- return *s1 - *s2;
-
- return 0;
- }
diff --git a/winsup/mingw/mingwex/wmemcpy.c b/winsup/mingw/mingwex/wmemcpy.c
deleted file mode 100644
index d7e7b4cb3..000000000
--- a/winsup/mingw/mingwex/wmemcpy.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* This source code was extracted from the Q8 package created and placed
- in the PUBLIC DOMAIN by Doug Gwyn <gwyn@arl.mil>
- last edit: 1999/11/05 gwyn@arl.mil
-
- Implements subclause 7.24 of ISO/IEC 9899:1999 (E).
-
- It supports an encoding where all char codes are mapped
- to the *same* code values within a wchar_t or wint_t,
- so long as no other wchar_t codes are used by the program.
-
-*/
-
-#include <wchar.h>
-
-
-wchar_t *
-wmemcpy(s1, s2, n)
- register wchar_t * __restrict__ s1;
- register const wchar_t * __restrict__ s2;
- register size_t n;
- {
- wchar_t *orig_s1 = s1;
-
- if ( s1 == NULL || s2 == NULL || n == 0 )
- return orig_s1; /* robust */
-
- for ( ; n > 0; --n )
- *s1++ = *s2++;
-
- return orig_s1;
- }
-
diff --git a/winsup/mingw/mingwex/wmemmove.c b/winsup/mingw/mingwex/wmemmove.c
deleted file mode 100644
index 3c545ac32..000000000
--- a/winsup/mingw/mingwex/wmemmove.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* This source code was extracted from the Q8 package created and placed
- in the PUBLIC DOMAIN by Doug Gwyn <gwyn@arl.mil>
- last edit: 1999/11/05 gwyn@arl.mil
-
- Implements subclause 7.24 of ISO/IEC 9899:1999 (E).
-
- It supports an encoding where all char codes are mapped
- to the *same* code values within a wchar_t or wint_t,
- so long as no other wchar_t codes are used by the program.
-
-*/
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <wchar.h>
-
-wchar_t *
-wmemmove(s1, s2, n)
- register wchar_t *s1;
- register const wchar_t *s2;
- register size_t n;
- {
- wchar_t *orig_s1 = s1;
-
- if ( s1 == NULL || s2 == NULL || n == 0 )
- return orig_s1; /* robust */
-
- /* XXX -- The following test works only within a flat address space! */
- if ( s2 >= s1 )
- for ( ; n > 0; --n )
- *s1++ = *s2++;
- else {
- s1 += n;
- s2 += n;
-
- for ( ; n > 0; --n )
- *--s1 = *--s2;
- }
-
- return orig_s1;
- }
-
diff --git a/winsup/mingw/mingwex/wmemset.c b/winsup/mingw/mingwex/wmemset.c
deleted file mode 100644
index dadd9fb07..000000000
--- a/winsup/mingw/mingwex/wmemset.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* This source code was extracted from the Q8 package created and placed
- in the PUBLIC DOMAIN by Doug Gwyn <gwyn@arl.mil>
- last edit: 1999/11/05 gwyn@arl.mil
-
- Implements subclause 7.24 of ISO/IEC 9899:1999 (E).
-
- It supports an encoding where all char codes are mapped
- to the *same* code values within a wchar_t or wint_t,
- so long as no other wchar_t codes are used by the program.
-
-*/
-
-#include <wchar.h>
-
-
-wchar_t *
-wmemset(s, c, n)
- register wchar_t *s;
- register wchar_t c;
- register size_t n;
- {
- wchar_t *orig_s = s;
-
- if ( s != NULL )
- for ( ; n > 0; --n )
- *s++ = c;
-
- return orig_s;
- }
-
diff --git a/winsup/mingw/mingwex/wtoll.c b/winsup/mingw/mingwex/wtoll.c
deleted file mode 100644
index 48f856245..000000000
--- a/winsup/mingw/mingwex/wtoll.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <stdlib.h>
-long long wtoll(const wchar_t * _w)
- { return _wtoi64 (_w); };
diff --git a/winsup/mingw/mkinstalldirs b/winsup/mingw/mkinstalldirs
deleted file mode 100755
index cc8783edc..000000000
--- a/winsup/mingw/mkinstalldirs
+++ /dev/null
@@ -1,36 +0,0 @@
-#! /bin/sh
-# mkinstalldirs --- make directory hierarchy
-# Author: Noah Friedman <friedman@prep.ai.mit.edu>
-# Created: 1993-05-16
-# Last modified: 1994-03-25
-# Public domain
-
-errstatus=0
-
-for file in ${1+"$@"} ; do
- set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
- shift
-
- pathcomp=
- for d in ${1+"$@"} ; do
- pathcomp="$pathcomp$d"
- case "$pathcomp" in
- -* ) pathcomp=./$pathcomp ;;
- esac
-
- if test ! -d "$pathcomp"; then
- echo "mkdir $pathcomp" 1>&2
- mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$?
- fi
-
- if test ! -d "$pathcomp"; then
- errstatus=$lasterr
- fi
-
- pathcomp="$pathcomp/"
- done
-done
-
-exit $errstatus
-
-# mkinstalldirs ends here
diff --git a/winsup/mingw/moldname-crtdll.def b/winsup/mingw/moldname-crtdll.def
deleted file mode 100644
index aded521e0..000000000
--- a/winsup/mingw/moldname-crtdll.def
+++ /dev/null
@@ -1,143 +0,0 @@
-;
-; moldname-crtdll.def
-;
-; Exports from the runtime except that these exports are actually preceeded
-; by a underscore in the actual DLL. These correspond to functions which
-; are non-ANSI and were prefixed with an underscore to avoid name space
-; clutter. However many, in fact most programs still use a few of these
-; functions without the underscore. This .def file is specially processed
-; to make those non-underscored name function calls call the equivalent
-; underscored functions.
-;
-; Contributors:
-; Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
-; Maintained by Mumit Khan <khan@xraylith.wisc.edu>
-;
-; THIS SOFTWARE IS NOT COPYRIGHTED
-;
-; This source code is offered for use in the public domain. You may
-; use, modify or distribute it freely.
-;
-; This code is distributed in the hope that it will be useful but
-; WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
-; DISCLAMED. This includes but is not limited to warrenties of
-; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-;
-EXPORTS
-access
-beep
-cabs
-chdir
-chmod
-chsize
-close
-creat
-cwait
-
-
-
-dup
-dup2
-ecvt
-eof
-execl
-execle
-execlp
-execlpe
-execv
-execve
-execvp
-execvpe
-fcvt
-fdopen
-fgetchar
-fgetwchar
-filelength
-fileno
-; Alias fpreset is set in CRT_fp10,c and CRT_fp8.c.
-; fpreset
-fputchar
-fputwchar
-fstat
-ftime
-gcvt
-getch
-getche
-getcwd
-getpid
-getw
-heapwalk
-hypot
-isatty
-itoa
-j0
-j1
-jn
-kbhit
-lseek
-ltoa
-memccpy
-memicmp
-mkdir
-mktemp
-open
-pclose
-popen
-putch
-putenv
-putw
-read
-rmdir
-searchenv
-seterrormode
-setmode
-sleep
-sopen
-spawnl
-spawnle
-spawnlp
-spawnlpe
-spawnv
-spawnve
-spawnvp
-spawnvpe
-stat
-strcmpi
-strdup
-stricmp
-stricoll
-strlwr
-strnicmp
-strnset
-strrev
-strset
-strupr
-swab
-tell
-tempnam
-
-
-
-; export tzname for both. See <time.h>
-tzname DATA
-tzset
-umask
-ungetch
-unlink
-utime
-wcsdup
-wcsicmp
-wcsicoll
-wcslwr
-wcsnicmp
-wcsnset
-wcsrev
-wcsset
-wcsupr
-
-
-
-write
-y0
-y1
-yn
diff --git a/winsup/mingw/moldname-msvcrt.def b/winsup/mingw/moldname-msvcrt.def
deleted file mode 100644
index a2090070b..000000000
--- a/winsup/mingw/moldname-msvcrt.def
+++ /dev/null
@@ -1,143 +0,0 @@
-;
-; moldname-msvcrt.def
-;
-; Exports from the runtime except that these exports are actually preceeded
-; by a underscore in the actual DLL. These correspond to functions which
-; are non-ANSI and were prefixed with an underscore to avoid name space
-; clutter. However many, in fact most programs still use a few of these
-; functions without the underscore. This .def file is specially processed
-; to make those non-underscored name function calls call the equivalent
-; underscored functions.
-;
-; Contributors:
-; Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
-; Maintained by Mumit Khan <khan@xraylith.wisc.edu>
-;
-; THIS SOFTWARE IS NOT COPYRIGHTED
-;
-; This source code is offered for use in the public domain. You may
-; use, modify or distribute it freely.
-;
-; This code is distributed in the hope that it will be useful but
-; WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
-; DISCLAMED. This includes but is not limited to warrenties of
-; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-;
-EXPORTS
-access
-beep
-cabs
-chdir
-chmod
-chsize
-close
-creat
-cwait
-
-daylight DATA
-
-dup
-dup2
-ecvt
-eof
-execl
-execle
-execlp
-execlpe
-execv
-execve
-execvp
-execvpe
-fcvt
-fdopen
-fgetchar
-fgetwchar
-filelength
-fileno
-; Alias fpreset is set in CRT_fp10,c and CRT_fp8.c.
-; fpreset
-fputchar
-fputwchar
-fstat
-ftime
-gcvt
-getch
-getche
-getcwd
-getpid
-getw
-heapwalk
-hypot
-isatty
-itoa
-j0
-j1
-jn
-kbhit
-lseek
-ltoa
-memccpy
-memicmp
-mkdir
-mktemp
-open
-pclose
-popen
-putch
-putenv
-putw
-read
-rmdir
-searchenv
-seterrormode
-setmode
-sleep
-sopen
-spawnl
-spawnle
-spawnlp
-spawnlpe
-spawnv
-spawnve
-spawnvp
-spawnvpe
-stat
-strcmpi
-strdup
-stricmp
-stricoll
-strlwr
-strnicmp
-strnset
-strrev
-strset
-strupr
-swab
-tell
-tempnam
-
-timezone DATA
-
-; export tzname for both. See <time.h>
-tzname DATA
-tzset
-umask
-ungetch
-unlink
-utime
-wcsdup
-wcsicmp
-wcsicoll
-wcslwr
-wcsnicmp
-wcsnset
-wcsrev
-wcsset
-wcsupr
-
-wpopen
-
-write
-y0
-y1
-yn
diff --git a/winsup/mingw/moldname.def b/winsup/mingw/moldname.def
deleted file mode 100644
index 369439b5c..000000000
--- a/winsup/mingw/moldname.def
+++ /dev/null
@@ -1,137 +0,0 @@
-;
-; moldname.def
-;
-; Exports from the runtime except that these exports are actually preceeded
-; by a underscore in the actual DLL. These correspond to functions which
-; are non-ANSI and were prefixed with an underscore to avoid name space
-; clutter. However many, in fact most programs still use a few of these
-; functions without the underscore. This .def file is specially processed
-; to make those non-underscored name function calls call the equivalent
-; underscored functions.
-;
-; NOTE: All the names currently included are available from both msvcrt and
-; crtdll. This may change in the future and require a new .def to be
-; created.
-;
-; Contributors:
-; Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
-;
-; THIS SOFTWARE IS NOT COPYRIGHTED
-;
-; This source code is offered for use in the public domain. You may
-; use, modify or distribute it freely.
-;
-; This code is distributed in the hope that it will be useful but
-; WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
-; DISCLAMED. This includes but is not limited to warrenties of
-; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-;
-; $Revision$
-; $Author$
-; $Date$
-;
-EXPORTS
-access
-beep
-cabs
-chdir
-chmod
-chsize
-close
-creat
-cwait
-dup
-dup2
-ecvt
-eof
-execl
-execle
-execlp
-execlpe
-execv
-execve
-execvp
-execvpe
-fcvt
-fdopen
-fgetchar
-fgetwchar
-filelength
-fileno
-fputchar
-fputwchar
-fstat
-ftime
-gcvt
-getch
-getche
-getcwd
-getpid
-getw
-heapwalk
-hypot
-isatty
-itoa
-j0
-j1
-jn
-kbhit
-lseek
-ltoa
-memccpy
-memicmp
-mkdir
-mktemp
-open
-pclose
-popen
-putch
-putenv
-putw
-read
-rmdir
-searchenv
-seterrormode
-setmode
-sleep
-sopen
-spawnl
-spawnle
-spawnlp
-spawnlpe
-spawnv
-spawnve
-spawnvp
-spawnvpe
-stat
-strcmpi
-strdup
-stricmp
-stricoll
-strlwr
-strnicmp
-strnset
-strrev
-strset
-strupr
-swab
-tell
-tempnam
-tzset
-umask
-ungetch
-unlink
-utime
-wcsdup
-wcsicmp
-wcsicoll
-wcslwr
-wcsnicmp
-wcsnset
-wcsrev
-wcsset
-wcsupr
-write
-y0
-y1
-yn
diff --git a/winsup/mingw/moldname.def.in b/winsup/mingw/moldname.def.in
deleted file mode 100644
index 1c88b0a56..000000000
--- a/winsup/mingw/moldname.def.in
+++ /dev/null
@@ -1,143 +0,0 @@
-;
-; __FILENAME__
-;
-; Exports from the runtime except that these exports are actually preceeded
-; by a underscore in the actual DLL. These correspond to functions which
-; are non-ANSI and were prefixed with an underscore to avoid name space
-; clutter. However many, in fact most programs still use a few of these
-; functions without the underscore. This .def file is specially processed
-; to make those non-underscored name function calls call the equivalent
-; underscored functions.
-;
-; Contributors:
-; Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
-; Maintained by Mumit Khan <khan@xraylith.wisc.edu>
-;
-; THIS SOFTWARE IS NOT COPYRIGHTED
-;
-; This source code is offered for use in the public domain. You may
-; use, modify or distribute it freely.
-;
-; This code is distributed in the hope that it will be useful but
-; WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
-; DISCLAMED. This includes but is not limited to warrenties of
-; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-;
-EXPORTS
-access
-beep
-cabs
-chdir
-chmod
-chsize
-close
-creat
-cwait
-#if !(__CRTDLL__)
-daylight DATA
-#endif
-dup
-dup2
-ecvt
-eof
-execl
-execle
-execlp
-execlpe
-execv
-execve
-execvp
-execvpe
-fcvt
-fdopen
-fgetchar
-fgetwchar
-filelength
-fileno
-; Alias fpreset is set in CRT_fp10,c and CRT_fp8.c.
-; fpreset
-fputchar
-fputwchar
-fstat
-ftime
-gcvt
-getch
-getche
-getcwd
-getpid
-getw
-heapwalk
-hypot
-isatty
-itoa
-j0
-j1
-jn
-kbhit
-lseek
-ltoa
-memccpy
-memicmp
-mkdir
-mktemp
-open
-pclose
-popen
-putch
-putenv
-putw
-read
-rmdir
-searchenv
-seterrormode
-setmode
-sleep
-sopen
-spawnl
-spawnle
-spawnlp
-spawnlpe
-spawnv
-spawnve
-spawnvp
-spawnvpe
-stat
-strcmpi
-strdup
-stricmp
-stricoll
-strlwr
-strnicmp
-strnset
-strrev
-strset
-strupr
-swab
-tell
-tempnam
-#if !(__CRTDLL__)
-timezone DATA
-#endif
-; export tzname for both. See <time.h>
-tzname DATA
-tzset
-umask
-ungetch
-unlink
-utime
-wcsdup
-wcsicmp
-wcsicoll
-wcslwr
-wcsnicmp
-wcsnset
-wcsrev
-wcsset
-wcsupr
-#if !(__CRTDLL__)
-wpopen
-#endif
-write
-y0
-y1
-yn
diff --git a/winsup/mingw/msvcrt.def b/winsup/mingw/msvcrt.def
deleted file mode 100644
index 0b85e9e1c..000000000
--- a/winsup/mingw/msvcrt.def
+++ /dev/null
@@ -1,737 +0,0 @@
-;
-; msvcrt.def
-;
-; Exports from msvcrt.dll. Msvcrt.dll appears to be distributed with
-; Internet Explorer 4.0, and may be more common in the future, but
-; right now it seems like a risky choice. There are differences, although
-; they seem to be minor overall, between the exports from msvcrt and msvcrt20.
-; However, for most purposes the two sets are interchangable.
-;
-; NOTE: All exports, except for what appeared to be C++ mangled names,
-; are included. Not all functions have prototypes in the headers
-; (and some aren't functions at all).
-;
-; Contributors:
-; Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
-;
-; THIS SOFTWARE IS NOT COPYRIGHTED
-;
-; This source code is offered for use in the public domain. You may
-; use, modify or distribute it freely.
-;
-; This code is distributed in the hope that it will be useful but
-; WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
-; DISCLAMED. This includes but is not limited to warrenties of
-; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-;
-; $Revision$
-; $Author$
-; $Date$
-;
-EXPORTS
-_CIacos
-_CIasin
-_CIatan
-_CIatan2
-_CIcos
-_CIcosh
-_CIexp
-_CIfmod
-_CIlog
-_CIlog10
-_CIpow
-_CIsin
-_CIsinh
-_CIsqrt
-_CItan
-_CItanh
-_CxxThrowException
-_EH_prolog
-_Getdays
-_Getmonths
-_Gettnames
-_HUGE DATA
-_Strftime
-_XcptFilter
-__CxxFrameHandler
-__CxxLongjmpUnwind
-__RTCastToVoid
-__RTDynamicCast
-__RTtypeid
-__STRINGTOLD
-__argc DATA
-__argv DATA
-__badioinfo
-__crtCompareStringA
-__crtGetLocaleInfoW
-__crtLCMapStringA
-__dllonexit
-__doserrno
-__fpecode
-__getmainargs
-__initenv DATA
-__isascii
-__iscsym
-__iscsymf
-__lc_codepage
-__lc_handle
-__lconv_init
-__mb_cur_max DATA
-__p___argc
-__p___argv
-__p___initenv
-__p___mb_cur_max
-__p___wargv
-__p___winitenv
-__p__acmdln
-__p__amblksiz
-__p__commode
-__p__daylight
-__p__dstbias
-__p__environ
-__p__fileinfo
-__p__fmode
-__p__iob
-__p__mbctype
-__p__osver
-__p__pctype
-__p__pgmptr
-__p__pwctype
-__p__timezone
-__p__tzname
-__p__wcmdln
-__p__wenviron
-__p__winmajor
-__p__winminor
-__p__winver
-__p__wpgmptr
-__pioinfo
-__pxcptinfoptrs
-__set_app_type
-__setlc_active
-__setusermatherr
-__threadhandle
-__threadid
-__toascii
-__unDName
-__unguarded_readlc_active
-__wargv DATA
-__wgetmainargs
-__winitenv DATA
-_abnormal_termination
-_access
-_acmdln DATA
-_adj_fdiv_m16i
-_adj_fdiv_m32
-_adj_fdiv_m32i
-_adj_fdiv_m64
-_adj_fdiv_r
-_adj_fdivr_m16i
-_adj_fdivr_m32
-_adj_fdivr_m32i
-_adj_fdivr_m64
-_adj_fpatan
-_adj_fprem
-_adj_fprem1
-_adj_fptan
-_adjust_fdiv DATA
-_aexit_rtn DATA
-_amsg_exit
-_assert
-_atodbl
-_atoi64
-_atoldbl
-_beep
-_beginthread
-_beginthreadex
-_c_exit
-_cabs
-_callnewh
-_cexit
-_cgets
-_chdir
-_chdrive
-_chgsign
-_chmod
-_chsize
-_clearfp
-_close
-_commit
-_commode DATA
-_control87
-_controlfp
-_copysign
-_cprintf
-_cputs
-_creat
-_cscanf
-_ctype DATA
-_cwait
-_daylight DATA
-_dstbias
-_dup
-_dup2
-_ecvt
-_endthread
-_endthreadex
-_environ DATA
-_eof
-_errno
-_except_handler2
-_except_handler3
-_execl
-_execle
-_execlp
-_execlpe
-_execv
-_execve
-_execvp
-_execvpe
-_exit
-_expand
-_fcloseall
-_fcvt
-_fdopen
-_fgetchar
-_fgetwchar
-_filbuf
-_fileinfo DATA
-_filelength
-_filelengthi64
-_fileno
-_findclose
-_findfirst
-_findfirsti64
-_findnext
-_findnexti64
-_finite
-_flsbuf
-_flushall
-_fmode DATA
-_fpclass
-_fpieee_flt
-_fpreset DATA
-_fputchar
-_fputwchar
-_fsopen
-_fstat
-_fstati64
-_ftime
-_ftol
-_fullpath
-_futime
-_gcvt
-_get_osfhandle
-_get_sbh_threshold
-_getch
-_getche
-_getcwd
-_getdcwd
-_getdiskfree
-_getdllprocaddr
-_getdrive
-_getdrives
-_getmaxstdio
-_getmbcp
-_getpid
-_getsystime
-_getw
-_getws
-_global_unwind2
-_heapadd
-_heapchk
-_heapmin
-_heapset
-_heapused
-_heapwalk
-_hypot
-_i64toa
-_i64tow
-_initterm
-_inp
-_inpd
-_inpw
-_iob DATA
-_isatty
-_isctype
-_ismbbalnum
-_ismbbalpha
-_ismbbgraph
-_ismbbkalnum
-_ismbbkana
-_ismbbkprint
-_ismbbkpunct
-_ismbblead
-_ismbbprint
-_ismbbpunct
-_ismbbtrail
-_ismbcalnum
-_ismbcalpha
-_ismbcdigit
-_ismbcgraph
-_ismbchira
-_ismbckata
-_ismbcl0
-_ismbcl1
-_ismbcl2
-_ismbclegal
-_ismbclower
-_ismbcprint
-_ismbcpunct
-_ismbcspace
-_ismbcsymbol
-_ismbcupper
-_ismbslead
-_ismbstrail
-_isnan
-_itoa
-_itow
-_j0
-_j1
-_jn
-_kbhit
-_lfind
-_loaddll
-_local_unwind2
-_lock
-_locking
-_logb
-_longjmpex
-_lrotl
-_lrotr
-_lsearch
-_lseek
-_lseeki64
-_ltoa
-_ltow
-_makepath
-_mbbtombc
-_mbbtype
-_mbccpy
-_mbcjistojms
-_mbcjmstojis
-_mbclen
-_mbctohira
-_mbctokata
-_mbctolower
-_mbctombb
-_mbctoupper
-_mbctype DATA
-_mbsbtype
-_mbscat
-_mbschr
-_mbscmp
-_mbscoll
-_mbscpy
-_mbscspn
-_mbsdec
-_mbsdup
-_mbsicmp
-_mbsicoll
-_mbsinc
-_mbslen
-_mbslwr
-_mbsnbcat
-_mbsnbcmp
-_mbsnbcnt
-_mbsnbcoll
-_mbsnbcpy
-_mbsnbicmp
-_mbsnbicoll
-_mbsnbset
-_mbsncat
-_mbsnccnt
-_mbsncmp
-_mbsncoll
-_mbsncpy
-_mbsnextc
-_mbsnicmp
-_mbsnicoll
-_mbsninc
-_mbsnset
-_mbspbrk
-_mbsrchr
-_mbsrev
-_mbsset
-_mbsspn
-_mbsspnp
-_mbsstr
-_mbstok
-_mbstrlen
-_mbsupr
-_memccpy
-_memicmp
-_mkdir
-_mktemp
-_msize
-_nextafter
-_onexit DATA
-_open
-_open_osfhandle
-_osver DATA
-_outp
-_outpd
-_outpw
-_pclose
-_pctype DATA
-_pgmptr DATA
-_pipe
-_popen
-_purecall
-_putch
-_putenv
-_putw
-_putws
-_pwctype DATA
-_read
-_rmdir
-_rmtmp
-_rotl
-_rotr
-_safe_fdiv
-_safe_fdivr
-_safe_fprem
-_safe_fprem1
-_scalb
-_searchenv
-_seh_longjmp_unwind
-_set_error_mode
-_set_sbh_threshold
-_seterrormode
-_setjmp
-_setjmp3
-_setmaxstdio
-_setmbcp
-_setmode
-_setsystime
-_sleep
-_snprintf
-_snwprintf
-_sopen
-_spawnl
-_spawnle
-_spawnlp
-_spawnlpe
-_spawnv
-_spawnve
-_spawnvp
-_spawnvpe
-_splitpath
-_stat
-_stati64
-_statusfp
-_strcmpi
-_strdate
-_strdup
-_strerror
-_stricmp
-_stricoll
-_strlwr
-_strncoll
-_strnicmp
-_strnicoll
-_strnset
-_strrev
-_strset
-_strtime
-_strupr
-_swab
-_sys_errlist DATA
-_sys_nerr DATA
-_tell
-_telli64
-_tempnam
-_timezone DATA
-_tolower
-_toupper
-_tzname DATA
-_tzset
-_ui64toa
-_ui64tow
-_ultoa
-_ultow
-_umask
-_ungetch
-_unlink
-_unloaddll
-_unlock
-_utime
-_vsnprintf
-_vsnwprintf
-_waccess
-_wasctime
-_wchdir
-_wchmod
-_wcmdln DATA
-_wcreat
-_wcsdup
-_wcsicmp
-_wcsicoll
-_wcslwr
-_wcsncoll
-_wcsnicmp
-_wcsnicoll
-_wcsnset
-_wcsrev
-_wcsset
-_wcsupr
-_wctime
-_wenviron DATA
-_wexecl
-_wexecle
-_wexeclp
-_wexeclpe
-_wexecv
-_wexecve
-_wexecvp
-_wexecvpe
-_wfdopen
-_wfindfirst
-_wfindfirsti64
-_wfindnext
-_wfindnexti64
-_wfopen
-_wfreopen
-_wfsopen
-_wfullpath
-_wgetcwd
-_wgetdcwd
-_wgetenv
-_winmajor DATA
-_winminor DATA
-_winver DATA
-_wmakepath
-_wmkdir
-_wmktemp
-_wopen
-_wperror
-_wpgmptr DATA
-_wpopen
-_wputenv
-_wremove
-_wrename
-_write
-_wrmdir
-_wsearchenv
-_wsetlocale
-_wsopen
-_wspawnl
-_wspawnle
-_wspawnlp
-_wspawnlpe
-_wspawnv
-_wspawnve
-_wspawnvp
-_wspawnvpe
-_wsplitpath
-_wstat
-_wstati64
-_wstrdate
-_wstrtime
-_wsystem
-_wtempnam
-_wtmpnam
-_wtoi
-_wtoi64
-_wtol
-_wunlink
-_wutime
-_y0
-_y1
-_yn
-abort
-abs
-acos
-asctime
-asin
-atan
-atan2
-atexit DATA
-atof
-atoi
-atol
-bsearch
-calloc
-ceil
-clearerr
-clock
-cos
-cosh
-ctime
-difftime
-div
-exit
-exp
-fabs
-fclose
-feof
-ferror
-fflush
-fgetc
-fgetpos
-fgets
-fgetwc
-fgetws
-floor
-fmod
-fopen
-fprintf
-fputc
-fputs
-fputwc
-fputws
-fread
-free
-freopen
-frexp
-fscanf
-fseek
-fsetpos
-ftell
-fwprintf
-fwrite
-fwscanf
-getc
-getchar
-getenv
-gets
-getwc
-getwchar
-gmtime
-is_wctype
-isalnum
-isalpha
-iscntrl
-isdigit
-isgraph
-isleadbyte
-islower
-isprint
-ispunct
-isspace
-isupper
-iswalnum
-iswalpha
-iswascii
-iswcntrl
-iswctype
-iswdigit
-iswgraph
-iswlower
-iswprint
-iswpunct
-iswspace
-iswupper
-iswxdigit
-isxdigit
-labs
-ldexp
-ldiv
-localeconv
-localtime
-log
-log10
-longjmp
-malloc
-mblen
-mbstowcs
-mbtowc
-memchr
-memcmp
-memcpy
-memmove
-memset
-mktime
-modf
-perror
-pow
-printf
-putc
-putchar
-puts
-putwc
-putwchar
-qsort
-raise
-rand
-realloc
-remove
-rename
-rewind
-scanf
-setbuf
-setlocale
-setvbuf
-signal
-sin
-sinh
-sprintf
-sqrt
-srand
-sscanf
-strcat
-strchr
-strcmp
-strcoll
-strcpy
-strcspn
-strerror
-strftime
-strlen
-strncat
-strncmp
-strncpy
-strpbrk
-strrchr
-strspn
-strstr
-strtod
-strtok
-strtol
-strtoul
-strxfrm
-swprintf
-swscanf
-system
-tan
-tanh
-time
-tmpfile
-tmpnam
-tolower
-toupper
-towlower
-towupper
-ungetc
-ungetwc
-vfprintf
-vfwprintf
-vprintf
-vsprintf
-vswprintf
-vwprintf
-wcscat
-wcschr
-wcscmp
-wcscoll
-wcscpy
-wcscspn
-wcsftime
-wcslen
-wcsncat
-wcsncmp
-wcsncpy
-wcspbrk
-wcsrchr
-wcsspn
-wcsstr
-wcstod
-wcstok
-wcstol
-wcstombs
-wcstoul
-wcsxfrm
-wctomb
-wprintf
-wscanf
-
diff --git a/winsup/mingw/msvcrt20.def b/winsup/mingw/msvcrt20.def
deleted file mode 100644
index 9ceb0750e..000000000
--- a/winsup/mingw/msvcrt20.def
+++ /dev/null
@@ -1,719 +0,0 @@
-;
-; msvcrt20.def
-;
-; Exports from msvcrt20.dll. I am hoping that msvcrt20.dll will be reasonably
-; common on user systems (if not ubiquitous) so that, effectively, it can
-; be considered part of the OS. Apparently it was included with the Windows 95
-; distribution, so it should be present there at least.
-;
-; NOTE: All exports, except for what appeared to be C++ mangled names,
-; are included. Not all functions have prototypes in the headers
-; (and some aren't functions at all).
-;
-; Contributors:
-; Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
-;
-; THIS SOFTWARE IS NOT COPYRIGHTED
-;
-; This source code is offered for use in the public domain. You may
-; use, modify or distribute it freely.
-;
-; This code is distributed in the hope that it will be useful but
-; WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
-; DISCLAMED. This includes but is not limited to warrenties of
-; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-;
-; $Revision$
-; $Author$
-; $Date$
-;
-EXPORTS
-_CIacos
-_CIasin
-_CIatan
-_CIatan2
-_CIcos
-_CIcosh
-_CIexp
-_CIfmod
-_CIlog
-_CIlog10
-_CIpow
-_CIsin
-_CIsinh
-_CIsqrt
-_CItan
-_CItanh
-_CxxThrowException
-_HUGE
-_XcptFilter
-__CxxFrameHandler
-__CxxLongjmpUnwind
-__STRINGTOLD
-__argc
-__argv
-__dllonexit
-__doserrno
-__fpecode
-__getmainargs
-__initenv
-__isascii
-__iscsym
-__iscsymf
-__lconv_init
-__mb_cur_max
-__p___argc
-__p___argv
-__p___initenv
-__p___mb_cur_max
-__p___wargv
-__p___winitenv
-__p__acmdln
-__p__amblksiz
-__p__commode
-__p__daylight
-__p__environ
-__p__fmode
-__p__iob
-__p__mbctype
-__p__osver
-__p__pctype
-__p__pgmptr
-__p__pwctype
-__p__timezone
-__p__tzname
-__p__wcmdln
-__p__wenviron
-__p__winmajor
-__p__winminor
-__p__winver
-__p__wpgmptr
-__pxcptinfoptrs
-__threadhandle
-__threadid
-__toascii
-__wargv
-__wgetmainargs
-__winitenv
-_abnormal_termination
-_access
-_acmdln
-_adj_fdiv_m16i
-_adj_fdiv_m32
-_adj_fdiv_m32i
-_adj_fdiv_m64
-_adj_fdiv_r
-_adj_fdivr_m16i
-_adj_fdivr_m32
-_adj_fdivr_m32i
-_adj_fdivr_m64
-_adj_fpatan
-_adj_fprem
-_adj_fprem1
-_adj_fptan
-_adjust_fdiv
-_aexit_rtn
-_amsg_exit
-_assert
-_atodbl
-_atoldbl
-_beep
-_beginthread
-_beginthreadex
-_c_exit
-_cabs
-_cexit
-_cgets
-_chdir
-_chdrive
-_chgsign
-_chmod
-_chsize
-_clearfp
-_close
-_commit
-_commode
-_control87
-_controlfp
-_copysign
-_cprintf
-_cputs
-_creat
-_cscanf
-_ctype
-_cwait
-_daylight
-_dup
-_dup2
-_ecvt
-_endthread
-_endthreadex
-_environ
-_eof
-_errno
-_except_handler2
-_except_handler3
-_execl
-_execle
-_execlp
-_execlpe
-_execv
-_execve
-_execvp
-_execvpe
-_exit
-_expand
-_fcloseall
-_fcvt
-_fdopen
-_fgetchar
-_fgetwchar
-_filbuf
-_fileinfo
-_filelength
-_fileno
-_findclose
-_findfirst
-_findnext
-_finite
-_flsbuf
-_flushall
-_fmode
-_fpclass
-_fpieee_flt
-_fpreset DATA
-_fputchar
-_fputwchar
-_fsopen
-_fstat
-_ftime
-_ftol
-_fullpath
-_futime
-_gcvt
-_get_osfhandle
-_getch
-_getche
-_getcwd
-_getdcwd
-_getdiskfree
-_getdllprocaddr
-_getdrive
-_getdrives
-_getmbcp
-_getpid
-_getsystime
-_getw
-_getws
-_global_unwind2
-_heapadd
-_heapchk
-_heapmin
-_heapset
-_heapused
-_heapwalk
-_hypot
-_initterm
-_iob
-_isatty
-_isctype
-_ismbbalnum
-_ismbbalpha
-_ismbbgraph
-_ismbbkalnum
-_ismbbkana
-_ismbbkprint
-_ismbbkpunct
-_ismbblead
-_ismbbprint
-_ismbbpunct
-_ismbbtrail
-_ismbcalnum
-_ismbcalpha
-_ismbcdigit
-_ismbcgraph
-_ismbchira
-_ismbckata
-_ismbcl0
-_ismbcl1
-_ismbcl2
-_ismbclegal
-_ismbclower
-_ismbcprint
-_ismbcpunct
-_ismbcspace
-_ismbcsymbol
-_ismbcupper
-_ismbslead
-_ismbstrail
-_isnan
-_itoa
-_itow
-_j0
-_j1
-_jn
-_kbhit
-_lfind
-_loaddll
-_local_unwind2
-_locking
-_logb
-_longjmpex
-_lrotl
-_lrotr
-_lsearch
-_lseek
-_ltoa
-_ltow
-_makepath
-_matherr
-_mbbtombc
-_mbbtype
-_mbccpy
-_mbcjistojms
-_mbcjmstojis
-_mbclen
-_mbctohira
-_mbctokata
-_mbctolower
-_mbctombb
-_mbctoupper
-_mbctype
-_mbsbtype
-_mbscat
-_mbschr
-_mbscmp
-_mbscoll
-_mbscpy
-_mbscspn
-_mbsdec
-_mbsdup
-_mbsicmp
-_mbsicoll
-_mbsinc
-_mbslen
-_mbslwr
-_mbsnbcat
-_mbsnbcmp
-_mbsnbcnt
-_mbsnbcoll
-_mbsnbcpy
-_mbsnbicmp
-_mbsnbicoll
-_mbsnbset
-_mbsncat
-_mbsnccnt
-_mbsncmp
-_mbsncoll
-_mbsncpy
-_mbsnextc
-_mbsnicmp
-_mbsnicoll
-_mbsninc
-_mbsnset
-_mbspbrk
-_mbsrchr
-_mbsrev
-_mbsset
-_mbsspn
-_mbsspnp
-_mbsstr
-_mbstok
-_mbstrlen
-_mbsupr
-_memccpy
-_memicmp
-_mkdir
-_mktemp
-_msize
-_mtlock
-_mtunlock
-_nextafter
-_onexit DATA
-_open
-_open_osfhandle
-_osver
-_pclose
-_pctype
-_pgmptr
-_pipe
-_popen
-_purecall
-_putch
-_putenv
-_putw
-_putws
-_pwctype
-_read
-_rmdir
-_rmtmp
-_rotl
-_rotr
-_safe_fdiv
-_safe_fdivr
-_safe_fprem
-_safe_fprem1
-_scalb
-_searchenv
-__seh_longjmp_unwind@4
-_seterrormode
-_setjmp
-_setjmp3
-_setmbcp
-_setmode
-_setsystime
-_sleep
-_snprintf
-_snwprintf
-_sopen
-_spawnl
-_spawnle
-_spawnlp
-_spawnlpe
-_spawnv
-_spawnve
-_spawnvp
-_spawnvpe
-_splitpath
-_stat
-_statusfp
-_strcmpi
-_strdate
-_strdup
-_strerror
-_stricmp
-_stricoll
-_strlwr
-_strncoll
-_strnicmp
-_strnicoll
-_strnset
-_strrev
-_strset
-_strtime
-_strupr
-_swab
-_sys_errlist
-_sys_nerr
-_tccpy
-_tclen
-_tcschr
-_tcsclen
-_tcscmp
-_tcscspn
-_tcsdec
-_tcsicmp
-_tcsinc
-_tcslwr
-_tcsnbcnt
-_tcsncat
-_tcsnccat
-_tcsnccmp
-_tcsnccnt
-_tcsnccpy
-_tcsncicmp
-_tcsncmp
-_tcsncpy
-_tcsncset
-_tcsnextc
-_tcsnicmp
-_tcsninc
-_tcsnset
-_tcspbrk
-_tcsrchr
-_tcsrev
-_tcsset
-_tcsspn
-_tcsspnp
-_tcsstr
-_tcstok
-_tcsupr
-_tell
-_tempnam
-_timezone
-_tolower
-_toupper
-_tzname
-_tzset
-_ultoa
-_ultow
-_umask
-_ungetch
-_unlink
-_unloaddll
-_utime
-_vsnprintf
-_vsnwprintf
-_waccess
-_wasctime
-_wchdir
-_wchmod
-_wcmdln
-_wcreat
-_wcsdup
-_wcsicmp
-_wcsicoll
-_wcslwr
-_wcsncoll
-_wcsnicmp
-_wcsnicoll
-_wcsnset
-_wcsrev
-_wcsset
-_wcsupr
-_wctime
-_wenviron
-_wexecl
-_wexecle
-_wexeclp
-_wexeclpe
-_wexecv
-_wexecve
-_wexecvp
-_wexecvpe
-_wfdopen
-_wfindfirst
-_wfindnext
-_wfopen
-_wfreopen
-_wfsopen
-_wfullpath
-_wgetcwd
-_wgetdcwd
-_wgetenv
-_winmajor
-_winminor
-_winver
-_wmakepath
-_wmkdir
-_wmktemp
-_wopen
-_wperror
-_wpgmptr
-_wpopen
-_wputenv
-_wremove
-_wrename
-_write
-_wrmdir
-_wsearchenv
-_wsetlocale
-_wsopen
-_wspawnl
-_wspawnle
-_wspawnlp
-_wspawnlpe
-_wspawnv
-_wspawnve
-_wspawnvp
-_wspawnvpe
-_wsplitpath
-_wstat
-_wstrdate
-_wstrtime
-_wsystem
-_wtempnam
-_wtmpnam
-_wtoi
-_wtol
-_wunlink
-_wutime
-_y0
-_y1
-_yn
-abort
-abs
-acos
-asctime
-asin
-atan
-atan2
-atexit DATA
-atof
-atoi
-atol
-bsearch
-calloc
-ceil
-clearerr
-clock
-cos
-cosh
-ctime
-difftime
-div
-exit
-exp
-fabs
-fclose
-feof
-ferror
-fflush
-fgetc
-fgetpos
-fgets
-fgetwc
-fgetws
-floor
-fmod
-fopen
-fprintf
-fputc
-fputs
-fputwc
-fputws
-fread
-free
-freopen
-frexp
-fscanf
-fseek
-fsetpos
-ftell
-fwprintf
-fwrite
-fwscanf
-getc
-getchar
-getenv
-gets
-getwc
-getwchar
-gmtime
-is_wctype
-isalnum
-isalpha
-iscntrl
-isdigit
-isgraph
-isleadbyte
-islower
-isprint
-ispunct
-isspace
-isupper
-iswalnum
-iswalpha
-iswascii
-iswcntrl
-iswctype
-iswdigit
-iswgraph
-iswlower
-iswprint
-iswpunct
-iswspace
-iswupper
-iswxdigit
-isxdigit
-labs
-ldexp
-ldiv
-localeconv
-localtime
-log
-log10
-longjmp
-malloc
-mblen
-mbstowcs
-mbtowc
-memchr
-memcmp
-memcpy
-memmove
-memset
-mktime
-modf
-perror
-pow
-printf
-putc
-putchar
-puts
-putwc
-putwchar
-qsort
-raise
-rand
-realloc
-remove
-rename
-rewind
-scanf
-setbuf
-setlocale
-setvbuf
-signal
-sin
-sinh
-sprintf
-sqrt
-srand
-sscanf
-strcat
-strchr
-strcmp
-strcoll
-strcpy
-strcspn
-strerror
-strftime
-strlen
-strncat
-strncmp
-strncpy
-strpbrk
-strrchr
-strspn
-strstr
-strtod
-strtok
-strtol
-strtoul
-strxfrm
-swprintf
-swscanf
-system
-tan
-tanh
-time
-tmpfile
-tmpnam
-tolower
-toupper
-towlower
-towupper
-ungetc
-ungetwc
-vfprintf
-vfwprintf
-vprintf
-vsprintf
-vswprintf
-vwprintf
-wcscat
-wcschr
-wcscmp
-wcscoll
-wcscpy
-wcscspn
-wcsftime
-wcslen
-wcsncat
-wcsncmp
-wcsncpy
-wcspbrk
-wcsrchr
-wcsspn
-wcsstr
-wcstod
-wcstok
-wcstol
-wcstombs
-wcstoul
-wcsxfrm
-wctomb
-wprintf
-wscanf
-
diff --git a/winsup/mingw/msvcrt40.def b/winsup/mingw/msvcrt40.def
deleted file mode 100644
index e4b09f999..000000000
--- a/winsup/mingw/msvcrt40.def
+++ /dev/null
@@ -1,676 +0,0 @@
-EXPORTS
-$I10_OUTPUT
-_CIacos
-_CIasin
-_CIatan
-_CIatan2
-_CIcos
-_CIcosh
-_CIexp
-_CIfmod
-_CIlog
-_CIlog10
-_CIpow
-_CIsin
-_CIsinh
-_CIsqrt
-_CItan
-_CItanh
-_CxxThrowException
-_EH_prolog
-_HUGE
-_XcptFilter
-__CxxFrameHandler
-__CxxLongjmpUnwind
-__RTCastToVoid
-__RTDynamicCast
-__RTtypeid
-__STRINGTOLD
-__argc
-__argv
-__dllonexit
-__doserrno
-__fpecode
-__getmainargs
-__initenv
-__isascii
-__iscsym
-__iscsymf
-__lconv_init
-__mb_cur_max
-__p___argc
-__p___argv
-__p___initenv
-__p___mb_cur_max
-__p___wargv
-__p___winitenv
-__p__acmdln
-__p__amblksiz
-__p__commode
-__p__daylight
-__p__environ
-__p__fmode
-__p__iob
-__p__mbctype
-__p__osver
-__p__pctype
-__p__pgmptr
-__p__pwctype
-__p__timezone
-__p__tzname
-__p__wcmdln
-__p__wenviron
-__p__winmajor
-__p__winminor
-__p__winver
-__p__wpgmptr
-__pxcptinfoptrs
-__set_app_type
-__setusermatherr
-__threadhandle
-__threadid
-__toascii
-__unDName
-__wargv
-__wgetmainargs
-__winitenv
-_abnormal_termination
-_access
-_acmdln
-_adj_fdiv_m16i
-_adj_fdiv_m32
-_adj_fdiv_m32i
-_adj_fdiv_m64
-_adj_fdiv_r
-_adj_fdivr_m16i
-_adj_fdivr_m32
-_adj_fdivr_m32i
-_adj_fdivr_m64
-_adj_fpatan
-_adj_fprem
-_adj_fprem1
-_adj_fptan
-_adjust_fdiv
-_aexit_rtn
-_amsg_exit
-_assert
-_atodbl
-_atoldbl
-_beep
-_beginthread
-_beginthreadex
-_c_exit
-_cabs
-_cexit
-_cgets
-_chdir
-_chdrive
-_chgsign
-_chmod
-_chsize
-_clearfp
-_close
-_commit
-_commode
-_control87
-_controlfp
-_copysign
-_cprintf
-_cputs
-_creat
-_cscanf
-_ctype
-_cwait
-_daylight
-_dup
-_dup2
-_ecvt
-_endthread
-_endthreadex
-_environ
-_eof
-_errno
-_except_handler2
-_except_handler3
-_execl
-_execle
-_execlp
-_execlpe
-_execv
-_execve
-_execvp
-_execvpe
-_exit
-_expand
-_fcloseall
-_fcvt
-_fdopen
-_fgetchar
-_fgetwchar
-_filbuf
-_fileinfo
-_filelength
-_filelengthi64
-_fileno
-_findclose
-_findfirst
-_findfirsti64
-_findnext
-_findnexti64
-_finite
-_flsbuf
-_flushall
-_fmode
-_fpclass
-_fpieee_flt
-_fpreset DATA
-_fputchar
-_fputwchar
-_fsopen
-_fstat
-_fstati64
-_ftime
-_ftol
-_fullpath
-_futime
-_gcvt
-_get_osfhandle
-_getch
-_getche
-_getcwd
-_getdcwd
-_getdiskfree
-_getdllprocaddr
-_getdrive
-_getdrives
-_getmbcp
-_getpid
-_getsystime
-_getw
-_getws
-_global_unwind2
-_heapadd
-_heapchk
-_heapmin
-_heapset
-_heapused
-_heapwalk
-_hypot
-_initterm
-_iob
-_isatty
-_isctype
-_ismbbalnum
-_ismbbalpha
-_ismbbgraph
-_ismbbkalnum
-_ismbbkana
-_ismbbkprint
-_ismbbkpunct
-_ismbblead
-_ismbbprint
-_ismbbpunct
-_ismbbtrail
-_ismbcalnum
-_ismbcalpha
-_ismbcdigit
-_ismbcgraph
-_ismbchira
-_ismbckata
-_ismbcl0
-_ismbcl1
-_ismbcl2
-_ismbclegal
-_ismbclower
-_ismbcprint
-_ismbcpunct
-_ismbcspace
-_ismbcsymbol
-_ismbcupper
-_ismbslead
-_ismbstrail
-_isnan
-_itoa
-_itow
-_j0
-_j1
-_jn
-_kbhit
-_lfind
-_loaddll
-_local_unwind2
-_locking
-_logb
-_longjmpex
-_lrotl
-_lrotr
-_lsearch
-_lseek
-_lseeki64
-_ltoa
-_ltow
-_makepath
-_mbbtombc
-_mbbtype
-_mbccpy
-_mbcjistojms
-_mbcjmstojis
-_mbclen
-_mbctohira
-_mbctokata
-_mbctolower
-_mbctombb
-_mbctoupper
-_mbctype
-_mbsbtype
-_mbscat
-_mbschr
-_mbscmp
-_mbscoll
-_mbscpy
-_mbscspn
-_mbsdec
-_mbsdup
-_mbsicmp
-_mbsicoll
-_mbsinc
-_mbslen
-_mbslwr
-_mbsnbcat
-_mbsnbcmp
-_mbsnbcnt
-_mbsnbcoll
-_mbsnbcpy
-_mbsnbicmp
-_mbsnbicoll
-_mbsnbset
-_mbsncat
-_mbsnccnt
-_mbsncmp
-_mbsncoll
-_mbsncpy
-_mbsnextc
-_mbsnicmp
-_mbsnicoll
-_mbsninc
-_mbsnset
-_mbspbrk
-_mbsrchr
-_mbsrev
-_mbsset
-_mbsspn
-_mbsspnp
-_mbsstr
-_mbstok
-_mbstrlen
-_mbsupr
-_memccpy
-_memicmp
-_mkdir
-_mktemp
-_msize
-_mtlock
-_mtunlock
-_nextafter
-_onexit DATA
-_open
-_open_osfhandle
-_osver
-_pclose
-_pctype
-_pgmptr
-_pipe
-_popen
-_purecall
-_putch
-_putenv
-_putw
-_putws
-_pwctype
-_read
-_rmdir
-_rmtmp
-_rotl
-_rotr
-_safe_fdiv
-_safe_fdivr
-_safe_fprem
-_safe_fprem1
-_scalb
-_searchenv
-_seh_longjmp_unwind
-_set_error_mode
-_seterrormode
-_setjmp
-_setjmp3
-_setmaxstdio
-_setmbcp
-_setmode
-_setsystime
-_sleep
-_snprintf
-_snwprintf
-_sopen
-_spawnl
-_spawnle
-_spawnlp
-_spawnlpe
-_spawnv
-_spawnve
-_spawnvp
-_spawnvpe
-_splitpath
-_stat
-_stati64
-_statusfp
-_strcmpi
-_strdate
-_strdup
-_strerror
-_stricmp
-_stricoll
-_strlwr
-_strncoll
-_strnicmp
-_strnicoll
-_strnset
-_strrev
-_strset
-_strtime
-_strupr
-_swab
-_sys_errlist
-_sys_nerr
-_tell
-_telli64
-_tempnam
-_timezone
-_tolower
-_toupper
-_tzname
-_tzset
-_ultoa
-_ultow
-_umask
-_ungetch
-_unlink
-_unloaddll
-_utime
-_vsnprintf
-_vsnwprintf
-_waccess
-_wasctime
-_wchdir
-_wchmod
-_wcmdln
-_wcreat
-_wcsdup
-_wcsicmp
-_wcsicoll
-_wcslwr
-_wcsncoll
-_wcsnicmp
-_wcsnicoll
-_wcsnset
-_wcsrev
-_wcsset
-_wcsupr
-_wctime
-_wenviron
-_wexecl
-_wexecle
-_wexeclp
-_wexeclpe
-_wexecv
-_wexecve
-_wexecvp
-_wexecvpe
-_wfdopen
-_wfindfirst
-_wfindfirsti64
-_wfindnext
-_wfindnexti64
-_wfopen
-_wfreopen
-_wfsopen
-_wfullpath
-_wgetcwd
-_wgetdcwd
-_wgetenv
-_winmajor
-_winminor
-_winver
-_wmakepath
-_wmkdir
-_wmktemp
-_wopen
-_wperror
-_wpgmptr
-_wpopen
-_wputenv
-_wremove
-_wrename
-_write
-_wrmdir
-_wsearchenv
-_wsetlocale
-_wsopen
-_wspawnl
-_wspawnle
-_wspawnlp
-_wspawnlpe
-_wspawnv
-_wspawnve
-_wspawnvp
-_wspawnvpe
-_wsplitpath
-_wstat
-_wstati64
-_wstrdate
-_wstrtime
-_wsystem
-_wtempnam
-_wtmpnam
-_wtoi
-_wtol
-_wunlink
-_wutime
-_y0
-_y1
-_yn
-abort
-abs
-acos
-asctime
-asin
-atan
-atan2
-atexit DATA
-atof
-atoi
-atol
-bsearch
-calloc
-ceil
-clearerr
-clock
-cos
-cosh
-ctime
-difftime
-div
-exit
-exp
-fabs
-fclose
-feof
-ferror
-fflush
-fgetc
-fgetpos
-fgets
-fgetwc
-fgetws
-floor
-fmod
-fopen
-fprintf
-fputc
-fputs
-fputwc
-fputws
-fread
-free
-freopen
-frexp
-fscanf
-fseek
-fsetpos
-ftell
-fwprintf
-fwrite
-fwscanf
-getc
-getchar
-getenv
-gets
-getwc
-getwchar
-gmtime
-is_wctype
-isalnum
-isalpha
-iscntrl
-isdigit
-isgraph
-isleadbyte
-islower
-isprint
-ispunct
-isspace
-isupper
-iswalnum
-iswalpha
-iswascii
-iswcntrl
-iswctype
-iswdigit
-iswgraph
-iswlower
-iswprint
-iswpunct
-iswspace
-iswupper
-iswxdigit
-isxdigit
-labs
-ldexp
-ldiv
-localeconv
-localtime
-log
-log10
-longjmp
-malloc
-mblen
-mbstowcs
-mbtowc
-memchr
-memcmp
-memcpy
-memmove
-memset
-mktime
-modf
-perror
-pow
-printf
-putc
-putchar
-puts
-putwc
-putwchar
-qsort
-raise
-rand
-realloc
-remove
-rename
-rewind
-scanf
-setbuf
-setlocale
-setvbuf
-signal
-sin
-sinh
-sprintf
-sqrt
-srand
-sscanf
-strcat
-strchr
-strcmp
-strcoll
-strcpy
-strcspn
-strerror
-strftime
-strlen
-strncat
-strncmp
-strncpy
-strpbrk
-strrchr
-strspn
-strstr
-strtod
-strtok
-strtol
-strtoul
-strxfrm
-swprintf
-swscanf
-system
-tan
-tanh
-time
-tmpfile
-tmpnam
-tolower
-toupper
-towlower
-towupper
-ungetc
-ungetwc
-vfprintf
-vfwprintf
-vprintf
-vsprintf
-vswprintf
-vwprintf
-wcscat
-wcschr
-wcscmp
-wcscoll
-wcscpy
-wcscspn
-wcsftime
-wcslen
-wcsncat
-wcsncmp
-wcsncpy
-wcspbrk
-wcsrchr
-wcsspn
-wcsstr
-wcstod
-wcstok
-wcstol
-wcstombs
-wcstoul
-wcsxfrm
-wctomb
-wprintf
-wscanf
-
diff --git a/winsup/mingw/mthr.c b/winsup/mingw/mthr.c
deleted file mode 100644
index f28236432..000000000
--- a/winsup/mingw/mthr.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * mthr.c
- *
- * Implement Mingw thread-support DLL .
- *
- * This file is used iff the following conditions are met:
- * - gcc uses -mthreads option
- * - user code uses C++ exceptions
- *
- * The sole job of the Mingw thread support DLL (MingwThr) is to catch
- * all the dying threads and clean up the data allocated in the TLSs
- * for exception contexts during C++ EH. Posix threads have key dtors,
- * but win32 TLS keys do not, hence the magic. Without this, there's at
- * least `6 * sizeof (void*)' bytes leaks for each catch/throw in each
- * thread. The only public interface is __mingwthr_key_dtor().
- *
- * Created by Mumit Khan <khan@nanotech.wisc.edu>
- *
- */
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
-#include <stdlib.h>
-
-/* To protect the thread/key association data structure modifications. */
-CRITICAL_SECTION __mingwthr_cs;
-
-typedef struct __mingwthr_key __mingwthr_key_t;
-
-/* The list of threads active with key/dtor pairs. */
-struct __mingwthr_key {
- DWORD key;
- void (*dtor) (void *);
- __mingwthr_key_t *next;
-};
-
-
-static __mingwthr_key_t *key_dtor_list;
-
-/*
- * __mingwthr_key_add:
- *
- * Add key/dtor association for this thread. If the thread entry does not
- * exist, create a new one and add to the head of the threads list; add
- * the new assoc at the head of the keys list.
- *
- */
-
-static int
-___mingwthr_add_key_dtor ( DWORD key, void (*dtor) (void *))
-{
- __mingwthr_key_t *new_key;
-
- new_key = (__mingwthr_key_t *) calloc (1, sizeof (__mingwthr_key_t));
- if (new_key == NULL)
- return -1;
-
- new_key->key = key;
- new_key->dtor = dtor;
-
- EnterCriticalSection (&__mingwthr_cs);
-
- new_key->next = key_dtor_list;
- key_dtor_list = new_key;
-
- LeaveCriticalSection (&__mingwthr_cs);
-
-#ifdef DEBUG
- printf ("%s: allocating: (%ld, %x)\n",
- __FUNCTION__, key, dtor);
-#endif
-
- return 0;
-}
-
-static int
-___mingwthr_remove_key_dtor ( DWORD key )
-{
- __mingwthr_key_t *prev_key;
- __mingwthr_key_t *cur_key;
-
- EnterCriticalSection (&__mingwthr_cs);
-
- prev_key = NULL;
- cur_key = key_dtor_list;
-
- while( cur_key != NULL )
- {
- if( cur_key->key == key )
- {
-// take key/dtor out of list
- if( prev_key == NULL )
- {
- key_dtor_list = cur_key->next;
- }
- else
- {
- prev_key->next = cur_key->next;
- }
-
-#ifdef DEBUG
- printf ("%s: removing: (%ld)\n",
- __FUNCTION__, key );
-#endif
-
- free( cur_key );
- break;
- }
-
- prev_key = cur_key;
- cur_key = cur_key->next;
- }
-
- LeaveCriticalSection (&__mingwthr_cs);
-
- return 0;
-}
-
-/*
- * __mingwthr_run_key_dtors (void):
- *
- * Callback from DllMain when thread detaches to clean up the key
- * storage.
- *
- * Note that this does not delete the key itself, but just runs
- * the dtor if the current value are both non-NULL. Note that the
- * keys with NULL dtors are not added by __mingwthr_key_dtor, the
- * only public interface, so we don't need to check.
- *
- */
-
-void
-__mingwthr_run_key_dtors (void)
-{
- __mingwthr_key_t *keyp;
-
-#ifdef DEBUG
- printf ("%s: Entering Thread id %ld\n", __FUNCTION__, GetCurrentThreadId() );
-#endif
-
- EnterCriticalSection (&__mingwthr_cs);
-
- for (keyp = key_dtor_list; keyp; )
- {
- LPVOID value = TlsGetValue (keyp->key);
- if (GetLastError () == ERROR_SUCCESS)
- {
-#ifdef DEBUG
- printf (" (%ld, %x)\n", keyp->key, keyp->dtor);
-#endif
- if (value)
- (*keyp->dtor) (value);
- }
-#ifdef DEBUG
- else
- {
- printf (" TlsGetValue FAILED (%ld, %x)\n",
- keyp->key, keyp->dtor);
- }
-#endif
- keyp = keyp->next;
- }
-
- LeaveCriticalSection (&__mingwthr_cs);
-
-#ifdef DEBUG
- printf ("%s: Exiting Thread id %ld\n", __FUNCTION__, GetCurrentThreadId() );
-#endif
-}
-
-/*
- * __mingwthr_register_key_dtor (DWORD key, void (*dtor) (void *))
- *
- * Public interface called by C++ exception handling mechanism in
- * libgcc (cf: __gthread_key_create).
- *
- */
-
-__declspec(dllexport)
-int
-__mingwthr_key_dtor (DWORD key, void (*dtor) (void *))
-{
- if (dtor)
- {
- return ___mingwthr_add_key_dtor (key, dtor);
- }
-
- return 0;
-}
-
-__declspec(dllexport)
-int
-__mingwthr_remove_key_dtor (DWORD key )
-{
- return ___mingwthr_remove_key_dtor ( key );
-}
diff --git a/winsup/mingw/mthr_init.c b/winsup/mingw/mthr_init.c
deleted file mode 100644
index 5c8c8bbe8..000000000
--- a/winsup/mingw/mthr_init.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * mthr_init.c
- *
- * Do the thread-support DLL initialization.
- *
- * This file is used iff the following conditions are met:
- * - gcc uses -mthreads option
- * - user code uses C++ exceptions
- *
- * The sole job of the Mingw thread support DLL (MingwThr) is to catch
- * all the dying threads and clean up the data allocated in the TLSs
- * for exception contexts during C++ EH. Posix threads have key dtors,
- * but win32 TLS keys do not, hence the magic. Without this, there's at
- * least `24 * sizeof (void*)' bytes leaks for each catch/throw in each
- * thread.
- *
- * See mthr.c for all the magic.
- *
- * Created by Mumit Khan <khan@nanotech.wisc.edu>
- *
- */
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
-#include <stdio.h>
-
-BOOL APIENTRY DllMain (HANDLE hDllHandle, DWORD reason,
- LPVOID reserved /* Not used. */ );
-
-/*
- *----------------------------------------------------------------------
- *
- * DllMain --
- *
- * This routine is called by the Mingw32, Cygwin32 or VC++ C run
- * time library init code, or the Borland DllEntryPoint routine. It
- * is responsible for initializing various dynamically loaded
- * libraries.
- *
- * Results:
- * TRUE on sucess, FALSE on failure.
- *
- * Side effects:
- *
- *----------------------------------------------------------------------
- */
-BOOL APIENTRY
-DllMain (HANDLE hDllHandle /* Library instance handle. */,
- DWORD reason /* Reason this function is being called. */,
- LPVOID reserved /* Not used. */)
-{
-
- extern CRITICAL_SECTION __mingwthr_cs;
- extern void __mingwthr_run_key_dtors( void );
-
-#ifdef DEBUG
- printf ("%s: reason %d\n", __FUNCTION__, reason );
-#endif
-
- switch (reason)
- {
- case DLL_PROCESS_ATTACH:
- InitializeCriticalSection (&__mingwthr_cs);
- break;
-
- case DLL_PROCESS_DETACH:
- __mingwthr_run_key_dtors();
- DeleteCriticalSection (&__mingwthr_cs);
- break;
-
- case DLL_THREAD_ATTACH:
- break;
-
- case DLL_THREAD_DETACH:
- __mingwthr_run_key_dtors();
- break;
- }
- return TRUE;
-}
diff --git a/winsup/mingw/mthr_stub.c b/winsup/mingw/mthr_stub.c
deleted file mode 100644
index cb926c16c..000000000
--- a/winsup/mingw/mthr_stub.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * mthr_stub.c
- *
- * Implement Mingw thread-support stubs for single-threaded C++ apps.
- *
- * This file is used by if gcc is built with --enable-threads=win32 and
- * iff gcc does *NOT* use -mthreads option.
- *
- * The -mthreads implementation is in mthr.c.
- *
- * Created by Mumit Khan <khan@nanotech.wisc.edu>
- *
- */
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
-#include <assert.h>
-
-/*
- * __mingwthr_register_key_dtor (DWORD key, void (*dtor) (void *))
- *
- * Public interface called by C++ exception handling mechanism in
- * libgcc (cf: __gthread_key_create).
- *
- * THIS SHOULD NEVER BE CALLED!
- *
- */
-
-int
-__mingwthr_key_dtor (DWORD key, void (*dtor) (void *))
-{
- assert (0);
- /* NOTREACHED */
- return 0;
-}
-
-
-int
-__mingwthr_remove_key_dtor (DWORD key )
-{
- assert (0);
- /* NOTREACHED */
- return 0;
-}
diff --git a/winsup/mingw/profile/Makefile.in b/winsup/mingw/profile/Makefile.in
deleted file mode 100644
index c7f3a0c7f..000000000
--- a/winsup/mingw/profile/Makefile.in
+++ /dev/null
@@ -1,134 +0,0 @@
-#
-# mingw/profile/Makefile.in: This file is part of Mingw runtime.
-#
-# This makefile requires GNU make.
-
-VPATH = @srcdir@
-srcdir = @srcdir@
-objdir = .
-
-target_alias = @target_alias@
-prefix = @prefix@
-
-program_transform_name = @program_transform_name@
-exec_prefix = @exec_prefix@
-bindir = @bindir@
-libdir = @libdir@
-tooldir = $(exec_prefix)/$(target_alias)
-datadir = @datadir@
-infodir = @infodir@
-includedir = @includedir@
-
-SHELL = /bin/sh
-
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-mkinstalldirs = $(SHELL) $(srcdir)/../mkinstalldirs
-DISTFILES = Makefile.in configure configure.in gcrt0.c gmon.c gmon.h mcount.c \
-profil.c profil.h profile.h
-
-CC = @CC@
-# FIXME: Which is it, CC or CC_FOR_TARGET?
-CC_FOR_TARGET = $(CC)
-AS_FOR_TARGET = $(AS)
-CFLAGS = @CFLAGS@
-CXXFLAGS = @CXXFLAGS@
-
-# compiling with Cygwin?
-MNO_CYGWIN = @MNO_CYGWIN@
-
-# Either crtdll (CRT_ID 1) or msvcrt (CRT_ID 2).
-RUNTIME = @RUNTIME@
-CRT_ID = @CRT_ID@
-
-# Needed for threading dll.
-THREAD_DLL = @THREAD_DLL@
-THREAD_DLL_VERSION = 10
-THREAD_DLL_NAME = $(THREAD_DLL)$(THREAD_DLL_VERSION).dll
-
-INCLUDES = -I$(srcdir) -I$(srcdir)/../include \
- -I$(srcdir)/../../w32api/include \
- -nostdinc -nostdinc++ \
- -iwithprefixbefore include
-ALL_CFLAGS = $(CFLAGS) $(INCLUDES) $(MNO_CYGWIN)
-ALL_CXXFLAGS = $(CXXFLAGS) $(INCLUDES) $(MNO_CYGWIN)
-
-AS = @AS@
-AR = @AR@
-LD = @LD@
-AR_FLAGS = rcv
-RANLIB = @RANLIB@
-DLLTOOL = @DLLTOOL@
-DLLTOOLFLAGS =
-DLLTOOL_FOR_TARGET = $(DLLTOOL)
-DLLTOOL_FLAGS = --as $(AS_FOR_TARGET)
-
-LIBGMON_A = @LIBGMON_A@
-LIBGMON_OBJS = gmon.o mcount.o profil.o
-CRT0S = @CRT0S@
-ALL_CRT0S = gcrt0.o gcrt1.o gcrt2.o
-
-LIBS = $(LIBGMON_A)
-DLLS =
-
-all: $(LIBGMON_A)
-
-$(LIBGMON_A): $(LIBGMON_OBJS) $(CRT0S)
- $(AR) $(ARFLAGS) $@ $(LIBGMON_OBJS)
- $(RANLIB) $@
-
-# FIXME: These are really the same, but gcc specs want different names.
-# The only CRT dependency is atexit.
-gcrt0.o: gcrt0.c
- $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $?
-
-gcrt1.o: gcrt0.c
- $(CC) -U__MSVCRT__ -c -o $@ $(CPPFLAGS) $(CFLAGS) $?
-
-gcrt2.o: gcrt0.c
- $(CC) -D__MSVCRT__ -c -o $@ $(CPPFLAGS) $(CFLAGS) $?
-
-Makefile: Makefile.in config.status configure
- $(SHELL) config.status
-
-config.status: configure
- $(SHELL) config.status --recheck
-
-info:
-
-info-html:
-
-install-info: info
-
-install: all
- $(mkinstalldirs) $(inst_libdir)
- for i in $(LIBS); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
- done
- for i in $(CRT0S); do \
- $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
- done
- for sub in . ; do \
- $(mkinstalldirs) $(inst_includedir)/$$sub ; \
- for i in $(srcdir)/$$sub/*.h ; do \
- $(INSTALL_DATA) $$i $(inst_includedir)/$$sub/`basename $$i` ; \
- done ; \
- done
-
-clean:
- -rm -f $(LIBGMON_OBJS) $(ALL_CRT0S) $(LIBGMON_A)
-
-distclean:
- -rm -f *.o *.a *~ core a.out
- -rm -f config.cache config.status config.log
- -rm -f Makefile
-.c.o:
- $(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) $< -o $@
-
-dist:
- mkdir $(distdir)/profile
- chmod 755 $(distdir)/profile
- @for i in $(DISTFILES); do\
- cp -p $(srcdir)/$$i $(distdir)/profile/$$i ; \
- done
diff --git a/winsup/mingw/profile/configure b/winsup/mingw/profile/configure
deleted file mode 100755
index f9c64e084..000000000
--- a/winsup/mingw/profile/configure
+++ /dev/null
@@ -1,1031 +0,0 @@
-#! /bin/sh
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-
-# Defaults:
-ac_help=
-ac_default_prefix=/usr/local
-# Any additions from configure.in:
-
-# Initialize some variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
-exec_prefix=NONE
-host=NONE
-no_create=
-nonopt=NONE
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-target=NONE
-verbose=
-x_includes=NONE
-x_libraries=NONE
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
-ac_prev=
-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=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case "$ac_option" in
-
- -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 ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$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" ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir="$ac_optarg" ;;
-
- -disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_${ac_feature}='$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)
- # 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 << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --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
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host="$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" ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- 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)
- 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" ;;
-
- -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 ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
- exit 0 ;;
-
- -with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "with_${ac_package}='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=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" ;;
-
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
- ;;
-
- *)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
-
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
-do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
- esac
-done
-
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
-
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=gcrt0.c
-
-# 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 its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
- 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
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
- else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
- fi
-fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
-else
- echo "creating cache $cache_file"
- > $cache_file
-fi
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
-
-
-
-CC=${CC-cc}
-
-AS=${AS-as}
-
-AR=${AR-ar}
-
-LD=${LD-ld}
-
-RANLIB=${RANLIB-ranlib}
-
-DLLTOOL=${DLLTOOL-dlltool}
-
-DLLWRAP=${DLLWRAP-dllwrap}
-
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-
-# Do some error checking and defaulting for the host and target type.
-# The inputs are:
-# configure --host=HOST --target=TARGET --build=BUILD NONOPT
-#
-# The rules are:
-# 1. You are not allowed to specify --host, --target, and nonopt at the
-# same time.
-# 2. Host defaults to nonopt.
-# 3. If nonopt is not specified, then host defaults to the current host,
-# as determined by config.guess.
-# 4. Target and build default to nonopt.
-# 5. If nonopt is not specified, then target and build default to host.
-
-# The aliases save the names the user supplied, while $host etc.
-# will get canonicalized.
-case $host---$target---$nonopt in
-NONE---*---* | *---NONE---* | *---*---NONE) ;;
-*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
-esac
-
-
-# Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:587: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
- case $nonopt in
- NONE)
- if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
- else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
- fi ;;
- *) host_alias=$nonopt ;;
- esac ;;
-esac
-
-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
-
-echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:608: checking target system type" >&5
-
-target_alias=$target
-case "$target_alias" in
-NONE)
- case $nonopt in
- NONE) target_alias=$host_alias ;;
- *) target_alias=$nonopt ;;
- esac ;;
-esac
-
-target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
-target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$target" 1>&6
-
-echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:626: checking build system type" >&5
-
-build_alias=$build
-case "$build_alias" in
-NONE)
- case $nonopt in
- NONE) build_alias=$host_alias ;;
- *) build_alias=$nonopt ;;
- esac ;;
-esac
-
-build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
-build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$build" 1>&6
-
-test "$host_alias" != "$target_alias" &&
- test "$program_prefix$program_suffix$program_transform_name" = \
- NONENONEs,x,x, &&
- program_prefix=${target_alias}-
-
-
-LIBGMON_A=libgmon.a
-
-case "$target_os" in
-*mingw32crt*)
- CRT_ID=1
- MNO_CYGWIN=
- RUNTIME=crtdll
- CRT0S="gcrt1.o gcrt2.o"
- ;;
-*cygwin*)
- CRT_ID=2
- MNO_CYGWIN=-mno-cygwin
- RUNTIME=msvcrt
- CRT0S=gcrt0.o
- # Do not build libm.a when building under Cygwin winsup. Otherwise, it'll
- # overwrite Cygwin's one. Likewise for libgmon.a.
- ;;
-*)
- # Build it for MSVCRT by default.
- CRT_ID=2
- MNO_CYGWIN=
- RUNTIME=msvcrt
- CRT0S="gcrt1.o gcrt2.o"
- ;;
-esac
-
-
-
-
-
-
-
-# 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
-# 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"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:693: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/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
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
-
-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. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL="$ac_install_sh"
- fi
-fi
-echo "$ac_t""$INSTALL" 1>&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_PROGRAM}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-trap '' 1 2 15
-cat > confcache <<\EOF
-# 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. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# 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.
-(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
- if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
-fi
-
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
-s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
-s%\[%\\&%g
-s%\]%\\&%g
-s%\$%$$%g
-EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-rm -f conftest.defs
-
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
-
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
-# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
-# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
-
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
-do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
-done
-
-ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
-
-trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@CC@%$CC%g
-s%@AS@%$AS%g
-s%@AR@%$AR%g
-s%@LD@%$LD%g
-s%@RANLIB@%$RANLIB%g
-s%@DLLTOOL@%$DLLTOOL%g
-s%@DLLWRAP@%$DLLWRAP%g
-s%@host@%$host%g
-s%@host_alias@%$host_alias%g
-s%@host_cpu@%$host_cpu%g
-s%@host_vendor@%$host_vendor%g
-s%@host_os@%$host_os%g
-s%@target@%$target%g
-s%@target_alias@%$target_alias%g
-s%@target_cpu@%$target_cpu%g
-s%@target_vendor@%$target_vendor%g
-s%@target_os@%$target_os%g
-s%@build@%$build%g
-s%@build_alias@%$build_alias%g
-s%@build_cpu@%$build_cpu%g
-s%@build_vendor@%$build_vendor%g
-s%@build_os@%$build_os%g
-s%@CRT_ID@%$CRT_ID%g
-s%@RUNTIME@%$RUNTIME%g
-s%@MNO_CYGWIN@%$MNO_CYGWIN%g
-s%@LIBGMON_A@%$LIBGMON_A%g
-s%@CRT0S@%$CRT0S%g
-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
-s%@INSTALL_DATA@%$INSTALL_DATA%g
-
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
- else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
- fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
- else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
- fi
-done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
-fi
-EOF
-
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
- fi
-
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
-
- case "$ac_given_INSTALL" in
- [/$]*) INSTALL="$ac_given_INSTALL" ;;
- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
- esac
-
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
- esac
-
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-s%@INSTALL@%$INSTALL%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
-
diff --git a/winsup/mingw/profile/configure.in b/winsup/mingw/profile/configure.in
deleted file mode 100644
index e688a67c6..000000000
--- a/winsup/mingw/profile/configure.in
+++ /dev/null
@@ -1,72 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-
-dnl This file is part of Mingw runtime.
-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 This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-AC_PREREQ(2.13)
-AC_INIT(gcrt0.c)
-
-CC=${CC-cc}
-AC_SUBST(CC)
-AS=${AS-as}
-AC_SUBST(AS)
-AR=${AR-ar}
-AC_SUBST(AR)
-LD=${LD-ld}
-AC_SUBST(LD)
-RANLIB=${RANLIB-ranlib}
-AC_SUBST(RANLIB)
-DLLTOOL=${DLLTOOL-dlltool}
-AC_SUBST(DLLTOOL)
-DLLWRAP=${DLLWRAP-dllwrap}
-AC_SUBST(DLLWRAP)
-AC_CANONICAL_SYSTEM
-
-LIBGMON_A=libgmon.a
-
-case "$target_os" in
-*mingw32crt*)
- CRT_ID=1
- MNO_CYGWIN=
- RUNTIME=crtdll
- CRT0S="gcrt1.o gcrt2.o"
- ;;
-*cygwin*)
- CRT_ID=2
- MNO_CYGWIN=-mno-cygwin
- RUNTIME=msvcrt
- CRT0S=gcrt0.o
- # Do not build libm.a when building under Cygwin winsup. Otherwise, it'll
- # overwrite Cygwin's one. Likewise for libgmon.a.
- ;;
-*)
- # Build it for MSVCRT by default.
- CRT_ID=2
- MNO_CYGWIN=
- RUNTIME=msvcrt
- CRT0S="gcrt1.o gcrt2.o"
- ;;
-esac
-
-AC_SUBST(CRT_ID)
-AC_SUBST(RUNTIME)
-AC_SUBST(MNO_CYGWIN)
-AC_SUBST(LIBGMON_A)
-AC_SUBST(CRT0S)
-
-AC_PROG_INSTALL
-AC_OUTPUT(Makefile)
-
diff --git a/winsup/mingw/profile/gcrt0.c b/winsup/mingw/profile/gcrt0.c
deleted file mode 100644
index 20f3c7ced..000000000
--- a/winsup/mingw/profile/gcrt0.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* gcrt0.c
-
- Copyright 1998, 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 file is taken from Cygwin distribution. Please keep it in sync.
- * The differences should be within __MINGW32__ guard.
- */
-
-#include <sys/types.h>
-#include <stdlib.h>
-
-#ifdef __MINGW32__
-typedef unsigned char u_char;
-typedef unsigned short u_short;
-typedef unsigned int u_int;
-typedef unsigned long u_long;
-#endif
-
-extern u_char etext asm ("etext");
-extern u_char eprol asm ("__eprol");
-extern void _mcleanup (void);
-extern void monstartup (u_long, u_long);
-void _monstartup (void) __attribute__((__constructor__));
-
-/* startup initialization for -pg support */
-
-void
-_monstartup (void)
-{
- static int called;
-
- /* Guard against multiple calls that may happen if DLLs are linked
- with profile option set as well. Addede side benefit is that it
- makes profiling backward compatible (GCC used to emit a call to
- _monstartup when compiling main with profiling enabled). */
- if (called++)
- return;
-
- monstartup ((u_long) &eprol, (u_long) &etext);
- atexit (&_mcleanup);
-}
-
-asm (".text");
-asm ("__eprol:");
-
diff --git a/winsup/mingw/profile/gmon.c b/winsup/mingw/profile/gmon.c
deleted file mode 100644
index b68f31818..000000000
--- a/winsup/mingw/profile/gmon.c
+++ /dev/null
@@ -1,289 +0,0 @@
-/*-
- * Copyright (c) 1983, 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if !defined(lint) && defined(LIBC_SCCS)
-static char rcsid[] = "$OpenBSD: gmon.c,v 1.8 1997/07/23 21:11:27 kstailey Exp $";
-#endif
-
-/*
- * This file is taken from Cygwin distribution. Please keep it in sync.
- * The differences should be within __MINGW32__ guard.
- */
-
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#ifndef __MINGW32__
-#include <unistd.h>
-#include <sys/param.h>
-#endif
-#include <sys/types.h>
-#include <gmon.h>
-
-#include <profil.h>
-
-/* XXX needed? */
-//extern char *minbrk __asm ("minbrk");
-
-#ifdef __MINGW32__
-#define bzero(ptr,size) memset (ptr, 0, size);
-#endif
-
-struct gmonparam _gmonparam = { GMON_PROF_OFF };
-
-static int s_scale;
-/* see profil(2) where this is describe (incorrectly) */
-#define SCALE_1_TO_1 0x10000L
-
-#define ERR(s) write(2, s, sizeof(s))
-
-void moncontrol __P((int));
-
-static void *
-fake_sbrk(int size)
-{
- return malloc(size);
-}
-
-void
-monstartup(lowpc, highpc)
- u_long lowpc;
- u_long highpc;
-{
- register int o;
- char *cp;
- struct gmonparam *p = &_gmonparam;
-
- /*
- * round lowpc and highpc to multiples of the density we're using
- * so the rest of the scaling (here and in gprof) stays in ints.
- */
- p->lowpc = ROUNDDOWN(lowpc, HISTFRACTION * sizeof(HISTCOUNTER));
- p->highpc = ROUNDUP(highpc, HISTFRACTION * sizeof(HISTCOUNTER));
- p->textsize = p->highpc - p->lowpc;
- p->kcountsize = p->textsize / HISTFRACTION;
- p->hashfraction = HASHFRACTION;
- p->fromssize = p->textsize / p->hashfraction;
- p->tolimit = p->textsize * ARCDENSITY / 100;
- if (p->tolimit < MINARCS)
- p->tolimit = MINARCS;
- else if (p->tolimit > MAXARCS)
- p->tolimit = MAXARCS;
- p->tossize = p->tolimit * sizeof(struct tostruct);
-
- cp = fake_sbrk(p->kcountsize + p->fromssize + p->tossize);
- if (cp == (char *)-1) {
- ERR("monstartup: out of memory\n");
- return;
- }
-
- /* zero out cp as value will be added there */
- bzero(cp, p->kcountsize + p->fromssize + p->tossize);
-
- p->tos = (struct tostruct *)cp;
- cp += p->tossize;
- p->kcount = (u_short *)cp;
- cp += p->kcountsize;
- p->froms = (u_short *)cp;
-
- /* XXX minbrk needed? */
- //minbrk = fake_sbrk(0);
- p->tos[0].link = 0;
-
- o = p->highpc - p->lowpc;
- if (p->kcountsize < o) {
-#ifndef notdef
- s_scale = ((float)p->kcountsize / o ) * SCALE_1_TO_1;
-#else /* avoid floating point */
- int quot = o / p->kcountsize;
-
- if (quot >= 0x10000)
- s_scale = 1;
- else if (quot >= 0x100)
- s_scale = 0x10000 / quot;
- else if (o >= 0x800000)
- s_scale = 0x1000000 / (o / (p->kcountsize >> 8));
- else
- s_scale = 0x1000000 / ((o << 8) / p->kcountsize);
-#endif
- } else
- s_scale = SCALE_1_TO_1;
-
- moncontrol(1);
-}
-
-void
-_mcleanup()
-{
- int fd;
- int hz;
- int fromindex;
- int endfrom;
- u_long frompc;
- int toindex;
- struct rawarc rawarc;
- struct gmonparam *p = &_gmonparam;
- struct gmonhdr gmonhdr, *hdr;
- char *proffile;
-#ifdef DEBUG
- int log, len;
- char dbuf[200];
-#endif
-
- if (p->state == GMON_PROF_ERROR)
- ERR("_mcleanup: tos overflow\n");
-
- hz = PROF_HZ;
- moncontrol(0);
-
-#ifdef nope
- if ((profdir = getenv("PROFDIR")) != NULL) {
- extern char *__progname;
- char *s, *t, *limit;
- pid_t pid;
- long divisor;
-
- /* If PROFDIR contains a null value, no profiling
- output is produced */
- if (*profdir == '\0') {
- return;
- }
-
- limit = buf + sizeof buf - 1 - 10 - 1 -
- strlen(__progname) - 1;
- t = buf;
- s = profdir;
- while((*t = *s) != '\0' && t < limit) {
- t++;
- s++;
- }
- *t++ = '/';
-
- /*
- * Copy and convert pid from a pid_t to a string. For
- * best performance, divisor should be initialized to
- * the largest power of 10 less than PID_MAX.
- */
- pid = getpid();
- divisor=10000;
- while (divisor > pid) divisor /= 10; /* skip leading zeros */
- do {
- *t++ = (pid/divisor) + '0';
- pid %= divisor;
- } while (divisor /= 10);
- *t++ = '.';
-
- s = __progname;
- while ((*t++ = *s++) != '\0')
- ;
-
- proffile = buf;
- } else {
- proffile = "gmon.out";
- }
-#else
- proffile = "gmon.out";
-#endif
-
- fd = open(proffile , O_CREAT|O_TRUNC|O_WRONLY|O_BINARY, 0666);
- if (fd < 0) {
- perror( proffile );
- return;
- }
-#ifdef DEBUG
- log = open("gmon.log", O_CREAT|O_TRUNC|O_WRONLY, 0664);
- if (log < 0) {
- perror("mcount: gmon.log");
- return;
- }
- len = sprintf(dbuf, "[mcleanup1] kcount 0x%x ssiz %d\n",
- p->kcount, p->kcountsize);
- write(log, dbuf, len);
-#endif
- hdr = (struct gmonhdr *)&gmonhdr;
- hdr->lpc = p->lowpc;
- hdr->hpc = p->highpc;
- hdr->ncnt = p->kcountsize + sizeof(gmonhdr);
- hdr->version = GMONVERSION;
- hdr->profrate = hz;
- write(fd, (char *)hdr, sizeof *hdr);
- write(fd, p->kcount, p->kcountsize);
- endfrom = p->fromssize / sizeof(*p->froms);
- for (fromindex = 0; fromindex < endfrom; fromindex++) {
- if (p->froms[fromindex] == 0)
- continue;
-
- frompc = p->lowpc;
- frompc += fromindex * p->hashfraction * sizeof(*p->froms);
- for (toindex = p->froms[fromindex]; toindex != 0;
- toindex = p->tos[toindex].link) {
-#ifdef DEBUG
- len = sprintf(dbuf,
- "[mcleanup2] frompc 0x%x selfpc 0x%x count %d\n" ,
- frompc, p->tos[toindex].selfpc,
- p->tos[toindex].count);
- write(log, dbuf, len);
-#endif
- rawarc.raw_frompc = frompc;
- rawarc.raw_selfpc = p->tos[toindex].selfpc;
- rawarc.raw_count = p->tos[toindex].count;
- write(fd, &rawarc, sizeof rawarc);
- }
- }
- close(fd);
-}
-
-/*
- * Control profiling
- * profiling is what mcount checks to see if
- * all the data structures are ready.
- */
-void
-moncontrol(mode)
- int mode;
-{
- struct gmonparam *p = &_gmonparam;
-
- if (mode) {
- /* start */
- profil((char *)p->kcount, p->kcountsize, p->lowpc,
- s_scale);
- p->state = GMON_PROF_ON;
- } else {
- /* stop */
- profil((char *)0, 0, 0, 0);
- p->state = GMON_PROF_OFF;
- }
-}
-
-
diff --git a/winsup/mingw/profile/gmon.h b/winsup/mingw/profile/gmon.h
deleted file mode 100644
index 1f01bf418..000000000
--- a/winsup/mingw/profile/gmon.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/* $OpenBSD: gmon.h,v 1.3 1996/04/21 22:31:46 deraadt Exp $ */
-/* $NetBSD: gmon.h,v 1.5 1996/04/09 20:55:30 cgd Exp $ */
-
-/*-
- * Copyright (c) 1982, 1986, 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)gmon.h 8.2 (Berkeley) 1/4/94
- */
-
-/*
- * This file is taken from Cygwin distribution. Please keep it in sync.
- * The differences should be within __MINGW32__ guard.
- */
-
-#ifndef _SYS_GMON_H_
-#define _SYS_GMON_H_
-
-#ifndef __P
-#define __P(x) x
-#endif
-
-#include <profile.h>
-
-#ifdef __MINGW32__
-#ifndef _BSDTYPES_DEFINED
-typedef unsigned char u_char;
-typedef unsigned short u_short;
-typedef unsigned int u_int;
-typedef unsigned long u_long;
-#define _BSDTYPES_DEFINED
-#endif /* _BSDTYPES_DEFINED */
-#endif /* __MINGW32__*/
-
-/*
- * Structure prepended to gmon.out profiling data file.
- */
-struct gmonhdr {
- u_long lpc; /* base pc address of sample buffer */
- u_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
-
-/*
- * histogram counters are unsigned shorts (according to the kernel).
- */
-#define HISTCOUNTER unsigned short
-
-/*
- * fraction of text space to allocate for histogram counters here, 1/2
- */
-#define HISTFRACTION 2
-
-/*
- * Fraction of text space to allocate for from hash buckets.
- * The value of HASHFRACTION is based on the minimum number of bytes
- * of separation between two subroutine call points in the object code.
- * Given MIN_SUBR_SEPARATION bytes of separation the value of
- * HASHFRACTION is calculated as:
- *
- * HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof(short) - 1);
- *
- * For example, on the VAX, the shortest two call sequence is:
- *
- * calls $0,(r0)
- * calls $0,(r0)
- *
- * which is separated by only three bytes, thus HASHFRACTION is
- * calculated as:
- *
- * HASHFRACTION = 3 / (2 * 2 - 1) = 1
- *
- * Note that the division above rounds down, thus if MIN_SUBR_FRACTION
- * is less than three, this algorithm will not work!
- *
- * In practice, however, call instructions are rarely at a minimal
- * distance. Hence, we will define HASHFRACTION to be 2 across all
- * architectures. This saves a reasonable amount of space for
- * profiling data structures without (in practice) sacrificing
- * any granularity.
- */
-#define HASHFRACTION 2
-
-/*
- * percent of text space to allocate for tostructs with a minimum.
- */
-#define ARCDENSITY 2
-#define MINARCS 50
-#define MAXARCS ((1 << (8 * sizeof(HISTCOUNTER))) - 2)
-
-struct tostruct {
- u_long selfpc;
- long count;
- u_short link;
- u_short pad;
-};
-
-/*
- * a raw arc, with pointers to the calling site and
- * the called site and a count.
- */
-struct rawarc {
- u_long raw_frompc;
- u_long raw_selfpc;
- long raw_count;
-};
-
-/*
- * general rounding functions.
- */
-#define ROUNDDOWN(x,y) (((x)/(y))*(y))
-#define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y))
-
-/*
- * The profiling data structures are housed in this structure.
- */
-struct gmonparam {
- int state;
- u_short *kcount;
- u_long kcountsize;
- u_short *froms;
- u_long fromssize;
- struct tostruct *tos;
- u_long tossize;
- long tolimit;
- u_long lowpc;
- u_long highpc;
- u_long textsize;
- u_long hashfraction;
-};
-extern struct gmonparam _gmonparam;
-
-/*
- * Possible states of profiling.
- */
-#define GMON_PROF_ON 0
-#define GMON_PROF_BUSY 1
-#define GMON_PROF_ERROR 2
-#define GMON_PROF_OFF 3
-
-/*
- * Sysctl definitions for extracting profiling information from the kernel.
- */
-#define GPROF_STATE 0 /* int: profiling enabling variable */
-#define GPROF_COUNT 1 /* struct: profile tick count buffer */
-#define GPROF_FROMS 2 /* struct: from location hash bucket */
-#define GPROF_TOS 3 /* struct: destination/count structure */
-#define GPROF_GMONPARAM 4 /* struct: profiling parameters (see above) */
-#endif /* !_SYS_GMONH_ */
diff --git a/winsup/mingw/profile/mcount.c b/winsup/mingw/profile/mcount.c
deleted file mode 100644
index 296f8c891..000000000
--- a/winsup/mingw/profile/mcount.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*-
- * Copyright (c) 1983, 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if !defined(lint) && !defined(_KERNEL) && defined(LIBC_SCCS)
-static char rcsid[] = "$OpenBSD: mcount.c,v 1.6 1997/07/23 21:11:27 kstailey Exp $";
-#endif
-
-/*
- * This file is taken from Cygwin distribution. Please keep it in sync.
- * The differences should be within __MINGW32__ guard.
- */
-
-#ifndef __MINGW32__
-#include <sys/param.h>
-#endif
-#include <sys/types.h>
-#include <gmon.h>
-
-/*
- * mcount is called on entry to each function compiled with the profiling
- * switch set. _mcount(), which is declared in a machine-dependent way
- * with _MCOUNT_DECL, does the actual work and is either inlined into a
- * C routine or called by an assembly stub. In any case, this magic is
- * taken care of by the MCOUNT definition in <machine/profile.h>.
- *
- * _mcount updates data structures that represent traversals of the
- * program's call graph edges. frompc and selfpc are the return
- * address and function address that represents the given call graph edge.
- *
- * Note: the original BSD code used the same variable (frompcindex) for
- * both frompcindex and frompc. Any reasonable, modern compiler will
- * perform this optimization.
- */
-//_MCOUNT_DECL __P((u_long frompc, u_long selfpc));
-_MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */
- register u_long frompc, selfpc;
-{
- register u_short *frompcindex;
- register struct tostruct *top, *prevtop;
- register struct gmonparam *p;
- register long toindex;
-
- p = &_gmonparam;
- /*
- * check that we are profiling
- * and that we aren't recursively invoked.
- */
- if (p->state != GMON_PROF_ON)
- return;
- p->state = GMON_PROF_BUSY;
- /*
- * check that frompcindex is a reasonable pc value.
- * for example: signal catchers get called from the stack,
- * not from text space. too bad.
- */
- frompc -= p->lowpc;
- if (frompc > p->textsize)
- goto done;
-
-#if (HASHFRACTION & (HASHFRACTION - 1)) == 0
- if (p->hashfraction == HASHFRACTION)
- frompcindex =
- &p->froms[frompc / (HASHFRACTION * sizeof(*p->froms))];
- else
-#endif
- frompcindex =
- &p->froms[frompc / (p->hashfraction * sizeof(*p->froms))];
- toindex = *frompcindex;
- if (toindex == 0) {
- /*
- * first time traversing this arc
- */
- toindex = ++p->tos[0].link;
- if (toindex >= p->tolimit)
- /* halt further profiling */
- goto overflow;
-
- *frompcindex = toindex;
- top = &p->tos[toindex];
- top->selfpc = selfpc;
- top->count = 1;
- top->link = 0;
- goto done;
- }
- top = &p->tos[toindex];
- if (top->selfpc == selfpc) {
- /*
- * arc at front of chain; usual case.
- */
- top->count++;
- goto done;
- }
- /*
- * have to go looking down chain for it.
- * top points to what we are looking at,
- * prevtop points to previous top.
- * we know it is not at the head of the chain.
- */
- for (; /* goto done */; ) {
- if (top->link == 0) {
- /*
- * top is end of the chain and none of the chain
- * had top->selfpc == selfpc.
- * so we allocate a new tostruct
- * and link it to the head of the chain.
- */
- toindex = ++p->tos[0].link;
- if (toindex >= p->tolimit)
- goto overflow;
-
- top = &p->tos[toindex];
- top->selfpc = selfpc;
- top->count = 1;
- top->link = *frompcindex;
- *frompcindex = toindex;
- goto done;
- }
- /*
- * otherwise, check the next arc on the chain.
- */
- prevtop = top;
- top = &p->tos[top->link];
- if (top->selfpc == selfpc) {
- /*
- * there it is.
- * increment its count
- * move it to the head of the chain.
- */
- top->count++;
- toindex = prevtop->link;
- prevtop->link = top->link;
- top->link = *frompcindex;
- *frompcindex = toindex;
- goto done;
- }
- }
-done:
- p->state = GMON_PROF_ON;
- return;
-overflow:
- p->state = GMON_PROF_ERROR;
- return;
-}
-
-/*
- * Actual definition of mcount function. Defined in <machine/profile.h>,
- * which is included by <sys/gmon.h>
- */
-MCOUNT
-
diff --git a/winsup/mingw/profile/profil.c b/winsup/mingw/profile/profil.c
deleted file mode 100644
index dae59d7fd..000000000
--- a/winsup/mingw/profile/profil.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/* profil.c -- win32 profil.c equivalent
-
- Copyright 1998, 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 file is taken from Cygwin distribution. Please keep it in sync.
- * The differences should be within __MINGW32__ guard.
- */
-
-#include <windows.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <math.h>
-
-#include <profil.h>
-
-#define SLEEPTIME (1000 / PROF_HZ)
-
-/* global profinfo for profil() call */
-static struct profinfo prof;
-
-/* Get the pc for thread THR */
-
-static u_long
-get_thrpc (HANDLE thr)
-{
- CONTEXT ctx;
- u_long pc;
- int res;
-
- res = SuspendThread (thr);
- if (res == -1)
- return (u_long) - 1;
- ctx.ContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER;
- pc = (u_long) - 1;
- if (GetThreadContext (thr, &ctx))
- pc = ctx.Eip;
- ResumeThread (thr);
- return pc;
-}
-
-/* Display cell of profile buffer */
-#if 0
-static void
-print_prof (struct profinfo *p)
-{
- printf ("profthr %x\ttarget thr %x\n", p->profthr, p->targthr);
- printf ("pc: %x - %x\n", p->lowpc, p->highpc);
- printf ("scale: %x\n", p->scale);
- return;
-}
-#endif
-
-/* Everytime we wake up use the main thread pc to hash into the cell in the
- profile buffer ARG. */
-
-static DWORD CALLBACK
-profthr_func (LPVOID arg)
-{
- struct profinfo *p = (struct profinfo *) arg;
- u_long pc, idx;
-
- for (;;)
- {
- pc = (u_long) get_thrpc (p->targthr);
- if (pc >= p->lowpc && pc < p->highpc)
- {
- idx = PROFIDX (pc, p->lowpc, p->scale);
- p->counter[idx]++;
- }
-#if 0
- print_prof (p);
-#endif
- Sleep (SLEEPTIME);
- }
- return 0;
-}
-
-/* Stop profiling to the profiling buffer pointed to by P. */
-
-static int
-profile_off (struct profinfo *p)
-{
- if (p->profthr)
- {
- TerminateThread (p->profthr, 0);
- CloseHandle (p->profthr);
- }
- if (p->targthr)
- CloseHandle (p->targthr);
- return 0;
-}
-
-/* Create a timer thread and pass it a pointer P to the profiling buffer. */
-
-static int
-profile_on (struct profinfo *p)
-{
- DWORD thrid;
-
- /* get handle for this thread */
- if (!DuplicateHandle (GetCurrentProcess (), GetCurrentThread (),
- GetCurrentProcess (), &p->targthr, 0, FALSE,
- DUPLICATE_SAME_ACCESS))
- {
- errno = ESRCH;
- return -1;
- }
-
- p->profthr = CreateThread (0, 0, profthr_func, (void *) p, 0, &thrid);
-
- /* Set profiler thread priority to highest to be sure that it gets the
- processor as soon it request it (i.e. when the Sleep terminate) to get
- the next data out of the profile. */
-
- SetThreadPriority (p->profthr, THREAD_PRIORITY_TIME_CRITICAL);
-
- if (!p->profthr)
- {
- CloseHandle (p->targthr);
- p->targthr = 0;
- errno = EAGAIN;
- return -1;
- }
- return 0;
-}
-
-/*
- * start or stop profiling
- *
- * profiling goes into the SAMPLES buffer of size SIZE (which is treated
- * as an array of u_shorts of size size/2)
- *
- * each bin represents a range of pc addresses from OFFSET. The number
- * of pc addresses in a bin depends on SCALE. (A scale of 65536 maps
- * each bin to two addresses, A scale of 32768 maps each bin to 4 addresses,
- * a scale of 1 maps each bin to 128k addreses). Scale may be 1 - 65536,
- * or zero to turn off profiling
- */
-int
-profile_ctl (struct profinfo * p, char *samples, size_t size,
- u_long offset, u_int scale)
-{
- u_long maxbin;
-
- if (scale > 65536)
- {
- errno = EINVAL;
- return -1;
- }
-
- profile_off (p);
- if (scale)
- {
- memset (samples, 0, size);
- memset (p, 0, sizeof *p);
- maxbin = size >> 1;
- prof.counter = (u_short *) samples;
- prof.lowpc = offset;
- prof.highpc = PROFADDR (maxbin, offset, scale);
- prof.scale = scale;
-
- return profile_on (p);
- }
- return 0;
-}
-
-/* Equivalent to unix profil()
- Every SLEEPTIME interval, the user's program counter (PC) is examined:
- offset is subtracted and the result is multiplied by scale.
- The word pointed to by this address is incremented. Buf is unused. */
-
-int
-profil (char *samples, size_t size, u_long offset, u_int scale)
-{
- return profile_ctl (&prof, samples, size, offset, scale);
-}
-
diff --git a/winsup/mingw/profile/profil.h b/winsup/mingw/profile/profil.h
deleted file mode 100644
index 9245dd25a..000000000
--- a/winsup/mingw/profile/profil.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* profil.h: gprof profiling header file
-
- Copyright 1998, 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 file is taken from Cygwin distribution. Please keep it in sync.
- * The differences should be within __MINGW32__ guard.
- */
-
-/* profiling frequency. (No larger than 1000) */
-#define PROF_HZ 100
-
-/* convert an addr to an index */
-#define PROFIDX(pc, base, scale) \
- ({ \
- size_t i = (pc - base) / 2; \
- if (sizeof (unsigned long long int) > sizeof (size_t)) \
- i = (unsigned long long int) i * scale / 65536; \
- else \
- i = i / 65536 * scale + i % 65536 * scale / 65536; \
- i; \
- })
-
-/* convert an index into an address */
-#define PROFADDR(idx, base, scale) \
- ((base) \
- + ((((unsigned long long)(idx) << 16) \
- / (unsigned long long)(scale)) << 1))
-
-/* convert a bin size into a scale */
-#define PROFSCALE(range, bins) (((bins) << 16) / ((range) >> 1))
-
-typedef void *_WINHANDLE;
-
-struct profinfo {
- _WINHANDLE targthr; /* thread to profile */
- _WINHANDLE profthr; /* profiling thread */
- u_short *counter; /* profiling counters */
- u_long lowpc, highpc; /* range to be profiled */
- u_int scale; /* scale value of bins */
-};
-
-int profile_ctl(struct profinfo *, char *, size_t, u_long, u_int);
-int profil(char *, size_t, u_long, u_int);
-
diff --git a/winsup/mingw/profile/profile.h b/winsup/mingw/profile/profile.h
deleted file mode 100644
index d578657f8..000000000
--- a/winsup/mingw/profile/profile.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $NetBSD: profile.h,v 1.6 1995/03/28 18:17:08 jtc Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)profile.h 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * This file is taken from Cygwin distribution. Please keep it in sync.
- * The differences should be within __MINGW32__ guard.
- */
-
-#define _MCOUNT_DECL static inline void _mcount
-
-#define MCOUNT \
-void \
-mcount() \
-{ \
- int selfpc, frompcindex; \
- /* \
- * find the return address for mcount, \
- * and the return address for mcount's caller. \
- * \
- * selfpc = pc pushed by mcount call \
- */ \
- __asm("movl 4(%%ebp),%0" : "=r" (selfpc)); \
- /* \
- * frompcindex = pc pushed by call into self. \
- */ \
- __asm("movl (%%ebp),%0;movl 4(%0),%0" : "=r" (frompcindex)); \
- _mcount(frompcindex, selfpc); \
-}
-
diff --git a/winsup/mingw/readme.txt b/winsup/mingw/readme.txt
deleted file mode 100644
index 4b680df48..000000000
--- a/winsup/mingw/readme.txt
+++ /dev/null
@@ -1,685 +0,0 @@
- Minimalist GNU-Win32 Readme
- version 0.1.3
- March 20, 1997
- Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
-
-
-0. Introduction
-
-Mingw32 is short for the Minimalist GNU-Win32 package, and it is a
-package which allows you to use GCC (as supplied by Cygnus in their GNU-
-Win32 or Cygwin32 package) the GNU compiler, on Win32 platforms like
-Windows 95 or NT, to compile "native" programs.
-
-In this case "native" means programs which don't require extra DLLs like
-the cygwin DLL. Mingw32 programs use CRTDLL.DLL to provide their C run
-time library functions, and CRTDLL.DLL is supplied with all current
-Win32 platforms. Thus the programs are light weight and easy to
-distribute, they also do not automatically fall under the GNU Public
-License as programs written with the GPL version of Cygwin32 do.
-
-
-0.1 Archive Contents
-
-Mingw32 version 0.1.3 is distributed in two files, mingw32_013.tar.gz
-and mingsrc013.tar.gz. The first file contains the following components:
-
- - Import libraries for building programs which use the
- CRTDLL.DLL C run time library supplied with Win32 platforms.
-
- - crt0.o and dllcrt0.o, two "startup code" object files that
- perform program or DLL initialization without using
- CRTDLL.DLL (instead of CYGWIN.DLL).
-
- - specs, a configuration file for GCC which defines appropriate
- options for creating executables which use the CRTDLL.DLL C
- run time library.
-
- - Include files with appropriate type and macro definitions,
- and function prototypes for use with CRTDLL.DLL.
-
-The source distribution (mingsrc013.tar.gz) contains the .def files and
-source files used to create the various import libraries and object
-files in the above list.
-
-
-0.2 Usage Notes
-
-Unlike some previous releases of Mingw32 the current version defaults to
-building console applications, the same way that GCC normally does when
-installed from the Cygnus distribution. The Mingw32 specs file also
-introduces two command line arguments to GCC which can be used to
-conveniently specify a console or GUI type build. When building console
-programs "-console" can be used on the GCC command line, while GUI
-programs can be built by specifying "-windows" (I tried defining -gui,
-and it works, but produces an annoying warning about -gui not being
-supported (?)). For example:
-
- gcc -o hellogui.exe hellogui.c -luser32 -windows
-
-Although using different "crt0" files for GUI and console applications
-has been suggested I have left the system more-or-less as it was in
-0.1.1: crt0 sets up for and calls main, and if you don't supply a main
-there is one in libmingw32.a, which in turn calls WinMain (actually
-WinMain@16). This allows either main or WinMain entry points in console
-or GUI applications, but if you don't supply main or WinMain, or don't
-prototype WinMain as __stdcall__ you will get a linker error about an
-"unresolved reference to WinMain@16." This is unfortunately cryptic, but
-otherwise the system works quite well.
-
-An important note if you want to rebuild from the sources of Mingw32 or
-otherwise use the special version of Jam made for Mingw32: you need to
-have a version of "rm", the UNIX equivalent of del, somewhere in your
-path to use the current Jambase (which is built into the Jam
-executable). The version that comes with the Cygnus files is perfectly
-adequate.
-
-
-0.3 Fixes and Improvements
-
-Numerous small bug fixes have been made in the header files.
-
-Floating point initialization, originally added in version 0.1.2, has
-been modified to use the _fpreset function from CRTDLL.DLL instead of
-cryptic and possibly less portable assembly code.
-
-A new DLL-building option has been added to the specs file so that the
-following link line will appropriately link in dllcrt0.o instead of the
-normal crt0.o, and set the entry point correctly:
-
- gcc -dll -o dll.dll dll.o -Wl,dll.exp
-
-A bug that would cause the wrong include files to be included in dual
-installations of Cygwin32 and Mingw32 has been fixed (I hope) in the
-Mingw32 specs file.
-
-Alongside this release is a new release of Jam specially built for use
-with Mingw32. It should be available from the same place you got this
-file. This release of Jam includes rules for building DLLs, including
-resources in your executables and creating import libraries. I also
-intend to distribute a small set of example files showing how to do all
-of these things with Mingw32 and Jam.
-
-In the "coming soon" category I have a version of the GNU Standard C++
-library ported to Mingw32. This means you can use iostreams, complex
-numbers and all those neat STL (Standard Template Library) things
-without needing the Cygwin DLL. I hope to put this port up for
-downloading soon (along with the source of course).
-
-
-
-1. Installing
-
-1.1 Download and Unpack GNU-Win32 Beta 17.1
-
-Because of the enormous size of the beta 17.1 release from Cygnus this
-process will require about 85 MB or more of free disk space. The first
-step, after downloading the Mingw32 package, is to download the GCC
-binary distribution, all.tar.gz, from Cygnus (or a mirror), which is
-about 10 MB. (Of course, if you just want the Cygwin32 install and are
-not actually interested in adding on Mingw32 you don't need the Mingw32
-package at all.)
-
-Just to be safe, and if you have the 10 MB to spare, you should probably
-copy the all.tar.gz file to a reasonably safe place at this point. This
-will save you from the pain of downloading it again if something goes
-wrong later.
-
-To complete this step you need a gzip program (or just gunzip) and a tar
-program. You can use the ones supplied by Cygnus (although some people
-seem to have trouble with them, especially if you try to use pipes) or
-one of the other ports available from your favorite freeware/shareware
-software site.
-
-First un-gzip the file with a command line like:
- gunzip all.tar.gz
-or
- gzip -d all.tar.gz
-
-This will produce a all.tar file and erase the all.tar.gz file (there
-are options for gzip if you want to keep the original around). The tar
-file is about 40 MB.
-
-Make a directory for the cygnus stuff, such as C:\cygnus for example.
-Move the tar file there (e.g. move \tmp\all.tar \cygnus). Don’t copy it
-unless you like waiting and wasting 40 MB of disk space.
-
-Unpack the tar file into your new directory with a command line like:
- tar xvf all.tar
-
-Run from the new directory (now containing the tar file). This is the
-step where disk space usage reaches its peak, since the tar extraction
-does not delete the all.tar file, and the amount of space taken by the
-extracted files plus the tar file itself is well in excess of 80 MB
-(mainly because, on my system at least, the files which are symbolic
-links in the tar archive are copied as they are expanded onto the FAT
-filesystem, so for example, a symbolic link to cygwin.dll, a 3 MB file,
-takes an extra 3 MB, since the file is simply duplicated in the new
-location). I could not actually do this on my laptop and had to extract
-the tar file from a mounted network drive!
-
-NOTE: From here on I will refer to files as if you had installed in
-C:\cygnus. If you installed somewhere else then just replace C:\cygnus
-with the appropriate path wherever it occurs.
-
-
-1.2 Setup Cygwin32
-
-This step is not 100% necessary, but it helps at this point to determine
-if you’ve gotten this far without any major problems. Also, if you
-intend to use both Cygwin32 and Mingw32 you will have to do some of
-these steps eventually.
-
-GCC and the other programs in the compiler suite all require cygwin.dll
-to run. There are two copies of this file: one in C:\cygnus\H-i386-
-cygwin32\bin (this might be a symbolic link), and one in C:\cygnus\H-
-i386-cygwin32\i386-cygwin32\lib (the original). Since this DLL is
-required by all Cygwin32 programs it makes sense to put one copy of it
-in your C:\Windows\System directory (or equivalent) and remove the extra
-copies. This will also save you headaches when the next release comes
-along and you have to make sure that everything is using the latest
-release of the DLL.
-
-After doing that run the cygwin32.bat batch file included with this
-distribution, or otherwise perform the following settings:
-
- PATH=%PATH%;C:\cygnus\H-i386-cygwin32\bin
- SET GCC_EXEC_PREFIX=C:\cygnus\H-i386-cygwin32\lib\gcc-lib\i386-
- cygwin32\cygnus-2.7.2-961023
- SET LIBRARY_PATH=/cygnus/H-i386-cygwin32/lib/gcc-lib/i386-
- cygwin32/cygnus-2.7.2-961023:/cygnus/H-i386-cygwin32/i386-
- cygwin32/lib:/cygnus/H-i386-cygwin32/lib
- SET C_INCLUDE_PATH=/cygnus/H-i386-cygwin32/lib/gcc-lib/i386-
- cygwin32/cygnus-2.7.2-961023/include:/cygnus/H-i386-
- cygwin32/i386-cygwin32/include:/cygnus/include
- SET CPLUS_INCLUDE_PATH=%C_INCLUDE_PATH%
-
-NOTE: You may need to increase the amount of environment space available
-at the command prompt to get these extremely long environment variables
-set. You can do this under Windows 95 by modifying the properties of the
-command prompt shortcut you use under the "Program" tab, adding a
-/e:#### argument to the command line COMMAND.COM, where #### is the
-number of bytes to set aside for the environment.
-
-NOTE: Under Windows 95 changes made in your autoexec.bat file will not
-show up in new DOS boxes unless you reboot your machine.
-
-Now write and compile a small test hello world program like this:
-
-#include <stdio.h>
-
-int
-main ()
-{
- printf ("Hello, world!\n");
- return 0;
-}
-
-Then compile it like this (assuming your file is called hello.c):
-
- gcc -o hello.exe hello.c
-
-The compile should proceed without problems and you should be able to
-run the hello program at the end. It should print "Hello, world!"
-(without the quotes) to the console and then return to the command
-prompt.
-
-If you wanted a full Cygwin32 install you now have it. With this setup
-(say, by adding those lines above to your autoexec.bat or global
-settings) you can port a great deal of UNIX code to run under Win32
-systems. No more steps are necessary.
-
-If you are a minimalist or otherwise want to save disk space you should
-continue from here. Also if you intend to use the Minimalist GNU-Win32
-files to compile programs which don't use the Cygwin32 API you will need
-to do some of the things mentioned below.
-
-If the compile didn't work for some reason check very carefully that you
-followed the instructions above correctly and then check whether one or
-more of the files in the download got corrupted. If neither of these
-seems to be the case then your system is not behaving like my system.
-Try looking at the troubleshooting section later in this file, and if
-none of that helps then you can email me (colin@bird.fu.is.saga-
-u.ac.jp), though I can't promise I'll be a lot of help.
-
-
-1.3 Separating the Win32 API Files
-
-Mingw32 and Cygwin32 share the same set of Win32 API include files and
-import libraries as included in the GCC distribution from Cygnus. In
-order to use the Win32 API with a dual setup or with Mingw32 alone you
-will have to separate those files from the bulk of the Cygwin32 API
-files.
-
-Make a new directory to serve as the root for the Win32 API files. I put
-mine under C:\cygnus and called it win32, but you can put it where you
-like and just replace later references to C:\cygnus\win32 with your own
-root directory.
-
-Move the following from C:\cygnus\H-i386-cygwin32\i386-cygwin32\include
-to a new C:\cygnus\win32\include directory:
-
-windows.h, winadvapi.h, winbase.h, wincon.h, windef.h, windowsx.h,
-winerror.h, wingdi.h, winkernel.h, winnt.h, wintypes.h, winuser.h,
-winversion.h, commdlg.h, ddeml.h and the Windows32 sub-directory and all
-its contents.
-
-Move the following files from C:\cygnus\H-i386-cygwin32\i386-
-cygwin32\lib to a new C:\cygnus\win32\lib directory:
-
-libadvapi32.a, libcomctl32.a, libcomdlg32.a, libctl3d32.a, libgdi32.a,
-libglaux.a, libglu32.a, libimm32.a, libkernel32.a, liblz32.a,
-libmapi32.a, libmfcuia32.a, libmgmtapi.a, libmpr.a, libmsacm32.a,
-libnddeapi.a, libnetapi32.a, libodbc32.a, libodbccp32.a, libole32.a,
-liboleaut32.a, liboledlg.a, libolepro32.a, libopengl32.a, libpenwin32.a,
-libpkpd32.a, librasapi32.a, librpcdce4.a, librpcndr.a, librpcns4.a,
-librpcrt4.a, libscrnsave.a, libshell32.a, libsnmp.a, libsvrapi.a,
-libtapi32.a, libth32.a, libthunk32.a, liburl.a libuser32.a, libvdmdbg.a,
-libversion.a, libvfw32.a, libwin32spl.a, libwinmm.a, libwinserve.a,
-libwinspool.a, libwinstrm.a, libwow32.a, libwsock32.a, libwst.a.
-
-That list is quite excessive for most basic Windows programming, which
-will only require kernel32, user32, gdi32, shell32 and possibly a couple
-of others like the common control and dialog libraries or advapi32. You
-may not need the ODBC support, or OLE, or Pen Windows, TAPI and on and
-on. Still, if you have the space and intend to use the Win32 API you
-might as well keep the ones you’re not sure you’ll ever use around.
-
-The lists above can also act as lists of files you can safely delete if
-you are never going to use the Win32 API in your programs except that
-libkernel32.a is still required even if you don’t use the Win32 API
-yourself. Note that this means that libkernel32.a must be on the library
-path as well, even if you don’t use the Win32 API. (Actually this
-appears to be an artifact of the specs file supplied with Cygwin32. If
-you like, and feel up to it, you can play around with the specs file and
-remove the reference to kernel32.)
-
-Here are the variable settings you need to make to allow GCC to find the
-Win32 API files in their new positions:
-
- SET LIBRARY_PATH=%LIBRARY_PATH%:/cygnus/win32/lib
- SET C_INCLUDE_PATH=%C_INCLUDE_PATH%:/cygnus/win32/include
- SET CPLUS_INCLUDE_PATH=%CPLUS_INCLUDE_PATH%:/cygnus/win32/include
-
-The file win32-api.bat performs these settings. Run it after you run
-cygwin32.bat (or mingw32.bat below).
-
-At this point you should be able to compile programs that use the Win32
-API, just as you could before. You might want to do a simple test
-compile to find out, for example this code:
-
-#include <windows.h>
-
-int STDCALL
-WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow)
-{
- MessageBox (NULL, "Test message", "Test", MB_OK);
- return 0;
-}
-
-Should compile with the following command line:
- gcc -o test.exe test.c -lkernel32 -luser32 -Wl,--subsystem,windows
-
-It will produce a warning at link time about not finding
-_WinMainCRTStartup, but this is harmless.
-
-If you have trouble check the troubleshooting section later in this
-file.
-
-
-1.4 Specs
-
-The file C:\cygnus\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\cygnus-
-2.7.2-961023\specs includes a set of options and defaults for GCC,
-including such things as which libraries are automatically linked into
-executables and such. A different specs file is required depending on
-whether you use Cygwin32 or Mingw32.
-
-To avoid GCC accidentally using the wrong specs file move specs to
-C:\cygnus\H-i386-cygwin32\i386-cygwin32\lib.
-
-You can verify what specs file is being used by attempting a compile
-with the -v option to gcc. Note that if no specs file is mentioned the
-compiler will default to Cygwin32 behavior.
-
-
-1.5 The Mingw32 Files
-
-Now we can install the Mingw32 files and start making programs which
-don’t use cygwin.dll or the Cygwin32 API. I install my copy under a
-separate directory called C:\mingw32, but you could put them wherever
-you like (e.g. C:\cygnus\mingw32). Again simply replace references to
-C:\mingw32 with the directory where you perform your installation.
-
-After making the install directory copy mingw32_012.tgz to that
-directory and run a command like this:
- gunzip -d mingw32_012.tgz
-
-in that directory, followed by:
- tar xvf mingw32_012.tar
-
-This will unpack the required files. Then you can use the following
-environment variable settings (as included in mingw32.bat) to setup for
-compiles using Mingw32:
-
- PATH=%PATH%;C:\cygnus\H-i386-cygwin32\bin
- SET GCC_EXEC_PREFIX=C:\cygnus\H-i386-cygwin32\lib\gcc-lib\i386-
- cygwin32\cygnus-2.7.2-961023\
- SET LIBRARY_PATH=/mingw32/lib
- SET C_INCLUDE_PATH=/mingw32/include:/mingw32/include/nonansi
- SET CPLUS_INCLUDE_PATH=%C_INCLUDE_PATH%
-
-The mingw32.bat file can be used the same way as the cygwin32.bat file.
-Depending on which one you run you will be able to do Mingw32 compiles
-or Cygwin32 compiles. Note that whichever one you use you must follow it
-with an invocation of win32-api.bat so that libkernel32.a will be in the
-library path.
-
-Setup is now complete, you have complete working Mingw32 and Cygwin32
-compiles available along with the bash shell, tons of UNIX-like
-utilities.
-
-If you had trouble with any of the steps above then the next section is
-for you.
-
-
-
-2. Troubleshooting Setup Problems
-
-If you ran into trouble at any stage in the section 1 here are a few
-general guidelines as well as some solutions to common problems.
-
-2.1 Winzip, gunzip or tar Complains of Errors
-
-Winzip may complain that it could not create a file with garbage
-characters in it's name. Gunzip, gzip or tar may complain about
-formatting errors. Usually this means that the downloaded file is
-corrupted. As of this writing this problem was most commonly caused when
-downloading the files from Geocities using Netscape Navigator for
-Windows 95 or NT. A combination of a badly set MIME type at Geocities
-and a bug in Netscape will corrupt files saved with "Save Link As" (and
-clicking on the links would display the files as garbage text). At this
-time the only solutions are to use another browser (IE, or Netscape for
-UNIX or Apple systems) or to download from the Japanese mirror
-(http://www.fu.is.saga-u.ac.jp/~colin/gcc.html). Hopefully Geocities
-will eventually fix their problem.
-
-
-2.2 Compile and Link Time Problems: General Steps
-
-First, evaluate that your environment variables are what you expect them
-to be by running the SET command with no arguments (if you are using the
-bash shell then the output of env might also be illuminating). Do this
-immediately before you attempt a compile in the same window as the
-compile.
-
-Secondly include the '-v' option on the gcc command line. This will give
-you far more information on what happens during the compile, especially
-important are which specs file is being used and what include file
-directories are being read, as well as the arguments to cpp and ld.
-
-If you send me email about a problem the output of these two general
-steps will be very helpful in making a diagnosis.
-
-
-2.3 Cannot exec 'cpp'
-
-On compiling you get an error message like this:
-
- GCC.EXE: installation problem, cannot exec `cpp': No such file
- or directory
- GCC.EXE: Internal compiler error: program cpp got fatal signal 127
-
-This means more or less what it says. The program cpp is the C
-preprocessor (it strips comments and interprets all those lines
-beginning in '#') and running it is the first step in compiling a C or
-C++ program. The problem here is that GCC.EXE cannot find CPP.EXE.
-Normally CPP.EXE is in the directory C:\cygnus\H-i386-cygwin32\lib\gcc-
-lib\i386-cygwin32\cygnus-2.7.2-961023\. If the file is there then
-probably the GCC_EXEC_PREFIX environment variable is not correctly set.
-
-
-2.4 Can't Find Include Files
-
-You get an error like this:
-
- hello.c:2: No include path in which to find stdio.h
-
-This, again, means what it says (more or less). The compiler cannot find
-the file stdio.h which is #included in the source file hello.c at line
-2. Of course the particular file names may differ in your case. If this
-is not simply a case of including a really non-existent file or
-misspelling the file name then probably your C_INCLUDE_PATH or
-CPLUS_INCLUDE_PATH environment variable is wrong. (If not, see "But the
-environment variables are right" below.)
-
-
-2.5 Can't Find Libraries
-
-At link time you get an error like this:
-
- ld: cannot open -lkernel32: No such file or directory
-
-This one is a bit cryptic, mainly because the name of the file that
-can't be opened is not "-lkernel32" but "libkernel32.a". "-lname" is the
-ld command line syntax for linking the library named "libname.a". So
-basically this error is saying it can't find libkernel32.a (or whatever
-library matches the error you got). If you weren't trying to manually
-link in a library that doesn't exist or was misspelled (by accidentally
-including the 'lib' or '.a' on the command line for example) then
-probably your LIBRARY_PATH environment variable is wrong. (If not, see
-"But the environment variables are right" below.)
-
-
-2.6 But the Environment Variables are Right!
-
-You had one of the problems with not finding include files or libraries
-but the environment variables all seem to be pointing at the right
-places and the files are all there.
-
-If you installed on a drive other than C: drive this may be your
-problem. The Cygwin DLL, and thus all the basic compiler tools,
-automatically map C: drive to (UNIX-style) '/'. Thus /cygnus is actually
-C:\cygnus. There are a few ways to fix this (without reinstalling on C:
-drive):
-
- - Map your actual install directory to /cygnus using mount
- (mount.exe is included with the Cygnus distribution). Simply
- type "mount D:\mydir /cygnus" (assuming you installed in the
- directory \mydir on D: drive). Similar tricks can be used for
- other directories which you may have installed on other drives.
-
- - Change the mount of C: to / to the actual install drive. This is
- possible by using the registry editor (regedit) included with
- Windows. Start the editor and go to the key (or folder) "My
- Computer\HKEY_CURRENT_USER\Software\Cygnus Support\CYGWIN.DLL
- setup\b15.0\mounts". Under this key there are several numbered
- keys. One of them will have the variables "native" set to "c:" and
- "unix" set to "/". Change the value of "native" to whatever drive
- you did your install on and everything should be fixed. NOTE: You
- should probably do this after a fresh boot with no Cygnus based
- programs running.
-
-
-2.7 Unresolved References to _impure_ptr and/or _ctype_ etc.
-
-At link time your code produces unresolved references to _impure_ptr,
-_ctype_ and/or _errno, among others.
-
-This is the result of using the Cygwin header files but linking against
-the Mingw32 libraries. I have hopefully managed to fix the bug that used
-to cause this problem on any dual installation, but perhaps I haven't.
-To check you can run gcc with the -v option and see if the list of
-directories searched for include files contains any include directories
-with Cygwin headers in them. If everything is working correctly you
-should only see the directories on your C_INCLUDE_PATH in this list.
-
-If you have this problem then you may have to modify the Mingw32 specs
-file, specifically the part that says:
-
-*cpp:
-%{posix:-D_POSIX_SOURCE} -iprefix /mingw32/include/
-
-These are options that get passed to the C preprocessor by gcc. Consult
-the documentation for cpp and try options other than -iprefix. You may
-have to use -nostdinc and/or -nostdinc++ plus -I options to get the
-correct behavior.
-
-
-2.8 My Program Doesn't Print Any Output OR My Windows Program Creates
- A Console Window
-
-Your console application runs, but doesn't print any output, or your GUI
-application runs fine, but always creates an extra console window when
-run from Explorer or by double clicking on an icon.
-
-These are basically two sides of the same coin. You have created a GUI
-(or console) application when you meant to create a console (or GUI)
-application. By default gcc creates console applications. If you make a
-windows GUI application with a WinMain and all that you will still get a
-console application if you don't tell gcc what to do at link time. The
-relevant options are "-windows" "-Wl,--subsystem,windows" or "-Wl,--
-subsystem,console". The first two, if used on a gcc link line, will
-create a proper GUI application. The last will make sure you are making
-a console application.
-
-
-
-3. Optimizing and Reducing Disk Space Usage
-
-There are still vast amounts of disk space used by the Cygwin32
-installation on your hard-drive, and much of it can be removed while
-still maintaining a fully functional compiler system. The following
-sections point out which files you actually need for certain tasks, so
-that you won’t delete them.
-
-
-3.1 Bare Minimum
-
-For C only, Mingw32 compiles which don’t use the Win32 API, and if you
-don’t want to produce DLLs or do debugging with any of the GNU tools the
-list of files required is as follows:
-
-In C:\cygnus\H-i386-cygwin32\bin:
- ar.exe, as.exe, gcc.exe, ld.exe
-
-In C:\cygnus\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\cygnus-2.7.2-
-961023:
- cc1.exe, cpp.exe, libgcc.a
-
-In C:\cygnus\win32\lib:
- libkernel32.a
-
-Plus all the files in C:\mingw32\lib and C:\mingw32\include and their
-subdirectories.
-
-
-3.2 C++ Support
-
-To add C++ Support to the above the following extra files are required:
-
-In C:\cygnus\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\cygnus-2.7.2-
-961023:
- cc1plus.exe
-
-Note that this does not include support for the standard C++ libraries
-(only the C run time libraries) or for iostreams. That support is still
-only available with the Cygwin32 API.
-
-
-3.3 Extra Utilities of Extreme Usefulness
-
-Even if you do not use the bash shell or UNIX utilities in general some
-of the utilities in C:\cygnus\H-i386-cygwin32\bin are extremely useful
-for debugging and probably shouldn’t be deleted if you intend to do any
-actual programming using the system.
-
-These include:
- dlltool.exe, gdb.exe, nm.exe, and strip.exe.
-
-
-3.4 Jam
-
-Jam is a make replacement program that I use pretty much exclusively,
-which is why you don't find any Makefile, makefile, makefile.mk or all
-that in the stuff that I do. You do find jamfiles and the occaisional
-mk.bat file. The executable of Jam is only 80 KB and the program is
-incredibly useful, so I would encourage you do download the special
-Mingw32 version and check it out. The Mingw32 version has built in rules
-for adding resources, building DLLs and import libraries as well as
-normal C and C++ files. The source code is, of course, freely available.
-
-The actual point of this section though, is to point out that to use Jam
-you need not only the Jam executable but also rm.exe from the Cygwin
-distribution. You also might want to download rcl.exe and res2coff.exe
-as these are the helper programs Jam expects to use for resource script
-handling.
-
-
-4. Legalities
-
-All of the code in the Mingw32 package is available as public domain
-source. You may use and modify the code as you like. Of course I
-encourage you to write software which is free, either public domain or
-under the GNU Public License for example, but that is up to you. Linking
-with the libraries included with Mingw32 similarly does not impose any
-licensing restrictions on your code or binaries.
-
-The library libgcc.a, which is linked into all code produced with GCC,
-is under a special version of the LGPL (as far as I know, you should
-check for yourself) which allows the distribution of programs which are
-simply linked with unmodified versions of libgcc.a with no licensing
-restrictions.
-
-Thus, using Mingw32, you should be able to produce code with no
-licensing restrictions imposed by use of the compiler or libraries. The
-Cygwin32 API, and the GNU libraries are another matter and you should
-consult their license agreements.
-
-Again I must stress that I am not a lawyer and the above statements only
-reflect my personal understanding of the situation. You would be well
-advised to consult the actual text of the appropriate copyright notices
-and license agreements if you have any concerns.
-
-
-5. Support
-
-First of all, the Mingw32 code is supplied AS IS with NO WARRANTY either
-EXPRESS or IMPLIED.
-
-There is also no support staff standing by to take your calls. There
-are, however, a few people, including myself, using Mingw32 who might be
-able to help you. If you have problems you can email me at
-colin@bird.fu.is.saga-u.ac.jp and I will try to get back to you. No
-guarantees, but I will do my best.
-
-
-6. Suggestions and Contributions
-
-If you find a bug in the Mingw32 files themselves then feel free to
-report it, or even better to supply a fix, by emailing me at
-colin@bird.fu.is.saga-u.ac.jp. Any fixes I receive will probably go into
-the next release, and if they seem high-priority I may put the patched
-files on my web page until I can make a complete release. Please note
-that if you supply code it must be in the public domain or I cannot
-include it in Mingw32. Please attach an appropriate legal message to the
-code or otherwise make sure that there are no copyright issues. Of
-course if you just suggest a possible method for solving a problem or
-point out a bug then there should be no need for all that.
-
-Note that the Win32 API header files are not actually part of the
-Mingw32 package. I know there are many bugs and omissions, and I try to
-keep informed about them, so I do appreciate mail pointing them out.
-However I can’t fix these problems at the source. You should send email
-to Scott Christley (the author of the GPL windows32-api) or possibly to
-Cygnus. Sending email to me might get me to mention it on my homepage or
-fix it in my personal copy of the header files, but that’s about it
-(sorry).
-
-Aside from bug reports, suggestions for improvements, testing of the
-header files and otherwise praise or criticism is all welcome in my
-inbox.
-
-Good luck,
-Colin Peters (colin@bird.fu.is.saga-u.ac.jp)
-
diff --git a/winsup/mingw/samples/dirent/jamfile b/winsup/mingw/samples/dirent/jamfile
deleted file mode 100644
index c920ffe9b..000000000
--- a/winsup/mingw/samples/dirent/jamfile
+++ /dev/null
@@ -1,3 +0,0 @@
-
-Main test.exe : test.c ;
-
diff --git a/winsup/mingw/samples/dirent/test.c b/winsup/mingw/samples/dirent/test.c
deleted file mode 100644
index 9ff4267ee..000000000
--- a/winsup/mingw/samples/dirent/test.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * A test which demonstrates the use of opendir and related functions
- * declared in dirent.h.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#include <dirent.h>
-
-int
-main (int argc, char* argv[])
-{
- int i;
- struct dirent* de;
- DIR* dir;
- long lPos;
-
- if (argc == 2)
- {
- printf ("Opening directory \"%s\"\n", argv[1]);
- dir = opendir(argv[1]);
- }
- else
- {
- printf ("Opening \".\"\n");
- dir = opendir(".");
- }
-
- if (!dir)
- {
- printf ("Directory open failed!\n");
- if (errno)
- {
- printf ("Error : %s\n", strerror(errno));
- }
- return 1;
- }
-
- i = 0;
- lPos = -1;
-
- while (de = readdir (dir))
- {
- i++;
- printf ("%d : \"%s\" (tell %ld)\n", i, de->d_name,
- telldir(dir));
-
- if (i == 3)
- {
- printf ("We will seek here later.\n");
- lPos = telldir (dir);
- }
- }
-
- printf ("Rewind directory.\n");
- rewinddir (dir);
-
- if (de = readdir (dir))
- {
- printf ("First entry : \"%s\"\n", de->d_name);
- }
- else
- {
- printf ("Empty directory.\n");
- }
-
- if (lPos != -1)
- {
- printf ("Seeking to fourth entry.\n");
- seekdir (dir, lPos);
-
- if (de = readdir (dir))
- {
- printf ("Fourth entry : \"%s\"\n", de->d_name);
- }
- else
- {
- printf ("No fourth entry.\n");
- }
- }
- else
- {
- printf ("Seek position is past end of directory.\n");
- }
-
- printf ("Closing directory.\n");
- closedir (dir);
-}
-
diff --git a/winsup/mingw/samples/dirent/wtest.c b/winsup/mingw/samples/dirent/wtest.c
deleted file mode 100644
index 798544374..000000000
--- a/winsup/mingw/samples/dirent/wtest.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * A test which demonstrates the use of _wopendir and related
- * wide char functions declared in dirent.h.
- *
- * TODO: Make this _UNICODE neutral using tchar.h mappings.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <dirent.h>
-
-int
-main (int argc, char* argv[])
-{
- int i;
- struct _wdirent* de;
- _WDIR* dir;
- long lPos;
-
- if (argc == 2)
- {
- size_t len = strlen(argv[1]) + 1;
- wchar_t* wpath = (wchar_t*) malloc(len *sizeof(wchar_t));
- mbstowcs(wpath, argv[1], len);
- wprintf (L"Opening directory \"%s\"\n", wpath);
- dir = _wopendir(wpath);
- free (wpath);
- }
- else
- {
- wprintf (L"Opening \".\"\n");
- dir = _wopendir(L".");
- }
-
- if (!dir)
- {
- wprintf (L"Directory open failed!\n");
- if (errno)
- {
- wprintf (L"Error : %S\n", strerror(errno));
- }
- return 1;
- }
-
- i = 0;
- lPos = -1;
-
- while ((de = _wreaddir (dir)))
- {
- i++;
- wprintf (L"%d : \"%s\" (tell %ld)\n", i, de->d_name,
- _wtelldir(dir));
-
- if (i == 3)
- {
- wprintf (L"We will seek here later.\n");
- lPos = _wtelldir (dir);
- }
- }
-
- printf ("Rewind directory.\n");
- _wrewinddir (dir);
-
- if ((de = _wreaddir (dir)))
- {
- wprintf (L"First entry : \"%s\"\n", de->d_name);
- }
- else
- {
- wprintf (L"Empty directory.\n");
- }
-
- if (lPos != -1)
- {
- wprintf (L"Seeking to fourth entry.\n");
- _wseekdir (dir, lPos);
-
- if ((de = _wreaddir (dir)))
- {
- wprintf (L"Fourth entry : \"%s\"\n", de->d_name);
- }
- else
- {
- wprintf (L"No fourth entry.\n");
- }
- }
- else
- {
- wprintf (L"Seek position is past end of directory.\n");
- }
-
- wprintf (L"Closing directory.\n");
- _wclosedir (dir);
-return 0;
-}
-
diff --git a/winsup/mingw/samples/dlltest/dll.c b/winsup/mingw/samples/dlltest/dll.c
deleted file mode 100644
index 257b1b8ff..000000000
--- a/winsup/mingw/samples/dlltest/dll.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Source code of the functions inside our test DLL. Note that DllMain is
- * not required (it will be provided by the stub in libmingw32.a).
- */
-
-#if 0
-#include <windows.h>
-#endif
-
-int Add (int x, int y)
-{
- printf ("In add!\nx = %d\ny = %d\n", x, y);
- return (x + y);
-}
-
-
-double __attribute__((stdcall)) Sub (double x, double y)
-{
- printf ("In sub!\nx = %f\ny = %f\n", x, y);
- return (x - y);
-}
-
diff --git a/winsup/mingw/samples/dlltest/dll.def b/winsup/mingw/samples/dlltest/dll.def
deleted file mode 100644
index b20a405d8..000000000
--- a/winsup/mingw/samples/dlltest/dll.def
+++ /dev/null
@@ -1,3 +0,0 @@
-EXPORTS
-Add
-Sub@16
diff --git a/winsup/mingw/samples/dlltest/dll.h b/winsup/mingw/samples/dlltest/dll.h
deleted file mode 100644
index 8fac5332b..000000000
--- a/winsup/mingw/samples/dlltest/dll.h
+++ /dev/null
@@ -1,4 +0,0 @@
-
-int Add (int x, int y);
-double __attribute__((stdcall)) Sub (double x, double y);
-
diff --git a/winsup/mingw/samples/dlltest/exe.c b/winsup/mingw/samples/dlltest/exe.c
deleted file mode 100644
index d778348e4..000000000
--- a/winsup/mingw/samples/dlltest/exe.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <stdio.h>
-
-#include "dll.h"
-
-int main()
-{
- int i, j, k;
- double dk;
-
- i = 10;
- j = 13;
-
- k = Add(i, j);
-
- printf ("%d + %d = %d\n", i, j, k);
-
- dk = Sub(i, j);
-
- printf ("%d - %d = %f\n", i, j, dk);
-
- return 0;
-}
-
diff --git a/winsup/mingw/samples/dlltest/exe.exp b/winsup/mingw/samples/dlltest/exe.exp
deleted file mode 100644
index 887fdb0ac..000000000
--- a/winsup/mingw/samples/dlltest/exe.exp
+++ /dev/null
@@ -1,8 +0,0 @@
-In add!
-x = 10
-y = 13
-10 + 13 = 23
-In sub!
-x = 10
-y = 13
-10 - 13 = -3
diff --git a/winsup/mingw/samples/dlltest/expexe.c b/winsup/mingw/samples/dlltest/expexe.c
deleted file mode 100644
index d94ea1e7e..000000000
--- a/winsup/mingw/samples/dlltest/expexe.c
+++ /dev/null
@@ -1,17 +0,0 @@
-
-#include <stdio.h>
-
-int
-ExportedFromExe ()
-{
- printf ("This output produced by ExportedFromExe.\n");
- return 0;
-}
-
-int main()
-{
- printf ("Hello, world\n");
-
- return 0;
-}
-
diff --git a/winsup/mingw/samples/dlltest/expexe.def b/winsup/mingw/samples/dlltest/expexe.def
deleted file mode 100644
index 309f1508f..000000000
--- a/winsup/mingw/samples/dlltest/expexe.def
+++ /dev/null
@@ -1,2 +0,0 @@
-EXPORTS
-ExportedFromExe
diff --git a/winsup/mingw/samples/dlltest/jamfile b/winsup/mingw/samples/dlltest/jamfile
deleted file mode 100644
index 5278d0379..000000000
--- a/winsup/mingw/samples/dlltest/jamfile
+++ /dev/null
@@ -1,46 +0,0 @@
-
-# This option is required to successfully return doubles via STDCALL as in
-# Sub function in dll.c.
-CCFLAGS = -mno-fp-ret-in-387 ;
-
-Main exe.exe : exe.c ;
-
-LinkLibraries exe.exe : libdll.a ;
-
-DEPENDS exe.exe : dll.dll ;
-
-LINKFLAGS on exe.exe = $(LINKFLAGS) -L. ;
-
-
-Main loaddll.exe : loaddll.c ;
-
-DEPENDS loaddll.exe : dll.dll ;
-
-
-Dll dll.dll : dll.c ;
-
-ImportLib libdll.a : dll.def ;
-
-
-Main expexe.exe : expexe.c ;
-
-# Force the executable to include the expexe.def file.
-Exports expexe.exe : expexe.def ;
-
-Main loadexe.exe : loadexe.c ;
-
-DEPENDS loadexe.exe : expexe.exe ;
-
-
-Main silly.exe : silly.cpp ;
-
-LinkLibraries silly.exe : libsilly.a ;
-
-DEPENDS silly.exe : silly.dll ;
-
-LINKFLAGS on silly.exe += -L. ;
-
-Dll silly.dll : sillydll.cpp ;
-
-ImportLib libsilly.a : silly.def ;
-
diff --git a/winsup/mingw/samples/dlltest/loaddll.c b/winsup/mingw/samples/dlltest/loaddll.c
deleted file mode 100644
index ec69c9a7e..000000000
--- a/winsup/mingw/samples/dlltest/loaddll.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * This version attempts to load dll.dll dynamically, get the address of the
- * Add function, and then call it.
- */
-
-#include <stdio.h>
-#include <windows.h>
-
-int (*Add)(int x, int y);
-
-int main()
-{
- HINSTANCE hDll;
- int i, j, k;
-
- hDll = LoadLibrary ("dll.dll");
- if (!hDll)
- {
- printf ("Error %d loading dll.\n", GetLastError());
- exit (-1);
- }
-
- if (!(Add = GetProcAddress (hDll, "Add")))
- {
- printf ("Error %d getting Add function.\n", GetLastError());
- exit (-1);
- }
-
- i = 10;
- j = 13;
-
- k = Add(i, j);
-
- printf ("i %d, j %d, k %d\n", i, j, k);
-
- FreeLibrary (hDll);
-
- return 0;
-}
-
diff --git a/winsup/mingw/samples/dlltest/loadexe.c b/winsup/mingw/samples/dlltest/loadexe.c
deleted file mode 100644
index 2ee4e8483..000000000
--- a/winsup/mingw/samples/dlltest/loadexe.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * This program attempts to load expexe.exe dynamically, get the address of the
- * ExportedFromExe function, and then call it.
- *
- * This example DOES NOT WORK! I don't know exactly what can be done, but
- * it simply seems that LoadLibrary refuses to load executables.
- */
-
-#include <stdio.h>
-#include <windows.h>
-
-int (*ExportedFromExe)();
-
-int main()
-{
- HINSTANCE hDll;
- int i, j, k;
-
- hDll = LoadLibrary ("expexe.exe");
- if (!hDll)
- {
- printf ("Error %d loading exe.\n", GetLastError());
- exit (-1);
- }
-
- if (!(ExportedFromExe = GetProcAddress (hDll, "ExportedFromExe")))
- {
- printf ("Error %d getting ExportedFromExe function.\n",
- GetLastError());
- exit (-1);
- }
- else
- {
- ExportedFromExe ();
- }
-
- /* NOTE: Unlike a DLL the exe doesn't have an entry point which
- * initializes global objects and adds __do_global_dtors to
- * the atexit list. Thus it should be safe(?) to free the
- * library. Of course, this also makes it unsafe to use
- * executables at all in this manner.
- */
- FreeLibrary (hDll);
-
- return 0;
-}
-
diff --git a/winsup/mingw/samples/dlltest/readme.txt b/winsup/mingw/samples/dlltest/readme.txt
deleted file mode 100644
index 3d3101326..000000000
--- a/winsup/mingw/samples/dlltest/readme.txt
+++ /dev/null
@@ -1,39 +0,0 @@
-This directory contains two examples of building DLLs. The exe.c and dll.c
-files are used to build a very simple example DLL with a function that
-adds two numbers together (and prints some text at the same time). The
-exe.c program links to the DLL and prints the results of the function
-call.
-
-The C++ example "silly" is more interesting because it involves a DLL which
-contains the code for a C++ class. The CSilly class has all of its code in
-the sillydll.cpp source file, which is used to build the silly.dll. The
-silly.cpp source code builds the main silly.exe executable which makes a
-dynamic instance of the object and calls its member functions.
-
-The C++ silly.def file was generated by doing a nm of sillydll.o after it
-was generated and then getting the symbol names from that. Removing the
-leading underscore produces the appropriate name to include in the EXPORTS
-section. Notice there are a few weird functions.
-
-Since there are now several different versions of the GNU compiler capable
-of doing this, and they each seem to have different requirements for exports
-for classes, it has gotten kind of messy. The silly.def file here is for
-use with the native Mingw32 build of the EGCS version of GCC. The silly.def.old
-file was the def file I used when I was using Jan-Jaap's Mingw32 native port
-of GCC. The Cygnus version is different again, if I recall correctly, but I
-don't have it hanging around anymore.
-
-The jamfile builds all the components from the raw sources.
-
-The expected output of exe.exe and silly.exe are in the files exe.exp
-and silly.exp.
-
-
-The source code in this directory is in the PUBLIC DOMAIN and can be
-used or abused as you see fit. There is NO WARRANTY for this code,
-including (but not limited to) implied warranties of MERCHANTABILITY
-or FITNESS FOR A PARTICULAR PURPOSE.
-
-
-Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
-
diff --git a/winsup/mingw/samples/dlltest/silly.cpp b/winsup/mingw/samples/dlltest/silly.cpp
deleted file mode 100644
index ee9e1fe77..000000000
--- a/winsup/mingw/samples/dlltest/silly.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// C++ test of a dll which contains a C++ class.
-//
-
-#include <stdlib.h>
-#include <stdio.h>
-
-// Interface of class.
-#include "silly.h"
-
-#ifdef DERIVED_TEST
-// Here is a derived class too.
-class CMoreSilly : public CSilly
-{
- public:
- CMoreSilly (char* szNewName) : CSilly (szNewName) {};
- ~CMoreSilly ();
-
- WhatsYourName();
-};
-
-CMoreSilly::
-~CMoreSilly ()
-{
- printf ("In CMoreSilly \"%s\" destructor!\n", szName);
-}
-
-CMoreSilly::
-WhatsYourName ()
-{
- printf ("I'm more silly and my name is \"%s\"\n", szName);
-}
-#endif
-
-int
-main ()
-{
- CSilly* psilly = new CSilly("silly");
-
- psilly->WhatsYourName();
- psilly->Poke(); // Poke him, he should say "Ouch!"
- psilly->Stab(4); // Stab him four times he should say "Ugh!!!!"
-
- delete psilly;
-
-#ifdef DERIVED_TEST
- psilly = new CMoreSilly("more silly");
- psilly->WhatsYourName();
- psilly->Stab(5);
- delete psilly;
-#endif
-
- return 0;
-}
-
diff --git a/winsup/mingw/samples/dlltest/silly.def b/winsup/mingw/samples/dlltest/silly.def
deleted file mode 100644
index a766ff94f..000000000
--- a/winsup/mingw/samples/dlltest/silly.def
+++ /dev/null
@@ -1,11 +0,0 @@
-EXPORTS
-DllMain@12
-Poke__6CSilly
-Stab__6CSillyi
-WhatsYourName__6CSilly
-_$_6CSilly
-__6CSilly
-__6CSillyPc
-__tf6CSilly
-__ti6CSilly
-_vt$6CSilly
diff --git a/winsup/mingw/samples/dlltest/silly.exp b/winsup/mingw/samples/dlltest/silly.exp
deleted file mode 100644
index ab544f97f..000000000
--- a/winsup/mingw/samples/dlltest/silly.exp
+++ /dev/null
@@ -1,8 +0,0 @@
-I'm silly.
-Ouch!
-Ugh!!!!
-In CSilly destructor.
-I'm more silly and my name is "more silly"
-Ugh!!!!!
-In CMoreSilly "more silly" destructor!
-In CSilly destructor.
diff --git a/winsup/mingw/samples/dlltest/silly.h b/winsup/mingw/samples/dlltest/silly.h
deleted file mode 100644
index d3f99bed8..000000000
--- a/winsup/mingw/samples/dlltest/silly.h
+++ /dev/null
@@ -1,27 +0,0 @@
-
-#define DERIVED_TEST 1
-
-class CSilly
-{
- protected:
- char* szName;
-
- public:
- CSilly();
- CSilly(char* szName);
-#ifdef DERIVED_TEST
- virtual ~CSilly();
-#else
- ~CSilly();
-#endif
-
- Poke ();
- Stab (int nTimes);
-#ifdef DERIVED_TEST
- virtual WhatsYourName ();
-#else
- WhatsYourName ();
-#endif
-
-};
-
diff --git a/winsup/mingw/samples/dlltest/sillydll.cpp b/winsup/mingw/samples/dlltest/sillydll.cpp
deleted file mode 100644
index 87385e584..000000000
--- a/winsup/mingw/samples/dlltest/sillydll.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <windows.h>
-
-
-#if 0
-#define STREAMS_VERSION
-#endif
-
-#if defined(STREAMS_VERSION)
-#include <iostream.h>
-#endif
-
-#include "silly.h"
-
-extern "C"
-BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
-{
- return TRUE;
-}
-
-CSilly::
-CSilly()
-{
- szName = NULL;
-}
-
-CSilly::
-CSilly(char* new_szName)
-{
- szName = new char[strlen(new_szName)+1];
-
- if (szName)
- {
- strcpy (szName, new_szName);
- }
-}
-
-CSilly::
-~CSilly()
-{
- printf ("In CSilly destructor.\n");
- if (szName)
- {
- delete szName;
- }
-}
-
-CSilly::
-Poke ()
-{
-#ifndef STREAMS_VERSION
- printf ("Ouch!\n");
-#else
- cout << "Ouch!" << endl;
-#endif
-}
-
-CSilly::
-Stab (int nTimes)
-{
-#ifndef STREAMS_VERSION
- printf ("Ugh");
-#else
- cout << "Ugh";
-#endif
-
- int i;
- for (i = 0; i < nTimes; i++)
- {
-#ifndef STREAMS_VERSION
- putchar('!');
-#else
- cout << '!' ;
-#endif
- }
-
-#ifndef STREAMS_VERSION
- putchar('\n');
-#else
- cout << endl;
-#endif
-}
-
-CSilly::
-WhatsYourName ()
-{
- if (szName)
- {
-#ifndef STREAMS_VERSION
- printf ("I'm %s.\n", szName);
-#else
- cout << "I'm " << szName << "." << endl;
-#endif
- }
- else
- {
-#ifndef STREAMS_VERSION
- printf ("I have no name.\n");
-#else
- cout << "I have no name." << endl;
-#endif
- }
-}
-
diff --git a/winsup/mingw/samples/filehand/filehand.c b/winsup/mingw/samples/filehand/filehand.c
deleted file mode 100644
index 2af69b371..000000000
--- a/winsup/mingw/samples/filehand/filehand.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * An example showing how you can obtain the UNIX-ish file number from a
- * FILE* and in turn how you can get the Win32 HANDLE of the file from
- * the file number.
- *
- * This code is in the PUBLIC DOMAIN and has NO WARRANTY.
- *
- * Colin Peters <colin@fu.is.saga-u.ac.jp>
- */
-
-#include <stdio.h>
-#include <io.h>
-#include <windows.h>
-
-int
-main (int argc, char* argv[])
-{
- char* szFileName;
- FILE* fileIn;
- int fnIn;
- HANDLE hFileIn;
- char caBuf[81];
- int nRead;
-
- if (argc >= 2)
- {
- szFileName = argv[1];
- }
- else
- {
- szFileName = "junk.txt";
- }
-
- fileIn = fopen (szFileName, "r");
-
- if (!fileIn)
- {
- printf ("Could not open %s for reading\n", szFileName);
- exit(1);
- }
-
- fnIn = fileno (fileIn);
- hFileIn = (HANDLE) _get_osfhandle (fnIn);
-
- printf ("OS file handle %d\n", (int) hFileIn);
-
- ReadFile (hFileIn, caBuf, 80, &nRead, NULL);
-
- printf ("Read %d bytes using ReadFile.\n", nRead);
-
- caBuf[nRead] = '\0';
-
- printf ("\"%s\"\n", caBuf);
-
- fclose (fileIn);
-}
-
diff --git a/winsup/mingw/samples/filehand/jamfile b/winsup/mingw/samples/filehand/jamfile
deleted file mode 100644
index 3b2c726de..000000000
--- a/winsup/mingw/samples/filehand/jamfile
+++ /dev/null
@@ -1,3 +0,0 @@
-
-Main filehand.exe : filehand.c ;
-
diff --git a/winsup/mingw/samples/filehand/junk.txt b/winsup/mingw/samples/filehand/junk.txt
deleted file mode 100644
index 6de7b8c69..000000000
--- a/winsup/mingw/samples/filehand/junk.txt
+++ /dev/null
@@ -1 +0,0 @@
-This is a test file.
diff --git a/winsup/mingw/samples/fixargv/fixargv.c b/winsup/mingw/samples/fixargv/fixargv.c
deleted file mode 100644
index c2e2a41e6..000000000
--- a/winsup/mingw/samples/fixargv/fixargv.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * fixargv.c
- *
- * A special function which "fixes" an argv array by replacing arguments
- * that need quoting with quoted versions.
- *
- * NOTE: In order to be reasonably consistent there is some misuse of the
- * const keyword here-- which leads to compilation warnings. These
- * should be ok to ignore.
- *
- * This is a sample distributed as part of the Mingw32 package.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAMED. This includes but is not limited to warrenties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#include <string.h>
-#include "fixargv.h"
-
-/*
- * This takes a single string and fixes it, enclosing it in quotes if it
- * contains any spaces and/or escaping the quotes it contains.
- */
-char*
-fix_arg (const char* szArg)
-{
- int nQuoteAll; /* Does the whole arg need quoting? */
- int nBkSlRun; /* How may backslashes in a row? */
- char* sz;
- char* szNew;
- size_t sizeLen;
-
- nQuoteAll = 0;
- nBkSlRun = 0;
- sz = szArg;
- sizeLen = 1;
-
- /* First we figure out how much bigger the new string has to be
- * than the old one. */
- while (*sz != '\0')
- {
- /*
- * Arguments containing whitespace of wildcards will be
- * quoted to preserve tokenization and/or those special
- * characters (i.e. wildcarding will NOT be done at the
- * other end-- they will get the * and ? characters as is).
- * TODO: Is this the best way? Do we want to enable wildcards?
- * If so, when?
- */
- if (!nQuoteAll &&
- (*sz == ' ' || *sz == '\t' || *sz == '*' || *sz == '?'))
- {
- nQuoteAll = 1;
- }
- else if (*sz == '\\')
- {
- nBkSlRun++;
- }
- else
- {
- if (*sz == '\"')
- {
- sizeLen += nBkSlRun + 1;
- }
- nBkSlRun = 0;
- }
-
- sizeLen++;
- sz++;
- }
-
- if (nQuoteAll)
- {
- sizeLen += 2;
- }
-
- /*
- * Make a new string big enough.
- */
- szNew = (char*) malloc (sizeLen);
- if (!szNew)
- {
- return NULL;
- }
- sz = szNew;
-
- /* First enclosing quote for fully quoted args. */
- if (nQuoteAll)
- {
- *sz = '\"';
- sz++;
- }
-
- /*
- * Go through the string putting backslashes in front of quotes,
- * and doubling all backslashes immediately in front of quotes.
- */
- nBkSlRun = 0;
- while (*szArg != '\0')
- {
- if (*szArg == '\\')
- {
- nBkSlRun++;
- }
- else
- {
- if (*szArg == '\"')
- {
- while (nBkSlRun > 0)
- {
- *sz = '\\';
- sz++;
- nBkSlRun--;
- }
- *sz = '\\';
- sz++;
- }
- nBkSlRun = 0;
- }
-
- *sz = *szArg;
- sz++;
- szArg++;
- }
-
- /* Closing quote for fully quoted args. */
- if (nQuoteAll)
- {
- *sz = '\"';
- sz++;
- }
-
- *sz = '\0';
- return szNew;
-}
-
-/*
- * Takes argc and argv and returns a new argv with escaped members. Pass
- * this fixed argv (along with the old one) to free_fixed_argv after
- * you finish with it. Pass in an argc of -1 and make sure the argv vector
- * ends with a null pointer to have fix_argv count the arguments for you.
- */
-char* const*
-fix_argv (int argc, char* const* szaArgv)
-{
- char** szaNew;
- char* sz;
- int i;
-
- if (!szaArgv)
- {
- return NULL;
- }
-
- /*
- * Count the arguments if asked.
- */
- if (argc == -1)
- {
- for (i = 0; szaArgv[i]; i++)
- ;
-
- argc = i;
- }
-
- /*
- * If there are no args or only one arg then do no escaping.
- */
- if (argc < 2)
- {
- return szaArgv;
- }
-
- for (i = 1, szaNew = NULL; i < argc; i++)
- {
- sz = szaArgv[i];
-
- /*
- * If an argument needs fixing, then fix it.
- */
- if (strpbrk (sz, "\" \t*?"))
- {
- /*
- * If we haven't created a new argv list already
- * then make one.
- */
- if (!szaNew)
- {
- szaNew = (char**) malloc ((argc + 1) *
- sizeof (char*));
- if (!szaNew)
- {
- return NULL;
- }
-
- /*
- * Copy previous args from old to new.
- */
- memcpy (szaNew, szaArgv, sizeof(char*) * i);
- }
-
- /*
- * Now do the fixing.
- */
- szaNew[i] = fix_arg (sz);
- if (!szaNew[i])
- {
- /* Fixing failed, free up and return error. */
- free_fixed_argv (szaNew, szaArgv);
- return NULL;
- }
- }
- else if (szaNew)
- {
- szaNew[i] = sz;
- }
- }
-
- if (szaNew)
- {
- /* If we have created a new argv list then we might as well
- * terminate it nicely. (And we depend on it in
- * free_fixed_argv.) */
- szaNew[argc] = NULL;
- }
- else
- {
- /* If we didn't create a new argv list then return the
- * original. */
- return szaArgv;
- }
-
- return szaNew;
-}
-
-void
-free_fixed_argv (char* const* szaFixed, char* const* szaOld)
-{
- char* const* sza;
-
- /*
- * Check for error conditions. Also note that if no corrections
- * were required the fixed argv will actually be the same as
- * the old one, and we don't need to do anything.
- */
- if (!szaFixed || !szaOld || szaFixed == szaOld)
- {
- return;
- }
-
- /*
- * Go through all members of the argv list. If any of the
- * members in the fixed list are different from the old
- * list we free those members.
- * NOTE: The first member is never modified, so we don't need to
- * check.
- */
- sza = szaFixed + 1;
- szaOld++;
- while (*sza)
- {
- if (*sza != *szaOld)
- {
- free (*sza);
- }
- sza++;
- szaOld++;
- }
-
- /*
- * Now we can free the array of char pointers itself.
- */
- free (szaFixed);
-}
-
diff --git a/winsup/mingw/samples/fixargv/fixargv.h b/winsup/mingw/samples/fixargv/fixargv.h
deleted file mode 100644
index e4a83fae1..000000000
--- a/winsup/mingw/samples/fixargv/fixargv.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * fixargv.h
- *
- * Prototypes of utility functions for 'properly' escaping argv vectors.
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#ifndef _FIXARGV_H_
-#define _FIXARGV_H_
-
-char* fix_arg (const char* szArg);
-char* const* fix_argv (int argc, char* const* szaArgv);
-void free_fixed_argv (char* const* szaFixed, char* const* szaOld);
-
-#endif
diff --git a/winsup/mingw/samples/fixargv/readme.txt b/winsup/mingw/samples/fixargv/readme.txt
deleted file mode 100644
index 555ef9bde..000000000
--- a/winsup/mingw/samples/fixargv/readme.txt
+++ /dev/null
@@ -1,85 +0,0 @@
-
-This code is a utility function I was considering adding to Mingw32. The
-Microsoft versions of argc, argv construction use quotes and backslashes
-to allow the user to pass arguments containing spaces (or quotes) to
-programs they invoke. The rules are
-
- - Arguments containing spaces must be enclosed in quotes.
- - A quote can be passed by preceeding it with a backslash.
- - Backslashes immediately preceeding a quote must be doubled to avoid
- escaping the quote.
-
-Thus an argument like:
-
- -D="Foo Bar\\"
-
-needs to be mangled as:
-
- "-D\"Foo Bar\\\\\""
-
-in order to get to the program as what was intended above.
-
-The fix_argv set of functions is meant to be used with spawnv and the
-like to allow a program to set up an argv array for the spawned program
-and have that array duplicated *exactly* in the spawned program, no
-matter what it contains (it also quotes 'globbing' characters like *
-and ?, so it does not matter if the destination has globbing turned on
-or not; it might be a reasonable extension to allow a flag to allow
-globbing characters to pass through unmolested, but they would still
-be quoted if the string contained whitespace).
-
-The reason for writing this came up because of problems with arguments
-like -DBLAH="Foo Bar" to GCC (define BLAH as a preprocessor constant
-being the string "Foo Bar", including the quotes). Because GCC simply
-passes the argument directly to CPP (the preprocessor) it had to be
-escaped *twice*:
-
- "-DBLAH=\"\\\"Foo Bar\\\"\""
-
-This would reach GCC as
-
- -DBLAH="\"Foo Bar\""
-
-And that would reach CPP as the desired
-
- -DBLAH="Foo Bar"
-
-One level of quoting and escaping is to be expected (although MS's
-standard is, arguably, not very good), but forcing the user to know
-how many different programs the argument is going to pass through,
-and perform double quoting and escaping, seems unreasonable. If
-GCC and friends all used fix_argv (they use their own version of
-it now) then the original argument could be
-
- "-DBLAH=\"Foo Bar\""
-
-And that would work fine, no matter how many different tools it
-passed through.
-
-The only basic limitation with this code is that it assumes that all
-the spawned programs use Microsoft-type escaping when interpreting
-their command line. Most programs on Win32 machines do (anything
-compiled with Mingw32 will).
-
-For now, this code has been relegated to 'sample' status. If you want
-to use it, feel free (it is public domain after all).
-
-Colin.
-
-P.S. Just out of interest you might try writing your own little program
- to look at the interaction of wildcards and quotes. Use the glob.exe
- program in ../globbing and see what it does with
-
- glob "foo*.txt"
-
- even if there are files foo.txt and foobar.txt in the same directory.
-
- Note that
-
- del "My *.txt"
-
- works (i.e. it deletes all files starting with My<space>). This could
- not be done unless del does globbing *after* processing escapes and
- quotes, which is not the way it seems to work normally (again see
- the glob example).
-
diff --git a/winsup/mingw/samples/fmode/all.c b/winsup/mingw/samples/fmode/all.c
deleted file mode 100644
index a6f7d51f7..000000000
--- a/winsup/mingw/samples/fmode/all.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * A sample program demonstrating how to use _CRT_fmode to change the default
- * file opening mode to binary AND change stdin, stdout and stderr. Redirect
- * stdout to a file from the command line to see the difference.
- *
- * Also try directing a file into stdin. If you type into stdin you will get
- * \r\n at the end of every line... unlike UNIX. But at least if you
- * redirect a file in you will get exactly the characters in the file as input.
- *
- * THIS CODE IS IN THE PUBLIC DOMAIN.
- *
- * Colin Peters <colin@fu.is.saga-u.ac.jp>
- */
-
-#include <stdio.h>
-#include <fcntl.h>
-
-unsigned int _CRT_fmode = _O_BINARY;
-
-main ()
-{
- char* sz = "This is line one.\nThis is line two.\n";
- FILE* fp;
- int c;
-
- printf (sz);
-
- /* Note how this fopen does NOT indicate "wb" to open the file in
- * binary mode. */
- fp = fopen ("all.out", "w");
-
- fprintf (fp, sz);
-
- fclose (fp);
-
- if (_isatty (_fileno(stdin)))
- {
- fprintf (stderr, "Waiting for input, press Ctrl-Z to finish.\n");
- }
-
- while ((c = fgetc(stdin)) != EOF)
- {
- printf ("\'%c\' %02X\n", (char) c, c);
- }
-}
-
diff --git a/winsup/mingw/samples/fmode/jamfile b/winsup/mingw/samples/fmode/jamfile
deleted file mode 100644
index 33455ec59..000000000
--- a/winsup/mingw/samples/fmode/jamfile
+++ /dev/null
@@ -1,5 +0,0 @@
-
-Main test.exe : test.c ;
-
-Main all.exe : all.c ;
-
diff --git a/winsup/mingw/samples/fmode/readme.txt b/winsup/mingw/samples/fmode/readme.txt
deleted file mode 100644
index b865bfd4e..000000000
--- a/winsup/mingw/samples/fmode/readme.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-
-These two demos show how _fmode and _CRT_fmode can be used to modify the
-default file opening mode (text vs. binary) and/or the mode of the standard
-file handles.
-
diff --git a/winsup/mingw/samples/fmode/test.c b/winsup/mingw/samples/fmode/test.c
deleted file mode 100644
index b0488b2ea..000000000
--- a/winsup/mingw/samples/fmode/test.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * A sample program demonstrating how to use fmode to change the default
- * file opening mode to binary. NOTE: Does not change stdin, stdout or
- * stderr.
- *
- * THIS CODE IS IN THE PUBLIC DOMAIN.
- *
- * Colin Peters <colin@fu.is.saga-u.ac.jp>
- */
-
-#include <stdio.h>
-#include <fcntl.h> /* Required to get _fmode and _O_BINARY */
-
-main ()
-{
- char* sz = "This is line one.\nThis is line two.\n";
- FILE* fp;
-
- _fmode = _O_BINARY;
-
- printf (sz);
-
- /* Note how this fopen does NOT indicate "wb" to open the file in
- * binary mode. */
- fp = fopen ("test.out", "w");
-
- fprintf (fp, sz);
-
- fclose (fp);
-}
-
diff --git a/winsup/mingw/samples/globbing/glob.c b/winsup/mingw/samples/globbing/glob.c
deleted file mode 100644
index 6bf8acaee..000000000
--- a/winsup/mingw/samples/globbing/glob.c
+++ /dev/null
@@ -1,20 +0,0 @@
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <windows.h>
-
-int
-main (int argc, char* argv[])
-{
- int i;
-
- printf ("Command line (via GetCommandLine) \"%s\"\n",
- GetCommandLine());
-
- for (i = 0; i < argc; i++)
- {
- printf ("Argv[%d] \"%s\"\n", i, argv[i]);
- }
-
- return 0;
-}
diff --git a/winsup/mingw/samples/globbing/jamfile b/winsup/mingw/samples/globbing/jamfile
deleted file mode 100644
index ff3a585d6..000000000
--- a/winsup/mingw/samples/globbing/jamfile
+++ /dev/null
@@ -1,11 +0,0 @@
-
-Object glob.o : glob.c ;
-
-MainFromObjects glob.exe : glob.o ;
-
-Main noglob.exe : noglob.c ;
-
-LIBDIR = \\mingw32\\lib\\ ;
-
-MainFromObjects CRTnoglob.exe : glob.o $(LIBDIR)CRT_noglob.o ;
-
diff --git a/winsup/mingw/samples/globbing/noglob.c b/winsup/mingw/samples/globbing/noglob.c
deleted file mode 100644
index 8bc4c82a3..000000000
--- a/winsup/mingw/samples/globbing/noglob.c
+++ /dev/null
@@ -1,22 +0,0 @@
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <windows.h>
-
-/* This line turns off automatic command line globbing. */
-int _CRT_glob = 0;
-
-int
-main (int argc, char* argv[])
-{
- int i;
-
- printf ("Command line (via GetCommandLine) \"%s\"\n",
- GetCommandLine());
- for (i = 0; i < argc; i++)
- {
- printf ("Argv[%d] \"%s\"\n", i, argv[i]);
- }
-
- return 0;
-}
diff --git a/winsup/mingw/samples/globbing/readme.txt b/winsup/mingw/samples/globbing/readme.txt
deleted file mode 100644
index 5e20de826..000000000
--- a/winsup/mingw/samples/globbing/readme.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-
-This directory contains samples which demonstrate default (globbing on)
-behavior, how to turn the globbing off with the _CRT_glob variable, and
-how to turn it off with the CRT_noglob object file.
-
-Run jam and then run glob, noglob and CRTnoglob with an argument like
-*.* to see the difference.
-
-The code in this directory is in the PUBLIC DOMAIN. It has NO WARRANTY,
-including, but not restricted to, warranties of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.
-
-Colin Peters <colin@bird.fu.is.saga-u.ac.jp>.
-
diff --git a/winsup/mingw/samples/print/jamfile b/winsup/mingw/samples/print/jamfile
deleted file mode 100644
index b77e6d66b..000000000
--- a/winsup/mingw/samples/print/jamfile
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-# A simple example which prints a message on a selected printer. This won't
-# work right unless you make PRINTDLG a packed structure!
-#
-
-Main prntest.exe : prntest.c ;
-
-Gui prntest.exe ;
-
diff --git a/winsup/mingw/samples/print/prntest.c b/winsup/mingw/samples/print/prntest.c
deleted file mode 100644
index a70e7ed5d..000000000
--- a/winsup/mingw/samples/print/prntest.c
+++ /dev/null
@@ -1,65 +0,0 @@
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <windows.h>
-
-main ()
-{
- PRINTDLG pd;
- DOCINFO di;
- char* szMessage;
-
- memset (&pd, 0, sizeof(PRINTDLG));
- memset (&di, 0, sizeof(DOCINFO));
-
- di.cbSize = sizeof(DOCINFO);
- di.lpszDocName = "Test";
-
- pd.lStructSize = sizeof(PRINTDLG);
- pd.Flags = PD_PAGENUMS | PD_RETURNDC;
- pd.nFromPage = 1;
- pd.nToPage = 1;
- pd.nMinPage = 1;
- pd.nMaxPage = 1;
-
- szMessage = 0;
-
- if (PrintDlg (&pd))
- {
- if (pd.hDC)
- {
- if (StartDoc (pd.hDC, &di) != SP_ERROR)
- {
- StartPage (pd.hDC);
-
- TextOut (pd.hDC, 0, 0, "Hello, printer!", 15);
-
- EndPage (pd.hDC);
-
- EndDoc (pd.hDC);
-
- szMessage = "Printed.";
- }
- else
- {
- szMessage = "Could not start document.";
- }
- }
- else
- {
- szMessage = "Could not create device context.";
- }
- }
- else
- {
- szMessage = "Canceled or printer could not be setup.";
- }
-
- if (szMessage)
- {
- MessageBox (NULL, szMessage, "Print Test", MB_OK);
- }
-
- return 0;
-}
diff --git a/winsup/mingw/samples/seh/eh3.c b/winsup/mingw/samples/seh/eh3.c
deleted file mode 100644
index 49a06ceab..000000000
--- a/winsup/mingw/samples/seh/eh3.c
+++ /dev/null
@@ -1,112 +0,0 @@
-int
-__except_handler3(
- struct _EXCEPTION_RECORD* pExceptionRecord,
- struct EXCEPTION_REGISTRATION* pRegistrationFrame,
- struct _CONTEXT* pContextRecord,
- void* pDispatcherContext
- )
-{
- LONG filterFuncRet;
- LONG trylevel;
- EXCEPTION_POINTERS exceptPtrs;
- PSCOPETABLE pScopeTable;
-
-
- CLD // Clear the direction flag (make no assumptions!)
-
- // if neither the EXCEPTION_UNWINDING nor EXCEPTION_EXIT_UNWIND bit
- // is set... This is true the first time through the handler (the
- // non-unwinding case)
-
- if ( ! (pExceptionRecord->ExceptionFlags
- & (EXCEPTION_UNWINDING | EXCEPTION_EXIT_UNWIND)
- ) )
- {
- // Build the EXCEPTION_POINTERS structure on the stack
- exceptPtrs.ExceptionRecord = pExceptionRecord;
- exceptPtrs.ContextRecord = pContextRecord;
-
- // Put the pointer to the EXCEPTION_POINTERS 4 bytes below the
- // establisher frame. See ASM code for GetExceptionInformation
- *(PDWORD)((PBYTE)pRegistrationFrame - 4) = &exceptPtrs;
-
- // Get initial "trylevel" value
- trylevel = pRegistrationFrame->trylevel
-
- // Get a pointer to the scopetable array
- scopeTable = pRegistrationFrame->scopetable;
-
-search_for_handler:
- if ( pRegistrationFrame->trylevel != TRYLEVEL_NONE )
- {
- if ( pRegistrationFrame->scopetable[trylevel].lpfnFilter )
- {
-
- PUSH EBP // Save this frame EBP
-
- // !!!Very Important!!! Switch to original EBP. This is
- // what allows all locals in the frame to have the same
- // value as before the exception occurred.
-
- EBP = &pRegistrationFrame->_ebp
-
- // Call the filter function
- filterFuncRet = scopetable[trylevel].lpfnFilter();
-
- POP EBP // Restore handler frame EBP
-
- if ( filterFuncRet != EXCEPTION_CONTINUE_SEARCH )
- {
- if ( filterFuncRet < 0 ) // EXCEPTION_CONTINUE_EXECUTION
- return ExceptionContinueExecution;
-
- // If we get here, EXCEPTION_EXECUTE_HANDLER was specified
- scopetable == pRegistrationFrame->scopetable
-
- // Does the actual OS cleanup of registration frames
- // Causes this function to recurse
- __global_unwind2( pRegistrationFrame );
-
-
- // Once we get here, everything is all cleaned up, except
- // for the last frame, where we'll continue execution
- EBP = &pRegistrationFrame->_ebp
-
- __local_unwind2( pRegistrationFrame, trylevel );
-
- // NLG == "non-local-goto" (setjmp/longjmp stuff)
- __NLG_Notify( 1 ); // EAX == scopetable->lpfnHandler
-
- // Set the current trylevel to whatever SCOPETABLE entry
- // was being used when a handler was found
- pRegistrationFrame->trylevel = scopetable->previousTryLevel;
-
- // Call the _except {} block. Never returns.
- pRegistrationFrame->scopetable[trylevel].lpfnHandler();
- }
- }
-
- scopeTable = pRegistrationFrame->scopetable;
- trylevel = scopeTable->previousTryLevel
-
- goto search_for_handler;
- }
- else // trylevel == TRYLEVEL_NONE
- {
- retvalue == DISPOSITION_CONTINUE_SEARCH;
- }
- }
- else // EXCEPTION_UNWINDING or EXCEPTION_EXIT_UNWIND flags are set
- {
- PUSH EBP // Save EBP
-
- EBP = pRegistrationFrame->_ebp // Set EBP for __local_unwind2
-
- __local_unwind2( pRegistrationFrame, TRYLEVEL_NONE )
-
- POP EBP // Restore EBP
-
- retvalue == DISPOSITION_CONTINUE_SEARCH;
- }
-}
-
diff --git a/winsup/mingw/samples/seh/exutil.c b/winsup/mingw/samples/seh/exutil.c
deleted file mode 100644
index 187242cd5..000000000
--- a/winsup/mingw/samples/seh/exutil.c
+++ /dev/null
@@ -1,68 +0,0 @@
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <excpt.h>
-#include <windows.h>
-
-#include "exutil.h"
-
-void
-WalkExceptionHandlers ()
-{
- PEXCEPTION_REGISTRATION_RECORD p;
- int i;
-
- __asm__("movl %%fs:0,%%eax;movl %%eax,%0" : "=g" (p) : : "%eax");
-
- i = 0;
- while (p != (PEXCEPTION_REGISTRATION_RECORD) -1 && p)
- {
- printf ("Registration %d at %08x : ", i, p);
- printf ("Handler = %08x ", p->handler);
- printf ("Next Registration = %08x\n", p->prev);
- p = p->prev;
- i++;
- }
- printf ("End of exception handler list.\n");
- fflush (stdout);
-}
-
-void
-DumpExceptionRecord (struct _EXCEPTION_RECORD* pExRec)
-{
- printf ("Exception: Code = %08x Flags %08x", pExRec->ExceptionCode,
- pExRec->ExceptionFlags);
-
- if (pExRec->ExceptionFlags)
- {
- printf (" ( ");
- if (pExRec->ExceptionFlags & EH_NONCONTINUABLE)
- {
- printf ("EH_NONCONTINUABLE ");
- }
- if (pExRec->ExceptionFlags & EH_UNWINDING)
- {
- printf ("EH_UNWINDING ");
- }
- if (pExRec->ExceptionFlags & EH_EXIT_UNWIND)
- {
- printf ("EH_EXIT_UNWIND ");
- }
- if (pExRec->ExceptionFlags & EH_STACK_INVALID)
- {
- printf ("EH_STACK_INVALID ");
- }
- if (pExRec->ExceptionFlags & EH_NESTED_CALL)
- {
- printf ("EH_NESTED_CALL ");
- }
- printf (")\n");
- }
- else
- {
- printf ("\n");
- }
-
- fflush(stdout);
-}
-
diff --git a/winsup/mingw/samples/seh/exutil.def b/winsup/mingw/samples/seh/exutil.def
deleted file mode 100644
index a474be7e5..000000000
--- a/winsup/mingw/samples/seh/exutil.def
+++ /dev/null
@@ -1,3 +0,0 @@
-EXPORTS
- WalkExceptionHandlers
- DumpExceptionRecord
diff --git a/winsup/mingw/samples/seh/exutil.h b/winsup/mingw/samples/seh/exutil.h
deleted file mode 100644
index a56155b96..000000000
--- a/winsup/mingw/samples/seh/exutil.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Definitions of some internal stuff for exception handling, including
- * a version of the all-important EXCEPTION_REGISTRATION_RECORD.
- */
-
-#ifndef _EXUTIL_H_
-#define _EXUTIL_H_
-
-#include <windows.h>
-#include <excpt.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void WalkExceptionHandlers ();
-void DumpExceptionRecord (struct _EXCEPTION_RECORD* pExRec);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/winsup/mingw/samples/seh/jamfile b/winsup/mingw/samples/seh/jamfile
deleted file mode 100644
index 04d83c770..000000000
--- a/winsup/mingw/samples/seh/jamfile
+++ /dev/null
@@ -1,13 +0,0 @@
-
-Dll exutil.dll : exutil.c ;
-
-ImportLib libexutil.a : exutil.def ;
-
-Main sehtest.exe : sehtest.c ;
-
-Main sehfix.exe : sehfix.c ;
-
-Main sehsub.exe : sehsub.c ;
-
-LinkLibraries sehtest.exe sehfix.exe sehsub.exe : libexutil.a ;
-
diff --git a/winsup/mingw/samples/seh/sehfix.c b/winsup/mingw/samples/seh/sehfix.c
deleted file mode 100644
index be527ab0d..000000000
--- a/winsup/mingw/samples/seh/sehfix.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * sehfix.c
- *
- * A test program involving an exception handler that fixes the exception
- * causing condition.
- *
- * In this code we install an exception handler my_handler and then a piece
- * of inline assembly attempts to write at the address marked in eax, after
- * setting eax to 10. This should produce an exception. The handler then
- * changes the eax register of the exception context to be the address of
- * a static variable and restarts the code. This should allow everything
- * to continue.
- */
-
-#include <windows.h>
-#include <excpt.h>
-
-#include "exutil.h"
-
-int x;
-
-EXCEPTION_DISPOSITION
-my_handler (
- struct _EXCEPTION_RECORD* pExceptionRec,
- void* pEstablisherFrame,
- struct _CONTEXT* pContextRecord,
- void* pDispatcherContext
- )
-{
- printf ("In my exception handler!\n");
- DumpExceptionRecord (pExceptionRec);
- pContextRecord->Eax = (DWORD) &x;
- return ExceptionContinueExecution;
-}
-
-main ()
-{
- x = 2;
-
- printf ("x = %d\n", x);
-
- WalkExceptionHandlers();
-
- __try1(my_handler)
-
- WalkExceptionHandlers();
-
- /* This assembly code should produce an exception. */
- __asm__("movl $10,%%eax;movl $1,(%%eax);" : : : "%eax");
-
- __except1
-
- WalkExceptionHandlers();
-
- printf ("x = %d\n", x);
-
- printf ("Finished!\n");
-}
-
-
diff --git a/winsup/mingw/samples/seh/sehsub.c b/winsup/mingw/samples/seh/sehsub.c
deleted file mode 100644
index 466b2e8e4..000000000
--- a/winsup/mingw/samples/seh/sehsub.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * sehsub.c
- *
- * In an attempt to see what might be going on inside CRTDLL, this program
- * walks the exception list after creating a new thread with _beginthread.
- *
- * It turns out that _beginthread DOES install an exception handler, as
- * expected, but this handler is NOT exported by CRTDLL (it is certainly
- * not _except_handler2 or _XcptFilter)... an odd and unpleasant turn of
- * events.
- */
-
-#include <windows.h>
-#include <excpt.h>
-#include <process.h>
-
-#include "exutil.h"
-
-extern void* __imp__except_handler3;
-
-unsigned
-my_thread (void * p)
-{
- printf ("In my thread.\n");
- WalkExceptionHandlers();
- return 0;
-}
-
-main ()
-{
- unsigned long h;
- unsigned id;
- printf ("In main.\n");
- WalkExceptionHandlers();
-
- printf ("Except_handler3 %08x\n", __imp__except_handler3);
- h = _beginthreadex (NULL, 0, my_thread, NULL, 0, &id);
-
- WaitForSingleObject ((HANDLE) h, INFINITE);
- CloseHandle ((HANDLE) h);
- return;
-}
-
diff --git a/winsup/mingw/samples/seh/sehtest.c b/winsup/mingw/samples/seh/sehtest.c
deleted file mode 100644
index f1c18d05e..000000000
--- a/winsup/mingw/samples/seh/sehtest.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * This file tests some of the basics of structured exception handling as
- * implemented in excpt.h and the Windows API header files.
- *
- * The program installs two exception handlers, then attempts to write to
- * a pointer to an invalid address. This causes an exception which passes
- * through the exception handlers and on to the default system exception
- * handler. That handler brings up the dialog box all Windows users know
- * and love, and then the program is terminated.
- *
- * You might note that after the initial run up through our exception frames
- * we get a second run up through them with the exception code
- * STATUS_INVALID_DISPOSITION and the code EH_UNWINDING. This seems normal
- * except that the code got changed from the previous STATUS_ACCESS_VIOLATION.
- * I don't understand that bit particularly.
- */
-
-#include <stdio.h>
-#include <excpt.h>
-
-#include "exutil.h"
-
-EXCEPTION_DISPOSITION
-my_handler (
- struct _EXCEPTION_RECORD* pExceptionRec,
- void* pEstablisherFrame,
- struct _CONTEXT* pContextRecord,
- void* pDispatcherContext
- )
-{
- printf ("In my exception handler!\n");
- DumpExceptionRecord (pExceptionRec);
- return ExceptionContinueSearch;
-}
-
-EXCEPTION_DISPOSITION
-my_handler2 (
- struct _EXCEPTION_RECORD* pExceptionRec,
- void* pEstablisherFrame,
- struct _CONTEXT* pContextRecord,
- void* pDispatcherContext
- )
-{
- printf ("In top exception handler!\n");
- DumpExceptionRecord (pExceptionRec);
- return ExceptionContinueSearch;
-}
-
-main ()
-{
- char* x;
-
- printf ("my_handler2 = %08x\n", my_handler2);
- printf ("my_handler = %08x\n", my_handler);
-
- WalkExceptionHandlers();
-
- __try1(my_handler2)
- x = (char*) 10;
-
- WalkExceptionHandlers();
-
- __try1(my_handler)
-
- WalkExceptionHandlers();
-
- *x = 1;
- __except1
- __except1
- printf ("Finished!\n");
-}
-
diff --git a/winsup/mingw/samples/simpledll/dll.c b/winsup/mingw/samples/simpledll/dll.c
deleted file mode 100644
index c642af4d8..000000000
--- a/winsup/mingw/samples/simpledll/dll.c
+++ /dev/null
@@ -1,33 +0,0 @@
-
-#include <windows.h>
-
-BOOL WINAPI
-DllMain (HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
-{
- switch (dwReason)
- {
- case DLL_PROCESS_ATTACH:
- printf ("DLL Attached.\n");
- break;
-
- case DLL_PROCESS_DETACH:
- printf ("DLL Detached.\n");
- break;
-
- case DLL_THREAD_ATTACH:
- printf ("DLL Thread Attached.\n");
- break;
-
- case DLL_THREAD_DETACH:
- printf ("DLL Thread Detached.\n");
- break;
- }
- return TRUE;
-}
-
-void
-Test ()
-{
- printf ("Test Function called!\n");
-}
-
diff --git a/winsup/mingw/samples/simpledll/dll.cpp b/winsup/mingw/samples/simpledll/dll.cpp
deleted file mode 100644
index cdf0dfb9f..000000000
--- a/winsup/mingw/samples/simpledll/dll.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-// This is a C++ version of the code in dll.c. NOTE that you need to put
-// extern "C" { ... } around DllMain or it will not be called when your
-// Dll starts up! (It will get name mangled as a C++ function and the C
-// default version in libmingw32.a will get called instead.)
-//
-
-#include <windows.h>
-
-#include <iostream>
-
-extern "C" {
-
-BOOL WINAPI
-DllMain (HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
-{
- switch (dwReason)
- {
- case DLL_PROCESS_ATTACH:
- cout << "Dll Attached" << endl ;
- break;
-
- case DLL_PROCESS_DETACH:
- cout << "Dll Detached" << endl ;
- break;
-
- case DLL_THREAD_ATTACH:
- printf ("DLL Thread Attached.\n");
- break;
-
- case DLL_THREAD_DETACH:
- printf ("DLL Thread Detached.\n");
- break;
- }
- return TRUE;
-}
-
-void
-Test ()
-{
- printf ("Test Function called!\n");
-}
-
-};
diff --git a/winsup/mingw/samples/simpledll/dll.def b/winsup/mingw/samples/simpledll/dll.def
deleted file mode 100644
index 3cabd50a5..000000000
--- a/winsup/mingw/samples/simpledll/dll.def
+++ /dev/null
@@ -1,2 +0,0 @@
-EXPORTS
-Test
diff --git a/winsup/mingw/samples/simpledll/exe.c b/winsup/mingw/samples/simpledll/exe.c
deleted file mode 100644
index af5bb41df..000000000
--- a/winsup/mingw/samples/simpledll/exe.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <stdio.h>
-
-extern void Test();
-
-int main()
-{
- printf ("Program started.\n");
- Test ();
- printf ("Program ends.\n");
-
- return 0;
-}
-
diff --git a/winsup/mingw/samples/simpledll/jamfile b/winsup/mingw/samples/simpledll/jamfile
deleted file mode 100644
index d1e2591be..000000000
--- a/winsup/mingw/samples/simpledll/jamfile
+++ /dev/null
@@ -1,14 +0,0 @@
-
-Dll dll.dll : dll.c ;
-
-ImportLib libdll.a : dll.def ;
-
-
-Main exe.exe : exe.c ;
-
-LinkLibraries exe.exe : libdll.a ;
-
-DEPENDS exe.exe : dll.dll ;
-
-LINKFLAGS on exe.exe = $(LINKFLAGS) -L. ;
-
diff --git a/winsup/mingw/samples/simpledll/makedll.bat b/winsup/mingw/samples/simpledll/makedll.bat
deleted file mode 100644
index c7f9b2ae8..000000000
--- a/winsup/mingw/samples/simpledll/makedll.bat
+++ /dev/null
@@ -1,23 +0,0 @@
-rem *** Create the import library for the dll ***
-dlltool --dllname dll.dll --def dll.def --output-lib libdll.a
-
-rem *** Compile the dll ***
-gcc -c -o dll.o dll.c
-
-rem *** Link the dll ***
-gcc -s -mdll -o dll.dll -Wl,--base-file,dll.b dll.o
-dlltool --dllname dll.dll --base-file dll.b --output-exp dll.e --def dll.def
-gcc -s -mdll -o dll.dll -Wl,--base-file,dll.b dll.o -Wl,dll.e
-dlltool --dllname dll.dll --base-file dll.b --output-exp dll.e --def dll.def
-gcc -s -mdll -o dll.dll dll.o -Wl,dll.e
-
-rem *** Delete temporary files from dll linking ***
-del dll.b
-del dll.e
-
-rem *** Compile exe, which uses dll. ***
-gcc -c -o exe.o exe.c
-
-rem *** Link exe.exe, which uses dll.dll ***
-gcc -s -L. -o exe.exe exe.o libdll.a
-
diff --git a/winsup/mingw/samples/test/jamfile b/winsup/mingw/samples/test/jamfile
deleted file mode 100644
index 2fc7b84af..000000000
--- a/winsup/mingw/samples/test/jamfile
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-# A very simple example with which you can test your compiler/jam setup.
-# Also an interesting example of a hybrid console/GUI application.
-#
-
-Main test.exe : test.c ;
-
-GuiLibs test.exe ;
-
diff --git a/winsup/mingw/samples/test/test.c b/winsup/mingw/samples/test/test.c
deleted file mode 100644
index 82ca6b0fc..000000000
--- a/winsup/mingw/samples/test/test.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * This source code is in the PUBLIC DOMAIN and has NO WARRANTY.
- *
- * Colin Peters <colin@bird.fu.is.saga-u.ac.jp>, April 15, 1997.
- */
-
-#include <windows.h>
-#include <stdio.h>
-
-int STDCALL
-WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow)
-{
- char text[80];
-
- printf ("Enter message box text:");
- fgets(text, 80, stdin);
- MessageBox (NULL, text, "Test", MB_OK);
- printf ("\nHello after message box.\n");
- return 0;
-}
diff --git a/winsup/mingw/samples/wintest/jamfile b/winsup/mingw/samples/wintest/jamfile
deleted file mode 100644
index b2f783118..000000000
--- a/winsup/mingw/samples/wintest/jamfile
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# A example of Win32 GUI programming in C.
-#
-
-Main test.exe : test.c ;
-
-Gui test.exe ;
-
diff --git a/winsup/mingw/samples/wintest/test.c b/winsup/mingw/samples/wintest/test.c
deleted file mode 100644
index 056888ffc..000000000
--- a/winsup/mingw/samples/wintest/test.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * A basic example of Win32 programming in C.
- *
- * This source code is in the PUBLIC DOMAIN and has NO WARRANTY.
- *
- * Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- */
-
-#include <windows.h>
-#include <string.h>
-
-/*
- * This is the window function for the main window. Whenever a message is
- * dispatched using DispatchMessage (or sent with SendMessage) this function
- * gets called with the contents of the message.
- */
-LRESULT CALLBACK
-MainWndProc (HWND hwnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
-{
- /* The window handle for the "Click Me" button. */
- static HWND hwndButton = 0;
- static int cx, cy; /* Height and width of our button. */
-
- HDC hdc; /* A device context used for drawing */
- PAINTSTRUCT ps; /* Also used during window drawing */
- RECT rc; /* A rectangle used during drawing */
-
- /*
- * Perform processing based on what kind of message we got.
- */
- switch (nMsg)
- {
- case WM_CREATE:
- {
- /* The window is being created. Create our button
- * window now. */
- TEXTMETRIC tm;
-
- /* First we use the system fixed font size to choose
- * a nice button size. */
- hdc = GetDC (hwnd);
- SelectObject (hdc, GetStockObject (SYSTEM_FIXED_FONT));
- GetTextMetrics (hdc, &tm);
- cx = tm.tmAveCharWidth * 30;
- cy = (tm.tmHeight + tm.tmExternalLeading) * 2;
- ReleaseDC (hwnd, hdc);
-
- /* Now create the button */
- hwndButton = CreateWindow (
- "button", /* Builtin button class */
- "Click Here",
- WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
- 0, 0, cx, cy,
- hwnd, /* Parent is this window. */
- (HMENU) 1, /* Control ID: 1 */
- ((LPCREATESTRUCT) lParam)->hInstance,
- NULL
- );
-
- return 0;
- break;
- }
-
- case WM_DESTROY:
- /* The window is being destroyed, close the application
- * (the child button gets destroyed automatically). */
- PostQuitMessage (0);
- return 0;
- break;
-
- case WM_PAINT:
- /* The window needs to be painted (redrawn). */
- hdc = BeginPaint (hwnd, &ps);
- GetClientRect (hwnd, &rc);
-
- /* Draw "Hello, World" in the middle of the upper
- * half of the window. */
- rc.bottom = rc.bottom / 2;
- DrawText (hdc, "Hello, World", -1, &rc,
- DT_SINGLELINE | DT_CENTER | DT_VCENTER);
-
- EndPaint (hwnd, &ps);
- return 0;
- break;
-
- case WM_SIZE:
- /* The window size is changing. If the button exists
- * then place it in the center of the bottom half of
- * the window. */
- if (hwndButton &&
- (wParam == SIZEFULLSCREEN ||
- wParam == SIZENORMAL)
- )
- {
- rc.left = (LOWORD(lParam) - cx) / 2;
- rc.top = HIWORD(lParam) * 3 / 4 - cy / 2;
- MoveWindow (
- hwndButton,
- rc.left, rc.top, cx, cy, TRUE);
- }
- break;
-
- case WM_COMMAND:
- /* Check the control ID, notification code and
- * control handle to see if this is a button click
- * message from our child button. */
- if (LOWORD(wParam) == 1 &&
- HIWORD(wParam) == BN_CLICKED &&
- (HWND) lParam == hwndButton)
- {
- /* Our button was clicked. Close the window. */
- DestroyWindow (hwnd);
- }
- return 0;
- break;
- }
-
- /* If we don't handle a message completely we hand it to the system
- * provided default window function. */
- return DefWindowProc (hwnd, nMsg, wParam, lParam);
-}
-
-
-int STDCALL
-WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow)
-{
- HWND hwndMain; /* Handle for the main window. */
- MSG msg; /* A Win32 message structure. */
- WNDCLASSEX wndclass; /* A window class structure. */
- char* szMainWndClass = "WinTestWin";
- /* The name of the main window class */
-
- /*
- * First we create a window class for our main window.
- */
-
- /* Initialize the entire structure to zero. */
- memset (&wndclass, 0, sizeof(WNDCLASSEX));
-
- /* This class is called WinTestWin */
- wndclass.lpszClassName = szMainWndClass;
-
- /* cbSize gives the size of the structure for extensibility. */
- wndclass.cbSize = sizeof(WNDCLASSEX);
-
- /* All windows of this class redraw when resized. */
- wndclass.style = CS_HREDRAW | CS_VREDRAW;
-
- /* All windows of this class use the MainWndProc window function. */
- wndclass.lpfnWndProc = MainWndProc;
-
- /* This class is used with the current program instance. */
- wndclass.hInstance = hInst;
-
- /* Use standard application icon and arrow cursor provided by the OS */
- wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION);
- wndclass.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
- wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
-
- /* Color the background white */
- wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
-
- /*
- * Now register the window class for use.
- */
- RegisterClassEx (&wndclass);
-
- /*
- * Create our main window using that window class.
- */
- hwndMain = CreateWindow (
- szMainWndClass, /* Class name */
- "Hello", /* Caption */
- WS_OVERLAPPEDWINDOW, /* Style */
- CW_USEDEFAULT, /* Initial x (use default) */
- CW_USEDEFAULT, /* Initial y (use default) */
- CW_USEDEFAULT, /* Initial x size (use default) */
- CW_USEDEFAULT, /* Initial y size (use default) */
- NULL, /* No parent window */
- NULL, /* No menu */
- hInst, /* This program instance */
- NULL /* Creation parameters */
- );
-
- /*
- * Display the window which we just created (using the nShow
- * passed by the OS, which allows for start minimized and that
- * sort of thing).
- */
- ShowWindow (hwndMain, nShow);
- UpdateWindow (hwndMain);
-
- /*
- * The main message loop. All messages being sent to the windows
- * of the application (or at least the primary thread) are retrieved
- * by the GetMessage call, then translated (mainly for keyboard
- * messages) and dispatched to the appropriate window procedure.
- * This is the simplest kind of message loop. More complex loops
- * are required for idle processing or handling modeless dialog
- * boxes. When one of the windows calls PostQuitMessage GetMessage
- * will return zero and the wParam of the message will be filled
- * with the argument to PostQuitMessage. The loop will end and
- * the application will close.
- */
- while (GetMessage (&msg, NULL, 0, 0))
- {
- TranslateMessage (&msg);
- DispatchMessage (&msg);
- }
- return msg.wParam;
-}
-
diff --git a/winsup/mingw/string_old.c b/winsup/mingw/string_old.c
deleted file mode 100644
index c1baeb47e..000000000
--- a/winsup/mingw/string_old.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * string_old.c
- *
- * Oldnames from ANSI header string.h
- *
- * Some wrapper functions for those old name functions whose appropriate
- * equivalents are not simply underscore prefixed.
- *
- * Contributors:
- * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAMED. This includes but is not limited to warrenties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision$
- * $Author$
- * $Date$
- *
- */
-
-#include <string.h>
-
-int
-strcasecmp (const char *sz1, const char *sz2)
-{
- return _stricmp (sz1, sz2);
-}
-
-int
-strncasecmp (const char *sz1, const char *sz2, size_t sizeMaxCompare)
-{
- return _strnicmp (sz1, sz2, sizeMaxCompare);
-}
-
-int
-wcscmpi (const wchar_t * ws1, const wchar_t * ws2)
-{
- return _wcsicmp (ws1, ws2);
-}
-
diff --git a/winsup/subauth/ChangeLog b/winsup/subauth/ChangeLog
deleted file mode 100644
index 385d6cc11..000000000
--- a/winsup/subauth/ChangeLog
+++ /dev/null
@@ -1,21 +0,0 @@
-2001-10-12 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Comment out install for now.
-
-2001-10-12 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Accomodate changes to w32api_include macro.
-
-Sun May 20 00:24:36 2001 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Use 'rm -f' when cleaning.
-
-Fri May 4 15:06:00 Corinna Vinschen <corinna@vinschen.de>
-
- Initial release of the Cygwin subauthentication DLL.
- * ChangeLog: New file.
- * Makefile.in: Ditto.
- * configure: Ditto. Generated from configure.in.
- * configure.in: Ditto.
- * cygsuba.c: Ditto.
- * cygsuba.din: Ditto.
diff --git a/winsup/subauth/Makefile.in b/winsup/subauth/Makefile.in
deleted file mode 100644
index ae64de496..000000000
--- a/winsup/subauth/Makefile.in
+++ /dev/null
@@ -1,89 +0,0 @@
-# Copyright (c) 2001, 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 <vinschen@redhat.de>
-#
-# Makefile for Cygwin subauthentication DLL.
-
-SHELL := @SHELL@
-
-srcdir := @srcdir@
-VPATH := @srcdir@
-prefix := @prefix@
-exec_prefix := @exec_prefix@
-
-bindir := @bindir@
-etcdir := $(exec_prefix)/etc
-
-program_transform_name := @program_transform_name@
-
-INSTALL := @INSTALL@
-INSTALL_PROGRAM := @INSTALL_PROGRAM@
-INSTALL_DATA := @INSTALL_DATA@
-
-CC := @CC@
-CC_FOR_TARGET := $(CC)
-
-CFLAGS := @CFLAGS@ -nostdinc
-
-include $(srcdir)/../Makefile.common
-
-WIN32_COMMON := -mno-cygwin
-WIN32_INCLUDES := -I. -I$(srcdir) $(w32api_include)
-WIN32_CFLAGS := $(CFLAGS) $(WIN32_COMMON) $(WIN32_INCLUDES)
-WIN32_LDFLAGS := $(CFLAGS) $(WIN32_COMMON) -L$(mingw_build) -nostdlib -Wl,-shared
-
-STARTFILE := $(mingw_build)/dllcrt2.o
-LIBS := -lmingw32 -lkernel32
-
-DLL := cygsuba.dll
-DEF_FILE:= cygsuba.def
-
-OBJ = cygsuba.o
-
-.SUFFIXES:
-.NOEXPORT:
-
-all: Makefile $(DLL)
-
-$(DEF_FILE): cygsuba.din config.status
- $(SHELL) config.status
-
-$(DLL): $(OBJ) $(DEF_FILE)
-ifdef VERBOSE
- $(CC) -s $(WIN32_LDFLAGS) -o $@ $(DEF_FILE) $(STARTFILE) $(OBJ) $(LIBS)
-else
- @echo $(CC) .. -o $@ $(OBJ)
- @$(CC) -s $(WIN32_LDFLAGS) -o $@ $(DEF_FILE) $(STARTFILE) $(OBJ) $(LIBS)
-endif
-
-.PHONY: all install clean realclean
-
-realclean: clean
- rm -f Makefile config.cache
-
-clean:
- rm -f *.o *.dll
-
-install: all
- # $(SHELL) $(updir1)/mkinstalldirs $(bindir)
- # for i in $(PROGS) ; do \
- # n=`echo $$i | sed '$(program_transform_name)'`; \
- # $(INSTALL_PROGRAM) $$i $(bindir)/$$n; \
- # done || exit 0
-
-%.o: %.c
-ifdef VERBOSE
- $(CC) $(WIN32_CFLAGS) -c -o $@ $<
-else
- @echo $(CC) -c $(CFLAGS) ... $(<F)
- @$(CC) $(WIN32_CFLAGS) -c -o $@ $<
-endif
-
diff --git a/winsup/subauth/configure b/winsup/subauth/configure
deleted file mode 100755
index 1c3c9cc2f..000000000
--- a/winsup/subauth/configure
+++ /dev/null
@@ -1,1253 +0,0 @@
-#! /bin/sh
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-
-# Defaults:
-ac_help=
-ac_default_prefix=/usr/local
-# Any additions from configure.in:
-
-# Initialize some variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
-exec_prefix=NONE
-host=NONE
-no_create=
-nonopt=NONE
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-target=NONE
-verbose=
-x_includes=NONE
-x_libraries=NONE
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
-ac_prev=
-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=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case "$ac_option" in
-
- -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 ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$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" ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir="$ac_optarg" ;;
-
- -disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_${ac_feature}='$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)
- # 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 << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --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
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host="$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" ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- 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)
- 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" ;;
-
- -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 ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
- exit 0 ;;
-
- -with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "with_${ac_package}='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=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" ;;
-
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
- ;;
-
- *)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
-
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
-do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
- esac
-done
-
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
-
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=Makefile.in
-
-# 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 its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
- 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
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
- else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
- fi
-fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
-else
- echo "creating cache $cache_file"
- > $cache_file
-fi
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
-
-
-
-
-
-
-
-
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-
-# Do some error checking and defaulting for the host and target type.
-# The inputs are:
-# configure --host=HOST --target=TARGET --build=BUILD NONOPT
-#
-# The rules are:
-# 1. You are not allowed to specify --host, --target, and nonopt at the
-# same time.
-# 2. Host defaults to nonopt.
-# 3. If nonopt is not specified, then host defaults to the current host,
-# as determined by config.guess.
-# 4. Target and build default to nonopt.
-# 5. If nonopt is not specified, then target and build default to host.
-
-# The aliases save the names the user supplied, while $host etc.
-# will get canonicalized.
-case $host---$target---$nonopt in
-NONE---*---* | *---NONE---* | *---*---NONE) ;;
-*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
-esac
-
-
-# Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:578: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
- case $nonopt in
- NONE)
- if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
- else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
- fi ;;
- *) host_alias=$nonopt ;;
- esac ;;
-esac
-
-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
-
-echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:599: checking target system type" >&5
-
-target_alias=$target
-case "$target_alias" in
-NONE)
- case $nonopt in
- NONE) target_alias=$host_alias ;;
- *) target_alias=$nonopt ;;
- esac ;;
-esac
-
-target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
-target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$target" 1>&6
-
-echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:617: checking build system type" >&5
-
-build_alias=$build
-case "$build_alias" in
-NONE)
- case $nonopt in
- NONE) build_alias=$host_alias ;;
- *) build_alias=$nonopt ;;
- esac ;;
-esac
-
-build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
-build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$build" 1>&6
-
-test "$host_alias" != "$target_alias" &&
- test "$program_prefix$program_suffix$program_transform_name" = \
- NONENONEs,x,x, &&
- program_prefix=${target_alias}-
-
-
-# Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:643: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:673: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_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 $# -gt 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
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
- fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:722: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:731: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
-else
- ac_cv_prog_gcc=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:746: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
-else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-O2"
- fi
-else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
-fi
-
-if test $host != $build; then
- ac_tool_prefix=${host_alias}-
-else
- ac_tool_prefix=
-fi
-
-# Extract the first word of "${ac_tool_prefix}g++", so it can be a program name with args.
-set dummy ${ac_tool_prefix}g++; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:782: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CXX"; then
- ac_cv_prog_CXX="$CXX" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CXX="${ac_tool_prefix}g++"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CXX="$ac_cv_prog_CXX"
-if test -n "$CXX"; then
- echo "$ac_t""$CXX" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_CXX"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "g++", so it can be a program name with args.
-set dummy g++; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:814: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CXX"; then
- ac_cv_prog_CXX="$CXX" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CXX="g++"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_CXX" && ac_cv_prog_CXX="g++"
-fi
-fi
-CXX="$ac_cv_prog_CXX"
-if test -n "$CXX"; then
- echo "$ac_t""$CXX" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- CXX="g++"
-fi
-fi
-
-if test -z "$CXX"; then
- # Extract the first word of "c++", so it can be a program name with args.
-set dummy c++; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:850: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CXX"; then
- ac_cv_prog_CXX="$CXX" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CXX="c++"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CXX="$ac_cv_prog_CXX"
-if test -n "$CXX"; then
- echo "$ac_t""$CXX" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-CXXFLAGS='$(CFLAGS)'
-
-
-if test "$program_transform_name" = s,x,x,; then
- program_transform_name=
-else
- # Double any \ or $. echo might interpret backslashes.
- cat <<\EOF_SED > conftestsed
-s,\\,\\\\,g; s,\$,$$,g
-EOF_SED
- program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
- rm -f conftestsed
-fi
-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"
-
-# sed with no file args requires a program.
-test "$program_transform_name" = "" && program_transform_name="s,x,x,"
-
-
-if test "x$cross_compiling" = "xyes"; then
- if test "x$program_transform_name" = "xs,x,x,"; then
- program_transform_name=""
- fi
- if test "x$program_transform_name" = "x"; then
- program_transform_name="s,^,$host-,"
- else
- program_transform_name="$program_transform_name -e s,^,$host-,"
- fi
-fi
-
-# 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
-# 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"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:925: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/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
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
-
-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. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL="$ac_install_sh"
- fi
-fi
-echo "$ac_t""$INSTALL" 1>&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_PROGRAM}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-
-trap '' 1 2 15
-cat > confcache <<\EOF
-# 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. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# 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.
-(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
- if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
-fi
-
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
-s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
-s%\[%\\&%g
-s%\]%\\&%g
-s%\$%$$%g
-EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-rm -f conftest.defs
-
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
-
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
-# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
-# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
-
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
-do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
-done
-
-ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
-
-trap 'rm -fr `echo "Makefile cygsuba.def:cygsuba.din" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@host@%$host%g
-s%@host_alias@%$host_alias%g
-s%@host_cpu@%$host_cpu%g
-s%@host_vendor@%$host_vendor%g
-s%@host_os@%$host_os%g
-s%@target@%$target%g
-s%@target_alias@%$target_alias%g
-s%@target_cpu@%$target_cpu%g
-s%@target_vendor@%$target_vendor%g
-s%@target_os@%$target_os%g
-s%@build@%$build%g
-s%@build_alias@%$build_alias%g
-s%@build_cpu@%$build_cpu%g
-s%@build_vendor@%$build_vendor%g
-s%@build_os@%$build_os%g
-s%@CC@%$CC%g
-s%@CXX@%$CXX%g
-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
-s%@INSTALL_DATA@%$INSTALL_DATA%g
-
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
- else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
- fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
- else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
- fi
-done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
-fi
-EOF
-
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"Makefile cygsuba.def:cygsuba.din"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
- fi
-
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
-
- case "$ac_given_INSTALL" in
- [/$]*) INSTALL="$ac_given_INSTALL" ;;
- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
- esac
-
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
- esac
-
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-s%@INSTALL@%$INSTALL%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
diff --git a/winsup/subauth/configure.in b/winsup/subauth/configure.in
deleted file mode 100644
index 7e76ea7b7..000000000
--- a/winsup/subauth/configure.in
+++ /dev/null
@@ -1,91 +0,0 @@
-dnl Copyright (c) 2001, 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 <cgf@redhat.com>
-dnl Changed for subauth subdir by Corinna Vinschen <vinschen@redhat.com>
-
-dnl Autoconf configure script for Cygwin utilities.
-dnl
-dnl Process this file with autoconf to produce a configure script.
-
-AC_PREREQ(2.12)
-
-AC_INIT(Makefile.in)
-
-dnl FIXME: We temporarily define our own version of AC_PROG_CC. This is
-dnl copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
-dnl are probably using a cross compiler, which will not be able to fully
-dnl link an executable. This should really be fixed in autoconf
-dnl itself.
-
-AC_DEFUN(LIB_AC_PROG_CC,
-[AC_BEFORE([$0], [AC_PROG_CPP])dnl
-AC_CHECK_PROG(CC, gcc, gcc)
-if test -z "$CC"; then
- AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
- test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
-fi
-
-AC_PROG_CC_GNU
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-dnl Check whether -g works, even if CFLAGS is set, in case the package
-dnl plays around with CFLAGS (such as to build both debugging and
-dnl normal versions of a library), tasteless as that idea is.
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- AC_PROG_CC_G
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-O2"
- fi
-else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
-fi
-])
-
-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_PROG(CXX, c++, c++, , , )
- test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
-fi
-
-CXXFLAGS='$(CFLAGS)'
-])
-
-AC_CANONICAL_SYSTEM
-
-LIB_AC_PROG_CC
-LIB_AC_PROG_CXX
-
-AC_ARG_PROGRAM
-
-if test "x$cross_compiling" = "xyes"; then
- if test "x$program_transform_name" = "xs,x,x,"; then
- program_transform_name=""
- fi
- if test "x$program_transform_name" = "x"; then
- program_transform_name="s,^,$host-,"
- else
- program_transform_name="$program_transform_name -e s,^,$host-,"
- fi
-fi
-
-AC_PROG_INSTALL
-
-AC_OUTPUT(Makefile cygsuba.def:cygsuba.din)
diff --git a/winsup/subauth/cygsuba.c b/winsup/subauth/cygsuba.c
deleted file mode 100644
index d79209fa8..000000000
--- a/winsup/subauth/cygsuba.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/* cygsuba.c: Minimal subauthentication functionality to support
- logon without password.
-
- Copyright 2001 Red Hat, Inc.
-
-Written by Corinna Vinschen <vinschen@redhat.com>
-
-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 <windows.h>
-#include <subauth.h>
-#include <ntsecapi.h>
-
-NTSTATUS NTAPI
-Msv1_0SubAuthenticationRoutine (NETLOGON_LOGON_INFO_CLASS logon_level,
- VOID *logon_inf,
- ULONG flags,
- USER_ALL_INFORMATION *usr_inf,
- ULONG *which,
- ULONG *usr_flags,
- BOOLEAN *auth,
- LARGE_INTEGER *logoff,
- LARGE_INTEGER *kickoff)
-{
- ULONG valid_account = USER_NORMAL_ACCOUNT;
- if (!(flags & MSV1_0_PASSTHRU))
- valid_account |= USER_TEMP_DUPLICATE_ACCOUNT;
-
- *which = *usr_flags = 0;
-
- /* Not a Network logon?
- TODO: How do I manage an interactive logon using a subauthentication
- package??? The logon_level "interactive" is available but I never
- got it working. I assume that's the reason I don't get a legal
- logon session so that I can connect to network drives. */
- if (logon_level != NetlogonNetworkInformation)
- {
- *auth = TRUE;
- return STATUS_INVALID_INFO_CLASS;
- }
-
- /* Account type ok? */
- if (!(usr_inf->UserAccountControl & valid_account))
- {
- *auth = FALSE;
- return STATUS_NO_SUCH_USER;
- }
-
- /* Guest logon? */
- if (flags & MSV1_0_GUEST_LOGON)
- *usr_flags = LOGON_GUEST;
-
-#if defined (SSHD)
- /* The same code could be used to allow the DLL checking for
- SSH RSA/DSA keys. For that purpose, SSH would need it's
- own implementation with the below field used to transport
- the keys which have to be checked. This could be used to
- allow secure logon with RSA/DSA instead of passwords.
- Of course that needs lots of additions to the code... */
- {
- PNETLOGON_NETWORK_INFO nw_inf = (PNETLOGON_NETWORK_INFO) logon_inf;
-
- /*
- nw_inf->LmChallenge.data <=>
- MSV1_0_LM20_LOGON::ChallengeToClient
- nw_inf->NtChallengeResponse <=>
- MSV1_0_LM20_LOGON::CaseSensitiveChallengeResponse
- nw_inf->LmChallengeResponse <=>
- MSV1_0_LM20_LOGON::CaseInsensitiveChallengeResponse
- */
- if (authentication_failed)
- {
- *auth = (usr_inf->UserAccountControl & USER_ACCOUNT_DISABLED) ?
- FALSE : TRUE;
- return STATUS_WRONG_PASSWORD;
- }
- }
-#endif
-
- /* All accounts except for the local admin are checked for being
- locked out or disabled or expired. */
- if (usr_inf->UserId != DOMAIN_USER_RID_ADMIN)
- {
- SYSTEMTIME CurrentTime;
- LARGE_INTEGER LogonTime;
-
- /* Account locked out? */
- if (usr_inf->UserAccountControl & USER_ACCOUNT_AUTO_LOCKED)
- {
- *auth = (usr_inf->UserAccountControl & USER_ACCOUNT_DISABLED) ?
- FALSE : TRUE;
- return STATUS_ACCOUNT_LOCKED_OUT;
- }
-
- /* Account disabled? */
- if (usr_inf->UserAccountControl & USER_ACCOUNT_DISABLED)
- {
- *auth = FALSE;
- return STATUS_ACCOUNT_DISABLED;
- }
-
- /* Account expired? */
- GetSystemTime (&CurrentTime);
- SystemTimeToFileTime(&CurrentTime, (LPFILETIME) &LogonTime);
- if (usr_inf->AccountExpires.QuadPart &&
- LogonTime.QuadPart >= usr_inf->AccountExpires.QuadPart)
- {
- *auth = TRUE;
- return STATUS_ACCOUNT_EXPIRED;
- }
- }
-
- /* Don't force logout. */
- logoff->HighPart = 0x7FFFFFFF;
- logoff->LowPart = 0xFFFFFFFF;
- kickoff->HighPart = 0x7FFFFFFF;
- kickoff->LowPart = 0xFFFFFFFF;
-
- *auth = TRUE;
- return STATUS_SUCCESS;
-}
-
-NTSTATUS NTAPI
-Msv1_0SubAuthenticationFilter (NETLOGON_LOGON_INFO_CLASS logon_level,
- VOID *logon_inf,
- ULONG flags,
- USER_ALL_INFORMATION *usr_inf,
- ULONG *which,
- ULONG *usr_flags,
- BOOLEAN *auth,
- LARGE_INTEGER *logoff,
- LARGE_INTEGER *kickoff)
-{
- return Msv1_0SubAuthenticationRoutine (logon_level, logon_inf, flags,
- usr_inf, which, usr_flags,
- auth, logoff, kickoff);
-}
diff --git a/winsup/subauth/cygsuba.din b/winsup/subauth/cygsuba.din
deleted file mode 100644
index 82ddcfe9b..000000000
--- a/winsup/subauth/cygsuba.din
+++ /dev/null
@@ -1,5 +0,0 @@
-LIBRARY "cygsuba"
-
-EXPORTS
-Msv1_0SubAuthenticationRoutine = Msv1_0SubAuthenticationRoutine@36
-Msv1_0SubAuthenticationFilter = Msv1_0SubAuthenticationFilter@36
diff --git a/winsup/testsuite/ChangeLog b/winsup/testsuite/ChangeLog
deleted file mode 100644
index c5fcd9447..000000000
--- a/winsup/testsuite/ChangeLog
+++ /dev/null
@@ -1,308 +0,0 @@
-2002-02-27 Christopher Faylor <cgf@redhat.com>
-
- * winsup.api/systemcall.c (main): Ensure that stdin is redirected.
-
-2001-11-18 Egor Duda <deo@logos-m.ru>
-
- * winsup.api/pthread/condvar3_1.c: Fix debugging output.
-
-2001-11-15 Egor Duda <deo@logos-m.ru>
-
- * 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 <corinna@vinschen.de>
-
- * checksignal.c: New testcase.
-
-2001-11-04 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Oops. Revert previous change. Add Makefile/Makefile.in
- dependency.
-
-2001-11-04 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Add check target.
-
-2001-11-02 Egor Duda <deo@logos-m.ru>
-
- * libltp/lib/forker.c: Include proper header to avoid compiler
- warning.
-
-2001-10-29 Egor Duda <deo@logos-m.ru>
-
- * winsup.api/ltp/stat03.c: Supress compiler warning.
-
-2001-10-29 Egor Duda <deo@logos-m.ru>
-
- * winsup.api/signal-into-win32-api.c: Supress compiler warning.
-
-Mon Oct 8 14:15:00 2001 Corinna Vinschen <corinna@vinschen.de>
-
- * 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 <cgf@cygnus.com>
-
- * winsup.api/nullgetcwd.c: New file. Check that NULL first argument to
- getcwd works.
-
-Thu Oct 4 22:47:51 2001 Christopher Faylor <cgf@cygnus.com>
-
- * winsup.api/systemcall.c (main): Change some messages for clarity.
-
-Thu Oct 4 22:19:39 2001 Christopher Faylor <cgf@cygnus.com>
-
- * winsup.api/systemcall.c: New file. Check for system call problems.
-
-2001-09-20 Egor Duda <deo@logos-m.ru>
-
- * 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 <deo@logos-m.ru>
-
- * 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 <deo@logos-m.ru>
-
- * 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 <deo@logos-m.ru>
-
- * 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 <deo@logos-m.ru>
-
- * 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 <corinna@vinschen.de>
-
- * 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 <corinna@vinschen.de>
-
- * winsup.api/winsup.exp: Force linking all tests against binmode.o.
-
-2001-04-27 Corinna Vinschen <corinna@vinschen.de>
-
- * winsup.api/mmaptest04.c: Take care for binmode explicitely.
-
-2001-04-19 Corinna Vinschen <corinna@vinschen.de>
-
- * winsup.api/mmaptest02.c: New test.
- * winsup.api/mmaptest03.c: Ditto.
- * winsup.api/mmaptest04.c: Ditto.
-
-2001-04-03 Corinna Vinschen <corinna@vinschen.de>
-
- * winsup.api/mmaptest01.c: New test.
-
-2001-03-10 Egor Duda <deo@logos-m.ru>
-
- * winsup.api/ltp/access01.c: Avoid compilation error if X_OK
- isn't declared as a constant.
-
-2001-03-09 Egor Duda <deo@logos-m.ru>
-
- * config/default.exp: Remove unneeded debugging output.
- * Makefile.in: Use correct path to find dejagnu in local tree.
-
-2000-09-06 Egor Duda <deo@logos-m.ru>
-
- 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 <deo@logos-m.ru>
-
- * Makefile.in: Always add libltp headers directory to headers
- search path.
-
-2000-09-02 Egor Duda <deo@logos-m.ru>
-
- * 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 <testname>.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 a620519e6..000000000
--- a/winsup/testsuite/Makefile.in
+++ /dev/null
@@ -1,189 +0,0 @@
-# Makefile.in for Cygwin's testsuite.
-# Copyright 2000 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@
-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@
-
-TESTSUP_INCLUDES:=-I$(libltp_srcdir)/include
-
-INSTALL:=@INSTALL@
-INSTALL_PROGRAM:=@INSTALL_PROGRAM@
-
-#
-# --enable options from configure
-#
-
-CC:=@CC@
-# FIXME: Which is it, CC or CC_FOR_TARGET?
-CC_FOR_TARGET:=$(CC)
-#CFLAGS:=@CFLAGS@ -MD -Wno-write-strings $(TESTSUP_INCLUDES)
-ifneq (,$(CFLAGS))
- override CFLAGS+= -MD $(TESTSUP_INCLUDES)
-else
- CFLAGS:=@CFLAGS@ -MD $(TESTSUP_INCLUDES)
-endif
-CXXFLAGS:=@CXXFLAGS@
-
-AR:=@AR@
-AR_FLAGS:=qv
-RANLIB:=@RANLIB@
-LD:=@LD@
-DLLTOOL:=@DLLTOOL@
-WINDRES:=@WINDRES@
-AS:=@AS@
-
-#
-# Include common definitions for winsup directory
-#
-include $(srcdir)/../Makefile.common
-
-INSTALL_DATA:=$(SHELL) $(updir1)/install-sh -c
-
-# Setup the testing framework, if you have one
-EXPECT = `if [ -f $${rootme}/../../expect/expect$(EXEEXT) ] ; then \
- echo $${rootme}/../../expect/expect$(EXEEXT) ; \
- else echo expect ; fi`
-
-RUNTEST = `if [ -f $${srcdir}/../../dejagnu/runtest ] ; then \
- echo $${srcdir}/../../dejagnu/runtest ; \
- else echo runtest; fi`
-RUNTESTFLAGS =
-
-ifdef VERBOSE
- RUNTESTFLAGS = -v
-endif
-
-RUNTIME=$(cygwin_build)/new-cygwin1.dll $(cygwin_build)/new-libcygwin.a $(cygwin_build)/cygrun.exe
-
-TESTSUP_LIB_NAME:=libltp.a
-TESTSUP_OFILES:=${sort ${addsuffix .o,${basename ${notdir ${wildcard $(libltp_srcdir)/lib/*.c}}}}}
-
-.PHONY: all force dll_ofiles install all_target install_target all_host install_host
-
-.SUFFIXES:
-.SUFFIXES: .c .cc .def .a .o .d
-
-all_host=@all_host@
-install_host=@install_host@
-
-all: $(TESTSUP_LIB_NAME)
-
-force:
-
-install:
-
-install_host:
-
-clean:
- -rm -f *.o *.dll *.a *.exp junk *.bak *.base *.exe testsuite/*
-
-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 \"\"" >> ./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 new-cygwin1.dll
-
-check: $(TESTSUP_LIB_NAME) $(RUNTIME) testsuite/site.exp
- -rootme=`pwd`; export rootme; \
- srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
- cd testsuite; \
- EXPECT=${EXPECT} ; export EXPECT ; \
- if [ -f $${rootme}/../expect/expect ] ; then \
- TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; pwd` ; \
- export TCL_LIBRARY ; fi ; \
- PATH=$${rootme}/../cygwin:$${PATH} ;\
- $(RUNTEST) --tool winsup $(RUNTESTFLAGS)
-
-Makefile: Makefile.in $(srcdir)/configure.in config.status
- $(SHELL) config.status
-#
-
diff --git a/winsup/testsuite/README b/winsup/testsuite/README
deleted file mode 100644
index 346111e9a..000000000
--- a/winsup/testsuite/README
+++ /dev/null
@@ -1,35 +0,0 @@
-1999-12-23 DJ Delorie <dj@cygnus.com>
-
-Here are some notes about adding and using this testsuite.
-
-First, all the programs are linked with new-libcygwin.a, which is just
-like libcygwin.a, except that it wants new-cygwin1.dll, not
-cygwin1.dll. The testsuite adds the winsup build directory to the
-PATH so that new-cygwin1.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.
diff --git a/winsup/testsuite/config/default.exp b/winsup/testsuite/config/default.exp
deleted file mode 100644
index 695808fc9..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/new-cygwin1.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 c57fde2cc..000000000
--- a/winsup/testsuite/configure
+++ /dev/null
@@ -1,1193 +0,0 @@
-#! /bin/sh
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-
-# Defaults:
-ac_help=
-ac_default_prefix=/usr/local
-# Any additions from configure.in:
-
-# Initialize some variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
-exec_prefix=NONE
-host=NONE
-no_create=
-nonopt=NONE
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-target=NONE
-verbose=
-x_includes=NONE
-x_libraries=NONE
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
-ac_prev=
-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=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case "$ac_option" in
-
- -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 ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$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" ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir="$ac_optarg" ;;
-
- -disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_${ac_feature}='$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)
- # 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 << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --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
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host="$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" ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- 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)
- 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" ;;
-
- -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 ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
- exit 0 ;;
-
- -with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "with_${ac_package}='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=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" ;;
-
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
- ;;
-
- *)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
-
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
-do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
- esac
-done
-
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
-
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=Makefile.in
-
-# 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 its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
- 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
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
- else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
- fi
-fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
-else
- echo "creating cache $cache_file"
- > $cache_file
-fi
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
-
-
-
-# Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:529: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:559: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_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 $# -gt 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
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
- fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- if test -z "$CC"; then
- case "`uname -s`" in
- *win32* | *WIN32*)
- # Extract the first word of "cl", so it can be a program name with args.
-set dummy cl; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:610: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="cl"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
- ;;
- esac
- fi
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:642: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext << EOF
-
-#line 653 "configure"
-#include "confdefs.h"
-
-main(){return(0);}
-EOF
-if { (eval echo configure:658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- ac_cv_prog_cc_works=yes
- # If we can't run a trivial program, we are probably using a cross compiler.
- if (./conftest; exit) 2>/dev/null; then
- ac_cv_prog_cc_cross=no
- else
- ac_cv_prog_cc_cross=yes
- fi
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_prog_cc_works=no
-fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-if test $ac_cv_prog_cc_works = no; then
- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
-fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:684: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:689: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:698: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
-else
- ac_cv_prog_gcc=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-else
- GCC=
-fi
-
-ac_test_CFLAGS="${CFLAGS+set}"
-ac_save_CFLAGS="$CFLAGS"
-CFLAGS=
-echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:717: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
-else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&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
-
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:749: checking how to run the C preprocessor" >&5
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- # This must be in double quotes, not single quotes, because CPP may get
- # substituted into the Makefile and "${CC-cc}" will confuse make.
- CPP="${CC-cc} -E"
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp.
- cat > conftest.$ac_ext <<EOF
-#line 764 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:770: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -E -traditional-cpp"
- cat > conftest.$ac_ext <<EOF
-#line 781 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:787: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -nologo -E"
- cat > conftest.$ac_ext <<EOF
-#line 798 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:804: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP=/lib/cpp
-fi
-rm -f conftest*
-fi
-rm -f conftest*
-fi
-rm -f conftest*
- ac_cv_prog_CPP="$CPP"
-fi
- CPP="$ac_cv_prog_CPP"
-else
- ac_cv_prog_CPP="$CPP"
-fi
-echo "$ac_t""$CPP" 1>&6
-
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-
-# Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:854: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
- case $nonopt in
- NONE)
- if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
- else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
- fi ;;
- *) host_alias=$nonopt ;;
- esac ;;
-esac
-
-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
-
-echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:875: checking build system type" >&5
-
-build_alias=$build
-case "$build_alias" in
-NONE)
- case $nonopt in
- NONE) build_alias=$host_alias ;;
- *) build_alias=$nonopt ;;
- esac ;;
-esac
-
-build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
-build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$build" 1>&6
-
-if test $host != $build; then
- ac_tool_prefix=${host_alias}-
-else
- ac_tool_prefix=
-fi
-
-# 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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:901: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$AR"; then
- ac_cv_prog_AR="$AR" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_AR="${ac_tool_prefix}ar"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
-fi
-fi
-AR="$ac_cv_prog_AR"
-if test -n "$AR"; then
- echo "$ac_t""$AR" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-
-
-trap '' 1 2 15
-cat > confcache <<\EOF
-# 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. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# 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.
-(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
- if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
-fi
-
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
-s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
-s%\[%\\&%g
-s%\]%\\&%g
-s%\$%$$%g
-EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-rm -f conftest.defs
-
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
-
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
-# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
-# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
-
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
-do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
-done
-
-ac_given_srcdir=$srcdir
-
-trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@CC@%$CC%g
-s%@CPP@%$CPP%g
-s%@host@%$host%g
-s%@host_alias@%$host_alias%g
-s%@host_cpu@%$host_cpu%g
-s%@host_vendor@%$host_vendor%g
-s%@host_os@%$host_os%g
-s%@build@%$build%g
-s%@build_alias@%$build_alias%g
-s%@build_cpu@%$build_cpu%g
-s%@build_vendor@%$build_vendor%g
-s%@build_os@%$build_os%g
-s%@AR@%$AR%g
-
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
- else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
- fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
- else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
- fi
-done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
-fi
-EOF
-
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
- fi
-
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
-
-
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
- esac
-
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
diff --git a/winsup/testsuite/configure.in b/winsup/testsuite/configure.in
deleted file mode 100755
index 6d198437d..000000000
--- a/winsup/testsuite/configure.in
+++ /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.12)
-AC_INIT(Makefile.in)
-
-AC_PROG_CC
-AC_PROG_CPP
-AC_CHECK_TOOL(AR,ar)
-
-AC_OUTPUT(Makefile)
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 <sep> string will be placed as a separator between symbols.
- * Commonly used separators would be a comma "," or pipe "|".
- * If <mode> is one and not all <openflags> 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 131311b44..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(char *cmd, 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 acfdfdf1b..000000000
--- a/winsup/testsuite/libltp/include/test.h
+++ /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$ */
-
-#ifndef __TEST_H__
-#define __TEST_H__
-
-#include <stdio.h>
-#include <signal.h>
-#include <unistd.h>
-
-#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, 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();
-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 <sys/iosw.h>
-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 <aio.h>
-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 232e67a98..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 <unistd.h>
-#endif
-
-#include <sys/param.h>
-
-/*
- * 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 {
- 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.
- ***********************************************************************/
-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;
-
-#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<USC_MAX_ERRNO; tmptime++) { \
- if ( STD_ERRNO_LIST[tmptime] ) { \
- if ( TEST_VALID_ENO[tmptime].flag ) \
- tst_resm(TINFO, "ERRNO %d:\tReceived %d Times", \
- tmptime, STD_ERRNO_LIST[tmptime]); \
- else \
- tst_resm(TINFO, \
- "ERRNO %d:\tReceived %d Times ** UNEXPECTED **", \
- tmptime, STD_ERRNO_LIST[tmptime]); \
- } \
- } \
-}
-
-/***********************************************************************
- * TEST_PAUSEF: Pause for SIGUSR1 if the pause flag is set.
- * Set the user specified function as the interrupt
- * handler instead of "STD_go"
- *
- * parameters:
- * none
- *
- ***********************************************************************/
-#define TEST_PAUSEF(HANDLER) \
-if ( STD_PAUSE ) { \
- _TMP_FUNC = (int (*)())signal(SIGUSR1, HANDLER); \
- pause(); \
- signal(SIGUSR1, (void (*)())_TMP_FUNC); \
-}
-
-/***********************************************************************
- * TEST_PAUSE: Pause for SIGUSR1 if the pause flag is set.
- * Just continue when signal comes in.
- *
- * parameters:
- * none
- *
- ***********************************************************************/
-#define TEST_PAUSE usc_global_setup_hook();
-int usc_global_setup_hook();
-
-/***********************************************************************
- * TEST_LOOPING now call the usc_test_looping function.
- * The function will return 1 if the test should continue
- * iterating.
- *
- ***********************************************************************/
-#define TEST_LOOPING usc_test_looping
-int usc_test_looping(int counter);
-
-/***********************************************************************
- * TEST_ERROR_LOG(eno): log this errno if STD_ERRNO_LOG flag set
- *
- * parameters:
- * int eno: the errno location in STD_ERRNO_LIST to log.
- *
- ***********************************************************************/
-#define TEST_ERROR_LOG(eno) \
- if ( STD_ERRNO_LOG ) \
- if ( eno < USC_MAX_ERRNO ) \
- STD_ERRNO_LIST[eno]++; \
-
-
-/***********************************************************************
- * TEST_EXP_ENOS(array): set the bits associated with the nput errnos
- * in the TEST_VALID_ENO array.
- *
- * parameters:
- * int array[]: a zero terminated array of errnos expected.
- *
- ***********************************************************************/
-#define TEST_EXP_ENOS(array) \
- tmptime=0; \
- while (array[tmptime] != 0) { \
- if (array[tmptime] < USC_MAX_ERRNO) \
- TEST_VALID_ENO[array[tmptime]].flag=1; \
- tmptime++; \
- }
-
-
-#endif /* end of __USCTEST_H__ */
diff --git a/winsup/testsuite/libltp/include/write_log.h b/winsup/testsuite/libltp/include/write_log.h
deleted file mode 100644
index 784d5b3eb..000000000
--- a/winsup/testsuite/libltp/include/write_log.h
+++ /dev/null
@@ -1,169 +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 _WRITE_LOG_H_
-#define _WRITE_LOG_H_
-
-/*
- * Constants defining the max size of various wlog_rec fields. ANY SIZE
- * CHANGES HERE MUST BE REFLECTED IN THE WLOG_REC_DISK STRUCTURE DEFINED
- * BELOW.
- */
-
-#define WLOG_MAX_PATH 128
-#define WLOG_MAX_PATTERN 64
-#define WLOG_MAX_HOST 8
-#define WLOG_REC_MAX_SIZE (sizeof(struct wlog_rec)+WLOG_MAX_PATH+WLOG_MAX_PATTERN+WLOG_MAX_HOST+2)
-
-/*
- * User view of a write log record. Note that this is not necessiliary
- * how the data is formatted on disk (signifigant compression occurrs), so
- * don't expect to od the write log file and see things formatted this way.
- */
-
-struct wlog_rec {
- int w_pid; /* pid doing the write */
- int w_offset; /* file offset */
- int w_nbytes; /* # bytes written */
- int w_oflags; /* low-order open() flags */
- int w_done; /* 1 if io confirmed done */
- int w_async; /* 1 if async write (writea) */
-
- char w_host[WLOG_MAX_HOST+1]; /* host doing write - */
- /* null terminated */
- int w_hostlen; /* host name length */
- char w_path[WLOG_MAX_PATH+1]; /* file written to - */
- /* null terminated */
- int w_pathlen; /* file name length */
- char w_pattern[WLOG_MAX_PATTERN+1]; /* pattern written - */
- /* null terminated */
- int w_patternlen; /* pattern length */
-};
-
-#ifndef uint
-#define uint unsigned int
-#endif
-
-/*
- * On-disk structure of a wlog_rec. Actually, the record consists of
- * 3 parts: [wlog_rec_disk structure][variable length data][length]
- * where length is a 2 byte field containing the total record length
- * (including the 2 bytes). It is used for scanning the logfile in reverse
- * order.
- *
- * The variable length data includes the path, host, and pattern (in that
- * order). The lengths of these pieces of data are held in the
- * wlog_rec_disk structure. Thus, the actual on-disk record looks like
- * this (top is lower byte offset):
- *
- * struct wlog_rec_disk
- * path (w_pathlen bytes - not null terminated)
- * host (w_hostlen bytes - not null terminated)
- * pattern (w_patternlen bytes - not null terminated)
- * 2-byte record length
- *
- * Another way of looking at it is:
- *
- * <struct wlog_rec_disk><path (wpathlen bytes)>-->
- * --><host (w_hostlen bytes)><pattern (w_patternlen bytes)><length (2 bytes)>
- *
- * 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 <stdio.h>
-#include <string.h>
-#include "dataascii.h"
-
-#define CHARS "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghjiklmnopqrstuvwxyz\n"
-#define CHARS_SIZE sizeof(CHARS)
-
-#ifdef UNIT_TEST
-#include <stdlib.h> /* 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<total; cnt++) {
- ind=cnt%chars_size;
- *chr++=charlist[ind];
- }
-
- return bsize;
-
-} /* end of dataasciigen */
-
-int
-dataasciichk(listofchars, buffer, bsize, offset, errmsg)
-char *listofchars; /* a null terminated list of characters */
-char *buffer;
-int bsize;
-int offset;
-char **errmsg;
-{
- 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);
- }
-
- if ( errmsg != NULL ) {
- *errmsg = Errmsg;
- }
-
- for(cnt=offset; cnt<total; chr++, cnt++) {
- ind=cnt%chars_size;
- if ( *chr != charlist[ind] ) {
- sprintf(Errmsg,
- "data mismatch at offset %d, exp:%#o, act:%#o", cnt,
- charlist[ind], *chr);
- return cnt;
- }
- }
-
- sprintf(Errmsg, "all %d bytes match desired pattern", bsize);
- return -1; /* buffer is ok */
-
-} /* end of dataasciichk */
-
-
-#if UNIT_TEST
-
-/***********************************************************************
- * main for doing unit testing
- ***********************************************************************/
-int
-main(ac, ag)
-int ac;
-char **ag;
-{
-
-int size=1023;
-char *buffer;
-int ret;
-char *errmsg;
-
- if ((buffer=(char *)malloc(size)) == NULL ) {
- perror("malloc");
- exit(2);
- }
-
- dataasciigen(NULL, buffer, size, 0);
- printf("dataasciigen(NULL, buffer, %d, 0)\n", size);
-
- ret=dataasciichk(NULL, buffer, size, 0, &errmsg);
- printf("dataasciichk(NULL, buffer, %d, 0, &errmsg) returned %d %s\n",
- size, ret, errmsg);
-
- if ( ret == -1 )
- printf("\tPASS return value is -1 as expected\n");
- else
- printf("\tFAIL return value is %d, expected -1\n", ret);
-
- ret=dataasciichk(NULL, &buffer[1], size-1, 1, &errmsg);
- printf("dataasciichk(NULL, &buffer[1], %d, 1, &errmsg) returned %d %s\n",
- size-1, ret, errmsg);
-
- if ( ret == -1 )
- printf("\tPASS return value is -1 as expected\n");
- else
- printf("\tFAIL return value is %d, expected -1\n", ret);
-
- buffer[25]= 0x0;
- printf("changing char 25\n");
-
- ret=dataasciichk(NULL, &buffer[1], size-1, 1, &errmsg);
- printf("dataasciichk(NULL, &buffer[1], %d, 1, &errmsg) returned %d %s\n",
- size-1, ret, errmsg);
-
- if ( ret == 25 )
- printf("\tPASS return value is 25 as expected\n");
- else
- printf("\tFAIL return value is %d, expected 25\n", ret);
-
- dataasciigen("this is a test of the my string" , buffer, size, 0);
- printf("dataasciigen(\"this is a test of the my string\", buffer, %d, 0)\n", size);
-
- ret=dataasciichk("this is a test of the my string", buffer, size, 0, &errmsg);
- printf("dataasciichk(\"this is a test of the my string\", buffer, %d, 0, &errmsg) returned %d %s\n",
- size, ret, errmsg);
-
- if ( ret == -1 )
- printf("\tPASS return value is -1 as expected\n");
- else
- printf("\tFAIL return value is %d, expected -1\n", ret);
-
- ret=dataasciichk("this is a test of the my string", &buffer[1], size-1, 1, &errmsg);
- printf("dataasciichk(\"this is a test of the my string\", &buffer[1], %d, 1, &errmsg) returned %d %s\n",
- size-1, ret, errmsg);
-
- if ( ret == -1 )
- printf("\tPASS return value is -1 as expected\n");
- else
- printf("\tFAIL return value is %d, expected -1\n", ret);
-
- buffer[25]= 0x0;
- printf("changing char 25\n");
-
- ret=dataasciichk("this is a test of the my string", &buffer[1], size-1, 1, &errmsg);
- printf("dataasciichk(\"this is a test of the my string\", &buffer[1], %d, 1, &errmsg) returned %d %s\n",
- size-1, ret, errmsg);
-
- if ( ret == 25 )
- printf("\tPASS return value is 25 as expected\n");
- else
- printf("\tFAIL return value is %d, expected 25\n", ret);
-
- exit(0);
-}
-
-#endif
-
diff --git a/winsup/testsuite/libltp/lib/databin.c b/winsup/testsuite/libltp/lib/databin.c
deleted file mode 100644
index f09c2c86c..000000000
--- a/winsup/testsuite/libltp/lib/databin.c
+++ /dev/null
@@ -1,298 +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 <stdio.h>
-#include <sys/param.h>
-#include <string.h> /* memset */
-#include <stdlib.h> /* rand */
-#include "databin.h"
-
-#if UNIT_TEST
-#include <malloc.h>
-#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<bsize; chr++, cnt++) {
- actbits = (long)*chr;
-
- if ( actbits != expbits ) {
- sprintf(Errmsg, "data mismatch at offset %d, exp:%#lo, act:%#lo",
- offset+cnt, expbits, actbits);
- return offset+cnt;
- }
- }
-
- sprintf(Errmsg, "all %d bytes match desired pattern", bsize);
- return -1; /* all ok */
-}
-
-#if UNIT_TEST
-
-/***********************************************************************
- * main for doing unit testing
- ***********************************************************************/
-int
-main(ac, ag)
-int ac;
-char **ag;
-{
-
- int size=1023;
- int offset;
- int number;
- unsigned char *buffer;
- int ret;
- char *errmsg;
-
- if ((buffer=(unsigned char *)malloc(size)) == NULL ) {
- perror("malloc");
- exit(2);
- }
-
-
-printf("***** for a ****************************\n");
- databingen('a', buffer, size, 0);
- printf("databingen('a', buffer, %d, 0)\n", size);
-
- ret=databinchk('a', buffer, size, 0, &errmsg);
- printf("databinchk('a', buffer, %d, 0, &errmsg) returned %d: %s\n",
- size, ret, errmsg);
- if ( ret == -1 )
- printf("\tPASS return value of -1 as expected\n");
- else
- printf("\tFAIL return value %d, expected -1\n", ret);
-
- offset=232400;
- ret=databinchk('a', &buffer[1], size-1, offset, &errmsg);
- printf("databinchk('a', &buffer[1], %d, %d, &errmsg) returned %d: %s\n",
- size, offset, ret, errmsg);
- if ( ret == -1 )
- printf("\tPASS return value of -1 as expected\n");
- else
- printf("\tFAIL return value %d, expected -1\n", ret);
-
- buffer[15]= 0x0;
- printf("changing char 15 (offset (%d+15) = %d) to 0x0\n", offset, offset+15);
- number=offset+15;
-
- ret=databinchk('a', &buffer[1], size-1, offset+1, &errmsg);
- printf("databinchk('a', &buffer[1], %d, %d, &errmsg) returned %d: %s\n",
- size-1, offset+1, ret, errmsg);
- if ( ret == number )
- printf("\tPASS return value of %d as expected\n", number);
- else
- printf("\tFAIL return value %d, expected %d\n", ret, number);
-
-
-
-printf("***** for c ****************************\n");
- databingen('c', buffer, size, 0);
- printf("databingen('c', buffer, %d, 0)\n", size);
-
- ret=databinchk('c', buffer, size, 0, &errmsg);
- printf("databinchk('c', buffer, %d, 0, &errmsg) returned %d: %s\n",
- size, ret, errmsg);
- if ( ret == -1 )
- printf("\tPASS return value of -1 as expected\n");
- else
- printf("\tFAIL return value %d, expected -1\n", ret);
-
- offset=232400;
- ret=databinchk('c', &buffer[1], size-1, offset, &errmsg);
- printf("databinchk('c', &buffer[1], %d, %d, &errmsg) returned %d: %s\n",
- size, offset, ret, errmsg);
- if ( ret == -1 )
- printf("\tPASS return value of -1 as expected\n");
- else
- printf("\tFAIL return value %d, expected -1\n", ret);
-
- buffer[15]= 0x0;
- printf("changing char 15 (offset (%d+15) = %d) to 0x0\n", offset, offset+15);
- number=offset+15;
-
- ret=databinchk('c', &buffer[1], size-1, offset+1, &errmsg);
- printf("databinchk('c', &buffer[1], %d, %d, &errmsg) returned %d: %s\n",
- size-1, offset+1, ret, errmsg);
- if ( ret == number )
- printf("\tPASS return value of %d as expected\n", number);
- else
- printf("\tFAIL return value %d, expected %d\n", ret, number);
-
-printf("***** for C ****************************\n");
-
- databingen('C', buffer, size, 0);
- printf("databingen('C', buffer, %d, 0)\n", size);
-
- ret=databinchk('C', buffer, size, 0, &errmsg);
- printf("databinchk('C', buffer, %d, 0, &errmsg) returned %d: %s\n",
- size, ret, errmsg);
- if ( ret == -1 )
- printf("\tPASS return value of -1 as expected\n");
- else
- printf("\tFAIL return value %d, expected -1\n", ret);
-
- offset=18;
- ret=databinchk('C', &buffer[18], size-18, 18, &errmsg);
- printf("databinchk('C', &buffer[18], %d, 18, &errmsg) returned %d: %s\n",
- size-18, ret, errmsg);
- if ( ret == -1 )
- printf("\tPASS return value of -1 as expected\n");
- else
- printf("\tFAIL return value %d, expected -1\n", ret);
-
- buffer[20]= 0x0;
- buffer[21]= 0x0;
- printf("changing char 20 and 21 to 0x0 (offset %d and %d)\n", 20,
- 21);
-
- ret=databinchk('C', &buffer[18], size-18, 18, &errmsg);
- printf("databinchk('C', &buffer[18], %d, 18, &errmsg) returned %d: %s\n",
- size-18, ret, errmsg);
-
- if ( ret == 20 || ret == 21 )
- printf("\tPASS return value of %d or %d as expected\n",
- 20, 21);
- else
- printf("\tFAIL return value %d, expected %d or %d\n", ret,
- 20, 21 );
-
- exit(0);
-
-}
-
-#endif
-
diff --git a/winsup/testsuite/libltp/lib/datapid.c b/winsup/testsuite/libltp/lib/datapid.c
deleted file mode 100644
index 9414eae90..000000000
--- a/winsup/testsuite/libltp/lib/datapid.c
+++ /dev/null
@@ -1,374 +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/
- */
-/************
-
-64 bits in a Cray word
-
- 12345678901234567890123456789012
-1234567890123456789012345678901234567890123456789012345678901234
-________________________________________________________________
-< pid >< word-offset in file (same #) >< pid >
-
-1234567890123456789012345678901234567890123456789012345678901234
-________________________________________________________________
-< pid >< offset in file of this word >< pid >
-
-
-8 bits to a bytes == character
- NBPW 8
-************/
-
-#include <stdio.h>
-#include <sys/param.h>
-#ifdef UNIT_TEST
-#include <unistd.h>
-#include <stdlib.h>
-#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<cnt; tmp++) { /* skip unused bytes */
- chr++;
- }
-
- for (; boff<(NBPW-cnt) && boff<bsize; boff++, chr++) {
- buffer[boff] = *chr;
- }
- }
-
- /*
- * full words
- */
-
- num_full_words = (bsize-boff)/NBPW;
-
- woff = offset+boff;
-
- for (cnt=0; cnt<num_full_words; woff += NBPW, cnt++ ) {
-
- word = ((LOWER16BITS(pid) << 48) | (LOWER32BITS(woff) << 16) | LOWER16BITS(pid));
-
- chr = (char *)&word;
- for(tmp=0; tmp<NBPW; tmp++, chr++) {
- buffer[boff++] = *chr;
- }
-/****** Only if wptr is a word ellined
- wptr = (long *)&buffer[boff];
- *wptr = word;
- boff += NBPW;
-*****/
-
- }
-
- /*
- * partial word at end of buffer
- */
-
- if ( cnt=((bsize-boff) % NBPW) ) {
-#if DEBUG
-printf("partial at end\n");
-#endif
- word = ((LOWER16BITS(pid) << 48) | (LOWER32BITS(woff) << 16) | LOWER16BITS(pid));
-
- chr = (char *)&word;
-
- for (tmp=0; tmp<cnt && boff<bsize; tmp++, chr++) {
- buffer[boff++] = *chr;
- }
- }
-
- return bsize;
-
-#else
- return -1; /* not support on non-64 bits word machines */
-
-#endif
-
-}
-
-/***********************************************************************
- *
- *
- ***********************************************************************/
-int
-datapidchk(pid, buffer, bsize, offset, errmsg)
-int pid;
-char *buffer;
-int bsize;
-int offset;
-char **errmsg;
-{
-#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;
-
-
- if ( errmsg != NULL ) {
- *errmsg = Errmsg;
- }
-
-
- num_full_words = bsize/NBPW;
- boff = 0;
-
- if ( cnt=(offset % NBPW) ) { /* partial word */
- woff = offset - cnt;
- word = ((LOWER16BITS(pid) << 48) | (LOWER32BITS(woff) << 16) | LOWER16BITS(pid));
-
- chr = (char *)&word;
-
- for (tmp=0; tmp<cnt; tmp++) { /* skip unused bytes */
- chr++;
- }
-
- for (; boff<(NBPW-cnt) && boff<bsize; boff++, chr++) {
- if (buffer[boff] != *chr) {
- sprintf(Errmsg, "Data mismatch at offset %d, exp:%#o, act:%#o",
- offset+boff, *chr, buffer[boff]);
- return offset+boff;
- }
- }
- }
-
- /*
- * full words
- */
-
- num_full_words = (bsize-boff)/NBPW;
-
- woff = offset+boff;
-
- for (cnt=0; cnt<num_full_words; woff += NBPW, cnt++ ) {
- word = ((LOWER16BITS(pid) << 48) | (LOWER32BITS(woff) << 16) | LOWER16BITS(pid));
-
- chr = (char *)&word;
- for(tmp=0; tmp<NBPW; tmp++, boff++, chr++) {
- if ( buffer[boff] != *chr ) {
- sprintf(Errmsg, "Data mismatch at offset %d, exp:%#o, act:%#o",
- woff, *chr, buffer[boff]);
- return woff;
- }
- }
-
-/****** only if a word elined
- wptr = (long *)&buffer[boff];
- if ( *wptr != word ) {
- sprintf(Errmsg, "Data mismatch at offset %d, exp:%#o, act:%#o",
- woff, word, *wptr);
- return woff;
- }
- boff += NBPW;
-******/
- }
-
- /*
- * partial word at end of buffer
- */
-
- if ( cnt=((bsize-boff) % NBPW) ) {
-#if DEBUG
-printf("partial at end\n");
-#endif
- word = ((LOWER16BITS(pid) << 48) | (LOWER32BITS(woff) << 16) | LOWER16BITS(pid));
-
- chr = (char *)&word;
-
-
- for (tmp=0; tmp<cnt && boff<bsize; boff++, tmp++, chr++) {
- if ( buffer[boff] != *chr ) {
- sprintf(Errmsg, "Data mismatch at offset %d, exp:%#o, act:%#o",
- offset+boff, *chr, buffer[boff]);
- return offset+boff;
- }
- }
- }
-
- sprintf(Errmsg, "all %d bytes match desired pattern", bsize);
- return -1; /* buffer is ok */
-
-#else
-
- if ( errmsg != NULL ) {
- *errmsg = Errmsg;
- }
- sprintf(Errmsg, "Not supported on this OS.");
- return 0;
-
-#endif
-
-
-} /* end of datapidchk */
-
-#if UNIT_TEST
-
-/***********************************************************************
- * main for doing unit testing
- ***********************************************************************/
-int
-main(ac, ag)
-int ac;
-char **ag;
-{
-
-int size=1234;
-char *buffer;
-int ret;
-char *errmsg;
-
- if ((buffer=(char *)malloc(size)) == NULL ) {
- perror("malloc");
- exit(2);
- }
-
-
- datapidgen(-1, buffer, size, 3);
-
-/***
-fwrite(buffer, size, 1, stdout);
-fwrite("\n", 1, 1, stdout);
-****/
-
- printf("datapidgen(-1, buffer, size, 3)\n");
-
- ret=datapidchk(-1, buffer, size, 3, &errmsg);
- printf("datapidchk(-1, buffer, %d, 3, &errmsg) returned %d %s\n",
- size, ret, errmsg);
- ret=datapidchk(-1, &buffer[1], size-1, 4, &errmsg);
- printf("datapidchk(-1, &buffer[1], %d, 4, &errmsg) returned %d %s\n",
- size-1, ret, errmsg);
-
- buffer[25]= 0x0;
- buffer[26]= 0x0;
- buffer[27]= 0x0;
- buffer[28]= 0x0;
- printf("changing char 25-28\n");
-
- ret=datapidchk(-1, &buffer[1], size-1, 4, &errmsg);
- printf("datapidchk(-1, &buffer[1], %d, 4, &errmsg) returned %d %s\n",
- size-1, ret, errmsg);
-
-printf("------------------------------------------\n");
-
- datapidgen(getpid(), buffer, size, 5);
-
-/*******
-fwrite(buffer, size, 1, stdout);
-fwrite("\n", 1, 1, stdout);
-******/
-
- printf("\ndatapidgen(getpid(), buffer, size, 5)\n");
-
- ret=datapidchk(getpid(), buffer, size, 5, &errmsg);
- printf("datapidchk(getpid(), buffer, %d, 5, &errmsg) returned %d %s\n",
- size, ret, errmsg);
-
- ret=datapidchk(getpid(), &buffer[1], size-1, 6, &errmsg);
- printf("datapidchk(getpid(), &buffer[1], %d, 6, &errmsg) returned %d %s\n",
- size-1, ret, errmsg);
-
- buffer[25]= 0x0;
- printf("changing char 25\n");
-
- ret=datapidchk(getpid(), &buffer[1], size-1, 6, &errmsg);
- printf("datapidchk(getpid(), &buffer[1], %d, 6, &errmsg) returned %d %s\n",
- size-1, ret, errmsg);
-
- exit(0);
-}
-
-#endif
-
diff --git a/winsup/testsuite/libltp/lib/forker.c b/winsup/testsuite/libltp/lib/forker.c
deleted file mode 100644
index 99bc58550..000000000
--- a/winsup/testsuite/libltp/lib/forker.c
+++ /dev/null
@@ -1,286 +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 : forker
- * background
- *
- * FUNCTION TITLE : fork desired number of copies of the current process
- * fork a process and return control to caller
- *
- * SYNOPSIS:
- * int forker(ncopies, mode, prefix)
- * int ncopies;
- * int mode;
- * char *prefix;
- *
- * int background(prefix);
- * char *prefix;
- *
- * extern int Forker_pids[];
- * extern int Forker_npids;
- *
- * AUTHOR : Richard Logan
- *
- * CO-PILOT(s) : Dean Roehrich
- *
- * INITIAL RELEASE : UNICOS 8.0
- *
- * DESIGN DESCRIPTION
- * The background function will do a fork of the current process.
- * The parent process will then exit, thus orphaning the
- * child process. Doing this will not nice the child process
- * like executing a cmd in the background using "&" from the shell.
- * If the fork fails and prefix is not NULL, a error message is printed
- * to stderr and the process will exit with a value of errno.
- *
- * The forker function will fork <ncopies> 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 <stdio.h>
-#include <errno.h>
-#include <unistd.h> /* fork, getpid, sleep */
-#include <string.h>
-#include <stdlib.h>
-#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<Forker_npids; ind++){
- printf("%d ind:%-2d pid:%d\n", getpid(), ind, Forker_pids[ind]);
- }
-
- sleep(30);
- exit(0);
-}
-
-#endif /* UNIT_TEST */
diff --git a/winsup/testsuite/libltp/lib/get_high_address.c b/winsup/testsuite/libltp/lib/get_high_address.c
deleted file mode 100644
index 5fe1e81b2..000000000
--- a/winsup/testsuite/libltp/lib/get_high_address.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * (C) COPYRIGHT CRAY RESEARCH, INC.
- * UNPUBLISHED PROPRIETARY INFORMATION.
- * ALL RIGHTS RESERVED.
- */
-
-#include <unistd.h>
-#ifdef __CYGWIN__
-#include <windows.h>
-#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 e974c871e..000000000
--- a/winsup/testsuite/libltp/lib/libtestsuite.c
+++ /dev/null
@@ -1,74 +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 <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <pwd.h>
-#include <errno.h>
-#include <fcntl.h>
-
-#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 <badname> is not NULL, <badname>
- * will updated to point that symbol in <string>.
- * Parse_open_flags will return -1 on this error.
- * Otherwise parse_open_flags will return the open flag bitmask.
- * If parse_open_flags returns, <string> 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 <sep> string will be placed as
- * a separator between symbols. Commonly used separators would
- * be a comma "," or pipe "|". If <mode> is one and not all
- * <openflags> 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 <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/param.h>
-#include <string.h> /* 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 c40181395..000000000
--- a/winsup/testsuite/libltp/lib/parse_opts.c
+++ /dev/null
@@ -1,878 +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 <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/param.h>
-#include <sys/signal.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <sys/time.h>
-
-#ifdef __CYGWIN__
-#include <getopt.h>
-#endif
-
-
-#if UNIT_TEST
-#include <time.h>
-#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
-
-/* 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<STD_COPIES;cnt++) {
- switch(fork() ) {
- case -1:
- fprintf(stderr, "%s: fork() failed, errno:%d %s\n",
- __FILE__, errno, strerror(errno));
- break;
- case 0: /* child */
- cnt=STD_COPIES; /* to stop the forking */
- break;
-
- default: /* parent */
- break;
- }
- }
-
- /*
- * pause waiting for sigusr1.
- */
- if ( STD_PAUSE ) {
- _TMP_FUNC = (int (*)())signal(SIGUSR1, STD_go);
- pause();
- signal(SIGUSR1, (void (*)())_TMP_FUNC);
- }
-
-
- if ( STD_TP_sbrk || STD_LP_sbrk) {
- STD_start_break=sbrk(0); /* get original sbreak size */
- }
-
- if ( STD_TP_sbrk ) {
- sbrk(STD_TP_sbrk);
- if ( Debug )
- printf("after sbrk(%d)\n", STD_TP_sbrk);
- }
- return 0;
-}
-
-#define USECS_PER_SEC 1000000 /* microseconds per second */
-
-/***********************************************************************
- * This function returns the number of get_current_time()'s return
- * per second.
- ***********************************************************************/
-
-static int
-get_timepersec()
-{
- return USECS_PER_SEC; /* microseconds per second */
-
-}
-
-/***********************************************************************
- * this function will get current time in microseconds since 1970.
- ***********************************************************************/
-static int
-get_current_time()
-{
- struct timeval curtime;
-
- gettimeofday(&curtime, NULL);
-
- /* microseconds since 1970 */
- return (curtime.tv_sec*USECS_PER_SEC) + curtime.tv_usec;
-
-
-}
-
-/***********************************************************************
- *
- * This function will determine if test should continue iterating
- * If the STD_INFINITE flag is set, return 1.
- * If the STD_LOOP_COUNT variable is set, compare it against
- * the counter.
- * If the STD_LOOP_DURATION variable is set, compare current time against
- * calculated stop_time.
- * This function will return 1 until all desired looping methods
- * have been met.
- *
- * counter integer is supplied by the user program.
- ***********************************************************************/
-int
-usc_test_looping(counter)
-int counter;
-{
- static int first_time = 1;
- static int stop_time = 0; /* stop time in rtc or usecs */
- static int delay; /* delay in clocks or usecs */
- int hz=0; /* clocks per second or usecs per second */
- int ct, end; /* current time, end delay time */
- int keepgoing=0; /* used to determine return value */
-
- /*
- * If this is the first iteration and we are looping for
- * duration of STD_LOOP_DURATION seconds (fractional) or
- * doing loop delays, get the clocks per second.
- */
- if ( first_time ) {
-
- first_time=0;
- if ( STD_LOOP_DELAY || STD_LOOP_DURATION ) {
- hz = get_timepersec();
- }
-
- /*
- * If looping for duration, calculate stop time in
- * clocks.
- */
-
- if ( STD_LOOP_DURATION) {
- ct=get_current_time();
- stop_time=(int)((float)hz * STD_LOOP_DURATION) + ct;
- }
-
- /*
- * If doing delay each iteration, calcuate the number
- * of clocks for each delay.
- */
- if ( STD_LOOP_DELAY ) {
- delay=(int)((float)hz * STD_LOOP_DELAY);
- }
-
- }
-
- /*
- * if delay each iteration, loop for delay clocks.
- * This will not be done on first iteration.
- * The delay will happen before determining if
- * there will be another iteration.
- */
- else if ( STD_LOOP_DELAY ) {
- ct=get_current_time();
- end=ct+delay;
- while ( ct < end ) {
- /*
- * The following are special test hooks in the delay loop.
- */
- if ( STD_LD_recfun ) {
- if ( Debug )
- printf("calling usc_recressive_func(0, %d, &STD_bigstack)\n",
- STD_LD_recfun);
- usc_recressive_func(0, STD_LD_recfun, &STD_bigstack);
- }
-
- ct=get_current_time();
- }
- }
-
- if ( STD_INFINITE ) {
- keepgoing++;
- }
-
- if ( STD_LOOP_COUNT && counter < STD_LOOP_COUNT ) {
- keepgoing++;
- }
-
- if ( STD_LOOP_DURATION != 0.0 && get_current_time() < stop_time ) {
- keepgoing++;
- }
-
- if ( keepgoing == 0 )
- return 0;
-
- /*
- * The following code allows special system testing hooks.
- */
-
- if ( STD_LP_recfun ) {
- if ( Debug )
- printf("calling usc_recressive_func(0, %d, &STD_bigstack)\n",
- STD_LP_recfun);
- usc_recressive_func(0, STD_LP_recfun, &STD_bigstack);
- }
-
- if ( STD_LP_sbrk ) {
- if ( Debug )
- printf("about to do sbrk(%d)\n", STD_LP_sbrk);
- sbrk(STD_LP_sbrk);
- }
-
-
- if ( keepgoing )
- return 1;
- else
- return 0; /* done - stop iterating */
-}
-
-
-/*
- * This function recressively calls itself max times.
- */
-static void
-usc_recressive_func(cnt, max, bstack)
-int cnt;
-int max;
-struct usc_bigstack_t bstack;
-{
- if ( cnt < max )
- usc_recressive_func(cnt+1, max, bstack);
-
-}
-
-#if UNIT_TEST
-/******************************************************************************
- * UNIT TEST CODE
- * UNIT TEST CODE
- *
- * this following code is provide so that unit testing can
- * be done fairly easily.
- ******************************************************************************/
-
-int Help = 0;
-int Help2 = 0;
-char *ptr;
-
-/*
- * 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;
-
-
-
-/* for test specific parse_opts options */
-option_t Options[] = {
- { "help", &Help2, NULL }, /* -help option */
- { "h", &Help, NULL }, /* -h option */
- { TIMING, NULL, NULL}, /* disable -timing option */
-
-#if INVALID_TEST_CASES
- { "missingflag", NULL, &ptr }, /* error */
- { "missingarg:", &Help, NULL }, /* error */
-#endif /* INVALID_TEST_CASES */
-
- { NULL, NULL, NULL }
-};
-
-
-main(argc, argv)
-int argc;
-char **argv;
-{
- int lc;
- char *msg;
- struct timeval t;
- int cnt;
-
- if ( (msg=parse_opts(argc, argv,
- (option_t *) Options)) != (char *) NULL ) {
- printf("ERROR : %s\n", msg);
- exit(1);
- }
-
- TEST_PAUSE;
-
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- TEST( gettimeofday(&t, NULL) );
- printf("iter=%d: sec:%d, usec:%6.6d %s", lc+1, t.tv_sec,
- t.tv_usec, ctime(&t.tv_sec));
- }
-
-
- TEST_CLEANUP;
-
- exit(0);
-}
-
-#endif /* UNIT_TEST */
diff --git a/winsup/testsuite/libltp/lib/pattern.c b/winsup/testsuite/libltp/lib/pattern.c
deleted file mode 100644
index 7f4d5873e..000000000
--- a/winsup/testsuite/libltp/lib/pattern.c
+++ /dev/null
@@ -1,168 +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 <string.h>
-#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 <errno.h> /* for errno */
-#include <stdio.h> /* for NULL */
-#include <stdlib.h> /* for malloc() */
-#include <string.h> /* for string function */
-#include <limits.h> /* for PATH_MAX */
-#include <sys/types.h> /* for opendir(), readdir(), closedir(), stat() */
-#include <sys/stat.h> /* for [l]stat() */
-#include <dirent.h> /* for opendir(), readdir(), closedir() */
-#include <unistd.h> /* 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 6663da507..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 <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/errno.h>
-#include <sys/param.h>
-#include <sys/stat.h>
-
-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)
-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 <stdio.h>
-#include <sys/param.h>
-#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 <sys/stat.h>
-#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<argc; ind++) {
-
- printf("str_to_bytes(%s) returned %d\n",
- argv[ind], str_to_bytes(argv[ind]));
-
- printf("str_to_lbytes(%s) returned %ld\n",
- argv[ind], str_to_lbytes(argv[ind]));
-
- printf("str_to_llbytes(%s) returned %lld\n",
- argv[ind], str_to_llbytes(argv[ind]));
- }
-}
-
-#endif
diff --git a/winsup/testsuite/libltp/lib/string_to_tokens.c b/winsup/testsuite/libltp/lib/string_to_tokens.c
deleted file mode 100644
index 6f0d775dd..000000000
--- a/winsup/testsuite/libltp/lib/string_to_tokens.c
+++ /dev/null
@@ -1,109 +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 : string_to_tokens
- *
- * FUNCTION TITLE : Break a string into its tokens
- *
- * SYNOPSIS:
- *
- * int string_to_tokens(arg_string, arg_array, array_size, separator)
- * char *arg_string;
- * char *arg_array[];
- * int array_size;
- * char *separator;
- *
- * AUTHOR : Richard Logan
- *
- * DATE : 10/94
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * DESCRIPTION
- * 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.
- * 'arg_array' must contains at least 'array_size' elements.
- * Only the first 'array_size' minus one tokens will be placed into
- * 'arg_array'. If there are more than 'array_size'-1 tokens, the rest are
- * ignored by this routine.
- *
- * RETURN VALUE
- * This function returns the number of 'separator' separated tokens that
- * were found in 'arg_string'.
- * If 'arg_array' or 'separator' is NULL or 'array_size' is less than 2, -1 is returned.
- *
- * WARNING
- * This function uses strtok() to parse 'arg_string', and thus
- * physically alters 'arg_string' by placing null characters where the
- * separators originally were.
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-#include <stdio.h>
-#include <string.h> /* 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<array_size; num_toks++) {
- if ( (arg_array[num_toks] = strtok(NULL, separator)) == NULL )
- break;
- }
-
- if ( num_toks == array_size )
- arg_array[num_toks] = NULL;
-
- /*
- * Return the number of tokens that were found in 'arg_string'.
- */
- return(num_toks);
-
-} /* end of string_to_tokens */
diff --git a/winsup/testsuite/libltp/lib/tst_res.c b/winsup/testsuite/libltp/lib/tst_res.c
deleted file mode 100644
index 7f0a003f3..000000000
--- a/winsup/testsuite/libltp/lib/tst_res.c
+++ /dev/null
@@ -1,964 +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_res() - Print result message (include file contents)
- * tst_resm() - Print result message
- * tst_brk() - Print result message (include file contents)
- * and break remaining test cases
- * tst_brkm() - Print result message and break remaining test
- * cases
- * tst_brkloop() - Print result message (include file contents)
- * and break test cases remaining in current loop
- * tst_brkloopm() - Print result message and break test case
- * remaining in current loop
- * tst_flush() - Print any messages pending because of
- * CONDENSE mode, and flush output stream
- * tst_exit() - Exit test with a meaningful exit value.
- * tst_environ() - Keep results coming to original stdout
- *
- * FUNCTION TITLE : Standard automated test result reporting mechanism
- *
- * SYNOPSIS:
- * #include "test.h"
- *
- * void tst_res(ttype, fname, tmesg [,arg]...)
- * int ttype;
- * char *fname;
- * char *tmesg;
- *
- * void tst_resm(ttype, tmesg [,arg]...)
- * int ttype;
- * char *tmesg;
- *
- * void tst_brk(ttype, fname, cleanup, tmesg, [,argv]...)
- * int ttype;
- * char *fname;
- * void (*cleanup)();
- * char *tmesg;
- *
- * void tst_brkm(ttype, cleanup, tmesg [,arg]...)
- * int ttype;
- * void (*cleanup)();
- * char *tmesg;
- *
- * void tst_brkloop(ttype, fname, cleanup, char *tmesg, [,argv]...)
- * int ttype;
- * char *fname;
- * void (*cleanup)();
- * char *tmesg;
- *
- * void tst_brkloopm(ttype, cleanup, tmesg [,arg]...)
- * int ttype;
- * void (*cleanup)();
- * char *tmesg;
- *
- * void tst_flush()
- *
- * void tst_exit()
- *
- * int tst_environ()
- *
- * AUTHOR : Kent Rogers (from Dave Fenner's original)
- *
- * CO-PILOT : Rich Logan
- *
- * DATE STARTED : 05/01/90 (rewritten 1/96)
- *
- * DESCRIPTION
- * See the man page(s).
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-#include <errno.h>
-#include <string.h>
-#include <stdio.h> /* for I/O functions, BUFSIZ */
-#include <stdlib.h> /* for getenv() */
-#include <stdarg.h> /* for varargs stuff */
-#include <unistd.h> /* for access() */
-#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(char *filename);
-
-
-/*
- * Define some static/global variables.
- */
-static FILE *T_out = NULL; /* tst_res() output file descriptor */
-static 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, 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)
-{
- 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(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 (<cr> 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 (<cr> 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 (<cr> 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 <errno.h>
-#include <string.h>
-#include <signal.h>
-#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 ef1e2cd70..000000000
--- a/winsup/testsuite/libltp/lib/tst_tmpdir.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 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 <stdio.h>
-#include <errno.h>
-#include <stdlib.h> /* for getenv() */
-#include <string.h> /* for string functions */
-#include <unistd.h> /* for sysconf(), getcwd(), rmdir() */
-#include <sys/types.h> /* for mkdir() */
-#include <sys/stat.h> /* 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 <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#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 a8b5d3927..000000000
--- a/winsup/testsuite/winsup.api/checksignal.c
+++ /dev/null
@@ -1,79 +0,0 @@
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-
-#include "test.h"
-#include "usctest.h"
-
-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;
-
- Tst_count = 0;
-
- if (pipe (fds) < 0)
- tst_brk (TBROK, NULL, NULL, "Create pipe");
-
- /* 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");
-
- /* 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");
-
- /* Reset SA_RESTART flag again. */
- act.sa_handler = sig_handler;
- act.sa_flags &= ~SA_RESTART;
- while ((ret = sigaction (SIGALRM, &act, NULL)) == EINTR)
- ;
- if (ret)
- tst_brk (TBROK, NULL, NULL, "Reset SA_RESTART");
-
- /* 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,
- "Set EINTR on interrupted read() call");
-
- /* Check if another errno is correctly returned (here EBADF). */
- close (fds[0]);
- 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 5dbc2227b..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 <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-#ifndef O_TEXT
-#define O_TEXT 0
-#endif
-
-int errors = 0;
-
-#define num_commands (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(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, 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, 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(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(char *name, Buffer *actual, Buffer *expected)
-{
- int i, got_one=0;
- for (i=0; i<actual->count && i<expected->count; 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)
-{
- char *readmode = "rb";
- char *writemode = "wb";
- FILE *file = 0;
- int i, fd;
- struct stat st;
- char *str;
-
- while (argc > 1 && argv[1][0] == '-')
- {
- if (strcmp(argv[1], "-v") == 0)
- verbose++;
- argc--;
- argv++;
- }
-
- size = 0;
-
- for (pc=0; pc<num_commands; pc++)
- {
- switch (commands[pc])
- {
- case Nop:
- vp("Nop");
- break;
-
- case New1:
- i = commands[++pc];
- vp("New %d", i);
- if (file) fclose(file);
- file = 0;
- remove(dataname);
- break;
-
- case Open:
- vp("Open");
- if (file) fclose(file);
- file = 0;
- break;
-
- case Read:
- if (!file)
- {
- file = fopen(dataname, readmode);
- if (size)
- setvbuf(file, 0, _IOFBF, size);
- }
- if (!file)
- error(1, "cannot open %s, mode %s", dataname, readmode);
- askfor = commands[++pc];
- get = commands[++pc];
- vp("Read %d %d", askfor, get);
- expand_buf(&rw_buf, askfor);
- if (askfor == 1)
- {
- i = getc(file);
- rw_buf.bytes[0] = i;
- i = (i == EOF) ? 0 : 1;
- }
- else
- i = fread(rw_buf.bytes, 1, askfor, file);
- if (i != get)
- error(0, "read wrong number of bytes (%d vs %d)", i, get);
- rw_buf.count = i;
- break;
-
- case Write:
- if (!file)
- {
- file = fopen(dataname, writemode);
- if (size)
- setvbuf(file, 0, _IOFBF, size);
- }
- if (!file)
- error(1, "cannot open %s, mode %s\n", dataname, writemode);
- expect = commands[++pc];
- get_bytestream(&rw_buf);
- vp("Write %d %d", rw_buf.count, expect);
- if (askfor == 1)
- {
- i = putc(rw_buf.bytes[0], file);
- i = (i == EOF) ? 0 : 1;
- }
- else
- i = fwrite(rw_buf.bytes, 1, rw_buf.count, file);
- if (expect && (i != expect))
- error(0, "wrote wrong number of bytes (%d vs %d)", i, expect);
- break;
-
- case Compare:
- get_bytestream(&cmp_buf);
- vp("Compare %d/%d", rw_buf.count, cmp_buf.count);
- compare_bufs("Compare", &rw_buf, &cmp_buf);
- break;
-
- case Verify:
- if (file) fclose(file);
- file = 0;
- get_bytestream(&cmp_buf);
- vp("Verify %s", dataname);
- if (stat(dataname, &st))
- error(1, "Can't stat %s", dataname);
- expand_buf(&vfy_buf, st.st_size);
- i = open(dataname, O_RDONLY|O_BINARY, 0);
- vfy_buf.count = read(i, vfy_buf.bytes, st.st_size);
- close(i);
- compare_bufs("Verify", &vfy_buf, &cmp_buf);
- break;
-
- case Seek:
- posn = commands[++pc];
- whence = commands[++pc];
- switch (whence)
- {
- case Start:
- whence = SEEK_SET;
- str = "Start";
- break;
- case Current:
- whence = SEEK_CUR;
- str = "Current";
- break;
- case End:
- whence = SEEK_END;
- str = "End";
- break;
- }
- vp("Seek 0x%x %s", posn, str);
- i = fseek(file, posn, whence);
- if (i)
- error(1, "fseek failed");
- break;
-
- case Tell:
- posn = commands[++pc];
- vp("Tell 0x%x", posn);
- i = ftell(file);
- if (i != posn)
- error(0, "ftell failed, got 0x%x expected 0x%x", i, posn);
- break;
-
- case BufSize:
- size = commands[++pc];
- vp("BufSize 0x%x", size);
- if (file)
- {
- fflush(file);
- setvbuf(file, 0, _IOFBF, size);
- }
- break;
-
- case Flush:
- vp("Flush");
- if (file)
- fflush(file);
- break;
-
- case Text:
- vp("Text");
- readmode = "rt";
- writemode = "wt";
- break;
-
- case Binary:
- vp("Binary");
- readmode = "rb";
- writemode = "wb";
- break;
-
- default:
- printf("Invalid command code %d at offset %d\n", commands[pc], pc);
- exit(1);
- }
- }
-
- if (file) fclose(file);
-
- if (errors)
- printf("FAIL: %d error%s\n", errors, errors==1?"":"s");
- else
- {
- printf("PASS\n");
- unlink (dataname);
- }
- return errors;
-}
diff --git a/winsup/testsuite/winsup.api/devzero.c b/winsup/testsuite/winsup.api/devzero.c
deleted file mode 100644
index 85a2615b1..000000000
--- a/winsup/testsuite/winsup.api/devzero.c
+++ /dev/null
@@ -1,113 +0,0 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-
-main()
-{
- int fd, r, w, 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 d286f90bd..000000000
--- a/winsup/testsuite/winsup.api/iospeed.c
+++ /dev/null
@@ -1,115 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <windows.h>
-
-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("%6d", 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<TSIZE; i += linesz)
- fwrite(buf, 1, linesz, f);
- fclose(f);
-
- f = fopen("iospeed.dat", "rt");
- fd = fileno(f);
-
- printf("%6d%6d", linesz, cr);
- for (i=0; i<TSIZE; i+= 65536)
- read(fd, buf, 65536);
-
- start(f);
- while (getc(f) != EOF);
- end();
-
- start(f);
- while (fread(buf, 1, 256, f) > 0);
- end();
-
- start(f);
- while (fgets(buf, 64436, f));
- end();
-
- f = fopen("iospeed.dat", "rb");
- fd = fileno(f);
-
- for (i=0; i<TSIZE; i+= 65536)
- read(fd, buf, 65536);
-
- start(f);
- while (getc(f) != EOF);
- end();
-
- start(f);
- while (fread(buf, 1, 256, f) > 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 1856608d9..000000000
--- a/winsup/testsuite/winsup.api/known_bugs.tcl
+++ /dev/null
@@ -1,8 +0,0 @@
-set xfail_list [list dup03 dup05 \
- fcntl05 fcntl07B fcntl09 fcntl10 \
- fsync01 gethostid01 lseek04 lseek10 mknod01 select03 \
- setgroups01 setregid01 setreuid01 setuid02 \
- ulimit01 unlink06 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 e003805a0..000000000
--- a/winsup/testsuite/winsup.api/ltp/access01.c
+++ /dev/null
@@ -1,302 +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 <string.h>
-#include <sys/unistd.h>
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include "test.h"
-#include "usctest.h"
-void setup();
-void cleanup();
-
-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<Ntc; tc++) {
- /*
- * Call access(2)
- */
- TEST(access(Test_cases[tc].file, Test_cases[tc].mode));
-
- /* check return code */
- if ( TEST_RETURN == -1 && Test_cases[tc].experrno == 0 ) {
- tst_resm(TFAIL, "access(%s, %s) Failed, errno=%d : %s",
- Test_cases[tc].file, Test_cases[tc].string,
- TEST_ERRNO, strerror(TEST_ERRNO));
-
- } else if ( TEST_RETURN != -1 && Test_cases[tc].experrno != 0 ) {
- tst_resm(TFAIL, "access(%s, %s) returned %d, exp -1, errno:%d",
- Test_cases[tc].file, Test_cases[tc].string,
- TEST_RETURN, Test_cases[tc].experrno);
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "access(%s, %s) returned %d",
- Test_cases[tc].file, Test_cases[tc].string,
- 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 fd;
- struct stat stbuf;
-
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- umask(0); /* reset umask avoid it affects on modes */
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /*
- * Since files inherit group ids, make sure our dir has a valid grp
- * to us.
- */
- chown(".", -1, getgid());
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(Fname,"accessfile");
-
- if ((fd = open(Fname, O_RDWR|O_CREAT, 06777)) == -1) {
- tst_brkm(TBROK, cleanup, "open(%s, O_RDWR|O_CREAT,06777) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- }
- else if (close(fd) == -1) {
- tst_resm(TINFO, "close(%s) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- }
-
- /*
- * force the mode to be set to 6777
- */
- if (chmod(Fname, 06777) == -1 ) {
- tst_brkm(TBROK, cleanup, "chmod(%s, 06777) failed, errno:%d %s\n",
- Fname, errno, strerror(errno));
- }
-
- stat(Fname, &stbuf);
-
- if ( (stbuf.st_mode & 06777) != 06777 ) {
- /*
- * file can not be properly 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.
- */
- TEST_CLEANUP;
-
- /* remove the temp dir */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/access03.c b/winsup/testsuite/winsup.api/ltp/access03.c
deleted file mode 100644
index dc7dc5ee4..000000000
--- a/winsup/testsuite/winsup.api/ltp/access03.c
+++ /dev/null
@@ -1,507 +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 : access03
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : EFAULT error testing for access(2)
- *
- * PARENT DOCUMENT : acstds01
- *
- * TEST CASE TOTAL : 8
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : Kathy Olmsted
- *
- * CO-PILOT : Tom Hampson
- *
- * DATE STARTED : 05/13/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * access(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
- *
- * Setup:
- * Setup signal handling.
- * Make and change to 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 and exit.
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-
-#include <unistd.h>
-#include "test.h"
-#include "usctest.h"
-
-
-void setup();
-void cleanup();
-
-
-char *get_high_address();
-
-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 20fa81187..000000000
--- a/winsup/testsuite/winsup.api/ltp/access04.c
+++ /dev/null
@@ -1,243 +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: <for command-line>
- * 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 <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-
-#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
-
-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(); /* 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 935b19bd3..000000000
--- a/winsup/testsuite/winsup.api/ltp/access05.c
+++ /dev/null
@@ -1,425 +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: <for command-line>
- * 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 <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#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 */
- char *pathname;
- int a_mode;
- 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 }
-};
-
-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(); /* cleanup function for the test */
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
- char *file_name; /* name of the testfile */
- 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 ac754e326..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 <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 7c608da66..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 <sys/types.h>
-#include <errno.h>
-#include <sys/signal.h>
-#include <limits.h>
-#include "test.h"
-#include "usctest.h" /* required for usctest */
-
-void setup();
-void cleanup();
-void alarm_received();
-
-
-
-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 */
- 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<TST_TOTAL;i++) {
-
- /* capture an SIGALRM signal */
- received_alarm = 0;
- signal(SIGALRM, alarm_received);
-
- TEST (alarm (sec[i]));
- /* reset the alarm */
- alarm (0);
- if (TEST_RETURN != 0) {
- tst_resm(TFAIL,
- "alarm(%u) returned %u, when %u was expected for value %s.",
- sec[i], TEST_RETURN, exp[i], buf[i]);
-
- }
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- else if (STD_FUNCTIONAL_TEST) {
- if (received_alarm == 1) {
- tst_resm (TFAIL,
- "alarm(%u) returned %u but an alarm signal was received for value %s.",
- sec[i], TEST_RETURN, buf[i]);
- } else {
- tst_resm (TPASS,
- "alarm(%u) returned %u as expected for value %s.",
- sec[i], TEST_RETURN, buf[i]);
- }
-
- } /* End of STD_FUNCTIONAL_TEST */
- } /* End of for loop */
- /*
- * Reset alarm before cleanup.
- */
-
- alarm(0);
-
- } /* End for TEST_LOOPING */
-
- cleanup();
-
- return 0;
-}
-
-/***************************************************************
- * 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:
- * exit using tst_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();
-}
-
-void alarm_received()
-{
- received_alarm = 1;
-}
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/alarm03.c b/winsup/testsuite/winsup.api/ltp/alarm03.c
deleted file mode 100644
index 275301374..000000000
--- a/winsup/testsuite/winsup.api/ltp/alarm03.c
+++ /dev/null
@@ -1,229 +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 : alarm03
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : alarm(2) cleared by a fork
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : Richard Logan
- *
- * CO-PILOT : Dennis Arason
- *
- * DATE STARTED : 08/96
- *
- *
- * TEST CASES
- *
- * 1.) alarm(100), fork, child's alarm(0) shall return 0;
- * 2.) alarm(100), fork, parent's alarm(0) shall return non-zero.
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * 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 <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-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 7661ba978..000000000
--- a/winsup/testsuite/winsup.api/ltp/alarm07.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
- */
-
-/*
- * 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: <for command-line>
- * 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 <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/wait.h>
-
-#include "test.h"
-#include "usctest.h"
-
-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(); /* 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 b7ccb62f5..000000000
--- a/winsup/testsuite/winsup.api/ltp/asyncio02.c
+++ /dev/null
@@ -1,365 +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 <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/signal.h>
-#include <errno.h>
-#include <stdlib.h>
-#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();
-int testrun(int flag, int bytes, int ti);
-
-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];
-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<Num_flags; flag_cnt++) {
-
- /*
- * call testrun writing (BUFSIZ + 1) byte chunks
- */
-
- filename=FNAME1;
- if( testrun(Flags[flag_cnt],BUFSIZ+1,1) != OK)
- tst_resm(TFAIL,ERR_MSG1);
-
- else if ( STD_FUNCTIONAL_TEST ) {
- tst_resm(TPASS,
- "More than BUFSIZE bytes multiple synchronous writes to a file check out ok");
- }
-
- /*
- * call testrun writing BUFSIZ byte chunks
- */
-
- filename=FNAME2;
- if(testrun(Flags[flag_cnt],BUFSIZ,2) != OK) {
- tst_resm(TFAIL,ERR_MSG1);
- }
- else if ( STD_FUNCTIONAL_TEST ) {
- tst_resm(TPASS,
- "BUFSIZE bytes multiple synchronous writes to a file checks out ok");
- }
-
- /*
- * while the byte chunks are greater than 0
- * call testrun() with decreasing chunk sizes
- */
-
- filename=FNAME3;
- eok=1;
- for(i = BUFSIZ-1; i >= 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 b59fd9338..000000000
--- a/winsup/testsuite/winsup.api/ltp/chdir02.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 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 <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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};
-
-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 d220bb17f..000000000
--- a/winsup/testsuite/winsup.api/ltp/chdir04.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
- * 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: <for command-line>
- * 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 <stdio.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <test.h>
-#include <usctest.h>
-
-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);
-
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- int i;
- const char *msg; /* message returned from parse_opts */
- struct stat statbuf;
-
- /* 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<TST_TOTAL; i++) {
-
- TEST(chdir(TC[i].dname));
-
- 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;
-
- /* make a temporary directory and cd to it */
- tst_tmpdir();
-}
-
-
-/*
- * 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;
-
- /*
- * 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/chmod01.c b/winsup/testsuite/winsup.api/ltp/chmod01.c
deleted file mode 100644
index 12198fe9e..000000000
--- a/winsup/testsuite/winsup.api/ltp/chmod01.c
+++ /dev/null
@@ -1,231 +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: chmod01
- *
- * Test Description:
- * Verify that, chmod(2) succeeds when used to change the mode permissions
- * of a file.
- *
- * Expected Result:
- * chmod(2) should return 0 and the mode permissions set on file should match
- * the specified mode.
- *
- * 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: <for command-line>
- * 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 <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include "test.h"
-#include "usctest.h"
-
-#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
-#define TESTFILE "testfile"
-
-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(); /* 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 */
- int 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 41c3485e8..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 <sys/types.h>
-#include <sys/stat.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-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];
-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<TST_TOTAL; ind++) {
- mode=Modes[ind];
-
- /*
- * Call chmod(2) with mode argument on fname
- */
- TEST(chmod(fname, mode));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- tst_resm(TFAIL, "chmod(%s, %#o) Failed, errno=%d : %s", fname,
- mode, 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, "chmod(%s, %#o) returned %d", fname,
- mode, 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()
-{
- 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;
-
- strcat(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 (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.
- */
- 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/chown01.c b/winsup/testsuite/winsup.api/ltp/chown01.c
deleted file mode 100644
index 1060637e2..000000000
--- a/winsup/testsuite/winsup.api/ltp/chown01.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 : chown01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for chown(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.) chown(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 chown(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
- * chown(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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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;
-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 1637c90eb..000000000
--- a/winsup/testsuite/winsup.api/ltp/close01.c
+++ /dev/null
@@ -1,199 +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: <for command-line>
- * 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 <stdio.h>
-#include <errno.h>
-#include "test.h"
-#include "usctest.h"
-
-void cleanup(void);
-void setup(void);
-
-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;
- char *type;
-} TC[] = {
- /* file descriptor for a regular file */
- {&newfd, "file"},
-
- /* file descriptor for a pipe */
- {&pipefildes[0], "pipe"}
-};
-
-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 44f98b250..000000000
--- a/winsup/testsuite/winsup.api/ltp/close02.c
+++ /dev/null
@@ -1,142 +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: <for command-line>
- * 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 <stdio.h>
-#include <errno.h>
-#include "test.h"
-#include "usctest.h"
-
-void cleanup(void);
-void setup(void);
-
-int exp_enos[] = {EBADF, 0};
-
-char *TCID = "close02()";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-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 7c9567fdb..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 7dd016f22..000000000
--- a/winsup/testsuite/winsup.api/ltp/creat01.c
+++ /dev/null
@@ -1,206 +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: <for command-line>
- * 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 <stdio.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup(void);
-void cleanup(void);
-void functest1(void);
-void functest2(void);
-
-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}
-};
-
-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<TST_TOTAL; i++) {
- TEST(creat(filename, TC[i].mode));
-
- if (TEST_RETURN == -1) {
- tst_resm(TFAIL, "Could not creat file %s",
- filename);
- continue;
- }
-
- if (STD_FUNCTIONAL_TEST) {
- (*TC[i].functest)();
- } else {
- tst_resm(TPASS, "call succeeded");
- }
- if (TEST_RETURN >= 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 c5e5242bf..000000000
--- a/winsup/testsuite/winsup.api/ltp/creat03.c
+++ /dev/null
@@ -1,153 +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: <for command-line>
- * 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 <errno.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "test.h"
-#include "usctest.h"
-
-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);
-
-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 0caa87973..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 d065f9dc1..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-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 3aac3e9f8..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-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<nfds; ind++) {
-
- /*
- * Call dup(2)
- */
- TEST( dup(Fds[ind]) );
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- if ( STD_FUNCTIONAL_TEST ) {
- if ( TEST_ERRNO == EBADF ) {
- tst_resm(TPASS, "dup(%d) Failed, errno=%d : %s", Fds[ind],
- TEST_ERRNO, strerror(TEST_ERRNO));
- }
- else {
- tst_resm(TFAIL,
- "dup(%d) Failed, errno=%d %s, expected %d (EBADF)",
- Fds[ind], TEST_ERRNO, strerror(TEST_ERRNO), EBADF);
- }
- }
- } else {
- tst_resm(TFAIL, "dup(%d) returned %d, expected -1, errno:%d (EBADF)",
- Fds[ind], TEST_RETURN, EBADF);
-
- /* 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()
-{
- /* 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;
-
-} /* 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/dup03.c b/winsup/testsuite/winsup.api/ltp/dup03.c
deleted file mode 100644
index 4870778a7..000000000
--- a/winsup/testsuite/winsup.api/ltp/dup03.c
+++ /dev/null
@@ -1,292 +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 : dup03
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Negative test for dup(2) (too many fds)
- *
- * 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
- *
- * 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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <stdlib.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-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) {
- for (; Nfds >0 ; Nfds--) {
- if (close(Fd[Nfds-1]) == -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 85540db35..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-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 4f889cdcd..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 <sys/types.h>
-#include <sys/stat.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-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 b23716a0f..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 <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 f29d34f6a..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 <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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", 0, 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 6bf97d4e1..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 <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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", 0);
- /* 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 b833e1c4f..000000000
--- a/winsup/testsuite/winsup.api/ltp/execv01.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 : 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 <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 */
-char *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 1abe72f23..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 <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 */
-char *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 6f645d68d..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 <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 */
-char *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 729f49ac6..000000000
--- a/winsup/testsuite/winsup.api/ltp/exit01.c
+++ /dev/null
@@ -1,163 +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 <stdio.h>
-#include <signal.h>
-#include <errno.h>
-#include "test.h"
-#include "usctest.h"
-
-void cleanup(void);
-void setup(void);
-
-char *TCID = "exit01";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-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 b81ecbcb9..000000000
--- a/winsup/testsuite/winsup.api/ltp/exit02.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
- * 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 <stdio.h>
-#include <errno.h>
-#include <signal.h>
-#include <fcntl.h>
-#include "test.h"
-#include "usctest.h"
-
-void cleanup(void);
-void setup(void);
-
-char *TCID = "exit02";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-#define READ 0
-#define WRITE 1
-#define MODE 0666
-
-char filen[40];
-
-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 83685d34d..000000000
--- a/winsup/testsuite/winsup.api/ltp/fchdir01.c
+++ /dev/null
@@ -1,248 +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: <for command-line>
- * 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 <errno.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-
-void cleanup(void);
-void setup(void);
-
-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
-
-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 c09d905b5..000000000
--- a/winsup/testsuite/winsup.api/ltp/fchdir02.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
- * 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: <for command-line>
- * 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 <errno.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-void cleanup(void);
-void setup(void);
-
-char *TCID = "fchdir02";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-int exp_enos[] = {9, 0}; /* 0 terminated list of expected errnos */
-
-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 ffcf37f66..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 <sys/types.h>
-#include <sys/stat.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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;
-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 045f84892..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 <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 14fc1b61d..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 93a9b9b1f..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 d70843071..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 86f492aa7..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 c48e475ba..000000000
--- a/winsup/testsuite/winsup.api/ltp/fcntl07.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 : 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 <fd> 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 <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/wait.h>
-#include <limits.h>
-
-#include "test.h"
-#include "usctest.h"
-#include "search_path.h"
-
-void setup();
-void cleanup();
-void help();
-
-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 <fd> 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"
-char *File1 = DEFAULT_FILE;
-
-#define DEFAULT_SUBPROG "test_open"
-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
- };
-
-char *testfdtypes[] = {
- "regular file",
- "write side of system pipe",
- };
-
-int test_open(char *arg);
-int do_exec(char *prog, int fd, 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) */
- 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 <fd> 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
- * <else> ???? exit code from child:
- * 2 BROK exec failed
- * 0 PASS fd was properly closed
- *
- */
-
-int
-do_exec(char *prog, int fd, 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, 0);
-
- /* 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/fcntl07B.c b/winsup/testsuite/winsup.api/ltp/fcntl07B.c
deleted file mode 100644
index 51b88c278..000000000
--- a/winsup/testsuite/winsup.api/ltp/fcntl07B.c
+++ /dev/null
@@ -1,427 +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
- * <same
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Close-On-Exec of named pipe functional test
- *
- * PARENT DOCUMENT : none
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 5
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : Richard Logan :copied from fcntcs07 written by 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 named 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 <fd> 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 <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/wait.h>
-#include <limits.h>
-
-#include "test.h"
-#include "usctest.h"
-#include "search_path.h"
-
-void setup();
-void cleanup();
-void help();
-
-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 <fd> 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"
-char *File1 = DEFAULT_FILE;
-
-#define DEFAULT_SUBPROG "test_open"
-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
-#define FIFONAME "FiFo"
-
-int *testfds[] = {
- &npipe_fd, 0
- };
-
-char *testfdtypes[] = {
- "named pipe"
- };
-
-int test_open(char *arg);
-int do_exec(char *prog, int fd, 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) */
- 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 <fd> 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
- * <else> ???? exit code from child:
- * 2 BROK exec failed
- * 0 PASS fd was properly closed
- *
- */
-
-int
-do_exec(char *prog, int fd, 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, 0);
-
- /* 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;
-
- extern char *optarg;
- extern int optind;
-
- 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 c4cbad461..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-#ifndef O_NDELAY
-#define O_NDELAY 0
-#endif
-
-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 f10df71fe..000000000
--- a/winsup/testsuite/winsup.api/ltp/fcntl09.c
+++ /dev/null
@@ -1,272 +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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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;
-
- flocks.l_type = F_RDLCK | F_WRLCK;
- /*
- * 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 8b23575b3..000000000
--- a/winsup/testsuite/winsup.api/ltp/fcntl10.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 : 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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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;
-
- flocks.l_type = F_RDLCK | F_WRLCK;
- /*
- * 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 dfd412a5f..000000000
--- a/winsup/testsuite/winsup.api/ltp/fork01.c
+++ /dev/null
@@ -1,317 +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 <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#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"
-
-
-
-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 eaf3b6404..000000000
--- a/winsup/testsuite/winsup.api/ltp/fork02.c
+++ /dev/null
@@ -1,142 +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 <stdio.h>
-#include <unistd.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup(void);
-void cleanup(void);
-
-char *TCID = "fork02";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-void setup(void);
-void cleanup(void);
-
-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 cda913273..000000000
--- a/winsup/testsuite/winsup.api/ltp/fork03.c
+++ /dev/null
@@ -1,164 +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 <stdio.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup(void);
-void cleanup(void);
-
-char *TCID = "fork03";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-void setup(void);
-void cleanup(void);
-
-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 3725d9f0f..000000000
--- a/winsup/testsuite/winsup.api/ltp/fork04.c
+++ /dev/null
@@ -1,405 +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 <stdlib.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-#include <sys/param.h>
-#include <signal.h> /*Includes signal information. */
-#include <errno.h>
-#include "test.h"
-#include "usctest.h"
-
-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 */
-char *environ_list[] = {"TERM","NoTSetzWq","TESTPROG"};
-#define NUMBER_OF_ENVIRON 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("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<NUMBER_OF_ENVIRON;index++) {
- memset(msg, 0, MAX_LINE_LENGTH);
-
- if ( (var=getenv(environ_list[index])) == NULL )
- (void)sprintf(msg,"%s:%s",environ_list[index], ENV_NOT_SET);
- else
- (void)sprintf(msg,"%s:%s",environ_list[index], var);
-
- write(fildes,msg,sizeof(msg)); /* includes extra null chars */
- }
-
- close(fildes);
-
-}
-
-/***********************************************************************
- *
- * Compare parent env string to child's string.
- * Each string is in the format: <env var>:<value>
- *
- ***********************************************************************/
-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<NUMBER_OF_ENVIRON;index++)
- {
- if ((ret=read(fildes,tmp_line,MAX_LINE_LENGTH)) == 0) {
- tst_resm(TBROK,"fork() test. parent_environment: failed to read from file with %d (%s)",
- errno,strerror(errno));
- }
- else {
-
- if ( (var=getenv(environ_list[index])) == NULL )
- sprintf(parent_value,"%s:%s", environ_list[index], ENV_NOT_SET);
- else
- sprintf(parent_value,"%s:%s", environ_list[index], var);
-
- cmp_env_strings(parent_value, tmp_line);
-
- }
- }
- close(fildes);
-
-}
-
-/***************************************************************
- * main() - performs tests
- *
- ***************************************************************/
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
- int kid_status; /* status returned from child */
- int wait_status; /* status of wait system call in parent */
- int fails; /* indicates whether to continue with tests */
-
- /***************************************************************
- * 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 and fail indicator in case we are looping. */
- Tst_count=0;
- fails = 0;
-
- /* make the call to fork */
- TEST(fork());
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- /* fork failed */
- if ( STD_FUNCTIONAL_TEST ) {
- tst_brkm(TFAIL, cleanup, "fork() failed with %d (%s)",
- TEST_ERRNO, strerror(TEST_ERRNO));
- }
- }
- else if (TEST_RETURN == 0) {
- /* child */
- if ( STD_FUNCTIONAL_TEST ) {
- /* determine environment variables */
- child_environment();
- }
- /* exit with known value */
- exit(KIDEXIT);
- } else {
- /* parent of successful fork */
- /* wait for the child to complete */
- wait_status = wait(&kid_status);
- if ( STD_FUNCTIONAL_TEST ) {
- /* validate the child exit status */
- if (wait_status == TEST_RETURN) {
- if (kid_status != KIDEXIT << 8) {
- tst_brkm(TBROK, cleanup,
- "fork(): Incorrect child status returned on wait(): %d",
- kid_status);
- fails++;
- }
- }
- else {
- tst_brkm(TBROK, cleanup,
- "fork(): wait() for child status failed with %d errno: %d : %s",
- wait_status,errno,strerror(errno));
- fails++;
- }
-
- if (fails == 0 ) {
- /* verification tests */
- parent_environment();
- }
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
diff --git a/winsup/testsuite/winsup.api/ltp/fork06.c b/winsup/testsuite/winsup.api/ltp/fork06.c
deleted file mode 100644
index c2e5a471a..000000000
--- a/winsup/testsuite/winsup.api/ltp/fork06.c
+++ /dev/null
@@ -1,152 +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
- * fork06.c
- *
- * DESCRIPTION
- * Test that a process can fork children a large number of
- * times in succession
- *
- * ALGORITHM
- * Attempt to fork a child that exits immediately
- * Repeat it many times(1000), counting the number of successes and
- * failures
- *
- * USAGE
- * fork06
- *
- * HISTORY
- * 07/2001 Ported by Wayne Boyer
- *
- * RESTRICTIONS
- * None
- */
-
-#include <stdio.h>
-#include "test.h"
-#include "usctest.h"
-
-char *TCID = "fork06";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-void setup(void);
-void cleanup(void);
-
-#define NUMFORKS 1000
-
-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 d8487c13a..000000000
--- a/winsup/testsuite/winsup.api/ltp/fork07.c
+++ /dev/null
@@ -1,198 +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 <stdio.h>
-#include "test.h"
-#include "usctest.h"
-
-char *TCID = "fork07";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-void setup(void);
-void cleanup(void);
-
-char pbuf[10];
-char fnamebuf[40];
-
-main(int ac, char **av)
-{
- int status, count, forks, pid1;
- int ch_r_stat;
- FILE *rea, *writ;
-
- 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 71a3f1d0b..000000000
--- a/winsup/testsuite/winsup.api/ltp/fork09.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
- * 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 <stdio.h>
-#include <errno.h>
-#include <limits.h> /* for OPEN_MAX */
-#include "test.h"
-#include "usctest.h"
-
-char *TCID = "fork01";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-void setup(void);
-void cleanup(void);
-
-char filname[40], childfile[40];
-int first;
-FILE **fildeses; /* file streams */
-int mypid, nfiles;
-
-main(int ac, char **av)
-{
- int pid, status, dtable, 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()
-{
- int nf;
-
- /*
- * 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 09de7c06f..000000000
--- a/winsup/testsuite/winsup.api/ltp/fork10.c
+++ /dev/null
@@ -1,215 +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 <stdio.h>
-#include <errno.h>
-#include "test.h"
-#include "usctest.h"
-
-char *TCID = "fork04";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-void setup(void);
-void cleanup(void);
-
-char pidbuf[10];
-char fnamebuf[40];
-
-main(int ac, char **av)
-{
- int status, pid, fildes;
- char parchar[2];
- char chilchar[2];
- long lseek();
-
- 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 1fc200dd1..000000000
--- a/winsup/testsuite/winsup.api/ltp/fork11.c
+++ /dev/null
@@ -1,140 +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 <stdio.h>
-#include <errno.h>
-#include "test.h"
-#include "usctest.h"
-
-char *TCID = "fork05";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-void setup(void);
-void cleanup(void);
-
-#define NUMFORKS 100
-
-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<NUMFORKS; i++) {
- if ((pid = fork()) == 0) { /* child */
- exit(0);
- }
-
- if (pid > 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 bc4f2b2ad..000000000
--- a/winsup/testsuite/winsup.api/ltp/fpathconf01.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 : 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 <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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
-{
- 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<TST_TOTAL; i++) {
- /*
- * Call fpathconf(2) with one of the valid arguments in the args array
- */
- TEST(fpathconf(fd,args[i].value));
-
- /* check return code -- if the return value is defined */
- if ( (TEST_RETURN == -1) && args[i].defined ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "fpathconf(fd, %s) Failed, errno=%d : %s", args[i].define_tag,
- 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, "fpathconf(fd, %s) returned %d", args[i].define_tag, TEST_RETURN);
- }
- }
- } /* End for i */
- } /* 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();
-
- if ( (fd=open(FILENAME, O_RDWR|O_CREAT, 0700)) == -1 )
- tst_brkm(TBROK, cleanup, "Unable to open temp file %s!", FILENAME);
-
- /* 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);
-
- /* exit with return code appropriate for results */
- tst_rmdir();
- tst_exit();
-
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/fstat01.c b/winsup/testsuite/winsup.api/ltp/fstat01.c
deleted file mode 100644
index 9cb7959e4..000000000
--- a/winsup/testsuite/winsup.api/ltp/fstat01.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 : fstat01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for fstat(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.) fstat(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 fstat(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
- * fstat(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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 f15e48e78..000000000
--- a/winsup/testsuite/winsup.api/ltp/fstat02.c
+++ /dev/null
@@ -1,245 +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: <for command-line>
- * 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 <stdio.h>
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include "test.h"
-#include "usctest.h"
-
-#define FILE_MODE 0644
-#define TESTFILE "testfile"
-#define FILE_SIZE 1024
-#define BUF_SIZE 256
-#define MASK 0777
-
-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(); /* 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 1f63cf106..000000000
--- a/winsup/testsuite/winsup.api/ltp/fstat03.c
+++ /dev/null
@@ -1,192 +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: <for command-line>
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include "test.h"
-#include "usctest.h"
-
-#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
-#define TEST_FILE "testfile"
-
-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(); /* 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 0287fff36..000000000
--- a/winsup/testsuite/winsup.api/ltp/fstat04.c
+++ /dev/null
@@ -1,245 +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: <for command-line>
- * 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 <stdio.h>
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include "test.h"
-#include "usctest.h"
-
-#define FILE_MODE 0644
-#define TESTFILE "testfile"
-#define FILE_SIZE 1024
-#define BUF_SIZE 256
-#define MASK 0777
-
-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(); /* 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 57ddd5f98..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/statfs.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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;
-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 2d3d797ec..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: <for command-line>
- * 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 <sys/types.h>
-#include <sys/stat.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#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 */
-
-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(); /* 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 8044c1de5..000000000
--- a/winsup/testsuite/winsup.api/ltp/ftruncate02.c
+++ /dev/null
@@ -1,314 +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: <for command-line>
- * 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 <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#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 */
-
-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(); /* 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 2e80558e7..000000000
--- a/winsup/testsuite/winsup.api/ltp/ftruncate03.c
+++ /dev/null
@@ -1,325 +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: <for command-line>
- * 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 <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#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;
- 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 }
-};
-
-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(); /* Main cleanup function for the test */
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
- 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 d2c8a5240..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 <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 b4840f52c..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 <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 fcde734a0..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 290ef10c5..000000000
--- a/winsup/testsuite/winsup.api/ltp/getgid02.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
- * 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: <for command-line>
- * 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 <pwd.h>
-#include <errno.h>
-
-#include "test.h"
-#include "usctest.h"
-
-void cleanup(void);
-void setup(void);
-
-char *TCID= "getgid02";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-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 3059b0b36..000000000
--- a/winsup/testsuite/winsup.api/ltp/getgid03.c
+++ /dev/null
@@ -1,157 +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: <for command-line>
- * 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 <pwd.h>
-#include <errno.h>
-
-#include "test.h"
-#include "usctest.h"
-
-void cleanup(void);
-void setup(void);
-
-char *TCID= "getgid01";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-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 6b935f293..000000000
--- a/winsup/testsuite/winsup.api/ltp/getgroups01.c
+++ /dev/null
@@ -1,315 +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 <unistd.h>
-#include <signal.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/param.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-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 b517c7617..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 <sys/types.h>
-#include <sys/param.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 2d4a18755..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 <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 2f94db725..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 <errno.h>
-#include <string.h>
-#include <signal.h>
-
-
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 d1a39a087..000000000
--- a/winsup/testsuite/winsup.api/ltp/getpgid01.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
- */
-
-/*
- * 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 <sys/types.h>
-#include <errno.h>
-#include <varargs.h>
-#include <sys/wait.h>
-#include <test.h>
-#include <usctest.h>
-
-void setup(void);
-void cleanup(void);
-
-char *TCID = "getpgid01";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-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 */
-block1:
- 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");
-
-block2:
- 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");
-
-block3:
- 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");
-
-block4:
- 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 afb80f261..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: <for command-line>
- * 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 <sys/types.h>
-#include <errno.h>
-#include <varargs.h>
-#include <sys/wait.h>
-#include <test.h>
-#include <usctest.h>
-
-void setup(void);
-void cleanup(void);
-
-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}
-};
-
-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 bd3a89117..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 58d6b0579..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 <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 8561c1a09..000000000
--- a/winsup/testsuite/winsup.api/ltp/getpid02.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
- */
-
-/*
- * 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: <for command-line>
- * 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 <unistd.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <unistd.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/wait.h>
-
-#include "test.h"
-#include "usctest.h"
-
-void setup(); /* Main setup function of test */
-void cleanup(); /* cleanup function for the test */
-
-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 9eab5dfc2..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 9eeead13f..000000000
--- a/winsup/testsuite/winsup.api/ltp/getppid02.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
- * getppid01.c
- *
- * DESCRIPTION
- * Testcase to check the basic functionality of the getppid() syscall.
- *
- * USAGE: <for command-line>
- * 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 <errno.h>
-#include <test.h>
-#include <usctest.h>
-
-char *TCID = "getppid01";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-void setup(void);
-void cleanup(void);
-
-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 58920ed34..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 b35072518..000000000
--- a/winsup/testsuite/winsup.api/ltp/getuid02.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
- * getuid02.c
- *
- * DESCRIPTION
- * Testcase to check the basic functionality of the geteuid() system call.
- *
- * USAGE: <for command-line>
- * 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 <pwd.h>
-#include <errno.h>
-#include <test.h>
-#include <usctest.h>
-
-char *TCID = "getuid02";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-void setup(void);
-void cleanup(void);
-
-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 7c1075ca4..000000000
--- a/winsup/testsuite/winsup.api/ltp/getuid03.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
- * getuid01.c
- *
- * DESCRIPTION
- * Testcase to check the basic functionality of the getuid() system call.
- *
- * USAGE: <for command-line>
- * 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 <pwd.h>
-#include <errno.h>
-#include <test.h>
-#include <usctest.h>
-
-char *TCID = "getuid01";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-void setup(void);
-void cleanup(void);
-
-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 d20d3a347..000000000
--- a/winsup/testsuite/winsup.api/ltp/kill01.c
+++ /dev/null
@@ -1,161 +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 <signal.h>
-#include <errno.h>
-#include <sys/wait.h>
-
-void cleanup(void);
-void setup(void);
-
-char *TCID= "kill01()";
-int TST_TOTAL = 1;
-
-extern int Tst_count;
-
-#define TEST_SIG SIGKILL
-
-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 e618c8c71..000000000
--- a/winsup/testsuite/winsup.api/ltp/kill02.c
+++ /dev/null
@@ -1,858 +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 <sys/param.h>
-#include <signal.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdlib.h>
-#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();
-
-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; /*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 528a080b4..000000000
--- a/winsup/testsuite/winsup.api/ltp/kill03.c
+++ /dev/null
@@ -1,169 +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 <signal.h>
-#include <errno.h>
-#include <sys/wait.h>
-
-void cleanup(void);
-void setup(void);
-
-char *TCID= "kill03()";
-int TST_TOTAL = 1;
-
-extern int Tst_count;
-
-int exp_enos[] = {EINVAL, 0};
-
-#define TEST_SIG 2000
-
-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 */
-
- 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 2e0ff6593..000000000
--- a/winsup/testsuite/winsup.api/ltp/kill04.c
+++ /dev/null
@@ -1,180 +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 <signal.h>
-#include <errno.h>
-#include <sys/wait.h>
-
-void cleanup(void);
-void setup(void);
-
-char *TCID= "kill04()";
-int TST_TOTAL = 1;
-
-extern int Tst_count;
-
-int exp_enos[] = {ESRCH, 0};
-
-#define TEST_SIG SIGKILL
-
-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 9d6b0a181..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 <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-void alarm_handler(int sig);
-
-
-
-
-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 61294f16f..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-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 7b4395853..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void help();
-void cleanup();
-
-
-
-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 7f2390139..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/param.h> /* for PATH_MAX */
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-extern char *get_high_address();
-
-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 {
- char *file1;
- char *desc1;
- char *file2;
- 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 */
- char *fname1, *fname2;
- 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 5078a6a3f..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-void help();
-
-
-
-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 32756fedd..000000000
--- a/winsup/testsuite/winsup.api/ltp/lseek01.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 : 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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <unistd.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-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 9ad906b5b..000000000
--- a/winsup/testsuite/winsup.api/ltp/lseek02.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 : 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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <unistd.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-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 03c035cb9..000000000
--- a/winsup/testsuite/winsup.api/ltp/lseek03.c
+++ /dev/null
@@ -1,290 +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 <sys/types.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <unistd.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-void rec_sigsys(int);
-
-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 */
-
- int 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<sizeof(Whences)/sizeof(int); ind++) {
-
- whence=Whences[ind];
-
- /*
- * On IRIX systems, the SIGSYS signal is also sent.
- */
- Rec_sigsys=0;
-
- /*
- * Call lseek(2)
- */
- TEST(lseek(fd, (long)1, whence));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- if ( STD_FUNCTIONAL_TEST ) {
-
- if ( TEST_ERRNO == EINVAL )
-#if defined(sgi)
- if ( Rec_sigsys ) {
- tst_resm(TPASS,
- "lseek(%s, 1, %d) Failed as expected, errno=%d : %s\n\
-and SIGSYS signal was received.",
- fname, whence, TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- tst_resm(TFAIL,
- "lseek(%s, 1, %d) Failed as expected, errno=%d : %s\n\
-But SIGSYS signal was NOT received.",
- fname, whence, TEST_ERRNO, strerror(TEST_ERRNO));
- }
-#elif defined(linux) || defined (__CYGWIN__)
- tst_resm(TPASS,
- "lseek(%s, 1, %d) Failed, errno=%d : %s",
- fname, whence, TEST_ERRNO, strerror(TEST_ERRNO));
-#endif
- else
- tst_resm(TFAIL,
- "lseek(%s, 1, %d) Failed, errno=%d %s, expected %d(EINVAL)",
- fname, whence, TEST_ERRNO, strerror(TEST_ERRNO),
- EINVAL);
- }
-
- else
- Tst_count++;
- } else {
-
- tst_resm(TFAIL, "lseek(%s, 1, %d) returned %d",
- fname, whence, TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/*
- * signal handler for the SIGSYS signal.
- */
-void
-rec_sigsys(int sig)
-{
- Rec_sigsys++;
-
- signal(sig, rec_sigsys);
-}
-
-/***************************************************************
- * 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();
-
- 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));
- }
- /* 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 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/lseek04.c b/winsup/testsuite/winsup.api/ltp/lseek04.c
deleted file mode 100644
index d1c3c36a1..000000000
--- a/winsup/testsuite/winsup.api/ltp/lseek04.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 : lseek04
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Negative test for lseek(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 : 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 <sys/types.h>
-#include <sys/stat.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <unistd.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-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 0d51643f0..000000000
--- a/winsup/testsuite/winsup.api/ltp/lseek05.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 : 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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <unistd.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-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 0262260fc..000000000
--- a/winsup/testsuite/winsup.api/ltp/lseek06.c
+++ /dev/null
@@ -1,237 +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: <for command-line>
- * 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 <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <utime.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <signal.h>
-
-#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
-
-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(); /* 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)) != 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 0acc28949..000000000
--- a/winsup/testsuite/winsup.api/ltp/lseek07.c
+++ /dev/null
@@ -1,288 +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: <for command-line>
- * 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 <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <utime.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <signal.h>
-
-#include "test.h"
-#include "usctest.h"
-
-#define TEMP_FILE "tmp_file"
-#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
-
-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(); /* 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)) !=
- 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)) !=
- 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 061ac3152..000000000
--- a/winsup/testsuite/winsup.api/ltp/lseek08.c
+++ /dev/null
@@ -1,242 +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: <for command-line>
- * 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 <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <utime.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <signal.h>
-
-#include "test.h"
-#include "usctest.h"
-
-#define TEMP_FILE "tmp_file"
-#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
-
-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 */
-size_t file_size; /* size of the temporary file */
-
-void setup(); /* Main setup function of test */
-void cleanup(); /* 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 b36df715d..000000000
--- a/winsup/testsuite/winsup.api/ltp/lseek09.c
+++ /dev/null
@@ -1,269 +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: <for command-line>
- * 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 <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <utime.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <signal.h>
-
-#include "test.h"
-#include "usctest.h"
-
-#define TEMP_FILE "tmp_file"
-#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
-
-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(); /* cleanup function for the test */
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- int rval;
- 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 060f3b290..000000000
--- a/winsup/testsuite/winsup.api/ltp/lseek10.c
+++ /dev/null
@@ -1,347 +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: <for command-line>
- * 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 <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <utime.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <signal.h>
-
-#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
-
-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;
- 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(); /* 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 */
- 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 f6b97d78a..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 80f9bb6cc..000000000
--- a/winsup/testsuite/winsup.api/ltp/mkdir01.c
+++ /dev/null
@@ -1,271 +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 <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-char *get_high_address();
-
-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 8378aba34..000000000
--- a/winsup/testsuite/winsup.api/ltp/mkdir08.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 : 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 <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 32c7fe1e2..000000000
--- a/winsup/testsuite/winsup.api/ltp/mknod01.c
+++ /dev/null
@@ -1,274 +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 <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-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<TST_TOTAL; i++) {
- /* Call mknod(2) */
- TEST(mknod(Path, tcases[i], 0));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "mknod(%s, %#o, 0) failed, errno=%d : %s",
- Path, tcases[i], 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, "mknod(%s, %#o, 0) returned %d",
- Path, tcases[i], TEST_RETURN);
- }
- }
-
- /* remove the node for the next go `round */
- if (unlink(Path) == -1 ) {
- if ( rmdir(Path) == -1 ) {
- tst_resm(TWARN, "unlink(%s) & rmdir(%s) failed, errno:%d %s",
- Path, Path, 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 dir and cd to it */
- tst_tmpdir();
-
- /* Check that user is root */
- if ( geteuid() != 0 )
- tst_brkm(TBROK, cleanup, "Must be root for this test!");
-
- /* build a temp node name to bre created my mknod */
- sprintf(Path, "./tnode_%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;
-
- /* 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/mmap001.c b/winsup/testsuite/winsup.api/ltp/mmap001.c
deleted file mode 100644
index 8ac1b3716..000000000
--- a/winsup/testsuite/winsup.api/ltp/mmap001.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * mmap001.c - Tests mmapping a big file and writing it once
- *
- * Copyright (C) 2000 Juan Quintela <quintela@fi.udc.es>
- * Aaron Laffin <alaffin@sgi.com>
- *
- * 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 <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-
-#include "test.h"
-#include "usctest.h"
-
-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;
- unsigned 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 35e944d74..000000000
--- a/winsup/testsuite/winsup.api/ltp/mmap02.c
+++ /dev/null
@@ -1,294 +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: <for command-line>
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-
-#include "test.h"
-#include "usctest.h"
-
-#define TEMPFILE "mmapfile"
-
-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(); /* 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)) < 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 6c66a4c45..000000000
--- a/winsup/testsuite/winsup.api/ltp/mmap03.c
+++ /dev/null
@@ -1,294 +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: <for command-line>
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-
-#include "test.h"
-#include "usctest.h"
-
-#define TEMPFILE "mmapfile"
-
-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(); /* cleanup function for the test */
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
- 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 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)) < 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 4f9018f92..000000000
--- a/winsup/testsuite/winsup.api/ltp/mmap04.c
+++ /dev/null
@@ -1,295 +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: <for command-line>
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-
-#include "test.h"
-#include "usctest.h"
-
-#define TEMPFILE "mmapfile"
-
-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(); /* cleanup function for the test */
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
- 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 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)) < 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 e8186899f..000000000
--- a/winsup/testsuite/winsup.api/ltp/mmap05.c
+++ /dev/null
@@ -1,303 +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: <for command-line>
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <setjmp.h>
-
-#include "test.h"
-#include "usctest.h"
-
-#define TEMPFILE "mmapfile"
-
-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(); /* 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 */
- 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)) != 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 bc3f20eb1..000000000
--- a/winsup/testsuite/winsup.api/ltp/mmap06.c
+++ /dev/null
@@ -1,237 +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: <for command-line>
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-
-#include "test.h"
-#include "usctest.h"
-
-#define TEMPFILE "mmapfile"
-
-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(); /* 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)) < 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 3d1f4341d..000000000
--- a/winsup/testsuite/winsup.api/ltp/mmap07.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
- */
-
-/*
- * 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: <for command-line>
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-
-#include "test.h"
-#include "usctest.h"
-
-#define TEMPFILE "mmapfile"
-
-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(); /* 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)) < 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 8b2c05091..000000000
--- a/winsup/testsuite/winsup.api/ltp/mmap08.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
- */
-
-/*
- * 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: <for command-line>
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-
-#include "test.h"
-#include "usctest.h"
-
-#define TEMPFILE "mmapfile"
-
-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(); /* 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)) != 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 5de98b6ff..000000000
--- a/winsup/testsuite/winsup.api/ltp/munmap01.c
+++ /dev/null
@@ -1,282 +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: <for command-line>
- * 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 <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-
-#include "test.h"
-#include "usctest.h"
-
-#define TEMPFILE "mmapfile"
-
-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(); /* 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 deadcc2f6..000000000
--- a/winsup/testsuite/winsup.api/ltp/munmap02.c
+++ /dev/null
@@ -1,307 +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: <for command-line>
- * 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 <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-
-#include "test.h"
-#include "usctest.h"
-
-#define TEMPFILE "mmapfile"
-
-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(); /* 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 602971f8a..000000000
--- a/winsup/testsuite/winsup.api/ltp/nice05.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 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 <unistd.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-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 84640ce97..000000000
--- a/winsup/testsuite/winsup.api/ltp/open02.c
+++ /dev/null
@@ -1,150 +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: <for command-line>
- * 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 <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <sys/fcntl.h>
-#include <test.h>
-#include <usctest.h>
-
-char *TCID = "open02";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-char pfilname[40] = "";
-
-int exp_enos[] = {ENOENT, 0};
-
-void cleanup(void);
-void setup(void);
-
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- struct stat statbuf;
- int fildes;
- unsigned short filmode;
-
- /*
- * 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 b8dce9cee..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 f87c6e239..000000000
--- a/winsup/testsuite/winsup.api/ltp/pathconf01.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 : 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 <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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;
-char *path = "/tmp";
-
-struct pathconf_args
-{
- 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<TST_TOTAL; i++) {
-
- errno=-4;
-
- /*
- * Call pathconf(2)
- */
- TEST(pathconf(path, args[i].value));
-
- /*
- * A test case can only fail if -1 is returned and the errno
- * was set. If the errno remains unchanged, the
- * system call did not fail.
- */
- if ( TEST_RETURN == -1 && errno != -4 ) {
- tst_resm(TFAIL, "pathconf(%s, %s) Failed, errno=%d : %s",
- path, args[i].define_tag,
- 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, "pathconf(%s, %s) returned %d",
- path, args[i].define_tag, 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/pause01.c b/winsup/testsuite/winsup.api/ltp/pause01.c
deleted file mode 100644
index 28187c39f..000000000
--- a/winsup/testsuite/winsup.api/ltp/pause01.c
+++ /dev/null
@@ -1,229 +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 : pause01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for pause(2)
- *
- * PARENT DOCUMENT : xxxtds01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 2
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) pause(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 pause(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
- * pause(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 <errno.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 699515da3..000000000
--- a/winsup/testsuite/winsup.api/ltp/pipe01.c
+++ /dev/null
@@ -1,157 +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: <for command-line>
- * 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 <unistd.h>
-#include <errno.h>
-#include "test.h"
-#include "usctest.h"
-
-char *TCID = "pipe01";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-void setup(void);
-void cleanup(void);
-
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- int pipe_ret; /* exit status of pipe */
- 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 9cc935d39..000000000
--- a/winsup/testsuite/winsup.api/ltp/pipe08.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
- * 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: <for command-line>
- * 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 <errno.h>
-#include <unistd.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-char *TCID = "pipe08";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-void setup(void);
-void cleanup(void);
-void sighandler(int);
-
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- int pipe_ret; /* exit status of pipe */
- 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 2c7d9f4c2..000000000
--- a/winsup/testsuite/winsup.api/ltp/pipe09.c
+++ /dev/null
@@ -1,232 +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: <for command-line>
- * 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 <unistd.h>
-#include <signal.h>
-#include <sys/wait.h>
-#include <errno.h>
-#include "test.h"
-#include "usctest.h"
-
-#define PIPEWRTCNT 100 /* must be an even number */
-
-char *TCID = "pipe09";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-void setup(void);
-void cleanup(void);
-
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- int i, red, wtstatus, ret_val;
- int pipe_ret; /* exit stat of pipe */
- int pipefd[2]; /* fds for pipe read/write */
- char synbuf[BUFSIZ];
- 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 410622c37..000000000
--- a/winsup/testsuite/winsup.api/ltp/pipe10.c
+++ /dev/null
@@ -1,168 +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: <for command-line>
- * 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 <errno.h>
-#include <unistd.h>
-#include <sys/wait.h>
-#include <test.h>
-#include <usctest.h>
-
-char *TCID = "pipe10";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-void setup(void);
-void cleanup(void);
-
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- int pipe_ret; /* exit status of pipe */
- 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 df7b24166..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: <for command-line>
- * 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 <errno.h>
-#include <stdio.h>
-#include <limits.h>
-#include "test.h"
-#include "usctest.h"
-
-char *TCID = "pipe11";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-void setup(void);
-void cleanup(void);
-
-#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;
-
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- int pipe_ret; /* exit status of pipe */
- int fd[2]; /* fds for pipe read/write */
- int i;
- int fork_ret, status, cond_numb = 0;
- 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 >= 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 67e1f139a..000000000
--- a/winsup/testsuite/winsup.api/ltp/poll01.c
+++ /dev/null
@@ -1,251 +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: <for command-line>
- * 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 <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/wait.h>
-#include <sys/poll.h>
-
-#include "test.h"
-#include "usctest.h"
-
-#define BUF_SIZE 512
-
-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(); /* 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))
- < 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)) !=
- 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 1a54afeb0..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/param.h>
-#include <errno.h>
-#include <signal.h>
-#include <string.h>
-#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();
-
-
-
-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], *malloc();
-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 99dcdf68d..000000000
--- a/winsup/testsuite/winsup.api/ltp/read04.c
+++ /dev/null
@@ -1,175 +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: <for command-line>
- * 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 <stdio.h>
-#include <fcntl.h>
-#include <errno.h>
-#include "test.h"
-#include "usctest.h"
-
-void cleanup(void);
-void setup(void);
-
-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;
-
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- int n;
- 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 e8b5bd5a5..000000000
--- a/winsup/testsuite/winsup.api/ltp/readdir01.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 : 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 <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
- /* 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();
-
-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 bb5f6e388..000000000
--- a/winsup/testsuite/winsup.api/ltp/readlink01.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
- */
-
-/*
- * 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: <for command-line>
- * 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 <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/stat.h>
-
-#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
-
-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(); /* 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 c0ed6f154..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 3279b903b..000000000
--- a/winsup/testsuite/winsup.api/ltp/readlink03.c
+++ /dev/null
@@ -1,361 +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: <for command-line>
- * 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 <stdio.h>
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-
-#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
-
-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*/
- char *link;
- 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 */
-extern void cleanup(); /* 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 */
- char *sym_file; /* symbolic link file name */
- 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 551efe722..000000000
--- a/winsup/testsuite/winsup.api/ltp/rename01.c
+++ /dev/null
@@ -1,264 +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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-extern void do_file_setup(char *);
-
-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 {
- char *name1;
- char *name2;
- 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<TST_TOTAL; i++) {
-
- TEST(rename(TC[i].name1, TC[i].name2));
-
- if (TEST_RETURN == -1) {
- tst_resm(TFAIL, "call failed unexpectedly");
- continue;
- }
-
- if (STD_FUNCTIONAL_TEST) {
- if (stat(TC[i].name2, &buf1) == -1) {
- tst_brkm(TBROK, cleanup, "stat of %s "
- "failed", TC[i].desc);
- /* NOTREACHED */
- }
-
- /*
- * verify the new file or directory is the
- * same as the old one
- */
- if (buf1.st_dev != *TC[i].olddev ||
- buf1.st_ino != *TC[i].oldino) {
- tst_resm(TFAIL, "rename() failed: the "
- "new %s points to a different "
- "inode/location", TC[i].desc);
- continue;
- }
- /*
- * verify that the old file or directory
- * does not exist
- */
- if (stat(fname, &buf1) != -1) {
- tst_resm(TFAIL, "the old %s still "
- "exists", TC[i].desc);
- continue;
- }
-
- tst_resm(TPASS, "functionality is correct "
- "for renaming a %s", TC[i].desc);
- } else {
- tst_resm(TPASS, "call succeeded on %s rename",
- TC[i].desc);
- }
- }
- /* reset things in case we are looping */
- if (rename(mname, fname) == -1) {
- tst_brkm(TBROK, cleanup, "file rename failed");
- }
-
- if (rename(mdir, fdir) == -1) {
- tst_brkm(TBROK, cleanup, "directory rename failed");
- }
- } /* 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(mname,"./rnfile_%d",getpid());
- sprintf(fdir,"./tdir_%d",getpid());
- sprintf(mdir,"./rndir_%d",getpid());
-
- /* create the "old" file */
- do_file_setup(fname);
-
- if (stat(fname, &buf1)== -1) {
- tst_brkm(TBROK,cleanup, "failed to stat file %s"
- "in setup()", fname);
- /* NOTREACHED */
- }
-
- f_olddev = buf1.st_dev;
- f_oldino = buf1.st_ino;
-
- /* create "old" directory */
- if (mkdir(fdir, 00770) == -1) {
- tst_brkm(TBROK, cleanup, "Could not create directory %s", fdir);
- /*NOTREACHED*/
- }
-
- if (stat(fdir, &buf1) == -1) {
- tst_brkm(TBROK, cleanup, "failed to stat directory %s"
- "in setup()", fname);
- /* NOTREACHED */
- }
-
- d_olddev = buf1.st_dev;
- d_oldino = buf1.st_ino;
-}
-
-/*
- * 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/rename02.c b/winsup/testsuite/winsup.api/ltp/rename02.c
deleted file mode 100644
index 1ad0fb01e..000000000
--- a/winsup/testsuite/winsup.api/ltp/rename02.c
+++ /dev/null
@@ -1,251 +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 : rename02
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for rename(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.) rename(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 rename(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
- * rename(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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-void do_file_setup();
-
-
-
-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 e83923901..000000000
--- a/winsup/testsuite/winsup.api/ltp/rename08.c
+++ /dev/null
@@ -1,206 +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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-extern void do_file_setup(char *);
-
-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 c1aae92b5..000000000
--- a/winsup/testsuite/winsup.api/ltp/rename10.c
+++ /dev/null
@@ -1,204 +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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-extern void do_file_setup(char *);
-
-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 5b16a518b..000000000
--- a/winsup/testsuite/winsup.api/ltp/rmdir01.c
+++ /dev/null
@@ -1,190 +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 <errno.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-#define PERMS 0777
-
-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 5cf84f770..000000000
--- a/winsup/testsuite/winsup.api/ltp/rmdir04.c
+++ /dev/null
@@ -1,237 +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 <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 b363735c0..000000000
--- a/winsup/testsuite/winsup.api/ltp/rmdir05.c
+++ /dev/null
@@ -1,448 +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 <errno.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdlib.h>
-#include <string.h>
-#include "test.h"
-#include "usctest.h"
-
-
-void setup();
-void cleanup();
-
-
-extern char *get_high_address();
-
-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 08fb0a184..000000000
--- a/winsup/testsuite/winsup.api/ltp/sbrk01.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 : 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 <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/types.h>
-
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-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 6ff0fe87b..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 <errno.h>
-#include <signal.h>
-#include <fcntl.h> /* For open system call parameters. */
-#include <signal.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/time.h>
-
-#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 <strings.h>
-#endif
-
-#include "test.h"
-#include "usctest.h"
-
-#define FILENAME "select01"
-
-void setup();
-void cleanup();
-
-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 8b2669564..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 <errno.h>
-#include <signal.h>
-#include <fcntl.h> /* For open system call parameters. */
-#include <signal.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/time.h>
-
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-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 d0959cb35..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 <errno.h>
-#include <signal.h>
-#include <fcntl.h> /* For open system call parameters. */
-#include <signal.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-
-
-#include "test.h"
-#include "usctest.h"
-
-#define FILENAME "select03"
-
-extern void setup();
-extern void cleanup();
-
-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 50b339d03..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 <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 dc7bd1d47..000000000
--- a/winsup/testsuite/winsup.api/ltp/setgroups01.c
+++ /dev/null
@@ -1,229 +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 <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/param.h>
-#include <unistd.h>
-#include <grp.h>
-
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-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 e580a34f7..000000000
--- a/winsup/testsuite/winsup.api/ltp/setpgid01.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 : 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 <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/wait.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 e247f6c61..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 <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 67f3bae4a..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 <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 4437108c8..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 <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-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 65576af62..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 <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 38ba72b3c..000000000
--- a/winsup/testsuite/winsup.api/ltp/signal03.c
+++ /dev/null
@@ -1,665 +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 <signal.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/wait.h>
-
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-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;
-
-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 46b8262d5..000000000
--- a/winsup/testsuite/winsup.api/ltp/stat01.c
+++ /dev/null
@@ -1,268 +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: <for command-line>
- * 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 <stdio.h>
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <pwd.h>
-
-#include "test.h"
-#include "usctest.h"
-
-#define FILE_MODE 0644
-#define TESTFILE "testfile"
-#define FILE_SIZE 1024
-#define BUF_SIZE 256
-#define MASK 0777
-
-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(); /* 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 06bf73a35..000000000
--- a/winsup/testsuite/winsup.api/ltp/stat02.c
+++ /dev/null
@@ -1,277 +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: <for command-line>
- * 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 <stdio.h>
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <pwd.h>
-
-#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
-
-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(); /* 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 2d04ec4fc..000000000
--- a/winsup/testsuite/winsup.api/ltp/stat03.c
+++ /dev/null
@@ -1,393 +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: <for command-line>
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <pwd.h>
-
-#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*/
- char *pathname;
- 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 }
-};
-
-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(); /* 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 */
- char *file_name; /* ptr. for file name whose mode is modified*/
- 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 ba102e3cb..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 90ee05a4c..000000000
--- a/winsup/testsuite/winsup.api/ltp/stat06.c
+++ /dev/null
@@ -1,378 +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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <setjmp.h>
-#include <unistd.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-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 {
- char *pathname;
- struct stat *stbuf;
- 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 */
- char *fname;
- 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 dcd6a749b..000000000
--- a/winsup/testsuite/winsup.api/ltp/symlink01.c
+++ /dev/null
@@ -1,2033 +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 <stdio.h>
-#include <signal.h>
-#include <string.h>
-#include <fcntl.h> /* open(2) system call */
-#include <errno.h>
-#include <sys/types.h>
-#include <utime.h> /* utime(2) system call */
-#include <sys/param.h>
-#include <sys/stat.h> /* stat(2) and lstat(2) system calls */
-
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-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
-{
- char *tcid;
- int test_fail;
- int errno_val;
- int pass_msg;
- int (*test_setup)();
- int (*ck_test)();
- 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
-{
- char *tcid;
- char *syscall;
- int test_cases; /* number of entries in test_objects array */
- struct all_test_cases *tc_ptr;
- 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;
-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;
-{
- int 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:%d) and of\n\t\t\
-%s (ino:%d), 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()
-{
- int ind;
-
- printf(" -T id Determines which tests cases to execute:\n");
-
- for (ind=0; ind<sizeof(all_tcses)/sizeof(struct tcses ); ind++) {
- printf(" %s/%s - %s\n", all_tcses[ind].tcid, all_tcses[ind].syscall,
- all_tcses[ind].desc);
- }
-}
diff --git a/winsup/testsuite/winsup.api/ltp/symlink02.c b/winsup/testsuite/winsup.api/ltp/symlink02.c
deleted file mode 100644
index 9fbecf202..000000000
--- a/winsup/testsuite/winsup.api/ltp/symlink02.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 : symlink02
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for symlink(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.) symlink(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 symlink(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
- * symlink(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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 9cdb74b18..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: <for command-line>
- * 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 <stdio.h>
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-
-#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"
-
-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*/
- char *file;
- char *link;
- 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 */
-extern void cleanup(); /* Cleanup function for the test */
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
- char *test_file; /* testfile name */
- char *sym_file; /* symbolic link file name */
- 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 8272d368c..000000000
--- a/winsup/testsuite/winsup.api/ltp/symlink04.c
+++ /dev/null
@@ -1,239 +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: <for command-line>
- * 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 <stdio.h>
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include "test.h"
-#include "usctest.h"
-
-#define TESTFILE "testfile"
-#define SYMFILE "slink_file"
-#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
-
-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 */
-extern void cleanup(); /* 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 36aff558f..000000000
--- a/winsup/testsuite/winsup.api/ltp/symlink05.c
+++ /dev/null
@@ -1,223 +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: <for command-line>
- * 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 <stdio.h>
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-
-#include "test.h"
-#include "usctest.h"
-
-#define TESTFILE "testfile"
-#define SYMFILE "slink_file"
-
-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 */
-extern void cleanup(); /* 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 a32b24ba8..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 <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 443df02bf..000000000
--- a/winsup/testsuite/winsup.api/ltp/sync02.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: 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: <for command-line>
- * 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 <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-
-#include "test.h"
-#include "usctest.h"
-
-#define TEMP_FILE "temp_file"
-#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
-
-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(); /* 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)) != \
- 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 570dedc6b..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 <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <time.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 827ed3201..000000000
--- a/winsup/testsuite/winsup.api/ltp/time02.c
+++ /dev/null
@@ -1,183 +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: <for command-line>
- * 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 <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <time.h>
-#include <sys/types.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup(); /* setup function for the test */
-extern void cleanup(); /* cleanup function for the test */
-
-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 0d8d1d0ca..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 <sys/types.h>
-#include <sys/times.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 825046430..000000000
--- a/winsup/testsuite/winsup.api/ltp/times02.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
- * 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: <for command-line>
- * 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 <sys/times.h>
-#include <errno.h>
-#include <test.h>
-#include <usctest.h>
-
-char *TCID = "times02";
-int TST_TOTAL = 1;
-extern int Tst_count;
-int exp_enos[]={EFAULT, 0};
-
-void setup(void);
-void cleanup(void);
-
-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 a388c77f7..000000000
--- a/winsup/testsuite/winsup.api/ltp/times03.c
+++ /dev/null
@@ -1,246 +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: <for command-line>
- * 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 <sys/types.h>
-#include <sys/times.h>
-#include <errno.h>
-#include <sys/wait.h>
-#include <test.h>
-#include <usctest.h>
-
-char *TCID = "times01";
-int TST_TOTAL = 1;
-extern int Tst_count;
-int exp_enos[]={0};
-
-void setup(void);
-void cleanup(void);
-
-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, pid1, 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) == -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) == -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) == -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) == -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 d8dc1b68e..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: <for command-line>
- * 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 <sys/types.h>
-#include <sys/stat.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#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 */
-
-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(); /* 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 b6e535cca..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: <for command-line>
- * 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 <sys/types.h>
-#include <sys/stat.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#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 */
-
-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(); /* 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 655c9e32e..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 <ulimit.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-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<TST_TOTAL; i++) {
-
- cmd=Scenarios[i].cmd;
- limit=Scenarios[i].newlimit;
-
- /*
- * Call ulimit(2)
- */
- TEST(ulimit(cmd, limit));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- if ( Scenarios[i].exp_fail ) {
- if ( STD_FUNCTIONAL_TEST ) {
- tst_resm(TPASS, "ulimit(%d, %d) Failed, errno=%d : %s", cmd, limit,
- TEST_ERRNO, strerror(TEST_ERRNO));
- }
- } else {
- tst_resm(TFAIL, "ulimit(%d, %d) Failed, errno=%d : %s", cmd, limit,
- TEST_ERRNO, strerror(TEST_ERRNO));
- }
- } else {
- if ( Scenarios[i].exp_fail ) {
- tst_resm(TFAIL, "ulimit(%d, %d) returned %d",
- cmd, limit, TEST_RETURN);
- } else if ( STD_FUNCTIONAL_TEST ) {
- tst_resm(TPASS, "ulimit(%d, %d) returned %d",
- cmd, limit, TEST_RETURN);
- }
-
- /*
- * Save the UL_GETFSIZE return value in the newlimit field
- * for UL_SETFSIZE test cases.
- */
- if ( cmd == UL_GETFSIZE ) {
- for (tmp=i+1; tmp<TST_TOTAL; tmp++) {
- if ( Scenarios[tmp].nlim_flag == 1 ) {
- Scenarios[tmp].newlimit = TEST_RETURN;
- }
- if ( Scenarios[tmp].nlim_flag == 2 ) {
- Scenarios[tmp].newlimit = TEST_RETURN-1;
- }
- }
- }
- }
- }
- } /* 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.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/umask01.c b/winsup/testsuite/winsup.api/ltp/umask01.c
deleted file mode 100644
index 04b385145..000000000
--- a/winsup/testsuite/winsup.api/ltp/umask01.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 Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : umask01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for umask(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.) umask(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 umask(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
- * umask(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 <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 f7d7c3bc8..000000000
--- a/winsup/testsuite/winsup.api/ltp/umask02.c
+++ /dev/null
@@ -1,134 +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: <for command-line>
- * 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 <stdio.h>
-#include "test.h"
-#include "usctest.h"
-
-char *TCID = "umask02";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-void setup(void);
-void cleanup(void);
-
-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 8d032ca5c..000000000
--- a/winsup/testsuite/winsup.api/ltp/umask03.c
+++ /dev/null
@@ -1,169 +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: <for command-line>
- * 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 <stdio.h>
-#include "test.h"
-#include "usctest.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-
-char *TCID = "umask01";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-char filname[40];
-
-void setup(void);
-void cleanup(void);
-
-main(int argc, char **argv)
-{
- int lc;
- const char *msg;
-
- struct stat statbuf;
- int 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 e2f8f8b0c..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 <sys/utsname.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 63e97df89..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-void create_file();
-
-
-
-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 3d0690383..000000000
--- a/winsup/testsuite/winsup.api/ltp/unlink06.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 : 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 <sys/types.h>
-#include <sys/stat.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <unistd.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void create_file();
-void cleanup();
-
-
-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 889b60959..000000000
--- a/winsup/testsuite/winsup.api/ltp/unlink07.c
+++ /dev/null
@@ -1,329 +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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <unistd.h>
-#include <sys/param.h> /* for PATH_MAX */
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-extern char *get_high_address();
-
-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 {
- char *pathname;
- 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 */
- char *fname;
- 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 a426aa03f..000000000
--- a/winsup/testsuite/winsup.api/ltp/unlink08.c
+++ /dev/null
@@ -1,433 +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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <signal.h>
-#include <unistd.h>
-#include <string.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-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 {
- char *pathname;
- 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 */
- char *fname;
- 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 41e48c461..000000000
--- a/winsup/testsuite/winsup.api/ltp/vfork01.c
+++ /dev/null
@@ -1,402 +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: <for command-line>
- * 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 <stdio.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-
-#include "test.h"
-#include "usctest.h"
-
-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(); /* 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 8b4f41b09..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 <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 0d307e247..000000000
--- a/winsup/testsuite/winsup.api/ltp/wait401.c
+++ /dev/null
@@ -1,187 +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: <for command-line>
- * 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 <errno.h>
-#define _USE_BSD
-#include <sys/types.h>
-#include <sys/resource.h>
-#include <sys/wait.h>
-
-void cleanup(void);
-void setup(void);
-
-char *TCID= "wait401()";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-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 43a5c22d3..000000000
--- a/winsup/testsuite/winsup.api/ltp/wait402.c
+++ /dev/null
@@ -1,202 +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: <for command-line>
- * 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 <errno.h>
-#define _USE_BSD
-#include <sys/types.h>
-#include <sys/resource.h>
-#include <sys/wait.h>
-
-/*
- * See the Makefile for comments about the following preprocessor code.
- */
-#if defined (__CYGWIN__)
-#define PID_MAX 0xfffffffd
-#else
-#ifndef _LTP_TASKS_H
-#include <linux/threads.h> /* for PID_MAX value - new */
-#else
-#include <linux/tasks.h> /* for PID_MAX value - old */
-#endif
-#endif
-
-void cleanup(void);
-void setup(void);
-
-char *TCID= "wait402()";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-int exp_enos[] = {10, 0};
-
-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 0fae9aea1..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 <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-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 1ee10fd9a..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: <for command-line>
- * 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 <errno.h>
-#include <stdio.h>
-#include "test.h"
-#include "usctest.h"
-
-char *TCID = "write02()";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-void cleanup(void);
-void setup(void);
-
-char pfiln[40] = "";
-
-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;
-
-block1:
- 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 5343c6484..000000000
--- a/winsup/testsuite/winsup.api/ltp/write03.c
+++ /dev/null
@@ -1,193 +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: <for command-line>
- * 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 <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <test.h>
-#include <usctest.h>
-
-/* 0 terminated list of expected errnos */
-int exp_enos[] = {14,0};
-
-char *TCID = "write03";
-int TST_TOTAL = 1;
-extern int Tst_count;
-
-void setup(void);
-void cleanup(void);
-
-int fd = -1;
-char filename[100];
-
-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;
-
-block1:
- 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 a48110eb7..000000000
--- a/winsup/testsuite/winsup.api/mmaptest01.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- Copyright 2001 Free Software Foundation, Inc.
- Written by Michael Chastain, <chastain@redhat.com>
- Changes by Corinna Vinschen, <corinna@vinschen.de>:
- - 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 <sys/mman.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "test.h"
-#include "usctest.h"
-
-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 ()
-{
- int ret = 0;
-
- char fnam1[32];
- char fnam2[32];
-
- int fd1;
- char * buf1;
-
- int fd2;
- char * buf2;
-
- char buf3[20];
-
- int 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");
- 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 ec5bac7f7..000000000
--- a/winsup/testsuite/winsup.api/mmaptest02.c
+++ /dev/null
@@ -1,189 +0,0 @@
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <setjmp.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-
-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 (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 544e3e43c..000000000
--- a/winsup/testsuite/winsup.api/mmaptest03.c
+++ /dev/null
@@ -1,127 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <setjmp.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <sys/wait.h>
-#include <errno.h>
-
-/* - 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;
-
-/* 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 (char *str)
-{
- printf ("%s: %s\n", str, strerror (errno));
- exit (1);
-}
-
-void
-sigsegv (int unused)
-{
- sigprocmask (SIG_UNBLOCK, &unblock_sigsegv, 0);
- longjmp (r, 1);
-}
-
-int
-main(int argc, char **argv)
-{
- int i, fd, status;
- struct stat statbuf;
- 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");
-
- pid = fork();
-
- if (pid == -1)
- perror_exit ("fork failed");
-
- if (setjmp (r))
- perror_exit (pid ? "SEGV in parent" : "SEGV in child");
-
- c = buf1[0];
- c = buf2[0];
-
- if (setjmp (r))
- perror_exit (pid ? "SEGV in parent's munmap" : "SEGV in child's munmap");
-
- if (munmap(buf1, statbuf.st_size))
- perror_exit (pid ? "munmap failed in parent" : "munmap failed in child");
-
- if (setjmp (r) == 0)
- {
- 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");
-
- c = buf2[0];
-
- if (setjmp (r))
- perror_exit (pid ? "SEGV in parent's munmap" : "SEGV in child's munmap");
-
- if (munmap(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))
- 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 56c4a88b7..000000000
--- a/winsup/testsuite/winsup.api/mmaptest04.c
+++ /dev/null
@@ -1,100 +0,0 @@
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <errno.h>
-
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-int
-main ()
-{
- char *data, *data2, *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/nullgetcwd.c b/winsup/testsuite/winsup.api/nullgetcwd.c
deleted file mode 100644
index f7d873261..000000000
--- a/winsup/testsuite/winsup.api/nullgetcwd.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-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/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 <sys/timeb.h>
-
-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 <sys/timeb.h>
-
-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 <sys/timeb.h>
-
-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 <sys/timeb.h>
-
-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 <sys/timeb.h>
-
-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 <sys/timeb.h>
-
-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 <sys/timeb.h>
-
-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 <sys/timeb.h>
-
-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 <sys/timeb.h>
-
-/*
- * 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/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 <sys/timeb.h>
-
-/*
- * 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/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, &param) == 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, &param) == 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/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/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/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/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, &param) == 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, &param) == 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, &param) == 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, &param) == 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/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 <string.h>
-
-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 a9a211dd7..000000000
--- a/winsup/testsuite/winsup.api/pthread/test.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * test.h
- *
- * Useful definitions and declarations for tests.
- */
-
-#ifndef _PTHREAD_TEST_H_
-#define _PTHREAD_TEST_H_
-
-#include "pthread.h"
-#include "sched.h"
-#include "semaphore.h"
-#include <stdio.h>
-#include <windows.h>
-#include <errno.h>
-
-/* #define assert(x) do { fprint (stderr, "assertion failed\n"); exit(1) } while (0) */
-
-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/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 <sched.h>
-#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/samples/sample-fail.c b/winsup/testsuite/winsup.api/samples/sample-fail.c
deleted file mode 100644
index d8beb90be..000000000
--- a/winsup/testsuite/winsup.api/samples/sample-fail.c
+++ /dev/null
@@ -1,4 +0,0 @@
-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 893a0b605..000000000
--- a/winsup/testsuite/winsup.api/samples/sample-pass.c
+++ /dev/null
@@ -1,4 +0,0 @@
-main()
-{
- return 0;
-}
diff --git a/winsup/testsuite/winsup.api/sigchld.c b/winsup/testsuite/winsup.api/sigchld.c
deleted file mode 100644
index a7d1069b7..000000000
--- a/winsup/testsuite/winsup.api/sigchld.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <sys/types.h>
-#include <unistd.h>
-#include <signal.h>
-
-int no_signal_caught = 1;
-
-void handler ( int signo )
-{
- no_signal_caught = 0;
-}
-
-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 23437c407..000000000
--- a/winsup/testsuite/winsup.api/signal-into-win32-api.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Test if signal is delivered to the application which is
- * currently inside of native syscall
- */
-
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <windows.h>
-
-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", 0 );
- 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;
- }
-}
diff --git a/winsup/testsuite/winsup.api/systemcall.c b/winsup/testsuite/winsup.api/systemcall.c
deleted file mode 100644
index 026f430ff..000000000
--- a/winsup/testsuite/winsup.api/systemcall.c
+++ /dev/null
@@ -1,65 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-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 ());
- 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 ());
- exit (1);
- }
- if (pipe (fds))
- {
- fprintf (stderr, "pipe call failed - %s\n", strerror ());
- 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 ());
- 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", n);
- exit (1);
- }
- exit (0);
-}
diff --git a/winsup/testsuite/winsup.api/waitpid.c b/winsup/testsuite/winsup.api/waitpid.c
deleted file mode 100644
index 9845cd1a4..000000000
--- a/winsup/testsuite/winsup.api/waitpid.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdio.h>
-#include <sys/wait.h>
-#include <errno.h>
-
-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 1d45c9527..000000000
--- a/winsup/testsuite/winsup.api/winsup.exp
+++ /dev/null
@@ -1,81 +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 [eval "exec $cmd"] rv
- verbose send "catchCode = $rv\n"
-}
-
-verbose "Filter: $test_filter"
-
-foreach src [glob -nocomplain $srcdir/$subdir/*.c $srcdir/$subdir/*/*.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
- }
-
- ws_spawn "$CC -g3 $CFLAGS $src $add_includes $add_libs $runtime_root/binmode.o $runtime_root/new-libcygwin.a -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 "$runtime_root/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/ChangeLog b/winsup/utils/ChangeLog
deleted file mode 100644
index 5c8dc8335..000000000
--- a/winsup/utils/ChangeLog
+++ /dev/null
@@ -1,831 +0,0 @@
-2002-06-14 Corinna Vinschen <corinna@vinschen.de>
-
- * 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 <joshuadfranklin@yahoo.com>
-
- * passwd.c (GetPW): Handle case of user-edited /etc/passwd
- with cygwin_internal (CW_EXTRACT_DOMAIN_AND_USER, ...).
-
-2002-06-09 Christopher Faylor <cgf@redhat.com>
-
- * path.cc (cygpath): Change MOUNT_AUTO to MOUNT_CYGDRIVE.
- (getmntent): Ditto.
-
-2002-06-09 Christopher Faylor <cgf@redhat.com>
-
- * 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 <cgf@redhat.com>
-
- * mount.cc (opts): Remove '-i' option.
- (usage): Ditto.
- (main): Ditto.
- (longopts): Remove --import-old-mounts option.
-
-2002-06-07 David Peterson <chief@mail.idrive.com>
- Christopher Faylor <cgf@redhat.com>
-
- * 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 <deo@logos-m.ru>
-
- * 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 <cgf@redhat.com>
-
- * strace.cc (main): Make toggle a local variable.
-
-2002-06-07 Conrad Scott <conrad.scott@dsl.pipex.com>
-
- * 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 <joshuadfranklin@yahoo.com>
-
- * strace.cc (version): New global variable.
- (usage): Accommodate stdout output.
- (print_version): New function.
-
-2002-06-03 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * 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 <joshuadfranklin@yahoo.com>
-
- * 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 <joshuadfranklin@yahoo.com>
-
- * 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 <cgf@redhat.com>
-
- * 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 <cgf@redhat.com>
-
- * mkpasswd.cc (main): Don't reset to binmode if stdout is a terminal.
-
-2002-05-29 Christopher Faylor <cgf@redhat.com>
-
- * mount.cc (main): Make -b the default.
-
-2002-05-29 Corinna Vinschen <corinna@vinschen.de>
-
- * 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 <corinna@vinschen.de>
-
- * 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 <joshuadfranklin@yahoo.com>
-
- * 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 <joshuadfranklin@yahoo.com>
-
- * ps.cc (usage): Fix typo.
-
-2002-05-27 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * 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 <cgf@redhat.com>
-
- * 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 <joshuadfranklin@yahoo.com>
-
- * setfacl.c (usage): Standardize usage output. Change return type to
- static void.
- (print_version): New function.
- (longopts): Added longopts for all options.
- (main): Accommodate changes in usage function and new version option.
-
-2002-05-23 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * 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 <joshuadfranklin@yahoo.com>
-
- * 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 <corinna@vinschen.de>
-
- * cygpath.cc (usage): Change usage output slightly.
-
-2002-05-20 Joerg Schaible <joerg.schaible@gmx.de>
-
- * 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 <cgf@redhat.com>
-
- * strace.cc (add_child): Use calloc since new requires working
- libstdc++.a.
- (remove_child): Ditto for delete/free.
-
-2002-05-15 Mark Blackburn <marklist@fangorn.ca>
-
- * cygpath.cc (get_short_paths): Fix more error checking.
- (get_short_name): Ditto.
-
-2002-05-14 Joerg Schaible <joerg.schaible@gmx.de>
-
- * 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 <marklist@fangorn.ca>
-
- * cygpath.cc (get_short_paths): Fix error checking.
-
-2002-05-13 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * 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 <cgf@redhat.com>
-
- * kill.cc (listsig): Display numeric id when given symbolic input.
-
-2002-05-13 Christopher Faylor <cgf@redhat.com>
-
- * kill.cc (usage): Show new options. Allow specification of output
- stream.
- (main): Implement 'h' option.
-
-2002-05-13 Christopher Faylor <cgf@redhat.com>
-
- * 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 <cgf@redhat.com>
-
- * 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 <joshuadfranklin@yahoo.com>
-
- * 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 <corinna@vinschen.de>
-
- * 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 <cgf@redhat.com>
-
- * 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 <joshuadfranklin@yahoo.com>
-
- * 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 <corinna@vinschen.de>
-
- * mkgroup.c (main): When generating group 513, check for computer's
- primary domain instead of current user's domain.
-
-2002-03-14 Corinna Vinschen <corinna@vinschen.de>
-
- * 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 <joshuadfranklin@yahoo.com>
-
- * kill.cc (usage): Move to top of file.
- (getsig): Ditto.
- (forcekill): Ditto.
-
-2002-03-06 Christopher Faylor <cgf@redhat.com>
-
- * cygcheck.cc: Reformat.
-
-2002-03-06 Christopher Faylor <cgf@redhat.com>
-
- * cygcheck.cc (longopts): Use correct short option for --version.
-
-2002-03-06 Christopher Faylor <cgf@redhat.com>
-
- * cygpath.cc: Reformat.
-
-2002-02-27 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * cygpath.cc (print_version): New function.
- (main): Accommodate new version function. Initialize 'o' to prevent
- warning.
-
-2002-02-27 Christopher Faylor <cgf@redhat.com>
-
- * cygcheck.cc (main): Eliminate non-GNU formatting glitch.
-
-2002-02-27 Christopher Faylor <cgf@redhat.com>
-
- * ssp.c (help_desk): Fix compiler warning.
-
-2002-02-27 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
- Christopher Faylor <cgf@redhat.com>
-
- 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 <cgf@redhat.com>
-
- * 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 <cgf@redhat.com>
-
- * mount.cc (usage): Fix typo in output.
-
-2002-02-14 Christopher Faylor <cgf@redhat.com>
-
- * strace.cc (attach_process): Change CW_STRACE_ON to CW_STRACE_TOGGLE.
-
-2002-01-31 Corinna Vinschen <corinna@vinschen.de>
-
- * mkpasswd.c (main): Set default home path for 9x/Me if --path-to-home
- isn't given.
-
-2002-01-30 Corinna Vinschen <corinna@vinschen.de>
-
- * 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 <cgf@redhat.com>
-
- * dump_setup.cc (parse_filename): Don't consider '_' part of the
- version.
-
-2002-01-28 Christopher Faylor <cgf@redhat.com>
-
- * 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 <cgf@redhat.com>
-
- * cygcheck.cc: Use specific cygwin includes, as required.
-
-2002-01-28 Christopher Faylor <cgf@redhat.com>
-
- * 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 <cgf@redhat.com>
-
- * Makefile.in (CXXFLAGS): Ensure that important settings are preserved
- even when overriden by command line.
-
-2002-01-21 Christopher Faylor <cgf@redhat.com>
-
- * 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 <dj@redhat.com>
-
- * Makefile.in: Use CXX instead of CC to compile C++ sources.
-
-2002-01-17 DJ Delorie <dj@redhat.com>
-
- * cygcheck.cc (already_did): Avoid default constructors, which may
- require exception support.
-
-2001-01-16 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * 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 <joerg.schaible@gmx.de>
-
- * cygpath.cc (doit): Empty file ignored using option -i.
-
-2002-01-15 Mark Bradshaw <bradshaw@crosswalk.com>
-
- * 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 <jik@curl.com>
-
- * 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 <jason@tishler.net>
-
- * 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 <jason@tishler.net>
-
- * mkpasswd.c (opts): Add indication that '-p' option requires an
- argument.
-
-2001-12-11 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Add define to CXXFLAGS.
-
-2001-12-03 Christopher Faylor <cgf@redhat.com>
-
- * cygcheck.cc (usage): Add -c description.
- * cygpath.cc (usage): Alphabetize options.
- * strace.cc (usage): Ditto.
-
-2001-11-21 Christopher Faylor <cgf@redhat.com>
-
- * path.cc (cygpath): Don't consider cygdrive stuff when trying to derive
- native paths.
-
-2001-11-20 Mark Bradshaw <bradshaw@staff.crosswalk.com>
-
- * 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 <g.r.vansickle@worldnet.att.net>
-
- * 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 <corinna@vinschen.de>
-
- * cygcheck.cc (dump_sysinfo): Redefine output format slightly.
- Print correct build number on 9x/ME systems.
-
-2001-11-12 Christopher Faylor <cgf@redhat.com>
-
- * cygcheck.cc (main): Slight formatting tweak.
-
-2001-11-12 Corinna Vinschen <corinna@vinschen.de>
-
- * cygcheck.cc (dump_sysinfo): Add some more details.
-
-2001-11-12 Corinna Vinschen <corinna@vinschen.de>
-
- * cygcheck.cc (dump_sysinfo): Print more detailed OS information string
- using OSVERSIONINFOEX information.
-
-2001-11-11 Christopher Faylor <cgf@redhat.com>
-
- * path.h: New file.
-
-2001-11-11 Christopher Faylor <cgf@redhat.com>
-
- * 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 <cgf@redhat.com>
-
- * 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 <cgf@redhat.com>
-
- * 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 <cgf@redhat.com>
-
- * 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 <corinna@vinschen.de>
-
- * cygcheck.cc (dump_sysinfo): Print more detailed OS information string.
-
-2001-11-04 Corinna Vinschen <corinna@vinschen.de>
-
- * 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 <deo@logos-m.ru>
-
- * 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 <cgf@redhat.com>
-
- * Makefile.in: Remove EXEEXT consideration. We always need .exe
- extensions.
-
-2001-10-20 Corinna Vinschen <corinna@vinschen.de>
-
- * 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 <cgf@redhat.com>
-
- * mkpasswd.cc (enum_users): Shorten "unused" passwd field.
-
-2001-10-13 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Allow stdinc searching for dumper.
-
-Tue Oct 9 21:59:00 2001 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in (MINGW_INCLUDES): Accommodate changes in Makefile.common.
-
-Sun Oct 7 23:06:39 2001 Christopher Faylor <cgf@cygnus.com>
-
- * kill.cc (main): Set exit value to 1 on invalid pid. Perform minor
- cleanup.
-
-Fri Sep 21 20:40:30 2001 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in (mingw_getopt.o): Ensure that newlib include directories
- are not searched.
-
-Thu Sep 20 21:00:20 2001 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in (MINGW_INCLUDES): Still need cygwin/include directory.
-
-Wed Sep 19 12:22:08 2001 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Filter newlib includes from mingw compilation.
-
-2001-09-14 Egor Duda <deo@logos-m.ru>
-
- * 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 <deo@logos-m.ru>
-
- * dumper.cc (main): Properly recognize negative pids (used by w9x).
-
-2001-09-09 Egor Duda <deo@logos-m.ru>
-
- * 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 <cgf@cygnus.com>
-
- * 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 <mchase@ix.netcom.com>
-
- * mount.cc (mount_commands): Don't write /cygdrive/u mount points.
-
-2001-09-03 Michael A Chase <mchase@ix.netcom.com>
-
- * 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 <cgf@cygnus.com>
-
- * mount.cc (main): Eliminate excess arguments in printf.
-
-2001-08-30 Egor Duda <deo@logos-m.ru>
-
- * 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 <cgf@cygnus.com>
-
- * mount.cc (main): Issue correct warning for 'not enough arguments'.
-
-2001-08-14 Joerg Schaible <joerg.schaible@gmx.de>
-
- * cygpath.cc (main): Support -w for Windows (System) directories and
- return physical correct orthography for the Windows System dir.
-
-2001-07-14 Chris Genly <chgenly@alum.mit.edu>
-
- * regtool.cc (find_key): Handle keys with only one subkey.
-
-Wed Jun 27 22:46:10 2001 Christopher Faylor <cgf@cygnus.com>
-
- * regtool.cc (find_key): Revert previous change.
-
-Wed Jun 27 13:37:41 2001 Keith Starsmeare" <keith_starsmeare@yahoo.co.uk>
-
- * regtool.cc (find_key): Allow '/' as a synonym for '\\'.
-
-Fri Jun 15 00:49:21 2001 Christopher Faylor <cgf@cygnus.com>
-
- * 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 <cgf@cygnus.com>
-
- * mkpasswd.c (enum_users): Use /bin/bash as the default shell.
- (main): Ditto.
-
-Sat Apr 28 22:32:01 2001 Christopher Faylor <cgf@cygnus.com>
-
- * passwd.cc (ttymnam): New function.
- (main): Use ttynam() to report name of tty.
-
-2001-04-19 Egor Duda <deo@logos-m.ru>
-
- * dumper.cc (dumper::init_core_dump): Set architecture field in dump
- header.
-
-Mon Apr 16 15:08:00 2001 Corinna Vinschen <vinschen@redhat.com>
-
- * 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 <mchase@ix.netcom.com>
-
- * 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 <fujieda@jaist.ac.jp>
-
- * 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 <deo@logos-m.ru>
-
- * 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 <cgf@cygnus.com>
-
- * 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 <cgf@cygnus.com>
-
- * 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 <cgf@cygnus.com>
-
- * kill.cc (forcekill): Use dwProcessId when opening a process, not the
- Cygwin pid.
-
-Mon Mar 5 18:50:00 2001 Corinna Vinschen <vinschen@redhat.com>
-
- * getfacl.c: Add copyright hint.
- * setfacl.c: Ditto.
- * strace.cc: Ditto.
-
-Tue Jan 09 10:26:23 2001 Tony Sideris <tonys1110@home.com>
-
- * 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 <cgf@cygnus.com>
-
- * 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 <cgf@cygnus.com>
-
- * cygcheck.cc (cygwin_info): Add some more bounds checking.
-
-Fri Dec 15 23:41:34 2000 Christopher Faylor <cgf@cygnus.com>
-
- From Matt Harget <matt@use.net>:
- * 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 <cgf@cygnus.com>
-
- * Makefile.in: Compile/link dumper.exe with c++.
-
-Tue Dec 7 11:15:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * 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 <cabbey@bresnanlink.net>
-
- * 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 <cgf@cygnus.com>
-
- * 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 <cgf@cygnus.com>
-
- * utils.sgml: Document new options for ps and strace.
-
-Wed Nov 8 08:49:27 2000 Jason Tishler <jt@dothill.com>
-
- * 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 <corinna@vinschen.de>
-
- * 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 <corinna@vinschen.de>
-
- * kill.cc (main): Return 1 in case of errors.
-
-Sat Oct 28 01:37:55 2000 Christopher Faylor <cgf@cygnus.com>
-
- * 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 <cgf@cygnus.com>
-
- * strace.cc (main): Add a '-b' option.
-
-2000-10-18 DJ Delorie <dj@redhat.com>
-
- * ssp.c: new
- * ssp.txt: new
- * Makefile.in: build ssp.exe
-
-Wed Oct 18 18:57:46 2000 Christopher Faylor <cgf@cygnus.com>
-
- * ps.cc (main): Add some extra space to Windows pid output for
- Windows 95.
-
-Tue Oct 17 23:49:04 2000 Christopher Faylor <cgf@cygnus.com>
-
- * ps.cc (main): Add some extra space to pid output for Windows 95.
-
-Tue Oct 17 1:09:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- Patch suggested by Brad Town <btown@ceddec.com>:
- * cygcheck.cc (main): Fix argument counting.
-
-Sat Oct 14 23:42:58 2000 Christopher Faylor <cgf@cygnus.com>
-
- * ps.cc (main): Accomodate new PID_ constant.
-
-Thu Oct 12 02:19:12 2000 Christopher Faylor <cgf@cygnus.com>
-
- * strace.cc (proc_child): Handle exceptions correctly.
-
-Sun Oct 8 23:11:17 2000 Christopher Faylor <cgf@cygnus.com>
-
- * 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 <corinna@vinschen.de>
-
- * 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 <corinna@vinschen.de>
-
- * cygkeycheck.cc: New file. Utility to retrieve keycodes.
- * Makefile.in: Add cygkeycheck to the dependencies.
-
-2000-09-15 Joerg Schaible <joerg.schaible@gmx.de>
-
- * cygpath.cc: Add new options: -s and -i.
- * utils.sgml: Document the new options.
-
-Tue Sep 12 22:45:28 2000 Christopher Faylor <cgf@cygnus.com>
-
- * 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 <cgf@cygnus.com>
-
- * Makefile.in: Refine dumper.exe message.
-
-Mon Aug 28 21:55:56 2000 Christopher Faylor <cgf@cygnus.com>
-
- * 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 <cgf@cygnus.com>
-
- * 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 <cgf@cygnus.com>
-
- * Makefile.in: Make failure to build dumper.exe a non-error.
-
-Thu Aug 24 18:02:35 2000 Christopher Faylor <cgf@cygnus.com>
-
- * ps.cc (main): Always print a cygwin process using cygwin paths.
-
-2000-08-24 Egor Duda <deo@logos-m.ru>
-
- * 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 <corinna@vinschen.de>
-
- * passwd.c (main): Initialize oldpwd before beeing used.
-
-Sat Jul 29 00:44:46 2000 Christopher Faylor <cgf@cygnus.com>
-
- * 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 <jt@dothill.com>
-
- * 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 <corinna@vinschen.de>
-
- * mount.cc (mount_already_exists): Slightly rearrange.
- Change message texts.
-
-Thu Jul 13 13:02:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * 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 <cgf@cygnus.com>
-
- * Makefile.in: Find getopt.c in cygwin/lib subdirectory.
-
-Sat Jun 24 23:16:33 2000 Christopher Faylor <cgf@cygnus.com>
-
- * 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 <fujieda@jaist.ac.jp>
-
- * 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 <dj@cygnus.com>
-
- * 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 <corinna@vinschen.de>
-
- * 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 <dj@cygnus.com>
-
- * cygpath.cc: add --windir/--sysdir options
- * utils.sgml: and document them
-
-Thu May 18 14:38:26 2000 Christopher Faylor <cgf@cygnus.com>
-
- * 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 <cgf@cygnus.com>
-
- * mount.cc (main): Add "-X" option to specify a "Cygwin executable".
-
-Sat Apr 15 23:34:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * 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 <cgf@cygnus.com>
-
- * cygpath.cc (main): Add -a -o and -c options.
- (doit): Ditto.
-
-Mon Apr 10 22:56:07 2000 Christopher Faylor <cgf@cygnus.com>
-
- * 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 <cgf@cygnus.com>
-
- Patch suggested by Mumit Khan <khan@xraylith.wisc.edu>:
- * strace.cc (_impure_ptr): New global variable to make strace build
- under Cygwin gcc.
-
-Sat Mar 18 12:45:10 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Make CXXFLAGS consistent with cygwin.
-
-Wed Mar 15 00:53:58 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Use MINGW_CXXFLAGS when compiling strace.
-
-Sun Mar 12 21:22:25 2000 Christopher Faylor <cgf@cygnus.com>
-
- * strace.cc: Throughout, track information like start_time, etc. on a
- per-process basis.
-
-Sun Feb 27 23:37:32 2000 Christopher Faylor <cgf@cygnus.com>
-
- * strace.cc (handle_output_debug_string): Parse strace output to allow
- various types of time output.
-
-Fri Jan 21 02:10:26 Corinna Vinschen <corinna@vinschen.de>
-
- * utils/regtool.cc (translate): Added unix like backslash
- processing.
-
-2000-01-20 Corinna Vinschen <corinna@vinschen.de>
-
- * regtool.cc: allow forward slashes as key separators
-
-2000-01-19 DJ Delorie <dj@redhat.com>
-
- * regtool.cc: New file.
- * Makefile.in: add regtool
- * utils.sgml: add regtool
-
-Sat Jan 8 17:13:51 2000 Christopher Faylor <cgf@cygnus.com>
-
- * 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/Makefile.in b/winsup/utils/Makefile.in
deleted file mode 100644
index 19346c474..000000000
--- a/winsup/utils/Makefile.in
+++ /dev/null
@@ -1,218 +0,0 @@
-# Makefile for Cygwin utilities
-# Copyright 1996, 1997, 1998, 1999, 2000, 2001 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@
-prefix:=@prefix@
-exec_prefix:=@exec_prefix@
-
-bindir:=@bindir@
-etcdir:=$(exec_prefix)/etc
-program_transform_name:=@program_transform_name@
-
-INSTALL:=@INSTALL@
-INSTALL_PROGRAM:=@INSTALL_PROGRAM@
-INSTALL_DATA:=@INSTALL_DATA@
-
-EXEEXT:=@EXEEXT@
-EXEEXT_FOR_BUILD:=@EXEEXT_FOR_BUILD@
-
-CC:=@CC@
-CC_FOR_TARGET:=$(CC)
-CXX:=@CXX@
-CXX_FOR_TARGET:=$(CXX)
-
-CFLAGS:=@CFLAGS@
-CXXFLAGS:=@CXXFLAGS@
-override CXXFLAGS+=-fno-exceptions -fno-rtti -DHAVE_DECL_GETOPT=0
-
-include $(srcdir)/../Makefile.common
-
-MINGW_INCLUDES:=$(MINGW_INCLUDES) $(w32api_include) -I$(updir)
-
-libbfd:=${shell $(CC) -B$(bupdir2)/bfd/ --print-file-name=libbfd.a}
-libintl:=${shell $(CC) -B$(bupdir2)/intl/ --print-file-name=libintl.a}
-build_dumper:=${shell test -r $(libbfd) && test -r ${libintl} && echo 1}
-
-DUMPER_INCLUDES:=-I$(bupdir2)/bfd -I$(updir1)/include
-
-MINGW_CXXFLAGS:=${filter-out $(newlib_source)/%,$(CXXFLAGS)} -mno-cygwin $(MINGW_INCLUDES)
-MINGW_CFLAGS:=-mno-cygwin $(MINGW_INCLUDES)
-
-libcygwin:=$(cygwin_build)/libcygwin.a
-libuser32:=$(w32api_lib)/libuser32.a
-libkernel32:=$(w32api_lib)/libkernel32.a
-ALL_DEP_LDLIBS:=$(libcygwin) $(w32api_lib)/libnetapi32.a \
- $(w32api_lib)/libadvapi32.a $(w32api_lib)/libkernel32.a \
- $(w32api_lib)/libuser32.a
-
-ALL_LDLIBS:=${patsubst $(w32api_lib)/lib%.a,-l%,\
- ${filter-out $(libuser32),\
- ${filter-out $(libkernel32),\
- ${filter-out $(libcygwin), $(ALL_DEP_LDLIBS)}}}}
-
-MINGW_LIB:=$(mingw_build)/libmingw32.a
-DUMPER_LIB:=${libbfd} ${libintl} -L$(bupdir1)/libiberty -liberty
-MINGW_LDLIBS:=$(ALL_LDLIBS) $(MINGW_LIB)
-MINGW_DEP_LDLIBS:=${ALL_DEP_LDLIBS} ${MINGW_LIB}
-ALL_LDFLAGS:=-B$(newlib_build)/libc/ -B$(newlib_build)/libm/ -B$(w32api_lib)/ \
- $(LDFLAGS) $(ALL_LDLIBS)
-MINGW_LDFLAGS:=$(ALL_LDFLAGS) $(MINGW_LIB)
-DUMPER_LDFLAGS:=$(ALL_LDFLAGS) $(DUMPER_LIB)
-
-PROGS:= cygcheck.exe cygpath.exe getfacl.exe kill.exe mkgroup.exe \
- mkpasswd.exe mount.exe passwd.exe ps.exe regtool.exe setfacl.exe \
- ssp.exe strace.exe umount.exe
-
-CLEAN_PROGS:=$(PROGS)
-ifdef build_dumper
-PROGS+=dumper$(EXEEXT)
-else
-PROGS:=warn_dumper $(PROGS)
-CLEAN_PROGS+=dumper.exe
-endif
-
-.SUFFIXES:
-.NOEXPORT:
-
-.PHONY: all install clean realclean warn_dumper
-
-all: Makefile $(PROGS)
-
-strace.exe: strace.o mingw_getopt.o $(MINGW_DEP_LDLIBS)
-ifdef VERBOSE
- $(CXX) $(MINGW_CXXFLAGS) -o $@ ${wordlist 1,2,$^} -B$(mingw_build)/ $(MINGW_LDFLAGS)
-else
- @echo $(CXX) -o $@ ${wordlist 1,2,$^} ${filter-out -B%, $(MINGW_CXXFLAGS) $(MINGW_LDFLAGS)};\
- $(CXX) $(MINGW_CXXFLAGS) -o $@ ${wordlist 1,2,$^} -B$(mingw_build)/ $(MINGW_LDFLAGS)
-endif
-
-cygcheck.exe: cygcheck.o mingw_getopt.o path.o dump_setup.o $(MINGW_DEP_LDLIBS)
-ifdef VERBOSE
- $(CXX) $(MINGW_CXXFLAGS) -o $@ ${wordlist 1,4,$^} -B$(mingw_build)/ $(MINGW_LDFLAGS)
-else
- @echo $(CXX) -o $@ ${wordlist 1,2,$^} ${filter-out -B%, $(MINGW_CXXFLAGS) $(MINGW_LDFLAGS)};\
- $(CXX) $(MINGW_CXXFLAGS) -o $@ ${wordlist 1,4,$^} -B$(mingw_build)/ $(MINGW_LDFLAGS)
-endif
-
-dumper.o: dumper.cc dumper.h
-ifdef VERBOSE
- ${filter-out -nostdinc,$(COMPILE_CXX)} $c -o $@ $(DUMPER_INCLUDES) ${firstword $^}
-else
- @echo $(CXX) $c $(CFLAGS) $(DUMPER_INCLUDES) ... $(basename $@).cc;\
- ${filter-out -nostdinc,$(COMPILE_CXX)} $c -o $(@D)/$(basename $@)$o $(DUMPER_INCLUDES) $<
-endif
-
-module_info.o: module_info.cc
-ifdef VERBOSE
- ${filter-out -nostdinc,$(COMPILE_CXX)} $c -o $@ $(DUMPER_INCLUDES) ${firstword $^}
-else
- @echo $(CXX) $c $(CFLAGS) $(DUMPER_INCLUDES) ... $(basename $@).cc;\
- ${filter-out -nostdinc,$(COMPILE_CXX)} $c -o $(@D)/$(basename $@)$o $(DUMPER_INCLUDES) $<
-endif
-
-parse_pe.o: parse_pe.cc dumper.h
-ifdef VERBOSE
- ${filter-out -nostdinc,$(COMPILE_CXX)} $c -o $@ $(DUMPER_INCLUDES) ${firstword $^}
-else
- @echo $(CXX) $c $(CFLAGS) $(DUMPER_INCLUDES) ... $(basename $@).cc;\
- ${filter-out -nostdinc,$(COMPILE_CXX)} $c -o $(@D)/$(basename $@)$o $(DUMPER_INCLUDES) $<
-endif
-
-mingw_getopt.o: $(cygwin_source)/lib/getopt.c
-ifdef VERBOSE
- ${filter-out -I$(newlib_source)/%,$(COMPILE_CC)} $c -o $(@D)/$(basename $@)$o $(MINGW_CFLAGS) $<
-else
- @echo $(CC) $c -o $(@D)/$(basename $@)$o $(MINGW_CFLAGS) ... $^;\
- ${filter-out -I$(newlib_source)/%,$(COMPILE_CC)} $c -o $(@D)/$(basename $@)$o $(MINGW_CFLAGS) $<
-endif
-
-path.o: path.cc
-ifdef VERBOSE
- ${filter-out -I$(newlib_source)/%,$(COMPILE_CXX)} $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) $<
-else
- @echo $(CXX) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) ... $^;\
- ${filter-out -I$(newlib_source)/%,$(COMPILE_CXX)} $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) $<
-endif
-
-dump_setup.o: dump_setup.cc
-ifdef VERBOSE
- ${filter-out -I$(newlib_source)/%,$(COMPILE_CXX)} $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) $<
-else
- @echo $(CXX) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) ... $^;\
- ${filter-out -I$(newlib_source)/%,$(COMPILE_CXX)} $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) $<
-endif
-
-cygcheck.o: cygcheck.cc
-ifdef VERBOSE
- ${filter-out -I$(newlib_source)/%,$(COMPILE_CXX)} $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) $<
-else
- @echo $(CXX) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) ... $^;\
- ${filter-out -I$(newlib_source)/%,$(COMPILE_CXX)} $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) $<
-endif
-
-strace.o: strace.cc
-ifdef VERBOSE
- ${filter-out -I$(newlib_source)/%,$(COMPILE_CXX)} $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) $<
-else
- @echo $(CXX) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) ... $^;\
- ${filter-out -I$(newlib_source)/%,$(COMPILE_CXX)} $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) $<
-endif
-
-kill.exe: kill.o $(bupdir1)/libiberty/strsignal.o
-ifdef VERBOSE
- $(CXX) -o $@ $^ -B$(cygwin_build)/ $(ALL_LDFLAGS) $(KILL_LIB)
-else
- @echo $(CXX) -o $@ $^ ${filter-out -B%, $(ALL_LDFLAGS)};\
- $(CXX) -o $@ $^ -B$(cygwin_build)/ $(ALL_LDFLAGS) $(KILL_LIB)
-endif
-
-clean:
- rm -f *.o $(CLEAN_PROGS)
-
-realclean: clean
- rm -f Makefile config.cache
-
-install: all
- $(SHELL) $(updir1)/mkinstalldirs $(bindir) $(etcdir)
- for i in $(PROGS) ; do \
- n=`echo $$i | sed '$(program_transform_name)'`; \
- $(INSTALL_PROGRAM) $$i $(bindir)/$$n; \
- done
-
-$(cygwin_build)/libcygwin.a: $(cygwin_build)/Makefile
- @$(MAKE) -C $(@D) $(@F)
-
-$(mingw_build)/libmingw32.a: $(mingw_build)/Makefile
- @$(MAKE) -C $(@D) $(@F)
-
-warn_dumper:
- @echo '*** Not building dumper.exe since some required libraries are'
- @echo '*** missing: libbfd.a and libintl.a.'
- @echo '*** If you need this program, check out the naked-bfd and naked-intl'
- @echo '*** sources from sources.redhat.com. Then, configure and build these'
- @echo '*** libraries. Otherwise, you can safely ignore this warning.'
-
-dumper.exe: module_info.o parse_pe.o dumper.o $(ALL_DEP_LDLIBS)
-ifdef VERBOSE
- $(CXX) -o $@ ${wordlist 1,3,$^} -B$(cygwin_build)/ $(DUMPER_LDFLAGS)
-else
- @echo $(CXX) -o $@ ${wordlist 1,3,$^} ${filter-out -B%, $(DUMPER_LDFLAGS)};\
- $(CXX) -o $@ ${wordlist 1,3,$^} -B$(cygwin_build)/ $(DUMPER_LDFLAGS)
-endif
-
-%.exe: %.o $(ALL_DEP_LDLIBS)
-ifdef VERBOSE
- $(CXX) -o $@ ${firstword $^} -B$(cygwin_build)/ $(ALL_LDFLAGS)
-else
- @echo $(CXX) -o $@ ${firstword $^} ${filter-out -B%, $(ALL_LDFLAGS)};\
- $(CXX) -o $@ ${firstword $^} -B$(cygwin_build)/ $(ALL_LDFLAGS)
-endif
diff --git a/winsup/utils/aclocal.m4 b/winsup/utils/aclocal.m4
deleted file mode 100644
index 754f640bb..000000000
--- a/winsup/utils/aclocal.m4
+++ /dev/null
@@ -1,78 +0,0 @@
-dnl aclocal.m4 generated automatically by aclocal 1.3b
-
-dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 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.
-
-# Check to see if we're running under Win32, without using
-# AC_CANONICAL_*. If so, set output variable EXEEXT to ".exe".
-# Otherwise set it to "".
-
-dnl AM_EXEEXT()
-dnl This knows we add .exe if we're building in the Cygwin
-dnl environment. But if we're not, then it compiles a test program
-dnl to see if there is a suffix for executables.
-AC_DEFUN(AM_EXEEXT,
-[AC_REQUIRE([AM_CYGWIN])
-AC_REQUIRE([AM_MINGW32])
-AC_MSG_CHECKING([for executable suffix])
-AC_CACHE_VAL(am_cv_exeext,
-[if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
-am_cv_exeext=.exe
-else
-cat > am_c_test.c << 'EOF'
-int main() {
-/* Nothing needed here */
-}
-EOF
-${CC-cc} -o am_c_test $CFLAGS $CPPFLAGS $LDFLAGS am_c_test.c $LIBS 1>&5
-am_cv_exeext=
-for file in am_c_test.*; do
- case $file in
- *.c) ;;
- *.o) ;;
- *) am_cv_exeext=`echo $file | sed -e s/am_c_test//` ;;
- esac
-done
-rm -f am_c_test*])
-test x"${am_cv_exeext}" = x && am_cv_exeext=no
-fi
-EXEEXT=""
-test x"${am_cv_exeext}" != xno && EXEEXT=${am_cv_exeext}
-AC_MSG_RESULT(${am_cv_exeext})
-AC_SUBST(EXEEXT)])
-
-# Check to see if we're running under Cygwin, without using
-# AC_CANONICAL_*. If so, set output variable CYGWIN to "yes".
-# Otherwise set it to "no".
-
-dnl AM_CYGWIN()
-AC_DEFUN(AM_CYGWIN,
-[AC_CACHE_CHECK(for Cygwin environment, am_cv_cygwin,
-[AC_TRY_COMPILE(,[return __CYGWIN32__;],
-am_cv_cygwin=yes, am_cv_cygwin=no)
-rm -f conftest*])
-CYGWIN=
-test "$am_cv_cygwin" = yes && CYGWIN=yes])
-
-
-
-# Check to see if we're running under Mingw, without using
-# AC_CANONICAL_*. If so, set output variable MINGW32 to "yes".
-# Otherwise set it to "no".
-
-dnl AM_MINGW32()
-AC_DEFUN(AM_MINGW32,
-[AC_CACHE_CHECK(for Mingw32 environment, am_cv_mingw32,
-[AC_TRY_COMPILE(,[return __MINGW32__;],
-am_cv_mingw32=yes, am_cv_mingw32=no)
-rm -f conftest*])
-MINGW32=
-test "$am_cv_mingw32" = yes && MINGW32=yes])
-
diff --git a/winsup/utils/configure b/winsup/utils/configure
deleted file mode 100755
index 4e0fa4345..000000000
--- a/winsup/utils/configure
+++ /dev/null
@@ -1,1358 +0,0 @@
-#! /bin/sh
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-
-# Defaults:
-ac_help=
-ac_default_prefix=/usr/local
-# Any additions from configure.in:
-
-# Initialize some variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
-exec_prefix=NONE
-host=NONE
-no_create=
-nonopt=NONE
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-sitefile=
-srcdir=
-target=NONE
-verbose=
-x_includes=NONE
-x_libraries=NONE
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
-ac_prev=
-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=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case "$ac_option" in
-
- -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 ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$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" ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir="$ac_optarg" ;;
-
- -disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_${ac_feature}='$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)
- # 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 << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --site-file=FILE use FILE as the site file
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --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
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host="$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" ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- 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)
- 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" ;;
-
- -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" ;;
-
- -site-file | --site-file | --site-fil | --site-fi | --site-f)
- ac_prev=sitefile ;;
- -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*)
- sitefile="$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 ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
- exit 0 ;;
-
- -with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "with_${ac_package}='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=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" ;;
-
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
- ;;
-
- *)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
-
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
-do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
- esac
-done
-
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
-
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=mount.cc
-
-# 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 its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
- 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
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
- else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
- fi
-fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$sitefile"; then
- if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
- fi
-else
- CONFIG_SITE="$sitefile"
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
-else
- echo "creating cache $cache_file"
- > $cache_file
-fi
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
-
-
-
-
-
-
-
-
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-
-# Do some error checking and defaulting for the host and target type.
-# The inputs are:
-# configure --host=HOST --target=TARGET --build=BUILD NONOPT
-#
-# The rules are:
-# 1. You are not allowed to specify --host, --target, and nonopt at the
-# same time.
-# 2. Host defaults to nonopt.
-# 3. If nonopt is not specified, then host defaults to the current host,
-# as determined by config.guess.
-# 4. Target and build default to nonopt.
-# 5. If nonopt is not specified, then target and build default to host.
-
-# The aliases save the names the user supplied, while $host etc.
-# will get canonicalized.
-case $host---$target---$nonopt in
-NONE---*---* | *---NONE---* | *---*---NONE) ;;
-*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
-esac
-
-
-# Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:589: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
- case $nonopt in
- NONE)
- if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
- else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
- fi ;;
- *) host_alias=$nonopt ;;
- esac ;;
-esac
-
-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
-
-echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:610: checking target system type" >&5
-
-target_alias=$target
-case "$target_alias" in
-NONE)
- case $nonopt in
- NONE) target_alias=$host_alias ;;
- *) target_alias=$nonopt ;;
- esac ;;
-esac
-
-target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
-target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$target" 1>&6
-
-echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:628: checking build system type" >&5
-
-build_alias=$build
-case "$build_alias" in
-NONE)
- case $nonopt in
- NONE) build_alias=$host_alias ;;
- *) build_alias=$nonopt ;;
- esac ;;
-esac
-
-build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
-build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$build" 1>&6
-
-test "$host_alias" != "$target_alias" &&
- test "$program_prefix$program_suffix$program_transform_name" = \
- NONENONEs,x,x, &&
- program_prefix=${target_alias}-
-
-
-# Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:654: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-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
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:684: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_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 $# -gt 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
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
- fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:733: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:742: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
-else
- ac_cv_prog_gcc=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:757: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
-else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-O2"
- fi
-else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
-fi
-
-if test $host != $build; then
- ac_tool_prefix=${host_alias}-
-else
- ac_tool_prefix=
-fi
-
-# Extract the first word of "${ac_tool_prefix}g++", so it can be a program name with args.
-set dummy ${ac_tool_prefix}g++; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:793: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CXX"; then
- ac_cv_prog_CXX="$CXX" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CXX="${ac_tool_prefix}g++"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CXX="$ac_cv_prog_CXX"
-if test -n "$CXX"; then
- echo "$ac_t""$CXX" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_CXX"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "g++", so it can be a program name with args.
-set dummy g++; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:825: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CXX"; then
- ac_cv_prog_CXX="$CXX" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CXX="g++"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_CXX" && ac_cv_prog_CXX="g++"
-fi
-fi
-CXX="$ac_cv_prog_CXX"
-if test -n "$CXX"; then
- echo "$ac_t""$CXX" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- CXX="g++"
-fi
-fi
-
-if test -z "$CXX"; then
- # Extract the first word of "c++", so it can be a program name with args.
-set dummy c++; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:861: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CXX"; then
- ac_cv_prog_CXX="$CXX" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CXX="c++"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CXX="$ac_cv_prog_CXX"
-if test -n "$CXX"; then
- echo "$ac_t""$CXX" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-CXXFLAGS='$(CFLAGS)'
-
-
-if test "$program_transform_name" = s,x,x,; then
- program_transform_name=
-else
- # Double any \ or $. echo might interpret backslashes.
- cat <<\EOF_SED > conftestsed
-s,\\,\\\\,g; s,\$,$$,g
-EOF_SED
- program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
- rm -f conftestsed
-fi
-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"
-
-# sed with no file args requires a program.
-test "$program_transform_name" = "" && program_transform_name="s,x,x,"
-
-
-if test "x$cross_compiling" = "xyes"; then
- if test "x$program_transform_name" = "xs,x,x,"; then
- program_transform_name=""
- fi
- if test "x$program_transform_name" = "x"; then
- program_transform_name="s,^,$host-,"
- else
- program_transform_name="$program_transform_name -e s,^,$host-,"
- fi
-fi
-
-# 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
-# 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"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:936: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/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
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
-
-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. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL="$ac_install_sh"
- fi
-fi
-echo "$ac_t""$INSTALL" 1>&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_PROGRAM}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-
-echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:990: checking for Cygwin environment" >&5
-if eval "test \"`echo '$''{'am_cv_cygwin'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 995 "configure"
-#include "confdefs.h"
-
-int main() {
-return __CYGWIN32__;
-; return 0; }
-EOF
-if { (eval echo configure:1002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- am_cv_cygwin=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- am_cv_cygwin=no
-fi
-rm -f conftest*
-rm -f conftest*
-fi
-
-echo "$ac_t""$am_cv_cygwin" 1>&6
-CYGWIN=
-test "$am_cv_cygwin" = yes && CYGWIN=yes
-echo $ac_n "checking for Mingw32 environment""... $ac_c" 1>&6
-echo "configure:1019: checking for Mingw32 environment" >&5
-if eval "test \"`echo '$''{'am_cv_mingw32'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1024 "configure"
-#include "confdefs.h"
-
-int main() {
-return __MINGW32__;
-; return 0; }
-EOF
-if { (eval echo configure:1031: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- am_cv_mingw32=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- am_cv_mingw32=no
-fi
-rm -f conftest*
-rm -f conftest*
-fi
-
-echo "$ac_t""$am_cv_mingw32" 1>&6
-MINGW32=
-test "$am_cv_mingw32" = yes && MINGW32=yes
-
-
-echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1050: checking for executable suffix" >&5
-if eval "test \"`echo '$''{'am_cv_exeext'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
-am_cv_exeext=.exe
-else
-cat > am_c_test.c << 'EOF'
-int main() {
-/* Nothing needed here */
-}
-EOF
-${CC-cc} -o am_c_test $CFLAGS $CPPFLAGS $LDFLAGS am_c_test.c $LIBS 1>&5
-am_cv_exeext=
-for file in am_c_test.*; do
- case $file in
- *.c) ;;
- *.o) ;;
- *) am_cv_exeext=`echo $file | sed -e s/am_c_test//` ;;
- esac
-done
-rm -f am_c_test*
-fi
-
-test x"${am_cv_exeext}" = x && am_cv_exeext=no
-fi
-EXEEXT=""
-test x"${am_cv_exeext}" != xno && EXEEXT=${am_cv_exeext}
-echo "$ac_t""${am_cv_exeext}" 1>&6
-
-
-trap '' 1 2 15
-cat > confcache <<\EOF
-# 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. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# 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.
-(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
- if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
-fi
-
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
-s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
-s%\[%\\&%g
-s%\]%\\&%g
-s%\$%$$%g
-EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-rm -f conftest.defs
-
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
-
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
-# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
-# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
-
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
-do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
-done
-
-ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
-
-trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@host@%$host%g
-s%@host_alias@%$host_alias%g
-s%@host_cpu@%$host_cpu%g
-s%@host_vendor@%$host_vendor%g
-s%@host_os@%$host_os%g
-s%@target@%$target%g
-s%@target_alias@%$target_alias%g
-s%@target_cpu@%$target_cpu%g
-s%@target_vendor@%$target_vendor%g
-s%@target_os@%$target_os%g
-s%@build@%$build%g
-s%@build_alias@%$build_alias%g
-s%@build_cpu@%$build_cpu%g
-s%@build_vendor@%$build_vendor%g
-s%@build_os@%$build_os%g
-s%@CC@%$CC%g
-s%@CXX@%$CXX%g
-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
-s%@INSTALL_DATA@%$INSTALL_DATA%g
-s%@EXEEXT@%$EXEEXT%g
-
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
- else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
- fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
- else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
- fi
-done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
-fi
-EOF
-
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
- fi
-
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
-
- case "$ac_given_INSTALL" in
- [/$]*) INSTALL="$ac_given_INSTALL" ;;
- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
- esac
-
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
- esac
-
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-s%@INSTALL@%$INSTALL%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
-
diff --git a/winsup/utils/configure.in b/winsup/utils/configure.in
deleted file mode 100644
index aea20413f..000000000
--- a/winsup/utils/configure.in
+++ /dev/null
@@ -1,88 +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.12)
-
-AC_INIT(mount.cc)
-
-dnl FIXME: We temporarily define our own version of AC_PROG_CC. This is
-dnl copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
-dnl are probably using a cross compiler, which will not be able to fully
-dnl link an executable. This should really be fixed in autoconf
-dnl itself.
-
-AC_DEFUN(LIB_AC_PROG_CC,
-[AC_BEFORE([$0], [AC_PROG_CPP])dnl
-AC_CHECK_PROG(CC, gcc, gcc)
-if test -z "$CC"; then
- AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
- test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
-fi
-
-AC_PROG_CC_GNU
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-dnl Check whether -g works, even if CFLAGS is set, in case the package
-dnl plays around with CFLAGS (such as to build both debugging and
-dnl normal versions of a library), tasteless as that idea is.
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- AC_PROG_CC_G
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-O2"
- fi
-else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
-fi
-])
-
-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_PROG(CXX, c++, c++, , , )
- test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
-fi
-
-CXXFLAGS='$(CFLAGS)'
-])
-
-AC_CANONICAL_SYSTEM
-
-LIB_AC_PROG_CC
-LIB_AC_PROG_CXX
-
-AC_ARG_PROGRAM
-
-if test "x$cross_compiling" = "xyes"; then
- if test "x$program_transform_name" = "xs,x,x,"; then
- program_transform_name=""
- fi
- if test "x$program_transform_name" = "x"; then
- program_transform_name="s,^,$host-,"
- else
- program_transform_name="$program_transform_name -e s,^,$host-,"
- fi
-fi
-
-AC_PROG_INSTALL
-
-AM_EXEEXT
-
-AC_OUTPUT(Makefile)
-
diff --git a/winsup/utils/cygcheck.cc b/winsup/utils/cygcheck.cc
deleted file mode 100644
index 10be2453e..000000000
--- a/winsup/utils/cygcheck.cc
+++ /dev/null
@@ -1,1369 +0,0 @@
-/* cygcheck.cc
-
- Copyright 1998, 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. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <windows.h>
-#include "cygwin/include/sys/cygwin.h"
-#include "cygwin/include/mntent.h"
-#include "cygwin/include/getopt.h"
-#include "time.h"
-#include "ctype.h"
-
-int verbose = 0;
-int registry = 0;
-int sysinfo = 0;
-int givehelp = 0;
-int keycheck = 0;
-int check_setup = 0;
-
-#ifdef __GNUC__
-typedef long long longlong;
-#else
-typedef __int64 longlong;
-#endif
-
-void dump_setup (int, char **, bool);
-
-static const char version[] = "$Revision$";
-
-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[] = {
- {"bash", 0},
- {"cat", 0},
- {"cpp", 1},
- {"find", 0},
- {"gcc", 0},
- {"gdb", 0},
- {"ld", 0},
- {"ls", 0},
- {"make", 0},
- {"sh", 0},
- {0, 0}
-};
-
-static int num_paths = 0, max_paths = 0;
-static char **paths = 0;
-
-/*
- * keyeprint() is used to report failure modes
- */
-static int
-keyeprint (const char *name)
-{
- fprintf (stderr, "cygcheck: %s failed: %lu\n", name, GetLastError ());
- return 1;
-}
-
-static void
-add_path (char *s, int maxlen)
-{
- if (num_paths >= max_paths)
- {
- max_paths += 10;
- if (paths)
- paths = (char **) realloc (paths, max_paths * sizeof (char *));
- else
- paths = (char **) malloc (max_paths * sizeof (char *));
- }
- paths[num_paths] = (char *) malloc (maxlen + 1);
- if (paths[num_paths] == NULL)
- {
- keyeprint ("add_path: malloc()");
- return;
- }
- memcpy (paths[num_paths], s, maxlen);
- paths[num_paths][maxlen] = 0;
- char *e = paths[num_paths] + strlen (paths[num_paths]);
- if (e[-1] == '\\' && e[-2] != ':')
- *--e = 0;
- for (int i = 1; i < num_paths; i++)
- if (strcasecmp (paths[num_paths], paths[i]) == 0)
- return;
- num_paths++;
-}
-
-static void
-init_paths ()
-{
- char tmp[4000], *sl;
- add_path ((char *) ".", 1); /* to be replaced later */
- add_path ((char *) ".", 1); /* the current directory */
- if (GetSystemDirectory (tmp, 4000))
- add_path (tmp, strlen (tmp));
- else
- keyeprint ("init_paths: GetSystemDirectory()");
- sl = strrchr (tmp, '\\');
- if (sl)
- {
- strcpy (sl, "\\SYSTEM");
- add_path (tmp, strlen (tmp));
- }
- GetWindowsDirectory (tmp, 4000);
- add_path (tmp, strlen (tmp));
-
- char *wpath = getenv ("PATH");
- if (wpath)
- {
- char *b, *e;
- b = wpath;
- while (1)
- {
- for (e = b; *e && *e != ';'; e++);
- add_path (b, e - b);
- if (!*e)
- break;
- b = e + 1;
- }
- }
- else
- printf ("WARNING: PATH is not set at all!\n");
-}
-
-static char *
-find_on_path (char *file, char *default_extension,
- int showall = 0, int search_sysdirs = 0)
-{
- static char rv[4000];
- char tmp[4000], *ptr = rv;
-
- if (file == NULL)
- {
- keyeprint ("find_on_path: NULL pointer for file");
- return 0;
- }
-
- if (default_extension == NULL)
- {
- keyeprint ("find_on_path: NULL pointer for default_extension");
- return 0;
- }
-
- if (strchr (file, ':') || strchr (file, '\\') || strchr (file, '/'))
- return file;
-
- if (strchr (file, '.'))
- default_extension = (char *) "";
-
- for (int i = 0; i < num_paths; i++)
- {
- if (!search_sysdirs && (i == 0 || i == 2 || i == 3))
- continue;
- if (i == 0 || !search_sysdirs || strcasecmp (paths[i], paths[0]))
- {
- sprintf (ptr, "%s\\%s%s", paths[i], file, default_extension);
- if (GetFileAttributes (ptr) != (DWORD) - 1)
- {
- if (showall)
- printf ("Found: %s\n", ptr);
- if (ptr == tmp && verbose)
- printf ("Warning: %s hides %s\n", rv, ptr);
- ptr = tmp;
- }
- }
- }
-
- if (ptr == tmp)
- return rv;
-
- return 0;
-}
-
-#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 (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;
-}
-
-static int
-get_word (HANDLE fh, int offset)
-{
- short rv;
- unsigned r;
-
- if (SetFilePointer (fh, offset, 0, FILE_BEGIN) == INVALID_SET_FILE_POINTER
- && GetLastError () != NO_ERROR)
- keyeprint ("get_word: SetFilePointer()");
-
- if (!ReadFile (fh, &rv, 2, (DWORD *) &r, 0))
- keyeprint ("get_word: Readfile()");
-
- return rv;
-}
-
-static int
-get_dword (HANDLE fh, int offset)
-{
- int rv;
- unsigned r;
-
- if (SetFilePointer (fh, offset, 0, FILE_BEGIN) == INVALID_SET_FILE_POINTER
- && GetLastError () != NO_ERROR)
- keyeprint ("get_word: SetFilePointer()");
-
- if (!ReadFile (fh, &rv, 4, (DWORD *) &r, 0))
- keyeprint ("get_dword: Readfile()");
-
- return rv;
-}
-
-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)
- {
- keyeprint ("rva_to_offset: NULL passed for sections");
- 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 void track_down (char *file, 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)
- {
- keyeprint ("cygwin_info: malloc()");
- 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;
-}
-
-static void
-dll_info (const char *path, HANDLE fh, int lvl, int recurse)
-{
- DWORD junk;
- int i;
- int pe_header_offset = get_dword (fh, 0x3c);
- int opthdr_ofs = pe_header_offset + 4 + 20;
- unsigned short v[6];
-
- if (path == NULL)
- {
- keyeprint ("dll_info: NULL passed for path");
- return;
- }
-
- if (SetFilePointer (fh, opthdr_ofs + 40, 0, FILE_BEGIN) ==
- INVALID_SET_FILE_POINTER && GetLastError () != NO_ERROR)
- keyeprint ("dll_info: SetFilePointer()");
-
- if (!ReadFile (fh, &v, sizeof (v), &junk, 0))
- keyeprint ("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 + 92);
- int export_rva = get_dword (fh, opthdr_ofs + 96);
- int export_size = get_dword (fh, opthdr_ofs + 100);
- int import_rva = get_dword (fh, opthdr_ofs + 104);
- int import_size = get_dword (fh, opthdr_ofs + 108);
-
- int nsections = get_word (fh, pe_header_offset + 4 + 2);
- 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)
- keyeprint ("dll_info: SetFilePointer()");
-
- if (!ReadFile (fh, sections, nsections * 40, &junk, 0))
- keyeprint ("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)
- keyeprint ("dll_info: SetFilePointer()");
-
- unsigned char *exp = (unsigned char *) malloc (expsz);
-
- if (!ReadFile (fh, exp, expsz, &junk, 0))
- keyeprint ("dll_info: Readfile()");
-
- ExpDirectory *ed = (ExpDirectory *) exp;
- int ofs = ed->name_rva - export_rva;
- struct tm *tm = localtime ((const time_t *) &(ed->timestamp));
- if (tm->tm_year < 60)
- tm->tm_year += 2000;
- if (tm->tm_year < 200)
- tm->tm_year += 1900;
- printf ("%*c", lvl + 2, ' ');
- printf ("\"%s\" v%d.%d ts=", exp + ofs,
- ed->major_ver, ed->minor_ver);
- printf ("%d/%d/%d %d:%02d\n",
- tm->tm_year, tm->tm_mon + 1, tm->tm_mday,
- tm->tm_hour, tm->tm_min);
- }
- }
-
- 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)
- keyeprint ("dll_info: SetFilePointer()");
-
- unsigned char *imp = (unsigned char *) malloc (impsz);
- if (imp == NULL)
- {
- keyeprint ("dll_info: malloc()");
- return;
- }
-
- if (!ReadFile (fh, imp, impsz, &junk, 0))
- keyeprint ("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);
-}
-
-static void
-track_down (char *file, char *suffix, int lvl)
-{
- if (file == NULL)
- {
- keyeprint ("track_down: malloc()");
- return;
- }
-
- if (suffix == NULL)
- {
- keyeprint ("track_down: malloc()");
- return;
- }
-
- char *path = find_on_path (file, suffix, 0, 1);
- if (!path)
- {
- printf ("Error: could not find %s\n", file);
- return;
- }
-
- 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;
- case DID_INACTIVE:
- if (verbose)
- {
- if (lvl)
- printf ("%*c", lvl, ' ');
- printf ("%s", path);
- printf (" (already done)\n");
- }
- return;
- default:
- break;
- }
-
- if (lvl)
- printf ("%*c", lvl, ' ');
-
- if (!path)
- {
- printf ("%s not found\n", file);
- return;
- }
-
- printf ("%s", path);
-
- HANDLE fh =
- CreateFile (path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- if (fh == INVALID_HANDLE_VALUE)
- {
- printf (" - Cannot open\n");
- return;
- }
-
- d->state = DID_ACTIVE;
-
- dll_info (path, fh, lvl, 1);
- d->state = DID_INACTIVE;
- if (!CloseHandle (fh))
- keyeprint ("track_down: CloseHandle()");
-}
-
-static void
-ls (char *f)
-{
- HANDLE h = CreateFile (f, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
- 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
- BY_HANDLE_FILE_INFORMATION info;
-
- if (!GetFileInformationByHandle (h, &info))
- keyeprint ("ls: GetFileInformationByHandle()");
-
- SYSTEMTIME systime;
-
- if (!FileTimeToSystemTime (&info.ftLastWriteTime, &systime))
- keyeprint ("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))
- keyeprint ("ls: CloseHandle()");
-}
-
-static void
-cygcheck (char *app)
-{
- char *papp = find_on_path (app, (char *) ".exe", 1, 0);
- if (!papp)
- {
- printf ("Error: could not find %s\n", app);
- return;
- }
- char *s = strdup (papp);
- char *sl = 0, *t;
- for (t = s; *t; t++)
- if (*t == '/' || *t == '\\' || *t == ':')
- sl = t;
- if (sl == 0)
- paths[0] = (char *) ".";
- else
- {
- *sl = 0;
- paths[0] = s;
- }
- did = 0;
- track_down (papp, (char *) ".exe", 0);
-}
-
-
-extern char **environ;
-
-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 cygnus)
-{
- RegInfo ri;
- ri.prev = prev;
- ri.name = name;
- ri.key = hKey;
-
- char *cp;
- for (cp = name; *cp; cp++)
- if (strncasecmp (cp, "cygnus", 6) == 0)
- cygnus = 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 (cygnus)
- {
- show_reg (&ri, 0);
-
- char *value_name = (char *) malloc (max_value_len + 1);
- if (value_name == NULL)
- {
- keyeprint ("scan_registry: malloc()");
- return;
- }
-
- char *value_data = (char *) malloc (max_valdata_len + 1);
- if (value_data == NULL)
- {
- keyeprint ("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;
- if (RegOpenKeyEx (hKey, subkey_name, 0, KEY_READ, &sKey)
- == ERROR_SUCCESS)
- {
- scan_registry (&ri, sKey, subkey_name, cygnus);
- if (RegCloseKey (sKey) != ERROR_SUCCESS)
- keyeprint ("scan_registry: RegCloseKey()");
- }
- }
- }
- free (subkey_name);
-}
-
-static void
-dump_sysinfo ()
-{
- int i, j;
- char tmp[4000];
- time_t now;
- char *found_cygwin_dll;
-
- printf ("\nCygwin Win95/NT Configuration Diagnostics\n");
- time (&now);
- printf ("Current System Time: %s\n", ctime (&now));
-
- OSVERSIONINFO osversion;
- osversion.dwOSVersionInfoSize = sizeof (osversion);
- if (!GetVersionEx (&osversion))
- keyeprint ("dump_sysinfo: GetVersionEx()");
- char *osname = (char *) "unknown OS";
- switch (osversion.dwPlatformId)
- {
- case VER_PLATFORM_WIN32s:
- osname = (char *) "32s";
- break;
- case VER_PLATFORM_WIN32_WINDOWS:
- switch (osversion.dwMinorVersion)
- {
- case 0:
- if (strchr (osversion.szCSDVersion, 'C'))
- osname = (char *) "95 OSR2";
- else
- osname = (char *) "95";
- break;
- case 10:
- if (strchr (osversion.szCSDVersion, 'A'))
- osname = (char *) "98 SE";
- else
- osname = (char *) "98";
- break;
- case 90:
- osname = (char *) "ME";
- break;
- default:
- osname = (char *) "9X";
- break;
- }
- break;
- case VER_PLATFORM_WIN32_NT:
- if (osversion.dwMajorVersion == 5)
- {
- BOOL more_info = FALSE;
- OSVERSIONINFOEX osversionex;
- osversionex.dwOSVersionInfoSize = sizeof (osversionex);
- if (GetVersionEx ((OSVERSIONINFO *) &osversionex))
- more_info = TRUE;
- if (osversion.dwMinorVersion == 0)
- {
- if (!more_info)
- osname = (char *) "2000";
- else if (osversionex.wProductType == VER_NT_SERVER
- || osversionex.wProductType ==
- VER_NT_DOMAIN_CONTROLLER)
- {
- if (osversionex.wSuiteMask &VER_SUITE_DATACENTER)
- osname = (char *) "2000 Datacenter Server";
- else if (osversionex.wSuiteMask & VER_SUITE_ENTERPRISE)
- osname = (char *) "2000 Advanced Server";
- else
- osname = (char *) "2000 Server";
- }
- else
- osname = (char *) "2000 Professional";
- }
- else
- {
- if (!more_info)
- osname = (char *) "XP";
- else if (osversionex.wProductType == VER_NT_SERVER
- || osversionex.wProductType ==
- VER_NT_DOMAIN_CONTROLLER)
- {
- if (osversionex.wSuiteMask & VER_SUITE_ENTERPRISE)
- osname = (char *) ".NET Enterprise Server";
- else
- osname = (char *) ".NET Server";
- }
- else if (osversionex.wSuiteMask & VER_SUITE_PERSONAL)
- osname = (char *) "XP Home Edition";
- else
- osname = (char *) "XP Professional";
-
- }
- }
- else
- osname = (char *) "NT";
- break;
- default:
- osname = (char *) "??";
- break;
- }
- printf ("Windows %s Ver %lu.%lu Build %lu %s\n\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 : "");
-
- printf ("Path:");
- char *s = getenv ("PATH"), *e;
- char sep = strchr (s, ';') ? ';' : ':';
- int count_path_items = 0;
- while (1)
- {
- for (e = s; *e && *e != sep; e++);
- printf ("\t%.*s\n", e - s, s);
- count_path_items++;
- if (!*e)
- break;
- s = e + 1;
- }
-
- if (!GetSystemDirectory (tmp, 4000))
- keyeprint ("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 `Cygnus' in them...\n");
-#if 0
- /* big and not generally useful */
- scan_registry (0, HKEY_CLASSES_ROOT, (char *) "HKEY_CLASSES_ROOT", 0);
-#endif
- scan_registry (0, HKEY_CURRENT_CONFIG,
- (char *) "HKEY_CURRENT_CONFIG", 0);
- scan_registry (0, HKEY_CURRENT_USER, (char *) "HKEY_CURRENT_USER", 0);
- scan_registry (0, HKEY_LOCAL_MACHINE, (char *) "HKEY_LOCAL_MACHINE", 0);
-#if 0
- /* the parts we need are duplicated in HKEY_CURRENT_USER anyway */
- scan_registry (0, HKEY_USERS, (char *) "HKEY_USERS", 0);
-#endif
- printf ("\n");
- }
- else
- printf ("Use `-r' to scan registry\n\n");
-
- if (givehelp)
- {
- printf ("Listing available drives...\n");
- printf ("Drv Type Size Free Flags Name\n");
- }
- int prev_mode =
- SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
- int drivemask = GetLogicalDrives ();
-
- HINSTANCE k32 = LoadLibrary ("kernel32.dll");
- BOOL (WINAPI * gdfse) (LPCSTR, long long *, long long *, long long *) =
- (BOOL (WINAPI *) (LPCSTR, long long *, long long *, long long *))
- GetProcAddress (k32, "GetDiskFreeSpaceExA");
-
- 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] = 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)
- keyeprint ("dump_sysinfo: GetVolumeInformation()");
-
- 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;
-
- long long free_me = 0ULL, free_bytes = 0ULL, total_bytes = 1ULL;
- if (gdfse != NULL && gdfse (drive, &free_me, &total_bytes, &free_bytes))
- {
- capacity_mb = total_bytes / (1024L * 1024L);
- percent_full = 100 - (int) ((100.0 * free_me) / total_bytes);
- }
- 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 ("%5dMb %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);
- }
-
- if (!FreeLibrary (k32))
- keyeprint ("dump_sysinfo: FreeLibrary()");
- SetErrorMode (prev_mode);
- if (givehelp)
- {
- printf ("fd=floppy, hd=hard drive, cd=CD-ROM, net=Network Share\n");
- printf ("CP=Case Preserving, CS=Case Sensitive, UN=Unicode\n");
- printf
- ("PA=Persistent ACLS, FC=File Compression, VC=Volume Compression\n");
- }
- printf ("\n");
-
- unsigned ml_fsname = 4, ml_dir = 7, ml_type = 6;
-
- struct mntent *mnt;
- setmntent (0, 0);
- while ((mnt = getmntent (0)))
- {
- unsigned n = (int) strlen (mnt->mnt_fsname);
- if (ml_fsname < n)
- ml_fsname = n;
- n = (int) strlen (mnt->mnt_dir);
- if (ml_dir < n)
- ml_dir = 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");
-
- add_path ((char *) "\\bin", 4); /* just in case */
-
- 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_on_path ((char *) common_apps[i].name, (char *) ".exe", 1, 0))
- {
- 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 Cygnus DLLs... (-v gives version info)\n");
- for (i = 0; i < num_paths; i++)
- {
- WIN32_FIND_DATA ffinfo;
- sprintf (tmp, "%s/*.*", paths[i]);
- HANDLE ff = FindFirstFile (tmp, &ffinfo);
- int found = (ff != INVALID_HANDLE_VALUE);
- found_cygwin_dll = NULL;
- while (found)
- {
- char *f = ffinfo.cFileName;
- if (strcasecmp (f + strlen (f) - 4, ".dll") == 0)
- {
- if (strncasecmp (f, "cyg", 3) == 0)
- {
- sprintf (tmp, "%s\\%s", paths[i], f);
- if (strcasecmp (f, "cygwin1.dll") == 0)
- found_cygwin_dll = strdup (tmp);
- else
- ls (tmp);
- }
- }
- found = FindNextFile (ff, &ffinfo);
- }
- if (found_cygwin_dll)
- {
- ls (found_cygwin_dll);
- free (found_cygwin_dll);
- }
-
- FindClose (ff);
- }
-}
-
-static int
-check_keys ()
-{
- HANDLE h = CreateFileA ("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 (keyeprint ("check_key: Opening CONIN$"));
-
- DWORD mode;
-
- if (!GetConsoleMode (h, &mode))
- keyeprint ("check_keys: GetConsoleMode()");
- else
- {
- mode &= ~ENABLE_PROCESSED_INPUT;
- if (!SetConsoleMode (h, mode))
- keyeprint ("check_keys: GetConsoleMode()");
- }
-
- 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 <RETURN> key
- ReadConsoleInput (h, &in, 1, &mode);
-
- memset (&in, 0, sizeof in);
-
- do
- {
- prev_in = in;
- if (!ReadConsoleInput (h, &in, 1, &mode))
- keyeprint ("ReadConsoleInput");
-
- if (!memcmp (&in, &prev_in, sizeof in))
- continue;
-
- switch (in.EventType)
- {
- case KEY_EVENT:
- printf ("%s %ux VK: 0x%02x VS: 0x%02x A: 0x%02x 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.AsciiChar);
- 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.AsciiChar != 'q');
-
- CloseHandle (h);
- return 0;
-}
-
-static void
-usage (FILE * stream, int status)
-{
- fprintf (stream, "\
-Usage: cygcheck [OPTIONS] [program ...]\n\
- -c, --check-setup check packages installed via setup.exe\n\
- -s, --sysinfo system information (not with -k)\n\
- -v, --verbose verbose output (indented) (for -s or programs)\n\
- -r, --registry registry search (requires -s)\n\
- -k, --keycheck perform a keyboard check session (not with -s)\n\
- -h, --help give help about the info (not with -c)\n\
- -V, --version output version information and exit\n\
-You must at least give either -s or -k or a program name\n");
- exit (status);
-}
-
-struct option longopts[] = {
- {"check-setup", no_argument, NULL, 'c'},
- {"sysinfo", no_argument, NULL, 's'},
- {"registry", no_argument, NULL, 'r'},
- {"verbose", no_argument, NULL, 'v'},
- {"keycheck", no_argument, NULL, 'k'},
- {"help", no_argument, NULL, 'h'},
- {"version", no_argument, 0, 'V'},
- {0, no_argument, NULL, 0}
-};
-
-static char opts[] = "chkrsvV";
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-cygcheck version %.*s\n\
-System Checker for Cygwin\n\
-Copyright 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.\n\
-Compiled on %s", len, v, __DATE__);
-}
-
-int
-main (int argc, char **argv)
-{
- int i;
-
- while ((i = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
- switch (i)
- {
- case 's':
- sysinfo = 1;
- break;
- case 'c':
- check_setup = 1;
- break;
- case 'r':
- registry = 1;
- break;
- case 'v':
- verbose = 1;
- break;
- case 'k':
- keycheck = 1;
- break;
- case 'h':
- givehelp = 1;
- break;
- case 'V':
- print_version ();
- exit (0);
- default:
- usage (stderr, 1);
- /*NOTREACHED*/}
- argc -= optind;
- argv += optind;
-
- if (argc == 0 && !sysinfo && !keycheck && !check_setup)
- if (givehelp)
- usage (stdout, 0);
- else
- usage (stderr, 1);
-
- if ((check_setup || sysinfo) && keycheck)
- usage (stderr, 1);
-
- if (keycheck)
- return check_keys ();
-
- init_paths ();
-
- /* FIXME: Add help for check_setup */
- if (argc >= 1 && givehelp && !check_setup)
- {
- if (argc == 1)
- {
- printf
- ("Here is where the OS will find your program, and which dlls\n");
- printf ("will be used for it. Use -v to see DLL version info\n");
- }
- else
- {
- printf
- ("Here is where the OS will find your programs, and which dlls\n");
- printf ("will be used for them. Use -v to see DLL version info\n");
- }
-
- if (!sysinfo)
- printf ("\n");
- }
-
- if (check_setup)
- {
- dump_setup (verbose, argv, true);
- puts ("");
- }
- else
- for (i = 0; i < argc; i++)
- {
- cygcheck (argv[i]);
- puts ("");
- }
-
- if (sysinfo)
- {
- dump_sysinfo ();
- if (!check_setup)
- {
- puts ("");
- dump_setup (verbose, NULL, false);
- puts ("");
- }
- }
-
- if (!givehelp)
- puts ("Use -h to see help about each section");
-
- return 0;
-}
diff --git a/winsup/utils/cygpath.cc b/winsup/utils/cygpath.cc
deleted file mode 100644
index 0a2875af8..000000000
--- a/winsup/utils/cygpath.cc
+++ /dev/null
@@ -1,745 +0,0 @@
-/* cygpath.cc -- convert pathnames between Windows and Unix format
- Copyright 1998, 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. */
-
-#define NOCOMATTRIBUTE
-
-#include <shlobj.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <getopt.h>
-#include <windows.h>
-#include <io.h>
-#include <sys/fcntl.h>
-#include <sys/cygwin.h>
-#include <ctype.h>
-
-static const char version[] = "$Revision$";
-
-static char *prog_name;
-static char *file_arg;
-static char *close_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;
-static const char *windows_format_arg;
-
-static struct option long_options[] = {
- {(char *) "help", no_argument, NULL, 'h'},
- {(char *) "absolute", no_argument, NULL, 'a'},
- {(char *) "option", no_argument, NULL, 'o'},
- {(char *) "path", no_argument, NULL, 'p'},
- {(char *) "close", required_argument, (int *) &close_arg, 'c'},
- {(char *) "unix", no_argument, NULL, 'u'},
- {(char *) "file", required_argument, (int *) &file_arg, 'f'},
- {(char *) "version", no_argument, NULL, 'v'},
- {(char *) "windows", no_argument, NULL, 'w'},
- {(char *) "short-name", no_argument, NULL, 's'},
- {(char *) "long-name", no_argument, NULL, 'l'},
- {(char *) "windir", no_argument, NULL, 'W'},
- {(char *) "sysdir", no_argument, NULL, 'S'},
- {(char *) "ignore", no_argument, NULL, 'i'},
- {(char *) "allusers", no_argument, NULL, 'A'},
- {(char *) "desktop", no_argument, NULL, 'D'},
- {(char *) "smprograms", no_argument, NULL, 'P'},
- {(char *) "type", required_argument, (int *) &windows_format_arg, 't'},
- {(char *) "homeroot", no_argument, NULL, 'H'},
- {0, no_argument, 0, 0}
-};
-
-static void
-usage (FILE * stream, int status)
-{
- if (!ignore_flag || !status)
- fprintf (stream, "\
-Usage: %s (-u|--unix)|(-w|--windows) [options] filename\n\n\
- -u|--unix print Unix form of filename\n\
- -w|--windows print Windows form of filename\n\n\
-Other options:\n\
- -a|--absolute output absolute path\n\
- -c|--close handle close handle (for use in captured process)\n\
- -f|--file file read file for input path information\n\
- -i|--ignore ignore missing argument\n\
- -l|--long-name print Windows long form of filename (with -w only)\n\
- -p|--path filename argument is a path\n\
- -s|--short-name print Windows short form of filename (with -w only)\n\
- -t|--type print Windows form of filename with specified\n\
- dos drive letter with backslashes (C:\\WINNT)\n\
- mixed drive letter with regular slashes (C:/WINNT)\n\
- -A|--allusers use `All Users' instead of current user for -D, -P\n\
- -D|--desktop output `Desktop' directory and exit\n\
- -H|--homeroot output `Profiles' directory (home root) 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\n\
-Informative output:\n\
- -h|--help print this help, then exit\n\
- -v|--version output version information and exit\n", prog_name);
- exit (ignore_flag ? 0 : status);
-}
-
-static char *
-get_short_paths (char *path)
-{
- char *sbuf;
- char *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;
- len = GetShortPathName (next, NULL, 0);
- if (len == 0 && GetLastError () == ERROR_INVALID_PARAMETER)
- {
- fprintf (stderr, "%s: cannot create short name of %s\n", prog_name,
- next);
- exit (2);
- }
- acc += len + 1;
- }
- sptr = sbuf = (char *) malloc (acc + 1);
- if (sbuf == NULL)
- {
- fprintf (stderr, "%s: out of memory\n", prog_name);
- exit (1);
- }
- ptr = path;
- for (;;)
- {
- len = GetShortPathName (ptr, sptr, acc);
- if (len == 0 && GetLastError () == ERROR_INVALID_PARAMETER)
- {
- fprintf (stderr, "%s: cannot create short name of %s\n", prog_name,
- ptr);
- exit (2);
- }
-
- ptr = strrchr (ptr, 0);
- sptr = strrchr (sptr, 0);
- if (ptr == end)
- break;
- *sptr = ';';
- ++ptr, ++sptr;
- acc -= len + 1;
- }
- return sbuf;
-}
-
-static char *
-get_short_name (const char *filename)
-{
- char *sbuf, buf[MAX_PATH];
- DWORD len = GetShortPathName (filename, buf, MAX_PATH);
- if (len == 0 && GetLastError () == ERROR_INVALID_PARAMETER)
- {
- fprintf (stderr, "%s: cannot create short name of %s\n", prog_name,
- filename);
- exit (2);
- }
- sbuf = (char *) malloc (++len);
- if (sbuf == NULL)
- {
- fprintf (stderr, "%s: out of memory\n", prog_name);
- exit (1);
- }
- return strcpy (sbuf, buf);
-}
-
-static DWORD
-get_long_path_name_w32impl (LPCSTR src, LPSTR sbuf, DWORD)
-{
- char buf1[MAX_PATH], buf2[MAX_PATH], *ptr;
- const char *pelem, *next;
- WIN32_FIND_DATA w32_fd;
- int len;
-
- strcpy (buf1, src);
- *buf2 = 0;
- pelem = src;
- ptr = buf2;
- while (pelem)
- {
- next = pelem;
- if (*next == '\\')
- {
- strcat (ptr++, "\\");
- pelem++;
- if (!*pelem)
- break;
- continue;
- }
- pelem = strchr (next, '\\');
- len = pelem ? (pelem++ - next) : strlen (next);
- strncpy (ptr, next, len);
- ptr[len] = 0;
- if (next[1] != ':' && strcmp(next, ".") && strcmp(next, ".."))
- {
- if (FindFirstFile (buf2, &w32_fd) != INVALID_HANDLE_VALUE)
- strcpy (ptr, w32_fd.cFileName);
- }
- ptr += strlen (ptr);
- if (pelem)
- {
- *ptr++ = '\\';
- *ptr = 0;
- }
- }
- if (sbuf)
- strcpy (sbuf, buf2);
- SetLastError (0);
- return strlen (buf2) + (sbuf ? 0 : 1);
-}
-
-static char *
-get_long_paths (char *path)
-{
- char *sbuf;
- char *sptr;
- char *next;
- char *ptr = path;
- char *end = strrchr (path, 0);
- DWORD acc = 0;
- DWORD len;
-
- HINSTANCE hinst;
- DWORD (*GetLongPathNameAPtr) (LPCSTR, LPSTR, DWORD) = 0;
- hinst = LoadLibrary ("kernel32");
- if (hinst)
- GetLongPathNameAPtr = (DWORD (*) (LPCSTR, LPSTR, DWORD))
- GetProcAddress (hinst, "GetLongPathNameA");
- /* subsequent calls of kernel function with NULL cause SegFault in W2K!! */
- if (1 || !GetLongPathNameAPtr)
- GetLongPathNameAPtr = get_long_path_name_w32impl;
-
- while (ptr != NULL)
- {
- next = ptr;
- ptr = strchr (ptr, ';');
- if (ptr)
- *ptr++ = 0;
- len = (*GetLongPathNameAPtr) (next, NULL, 0);
- if (len == 0 && GetLastError () == ERROR_INVALID_PARAMETER)
- {
- fprintf (stderr, "%s: cannot create long name of %s\n", prog_name,
- next);
- exit (2);
- }
- acc += len + 1;
- }
- sptr = sbuf = (char *) malloc (acc + 1);
- if (sbuf == NULL)
- {
- fprintf (stderr, "%s: out of memory\n", prog_name);
- exit (1);
- }
- ptr = path;
- for (;;)
- {
- len = (*GetLongPathNameAPtr) (ptr, sptr, acc);
- if (len == 0 && GetLastError () == ERROR_INVALID_PARAMETER)
- {
- fprintf (stderr, "%s: cannot create long name of %s\n", prog_name,
- ptr);
- exit (2);
- }
-
- ptr = strrchr (ptr, 0);
- sptr = strrchr (sptr, 0);
- if (ptr == end)
- break;
- *ptr = *sptr = ';';
- ++ptr, ++sptr;
- acc -= len + 1;
- }
- return sbuf;
-}
-
-static char *
-get_long_name (const char *filename)
-{
- char *sbuf, buf[MAX_PATH];
- DWORD len;
- HINSTANCE hinst;
- DWORD (*GetLongPathNameAPtr) (LPCSTR, LPSTR, DWORD) = 0;
- hinst = LoadLibrary ("kernel32");
- if (hinst)
- GetLongPathNameAPtr = (DWORD (*) (LPCSTR, LPSTR, DWORD))
- GetProcAddress (hinst, "GetLongPathNameA");
- if (!GetLongPathNameAPtr)
- GetLongPathNameAPtr = get_long_path_name_w32impl;
-
- len = (*GetLongPathNameAPtr) (filename, buf, MAX_PATH);
- if (len == 0 && GetLastError () == ERROR_INVALID_PARAMETER)
- {
- fprintf (stderr, "%s: cannot create long name of %s\n", prog_name,
- filename);
- exit (2);
- }
- sbuf = (char *) malloc (++len);
- if (sbuf == NULL)
- {
- fprintf (stderr, "%s: out of memory\n", prog_name);
- exit (1);
- }
- return strcpy (sbuf, buf);
-}
-
-static void
-dowin (char option)
-{
- char *buf, buf1[MAX_PATH], buf2[MAX_PATH];
- DWORD len = MAX_PATH;
- WIN32_FIND_DATA w32_fd;
- LPITEMIDLIST id;
- HINSTANCE hinst;
- BOOL (*GetProfilesDirectoryAPtr) (LPSTR, LPDWORD) = 0;
-
- buf = buf1;
- switch (option)
- {
- case 'D':
- SHGetSpecialFolderLocation (NULL, allusers_flag ?
- CSIDL_COMMON_DESKTOPDIRECTORY : CSIDL_DESKTOPDIRECTORY, &id);
- SHGetPathFromIDList (id, buf);
- /* This if clause is a Fix for Win95 without any "All Users" */
- if (strlen (buf) == 0)
- {
- SHGetSpecialFolderLocation (NULL, CSIDL_DESKTOPDIRECTORY, &id);
- SHGetPathFromIDList (id, buf);
- }
- break;
-
- case 'P':
- SHGetSpecialFolderLocation (NULL, allusers_flag ?
- CSIDL_COMMON_PROGRAMS : CSIDL_PROGRAMS, &id);
- SHGetPathFromIDList (id, buf);
- /* This if clause is a Fix for Win95 without any "All Users" */
- if (strlen (buf) == 0)
- {
- SHGetSpecialFolderLocation (NULL, CSIDL_PROGRAMS, &id);
- SHGetPathFromIDList (id, buf);
- }
- break;
-
- case 'H':
- hinst = LoadLibrary ("userenv");
- if (hinst)
- GetProfilesDirectoryAPtr = (BOOL (*) (LPSTR, LPDWORD))
- GetProcAddress (hinst, "GetProfilesDirectoryA");
- if (GetProfilesDirectoryAPtr)
- (*GetProfilesDirectoryAPtr) (buf, &len);
- else
- {
- GetWindowsDirectory (buf, MAX_PATH);
- strcat (buf, "\\Profiles");
- }
- break;
-
- case 'S':
- GetSystemDirectory (buf, MAX_PATH);
- FindFirstFile (buf, &w32_fd);
- strcpy (strrchr (buf, '\\') + 1, w32_fd.cFileName);
- break;
-
- case 'W':
- GetWindowsDirectory (buf, MAX_PATH);
- break;
-
- default:
- usage (stderr, 1);
- }
-
- if (!windows_flag)
- {
- cygwin_conv_to_posix_path (buf, buf2);
- buf = buf2;
- }
- else
- {
- if (shortname_flag)
- buf = get_short_name (buf);
- }
- printf ("%s\n", buf);
- exit (0);
-}
-
-static void
-convert_slashes (char* name)
-{
- while ((name = strchr (name, '\\')) != NULL)
- {
- if (*name == '\\')
- *name = '/';
- name++;
- }
-}
-
-static char *
-get_mixed_name (const char* filename)
-{
- char* mixed_buf = strdup (filename);
-
- if (mixed_buf == NULL)
- {
- fprintf (stderr, "%s: out of memory\n", prog_name);
- exit (1);
- }
-
- convert_slashes (mixed_buf);
-
- return mixed_buf;
-}
-
-static void
-doit (char *filename)
-{
- char *buf;
- size_t len;
- int retval;
- int (*conv_func) (const char *, char *);
-
- if (path_flag)
- {
- if (cygwin_posix_path_list_p (filename) ? unix_flag : windows_flag)
- {
- /* The path is already in the right format. */
- puts (filename);
- exit (0);
- }
- }
-
- if (!path_flag)
- {
- len = strlen (filename) + 100;
- if (len == 100)
- {
- if (!ignore_flag)
- {
- fprintf (stderr, "%s: can't convert empty path\n", prog_name);
- exit (1);
- }
- else
- exit (0);
- }
- }
- else
- {
- if (unix_flag)
- len = cygwin_win32_to_posix_path_list_buf_size (filename);
- else
- len = cygwin_posix_to_win32_path_list_buf_size (filename);
- }
-
- if (len < PATH_MAX)
- len = PATH_MAX;
-
- buf = (char *) malloc (len);
- if (buf == NULL)
- {
- fprintf (stderr, "%s: out of memory\n", prog_name);
- exit (1);
- }
-
- if (path_flag)
- {
- if (unix_flag)
- cygwin_win32_to_posix_path_list (filename, buf);
- else
- {
- cygwin_posix_to_win32_path_list (filename, buf);
- if (shortname_flag)
- buf = get_short_paths (buf);
- if (longname_flag)
- buf = get_long_paths (buf);
- if (mixed_flag)
- buf = get_mixed_name (buf);
- }
- }
- else
- {
- if (unix_flag)
- conv_func = (absolute_flag ? cygwin_conv_to_full_posix_path :
- cygwin_conv_to_posix_path);
- else
- conv_func = (absolute_flag ? cygwin_conv_to_full_win32_path :
- cygwin_conv_to_win32_path);
- retval = conv_func (filename, buf);
- if (mixed_flag)
- buf = get_mixed_name (buf);
- if (retval < 0)
- {
- fprintf (stderr, "%s: error converting \"%s\"\n",
- prog_name, filename);
- exit (1);
- }
- if (!unix_flag)
- {
- if (shortname_flag)
- buf = get_short_name (buf);
- if (longname_flag)
- buf = get_long_name (buf);
- }
- }
-
- puts (buf);
-}
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-cygpath (cygwin) %.*s\n\
-Path Conversion Utility\n\
-Copyright 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.\n\
-Compiled on %s", len, v, __DATE__);
-}
-
-int
-main (int argc, char **argv)
-{
- int c, o = 0;
- int options_from_file_flag;
- char *filename;
-
- prog_name = strrchr (argv[0], '/');
- if (prog_name == NULL)
- prog_name = strrchr (argv[0], '\\');
- if (prog_name == NULL)
- prog_name = argv[0];
- else
- prog_name++;
-
- path_flag = 0;
- unix_flag = 0;
- windows_flag = 0;
- shortname_flag = 0;
- longname_flag = 0;
- mixed_flag = 0;
- ignore_flag = 0;
- options_from_file_flag = 0;
- allusers_flag = 0;
- output_flag = 0;
- while ((c = getopt_long (argc, argv, (char *) "hac:f:opslSuvwt:WiDPAH",
- long_options, (int *) NULL)) != EOF)
- {
- switch (c)
- {
- case 'a':
- absolute_flag = 1;
- break;
-
- case 'c':
- CloseHandle ((HANDLE) strtoul (optarg, NULL, 16));
- break;
-
- case 'f':
- file_arg = optarg;
- break;
-
- case 'o':
- options_from_file_flag = 1;
- break;
-
- case 'p':
- path_flag = 1;
- break;
-
- case 'u':
- if (unix_flag || windows_flag)
- usage (stderr, 1);
- unix_flag = 1;
- break;
-
- case 'w':
- if (unix_flag || windows_flag)
- usage (stderr, 1);
- windows_flag = 1;
- break;
-
- case 'l':
- if (unix_flag || shortname_flag)
- usage (stderr, 1);
- longname_flag = 1;
- break;
-
- case 's':
- if (unix_flag || longname_flag)
- usage (stderr, 1);
- shortname_flag = 1;
- break;
-
- case 't':
- if (unix_flag || (optarg == NULL))
- usage (stderr, 1);
-
- windows_flag = 1;
- windows_format_arg = (*optarg == '=') ? (optarg + 1) : (optarg);
-
- if (strcasecmp (windows_format_arg, "mixed") == 0)
- mixed_flag = 1;
- else if (strcasecmp (windows_format_arg, "dos") == 0)
- /* nothing */;
- else
- usage (stderr, 1);
- break;
-
- case 'A':
- allusers_flag = 1;
- break;
-
- case 'D':
- case 'H':
- case 'P':
- case 'S':
- case 'W':
- if (output_flag)
- usage (stderr, 1);
- output_flag = 1;
- o = c;
- break;
-
- case 'i':
- ignore_flag = 1;
- break;
-
- case 'h':
- usage (stdout, 0);
- break;
-
- case 'v':
- print_version ();
- exit (0);
-
- default:
- usage (stderr, 1);
- break;
- }
-
- }
-
- if (options_from_file_flag && !file_arg)
- usage (stderr, 1);
-
- if (!output_flag && !unix_flag && !windows_flag && !options_from_file_flag)
- usage (stderr, 1);
-
- if (!file_arg)
- {
- if (output_flag)
- dowin (o);
-
- if (optind != argc - 1)
- usage (stderr, 1);
-
- filename = argv[optind];
- doit (filename);
- }
- else
- {
- FILE *fp;
- char buf[PATH_MAX * 2 + 1];
-
- if (argv[optind])
- usage (stderr, 1);
-
- if (strcmp (file_arg, "-") != 0)
- fp = fopen (file_arg, "rt");
- else
- {
- fp = stdin;
- setmode (0, O_TEXT);
- }
- if (fp == NULL)
- {
- perror ("cygpath");
- exit (1);
- }
-
- setbuf (stdout, NULL);
- while (fgets (buf, sizeof (buf), fp) != NULL)
- {
- char *s = buf;
- char *p = strchr (s, '\n');
- if (p)
- *p = '\0';
- if (options_from_file_flag && *s == '-')
- {
- char c;
- for (c = *++s; c && !isspace (c); c = *++s)
- switch (c)
- {
- case 'a':
- absolute_flag = 1;
- break;
- case 'i':
- ignore_flag = 1;
- break;
- case 's':
- shortname_flag = 1;
- longname_flag = 0;
- break;
- case 'l':
- shortname_flag = 0;
- longname_flag = 1;
- break;
- case 'w':
- unix_flag = 0;
- windows_flag = 1;
- break;
- case 'u':
- windows_flag = 0;
- unix_flag = 1;
- break;
- case 'p':
- path_flag = 1;
- break;
- case 'D':
- case 'H':
- case 'P':
- case 'S':
- case 'W':
- output_flag = 1;
- o = c;
- break;
- }
- if (*s)
- do
- s++;
- while (*s && isspace (*s));
- }
- if (*s && !output_flag)
- doit (s);
- if (!*s && output_flag)
- dowin (o);
- }
- }
-
- exit (0);
-}
diff --git a/winsup/utils/dump_setup.cc b/winsup/utils/dump_setup.cc
deleted file mode 100644
index d551098b9..000000000
--- a/winsup/utils/dump_setup.cc
+++ /dev/null
@@ -1,249 +0,0 @@
-/* path.cc
-
- Copyright 2001 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 <windows.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <io.h>
-#include "path.h"
-
-static int package_len = 20;
-static int version_len = 20;
-
-
-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') - 7;
- if (p <= path)
- return 0;
- if (*p == '.')
- {
- if (strcmp (p, ".tar.gz") != 0)
- return 0;
- }
- else if (--p <= path || strcmp (p, ".tar.bz2") != 0)
- return 0;
-
- return p - path;
-}
-
-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 == '-')
- 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 *path = cygpath ("/etc/setup/", fn, NULL);
- FILE *fp = fopen (path, "rt");
- bool printed;
- char buf[4096];
- if (!fp)
- printed = false;
- else if (!fgets (buf, 4096, fp))
- printed = false;
- {
- char *p = strchr (buf, '\0');
- printf ("%s%s%s", msg, buf, (p == buf) || p[-1] != '\n' ? "\n" : "");
- printed = true;
- }
- if (fp)
- 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 strcmp (pa->name, pb->name);
-}
-}
-
-bool
-match_argv (char **argv, const char *name)
-{
- if (!argv || !*argv)
- return true;
- for (char **a = argv; *a; a++)
- if (strcasecmp (*a, name) == 0)
- return true;
- return false;
-}
-
-void
-dump_setup (int verbose, char **argv, bool /*check_files*/)
-{
- char *setup = cygpath ("/etc/setup/installed.db", NULL);
- FILE *fp = fopen (setup, "rt");
- puts ("Cygwin Package Information");
- if (fp == NULL)
- goto err;
- 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 ("");
- }
-
- if (!fp)
- goto err;
-
- int nlines;
- nlines = 0;
- char buf[4096];
- while (fgets (buf, 4096, fp))
- nlines += 2; /* potentially binary + source */
- if (!nlines)
- goto err;
- rewind (fp);
-
- pkgver *packages;
-
- packages = (pkgver *) calloc (nlines, sizeof(packages[0]));
- printf ("%-*s%-*s\n", package_len, "Package", version_len, "Version");
- 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;
- 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);
- n++;
- if (strtok (NULL, " ") == NULL)
- break;
- }
- }
-
- qsort (packages, n, sizeof (packages[0]), compar);
-
- for (int i = 0; i < n; i++)
- printf ("%-*s%-*s\n", package_len, packages[i].name,
- version_len, packages[i].ver);
- fclose (fp);
-
- return;
-
-err:
- puts ("No setup information found");
- if (fp)
- fclose (fp);
- return;
-}
diff --git a/winsup/utils/dumper.cc b/winsup/utils/dumper.cc
deleted file mode 100644
index b898ebdbd..000000000
--- a/winsup/utils/dumper.cc
+++ /dev/null
@@ -1,880 +0,0 @@
-/* dumper.cc
-
- Copyright 1999, 2001, 2002 Red Hat Inc.
-
- Written by Egor Duda <deo@logos-m.ru>
-
- 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 <bfd.h>
-#include <elf/common.h>
-#include <elf/external.h>
-#include <sys/procfs.h>
-#include <sys/cygwin.h>
-#include <getopt.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <windows.h>
-
-#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;
-
-static const char version[] = "$Revision$";
-
-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 #%lu, error %ld\n", pid, 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, DWORD 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 %08x-%08x\n", (DWORD) base, (DWORD) 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, DWORD 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, (DWORD) 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 %08x %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;
- DWORD last_size = 0;
- DWORD 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 %08x-%08x (protect = %s), error %ld.\n",
- (DWORD) current_page_address,
- (DWORD) 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;
-
- DWORD size = memory->size;
- DWORD todo;
- DWORD 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 #%lu, error %ld", pid, GetLastError ());
- return 0;
- }
-
- char event_name[sizeof ("cygwin_error_start_event") + 20];
- sprintf (event_name, "cygwin_error_start_event%16lx", pid);
- HANDLE sync_with_debugee = OpenEvent (EVENT_MODIFY_STATE, FALSE, event_name);
-
- DEBUG_EVENT current_event;
-
- while (1)
- {
- if (!WaitForDebugEvent (&current_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;
- DWORD sect_size;
- bfd_vma sect_vma;
-
- asection *new_section;
-
- for (process_entity * p = list; p != NULL; p = p->next)
- {
- sect_no++;
-
- 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);
-
- 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;
- 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;
- break;
-
- default:
- continue;
- }
-
- if (p->type == pr_ent_module && status_section != NULL)
- {
- if (!bfd_set_section_size (core_bfd,
- status_section,
- status_section->_raw_size + 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->output_section = new_section;
- new_section->output_offset = 0;
- p->section = new_section;
- }
-
- 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=%08x size=%08x flags=%08x\n",
- p->type,
- p->section->vma,
- p->section->_raw_size,
- 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: dumper [OPTION] FILENAME WIN32PID\n\
-Dump core from WIN32PID to FILENAME.core\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\
-");
- 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}
-};
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-dumper (cygwin) %.*s\n\
-Core Dumper for Cygwin\n\
-Copyright 1999, 2001, 2002 Red Hat, Inc.\n", len, v);
-}
-
-int
-main (int argc, char **argv)
-{
- int opt;
- const char *p = "";
- DWORD pid;
- char win32_name [MAX_PATH];
-
- while ((opt = getopt_long (argc, argv, "dqhv", 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:
- usage (stderr, 1);
- break;
- }
-
- if (argv && *(argv + optind) && *(argv + optind +1))
- {
- *win32_name = '\0';
- cygwin_conv_to_win32_path (*(argv + optind), win32_name);
- 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 #%lu to %s\n", 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 2a1841e78..000000000
--- a/winsup/utils/dumper.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/* dumper.h
-
- Copyright 1999,2001 Red Hat Inc.
-
- Written by Egor Duda <deo@logos-m.ru>
-
-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 _DUMPER_H_
-#define _DUMPER_H_
-
-#include <windows.h>
-
-typedef struct
-{
- LPBYTE base;
- DWORD 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:
- int last;
- int size;
- int step;
- process_mem_region* region;
-
- exclusion ( int step ) { last = size = 0;
- this->step = step;
- region = NULL; }
- ~exclusion () { free ( region ); }
- int add ( LPBYTE mem_base, DWORD 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, DWORD size );
-
- /* break mem_region by excl_list and add add all subregions */
- int split_add_mem_region ( LPBYTE base, DWORD 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, DWORD BaseAddress );
-
-extern int parse_pe ( const char* file_name, exclusion* excl_list );
-
-extern BOOL verbose;
-
-#endif
diff --git a/winsup/utils/getfacl.c b/winsup/utils/getfacl.c
deleted file mode 100644
index 47b2b7da3..000000000
--- a/winsup/utils/getfacl.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/* getfacl.c
-
- Copyright 2000, 2001, 2002 Red Hat Inc.
-
- Written by Corinna Vinschen <vinschen@redhat.com>
-
-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 <pwd.h>
-#include <grp.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <sys/types.h>
-#include <sys/acl.h>
-#include <sys/stat.h>
-#include <string.h>
-
-static const char version[] = "$Revision$";
-static char *prog_name;
-
-char *
-permstr (mode_t perm)
-{
- static char pbuf[4];
-
- pbuf[0] = (perm & S_IREAD) ? 'r' : '-';
- pbuf[1] = (perm & S_IWRITE) ? 'w' : '-';
- pbuf[2] = (perm & S_IEXEC) ? '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, "%d <unknown>", 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, "%d <unknown>", gid);
- return gbuf;
-}
-
-static void
-usage (FILE * stream)
-{
- fprintf (stream, "Usage: %s [-adn] FILE [FILE2...]\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}
-};
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-getfacl (cygwin) %.*s\n\
-ACL Utility\n\
-Copyright (c) 2000, 2001, 2002 Red Hat, Inc.\n\
-Compiled on %s", len, v, __DATE__);
-}
-
-int
-main (int argc, char **argv)
-{
- extern int optind;
- int c, i;
- int aopt = 0;
- int dopt = 0;
- int nopt = 0;
- int first = 1;
- struct stat st;
- aclent_t acls[MAX_ACL_ENTRIES];
-
- prog_name = strrchr (argv[0], '/');
- if (prog_name == NULL)
- prog_name = strrchr (argv[0], '\\');
- if (prog_name == NULL)
- prog_name = argv[0];
- else
- prog_name++;
-
- while ((c = getopt_long (argc, argv, "adhnv", 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:
- usage (stderr);
- return 1;
- }
- if (optind > argc - 1)
- {
- usage (stderr);
- return 1;
- }
- while ((c = optind++) < argc)
- {
- if (stat (argv[c], &st))
- {
- perror (argv[0]);
- continue;
- }
- if (!first)
- putchar ('\n');
- first = 0;
- printf ("# file: %s\n", argv[c]);
- if (nopt)
- {
- printf ("# owner: %d\n", st.st_uid);
- printf ("# group: %d\n", st.st_gid);
- }
- else
- {
- printf ("# owner: %s\n", username (st.st_uid));
- printf ("# group: %s\n", groupname (st.st_gid));
- }
- if ((c = acl (argv[c], GETACL, MAX_ACL_ENTRIES, acls)) < 0)
- {
- perror (argv[0]);
- continue;
- }
- for (i = 0; i < c; ++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:%d:", 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:%d:", 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));
- }
- }
- return 0;
-}
diff --git a/winsup/utils/kill.cc b/winsup/utils/kill.cc
deleted file mode 100644
index f59d1e8fd..000000000
--- a/winsup/utils/kill.cc
+++ /dev/null
@@ -1,237 +0,0 @@
-/* kill.cc
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <string.h>
-#include <time.h>
-#include <errno.h>
-#include <windows.h>
-#include <sys/cygwin.h>
-#include <getopt.h>
-
-static const char version[] = "$Revision$";
-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";
-
-extern "C" const char *strsigno (int);
-
-static void
-usage (FILE *where = stderr)
-{
- fprintf (where , ""
- "Usage: %s [-f] [-signal] [-s signal] pid1 [pid2 ...]\n"
- " %s -l [signal]\n"
- " -f, --force force, using win32 interface if necessary\n"
- " -l, --list print a list of signal names\n"
- " -s, --signal send signal (use %s --list for a list)\n"
- " -h, --help output usage information and exit\n"
- " -v, --version output version information and exit\n"
- "", prog_name, prog_name, prog_name);
- exit (where == stderr ? 1 : 0);
-}
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-%s (cygwin) %.*s\n\
-Process Signaller\n\
-Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.\n\
-Compiled on %s", prog_name, len, v, __DATE__);
-}
-
-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%s", 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, "%s: unknown signal: %s\n", prog_name, sigstr);
- usage ();
- exit (1);
- }
-}
-
-static void
-listsig (const char *in_sig)
-{
- int sig;
- if (!in_sig)
- for (sig = 1; sig < NSIG; 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 __stdcall
-forcekill (int pid, int sig, int wait)
-{
- external_pinfo *p = (external_pinfo *) cygwin_internal (CW_GETPINFO_FULL, pid);
- if (!p)
- return;
- HANDLE h = OpenProcess (PROCESS_TERMINATE, FALSE, (DWORD) p->dwProcessId);
- if (!h)
- return;
- if (!wait || WaitForSingleObject (h, 200) != WAIT_OBJECT_0)
- TerminateProcess (h, sig << 8);
- CloseHandle (h);
-}
-
-int
-main (int argc, char **argv)
-{
- int sig = SIGTERM;
- int force = 0;
- char *gotsig = NULL;
- int ret = 0;
-
- prog_name = strrchr (argv[0], '/');
- if (prog_name == NULL)
- prog_name = strrchr (argv[0], '\\');
- if (prog_name == NULL)
- prog_name = argv[0];
- else
- prog_name++;
-
- if (argc == 1)
- usage ();
-
- opterr = 0;
- for (;;)
- {
- int ch;
- char **av = argv + optind;
- if ((ch = getopt_long (argc, argv, opts, longopts, NULL)) == EOF)
- break;
- switch (ch)
- {
- case 's':
- gotsig = optarg;
- sig = getsig (gotsig);
- 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 (gotsig)
- usage ();
- optreset = 1;
- optind = 1 + av - argv;
- gotsig = *av + 1;
- sig = getsig (gotsig);
- break;
- default:
- usage ();
- break;
- }
- }
-
- test_for_unknown_sig (sig, gotsig);
-
- argv += optind;
- while (*argv != NULL)
- {
- char *p;
- int pid = strtol (*argv, &p, 10);
- if (*p != '\0')
- {
- fprintf (stderr, "%s: illegal pid: %s\n", prog_name, *argv);
- ret = 1;
- }
- else if (kill (pid, sig) == 0)
- {
- if (force)
- forcekill (pid, sig, 1);
- }
- else if (force && sig != 0)
- forcekill (pid, sig, 0);
- else
- {
- char buf[1000];
- sprintf (buf, "%s %d", prog_name, pid);
- perror (buf);
- ret = 1;
- }
- argv++;
- }
- return ret;
-}
diff --git a/winsup/utils/mkgroup.c b/winsup/utils/mkgroup.c
deleted file mode 100644
index 5457354ee..000000000
--- a/winsup/utils/mkgroup.c
+++ /dev/null
@@ -1,630 +0,0 @@
-/* mkgroup.c:
-
- Copyright 1997, 1998, 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. */
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <stdio.h>
-#include <windows.h>
-#include <sys/cygwin.h>
-#include <getopt.h>
-#include <lmaccess.h>
-#include <lmapibuf.h>
-#include <ntsecapi.h>
-#include <ntdef.h>
-
-static const char version[] = "$Revision$";
-
-SID_IDENTIFIER_AUTHORITY sid_world_auth = {SECURITY_WORLD_SID_AUTHORITY};
-SID_IDENTIFIER_AUTHORITY sid_nt_auth = {SECURITY_NT_AUTHORITY};
-
-NET_API_STATUS WINAPI (*netapibufferfree)(PVOID);
-NET_API_STATUS WINAPI (*netgroupenum)(LPWSTR,DWORD,PBYTE*,DWORD,PDWORD,PDWORD,PDWORD);
-NET_API_STATUS WINAPI (*netlocalgroupenum)(LPWSTR,DWORD,PBYTE*,DWORD,PDWORD,PDWORD,PDWORD);
-NET_API_STATUS WINAPI (*netlocalgroupgetmembers)(LPWSTR,LPWSTR,DWORD,PBYTE*,DWORD,PDWORD,PDWORD,PDWORD);
-NET_API_STATUS WINAPI (*netgetdcname)(LPWSTR,LPWSTR,PBYTE*);
-NET_API_STATUS WINAPI (*netgroupgetusers)(LPWSTR,LPWSTR,DWORD,PBYTE*,DWORD,PDWORD,PDWORD,PDWORD);
-
-#ifndef min
-#define min(a,b) (((a)<(b))?(a):(b))
-#endif
-
-BOOL
-load_netapi ()
-{
- HANDLE h = LoadLibrary ("netapi32.dll");
-
- if (!h)
- return FALSE;
-
- if (!(netapibufferfree = (void *) GetProcAddress (h, "NetApiBufferFree")))
- return FALSE;
- if (!(netgroupenum = (void *) GetProcAddress (h, "NetGroupEnum")))
- return FALSE;
- if (!(netgroupgetusers = (void *) GetProcAddress (h, "NetGroupGetUsers")))
- return FALSE;
- if (!(netlocalgroupenum = (void *) GetProcAddress (h, "NetLocalGroupEnum")))
- return FALSE;
- if (!(netlocalgroupgetmembers = (void *) GetProcAddress (h, "NetLocalGroupGetMembers")))
- return FALSE;
- if (!(netgetdcname = (void *) GetProcAddress (h, "NetGetDCName")))
- return FALSE;
-
- return TRUE;
-}
-
-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, "-%lu", *GetSidSubAuthority (sid, i));
- strcat (s, t);
- }
- return s;
-}
-
-void
-psx_dir (char *in, char *out)
-{
- if (isalpha (in[0]) && in[1] == ':')
- {
- sprintf (out, "/cygdrive/%c", in[0]);
- in += 2;
- out += strlen (out);
- }
-
- while (*in)
- {
- if (*in == '\\')
- *out = '/';
- else
- *out = *in;
- in++;
- out++;
- }
-
- *out = '\0';
-}
-
-void
-uni2ansi (LPWSTR wcs, char *mbs, int size)
-{
- if (wcs)
- WideCharToMultiByte (CP_ACP, 0, wcs, -1, mbs, size, NULL, NULL);
- else
- *mbs = '\0';
-}
-
-void
-enum_local_users (LPWSTR groupname)
-{
- LOCALGROUP_MEMBERS_INFO_1 *buf1;
- DWORD entries = 0;
- DWORD total = 0;
- DWORD reshdl = 0;
-
- if (!netlocalgroupgetmembers (NULL, groupname,
- 1, (LPBYTE *) &buf1,
- MAX_PREFERRED_LENGTH,
- &entries, &total, &reshdl))
- {
- int i, first = 1;
-
- for (i = 0; i < entries; ++i)
- if (buf1[i].lgrmi1_sidusage == SidTypeUser)
- {
- char user[256];
-
- if (!first)
- printf (",");
- first = 0;
- uni2ansi (buf1[i].lgrmi1_name, user, sizeof (user));
- printf ("%s", user);
- }
- netapibufferfree (buf1);
- }
-}
-
-int
-enum_local_groups (int print_sids, int print_users)
-{
- LOCALGROUP_INFO_0 *buffer;
- DWORD entriesread = 0;
- DWORD totalentries = 0;
- DWORD resume_handle = 0;
- DWORD rc;
-
- do
- {
- DWORD i;
-
- rc = netlocalgroupenum (NULL, 0, (LPBYTE *) &buffer, 1024,
- &entriesread, &totalentries, &resume_handle);
- switch (rc)
- {
- case ERROR_ACCESS_DENIED:
- fprintf (stderr, "Access denied\n");
- exit (1);
-
- case ERROR_MORE_DATA:
- case ERROR_SUCCESS:
- break;
-
- default:
- fprintf (stderr, "NetLocalGroupEnum() failed with %ld\n", rc);
- exit (1);
- }
-
- for (i = 0; i < entriesread; i++)
- {
- char localgroup_name[100];
- char domain_name[100];
- DWORD domname_len = 100;
- char psid_buffer[1024];
- PSID psid = (PSID) psid_buffer;
- DWORD sid_length = 1024;
- DWORD gid;
- SID_NAME_USE acc_type;
- uni2ansi (buffer[i].lgrpi0_name, localgroup_name, sizeof (localgroup_name));
-
- if (!LookupAccountName (NULL, localgroup_name, psid,
- &sid_length, domain_name, &domname_len,
- &acc_type))
- {
- fprintf (stderr, "LookupAccountName(%s) failed with %ld\n",
- localgroup_name, GetLastError ());
- continue;
- }
- else if (acc_type == SidTypeDomain)
- {
- char domname[356];
-
- strcpy (domname, domain_name);
- strcat (domname, "\\");
- strcat (domname, localgroup_name);
- sid_length = 1024;
- domname_len = 100;
- if (!LookupAccountName (NULL, domname,
- psid, &sid_length,
- domain_name, &domname_len,
- &acc_type))
- {
- fprintf (stderr,
- "LookupAccountName(%s) failed with error %ld\n",
- localgroup_name, GetLastError ());
- continue;
- }
- }
-
- gid = *GetSidSubAuthority (psid, *GetSidSubAuthorityCount(psid) - 1);
-
- printf ("%s:%s:%ld:", localgroup_name,
- print_sids ? put_sid (psid) : "",
- gid);
- if (print_users)
- enum_local_users (buffer[i].lgrpi0_name);
- printf ("\n");
- }
-
- netapibufferfree (buffer);
-
- }
- while (rc == ERROR_MORE_DATA);
-
- return 0;
-}
-
-void
-enum_users (LPWSTR servername, LPWSTR groupname)
-{
- GROUP_USERS_INFO_0 *buf1;
- DWORD entries = 0;
- DWORD total = 0;
- DWORD reshdl = 0;
-
- if (!netgroupgetusers (servername, groupname,
- 0, (LPBYTE *) &buf1,
- MAX_PREFERRED_LENGTH,
- &entries, &total, &reshdl))
- {
- int i, first = 1;
-
- for (i = 0; i < entries; ++i)
- {
- char user[256];
-
- if (!first)
- printf (",");
- first = 0;
- uni2ansi (buf1[i].grui0_name, user, sizeof (user));
- printf ("%s", user);
- }
- netapibufferfree (buf1);
- }
-}
-
-void
-enum_groups (LPWSTR servername, int print_sids, int print_users, int id_offset)
-{
- GROUP_INFO_2 *buffer;
- DWORD entriesread = 0;
- DWORD totalentries = 0;
- DWORD resume_handle = 0;
- DWORD rc;
- char ansi_srvname[256];
-
- if (servername)
- uni2ansi (servername, ansi_srvname, sizeof (ansi_srvname));
-
- do
- {
- DWORD i;
-
- rc = netgroupenum (servername, 2, (LPBYTE *) & buffer, 1024,
- &entriesread, &totalentries, &resume_handle);
- switch (rc)
- {
- case ERROR_ACCESS_DENIED:
- fprintf (stderr, "Access denied\n");
- exit (1);
-
- case ERROR_MORE_DATA:
- case ERROR_SUCCESS:
- break;
-
- default:
- fprintf (stderr, "NetGroupEnum() failed with %ld\n", rc);
- exit (1);
- }
-
- for (i = 0; i < entriesread; i++)
- {
- char groupname[100];
- char domain_name[100];
- DWORD domname_len = 100;
- char psid_buffer[1024];
- PSID psid = (PSID) psid_buffer;
- DWORD sid_length = 1024;
- SID_NAME_USE acc_type;
-
- int gid = buffer[i].grpi2_group_id;
- uni2ansi (buffer[i].grpi2_name, groupname, sizeof (groupname));
- if (print_sids)
- {
- if (!LookupAccountName (servername ? ansi_srvname : NULL,
- groupname,
- psid, &sid_length,
- domain_name, &domname_len,
- &acc_type))
- {
- fprintf (stderr,
- "LookupAccountName (%s, %s) failed with error %ld\n",
- servername ? ansi_srvname : "NULL",
- groupname,
- GetLastError ());
- continue;
- }
- else if (acc_type == SidTypeDomain)
- {
- char domname[356];
-
- strcpy (domname, domain_name);
- strcat (domname, "\\");
- strcat (domname, groupname);
- sid_length = 1024;
- domname_len = 100;
- if (!LookupAccountName (servername ? ansi_srvname : NULL,
- domname,
- psid, &sid_length,
- domain_name, &domname_len,
- &acc_type))
- {
- fprintf (stderr,
- "LookupAccountName(%s,%s) failed with error %ld\n",
- servername ? ansi_srvname : "NULL",
- domname,
- GetLastError ());
- continue;
- }
- }
- }
- printf ("%s:%s:%d:", groupname,
- print_sids ? put_sid (psid) : "",
- gid + id_offset);
- if (print_users)
- enum_users (servername, buffer[i].grpi2_name);
- printf ("\n");
- }
-
- netapibufferfree (buffer);
-
- }
- while (rc == ERROR_MORE_DATA);
-
- if (servername)
- netapibufferfree (servername);
-}
-
-void
-print_special (int print_sids,
- PSID_IDENTIFIER_AUTHORITY auth, BYTE cnt,
- DWORD sub1, DWORD sub2, DWORD sub3, DWORD sub4,
- DWORD sub5, DWORD sub6, DWORD sub7, DWORD sub8)
-{
- char name[256], dom[256];
- DWORD len, len2, rid;
- PSID sid;
- SID_NAME_USE use;
-
- if (AllocateAndInitializeSid (auth, cnt, sub1, sub2, sub3, sub4,
- sub5, sub6, sub7, sub8, &sid))
- {
- if (LookupAccountSid (NULL, sid,
- name, (len = 256, &len),
- dom, (len2 = 256, &len),
- &use))
- {
- 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 ("%s:%s:%lu:\n", name,
- print_sids ? put_sid (sid) : "",
- rid);
- }
- FreeSid (sid);
- }
-}
-
-int
-usage (FILE * stream, int status)
-{
- fprintf (stream, "Usage: mkgroup [OPTION]... [domain]\n\n"
- "This program prints a /etc/group file to stdout\n\n"
- "Options:\n"
- " -l,--local print local group information\n"
- " -d,--domain print global group information from the domain\n"
- " specified (or from the current domain if there is\n"
- " no domain specified)\n"
- " -o,--id-offset offset change the default offset (10000) added to uids\n"
- " in domain accounts.\n"
- " -s,--no-sids don't print SIDs in pwd field\n"
- " (this affects ntsec)\n"
- " -u,--users print user list in gr_mem field\n"
- " -h,--help print this message\n\n"
- " -v,--version print version information and exit\n\n"
- "One of `-l' or `-d' must be given on NT/W2K.\n");
- return status;
-}
-
-struct option longopts[] = {
- {"local", no_argument, NULL, 'l'},
- {"domain", no_argument, NULL, 'd'},
- {"id-offset", required_argument, NULL, 'o'},
- {"no-sids", no_argument, NULL, 's'},
- {"users", no_argument, NULL, 'u'},
- {"help", no_argument, NULL, 'h'},
- {"version", no_argument, NULL, 'v'},
- {0, no_argument, NULL, 0}
-};
-
-char opts[] = "ldo:suhv";
-
-void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-mkgroup (cygwin) %.*s\n\
-group File Generator\n\
-Copyright 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.\n\
-Compiled on %s", len, v, __DATE__);
-}
-
-int
-main (int argc, char **argv)
-{
- LPWSTR servername;
- DWORD rc = ERROR_SUCCESS;
- WCHAR domain_name[100];
- int print_local = 0;
- int print_domain = 0;
- int print_sids = 1;
- int print_users = 0;
- int domain_specified = 0;
- int id_offset = 10000;
- int i;
-
- char name[256], dom[256];
- DWORD len, len2;
- char buf[1024];
- PSID psid = NULL;
- SID_NAME_USE use;
-
- LSA_OBJECT_ATTRIBUTES oa = { 0, 0, 0, 0, 0, 0 };
- LSA_HANDLE lsa = INVALID_HANDLE_VALUE;
- NTSTATUS ret;
- PPOLICY_PRIMARY_DOMAIN_INFO pdi;
-
- if (GetVersion () < 0x80000000)
- {
- if (argc == 1)
- return usage(stderr, 1);
- else
- {
- while ((i = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
- switch (i)
- {
- case 'l':
- print_local = 1;
- break;
- case 'd':
- print_domain = 1;
- break;
- case 'o':
- id_offset = strtol (optarg, NULL, 10);
- break;
- case 's':
- print_sids = 0;
- break;
- case 'u':
- print_users = 1;
- break;
- case 'h':
- return usage (stdout, 0);
- case 'v':
- print_version ();
- return 0;
- default:
- fprintf (stderr, "Try `%s --help' for more information.\n", argv[0]);
- return 1;
- }
- if (!print_local && !print_domain)
- {
- fprintf (stderr, "%s: Specify one of `-l' or `-d'\n", argv[0]);
- return 1;
- }
- if (optind < argc)
- {
- if (!print_domain)
- {
- fprintf (stderr, "%s: A domain name is only accepted "
- "when `-d' is given.\n", argv[0]);
- return 1;
- }
- mbstowcs (domain_name, argv[optind], (strlen (argv[optind]) + 1));
- domain_specified = 1;
- }
- }
- }
-
- /* This takes Windows 9x/ME into account. */
- if (GetVersion () >= 0x80000000)
- {
- printf ("unknown::%ld:\n", DOMAIN_ALIAS_RID_ADMINS);
- return 0;
- }
-
- if (!load_netapi ())
- {
- fprintf (stderr, "Failed loading symbols from netapi32.dll "
- "with error %lu\n", GetLastError ());
- return 1;
- }
-
- /*
- * Get `Everyone' group
- */
- print_special (print_sids, &sid_world_auth, 1, SECURITY_WORLD_RID,
- 0, 0, 0, 0, 0, 0, 0);
- /*
- * Get `system' group
- */
- print_special (print_sids, &sid_nt_auth, 1, SECURITY_LOCAL_SYSTEM_RID,
- 0, 0, 0, 0, 0, 0, 0);
- if (print_local)
- {
- /*
- * Get `None' group
- */
- len = 256;
- GetComputerName (name, &len);
- len = 1024;
- len2 = 256;
- if (LookupAccountName (NULL, name, (PSID) buf, &len, dom, &len, &use))
- psid = (PSID) buf;
- else
- {
- ret = LsaOpenPolicy(NULL, &oa, POLICY_VIEW_LOCAL_INFORMATION, &lsa);
- if (ret == STATUS_SUCCESS && lsa != INVALID_HANDLE_VALUE)
- {
- ret = LsaQueryInformationPolicy (lsa,
- PolicyPrimaryDomainInformation,
- (PVOID *) &pdi);
- if (ret == STATUS_SUCCESS)
- {
- if (pdi->Sid)
- {
- CopySid (1024, (PSID) buf, pdi->Sid);
- psid = (PSID) buf;
- }
- LsaFreeMemory (pdi);
- }
- LsaClose (lsa);
- }
- }
- if (!psid)
- fprintf (stderr,
- "WARNING: Group 513 couldn't get retrieved. Try mkgroup -d\n");
- else
- print_special (print_sids, GetSidIdentifierAuthority (psid), 5,
- *GetSidSubAuthority (psid, 0),
- *GetSidSubAuthority (psid, 1),
- *GetSidSubAuthority (psid, 2),
- *GetSidSubAuthority (psid, 3),
- 513,
- 0,
- 0,
- 0);
- }
-
- if (print_domain)
- {
- if (domain_specified)
- rc = netgetdcname (NULL, domain_name, (LPBYTE *) & servername);
-
- else
- rc = netgetdcname (NULL, NULL, (LPBYTE *) & servername);
-
- if (rc != ERROR_SUCCESS)
- {
- fprintf (stderr, "Cannot get PDC, code = %ld\n", rc);
- return 1;
- }
-
- enum_groups (servername, print_sids, print_users, id_offset);
- }
-
- if (print_local)
- enum_local_groups (print_sids, print_users);
-
- return 0;
-}
diff --git a/winsup/utils/mkpasswd.c b/winsup/utils/mkpasswd.c
deleted file mode 100644
index 63a81aabd..000000000
--- a/winsup/utils/mkpasswd.c
+++ /dev/null
@@ -1,625 +0,0 @@
-/* mkpasswd.c:
-
- Copyright 1997, 1998, 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. */
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <stdio.h>
-#include <windows.h>
-#include <io.h>
-#include <sys/cygwin.h>
-#include <getopt.h>
-#include <lmaccess.h>
-#include <lmapibuf.h>
-#include <sys/fcntl.h>
-#include <lmerr.h>
-
-static const char version[] = "$Revision$";
-
-SID_IDENTIFIER_AUTHORITY sid_world_auth = {SECURITY_WORLD_SID_AUTHORITY};
-SID_IDENTIFIER_AUTHORITY sid_nt_auth = {SECURITY_NT_AUTHORITY};
-
-NET_API_STATUS WINAPI (*netapibufferfree)(PVOID);
-NET_API_STATUS WINAPI (*netuserenum)(LPWSTR,DWORD,DWORD,PBYTE*,DWORD,PDWORD,PDWORD,PDWORD);
-NET_API_STATUS WINAPI (*netlocalgroupenum)(LPWSTR,DWORD,PBYTE*,DWORD,PDWORD,PDWORD,PDWORD);
-NET_API_STATUS WINAPI (*netgetdcname)(LPWSTR,LPWSTR,PBYTE*);
-NET_API_STATUS WINAPI (*netusergetinfo)(LPWSTR,LPWSTR,DWORD,PBYTE*);
-
-#ifndef min
-#define min(a,b) (((a)<(b))?(a):(b))
-#endif
-
-BOOL
-load_netapi ()
-{
- HANDLE h = LoadLibrary ("netapi32.dll");
-
- if (!h)
- return FALSE;
-
- if (!(netapibufferfree = (void *) GetProcAddress (h, "NetApiBufferFree")))
- return FALSE;
- if (!(netuserenum = (void *) GetProcAddress (h, "NetUserEnum")))
- return FALSE;
- if (!(netlocalgroupenum = (void *) GetProcAddress (h, "NetLocalGroupEnum")))
- return FALSE;
- if (!(netgetdcname = (void *) GetProcAddress (h, "NetGetDCName")))
- return FALSE;
- if (!(netusergetinfo = (void *) GetProcAddress (h, "NetUserGetInfo")))
- return FALSE;
-
- return TRUE;
-}
-
-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, "-%lu", *GetSidSubAuthority (sid, i));
- strcat (s, t);
- }
- return s;
-}
-
-void
-psx_dir (char *in, char *out)
-{
- if (isalpha (in[0]) && in[1] == ':')
- {
- sprintf (out, "/cygdrive/%c", in[0]);
- in += 2;
- out += strlen (out);
- }
-
- while (*in)
- {
- if (*in == '\\')
- *out = '/';
- else
- *out = *in;
- in++;
- out++;
- }
-
- *out = '\0';
-}
-
-void
-uni2ansi (LPWSTR wcs, char *mbs, int size)
-{
- if (wcs)
- WideCharToMultiByte (CP_ACP, 0, wcs, -1, mbs, size, NULL, NULL);
- else
- *mbs = '\0';
-}
-
-void
-print_win_error(DWORD code)
-{
- 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: [%lu] %s", code, buf);
- else
- fprintf (stderr, "mkpasswd: error %lu", code);
-}
-
-int
-enum_users (LPWSTR servername, int print_sids, int print_cygpath,
- const char * passed_home_path, int id_offset, char *disp_username)
-{
- USER_INFO_3 *buffer;
- DWORD entriesread = 0;
- DWORD totalentries = 0;
- DWORD resume_handle = 0;
- DWORD rc;
- char ansi_srvname[256];
- WCHAR uni_name[512];
-
- if (servername)
- uni2ansi (servername, ansi_srvname, sizeof (ansi_srvname));
-
- do
- {
- DWORD i;
-
- if (disp_username != NULL)
- {
- MultiByteToWideChar (CP_ACP, 0, disp_username, -1, uni_name, 512 );
- rc = netusergetinfo(servername, (LPWSTR) & uni_name, 3,
- (LPBYTE *) &buffer );
- entriesread=1;
- }
- else
- rc = netuserenum (servername, 3, FILTER_NORMAL_ACCOUNT,
- (LPBYTE *) & buffer, 1024,
- &entriesread, &totalentries, &resume_handle);
- switch (rc)
- {
- case ERROR_ACCESS_DENIED:
- print_win_error(rc);
- exit (1);
-
- case ERROR_MORE_DATA:
- case ERROR_SUCCESS:
- break;
-
- default:
- print_win_error(rc);
- exit (1);
- }
-
- for (i = 0; i < entriesread; i++)
- {
- char username[100];
- char fullname[100];
- char homedir_psx[MAX_PATH];
- char homedir_w32[MAX_PATH];
- char domain_name[100];
- DWORD domname_len = 100;
- char psid_buffer[1024];
- PSID psid = (PSID) psid_buffer;
- DWORD sid_length = 1024;
- SID_NAME_USE acc_type;
-
- int uid = buffer[i].usri3_user_id;
- int gid = buffer[i].usri3_primary_group_id;
- uni2ansi (buffer[i].usri3_name, username, sizeof (username));
- uni2ansi (buffer[i].usri3_full_name, fullname, sizeof (fullname));
- homedir_w32[0] = homedir_psx[0] = '\0';
- if (passed_home_path[0] == '\0')
- {
- uni2ansi (buffer[i].usri3_home_dir, homedir_w32,
- sizeof (homedir_w32));
- if (homedir_w32[0] != '\0')
- {
- if (print_cygpath)
- cygwin_conv_to_posix_path (homedir_w32, homedir_psx);
- else
- psx_dir (homedir_w32, homedir_psx);
- }
- else
- {
- strcpy (homedir_psx, "/home/");
- strcat (homedir_psx, username);
- }
- }
- else
- {
- strcpy (homedir_psx, passed_home_path);
- strcat (homedir_psx, username);
- }
-
- if (print_sids)
- {
- if (!LookupAccountName (servername ? ansi_srvname : NULL,
- username,
- psid, &sid_length,
- domain_name, &domname_len,
- &acc_type))
- {
- print_win_error(GetLastError ());
- continue;
- }
- else if (acc_type == SidTypeDomain)
- {
- char domname[356];
-
- strcpy (domname, domain_name);
- strcat (domname, "\\");
- strcat (domname, username);
- sid_length = 1024;
- domname_len = 100;
- if (!LookupAccountName (servername ? ansi_srvname : NULL,
- domname,
- psid, &sid_length,
- domain_name, &domname_len,
- &acc_type))
- {
- print_win_error(GetLastError ());
- continue;
- }
- }
- }
- printf ("%s:unused_by_nt/2000/xp:%d:%d:%s%s%s%s%s%s%s%s:%s:/bin/bash\n",
- username,
- uid + id_offset,
- gid + id_offset,
- fullname,
- print_sids && fullname[0] ? "," : "",
- print_sids ? "U-" : "",
- print_sids ? domain_name : "",
- print_sids && domain_name[0] ? "\\" : "",
- print_sids ? username : "",
- print_sids ? "," : "",
- print_sids ? put_sid (psid) : "",
- homedir_psx);
- }
-
- netapibufferfree (buffer);
-
- }
- while (rc == ERROR_MORE_DATA);
-
- if (servername)
- netapibufferfree (servername);
-
- return 0;
-}
-
-int
-enum_local_groups (int print_sids)
-{
- LOCALGROUP_INFO_0 *buffer;
- DWORD entriesread = 0;
- DWORD totalentries = 0;
- DWORD resume_handle = 0;
- DWORD rc ;
-
- do
- {
- DWORD i;
-
- rc = netlocalgroupenum (NULL, 0, (LPBYTE *) & buffer, 1024,
- &entriesread, &totalentries, &resume_handle);
- switch (rc)
- {
- case ERROR_ACCESS_DENIED:
- print_win_error(rc);
- exit (1);
-
- case ERROR_MORE_DATA:
- case ERROR_SUCCESS:
- break;
-
- default:
- print_win_error(rc);
- exit (1);
- }
-
- for (i = 0; i < entriesread; i++)
- {
- char localgroup_name[100];
- char domain_name[100];
- DWORD domname_len = 100;
- char psid_buffer[1024];
- PSID psid = (PSID) psid_buffer;
- DWORD sid_length = 1024;
- DWORD gid;
- SID_NAME_USE acc_type;
- uni2ansi (buffer[i].lgrpi0_name, localgroup_name, sizeof (localgroup_name));
-
- if (!LookupAccountName (NULL, localgroup_name, psid,
- &sid_length, domain_name, &domname_len,
- &acc_type))
- {
- print_win_error(GetLastError ());
- continue;
- }
- else if (acc_type == SidTypeDomain)
- {
- char domname[356];
-
- strcpy (domname, domain_name);
- strcat (domname, "\\");
- strcat (domname, localgroup_name);
- sid_length = 1024;
- domname_len = 100;
- if (!LookupAccountName (NULL, domname,
- psid, &sid_length,
- domain_name, &domname_len,
- &acc_type))
- {
- print_win_error(GetLastError ());
- continue;
- }
- }
-
- gid = *GetSidSubAuthority (psid, *GetSidSubAuthorityCount(psid) - 1);
-
- printf ("%s:*:%ld:%ld:%s%s::\n", localgroup_name, gid, gid,
- print_sids ? "," : "",
- print_sids ? put_sid (psid) : "");
- }
-
- netapibufferfree (buffer);
-
- }
- while (rc == ERROR_MORE_DATA);
-
- return 0;
-}
-
-void
-print_special (int print_sids,
- PSID_IDENTIFIER_AUTHORITY auth, BYTE cnt,
- DWORD sub1, DWORD sub2, DWORD sub3, DWORD sub4,
- DWORD sub5, DWORD sub6, DWORD sub7, DWORD sub8)
-{
- char name[256], dom[256];
- DWORD len, len2, rid;
- PSID sid;
- SID_NAME_USE use;
-
- if (AllocateAndInitializeSid (auth, cnt, sub1, sub2, sub3, sub4,
- sub5, sub6, sub7, sub8, &sid))
- {
- if (LookupAccountSid (NULL, sid,
- name, (len = 256, &len),
- dom, (len2 = 256, &len),
- &use))
- {
- 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 ("%s:*:%lu:%lu:%s%s::\n",
- name, rid, rid,
- print_sids ? "," : "",
- print_sids ? put_sid (sid) : "");
- }
- FreeSid (sid);
- }
-}
-
-int
-usage (FILE * stream, int status)
-{
- fprintf (stream, "Usage: mkpasswd [OPTION]... [domain]\n\n"
- "This program prints a /etc/passwd file to stdout\n\n"
- "Options:\n"
- " -l,--local print local user accounts\n"
- " -d,--domain print domain accounts (from current domain\n"
- " if no domain specified)\n"
- " -o,--id-offset offset change the default offset (10000) added to uids\n"
- " in domain accounts.\n"
- " -g,--local-groups print local group information too\n"
- " if no domain specified\n"
- " -m,--no-mount don't use mount points for home dir\n"
- " -s,--no-sids don't print SIDs in GCOS field\n"
- " (this affects ntsec)\n"
- " -p,--path-to-home path use specified path instead of user account home dir\n"
- " -u,--username username only return information for the specified user\n"
- " -h,--help displays this message\n"
- " -v,--version version information and exit\n\n"
- "One of `-l', `-d' or `-g' must be given on NT/W2K.\n");
- return status;
-}
-
-struct option longopts[] = {
- {"local", no_argument, NULL, 'l'},
- {"domain", no_argument, NULL, 'd'},
- {"id-offset", required_argument, NULL, 'o'},
- {"local-groups", no_argument, NULL, 'g'},
- {"no-mount", no_argument, NULL, 'm'},
- {"no-sids", no_argument, NULL, 's'},
- {"path-to-home", required_argument, NULL, 'p'},
- {"username", required_argument, NULL, 'u'},
- {"help", no_argument, NULL, 'h'},
- {"version", no_argument, NULL, 'v'},
- {0, no_argument, NULL, 0}
-};
-
-char opts[] = "ldo:gsmhp:u:v";
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-mkpasswd (cygwin) %.*s\n\
-passwd File Generator\n\
-Copyright 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.\n\
-Compiled on %s", len, v, __DATE__);
-}
-
-int
-main (int argc, char **argv)
-{
- LPWSTR servername = NULL;
- DWORD rc = ERROR_SUCCESS;
- WCHAR domain_name[200];
- int print_local = 0;
- int print_domain = 0;
- int print_local_groups = 0;
- int domain_name_specified = 0;
- int print_sids = 1;
- int print_cygpath = 1;
- int id_offset = 10000;
- int i;
- char *disp_username = NULL;
-
- char name[256], passed_home_path[MAX_PATH];
- DWORD len;
-
- passed_home_path[0] = '\0';
- if (!isatty (1))
- setmode (1, O_BINARY);
-
- if (GetVersion () < 0x80000000)
- {
- if (argc == 1)
- return usage (stderr, 1);
- else
- {
- while ((i = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
- switch (i)
- {
- case 'l':
- print_local = 1;
- break;
- case 'd':
- print_domain = 1;
- break;
- case 'o':
- id_offset = strtol (optarg, NULL, 10);
- break;
- case 'g':
- print_local_groups = 1;
- break;
- case 's':
- print_sids = 0;
- break;
- case 'm':
- print_cygpath = 0;
- break;
- case 'p':
- if (optarg[0] != '/')
- {
- fprintf (stderr, "%s: `%s' is not a fully qualified path.\n",
- argv[0], 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':
- return usage (stdout, 0);
- case 'v':
- print_version ();
- return 0;
- default:
- fprintf (stderr, "Try `%s --help' for more information.\n", argv[0]);
- return 1;
- }
- if (!print_local && !print_domain && !print_local_groups)
- {
- fprintf (stderr, "%s: Specify one of `-l', `-d' or `-g'\n", argv[0]);
- return 1;
- }
- if (optind < argc)
- {
- if (!print_domain)
- {
- fprintf (stderr, "%s: A domain name is only accepted "
- "when `-d' is given.\n", argv[0]);
- return 1;
- }
- mbstowcs (domain_name, argv[optind], (strlen (argv[optind]) + 1));
- domain_name_specified = 1;
- }
- }
- }
-
- /* This takes Windows 9x/ME into account. */
- if (GetVersion () >= 0x80000000)
- {
- /* Same behaviour as in cygwin/uinfo.cc (internal_getlogin). */
- if (!GetUserName (name, (len = 256, &len)))
- strcpy (name, "unknown");
-
- if (passed_home_path[0] == '\0')
- strcpy (passed_home_path, "/home/");
-
- printf ("%s::%ld:%ld::%s%s:/bin/bash\n", name,
- DOMAIN_USER_RID_ADMIN,
- DOMAIN_ALIAS_RID_ADMINS,
- passed_home_path,
- name);
-
- return 0;
- }
-
- if (!load_netapi ())
- {
- print_win_error(GetLastError ());
- return 1;
- }
-
- /*
- * Get `Everyone' group
- */
- if (disp_username == NULL)
- {
- print_special (print_sids, &sid_world_auth, 1, SECURITY_WORLD_RID,
- 0, 0, 0, 0, 0, 0, 0);
- /*
- * Get `system' group
- */
- print_special (print_sids, &sid_nt_auth, 1, SECURITY_LOCAL_SYSTEM_RID,
- 0, 0, 0, 0, 0, 0, 0);
- /*
- * Get `administrators' group
- */
- if (!print_local_groups)
- print_special (print_sids, &sid_nt_auth, 2, SECURITY_BUILTIN_DOMAIN_RID,
- DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0);
-
- if (print_local_groups)
- enum_local_groups (print_sids);
- }
-
- if (print_domain)
- {
- if (domain_name_specified)
- rc = netgetdcname (NULL, domain_name, (LPBYTE *) & servername);
-
- else
- rc = netgetdcname (NULL, NULL, (LPBYTE *) & servername);
-
- if (rc != ERROR_SUCCESS)
- {
- print_win_error(rc);
- return 1;
- }
-
- enum_users (servername, print_sids, print_cygpath, passed_home_path,
- id_offset, disp_username);
- }
-
- if (print_local)
- enum_users (NULL, print_sids, print_cygpath, passed_home_path, 0,
- disp_username);
-
- if (servername)
- netapibufferfree (servername);
-
- return 0;
-}
diff --git a/winsup/utils/module_info.cc b/winsup/utils/module_info.cc
deleted file mode 100644
index c0e7079cc..000000000
--- a/winsup/utils/module_info.cc
+++ /dev/null
@@ -1,114 +0,0 @@
-/* module_info.cc
-
- Copyright 1999,2000,2001 Red Hat, Inc.
-
- Written by Egor Duda <deo@logos-m.ru>
-
-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 <stdlib.h>
-#include <windows.h>
-#include <psapi.h>
-
-static int psapi_loaded = 0;
-static HMODULE psapi_module_handle = NULL;
-
-typedef BOOL WINAPI (tf_EnumProcessModules) (HANDLE, HMODULE *, DWORD,
- LPDWORD);
-typedef BOOL WINAPI (tf_GetModuleInformation) (HANDLE, HMODULE, LPMODULEINFO,
- DWORD);
-typedef DWORD WINAPI (tf_GetModuleFileNameExA) (HANDLE, HMODULE, LPSTR,
- DWORD);
-
-static tf_EnumProcessModules *psapi_EnumProcessModules = NULL;
-static tf_GetModuleInformation *psapi_GetModuleInformation = NULL;
-static tf_GetModuleFileNameExA *psapi_GetModuleFileNameExA = NULL;
-
-/* Returns full name of Dll, which is loaded by hProcess at BaseAddress.
- Uses psapi.dll. */
-
-char *
-psapi_get_module_name (HANDLE hProcess, DWORD 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];
-
- if (!psapi_loaded ||
- psapi_EnumProcessModules == NULL ||
- psapi_GetModuleInformation == NULL ||
- psapi_GetModuleFileNameExA == NULL)
- {
- if (psapi_loaded)
- goto failed;
- psapi_loaded = 1;
- psapi_module_handle = LoadLibrary ("psapi.dll");
- if (!psapi_module_handle)
- goto failed;
- psapi_EnumProcessModules =
- (tf_EnumProcessModules *) GetProcAddress (psapi_module_handle,
- "EnumProcessModules");
- psapi_GetModuleInformation =
- (tf_GetModuleInformation *) GetProcAddress (psapi_module_handle,
- "GetModuleInformation");
- psapi_GetModuleFileNameExA =
- (tf_GetModuleFileNameExA *) GetProcAddress (psapi_module_handle,
- "GetModuleFileNameExA");
- if (psapi_EnumProcessModules == NULL
- || psapi_GetModuleInformation == NULL
- || psapi_GetModuleFileNameExA == NULL)
- goto failed;
- }
-
- ok = (*psapi_EnumProcessModules) (hProcess,
- DllHandle, sizeof (HMODULE), &cbNeeded);
-
- if (!ok || !cbNeeded)
- goto failed;
- DllHandle = (HMODULE *) malloc (cbNeeded);
- if (!DllHandle)
- goto failed;
- ok = (*psapi_EnumProcessModules) (hProcess, DllHandle, cbNeeded, &cbNeeded);
- if (!ok)
- {
- free (DllHandle);
- goto failed;
- }
-
- for (i = 0; i < cbNeeded / sizeof (HMODULE); i++)
- {
- if (!(*psapi_GetModuleInformation) (hProcess,
- DllHandle[i], &mi, sizeof (mi)))
- {
- free (DllHandle);
- goto failed;
- }
-
- len = (*psapi_GetModuleFileNameExA) (hProcess,
- DllHandle[i], name_buf, MAX_PATH);
- if (len == 0)
- {
- free (DllHandle);
- goto failed;
- }
-
- if ((DWORD) (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 cd3131028..000000000
--- a/winsup/utils/mount.cc
+++ /dev/null
@@ -1,470 +0,0 @@
-/* mount.cc
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include <stdio.h>
-#include <sys/mount.h>
-#include <sys/stat.h>
-#include <mntent.h>
-#include <windows.h>
-#include <sys/cygwin.h>
-#include <stdlib.h>
-#include <getopt.h>
-
-#ifdef errno
-#undef errno
-#endif
-#include <errno.h>
-
-#define EXEC_FLAGS (MOUNT_EXEC | MOUNT_NOTEXEC | MOUNT_CYGWIN_EXEC)
-
-static void mount_commands (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 short force = FALSE;
-
-static const char version[] = "$Revision$";
-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;
- char win32_path[MAX_PATH];
- int statres;
-
- cygwin_conv_to_win32_path (where, win32_path);
-
- statres = stat (win32_path, &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) && 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 '--no-executable' flag for speed since native path\n"
- "%*creferences a remote share. Use '-f' option to override.\n", progname,
- strlen(progname) + 2, ' ');
- flags |= MOUNT_NOTEXEC;
- }
- }
-
- if (mount (dev, where, flags))
- error (where);
-
- exit (0);
-}
-
-static struct option longopts[] =
-{
- {"binary", no_argument, NULL, 'b'},
- {"change-cygdrive-prefix", no_argument, NULL, 'c'},
- {"cygwin-executable", no_argument, NULL, 'X'},
- {"executable", no_argument, NULL, 'x'},
- {"force", no_argument, NULL, 'f'},
- {"help", no_argument, NULL, 'h' },
- {"mount-commands", no_argument, NULL, 'm'},
- {"no-executable", no_argument, NULL, 'E'},
- {"show-cygdrive-prefix", no_argument, NULL, 'p'},
- {"system", no_argument, NULL, 's'},
- {"text", no_argument, NULL, 't'},
- {"user", no_argument, NULL, 'u'},
- {"version", no_argument, NULL, 'v'},
- {NULL, 0, NULL, 0}
-};
-
-static char opts[] = "bcfhmpstuvxEX";
-
-static void
-usage (FILE *where = stderr)
-{
- fprintf (where, "Usage: %s [OPTION] [<win32path> <posixpath>]\n\
- -b, --binary text files are equivalent to binary files\n\
- (newline = \\n)\n\
- -c, --change-cygdrive-prefix change the cygdrive path prefix to <posixpath>\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-commands write mount commands to replace user and\n\
- system mount points and cygdrive prefixes\n\
- -p, --show-cygdrive-prefix show user and/or system cygdrive path prefix\n\
- -s, --system (default) add system-wide mount point\n\
- -t, --text (default) text files get \\r\\n line endings\n\
- -u, --user add user-only mount point\n\
- -v, --version output version information and exit\n\
- -x, --executable treat all files under mount point as executables\n\
- -E, --no-executable treat all files under mount point as \n\
- non-executables\n\
- -X, --cygwin-executable treat all files under mount point as cygwin\n\
- executables\n\
-", progname);
- exit (where == stderr ? 1 : 0);
-}
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-%s (cygwin) %.*s\n\
-Filesystem Utility\n\
-Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.\n\
-Compiled on %s", progname, len, v, __DATE__);
-}
-
-int
-main (int argc, char **argv)
-{
- int i;
- int flags = MOUNT_BINARY;
- int default_flag = MOUNT_SYSTEM;
- enum do_what
- {
- nada,
- saw_change_cygdrive_prefix,
- saw_show_cygdrive_prefix,
- saw_mount_commands
- } do_what = nada;
-
- progname = strrchr (argv[0], '/');
- if (progname == NULL)
- progname = strrchr (argv[0], '\\');
- if (progname == NULL)
- progname = argv[0];
- else
- progname++;
-
- if (argc == 1)
- {
- show_mounts ();
- exit (0);
- }
-
- while ((i = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
- switch (i)
- {
- case 'b':
- flags |= MOUNT_BINARY;
- 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 'p':
- if (do_what == nada)
- do_what = saw_show_cygdrive_prefix;
- else
- usage ();
- break;
- case 's':
- flags |= MOUNT_SYSTEM;
- break;
- case 't':
- flags &= ~MOUNT_BINARY;
- break;
- case 'u':
- flags &= ~MOUNT_SYSTEM;
- default_flag = 0;
- break;
- case 'v':
- print_version ();
- return 0;
- break;
- case 'x':
- flags |= MOUNT_EXEC;
- break;
- case 'E':
- flags |= MOUNT_NOTEXEC;
- break;
- case 'X':
- flags |= MOUNT_CYGWIN_EXEC;
- break;
- default:
- usage ();
- }
-
- if (flags & MOUNT_NOTEXEC && flags & (MOUNT_EXEC | MOUNT_CYGWIN_EXEC))
- {
- fprintf (stderr, "%s: invalid combination of executable options\n", progname);
- exit (1);
- }
-
- argc--;
- switch (do_what)
- {
- case saw_change_cygdrive_prefix:
- if (optind != argc)
- usage ();
- change_cygdrive_prefix (argv[optind], flags | default_flag);
- break;
- case saw_show_cygdrive_prefix:
- if (optind <= argc)
- usage ();
- show_cygdrive_info ();
- break;
- case saw_mount_commands:
- if (optind <= argc)
- usage ();
- mount_commands ();
- break;
- default:
- if (optind != (argc - 1))
- {
- if (optind >= argc)
- fprintf (stderr, "%s: not enough arguments\n", progname);
- else
- fprintf (stderr, "%s: too many arguments\n", progname);
- usage ();
- }
- if (force || !mount_already_exists (argv[optind + 1], flags))
- do_mount (argv[optind], argv[optind + 1], flags | default_flag);
- else
- {
- errno = EBUSY;
- error (argv[optind + 1]);
- }
- }
-
- /* NOTREACHED */
- return 0;
-}
-
-static void
-mount_commands (void)
-{
- FILE *m = setmntent ("/-not-used-", "r");
- struct mntent *p;
- char *c;
- const char *format_mnt = "mount%s \"%s\" \"%s\"\n";
- const char *format_cyg = "mount%s --change-cygdrive-prefix \"%s\"\n";
- char opts[MAX_PATH];
- char user[MAX_PATH];
- char system[MAX_PATH];
- char user_flags[MAX_PATH];
- char system_flags[MAX_PATH];
-
- // write mount commands for user and system mount points
- while ((p = getmntent (m)) != NULL) {
- // Only list non-cygdrives
- if (!strstr (p->mnt_opts, ",noumount")) {
- strcpy(opts, " -f");
- if (p->mnt_type[0] == 'u')
- strcat (opts, " -u");
- else if (p->mnt_type[0] == 's')
- strcat (opts, " -s");
- if (p->mnt_opts[0] == 'b')
- strcat (opts, " -b");
- else if (p->mnt_opts[0] == 't')
- strcat (opts, " -t");
- if (strstr (p->mnt_opts, ",exec"))
- strcat (opts, " -x");
- if (strstr (p->mnt_opts, ",noexec"))
- strcat (opts, " -E");
- while ((c = strchr (p->mnt_fsname, '\\')) != NULL)
- *c = '/';
- printf (format_mnt, opts, p->mnt_fsname, p->mnt_dir);
- }
- }
- endmntent (m);
-
- // write mount commands for cygdrive prefixes
- cygwin_internal (CW_GET_CYGDRIVE_INFO, user, system, user_flags,
- system_flags);
- if (strlen (user) > 0) {
- strcpy (opts, " ");
- if (user_flags[0] == 'b')
- strcat (opts, " -b");
- else if (user_flags[0] == 't')
- strcat (opts, " -t");
- printf (format_cyg, opts, user);
- }
- if (strlen (system) > 0) {
- strcpy (opts, " -s");
- if (system_flags[0] == 'b')
- strcat (opts, " -b");
- else if (system_flags[0] == 't')
- strcat (opts, " -t");
- printf (format_cyg, opts, system);
- }
-
- 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, "system", system_flags);
-
- exit (0);
-}
diff --git a/winsup/utils/parse_pe.cc b/winsup/utils/parse_pe.cc
deleted file mode 100644
index 07242da87..000000000
--- a/winsup/utils/parse_pe.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-/* parse_pe.cc
-
- Copyright 1999,2000,2001 Red Hat, Inc.
-
- Written by Egor Duda <deo@logos-m.ru>
-
- 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 <bfd.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "dumper.h"
-
-int
-exclusion::add (LPBYTE mem_base, DWORD 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 (p->base + size > q->base)
- {
- fprintf (stderr, "region error @ %08x", (unsigned) p->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 && sect->_raw_size)
- {
- excl_list->add ((LPBYTE) sect->vma, (DWORD) sect->_raw_size);
- deb_printf ("excluding section: %20s %08lx\n", sect->name, sect->_raw_size);
- }
-}
-
-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 48fa75b2c..000000000
--- a/winsup/utils/passwd.c
+++ /dev/null
@@ -1,441 +0,0 @@
-/* passwd.c: Changing passwords and managing account information
-
- Copyright 1999, 2000, 2001, 2002 Red Hat, Inc.
-
- Written by Corinna Vinschen <corinna.vinschen@cityweb.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. */
-
-#include <windows.h>
-#include <wininet.h>
-#include <lmaccess.h>
-#include <lmerr.h>
-#include <lmcons.h>
-#include <lmapibuf.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <pwd.h>
-#include <sys/cygwin.h>
-#include <sys/types.h>
-#include <time.h>
-
-#define USER_PRIV_ADMIN 2
-
-#define UF_LOCKOUT 0x00010
-
-static const char version[] = "$Revision$";
-static char *prog_name;
-
-static struct option longopts[] =
-{
- {"help", no_argument, NULL, 'h' },
- {"inactive", required_argument, NULL, 'i'},
- {"lock", no_argument, NULL, 'l'},
- {"minage", required_argument, NULL, 'n'},
- {"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'},
- {NULL, 0, NULL, 0}
-};
-
-static char opts[] = "L:x:n:i:luShv";
-
-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)
-{
- char usr_buf[UNLEN + 1];
- WCHAR name[2 * (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);
- }
- }
- }
- MultiByteToWideChar (CP_ACP, 0, user, -1, name, 2 * (UNLEN + 1));
- ret = NetUserGetInfo (NULL, name, 3, (LPBYTE *) &ui);
- return EvalRet (ret, user) ? NULL : ui;
-}
-
-int
-ChangePW (const char *user, const char *oldpwd, const char *pwd, int justcheck)
-{
- WCHAR name[2 * (UNLEN + 1)], oldpass[512], pass[512];
- DWORD ret;
-
- MultiByteToWideChar (CP_ACP, 0, user, -1, name, 2 * (UNLEN + 1));
- MultiByteToWideChar (CP_ACP, 0, pwd, -1, pass, 512);
- if (! oldpwd)
- {
- USER_INFO_1003 ui;
-
- ui.usri1003_password = pass;
- ret = NetUserSetInfo (NULL, name, 1003, (LPBYTE) &ui, NULL);
- }
- else
- {
- MultiByteToWideChar (CP_ACP, 0, oldpwd, -1, oldpass, 512);
- ret = NetUserChangePassword (NULL, 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)
-{
- 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 required: %s", (ui->usri3_flags & UF_PASSWD_NOTREQD)
- ? "no\n" : "yes\n");
- printf ("Password expired : %s", (ui->usri3_password_expired)
- ? "yes\n" : "no\n");
- printf ("Password changed : %s", ctime(&t));
- ret = NetUserModalsGet (NULL, 0, (LPBYTE *) &mi);
- if (! ret)
- {
- if (mi->usrmod0_max_passwd_age == TIMEQ_FOREVER
- || ui->usri3_priv == USER_PRIV_ADMIN)
- mi->usrmod0_max_passwd_age = 0;
- if (mi->usrmod0_min_passwd_age == TIMEQ_FOREVER
- || ui->usri3_priv == USER_PRIV_ADMIN)
- mi->usrmod0_min_passwd_age = 0;
- if (mi->usrmod0_force_logoff == TIMEQ_FOREVER
- || ui->usri3_priv == USER_PRIV_ADMIN)
- mi->usrmod0_force_logoff = 0;
- if (ui->usri3_priv == USER_PRIV_ADMIN)
- mi->usrmod0_min_passwd_len = 0;
- printf ("Max. password age %ld days\n",
- mi->usrmod0_max_passwd_age / ONE_DAY);
- printf ("Min. password age %ld days\n",
- mi->usrmod0_min_passwd_age / ONE_DAY);
- printf ("Force logout after %ld days\n",
- mi->usrmod0_force_logoff / ONE_DAY);
- printf ("Min. password length: %ld\n",
- mi->usrmod0_min_passwd_len);
- }
-}
-
-int
-SetModals (int xarg, int narg, int iarg, int Larg)
-{
- int ret;
- PUSER_MODALS_INFO_0 mi;
-
- ret = NetUserModalsGet (NULL, 0, (LPBYTE *) &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 (NULL, 0, (LPBYTE) mi, NULL);
- NetApiBufferFree (mi);
- }
- return EvalRet (ret, NULL);
-}
-
-static void
-usage (FILE * stream, int status)
-{
- fprintf (stream, ""
- "Usage: %s (-l|-u|-S) [USER]\n"
- " %s [-i NUM] [-n MINDAYS] [-x MAXDAYS] [-L LEN]\n"
- "\n"
- "User operations:\n"
- " -l, --lock lock USER's account\n"
- " -u, --unlock unlock USER's account\n"
- " -S, --status display password status for USER (locked, expired, etc.)\n"
- "\n"
- "System operations:\n"
- " -i, --inactive set NUM of days before inactive accounts are disabled\n"
- " (inactive accounts are those with expired passwords)\n"
- " -n, --minage set system minimum password age to MINDAYS\n"
- " -x, --maxage set system maximum password age to MAXDAYS\n"
- " -L, --length set system minimum password length to LEN\n"
- "\n"
- "Other options:\n"
- " -h, --help output usage information and exit\n"
- " -v, --version output version information and exit\n"
- "", prog_name, prog_name);
- exit (status);
-}
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-%s (cygwin) %.*s\n\
-Password Utility\n\
-Copyright 1999, 2000, 2001, 2002 Red Hat, Inc.\n\
-Compiled on %s", prog_name, len, v, __DATE__);
-}
-
-int
-main (int argc, char **argv)
-{
- char *c;
- char user[64], oldpwd[64], newpwd[64];
- 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 Sopt = 0;
- PUSER_INFO_3 ui, li;
-
- prog_name = strrchr (argv[0], '/');
- if (prog_name == NULL)
- prog_name = strrchr (argv[0], '\\');
- if (prog_name == NULL)
- prog_name = argv[0];
- else
- prog_name++;
- c = strrchr (prog_name, '.');
- if (c)
- *c = '\0';
-
- while ((opt = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
- switch (opt)
- {
- case 'h':
- usage (stdout, 0);
- break;
-
- case 'i':
- 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)
- usage (stderr, 1);
- lopt = 1;
- break;
-
- case 'n':
- 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)
- usage (stderr, 1);
- uopt = 1;
- break;
-
- case 'v':
- print_version ();
- exit (0);
- break;
-
- case 'x':
- 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 ((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)
- usage (stderr, 1);
- Sopt = 1;
- break;
-
- default:
- usage (stderr, 1);
- }
- if (Larg >= 0 || xarg >= 0 || narg >= 0 || iarg >= 0)
- {
- if (optind < argc)
- usage (stderr, 1);
- return SetModals (xarg, narg, iarg, Larg);
- }
-
- strcpy (user, optind >= argc ? getlogin () : argv[optind]);
-
- li = GetPW (getlogin (), 0);
- if (! li)
- return 1;
-
- ui = GetPW (user, 1);
- if (! ui)
- return 1;
-
- if (lopt || uopt || Sopt)
- {
- if (li->usri3_priv != USER_PRIV_ADMIN)
- return eprint (0, "You have no maintenance privileges.");
- if (lopt)
- {
- if (ui->usri3_priv == USER_PRIV_ADMIN)
- return eprint (0, "Locking an admin account is disallowed.");
- ui->usri3_flags |= UF_ACCOUNTDISABLE;
- }
- if (uopt)
- ui->usri3_flags &= ~UF_ACCOUNTDISABLE;
- if (lopt || uopt)
- {
- ret = NetUserSetInfo (NULL, ui->usri3_name, 3, (LPBYTE) ui, NULL);
- return EvalRet (ret, NULL);
- }
- // Sopt
- PrintPW (ui);
- return 0;
- }
-
- if (li->usri3_priv != USER_PRIV_ADMIN && strcmp (getlogin (), user))
- 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 (li->usri3_priv != USER_PRIV_ADMIN)
- {
- strcpy (oldpwd, getpass ("Old password: "));
- if (ChangePW (user, oldpwd, oldpwd, 1))
- 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))
- 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 c72cefc29..000000000
--- a/winsup/utils/path.cc
+++ /dev/null
@@ -1,350 +0,0 @@
-/* path.cc
-
- Copyright 2001 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. If the format or location of the mount table
- changes, this is the file to change to match it. */
-
-#include <windows.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <cygwin/version.h>
-#include <sys/mount.h>
-#include <mntent.h>
-
-/* Used when treating / and \ as equivalent. */
-#define SLASH_P(ch) \
- ({ \
- char __c = (ch); \
- ((__c) == '/' || (__c) == '\\'); \
- })
-
-
-static struct mnt
- {
- const char *native;
- char *posix;
- unsigned flags;
- int issys;
- } mount_table[255];
-
-struct mnt *root_here = NULL;
-
-static char *
-find2 (HKEY rkey, unsigned *flags, char *what)
-{
- char *retval = 0;
- DWORD retvallen = 0;
- DWORD type;
- HKEY key;
-
- if (RegOpenKeyEx (rkey, what, 0, KEY_READ, &key) != ERROR_SUCCESS)
- return 0;
-
- if (RegQueryValueEx (key, "native", 0, &type, 0, &retvallen)
- == ERROR_SUCCESS)
- {
- retval = (char *) malloc (MAX_PATH + 1);
- if (RegQueryValueEx (key, "native", 0, &type, (BYTE *) retval, &retvallen)
- != ERROR_SUCCESS)
- {
- free (retval);
- retval = 0;
- }
- }
-
- retvallen = sizeof (flags);
- RegQueryValueEx (key, "flags", 0, &type, (BYTE *)flags, &retvallen);
-
- RegCloseKey (key);
-
- return retval;
-}
-
-static LONG
-get_cygdrive0 (HKEY key, const char *what, void *val, DWORD len)
-{
- LONG status = RegQueryValueEx (key, what, 0, 0, (BYTE *)val, &len);
- return status;
-}
-
-static mnt *
-get_cygdrive (HKEY key, mnt *m, int issystem)
-{
-
- if (get_cygdrive0 (key, CYGWIN_INFO_CYGDRIVE_FLAGS, &m->flags,
- sizeof (m->flags)) != ERROR_SUCCESS) {
- free (m->posix);
- return m;
- }
- get_cygdrive0 (key, CYGWIN_INFO_CYGDRIVE_PREFIX, m->posix, MAX_PATH);
- m->native = strdup (".");
- return m + 1;
-}
-
-static void
-read_mounts ()
-{
- DWORD posix_path_size;
- int res;
- struct mnt *m = mount_table;
- DWORD disposition;
- char buf[10000];
-
- root_here = NULL;
- for (mnt *m1 = mount_table; m1->posix; m1++)
- {
- free (m1->posix);
- if (m1->native)
- free ((char *) m1->native);
- m1->posix = NULL;
- }
-
- /* Loop through subkeys */
- /* FIXME: we would like to not check MAX_MOUNTS but the heap in the
- shared area is currently statically allocated so we can't have an
- arbitrarily large number of mounts. */
- for (int issystem = 0; issystem <= 1; issystem++)
- {
- sprintf (buf, "Software\\%s\\%s\\%s",
- CYGWIN_INFO_CYGNUS_REGISTRY_NAME,
- CYGWIN_INFO_CYGWIN_REGISTRY_NAME,
- CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME);
-
- HKEY key = issystem ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
- if (RegCreateKeyEx (key, buf, 0, (LPTSTR) "Cygwin", 0, KEY_READ,
- 0, &key, &disposition) != ERROR_SUCCESS)
- break;
- for (int i = 0; ;i++, m++)
- {
- m->posix = (char *) malloc (MAX_PATH + 1);
- posix_path_size = MAX_PATH;
- /* FIXME: if maximum posix_path_size is 256, we're going to
- run into problems if we ever try to store a mount point that's
- over 256 but is under MAX_PATH. */
- res = RegEnumKeyEx (key, i, m->posix, &posix_path_size, NULL,
- NULL, NULL, NULL);
-
- if (res == ERROR_NO_MORE_ITEMS)
- {
- m = get_cygdrive (key, m, issystem);
- m->posix = NULL;
- break;
- }
-
- if (!*m->posix)
- goto no_go;
- else if (res != ERROR_SUCCESS)
- break;
- else
- {
- m->native = find2 (key, &m->flags, m->posix);
- m->issys = issystem;
- if (!m->native)
- goto no_go;
- }
- continue;
- no_go:
- free (m->posix);
- m->posix = NULL;
- m--;
- }
- RegCloseKey (key);
- }
-}
-
-/* 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 && SLASH_P (path1[len1 - 1]))
- len1--;
-
- if (len1 == 0)
- return SLASH_P (path2[0]) && !SLASH_P (path2[1]);
-
- if (strncasecmp (path1, path2, len1) != 0)
- return 0;
-
- return SLASH_P (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 = SLASH_P (*s) && SLASH_P (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;
- for (p = rv; *p; p++)
- if (*p == '\\')
- *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 (*p == '/' || *p == '\\')
- {
- if (p == rv && unc)
- 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);
-}
-
-char *
-cygpath (const char *s, ...)
-{
- va_list v;
- int max_len = -1;
- struct mnt *m, *match = NULL;
-
- if (!mount_table[0].posix)
- read_mounts ();
- va_start (v, s);
- char *path = vconcat (s, v);
- if (strncmp (path, "./", 2) == 0)
- memmove (path, path + 2, strlen (path + 2) + 1);
- if (strncmp (path, "/./", 3) == 0)
- memmove (path + 1, path + 3, strlen (path + 3) + 1);
-
- for (m = mount_table; m->posix ; m++)
- {
- if (m->flags & MOUNT_CYGDRIVE)
- continue;
-
- int n = strlen (m->posix);
- if (n < max_len || !path_prefix_p (m->posix, path, n))
- 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
- native = concat (match->native, "/", path + max_len, NULL);
- free (path);
-
- return native;
-}
-
-static mnt *m = NULL;
-
-extern "C" FILE *
-setmntent (const char *, const char *)
-{
- m = mount_table;
- if (!m->posix)
- 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 (1024);
- if (!mnt.mnt_opts)
- mnt.mnt_opts = (char *) malloc (1024);
- if (!m->issys)
- strcpy (mnt.mnt_type, (char *) "user");
- else
- strcpy (mnt.mnt_type, (char *) "system");
- if (!(m->flags & MOUNT_BINARY))
- strcpy (mnt.mnt_opts, (char *) "textmode");
- else
- strcpy (mnt.mnt_opts, (char *) "binmode");
- if (m->flags & MOUNT_CYGWIN_EXEC)
- strcat (mnt.mnt_opts, (char *) ",cygexec");
- else if (m->flags & MOUNT_EXEC)
- strcat (mnt.mnt_opts, (char *) ",exec");
- if ((m->flags & MOUNT_CYGDRIVE)) /* cygdrive */
- strcat (mnt.mnt_opts, (char *) ",cygdrive");
- mnt.mnt_freq = 1;
- mnt.mnt_passno = 1;
- m++;
- return &mnt;
-}
diff --git a/winsup/utils/path.h b/winsup/utils/path.h
deleted file mode 100644
index 0512a55dd..000000000
--- a/winsup/utils/path.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/* path.h
-
- Copyright 2001 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. */
-
-char * cygpath (const char *s, ...);
diff --git a/winsup/utils/ps.cc b/winsup/utils/ps.cc
deleted file mode 100644
index 6866ccb62..000000000
--- a/winsup/utils/ps.cc
+++ /dev/null
@@ -1,405 +0,0 @@
-/* ps.cc
-
- Copyright 1996, 1997, 1998, 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. */
-
-#include <stdio.h>
-#include <windows.h>
-#include <time.h>
-#include <getopt.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <pwd.h>
-#include <sys/cygwin.h>
-#include <tlhelp32.h>
-#include <psapi.h>
-
-static const char version[] = "$Revision$";
-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' },
- {"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[] = "aefhlsu:vW";
-
-typedef BOOL (WINAPI *ENUMPROCESSMODULES)(
- HANDLE hProcess, // handle to the process
- HMODULE * lphModule, // array to receive the module handles
- DWORD cb, // size of the array
- LPDWORD lpcbNeeded // receives the number of bytes returned
-);
-
-typedef DWORD (WINAPI *GETMODULEFILENAME)(
- HANDLE hProcess,
- HMODULE hModule,
- LPTSTR lpstrFileName,
- DWORD nSize
-);
-
-typedef HANDLE (WINAPI *CREATESNAPSHOT)(
- DWORD dwFlags,
- DWORD th32ProcessID
-);
-
-// Win95 functions
-typedef BOOL (WINAPI *PROCESSWALK)(
- HANDLE hSnapshot,
- LPPROCESSENTRY32 lppe
-);
-
-ENUMPROCESSMODULES myEnumProcessModules;
-GETMODULEFILENAME myGetModuleFileNameEx;
-CREATESNAPSHOT myCreateToolhelp32Snapshot;
-PROCESSWALK myProcess32First;
-PROCESSWALK myProcess32Next;
-
-static BOOL WINAPI dummyprocessmodules (
- HANDLE hProcess, // handle to the process
- HMODULE * lphModule, // array to receive the module handles
- DWORD cb, // size of the array
- LPDWORD lpcbNeeded // receives the number of bytes returned
-)
-{
- lphModule[0] = (HMODULE) *lpcbNeeded;
- *lpcbNeeded = 1;
- return 1;
-}
-
-static DWORD WINAPI GetModuleFileNameEx95 (
- HANDLE hProcess,
- HMODULE hModule,
- LPTSTR lpstrFileName,
- DWORD n
-)
-{
- HANDLE h;
- DWORD pid = (DWORD) hModule;
-
- h = myCreateToolhelp32Snapshot (TH32CS_SNAPPROCESS, 0);
- if (!h)
- return 0;
-
- PROCESSENTRY32 proc;
- proc.dwSize = sizeof (proc);
- if (myProcess32First(h, &proc))
- do
- if (proc.th32ProcessID == pid)
- {
- CloseHandle (h);
- strcpy (lpstrFileName, proc.szExeFile);
- return 1;
- }
- while (myProcess32Next (h, &proc));
- CloseHandle (h);
- return 0;
-}
-
-int
-init_win ()
-{
- OSVERSIONINFO os_version_info;
-
- memset (&os_version_info, 0, sizeof os_version_info);
- os_version_info.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
- GetVersionEx (&os_version_info);
-
- HMODULE h;
- if (os_version_info.dwPlatformId == VER_PLATFORM_WIN32_NT)
- {
- h = LoadLibrary ("psapi.dll");
- if (!h)
- return 0;
- myEnumProcessModules = (ENUMPROCESSMODULES) GetProcAddress (h, "EnumProcessModules");
- myGetModuleFileNameEx = (GETMODULEFILENAME) GetProcAddress (h, "GetModuleFileNameExA");
- if (!myEnumProcessModules || !myGetModuleFileNameEx)
- return 0;
- return 1;
- }
-
- h = GetModuleHandle("KERNEL32.DLL");
- myCreateToolhelp32Snapshot = (CREATESNAPSHOT)GetProcAddress (h, "CreateToolhelp32Snapshot");
- myProcess32First = (PROCESSWALK)GetProcAddress (h, "Process32First");
- myProcess32Next = (PROCESSWALK)GetProcAddress (h, "Process32Next");
- if (!myCreateToolhelp32Snapshot || !myProcess32First || !myProcess32Next)
- return 0;
-
- myEnumProcessModules = dummyprocessmodules;
- myGetModuleFileNameEx = GetModuleFileNameEx95;
- return 1;
-}
-
-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[5];
- if (ntty < 0)
- return " ?";
- if (ntty == TTY_CONSOLE)
- return " con";
- sprintf (buf, "%4d", ntty);
- return buf;
-}
-
-static void
-usage (FILE * stream, int status)
-{
- fprintf (stream, "\
-Usage: %s [-aefls] [-u UID]\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\
- -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\
-With no options, %s outputs the long format by default\n",
- prog_name, prog_name);
- exit (status);
-}
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-%s (cygwin) %.*s\n\
-Process Statistics\n\
-Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.\n\
-Compiled on %s", prog_name, len, v, __DATE__);
-}
-
-int
-main (int argc, char *argv[])
-{
- external_pinfo *p;
- int aflag, lflag, fflag, sflag, uid;
- 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;
-
- aflag = lflag = fflag = sflag = 0;
- uid = getuid ();
- lflag = 1;
-
- prog_name = strrchr (argv[0], '/');
- if (prog_name == NULL)
- prog_name = strrchr (argv[0], '\\');
- if (prog_name == NULL)
- prog_name = argv[0];
- else
- prog_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 '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:
- usage (stderr, 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 && !init_win ())
- query = CW_GETPINFO;
-
- for (int pid = 0;
- (p = (external_pinfo *) cygwin_internal (query, pid | CW_NEXTPID));
- pid = p->pid)
- {
- if (!aflag)
- if (p->version >= EXTERNAL_PINFO_VERSION_32_BIT)
- {
- if (p->uid32 != (__uid32_t) 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';
-
- char pname[MAX_PATH];
- if (p->process_state & (PID_ZOMBIE | PID_EXITED))
- strcpy (pname, "<defunct>");
- else if (p->ppid)
- {
- char *s;
- pname[0] = '\0';
- cygwin_conv_to_posix_path (p->progname, pname);
- s = strchr (pname, '\0') - 4;
- if (s > pname && strcasecmp (s, ".exe") == 0)
- *s = '\0';
- }
- else if (query == CW_GETPINFO_FULL)
- {
- HANDLE h = OpenProcess (PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
- FALSE, p->dwProcessId);
- if (!h)
- continue;
- HMODULE hm[1000];
- DWORD n = p->dwProcessId;
- if (!myEnumProcessModules (h, hm, sizeof (hm), &n))
- n = 0;
- if (!n || !myGetModuleFileNameEx (h, hm[0], pname, MAX_PATH))
- 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);
-
- }
- (void) cygwin_internal (CW_UNLOCK_PINFO);
-
- return 0;
-}
-
diff --git a/winsup/utils/regtool.cc b/winsup/utils/regtool.cc
deleted file mode 100644
index ffaab6a7b..000000000
--- a/winsup/utils/regtool.cc
+++ /dev/null
@@ -1,682 +0,0 @@
-/* regtool.cc
-
- Copyright 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. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <getopt.h>
-#include <windows.h>
-
-enum
-{
- KT_AUTO, KT_INT, KT_STRING, KT_EXPAND, KT_MULTI
-} key_type = KT_AUTO;
-
-#define LIST_KEYS 0x01
-#define LIST_VALS 0x02
-#define LIST_ALL (LIST_KEYS | LIST_VALS)
-
-static const char version[] = "$Revision$";
-static char *prog_name;
-
-static struct option longopts[] =
-{
- {"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'},
- {"postfix", no_argument, NULL, 'p'},
- {"quiet", no_argument, NULL, 'q'},
- {"string", no_argument, NULL, 's'},
- {"verbose", no_argument, NULL, 'v'},
- {"version", no_argument, NULL, 'V'},
- {NULL, 0, NULL, 0}
-};
-
-static char opts[] = "ehiklmpqsvV";
-
-int listwhat = 0;
-int postfix = 0;
-int verbose = 0;
-int quiet = 0;
-char **argv;
-
-HKEY key;
-char *value;
-
-static void
-usage (FILE *where = stderr)
-{
- fprintf (where, ""
- "Usage: %s [OPTION] (add | check | get | list | remove | unset) KEY\n"
- "\n"
- "", prog_name);
- if (where == stdout)
- fprintf (where, ""
- "Actions:\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"
- "\n");
- fprintf (where, ""
- "Options for 'list' Action:\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 'set' Action:\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"
- " -s, --string set type to REG_SZ\n"
- "\n"
- "Other Options:\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"
- " -V, --version output version information and exit\n"
- "\n");
- if (where == stdout)
- 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"
- "You can use forward slash ('/') as a separator instead of backslash, in\n"
- "that case backslash is treated as escape character\n"
- "");
- fprintf (where, ""
- "Example: %s get '\\user\\software\\Microsoft\\Clock\\iFormat'\n", prog_name);
- if (where == stderr)
- fprintf (where, "Try '%s --help' for more information.", prog_name);
- exit (where == stderr ? 1 : 0);
-}
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-%s (cygwin) %.*s\n\
-Registry Tool\n\
-Copyright 2000, 2001, 2002 Red Hat, Inc.\n\
-Compiled on %s", prog_name, len, v, __DATE__);
-}
-
-void
-Fail (DWORD rv)
-{
- char *buf;
- if (!quiet)
- {
- FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER
- | FORMAT_MESSAGE_FROM_SYSTEM,
- 0, rv, 0, (CHAR *) & buf, 0, 0);
- fprintf (stderr, "Error (%ld): %s\n", rv, buf);
- LocalFree (buf);
- }
- exit (1);
-}
-
-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)
-{
- HKEY base;
- int rv;
- char *n = argv[0], *e, *h, c;
- char* host = NULL;
- int i;
- 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 != '\\')
- e--;
- if (*e != '\\')
- {
- key = wkprefixes[i].key;
- value = n;
- return;
- }
- else
- {
- *e = 0;
- value = e + 1;
- }
- }
- 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
- {
- rv = RegOpenKeyEx (base, n, 0, access, &key);
- if (rv != ERROR_SUCCESS)
- Fail (rv);
- }
- //printf("key `%s' value `%s'\n", n, value);
-}
-
-
-int
-cmd_list ()
-{
- DWORD num_subkeys, maxsubkeylen, num_values, maxvalnamelen, maxvaluelen;
- DWORD maxclasslen;
- char *subkey_name, *value_name, *class_name;
- unsigned char *value_data, *vd;
- DWORD i, j, m, n, t;
- int v;
-
- find_key (1, KEY_READ);
- RegQueryInfoKey (key, 0, 0, 0, &num_subkeys, &maxsubkeylen, &maxclasslen,
- &num_values, &maxvalnamelen, &maxvaluelen, 0, 0);
-
- subkey_name = (char *) malloc (maxsubkeylen + 1);
- class_name = (char *) malloc (maxclasslen + 1);
- value_name = (char *) malloc (maxvalnamelen + 1);
- 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;
- n = maxclasslen + 1;
- RegEnumKeyEx (key, i, subkey_name, &m, 0, class_name, &n, 0);
- printf ("%s%s", subkey_name, (postfix || verbose) ? "\\" : "");
-
- if (verbose)
- printf (" (%s)", class_name);
-
- puts ("");
- }
-
- if (listwhat & LIST_VALS)
- for (i = 0; i < num_values; i++)
- {
- m = maxvalnamelen + 1;
- n = maxvaluelen + 1;
- RegEnumValue (key, i, value_name, &m, 0, &t, (BYTE *) value_data, &n);
- if (!verbose)
- printf ("%s\n", value_name);
- else
- {
- printf ("%s = ", value_name);
- switch (t)
- {
- case REG_BINARY:
- for (j = 0; j < 8 && j < n; j++)
- printf ("%02x ", value_data[j]);
- printf ("\n");
- break;
- case REG_DWORD:
- printf ("0x%08lx (%lu)\n", *(DWORD *) value_data,
- *(DWORD *) 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_EXPAND_SZ:
- case REG_SZ:
- printf ("\"%s\"\n", value_data);
- break;
- case REG_MULTI_SZ:
- vd = value_data;
- while (vd && *vd)
- {
- printf ("\"%s\"", vd);
- vd = vd + strlen ((const char *) vd) + 1;
- if (*vd)
- printf (", ");
- }
- printf ("\n");
- break;
- default:
- printf ("? (type %d)\n", (int) t);
- }
- }
- }
- return 0;
-}
-
-int
-cmd_add ()
-{
- find_key (2, KEY_ALL_ACCESS);
- HKEY newkey;
- DWORD newtype;
- int rv = RegCreateKeyEx (key, value, 0, (char *) "", REG_OPTION_NON_VOLATILE,
- KEY_ALL_ACCESS, 0, &newkey, &newtype);
- if (rv != ERROR_SUCCESS)
- Fail (rv);
-
- if (verbose)
- {
- if (newtype == REG_OPENED_EXISTING_KEY)
- printf ("Key %s already exists\n", value);
- else
- printf ("Key %s created\n", value);
- }
- return 0;
-}
-
-int
-cmd_remove ()
-{
- find_key (2, KEY_ALL_ACCESS);
- DWORD rv = RegDeleteKey (key, value);
- if (rv != ERROR_SUCCESS)
- Fail (rv);
- if (verbose)
- printf ("subkey %s 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;
- DWORD v, rv;
- char *a = argv[1], *data;
- find_key (2, KEY_ALL_ACCESS);
-
- if (key_type == KT_AUTO)
- {
- char *e;
- strtoul (a, &e, 0);
- if (a[0] == '%')
- key_type = KT_EXPAND;
- else if (a[0] && !*e)
- key_type = KT_INT;
- else if (argv[2])
- key_type = KT_MULTI;
- else
- key_type = KT_STRING;
- }
-
- switch (key_type)
- {
- case KT_INT:
- v = strtoul (a, 0, 0);
- rv = RegSetValueEx (key, value, 0, REG_DWORD, (const BYTE *) &v,
- sizeof (v));
- break;
- case KT_STRING:
- rv = RegSetValueEx (key, value, 0, REG_SZ, (const BYTE *) a, strlen (a));
- break;
- case KT_EXPAND:
- rv = RegSetValueEx (key, value, 0, REG_EXPAND_SZ, (const BYTE *) a,
- strlen (a));
- break;
- case KT_MULTI:
- for (i = 1, n = 1; argv[i]; i++)
- n += strlen (argv[i]) + 1;
- data = (char *) malloc (n);
- for (i = 1, n = 0; argv[i]; i++)
- {
- strcpy (data + n, argv[i]);
- n += strlen (argv[i]) + 1;
- }
- data[n] = 0;
- rv = RegSetValueEx (key, value, 0, REG_MULTI_SZ, (const BYTE *) data,
- n + 1);
- break;
- case KT_AUTO:
- rv = ERROR_SUCCESS;
- break;
- default:
- rv = ERROR_INVALID_CATEGORY;
- break;
- }
-
- if (rv != ERROR_SUCCESS)
- Fail (rv);
-
- return 0;
-}
-
-int
-cmd_unset ()
-{
- find_key (2, KEY_ALL_ACCESS);
- DWORD rv = RegDeleteValue (key, value);
- if (rv != ERROR_SUCCESS)
- Fail (rv);
- if (verbose)
- printf ("value %s deleted\n", value);
- return 0;
-}
-
-int
-cmd_get ()
-{
- find_key (2, KEY_READ);
- DWORD vtype, dsize, rv;
- char *data, *vd;
- rv = RegQueryValueEx (key, value, 0, &vtype, 0, &dsize);
- if (rv != ERROR_SUCCESS)
- Fail (rv);
- dsize++;
- data = (char *) malloc (dsize);
- rv = RegQueryValueEx (key, value, 0, &vtype, (BYTE *) data, &dsize);
- if (rv != ERROR_SUCCESS)
- Fail (rv);
- switch (vtype)
- {
- case REG_BINARY:
- fwrite (data, dsize, 0, stdout);
- break;
- case REG_DWORD:
- printf ("%lu\n", *(DWORD *) data);
- break;
- case REG_SZ:
- printf ("%s\n", data);
- break;
- case REG_EXPAND_SZ:
- if (key_type == KT_EXPAND) // hack
- {
- char *buf;
- DWORD bufsize;
- bufsize = ExpandEnvironmentStrings (data, 0, 0);
- buf = (char *) malloc (bufsize + 1);
- ExpandEnvironmentStrings (data, buf, bufsize + 1);
- data = buf;
- }
- printf ("%s\n", data);
- break;
- case REG_MULTI_SZ:
- vd = data;
- while (vd && *vd)
- {
- printf ("%s\n", vd);
- vd = vd + strlen ((const char *) vd) + 1;
- }
- break;
- }
- return 0;
-}
-
-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},
- {0, 0}
-};
-
-int
-main (int argc, char **_argv)
-{
- int g;
-
- prog_name = strrchr (_argv[0], '/');
- if (prog_name == NULL)
- prog_name = strrchr (_argv[0], '\\');
- if (prog_name == NULL)
- prog_name = _argv[0];
- else
- prog_name++;
-
- while ((g = getopt_long (argc, _argv, opts, longopts, NULL)) != EOF)
- switch (g)
- {
- case 'e':
- key_type = KT_EXPAND;
- break;
- case 'k':
- listwhat |= LIST_KEYS;
- break;
- case 'h':
- usage (stdout);
- case 'i':
- key_type = KT_INT;
- break;
- case 'l':
- listwhat |= LIST_VALS;
- break;
- case 'm':
- key_type = KT_MULTI;
- break;
- case 'p':
- postfix++;
- break;
- case 'q':
- quiet++;
- break;
- case 's':
- key_type = KT_STRING;
- break;
- case 'v':
- verbose++;
- break;
- case 'V':
- print_version ();
- exit (0);
- default :
- usage ();
- }
-
- 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 5b55f5dff..000000000
--- a/winsup/utils/setfacl.c
+++ /dev/null
@@ -1,568 +0,0 @@
-/* setfacl.c
-
- Copyright 2000, 2001 Red Hat Inc.
-
- Written by Corinna Vinschen <vinschen@redhat.com>
-
-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 <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <pwd.h>
-#include <grp.h>
-#include <sys/types.h>
-#include <sys/acl.h>
-
-#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 const char version[] = "$Revision$";
-static char *prog_name;
-
-typedef enum {
- NoAction,
- Set,
- Modify,
- Delete,
- ModNDel,
- SetFromFile
-} action_t;
-
-mode_t getperm (char *in)
-{
- if (isdigit (*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_IRUSR | S_IRGRP | S_IROTH : 0)
- | (in[1] == 'w' ? S_IWUSR | S_IWGRP | S_IWOTH : 0)
- | (in[2] == 'x' ? S_IXUSR | S_IXGRP | S_IXOTH : 0);
-}
-
-BOOL
-getaclentry (action_t action, char *c, aclent_t *ace)
-{
- char *c2;
-
- ace->a_type = 0;
- ace->a_id = 0;
- ace->a_perm = 0;
-
- if (!strncmp (c, "default:", 8)
- || !strncmp (c, "d:", 2))
- {
- ace->a_type = ACL_DEFAULT;
- c = strchr (c, ':') + 1;
- }
- if (!strncmp (c, "user:", 5)
- || !strncmp (c, "u:", 2))
- {
- ace->a_type |= USER_OBJ;
- c = strchr (c, ':') + 1;
- }
- else if (!strncmp (c, "group:", 6)
- || !strncmp (c, "g:", 2))
- {
- ace->a_type |= GROUP_OBJ;
- c = strchr (c, ':') + 1;
- }
- else if (!strncmp (c, "mask:", 5)
- || !strncmp (c, "m:", 2))
- {
- ace->a_type |= CLASS_OBJ;
- c = strchr (c, ':') + 1;
- }
- else if (!strncmp (c, "other:", 6)
- || !strncmp (c, "o:", 2))
- {
- ace->a_type |= OTHER_OBJ;
- c = strchr (c, ':') + 1;
- }
- else
- return FALSE;
- if (ace->a_type & (USER_OBJ | GROUP_OBJ))
- {
- if ((c2 = strchr (c, ':')))
- {
- if (action == Delete)
- return FALSE;
- *c2 = '\0';
- }
- else if (action != Delete)
- return FALSE;
- if (c2 == c)
- {
- if (action == Delete)
- return FALSE;
- }
- else if (isdigit (*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 (c2 != c)
- {
- 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;
- }
- }
- if (c2)
- c = c2 + 1;
- }
- else if (*c++ != ':')
- return FALSE;
- if (action == Delete)
- {
- if ((ace->a_type & (CLASS_OBJ | OTHER_OBJ))
- && *c)
- return FALSE;
- ace->a_perm = ILLEGAL_MODE;
- return TRUE;
- }
- 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;
-}
-
-void
-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;
- }
- 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);
-}
-
-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", prog_name);
- }
- else
- fprintf(stream, "Try `%s --help' for more information.", 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}
-};
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-setfacl (cygwin) %.*s\n\
-ACL Modification Utility\n\
-Copyright 2000, 2001, 2002 Red Hat, Inc.\n\
-Compiled on %s", len, v, __DATE__);
-}
-
-int
-main (int argc, char **argv)
-{
- extern char *optarg;
- extern int optind;
- int c;
- action_t action = NoAction;
- int ropt = 0;
- aclent_t acls[MAX_ACL_ENTRIES];
- int aclidx = 0;
-
- prog_name = strrchr (argv[0], '/');
- if (prog_name == NULL)
- prog_name = strrchr (argv[0], '\\');
- if (prog_name == NULL)
- prog_name = argv[0];
- else
- prog_name++;
-
- memset (acls, 0, sizeof acls);
- while ((c = getopt_long (argc, argv, "d:f:hm:rs:v", 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;
- }
- break;
- 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:
- usage (stderr);
- 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)
- setfacl (action, argv[c], acls, aclidx);
- return 0;
-}
diff --git a/winsup/utils/ssp.c b/winsup/utils/ssp.c
deleted file mode 100644
index 17195777d..000000000
--- a/winsup/utils/ssp.c
+++ /dev/null
@@ -1,948 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, 2002 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 <dj@redhat.com>
- *
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <time.h>
-#include <ctype.h>
-#include <windows.h>
-#include <getopt.h>
-
-static const char version[] = "$Revision$";
-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;
-
-int low_pc=0, high_pc=0;
-unsigned int 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
-int active_thread_ids[MAXTHREADS];
-HANDLE active_threads[MAXTHREADS];
-int thread_step_flags[MAXTHREADS];
-int 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; i++)
- {
- if (pending_breakpoints[i].address == address)
- return;
- if (pending_breakpoints[i].address == 0)
- break;
- }
- if (i == MAXPENDS)
- return;
- pending_breakpoints[i].address = address;
- ReadProcessMemory (hProcess,
- (void *)address,
- &(pending_breakpoints[i].real_byte),
- 1, &rv);
-
- WriteProcessMemory (hProcess,
- (void *)address,
- (LPVOID)int3, 1, &rv);
- if (i >= num_breakpoints)
- num_breakpoints = i+1;
-}
-
-static int
-remove_breakpoint (unsigned int address)
-{
- int i;
- DWORD rv;
- for (i=0; i<num_breakpoints; i++)
- {
- if (pending_breakpoints[i].address == address)
- {
- pending_breakpoints[i].address = 0;
- WriteProcessMemory (hProcess,
- (void *)address,
- &(pending_breakpoints[i].real_byte),
- 1, &rv);
- return 1;
- }
- }
- return 0;
-}
-
-static HANDLE
-lookup_thread_id (int threadId, int *tix)
-{
- int i;
- for (i=0; i<num_active_threads; i++)
- if (active_thread_ids[i] == threadId)
- {
- if (tix) *tix = i;
- return active_threads[i];
- }
- return 0;
-}
-
-static void
-set_step_threads (int threadId, int trace)
-{
- int rv, tix;
- HANDLE thread = lookup_thread_id (threadId, &tix);
-
- rv = GetThreadContext (thread, &context);
- if (rv != -1)
- {
- thread_step_flags[tix] = trace;
- if (trace)
- context.EFlags |= 0x100; /* TRAP (single step) flag */
- else
- context.EFlags &= ~0x100; /* TRAP (single step) flag */
- SetThreadContext (thread, &context);
- }
-}
-
-static void
-set_steps ()
-{
- int i, s;
- for (i=0; i<num_active_threads; i++)
- {
- GetThreadContext (active_threads[i], &context);
- s = context.EFlags & 0x0100;
- if (!s && thread_step_flags[i])
- {
- set_step_threads (active_thread_ids[i], 1);
- }
- }
-}
-
-static int
-dll_sort (const void *va, const void *vb)
-{
- DllInfo *a = (DllInfo *)va;
- DllInfo *b = (DllInfo *)vb;
- if (a->base_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<num_active_threads; src++)
- {
- int sc = SuspendThread (active_threads[src]);
- int rv = GetThreadContext (active_threads[src], &context);
- ResumeThread (active_threads[src]);
- printf (" [%x,%x,%x]",
- active_threads[src], context.Eip, active_thread_ids[src]);
- }
- printf ("\n");
-#endif
-
- switch (event.dwDebugEventCode)
- {
-
- case CREATE_PROCESS_DEBUG_EVENT:
- break;
-
- case CREATE_THREAD_DEBUG_EVENT:
- if (verbose)
- printf ("create thread %08lx at %08x %s\n",
- event.dwThreadId,
- (int)event.u.CreateThread.lpStartAddress,
- addr2dllname ((unsigned int)event.u.CreateThread.lpStartAddress));
-
- active_thread_ids[num_active_threads] = event.dwThreadId;
- active_threads[num_active_threads] = event.u.CreateThread.hThread;
- thread_return_address[num_active_threads] = 0;
- num_active_threads++;
-
- if (trace_all_threads && stepping_enabled)
- {
- thread_step_flags[num_active_threads-1] = stepping_enabled;
- add_breakpoint ((int)event.u.CreateThread.lpStartAddress);
- }
-
- break;
-
- case EXIT_THREAD_DEBUG_EVENT:
- if (verbose)
- printf ("exit thread %08lx, code=%ld\n",
- event.dwThreadId,
- event.u.ExitThread.dwExitCode);
-
- for (src=0, dest=0; src<num_active_threads; src++)
- if (active_thread_ids[src] != event.dwThreadId)
- {
- active_thread_ids[dest] = active_thread_ids[src];
- active_threads[dest] = active_threads[src];
- dest++;
- }
- num_active_threads = dest;
- break;
-
- case EXCEPTION_DEBUG_EVENT:
- rv = GetThreadContext (hThread, &context);
- switch (event.u.Exception.ExceptionRecord.ExceptionCode)
- {
- case STATUS_BREAKPOINT:
- if (remove_breakpoint ((int)event.u.Exception.ExceptionRecord.ExceptionAddress))
- {
- context.Eip --;
- if (rv != -1)
- SetThreadContext (hThread, &context);
- if (ReadProcessMemory (hProcess, (void *)context.Esp, &rv, 4, &rv))
- thread_return_address[tix] = rv;
- }
- set_step_threads (event.dwThreadId, stepping_enabled);
- case STATUS_SINGLE_STEP:
- opcode_count++;
- pc = (unsigned int)event.u.Exception.ExceptionRecord.ExceptionAddress;
- sp = (unsigned int)context.Esp;
- if (tracing_enabled)
- fprintf (tracefile, "%08x %08lx\n", pc, event.dwThreadId);
- if (trace_console)
- {
- printf ("%d %08x\n", tix, pc);
- fflush (stdout);
- }
-
- if (dll_counts)
- {
- int i;
- for (i=num_dlls-1; i>=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 != -1)
- {
- 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 (*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<high_pc; pc+=2)
- {
- count += hits[(pc - low_pc)/2];
- }
- printf ("total cycles: %d, counted cycles: %d\n", total_cycles, count);
-
- if (tracing_enabled)
- fclose (tracefile);
-
-}
-
-static void
-usage (FILE * stream)
-{
- fprintf (stream , ""
- "Usage: %s [options] low_pc high_pc command...\n"
- " -c, --console-trace trace every EIP value to the console. *Lots* slower.\n"
- " -d, --disable disable single-stepping by default; use\n"
- " OutputDebugString (\"ssp on\") to enable stepping\n"
- " -e, --enable enable single-stepping by default; use\n"
- " OutputDebugString (\"ssp off\") to disable stepping\n"
- " -h, --help output usage information and exit\n"
- " -l, --dll enable dll profiling. A chart of relative DLL usage\n"
- " is produced after the run.\n"
- " -s, --sub-threads trace sub-threads too. Dangerous if you have\n"
- " race conditions.\n"
- " -t, --trace-eip trace every EIP value to a file TRACE.SSP. This\n"
- " gets big *fast*.\n"
- " -v, --verbose output verbose messages about debug events.\n"
- " -V, --version output version information and exit\n"
- "\n"
- "Example: %s 0x401000 0x403000 hello.exe\n"
- "\n"
- "", prog_name, prog_name);
- if (stream == stdout)
- fprintf (stream , ""
- "SSP - The Single Step Profiler\n"
- "\n"
- "Original Author: DJ Delorie <dj@redhat.com>\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 <windows.h>\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"
- "I usually 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.", prog_name);
- exit (stream == stderr ? 1 : 0);
-}
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-%s (cygwin) %.*s\n\
-Single-Step Profiler\n\
-Copyright 2000, 2001, 2002 Red Hat, Inc.\n\
-Compiled on %s", prog_name, len, v, __DATE__);
-}
-
-int
-main (int argc, char **argv)
-{
- int c, i;
- int total_pcount, total_scount;
- FILE *gmon;
-
- setbuf (stdout, 0);
-
- prog_name = strrchr (argv[0], '/');
- if (prog_name == NULL)
- prog_name = strrchr (argv[0], '\\');
- if (prog_name == NULL)
- prog_name = argv[0];
- else
- prog_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:
- usage (stderr);
- }
-
- 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<num_dlls; i++)
- {
- total_pcount += dll_info[i].pcount;
- total_scount += dll_info[i].scount;
- }
-
- if (total_pcount == 0) total_pcount++;
- if (total_scount == 0) total_scount++;
-
- for (i=0; i<num_dlls; i++)
- if (dll_info[i].pcount || dll_info[i].scount)
- {
- printf ("%7d %3d%% %7d %3d%% %08x %s\n",
- dll_info[i].pcount,
- (dll_info[i].pcount*100)/opcode_count,
- dll_info[i].scount,
- (dll_info[i].scount*100)/opcode_count,
- dll_info[i].base_address,
- dll_info[i].name);
- }
- }
-
- exit (0);
-}
-
diff --git a/winsup/utils/ssp.txt b/winsup/utils/ssp.txt
deleted file mode 100644
index e73880e90..000000000
--- a/winsup/utils/ssp.txt
+++ /dev/null
@@ -1,125 +0,0 @@
-
-SSP - The Single Step Profiler
-
-Original Author: DJ Delorie <dj@redhat.com>
-
-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.
-
- 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 69a7fa807..000000000
--- a/winsup/utils/strace.cc
+++ /dev/null
@@ -1,1007 +0,0 @@
-/* strace.cc
-
- Copyright 2000, 2001, 2002 Red Hat Inc.
-
- Written by Chris Faylor <cgf@redhat.com>
-
-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 <stdio.h>
-#include <fcntl.h>
-#include <getopt.h>
-#include <stdarg.h>
-#include <string.h>
-#include <stdlib.h>
-#include <time.h>
-#include <windows.h>
-#include <signal.h>
-#include <errno.h>
-#include "cygwin/include/sys/strace.h"
-#include "cygwin/include/sys/cygwin.h"
-#undef cygwin_internal
-
-/* GCC runtime library's C++ EH code unfortunately pulls in stdio, and we
- get undefine references to __impure_ptr, and hence the following
- hack. It should be reasonably safe however as long as this file
- is built using -mno-cygwin as is intended. */
-int _impure_ptr;
-
-/* we *know* we're being built with GCC */
-#define alloca __builtin_alloca
-
-// Version string.
-static const char version[] = "$Revision$";
-
-static const char *pgm;
-static int forkdebug = 1;
-static int numerror = 1;
-static int usecs = 1;
-static int delta = 1;
-static int hhmmss = 0;
-static int bufsize = 0;
-static int new_window = 0;
-static long flush_period = 0;
-
-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;
-
-#define PROCFLAGS \
- PROCESS_ALL_ACCESS /*(PROCESS_DUP_HANDLE | PROCESS_TERMINATE | PROCESS_VM_READ | PROCESS_VM_WRITE) */
-static void
-add_child (DWORD id, HANDLE hproc)
-{
- 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;
-}
-
-static child_list *
-get_child (DWORD id)
-{
- child_list *c;
- for (c = &children; (c = c->next) != NULL;)
- if (c->id == id)
- return c;
-
- error (0, "no process id %d found", 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);
- 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;
-}
-
-DWORD (*cygwin_internal) (int, ...);
-
-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;
- }
- if (!(cygwin_internal = (DWORD (*) (int, ...)) GetProcAddress (h, "cygwin_internal")))
- {
- errno = ENOSYS;
- return 0;
- }
- return 1;
-}
-
-static void
-attach_process (pid_t pid)
-{
- load_cygwin ();
- 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 (!DebugActiveProcess (child_pid))
- error (0, "couldn't attach to pid %d<%d> for debugging", pid, child_pid);
-
- printf ("Attached to pid %d (windows pid %u)\n", pid, (unsigned) child_pid);
- return;
-}
-
-
-static void
-create_child (char **argv)
-{
- linebuf one_line;
-
- STARTUPINFO si;
- PROCESS_INFORMATION pi;
- BOOL ret;
- DWORD flags;
-
- 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);
- ret = CreateProcess (0, one_line.buf, /* command line */
- NULL, /* Security */
- NULL, /* thread */
- TRUE, /* inherit handles */
- flags, /* start flags */
- NULL, 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];
- DWORD nbytes;
- child_list *child = get_child (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)
- len = 17;
- }
-
- char *buf;
- buf = (char *) alloca (len + 65) + 10;
-
- 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, " ");
-
- unsigned n = strtoul (s, NULL, 16);
-
- s = strchr (s, '\0') + 1;
-
- if (special == _STRACE_INTERFACE_ACTIVATE_ADDR)
- {
- DWORD new_flag = 1;
- if (!WriteProcessMemory (hchild, (LPVOID) n, &new_flag,
- sizeof (new_flag), &nbytes))
- error (0,
- "couldn't write strace flag to subprocess, windows error %d",
- 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 = s;
- usecs = dusecs;
- }
-
- 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++;
- }
- }
- }
- }
-
- 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);
- }
-
- child->last_usecs = usecs;
- if (numerror || !output_winerror (ofile, s))
- fputs (s, ofile);
- if (!bufsize)
- fflush (ofile);
-}
-
-static void
-proc_child (unsigned mask, FILE *ofile, pid_t pid)
-{
- DEBUG_EVENT ev;
- int processes = 0;
- 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);
- processes++;
- 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:
- remove_child (ev.dwProcessId);
- break;
- case EXCEPTION_DEBUG_EVENT:
- if (ev.u.Exception.ExceptionRecord.ExceptionCode !=
- STATUS_BREAKPOINT)
- {
- status = DBG_EXCEPTION_NOT_HANDLED;
-#if 0
- fprintf (stderr, "exception %p at %p\n",
- ev.u.Exception.ExceptionRecord.ExceptionCode,
- ev.u.Exception.ExceptionRecord.ExceptionAddress);
-#endif
- }
- break;
- }
- if (!ContinueDebugEvent (ev.dwProcessId, ev.dwThreadId, status))
- error (0, "couldn't continue debug event, windows error %d",
- GetLastError ());
- if (ev.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT && --processes == 0)
- break;
- }
-}
-
-static void
-dotoggle (pid_t pid)
-{
- load_cygwin ();
- 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 void
-dostrace (unsigned mask, FILE *ofile, pid_t pid, char **argv)
-{
- if (!pid)
- create_child (argv);
- else
- attach_process (pid);
- proc_child (mask, ofile, pid);
-
- return;
-}
-
-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"},
- {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-<something>", 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] <command-line>\n\
-Usage: %s [OPTIONS] -p <pid>\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\
- -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 <pid>\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 0x00001 (_STRACE_ALL) All strace messages.\n\
- flush 0x00002 (_STRACE_FLUSH) Flush output buffer after each message.\n\
- inherit 0x00004 (_STRACE_INHERIT) Children inherit mask from parent.\n\
- uhoh 0x00008 (_STRACE_UHOH) Unusual or weird phenomenon.\n\
- syscall 0x00010 (_STRACE_SYSCALL) System calls.\n\
- startup 0x00020 (_STRACE_STARTUP) argc/envp printout at startup.\n\
- debug 0x00040 (_STRACE_DEBUG) Info to help debugging. \n\
- paranoid 0x00080 (_STRACE_PARANOID) Paranoid info.\n\
- termios 0x00100 (_STRACE_TERMIOS) Info for debugging termios stuff.\n\
- select 0x00200 (_STRACE_SELECT) Info on ugly select internals.\n\
- wm 0x00400 (_STRACE_WM) Trace Windows msgs (enable _strace_wm).\n\
- sigp 0x00800 (_STRACE_SIGP) Trace signal and process handling.\n\
- minimal 0x01000 (_STRACE_MINIMAL) Very minimal strace output.\n\
- exitdump 0x04000 (_STRACE_EXITDUMP) Dump strace cache on exit.\n\
- system 0x08000 (_STRACE_SYSTEM) Serious error; goes to console and log.\n\
- nomutex 0x10000 (_STRACE_NOMUTEX) Don't use mutex for synchronization.\n\
- malloc 0x20000 (_STRACE_MALLOC) Trace malloc calls.\n\
- thread 0x40000 (_STRACE_THREAD) Thread-locking calls.\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'},
- {"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'},
- {"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:dhfm:no:p:S:tTuvw";
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-%s (cygwin) %.*s\n\
-System Trace\n\
-Copyright 2000, 2001, 2002 Red Hat, Inc.\n\
-Compiled on %s", pgm, len, v, __DATE__);
-}
-
-int
-main (int argc, char **argv)
-{
- unsigned mask = 0;
- FILE *ofile = NULL;
- pid_t pid = 0;
- int opt;
- int toggle = 0;
-
- 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 '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 (optarg, "w")) == NULL)
- error (1, "can't open %s", optarg);
-#ifdef F_SETFD
- (void) fcntl (fileno (ofile), F_SETFD, 0);
-#endif
- break;
- case 'p':
- pid = strtol (optarg, NULL, 10);
- break;
- case 'S':
- flush_period = strtol (optarg, NULL, 10);
- break;
- case 't':
- hhmmss ^= 1;
- break;
- case 'T':
- toggle ^= 1;
- break;
- case 'u':
- // FIXME: currently unimplemented
- usecs ^= 1;
- break;
- case 'v':
- // Print version info and exit
- print_version ();
- return 0;
- case 'w':
- new_window ^= 1;
- break;
- case '?':
- 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 (!mask)
- mask = 1;
-
- if (bufsize)
- setvbuf (ofile, (char *) alloca (bufsize), _IOFBF, bufsize);
-
- if (!ofile)
- ofile = stdout;
-
- if (toggle)
- dotoggle (pid);
- else
- dostrace (mask, ofile, pid, argv + optind);
-}
-
-#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/umount.cc b/winsup/utils/umount.cc
deleted file mode 100644
index afcee5ee7..000000000
--- a/winsup/utils/umount.cc
+++ /dev/null
@@ -1,251 +0,0 @@
-/* umount.cc
-
- Copyright 1996, 1998, 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. */
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/mount.h>
-#include <mntent.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <getopt.h>
-
-static void remove_all_mounts ();
-static void remove_all_user_mounts ();
-static void remove_all_system_mounts ();
-static void remove_cygdrive_prefix (int flags);
-
-static const char version[] = "$Revision$";
-static const char *progname;
-
-struct option longopts[] =
-{
- {"help", no_argument, NULL, 'h' },
- {"remove-all-mounts", no_argument, NULL, 'A'},
- {"remove-cygdrive-prefix", no_argument, NULL, 'c'},
- {"remove-system-mounts", no_argument, NULL, 'S'},
- {"remove-user-mounts", no_argument, NULL, 'U'},
- {"system", no_argument, NULL, 's'},
- {"user", no_argument, NULL, 'u'},
- {"version", no_argument, NULL, 'v'},
- {NULL, 0, NULL, 0}
-};
-
-char opts[] = "AchsSuUv";
-
-static void
-usage (FILE *where = stderr)
-{
- fprintf (where, "\
-Usage: %s [OPTION] [<posixpath>]\n\
- -A, --remove-all-mounts remove all mounts\n\
- -c, --remove-cygdrive-prefix remove cygdrive prefix\n\
- -h, --help output usage information and exit\n\
- -s, --system remove system mount (default)\n\
- -S, --remove-system-mounts remove all system mounts\n\
- -u, --user remove user mount\n\
- -U, --remove-user-mounts remove all user mounts\n\
- -v, --version output version information and exit\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 ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-%s (cygwin) %.*s\n\
-Filesystem Utility\n\
-Copyright 1996, 1998, 1999, 2000, 2001, 2002\n\
-Compiled on %s", progname, len, v, __DATE__);
-}
-
-int
-main (int argc, char **argv)
-{
- int i;
- int flags = 0;
- int default_flag = MOUNT_SYSTEM;
- enum do_what
- {
- nada,
- saw_remove_all_mounts,
- saw_remove_cygdrive_prefix,
- saw_remove_all_system_mounts,
- saw_remove_all_user_mounts
- } do_what = nada;
-
- progname = strrchr (argv[0], '/');
- if (progname == NULL)
- progname = strrchr (argv[0], '\\');
- if (progname == NULL)
- progname = argv[0];
- else
- progname++;
-
- if (argc == 1)
- usage ();
-
- while ((i = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
- switch (i)
- {
- case 'A':
- if (do_what != nada)
- usage ();
- do_what = saw_remove_all_mounts;
- break;
- case 'c':
- if (do_what != nada)
- usage ();
- do_what = saw_remove_cygdrive_prefix;
- break;
- case 'h':
- usage (stdout);
- case 's':
- flags |= MOUNT_SYSTEM;
- break;
- case 'S':
- if (do_what != nada)
- usage ();
- do_what = saw_remove_all_system_mounts;
- break;
- case 'u':
- flags &= ~MOUNT_SYSTEM;
- default_flag = 0;
- break;
- case 'U':
- if (do_what != nada)
- usage ();
- do_what = saw_remove_all_user_mounts;
- break;
- case 'v':
- print_version ();
- exit (0);
- default:
- usage ();
- }
-
- switch (do_what)
- {
- case saw_remove_all_mounts:
- if (optind != argc)
- usage ();
- remove_all_mounts ();
- break;
- case saw_remove_cygdrive_prefix:
- if (optind != argc)
- usage ();
- remove_cygdrive_prefix (flags | default_flag);
- break;
- case saw_remove_all_system_mounts:
- if (optind != argc)
- usage ();
- remove_all_system_mounts ();
- break;
- 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_mounts: Unmount all mounts. */
-static void
-remove_all_mounts ()
-{
- remove_all_user_mounts ();
- remove_all_system_mounts ();
-}
-
-/* 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);
-}
-
-/* remove_all_system_mounts: Unmount all system mounts. */
-static void
-remove_all_system_mounts ()
-{
- FILE *m = setmntent ("/-not-used-", "r");
- struct mntent *p;
-
- while ((p = getmntent (m)) != NULL)
- {
- /* Remove the mount if it's a system mount. */
- if (strncmp (p->mnt_type, "system", 6) == 0 &&
- strstr (p->mnt_opts, "noumount") == NULL)
- {
- if (cygwin_umount (p->mnt_dir, MOUNT_SYSTEM))
- error (p->mnt_dir);
-
- /* We've modified the table so we need to start over. */
- endmntent (m);
- m = setmntent ("/-not-used-", "r");
- }
- }
-
- endmntent (m);
-}
-
-/* remove_cygdrive_prefix: Remove cygdrive user or system path prefix. */
-static void
-remove_cygdrive_prefix (int flags)
-{
- int res = cygwin_umount (NULL, flags | MOUNT_CYGDRIVE);
- if (res)
- error ("remove_cygdrive_prefix");
- exit (0);
-}
diff --git a/winsup/utils/utils.sgml b/winsup/utils/utils.sgml
deleted file mode 100644
index e371619a7..000000000
--- a/winsup/utils/utils.sgml
+++ /dev/null
@@ -1,815 +0,0 @@
-<sect1 id="using-utils"><title>Cygwin Utilities</title>
-
-<para>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.</para>
-
-<sect2 id="cygcheck"><title>cygcheck</title>
-
-<screen>
-Usage: cygcheck [-s] [-v] [-r] [-h] [program ...]
- -c check current package setup
- -h give help about the info
- -s system information
- -v verbose output (indented) (for -s or programs)
- -r registry search (requires -s)
- -V version info
-You must at least give either -s or a program name
-</screen>
-
-<para>The <command>cygcheck</command> program is a diagnostic utility
-that examines your system and reports the information that is
-significant to the proper operation of Cygwin programs. It can give
-information about a specific program (or program) you are trying to
-run, general system information, or both. If you list one or more
-programs on the command line, it will diagnose the runtime environment
-of that program or programs. If you specify the <literal>-s</literal>
-option, it will give general system information. If you specify
-<literal>-s</literal> and list one or more programs on the command line,
-it reports on both.</para>
-
-<para>The <literal>-c</literal> option causes the "program" arguments
-to be interpreted as package names. <command>cygcheck</command> will
-report the current version of the package that you specify. With no
-arguments, <command>cygcheck</command> will report on all packages.</para>
-
-<para>The <command>cygcheck</command> program should be used to send
-information about your system to Cygnus for troubleshooting (if your
-support representative requests it). When asked to run this command,
-include all the options plus any commands you are having trouble with,
-and save the output so that you can mail it to Cygnus, like
-this:</para>
-
-<screen>
-<prompt>C:\Cygnus&gt;</prompt> <userinput>cygcheck -s -v -r -h &gt; tocygnus.txt</userinput>
-</screen>
-
-<para>The <literal>-v</literal> 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. </para>
-
-<para>The <literal>-r</literal> option causes
-<command>cygcheck</command> to search your registry for information
-that is relevent to Cygnus programs. These registry entries are the
-ones that have "Cygnus" 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 for Cygnus to diagnose your
-problems.</para>
-
-<para>The <literal>-h</literal> 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.</para>
-
-</sect2>
-
-<sect2 id="cygpath"><title>cygpath</title>
-
-<screen>
-Usage: cygpath [-p|--path] (-w|--windows) ([-s|--short-name]|[-l|--long-name]) filename
-Usage: cygpath [-p|--path] (-u|--unix) filename
-Usage: cygpath (-H|--homeroot)|(-S|--sysdir)|(-W|--windir) [-s|--short-name]
-Usage: cygpath [-A|--allusers] (-D|--desktop)|(-P|--smprograms) [-s|--short-name]
- -a|--absolute output absolute path
- -c|--close handle close handle (for use in captured process)
- -f|--file file read file for input path information
- -i|--ignore ignore missing argument
- -l|--long-name print Windows long form of filename
- -p|--path filename argument is a path
- -s|--short-name print Windows short form of filename
- -u|--unix print Unix form of filename
- -t|--type print Windows form of filename with specified
- dos drive letter with backslashes (c:\winnt)
- mixed drive letter with regular slashes (c:/winnt)
- -v|--version output version information and exit
- -w|--windows print Windows form of filename
- -A|--allusers use `All Users' instead of current user for -D, -P
- -H|--homeroot output `Profiles' directory (home root) and exit
- -D|--desktop output `Desktop' 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
-</screen>
-
-<para>The <command>cygpath</command> program is a utility that
-converts Windows native filenames to Cygwin POSIX-style pathnames and
-back. 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. You may use the long or short option names
-interchangeably, even though only the short ones are described
-here.</para>
-
-<para>The <literal>-u</literal> and <literal>-w</literal> options
-indicate whether you want a conversion from Windows to UNIX (POSIX)
-format (<literal>-u</literal>) or a conversion from UNIX (POSIX) to
-Windows format (<literal>-w</literal>). You must give exactly
-one of these. To give neither or both is an error. Use the
-<literal>-l</literal> or <literal>-s</literal> option in combination
-with the <literal>-w</literal> option to convert to Windows long or
-short form.</para>
-
-<para>Caveat: The <literal>-l</literal> option does not work if the
-<em>check_case</em> parameter of <em>CYGWIN</em> is set to <em>strict</em>,
-since Cygwin is not able to match any Windows short path in this mode.
-</para>
-
-<para>The <literal>-p</literal> 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 <literal>-p</literal> you are
-instructing <command>cygpath</command> to convert between these
-formats.</para>
-
-<para>The <literal>-i</literal> 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 to a proper format that may be
-omitted.</para>
-
-<example><title>Example cygpath usage</title>
-<screen>
-#!/bin/sh
-for i in `echo *.exe | sed 's/\.exe/.cc/'`
-do
- notepad "`cygpath -w $i`"
-done
-</screen>
-</example>
-
-<para>The capital options
-<literal>-D</literal>, <literal>-H</literal>, <literal>-P</literal>,
-<literal>-S</literal>, and <literal>-W</literal> output directories used
-by Windows that are not the same on all systems, for example
-<literal>-S</literal> might output C:\WINNT\SYSTEM32 or C:\WINDOWS\SYSTEM.
-The <literal>-A</literal> option forces use of the "All Users" directories
-instead of the current user for the <literal>-D</literal> and
-<literal>-P</literal> options. The <literal>-H</literal> shows the Windows'
-profiles directory that can be used as root of home.
-On Win9x systems with only a single user, <literal>-A</literal> has no
-effect; <literal>-D</literal> and <literal>-AD</literal> would have the
-same output.
-The <literal>-ws</literal> options can be combined with the capital options.
-
-</sect2>
-
-<sect2 id="kill"><title>kill</title>
-
-<screen>
-Usage: kill [-f] [-sigN] [-s sigN] pid1 [pid2 ...]
-Usage: kill -l [signal]
-Usage: Kill -h
-</screen>
-
-<para>The <command>kill</command> 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.</para>
-
-<para>Note that, unless you specific the <literal>-f</literal> option,
-the "pid" values are the Cygwin pids, not the Windows pids. To get a
-list of running programs and their Cygwin pids, use the Cygwin
-<command>ps</command> program. <command>ps -W</command> will display
-<emphasis>all</emphasis> windows pids.</para>
-
-<para>The <command>kill -l</command> option prints the name of the
-given signal, or a list of all signal names if no signal is given.</para>
-
-<para><command>kill -h</command> just displays the kill usage message.</para>
-
-<para>To send a specific signal, use the <literal>-signN</literal>
-option, either with a signal number or a signal name (minus the "SIG"
-part), like these examples:</para>
-
-<example><title>Using the kill command</title>
-<screen>
-<prompt>$</prompt> <userinput>kill 123</userinput>
-<prompt>$</prompt> <userinput>kill -1 123</userinput>
-<prompt>$</prompt> <userinput>kill -HUP 123</userinput>
-<prompt>$</prompt> <userinput>kill -f 123</userinput>
-</screen>
-</example>
-
-<para>Here is a list of available signals, their numbers, and some
-commentary on them, from the file
-<literal>&lt;sys/signal.h&gt;</literal>, which should be considered
-the official source of this information.</para>
-
-<screen>
-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-&gt;t_local&amp;LTOSTOP)
-SIGIO 23 input/output possible signal
-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)
-SIGUSR1 30 user defined signal 1
-SIGUSR2 31 user defined signal 2
-</screen>
-
-</sect2>
-
-<sect2 id="mkgroup"><title>mkgroup</title>
-
-<screen>
-usage: mkgroup [options] [domain]
- This program prints a /etc/group file to stdout
- Options:
- -l,--local print local group information
- -d,--domain print global group information from the domain
- specified (or from the current domain if there is
- no domain specified)
- -o,--id-offset offset change the default offset (10000) added to uids
- in domain accounts.
- -s,--no-sids don't print SIDs in pwd field
- (this affects ntsec)
- -u,--users print user list in gr_mem field
- -?,--help print this message
- One of `-l' or `-d' must be given on NT/W2K.
-</screen>
-
-<para>The <command>mkgroup</command> program can be used to help
-configure your Windows system to be more UNIX-like by creating an
-initial <filename>/etc/group</filename> substitute (some commands need this
-file) from your system information. It only works on NT.
-To initially set up your machine,
-you'd do something like this:</para>
-
-<example><title>Setting up the groups file</title>
-<screen>
-<prompt>$</prompt> <userinput>mkdir /etc</userinput>
-<prompt>$</prompt> <userinput>mkgroup -l &gt; /etc/group</userinput>
-</screen>
-</example>
-
-<para>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.</para>
-
-<para>The <literal>-d</literal> and <literal>-l</literal> options
-allow you to specify where the information comes from, either the
-local machine or the default (or given) domain.</para>
-
-</sect2>
-
-<sect2 id="mkpasswd"><title>mkpasswd</title>
-
-<screen>
-Usage: mkpasswd [options] [domain]
- Usage: mkpasswd [OPTION]... [domain]
- This program prints a /etc/passwd file to stdout
- Options:
- -l,--local print local user accounts
- -d,--domain print domain accounts (from current domain
- if no domain specified)
- -o,--id-offset offset change the default offset (10000) added to uids
- in domain accounts.
- -g,--local-groups print local group information too
- if no domain specified
- -m,--no-mount don't use mount points for home dir
- -s,--no-sids don't print SIDs in GCOS field
- (this affects ntsec)
- -p,--path-to-home path if user account has no home dir, use
- path instead of /home/
- -u,--username username only return information for the specified user
- -?,--help displays this message
- One of `-l', `-d' or `-g' must be given on NT/W2K.
-</screen>
-
-<para>The <command>mkpasswd</command> program can be used to help
-configure your Windows system to be more UNIX-like by creating an
-initial <filename>/etc/passwd</filename> substitute (some commands
-need this file) from your system information. It only works on NT.
-To initially set up your machine, you'd do something like this:</para>
-
-<example><title>Setting up the passwd file</title>
-<screen>
-<prompt>$</prompt> <userinput>mkdir /etc</userinput>
-<prompt>$</prompt> <userinput>mkpasswd -l &gt; /etc/passwd</userinput>
-</screen>
-</example>
-
-<para>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.</para>
-
-<para>The <literal>-d</literal> and <literal>-l</literal> options
-allow you to specify where the information comes from, either the
-local machine or the default (or given) domain.</para>
-
-</sect2>
-
-<sect2 id="passwd"><title>passwd</title>
-
-<screen>
-Usage passwd [name]
- passwd [-x max] [-n min] [-i inact] [-L len]
- passwd {-l|-u|-S} name
- -x max set max age of passwords
- -n min set min age of passwords
- -i inact disables account after inact days of expiry
- -L len set min password length
- -l lock an account
- -u unlock an account
- -S show account information
-</screen>
-
-<para> <command>passwd</command> changes passwords for user accounts.
-A normal user may only change the password for their own account,
-the administrators may change the password for any account.
-<command>passwd</command> also changes account information, such as
-password expiry dates and intervals.</para>
-
-<para>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.</para>
-
-<para>The user is then prompted for a replacement password.
-<command>passwd</command> will prompt again and compare the second entry
-against the first. Both entries are require to match in order for the
-password to be changed.</para>
-
-<para>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, <command>passwd</command> refuses to change the
-password and exits.</para>
-
-<para>Password expiry and length: The password aging information may be
-changed by the administrators with the <literal>-x</literal>,
-<literal>-n</literal> and <literal>-i</literal> options. The
-<literal>-x</literal> option is used to set the maximum number of days
-a password remains valid. After <emphasis>max</emphasis> days, the
-password is required to be changed. The <literal>-n</literal> 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
-<emphasis>min</emphasis> days have elapsed. The <literal>-i</literal>
-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 <emphasis>inact</emphasis> days, the user may no longer sign on to
-the account. Allowed values for the above options are 0 to 999. The
-<literal>-L</literal> option sets the minimum length of allowed passwords
-for users, which doesn't belong to the administrators group, to
-<emphasis>len</emphasis> 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'.</para>
-
-<para>Account maintenance: User accounts may be locked and unlocked with the
-<literal>-l</literal> and <literal>-u</literal> flags. The
-<literal>-l</literal> option disables an account. The <literal>-u</literal>
-option re-enables an account.</para>
-
-<para>The account status may be given with the <literal>-S</literal>
-option. The status information is self explanatory.</para>
-
-<para>Limitations: Users may not be able to change their password on
-some systems.</para>
-
-</sect2>
-
-<sect2 id="mount"><title>mount</title>
-
-<screen>
-Usage mount
- mount [options] &lt;win32path&gt; &lt;posixpath&gt;
-
- -b, --binary text files are equivalent to binary files
- (newline = \n)
- -c, --change-cygdrive-prefix change the cygdrive path prefix to &lt;posixpath&gt;
- -f, --force force mount, don't warn about missing mount
- point directories
- -i, --import-old-mounts copy old registry mount table mounts into the current
- mount areas
- -p, --show-cygdrive-prefix show user and/or system cygdrive path prefix
- -s, --system (default) add mount point to system-wide registry location
- -t, --text (default) text files get \r\n line endings
- -u, --user add mount point to user registry location
- -x, --executable treat all files under mount point as executables
- -X, --cygwin-executable treat all files under mount point as cygwin
- executables. Use to speed up file access.
- -E, --no-executable don't open files to see if they contain executable
- magic. Use to speed up file access.
- -m, --mount-commands write mount commands to replace user and
- system mount points and cygdrive prefixes
-
- When invoked without any arguments, mount displays the current mount table.
-</screen>
-
-<para>The <command>mount</command> 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. Please see
-<Xref Linkend="mount-table"> for more information on the concepts
-behind the Cygwin POSIX file system and strategies for using
-mounts.</para>
-
-<sect3><title>Using mount</title>
-
-<para>If you just type <command>mount</command> with no parameters, it
-will display the current mount table for you.</para>
-
-<example>
-<title>Displaying the current set of mount points</title>
-<screen>
-<prompt>c:\cygnus\&gt;</prompt> <userinput>mount</userinput>
-Device Directory Type Flags
-D: /d user textmode
-C: / system textmode
-</screen>
-</example>
-
-<para>In this example, the C
-drive is the POSIX root and D drive is mapped to
-<filename>/d</filename>. 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 <filename>/d</filename> mount is only visible
-to the current user.</para>
-
-<para>The <command>mount</command> utility is also the mechanism for
-adding new mounts to the mount table. The following example
-demonstrates how to mount the directory
-<filename>C:\cygnus\cygwin-b20\H-i586-cygwin32\bin</filename>
-to <filename>/bin</filename> and the network directory
-<filename>\\pollux\home\joe\data</filename> to <filename>/data</filename>.
-<filename>/bin</filename> is assumed to already exist.</para>
-
-<example>
-<title>Adding mount points</title>
-<screen>
-<prompt>c:\cygnus\&gt;</prompt> <userinput>ls /bin /data</userinput>
-ls: /data: No such file or directory
-<prompt>c:\cygnus\&gt;</prompt> <userinput>mount C:\cygnus\cygwin-b20\H-i586-cygwin32\bin /bin</userinput>
-<prompt>c:\cygnus\&gt;</prompt> <userinput>mount \\pollux\home\joe\data /data</userinput>
-Warning: /data does not exist!
-<prompt>c:\cygnus\&gt;</prompt> <userinput>mount</userinput>
-Device Directory Type Flags
-\\pollux\home\joe\data /data user textmode
-C:\cygnus\cygwin-b20\H-i586-cygwin32\bin /bin user textmode
-D: /d user textmode
-\\.\tape1: /dev/st1 user textmode
-\\.\tape0: /dev/st0 user textmode
-\\.\b: /dev/fd1 user textmode
-\\.\a: /dev/fd0 user textmode
-C: / system textmode
-<prompt>c:\cygnus\&gt;</prompt> <userinput>ls /bin/sh</userinput>
-/bin/sh
-</screen>
-</example>
-
-<para>Note that <command>mount</command> was invoked from the Windows
-command shell in the previous example. In many Unix shells, including
-bash, it is legal and convenient to use the forward "/" in Win32
-pathnames since the "\" is the shell's escape character. </para>
-
-<para>The "-s" flag to <command>mount</command> is used to add a mount
-in the system-wide mount table used by all Cygwin users on the system,
-instead of the user-specific one. System-wide mounts are displayed
-by <command>mount</command> as being of the "system" type, as is the
-case for the <filename>/</filename> partition in the last example.
-Under Windows NT, only those users with Administrator priviledges are
-permitted to modify the system-wide mount table.</para>
-
-<para>Note that a given POSIX path may only exist once in the user
-table and once in the global, system-wide table. Attempts to replace
-the mount will fail with a busy error. The "-f" (force) flag causes
-the old mount to be silently replaced with the new one. It will also
-silence warnings about the non-existence of directories at the Win32
-path location.</para>
-
-<para>The "-b" flag is used to instruct Cygwin to treat binary and
-text files in the same manner by default. Binary mode mounts are
-marked as "binmode" in the Flags column of <command>mount</command>
-output. By default, mounts are in text mode ("textmode" in the Flags
-column).</para>
-
-<para>The "-x" flag is used to instruct Cygwin that the mounted file
-is "executable". If the "-x" flag is used with a directory then
-all files in the directory are executable. Files ending in certain
-extensions (.exe, .com, .bat, .cmd) are assumed to be executable
-by default. Files whose first two characters begin with '#!' are
-also considered to be executable. This option allows other files
-to be marked as executable and avoids the overhead of opening each
-file to check for a '#!'.</para>
-
-</sect3>
-
-<sect3><title>Cygdrive mount points</title>
-
-<para>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:
-<filename>/cygdrive</filename>. For example, if Cygwin accesses
-<filename>Z:\foo</filename> and the Z drive is not currently in the
-mount table, then <filename>Z:\</filename> will be accessible as
-<filename>/cygdrive/Z</filename>. The default prefix of
-<filename>/cygdrive</filename> may be changed via the
-<Xref Linkend="mount"> command.</para>
-
-<para>The <command>mount</command> utility can be used to change this
-default automount prefix through the use of the
-"--change-cygdrive-prefix" flag. In the following example, we will
-set the automount prefix to <filename>/</filename>:</para>
-
-<example>
-<title>Changing the default prefix</title>
-<screen>
-<prompt>c:\cygnus\&gt;</prompt> <userinput>mount --change-cygdrive-prefix /</userinput>
-</screen>
-</example>
-
-<para>Note that you if you set a new prefix in this manner, you can
-specify the "-s" flag to make this the system-wide default prefix. By
-default, the cygdrive-prefix applies only to the current user. In the
-same way, you can specify the "-b" flag such that all new automounted
-filesystems default to binary mode file accesses.</para>
-
-</sect3>
-
-<sect3><title>Limitations</title>
-
-<para>Limitations: there is a hard-coded limit of 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.</para>
-
-<para>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.
-</para>
-
-<para>It is sometimes desirable to mount to a non-existent directory,
-for example to avoid cluttering the root directory with names
-such as
-<filename>a</filename>, <filename>b</filename>, <filename>c</filename>
-pointing to disks.
-Although <command>mount</command> 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
-<filename>/dir</filename>,
-say, and <filename>/dir/mtpt</filename> is a mount point, then
-<filename>mtpt</filename> will not show up in an <command>ls</command>
-or
-<command>echo *</command> command and <command>find .</command> will
-not
-find <filename>mtpt</filename>.
-</para>
-
-</sect3>
-
-</sect2>
-
-<sect2 id="ps"><title>ps</title>
-
-<screen>
-Usage ps [-aefl] [-u uid]
- -a, -e show processes of all users
- -f show process uids, ppids
- -l show process uids, ppids, pgids, winpids
- -s short process listing
- -u uid show processes owned by uid
- -W show all windows processes, not just cygwin processes
-</screen>
-
-<para>The <command>ps</command> 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 <command>kill</command> command. The WINPID
-column is the process ID that's displayed by NT's Task Manager
-program.</para>
-
-</sect2>
-
-<sect2 id="umount"><title>umount</title>
-
-<screen>
-Usage umount [options] &lt;posixpath&gt;
- -A, --remove-all-mounts remove all mounts
- -c, --remove-cygdrive-prefix remove cygdrive prefix
- -s, --system remove system mount (default)
- -S, --remove-system-mounts remove all system mounts
- -u, --user remove user mount
- -U, --remove-user-mounts remove all user mounts
-</screen>
-
-<para>The <command>umount</command> program removes mounts from the
-mount table. If you specify a POSIX path that corresponds to a
-current mount point, <command>umount</command> will remove it from the
-user-specific registry area. The -s flag may be used to specify
-removing the mount from the system-wide registry area instead
-(Administrator priviledges are required).</para>
-
-<para>The <command>umount</command> utility may also be used to remove
-all mounts of a particular type. With the extended options it is
-possible to remove all mounts, all automatically-mounted mounts, all
-mounts in the current user's registry area, or all mounts in the
-system-wide registry area (with Administrator privileges).</para>
-
-<para>See <Xref Linkend="mount">) for more information on the mount
-table.</para>
-</sect2>
-
-<sect2 id="strace"><title>strace</title>
-
-<screen>
-Usage: strace [OPTIONS] <command-line>
-Usage: strace [OPTIONS] -p <pid>
- -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
- -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>
- -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 0x00001 (_STRACE_ALL) All strace messages.
- flush 0x00002 (_STRACE_FLUSH) Flush output buffer after each message.
- inherit 0x00004 (_STRACE_INHERIT) Children inherit mask from parent.
- uhoh 0x00008 (_STRACE_UHOH) Unusual or weird phenomenon.
- syscall 0x00010 (_STRACE_SYSCALL) System calls.
- startup 0x00020 (_STRACE_STARTUP) argc/envp printout at startup.
- debug 0x00040 (_STRACE_DEBUG) Info to help debugging.
- paranoid 0x00080 (_STRACE_PARANOID) Paranoid info.
- termios 0x00100 (_STRACE_TERMIOS) Info for debugging termios stuff.
- select 0x00200 (_STRACE_SELECT) Info on ugly select internals.
- wm 0x00400 (_STRACE_WM) Trace Windows msgs (enable _strace_wm).
- sigp 0x00800 (_STRACE_SIGP) Trace signal and process handling.
- minimal 0x01000 (_STRACE_MINIMAL) Very minimal strace output.
- exitdump 0x04000 (_STRACE_EXITDUMP) Dump strace cache on exit.
- system 0x08000 (_STRACE_SYSTEM) Cache strace messages.
- nomutex 0x10000 (_STRACE_NOMUTEX) Don't use mutex for synchronization.
- malloc 0x20000 (_STRACE_MALLOC) Trace malloc calls.
- thread 0x40000 (_STRACE_THREAD) Thread-locking calls.
-</screen>
-
-<para>The <command>strace</command> program executes a program, and
-optionally the children of the program, reporting any Cygwin DLL output
-from the program(s) to file. This program is mainly useful for debugging
-the Cygwin DLL itself.</para>
-</sect2>
-
-<sect2 id="regtool"><title>regtool</title>
-
-<screen>
-Regtool Copyright (c) 2000 Red Hat Inc
- regtool -h - print this message
- regtool [-v|-p|-k|-l] list [key] - list subkeys and values
- -p=postfix, like ls -p, appends / postfix to key names
- -k=keys, lists only keys
- -l=values, lists only values
- regtool [-v] add [key\subkey] - add new subkey
- regtool [-v] remove [key] - remove key
- regtool [-v|-q] check [key] - exit 0 if key exists, 1 if not
- regtool [-i|-s|-e|-m] set [key\value] [data ...] - set value
- -i=integer -s=string -e=expand-string -m=multi-string
- regtool [-v] unset [key\value] - removes value from key
- regtool [-q] get [key\value] - prints value to stdout
- -q=quiet, no error msg, just return nonzero exit if key/value missing
- 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: \user\software\Microsoft\Clock\iFormat
-</screen>
-
-<para>The <command>regtool</command> 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.</para>
-
-<para>The <literal>-v</literal> option means "verbose". For most
-commands, this causes additional or lengthier messages to be printed.
-Conversely, the <literal>-q</literal> option supresses error messages,
-so you can use the exit status of the program to detect if a key
-exists or not (for example).</para>
-
-<para>The <literal>list</literal> command lists the subkeys and values
-belonging to the given key. The <literal>add</literal> command adds a
-new key. The <literal>remove</literal> command 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 <literal>check</literal> command checks to see
-if a key exists (the exit code of the program is zero if it does,
-nonzero if it does not).</para>
-
-<para>The <literal>set</literal> command sets a value within a key.
-<literal>-i</literal> means the value is an integer (DWORD).
-<literal>-s</literal> means the value is a string.
-<literal>-e</literal> means it's an expanding string (it contains
-embedded environment variables). <literal>-m</literal> means it's a
-multi-string (list). If you don't specify one of these, it tries to
-guess the type based on the value you give. If it looks like a
-number, it's a number. 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.</para>
-
-<para>The <literal>unset</literal> command removes a value from a key.
-The <literal>get</literal> command gets the value of a 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 <literal>-q</literal>, it doesn't
-print the message but does return the non-zero exit code.</para>
-
-</sect2>
-
-<sect2 id="dumper"><title>dumper</title>
-
-<screen>
-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
-</screen>
-
-<para>The <command>dumper</command> utility can be used to create
-core dump of running windows process. This core dump can be later loaded
-to gdb an analyzed. One common way to use <command>dumper</command> is to
-plug it into cygwin's Just-In-Time debugging facility by adding
-
-<screen>
-error_start=x:\path\to\dumper.exe
-</screen>
-
-to <em>CYGWIN</em> environment variable. Please note that
-<literal>x:\path\to\dumper.exe</literal> is win32-style and not cygwin
-path. If <literal>error_start</literal> is set this way, then dumper will
-be started whenever some program encounters fatal error.
-</para>
-
-<para>
-<command>dumper</command> can be also be started from command line to create
-core dump of any running process. Unfortunately, because of windows API
-limitation, when core dump is created and <command>dumper</command> exits,
-the target process is terminated too.
-</para>
-
-<para>
-To save the space in core dump, <command>dumper</command> 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,
-<command>dumper</command> saves paths to files which contain that data. When
-core dump is loaded into gdb, it uses these paths to load appropriate files.
-That means that if you create core dump on one machine and try to debug it on
-other, you'll need to place identical copies of executable and dlls in the same
-directories as on machine where core dump has been created.
-</para>
-
-</sect2>
-
-</sect1>
-