OSDN Git Service

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