OSDN Git Service

* net.cc (cygwin_getnameinfo): Fix typo in comment.
[pf3gnuchains/pf3gnuchains4x.git] / winsup / cygwin / ChangeLog
1 2006-10-20  Corinna Vinschen  <corinna@vinschen.de>
2
3         * net.cc (cygwin_getnameinfo): Fix typo in comment.
4
5 2006-10-19  Corinna Vinschen  <corinna@vinschen.de>
6
7         * fhandler.h (fhandler_base::set_name): Make virtual.
8         (class fhandler_registry): Add wow64 and prefix_len members.
9         Declare set_name method.
10         * fhandler_proc.cc (PROC_REGISTRY32): Define.
11         (PROC_REGISTRY64): Define.
12         (proc_listing): Add "registry32" and "registry64" elements.
13         (proc_fhandlers): Add corresponding FH_REGISTRY values.
14         * fhandler_registry.cc (registry_len): Drop static value in favor of
15         class member prefix_len.  Use preifx_len instead of registry_len
16         throughout.
17         (fhandler_registry::set_name): Define.  Set wow64 and prefix_len
18         according to directory prefix.
19         (fhandler_registry::fhandler_registry): Set wow64 and prefix_len to
20         default values.
21         (open_key): Add wow64 argument.  Handle wow64 in call to RegOpenKeyEx.
22         Use fhandler_registry member wow64 in this place throughout.
23
24 2006-10-19  Corinna Vinschen  <corinna@vinschen.de>
25
26         * fhandler_proc.cc: Drop superfluous definition of _WIN32_WINNT.
27         * miscfuncs.cc: Ditto.
28         * sched.cc: Ditto.
29
30 2006-10-17  Corinna Vinschen  <corinna@vinschen.de>
31
32         * glob.c: Remove.
33         * glob.cc: New file.  Latest glob version from FreeBSD plus Cygwin
34         specific changes (__stat64/__stat32, ignore_case_with_glob,
35         drop collate functions).
36         (glob3): Return GLOB_ABORTED in case directory is unreadable and
37         GLOB_ERR is set, as demanded by SUSv3.
38         * glob.h: Import latest version from FreeBSD.
39
40 2006-10-17  Corinna Vinschen  <corinna@vinschen.de>
41
42         * winsup.h (WINVER): Define instead of _WIN32_WINNT.  Set to 0x0502.
43         (_NO_W32_PSEUDO_MODIFIERS): Define.
44
45 2006-10-16  Corinna Vinschen  <corinna@vinschen.de>
46
47         * fhandler_disk_file.cc (fhandler_disk_file::opendir): Drop redundant
48         access check.
49
50 2006-10-16  Corinna Vinschen  <corinna@vinschen.de>
51
52         * include/asm/byteorder.h: Fix copyright dates.
53
54 2006-10-16  Corinna Vinschen  <corinna@vinschen.de>
55
56         * autoload.cc (PrivilegeCheck): Define.
57         * fhandler.cc (fhandler_base::open): Always try opening with backup
58         resp. restore intent.
59         * fhandler_disk_file.cc (fhandler_disk_file::opendir): Always try
60         opening with backup intent.
61         (fhandler_disk_file::readdir): Ditto when trying to retrieve file id
62         explicitely.
63         * security.cc (check_file_access): Replace pbuf with correctly 
64         PPRIVILEGE_SET typed pset.  Check explicitely for backup and/or restore
65         privileges when AccessCheck fails, to circumvent AccessCheck
66         shortcoming.  Add comment to explain.
67
68 2006-10-13  Christopher Faylor  <cgf@timesys.com>
69
70         * winsup.h: Turn off DEBUGGING.
71
72 2006-10-13  Corinna Vinschen  <corinna@vinschen.de>
73
74         * autoload.cc (Wow64DisableWow64FsRedirection): Define.
75         (Wow64RevertWow64FsRedirection): Define.
76         * security.cc (cygsuba_installed): New shared variable to store result
77         of cygsuba.dll installation test.
78         (subauth): Check if cygsuba.dll has been installed and registered
79         before issuing the (sub)authentication.
80
81 2006-10-12  Corinna Vinschen  <corinna@vinschen.de>
82
83         * security.cc (create_token): Fix condition for source identifier.
84
85 2006-10-11  Corinna Vinschen  <corinna@vinschen.de>
86
87         * select.cc (struct socketinf): Convert ser_num and w4 to dynamically
88         allocated arrays.  Add max_w4 member to keep track.
89         (thread_socket): Make timeout depending on number of sockets to wait
90         for.  Loop WFMO over all sockets.
91         (start_thread_socket): Handle any number of sockets.  Fix typo.  Don't
92         close socket event in out of memory condition.
93         (socket_cleanup): Free ser_num and w4.
94
95 2006-10-06  David Jade  <d3@mutable.net>
96
97         * path.cc (path_conv::get_nt_native_path): Properly detect \\?\ paths.
98         (mount_info::conv_to_win32_path): Update comment.
99         * fhandler_disk_file.cc (path_conv::ndisk_links): Use backslashes
100         to make NT kernel functions work for \\?\GLOBALROOT paths.
101
102 2006-10-09  Corinna Vinschen  <corinna@vinschen.de>
103
104         * devices.in: Raise number of handled serial ports to 64.
105         * devices.cc: Regenerate.
106
107 2006-09-17  Danny Smith  <dannysmith@clear.net.nz>
108
109         * include/asm/byteorder.h: Correct typo.
110
111 2006-09-17  Danny Smith  <dannysmith@clear.net.nz>
112
113         * include/asm/byteorder.h: Don't #define n* macros if -fnoinline is
114         specified.
115
116 2006-09-07  Christopher Faylor  <cgf@timesys.com>
117
118         * environ.cc (build_env): Don't put an empty environment variable into
119         the environment.  Optimize use of "len".
120         * errno.cc (ERROR_MORE_DATA): Translate to EMSGSIZE rather than EAGAIN.
121
122 2006-08-31  Corinna Vinschen  <corinna@vinschen.de>
123
124         * grp.cc (initgroups32): Run get_server_groups under original token.
125         * syscalls.cc (seteuid32): Slightly reorganize code creating a token.
126
127 2006-08-27  Christopher Faylor  <cgf@timesys.com>
128
129         * child_info.h (child_info_spawn::~child_info_spawn): Don't close
130         myself_pinfo handle when spawning.
131
132 2006-08-20  Corinna Vinschen  <corinna@vinschen.de>
133
134         * fhandler_disk_file.cc (fhandler_disk_file::opendir): Fix formatting.
135
136 2006-08-20  Corinna Vinschen  <corinna@vinschen.de>
137
138         * fhandler_disk_file.cc (DIR_NUM_ENTRIES): Set to 100 to maximize
139         performance on remote shares.
140         (fhandler_disk_file::opendir): Move comment about Samba weirdness into
141         fhandler_disk_file::readdir.  Don't disallow
142         FileIdBothDirectoryInformation on Samba.
143         (fhandler_disk_file::readdir): Workaround Samba problem with
144         FileIdBothDirectoryInformation by rereading already read entries
145         using FileBothDirectoryInformation.  Change comment about Samba
146         weirdness explaining this change.
147
148 2006-08-20  Hideki Iwamoto  <h-iwamoto@kit.hi-ho.ne.jp>
149
150         * fhandler_disk_file.cc (fhandler_disk_file::pread): Properly check for
151         non-error return from lseek.
152
153 2006-08-17  Corinna Vinschen  <corinna@vinschen.de>
154
155         * fhandler_serial.cc (raw_read): Evaluate minchars taking the
156         vmin_ > ulen case into account.  Simplify evaluating the bytes to read.
157         Don't use bytes in Queue value from ClearCommError call in case vtime_
158         is > 0.  Reformat GetOverlappedResult call.  Simplify call to ReadFile.
159
160 2006-08-14  Corinna Vinschen  <corinna@vinschen.de>
161
162         * security.cc (subauth): Initialize user_token to NULL.  Add comment.
163
164 2006-08-11  Corinna Vinschen  <corinna@vinschen.de>
165
166         * shared.cc (open_shared): Desperately try to get shared memory, only
167         when DEBUGGING enabled for now.
168
169 2006-08-10  Christopher Faylor  <cgf@timesys.com>
170
171         * pinfo.cc (_onreturn::~onreturn): Don't attempt to close a NULL
172         handle.
173
174 2006-08-10  Christopher Faylor  <cgf@timesys.com>
175
176         * winsup.h: Turn on DEBUGGING by default for now.
177
178 2006-08-10  Corinna Vinschen  <corinna@vinschen.de>
179
180         * fhandler_disk_file.cc (fhandler_disk_file::lock): Handle
181         ERROR_NOT_LOCKED returned from UnlockFileEx.
182
183 2006-08-09  Corinna Vinschen  <corinna@vinschen.de>
184
185         * path.h (SYMLINK_EA_NAME): Remove.
186         (SHORTCUT_HDR_SIZE): Ditto.
187
188 2006-08-09  Christopher Faylor  <cgf@timesys.com>
189
190         * autoload.cc (GetHandleInformation): Declare new function.
191         (SetHandleInformation): Ditto.
192         * debug.cc (add_handle): Use SetHandleInformation to protect handle.
193         (close_handle): Use SetHandleInformation to unprotect handle.
194
195         * spawn.cc (spawn_guts): Move detached test outside of P_OVERLAY block.
196
197 2006-08-07  Corinna Vinschen  <corinna@vinschen.de>
198
199         * autoload.cc (NtSetInformationFile): Define.
200         * cygwin.din: Export posix_fadvise and posix_fallocate.
201         * fhandler.cc (fhandler_base::fadvise): New method.
202         (fhandler_base::ftruncate): Add allow_truncate parameter.
203         * fhandler.h (class fhandler_base): Add fadvise method.  Accomodate
204         new parameter to ftruncate.
205         (class fhandler_pipe): Add fadvise and ftruncate methods.
206         (class fhandler_disk_file): Add fadvise method.  Accomodate new
207         parameter to ftruncate.
208         * fhandler_disk_file.cc (fhandler_disk_file::fadvise): New method.
209         (fhandler_disk_file::ftruncate): Accomodate new allow_truncate
210         parameter.  Set EOF using NtSetInformationFile on NT.
211         * ntdll.h (struct _FILE_END_OF_FILE_INFORMATION): Define.
212         (NtSetInformationFile): Declare.
213         * pipe.cc (fhandler_pipe::fadvise): New method.
214         (fhandler_pipe::ftruncate): Ditto.
215         * syscalls.cc (posix_fadvise): New function.
216         (posix_fallocate): Ditto.
217         (ftruncate64): Accomodate second parameter to fhandler's ftruncate
218         method.
219         * include/fcntl.h: Add POSIX_FADV_* flags.  Add declarations of
220         posix_fadvise and posix_fallocate.
221         * include/cygwin/version.h: Bump API minor number.
222
223 2006-08-02  Christopher Faylor  <cgf@timesys.com>
224
225         * environ.cc (env_win32_to_posix_path_list): Declare.
226         (conv_envvars): Use env_win32_to_posix_path_list rather than
227         cygwin_win32_to_posix_path_list.
228         (posify): Translate back to win32 path if errno is EIDRM.
229         * environ.h: Update copyright.  Define ENV_CVT.
230         * path.cc (conv_path_list): If converting for the environment and
231         removed an element set errno to ENV_CVT.
232         (env_win32_to_posix_path_list): New function.
233
234 2006-08-01  Christopher Faylor  <cgf@timesys.com>
235
236         * environ.cc (dos_file_warning): Declare.
237         (parse_thing): Add "dosfilewarning".  Alphabetize.
238         * path.cc (normalize_posix_path): Return -1 when MS-DOS path detected.
239         (warn_msdos): New function.
240         (path_conv::check): Call if !PC_NOWARN and MS-DOS path detected.
241         (cygwin_conv_to_win32_path): Set PC_NOWARN when calling path_conv.
242         (cygwin_conv_to_full_win32_path): Ditto.
243         * path.h (pathconv_arg::PC_NOWARN): Define.
244         * shared_info.h (user_info::warned_msdos): New field.
245         (CURR_USER_MAGIC): Reset.
246
247 2006-07-31  Corinna Vinschen  <corinna@vinschen.de>
248
249         * fhandler_socket.cc (fhandler_socket::recv_internal): Fix a problem
250         with poll(2) after shutdown(SHUT_RD) has been called on the local side.
251         * poll.cc (poll): Use POSIX type nfds_t for second parameter.  Drop
252         special socket handling for POLLIN.  Add comment to explain why.
253         * include/sys/poll.h: Declare nfds_t.  Use as type for second parameter
254         in poll(2) declaration.
255
256 2006-07-31  Corinna Vinschen  <corinna@vinschen.de>
257
258         * fhandler_socket.cc (fhandler_socket::evaluate_events): Circumvent
259         potential race condition.
260         (fhandler_socket::recv_internal): Fix MSG_PEEK bug on blocking sockets
261         and simplify recv loop.
262         (fhandler_socket::send_internal): Only lock when changing wsock_events.
263
264 2006-07-31  Corinna Vinschen  <corinna@vinschen.de>
265
266         * autoload.cc: Drop LoadDLLprime for wsock32 since no wsock32 function
267         is used anymore.  Drop all unused ws2_32.dll functions.
268
269 2006-07-28  Corinna Vinschen  <corinna@vinschen.de>
270
271         * fhandler.h (struct wsa_event): Define here.
272         (class fhandler_socket): Make wsock_evt private again.
273         (fhandler_socket::wsock_event): New read accessor for wsock_evt.
274         (fhandler_socket::serial_number): New read accessor to get the
275         socket's serial number.
276         (fhandler_socket::ready_for_read): Just return true.
277         * fhandler_socket.cc (struct wsa_event): Move definition to fhandler.h.
278         * select.cc (struct socketinf): Add serial number vector.
279         (start_thread_socket): Identify duplicate sockets by their serial
280         number, not (wrongly) by their wsock_evt.
281
282 2006-07-27  Corinna Vinschen  <corinna@vinschen.de>
283
284         * fhandler_socket.cc: Revert misguided attempt to handle FD_CLOSE error
285         conditions in evaluate_events.
286         (search_wsa_event_slot): Move wrongly placed memset in
287         fhandler_socket::init_events here.
288         (fhandler_socket::init_events): Initially set FD_WRITE event for
289         connectionless sockets.
290         * poll.cc (poll): Don't add sockets always to except_fds since select
291         is now supposed to do it right.
292         * select.cc (set_bits): Set connection state correctly for failed
293         af_local_connect on local sockets.  Remove socket special handling
294         for except_selected descriptors.
295         (peek_socket): Try to set the read/write/exception bits actually
296         correctly.
297
298 2006-07-27  Brian Ford  <Brian.Ford@FlightSafety.com>
299
300         * fhandler_socket.cc (fhandler_socket::recvmsg): Remove unused tot
301         argument.  All callers changed.
302         (fhandler_socket::sendmsg): Likewise.
303         * net.cc (cygwin_recvmsg): Likewise.
304         (cygwin_sendmsg): Likewise, and prevent calling sendmsg whith an
305         invalid iovec.
306         * fhandler.h (fhandler_socket::recvmsg): Adjust prototype.
307         (fhandler_socket::sendmsg): Likewise.
308
309 2006-07-27  Corinna Vinschen  <corinna@vinschen.de>
310
311         * fhandler.h (class fhandler_socket): Remove prot_info_ptr.
312         (fhandler_socket::fixup_before_fork_exec): Remove.
313         (fhandler_socket::fixup_after_exec): Remove.
314         (fhandler_socket::need_fixup_before): Remove.
315         * fhandler_socket.cc (fhandler_socket::fhandler_socket): Drop
316         initializing prot_info_ptr.  Remove unused code.
317         (fhandler_socket::~fhandler_socket): Drop free'ing prot_info_ptr.
318         (struct wsa_event): Rename connect_errorcode to errorcode.
319         (fhandler_socket::evaluate_events): Handle FD_CLOSE error condition
320         as FD_CONNECT error condition, except, never reset an FD_CLOSE error
321         condition.  Always set FD_WRITE after successfully recorded FD_CONNECT.
322         (fhandler_socket::fixup_before_fork_exec): Remove.
323         (fhandler_socket::fixup_after_fork): Revert to using handle duplication.
324         (fhandler_socket::fixup_after_exec): Remove.
325         (fhandler_socket::dup): Revert to using handle duplication.
326         (fhandler_socket::send_internal): Only call wait_for_events in case
327         of WSAEWOULDBLOCK condition.
328         (fhandler_socket::set_close_on_exec): Call
329         fhandler_base::set_close_on_exec.
330         * net.cc (fdsock): Just set socket to inheritable on non-NT.  Don't
331         call inc_need_fixup_before.
332         * select.cc (peek_socket): Don't set except_ready on every FD_CLOSE,
333         just on error.
334
335 2006-07-26  Brian ford  <Brian.Ford@FlightSafety.com>
336
337         * fhandler.cc (fhandler_base::read): Call get_readahead_into_buffer
338         instead of duplicating it.
339
340 2006-07-26  Corinna Vinschen  <corinna@vinschen.de>
341
342         * shared.cc (offsets): Define as offsets relative to cygwin_hmodule
343         instead of addresses.
344         (off_addr): New macro.
345         (open_shared): Use offsets array accordingly.  Remove unused code.
346         * shared_info.h (cygwin_shared_address): Remove.
347
348 2006-07-26  Corinna Vinschen  <corinna@vinschen.de>
349
350         * cygheap.h (struct init_cygheap): Remove shared_h and mt_h members.
351         * fhandler_tape.cc (mt): Define as DLL shared area in
352         .cygwin_dll_common instead of as dynamically allocated area.
353         Change referencing throughout.
354         * mtinfo.h (mt_h): Remove entirely.
355         (mt): Remove extern declaration.
356         * shared.cc (cygwin_shared_area): New global cygwin_shared
357         variable located in .cygwin_dll_common.
358         (offsets): Define shared region addresses descending from
359         cygwin_shared_address.
360         (open_shared): Replace usage of SH_CYGWIN_SHARED by SH_USER_SHARED.
361         (memory_init): Set cygwin_shared just by pointing to cygwin_shared_area.
362         * shared_info.h (shared_locations): Remove SH_CYGWIN_SHARED and
363         SH_MTINFO.
364         (cygwin_shared_address): Define as DLL start address.
365         * tty.h (tty_min::tty_min): Remove constructor.
366
367 2006-07-25  Corinna Vinschen  <corinna@vinschen.de>
368
369         * include/cygwin/in6.h: Guard in_port_t typedef more restrictive to
370         avoid compiler warning.
371
372 2006-07-25  Christopher Faylor  <cgf@timesys.com>
373
374         * security.cc (get_logon_server): Remove nret and use dret for
375         everything to avoid a g++ warning.
376
377 2006-07-25  Corinna Vinschen  <corinna@vinschen.de>
378
379         * include/cygwin/version.h: Bump DLL version to 1.7.0.
380
381 2006-07-25  Corinna Vinschen  <corinna@vinschen.de>
382
383         * select.h: Remove.
384         * fhandler_socket.cc: Don't include select.h.
385         * select.cc: Ditto.
386
387 2006-07-25  Corinna Vinschen  <corinna@vinschen.de>
388
389         * cygtls.h: Drop socket related includes.
390         (struct _local_storage): Remove exitsock and exitsock_sin. Add
391         select_sockevt.
392         * cygtls.cc: Accomodate above change throughout.
393         * fhandler.h (class fhandler_socket): Make wsock_evt public.
394         * fhandler_socket.cc (fhandler_socket::fhandler_socket): Accomodate
395         reordering members.
396         (fhandler_socket::evaluate_events): Drop FD_CONNECT event as soon as
397         it gets read once.  Never remove FD_WRITE event here.
398         (fhandler_socket::wait_for_events): Wait 50 ms instead of INFINITE for
399         socket events.
400         (fhandler_socket::accept): Fix conditional.  Set wsock_events members
401         of accepted socket to useful start values.
402         (fhandler_socket::recv_internal): Always drop FD_READ/FD_OOB events from
403         wsock_events after the call to WSARecvFrom.
404         (fhandler_socket::send_internal): Drop FD_WRITE event from wsock_events
405         if the call to WSASendTo fails with WSAEWOULDBLOCK.  Fix return value
406         condition.
407         * select.cc (struct socketinf): Change to accomodate using socket event
408         handling.
409         (peek_socket): Use event handling for peeking socket.
410         (thread_socket): Ditto.
411         (start_thread_socket): Ditto.
412         (socket_cleanup): Same here.
413         * tlsoffsets.h: Regenerate.
414
415 2006-07-23  Christopher Faylor  <cgf@timesys.com>
416
417         * include/cygwin/version.h: Bump DLL minor version number to 22.
418
419 2006-07-20  Corinna Vinschen  <corinna@vinschen.de>
420
421         * fhandler.h (class fhandler_socket): Rearrange slightly to keep
422         event handling methods and members together.  Drop owner status flag.
423         Split wait method.  Rename event handling methods for readability.
424         * fhandler_socket.cc (struct wsa_event): Add owner field.
425         (LOCK_EVENTS): New macro.
426         (UNLOCK_EVENTS): Ditto.
427         (fhandler_socket::init_events): rename from prepare.
428         (fhandler_socket::evaluate_events): First half of former wait method.
429         Do everything but wait.  Allow specifiying whether or not events from
430         event_mask should be erased from wsock_events->events.  Simplify
431         OOB handling.  Allow sending SIGURG to any process (group).
432         (fhandler_socket::wait_for_events): Second half of former wait method.
433         Call evaluate_events and wait in a loop if socket is blocking.
434         (fhandler_socket::release_events): Rename from release.
435         (fhandler_socket::connect): Accomodate above name changes.
436         (fhandler_socket::accept): Ditto.
437         (fhandler_socket::recv_internal): Ditto.
438         (fhandler_socket::send_internal): Ditto.
439         (fhandler_socket::close): Ditto.
440         (fhandler_socket::fcntl): Always set owner to given input value on
441         F_SETOWN.  Handle F_GETOWN.
442         * net.cc (fdsock): Accomodate above name changes.
443
444 2006-07-20  Corinna Vinschen  <corinna@vinschen.de>
445
446         * fhandler_socket.cc (fhandler_socket::wait): Set Winsock errno to
447         WSAEWOULDBLOCK instead of WSAEINPROGRESS.
448
449 2006-07-19  Corinna Vinschen  <corinna@vinschen.de>
450
451         * pinfo.cc (commune_process): Don't add extra \0 to cmdline.
452         (_pinfo::cmdline): Ditto process internal.
453
454 2006-07-19  Corinna Vinschen  <corinna@vinschen.de>
455
456         * mmap.cc (msync): Disable rounding up len.  Fix bug in access check
457         loop.
458
459 2006-07-19  Corinna Vinschen  <corinna@vinschen.de>
460
461         * path.cc (symlink_worker): Return EEXIST if newpath exists.
462
463 2006-07-18  Christopher Faylor  <cgf@timesys.com>
464
465         * tty.cc (tty_list::terminate): Don't enter the busy loop if we don't
466         own the master.
467
468 2006-07-18  Silvio Laguzzi  <slaguzzi@data-al.de>
469
470         * sec_acl.cc (acltotext32): Add missing handling of default ACL entry
471         types.
472
473 2006-07-18  Brian Ford  <Brian.Ford@FlightSafety.com>
474             Corinna Vinschen  <corinna@vinschen.de>
475
476         * winsup.h (mmap_region_status): New enum.
477         (mmap_is_attached_or_noreserve_page): Adjust prototype and rename
478         as below.
479         * mmap.cc (mmap_is_attached_or_noreserve_page):  Rename
480         mmap_is_attached_or_noreserve.  Add region length parameter.
481         Return enum above.
482         * exceptions.cc (_cygtls::handle_exceptions): Accomodate above.
483         * fhandler.cc (fhandler_base::raw_read): Call above for NOACCESS
484         errors and retry on success to allow reads into untouched
485         MAP_NORESERVE buffers.
486
487 2006-07-18  Corinna Vinschen  <corinna@vinschen.de>
488
489         * fhandler_floppy.cc (fhandler_dev_floppy::ioctl): Fix typo in lint
490         directive.
491
492 2006-07-18  Corinna Vinschen  <corinna@vinschen.de>
493
494         * cygwin.din (posix_openpt): Export.
495         * tty.cc (posix_openpt): New function.
496         * include/cygwin/stdlib.h (posix_openpt): Declare.
497         * include/cygwin/version.h: Bump API minor number.
498
499 2006-07-17  Christopher Faylor  <cgf@timesys.com>
500
501         GCC 4.1 fixes.
502         * cygheap.h (cygheap_user): Remove unneeded class names from function
503         declaration.
504         * fhandler.h (fhandler_base): Ditto.
505         (fhandler_dev_floppy): Ditto.
506         (fhandler_console): Ditto.
507         * wininfo.h (wininfo): Ditto.
508         * exceptions.cc (sigpacket::process): Avoid compiler errors about gotos
509         and initialization.
510         * fhandler_fifo.cc (fhandler_fifo::open): Ditto.
511         * fhandler_floppy.cc (fhandler_dev_floppy::ioctl): Ditto.
512         * fhandler_tty.cc (fhandler_tty_slave::ioctl): Ditto.
513         * mmap.cc (mmap64): Ditto.
514         * pipe.cc (fhandler_pipe::open): Ditto.
515         * spawn.cc (spawn_guts): Ditto.
516
517         * sec_helper.cc: Fix some comments.
518         (get_null_sd): Move file-scope static to only function where it is
519         used.
520
521 2006-07-14  Christopher Faylor  <cgf@timesys.com>
522
523         * fork.cc (fork): Lock the process before forking to prevent things
524         like new fds from being opened, etc.
525         * sync.h (lock_process::dont_bother): New function.
526
527 2006-07-14  Christopher Faylor  <cgf@timesys.com>
528
529         * include/cygwin/types.h: Update copyright.
530
531 2006-07-14  Christopher Faylor  <cgf@timesys.com>
532
533         * cygwin.sc: Make sure there's something in the cygheap.
534         * dllfixdbg: Accommodate newer binutils which put the gnu_debuglink at
535         the end rather than at the beginning.
536
537 2006-07-14  Corinna Vinschen  <corinna@vinschen.de>
538
539         * security.cc (get_token_group_sidlist): Always add the interactive
540         group to the token.  Add comment.  Create logon_id group SID by
541         copying it from incoming group list.
542         (create_token): Add subauth_token parameter.  Use information in
543         subauth_token if present.  Tweak SourceIdentifier if subauth_token
544         is present for debugging purposes.
545         * security.h (create_token): Add subauth_token parameter in declaration.
546         * syscalls.cc (seteuid32): Call subauth first.  Call create_token
547         regardless.  Use subauth token in call to create_token if subauth
548         succeeded.
549
550 2006-07-13  Christopher Faylor  <cgf@timesys.com>
551
552         * sigproc.cc (waitq_head): Don't initialize to zero.
553         * sigproc.h: Update copyright, fix whitespace.
554
555 2006-07-13  Christopher Faylor  <cgf@timesys.com>
556
557         * fhandler.cc (fhandler_base::raw_read): Only return EISDIR when we're
558         really trying to read a directory.
559
560         * sigproc.cc: Use "Static" where appropriate.
561
562 2006-07-13  Corinna Vinschen  <corinna@vinschen.de>
563
564         * include/netinet/in.h: Update copyright.
565
566 2006-07-13  Corinna Vinschen  <corinna@vinschen.de>
567
568         * fhandler_socket.cc: Update copyright.
569         * include/pthread.h: Ditto.
570
571 2006-07-13  Corinna Vinschen  <corinna@vinschen.de>
572
573         * fhandler_socket.cc (fhandler_socket::wait): Rework function so that
574         WaitForMultipleObjects is really only called when necessary.
575
576 2006-07-13  Corinna Vinschen  <corinna@vinschen.de>
577
578         * mmap.cc (mmap64): Drop MAP_NORESERVE flag for non-anonymous,
579         non-private mappings.
580         (mmap_record::unmap_pages): Only check noreserve flag which now implies
581         anonymous and private.
582         (mprotect): Ditto.
583         (fixup_mmaps_after_fork): Ditto.
584
585 2006-07-13  Corinna Vinschen  <corinna@vinschen.de>
586
587         * mmap.cc (mmap64): Drop MAP_RESERVED flag for all non-anonymous,
588         non-private mappings.
589
590 2006-07-13  Corinna Vinschen  <corinna@vinschen.de>
591
592         * exceptions.cc (_cygtls::handle_exceptions): Call new
593         mmap_is_attached_or_noreserve_page function in case of access violation
594         and allow application to retry access on noreserve pages.
595         * mmap.cc (mmap_is_attached_or_noreserve_page): Changed from
596         mmap_is_attached_page.  Handle also noreserve pages now.  Change
597         comment accordingly.
598         * winsup.h (mmap_is_attached_or_noreserve_page): Declare instead of
599         mmap_is_attached_page.
600
601 2006-07-12  Corinna Vinschen  <corinna@vinschen.de>
602
603         * mmap.cc (mmap_record::alloc_page_map): Don't call VirtualProtect
604         on maps created with MAP_NORESERVE.
605
606 2006-07-12  Corinna Vinschen  <corinna@vinschen.de>
607
608         * include/netdb.h: Declare rcmd, rcmd_af, rexec, rresvport,
609         rresvport_af, iruserok, iruserok_sa, ruserok.
610
611 2006-07-12  Corinna Vinschen  <corinna@vinschen.de>
612
613         * Makefile.in (DLL_OFILES): Drop iruserok.o.  Add rcmd.o.
614         * autoload.cc (rcmd): Drop definition.
615         * cygwin.din: Export bindresvport, bindresvport_sa, iruserok_sa,
616         rcmd_af, rresvport_af.
617         * net.cc (cygwin_rcmd): Remove.
618         (last_used_bindresvport): Rename from last_used_rrecvport.
619         (cygwin_bindresvport_sa): New function implementing bindresvport_sa.
620         (cygwin_bindresvport): New function implementing bindresvport.
621         (cygwin_rresvport): Remove.
622         * include/cygwin/version.h: Bump API minor number.
623         * include/netinet/in.h: Declare bindresvport and bindresvport_sa.
624         * libc/iruserok.c: Remove file.
625         * libc/rcmd.cc: New file implementing rcmd, rcmd_af, rresvport,
626         rresvport_af, iruserok_sa, iruserok and ruserok.
627
628 2006-07-12  Corinna Vinschen  <corinna@vinschen.de>
629
630         * include/pthread.h: Define PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT and
631         PTHREAD_PRIO_PROTECT only if _POSIX_THREAD_PRIO_INHERIT is defined.
632
633 2006-07-12  Corinna Vinschen  <corinna@vinschen.de>
634
635         * fhandler_socket.cc (fhandler_socket::getsockname): Return valid
636         result for unbound sockets.
637
638 2006-07-11  Corinna Vinschen  <corinna@vinschen.de>
639
640         * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Handle
641         wsock_mtx and wsock_evt on fork, thus handling close_on_exec correctly.
642         (fhandler_socket::fixup_after_exec): Drop misguided attempt to handle
643         close_on_exec here.
644         (fhandler_socket::dup): Call fixup_after_fork with NULL parent.
645         Add comment.
646         (fhandler_socket::set_close_on_exec): Handle wsock_mtx and wsock_evt.
647
648 2006-07-10  Corinna Vinschen  <corinna@vinschen.de>
649
650         * fhandler.h (class fhandler_socket): Add wsock_mtx, wsock_evt
651         and wsock_events members.  Remove closed status flag, add listener
652         status flag.  Accomodate new implementation of socket event handling
653         methods.  Declare recv* and send* functions ssize_t as the POSIX
654         equivalents.
655         (fhandler_socket::recv_internal): Declare.
656         (fhandler_socket::send_internal): Ditto.
657         * fhandler_socket.cc (EVENT_MASK): Define mask of selected events.
658         (fhandler_socket::fhandler_socket): Initialize new members.
659         (fhandler_socket::af_local_setblocking): Don't actually set the
660         socket to blocking mode.  Keep sane event selection.
661         (fhandler_socket::af_local_unsetblocking): Don't actually set the
662         socket to previous blocking setting, just remember it.
663         (struct wsa_event): New structure to keep event data per shared
664         socket.
665         (NUM_SOCKS): Define number of shared sockets concurrently handled by
666         all active Cygwin processes.
667         (wsa_events): New shared datastructure keeping all wsa_event records.
668         (socket_serial_number): New shared variable to identify shared sockets.
669         (wsa_slot_mtx): Global mutex to serialize wsa_events access.
670         (search_wsa_event_slot): New static function to select a new wsa_event
671         slot for a new socket.
672         (fhandler_socket::prepare): Rewrite.  Prepare event selection
673         per new socket.
674         (fhandler_socket::wait): Rewrite.  Wait for socket events in thread
675         safe and multiple process safe.
676         (fhandler_socket::release): Rewrite.  Close per-socket descriptor
677         mutex handle and event handle.
678         (fhandler_socket::dup): Duplicate wsock_mtx and wsock_evt.  Fix
679         copy-paste error in debug output.
680         (fhandler_socket::connect): Accomodate new event handling.
681         (fhandler_socket::listen): Set listener flag on successful listen.
682         (fhandler_socket::accept): Accomodate new event handling.
683         (fhandler_socket::recv_internal): New inline method centralizing
684         common recv code.
685         (fhandler_socket::recvfrom): Call recv_internal now.
686         (fhandler_socket::recvmsg): Ditto.  Streamline copying from iovec
687         to WSABUF.
688         (fhandler_socket::send_internal): New inline method centralizing
689         common send code.
690         (fhandler_socket::sendto): Call send_internal now.
691         (fhandler_socket::sendmsg): Ditto.  Streamline copying from iovec
692         to WSABUF.
693         (fhandler_socket::close): Call release now.
694         (fhandler_socket::ioctl): Never actually switch to blocking mode.
695         Just keep track of the setting.
696         * net.cc (fdsock): Call prepare now.
697         (cygwin_connect): Revert again to event driven technique.
698         (cygwin_accept): Ditto.
699         * poll.cc (poll): Don't call recvfrom on a listening socket.
700         Remove special case for failing recvfrom.
701         * include/sys/socket.h: Declare recv* and send* functions ssize_t as
702         requested by POSIX.
703
704 2006-07-10  Corinna Vinschen  <corinna@vinschen.de>
705
706         * libc/inet_addr.c: Define __INSIDE_CYGWIN_NET__.
707         * libc/inet_network.c: Ditto.
708
709 2006-07-07  Corinna Vinschen  <corinna@vinschen.de>
710
711         * fhandler_socket.cc (fhandler_socket::wait): Disable SA_RESTART
712         handling for now.
713
714 2006-07-07  Corinna Vinschen  <corinna@vinschen.de>
715
716         * net.cc (cygwin_inet_ntop): Fix data type of forth parameter.
717
718 2006-07-07  Corinna Vinschen  <corinna@vinschen.de>
719
720         * Makefile.in (DLL_OFILES): Add inet_addr.o and inet_network.o.
721         * autoload.cc (inet_addr): Drop definition.
722         (inet_ntoa): Ditto.
723         * net.cc: Forward declare cygwin_inet_aton and cygwin_inet_ntop.
724         (cygwin_inet_ntoa): Call cygwin_inet_ntop instead of Winsock inet_ntoa.
725         (cygwin_inet_addr): Remove here.
726         (cygwin_inet_aton): Ditto.
727         (cygwin_inet_network): Ditto.
728         * libc/inet_addr.c: New file implementing cygwin_inet_aton and
729         cygwin_inet_addr.
730         * libc/inet_network.c: New file implementing cygwin_inet_network.
731
732 2006-07-06  Christopher Faylor  <cgf@timesys.com>
733
734         * hookapi.cc: Add comment header
735         (putmem): Make static.
736         (get_export): Ditto.
737         (rvadelta): Ditto.  Don't assume that a section which ends where the
738         import_rva begins is the import list.
739
740         * child_info.h: Update copyright.
741         * fork.cc: Ditto.
742
743 2006-07-06  Corinna Vinschen  <corinna@vinschen.de>
744
745         * include/cygwin/in6.h (struct in6_addr): Fix typo.
746
747 2006-07-06  Corinna Vinschen  <corinna@vinschen.de>
748
749         * cygwin.din: Export in6addr_any, in6addr_loopback, freeaddrinfo,
750         gai_strerror, getaddrinfo, getnameinfo.
751         * fhandler_socket.cc: Include cygwin/in6.h.
752         (get_inet_addr): Accomodate AF_INET6 usage.
753         (fhandler_socket::connect): Ditto.
754         (fhandler_socket::listen): Ditto.
755         (fhandler_socket::sendto): Ditto.
756         * net.cc: Include cygwin/in6.h.
757         (in6addr_any): Define.
758         (in6addr_loopback): Define.
759         (cygwin_socket): Accomodate AF_INET6 usage.
760         (socketpair): Bind socketpairs only to loopback for security.
761         (inet_pton4): New static function.
762         (inet_pton6): Ditto.
763         (cygwin_inet_pton): New AF_INET6 aware inet_pton implementation.
764         (inet_ntop4): New static function.
765         (inet_ntop6): Ditto.
766         (cygwin_inet_ntop): New AF_INET6 aware inet_ntop implementation.
767         (ga_aistruct): New static function.
768         (ga_clone): Ditto.
769         (ga_echeck): Ditto.
770         (ga_nsearch): Ditto.
771         (ga_port): Ditto.
772         (ga_serv): Ditto.
773         (ga_unix): Ditto.
774         (gn_ipv46): Ditto.
775         (ipv4_freeaddrinfo): Ditto.
776         (ipv4_getaddrinfo): Ditto.
777         (ipv4_getnameinfo): Ditto.
778         (gai_errmap_t): New structure holding error code - error string mapping.
779         (cygwin_gai_strerror): New function implementing gai_strerror.
780         (w32_to_gai_err): New static function.
781         (get_ipv6_funcs): Ditto.
782         (load_ipv6_funcs): Ditto.
783         (cygwin_freeaddrinfo): New function implementing freeaddrinfo.
784         (cygwin_getaddrinfo): New function implementing getaddrinfo.
785         (cygwin_getnameinfo): New function implementing getnameinfo.
786         * include/netdb.h: Include stdint.h and cygwin/socket.h.  Define
787         data types and macros used by getaddrinfo and friends.  Declare
788         freeaddrinfo, gai_strerror, getaddrinfo and getnameinfo.
789         * include/cygwin/in.h: Add IPv6 related IPPROTOs. Remove definition
790         of struct sockaddr_in6.  Include cygwin/in6.h instead.
791         * include/cygwin/in6.h: New header file defining IPv6 releated
792         data types and macros.
793         * include/cygwin/socket.h: Enable AF_INET6 and PF_INET6.  Add
794         IPv6 related socket options.
795         * include/cygwin/version.h: Bump API minor number.
796
797 2006-07-06  Corinna Vinschen  <corinna@vinschen.de>
798
799         * autoload.cc (DsGetDcNameA): Define.
800         (NetGetAnyDCName): Define.
801         * security.cc: Include dsgetdc.h.
802         (DsGetDcNameA): Declare.
803         (DS_FORCE_REDISCOVERY): Define.
804         (get_logon_server): Add bool parameter to control rediscovery of DC.
805         Use DsGetDcNameA function if supported, NetGetDCName/NetGetAnyDCName
806         otherwise.
807         (get_server_groups): Rediscover DC if get_user_groups fails and
808         try again.
809         (get_reg_security): Use correct error code macro when testing
810         RegGetKeySecurity return value.
811         * security.h (get_logon_server): Remove default vaue from wserver
812         parameter.  Add rediscovery parameter.
813         * uinfo.cc (cygheap_user::env_logsrv): Accomodate rediscovery parameter
814         in call to get_logon_server.
815
816 2006-07-05  Christopher Faylor  <cgf@timesys.com>
817
818         * sortdin: Ignore all leading underscores when deriving a sort key.
819         * cygwin.din: Resort.
820
821 2006-07-05  Christopher Faylor  <cgf@timesys.com>
822
823         * sortdin: New program.
824         * cygwin.din: Sort.
825
826 2006-07-05  Corinna Vinschen  <corinna@vinschen.de>
827
828         * fhandler.h (fhandler_socket::wait): Reset default timeout to 10ms.
829
830 2006-07-05  Corinna Vinschen  <corinna@vinschen.de>
831
832         * path.cc (path_conv::check): Ignore has_ea setting, it's always unset
833         at this point anyway.
834         (get_symlink_ea): Remove.
835         (set_symlink_ea): Remove.
836         (symlink_worker): Drop writing symlink into NTFS extended attributes.
837         (symlink_info::check): Drop reading symlinks from NTFS extended
838         attributes.
839
840 2006-07-04  Christopher Faylor  <cgf@timesys.com>
841
842         * libc/rexec.cc (cygwin_rexec): Obvious (?) fix to correct a gcc
843         warning - set port to zero first thing in the function.
844
845 2006-07-04  Corinna Vinschen  <corinna@vinschen.de>
846
847         * signal.cc (signal): Set sa_mask to sig.
848
849 2006-07-04  Corinna Vinschen  <corinna@vinschen.de>
850
851         * Makefile.in (DLL_OFILES): Add rexec.o.
852         * autoload.cc (inet_network): Drop definition.
853         (rexec): Ditto.
854         * net.cc (rexec): Drop extern declaration.
855         (inet_network): Ditto.
856         (cygwin_inet_network): Implement using inet_addr.
857         (cygwin_rexec): Remove.
858         * libc/rexec.cc: New file.
859
860 2006-07-04  Corinna Vinschen  <corinna@vinschen.de>
861
862         * fhandler_socket.cc (fhandler_socket::listen): Allow listening on
863         unbound INET socket.
864
865 2006-07-04  Corinna Vinschen  <corinna@vinschen.de>
866
867         * fhandler.h (fhandler_socket::wait): Set default timeout to INFINITE.
868
869 2006-07-03  Corinna Vinschen  <corinna@vinschen.de>
870
871         * autoload.cc (NtQueryEaFile): Define.
872         (NtSetEaFile): Define.
873         * fhandler.cc (fhandler_base::open): Use appropriate open flags
874         in query case when allow_ntea is set.
875         * ntdll.h (struct _FILE_GET_EA_INFORMATION): Define.
876         (struct _FILE_FULL_EA_INFORMATION): Define.
877         (NtQueryEaFile): Declare.
878         (NtSetEaFile): Declare.
879         * ntea.cc (read_ea): Rename from NTReadEA and rewrite using
880         NtQueryEaFile.
881         (write_ea): Rename from NTWriteEA and rewrite using NtSetEaFile.
882         * path.cc (get_symlink_ea): Make static.  Add handle parameter to
883         accomodate new read_ea call.
884         (set_symlink_ea): Make static.  Add handle parameter to accomodate new
885         write_ea call.
886         (symlink_worker): Call set_symlink_ea while file is still open.
887         (symlink_info::check): Call get_symlink_ea after file has been opened.
888         * security.cc (get_file_attribute): Accomodate new read_ea call.
889         (set_file_attribute): Accomodate new write_ea call.
890         * security.h (read_ea): Change declaration accordingly.
891         (write_ea): Ditto.
892
893 2006-07-03  Kazuhiro Fujieda  <fujieda@jaist.ac.jp>
894
895         * fhandler.h (class dev_console): Add `metabit' indicating the
896         current meta key mode.
897         * fhandler_console.cc (fhandler_console::read): Set the top bit of
898         the character if metabit is true.
899         * fhandler_console.cc (fhandler_console::ioctl): Implement
900         KDGKBMETA and KDSKBMETA commands.
901         * fhandler_tty.cc (process_ioctl): Support KDSKBMETA.
902         (fhandler_tty_slave::ioctl): Send KDGKBMETA and KDSKBMETA to the
903         master.
904         * include/cygwin/kd.h: New file for the meta key mode.
905         * include/sys/kd.h: New file.
906
907 2006-07-03  Eric Blake  <ebb9@byu.net>
908
909         * include/stdint.h (UINT8_C, UINT16_C): Unsigned types smaller
910         than int promote to signed int.
911
912 2006-07-03  Corinna Vinschen  <corinna@vinschen.de>
913
914         * net.cc (cygwin_sendto): Define appropriate parameters using
915         socklen_t type according to SUSv3.
916         (cygwin_recvfrom): Ditto.
917         (cygwin_setsockopt): Ditto.
918         (cygwin_getsockopt): Ditto.
919         (cygwin_connect): Ditto.
920         (cygwin_accept): Ditto.
921         (cygwin_bind): Ditto.
922         (cygwin_getsockname): Ditto.
923         (cygwin_getpeername): Ditto.
924         (cygwin_recv): Ditto.
925         (cygwin_send): Ditto.
926         * include/cygwin/socket.h (socklen_t): Typedef and define.
927         * include/sys/socket.h: Declare socket functions using socklen_t type.
928
929 2006-07-02  Christopher Faylor  <cgf@timesys.com>
930
931         * include/cygwin/version.h: Bump DLL minor version number to 21.
932
933 2006-06-30  Corinna Vinschen  <corinna@vinschen.de>
934
935         * net.cc (cygwin_sendto): Allow zero-sized packets.
936         (cygwin_sendmsg): Ditto.
937
938 2006-06-26  Corinna Vinschen  <corinna@vinschen.de>
939
940         Revert patches from 2005-10-22 and 2006-06-14 to use event driven
941         accept and connect back to using select:
942         * fhandler.h (class fhandler_socket): Remove accept_mtx.
943         * fhandler_socket.cc (fhandler_socket::fhandler_socket): Drop
944         initializing accept_mtx.
945         (fhandler_socket::accept): Drop event handling.
946         (fhandler_socket.cc (fhandler_socket::connect): Ditto.
947         (fhandler_socket::dup): Drop accept_mtx handling.
948         (fhandler_socket::listen): Ditto.
949         (fhandler_socket::prepare): Ditto.
950         (fhandler_socket::release): Ditto.
951         (fhandler_socket::close): Ditto.
952         * net.cc (cygwin_accept): Revert to calling cygwin_select to
953         implement interuptible accept.
954         (cygwin_connect): Ditto for connect.
955
956 2006-06-22  Christopher Faylor  <cgf@timesys.com>
957
958         * fhandler_fifo.cc (fhandler_fifo::open): Release process lock and grab
959         a system-wide mutex to prevent a deadlock and a race.
960         * sync.h (lock_process): Make fhandler_fifo a friend.
961
962         * smallprint.c (__small_vsprintf): Cosmetic change.
963
964 2006-06-15  Corinna Vinschen  <corinna@vinschen.de>
965
966         * cygwin.din: Export __srget_r, __swbuf_r.
967         * include/cygwin/version.h: Bump API minor number to 156.
968
969 2006-06-14  Corinna Vinschen  <corinna@vinschen.de>
970
971         * fhandler.h (class fhandler_socket): Add private mutex handle
972         accept_mtx.
973         * fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize
974         accept_mtx to NULL.
975         (fhandler_socket::dup): Duplicate accept_mtx, if available.
976         (fhandler_socket::listen): Create accept_mtx before trying to listen.
977         (fhandler_socket::prepare): Wait for accept_mtx if available to
978         serialize accepts on the same socket.
979         (fhandler_socket::release): Release accept_mtx.
980         (fhandler_socket::close): Close accept_mtx on successful closesocket.
981
982 2006-06-12  Christopher Faylor  <cgf@timesys.com>
983
984         * fhandler_tty.cc (fhandler_pty_master::close): Always close
985         from_master/to_master since we always have copies of these handles.
986
987 2006-06-12  Corinna Vinschen  <corinna@vinschen.de>
988
989         * include/sys/wait.h: Move definition of wait constants from here...
990         * include/cygwin/wait.h: ...to here.  New file.
991         * include/cygwin/stdlib.h: Include cygwin/wait.h to conform with SUSv3.
992
993 2006-06-12  Pierre Humblet  Pierre.Humblet@ieee.org
994
995         * heap.cc (heap_init): Only commit if allocsize is not zero.
996
997 2006-06-12  Corinna Vinschen  <corinna@vinschen.de>
998
999         * net.cc (fdsock): Disable raising buffer sizes.  Add comment to
1000         explain why.
1001
1002 2006-06-04  Christopher Faylor  <cgf@timesys.com>
1003
1004         * ioctl.cc (ioctl): Accommodate change in reported pty master device
1005         number.
1006         * select.cc (peek_pipe): Ditto.
1007
1008 2006-06-04  Christopher Faylor  <cgf@timesys.com>
1009
1010         * cygtls.h (CYGTLS_PADSIZE): Reset to a size that XP SP1 seems to like.
1011         * tlsoffsets.h: Regenerate.
1012
1013 2006-06-03  Christopher Faylor  <cgf@timesys.com>
1014
1015         * cygthread.cc (cygthread::terminate_thread): In debugging output, use
1016         name of thread being terminated rather than thread doing the
1017         terminating.
1018
1019         * fhandler.h (fhandler_pty_master::slave): Delete.
1020         (fhandler_pty_master::get_unit): Ditto.
1021         (fhandler_pty_master::setup): Change argument declaration to
1022         accommodate new usage.
1023         * fhandler_tty.cc (fhandler_tty_master::init): Remove obsolete slave
1024         assignment.  Pass argument to setup indicating that this is a tty.
1025         (fhandler_tty_slave::open): Use dev() method rather than referencing
1026         pc.dev directly.
1027         (fhandler_pty_master::open): Don't create archetype based on ptym
1028         device number.  Set device number to use DEV_TTYM_MAJOR and tty number.
1029         Pass argument to setup indicating that this is a pty.
1030         (fhandler_pty_master::setup): Change single argument to a flag
1031         indicating whether we're creating a pty and use appropriately.
1032         Calculate 't' variable here rather than in caller.
1033
1034         * fhandler_dsp.cc (fhandler_dev_dsp::open): Use dev() method rather
1035         than referencing pc.dev directly.
1036
1037 2006-06-03  Christopher Faylor  <cgf@timesys.com>
1038
1039         * dcrt0.cc (dll_crt0_0): Call tty_list::init_session here.
1040         (dll_crt0_1): Reflect renaming from tty_init to tty::init_session.
1041         (do_exit): Reflect moving of tty_terminate into tty_list.
1042         * exceptions.cc (events_init): Move tty_mutex stuff elsewhere.
1043         * fhandler_console.cc (set_console_title): Use lock_ttys class.
1044         * fhandler_termios.cc (fhandler_termios::bg_check): Make debug output
1045         more accurate.
1046         * fhandler_tty.cc (fhandler_tty_slave::open): Reflect move of
1047         attach_tty into tty_list class.  Don't attempt to grab master end of
1048         pty if master doesn't exist.
1049         (fhandler_pty_master::open): Reflect move of allocate_tty into tty_list
1050         class.  Use lock_ttys::release to release mutex.  Improve debugging
1051         output.
1052         (fhandler_pty_master::setup): Remove if 0'ed block.  Fix argument to
1053         SetNamedPipeHandleState.
1054         * pinfo.cc (_pinfo::set_ctty): Lock ttys before setting sid/pgid.
1055         Improve debugging.  Add temporary debugging.
1056         * tty.cc (tty_list::init_session): New function.
1057         (tty::init_session): Rename from tty_init.  Reflect move of attach_tty
1058         to tty_list class.
1059         (tty::create_master): Rename from create_tty_master.
1060         (tty_list::attach): Rename from attach_tty.  Reflect renaming of
1061         connect_tty to connect.  Ditto for allocate_tty.
1062         (tty_terminate): Delete.
1063         (tty_list::terminate): Subsume tty_terminate.  Use lock_ttys rather
1064         than manipulating mutex directly.
1065         (tty_list::allocate): Rename from allocate_tty.  Use lock_ttys rather
1066         than manipulating mutex directly.  Don't set sid here since linux
1067         apparently doesn't do this.  Reflect move of create_tty_master into
1068         tty.
1069         (lock_ttys::lock_ttys): Define new constructor.
1070         (lock_ttys::release): New function.
1071         * tty.h (tty::exists): Return false immediately if !master_pid.
1072         (tty::set_master_closed): Define new function.
1073         (tty::create_master): Ditto.
1074         (tty::init_session): Ditto.
1075         (tty_list::mutex): New field.
1076         (tty_list::allocate): Define new function.
1077         (tty_list::connect): Ditto.
1078         (tty_list::attach): Ditto.
1079         (tty_list::init_session): Ditto.
1080         (lock_ttys): New class.
1081         (tty_init): Delete declaration.
1082         (tty_terminate): Ditto.
1083         (attach_tty): Ditto.
1084         (create_tty_master): Ditto.
1085
1086 2006-06-03  Christopher Faylor  <cgf@timesys.com>
1087
1088         * Makefile.in (libdl.a): New library.
1089
1090 2006-06-03  Christopher Faylor  <cgf@timesys.com>
1091
1092         * fhandler_tty.cc (fhandler_pty_master::close): Don't close handles if
1093         we don't own them.
1094         (fhandler_pty_master::setup): Make sure that original handle is closed
1095         when changing inheritance.
1096         (fhandler_pty_master::fixup_after_fork): Set from_master/to_master to
1097         arch value always.
1098         (fhandler_pty_master::fixup_after_exec): Clear from_master/to_master
1099         when close_on_exec.
1100
1101 2006-06-03  Christopher Faylor  <cgf@timesys.com>
1102
1103         * cygheap.cc (init_cygheap::close_ctty): Remove obsolete code.
1104         * dcrt0.cc (child_info_spawn::handle_spawn): Signal ready after we've
1105         run fixup_after_exec.
1106         * dtable.cc (dtable::fixup_after_exec): Add debugging output.
1107         * fhandler_tty.cc (fhandler_pty_master::doecho): Use class version of
1108         to_master.
1109         (fhandler_tty_common::close): Remove obsolete code.
1110         (fhandler_tty_slave::fixup_after_exec): Don't close, since this is done
1111         in dtable's fixup_after_exec.  (revisit later?)
1112         (fhandler_pty_master::fixup_after_exec): Ditto.
1113
1114 2006-06-02  Christopher Faylor  <cgf@timesys.com>
1115
1116         * cygtls.h (CYGTLS_PADSIZE): Bump up or suffer a regrettable collision
1117         with the call chain.
1118         * tlsoffsets.h: Regenerate.
1119
1120         * dcrt0.cc (break_here): Define unconditionally for use elsewhere.
1121         Call DebugBreak, if appropriate.
1122         (initial_env): Rely on break_here() to call DebugBreak.
1123         * exceptions.cc (try_to_debug): Ditto.
1124
1125 2006-06-02  Christopher Faylor  <cgf@timesys.com>
1126
1127         * fhandler.cc (fhandler_base::fixup_after_exec): Declare here.
1128         * fhandler.h (fhandler_base::fixup_after_exec): Make non-inline.
1129         (fhandler_termios::fixup_after_fork): Delete declaration.
1130         (fhandler_termios::fixup_after_exec): Ditto.
1131         (fhandler_tty_common::inuse): Remove.
1132         (fhandler_tty_common::dup): Delete declaration.
1133         (fhandler_tty_common::fixup_after_fork): Ditto.
1134         (fhandler_tty_slave::fixup_after_exec): Declare new function.
1135         (fhandler_pty_master::dwProcessId): New variable.
1136         (fhandler_pty_master::from_master): Ditto.
1137         (fhandler_pty_master::to_master): Ditto.
1138         (fhandler_pty_master::setup): New function.
1139         (fhandler_pty_master::fixup_after_fork): Ditto.
1140         (fhandler_pty_master::fixup_after_exec): Ditto.
1141         * fhandler_termios.cc (fhandler_termios::fixup_after_exec): Delete
1142         definition.
1143         (fhandler_termios::fixup_after_fork): Ditto.
1144         * fhandler_tty.cc (fhandler_tty_master::init): Use fhandler_pty_master
1145         setup function rather than obsolete tty::common_init.  Delete obsolete
1146         inuse setting.
1147         (fhandler_tty_slave::fhandler_tty_slave): Set inuse to NULL here.
1148         (fhandler_tty_slave::open): Change debugging output for clarity.  Check
1149         for different things when doing a sanity check on the tty.  Reflect the
1150         fact that master_pid now is the cygwin pid rather than the windows pid.
1151         Use "arch" rather than "archetype" for consistency.
1152         (fhandler_tty_slave::close): Close inuse here.
1153         (fhandler_tty_slave::dup): Remove old if 0'ed code.
1154         (fhandler_pty_master::dup): New function.  Handles pty master
1155         archetype.
1156         (fhandler_pty_master::fhandler_pty_master): Zero pty_master specific
1157         fields.
1158         (fhandler_pty_master::open): Implement using archetypes, similar to
1159         slave.  Use fhandler_pty_master setup function rather than obsolete
1160         tty::common_init.  Don't set inuse.
1161         (fhandler_tty_common::close): Don't deal with inuse.  Delete old if
1162         0'ed code.
1163         (fhandler_pty_master::close): Implement using archetypes.  Close
1164         from_master and to_master.
1165         (fhandler_tty_common::set_close_on_exec): Just set close_on_exec flag
1166         here since everything uses archetypes now.
1167         (fhandler_tty_common::fixup_after_fork): Delete definition.
1168         (fhandler_tty_slave::fixup_after_exec): Define new function.
1169         (fhandler_pty_master::setup): New function, derived from
1170         tty::common_init.
1171         (fhandler_pty_master::fixup_after_fork): New function.
1172         (shared_info.h): Reset SHARED_INFO_CB to reflect new tty size.
1173         * tty.cc (tty_list::terminate): Close individual handles from
1174         tty_master.
1175         (tty::master_alive): Delete.
1176         (tty::make_pipes): Ditto.
1177         (tty::common_init): Ditto.
1178         * tty.h (tty::from_slave): Delete.
1179         (tty::to_slave): Ditto.
1180         (tty::common_init): Delete declaration.
1181         (tty::make_pipes): Ditto.
1182         (tty::master_pid): Define as pid_t since it is now a cygwin pid.
1183
1184 2006-06-01  Christopher Faylor  <cgf@timesys.com>
1185
1186         * cygheap.cc (cygheap_fixup_in_child): Don't close parent handle here.
1187         Let the caller do that.
1188         * dcrt0.cc (child_info_spawn::handle_spawn): Close parent handle here
1189         to allow fixup_after_exec functions to use it.
1190
1191         * cygtls.cc (_cygtls::call2): Avoid calling exit thread if called with
1192         *crt0_1 functions.
1193         * cygtls.h (_cygtls::isinitialized): Check that we actually have a tls
1194         before seeing if it is initialized.
1195         * gendef (_sigfe_maybe): Ditto.
1196         * dcrt0.cc (dll_crt0_1): Remove static, use just one argument.
1197         * dll_init.cc (dllcrt0_info): New structure.
1198         (dll_dllcrt0): Change into a front-end to renamed dll_dllcrt0_1 so that
1199         we'll always be assured of having something like a tls.
1200         (dll_dllcrt0_1): New function, basically renamed from from dll_dllcrt0.
1201         Unconditionally call _my_tls.init_exception_handler now that we are
1202         assured of having a tls.  Change variable name from "linking" to "linked".
1203         * winsup.h (dll_crt0_1): Declare.
1204         (dll_dllcrt0_1): Ditto.
1205
1206 2006-05-30  Christopher Faylor  <cgf@timesys.com>
1207
1208         * cygtls.cc (_cygtls::call2): Don't call ExitThread on the main thread.
1209
1210 2006-05-29  Christopher Faylor  <cgf@timesys.com>
1211
1212         * winf.h (MAXCYGWINCMDLEN): Set down size to 30000 or suffer fork
1213         errors.
1214
1215 2006-05-28  Christopher Faylor  <cgf@timesys.com>
1216
1217         * sigproc.cc (child_info::proc_retry): Mask all of the bits we're
1218         interested in, which includes bits above and below 0xc0000000.
1219
1220 2006-05-27  Christopher Faylor  <cgf@timesys.com>
1221
1222         * dll_init.cc (dll_dllcrt0): Previous change didn't work very well with
1223         fork.  Semi-revert it but change name of variable to something that
1224         makes better sense.
1225
1226 2006-05-27  Christopher Faylor  <cgf@timesys.com>
1227
1228         * thread.cc (verifyable_object_isvalid): Check for NULL specifically.
1229
1230 2006-05-27  Christopher Faylor  <cgf@timesys.com>
1231
1232         * dll_init.cc (dll_dllcrt0): Call _my_tls.init_exception_handler if
1233         we've finished initializing (Thanks to Gary Zablackis for noticing this
1234         problem).  Just use cygwin_finished_initializing rather than defining a
1235         separate variable.
1236
1237 2006-05-25  Christopher Faylor  <cgf@timesys.com>
1238
1239         * debug.h (ModifyHandle): Define new macro.
1240         (modify_handle): Declare new function.
1241         * debug.cc (modify_handle): Define new function.
1242         * fhandler.h (fhandler_base::fork_fixup): Change return value from void
1243         to bool.
1244         * fhandler.cc (fhandler_base::fork_fixup): Return true if fork fixup has
1245         been done.
1246         * pipe.cc (fhandler_pipe::set_close_on_exec): Set inheritance of
1247         protected handle via ModifyHandle if DEBUGGING.
1248         (fhandler_pipe::fixup_after_fork): Protect guard handle if fork fixup
1249         has been done.
1250
1251 2006-05-24  Christopher Faylor  <cgf@timesys.com>
1252
1253         * cygtls.cc (_cygtls::call): Call call2 using _my_tls.
1254         (_cygtls::init_exception_handler): Always replace existing exception
1255         handler with cygwin exception handler.
1256         * cygtls.h (_cygtls::call2): Remove static designation.
1257         * dcrto.cc (dll_crt0_1): Define in a way that allows calling via
1258         _cygtls::call.
1259         (_initialize_main_tls): Delete.
1260         (_dll_crt0): Call dll_crt0_1 via cygtls::call.  Set _main_tls here.
1261         * external.cc (cygwin_internal): Implement CW_CYGTLS_PADSIZE.
1262         * include/sys/cygwin.h (CW_CYGTLS_PADSIZE): Define.
1263         * tlsoffsets.h: Regenerate.
1264
1265 2006-05-24  Christopher Faylor  <cgf@timesys.com>
1266
1267         * configure.in: Update to newer autoconf.
1268         (thanks to Steve Ellcey)
1269         * configure: Regenerate.
1270         * aclocal.m4: New file.
1271
1272 2006-05-23  Lev Bishop  <lev.bishop+cygwin@gmail.com>
1273
1274         * fhandler.cc (readv): Remove nonsensical assert.
1275
1276 2006-05-23  Christopher Faylor  <cgf@timesys.com>
1277
1278         * select.cc (start_thread_socket): Delay setting thread local exitsock
1279         until we know it's correct.  Return correct value on error.
1280
1281 2006-05-23  Lev Bishop  <lev.bishop+cygwin@gmail.com>
1282             Christopher Faylor  <cgf@timesys.com>
1283
1284         * select.cc (start_thread_socket): Clean up exitsock in case of error.
1285         Use si->exitcode consistently.
1286
1287 2006-05-21  Christopher Faylor  <cgf@timesys.com>
1288
1289         * child_info.h (_CI_SAW_CTRL_C): New enum.
1290         (CURR_CHILD_INFO_MAGIC): Reset.
1291         (saw_ctrl_c): New function.
1292         (set_saw_ctrl_c): Ditto.
1293         * sigproc.cc (child_info::proc_retry): Return EXITCODE_OK if we get
1294         STATUS_CONTROL_C_EXIT and we actually saw a CTRL-C.
1295         * spawn.cc (dwExeced): Delete.
1296         (chExeced): New variable.
1297         (spawn_guts): Set chExeced;
1298         * exceptions.cc (dwExeced): Delete declaration.
1299         (chExeced): Declare.
1300         (ctrl_c_handler): Detect if we're an exec stub process and set a flag,
1301         if so.
1302
1303         * fhandler_tty.cc (fhandler_tty_common::__release_output_mutex): Add
1304         extra DEBUGGING test.
1305
1306         * pinfo.cc: Fix comment.
1307
1308 2006-05-21  Christopher Faylor  <cgf@timesys.com>
1309
1310         * fhandle.h (fhandler_pipe::create_guard): Revert change which
1311         eliminated SECURITY_ATTRIBUTES argument.
1312         * pipe.cc (fhandler_pipe::open): Duplicate guard from other process and
1313         protect it appropriately.  Eliminate unneeded writepipe_exists
1314         temporary variable.  Set inheritance appropriately.
1315         (fhandler_pipe::set_close_on_exec): Revert change which eliminated
1316         handling guard inheritance.
1317         (fhandler_pipe::fixup_after_fork): Ditto.  Use correct name of entity
1318         being checked by fork_fixup.
1319         (fhandler_pipe::fixup_after_exec): Don't bother with guard here.
1320         (fhandler_pipe::dup): Cosmetic changes and revert creation of
1321         writepipe_exists as noninheritable.
1322         (fhandler_pipe::create): Revert change which eliminated
1323         SECURITY_ATTRIBUTES argument.  Revert change which always made
1324         writepipe_exists noninheritable.
1325
1326 2006-05-21  Christopher Faylor  <cgf@timesys.com>
1327
1328         * debug.cc (add_handle): Print handle value when collision detected.
1329         * dtable.cc (dtable::stdio_init): Cosmetic change.
1330         * fhandler.h (fhandler_base::create_read_state): Protect handle.
1331         (fhandler_pipe::create_guard): Ditto.  Always mark the handle as
1332         inheritable.
1333         (fhandler_pipe::is_slow): Return boolean value rather than numeric 1.
1334         * pipe.cc (fhandler_pipe::fhandler_pipe): Always flag that we need fork
1335         fixup.
1336         (fhandler_pipe::open): Don't pass security attributes to create_guard.
1337         (fhandler_pipe::set_close_on_exec): Don't handle guard here.
1338         (fhandler_pipe::close): Accommodate now-protected guard handle.
1339         (fhandler_pipe::fixup_in_child): Don't protect read_state here.
1340         (fhandler_pipe::fixup_after_exec): Close guard handle if close_on_exec.
1341         (fhandler_pipe::fixup_after_fork): Don't bother with guard here.
1342         (fhandler_pipe::dup): Don't set res to non-error prematurely.  Use
1343         boolean values where appropriate.  Protect guard and read_state.
1344         (fhandler_pipe::create): Don't call need_fork_fixup since it is now the
1345         default.  Don't protect read_state or guard.
1346
1347         * pipe.cc (fhandler_base::ready_for_read): Use bool values for "avail".
1348
1349         * spawn.cc (spawn_guts): Set cygheap->pid_handle as inheritable when
1350         protecting.
1351
1352 2006-05-15  Lev Bishop  <lev.bishop+cygwin@gmail.com>
1353             Christopher Faylor  <cgf@timesys.com>
1354
1355         * select.cc (fhandler_pipe::ready_for_read): Actually get the guard
1356         mutex for blocking reads.
1357
1358 2006-05-20  Christopher Faylor  <cgf@timesys.com>
1359
1360         * fhandler_tty.cc (fhandler_tty::close): Remove problematic hExeced guard.
1361
1362 2006-05-20  Christopher Faylor  <cgf@timesys.com>
1363
1364         * fhandler_tty.cc (fhandler_tty_slave::open): Reinstate call to
1365         need_invisible on first pty open.
1366
1367 2006-05-18  Christopher Faylor  <cgf@timesys.com>
1368
1369         * fhandler_console.cc (fhandler_console::need_invisible): Allocate an
1370         invisible window station when ctty != TTY_CONSOLE.
1371
1372 2006-05-16  Christopher Faylor  <cgf@timesys.com>
1373
1374         * cygtls.cc (_cygtls::remove): Don't test for initialization since
1375         this function will always be called when _my_tls is initialized.
1376         * init.cc (dll_entry): Don't attempt to remove tls info if _my_tls is
1377         obviously not even available.
1378
1379 2006-05-15  Christopher Faylor  <cgf@timesys.com>
1380
1381         * sigproc.cc (no_signals_available): Detect hwait_sig ==
1382         INVALID_HANDLE_VALUE.
1383         (wait_sig): Set hwait_sig to INVALID_HANDLE_VALUE on __SIGEXIT.
1384
1385 2006-05-15  Christopher Faylor  <cgf@timesys.com>
1386
1387         * cygtls.cc (_cygtls::init_thread): Zero entire _my_tls structure and
1388         no more.
1389         * cygtls.h (_my_tls::padding): Delete.
1390         (CYGTLS_PADSIZE): Redefine concept of padding to mean padding at the
1391         end of the stack.
1392         * dcrt0.cc (initialize_main_tls): Change return to void.
1393         * gentls_offsets: Treat const specially, too.  Keep going after a '}'
1394         is found.  Change negative offset calculation to use CYGTLS_PADSIZE.
1395         * init.cc (_my_oldfunc): New variable.
1396         (threadfunc_fe): Use stored tls value for oldfunc rather than blindly
1397         writing to the stack.
1398         (munge_threadfunc): Set oldfunc in tls.
1399         (dll_entry): Initialize tls allocation.
1400         * tlsoffsets.h: Regenerate.
1401
1402 2006-05-13  Christopher Faylor  <cgf@timesys.com>
1403
1404         * ntdll.h (STATUS_INVALID_INFO_CLASS): Conditionalize.
1405
1406 2006-05-10  Brian Dessent  <brian@dessent.net>
1407
1408         * Makefile.in (clean): Also delete *.dbg.
1409
1410 2006-05-08  Christian Franke  <Christian.Franke@t-online.de>
1411
1412         * fhandler_disk_file.cc (fhandler_disk_file::readdir): Fix typo which
1413         caused test for ".." to be skipped.
1414
1415 2006-05-02  Christopher Faylor  <cgf@timesys.com>
1416
1417         * external.cc (cygwin_internal): Set errno on failure.
1418
1419 2006-04-27  Corinna Vinschen  <corinna@vinschen.de>
1420
1421         * pipe.cc (DEFAULT_PIPEBUFSIZE): Raise to 64K.
1422
1423 2006-04-26  Corinna Vinschen  <corinna@vinschen.de>
1424
1425         * fhandler.h (fhandler_base): Change fstat_helper prototype
1426         to take file size and inode number as 64 bit values.
1427         * fhandler_disk_file.cc (FS_IS_SAMBA): Move to path.cc
1428         (FS_IS_SAMBA_WITH_QUOTA): Ditto.
1429         (path_conv::hasgood_inode): Delete.
1430         (path_conv::is_samba): Delete.
1431         (path_conv::isgood_inode): Centralized function to recognize
1432         a good inode number.
1433         (fhandler_base::fstat_by_handle): Constify fvi_size and fai_size.
1434         Accomodate argument change in fstat_helper.
1435         (fhandler_base::fstat_by_name): Ditto.
1436         (fhandler_base::fstat_helper): Accomodate argument change.  Call
1437         path_conv::isgood_inode to recognize good inodes.
1438         (fhandler_disk_file::opendir): Explain Samba weirdness here.
1439         Call path_conv::fs_is_samba instead of path_conv::is_samba.
1440         (fhandler_disk_file::readdir): Add STATUS_INVALID_INFO_CLASS
1441         as valid return code from NtQueryDirectoryFile to indicate that
1442         FileIdBothDirectoryInformation is not supported.
1443         Call path_conv::isgood_inode to recognize good inodes.
1444         * ntdll.h (STATUS_INVALID_INFO_CLASS): Define.
1445         * path.cc (fs_info::update): Rework file system recognition
1446         and set appropriate flags.
1447         * path.h (struct fs_info): Add is_ntfs, is_samba and is_nfs flags.
1448         Constify pure read accessors.
1449
1450 2006-04-24  Christopher Faylor  <cgf@timesys.com>
1451
1452         * environ.cc (getearly): Force correct dereference order when
1453         inspecting environ table.
1454
1455 2006-04-24  Corinna Vinschen  <corinna@vinschen.de>
1456
1457         * select.cc (thread_pipe): Raise sleep time only every 8th iteration.
1458         (thread_mailslot): Ditto.
1459
1460 2006-04-23  Corinna Vinschen  <corinna@vinschen.de>
1461             Christopher Faylor  <cgf@timesys.com>
1462
1463         * select.cc (thread_pipe): Raise sleep time dynamically to speed up
1464         select on pipes when copying lots of data.
1465         (thread_mailslot): Ditto for mailslots.
1466
1467 2006-04-22  Christopher Faylor  <cgf@timesys.com>
1468
1469         * signal.cc (abort): On second thought, just set incyg once.
1470
1471 2006-04-22  Christopher Faylor  <cgf@timesys.com>
1472
1473         * signal.cc (abort): Set incyg manually to help get a reliable gdb
1474         stack trace.
1475         * cygwin.din (abort): Make NOSIGFE.
1476
1477 2006-04-21  Pierre Humblet Pierre.Humblet@ieee.org
1478             Christopher Faylor  <cgf@timesys.com>
1479
1480         * environ.cc (getearly): Use GetEnvironmentVariable and cmalloc instead
1481         of GetEnvironmentStrings.
1482         (environ_init): Revert rawenv stuff.
1483
1484 2006-04-21  Christopher Faylor  <cgf@timesys.com>
1485
1486         * environ.cc (rawenv): Make this variable a file-scope static.
1487         (getearly): Rename 's' variable to 'len' since 's' is used fairly
1488         consistently throughout cygwin as a string variable.  Remove rawenv
1489         declaration.  Perform other minor cleanups.
1490         (environ_init): Remove rawenv declaration.  Only set rawenv to
1491         GetEnvironmentStrings() if it has not already been set.  Properly free
1492         rawenv in all cases.
1493
1494 2006-04-21  Christopher Faylor  <cgf@timesys.com>
1495
1496         * tty.h (tty::hwnd): Move to tty_min.
1497         (tty::gethwnd): Ditto.
1498         (tty::sethwnd): Ditto.
1499         (tty_min::hwnd): Receive variable from tty class.
1500         (tty_min::gethwnd): Receive function from tty classs.
1501         (tty_min::sethwnd): Ditto.
1502         * dtable.cc (dtable::stdio_init): Only call init_console_handler when
1503         we actually own the console.
1504         * fhandler_console.cc (fhandler_console::get_tty_stuff): Set tty's hwnd
1505         to non-zero value.
1506         * fhandler_termios.cc (fhandler_termios::tcsetpgrp): Semi-reinstate
1507         handling of console when pgrp is set.
1508
1509 2006-04-21  Pierre Humblet  <Pierre.Humblet@ieee.org>
1510             Corinna Vinschen  <corinna@vinschen.de>
1511
1512         * environ.cc (getearly): New function.
1513         (findenv_func): New function pointer, predefined to getearly.
1514         (getenv): Call findenv function over the findenv_func pointer.
1515         (environ_init): Change findenv_func pointer to my_findenv after Cygwin
1516         environment is initialized.
1517
1518 2006-04-21  Lars Munch  <lars@segv.dk>
1519
1520         * include/asm/byteorder.h (__ntohl): Fix the missing uint32_t.
1521
1522 2006-04-21  Corinna Vinschen  <corinna@vinschen.de>
1523
1524         * fhandler_socket.cc (fhandler_socket::wait): Reorder setting
1525         WSAError to avoid spurious errors with WSAError set to 0.
1526
1527 2006-04-21  Corinna Vinschen  <corinna@vinschen.de>
1528
1529         * include/asm/byteorder.h: Include stdint.h.  Per standard, change
1530         datatypes in ntohX and htonX functions to uintXX_t types.
1531
1532 2006-04-18  Christopher Faylor  <cgf@timesys.com>
1533
1534         * exceptions.cc (ctrl_c_handler): Only exit TRUE on CTRL_LOGOFF_EVENT
1535         when we have actually handled the event.
1536
1537 2006-04-17  Eric Blake  <ebb9@byu.net>
1538
1539         * mktemp.cc (_gettemp): Open temp files in binary mode.
1540
1541 2006-04-14  Corinna Vinschen  <corinna@vinschen.de>
1542
1543         * fhandler_disk_file.cc (fhandler_disk_file::readdir): Use UINT32_MAX
1544         instead of UINT_MAX.
1545
1546 2006-04-14  Corinna Vinschen  <corinna@vinschen.de>
1547
1548         * fhandler_disk_file.cc (path_conv::hasgood_inode): Make inline.
1549         Drop remote fs handling entirely since unreliable inode numbers
1550         are now recognized differently.
1551         (path_conv::is_samba): Make inline.
1552         (fhandler_disk_file::opendir): Reformat comment.
1553         (fhandler_base::fstat_helper): Special case remote file systems
1554         returning (unreliable) 32 bit inode numbers.
1555         (fhandler_disk_file::readdir): Ditto.
1556         * fhandler_netdrive.cc (fhandler_netdrive::readdir): Ditto.
1557
1558 2006-04-13  Christopher Faylor  <cgf@timesys.com>
1559
1560         * spawn.cc (spawn_guts): Move ch.set() call back to where it was
1561         supposed to be.
1562
1563 2006-04-13  Corinna Vinschen  <corinna@vinschen.de>
1564
1565         * sysconf.cc (sysconf): Add _SC_THREADS, _SC_THREAD_ATTR_STACKSIZE,
1566         _SC_THREAD_PRIORITY_SCHEDULING, _SC_THREAD_PROCESS_SHARED,
1567         _SC_THREAD_SAFE_FUNCTIONS, _SC_TIMERS handling.
1568
1569 2006-04-12  Corinna Vinschen  <corinna@vinschen.de>
1570             Christopher Faylor  <cgf@timesys.com>
1571
1572         * spawn.cc (spawn_guts): Revert patch which treated derived cygwin
1573         programs differently from those which are mounted with -X.  Pass extra
1574         argument to linebuf::fromargv.
1575         * winf.h (MAXCYGWINCMDLEN): New define.
1576         (linebuf::finish): Add a new argument denoting when command line
1577         overflow is ok.
1578         (linebuf::fromargv): Ditto.
1579         * winf.cc (linebuf::finish): Implement above change.
1580         (linebuf::fromargv): Ditto.
1581
1582 2006-04-11  Christopher Faylor  <cgf@timesys.com>
1583
1584         * Makefile.in (DLL_OFILES): Add winf.o.
1585         * spawn.cc: Move command line handling stuff into winf.cc.
1586         * winf.h: New file.
1587         * winf.cc: New file.
1588
1589 2006-04-05  Christopher Faylor  <cgf@timesys.com>
1590
1591         * fhandler_socket.cc: Move iptypes.h include after winsock2 since it
1592         now relies on it.
1593         * net.cc: Ditto.
1594
1595 2006-04-05  Christopher Faylor  <cgf@timesys.com>
1596
1597         * dcrt0.cc (dll_crt0_0): Move user_data->{resourcelocks,threadinterface}
1598         initialization here from dll_crt0_1.
1599         (dll_crt0_1): See above.
1600
1601 2006-04-04  Corinna Vinschen  <corinna@vinschen.de>
1602
1603         * net.cc (fdsock): Raise default SO_RCVBUF/SO_SNDBUF buffer sizes to
1604         the same values as on Linux.
1605
1606 2006-04-03  Christopher Faylor  <cgf@timesys.com>
1607
1608         * child_info.h (CURR_CHILD_INFO_MAGIC): Update.
1609         (child_info_fork::alloc_stack): Move into this class.
1610         (child_info_fork::alloc_stack_hard_way): Ditto.
1611         * dcrt0.cc (child_info_fork::alloc_stack): Ditto.
1612         (child_info_fork::alloc_stack_hard_way): Ditto.
1613         (_dll_crt0): Reference alloc_stack via fork_info.
1614
1615 2006-04-03  Corinna Vinschen  <corinna@vinschen.de>
1616
1617         * spawn.cc (linebuf::finish): Drop argument.  Don't check command line
1618         length.
1619         (spawn_guts): Remove wascygexec.  Check real_path.iscygexec instead.
1620         Accommodate change to linebuf::finish.
1621
1622 2006-04-03  Christopher Faylor  <cgf@timesys.com>
1623
1624         * dcrt0.cc (sm): Delete.
1625         (alloc_stack_hard_way): Figure out where the stack lives here rather
1626         than relying on previously filled out information which has been
1627         invalid since 1.5.19.
1628
1629 2006-03-31  Corinna Vinschen  <corinna@vinschen.de>
1630
1631         * fhandler_disk_file.cc (FS_IS_SAMBA_WITH_QUOTA): New define.
1632         (path_conv::hasgood_inode): Recognize Samba with quota support
1633         compiled in.
1634         (path_conv::is_samba): Ditto.  Fix comment to include Samba version
1635         numbers for later reference.
1636
1637 2006-03-30  Corinna Vinschen  <corinna@vinschen.de>
1638
1639         * security.h (sec_user_nih): Make sid1 argument mandatory.
1640         (sec_user): Ditto.
1641
1642 2006-03-29  Christopher Faylor  <cgf@timesys.com>
1643
1644         * sigproc.cc (wait_for_sigthread): Use the current user sid when
1645         setting up the signal pipe rather than relying on (eventually) the
1646         effective sid.
1647
1648 2006-03-29  Christopher Faylor  <cgf@timesys.com>
1649
1650         * dcrt0.cc (child_info_fork::handle_fork): Set uid/gid in myself so
1651         that it can be used by subsequent startup functions.
1652         (dll_crt0_0): Issue a warning if DuplicateTokenEx fails and DEBUGGING.
1653         (dll_crt0_1): Move user_data->{resourcelocks,threadinterface}
1654         initialization here from dll_crt0_0.
1655         * fork.cc (frok::child): Tell wait_for_sigthread that this is fork.
1656         (frok::parent): Only initialize start_time once.  Tighten time when
1657         we're "deimpersonated".
1658         * sigproc.cc (signal_fixup_after_exec): Rework (futiley) sa_buf stuff.
1659         Add debugging output.
1660         (wait_for_sigthread): Accept an argument which illustrates whether we
1661         are forked or not.
1662         (wait_sig): Avoid using myself pointer.
1663         * winsup.h ((wait_for_sigthread): Reflect change to argument.
1664
1665 2006-03-26  Christopher Faylor  <cgf@timesys.com>
1666
1667         * spawn.cc (spawn_guts): Close handles if we know that we will not be
1668         seeing a sync event from the child.
1669
1670 2006-03-26  Christopher Faylor  <cgf@timesys.com>
1671
1672         * sigproc.cc (wait_sig): Move myself manipulation...
1673         (wait_for_sigthread): ...to here.
1674
1675 2006-03-24  Corinna Vinschen  <corinna@vinschen.de>
1676
1677         * fhandler_floppy.cc: Include ntdef.h and ntdll.h.
1678         (fhandler_dev_floppy::get_drive_info): Rearrange so that now
1679         NtQueryVolumeInformationFile is called on drives which don't support
1680         IOCTL_DISK_GET_DRIVE_GEOMETRY.
1681         * ntdll.h (struct _FILE_FS_SIZE_INFORMATION): Add.
1682         (enum _FSINFOCLASS): Add missing values.
1683
1684 2006-03-23  Christopher Faylor  <cgf@timesys.com>
1685
1686         * fhandler_console.cc (fhandler_console::fixup_after_fork_exec): Make
1687         error message more explicit.
1688         * pinfo.cc (_pinfo::commune_request): Don't lock process unless we're
1689         looking for fifos.
1690
1691 2006-03-23  Christopher Faylor  <cgf@timesys.com>
1692
1693         * dcrt0.cc (child_info_spawn::handle_spawn): Don't initialize the
1694         console handler here.
1695         * dtable.cc (dtable::stdio_init): Initialize console handler here.
1696
1697 2006-03-23  Christopher Faylor  <cgf@timesys.com>
1698
1699         * sigproc.cc (sigalloc): Don't set SA_RESTART here.
1700         * signal.cc (_SA_NORESTART): New flag.
1701         (sigaction_worker): New function, derived from sigaction.  Don't set
1702         internal flags unless called internally.
1703         (sigaction): Use sigaction_worker.
1704         (signal): Honor new _SA_NORESTART flag.
1705         (siginterrupt): Set _SA_NORESTART flag appropriately.  Use
1706         sigaction_worker to set flags.
1707         * include/cygwin/signal.h: Define _SA_INTERNAL_MASK here.
1708
1709 2006-03-22  Corinna Vinschen  <corinna@vinschen.de>
1710
1711         * thread.cc (pthread_mutex::is_good_initializer_or_bad_object): Delete.
1712         (pthread_cond::is_good_initializer_or_bad_object): Delete.
1713         (pthread_rwlock::is_good_initializer_or_bad_object): Delete.
1714         (pthread_cond::init): Remove disabled code.  Guard assignment to
1715         object to initialize against access violation.
1716         (pthread_rwlock::init): Ditto.
1717         (pthread_mutex::init): Ditto.
1718
1719 2006-03-22  Eric Blake  <ebb9@byu.net>
1720
1721         * fhandler.cc (fcntl): Print flags in hex.
1722
1723 2006-03-22  Christopher Faylor  <cgf@timesys.com>
1724
1725         * dcrt0.cc (dll_crt0_0): Semi-revert 2006-03-14 change which moved
1726         pinfo_init and uinfo_init here.
1727         (dll_crt0_1): Ditto.
1728         (__dll_crt0): Ditto. Don't call update_envptrs here.
1729         (dll_crt0_1): Ditto. Move wait_for_sigthread call here from dll_crt0_0.
1730         * environ.cc (environ_init): Call it here instead.
1731         * sigproc.cc (my_readsig): New static variable.
1732         (wait_for_sigthread): Set up read pipe here since we are assured that
1733         we have the proper privileges when this is called.
1734         (talktome): Eliminate second argument since it is available as a global
1735         now.
1736         (wait_sig): Reflect use of my_readsig.
1737
1738 2006-03-22  Corinna Vinschen  <corinna@vinschen.de>
1739
1740         * thread.cc (pthread_cond::init): Disable validity test of object
1741         to initialize since test of uninitialized content is unreliable.
1742         (pthread_rwlock::init): Ditto.
1743         (pthread_mutex::init): Ditto.
1744
1745 2006-03-21  Christopher Faylor  <cgf@timesys.com>
1746
1747         * signal.cc (signal): Don't set SA_RESTART here.
1748         (siginterrupt): White space.
1749         * sigproc.cc (sigalloc): Set SA_RESTART here, on initialization.
1750
1751 2006-03-21  Christopher Faylor  <cgf@timesys.com>
1752
1753         * child_info.h (child_status): Fix typo which made it impossible to set
1754         iscygwin.
1755         (child_info::isstraced): Booleanize.
1756         (child_info::iscygwin): Ditto.
1757         * sigproc.cc (child_info::child_info): Minor cleanup of flag setting.
1758         * spawn.cc (spawn_guts): Only close_all_files when we know the process
1759         has started successfully.
1760
1761         * exceptions.cc (init_console_handler): Fix indentation.
1762
1763 2006-03-20  Christopher Faylor  <cgf@timesys.com>
1764
1765         * dcrt0.cc (dll_crt0_0): Call SetErrorMode earlier.
1766         * pinfo.cc (_pinfo::dup_proc_pipe): Reset wr_proc_pipe on failure.
1767         Return previous pipe handle.
1768         * pinfo.h (_pinfo::dup_proc_pipe): Reflect change to return value.
1769         * spawn.cc (spawn_guts): Restore previous proc pipe on retry or if
1770         process exits before synchronization.
1771
1772 2006-03-20  Christopher Faylor  <cgf@timesys.com>
1773
1774         * child_info.h (child_status): New enum.
1775         (child_info::flag): Rename from 'straced'.
1776         (child_info::isstraced): New function.
1777         (child_info::iscygwin): Ditto.
1778         (child_info_fork::handle_fork): Reparmize.
1779         (child_info_fork::handle_failure): Ditto.
1780         (child_info_spawn::handle_spawn): New function.
1781         * dcrt0.cc (get_cygwin_startup_info): Use isstraced method.
1782         (child_info_spawn::handle_spawn): Define new function from code
1783         previously in dll_crt0_0.
1784         (dll_crt0_0): Move spawn stuff into handle_spawn.  Only call
1785         init_console_handler for fork case.
1786         * sigproc.cc (child_info::child_info): Set flag appropriately.
1787         (child_info::proc_retry): Treat exit code as "funny" if it's a cygwin
1788         process.
1789         * spawn.cc (spawn_guts): Remove commented out flag setting.
1790
1791 2006-03-19  Christopher Faylor  <cgf@timesys.com>
1792
1793         * pinfo.cc (commune_process): Fix randomly invalid pointer which caused
1794         fifos to work incorrectly.
1795
1796 2006-03-19  Christopher Faylor  <cgf@timesys.com>
1797
1798         * dcrt0.cc (dll_crt0_0): Oops.  We need to bother with setting
1799         init_console_handler in the fork/exec case.
1800
1801 2006-03-19  Christopher Faylor  <cgf@timesys.com>
1802
1803         * dcrt0.cc (dll_crt0_0): Don't bother with setting init_console_handler
1804         here since it will be set later when we discover if we have a ctty or
1805         not.
1806         * exceptions.cc (init_console_handler): Properly remove NULL handler.
1807
1808 2006-03-18  Christopher Faylor  <cgf@timesys.com>
1809
1810         * pinfo.h (EXITCODE_OK): Define new constant.
1811         * sigproc.cc (child_info::sync): Return EXITCODE_OK if entering with
1812         exit_code == 0.
1813         (sig_send): Don't complain if sending signals while blocked if the
1814         sender isn't in the main thread.
1815
1816 2006-03-18  Christopher Faylor  <cgf@timesys.com>
1817
1818         * child_info.h (CURR_CHILD_INFO_MAGIC): Regenerate.
1819         (child_info::retry): Move here from fork subclass.
1820         (child_info::exit_code): New field.
1821         (child_info::retry_count): Max retry count for process start.
1822         (child_info::proc_retry): Declare new function.
1823         (child_info_fork::retry): Move to parent.
1824         (child_info_fork::fork_retry): Ditto.
1825         * dcrt0.cc (child_info::fork_retry): Rename and move.
1826         (child_info_fork::handle_failure): Move.
1827         (dll_crt0_0): Initialize console handler based on whether we have a
1828         controlling tty or not.  Avoid nonsensical check for fork where it can
1829         never occur.
1830         * environ.cc (set_proc_retry): Rename from set_fork_retry.  Set
1831         retry_count in child_info.
1832         (parse_thing): Reflect above change.
1833         * exceptions.cc (dummy_ctrl_c_handler): Remove unused variable name.
1834         (ctrl_c_handler): Always return TRUE for the annoying
1835         CTRL_LOGOFF_EVENT.
1836         * fhandler_termios.cc (fhandler_termios::tcsetpgrp): Remove call to
1837         init_console_handler.
1838         * fhandler_tty.cc (fhandler_tty_slave::open): Just call
1839         mange_console_count here and let it decide what to do with initializing
1840         console control handling.
1841         * fork.cc (fork_retry): Remove definition.
1842         (frok::parent): Define static errbuf and use in error messages (not
1843         thread safe yet).  Close pi.hThread as soon as possible.  Protect
1844         pi.hProcess as soon as possible.  Don't set retry_count.  That happens
1845         automatically in the constructor now.  Accommodate name change from
1846         fork_retry to proc_retry.
1847         * init.cc (dll_entry): Turn off ctrl-c handling early until we know how
1848         it is supposed to be handled.
1849         * pinfo.cc (_pinfo::dup_proc_pipe): Remember original proc pipe value
1850         for failure error message.  Tweak debug message slightly.
1851         * sigproc.cc (child_info::retry_count): Define.
1852         (child_info::child_info): Initialize retry count.
1853         (child_info::sync): Set exit code if process dies before
1854         synchronization.
1855         (child_info::proc_retry): Rename from child_info_fork::fork_retry.  Use
1856         previously derived exit code.  Be more defensive about what is
1857         classified as an error exit.
1858         (child_info_fork::handle_failure): Move here from dcrt0.cc.
1859         * spawn.cc (spawn_guts): Maintain error mode when starting new process
1860         to avoid annoying pop ups.  Move deimpersonate call within new loop.
1861         Move envblock freeing to end.  Loop if process dies prematurely with
1862         bad exit code.
1863         * syscalls.cc (setpgid): Remove hopefully unneeded call to
1864         init_console_handler.
1865
1866 2006-03-15  Christopher Faylor  <cgf@timesys.com>
1867
1868         * cygheap.cc (init_cygheap::manage_console_count): Turn console control
1869         handler on/off depending on whether we have allocated a console or not.
1870         * dcrt0.cc (child_info_fork::fork_retry): Add more potential retry
1871         statuses.
1872         (dll_crt0_0): Turn on/off console control depending on whether we have
1873         a controlling tty or not.
1874         * exceptions.cc (init_console_handler): Change BOOL to bool.
1875         * fhandler_console.cc (fhandler_console::need_invisible): Cosmetic
1876         change.
1877         * winsup.h (init_console_handler): Reflect argument type change.
1878
1879         * wincap.h (supports_setconsolectrlhandler_null): Remove duplicate
1880         capability throughout.
1881         * wincap.cc: Ditto.
1882
1883 2006-03-14  Christopher Faylor  <cgf@timesys.com>
1884
1885         * child_info.h (child_info_fork::fork_retry): Declare new function.
1886         * dcrt0.cc (child_info_fork::fork_retry): Define new function.
1887         * fork.cc (frok::parent): Move retry decision into
1888         child_info_fork::fork_retry and honor what it tells us to do.
1889         * sigproc.cc (sig_send): Unhold signals on __SIGEXIT.
1890
1891 2006-03-14  Christopher Faylor  <cgf@timesys.com>
1892
1893         * fork.cc (frok::parent): Improve error message.
1894
1895 2006-03-14  Christopher Faylor  <cgf@timesys.com>
1896
1897         * dcrt0.cc (main_environ): Initialize to &__cygwin_environment.
1898         (dll_crt0_1): Move resourcelocks, thread interface, pinfo_init, and
1899         uinfo_init...
1900         (dll_crt0_0): ...to here.
1901         (_dll_crt0): Call update_envptrs here after setting main_environ.
1902         * environ.cc (environ_init): Eliminate initted variable.  Don't call
1903         update_envptrs here.
1904         * sigproc.cc (wait_sig): Use my_sendsig when calling CreatePipe to
1905         avoid a dereference.
1906
1907 2006-03-13  Christopher Faylor  <cgf@timesys.com>
1908
1909         * child_info.h (child_info_fork::handle_failure): Declare new function.
1910         (child_info_fork::retry): New field.
1911         * dcrt0.cc (__api_fatal_exit_val): Define.
1912         (child_info_fork::handle_failure): Define new function.
1913         (__api_fatal): Exit using __api_fatal_exit_val value.
1914         * environ.cc (set_fork_retry): Set fork_retry based on CYGWIN
1915         environment variable.
1916         (parse_thing): Add "fork_retry" setting.
1917         * fork.cc (fork_retry): Define.
1918         (frok::parent): Reorganize to allow retry of failed child creation if
1919         child signalled that it was ok to do so.
1920         * heap.cc (heap_init): Signal parent via handle_failure when
1921         VirtualAlloc fails.
1922         * pinfo.h (EXITCODE_RETRY): Declare.
1923         * sigproc.cc (child_info::sync): Properly exit with failure condition
1924         if called for fork and didn't see subproc_ready.
1925         * spawn.cc (spawn_guts): Use windows pid as first argument.
1926         * winsup.h: Remove obsolete NEW_MACRO_VARARGS define.
1927         (__api_fatal_exit_val): Declare.
1928         (set_api_fatal_return): Define.
1929         (in_dllentry): Declare.
1930         * exceptions.cc (inside_kernel): Remove unneeded in_dllentry
1931         declaration.
1932
1933 2006-03-13  Christopher Faylor  <cgf@timesys.com>
1934
1935         * dcrt0.cc (dll_crt0_0): Reorganize so that sigproc_init is called a
1936         little later.  Add a comment.
1937         * fork.cc (resume_child): Make void.
1938         (frok::parent): Only zero pi when necessary.  Explicitly zero si.  Set
1939         this_errno when child_copy fails.  Accommodate change to resume_child.
1940         * sigproc.cc (sigalloc): Move global_sigs initialization here.
1941         (sigproc_init): Move global_sigs.
1942         (sig_send): Just check for flush signals once.
1943
1944         * wincap.h: Define supports_setconsolectrlhandler_null throughout.
1945         * wincap.cc: Ditto.
1946
1947 2006-03-13  Corinna Vinschen  <corinna@vinschen.de>
1948
1949         * autoload.cc (LoadDLLfuncNt): New define to wrap NT native functions.
1950         Use for NT native functions throughout.
1951         * dtable.cc (handle_to_fn): Treat return value of NtQueryObject as
1952         NTSTATUS value.
1953
1954 2006-03-12  Christopher Faylor  <cgf@timesys.com>
1955
1956         * cygtls.cc (_cygtls::remove): Reset initialized flag right away if we
1957         were previously initialized.
1958         * cygtls.h (_cygtls::initialized): Move nearer to the end to catch
1959         situation when Windows 98 mysteriously changes parts of _my_tls when
1960         thread is detaching.
1961         * gendef (__sigfe_maybe): Simplify slightly.
1962         * tlsoffsets.h: Regenerate.
1963
1964 2006-03-12  Christopher Faylor  <cgf@timesys.com>
1965
1966         * cygtls.h (CYGTLS_INITIALIZED): Change to a little more unlikely value.
1967         (CYGTLSMAGIC): Delete.
1968         * dcrt0.cc (dll_crt0_0): Call sigproc_init during init startup.
1969         (_dll_crt0): Don't worry about sync_startup.  Just wait for sigthread here.
1970         * dll_init.cc (cygwin_detach_dll): Only pick up tls version of retaddr
1971         if we have a valid tls.
1972         * fork.cc (frok::child): Remove sigproc_init initialization since it
1973         happens much earlier now.
1974         * gendef: Recognize SIGFE_MAYBE.
1975         (fefunc): Generate calls to _sigfe_maybe, if appropriate.
1976         (_sigfe_maybe): New function.
1977         * init.cc (search_for): Always initialize search_for, even on fork.
1978         (calibration_thread): Delete.
1979         (calibration_id): Delete.
1980         (prime_threads): Delete.
1981         (munge_threadfunc): Remove calibration_thread special case.  Avoid
1982         calling thread function if we haven't yet hit the "search_for" thread.
1983         (dll_entry): Remove prime_threads call.  Only call munge_threadfunc
1984         when hwait_sig is active.  Ditto. for _my_tls.remove ();
1985         * sigproc.cc (hwait_sig): Make global.
1986         (sigproc_init): Don't bother with sync_startup.
1987         (sig_send): Treat flush as a no-op when signals are held.
1988         (wait_sig): Cause signals to be held after fork.
1989
1990 2006-03-09  Corinna Vinschen  <corinna@vinschen.de>
1991
1992         * syscalls.cc (rename): Move existance check for oldpath further up
1993         to the start of the function.  Avoid another case of a name collision
1994         if oldpath is a shortcut and a file or directory newpath already exists.
1995
1996 2006-03-09  Corinna Vinschen  <corinna@vinschen.de>
1997
1998         * autoload.cc (NtClose): Define.
1999         (NtOpenDirectoryObject): Define.
2000         (NtQueryDirectoryObject): Define.
2001         * fhandler_proc.cc: Include ctype.h and wchar.h.
2002         (format_proc_partitions): Revamp loop over existing harddisks by
2003         scanning the NT native \Device object directory and looking for
2004         Harddisk entries.
2005         * ntdll.h: Rearrange system call declarations alphabetically.
2006         (DIRECTORY_QUERY): Define.
2007         (struct _DIRECTORY_BASIC_INFORMATION): Define.
2008         (NtOpenDirectoryObject): Declare.
2009         (NtQueryDirectoryObject): Declare.
2010
2011 2006-03-08  Christopher Faylor  <cgf@timesys.com>
2012
2013         * cygtls.h (_cygtls::retaddr): New method.
2014         * dll_init.cc (cygwin_detach_dll): Use new tls method to find return
2015         address since this function is now signal guarded.
2016         (update_envptrs): Remove unneeded braces.
2017         * syscalls.cc (statvfs): Coerce full_path to avoid a gcc warning.
2018
2019 2006-03-08  Corinna Vinschen  <corinna@vinschen.de>
2020
2021         * syscalls.cc (statvfs): Simplify path name expression.
2022
2023 2006-03-08  Corinna Vinschen  <corinna@vinschen.de>
2024
2025         * syscalls.cc: Include winioctl.h.
2026         (statvfs): Request correct volume size using DeviceIoControl if
2027         quotas are enforced on the file system.
2028
2029 2006-03-03  Corinna Vinschen  <corinna@vinschen.de>
2030
2031         * dir.cc (opendir): Fix indentation.
2032         * fhandler_disk_file.cc (fhandler_disk_file::opendir): Move storing
2033         fhandler in file descriptor table to some point very late in function
2034         to avoid double free'ing.  Add comment to explain what happens.
2035         Add label free_mounts and don't forget to delete __DIR_mounts structure
2036         if NtOpenFile fails.
2037
2038 2006-03-02  Corinna Vinschen  <corinna@vinschen.de>
2039
2040         * syscalls.cc (chroot): Disallow chroot into special directories.
2041         Return EPERM instead.
2042
2043 2006-03-02  Corinna Vinschen  <corinna@vinschen.de>
2044
2045         * fhandler_disk_file.cc (__DIR_mounts::check_missing_mount): Check
2046         cygdrive string length for those who have cygdrive mapped to "/".
2047
2048 2006-03-01  Corinna Vinschen  <corinna@vinschen.de>
2049
2050         * sec_helper.cc (set_cygwin_privileges): Request SE_BACKUP_NAME
2051         privileges.
2052
2053 2006-03-01  Corinna Vinschen  <corinna@vinschen.de>
2054
2055         * fhandler_proc.cc (fhandler_proc::fstat): Always return fixed link
2056         count of 1 for /proc directory instead of incorrect PROC_LINK_COUNT.
2057
2058 2006-03-01  Corinna Vinschen  <corinna@vinschen.de>
2059
2060         * fhandler.h (enum dirent_states): Remove dirent_saw_cygdrive,
2061         dirent_saw_dev and dirent_saw_proc.
2062         (fhandler_cygdrive::open): Declare.
2063         (fhandler_cygdrive::close): Declare.
2064         * fhandler_disk_file.cc (class __DIR_mounts): Move to beginning of file.
2065         (__DIR_mounts::check_mount): New parameter to indicate if inode number
2066         is needed in calling function or not. Add /proc and /cygdrive handling.
2067         (__DIR_mounts::check_missing_mount): Ditto.
2068         (path_conv::ndisk_links): Use __DIR_mounts class to create correct
2069         hardlink count for directories with mount points in them.
2070         (fhandler_disk_file::readdir_helper): Remove /dev, /proc and /cygdrive
2071         handling.
2072         (fhandler_cygdrive::open): New method.
2073         (fhandler_cygdrive::close): New method.
2074         (fhandler_cygdrive::fstat): Always return fixed inode number 2 and
2075         fixed link count of 1. Drop call to set_drives.
2076         (fhandler_cygdrive::opendir): Drop call to get_namehash.
2077         (fhandler_cygdrive::readdir): Handle "." entry to return fixed inode
2078         number 2.
2079
2080 2006-03-01  Christopher Faylor  <cgf@timesys.com>
2081
2082         * cygwin.din: Fix some erroneous SIGFE/NOSIGFE settings.
2083
2084 2006-03-01  Christopher Faylor  <cgf@timesys.com>
2085
2086         * cygthread.cc (cygthread::callfunc): Revert below change.  Make ev a
2087         manual reset event again.  so that it will be reset by WaitFor*Object
2088         as appropriate.
2089         (cygthread::stub): Ditto.
2090         (cygthread::terminate_thread): Reset ev if it was found to have been
2091         set.
2092
2093 2006-03-01  Christopher Faylor  <cgf@timesys.com>
2094
2095         * analyze_sigfe: New script.
2096         * dllfixdbg: Add copyright.
2097         * gendef: Ditto.
2098         * gendevices: Ditto.
2099         * gentls_offsets: Ditto.
2100
2101 2006-03-01  Christopher Faylor  <cgf@timesys.com>
2102
2103         * cygthread.cc (cygthread::callfunc): Create ev as an auto-reset event
2104         so that it will be reset by WaitFor*Object as appropriate.
2105         (cygthread::stub): Ditto.
2106         (cygthread::terminate_thread): Remove forced setting of thread
2107         termination.
2108
2109 2006-03-01  Corinna Vinschen  <corinna@vinschen.de>
2110
2111         * include/sys/dirent.h (struct __DIR): Rename __d_unused to
2112         __d_internal.
2113         * fhandler_disk_file.cc (struct __DIR_cache): Remove useless "typedef".
2114         (d_dirname): Remove useless "struct".
2115         (d_cachepos): Ditto.
2116         (d_cache): Ditto.
2117         (class __DIR_mounts): New class, implementing mount point tracking
2118         for readdir.
2119         (d_mounts): New macro for easy access to __DIR_mounts structure.
2120         (fhandler_disk_file::opendir): Allocate __DIR_mounts structure and
2121         let __d_internal element of dir point to it.
2122         (fhandler_disk_file::readdir_helper): Add mount points in the current
2123         directory, which don't have a real directory backing them.
2124         Don't generate an inode number for /dev.  Add comment, why.
2125         (fhandler_disk_file::readdir): Move filling fname to an earlier point.
2126         Check if current entry is a mount point and evaluate correct inode
2127         number for it.
2128         (fhandler_disk_file::readdir_9x): Ditto.
2129         (fhandler_disk_file::rewinddir): Set all mount points in this directory
2130         to "not found" so that they are listed again after calling rewinddir().
2131         (fhandler_disk_file::closedir): Deallocate __DIR_mounts structure.
2132         * path.cc (mount_info::get_mounts_here): New method to evaluate a list
2133         of mount points in a given parent directory.
2134         * shared_info.h (class mount_info): Declare get_mounts_here.
2135
2136 2006-02-28  Corinna Vinschen  <corinna@vinschen.de>
2137
2138         * fhandler_disk_file.cc (fhandler_disk_file::opendir): Use iscygdrive
2139         instead of isspecial.
2140         * path.h (path_conv::iscygdrive): New method.
2141
2142 2006-02-28  Christopher Faylor  <cgf@timesys.com>
2143
2144         * exceptions.cc (_cygtls::interrupt_now): Remove "inside cygwin" check
2145         since some cygwin functions are meant to be interrupted.
2146
2147 2006-02-28  Corinna Vinschen  <corinna@vinschen.de>
2148
2149         * cygwin.din: Export __isinff, __isinfd, __isnanf, __isnand.
2150         * include/cygwin/version.h: Bump API minor number to 155.
2151
2152 2006-02-28  Corinna Vinschen  <corinna@vinschen.de>
2153
2154         * dir.cc (readdir_worker): Use slash as path separator when evaluating
2155         namehash for paths below /proc.
2156         * fhandler_netdrive.cc (fhandler_netdrive::readdir): Use expensive
2157         inode number evaluation on share names.
2158
2159 2006-02-27  Christopher Faylor  <cgf@timesys.com>
2160
2161         * fhandler_disk_file.cc (fhandler_disk_file::opendir): Only set
2162         d_cachepos under NT or suffer memory corruption.
2163         (fhandler_disk_file::readdir_helper): Avoid else with a return.  Just
2164         calculate extension location once when doing symlink checks.
2165         (fhandler_disk_file::readdir): Make debug output more useful.
2166         (fhandler_disk_file::readdir_9x): Ditto.  Eliminate redundant variable.
2167
2168 2006-02-27  Christopher Faylor  <cgf@timesys.com>
2169
2170         * include/sys/termios.h (cfsetispeed): Just define as a function rather
2171         than resorting to a macro.
2172         (cfsetospeed): Ditto.
2173
2174 2006-02-27  Christopher Faylor  <cgf@timesys.com>
2175
2176         * sigproc.cc: Fix a comment.
2177
2178 2006-02-27  Christopher Faylor  <cgf@timesys.com>
2179
2180         * cygthread.cc (cygthread::release): Add a comment.
2181
2182 2006-02-27  Corinna Vinschen  <corinna@vinschen.de>
2183
2184         * fhandler_netdrive.cc (fhandler_netdrive::fstat): Create unambiguous
2185         inode number.
2186         (fhandler_netdrive::readdir): Ditto.
2187
2188 2006-02-24  Christopher Faylor  <cgf@timesys.com>
2189
2190         * sigproc.cc (sigheld): Define new variable.
2191         (sig_dispatch_pending): Don't check sigq since that's racy.
2192         (sig_send): Set sigheld flag if __SIGHOLD is specified, reset it if
2193         __SIGNOHOLD is specified.  Ignore flush signals if we're holding
2194         signals.
2195
2196 2006-02-23  Christopher Faylor  <cgf@timesys.com>
2197
2198         * cygwin.din (_exit): Use signal front end.
2199         (exit): Ditto.
2200
2201 2006-02-23  Christopher Faylor  <cgf@timesys.com>
2202
2203         * winsup.h (cygwin_hmodule): Declare.
2204         * exceptions.cc (inside_kernel): Reverse return values to reflect
2205         function name.  Return true if we're in cygwin1.dll or if we're
2206         executing in dll_entry.
2207         (_cygtls::interrupt_now): Reflect reversal of inside_kernel return
2208         value.
2209         * hookapi.cc (cygwin_hmodule): Remove declaration.
2210         * init.cc (dll_entry): Use in_dllentry global to record that we are
2211         executing in dllentry.
2212
2213 2006-02-22  Corinna Vinschen  <corinna@vinschen.de>
2214
2215         * exceptions.cc (_cygtls::interrupt_now): Reorder conditional
2216         to call inside_kernel only if this isn't locked.
2217
2218 2006-02-22  Corinna Vinschen  <corinna@vinschen.de>
2219
2220         * fhandler.cc (fhandler_base::open): Add FILE_READ_ATTRIBUTES to
2221         access flags in case of query_read_control case, add FILE_READ_DATA
2222         in case of query_stat_control.
2223
2224 2006-02-20  Christopher Faylor  <cgf@timesys.com>
2225
2226         * spawn.cc (av::fixup): Check for .bat and friends specifically now
2227         since these extensions are no longer automatically detected.
2228
2229 2006-02-19  Christopher Faylor  <cgf@timesys.com>
2230
2231         * exceptions.cc (stackdump): Avoid dumping more than once.
2232
2233 2006-02-19  Christopher Faylor  <cgf@timesys.com>
2234
2235         * fhandler_disk_file.cc (fhandler_disk_file::opendir): Use NtOpenFile
2236         to open the directory.
2237         (fhandler_disk_file::readdir): Use NT_SUCCESS to determine if status
2238         represents success.
2239
2240 2006-02-19  Corinna Vinschen  <corinna@vinschen.de>
2241
2242         * fhandler_disk_file.cc (fhandler_disk_file::opendir): Drop generating
2243         path_conv for root.
2244
2245 2006-02-18  Corinna Vinschen  <corinna@vinschen.de>
2246
2247         * fhandler_disk_file.cc (FS_IS_SAMBA): Move out of
2248         path_conv::hasgood_inode.
2249         (path_conv::is_samba): New method.
2250         (fhandler_base::fstat_by_handle): Don't even try to use
2251         FileIdBothDirectoryInformation on Samba.
2252         * path.h (class path_conv): Declare is_samba method.
2253
2254 2006-02-17  Christopher Faylor  <cgf@timesys.com>
2255
2256         * path.cc (conv_path_list): Eat empty paths when converting to POSIX.
2257         (cygwin_conv_to_win32_path): Deal with Cygwin's necessity of adding a
2258         '/' to the end of a path ending in '.'.
2259
2260 2006-02-16  Corinna Vinschen  <corinna@vinschen.de>
2261
2262         * cygwin.din: Export sigignore and sigset.
2263         * exceptions.cc (sigset): New function.
2264         (sigignore): New function.
2265         * include/cygwin/signal.h (SIG_HOLD): Define.
2266         (sigignore): Declare.
2267         (sigset): Declare.
2268         * include/cygwin/version.h: Bump API minor number to 154.
2269
2270 2006-02-13  Igor Peshansky  <pechtcha@cs.nyu.edu>
2271
2272         * include/mntent.h: Add missing #include.
2273
2274 2006-02-13  Igor Peshansky  <pechtcha@cs.nyu.edu>
2275
2276         * gentls_offsets: Fix typo in error message.
2277
2278 2006-02-10  Christopher Faylor  <cgf@timesys.com>
2279
2280         * fhandler_process.cc (format_process_stat): Use cygwin-derived start
2281         time even on NT since it is the logical start time of the "process".
2282         * pinfo.cc (set_myself): Don't set start time when it should have
2283         already been set previously.
2284
2285 2006-02-10  Brian Ford  <Brian.Ford@FlightSafety.com>
2286
2287         * times.cc (clock_getres): Use correct conversion from milliseconds to
2288         seconds/nanoseconds.
2289         (clock_setres): Use correct conversion to nanoseconds.
2290
2291 2006-02-10  Christopher Faylor  <cgf@timesys.com>
2292
2293         * external.cc (sync_winenv): Rename from "setup_winenv".  Use same
2294         mechanism as spawn to determine environment variables which should be
2295         converted back to windows form.
2296         (cygwin_internal): Reflect setup_winenv -> sync_winenv name change.
2297         * include/sys/cygwin.h: Ditto.
2298
2299 2006-02-09  Corinna Vinschen  <corinna@vinschen.de>
2300
2301         * fhandler_disk_file.cc (fhandler_disk_file::opendir): Only set
2302         the dirent_get_d_ino flag on filesystems having useful File IDs.
2303         Add comment explaining why.
2304
2305 2006-02-07  Corinna Vinschen  <corinna@vinschen.de>
2306
2307         * dtable.cc (handle_to_fn): Accommodate new argument order in call to
2308         sys_wcstombs.
2309         * fhandler_disk_file.cc (fhandler_disk_file::readdir): Call sys_wcstombs
2310         instead of just wcstombs to accommodate OEM codepages.
2311         * miscfuncs.cc (sys_wcstombs): Split len argument in source and target
2312         length.  Always 0-terminate result in target string.
2313         * security.cc (lsa2wchar): Remove unused function.
2314         (lsa2str): Ditto.
2315         (get_lsa_srv_inf): Ditto.
2316         (get_logon_server): Accommodate new argument order in call to
2317         sys_wcstombs.
2318         (get_user_groups): Ditto.
2319         (get_user_local_groups): Ditto.
2320         (get_priv_list): Call sys_wcstombs directly instead of lsa2str.
2321         * uinfo.cc (cygheap_user::ontherange): Accommodate new argument order
2322         in call to sys_wcstombs.
2323         * winsup.h (sys_wcstombs): Change prototype to match new argument order.
2324
2325 2006-02-07  Corinna Vinschen  <corinna@vinschen.de>
2326
2327         * init.cc (respawn_wow64_process): Exit with the exit code returned
2328         by the respawned process.
2329
2330 2006-02-06  Christopher Faylor  <cgf@timesys.com>
2331
2332         Always zero all elements of siginfo_t throughout.
2333         * cygtls.h (_cygtls::thread_context): Declare new field.
2334         (_cygtls::thread_id): Ditto.
2335         (_cygtls::signal_exit): Move into this class.
2336         (_cygtls::copy_context): Declare new function.
2337         (_cygtls::signal_debugger): Ditto.
2338         * cygtls.cc (_cygtls::init_thread): Fill out thread id field.
2339         * exceptions.cc (exception): Change message when exception info is
2340         unknown.  Copy context to thread local storage.
2341         (_cygtls::handle_exceptions): Avoid double test for fault_guarded.
2342         Reflect move of signal_exit to _cygtls class.
2343         (sigpacket::process): Copy context to thread local storage.
2344         (_cygtls::signal_exit): Move to _cygtls class.  Call signal_debugger to
2345         notify debugger of exiting signal (WIP).  Call stackdump here (WIP).
2346         (_cygtls::copy_context): Define new function.
2347         (_cygtls::signal_debugger): Ditto.
2348         * tlsoffsets.h: Regenerate.
2349         * include/cygwin.h (_fpstate): New internal structure.
2350         (ucontext): Declare new structure (WIP).
2351         (__COPY_CONTEXT_SIZE): New define.
2352
2353         * exceptions.cc (_cygtls::interrupt_setup): Clear "threadkill" field
2354         when there is no sigwaiting thread.
2355         (setup_handler): Move event handling into interrupt_setup.
2356
2357 2006-02-06  Corinna Vinschen  <corinna@vinschen.de>
2358
2359         * fhandler_socket.cc (fhandler_socket::connect): Fix formatting.
2360         (fhandler_socket::wait): Handle SA_RESTART when signal arrives.
2361
2362 2006-02-06  Corinna Vinschen  <corinna@vinschen.de>
2363
2364         * include/cygwin/socket.h (CMSG_FIRSTHDR): Avoid compiler warning.
2365
2366 2006-02-05  Corinna Vinschen  <corinna@vinschen.de>
2367
2368         * include/features.h: Add comment to explain what's going to happen
2369         here at one point.
2370         * include/sys/stdio.h: Guard getline and getdelim prototypes with
2371         _GNU_SOURCE to avoid collision with old-style declarations.
2372
2373 2006-02-05  Corinna Vinschen  <corinna@vinschen.de>
2374
2375         * environ.cc (struct parse_thing): Add transparent_exe option.
2376         * fhandler_disk_file.cc (fhandler_disk_file::link): Accommodate
2377         transparent_exe option.  Add .exe suffix for links to executable files,
2378         if transparent_exe is set.
2379         * fhandler_process.cc (fhandler_process::fill_filebuf): Remove .exe
2380         suffix if transparent_exe option is set.
2381         * path.cc (symlink_worker): Accommodate transparent_exe option.
2382         (realpath): Don't tack on .exe suffix if transparent_exe is set.
2383         * syscalls.cc (transparent_exe): New global variable.
2384         (unlink): Accommodate transparent_exe option.
2385         (open): Ditto.
2386         (link): Ditto.
2387         (rename): Ditto. Maybe add .exe suffix when renaming executable files.
2388         (pathconf): Accommodate transparent_exe option.
2389         * winsup.h: Declare transparent_exe.
2390
2391 2006-02-05  Christopher Faylor  <cgf@timesys.com>
2392             Corinna Vinschen  <corinna@vinschen.de>
2393
2394         * fhandler_disk_file.cc (fhandler_disk_file::readdir_9x): Remove
2395         useless code.
2396
2397 2006-02-05  Corinna Vinschen  <corinna@vinschen.de>
2398
2399         * fhandler_disk_file.cc (fhandler_disk_file::rewinddir): Remove label
2400         "out".  Move test for NULL __handle ...
2401         (fhandler_disk_file::rewinddir_9x): ... here.
2402
2403 2006-02-05  Corinna Vinschen  <corinna@vinschen.de>
2404
2405         * dir.cc (rewinddir): Keep dirent_get_d_ino and dirent_set_d_ino flags.
2406
2407 2006-02-05  Christopher Faylor  <cgf@timesys.com>
2408
2409         * fhandler_disk_file.cc (fhandler_disk_file::readdir): Don't close dir
2410         handle when we hit EOF since rewwindir may reactivate it.
2411         (fhandler_disk_file::readdir_9x): Eliminate superfluous temporary
2412         variable.
2413         (fhandler_disk_file::closedir): Return EBADF when trying to close
2414         unopened DIR.  Reorganize slightly.  Return actual derived error value
2415         rather than always returning 0.
2416
2417 2006-02-04  Christopher Faylor  <cgf@timesys.com>
2418
2419         * dir.cc (rmdir): Reorganize check for trailing dot to return correct
2420         error when directory does not exist.
2421
2422 2006-02-03  Christopher Faylor  <cgf@timesys.com>
2423
2424         * dir.cc (mkdir): Reorganize check for trailing dot to return correct
2425         error when directory exists.
2426         * fhandler_disk_file.cc (fhandler_disk_file::mkdir): Remove special
2427         test for path ending in '.'.
2428
2429 2006-02-03  Corinna Vinschen  <corinna@vinschen.de>
2430
2431         * path.cc (suffix_scan::lnk_match): Return true beginning with
2432         SCAN_APPENDLNK.
2433         (suffix_scan::next): Rearrange code to make .lnk append order slightly
2434         more deterministic.
2435         * spawn.cc (exe_suffixes): Try no suffix before .exe suffix to align
2436         evaluation with stat_suffixes.
2437         (dll_suffixes): Ditto.
2438
2439 2006-02-02  Christopher Faylor  <cgf@timesys.com>
2440
2441         * cygwin/version.h: Mention CW_SETUP_WINENV in comment for API minor
2442         153.
2443
2444 2006-02-02  Corinna Vinschen  <corinna@vinschen.de>
2445
2446         * cygwin.din (updwtmpx): Export.
2447         * syscalls.cc (updwtmpx): New function.
2448         * include/utmpx.h (updwtmpx): Declare.
2449         * include/cygwin/version.h: Bump API minor number to 153.
2450
2451 2006-02-02  Christopher Faylor  <cgf@timesys.com>
2452
2453         * external.cc (setup_winenv): New function.
2454         (cygwin_internal): Implement CW_SETUP_WINENV.
2455         * sys/cygwin.h (cygwin_getinfo_types): Define CW_SETUP_WINENV.
2456
2457 2006-02-02  Corinna Vinschen  <corinna@vinschen.de>
2458
2459         * security.cc (is_group_member): Fix comment.
2460
2461 2006-02-02  Corinna Vinschen  <corinna@vinschen.de>
2462
2463         * security.cc (is_group_member): Use local group info type 1.  Test
2464         group for being a global group or a well-known SID before adding it
2465         to the group list.  Add comment.
2466
2467 2006-02-01  Corinna Vinschen  <corinna@vinschen.de>
2468
2469         * autoload.cc  (GetTcpTable): Define.
2470         * fhandler_socket.cc (address_in_use): New function to check if
2471         sockaddr_in address is already in use.
2472         (fhandler_socket::bind): Check if address is alreay in use in case of
2473         SO_REUSEADDR, to circumvent WinSock non-standard behaviour.
2474
2475 2006-02-01  Corinna Vinschen  <corinna@vinschen.de>
2476
2477         * spawn.cc (dll_suffixes): Add .exe and "no suffix" to the list.
2478
2479 2006-01-31  Corinna Vinschen  <corinna@vinschen.de>
2480
2481         * dlfcn.cc (check_path_access): Call find_exec with FE_DLL option.
2482         * path.h (enum fe_types): Add FE_DLL value.
2483         * spawn.cc (std_suffixes): Remove.
2484         (exe_suffixes): New suffix_info for executing files.
2485         (dll_suffixes): New suffix_info for searching shared libraries.
2486         (perhaps_suffix): Add opt argument.  Use dll_suffixes if FE_DLL
2487         option is given, exe_suffixes otherwise.
2488         (find_exec): Propagate opt argument to perhaps_suffix.  Drop suffix
2489         check when testing execute permission.
2490         (spawn_guts): Call perhaps_suffix with FE_NADA opt argument.
2491
2492 2006-01-31  Christopher Faylor  <cgf@timesys.com>
2493
2494         * spawn.cc (av::fixup): Remove unused argument.
2495         (spawn_guts): Remove capitalization in debugging.
2496
2497 2006-01-31  Corinna Vinschen  <corinna@vinschen.de>
2498
2499         * spawn.cc (find_exec): Only return files with execute permission set
2500         if ntsec is on.  Don't check execute permission of Windows batch files.
2501         (av::fixup): Handle empty files gracefully.  Drop execute permission
2502         test here.
2503         * path.cc (suffix_scan::next): Don't skip any suffix on first run.
2504
2505 2006-01-31  Corinna Vinschen  <corinna@vinschen.de>
2506
2507         * path.cc (cwdstuff::set): Don't set win32 error, only POSIX errno.
2508
2509 2006-01-31  Corinna Vinschen  <corinna@vinschen.de>
2510
2511         * path.cc (cwdstuff::set): When SetCurrentDirectory returns
2512         ERROR_INVALID_FUNCTION, bend it over to ERROR_FILE_NOT_FOUND.  Add
2513         comment to explain why.
2514
2515 2006-01-31  Corinna Vinschen  <corinna@vinschen.de>
2516
2517         * dir.cc (readdir_worker): Add comment about writing old 32 bit d_ino.
2518         * include/cygwin/version.h: Bump API minor number to 152.
2519         (CYGWIN_VERSION_CHECK_FOR_NEEDS_D_INO): Remove.
2520
2521 2006-01-30  Corinna Vinschen  <corinna@vinschen.de>
2522
2523         * fhandler_disk_file.cc (fhandler_disk_file::rewinddir): Simplify
2524         conditional.
2525
2526 2006-01-30  Corinna Vinschen  <corinna@vinschen.de>
2527
2528         * fhandler_disk_file.cc (d_cachepos): Rename from d_pos to distinct
2529         clearly from __d_position.  Change throughout.
2530         (fhandler_disk_file::rewinddir): Reset readdir cache on NT.
2531
2532 2006-01-29  Corinna Vinschen  <corinna@vinschen.de>
2533
2534         * fhandler_disk_file.cc (readdir_get_ino): Don't follow symlinks.
2535
2536 2006-01-29  Corinna Vinschen  <corinna@vinschen.de>
2537
2538         * fhandler.h (class fhandler_socket): Add saw_reuseaddr status flag.
2539         * fhandler_socket.cc (fhandler_socket::bind): Set socket to
2540         SO_EXCLUSIVEADDRUSE if application didn't explicitely set SO_REUSEADDR
2541         socket option, on systems supporting SO_EXCLUSIVEADDRUSE.
2542         * net.cc (cygwin_setsockopt): Set fhandler's saw_reuseaddr status flag
2543         if SO_REUSEADDR socket option has been successsfully set.
2544         * wincap.h (wincaps::has_exclusiveaddruse): New element.
2545         * wincap.cc: Implement above element throughout.
2546
2547 2006-01-28  Corinna Vinschen  <corinna@vinschen.de>
2548
2549         * fhandler_disk_file.cc (fhandler_disk_file::mkdir): In case or error,
2550         check for existance explicitely and set errno to EEXIST.
2551
2552 2006-01-28  Corinna Vinschen  <corinna@vinschen.de>
2553
2554         * fhandler_disk_file.cc (DIR_NUM_ENTRIES): New define determining
2555         minimum number of dir entries which fit into the readdir cache.
2556         (DIR_BUF_SIZE): Define globally as size of readdir cache.
2557         (struct __DIR_cache): New structure used for readdir caching on NT.
2558         (d_dirname): Accessor for struct __DIR_cache, use throughout.
2559         (d_pos): Ditto.
2560         (d_cache): Ditto.
2561         (fhandler_disk_file::opendir): Allocate __d_dirname to contain readdir
2562         cache on NT.
2563         (fhandler_disk_file::readdir): Use buf as pointer into readdir cache.
2564         Implement readdir caching.
2565
2566 2006-01-28  Corinna Vinschen  <corinna@vinschen.de>
2567
2568         * include/sys/dirent.h (struct dirent): Revert misguided attempt to
2569         rename __d_unused1 to __d_fd.
2570
2571 2006-01-27  Corinna Vinschen  <corinna@vinschen.de>
2572
2573         * autoload.cc (NtQueryDirectoryFile): Define.
2574         * dir.cc (__opendir_with_d_ino): Just call opendir.
2575         (opendir): Remove CYGWIN_VERSION_CHECK_FOR_NEEDS_D_INO handling.
2576         (readdir_worker): Only try generating d_ino if it's 0.
2577         Utilize namehash of directories fhandler.  Call readdir_get_ino to
2578         generate d_ino for "..".
2579         (seekdir64): Keep dirent_set_d_ino flag.
2580         * fhandler.h (enum dirent_states): Add dirent_get_d_ino.
2581         (class fhandler_disk_file): Declare new private methods readdir_helper
2582         and readdir_9x.
2583         * fhandler_disk_file.cc (path_conv::hasgood_inode): New method to
2584         evaluate if a filesystem has reliable inode numbers.
2585         (fhandler_base::fstat_by_handle): Accommodate structure member name
2586         change from IndexNumber to FileId.
2587         (fhandler_base::fstat_helper): Call hasgood_inode here.
2588         (fhandler_disk_file::opendir): Call fhaccess only for real files.
2589         Don't append '*' to __d_dirname here, move to readdir_9x.  On NT,
2590         open directory handle here.  Set dirent_get_d_ino and dirent_set_d_ino
2591         flags according to wincap and filesystem.
2592         (fhandler_disk_file::readdir_helper): New method to implement readdir
2593         postprocessing only once.
2594         (readdir_get_ino_by_handle): New static function.
2595         (readdir_get_ino): New function to centralize inode number evaluation
2596         in case inode number hasn't been returned by NtQueryDirectoryFile.
2597         (fhandler_disk_file::readdir): Move old functionality to readdir_9x.
2598         Call readdir_9x when on 9x/Me.  Implement NT specific readdir here.
2599         (fhandler_disk_file::readdir_9x): Move 9x specific readdir here.
2600         (fhandler_disk_file::seekdir): Accommodate new NT readdir method.
2601         (fhandler_disk_file::closedir): Ditto.
2602         (fhandler_cygdrive::fstat): Set d_ino to namehash. Add comment.
2603         (fhandler_cygdrive::opendir): Call get_namehash to prepare later
2604         correct evaluation of d_ino.
2605         (fhandler_cygdrive::readdir): Replace recursion with loop. Evaluate
2606         drive's d_ino by calling readdir_get_ino.
2607         * fhandler_proc.cc (fhandler_proc::readdir): Set dirent_saw_dot and
2608         dirent_saw_dot_dot to avoid seeing . and .. entries twice.
2609         * fhandler_process.cc (fhandler_process::readdir): Ditto.
2610         * fhandler_registry.cc (fhandler_registry::readdir): Ditto.
2611         * ntdll.h (STATUS_INVALID_PARAMETER): New define.
2612         (STATUS_INVALID_LEVEL): New define.
2613         (struct _FILE_INTERNAL_INFORMATION): Rename member IndexNumber to
2614         FileId (as in Nebbitt).
2615         * path.h (path_conv::hasgood_inode): Now implemented in
2616         fhandler_disk_file.cc.
2617         * wincap.h (wincaps::has_fileid_dirinfo): New element.
2618         * wincap.cc: Implement above element throughout.
2619         * winsup.h (readdir_get_ino): Add declaration.
2620         * include/sys/dirent.h (struct dirent): Slightly rename structure
2621         members to accommodate changes.
2622         Remove __USE_EXPENSIVE_CYGWIN_D_INO handling and declaration of
2623         __opendir_with_d_ino.
2624
2625 2006-01-27  Christopher Faylor  <cgf@timesys.com>
2626
2627         * spawn.cc (spawn_guts): Fix potential handle leak when failing exec.
2628
2629 2006-01-27  Christopher Faylor  <cgf@timesys.com>
2630
2631         * exceptions.cc (inside_kernel): Fix to return true if we can't get the
2632         name of the DLL for the given memory block since we are not in kernel
2633         code.
2634
2635 2006-01-26  Corinna Vinschen  <corinna@vinschen.de>
2636
2637         * fhandler.cc (fhandler_base::open): Fix bug in argument order to
2638         InitializeObjectAttributes call.
2639
2640 2006-01-25  Corinna Vinschen  <corinna@vinschen.de>
2641
2642         * fhandler_disk_file.cc (fhandler_disk_file::readdir): Fix test for
2643         dirent_isroot to use the correct boolean operator.
2644
2645 2006-01-25  Christopher Faylor  <cgf@timesys.com>
2646
2647         * ntdll.h: (temporarily?) Add more functions for querying directory.
2648
2649 2006-01-24  Christopher Faylor  <cgf@timesys.com>
2650
2651         * dir.cc (readdir_worker): Turn off expensive inode calculation.
2652
2653 2006-01-24  Corinna Vinschen  <corinna@vinschen.de>
2654
2655         * fhandler_process.cc (fhandler_process::fill_filebuf): Disable
2656         stripping the .exe suffix from the link target in PROCESS_EXE and
2657         PROCESS_EXENAME case.
2658         * path.cc (realpath): Tack on .exe suffix if necessary.
2659
2660 2006-01-24  Corinna Vinschen  <corinna@vinschen.de>
2661
2662         * fhandler_disk_file.cc (fhandler_base::fstat_helper): Try harder
2663         to determine remote file systems with reliable inode numbers.  Add
2664         longish comment.
2665
2666 2006-01-23  Corinna Vinschen  <corinna@vinschen.de>
2667
2668         * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Reset
2669         inheritance for duplicated socket.
2670
2671 2006-01-20  Christopher Faylor  <cgf@timesys.com>
2672
2673         * include/cygwin/version.h: Bump API minor number to 151.
2674         * dir.cc (__opendir_with_d_ino): New function.
2675         (opendir): Set flag if we should be calculating inodes.
2676         (readdir_worker): Calculate d_ino by calling stat if the user has asked
2677         for it.
2678         (seekdir64): Maintain all persistent flag settings.
2679         * fhandler.h (dirent_states): Add dirent_set_d_ino.
2680         * fhandler_disk_file.cc (fhandler_disk_file::opendir): Reflect changes
2681         to dirent structure.
2682         * fhandler_virtual.cc (fhandler_virtual::opendir): Ditto.
2683         * include/sys/dirent.h (struct dirent): Coalesce two similar
2684         structures.  Remove all shreds of the apparently highly confusing
2685         references to inodes.  Add support for calculating a real inode if
2686         __USE_EXPENSIVE_CYGWIN_D_INO is defined.
2687
2688 2006-01-20  Christopher Faylor  <cgf@timesys.com>
2689
2690         * include/sys/dirent.h: Add comments for people who are REALLY confused
2691         about whether they should be using something called __invalid_d_ino or
2692         not.
2693
2694 2006-01-20  Corinna Vinschen  <corinna@vinschen.de>
2695
2696         * fhandler_socket.cc (fhandler_socket::prepare): Fix debug output.
2697         (fhandler_socket::release): Add debug output for WSAEventSelect failure.
2698         (fhandler_socket::ioctl): Always cancel WSAEventSelect before switching
2699         to blocking mode.  Only set nonblocking flag if ioctlsocket call
2700         succeeded.  Only print new socket state if ioctlsocket call succeeded.
2701
2702 2006-01-19  Christopher Faylor  <cgf@timesys.com>
2703
2704         * fhandler_disk_file.cc (fhandler_disk_file::opendir): Check posix path
2705         for root rather than windows path.
2706
2707 2006-01-19  Christopher Faylor  <cgf@timesys.com>
2708
2709         * dir.cc (readdir_worker): Fill in invalid fields with -1.  Accommodate
2710         name change from __ino32 to __invalid_ino32.
2711         * include/sys/dirent.h (__invalid_ino32): Rename from __ino32.  Don't
2712         define unused d_type macros.
2713
2714 2006-01-18  Christopher Faylor  <cgf@timesys.com>
2715
2716         * heap.cc (heap_init): Remove Sleep.
2717
2718 2006-01-18  Corinna Vinschen  <corinna@vinschen.de>
2719
2720         * net.cc (rresvport): Remove extern declaration.
2721
2722 2006-01-18  Corinna Vinschen  <corinna@vinschen.de>
2723
2724         * autoload.cc (rresvport): Remove.
2725         * net.cc (last_used_rrecvport): New global shared variable.
2726         (cygwin_rresvport): Implement rresvport without using rresvport from
2727         wsock32.
2728
2729 2006-01-18  Corinna Vinschen  <corinna@vinschen.de>
2730
2731         * include/cygwin/socket.h (struct sockaddr_storage): Fix typo in
2732         ss_family member name.
2733
2734 2006-01-16  Christopher Faylor  <cgf@timesys.com>
2735
2736         * include/cygwin/version.h: Bump DLL minor version number to 20.
2737
2738 2006-01-13  Corinna Vinschen  <corinna@vinschen.de>
2739
2740         * uname.cc (uname): Concatenate a "-WOW64" to utsname's sysname
2741         member to see when running under WOW64.
2742
2743 2006-01-13  Corinna Vinschen  <corinna@vinschen.de>
2744
2745         * net.cc (cygwin_setsockopt): Ignore errors when setting IP_TOS on
2746         Windows 2000 and above. Clarify the comment about IP_TOS and move
2747         to the place where the magic happens.
2748         (get_ifconf): Remove unused code.
2749         * wincap.h (wincaps::has_disabled_user_tos_setting): New element.
2750         * wincap.cc: Implement above element throughout.
2751
2752 2006-01-12  Christopher Faylor  <cgf@timesys.com>
2753
2754         * fhandler_console.cc (set_console_state_for_spawn): Fix to recognize
2755         ttys >= 0.
2756
2757 2006-01-12  Christopher Faylor  <cgf@timesys.com>
2758
2759         * fhandler.h (set_console_state_for_spawn): Whackamole the argument
2760         back to a bool.
2761         * spawn.cc (spawn_guts): Ditto, i.e., once again call
2762         set_console_state_for_spawn with an indication of whether we're about
2763         to start a cygwin process.
2764         * fhandler_console.cc (set_console_state_for_spawn): Don't set the
2765         console state if we know we're starting a cygwin process or if we're
2766         using a "real" tty.
2767
2768 2006-01-10  Corinna Vinschen  <corinna@vinschen.de>
2769
2770         * dcrt0.cc (dll_crt0_0): Remove call to wincap.init.
2771         * init.cc (dll_entry): Rename is_wow64_proc to wow64_test_stack_marker.
2772         Call wincap.init here before doing anything else.  Use wincap.is_wow64
2773         to determine if we're running in a WOW64 emulator.
2774         * mmap.cc (MapViewNT): Don't use AT_ROUND_TO_PAGE in WOW64, it's
2775         apparently not supported.
2776         (mmap64): Don't create mappings beyond EOF, which would need to use
2777         AT_ROUND_TO_PAGE, on WOW64.
2778         * wincap.cc (wincap): Throw into the .cygwin_dll_common section.
2779         (wincapc::init): Determine if running in WOW64 and set wow_64 flag.
2780         * wincap.h (class wincapc): Add wow64 member.
2781         (wincapc::is_wow64): New method.
2782
2783 2006-01-10  Christopher Faylor  <cgf@timesys.com>
2784
2785         * fhandler_proc.cc (format_proc_cpuinfo): Avoid leading whitespace in
2786         model name.
2787
2788 2006-01-09  Christopher Faylor  <cgf@timesys.com>
2789
2790         * spawn.cc (spawn_guts): Reorganize slightly so that 16 bit check is
2791         done prior to check for command.com/cmd.com.  Don't bother setting
2792         CREATE_SUSPENDED flag for a MS-DOS process since it doesn't work
2793         anyway.  Avoid calling remember() when the child process has already
2794         exited.
2795         (av::fixup): Explicitly set cygexec flag to false on a 16 bit process.
2796
2797 2006-01-09  Corinna Vinschen  <corinna@vinschen.de>
2798
2799         * include/getopt.h (getopt_long_only): Declare.
2800
2801 2006-01-09  Eric Blake  <ebb9@byu.net>
2802
2803         * cygwin.din: Export getsubopt.
2804         * include/cygwin/version.h: Bump API minor version.
2805
2806 2006-01-08  Christopher Faylor  <cgf@timesys.com>
2807
2808         * fhandler_tty.cc (fhandler_tty_slave::dup): Don't assign a controlling
2809         terminal to a process when duped.  Linux doesn't do this, so we won't
2810         either.
2811
2812 2006-01-08  Christopher Faylor  <cgf@timesys.com>
2813
2814         * environ.cc (spenvs[]): windir -> WINDIR.
2815
2816 2006-01-07  Christopher Faylor  <cgf@timesys.com>
2817
2818         * fhandler_console.cc (fhandler_console::need_invisible): Remove
2819         duplicate test.
2820
2821 2006-01-07  Christopher Faylor  <cgf@timesys.com>
2822
2823         * fhandler.h (set_console_state_for_spawn): Eliminate argument from
2824         declaration.
2825         * fhandler.cc (set_console_state_for_spawn): Eliminate argument from
2826         definition.  Always check for invisible console.
2827         (fhandler_console::need_invisible): Don't do anything if the windows
2828         station is already not visible.
2829         * spawn.cc (spawn_guts): Accommodate change of argument to
2830         set_console_state_for_spawn.
2831
2832 2006-01-05  Christopher Faylor  <cgf@timesys.com>
2833
2834         * sigproc.cc (no_signals_available): Use existence of signal thread
2835         handle to figure out if we can actually send signals rather than
2836         relying on my_sendsig.
2837         (hwait_sig): Make static.
2838         (sigproc_init): Don't set my_sendsig to anything special.  Use new
2839         global static hwait_sig.
2840         (wait_sig): Set hwait_sig to NULL when we are exiting.
2841
2842 2006-01-05  Christopher Faylor  <cgf@timesys.com>
2843
2844         * include/getopt.h: Accommodate recent unfortunate newlib changes.
2845
2846 2006-01-05  Christopher Faylor  <cgf@timesys.com>
2847
2848         * cygtls.cc (_cygtls::remove): Don't output debugging info if this
2849         isn't a cygwin thread.
2850         * sigproc.cc (sigproc_init): Move clearing of sync_startup here to
2851         lessen the likelihood of trying to deal with non-cygwin threads in
2852         dll_entry.
2853
2854         * fhandler_console: Fix set_console_state_for_spawn comment.
2855
2856 2006-01-05  Igor Peshansky  <pechtcha@cs.nyu.edu>
2857
2858         * spawn.cc (spawn_guts): Invert the argument to
2859         set_console_state_for_spawn.
2860
2861 2006-01-04  Christopher Faylor  <cgf@timesys.com>
2862
2863         * fhandler_console.cc (fhandler_console::need_invisible): Only try to
2864         open "CygwinInvisible" windows station if opening of default station
2865         fails.  Use CloseWindowStation to close window station handle.
2866
2867 2006-01-04  Christopher Faylor  <cgf@timesys.com>
2868
2869         * fhandler_console.cc (fhandler_console::need_invisible): Open up the
2870         security of the newly created windows station.
2871
2872 2006-01-04  Eric Blake  <ebb9@byu.net>
2873
2874         * path.cc (dot_special_chars): Add ", <, >, and |.
2875
2876 2006-01-03  Christopher Faylor  <cgf@timesys.com>
2877
2878         * fhandler_console.cc (beep): Use MB_OK which is documented as using
2879         the default bell rather than -1 which seems to behave differently on
2880         different versions of Windows.
2881
2882 2006-01-03  Christopher Faylor  <cgf@timesys.com>
2883
2884         * fhandler_process.cc (fhandler_process::readdir): Add missing argument
2885         to syscall_printf.
2886
2887         * fhandler_console.cc (fhandler_console::need_invisible): Use made-up
2888         name for windows station rather than asking Windows to create one for
2889         us.
2890
2891         * spawn.cc (spawn_guts): Don't mess with console if we're detaching.
2892
2893 2006-01-03  Christopher Faylor  <cgf@timesys.com>
2894
2895         * dir.cc (readdir_worker): Minor code cleanup.
2896
2897         * fhandler_console.cc (beep): Use a more Windows-generic wav file if
2898         the beep is missing.  Use a more foolproof way to find out whether we
2899         should be recreating the missing key.
2900
2901         * registry.h (reg_key::_disposition): New field.
2902         (reg_key::created): New function.
2903         * registry.cc (reg_key::reg_key): Set _disposition to zero by default.
2904         (reg_key::build_key): Fill in _disposition field.
2905
2906 2006-01-03  Eric Blake  <ebb9@byu.net>
2907
2908         * dir.cc (readdir_worker): Ensure that saw_dot* flags are updated when
2909         not handling inodes.
2910
2911 2006-01-02  Christopher Faylor  <cgf@timesys.com>
2912
2913         * fhandler_console.cc (beep): New function.  Restores missing "Default
2914         Beep", if necessary.
2915         (fhandler_console::write_normal): Use beep().
2916
2917 2006-01-02  Christopher Faylor  <cgf@timesys.com>
2918
2919         * dcrt0.cc (_dll_crt0): Remove more leftover debugging stuff.
2920         (cygwin_dll_init): Remove unneeded initializations.  Call _dll_crt0
2921         rather than dll_crt0_1.
2922
2923 2006-01-02  Corinna Vinschen  <corinna@vinschen.de>
2924
2925         * syslog.cc: Include sys/un.h instead of sys/socket.h.
2926         (syslogd_inited): Convert to enum type noting the exact result of
2927         trying to connect to syslog daemon.  Use this way throughout.
2928         (connect_syslogd): New static function taking over the task to
2929         connect to syslog socket.  Use correct struct sockaddr_un instead of
2930         struct sockaddr.
2931         (try_connect_syslogd): Call connect_syslogd.  If write fails on
2932         connection oriented socket, try to reconnect to syslog socket and
2933         try to write again.
2934
2935 2006-01-01  Christopher Faylor  <cgf@timesys.com>
2936
2937         * pinfo.cc (pinfo::exit): Swap signal and normal exit value when not
2938         started from a cygwin process - just like the good-old-days of B20.
2939
2940 2006-01-01  Christopher Faylor  <cgf@timesys.com>
2941
2942         * strace.cc (strace::write_childpid):  Remove debugging output.
2943
2944 2006-01-01  Christopher Faylor  <cgf@timesys.com>
2945
2946         * cygtls.cc (_cygtls::remove): Remove left over debugging cruft which
2947         caused this function to always return prematurely.
2948
2949 2006-01-01  Christopher Faylor  <cgf@timesys.com>
2950
2951         * exceptions.cc (sigpacket::process): Pass actual reference to signal's
2952         sigaction structure to setup_handler.
2953
2954 2006-01-01  Christopher Faylor  <cgf@timesys.com>
2955
2956         * exceptions.cc (_cygtls::interrupt_setup): Implement SA_RESETHAND.
2957         * include/cygwin/signal.h: Define SA_ONESHOT and SA_NOMASK.
2958
2959         * dcrt0.cc (get_cygwin_startup_info): Remove commented out code.
2960
2961 2006-01-01  Corinna Vinschen  <corinna@vinschen.de>
2962
2963         * syslog.cc (vklog): Never log kernel messages using the vsyslog
2964         interface.