OSDN Git Service

6c5d202e3a12ae33312856cd1036392a3dd2268a
[pf3gnuchains/pf3gnuchains4x.git] / winsup / cygwin / ChangeLog
1 2004-05-07  Corinna Vinschen  <corinna@vinschen.de>
2
3         Revert code reversion from 2004-04-03.  So, revert to async I/O again.
4         * fhandler.h (status): Add "closed" flag.
5         (prepare): New method declaration.
6         (wait): Ditto.
7         (release): Ditto.
8         * fhandler_socket.cc: Don't include wsock_event.h.
9         (fhandler_socket::prepare): New method, moved from wsock_event.
10         (fhandler_socket::wait): Ditto.
11         (fhandler_socket::release): New method.
12         (fhandler_socket::recvfrom): Simplify loop.
13         (fhandler_socket::recvmsg): Ditto.
14         (fhandler_socket::sendto): Ditto.
15         (fhandler_socket::sendmsg): Ditto.
16         * net.cc: Don't include wsock_event.h.
17         (wsock_event::prepare): Remove.
18         (wsock_event::wait): Ditto.
19         * wsock_event.h: Remove.
20
21 2004-05-06  Christopher Faylor  <cgf@alum.bu.edu>
22
23         * thread.cc (pthread::create): Move postcreate call to avoid a
24         potential race.
25         (pthread::cancelable_wait): Don't allow signal interrupt unless main
26         thread.
27
28 2004-05-07  Pierre Humblet <pierre.humblet@ieee.org>
29             Christopher Faylor <cgf@timesys.com>
30
31         * path.cc (mount_info::conv_to_posix_path): Return proper status when
32         chrooted.
33
34 2004-05-06  Pierre Humblet <pierre.humblet@ieee.org>
35
36         * path.cc (path_conv::check): Strip trailing dots and spaces and
37         return error if the final component had only dots and spaces.
38         (normalize_posix_path): Revert 2004-04-30.
39         (chdir): Do not check for trailing spaces. Do not set native_dir 
40         to c:\ for virtual devices. Pass only native_dir to cwd.set.
41         (cwdstuff::set): Assume posix_cwd is already normalized.
42
43 2004-05-04  Christopher Faylor  <cgf@alum.bu.edu>
44
45         * path.cc (normalize_win32_path): Detect components with only dots.
46         Remove a final .  if it follows '\\'.
47         (mount_info::conv_to_win32_path): Only backslashify the path when no
48         mount is found.
49         (chdir): Do not look for components with only dots.
50
51 2004-05-04  Pierre Humblet <pierre.humblet@ieee.org>
52             Christopher Faylor  <cgf@alum.bu.edu>
53
54         * path.cc (is_unc_share): Remove redundant tests.
55
56 2004-05-04  Corinna Vinschen  <corinna@vinschen.de>
57
58         * crt0.o (mainCRTStartup): 16 byte align stack for main function.
59
60 2004-05-04  Corinna Vinschen  <corinna@vinschen.de>
61
62         * path.cc (check_sysfile): Don't scan string twice.
63
64 2004-05-03  Corinna Vinschen  <corinna@vinschen.de>
65
66         * dir.cc (writable_directory): Remove.
67         (mkdir): Remove call to writable_directory.
68         * syscalls.cc (unlink): Ditto.
69         (rename): Ditto.
70         * winsup.h (writable_directory): Remove declaration.
71
72 2004-04-30  Corinna Vinschen  <corinna@vinschen.de>
73
74         * fhandler.cc (fhandler_base::open): Call path_conv::get_nt_native_path
75         for evaluating NT path.
76         * path.cc (normalize_posix_path): Remove trailing dots and spaces.
77         (path_conv::get_nt_native_path): New function.
78         * path.h (class path_conv): Declare get_nt_native_path method.
79
80 2004-04-30  Corinna Vinschen  <corinna@vinschen.de>
81
82         * fhandler.cc (fhandler_base::open): Fix NT native path evaluation
83         to allow opening serial ports.
84
85 2004-04-30  DJ Delorie  <dj@redhat.com>
86
87         * init.cc (threadfunc_fe): Hack to make thread stacks always 16
88         byte aligned.
89
90 2004-04-21  Yitzchak Scott-Thoennes  <sthoenna@efn.org>
91
92         * syscalls.cc (lseek64): Fix debug_printf format string.
93         (truncate64): Ditto.
94
95 2004-04-21  Corinna Vinschen  <corinna@vinschen.de>
96
97         * fhandler.cc (fhandler_base::lseek): Force res to -1 on error.
98
99 2004-04-20  Christopher Faylor  <cgf@alum.bu.edu>
100
101         * path.cc (is_unc_share): Rename from slash_unc_prefix_p throughout.
102
103 2004-04-20  Pierre Humblet <pierre.humblet@ieee.org>
104
105         * path.cc (normalize_posix_path): Process all Posix paths and map three
106         or more initial slashes to a single one.  Simplify processing following
107         two initial slashes.
108         (normalize_win32_path): Make last argument non-optional and do not
109         check for NULL value.
110
111 2004-04-20  Pierre Humblet <pierre.humblet@ieee.org>
112
113         * fhandler_disk_file.cc (fhandler_base::open_fs): Change
114         set_file_attribute call to indicate that NT security isn't used.
115         (fhandler_disk_file::fchmod): Rearrange to isolate 9x related
116         statements.
117         Do not set FILE_ATTRIBUTE_SYSTEM.
118         (fhandler_disk_file::fchown): Check noop case first.
119         * fhandler.cc (fhandler_base::open9x): Remove ntsec related statements.
120         (fhandler_base::set_name): Do not set namehash.
121         * fhandler.h (fhandler_base::get_namehash): Compute and set namehash if
122         needed.
123         * syscalls.cc (access): Verify that fh is not NULL. Do not set PC_FULL.
124         (chmod): Ditto.
125         (chown_worker): Ditto.
126         (stat_worker): Ditto. Verify if the path exists.
127
128 2004-04-20  Corinna Vinschen  <corinna@vinschen.de>
129
130         * fhandler.cc (fhandler_base::open): Remove special DEV_FLOPPY_MAJOR
131         treatment.
132         * fhandler_raw.cc (fhandler_dev_raw::open): Simplify write-only case.
133         * fhandler_tape.cc (fhandler_dev_tape::raw_write): Add accidentally
134         dropped condition.
135
136 2004-04-20  Corinna Vinschen  <corinna@vinschen.de>
137
138         * fhandler.cc (fhandler_base::open): Add FILE_READ_ATTRIBUTES when
139         only GENERIC_WRITE access is requested.
140
141 2004-04-19  Corinna Vinschen  <corinna@vinschen.de>
142
143         * include/cygwin/mtio.h (GMT_ASYNC): New define.
144         (MT_ST_ASYNC_WRITES): Remove "Not supported" comment.
145
146 2004-04-19  Corinna Vinschen  <corinna@vinschen.de>
147
148         * errno.cc (errmap): Handle ERROR_IO_PENDING.
149         * fhandler.cc (fhandler_base::open): Make tape I/O asynchronous.
150         * fhandler.h (class fhandler_dev_tape): Add mt_evt member.
151         * fhandler_tape.cc (mtinfo_drive::initialize): Initialize async_writes.
152         (mtinfo_drive::close): Handle async writes.
153         (mtinfo_drive::read): Add mt_evt parameter.  Use overlapped I/O.
154         (mtinfo_drive::async_wait): New function.
155         (mtinfo_drive::write): Add mt_evt parameter.  Use overlapped I/O.
156         Handle async writes.
157         (mtinfo_drive::_set_pos): Handle async writes.
158         (mtinfo_drive::set_partition): Ditto.
159         (mtinfo_drive::prepare): Ditto.
160         (mtinfo_drive::get_status): Drop useless "else".  Handle async_writes
161         flag.
162         (mtinfo_drive::set_options): Handle async_writes flags.
163         (fhandler_dev_tape::close): Close mt_evt handle.
164         (fhandler_dev_tape::raw_read): Create mt_evt handle and use in call
165         to mtinfo_drive::read.
166         (fhandler_dev_tape::raw_write): Create mt_evt handle and use in call
167         to mtinfo_drive::write.
168         * mtinfo.h (MTINFO_VERSION): Bump.
169         (enum dirty_state): Add async_write_pending state.
170         (class mtinfo_drive): Add OVERLAPPED struct "ov".  Add async_writes
171         flag.
172         (mtinfo_drive::async_wait): Add declaration.
173         (mtinfo_drive::read): Add mt_evt parameter.
174         (mtinfo_drive::write): Ditto.
175
176         * registry.cc (load_registry_hive): Call enable_restore_privilege
177         instead of set_process_privilege.
178
179 2004-04-19  Corinna Vinschen  <corinna@vinschen.de>
180
181         * fhandler_tape.cc (mtinfo_drive::_set_pos): Take additional dont_wait
182         parameter.  Use in call to SetTapePosition.
183         (mtinfo_drive::set_pos): Accomodate _set_pos calls to above change.
184         (mtinfo_drive::set_partition): Ditto.
185         * mtinfo.h (mtinfo_drive::_set_pos): Change declaration accordingly.
186
187 2004-04-16  Corinna Vinschen  <corinna@vinschen.de>
188
189         * autoload.cc (NtCreateFile): Add.
190         * dir.cc (mkdir): Change set_file_attribute call to indicate that
191         NT security isn't used.
192         * fhandler.cc (fhandler_base::open_9x): New method, created from
193         fhandler_base::open.
194         (fhandler_base::open): Rearrange to use NtCreateFile instead of
195         CreateFile.
196         * fhandler.h (enum query_state): Redefine query_null_access to
197         query_stat_control.  query_null_access isn't allowed in NtCreateFile.
198         (fhandler_base::open_9x): Declare.
199         * fhandler_disk_file.cc (fhandler_base::fstat_fs): Use
200         query_stat_control first, query_read_control if that fails.
201         (fhandler_disk_file::fchmod): Call enable_restore_privilege before
202         trying to open for query_write_control.  Don't fall back to
203         opening for query_read_control.
204         (fhandler_disk_file::fchown): Ditto.
205         (fhandler_disk_file::facl):  Only request restore privilege and query
206         access necessary for given cmd.
207         * fhandler_raw.cc (fhandler_dev_raw::open): Call fhandler_base::open
208         instead of opening device here.
209         * ntdll.h (NtCreateFile): Declare.
210         * path.cc (symlink_worker): Change set_file_attribute call to indicate
211         that NT security isn't used.
212         * sec_acl.cc (getacl): Fix bracketing.
213         * sec_helper.cc (enable_restore_privilege): New function.
214         * security.cc (str2buf2uni_cat): New function.
215         (write_sd): Don't request restore permission here.
216         * security.h (set_process_privileges): Drop stale declaration.
217         (str2buf2uni): Declare.
218         (str2buf2uni_cat): Declare.
219         (enable_restore_privilege): Declare.
220         * syscalls.cc (fchown32): Return immediate success on 9x.
221
222 2004-04-15  Christopher Faylor  <cgf@alum.bu.edu>
223
224         * autoload.cc (dll_chain1): Rename to dll_chain.  Remove old dll_chain
225         code.
226         (wsock_init): Avoid unneeded winsock_active tests.
227         * winsup.h (winsock_active): Delete.
228
229 2004-04-15  Corinna Vinschen  <corinna@vinschen.de>
230
231         * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Try opening
232         in query_read mode if query_write fails.
233         * fhandler_disk_file.cc (fhandler_disk_file::fchown): Ditto.
234         * fhandler_disk_file.cc (fhandler_disk_file::facl): Ditto.
235
236 2004-04-14  Corinna Vinschen  <corinna@vinschen.de>
237
238         * ntdll.h: Fix copyright date.
239         * sec_acl.cc (acl_worker): Delete allocated fhandler.
240         * syscalls.cc (chown_worker): Ditto.
241         (chmod): Ditto.
242         (stat_worker): Use get_namehash instead of hash_path_name.
243
244 2004-04-14  Corinna Vinschen  <corinna@vinschen.de>
245
246         * sec_acl.cc (getacl): Avoid compiler warning.
247         * security.cc (write_sd): Ditto.  Fix error handling.
248
249 2004-04-14  Corinna Vinschen  <corinna@vinschen.de>
250
251         * syscalls.cc (fstat64): Use get_namehash instead of hash_path_name.
252
253 2004-04-14  Corinna Vinschen  <corinna@vinschen.de>
254
255         * fhandler.cc (fhandler_base::open): Simplify access evaluation
256         expression.
257         (fhandler_base::facl): New method.
258         * fhandler.h: Declare facl method in fhandler_base,
259         fhandler_disk_file and fhandler_virtual.
260         * fhandler_disk_file.cc (fhandler_disk_file::facl): New method.
261         * fhandler_virtual.cc (fhandler_virtual::facl): New method.
262         * sec_acl.cc: Remove forward declaration for aclsort32 and acl32.
263         (setacl): Remove static.  Add and use handle parameter.
264         (getacl): Ditto.
265         (acl_worker): Reorganize to call fhandler's facl method eventually.
266         (facl32): Ditto.
267         * security.cc (get_nt_object_security): Remove static.
268         * security.h: Add extern declarations for get_nt_object_security,
269         aclsort32, acl32, getacl and setacl.
270
271 2004-04-14  Corinna Vinschen  <corinna@vinschen.de>
272
273         * fhandler.cc (fhandler_base::open): Accomodate query_write_control
274         query_state.
275         (fhandler_base::fchown): New method.
276         * fhandler.h: Declare fchown method in fhandler_base,
277         fhandler_disk_file and fhandler_virtual.
278         (enum query_state): Add query_write_control.
279         * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Set query_state
280         to query_write_control.  Only remove FILE_ATTRIBUTE_READONLY if not
281         setting security descriptor.
282         (fhandler_disk_file::fchown): New method.
283         * fhandler_virtual.cc (fhandler_virtual::fchown): New method.
284         * sec_acl.cc (setacl): Call write_sd with additional handle attribute.
285         * security.cc (write_sd): Take handle argument.  Only request owner
286         if getting SE_RESTORE_NAME privilege failed.  Only open file if
287         NtSetSecurityObject failed or handle is NULL.
288         (set_nt_attribute): Call write_sd with additional handle attribute.
289         * security.h (write_sd): Declare with additional handle argument.
290         * syscalls.cc (chown_worker): Reorganize to call fhandler's fchown
291         method eventually.
292         (fchown): Ditto.
293
294 2004-04-14  Corinna Vinschen  <corinna@vinschen.de>
295
296         * autoload.cc (NtSetSecurityObject): Add.
297         * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Only request
298         READ_CONTROL rights when opening the file.
299         * ntdll.h (NtSetSecurityObject): Add declaration.
300         * security.cc (write_sd): Call NtSetSecurityObject instead of
301         BackupWrite.
302         (get_nt_object_security): Don't free security descriptor here.
303
304 2004-04-14  Corinna Vinschen  <corinna@vinschen.de>
305
306         * syscalls.cc (ttyname): Use buffer of length TTY_NAME_MAX + 1.
307         * sysconf.cc (sysconf): Handle _SC_TTY_NAME_MAX request.
308         * include/limits.h: Define TTY_NAME_MAX and _POSIX_TTY_NAME_MAX.
309
310 2004-04-14  Corinna Vinschen  <corinna@vinschen.de>
311
312         * cygwin.din: Export rand_r and ttyname_r.
313         * syscalls.cc (ttyname_r): New function.
314         (ttyname): Move functionality to ttyname_r.  Call it from here.
315         * include/cygwin/version.h: Bump API minor number.
316
317 2004-04-14  Pierre Humblet <pierre.humblet@ieee.org>
318
319         * path.h (path_conv::set_symlink): Add argument.
320         (path_conv::get_symlink_length): New method.
321         (path_conv::symlink_length): New member.
322         * path.cc (path_conv::check): Pass symlen to set_symlink.
323         * fhandler_disk_file.cc (fhandler_base::fstat_helper): For symlinks
324         set st_size from get_symlink_length.
325
326 2004-04-13  Corinna Vinschen  <corinna@vinschen.de>
327
328         * security.cc (set_nt_attribute): Only call get_nt_object_security
329         if handle is NULL.
330
331 2004-04-13  Corinna Vinschen  <corinna@vinschen.de>
332
333         * dir.cc (mkdir): Call set_file_attribute with additional handle
334         argument.
335         * fhandler.cc (fhandler_base::fchmod): New method.
336         * fhandler.h: Declare fchmod method in fhandler_base,
337         fhandler_disk_file and fhandler_virtual.
338         * fhandler_disk_file.cc (fhandler_disk_file::fchmod): New method.
339         (fhandler_base::open_fs): Call set_file_attribute with additional
340         handle argument.
341         * fhandler_virtual.cc (fhandler_virtual::fchmod): New method.
342         * path.cc (symlink_worker): Call set_file_attribute with additional
343         handle argument.
344         * security.cc (get_nt_object_security): New function.
345         (get_nt_object_attribute): Call get_nt_object_security.
346         (set_nt_attribute): Add handle argument.  Call get_nt_object_security
347         first, read_sd only if that fails.
348         (set_file_attribute): Add handle argument.
349         * security.h (set_file_attribute): Declare with additional handle
350         argument.
351         * syscalls.cc (stat_suffixes): Move to beginning of file.
352         (chown_worker): Call set_file_attribute with additional handle argument.
353         (chmod): Reorganize to call fhandler's fchmod method eventually.
354         (fchmod): Ditto.
355
356 2004-04-13  Corinna Vinschen  <corinna@vinschen.de>
357
358         * autoload.cc (NtQuerySecurityObject): Add.
359         * ntdll.h (STATUS_BUFFER_TOO_SMALL): Add definition.
360         (NtQuerySecurityObject): Add declaration.
361         * security.cc (get_nt_object_attribute): Always use
362         NtQuerySecurityObject to retrieve security descriptor.
363
364 2004-04-13  Gerd Spalink  <Gerd.Spalink@t-online.de>
365
366         * fhandler_dsp.cc (fhandler_dev_dsp::Audio_out::stop): Add optional
367         boolean argument so that playing can be stopped without playing
368         pending buffers.
369         (fhandler_dev_dsp::ioctl): Stop playback immediately for
370         SNDCTL_DSP_RESET.  Do not reset audio parameters in this case.
371         Add support for ioctl SNDCTL_DSP_GETISPACE.
372         (fhandler_dev_dsp::Audio_out::emptyblocks): Now returns the number of
373         completely empty blocks.
374         (fhandler_dev_dsp::Audio_out::buf_info): p->fragments is now the number
375         of completely empty blocks. This conforms with the OSS specification.
376         (fhandler_dev_dsp::Audio_out::parsewav): Ignore wave headers that are
377         not aligned on four byte boundary.
378         (fhandler_dev_dsp::Audio_in::buf_info): New, needed for
379         SNDCTL_DSP_GETISPACE.
380
381 2004-04-13  Corinna Vinschen  <corinna@vinschen.de>
382
383         * winsup.h (IMPLEMENT_STATUS_FLAG): New macro to define status flag
384         accessor methods unambiguously.
385         * fhandler.h: Use IMPLEMENT_STATUS_FLAG throughout where possible.
386         * fhandler_termios.cc (fhandler_termios::tcinit): Call corrected
387         accessor for initialized status flag.
388         * mtinfo.h (class mtinfo_drive): Use IMPLEMENT_STATUS_FLAG throughout.
389         * path.cc (fs_info::update): Remove duplicate call to flags().
390         * path.h (struct fs_info): Use IMPLEMENT_STATUS_FLAG where possible.
391         (path_conv::is_auto_device): Fix spacing.
392         * tty.h (class tty_min): Use IMPLEMENT_STATUS_FLAG throughout.
393
394 2004-04-12  Christopher Faylor  <cgf@alum.bu.edu>
395
396         * thread.cc (pthread::thread_init_wrapper): Wait later to get more
397         parallel behavior.
398
399 2004-04-12  Christopher Faylor  <cgf@alum.bu.edu>
400
401         * thread.cc (pthread::create): Use thread mutex to control
402         synchronization rather than creating a suspended thread.  Wait for
403         "cancellation event" to indicate that started thread has been properly
404         initialized.
405         (pthread::thread_init_wrapper): Use set_tls_self_pointer() to set tid
406         and cygtls.  Signal with cancel_event when done.
407
408 2004-04-12  Pierre Humblet <pierre.humblet@ieee.org>
409
410         * path.cc (path_conv::check): Fix "tail filling" logic.
411
412 2004-04-11  Christopher Faylor  <cgf@alum.bu.edu>
413
414         * cygheap.h: Replace inexplicably removed closing brace.
415
416 2004-04-11  Christopher Faylor  <cgf@alum.bu.edu>
417
418         * cygheap.h (CYGHEAP_SLOP): Reduce drastically to avoid collisions.
419
420 2004-04-11  Pierre Humblet <pierre.humblet@ieee.org>
421
422         * dtable.cc (dtable::extend): Change order of memcpy and cfree.
423
424 2004-04-10  Corinna Vinschen  <corinna@vinschen.de>
425
426         * syscalls.cc (sync): Define void according to SUSv3.
427
428 2004-04-10  Corinna Vinschen  <corinna@vinschen.de>
429
430         * sec_acl.cc (setacl): Use correct offset when trying to combine
431         standard and default entry of same type.
432
433 2004-04-10  Pierre Humblet <pierre.humblet@ieee.org>
434
435         * fhandler.cc (rootdir): Add and use second argument.
436         * winsup.h (rootdir): Add second argument in declaration.
437         * path.cc (fs_info::update): Modify call to rootdir.
438         * syscalls.cc (check_posix_perm): Ditto.
439         (statfs): Ditto. Move syscall_printf near top.
440
441 2004-04-10  Corinna Vinschen  <corinna@vinschen.de>
442
443         * Use new unified status_flag accessor methods from classes fhandler_*,
444         tty_min, mtinfo and fs_info thoroughout.
445         * fhandler.h: Redefine all set_close_on_exec methods to take a bool
446         argument.
447         (enum conn_state): Rename from connect_state.
448         (class fhandler_base): Rename some status flags to align with
449         accessor method names.  Drop encoded flag entirely.  Unify status
450         accessor methods.  Const'ify all read accessor methods.
451         (class fhandler_socket): Ditto.
452         (class fhandler_dev_raw): Ditto.
453         * fhandler_disk_file.cc (fhandler_base::fstat_fs): Use fs.fs_is_fat()
454         instead of evaluating FATness of file system here.
455         (fhandler_disk_file::opendir): Drop call to set_encoded().
456         (fhandler_disk_file::readdir): Use pc.isencoded() directly.
457         * mtinfo.h (class mtinfo_drive): Const'ify all read accessor methods.
458         * path.cc (fsinfo_cnt): Add.
459         (fs_info::update): Accomodate class changes. Evaluate file system
460         name specific flags right here. Add thread safety for reading and
461         writing global fsinfo array.
462         * path.h (enum path_types): Drop values for flags kept in fs already.
463         (struct fs_info): Move status informatin into private struct type
464         status_flags.  Add accessor methods. Remove path and file system
465         name string arrays in favor of status bits.
466         (class path_conv): Use new fs_info status information where
467         appropriate.
468         (path_conf::fs_has_ea): Rename from fs_fast_ea.
469         (path_conf::fs_has_acls): New method.
470         (path_conf::root_dir): Remove.
471         (path_conf::volname): Remove.
472         * syscalls (statfs): Evaluate root dir locally.
473         * tty.h (class tty_min): Unify status accessor methods.  Const'ify
474         all read accessor methods.
475
476 2004-04-09  Thomas Pfaff  <tpfaff@gmx.net>
477
478         * thread.h (pthread::init_mainthread): Remove parameter forked.
479         (pthread::set_tls_self_pointer): New static function.
480         * thread.cc (MTinterface::fixup_after_fork): Change call to
481         pthread::init_mainthread.
482         (pthread::init_mainthread): Remove parameter forked.  Simplify thread
483         self pointer handling.
484         (pthread::self): Set thread self pointer to null_pthread if thread has
485         not been initialized.
486         (pthread::set_tls_self_pointer): New static function.
487
488 2004-04-05  Pierre Humblet  <pierre.humblet@ieee.org>
489
490         * path.cc (path_conv::check): Optimize symlink replacements.
491
492 2004-04-09  Pierre Humblet  <pierre.humblet@ieee.org>
493
494         * path.cc (normalize_posix_path): Add "tail" argument and set it.
495         Always have a final slash for directories.  Pass 3rd argument to
496         normalize_win32_path.
497         (path_conv::check): Pass tail to normalize_posix_path.  Set
498         need_directory and remove final slash after that call.  Remove last
499         argument to mount_table->conv_to_win32_path().  Remove noop dostail
500         check.  Remove fs.update() from inner loop.  Improve tail finding
501         search.
502         (normalize_win32_path): Add and set tail argument.
503         (mount_item::build_win32): Avoid calling strcpy.
504         (mount_info::conv_to_win32_path): Remove third argument and simplify
505         because the source is normalized.  Keep /proc path in Posix form.  Call
506         win32_device_name() only once.
507         (mount_info::conv_to_posix_path): Add and use 3rd argument to
508         normalize_win32_path to avoid calling strlen.
509         (cwdstuff::set): Add 3rd argument to normalize_posix_path and remove
510         final slash if any.
511         * shared_info.h (mount_info::conv_to_win32_path): Remove last argument
512         in declaration.
513
514 2004-04-09  Corinna Vinschen  <corinna@vinschen.de>
515
516         * fhandler.h (class fhandler_dev_raw): Move status bits into protected
517         bitfield struct type status_flags.  Drop unused has_written bit.
518         Add accessor methods.
519         (fhandler_dev_raw::clear): Remove.
520         (fhandler_dev_raw::reset_devbuf): Remove.
521         * fhandler_floppy.cc (fhandler_dev_floppy::lseek): Use accessor method
522         for is_writing.
523         * fhandler_raw.cc: Use status accessor methods throughout.
524         (fhandler_dev_raw::clear): Remove.
525         (fhandler_dev_raw::fhandler_dev_raw): Drop clear call.
526         (fhandler_dev_raw::~fhandler_dev_raw): Ditto.
527         * fhandler_tape.cc: Use mtinfo::status accessor methods throughout.
528         (mtinfo_drive::close): Fix conditional to enable BSD semantics
529         correctly.
530         (mtinfo_drive::get_status): Rename from mtinfo_drive::status.
531         * mtinfo.h (class mtinfo_drive): Move status bits into private bitfield
532         struct type status_flags.  Add accessor methods.
533         Rename status method to get_status.
534
535 2004-04-09  Corinna Vinschen  <corinna@vinschen.de>
536
537         * path.cc (fsinfo): Global storage for file system information.
538         (fs_info::update): Store file system information also in fsinfo and
539         short circuit GetVolumeInformation by using alredy stored file system
540         information.
541
542 2004-04-09  Corinna Vinschen  <corinna@vinschen.de>
543
544         * fhandler.h (fhandler_base::status): Declare private.
545         (fhandler_base::open_status): Ditto.
546         (class fhandler_socket): Move status bits into private bitfield struct
547         type status_flags.  Change accessor methods appropriately.
548         * fhandler_socket.cc (fhandler_socket::fhandler_socket): Accomodate
549         above status bit changes.
550         * tty.h: Remove status bit enumerator.
551         (TTYISSETF): Remove.
552         (TTYSETF): Remove.
553         (TTYCLEARF): Remove.
554         (TTYCONDSETF): Remove.
555         (tty_min::status): Define as private bitfield struct type status_flags.
556         Add appropriate accessor methods.
557         * fhandler_console.cc: Use tty_min::status accessor methods throughout.
558         * fhandler_termios.cc: Ditto.
559         * winsup.h (__ISSETF): Remove.
560         (__SETF): Remove.
561         (__CLEARF): Remove.
562         (__CONDSETF): Remove.
563
564 2004-04-09  Corinna Vinschen  <corinna@vinschen.de>
565
566         * fhandler.cc (fhandler_base::write): Use bool parameter in calls to
567         set_did_lseek.
568         (fhandler_base::fhandler_base): Accomodate new status and open_status
569         constructor.
570         * fhandler.h: Remove status bit enumerator.
571         (FHDEVN): Remove.
572         (FHISSETF): Remove.
573         (FHSETF): Remove.
574         (FHCLEARF): Remove.
575         (FHCONDSETF): Remove.
576         (FHSTATOFF): Remove.
577         (UNCONNECTED, CONNECT_PENDING, CONNECTED): Substitute by enum
578         connect_state.
579         (fhandler_base::status): Define as bitfield struct type status_flags.
580         Remove unused flags entirely.  Accomodate all status access methods.
581         (open_status): Define as bitfield struct type status_flags.
582         (fhandler_socket): Move socket related status bits to here.  Redefine
583         had_connect_or_listen to be part of these status bits.  Accomodate
584         related access methods.
585         * fhandler_disk_file.cc (fhandler_base::fstat_helper): Use pc.issymlink
586         instead of dropped method get_symlink_p.
587         (fhandler_base::open_fs): Remove setting dropped status flags.
588         * fhandler_socket.cc: Use values from enum connect_state throughout.
589         (fhandler_socket::fhandler_socket): Initialize status bits.
590         * fhandler_virtual.cc (fhandler_virtual::open): Remove setting dropped
591         status flags.
592         * net.cc: Use values from enum connect_state throughout.
593         * select.cc: Ditto.
594         * shared_info.h: Protect struct console_state using _FHANDLER_H_
595         instead of FHDEVN.
596
597 2004-04-09  Corinna Vinschen  <corinna@vinschen.de>
598
599         * security.cc (get_file_attribute): Fix conditional.
600
601 2004-04-08  Christopher Faylor  <cgf@bosbc.com>
602
603         * child_info.h: Update CHILD_INFO_MAGIC after 2004-04-03 change.
604
605 2004-04-08  Corinna Vinschen  <corinna@vinschen.de>
606
607         * path.cc (hash_path_name): Replace hash algorithm with SDBM.
608
609 2004-04-08  Corinna Vinschen  <corinna@vinschen.de>
610
611         * fhandler.cc (fhandler_base::open): Set query access mode according
612         to query_open setting.
613         (fhandler_base::fhandler_base): Initialize query_open.
614         * fhandler.h (FH_QUERYOPEN): Drop.
615         (enum query_state): Add.
616         (class fhandler_base): Add query_open member.
617         (fhandler_base::get_query_open): Redefine to use query_open.
618         (fhandler_base::set_query_open): Ditto.
619         * fhandler_disk_file.cc (fhandler_base::fstat_fs): Remove O_DIROPEN
620         from open_flags since it's added in open_fs anyway.  Remove
621         query_open_already.  Use new query_open settings.  Rearrange slightly.
622         (fhandler_base::fstat_helper): Add get_io_handle as parameter to
623         get_file_attribute.
624         * security.cc (get_nt_object_attribute): Make returning an int.
625         Return -1 on error, 0 otherwise.
626         (get_file_attribute): Take an object handle as argument. Move down
627         to allow calling get_nt_object_attribute in case a non-NULL handle
628         is given.
629         * security.h (get_file_attribute): Add handle to argument list.
630         * syscalls.cc (chown_worker): Accomodate new definition of
631         get_file_attribute.
632
633 2004-04-07  Pierre Humblet  <pierre.humblet@ieee.org>
634
635         * path.cc (path_prefix_p): Optimize test order.
636
637 2004-04-06  Corinna Vinschen  <corinna@vinschen.de>
638
639         * Makefile.in (EXTRALIBS): Add libtextreadmode.a.
640         (INSTOBJS): Add textreadmode.o.
641         * textreadmode.c: New file.
642
643 2004-04-06  Corinna Vinschen  <corinna@vinschen.de>
644
645         * fhandler_disk_file.cc (fhandler_base::fstat_helper): Request
646         compressed size only if the matching attributes are set.  Use
647         NtQueryInformationFile instead of GetCompressedFileSize.
648         (fhandler_base::fstat_by_handle): Remove NT 3.5 cruft since
649         local.dwVolumeSerialNumber isn't used subsequently.
650         * ntdll.h: Add typedefs for FILE_COMPRESSION_INFORMATION and
651         FILE_INFORMATION_CLASS.
652
653 2004-04-06  Corinna Vinschen  <corinna@vinschen.de>
654
655         * fhandler_raw.cc (fhandler_dev_raw::open): Actually use "options".
656
657 2004-04-04  Gerd Spalink  <Gerd.Spalink@t-online.de>
658
659         * fhandler_dsp.cc (fhandler_dev_dsp::ioctl): Add implementation
660         for ioctl codes SNDCTL_DSP_CHANNELS and SNDCTL_DSP_GETCAPS.
661
662 2004-04-03  Christopher Faylor  <cgf@bosbc.com>
663
664         * child_info.h (child_info::cygheap_reserve_sz): Rename from
665         cygheap_alloc_sz.
666         * cygheap.cc: Rename alloc_sz to reserve_sz throughout.
667
668 2004-04-03  Corinna Vinschen  <corinna@vinschen.de>
669
670         * fhandler.h (class fhandler_socket): Remove has_been_closed member.
671         * fhandler_socket.cc (fhandler_socket::recvfrom): Revert to
672         overlapped I/O.
673         (fhandler_socket::recvmsg): Ditto.
674         (fhandler_socket::sendto): Ditto.
675         (fhandler_socket::sendmsg): Ditto.
676         * net.cc (wsock_event::prepare): Ditto.
677         (wsock_event::wait): Ditto.  Evaluate overlapped result also after
678         calling CancelIo (thanks to Patrick Samson <p_samson@yahoo.com>).
679         (wsock_event::release): Remove.
680         * wsock_event.h: Revert to overlapped I/O.
681
682 2004-04-02  Corinna Vinschen  <corinna@vinschen.de>
683
684         * net.cc (wsock_event::release): Use NULL handle in call to
685         WSAEventSelect to resolve KB 168349.
686
687 2004-04-01  Corinna Vinschen  <corinna@vinschen.de>
688
689         * fhandler_socket.cc (fhandler_socket::recvfrom): Rearrange loop
690         so that WSARecvFrom is always called before waiting.
691         (fhandler_socket::recvmsg): Ditto.
692
693 2004-04-01  Corinna Vinschen  <corinna@vinschen.de>
694
695         * net.cc (wsock_event::wait): Make wsa_err an int.  Don't set
696         ret to 0 if any error has happened.
697
698 2004-04-01  Corinna Vinschen  <corinna@vinschen.de>
699
700         * fhandler_socket.cc (fhandler_socket::sendto): Drop out of loop if
701         has_been_closed gets set.
702         (fhandler_socket::sendmsg): Ditto.
703         * net.cc (wsock_event::wait): Don't initialize evts.  Don't try to
704         evaluate network events if WSAEnumNetworkEvents fails.
705         (wsock_event::release): Save last WSA error and set it again unless
706         resetting to blocking socket fails.
707         * wsock_event.h (class wsock_event): Remove destructor.
708
709 2004-03-31  Corinna Vinschen  <corinna@vinschen.de>
710
711         * fhandler_tape.cc (mtinfo::initialize): Fix fatal error message.
712
713 2004-03-31  Corinna Vinschen  <corinna@vinschen.de>
714
715         * fhandler_socket.cc (fhandler_socket::recvfrom): Always initialize
716         ret to 0 when using in Winsock call.
717         (fhandler_socket::recvmsg): Ditto.
718         (fhandler_socket::sendto): Ditto.
719         (fhandler_socket::sendmsg): Ditto.
720
721 2004-03-31  Corinna Vinschen  <corinna@vinschen.de>
722
723         * fhandler_tape.cc (mtinfo_drive::get_pos): Only set partition if
724         GetTapePosition returned a non-zero partition number.
725         (mtinfo_drive::create_partitions): Reinitialize to partition 0.
726         Support TAPE_DRIVE_INITIATOR and TAPE_DRIVE_FIXED partitioning.
727         (mtinfo_drive::set_partition): Initialize new partition.
728         (mtinfo_drive::status): Readd accidentally dropped setting of mt_resid.
729
730         * net.cc (wsock_event::prepare): Always print debug output in case
731         of error.
732
733 2004-03-31  Corinna Vinschen  <corinna@vinschen.de>
734
735         * fhandler_socket.cc (fhandler_socket::sendmsg): Add SIGPIPE handling.
736
737 2004-03-31  Corinna Vinschen  <corinna@vinschen.de>
738
739         * fhandler_socket.cc (fhandler_socket::recvfrom): Initialize res to
740         SOCKET_ERROR.  Use SOCKET_ERROR instead of -1 throughout.
741         (fhandler_socket::recvmsg): Ditto.
742         (fhandler_socket::sendto): Ditto.
743         (fhandler_socket::sendmsg): Ditto.
744         * net.cc (wsock_event::prepare): Call WSASetLastError instead of
745         SetLastError.
746         (wsock_event::wait): Use SOCKET_ERROR instead of -1.
747
748 2004-03-30  Thomas Pfaff  <tpfaff@gmx.net>
749
750         * thread.h (pthread::init_mainthread): Add parameter forked.  Set
751         forked default to false..
752         * thread.cc (MTinterface::fixup_after_fork): Call
753         pthread::init_mainthread with forked = true.
754         (pthread::init_mainthread): Add parameter forked.  Do not change thread
755         self pointer when forked.
756
757 2004-03-30  Corinna Vinschen  <corinna@vinschen.de>
758
759         * shm.cc (shmat): If shmid is unknown, call a special variation
760         of shmget to retrieve the shared memory segment from Cygserver
761         instead of failing immediately.
762         * include/cygwin/ipc.h (IPC_KEY_IS_SHMID): New internal flag for
763         shmget when called from shmat.
764
765 2004-03-29  Corinna Vinschen  <corinna@vinschen.de>
766
767         * fhandler.h (class fhandler_socket): Add has_been_closed member.
768         * fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize
769         has_been_closed to 0.
770         (fhandler_socket::recvfrom): Use new asynchronous I/O driven
771         wsock_event methods.
772         (fhandler_socket::recvmsg): Ditto.
773         (fhandler_socket::sendto): Ditto.
774         (fhandler_socket::sendmsg): Ditto.
775         * net.cc (wsock_event::prepare): Reimplement using asynchronous I/O.
776         (wsock_event::wait): Ditto.
777         (wsock_event::release): New method.
778         * wsock_event.h (class wsock_event): Remove ovr member.  Accomodate
779         new implementation of prepare and wait methods.  Add release method.
780
781 2004-03-29  Thomas Pfaff  <tpfaff@gmx.net>
782
783         * thread.cc (pthread::atforkprepare): Call
784         MT_INTERFACE->fixup_before_fork at the end of atforkprepare.
785
786 2004-03-29  Corinna Vinschen  <corinna@vinschen.de>
787
788         * net.cc (wsock_event::wait): Change scope of local "len" variable.
789
790 2004-03-28  Corinna Vinschen  <corinna@vinschen.de>
791
792         * shm.cc (shmat): Return (void *) -1 on error instead of NULL.
793
794 2004-03-27  Christopher Faylor  <cgf@redhat.com>
795
796         * fhandler_nodevice.cc (fhandler_nodevice::open): Assume that errno has
797         already been set if pc.error is nonzero.
798
799 2004-03-26  Christopher Faylor  <cgf@redhat.com>
800
801         * cygheap.cc (cygheap_fixup_in_child): Improve strace output.
802
803 2004-03-26  Corinna Vinschen  <corinna@vinschen.de>
804
805         * errno.cc (errmap): Map ERROR_SHARING_VIOLATION to EBUSY,
806         ERROR_EOM_OVERFLOW and ERROR_NO_DATA_DETECTED to EIO.  Add mappings
807         for ERROR_NO_MEDIA_IN_DRIVE, ERROR_DEVICE_REQUIRES_CLEANING and
808         ERROR_DEVICE_DOOR_OPEN.
809         * fhandler.h (class fhandler_dev_raw): Drop varblkop member.
810         (fhandler_dev_raw::is_eom): De-virtualize.
811         (fhandler_dev_raw::is_eof): Ditto.
812         (class fhandler_dev_tape): Drop lasterr and dp member.  Add mt_mtx
813         member.  Drop all private methods formerly used by ioctl.
814         (fhandler_dev_tape::is_rewind_device): Use get_minor for clarity.
815         (fhandler_dev_tape::driveno): New method.
816         (fhandler_dev_tape::drive_init): New method.
817         (fhandler_dev_tape::clear): Remove method.
818         (fhandler_dev_tape::is_eom): Ditto.
819         (fhandler_dev_tape::is_eof): Ditto.
820         (fhandler_dev_tape::write_file): Ditto.
821         (fhandler_dev_tape::read_file): Ditto.
822         (fhandler_dev_tape::_lock): New method.
823         (fhandler_dev_tape::unlock): New method.
824         (fhandler_dev_tape::raw_read): New method.
825         (fhandler_dev_tape::raw_write): New method.
826         * fhandler_raw.cc (fhandler_dev_raw::is_eom): New method.
827         (fhandler_dev_raw::is_eof): New method.
828         (fhandler_dev_raw::open): Allow setting write through option by
829         using the O_TEXT flag as ... flag.
830         (fhandler_dev_raw::writebuf): Remove usage of varblkop and other
831         tape specific code.
832         (fhandler_dev_raw::raw_read): Ditto.
833         (fhandler_dev_raw::dup): Ditto.
834         * fhandler_tape.cc: Rewrite tape operations entirely.  Implement
835         new tape driver classes mtinfo, mtinfo_drive and mtinfo_part.
836         Reduce fhandler_dev_tape methods to mostly just calling appropriate
837         mtinfo_drive methods.
838         (mtinfo_init): New function adding the mtinfo shared memory area.
839         * mtinfo.h: New file, containing the definition of the new tape
840         driver classes.
841         * shared.cc: Include mtinfo.h.
842         (offsets): Add entry for mtinfo shared memory area.
843         (memory_init): Call mtinfo_init.
844         * shared_info.h (shared_locations): Add SH_MTINFO shared location.
845         * include/cygwin/mtio.h: Change and add various comments.  Add GMT_xxx
846         macros for new generic flags.  Add MT_ST_xxx bitfield definitions
847         for MTSETDRVBUFFER ioctl.
848         * include/cygwin/version.h: Bump API minor version number.
849
850 2004-03-26  Christopher Faylor  <cgf@redhat.com>
851
852         * path.cc (path_conv::check): Use 'strchr' rather than 'strrchr' to
853         find end of string, for efficiency.
854
855 2004-03-26 Thomas Pfaff <tpfaff@gmx.net>
856
857         * include/cygwin/_types.h: New file.
858         * include/sys/lock.h: Ditto.
859         * include/sys/stdio.h: Ditto.
860         * thread.cc: Include sys/lock.h
861         (__cygwin_lock_init): New function.
862         (__cygwin_lock_init_recursive): Ditto.
863         (__cygwin_lock_fini): Ditto.
864         (__cygwin_lock_lock): Ditto.
865         (__cygwin_lock_trylock): Ditto.
866         (__cygwin_lock_unlock): Ditto.
867         (pthread::atforkprepare): Lock file pointer before fork.
868         (pthread::atforkparent): Unlock file pointer after fork.
869         (pthread::atforkchild): Ditto.
870
871 2004-03-26  Corinna Vinschen  <corinna@vinschen.de>
872
873         * sem.cc (semget): Fix debug string.
874         (semop): Ditto.
875         * shm.cc (fixup_shms_after_fork): Ditto.
876         (shmat): Ditto.
877         (shmdt): Ditto.
878         (shmget): Ditto.
879
880 2004-03-26  Christopher Faylor  <cgf@redhat.com>
881
882         * sigproc.cc (wait_sig): Make sure that SIGCHLD is handled regardless
883         of whether a signal is queued.
884
885 2004-03-26  Christopher Faylor  <cgf@redhat.com>
886
887         * sigproc.cc (wait_sig): Report if not trying to send signal due to
888         queued signal.
889
890 2004-03-25  Christopher Faylor  <cgf@redhat.com>
891
892         * path.cc (normalize_posix_path): Reorganize to short circuit to DOS
893         path handling whenever a '\' is detected.
894
895         * signal.cc (sigaction): Make strace output more informative.
896         * sigproc.cc (pending_signals::add): Just index directly into signal
897         array rather than treating the array as a heap.
898         (pending_signals::del): Ditto.
899         (wait_sig): Don't send signal if we already have a similar signal
900         queued.
901         * sigproc.h (call_signal_handler_now): Remove obsolete declaration.
902
903 2004-03-23  Gerd Spalink  <Gerd.Spalink@t-online.de>
904
905         * fhandler_dsp.cc (fhandler_dev_dsp::write): Remove type
906         cast from argument to audio_out_->parsewav() to make reference
907         work properly. Now .wav file headers are properly discarded.
908
909 2004-03-23  Corinna Vinschen  <corinna@vinschen.de>
910
911         * fhandler_disk_file.cc (fhandler_base::fstat_fs): Use created
912         handle regardless of nohandle state.  Clean up afterwards.
913
914 2004-03-23  Gerd Spalink  <Gerd.Spalink@t-online.de>
915
916         * autoload.cc: Load eight more functions for waveIn support.
917         * fhandler.h (class fhandler_dev_dsp): Add class Audio, class Audio_in
918         and class Audio_out members and audio_in_, audio_out_ pointers so
919         that future changes are restricted to file fhandler_dsp.cc.
920         * fhandler_dsp.cc (fhandler_dev_dsp::Audio): Add this class to treat
921         things common to audio recording and playback.
922         Add more format conversions.
923         (fhandler_dev_dsp::Audio::queue): New queues for buffer management
924         to fix incomplete cleanup of buffers passed to the wave device.
925         (fhandler_dev_dsp::Audio_in): New, added class to implement audio
926         recording.
927         (fhandler_dev_dsp::Audio_out): Rework to use functionality provided
928         by fhandler_dev_dsp::Audio.  Allocate memory audio buffers late,
929         just before write.
930         (fhandler_dev_dsp::Audio_out::start): Size of wave buffer allocated
931         here depends on audio rate/bits/channels.
932         (fhandler_dev_dsp::Audio_in::start): Ditto.
933         (fhandler_dev_dsp::setupwav): Replaced by following function.
934         (fhandler_dev_dsp::Audio_out::parsewav): Does not setup wave device
935         any more. Discard wave header properly.
936         (fhandler_dev_dsp::open): Add O_RDONLY and_RDWR as legal modes.
937         Protect against re-open. Activate fork_fixup.
938         (fhandler_dev_dsp::ioctl): Protect against actions when audio is
939         active.  SNDCTL_DSP_GETFMTS only returns formats supported by
940         mmsystem wave API, not all supported formats.  SNDCTL_DSP_GETBLKSIZE
941         result now depends on current audio format.
942         (fhandler_dev_dsp::fixup_after_fork): Call fork_fixup for the Audio
943         classes to let them duplicate the CRITICAL_SECTION.
944
945 2004-03-19  Pierre Humblet  <pierre.humblet@ieee.org>
946             Christopher Faylor  <cgf@redhat.com>
947
948         * init.cc (munge_threadfunc): Handle all instances of search_for.
949         (prime_threads): Test threadfunc_ix[0].
950
951 2004-03-21  Christopher Faylor  <cgf@redhat.com>
952
953         * cygheap.cc (init_cheap): Set initial_sz to something or suffer
954         spurious output.
955         (cygheap_fixup_in_child): Set alloc_sz to passed in size to ensure that
956         children will have the right size heap.
957         (_csbrk): Make output conditional on DEBUGGING.
958
959 2004-03-21  Christopher Faylor  <cgf@redhat.com>
960
961         * cygheap.cc (init_cheap): Conditionalize debugging code.
962
963 2004-03-21  Christopher Faylor  <cgf@redhat.com>
964
965         * cygheap.cc (init_cheap): Add ability to specify minimal cygwin heap
966         size when debugging.
967         (_csbrk): Report error in allocation to stderr.
968         (ccalloc): Ditto.
969         * dtable.cc (dtable::find_fifo): Remove use of atoms.
970         * dtable.h (dtable::find_fifo): Ditto.
971         * fhandler.h (fhandler_fifo): Ditto.
972         * fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Ditto.
973         (fhandler_fifo::set_use): Ditto.
974         (fhandler_fifo::open_not_mine): Ditto.
975         (fhandler_fifo::open): Ditto.
976         * pinfo.cc (_pinfo::commune_recv): Ditto.
977         (_pinfo::commune_send): Ditto.
978
979 2004-03-19  Pierre Humblet <pierre.humblet@ieee.org>
980
981         * dir.cc (rmdir): Reorganize error handling to reduce indentation.
982
983 2004-03-19  Christopher Faylor  <cgf@redhat.com>
984
985         * include/cygwin/version.h: Bump DLL minor number to 10.
986
987 2004-03-18  Christopher Faylor  <cgf@redhat.com>
988
989         * child_info.h (CURR_CHILD_INFO_MAGIC): Reset to new value.
990         (child_info::cygheap_alloc_sz): New field.
991         * cygheap.cc (init_cheap): Reduce size of cygwin stack until minimal
992         hit when attempting initial allocation.
993         (cygheap_setup_for_child): Use alloc_sz to create secondary memory
994         mapped entry.  Store alloc_sz in cygheap_alloc_sz.
995         (cygheap_fixup_in_child): Use cygheap_alloc_sz to map parent's cygheap.
996         * cygheap.h (_CYGHEAPSIZE_SLOP): New define.
997         (CYGHEAPSIZE): Use _CYGHEAPSIZE_SLOP.
998
999 2004-03-18  Corinna Vinschen  <corinna@vinschen.de>
1000
1001         * fhandler_proc.cc (format_proc_meminfo): On NT, try to figure out
1002         real swap file usage by requesting SystemPagefileInformation.  Use
1003         GlobalMemoryStatus as fallback.
1004         * ntdll.h (_SYSTEM_INFORMATION_CLASS): Add SystemPagefileInformation.
1005         (struct _SYSTEM_PAGEFILE_INFORMATION): Define.
1006
1007 2004-03-17  Christopher Faylor  <cgf@redhat.com>
1008
1009         * pipe.cc (fhandler_pipe::dup): Fix debugging message.
1010
1011 2004-03-17  Christopher Faylor  <cgf@redhat.com>
1012
1013         * include/cygwin/version.h: Bump DLL minor number to 9.
1014
1015 2004-03-16  Christopher Faylor  <cgf@redhat.com>
1016
1017         * sigproc.cc (proc_terminate): Release sync_proc_subproc when done
1018         terminating or suffer potential hangs.
1019         (get_proc_lock): Reorganize debugging output slightly.
1020
1021 2004-03-15  Christopher Faylor  <cgf@redhat.com>
1022
1023         * cygtls.cc (_cygtls::fixup_after_fork): Just manipulate the signal
1024         stack if a signal occurred during the parent's fork.  Otherwise leave
1025         it alone.
1026
1027 2004-03-15  Christopher Faylor  <cgf@redhat.com>
1028
1029         * exceptions.cc (try_to_debug): Report on tid of caller.
1030
1031         * sync.cc (muto::acquire): Fix some races.
1032         * sync.h (muto): Expose some fields for easier debugging.
1033
1034 2004-03-15  Corinna Vinschen  <corinna@vinschen.de>
1035
1036         * fhandler.h (fhandler_dev_tape::tape_get_pos): Declare with extra
1037         parameter for partition number.
1038         (fhandler_dev_tape::_tape_set_pos): Ditto.
1039         (fhandler_dev_tape::tape_partition): New method.
1040         (fhandler_dev_tape::tape_set_partition): New method.
1041         * fhandler_tape.cc (fhandler_dev_tape::open): Call private methods
1042         directly instead of ioctl.
1043         (fhandler_dev_tape::ioctl): Use long erase on MTERASE by default.
1044         Don't use absolute positioning on MTSEEK.  Call tape_set_partition
1045         on MTSETPART, tape_partition on MTMKPART.
1046         (fhandler_dev_tape::tape_get_pos): Add partition number parameter.
1047         Prefer logical position information over absolute position information.
1048         Return partition number.
1049         (fhandler_dev_tape::_tape_set_pos): Add partition number parameter.
1050         Use in SetTapePosition.
1051         (fhandler_dev_tape::tape_set_pos): Remove special TAPE_ABSOLUTE_BLOCK
1052         handling.
1053         (fhandler_dev_tape::tape_erase): Rewind before erasing.
1054         (fhandler_dev_tape::tape_status): Rearrange slightly. Try to get a
1055         MediaType even if no tape is loaded. Store active partition in
1056         mt_resid as on Linux.
1057         (fhandler_dev_tape::tape_partition): New method.
1058         (fhandler_dev_tape::tape_set_partition): New method.
1059         * include/cygwin/mtio.h: Fix copyright. Add comment to explain
1060         mt_resid content.
1061         * include/cygwin/version.h: Bump API minor number.
1062
1063 2004-03-14  Christopher Faylor  <cgf@redhat.com>
1064
1065         * cygtls.cc (_cygtls::remove): Call remove_wq even when we can't
1066         necessarily get the cygtls table lock.
1067         * cygtls.h (_cygtls::remove_wq): Add wait argument.
1068         * sigproc.cc (_cygtls::remove_wq): Honor wait argument when acquiring
1069         lock.
1070         (proc_terminate): Don't NULL sync_proc_subproc since other threads may
1071         still try to access it.
1072
1073 2004-03-14  Corinna Vinschen  <corinna@vinschen.de>
1074
1075         * errno.cc (errmap): Map ERROR_BEGINNING_OF_MEDIA and
1076         ERROR_SETMARK_DETECTED to EIO instead of ESPIPE.
1077         Handle ERROR_FILEMARK_DETECTED.
1078         * fhandler_tape.cc (TAPE_FUNC): Add comment that ERROR_BUS_RESET
1079         has still to be handled correctly.
1080         (fhandler_dev_tape::open): Accomodate fact that get.mt_dsreg
1081         also contains density code.
1082         (fhandler_dev_tape::ioctl): Rearrange slightly.  Reset devbuf also on
1083         MTNOP, MTWSM, MTSETBLK, MTSETDRVBUFFER, MTSETPART and MTMKPART.
1084         (fhandler_dev_tape::tape_set_pos): Rearrange.  Match behaviour to
1085         the Linux tape driver.
1086         (fhandler_dev_tape::tape_status): Call IOCTL_STORAGE_GET_MEDIA_TYPES_EX
1087         if available.  Return device type and density code in appropriate
1088         mtget members.
1089         * wincap.h (wincaps::has_ioctl_storage_get_media_types_ex): New element.
1090         * wincap.cc: Implement above element throughout.
1091         * include/cygwin/mtio.h: Add tape device types as returned by
1092         IOCTL_STORAGE_GET_MEDIA_TYPES_EX.
1093         (MT_TAPE_INFO): Use above type codes.
1094         (struct mtget): Change mt_dsreg comment.
1095
1096 2004-03-14  Pierre Humblet <pierre.humblet@ieee.org>
1097
1098         * dir.cc (rmdir): Construct real_dir with flag PC_FULL.
1099         Use a loop instead of recursion to handle the current directory.
1100
1101 2004-03-14  Christopher Faylor  <cgf@redhat.com>
1102
1103         * cygtls.cc (_cygtls::remove): Call remove_wq to ensure that wait stuff
1104         is removed from proc_subproc linked list.
1105         * cygtls.h (_cygtls::remove_wq): Declare.
1106         * sigproc.cc (_cygtls::remove_wq): Define.
1107         (proc_subproc): Label event handle appropriately.
1108         * spawn.cc (spawn_guts): Return -1 when wait() fails for spawn types
1109         that require waiting.
1110
1111 2004-03-13  Corinna Vinschen  <corinna@vinschen.de>
1112
1113         * errno.cc (errmap): Handle ERROR_BUS_RESET.
1114         * fhandler.h (fhandler_dev_raw::write_file): New method, created
1115         from former static function.
1116         (fhandler_dev_raw::read_file): Ditto.
1117         (reset_devbuf): New inline method.
1118         (class fhandler_dev_tape): Add TAPE_GET_DRIVE_PARAMETERS
1119         member `dp'.
1120         (fhandler_dev_tape::write_file): New method.
1121         (fhandler_dev_tape::read_file): Ditto.
1122         (fhandler_dev_tape::tape_get_feature): Convert to inline method.
1123         (fhandler_dev_tape::tape_error): New method, created from former
1124         static function.
1125         (fhandler_dev_tape::tape_get_blocksize): Remove declaration.
1126         * fhandler_raw.cc (fhandler_dev_raw::write_file): New method, created
1127         from former static function.
1128         (fhandler_dev_raw::read_file): Ditto.
1129         (fhandler_dev_raw::writebuf): Accomodate the fact that no devbuf
1130         exists under variable block size condition.
1131         (fhandler_dev_raw::raw_read): Ditto. Add local p pointer to simplify
1132         pointer arithmetic.
1133         (fhandler_dev_raw::raw_write): Always set devbufend to 0 when starting
1134         with writing. Accomodate the fact that no devbuf exists under
1135         variable block size condition.
1136         * fhandler_tape.cc: Various formatting changes.
1137         (TAPE_FUNC): New macro. Use throughout as tape function loop.
1138         (get_ll): Convert into macro.
1139         (IS_EOM): New macro.
1140         (IS_EOF): New macro.
1141         (fhandler_dev_tape::is_eom): Use IS_EOM macro.
1142         (fhandler_dev_tape::is_eof): Use IS_EOF macro.
1143         (fhandler_dev_tape::write_file): New method.
1144         (fhandler_dev_tape::read_file): New method.
1145         (fhandler_dev_tape::open): Get drive information block here once.
1146         (fhandler_dev_tape::lseek): Remove unneeded duplicate code.
1147         (fhandler_dev_tape::dup): Duplicate drive information block.
1148         (fhandler_dev_tape::ioctl): Remove drvbuf in variable block size mode.
1149         Return ERROR_INVALID_BLOCK_LENGTH instead of ERROR_MORE_DATA if
1150         buffer contains data which would get lost on buffer size changing.
1151         Use absolute tape positioning also if drive only supports logical
1152         block positioning.
1153         (fhandler_dev_tape::tape_error): New method, created from former
1154         static function.
1155         (fhandler_dev_tape::tape_get_pos): Allow logical block reporting.
1156         Workaround tape driver bug.
1157         (fhandler_dev_tape::_tape_set_pos): Reset device buffer and flags
1158         after successful repositioning.
1159         (fhandler_dev_tape::tape_set_pos): Allow logical block positioning.
1160         Workaround tape driver bug.
1161         (fhandler_dev_tape::tape_erase): Use dp instead of calling
1162         GetTapeParameters.
1163         (fhandler_dev_tape::tape_prepare): Ditto.
1164         (fhandler_dev_tape::tape_get_blocksize): Remove.
1165         (fhandler_dev_tape::tape_set_blocksize): Don't call tape_get_blocksize.
1166         Error handling already done in fhandler_dev_tape::ioctl.
1167         (fhandler_dev_tape::tape_status): Remove local `dp' variable.
1168         Accomodate logical tape reporting.  Call tape_get_feature instead
1169         of accessing feature words directly.
1170         (fhandler_dev_tape::tape_compression): Use dp instead of calling
1171         GetTapeParameters.  Fix resetting datcompression.
1172
1173 2004-03-12  Christopher Faylor  <cgf@redhat.com>
1174
1175         * wait.cc (wait4): Initialize pointer on entry.  Avoid calling
1176         call_signal_handler twice since that guarantees exiting with errno set
1177         to EINTR.
1178
1179 2004-03-12  Corinna Vinschen  <corinna@vinschen.de>
1180
1181         * exceptions.cc (sigpacket::process): Simplify code slightly.
1182
1183 2004-03-11  Christopher Faylor  <cgf@redhat.com>
1184
1185         * cygtls.h (waitq): Declare structure here.
1186         (_cygtls::wq): Declare.
1187         * cygtls.cc (_cygtls::fixup_after_fork): Clear wq.thread_ev to avoid
1188         using an invalid event handle in forked process.
1189         * dcrt0.cc (waitq_storage): Delete.
1190         (threadstuff): Remove waitq_storage.
1191         * perthread.h (per_thread_waitq): Delete.
1192         (waitq_storage): Delete declaration.
1193         * sigproc.cc (sigproc_init): Remove perthread waitq consideration.
1194         * sigproc.h (waitq): Delete declaration.
1195         * wait.cc (wait4): Use _my_tls waitq structure rather than per_thread.
1196
1197 2004-03-11  Pierre Humblet  <pierre.humblet@ieee.org>
1198
1199         * cygtls.h (_cygtls::newmask): Delete member.
1200         (_cygtls::deltamask): New member.
1201         * gendef (_sigdelayed): Replace the call to set_process_mask by a call
1202         to set_process_mask_delta.
1203         * exceptions.cc (handle_sigsuspend): Do not filter tempmask.  Or
1204         SIG_NONMASKABLE in deltamask as a flag.
1205         (_cygtls::interrupt_setup): Set deltamask only.
1206         (set_process_mask_delta): New function.
1207         (_cygtls::call_signal_handler): Replace the first call to
1208         set_process_mask by a call to set_process_mask_delta.
1209         * tlsoffsets.h: Regenerate.
1210
1211 2004-03-11  Christopher Faylor  <cgf@redhat.com>
1212
1213         * cygtls.cc (_cygtls::fixup_after_fork): Remove unneeded setting of
1214         oldmask.
1215         * exceptions.cc: Remove some __I386__ conditionals.
1216         (handle_exceptions): Move ppid test to outside of a loop for
1217         efficiency.
1218         (setup_handler): Make debugging output more wordy.
1219         (_cygtls::call_signal_handler): To avoid a race, use lock/unlock to
1220         synchronize with signal thread and ensure that signal_arrived event has
1221         actually been set.
1222         * gendef (_sigfe): Use ebx for all sigstack manipulations to ensure
1223         that the register is saved.  Move setting of incyg to within stack lock
1224         to avoid setup_handler confusion.
1225         (_sigbe): Use ebx for all sigstack manipulations to ensure that the
1226         register is saved.
1227         (_cygtls::pop): Ditto.
1228         (_cygtls::lock): Ditto.
1229         (stabilize_sig_stack): Ditto.
1230         (setjmp): Ditto.
1231         (longjmp): Ditto.
1232
1233 2004-03-08  Jaakko Hyvatti  <jaakko.hyvatti@iki.fi>
1234
1235         * fhandler_serial.cc (fhandler_serial::ioctl): Implement TIOCSBRK and
1236         TIOCCBRK.
1237         * include/sys/termios.h: Define TIOCSBRK and TIOCCBRK.
1238
1239 2004-03-08  Christopher Faylor  <cgf@redhat.com>
1240
1241         * exceptions.cc (setup_handler): Avoid suspending a thread if it is in
1242         a cygwin function, in an exception, spinning, or locked.
1243         * gendef (_sigfe): Move incyg setting earlier.
1244         (sigreturn): Set incyg flag to avoid interrupting called cygwin
1245         functions.
1246         (sigdelayed): Ditto.
1247         (stabilize_sig_stack): Ditto.
1248
1249         * sigproc.cc (proc_subproc): Don't restore process lock early in exec
1250         case.
1251
1252         * cygtls.h: Reorganize fields in _cygtls slightly.
1253         * tlsoffsets.h: Regenerate.
1254
1255 2004-03-06  Christopher Faylor  <cgf@redhat.com>
1256
1257         * fork.cc (fork_parent): Save parent pid in a temporary variable since
1258         child could conceivably exit before function returns, rendering the
1259         child's shared memory area invalid.
1260
1261         * cygtls.h (_cygtls::incyg): Declare new field.
1262         (_cygtls::in_exception): Define new function.
1263         * exceptions.cc (setup_handler): Remove locked flag.  Use 'incyg' flag
1264         and in_exception function to determine when we're in a cygwin function.
1265         (_cygtls::call_signal_handler): Decrement incyg flag prior to calling a
1266         handler.  Increment it on return.
1267         * gendef (_sigfe): Increment incyg flag.  Use testl for zero testing
1268         rather than orl, for consistency.
1269         (_sigbe): Decrement incyg flag.  Use testl for zero testing rather than
1270         orl, for consistency.
1271         (_cygtls::pop): Use testl for zero testing rather than orl, for
1272         consistency.
1273         (stabilize_sig_stack): Ditto.
1274
1275         * tlsoffsets.h: Regenerate.
1276
1277 2004-03-05  Christopher Faylor  <cgf@redhat.com>
1278
1279         * gendef (sigdelayed): Handle return here rather than going through
1280         sigbe to ensure that flags are properly restored.
1281
1282 2004-03-04  Thomas Pfaff  <tpfaff@gmx.net>
1283
1284         * include/pthread.h (PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP): New
1285         define.
1286         (PTHREAD_NORMAL_MUTEX_INITIALIZER_NP): Ditto.
1287         (PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP): Ditto.
1288         * thread.cc (pthread_mutex::is_good_initializer): Check for all
1289         posssible initializers
1290         (pthread_mutex::is_good_initializer_or_object): Ditto.
1291         (pthread_mutex::is_good_initializer_or_bad_object): Ditto.
1292         (verifyable_object_isvalid): Support up to three static initializers.
1293         (verifyable_object_isvalid (void const *,long)): Remove.
1294         (pthread_cond::is_good_initializer_or_bad_object): Remove unneeded
1295         objectState var.
1296         (pthread_cond::init): Condition remains unchanged when creation has
1297         failed.
1298         (pthread_rwlock::is_good_initializer_or_bad_object): Remove unneeded
1299         objectState var.
1300         (pthread_rwlock::init): Rwlock remains unchanged when creation has
1301         failed.
1302         (pthread_mutex::init): Remove obsolete comment.  Mutex remains
1303         unchanged when creation has failed.  Add support for new initializers.
1304         (pthread_mutex_getprioceiling): Do not create mutex, just return
1305         ENOSYS.
1306         (pthread_mutex_lock): Simplify.
1307         (pthread_mutex_trylock): Remove unneeded local themutex.
1308         (pthread_mutex_unlock): Just return EPERM if mutex is not initialized.
1309         (pthread_mutex_setprioceiling): Do not create mutex, just return
1310         ENOSYS.
1311         * thread.h (verifyable_object_isvalid): Support up to three static
1312         initializers.
1313         (verifyable_object_isvalid (void const *,long)): Remove prototype.
1314         (pthread_mutex::init): Add optional initializer to parameter list.
1315
1316 2004-03-03  Christopher Faylor  <cgf@redhat.com>
1317
1318         * gendef (sigreturn): Call stabilize_sig_stack to ensure that there are
1319         no pending signals.  Restore edx later.
1320         (sigdelayed): Save edx earlier.
1321
1322         * malloc_wrapper.cc (malloc_init): Add some more debugging output.
1323
1324 2004-03-02  Corinna Vinschen  <corinna@vinschen.de>
1325
1326         * fhandler_raw.cc (fhandler_dev_raw::raw_read): When reading with
1327         variable block size, read only one block, read directly into user
1328         supplied buffer, return ENOMEM if user supplied buffer is smaller
1329         than size of next block to read.  Use read2 instead of bytes_to_read
1330         to count number of bytes read.
1331         * fhandler_tape.cc (fhandler_dev_tape::open): Add debug output.
1332
1333 2004-02-26  Brian Ford  <ford@vss.fsi.com>
1334
1335         * miscfuncs.cc (check_invalid_virtual_addr): Assure the last page
1336         in the range is always tested.  Add appropriate const.
1337         * mmap.cc (mmap_record::alloc_fh): Remove unused static path_conf object.
1338
1339 2004-02-25  Christopher Faylor  <cgf@redhat.com>
1340
1341         * exceptions.cc (setup_handler): Signal event for any sigwaitinfo, if it
1342         exists, to force signal to be handled.  Zero event here to prevent
1343         races.
1344         * signal.cc (sigwaitinfo): Use local handle value for everything since
1345         signal thread could zero event element at any time.  Detect when
1346         awaking due to thread not in mask and set return value and errno
1347         accordingly.  Don't set signal number to zero unless we've recognized
1348         the signal.
1349         * sigproc.cc (sigq): Rename from sigqueue throughout.
1350
1351         * thread.cc (pthread::join): Handle signals received while waiting for
1352         thread to terminate.
1353
1354 2004-02-25  Christopher Faylor  <cgf@redhat.com>
1355
1356         * cygwin.din: Export sighold, sigqueue.
1357         * exceptions.cc (sighold): Define new function.
1358         * signal.cc (handle_sigprocmask): Set correct errno for invalid signal.
1359         Simplify debugging output.
1360         (sigqueue): Define new function.
1361         * include/cygwin/signal.h (sighold): Declare new function.
1362         (sigqueue): Ditto.
1363         * include/cygwin/version.h: Bump API minor version number.
1364         * include/limits.h (TIMER_MAX): Define.
1365         (_POSIX_TIMER_MAX): Ditto.
1366
1367 2004-02-25  Brian Ford <ford@vss.fsi.com>,
1368             Corinna Vinschen  <corinna@vinschen.de>
1369
1370         * miscfuncs.cc (check_invalid_virtual_addr): New function.
1371         * winsup.h (check_invalid_virtual_addr): Declare.
1372         * mmap.cc (munmap): Call check_invalid_virtual_addr instead of
1373         IsBadReadPtr.
1374
1375 2004-02-24  Christopher Faylor  <cgf@redhat.com>
1376
1377         * gendef (stabilize_sig_stack): Correctly align this pointer for call
1378         to _cygtls::call_signal_handler.
1379         * gentls_offsets: Output sizeof field.
1380         * tlsoffsets.h: Regenerate.
1381
1382 2004-02-24  Christopher Faylor  <cgf@redhat.com>
1383
1384         * dcrt0.cc (_dll_crt0): Don't check sync_startup if threadfunc_ix is set.
1385
1386         * external.cc (cygwin_internal): Implement CW_GET_BINMODE.
1387         * include/sys/cygwin.h: Declare CW_GET_BINMODE.
1388
1389 2004-02-24  Christopher Faylor  <cgf@redhat.com>
1390
1391         * dcrt0.cc (_dll_crt0): Add some stern internal errors.
1392
1393 2004-02-24  Corinna Vinschen  <corinna@vinschen.de>
1394
1395         * thread.cc (pthread::cancelable_wait): Rearrange slightly.
1396         Add do_sig_wait parameter.  Wait for signal_arrived if set to true.
1397         Return WAIT_SIGNALED if signal arrived.
1398         (pthread_cond::wait): Accomodate change to pthread::cancelable_wait.
1399         (pthread::join): Ditto.
1400         (semaphore::_timedwait): Ditto.
1401         (semaphore::_wait): Ditto.  Change to return int to allow status
1402         feedback.
1403         (semaphore::wait): Return return value from semaphore::_wait.
1404         * thread.h (WAIT_SIGNALED): New definition.
1405         (pthread::cancelable_wait): Change declaration.  Define do_sig_wait
1406         as false by default to not interfere with existing calls accidentally.
1407         (semaphore::_wait): Declare int.
1408
1409 2004-02-21  Christopher Faylor  <cgf@redhat.com>
1410
1411         * exceptions.cc (sigpacket::process): Make sure that tls is filled in
1412         for SIGSTOP condition.
1413         (_cygtls::call_signal_handler): Restore signal mask using saved oldmask
1414         rather than current oldmask.
1415
1416 2004-02-20  Christopher Faylor  <cgf@redhat.com>
1417
1418         * path.cc (conv_path_list): Return error condition.
1419         (copy1): New function.
1420         (copyenc): New function.
1421         (mount_item::fnmunge): Return error condition.  Use new functions to
1422         copy strings.
1423         (mount_item::build_win32): Ditto.
1424         (mount_info::conv_to_win32_path): Return error condition.
1425         (cygwin_conv_to_posix_path): Return result of path conversion.
1426         (cygwin_conv_to_full_posix_path): Ditto.
1427         (return_with_errno): New macro.
1428         (cygwin_win32_to_posix_path_list): Use new macro to potentially set
1429         errno.
1430         (cygwin_posix_to_win32_path_list): Ditto.
1431         * path.h (mount_item::fnmunge): Add size argument.
1432         (mount_item::build_win32): Ditto.
1433
1434 2004-02-20  Corinna Vinschen  <corinna@vinschen.de>
1435
1436         * getopt.c: Avoid useless compiler warnings.
1437
1438 2004-02-20  Corinna Vinschen  <corinna@vinschen.de>
1439
1440         * getopt.c: Replace with latest vanilla(!) OpenBSD version 1.16.
1441
1442 2004-02-18  Christopher Faylor  <cgf@redhat.com>
1443
1444         * fork.cc (fork_child): Invert sense of test which defeated correct
1445         handling in a fork from a non-main thread.
1446
1447         * dcrt0.cc (initial_env): Eliminate parameter and just send DebugBreak
1448         when appropriate.
1449         (dll_crt0_0): Reflect parameter change to initial_env.
1450         (dll_crt0_1): Don't call initial_env.
1451
1452 2004-02-18  Christopher Faylor  <cgf@redhat.com>
1453
1454         * gendef (stabilize_sig_stack): New function.
1455         (setjmp): Import, add sig stack handling.  Store sig stack info.
1456         (longjmp): Call stabilize_sig_stack.  Restore sig stack info.
1457         * config/i386/setjmp.c: Remove.
1458
1459 2004-02-17  Corinna Vinschen  <corinna@vinschen.de>
1460
1461         * fork.cc (fork_child): Move fixup_shms_after_fork so that
1462         signal_arrived is initialized when calling it.
1463
1464 2004-02-17  Christopher Faylor  <cgf@redhat.com>
1465
1466         * Makefile.in (clean): Clean libserver, too.
1467
1468         * fhandler.cc (fhandler_base::~fhandler_base): Remove path_conv cleanup.
1469         * syscalls.cc (chroot): Ditto.
1470         * path.cc (path_conv::~path_conv): Define new destructor.
1471         (conv_path_list_buf_size): Remove explicit path_conv cleanup.
1472         * path.h (path_conv::~path_conv): Declare new destructor.
1473
1474 2004-02-16  Christopher Faylor  <cgf@redhat.com>
1475
1476         * Makefile.in: Compile flock.o with -fomit-frame-pointer.
1477
1478 2004-02-16  Christopher Faylor  <cgf@redhat.com>
1479
1480         * Makefile.in: Compile dlfcn.o with -fomit-frame-pointer.
1481
1482 2004-02-16  Christopher Faylor  <cgf@redhat.com>
1483
1484         * Makefile.in: Compile delqueue.o with -fomit-frame-pointer.
1485
1486 2004-02-16  Pierre Humblet <pierre.humblet@ieee.org>
1487
1488         * syscalls.cc (rename): Do not test the MoveFile error code
1489         where MoveFileEx exists.
1490
1491 2004-02-15  Christopher Faylor  <cgf@redhat.com>
1492
1493         * cygheap.cc (_csbrk): Report more debugging details on failing
1494         condition.
1495
1496 2004-02-14  Christopher Faylor  <cgf@redhat.com>
1497
1498         * Makefile.in: Compile syscalls.o with -fomit-frame-pointer.
1499
1500         * sigproc.cc: Eliminate unused variable.
1501
1502 2004-02-14  Corinna Vinschen  <corinna@vinschen.de>
1503
1504         * getopt.c: Replace with latest NetBSD version 1.16.  Keep Cygwin
1505         specific changes as minimal as possible.
1506
1507 2004-02-13  Christopher Faylor  <cgf@redhat.com>
1508
1509         * sigproc.cc (proc_subproc): Change warning back to silent debug
1510         output.
1511
1512 2004-02-13  Christopher Faylor  <cgf@redhat.com>
1513
1514         * dcrt0.cc (alloc_stack_hard_way): Revert to previous implementation.
1515         (alloc_stack): Ditto.
1516         * exceptions.cc (ctrl_c_handler): Add debugging output.
1517
1518 2004-02-13  Christopher Faylor  <cgf@redhat.com>
1519
1520         * Makefile.in (clean): Remove sigfe.s.
1521         (sigfe.s): Ensure that sigfe.s will be regenerated if it does not exist.
1522         * dll_init.cc (dll_dllcrt0): Simplify initializing tests.
1523
1524         * exceptions.cc (setup_handler): Detect when stub caller is either
1525         spinning or has acquired the lock after being suspended to avoid
1526         windows problems with suspending a win32 API call.
1527
1528         * cygtls.h (_cygtls::spinning): Declare new element.
1529         * gendef: Remove unused _siglist_index and _siglist declaration.
1530         (_sigfe): Set spinning element when potentially looping, waiting for lock.
1531         (_sigbe): Ditto.
1532         (_cygtls::lock): Ditto.
1533         (_longjmp): Ditto.
1534         * tlsoffsets.h: Regenerate.
1535         * pinfo.cc (_pinfo::exit): Set final exit state here.  Call sigproc_terminate if
1536         invoked with 'norecord'.  Clear any residual _cygtls stuff.
1537         * winsup.h (exit_states): Define ES_FINAL.
1538         * spawn.cc (spawn_guts): Don't call proc_terminate specifically when
1539         execing.  Let _pinfo::exit handle that case.
1540
1541         * sigproc.cc (wait_subproc): Always exit loop early when proc_loop_wait.
1542
1543         * init.cc (munge_threadfunc): Eliminate unused argument.
1544         (dll_entry): Reflect above change in call to munge_threadfunc.
1545
1546 2004-02-11  Christopher Faylor  <cgf@redhat.com>
1547
1548         * gendef (_sigbe): Zero location on pop.
1549         (_cygtls::pop): Ditto.
1550
1551 2004-02-11  Christopher Faylor  <cgf@redhat.com>
1552
1553         * dcrt0.cc (alloc_stack_hard_way): Eliminate second argument.
1554         (alloc_stack): Remove use of 'b' throughout.
1555
1556 2004-02-11  Christopher Faylor  <cgf@redhat.com>
1557
1558         Rename _threadinfo to _cygtls, throughout.
1559         * cygtls.h (_cygtls::call_signal_handler): Rename from
1560         call_signal_handler_now.
1561         (_cygtls::push): Make second argument mandatory.
1562         (_cygtls::fixup_after_fork): Declare new function.
1563         (_cygtls::lock): Ditto.
1564         * cygtls.cc (_cygtls::fixup_after_fork): Define new function.
1565         * dcrt0.cc (cygwin_finished_initializing): Define as bool.
1566         (alloc_stack): Use _tlstop rather than arbitrary variable in probably
1567         vain attempt to avoid strange fork problem on CTRL-C.
1568         (dll_crt0_0): Remove obsolete winpids::init call.
1569         * dll_init.cc (dll_dllcrt0): Detect forkee condition as equivalent to
1570         initializing.
1571         * winsup.h (cygwin_finished_initializing): Declare as bool.
1572         * exceptions.cc (handle_exceptions): Rely on
1573         cygwin_finished_initializing to determine how to handle exception
1574         during process startup.
1575         (_cygtls::call_signal_handler): Rename from call_signal_handler_now.
1576         (_cygtls::interrupt_now): Fill in second argument to push.
1577         (signal_fixup_after_fork): Eliminate.
1578         (setup_handler): Initialize locked to avoid potential inappropriate
1579         unlock.  Resume thread if it has acquired the stack lock.
1580         (ctrl_c_handler): Just exit if ctrl-c is hit before cygiwn has finished
1581         initializing.
1582         * fork.cc (sync_with_child): Don't call abort since it can cause exit
1583         deadlocks.
1584         (sync_with_child): Change debugging output slightly.
1585         (fork_child): Set cygwin_finished_initializing here.  Call _cygtls fork
1586         fixup and explicitly call sigproc_init.
1587         (fork_parent): Release malloc lock on fork failure.
1588         (vfork): Call signal handler via _my_tls.
1589         * sigproc.cc (sig_send): Ditto.
1590         * syscalls.cc (readv): Ditto.
1591         * termios.cc (tcsetattr): Ditto.
1592         * wait.cc (wait4): Ditto.
1593         * signal.cc (nanosleep): Ditto.
1594         (abort): Ditto.
1595         (kill_pgrp): Avoid killing self if exiting.
1596         * sync.cc (muto::acquire): Remove (temporarily?) ill-advised
1597         exiting_thread check.
1598         * gendef (_sigfe): Be more agressive in protecting stack pointer from
1599         other access by signal thread.
1600         (_cygtls::locked): Define new function.
1601         (_sigbe): Ditto.
1602         (_cygtls::pop): Protect edx.
1603         (_cygtls::lock): Use guaranteed method to set eax to 1.
1604         (longjmp): Aggressively protect signal stack.
1605         * miscfuncs.cc (low_priority_sleep): Reduce "sleep time" for secs == 0.
1606         * pinfo.cc (winpids::set): Counterintuitively use malloc's lock to
1607         protect simultaneous access to the pids list since there are
1608         pathological conditions which can cause malloc to call winpid.
1609         (winpids::init): Eliminate.
1610         * pinfo.h (winpids::cs): Eliminate declaration.
1611         * pinfo.h (winpids::init): Eliminate definition.
1612
1613 2004-02-11  Corinna Vinschen  <corinna@vinschen.de>
1614
1615         * security.cc (get_nt_object_attribute): Fix error handling.
1616
1617 2004-02-09  Ralf Habacker  <ralf.habacker@freenet.de>
1618
1619         * fhandler_socket.cc (fhandler_socket::ioctl): Add FIONREAD handling.
1620
1621 2004-02-08  Christopher Faylor  <cgf@redhat.com>
1622
1623         * debug.h (console_printf): Define for non-debugging condition.
1624
1625         * cygtls.h (_threadinfo::lock): Remove wait argument.
1626         (_threadinfo::interrupt_setup): Remove retaddr argument.
1627         * exceptions.cc (_threadinfo::interrupt_setup): Ditto.
1628         (_threadinfo::interrupt_now): Accommodate change to interrupt_setup
1629         argument.
1630         (setup_handler): Ditto.  Always lock sig stack prior to determining
1631         interrupt method.
1632         * gendef (_sigfe): Correct thinko regarding cmpxchg.
1633         (_sigbe): Ditto.
1634         (_threadinfo::lock): Ditto.
1635         (_threadinfo::pop): Eliminate left-over stack unlock.
1636         * sigproc.cc (proc_subproc): Change debugging output to printed
1637         warning.
1638
1639 2004-02-08  Christopher Faylor  <cgf@redhat.com>
1640
1641         * localtime.cc (localtime_r): Call tzset.
1642
1643         * Makefile.in: Make version.h/cygwin.din version check a warning since
1644         it is not foolproof.
1645
1646         * cygheap.h (CYGHEAPSIZE): Bump size down.
1647
1648         * cygtls.h (_threadinfo::stacklock): New element.
1649         (_threadinfo::pop): Make regparm.
1650         (_threadinfo::lock): New function.
1651         (_threadinfo::unlock): New function.
1652         * cygtls.cc (_threadinfo::push): Wait for a lock on the stack before
1653         performing the operation.
1654         (_threadinfo::pop): Move to another file.
1655         * cygwin.din: More SIGFE changes.
1656         * exceptions.cc (try_to_debug): Always display messages on console.
1657         (handle_exceptions): Unwind stack only when actually about to call
1658         sig_send.
1659         (setup_handler): Lock stack prior to performing any operations.
1660         * gendef (_sigfe): Ditto.
1661         (_sigbe): Ditto.
1662         (_threadinfo::pop): Ditto.  Move here.
1663         * gen_tlsoffsets: Generate positive offsets.
1664         * tlsoffsets.h: Regenerate.
1665
1666 2004-02-06  Corinna Vinschen  <corinna@vinschen.de>
1667
1668         * cygserver.h (CYGWIN_SERVER_VERSION_API): Bump.
1669         * cygserver_ipc.h (struct proc): Add signal_arrived member.
1670         (ipc_set_proc_info): Inititalize blk.signal_arrived.
1671
1672 2004-02-06  Pierre Humblet <pierre.humblet@ieee.org>
1673
1674         * uinfo.cc (cygheap_user::init): Use sec_user_nih to build a
1675         security descriptor. Set both the process and the default DACLs.
1676         * fork.cc (fork_parent): Use sec_none_nih security attributes.
1677         * spawn.cc (spawn_guts): Ditto.
1678
1679 2004-02-05  Christopher Faylor  <cgf@redhat.com>
1680
1681         * cygwin.din: Make many more functions SIGFE.
1682         * include/cygwin/version.h (CYGWIN_VERSION_SHARED_DATA): Bump.
1683
1684 2004-02-05  Pierre Humblet <pierre.humblet@ieee.org>
1685
1686         * security.h (SID): New macro.
1687         (well_known_*_sid): Change type to cygpsid.
1688         (cygsid::init): Delete declaration.
1689         * sec_helper.cc (well_known_*_sid): Define using above SID macro.
1690         (cygsid::init): Delete.
1691         * dcrt0.cc (dll_crt0_0): Do not call cygsid::init.
1692         * security.cc (get_user_local_groups): Change the second argument type
1693         to cygpsid.
1694
1695 2004-02-03  Christopher Faylor  <cgf@redhat.com>
1696
1697         * cygtls.h (_local_storage::signamebuf): Increase size to prevent
1698         overflow on really odd values.
1699         * tlsoffsets.h: Regenerate.
1700
1701 2004-02-03  Christopher Faylor  <cgf@redhat.com>
1702
1703         * Makefile.in (DLL_OFILES): Add strsig.o.
1704         * cygtls.h (_local_storage::signamebuf): New element.
1705         * sysconf.cc (sysconf): Implement _SC_RTSIG_MAX.
1706         * tlsoffsets.h: Regenerate.
1707         * include/limits.h (_POSIX_RTSIG_MAX): New define.
1708         (RTSIG_MAX): Ditto.
1709         * include/cygwin/signal.h (SIGRTMIN): New define.
1710         (SIGRTMAX): Ditto.
1711         (NSIG): Bump.
1712         * strsig.cc: New file.
1713
1714 2004-02-03  Jason Tishler <jason@tishler.net>
1715
1716         * window.cc (Winmain): Show windows error code in error output when
1717         RegisterClass fails.
1718
1719 2004-02-02  Christopher Faylor  <cgf@redhat.com>
1720
1721         * fhandler.h (*::fixup_after_exec): Eliminate unused handle argument.
1722         * fhandler.h (dtable::fixup_after_exec): Eliminate unused handle
1723         argument.
1724         * dcrt0.cc (dll_crt0_1): Reflect elimination of unused handle argument
1725         to fixup_after_exec.
1726         * dtable.cc (dtable::fixup_after_exec): Ditto.
1727         * fhandler_console.cc (fhandler_console::fixup_after_exec): Ditto.
1728         * fhandler_dsp.cc (fhandler_dsp::fixup_after_exec): Ditto.
1729         * fhandler_raw.cc (fhandler_raw::fixup_after_exec): Ditto.
1730         * fhandler_socket.cc (fhandler_socket::fixup_after_exec): Ditto.
1731         * fhandler_virtual.cc (fhandler_virtual::fixup_after_exec): Ditto.
1732         * pipe.cc (fhandler_pipe::fixup_after_exec): Ditto.
1733
1734 2004-02-02  Pierre Humblet <pierre.humblet@ieee.org>
1735
1736         * spawn.cc (spawn_guts): Do not set ciresrv.parent.
1737         * child_info.h (child_info_spawn::~child_info_spawn): Do not close
1738         parent.  Update CURR_CHILD_INFO_MAGIC.
1739         * dcrt0.cc (dll_crt0_0): Do not close spawn_info->parent.  Pass NULL to
1740         cygheap->fdtab.fixup_after_exec().
1741
1742 2004-02-02  Christopher Faylor  <cgf@redhat.com>
1743
1744         Throughout, change name from set_inheritance to set_no_inheritance to
1745         better reflect input arguments of this function.
1746
1747         * cygheap.h (CYGHEAPSIZE): Increase size of cygheap to something closer
1748         to the 21st century.
1749
1750 2004-02-02  Corinna Vinschen  <corinna@vinschen.de>
1751
1752         * cygerrno.h (set_errno): Replace semicolon with comma in non-DEBUGGING
1753         version to avoid compile time error.
1754
1755 2004-02-01  Christopher Faylor  <cgf@redhat.com>
1756
1757         * cygerrno.h (set_errno): Set global errno whenever setting thread
1758         specific version.
1759         * debug.cc (__set_errno): Ditto.
1760
1761         * exceptions.cc (handle_sigsuspend): Remove spurious
1762         sig_dispatch_pending call.
1763         (set_signal_mask): When there seem to be pending signals to dispatch,
1764         tell signal_dispatch_pending/sig_send not to specifically call any
1765         handlers.
1766         * sigproc.h (sig_dispatch_pending): Change declaration to void.
1767         * sigproc.cc (sig_dispatch_pending): Change definition to void.  Take
1768         an argument to determine whether to tell sig_send to wait for handler
1769         to be called.
1770         * sigproc.cc (sig_send): Don't call signal handler when sig ==
1771         __SIGFLUSHFAST.
1772         (wait_sig): Honor __SIGFLUSHFAST.  Guard against sigpacket::process
1773         nuking si_signo.
1774         * sigproc.h (__SIGFLUSHFAST): Define new special signal.
1775         (sig_dispatch_pending): Change declaration to void.  Take optional
1776         boolean argument.
1777
1778         * fork.cc (vfork): Add debugging output.
1779
1780 2004-01-26  Christopher Faylor  <cgf@redhat.com>
1781
1782         * exceptions.cc (sig_handle_tty_stop): Avoid races by waiting for both
1783         signal_arrived and for sigCONT.
1784         (sigpacket::process): Enforce sending of both signal_arrived and
1785         sigCONT, where appropriate.
1786         * gendef (sigreturn): Save tls pointer in ebx so that it can jump into
1787         sigdelayed and use the same register.
1788
1789 2004-01-26  Christopher Faylor  <cgf@redhat.com>
1790
1791         * cygtls.cc (_threadinfo::init_thread): Add more local reent stdio
1792         initialization.
1793         * dcrt0.cc (initial_env): Can it really be true that XP doesn't allow
1794         attaching a debugger during DLL attach?  Add temporary workaround.
1795         (dll_crt0_0): Ensure that _impure_ptr stdio is initialized before any
1796         threads.
1797         (dll_crt0_1): Move _impure_ptr initialization to dll_crt0_0.
1798         * exceptions.cc (try_to_debug): Reinstate old method for looping while
1799         debugging.
1800         * syscalls.cc (_cygwin_istext_for_stdio): Regularize debugging output.
1801         Remove hopefully extraneous check.
1802         (setmode_helper): Add debugging output for improbable case.  Use
1803         "binary" rather "raw" for consistency.
1804
1805 2004-01-25  Christopher Faylor  <cgf@redhat.com>
1806
1807         * fhandler.cc (fhandler_base::fhaccess): Avoid always setting errno to
1808         EACCESS when return value is < 0.  Rely on errno being set properly.
1809
1810 2004-01-25  Christopher Faylor  <cgf@redhat.com>
1811
1812         * sigproc.cc (proc_subproc): Don't protect *child's* handle.
1813
1814 2004-01-24  Christopher Faylor  <cgf@redhat.com>
1815
1816         * fhandler.h (fhandler_base::fhaccess): Return int for compatibility
1817         with access.
1818         * fhandler.cc (fhandler_base::fhaccess): Return int.  Use consistent
1819         variable name for exit value.  Exit at bottom, printing debugging
1820         information, like other cygwin functions.
1821
1822 2004-01-23  Christopher Faylor  <cgf@redhat.com>
1823
1824         * cygheap.cc (init_cygheap::close_ctty): Protect YA vforkism.
1825         * fhandler.h (fhandler_base::has_acls): Make pass through for path_conv
1826         method.
1827         (fhandler_base::isremote): Ditto.
1828         (fhandler_base::is_fs_special): Ditto.
1829         (fhandler_base::has_attribute): Ditto.  Define new function.
1830         (fhandler_base::fhaccess): Declare new function based on access_worker.
1831         (fhandler_base::set_has_acls): Eliminate obsolete function.
1832         (fhandler_base::set_isremote): Ditto.
1833         * fhandler.cc (fhandler_base::fhaccess): Move from syscalls.cc and into
1834         fhandler_base class.  Use fhandler methods to access data rather than
1835         path_conv stuff.
1836         (fhandler_base::device_access_denied): Use fhaccess method.
1837         * fhandler_disk_file.cc (fhandler_disk_file::opendir): Ditto.
1838         (fhandler_base::open_fs): Remove calls to obsolete functions.
1839         * fhandler_virtual.cc (fhandler_virtual::open): Ditto.
1840         * winsup.h (access_worker): Remove obsolete access_worker declaration.
1841         *syscalls.cc (access_worker): Move function to fhandler.cc.
1842         (access): Use fhaccess method.
1843
1844         * pinfo.cc (_pinfo::set_ctty): Clarify debugging output.
1845         * sigproc.cc (sig_dispatch_pending): Ditto.
1846         * syscalls.cc (setsid): Perform minor rearrangement.
1847
1848 2004-01-23  Pierre Humblet <pierre.humblet@ieee.org>
1849
1850         * fhandler_socket.cc (fhandler_socket::create_secret_event): Avoid
1851         creating multiple handles. Always allow event inheritance but set the
1852         handle inheritance appropriately. Improve error handling.
1853         (fhandler_socket::check_peer_secret_event): Improve error handling.
1854         (fhandler_socket::close_secret_event): Simply call CloseHandle.
1855         (fhandler_socket::set_close_on_exec): Set secret event inheritance.
1856
1857 2004-01-23  Christopher Faylor  <cgf@redhat.com>
1858
1859         * configure.in: Remove NEWVFORK default.
1860         * configure: Regenerate.
1861         * dcrt0.cc: Conditionalize vfork stuff throughout.
1862         * dtable.cc: Ditto.
1863         * perthread.h: Ditto.
1864         * pipe.cc (fhandler_pipe::close): Ditto.
1865         * spawn.cc (spawnve): Ditto.
1866         * syscalls.cc (setsid): Ditto.
1867         * exceptions.cc (sigpacket::process): Use macro to refer to vfork pid.
1868
1869         * debug.cc (verify_handle): Define new function.
1870         * debug.h (VerifyHandle): Define new macro.
1871         (verify_handle): Declare new function
1872         * fhandler.cc (fhandler_base::dup): Verify that dup'ed handle is not
1873         supposed to be in use.
1874         (fhandler_base::set_inheritance): Ditto.
1875         (fhandler_base::fork_fixup): Ditto.
1876         * fhandler_socket.cc (fhandler_socket::dup): Ditto.
1877         * fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
1878         * net.cc (set_socket_inheritance): Ditto.
1879         * pinfo.cc (pinfo_fixup_after_exec): Ditto.
1880         * sigproc.cc (proc_subproc): Ditto.
1881         (sig_send): Ditto.
1882         * spawn.cc (spawn_guts): Ditto.
1883         * thread.cc (pthread::init_mainthread): Ditto.
1884         * pipe.cc (fhandler_pipe::close): Close read_state with
1885         ForceCloseHandle since it was protected.
1886         (fhandler_pipe::fixup_after_exec): Protect read_state handle.
1887         (fhandler_pipe::dup): Correctly close open handles on error condition.
1888         Verify that dup'ed handle is not supposed to be in use.
1889         (fhandler_pipe::create): Protect read_state.
1890
1891 2004-01-23  Christopher Faylor  <cgf@redhat.com>
1892
1893         * exceptions.cc (sig_handle_tty_stop): Fix boneheaded mistake by using
1894         correct check for parent state rather than inverted check mistakenly
1895         introduced on 2003-09-15.
1896
1897 2004-01-22  Brian Ford  <ford@vss.fsi.com>
1898
1899         * fhandler_serial.cc (fhandler_serial::raw_write): Prevent a deadlock
1900         when the input buffer overflows.
1901         (fhandler_serial::raw_read): Correct to print the actual error and only
1902         call PurgeComm when necessary.
1903
1904 2004-01-22  Christopher Faylor  <cgf@redhat.com>
1905
1906         * dcrt0.cc (reent_data): Make global.
1907         * cygwin.din: Reexport reent_data.
1908
1909 2004-01-22  Christopher Faylor  <cgf@redhat.com>
1910
1911         * cygtls.cc (_threadinfo::remove): Don't assume that we are removing
1912         _my_tls.
1913         * exceptions.cc (setup_handler): Improve debugging output.
1914         (call_signal_handler_now): Remove ill-advised debugger call.
1915         * sigproc.cc (sigcomplete_main): Delete.
1916         (sig_send): Honor FIXME and avoid using main thread's completion event
1917         for everything or suffer races.
1918         (pending_signals::add): Default stored mask to current process mask
1919         rather than mask at time of signal send.
1920         (wait_sig): Add debugging output.
1921         * sigproc.h (sigpacket::mask_storage): Delete.
1922
1923 2004-01-22  Christopher Faylor  <cgf@redhat.com>
1924
1925         * fhandler.cc (fhandler_base::open): Revert isfs change.
1926
1927 2004-01-21  Christopher Faylor  <cgf@redhat.com>
1928
1929         * devices.in: Change raw com device to more correct form.
1930
1931 2004-01-21  Christopher Faylor  <cgf@redhat.com>
1932
1933         * fhandler.cc (fhandler_base::open): Use major numbers rather than
1934         device numbers to control special behavior for devices which take
1935         units.
1936         * fhandler_raw.cc (fhandler_dev_raw::writebuf): Ditto.
1937         (fhandler_dev_raw::fstat): Ditto.
1938         (fhandler_dev_raw::open): Ditto.
1939         (fhandler_dev_raw::ioctl): Ditto.
1940
1941 2004-01-21  Nicholas Wourms  <nwourms@netscape.net>
1942
1943         * signal.cc (sigaction): Fix if-statement typo.
1944
1945 2004-01-21  Christopher Faylor  <cgf@redhat.com>
1946
1947         * cygtls.cc (handle_threadlist_exception): Change logic, improve
1948         debugging output.
1949
1950 2004-01-21  Christopher Faylor  <cgf@redhat.com>
1951
1952         * fhandler_tty.cc (fhandler_tty::ioctl): Semi-revert 2003-09-26 change
1953         for TIOCSWINSZ.  It is not an error for ioctl_request_event to be
1954         missing.
1955
1956 2004-01-20  Christopher Faylor  <cgf@redhat.com>
1957
1958         * sigproc.cc (pending_signals::save): New function.
1959         (pending_signals::restore): Ditto.
1960         (sig_clear): Save/restore current queue pointer.
1961         (wait_sig): Delete signals marked as such.
1962         * sigproc.h (__SIGDELETE): New enum.
1963
1964 2004-01-20  Christopher Faylor  <cgf@redhat.com>
1965
1966         * include/cygwin/version.h: Bump DLL minor number to 8.
1967
1968         * cygmalloc.h: Make more concessions to attempts to get debugging
1969         malloc working.
1970         * debug.h: Ditto.
1971         * dlmalloc.cc: Ditto.
1972         * dlmalloc.h: Ditto.
1973         * malloc_wrapper.cc: Ditto.
1974
1975         * perthread.h (perthread::create): Use calloc to ensure zeroed memory.
1976
1977 2004-01-20  Christopher Faylor  <cgf@redhat.com>
1978
1979         * sec_acl.cc (setacl): Make sure sd_ret is large enough.
1980
1981 2004-01-19  Christopher Faylor  <cgf@redhat.com>
1982
1983         * sigproc.cc (sigproc_terminate): Don't close sendsig handle when
1984         execing since we're not closing what we think we're closing.
1985         (sig_send): Improve debugging when exiting due to no_signals_available.
1986
1987         * wincap.h (wincaps::cant_debug_dll_entry): New element.
1988         * wincap.cc: Implement above element throughout.
1989         * dcrt0.cc (initial_env): Accommodate changes necessary to allow
1990         initial debugging for systems which do not allow debugging in
1991         dll_entry.
1992         (dll_crt0_0): Add initial_env call back here.
1993
1994         * Makefile.in (install-man): Use mandir as target for installation.
1995
1996 2004-01-19  Christopher Faylor  <cgf@redhat.com>
1997
1998         * include/cygwin/version.h: Bump DLL minor number to 7 (should have been
1999         done earlier).
2000
2001 2004-01-19  Christopher Faylor  <cgf@redhat.com>
2002
2003         * cygwin/include/signal.h: Add copyright notice.
2004
2005         * cygwin.din: Make clock SIGFE.  Add clock_gettime, sigwaitinfo,
2006         timer_create, timer_delete, timer_settime.
2007         * include/cygwin/version.h: Reflect above additions.
2008         * fork.cc (fork_child): Call fixup_timers_after_fork.
2009         * signal.cc (sigwait): Remove unused variable.
2010         * timer.cc: New file.
2011         (clock_gettime): Define new function.
2012         (timer_tracker): Define new struct used by timer functions.
2013         (timer_tracker::timer_tracker): New function.
2014         (to_us): New function.
2015         (timer_thread): New function.
2016         (timer_tracker::settime): New function.
2017         (timer_create): New function.
2018         (timer_settime): New function.
2019         (timer_delete): New function.
2020         (fixup_timers_after_fork): New function.
2021         * cygthread.cc: Bump thread count.
2022
2023 2004-01-17  Christopher Faylor  <cgf@redhat.com>
2024
2025         * signal.cc (sigwaitinfo): Define new function.
2026         (sigwait): Redefine based on sigwaitinfo.
2027         * include/cygwin/signal.h (sigwaitinfo): Declare.
2028         (sigwait): Ditto.
2029
2030 2004-01-17  Christopher Faylor  <cgf@redhat.com>
2031
2032         * dtable.cc (dtable::vfork_parent_restore): Avoid double close of ctty
2033         when ctty == ctty_on_hold.
2034
2035 2004-01-16  Christopher Faylor  <cgf@redhat.com>
2036
2037         * cygtls.h (_threadinfo::threadkill): New element.
2038         (_threadinfo::set_threadkill): Declare new function.
2039         (_threadinfo::reset_threadkill): Declare new function.
2040         * dcrt0.cc (dcrt0_1): Call here so that it will be possible to attach
2041         to running process with #(*& Windows Me/9x.
2042         (initial_env): Try to initialize strace if uninitialized.
2043         * gendef: Don't zero signal if threadkill is set since that will happen
2044         in the called function.
2045         * signal.cc (sigwait): Ensure cleanup in error conditions.
2046         * sigproc.cc (sig_send): Clear packet mask storage.
2047         (wait_subproc): Fill in child exit code in siginfo_t structure.
2048         * thread.cc (pthread_kill): Set threadkill flag.
2049         * tlsoffsets.h: Regenerate.
2050
2051 2004-01-16  Christopher Faylor  <cgf@redhat.com>
2052
2053         Throughout, use siginfo_t to fill out all signal information for
2054         "kernel" signals.
2055         * cygtls.h (_threadinfo::set_siginfo): Declare new function.
2056         * cygtls.cc (_threadinfo::set_siginfo): Define new function.
2057         * dcrt0.cc (do_exit): Accommodate siginfo_t considerations.
2058         * exceptions.cc (handle_exceptions): Ditto.
2059         (sig_handle_tty_stop): Ditto.
2060         (ctrl_c_handler): Use killsys() to send signal.
2061         (sigpacket::process): Rename from sig_handle.  Use siginfo_t field from
2062         sigpacket for everything.
2063         (tty_min::kill_pgrp): Accommodate siginfo_t considerations.
2064         (fhandler_termios::bg_check): Ditto.
2065         * fhandler_tty.cc (fhandler_tty_slave::ioctl): Use killsys() to send signal.
2066         * signal.cc (kill_worker): Rewrite to use siginfo_t second argument.
2067         (kill_pgrp): Ditto.
2068         (kill0): Define new function pulled from kill().
2069         (kill): Rewrite as frontend to kill0.
2070         (killsys): Define new function.
2071         * sigproc.cc (sigelem): Eliminate.
2072         (sigpacket): Move to sigproc.h.  Subsume sigelem.
2073         (pending_signals): Use sigpacket rather than sigelem for everything.
2074         (sig_clear): Ditto.
2075         (wait_sig): Ditto.
2076         (sig_send): Rewrite to use siginfo_t argument.
2077         (sig_send): New function wratpper to sig_send with siginfo_t argument.
2078         (wait_subproc): Accommodate siginfo_t considerations.
2079         * thread.cc (pthread_kill): Ditto.
2080         * sigproc.h (sigpacket): Move here.
2081         (sigpacket::process): Declare "new" function.
2082         (sig_handle): Eliminate declaration.
2083         (sig_send): Declare with new paramaters.
2084         (killsys): Declare new function.
2085         (kill_pgrp): Declare.
2086         * winsup.h: Move some signal-specific stuff to sigproc.h.
2087         * include/cygwin/signal.h: Tweak some siginfo_t stuff.
2088
2089 2004-01-16  Christopher Faylor  <cgf@redhat.com>
2090
2091         * fhandler_console.cc (fhandler_console::close): Remove obsolete test
2092         for vfork_cleanup.
2093         * pipe.cc (fhandler_pipe::close): Add comment.
2094
2095 2004-01-16  Christopher Faylor  <cgf@redhat.com>
2096
2097         * cygheap.cc (init_cygheap::close_ctty): Don't NULL ctty if it is still
2098         active.
2099
2100 2004-01-16  Christopher Faylor  <cgf@redhat.com>
2101
2102         * dtable.cc (dtable::vfork_parent_restore): Store ctty_on_hold prior to
2103         calling close_all_files since it will be zeroed.
2104
2105 2004-01-15  Christopher Faylor  <cgf@redhat.com>
2106
2107         * gentls_offsets: Reinstate unlink of temp files.
2108
2109 2004-01-14  Christopher Faylor  <cgf@redhat.com>
2110
2111         * fhandler_console.cc (fhandler_console::close): Fix debugging output.
2112         (fhandler_console::fixup_after_fork): Decrement open_fhs prior to call
2113         to fhandler_console::open since this would cause incrementing too much
2114         incrementing in child processes.  (Probably needs to be handled more
2115         elegantly someday)
2116         (fhandler_console::fixup_after_exec): Ditto.
2117
2118 2004-01-14  Christopher Faylor  <cgf@redhat.com>
2119
2120         * cygtls.h (_threadinfo::call): Remove regparm declaration to work
2121         around compiler bug.
2122
2123 2004-01-13  Christopher Faylor  <cgf@redhat.com>
2124
2125         * autoload.cc (TryEnterCriticalSection): Remove.
2126         * dcrt0.cc (dll_crt0_0): Delete inappropriate setting of
2127         _my_tls.stackptr to NULL since it has really bad consequences.  Make
2128         'si' an automatic variable.
2129
2130 2004-01-13  Christopher Faylor  <cgf@redhat.com>
2131
2132         * cygtls.cc (_threadinfo::init_thread): Correct thinko which caused
2133         thread list to be allocated every time.
2134         * cygtls.h (CYGTLS_PADSIZE): Define as const int.
2135         * sync.h: Make multiple inclusion safe.
2136         (muto::next): Eliminate.
2137         (muto::exiting_thread): New variable.
2138         (muto::set_exiting_thread): New function.
2139         (new_muto): Change to use different section for mutos since c++ give
2140         inexplicable warning in some cases otherwise.
2141         (new_muto1): Ditto.
2142         * dcrt0.cc (do_exit): Call muto::set_exiting_thread here.
2143         * sync.cc (muto_start): Eliminate.
2144         (muto::acquire): Always give exiting thread a lock.  Never give thread
2145         a lock if exiting.
2146         (muto::release): Ditto for releasing.
2147         * dtable.cc (dtable::init_lock): Unline function and define here.
2148         * dtable.h (lock_cs): Define as a muto since critical sections seem to
2149         work oddly on Windows Me.
2150         (lock): Accommodate switch to muto.
2151         (unlock): Ditto.
2152         * exceptions.cc (setup_handler): Don't worry about acquiring mutos
2153         since that hasn't mattered for a long time.
2154         (signal_exit): Ditto: muto stuff will be handled automatically on exit
2155         now.
2156
2157 2004-01-12  Christopher Faylor  <cgf@redhat.com>
2158
2159         * Makefile.in (DLL_IMPORTS): Link advapi32 to ensure proper DLL
2160         initialization.
2161         * autoload.cc (RegCloseKey): Arbitrarily choose this function as a
2162         "seed" to pull the advapi32 link library in.  So, comment out the
2163         autoloading.
2164         * cygtls.cc (_threadinfo::init_thread): Just clear CYGTLS_PADSIZE.
2165         (_threadinfo::remove): Add debugging.
2166         (_threadinfo::find_tls): Ditto.
2167         * cygtls.h (_threadinfo::padding): Make zero length (for now?).
2168         * dcrt0.cc (dll_crt0_0): Move more initialization here from dll_crt0_1.
2169         (dll_crt0_1): See above.
2170         * dtable.h (dtable::lock): Remove commented out critical section
2171         locking.
2172         * dtable.h (dtable::init_lock): Remove commented out critical section
2173         locking.
2174         * dtable.h (dtable::unlock): Remove commented out critical section
2175         locking.
2176         * exceptions.cc (interruptible): bool'ize.
2177         * init.cc (threadfunc_fe): Revert to storing threadfunc at stack
2178         bottom.
2179         (munge_threadfunc): Ditto.  Avoid adding overhead to
2180         calibration_thread.
2181         (prime_threads): Don't initialize tls stuff.
2182         (dll_entry): Make minor change to initialization order.
2183         * tlsoffsets.h: Regenerate.
2184
2185         * sigproc.cc (wait_sig): Add sanity check for end of process thread
2186         exit.
2187
2188         * select.h: Make minor formatting change.
2189
2190 2004-01-10  Christopher Faylor  <cgf@redhat.com>
2191
2192         * Makefile.in: Add still more -fomit-frame-pointer functions.
2193         * dtable.h (dtable::lock): New function.
2194         (dtable::unlock): New function.
2195         (dtable::init_lock): New function.
2196         * cygheap.h (HEAP_TLS): Declare new enum value.
2197         (init_cygheap::threadlist): Declare new array.
2198         (init_cygheap::sthreads): Declare new variable.
2199         (cygheap_fdmanip::~cygheap_fdmanip): Use new dtable lock/unlock
2200         functions.
2201         (cygheap_fdnew::cygheap_fdnew): Ditto.
2202         (cygheap_fdget::cygheap_fdget): Ditto.
2203         * dtable.cc (dtable_init): Initialize fdtab critical section.
2204         (dtable::fixup_after_fork): Ditto.
2205         (dtable::fixup_after_exec): Ditto.
2206         (dtable::dup2): Use lock/unlock calls to protect access to fdtab.
2207         (dtable::find_fifo): Ditto.
2208         (dtable::fixup_before_fork): Ditto.
2209         (dtable::fixup_before_exec): Ditto.
2210         (dtable::set_file_pointers_for_exec): Ditto.
2211         (dtable::vfork_child_dup): Ditto.
2212         (dtable::vfork_parent_restore): Ditto.
2213         * syscalls.cc (close_all_files): Ditto.
2214         * sync.h (muto::acquired): Declare new function.
2215         (new_muto1): Declare new macro used to specify name of muto storage.
2216         * sync.cc (muto::acquired): Define new function.
2217
2218         * cygthread.cc (cygthread::stub): Remove signal chain removal call
2219         since it is handled during initialization now.
2220         * cygthread.cc (cygthread::simplestub): Remove signal chain removal
2221         call since it is handled during initialization now.
2222         * cygtls.cc (sentry): New class used for locking.  Use throughout.
2223         (_threadinfo::reset_exception): Don't pop stack.
2224         (_threadinfo::find_tls): Move from exceptions.cc.
2225         (_threadinfo::init_thread): Initialize array of threads rather than
2226         linked list.  Take second argument indicating thread function for this
2227         thread.
2228         (_threadinfo::remove): Search thread array rather than linked list.
2229         Use sentry to lock.  Only unlock if we got the lock.
2230         (_threadinfo::find_tls): Ditto for first two.
2231         (handle_threadlist_exception): Handle exceptions when manipulating the
2232         thread list in case of premature thread termination.
2233         (_threadinfo::init_threadlist_exceptions): Ditto.
2234         * cygtls.h (TLS_STACK_SIZE): Decrease size.
2235         (_threadinfo::padding): Add element to avoid overwriting lower part of
2236         stack.
2237         (_threadinfo::remove): Add a "wait" argument to control how long we
2238         wait for a lock before removing.
2239         * exceptions.cc (init_exception_handler): Make global.  Take argument
2240         to control exception handler being set.
2241         (ctrl_c_handler): Wait forever when removing self from signal chain.
2242         (_threadinfo::find_tls): Move to cygtls.cc.
2243         (sig_handle): Reorganize detection for thread-specific signals.
2244         * heap.cc (heap_init): Rework slightly.  Make fatal error more verbose.
2245         Remove malloc initialization since it can't happen during dll attach.
2246         * init.cc (search_for): Move address to search for on stack here.
2247         (threadfunc_ix): Ditto for stack offset.  Make shared so that stack
2248         walk potentially only has to be done once when cygwin processes are
2249         running.
2250         (threadfunc_fe): Use standard tls to store thread function (may change
2251         back later).
2252         (calibration_thread): New function.  Potentially called to find
2253         threadfunc_ix.
2254         (munge_threadfunc): Search for "search_for" value on stack.  Output
2255         warning when thread func not found on stack.  Use standard tls to store
2256         thread function.
2257         (prime_threads): New function.  Called to prime thread front end.
2258         (dll_entry): Call dll_crt0_0 here when DLL_PROCESS_ATTACH.  Call
2259         prime_threads here.  Try to remove thread from signal list here.
2260         * sigproc.cc (wait_sig): Initialize threadlist exception stuff here.
2261         * thread.cc (pthread::exit): Pass argument to signal list remove
2262         function.
2263         * thread.h: Remove obsolete *ResourceLock defines.
2264
2265         * tlsoffsets.h: Regenerate.
2266
2267         * winsup.h (spf): Define temporary debug macro to be deleted later.
2268
2269         * dcrt0.cc (dll_crt0_0): New function, called during DLL
2270         initialization.  Mainly consists of code pulled from dll_crt0_1.
2271         (dll_crt0_1): See above.
2272         (_dll_crt0): Wait for initial calibration thread to complete, if
2273         appropriate.  Move some stuff to dll_crt0_0.
2274         (initialize_main_tls): Accommodate argument change to
2275         _thread_info::init_thread.
2276         * fork.cc (fork_child): Ditto.
2277         (sync_with_child): Fix debug message.
2278         * external.cc (cygwin_internal): Remove special considerations for
2279         uninitialized dll since initialization happens during dll attach now.
2280
2281         * dlfcn.cc (dlopen): Remove obsolete *ResourceLock calls.
2282         (dlclose): Ditto.
2283
2284 2004-01-05  Christopher Faylor  <cgf@redhat.com>
2285
2286         * cygheap.h (init_cygheap::close_ctty): Declare new function.
2287         * cygheap.cc (init_cygheap::close_ctty): Define new function.
2288         * syscalls.cc (close_all_files): Use close_ctty.
2289         (setsid): Ditto.
2290
2291         * cygthread.cc (cygthread::stub): Remove exception initialization.
2292         * cygthread.cc (cygthread::stub): Remove exception initialization.
2293         (cygthread::simplestub): Ditto.
2294         * thread.cc (pthread::thread_init_wrapper): Ditto.
2295         * cygtls.cc (_last_thread): Make static.
2296         (_threadinfo::call2): Initialize exception handler here.
2297         (_threadinfo::find_tls): Move here.
2298         * exceptions.cc (_threadinfo::find_tls): Move.
2299
2300         * dcrt0.cc (__api_fatal): Add prefix info to message here rather than
2301         including it in every call to function.
2302         * winsup.h (api_fatal): Accommodate above change.
2303         * debug.cc (add_handle): Don't do anything if cygheap not around.
2304         (mark_closed): Ditto.
2305
2306         * dll_init.cc (dll_list::detach): Fix debug output.
2307         * fork.cc (sync_with_child): Ditto.
2308         (vfork): Improve debug output.
2309         * heap.cc (heap_init): Ditto.
2310
2311         * exceptions.cc (try_to_debug): Clarify message when debugger attaches.
2312
2313 2004-01-03  Christopher Faylor  <cgf@redhat.com>
2314
2315         * exceptions.cc (_threadinfo::interrupt_now): Avoid double call to
2316         sigdelayed.
2317         * pinfo.cc (_pinfo::commune_send): Avoid inexplicable test which caused
2318         most pids to be shown as "<defunct>" on Win9x.
2319
2320 2004-01-02  Christopher Faylor  <cgf@redhat.com>
2321
2322         * cygheap.h (init_cygheap): Play more vfork shell games and move
2323         ctty_on_hold and open_fhs_on_hold (back) here.
2324         * dcrt0.cc (_dll_crt0): Just set impure_ptr_ptr here and let later
2325         initialization deal with tls.
2326         * dtable.cc (dtable::vfork_child_fixup): Move ctty considerations here.
2327         (dtable:vfork_parent_restore): And here.
2328         * fork.cc (vfork): Reflect change to ctty handling.
2329         * perthread.h (vfork_save::fhctty): Eliminate.
2330
2331         * cygwin.din: Make more exports NOSIGFE that will never be interrupted
2332         by a signal.
2333
2334         * init.cc (dll_entry): Set stackptr to NULL to catch problems earlier.