OSDN Git Service

172dabcc4a34b9e152a09a0a40d069c71af2f39b
[pf3gnuchains/pf3gnuchains4x.git] / winsup / cygwin / ChangeLog
1 2011-11-10  Christopher Faylor  <me.cygwin2011@cgf.cx>
2
3         Throughout use "have_execed" macro rather than "hExeced" global handle.
4         Throughout rename _PROC_* to _CH_*.
5         * child_info.h: Include "pinfo.h".
6         (child_info_types): Rename _PROC_* -> _CH_* to avoid confusion with
7         similarly named constants.
8         (_PROC_*): Delete unneeded aliases.
9         (PROC_*): Ditto.
10         (CURR_CHILD_INFO_MAGIC): Ditto.
11         (cchildren): Define using "pinfo_minimal".
12         (child_info::set_saw_ctrl_c): Move to
13         (child_info_spawn::set_saw_ctrl_c): Here.
14         (child_info_spawn::lock): New field.
15         (child_info_spawn::hExeced): Ditto.
16         (child_info_spawn::ev): Ditto.
17         (child_info_spawn::~child_info_spawn): Move to sigproc.cc.
18         (child_info_spawn::child_info_spawn): Ditto.
19         (child_info_spawn::cleanup): Declare new function.
20         (child_info_spawn::set_saw_ctrl_c): Move to this class.  Set flag only
21         when execed and return true when we have set the flag.
22         (child_info_spawn::child_info_spawn::signal_myself_exited): New function.
23         (child_info_spawn::wait_for_myself): Ditto.
24         (child_info_spawn::has_execed_cygwin): Ditto.
25         (child_info_spawn::has_execed): Ditto.  Replaces "hExeced" test.
26         (child_info_spawn::operator HANDLE&): New operator.
27         (child_info_spawn::worker): Define old "spawn_guts" as class member.
28         (ch_spawn): Declare.
29         (have_execed): Define.
30         (have_execed_cygwin): Ditto.
31         * cygheap.h: Update comment.
32         * dcrt0.cc (get_cygwin_startup_info): Use _CH_* enums.
33         (child_info_spawn::handle_spawn): Ditto.
34         (dll_crt0_0): Ditto.
35         (multiple_cygwin_problem): Ditto.
36         * exceptions.cc (chExeced): Delete obsolete declaration.
37         (ctrl_c_handler): Reference set_saw_ctrl_c via new ch_spawn global.
38         * globals.cc (hExeced): Delete.
39         * pinfo.cc (pinfo::thisproc): Refer to cygheap as ::cygheap for
40         consistency in handle naming when -DDEBUGGING.
41         (pinfo::init): Accommodate case where myself.h is known but h0 is
42         passed in.
43         (pinfo::pinfo): New constructor for setting up a pinfo passed in by
44         previous exec'or.
45         (pinfo::proc_waiter): Don't handle subprocess if we're in the process
46         of exiting due to an exec of a cygwin process.  Don't close
47         rd_proc_pipe here.  Close it when we actually are finished with the
48         process.  Use new ch_spawn.signal_myself_exited function to let exec
49         stub know that subprocess has exited.
50         (pinfo::wait): Clarify debugging output.
51         (pinfo::release): Use "close_h" to close all handles to avoid races.
52         (winpids::add): Assume that elements of the array do not need to be
53         zeroed and are properly initialized or suffer problems on
54         pinfo::release.  Don't close hProcess since release does that now.
55         * pinfo.h: Update comment.
56         (pinfo_minimal): Move some elements from pinfo here so that
57         child_info_spawn can use them.
58         (pinfo): Inherit from pinfo_minimal.
59         (pinfo::pinfo): Modify to accommodate new pinfo_minimal.
60         (pinfo::allow_remove): New function.
61         * sigproc.cc (proc_subproc): Use boolean values for true/false.
62         Implement PROC_EXEC_CLEANUP.
63         (proc_terminate): Set ppid = 1 since the procs list will only be
64         iterated when the process has not execed.  Don't do any cleanup here
65         since it is now handled in pinfo::release.
66         (sigproc_init): Initialize sync_proc_subproc earlier.
67         (child_info::child_info): Assume that all important fields are properly
68         initialized and avoid memset().
69         (child_info_spawn::child_info_spawn): Specifically test for execing and
70         then set up appropriate fields in the struct.
71         (child_info_spawn::cleanup): Define new function.
72         (child_info_spawn::record_children): Specifically test for being execed
73         here.  Fill in pinfo_minimal part of children array.
74         (child_info_spawn::reattach_children): Use constructor to duplicate
75         information for previous exec'or.  Add more debugging output.
76         (remove_proc): Force deletion of thread when exiting due to exec.  Rely
77         on pinfo::cleanup in release.
78         * sigproc.h (PROC_EXEC_CLEANUP): New enum.
79         (PROC_DETACHED_CHILD): Delete.
80         * spawn.cc (chExeced): Delete.
81         (child_info_spawn::worker): Rename from spawn_guts.  Use elements of
82         child_info_spawn throughout rather than ch.whatever.  Use ::cygheap to
83         refer to global rather than element of child_info.  Use
84         wait_for_myself() rather than waitpid().  Call
85         child_info_spawn::cleanup on function return.
86         (spawnve): Reflect movement of spawn_guts functionality into
87         child_info_spawn::worker.
88         * syscalls.cc (popen): Ditto.
89         * winsup.h (spawn_guts): Delete declaration.
90
91 2011-11-08  Corinna Vinschen  <corinna@vinschen.de>
92
93         * posix.sgml (std-gnu): Add ptsname_r.
94
95 2011-11-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
96
97         * fhandler.h (__ptsname): New macro.
98         * dtable.cc (decode_tty): Use __ptsname to generate the slave pty name.
99         * fhandler_tty.cc (fhandler_pty_master::ptsname_r): Ditto.
100         * bsdlib.cc: Add needed includes for openpty() changes.
101         (openpty): Use __ptsname to generate the slave pty name.  Close slave
102         fd when aslave == NULL.
103
104 2011-11-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
105
106         * include/cygwin/stdlib.h: Update copyright.
107
108 2011-11-07  Christopher Faylor  <me.cygwin2011@cgf.cx>
109
110         * cygwin.din (ptsname_r): Export.
111         * fhandler.cc (fhandler_base::ptsname_r): Define.
112         * fhandler.h (fhandler_base::ptsname): Delete.
113         (fhandler_base::ptsname_r): Declare.
114         (fhandler_pty_master::ptsname_r): Declare.
115         * fhandler_tty.cc (fhandler_pty_master::ptsname): Delete.
116         (fhandler_pty_master::ptsname_r): New reentrant function derived from
117         previous ptsname.
118         * syscalls.cc (ptsname_r): Implement new function with functionality
119         similar to Linux.
120         (ptsname): Use ptsname_r () to fill out buf.
121         * include/cygwin/stdlib.h (ptsname_r): Declare.
122         * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 255 to
123         reflect export of ptsname_r.
124
125         * pinfo.cc (pinfo::wait): Return bool rather than int.
126         * pinfo.h (info::wait): Ditto.
127         (pinfo::reattach): Define !defined(_SIGPROC_H) case for consistency.
128         * sigproc.cc (child_info_spawn::reattach_children): Use correct
129         dwProcessId rather than pid when duplicating handle.
130
131 2011-11-07  Corinna Vinschen  <corinna@vinschen.de>
132
133         * fhandler.cc (CHUNK_SIZE): Drop NO_COPY.
134
135 2011-11-07  Corinna Vinschen  <corinna@vinschen.de>
136
137         * syscalls.cc (check_dir_not_empty): Check surplus directory entries
138         by calling NtQueryAttributesFile.  Make STATUS_DIRECTORY_NOT_EMPTY
139         return value dependent on its status code.  Add long comment to explain.
140         (unlink_nt): Add comment to explain flaw in checking the sharing mode.
141         Set status to STATUS_SUCCESS instead of 0.  Add a retry loop to setting
142         the delete disposition and trying to move a directory to bin to
143         workaround rare cases of lingering, already deleted subdirectory
144         entries.  Add long comment to explain.
145         (rename): Set status to STATUS_SUCCESS instead of 0.
146
147 2011-11-05  Christopher Faylor  <me.cygwin2011@cgf.cx>
148
149         * pinfo.cc (status_exit): Recognize STATUS_ILLEGAL_INSTRUCTION.
150         (child_info::proc_retry): Ditto.
151
152 2011-11-05  Christopher Faylor  <me.cygwin2011@cgf.cx>
153
154         * pinfo.cc (status_exit): Return complete error code.  Handle
155         STATUS_ACCESS_VIOLATION correctly.
156         (pinfo::set_exit_code): Set self->exitcode directly from status_exit.
157
158 2011-11-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
159
160         * pinfo.h (pinfo::reattach): Only set destroy to false when
161         proc_subproc succeeds.  Return true for success.
162         * sigproc.cc (child_info_spawn::reattach_children): Try harder to clean
163         up on error by detecting reattach failures too.
164
165 2011-11-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
166
167         * sigproc.cc (child_info_spawn::reattach_children): Clean up handle
168         when can't open parent process or suffer handle leak.
169
170 2011-11-03  Christopher Faylor  <me.cygwin2011@cgf.cx>
171
172         * sigproc.cc (child_info::sync): Report on exit code in strace output.
173         (child_info::proc_retry): Don't consider STATUS_ACCESS_VIOLATION as a
174         restartable event.
175
176 2011-11-03  Christopher Faylor  <me.cygwin2011@cgf.cx>
177
178         * sigproc.cc (child_info_spawn::reattach_children): Avoid issuing an
179         error when we can't duplicate from "parent" since it is probably ok if
180         children of the previous owner of the pid disappear.
181
182 2011-11-03  Corinna Vinschen  <corinna@vinschen.de>
183
184         * fhandler.cc (off_current): Define local in fhandler_base::raw_write.
185         Drop erroneous NO_COPY, add _RDATA to make R/O.
186         (off_append): Ditto.
187         * globals.cc (_RDATA): Move definition from here...
188         * winsup.h: ...to here.
189
190 2011-10-30  Christopher Faylor  <me.cygwin2011@cgf.cx>
191
192         * fhandler.h (fhandler_pipe::create_selectable): Remove optional
193         argument, take an options argument for CreateNamedPipe/CreateFile.
194         Change handle arguments to expect pointers.
195         (fhandler_fifo::fifo_state): Delete.
196         (fhandler_fifo::dummy_client): Ditto.
197         (fhandler_fifo::open_nonserver): Ditto.
198         (fhandler_fifo::wait_state): Ditto.
199         (fhandler_fifo::raw_write): Ditto.
200         (fhandler_fifo::read_ready): New field.
201         (fhandler_fifo::write_ready): Ditto.
202         (fhandler_fifo::wait): Modify argument.
203         (fhandler_fifo::fifo_name): Add a new argument.
204         (fhandler_fifo::fixup_after_fork): New function.
205         * fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Remove
206         initialization of expunged elements.  Initialize new handles to NULL.
207         (fhandler_fifo::open_nonserver): Delete.
208         (fnevent): New macro for creating a named event.
209         (fnpipe): New macro for creating a unique named pipe name.
210         (create_pipe): New macro for simplification of named pipe creation.
211         (fhandler_fifo::fifo_name): Use new argument when creating a shared
212         name.
213         (fhandler_fifo::open): Rewrite.  Use events to synchronize.
214         (fhandler_fifo::wait): Rewrite to wait for new fifo events which are
215         supplied as a parameter.
216         (fhandler_fifo::raw_read): Rewrite to use handle mechanism to detect
217         client-side disconnect.
218         (fhandler_fifo::raw_write): Delete.
219         (fhandler_fifo::close): Remove accommodations for expunged fields.
220         Close event handles.
221         (fhandler_fifo::dup): Remove accommodations for expunged fields.
222         Duplicate event handles.
223         (fhandler_fifo::fixup_after_fork): New function.  Perform fixups on
224         event handles.
225         (fhandler_fifo::set_close_on_exec): Remove accommodations for expunged
226         fields.  Set inheritance for new handle fields.
227         * miscfuncs.cc (CreatePipeOverlapped): Accommodate changes in
228         fhandler_pipe::create_selectable.
229         * tty.cc (tty::not_allocated): Ditto.
230         * pipe.cc (fhandler_pipe::create): Ditto.
231         (fhandler_pipe::create_selectable): Accept an extra open_mode argument.
232         Pass arguments by reference and allow opening one end of the pipe at a
233         time.
234
235         * sys/strace.h (debug_only_printf): Define new macro which calls
236         debug_printf only when DEBUGGING is defined.
237
238 2011-10-28  Christopher Faylor  <me.cygwin2011@cgf.cx>
239
240         * exceptions.cc (sigpacket::process): Avoid a potential deadlock when
241         exiting due to a signal.
242
243 2011-10-28  Corinna Vinschen  <corinna@vinschen.de>
244
245         * cygwin.din (getgrouplist): Export.
246         * grp.cc (get_groups): New static function to run the core functionality
247         of initgroups and getgrouplist.
248         (initgroups32): Call get_groups and just create supplementary group
249         list in cygheap.  Rename name of first argument to "user".  Add an
250         assertion to test for a NULL user name.
251         (initgroups): Rename name of first argument to "user".
252         (getgrouplist): New function.
253         * posix.sgml (std-bsd): Add getgrouplist.
254         * include/cygwin/grp.h (getgrouplist): Declare.
255         * include/cygwin/version.h: Bump API minor number.
256
257 2011-10-25  Christopher Faylor  <me.cygwin2011@cgf.cx>
258
259         * child_info.h (cchildren): New struct.
260         (child_info_spawn::nchildren): Rename from nprocs.
261         (child_info_spawn::children): Change type to cchildren for more
262         bookkeeping possibilities.
263         (child_info_spawn::child_info_spawn): Clear nchildren.
264         (child_info_spawn::record_children): Declare new function.
265         (child_info_spawn::reattach_children): Ditto.
266         * dcrt0.cc (child_info_spawn::handle_spawn): Call reattach_children to
267         gather list of processes we are potentially waiting for.
268         * pinfo.h (pinfo::pinfo): Make sure that rd_proc_pipe is always cleared.
269         (pinfo::reattach): New function.
270         * sigproc.cc: Move pinfo.h earlier so that it can be used in sigproc.h.
271         (get_proc_lock): Don't bother with a lock during DLL initialization.
272         (proc_subproc): Handle PROC_REATTACH_CHILD.
273         (proc_terminate): Orphan children only when we are not an execed
274         process or when the pid is about to be occupied by a non-cygwin
275         process.
276         (child_info_spawn::record_children): Define new function.
277         (child_info_spawn::reattach_children): Ditto.
278         * sigproc.h (procstuff): Define PROC_REATTACH_CHILD and renumber other
279         elements.
280         * spawn.cc (spawn_guts): Record any to-be-waited-for subprocesses if
281         about to exec a cygwin process.
282
283         * sigproc.cc (sig_send): Fix harmless transposition of fifth and six
284         arguments to DuplicateHandle().
285         (child_info::child_info): Ditto.
286
287         * globals.cc (hExeced): Make NO_COPY.
288
289 2011-10-25  Corinna Vinschen  <corinna@vinschen.de>
290
291         * hookapi.cc (hook_or_detect_cygwin): Take additional handle
292         to a file mapping as parameter.  If this handle is not NULL,
293         create another file mapping for the IAT.
294         * spawn.cc (av::fixup): Only map the first 64K of an image and
295         keep the mapping handle to use as argument to hook_or_detect_cygwin.
296         * winsup.h (hook_or_detect_cygwin): Add mapping handle as default
297         parameter in declaration.
298
299 2011-10-24  Corinna Vinschen  <corinna@vinschen.de>
300
301         * syscalls.cc (unlink_nt): Fix a bug which overwrites the NT status
302         value in case setting the delete disposition returns with
303         STATUS_DIRECTORY_NOT_EMPTY.
304
305 2011-10-24  Corinna Vinschen  <corinna@vinschen.de>
306
307         * shared.cc (open_shared): Fix memory reservation of essential shared
308         memory regions.  Drop delta computations since delta is always 0 in
309         non-relocated case.  Add a comment.
310
311 2011-10-23  Christopher Faylor  <me.cygwin2011@cgf.cx>
312
313         * fhandler_tty.cc (fhandler_pty_slave::read): Use consistent way for
314         testing ReadFile return.
315         * pipe.cc (fhandler_pipe::create_selectable): Open the write side of
316         the pipe in message-mode to force writing as "chunks".  Explain why.
317
318 2011-10-23  Christopher Faylor  <me.cygwin2011@cgf.cx>
319
320         * path.cc (path_conv::get_nt_native_path): Avoid dereferencing path
321         when it is NULL.
322
323 2011-10-21  Christopher Faylor  <me.cygwin2011@cgf.cx>
324
325         * dtable.cc (dtable::delete_archetype): Improve debugging output.
326         (dtable::init_std_file_from_handle): Close console handle early, before
327         initialization.  Build up openflags for passing to open_setup, just to
328         be safe.
329         (last_tty_dev): New variable.
330         (fh_last_tty_dev): New macro.
331         (fh_alloc): Try again to keep track of previously opened tty, this time
332         by just saving the device and using that to potentially open an
333         archetype.  Avoid setting the "/dev/tty" name if the creation of the
334         fhandler failed.
335         (build_fh_pc): Remove unused second argument.  Reorganize how and where
336         the name is set.  Set last_tty_dev as appropriate.  Avoid a NULL
337         dereference in a debug printf.
338         * dtable.h (build_fh_pc): Reflect removal of second parameter.
339         * fhandler.cc (fhandler_base::reset): Use new '<<' operator to copy pc
340         since it preserves any potentially previously set name.
341         (fhandler_base::set_name): Ditto.
342         * fhandler.h (fhandler_*::clone): Throughout use ccalloc to allocate
343         new fhandler, primarily to make sure that pc field is properly zeroed.
344         (fhandler_termios::last): Eliminate.
345         (fhandler_termios): Remove setting of last.
346         (fhandler_base::~fhandler_termios): Ditto.
347         * fhandler_console.cc (fhandler_console::open): Don't make decisions
348         about opening close-on-exec handles here since it makes no sense for
349         archetypes.
350         (fhandler_console::init): Assume that input handle has already been
351         opened.
352         * fhandler_termios.cc (fhandler_termios::last): Delete.
353         * path.h (path_conv::eq_worker): New function.  Move bulk of operator =
354         here.
355         (operator <<): New function.
356         (operator =): Use eq_worker to perform old functionality.
357
358         * child_info.h (NPROCS): Move here from sigproc.cc.
359         (child_info::nprocs): New field.  Not used yet.
360         (child_info::children):: Ditto.
361
362 2011-10-21  Corinna Vinschen  <corinna@vinschen.de>
363
364         * fhandler_disk_file.cc (fhandler_disk_file::rmdir): Check invalid
365         success only on Samba shares.
366         * mount.cc (fs_info::update): Drop has_buggy_basic_info flag for
367         NcFsd.
368         * syscalls.cc (unlink_nt): Fix typo in comment.
369
370 2011-10-21  Corinna Vinschen  <corinna@vinschen.de>
371
372         * globals.cc (ro_u_ncfsd): New R/O unicode string.
373         * mount.cc (fs_info::update): Check for "NcFsd" FS.  Set flags and
374         change comments accordingly.
375         (fs_names): Add entry for NcFsd FS.
376         * mount.h (enum fs_info_type): Add ncfsd.
377         (class fs_info): Add ncfsd flag and accessor methods.
378         * path.h (class path_conv): Add fs_is_ncfsd method.
379         * syscalls.cc (unlink_nt): Experimentally try delete-on-close on NcFsd
380         in STATUS_CANNOT_DELETE case.
381
382 2011-10-20  Christopher Faylor  <me.cygwin2011@cgf.cx>
383
384         * fhandler.h (fhandler*::copyto): Free path_conv strings first.
385         * path.h (cfree_and_null): Rename and expand from cfree_maybe.
386         (path_conv &operator =): Call free_strings rather than freeing strings
387         directly.
388
389 2011-10-20  Christopher Faylor  <me.cygwin2011@cgf.cx>
390
391         Throughout change TTY_* to PTY_*, tty_* to pty_*, and ttym_* to ptmx_*.
392         * devices.cc: Regenerate.
393         * dtable.cc: (fh_alloc): Preserve /dev/tty name when that's what we
394         opened.
395         (build_fh_pc): Preserve any existing name.
396         * fhandler.cc (fhandler_base::open_with_arch): Ditto.
397         * fhandler_tty.cc (fhandler_pty_master::fhandler_pty_master): Force the
398         name to /dev/ptmx while preserving other pty master device information.
399         * path.h (cfree_maybe): New macro.
400         (path_conv::operator =): Free any allocated strings in target.
401         (path_conv::free_strings): Delete unused function.
402
403         * sigproc.cc (proc_terminate): Remove previous accommodation for execed
404         processes since it didn't have the desired effect.  Change comment to a
405         FIXME.
406
407         * spawn.cc (chExeced): Mark NO_COPY.
408         (exe_suffixes): Ditto.
409
410 2011-10-20  Corinna Vinschen  <corinna@vinschen.de>
411
412         * syscalls.cc (try_to_bin): Improve debug output.
413         (check_dir_not_empty): Take additional path_conv argument.  Improve
414         debug output.  Change syscall_printf to debug_printf.
415         (unlink_nt): Improve debug output.  Change syscall_printf to
416         debug_printf.
417         (unlink): Change syscall_printf to debug_printf.
418
419         * cygthread.h: Fix copyright dates.
420
421 2011-10-18  Corinna Vinschen  <corinna@vinschen.de>
422
423         * path.cc: Extend two comments.  Mention the name RtlpCurDirRef
424         for reference.
425
426 2011-10-17  Christopher Faylor  <me.cygwin2011@cgf.cx>
427
428         * dcrt0.cc (dll_crt0_1): Copy argv before passing to main().
429
430 2011-10-17  Christopher Faylor  <me.cygwin2011@cgf.cx>
431
432         * sigproc.cc (proc_terminate): Avoid setting ppid to 1 if we're execing.
433
434 2011-10-15  Christopher Faylor  <me.cygwin2011@cgf.cx>
435
436         * cygerrno.h (__set_errno): Modify debugging output to make searching
437         strace logs easier.
438
439         Throughout, change /dev/tty* to /dev/pty*.
440         Throughout, add flags argument to fhandler_*::dup methods.
441         * devices.in: Rename (temporarily?) /dev/ttyN to /dev/ptyN.  Add
442         /dev/ptymN devices for pty masters.
443         * devices.cc: Regenerate.
444         * devices.h (MAX_CONSOLES): Set to max number supported by devices.in.
445         (fh_devices::FH_PTMX): Rename from FH_PTYM.
446         (device::operator int): Return by reference.
447         * dtable.cc (fh_alloc): Take pc as an argument rather than just the
448         device.  This makes debugging easier since more information is
449         available.  Actually implement handling for already-allocated pty
450         master devices.  Make different decisions when generating fhandler for
451         not-opened devices.  Add kludge to deal with opening /dev/tty.
452         (cnew_no_ctor): New macro.
453         (build_fh_pc): Make debugging output more verbose.  Use new clone()
454         fhandler interface to duplicate archetypes.  Reset last term opened.
455         (dtable::dup_worker): Use Use new clone() fhandler interface to
456         duplicate archetypes.  Pass flags to child dup handler.
457         (dtable::dup3): Set O_NOCTTY flag if newfd is not stdin/stdout/stderr.
458         * fhandler.cc (fhandler_base::reset): Rename from operator =() and
459         reduce functionality and sense of copy direction.
460         (fhandler_base::open_with_arch): Use published interface to query
461         io_handle().  Use new copyto() fhandler method to copy from/to found
462         archetype.
463         * fhandler.h: Throughout, delete size(), add copyout, clone, and
464         fhandler_* (void *) methods.
465         (fhandler_base::reset): Rename from operator =().
466         (fhandler_termios::is_dev_tty): Delete.
467         (fhandler_termios): change "protected" region to "private".
468         (fhandler_termios::is_dev_tty): Delete.
469         (fhandler_termios): Rearrange protected/public.
470         (fhandler_termios::fhandler_termios): Remember last fhandler_termios
471         "opened".
472         (fhandler_termios::~fhandler_termios): Forget last fhandler_termios
473         opened.
474         (ioctl): Rename from ioctl_termios.  Take a void * argument.  Reflect
475         argument change in pinfo::set_ctty.
476         (fhandler_console::dup): Declare new function.  Set ctty here if
477         appropriate.
478         (fhandler_pty_master::from_master): Privatize.
479         (fhandler_pty_master::to_master): Ditto.
480         (fhandler_pty_master::dwProcessId): Ditto.
481         (fhandler_pty_master::fhandler_pty_master): Add an `int' argument.
482         (fhandler_pty_master::open_setup): Declare new function.
483         (fhandler_pty_master::~fhandler_pty_master): Declare new method.
484         (fhandler_nodevice): Remove commented out function declaration.
485         * fhandler_console.cc: Use get_ttyp() instead of tc() throughout.
486         (fhandler_console::dup): Define new function to set controlling ctty on
487         dup, as appropriate.
488         (fhandler_console::ioctl): Reflect ioctl_termios name change.
489         (fhandler_console::setup): Rename from get_tty_stuff.
490         (fhandler_console::open_setup): Reflect argument change in
491         pinfo::set_ctty.
492         (fhandler_console::fhandler_console): Set _tc here.
493         * fhandler_termios.cc (handler_termios::ioctl): Rename.  Take a void *
494         arg like other ioctl functions.
495         * fhandler_tty.cc (fhandler_pty_slave::dup): Call myself->set_ctty to
496         potentially reset the controlling terminal.
497         (fhandler_pty_slave::ioctl): Reflect name/arg change for ioctl_termios.
498         (fhandler_pty_slave::fhandler_pty_slave): Take a "unit" argument.  Call
499         setup() here so that we will know the unit number of this fhandler as
500         soon as possible.  Set the unit as appropriate.
501         (handler_pty_master::open): Move most stuff to constructor and
502         open_setup.
503         (handler_pty_slave::open_setup): Reflect argument change in
504         pinfo::set_ctty.
505         (handler_pty_master::open_setup): Define new function.
506         (fhandler_pty_master::cleanup): Clear handles as a flag that the
507         destructor does not have to do "close" operations.
508         (fhandler_pty_master::close): Ditto.
509         (fhandler_pty_master::~fhandler_pty_master): Define new method.
510         (fhandler_pty_master::ioctl): Reflect name/arg change for
511         ioctl_termios.
512         (fhandler_pty_master::setup): Allocate tty here.  Rely on handles being
513         returned from allocated test rather than opening them here.  Avoid
514         setting _need_nl here since it is already zeroed in the constructor.
515         Set up device information with DEV_TTYM_MAJOR.
516         * path.h (path_conv &operator =): Take a const argument.
517         (path_conv::dup): Ditto.
518         (pathconv_arg::PC_OPEN): New enum.
519         (pathconv_arg::PC_CTTY): Ditto.
520         (path_types::PATH_CTTY): Ditto.
521         (path_types::PATH_OPEN): Ditto.
522         (path_conv::isopen): New method.
523         (path_conv::isctty_capable): Ditto.
524         * path.cc (path_conv::check): Set PATH_OPEN and PATH_CTTY as
525         appropriate.
526         * pipe.cc (fhandler_pipe::open): Use copyto to copy pipe handle.
527         * syscall.cc (open): Reinstate fd > 2 check to disallow resetting ctty
528         on non-std* handles.
529         * tty.cc (tty_list::allocate): Pass out handles for allocated tty.  use
530         `not_allocated' to find unallocated ttys.  Avoid keeping the lock since
531         the allocation of the tty should be sufficient to prevent multiple
532         access.
533         (tty::not_allocated): Clarify comment.  Rename.  Return handles when an
534         unused tty is found.  Simply test for existing tty.
535         (tty::exists): Rewrite to use `not_allocated'.
536         * tty.h (NTTYS): Reset down to actual number supported by devices.in.
537         (tty::not_allocated): Declare new function.
538         (tty_list::allocate): Pass out read/write tty handles.  Zero them when
539         not found.
540         * fhandler_proc.cc: Reflect name change from FH_PTYM -> FH_PTMX.
541         * pinfo.h (pinfo::set_ctty): Reduce/reorder arguments passed in.
542         * pinfo.cc (pinfo::set_ctty): Ditto.  Just use tc() built into the
543         passed-in fhandler_termios pointer.  Return true if ctty is assigned.
544         * syscalls.cc (open): Call build_fh_pc with PC_OPEN flag.  Set PC_CTTY
545         if appropriate.
546         (stat_worker): Remove is_dev_tty () stuff.
547
548 2011-10-15  Corinna Vinschen  <corinna@vinschen.de>
549
550         * fhandler_process.cc (dos_drive_mappings::fixup_if_match): Convert
551         native NT network paths into DOS UNC paths.
552
553 2011-10-15  Corinna Vinschen  <corinna@vinschen.de>
554
555         * sec_auth.cc (get_token_group_sidlist): Add CONSOLE LOGON SID on
556         systems supporting it.  Never add SERVICE SID but keep code in for
557         future reference.  Explain why.
558         (get_priv_list): Add cygpsid pointer parameter.  Point it to the
559         mandatory integrity SID which matches account and privileges.
560         (create_token): Fetch mandatory integrity SID from call to
561         get_priv_list.
562         (lsaauth): Call get_priv_list with additional NULL pointer.  Change
563         comment accordingly.
564         * sec_helper.cc (well_known_console_logon_sid): New static SID.
565         (cygpriv): Change to structure containing extra flag to store info
566         about required integrity level.
567         (privilege_luid): Accommodate changes to cygpriv.  Return integrity
568         level in new high_integrity parameter.
569         (privilege_name): Accommodate changes to cygpriv.
570         (set_privilege): Drop trailing \n from debug output.
571         (set_cygwin_privileges): Don't set SE_CREATE_GLOBAL_PRIVILEGE anymore
572         since it's just not needed, but keep code in for future reference.
573         Change comment accordingly.
574         * security.h (well_known_console_logon_sid): Declare.
575         (privilege_luid): Align declaration to above change.
576         * wincap.h (wincaps::has_console_logon_sid): New element.
577         * wincap.cc: Implement above element throughout.
578
579 2011-10-13  Corinna Vinschen  <corinna@vinschen.de>
580
581         * path.cc (find_fast_cwd_pointer): Allow 'push crit-sect-addr' instead
582         of 'mov edi, crit-sect-addr; push edi' and set rcall accordingly.
583
584 2011-10-13  Corinna Vinschen  <corinna@vinschen.de>
585
586         * path.cc (copy_cwd_str): Move up in file to be accessible from
587         class fcwd_access_t.
588         (class fcwd_access_t): New class to consolidate and hide the details
589         of the various FAST_CWD implementations.  Add implementation for
590         Windows 8 Developer Preview.
591         (fast_cwd_version): Make static private member of fcwd_access_t.
592         (fast_cwd_ptr): Change base type to fcwd_access_t.
593         (find_fast_cwd_pointer): Return fcwd_access_t**.
594         (find_fast_cwd): Ditto.  Rip out all FAST_CWD implementations and use
595         fcwd_access_t methods instead.
596         (cwdstuff::override_win32_cwd): Ditto.
597
598 2011-10-12  Corinna Vinschen  <corinna@vinschen.de>
599
600         * fhandler_console.cc (fhandler_console::cursor_set): Disable forcing
601         y to the current winBottom position.  Explain why.
602
603 2011-10-11  Christopher Faylor  <me.cygwin2011@cgf.cx>
604
605         * cygwin.din: Remove some _tc* exports.  Add tcgetsid().
606         * dtable.cc (fh_alloc): Revert ill-advised setting of major/minor.  Use
607         new is_dev_tty to remember that this device was opened as /dev/tty.
608         * fhandler.cc (fhandler_base::fstat): Remove leftover debugging
609         statement.
610         (fhandler_base::tcgetsid): New function.
611         * fhandler.h ((fhandler_base::tcgetsid): Declare new function.
612         (fhandler_base::is_dev_tty): Ditto.
613         (fhandler_termios): Rearrange protected/public.
614         (fhandler_termios::fhandler_termios): Remember last fhandler_termios
615         "opened".
616         (fhandler_termios::~fhandler_termios): Forget last fhandler_termios
617         opened.
618         (fhandler_termios::opened_as_dev_tty): Declare new field.
619         (fhandler_termios::is_dev_tty): Declare new function.
620         (fhandler_termios::tcgetsid): Ditto.
621         (fhandler_pty_common::use_archetype): Move here from subclass.
622         (fhandler_pty_slave::use_archetype): Move up.
623         (fhandler_pty_master::use_archetype): Ditto.
624         * fhandler_console.cc (fhandler_console::ioctl): Rename second argument
625         from `buf' to `arg' for consistency.  Call ioctl_termios for common
626         fhandler_termios ioctl handling.
627         * fhandler_tty.cc (fhandler_pty_slave::ioctl): Call ioctl_termios for
628         common fhandler_termios ioctl handling.
629         (fhandler_pty_master::ioctl): Ditto.
630         * fhandler_termios.cc (fhandler_termios::tcgetsid): Implement new
631         function.
632         (fhandler_termios::ioctl_termios): Ditto.  Implements TIOCSCTTY
633         handling.
634         * syscalls.cc (stat_worker): Set /dev/tty device info when appropriate.
635         * termios.cc (tcgetpgrp): Avoid extraneous "isatty" check.
636         (tcgetsid): Implement new function.
637         * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 253.
638         * include/sys/termios.h (TIOCSCTTY): Define.
639
640 2011-10-11  Christopher Faylor  <me.cygwin2011@cgf.cx>
641
642         * dtable.cc (fh_alloc): Don't parse /dev/tty if ctty is < 0.  Reset
643         major/minor from the specific tty to those for /dev/tty.
644
645 2011-10-10  Christopher Faylor  <me.cygwin2011@cgf.cx>
646
647         * syscalls.cc (open): Add temporary kludge to avoid assigning the
648         controlling tty on open unless the open is for stdin/stdout/stderr.
649         * tty.cc (tty_list::connect): Set ENXIO when can't find a tty.
650
651 2011-10-10  Corinna Vinschen  <corinna@vinschen.de>
652
653         * fhandler.h (fhandler_process::closedir): Declare.
654         * fhandler_process.cc (fhandler_process::closedir): New function to
655         avoid a SEGV in fhandler_proc::closedir.
656
657 2011-10-10  Christopher Faylor  <me.cygwin2011@cgf.cx>
658
659         * fhandler_tty.cc (fhandler_pty_slave::open): Clarify debugging output.
660         (fhandler_pty_slave::open): Change ENOENT to ENXIO when can't open a
661         tty.
662
663 2011-10-07  Corinna Vinschen  <corinna@vinschen.de>
664             Christopher Faylor  <me.cygwin2011@cgf.cx>
665
666         * fhandler.h (fhandler_console::tc_getpgid): New function.
667         * spawn.cc (spawn_guts): Add logic to put pure-windows processes "in
668         the background" when they are started that way.
669
670 2011-10-07  Corinna Vinschen  <corinna@vinschen.de>
671
672         * include/sys/cygwin.h (cygwin_getinfo_types): Define values
673         additionally as preprocessor symbols.
674
675 2011-10-06  Corinna Vinschen  <corinna@vinschen.de>
676
677         * fhandler_termios.cc (fhandler_termios::tcsetpgrp): Send __SIGSETPGRP
678         pseudo signal to process group instead of just calling
679         init_console_handler.
680         * sigproc.cc (wait_sig): Call init_console_handler here on __SIGSETPGRP
681         signal.
682         * sigproc.h (__SIGSETPGRP): Define.
683
684 2011-10-06  Christian Franke  <franke@computer.org>
685
686         * include/cygwin/wait.h: Use new __wait_status_to_int()
687         macro to access status value in W*() status checks.
688         Fix status description.
689         * include/sys/wait.h: Allow `int' and `union wait' as
690         wait status parameter.  Change __wait_status_to_int()
691         macro and wait () prototypes accordingly.  Add inline
692         functions for C++.  Remove extra `;'.
693
694 2011-10-05  Corinna Vinschen  <corinna@vinschen.de>
695
696         * external.cc (create_winenv): Rename from sync_winenv.  Take
697         environment pointer as parameter and return pointer to corresponding
698         win32 environment block if != NULL.  Otherwise just sync as before.
699         (cygwin_internal): Add CW_CVT_ENV_TO_WINENV case.
700         * include/cygwin/version.h: Bump API minor number.
701         * include/sys/cygwin.h (cygwin_getinfo_types): Add CW_CVT_ENV_TO_WINENV.
702
703 2011-10-04  Corinna Vinschen  <corinna@vinschen.de>
704
705         * net.cc (socketpair): Bind first socket to loopback only as well.
706
707 2011-09-21  Christopher Faylor  <me.cygwin2011@cgf.cx>
708
709         * tty.cc (grantpt): Check for valid fd.
710         (unlockpt): Ditto.
711
712 2011-09-02  Corinna Vinschen  <corinna@vinschen.de>
713
714         * net.cc (cygwin_getsockopt): Drop erroneous double conversion of error
715         code returned by SOL_SOCKET/SO_ERROR.  Fix error handling.
716
717 2011-09-01  Corinna Vinschen  <corinna@vinschen.de>
718
719         * lc_msg.h: Regenerate.
720
721 2011-09-01  Corinna Vinschen  <corinna@vinschen.de>
722
723         * dlfcn.cc (gfpod_helper): Helper function to search DLL using
724         a given DLL name.  Change default search path to allow /usr/bin.
725         (get_full_path_of_dll): Find DLLs even if the caller used a ".so"
726         suffix or a "lib" prefix for the DLL.
727
728 2011-08-31  Corinna Vinschen  <corinna@vinschen.de>
729
730         * flock.cc (inode_t::unlock_and_remove_if_unused): Rename from
731         unlock_and_remove.
732
733 2011-08-29  Corinna Vinschen  <corinna@vinschen.de>
734
735         * flock.cc (LOCK_OBJ_NAME_LEN): Change to accommodate extra lf_ver
736         field.
737         (class lockf_t): Add lf_ver field.
738         (lockf_t::lockf_t): Initialize lf_ver to 0.
739         (class inode_t): Change i_wait to i_cnt.  Change comment to explain
740         change in usage.
741         (inode_t:use): Rename from wait.  Make private.
742         (inode_t::unuse): Rename from unwait.  Make private.
743         (inode_t::inuse): Rename from waiting.  Make private.
744         (inode_t::notused): New public method to set use count to 0.
745         (inode_t::unlock_and_remove): New method to unlock node and to delete
746         it if it's unused in current process.
747         (fhandler_base::del_my_locks): Drop global list lock.  Drop variable
748         no_locks_left.  Simpify unlocking and removing node by just calling
749         unlock_and_remove.
750         (fixup_lockf_after_exec): Call notused method for each node.
751         (inode_t::get): Call use method.  Lock node only if outside of list
752         lock.
753         (inode_t::get_all_locks_list): Accommodate additional lf_ver field
754         when creating lockf_t structure from object name.
755         (lockf_t::create_lock_obj_attr): Accommodate additional lf_ver field
756         when creating object name from lockf_t structure.  Handle
757         STATUS_OBJECT_NAME_COLLISION gracefully in F_POSIX case as well.
758         Change comment accordingly.  Increment lf_ver field rather than high
759         byte of lf_wid field.  Simplify comment.
760         (fhandler_disk_file::lock): Always call unlock_and_remove rather than
761         just UNLOCK on node.
762         (lf_setlock): Move ret definition where it's used.  Drop unneeded
763         tests for obj being not NULL.  Only check for deadlock condition if the
764         lock we're trying to establish is a POSIX lock.  Revamp object
765         collecting and wait code to cover all cases.  Don't return with EDEADLK
766         if blocking process can't be opened for synchronization in F_POSIX case,
767         rather just wait like in F_FLOCK case.  Change system_printf to
768         debug_printf in that case.  Only run WaitForMultipleObjects with high
769         priority.  Close obj and process handles prior to locking node.
770
771 2011-08-27  Corinna Vinschen  <corinna@vinschen.de>
772
773         * fhandler.cc (fhandler_base::open): Fix typo in comment.
774         (fhandler_base::close): Move call to del_my_locks from here...
775         * fhandler_disk_file.cc (fhandler_disk_file::open): ...to here.
776         * flock.cc (struct lockfattr_t): New type.
777         (lockf_t::close_lock_obj): New method, use throughout.
778         (lockf_t::create_lock_obj_attr): New method.
779         (lockf_t::create_lock_obj): Use create_lock_obj_attr method.  Handle
780         STATUS_OBJECT_NAME_COLLISION in F_FLOCK case gracefully.  Add lengthy
781         comments to explain why and how.
782         (lockf_t::open_lock_obj): Use create_lock_obj_attr method.
783         (lockf_t::del_lock_obj): Call NtSetEvent rather than SetEvent for
784         symmetry.
785         (fhandler_disk_file::lock): Define n only where it's used.  Call
786         need_fork_fixup only if call was successful.  Handle EINTR and
787         ECANCELED return values from lf_setlock.
788         (lf_setlock): Drop WAIT_UNLOCKED and WAIT_PROC_EXITED.  Don't wait
789         for event object handle count to become <= 1 in F_LOCK case.
790         Simplify WFMO return value handling.  Don't handle signal and cancel
791         events here; just return with appropriate error code instead.
792         (lf_getblock): Ignore locks for which the handle can't be opened.
793         Use IsEventSignalled.
794         * ntdll.h (STATUS_INVALID_INFO_CLASS): Undef if defined elsewhere to
795         make sure the definition is casted to NTSTATUS.
796         (STATUS_INVALID_HANDLE): Define and ditto.
797         (STATUS_OBJECT_NAME_COLLISION): Define.
798         (NtSetEvent): Declare.
799
800 2011-08-25  Rafal Zwierz  <rzwierz@googlemail.com>
801
802         * cygthread.cc (cygthread::simplestub): Notify that the thread has
803         detached also in freerange thread case.
804
805 2011-08-25  Corinna Vinschen  <corinna@vinschen.de>
806
807         * fhandler.cc (fhandler_base::open): Never open files with
808         FILE_OVERWITE/FILE_OVERWRITE_IF.  Set file size to 0 explicitely if
809         regular, existing file has been opened for writing with O_TRUNC flag
810         set.  Explain why.
811
812 2011-08-24  Corinna Vinschen  <corinna@vinschen.de>
813
814         * thread.cc (pthread::pthread): Drop setting parent_tls.  Call
815         sigprocmask to copy parent thread signal mask into new parent_sigmask
816         member.
817         (pthread::thread_init_wrapper): Copy _my_tls.sigmask from new
818         parent_sigmask member.
819         * thread.h (class pthread): Drop parent_tls.  Add parent_sigmask.
820
821 2011-08-24  Christopher Faylor  <me.cygwin2011@cgf.cx>
822
823         * thread.cc (pthread::exit): Create dummy tls structure to hold
824         _main_tls contents if we've asked _main_tls to exit.
825
826 2011-08-23  Corinna Vinschen  <corinna@vinschen.de>
827
828         * poll.cc (poll): Don't return prematurely if invalid fds have been
829         encountered.  Enforce timeout set to 0 in case of invalid fds.  Take
830         number of invalid fds into account when returning.
831
832 2011-08-23  Corinna Vinschen  <corinna@vinschen.de>
833
834         * fhandler_socket.cc (fhandler_socket::send_internal): Fix setting
835         nosignal flag.  Convert ECONNABORTED on connection-oriented socket
836         to EPIPE, too.
837
838 2011-08-21  Christopher Faylor  <me.cygwin2011@cgf.cx>
839
840         * dtable.cc (conv_start_chars): Remove unneeded section attribute.
841
842 2011-08-20  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
843
844         * include/paths.h (_PATH_MAILDIR): Define.
845         (_PATH_SHELLS): Define.
846
847 2011-08-20  Corinna Vinschen  <corinna@vinschen.de>
848
849         * fhandler_process.cc (format_process_maps): Define page protection
850         shortcuts RO, X, and WC.  Use in creating access flag string.  Don't
851         set type flag to 's' for copy-on-write pages, as on Linux.
852
853 2011-08-19  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
854
855         * devices.h (fh_devices): Define DEV_MISC_MAJOR, DEV_MEM_MAJOR,
856         DEV_SOUND_MAJOR.  Use throughout.
857         * fhandler_proc.cc (proc_tab): Add /proc/devices and /proc/misc
858         virtual files.
859         (format_proc_devices): New function.
860         (format_proc_misc): New function.
861
862 2011-08-19  Christopher Faylor  <me.cygwin2011@cgf.cx>
863
864         * dtable.cc: Mark some const variables as static.
865         * environ.cc (conv_start_chars): Move to shared cygwin region and
866         initialize at compile time.
867         (match_first_char): New generic function for querying conv_start_chars.
868         (posify_maybe): Rename from posify.
869         (environ_init): Remove conv_envvars initialization.  Don't check
870         conv_start_chars, just allow posify_maybe to make the decision.
871         * fhandler_console.cc (__vt100_conv): Fix formatting.  Mark as const.
872
873 2011-08-19  Corinna Vinschen  <corinna@vinschen.de>
874
875         * fhandler_console.cc (fhandler_console::read): Recognize backspace key
876         using the device independent key code, rather than the device dependent
877         scan code.
878
879 2011-08-18  Christopher Faylor  <me.cygwin2011@cgf.cx>
880
881         * dcrt0.cc (dll_crt0_0): Remove unneeded __stdcall decoration.
882         * init.cc: Reflect change to dll_crt0_0 in declaration.
883
884 2011-08-18  Corinna Vinschen  <corinna@vinschen.de>
885
886         * dtable.cc (dtable::get_debugger_info): Add missing braces.
887         (dtable::stdio_init): Fix incorrect negation of not_open(2) condition.
888
889 2011-08-16  Pierre Humblet <Pierre.Humblet@ieee.org>
890
891         * net.cc (gethostby_helper): Remove DEBUGGING code from and
892         streamline the second pass.
893
894 2011-08-16  Corinna Vinschen  <corinna@vinschen.de>
895
896         * dlfcn.cc (dlopen): Reimplement RTLD_NODELETE for Windows 2000 using
897         internal datastructures.  Explain the code.
898         * ntdll.h (struct _LDR_DATA_TABLE_ENTRY): Define.
899         (struct _PEB_LDR_DATA): Define.
900         (struct _PEB): Change PVOID LoaderData to PPEB_LDR_DATA Ldr.
901
902         * fhandler_process.cc (format_process_maps): Call NtQueryVirtualMemory
903         with valid return length pointer.  Explain why.
904
905 2011-08-16  Corinna Vinschen  <corinna@vinschen.de>
906
907         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
908
909 2011-08-16  Corinna Vinschen  <corinna@vinschen.de>
910
911         * autoload.cc (GetModuleHandleExW): Define.
912         * dlfcn.cc: Throughout mark exported symbols as extern "C".
913         (dlopen): Unignore flags argument.  Define ret to NULL.  Fix typo in
914         comment.  Support Glibc flags RTLD_NOLOAD and RTLD_NODELETE.
915         * include/dlfcn.h:  Clean up comments.
916         (RTLD_NODELETE): Define.
917         (RTLD_NOLOAD): Define.
918         (RTLD_DEEPBIND): Define.
919
920 2011-08-15  Corinna Vinschen  <corinna@vinschen.de>
921
922         * pipe.cc (pipe): Just call _pipe with O_BINARY mode.  Move code to
923         generate normalized pathnames from here...
924         (_pipe): ...to here.
925
926 2011-08-13  Corinna Vinschen  <corinna@vinschen.de>
927
928         * miscfuncs.cc (CreatePipeOverlapped): New function.
929         (ReadPipeOverlapped): Ditto.
930         (WritePipeOverlapped): Ditto.
931         * miscfuncs.h: Declare new functions.
932         * pinfo.cc (commune_process): Call WritePipeOverlapped instead of
933         WriteFile.  Set timeout to 1 sec.
934         (_pinfo::commune_request): Call ReadPipeOverlapped instead of ReadFile.
935         Set timeout to 0.5 secs.
936         * sigproc.cc (sig_send): Create pipe using CreatePipeOverlapped.
937
938 2011-08-12  Christopher Faylor  <me.cygwin2011@cgf.cx>
939
940         * miscfuncs.cc (create_pipe): Delete obsolete function.
941         * miscfuncs.h (create_pipe): Delete define.
942
943         * pipe.c (fhandler_pipe::create_selectable): Delete obsolete comment.
944
945 2011-08-12  Corinna Vinschen  <corinna@vinschen.de>
946
947         * fhandler_proc.cc (fhandler_proc::closedir): Don't free, but delete
948         instead.
949
950 2011-08-12  Corinna Vinschen  <corinna@vinschen.de>
951
952         * fhandler.h (fhandler_proc::opendir): Declare.
953         (fhandler_proc::closedir): Declare.
954         * fhandler_proc.cc (fhandler_proc::opendir): New method.  Fetch list
955         of active processes here once to avoid potential duplicates and store
956         in dir->__handle.
957         (fhandler_proc::closedir): New method.  Free dir->__handle.
958         (fhandler_proc::readdir): Convert pinfo into a reference to the winpids
959         entry in dir->__handle.
960
961 2011-08-11  Corinna Vinschen  <corinna@vinschen.de>
962
963         * fhandler_proc.cc (fhandler_proc::get_proc_fhandler): Don't allow to
964         access process info by using the Windows PID.
965         * fhandler_process.cc (fhandler_process::fstat): Ditto.
966         (fhandler_process::fill_filebuf): Ditto.
967
968 2011-08-11  Corinna Vinschen  <corinna@vinschen.de>
969
970         * (winpids::add): Make sure to store always a Windows PID in
971         pidlist, even if pid is a Cygwin PID.
972         (winpids::enum_processes): Fetch Cygwin processes from listing of
973         shared cygwin object dir in the native NT namespace.  Only if winpid
974         is true, fetch Windows processes using an additional call to
975         NtQuerySystemInformation.
976
977 2011-08-10  Corinna Vinschen  <corinna@vinschen.de>
978
979         * fhandler_process.cc (format_process_status): Always print process name
980         even for zombies.
981         (get_mem_values): Fix loop fetching working set list to avoid out of
982         memory conditions.  Return all mem values set to 0 for zombies.
983         * ntdll.h (STATUS_PROCESS_IS_TERMINATING): Define.
984
985 2011-08-09  Corinna Vinschen  <corinna@vinschen.de>
986
987         * heap.cc (eval_initial_heap_size): New function fetching the heap
988         size from the LoaderFlags field in the PE/COFF header.
989         (heap_init): Call eval_initial_heap_size rather than
990         cygwin_shared->heap_chunk_size to fetch the initial heap size.
991         * shared.cc (shared_info::heap_chunk_size): Remove.
992         * shared_info.h (class shared_info): Drop heap_chunk member.
993         (CURR_SHARED_MAGIC): Update.
994
995 2011-08-09  Corinna Vinschen  <corinna@vinschen.de>
996
997         * ntdll.h (STATUS_NOT_FOUND): Define.
998         * ntea.cc (read_ea): Return correct ENOTSUP rather than EOPNOTSUPP.
999         Handle STATUS_INVALID_DEVICE_REQUEST and STATUS_NOT_FOUND.  Explain
1000         why.  Convert conditional to switch statement.
1001         (write_ea): Return correct ENOTSUP rather than EOPNOTSUPP.  Handle
1002         STATUS_INVALID_DEVICE_REQUEST.  Convert conditional to switch statement.
1003
1004 2011-08-07  Corinna Vinschen  <corinna@vinschen.de>
1005
1006         * resource.cc (getrlimit): Just return RLIM_INFINITY in a request for
1007         RLIMIT_AS.
1008
1009 2011-08-07  Corinna Vinschen  <corinna@vinschen.de>
1010
1011         * fhandler_process.cc (format_process_maps): Actually print info about
1012         the application heap of the printed process, not of the current process.
1013
1014 2011-08-04  Corinna Vinschen  <corinna@vinschen.de>
1015
1016         * net.cc (socketpair): Release sb0 if there's no space left for sb1.
1017
1018 2011-08-03  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
1019
1020         * cygwin.din (clock_nanosleep): Export.
1021         * posix.sgml (std-notimpl): Move clock_nanosleep from here...
1022         (std-susv4): ... to here.
1023         (std-notes): Note limitations of clock_nanosleep.
1024         * signal.cc (clock_nanosleep): Renamed from nanosleep, adding clock_id
1025         and flags arguments and changing return values throughout.
1026         Improve checks for illegal rqtp values.  Add support for
1027         CLOCK_MONOTONIC and TIMER_ABSTIME.
1028         (nanosleep): Rewrite in terms of clock_nanosleep.
1029         (sleep): Ditto.
1030         (usleep): Ditto.
1031         * thread.cc: Mark clock_nanosleep in list of cancellation points.
1032         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
1033
1034 2011-08-03  Christopher Faylor  <me.cygwin2011@cgf.cx>
1035
1036         * dll_init.cc: Use fabort in favor of api_fatal and fork_info->abort
1037         where appropriate throughout.
1038         (fabort): Define.
1039         (dll_list::topsort): Don't print sorting information.  Fix formatting.
1040         (dll_list::topsort_visit): Fix formatting.
1041         (dll_list::load_after_fork_impl): Perform comment fixups.
1042         * sigproc.cc (child_info_fork::abort): (for now?) Always print cause of
1043         fork failure.
1044         * include/sys/strace.h (strace_vprintf): Remove _STRACE_NOTALL when
1045         printing.  We really do want to see this.
1046
1047 2011-08-03  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
1048
1049         * cygtls.h (struct _local_storage): Add cw_timer member.
1050         * cygtls.cc (_cygtls::init_thread): Initialize locals.cw_timer.
1051         (_cygtls::fixup_after_fork): Ditto.
1052         * tlsoffsets.h: Regenerate.
1053         * ntdll.h (enum _TIMER_INFORMATION_CLASS): Define.
1054         (struct _TIMER_BASIC_INFORMATION): Define.
1055         (NtQueryTimer): Declare function.
1056         * thread.h (cancelable_wait): Change timeout argument to
1057         PLARGE_INTEGER and provide NULL default.
1058         (fast_mutex::lock): Adjust accordingly.
1059         (pthread_cond::wait): Change timeout argument to PLARGE_INTEGER
1060         and default to NULL.
1061         * thread.cc (cancelable_wait): Change timeout argument to
1062         PLARGE_INTEGER.  Initialize _cygtls.locals.cw_timer if needed.
1063         Use NT waitable timers for handling timeout.  Return remaining time
1064         to timeout argument if timeout was relative.
1065         (pthread_cond::wait): Change timeout argument to PLARGE_INTEGER.
1066         Adjust to change in cancelable_wait.
1067         (pthread_mutex::lock): Adjust to change in cancelable_wait.
1068         (pthread_spinlock::lock): Ditto.
1069         (pthread::join): Ditto.
1070         (__pthread_cond_dowait): Change waitlength argument to PLARGE_INTEGER.
1071         Adjust to changes in cancelable_wait and pthread_cond::wait.
1072         (pthread_cond_timedwait): Adjust to change in __pthread_cond_dowait.
1073         (pthread_cond_wait): Ditto.
1074         (semaphore::_timedwait): Adjust to change in cancelable_wait.
1075         (semaphore::_wait): Ditto.
1076         * exceptions.cc (handle_sigsuspend): Ditto.
1077         * signal.cc (nanosleep): Ditto.
1078         * wait.cc (wait4): Ditto. Fix copyright dates.
1079         * times.cc (FACTOR, NSPERSEC): Move from here...
1080         * hires.h (FACTOR, NSPERSEC): ...to here.
1081
1082 2011-08-01  Corinna Vinschen  <corinna@vinschen.de>
1083
1084         * syscalls.cc (faccessat): Fix parens in flag expression when calling
1085         build_fh_name.
1086
1087         * fhandler_disk_file.cc (fhandler_disk_file::mkdir): Fix typo in
1088         comment.
1089         * fhandler_socket.cc (fhandler_socket::bind): Ditto.
1090         * path.cc (symlink_worker): Ditto.
1091
1092 2011-07-31  Christopher Faylor  <me.cygwin2011@cgf.cx>
1093
1094         * dll_init.cc (dll_list::load_after_fork_impl): Add a hint to an error
1095         message.
1096
1097 2011-07-31  Christopher Faylor  <me.cygwin2011@cgf.cx>
1098
1099         * sigproc.cc (pending_signals::pending): Define new function.
1100         (sig_dispatch_pending): Avoid calling sig_send if there are no pending
1101         signals.
1102
1103 2011-07-31  Corinna Vinschen  <corinna@vinschen.de>
1104
1105         * fhandler.h (class fhandler_dev_mem): Remove dup method declaration.
1106         * fhandler_clipboard.cc (fhandler_dev_clipboard::dup): Accommodate the
1107         fact that the entire fhandler gets copied over to the child in
1108         operator =.
1109         * fhandler_floppy.cc (fhandler_dev_floppy::dup): Ditto.
1110         * fhandler_raw.cc (fhandler_dev_raw::dup): Ditto.
1111         * fhandler_serial.cc (fhandler_serial::dup): Ditto.
1112         * fhandler_socket.cc (fhandler_socket::dup): Ditto.
1113         * fhandler_virtual.cc (fhandler_virtual::dup): Ditto.
1114         * fhandler_mem.cc (fhandler_dev_mem::dup): Ditto.  Remove entirely.
1115
1116 2011-07-30  Christopher Faylor  <me.cygwin2011@cgf.cx>
1117
1118         * cygthread.cc (cygthread::async_create): Define new function.
1119         * cygthread.h (cygthread::create): Use correct regparm.
1120         (cygthread::standalone): Delete from class and from all constructors.
1121         (cygthread::cygthread): Use three only arguments for detached threads,
1122         (cygthread::async_create): Declare.
1123         and start the thread via QueueUserAPC/async_create.
1124         * dcrt0.cc (dll_crt0_0): Remove handling for
1125         wincap.has_buggy_thread_startup.
1126         (dll_crt0_1): Ditto.
1127         * wincap.cc: Ditto throughout.
1128         * wincap.h: Ditto.
1129
1130 2011-07-30  Christopher Faylor  <me.cygwin2011@cgf.cx>
1131
1132         * fhandler.h (fhandler_base_overlapped::size): Declare/define size()
1133         function for consistency.
1134         (fhandler_termios::size): Ditto.
1135         (fhandler_pty_common::size): Ditto.
1136
1137 2011-07-30  Corinna Vinschen  <corinna@vinschen.de>
1138
1139         * fhandler_registry.cc (fhandler_registry::dup): Duplicate value_name.
1140
1141 2011-07-29  Corinna Vinschen  <corinna@vinschen.de>
1142
1143         Throughout change "WinSock" to "Winsock" in comments.
1144         * fhandler_socket.cc (fhandler_socket::sendmsg): Add missing call to
1145         get_inet_addr to convert AF_LOCAL to AF_INET sockets.
1146         * net.cc (cygwin_socket): Workaround UDP Winsock problem.  Add comment
1147         to explain why.
1148         * select.cc: Include winsock2.h rather than winsock.h.
1149
1150 2011-07-26  Corinna Vinschen  <corinna@vinschen.de>
1151
1152         * fhandler_disk_file.cc (__DIR_mounts::eval_ino): Create path_conv
1153         with PC_KEEP_HANDLE flag.
1154         * path.h (path_conv::operator =): Duplicate UNICODE path as well.
1155         * security.cc (check_file_access): Use path_conv handle if available.
1156         * syscalls.cc (access): Create fhandler with PC_KEEP_HANDLE flag set.
1157         (euidaccess): Ditto.
1158         (faccessat): Ditto.
1159
1160 2011-07-26  Corinna Vinschen  <corinna@vinschen.de>
1161
1162         * ntdll.h: Fix typo in comment.
1163         * path.cc: Ditto.
1164
1165 2011-07-25  Corinna Vinschen  <corinna@vinschen.de>
1166
1167         * fhandler_console.cc (fhandler_console::ioctl): Fetch console events
1168         using PeekConsoleInput and return only key down events in buf.
1169         * fhandler_tty.cc (fhandler_pty_slave::ioctl): Always return EINVAL
1170         if PeekNamedPipe fails.
1171         (fhandler_pty_master::ioctl): Ditto.
1172
1173 2011-07-22  Corinna Vinschen  <corinna@vinschen.de>
1174
1175         * fhandler_tty.cc (fhandler_pty_slave::ioctl): Drop FIONBIO case.
1176         Handle FIONREAD.
1177         (fhandler_pty_master::ioctl): Ditto.  Call fhandler_base::ioctl to
1178         decode default condition.
1179         * fhandler_console.cc (fhandler_console::ioctl): Handle FIONREAD.
1180
1181 2011-07-21  Christopher Faylor  <me.cygwin2011@cgf.cx>
1182             Corinna Vinschen  <corinna@vinschen.de>
1183
1184         * fhandler.cc: Add #include for asm/socket.h for dealing with FIONREAD.
1185         (fhandler_base::ioctl): Special-case errno for FIONREAD.
1186         * fhandler_dsp.cc (fhandler_dev_dsp::ioctl): Rename parameter for
1187         consistency.  Call fhandler_base::ioctl to decode default condition.
1188         * fhandler_serial.cc (fhandler_serial::ioctl): Ditto.
1189         * fhandler_tty.cc (fhandler_pty_slave::ioctl): Call
1190         fhandler_base::ioctl to decode default condition.
1191         * fhandler_windows.cc (fhandler_windows::ioctl): Ditto.
1192
1193 2011-07-21  Corinna Vinschen  <corinna@vinschen.de>
1194
1195         * heap.cc (eval_start_address): Simplify test for large address
1196         awareness of executable, which works for 32 and 64 bit systems.
1197         Change comment accordingly.
1198
1199 2011-07-21  Corinna Vinschen  <corinna@vinschen.de>
1200
1201         * heap.cc (eval_start_address): New static function to evaluate the
1202         best start address for the application heap.
1203         (heap_init): Call eval_start_address to fetch the start value for
1204         start_address.  Move preceeding comment to eval_start_address.
1205
1206 2011-07-21  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
1207
1208         * cygwin.din (pthread_condattr_getclock): Export.
1209         (pthread_condattr_setclock): Export.
1210         * posix.sgml (std-notimpl): Move pthread_condattr_getclock and
1211         pthread_condattr_setclock from here...
1212         (std-susv4): ... to here.
1213         * sysconf.cc (sca): Set _SC_CLOCK_SELECTION to _POSIX_CLOCK_SELECTION.
1214         * thread.cc: (pthread_condattr::pthread_condattr): Initialize clock_id.
1215         (pthread_cond::pthread_cond): Initialize clock_id.
1216         (pthread_cond_timedwait): Use clock_gettime() instead of gettimeofday()
1217         in order to support all allowed clocks.
1218         (pthread_condattr_getclock): New function.
1219         (pthread_condattr_setclock): New function.
1220         * thread.h (class pthread_condattr): Add clock_id member.
1221         (class pthread_cond): Ditto.
1222         * include/pthread.h: Remove obsolete comment.
1223         (pthread_condattr_getclock): Declare.
1224         (pthread_condattr_setclock): Declare.
1225         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
1226
1227 2011-07-18  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
1228
1229         * sysconf.cc (sca): Return -1 for _SC_THREAD_ROBUST_PRIO_INHERIT,
1230         _SC_THREAD_ROBUST_PRIO_PROTECT, and _SC_XOPEN_UUCP.
1231         (SC_MAX): Redefine accordingly.
1232         (csa): Return strings for _CS_POSIX_V7_THREADS_CFLAGS,
1233         _CS_POSIX_V7_THREADS_LDFLAGS, and _CS_V7_ENV.
1234         (CS_MAX): Redefine accordingly.
1235         * include/limits.h (LONG_BIT): Define.
1236         (WORD_BIT): Define.
1237
1238 2011-07-18  Corinna Vinschen  <corinna@vinschen.de>
1239
1240         * heap.cc (heap_init): Change type of largest_found to PVOID.  Start
1241         querying memory at 0x20000000.  Use largest_found pointer when trying
1242         to allocate largest free memory area found.
1243
1244 2011-07-14  Corinna Vinschen  <corinna@vinschen.de>
1245
1246         * fhandler_console.cc (fhandler_console::input_tcsetattr): Revert to
1247         setting ENABLE_PROCESSED_INPUT depending on ISIG and IGNBRK.
1248         (fhandler_console::tcgetattr): Set ISIG depending on
1249         ENABLE_PROCESSED_INPUT as well.
1250
1251 2011-07-13  Corinna Vinschen  <corinna@vinschen.de>
1252
1253         * fhandler_serial.cc (fhandler_serial::raw_read): Handle non-blocking
1254         case more thoroughly.
1255
1256 2011-07-13  Christopher Faylor  <me.cygwin2011@cgf.cx>
1257
1258         * setup_handler (setup_handler): Change break to goto out, missed in
1259         2011-07-06 changes.
1260
1261 2011-07-10  Christopher Faylor  <me.cygwin2011@cgf.cx>
1262
1263         * fhandler_tty.cc (fhandler_pty_slave::ioctl): Remove erroneous support
1264         for TIOCLINUX for pty.  Get rid of unneeded EINVAL handling in wake of
1265         tty removal.  Remove now-unneeded variable.
1266
1267 2011-07-10  Corinna Vinschen  <corinna@vinschen.de>
1268
1269         * include/netdb.h (gethostbyname2): Declare.
1270
1271 2011-07-09  Eric Blake  <eblake@redhat.com>
1272
1273         * signal.cc (handle_sigprocmask): Return error rather than setting
1274         errno, for pthread_sigmask.
1275         (sigprocmask): Adjust caller.
1276
1277 2011-07-07  Corinna Vinschen  <corinna@vinschen.de>
1278
1279         * miscfuncs.cc (yield): Drop thread priority only once.
1280
1281 2011-07-06  Christopher Faylor  <me.cygwin2011@cgf.cx>
1282
1283         * exceptions.cc (_cygtls::interrupt_now): Back out previous change
1284         since it could theoretically cause a non-CTRL-C-able program if a
1285         program has suffered memory corruption.
1286         (setup_handler): Ditto.
1287
1288 2011-07-06  Corinna Vinschen  <corinna@vinschen.de>
1289
1290         * sched.c (sched_yield): Just call SwitchToThread because yield now
1291         potentially switches CPU.
1292
1293 2011-07-06  Christopher Faylor  <me.cygwin2011@cgf.cx>
1294
1295         * exceptions.cc (_cygtls::interrupt_now): Don't check for spinning
1296         here.
1297         (setup_handler): Check for spinning here, assuming that it is
1298         transitory and should not affect the retry loop.
1299
1300 2011-07-06  Christopher Faylor  <me.cygwin2011@cgf.cx>
1301
1302         * exceptions.cc (CALL_HANDLER_RETRY_INNER): Rename to reflect different
1303         functionality.
1304         (CALL_HANDLER_RETRY_OUTER): New define.
1305         (setup_handler): Add outer loop to signal handler to try harder to
1306         deliver the signal.
1307         * miscfuncs.cc (yield): Drop priority and use SleepEx() to force thread
1308         rescheduling rather than relying on SwitchToThread().
1309
1310 2011-07-06  Corinna Vinschen  <corinna@vinschen.de>
1311
1312         * sigproc.cc (wait_sig): Fix debug output.
1313
1314 2011-07-05  Corinna Vinschen  <corinna@vinschen.de>
1315
1316         * fhandler_console.cc (fhandler_console::input_tcsetattr): Make
1317         ENABLE_PROCESSED_INPUT flag only depending on value of IGNBRK.
1318         (fhandler_console::tcgetattr): Don't set ISIG depending on
1319         ENABLE_PROCESSED_INPUT, set IGNBRK instead.
1320
1321 2011-07-05  Corinna Vinschen  <corinna@vinschen.de>
1322
1323         * security.cc (get_file_sd): Fix comment.
1324
1325 2011-07-05  Corinna Vinschen  <corinna@vinschen.de>
1326
1327         * fhandler.cc (fhandler_base::open): Never create files with WRITE_DAC
1328         access.  Explain why.
1329         * fhandler_disk_file.cc (fhandler_base::fstat_helper): Improve debug
1330         output.
1331
1332 2011-07-05  Corinna Vinschen  <corinna@vinschen.de>
1333
1334         * fhandler.cc (fhandler_base::open): Don't open file with WRITE_DAC
1335         access on remote filesystem.  Explain why.
1336         * fhandler_disk_file.cc (fhandler_disk_file::mkdir): Ditto for
1337         directories.
1338         * fhandler_socket.cc (fhandler_socket::bind): Ditto for sockets.
1339         * path.cc (symlink_worker): Ditto for symlinks.
1340
1341 2011-07-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
1342
1343         * environ.cc (tty_is_gone): Wrap warning at 80 characters.
1344
1345 2011-07-04  Corinna Vinschen  <corinna@vinschen.de>
1346
1347         Throughout, open console handles with sharing for reading and writing.
1348         * dcrt0.cc (insert_file): Open file with full sharing allowed.
1349         * hookapi.cc (find_first_notloaded_dll): Ditto.
1350         * spawn.cc (av::fixup): Ditto.
1351
1352 2011-07-04  Corinna Vinschen  <corinna@vinschen.de>
1353
1354         * dtable.cc (dtable::init_std_file_from_handle): Change test for console
1355         device in call to fh->init to avoid conhost crash on W7.
1356
1357 2011-07-04  Corinna Vinschen  <corinna@vinschen.de>
1358
1359         * environ.cc (environ_init): Reinstantiate on-the-fly CYGWIN variable
1360         test and call to parse_options if found.
1361
1362 2011-07-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
1363
1364         * fhandler.cc (fhandler_base::open_with_arch): Call close_on_exec last
1365         to avoid setting close_on_exec for archetype.
1366         * fhandler_tty.cc (fhandler_pty_master::setup): Protect {from,to}_pty
1367         handles.  Use consistent naming in debug output.  Use inheritable
1368         handles and...
1369         (fhandler_pty_master::fixup_after_fork): ...avoid duplicating handles
1370         here.
1371         (fhandler_pty_slave::open): Don't set close_on_exec flag here.
1372
1373 2011-07-01  Christopher Faylor  <me.cygwin2011@cgf.cx>
1374
1375         * dtable.cc (cnew): Fix whitespace.
1376
1377 2011-07-01  Corinna Vinschen  <corinna@vinschen.de>
1378
1379         * include/sys/param.h (NGROUPS): Redefine as NGROUPS_MAX.
1380         (MAXHOSTNAMELEN): Redefine with same value as MAX_HOSTNAME_LEN.  Change
1381         comment.
1382         (MAXPATHLEN): Improve comment.
1383         (MAXSYMLINKS): Define and add comment.
1384
1385 2011-07-01  Corinna Vinschen  <corinna@vinschen.de>
1386
1387         * fhandler.cc (fhandler_base::open): Move NFS-specific code into the
1388         code block handling FH_FS stuff.
1389
1390 2011-06-30  Ryan Johnson  <ryan.johnson@cs.utoronto.ca>
1391
1392         * dtable.cc (fh_oom): Remove.
1393         (fh_calloc): Remove.
1394         (cnew): Redefine to handle NULL returns from cmalloc.
1395         (build_fh_name): Accommodate new definition of cnew.  Remove unneeded
1396         test for fh_oom.
1397         (fh_alloc): Ditto.
1398
1399 2011-06-30  Corinna Vinschen  <corinna@vinschen.de>
1400
1401         * fhandler_console.cc (fhandler_console::read): Add comment.
1402         (fhandler_console::input_tcsetattr): Don't set ENABLE_PROCESSED_INPUT
1403         if IGNBRK flag is set.
1404
1405 2011-06-30  Corinna Vinschen  <corinna@vinschen.de>
1406
1407         * dtable.cc (fh_oom): New static fhandler storage.
1408         (fh_calloc): New static function.  Add a comment to explain why this
1409         is needed.
1410         (cnew): Call fh_calloc as placement argument.
1411         (build_fh_name): Check return code from cnew against address of
1412         fh_oom to test for out of memory condition.
1413         (fh_alloc): Ditto.
1414         (build_fh_pc): Avoid a crash due to useing a NULL fhandler.
1415         * pipe.cc (fhandler_pipe::create): Check if build_fh_dev returned a
1416         valid pointer before using it.
1417
1418 2011-06-28  Corinna Vinschen  <corinna@vinschen.de>
1419
1420         * fhandler_process.cc (heap_info::fill_if_match): Rename info to
1421         note that this heap is a Windows heap.
1422         (format_process_maps): Print info about application heap.
1423
1424 2011-06-24  Corinna Vinschen  <corinna@vinschen.de>
1425
1426         * fhandler_console.cc (fhandler_console::read): Don't generate ^@ on
1427         Ctrl+Alt+Space.
1428
1429 2011-06-22  Corinna Vinschen  <corinna@vinschen.de>
1430
1431         * fhandler_tty.cc (fhandler_pty_master::setup): Create pty pipes
1432         non-inheritable.
1433
1434 2011-06-22  Corinna Vinschen  <corinna@vinschen.de>
1435
1436         * fhandler_tty.cc (fhandler_pty_master::setup): Fix crash in debug
1437         output.
1438
1439 2011-06-18  Corinna Vinschen  <corinna@vinschen.de>
1440
1441         * path.cc (normalize_win32_path): Skip all slashes after recognizing
1442         a ".." path component.  Add comment.
1443
1444 2011-06-17  Corinna Vinschen  <corinna@vinschen.de>
1445
1446         * fhandler.cc (fhandler_base::open): Drop local create_options variable.
1447         Use options member instead.
1448         * fhandler.h (class fhandler_base): Change type of access member to
1449         ACCESS_MASK.  Change get_access and set_access methods accordingly.
1450         Add options member.  Add get_options and set_options methods.
1451         (class fhandler_disk_file): Add prw_handle.
1452         (fhandler_disk_file::prw_open): Declare.
1453         (fhandler_disk_file::close): Declare.
1454         (fhandler_disk_file::dup): Declare.
1455         (fhandler_disk_file::fixup_after_fork): Declare.
1456         * fhandler_disk_file.cc (fhandler_disk_file::fhandler_disk_file):
1457         Initialize prw_handle to NULL.
1458         (fhandler_disk_file::close): Close prw_handle.
1459         (fhandler_disk_file::dup): New method.
1460         (fhandler_disk_file::fixup_after_fork): Set prw_handle to NULL since
1461         prw_handle is not inherited.
1462         (fhandler_disk_file::prw_open): New method.  Add long comment to
1463         explain current behaviour.
1464         (fhandler_disk_file::pread): Revert previous change.  Change to use
1465         prw_handle if possible.
1466         (fhandler_disk_file::pwrite): Change to use prw_handle if possible.
1467
1468 2011-06-17  Corinna Vinschen  <corinna@vinschen.de>
1469
1470         * dcrt0.cc (dll_crt0_1): Call strace.dll_info after call to pinfo_init.
1471         * strace.cc (strace::hello): Drop printing DLL information here since
1472         application info is not always available at this point.
1473         (strace::dll_info): New method to print DLL info.
1474         * include/sys/strace.h (strace::dll_info): Declare.
1475
1476 2011-06-17  Corinna Vinschen  <corinna@vinschen.de>
1477
1478         * dtable.cc (handle_to_fn): Accommodate name change of pty named pipes,
1479         otherwise ptys are not recognized.
1480
1481 2011-06-16  Christopher Faylor  <me.cygwin2011@cgf.cx>
1482
1483         * fhandler_console.cc (fhandler_console::set_unit): Set
1484         pc.file_attributes() to reflect existence.
1485         * fhandler.h (fhandler_pty_common::fhandler_pty_common): Ditto.
1486         * pinfo.cc (_pinfo::set_ctty): Output device numbers in hex.
1487
1488 2011-06-15  Christopher Faylor  <me.cygwin2011@cgf.cx>
1489
1490         * errno.cc (EIO): Lowercase "o" representative string.
1491
1492 2011-06-14  Christopher Faylor  <me.cygwin2011@cgf.cx>
1493
1494         * cygheap.h (init_cygheap::ctty_on_hold): Remove conditionalized
1495         variable.
1496         * dcrt0.cc (do_exit): Remove code which handled CYGWIN=tty style ttys.
1497         * devices.in: Remove "/dev/ttym".
1498         * dtable.cc: Rename tty to pty where appropriate throughout.
1499         (dtable::stdio_init): Use new t->is_console rather than using
1500         now-deleted hwnd element in tty structure.
1501         (dtable::init_std_file_from_handle): Remove code which handled
1502         CYGWIN=tty style ttys.
1503         (fh_alloc): Ditto.
1504         * fhandler.h: Rename tty to pty where appropriate.
1505         (fhandler_pty_common): Delete output_done_event, ioctl_request_event,
1506         ioctl_done_event.
1507         (fhandler_pty_master::setup): Delete argument.
1508         (fhandler_tty_master): Delete.
1509         (fhandler_union): Delete __tty_master.
1510         * fhandler_console.cc (use_tty): Delete.
1511         (fhandler_console::get_tty_stuff): Set is_console to true rather than
1512         calling sethwnd.
1513         (fhandler_console::send_winch_maybe): Remove CYGWIN=tty considerations.
1514         (fhandler_console::input_tcsetattr): Ditto.
1515         * fhandler_termios.cc (fhandler_termios::tcsetpgrp): Use new
1516         t->is_console rather than using now-deleted hwnd element in tty
1517         structure.
1518         * fhandler_tty.cc: Rename tty to pty where appropriate throughout.
1519         (tty_master): Delete.
1520         (process_input): Ditto.
1521         (process_output): Ditto.
1522         (process_ioctl): Ditto.
1523         (fhandler_tty_master::*): Ditto.
1524         (fhandler_pty_master::process_slave_output): Remove CYGWIN=tty
1525         considerations.
1526         (fhandler_pty_slave::open): Ditto for *_done_event.
1527         (fhandler_pty_slave::write): Ditto.
1528         (fhandler_pty_slave::ioctl): Ditto.
1529         (fhandler_pty_slave::fch_open_handles): Ditto.
1530         (fhandler_pty_slave::fch_set_sd): Ditto.
1531         (fhandler_pty_slave::fch_close_handles): Ditto.
1532         (fhandler_pty_common::close): Ditto.
1533         (fhandler_pty_master::setup): Ditto.  Remove now-unneeded ispty
1534         parameter.
1535         (fhandler_pty_master::open): Reflect argument removal for
1536         tty::allocate.
1537         * select.cc: Rename tty to pty where appropriate throughout.
1538         * sigproc.cc (proc_subproc): Remove CYGWIN=tty considerations.
1539         * tty.cc (ttyslot): Accommodate CYGWIN=tty removal.
1540         (tty_list::init_session): Ditto.
1541         (tty_list::attach): Ditto.
1542         (tty::create_master): Delete.
1543         (tty_list::terminate): Ditto.
1544         (tty_list::allocate): Delete "with_console" parameter.  Remove
1545         CYGWIN=tty considerations.
1546         (tty::init): Set is_console = false.  Use 'false' for was_opened since
1547         it is a boolean.
1548         * tty.h (*_{DONE,REQUEST}_EVENT): Delete.
1549         (tty_min::is_console): Declare new field which replaces hwnd.
1550         (tty_min::gethwnd): Delete.
1551         (tty_min::sethwnd): Ditto.
1552         (tty_list::allocate): Delete parameter.
1553         (tty_list::terminate): Delete declaration.
1554         * include/sys/cygwin.h (PID_USETTY): Redefine to PID_UNUSED1 and change
1555         comment to reflect its availability.
1556
1557 2011-06-13  Christopher Faylor  <me.cygwin2011@cgf.cx>
1558
1559         * fhandler_tty_slave.cc (fhandler_tty_slave::fhandler_tty_slave):
1560         Revert previous change since unit 0 is perfectly valid.
1561
1562 2011-06-12  Christopher Faylor  <me.cygwin2011@cgf.cx>
1563
1564         Rename FH_BAD to FH_NADA throughout.
1565         * devices.h (FH_ERROR): New value.
1566         (iscons_dev): Extend to detect all the console device types.
1567         * devices.in: Set aside storage for FH_ERROR.
1568         * dtable.cc (dtable::init_std_file_from_handle): Use iscons_dev to
1569         detect when device is a console.
1570         (fh_alloc): Pass device to console constructor.
1571         (build_fh_pc): Short circuit when we detect that the constructor saw an
1572         error.
1573         * fhandler.h (fhandler_console::fhandler_console): Accept fh_devices
1574         parameter.
1575         (get_tty_stuff): Change to void.
1576         * fhandler_console (fhandler_console::set_unit): Set device to FH_ERROR
1577         on attempt to access anything other than the current console.
1578         (fhandler_console::get_tty_stuff): Change to void return.
1579         (fhandler_console::open): Return EPERM on FH_ERROR device type.
1580         (fhandler_console::fhandler_console): Set the device type appropriately
1581         before calling get_tty_stuff and rely on that function to reset it if
1582         necessary.
1583
1584 2011-06-10  Christopher Faylor  <me.cygwin2011@cgf.cx>
1585
1586         * environ.cc (create_upcaseenv): Delete.
1587         (ucenv): Don't honor create_upcaseenv.
1588         (environ_init): Remove early retrieval of CYGWIN environment variable.
1589         Change comment to reflect new behavior.
1590
1591 2011-06-09  Christopher Faylor  <me.cygwin2011@cgf.cx>
1592
1593         * child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
1594         (child_info::old_title): Delete.
1595         (child_info::~child_info_spawn): Remove recording of old_title.
1596         * dcrt0.cc (title_buf): Delete.
1597         (child_info_spawn::handle_spawn): Remove recording of old_title.
1598         (dll_crt0_1): Get rid of all title handling.
1599         (do_exit): Ditto.
1600         * environ.cc (known): Delete strip_title and title.
1601         * fhandler_console.cc (fhandler_console::write): Remove recording of
1602         old_title.
1603         * globals.cc (exit_states): Remove ES_TITLE.
1604         (display_title): Delete.
1605         (strip_title_path): Delete.
1606         (old_title): Delete.
1607         * spawn.cc (spawn_guts): Remove old_title accommodation.
1608
1609 2011-06-09  Christopher Faylor  <me.cygwin2011@cgf.cx>
1610
1611         * environ.cc (envcache): Delete.
1612         (known): Remove envcache.
1613         (getwinenv): Don't honor envcache setting.
1614
1615 2011-06-09  Christopher Faylor  <me.cygwin2011@cgf.cx>
1616
1617         * environ.c: Move code earlier to allow:
1618         (_addenv): Call parse_options() when CYGWIN environment variable is
1619         being changed.
1620         (parse_options): Change parameter to 'const'.
1621
1622 2011-06-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
1623
1624         * environ.cc (tty_is_gone): Add missing space to message.
1625
1626 2011-06-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
1627
1628         * environ.cc (settings::set_process_state): Delete.
1629         (tty_is_gone): New function.
1630         (known): Change "tty" to call tty_is_gone().  Remove unneeded '&' from
1631         beginning of function address.
1632         (parse_options): Remove set_process_state handling.
1633         * shared_info.h (CURR_USER_MAGIC): Reset.
1634         (user_info::warned_notty): New member.
1635
1636 2011-06-07  Christopher Faylor  <me.cygwin2011@cgf.cx>
1637
1638         * fhandler_console.cc (fhandler_console::open_shared_console):
1639         Semi-revert to using fixed location for console stuff.
1640         * shared.cc (offsets): Ditto.  Comment.
1641         * shared_info (shared_locations): Re-add SH_SHARED_CONSOLE.
1642
1643 2011-06-05  Christopher Faylor  <me.cygwin2011@cgf.cx>
1644
1645         * fhandler_disk_file.cc (fhandler_disk_file::pread): Reset windows file
1646         position pointer back to previous location after successful read.
1647
1648 2011-06-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
1649
1650         * fhandler_console.cc (fhandler_console::open_shared_console): Don't
1651         zero handle to open_shared since it is supposed to be an input.
1652         (enum_windows): Set handle input to open_shared to NULL since it does
1653         not represent any previously opened shared region.
1654         * shared.cc (open_shared): Tweak debugging output.
1655
1656 2011-06-03  Christopher Faylor  <me.cygwin2011@cgf.cx>
1657
1658         * ntdll.h (FILE_PIPE_*): Define constants.
1659         * select.cc (pipe_data_available): Detect closing state.
1660
1661 2011-06-03  Christopher Faylor  <me.cygwin2011@cgf.cx>
1662
1663         * pinfo.cc (_pinfo::set_ctty): Don't reset myself->{pgid,sid} if
1664         terminal has no pgid or sid settings.
1665
1666 2011-06-03  Christopher Faylor  <me.cygwin2011@cgf.cx>
1667
1668         * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Only raise
1669         SIGPIPE when writing.
1670
1671         * fhandler.h: Include "tty.h".
1672         (fhandler_termios::_tc): Rename from tc.
1673         (fhandler_termios::tc): New method.
1674         (fhandler_termios::tcinit): Remove an argument.
1675         (fhandler_termios::get_ttyp): Use method to retrieve value.
1676         (fhandler_console::console_state): Move here.
1677         (fhandler_console::dev_state): Delete.
1678         (fhandler_console::shared_console_info): Define.
1679         (fhandler_console::open_shared_console): Move this function under
1680         fhandler_console umbrella.
1681         (fhandler_console::tc): Define.  Return static value.
1682         (fhandler_console::focus_aware): Accommodate deletion of dev_state.
1683         (fhandler_console): Add tty_list::get_cttyp as a friend.
1684         * fhandler_console.cc (dev_state): Redefine as a pointer within
1685         shared_console_info and change dev-> to dev. throughout.
1686         (fhandler_console::shared_console_info): Move into fhandler_console.
1687         (fhandler_console::open_shared_console): Move into fhandler_console
1688         change argument to simple bool.
1689         (enum_windows): Accommodate changes to console_state and
1690         open_shared_console.
1691         (console_unit::console_unit): Ditto.
1692         (fhandler_console::get_tty_stuff): Accommodate change to dev_state.
1693         (tty_list::get_cttyp): Accommodate change to
1694         handler_console::shared_console_info.
1695         (fhandler_console::read): Accommodate change from tc to tc ().
1696         (fhandler_console::set_input_state): Ditto.
1697         (fhandler_console::open): Accommodate tcinit argument change and change
1698         from tc to tc().
1699         (fhandler_console::input_tcsetattr): Accomodate change from tc to tc().
1700         (fhandler_console::input_tcsetattr): Ditto.
1701         (fhandler_console::write_normal): Ditto.
1702         (fhandler_console::init): Ditto.
1703         (fhandler_console::igncr_enabled): Ditto.
1704         * fhandler_termios.cc (fhandler_termios::tcinit): Remove first argument.
1705         Expect tc() to have been set up first.  Use tc() rather than tc.
1706         (fhandler_termios::tcsetpgrp): Accomodate change from tc to tc().
1707         (fhandler_termios::tcgetpgrp): Ditto.
1708         (fhandler_termios::bg_check): Ditto.
1709         (fhandler_termios::line_edit: Ditto.
1710         (fhandler_tty_master::set_winsize): Ditto.
1711         (fhandler_tty_slave::open): Ditto.
1712         (fhandler_tty_slave::init): Ditto.
1713         (fhandler_pty_master::write): Ditto.
1714         (fhandler_pty_master::setup): Ditto.  Accommodate change in arguments
1715         to tcinit.
1716         (fhandler_tty_slave::fch_open_handles): Set _tc directly.
1717         (tty_min::is_orphaned_process_group): Don't assume that parent pid
1718         exists.
1719         * pinfo.cc (_pinfo::set_ctty): Reset myself->{pgid,sid} here if we were
1720         started by a non-Cygwin process but the tty exists.
1721         * shared_info.h (console_state): Delete from here.
1722         * tty.h: Make multiple inclusion safe.
1723
1724 2011-05-31  Christopher Faylor  <me.cygwin2011@cgf.cx>
1725
1726         * exceptions.cc (ctrl_c_handler): Simplify test for no parent tty.
1727         * fhandler_console.cc (fhandler_console::get_tty_stuff): Return NULL if
1728         ctty is not tty/console.  Improve test for slave tty/pty device.
1729
1730 2011-05-31  Christopher Faylor  <me.cygwin2011@cgf.cx>
1731
1732         * external.cc (fillout_pinfo): Don't truncate ctty if it's < 0.
1733
1734         * select.cc (pipe_data_available): Avoid printing debug info by default
1735         or suffer very large strace files.
1736
1737 2011-05-31  Christopher Faylor  <me.cygwin2011@cgf.cx>
1738
1739         * select.cc (pipe_data_available): New function - uses
1740         NtQueryInformationFile to return information about pipes.
1741         (peek_pipe): Rewrite to use pipe_data_available for both read and write
1742         tests.
1743
1744 2011-05-30  Christopher Faylor  <me.cygwin2011@cgf.cx>
1745
1746         * dtable.cc (dtable::select_write): Add missing argument to
1747         debug_printf.
1748
1749         * fhandler.cc (fhandler_base_overlapped::setup_overlapped): Explicitly
1750         set io_pending to false.
1751         (fhandler_base_overlapped::has_ongoing_io): Call GetOverlappedResult
1752         to force completion of I/O.
1753         (fhandler_base_overlapped::wait_overlapped): Rewrite to correctly deal
1754         with nonblocking reads and to make more race proof.
1755         (fhandler_base_overlapped::raw_write): Deal with new enum values.
1756         (fhandler_base_overlapped::raw_read): Ditto.  Don't deal with ongoing
1757         I/O here since it makes no sense in the read context.
1758         * fhandler.h (enum wait_return): Add overlapped_unknown,
1759         overlapped_nonblocking_no_data.
1760         * pipe.cc (pipe): Add debugging output.
1761
1762 2011-05-30  Christopher Faylor  <me.cygwin2011@cgf.cx>
1763
1764         * dll_init.cc (dll_list::append): Eliminate increment of unused tot
1765         variable.
1766         * dll_init.h (dll_list::tot): Delete.
1767         (dll_list::populate_all_deps): Delete undefined function.
1768
1769         * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Move EPIPE
1770         handling under error condition.
1771
1772 2011-05-30  Ryan Johnson  <ryan.johnson@cs.utoronto.ca>
1773
1774         * dll_init.cc (reserve_upto): Remove.
1775         (release_upto): Ditto.
1776         (dll_list::reserve_space): New function to reserve space needed by
1777         DLL_LOAD dlls early in the fork process.
1778         (dll_list::load_after_fork): Rewrite to use recursion to
1779         track reservations it makes while trying to make dlls land where they
1780         belong.
1781         (dll_list::load_after_fork_impl): New function used by load_after_fork.
1782         (dll_list::alloc): Initialize image base field.
1783         * dll_init.h (dll_list::prefered_base): New field.
1784         (dll_list::reserve_space): Declare new function.
1785         (dll_list::load_after_fork): Declare new function.
1786         * fork.cc (frok::child): call dll_list::reserve_space early, so we can
1787         retry if it fails.
1788
1789 2011-05-30  Tor Perkins  <cygwin@noid.net>
1790
1791         * fhandler_termios.cc (fhandler_termios::bg_check): Do not return EIO
1792         when a process group has no leader as this is allowed and does not
1793         imply an orphaned process group.  Add a test for orphaned process
1794         groups.
1795         (tty_min::is_orphaned_process_group): Define new function.
1796         * tty.h (tty_min::is_orphaned_process_group): Define new function.
1797
1798 2011-05-30  Ryan Johnson  <ryan.johnson@cs.utoronto.ca>
1799
1800         * dll_init.cc (dll_list::find_by_modname): New function to search the
1801         dll list for a module name only (no path).
1802         (dll_list::alloc): Initialize newly-added members of struct dll.
1803         (dll_list::append): New function to factor out the append operation
1804         (used by dll_list::topsort).
1805         (dll_list::populate_deps): New function to identify dll dependencies.
1806         (dll_list::topsort): New function to sort the dll list topologically by
1807         dependencies.
1808         (dll_list::topsort_visit): New helper function for the above.
1809         * dll_init.h (dll::ndeps): New class member.
1810         (dll::deps): Ditto.
1811         (dll::modname): Ditto.
1812         (dll_list::find_by_modname): New function related to topsort.
1813         (dll_list::populate_all_deps): Ditto.
1814         (dll_list::populate_deps): Ditto.
1815         (dll_list::topsort): Ditto.
1816         (dll_list::topsort_visit): Ditto.
1817         (dll_list::append): Ditto.
1818         (pefile): New struct allowing simple introspection of dll images.
1819         * fork.cc (fork): Topologically sort the dll list before forking
1820
1821 2011-05-30  Christopher Faylor  <me.cygwin2011@cgf.cx>
1822
1823         * child_info.h (CURR_CHILD_INFO_MAGIC): Refresh.
1824         (child_info::refresh_cygheap): New function.
1825         * spawn.cc (spawn_guts): Call refresh_cygheap before creating a new
1826         process to ensure that cygheap_max is up-to-date.
1827         * fork.cc (frok::parent): Ditto.
1828
1829 2011-05-30  Christopher Faylor  <me.cygwin2011@cgf.cx>
1830
1831         * cygheap.cc (cygheap_dummy): Rename from cygheap_at_start.
1832         (cygheap): Accommodate name change to cygheap_dummy.
1833         (cygheap_init): Ditto.
1834         (cygheap_fixup_in_child): Simplify slightly.
1835         * fork.cc (fork): Add an advisory comment.
1836
1837 2011-05-29  Christopher Faylor  <me.cygwin2011@cgf.cx>
1838
1839         * fhandler.cc (fhandler_overlapped::wait_overlapped): Make sure that
1840         I/O is cancelled on signal.
1841
1842 2011-05-28  Ryan Johnson  <ryan.johnson@cs.utoronto.ca>
1843
1844         * dll_init.cc (dll_list::alloc): Initialize dll::image_size.
1845         (reserve_at): Don't reserve space needed by the target dll if the
1846         latter overlaps the free region to be blocked.
1847         (dll_list::load_after_fork): Use new version of reserve_at.
1848         * dll_init.h (dll::image_size): New member.
1849         (pefile): New struct.
1850
1851 2011-05-28  Christopher Faylor  <me.cygwin2011@cgf.cx>
1852             Ryan Johnson  <ryan.johnson@cs.utoronto.ca>
1853
1854         * dll_init.c (dll_list::load_after_fork): Don't clear in_forkee here.
1855         * fork.cc (frok::errmsg): Rename from 'error'.
1856         (frok::error): New function.  Handle conditional printing of error
1857         messages.
1858         (frok::parent): Record hchild handle for use by error function.  Use
1859         throughout.  Use error function rather than setting error pointer
1860         directly.
1861         (fork): Clear is_forkee here.  Accommodate rename of 'error' to
1862         'errmsg'.
1863         * sigproc.cc (child_info::proc_retry): Detect EXITCODE_FORK_FAILED.
1864
1865 2011-05-28  Christopher Faylor  <me.cygwin2011@cgf.cx>
1866
1867         * fhandler.cc (handler_base_overlapped::wait_overlapped): Rework to
1868         attempt to properly set errno and bytes read for non-blocking case.
1869         Change to just rely on res to indicate error conditions.
1870
1871 2011-05-28  Christopher Faylor  <me.cygwin2011@cgf.cx>
1872
1873         * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Don't set
1874         io_pending unless ReadFile has returned an error.  (this is a partial fix,
1875         accidentally checked in)
1876
1877 2011-05-28  Christopher Faylor  <me.cygwin2011@cgf.cx>
1878
1879         * autoload.cc: Call _api_fatal in asm.
1880         * child_info.h: Redefine CURR_CHILD_INFO_MAGIC.
1881         (child_info_fork::abort): Rename from handle_failure.  Change
1882         arguments.
1883         * cygtls.h (_local_storage::ttybuf): New field.
1884         * dcrt0.cc (vapi_fatal): Split api_fatal.  Add "in forked process" to
1885         message when appropriate.
1886         (api_fatal): Use vapi_fatal.
1887         * devices.h: Make multiple inclusion safe.
1888         (fh_devices): Add FH_CONS* stuff.  Reorder slightly.
1889         (device): Eliminate anonymous union.  Add more ways to access
1890         minor/major.
1891         (device::setunit): Accommodate no-longer-anonymous union.
1892         (device::is_fs): Ditto.
1893         (device::is_fs_special): Ditto.
1894         (device::major): New function.
1895         (device::minor): Ditto.
1896         (device::is_device): New function.
1897         (device::not_device): Ditto.
1898         (device::operator int): New operator.
1899         (device::operator fh_devices): Ditto.
1900         (device::operator bool): Ditto.
1901         (device::operator DWORD): Ditto.
1902         (device::operator =): Ditto.
1903         (isproc_dev): New function.
1904         (isprocsys_dev): Ditto.
1905         (iscons_dev): Ditto.
1906         (istty_slave_dev): Ditto.
1907         * devices.in: Add new "/dev/cons*" strings.  Accommodate
1908         no-longer-anonymous union throughout.
1909         (BRACK): Use more precise method for initialization.
1910         * devices.cc: Regenerate.
1911         * dtable.cc (dtable::stdio_init): Use get_cttyp instead of get_tty.
1912         (dtable::find_archetype): Use new DWORD operator in device to test
1913         archetypes.
1914         (dtable::init_std_file_from_handle): Use different method to initialize
1915         'dev'.  Adapt to different ctty handling and accommodate /dev/cons*.
1916         (fh_alloc): Accommodate no-longer-anonymous union.  Adapt to new
1917         /dev/cons*.
1918         (build_fh_pc): Make debugging output more useful.
1919         * exceptions.cc (ctrl_c_handler): Use get_cttyp instead of get_tty.
1920         * external.cc (fillout_pinfo): Accommodate new cons* stuff.
1921         * fhandler.cc (fhandler_base::read): Eliminate is_slow() test.
1922         * fhandler.h (fhandler_base::*): Adapt to changes in device.h.
1923         (fhandler_*::is_slow): Delete.
1924         ( fhandler_proc::get_proc_fhandler): Return fh_devices type.
1925         * fhandler_console.cc (open_shared_console): New function.
1926         (console_unit): New class.
1927         (console_unit::console_unit): New constructor.
1928         (enum_windows): New function.  Declare as friend to console_unit.
1929         (fhandler_console::set_unit): New function.
1930         (fhandler_console::get_tty_stuff): Call set_unit to set the unit number
1931         and determine if initialization is needed.  Eliminate flags parameter.
1932         (tty_list::get_cttyp): Rename (sorta) from get_tty.  Return pointer to
1933         correct tty_min.
1934         (fhandler_console::open): Adapt to elimination of argument to
1935         get_tty_stuff.
1936         (fhandler_console::output_tcsetattr): Properly detect error condition.
1937         (fhandler_console::fixup_after_fork_exec): Adapt to get_tty_stuff()
1938         setting tc automatically.
1939         * fhandler_proc.cc: Use FH_BAD rather than 0 throughout where using
1940         fh_devices enum.
1941         (fhandler_proc::get_proc_fhandler): Return fh_devices.  Adapt to
1942         devices.h changes.
1943         * fhandler_process.cc: Adapt to devices.h changes.  Use FH_BAD rather
1944         than 0 throughout where using fh_devices enum.
1945         * fhandler_procnet.cc: Ditto.
1946         * fhandler_procsys.cc: Ditto.
1947         * fhandler_procsysvipc.cc: Ditto.
1948         * fhandler_tape.cc (fhandler_dev_tape::fhandler_dev_tape): Ditto.
1949         * fhandler_termios.cc (handler_termios::bg_check): Use tc->ttyname()
1950         rather than assuming that we can construct a tty.
1951         * fhandler_tty.cc (fhandler_tty_master::fhandler_tty_master): Just
1952         return get_minor() of dev.
1953         (fhandler_pty_master::process_slave_output): Add slightly more
1954         debugging info.
1955         (fhandler_tty_slave::fhandler_tty_slave): Change name from ntty to
1956         unit.
1957         (fhandler_pty_master::open): Ditto.
1958         (fhandler_tty_slave::ioctl): Adapt to change which causes ctty to
1959         represent a complete device.
1960         (fhandler_tty_master::init_console): Add debugging for failure path.
1961         (fhandler_pty_master::setup): Use get_unit() to retrieve unit number
1962         rather than relying on raw ntty.
1963         (fhandler_pty_master::setup): Ditto.
1964         * fhandler_virtual.h (virt_tab_t): Redefine fhandler as fh_devices.
1965         * fork.cc: Remove obsolete vfork stuff.
1966         (frok::child): Don't assume that a ctty == 0 is valid.
1967         * mount.cc (mount_info::conv_to_win32_path): Adapt to device struct
1968         changes.
1969         (mount_info::conv_to_win32_path): Ditto.
1970         * path.cc (path_conv::check): Retrive major/minor numbers via a method
1971         rather than accessing them directly from device.  Rely on dev operators
1972         to set/retrieve device information as required by device struct change.
1973         * path.h (isproc_dev): Move to devices.h.
1974         (isprocsys_dev): Ditto.
1975         (isvirtual_dev): Ditto.
1976         (path_conv:{isdevice,isfifo,isspecial,iscygdrive,issocket,get_devn,get_unitn}):
1977         Use device methods to access/manipulate devices.
1978         * pinfo.cc (pinfo::exit): Don't assume that ctty == 0 is valid.  Use
1979         iscons_dev to determine if a device is a console.
1980         (_pinfo::_ctty): Use device::parse to generate tty/cons name.
1981         (_pinfo::set_ctty): Don't assume that ctty == 0 is valid.  Remove
1982         redundant info from debugging.
1983         * shared.cc (offsets): Remove console offset.
1984         * shared_info.h (shared_locations): Ditto.
1985         * syscalls.cc (umask): Use device methods to manipulate device
1986         information.
1987         (ctermid): Use device::parse to generate term device name.
1988         * tlsoffsets.h: Regenerate.
1989         * tty.cc (ttyslot): Return minor number of ctty since ctty now
1990         represents a full device.
1991         (tty::create_master): Set ctty to a complete device.
1992         (tty_list::attach): Rework to detect new /dev/cons* stuff.
1993         (tty_list::terminate): Adapt to changes to ctty.
1994         (tty_list::init): Adapt to change to setntty - pass in device major
1995         number.
1996         (tty::exists): Use get_unit() to retrive tty unit number.
1997         (tty::open_mutex): Ditto.
1998         (tty::open_inuse): Ditto.
1999         (tty::create_inuse): Ditto.
2000         (tty::get_event): Ditto.
2001         (tty_min::ttyname): Define new function.
2002         * tty.h (tty_min::ntty): Redefine as fh_devices.
2003         (tty::exists): Use get_unit() to retrive tty unit number.
2004         (tty::open_mutex): Ditto.
2005         (tty::open_inuse): Ditto.
2006         (tty::create_inuse): Ditto.
2007         (tty::get_event): Ditto.
2008         (tty_min::ttyname): Declare new function.
2009         (tty::getntty): Declare as const.
2010         (tty_list::operator []): Assure that only minor part of argument is
2011         used.
2012
2013         * dll_init.cc (dll_list::alloc): Detect mismatch of data segments early
2014         issuing an explicit error message if necessary.
2015         * heap.cc (heap_init): Adapt to changes from fork->handle_failure to
2016         fork->abort.
2017         * pinfo.h (EXITCODE_FORK_FAILED): New enum.  (from Ryan Johnson)
2018         * sigproc.cc (child_info_fork::abort): Rename from handle_failure.
2019         Change arguments to allow passing in a printf-like message.
2020         * winsup.h (api_fatal): Delete macro definition.
2021         (api_fatal): Redefine from __api_fatal.
2022         (vapi_fatal): Declare new function.
2023         * include/sys/strace.h (strace_vprintf): Define new macro.
2024
2025         * ntdll.h (_SYSTEM_INFORMATION_CLASS): Add SystemHandleInformation.
2026
2027 2011-05-27  Corinna Vinschen  <corinna@vinschen.de>
2028
2029         * shared.cc (offsets): Reorder so that console_state is lowest in
2030         memory.  Explain why.
2031         (open_shared): Accommodate reordering of offsets array.
2032         * shared_info.h (shared_locations): Reorder SH_SHARED_CONSOLE after
2033         SH_MYSELF.
2034
2035 2011-05-26  Corinna Vinschen  <corinna@vinschen.de>
2036
2037         * mount.h (MAX_MOUNTS): Raise to 64.
2038
2039 2011-05-25  Eric Blake  <eblake@redhat.com>
2040
2041         * cygtls.h (strerror_r_buf): New buffer.
2042         * errno.cc (strerror): Move guts...
2043         (_strerror_r): ...to new function demanded by newlib.
2044         (strerror_r): Don't clobber strerror buffer.
2045         (_user_strerror): Drop unused declaration.
2046         * tlsoffsets.h: Regenerate.
2047
2048 2011-05-25  Corinna Vinschen  <corinna@vinschen.de>
2049
2050         * init.cc (dll_entry): Reinstantiate wow64_test_stack_marker and
2051         previous stack tests.
2052
2053 2011-05-25  Corinna Vinschen  <corinna@vinschen.de>
2054
2055         * posix.sgml (std-notes): Add missing <para>.
2056
2057 2011-05-24  Corinna Vinschen  <corinna@vinschen.de>
2058
2059         * mount.cc (mount_info::conv_to_win32_path): Remove unused code.
2060         * mount.h (class mount_info): Remove sys_mount_table_counter member.
2061         * shared_info.h (class shared_info): Ditto.
2062         (CURR_SHARED_MAGIC): Update.
2063
2064 2011-05-24  Corinna Vinschen  <corinna@vinschen.de>
2065
2066         * pinfo.h (struct _pinfo): Reduce size of progname array slightly.
2067         Explain why.
2068
2069 2011-05-23  Eric Blake  <eblake@redhat.com>
2070
2071         * errno.cc (strerror): Print unknown errno as int.
2072         (__xpg_strerror_r): Likewise, and don't clobber strerror buffer.
2073         * cygtls.h (strerror_buf): Resize to allow '-'.
2074
2075 2011-05-23  Corinna Vinschen  <corinna@vinschen.de>
2076
2077         * fhandler_process.cc (thread_info::fill_if_match): Reformat.
2078         (format_process_maps): Ditto.  Fetch pointer to procinfo structure
2079         from mapped process.  Print info about global shared Cygwin regions.
2080
2081 2011-05-21  Corinna Vinschen  <corinna@vinschen.de>
2082
2083         * fhandler_process.cc (struct dos_drive_mappings): Use malloc/free
2084         rather than cmalloc/cfree.  Check return value from malloc before
2085         using it.
2086         (struct heap_info): Ditto.
2087         (struct thread_info): Ditto.  Rename from stack_info.  Rename members
2088         and local variables accordingly.
2089         (thread_info::thread_info): Store stack and TEB addresses.
2090         (thread_info::fill_if_match): Print "teb" if a TEB address has been
2091         found.  Special case for WOW64, explain why.
2092         (format_process_maps): Fetch PEB address.  Print MEM_RESERVE regions
2093         with equal signs to distinguish them from PAGE_NOACCESS regions.  Fix
2094         printing of 'p' and 's' to differ between MEM_PRIVATE and MEM_MAPPED
2095         pages, as on Linux.  Print 'g' instead of 'p for PAGE_GUARD pages.
2096         Print PEB and SharedUserData area if recognized.
2097
2098 2011-05-20  Corinna Vinschen  <corinna@vinschen.de>
2099
2100         * miscfuncs.cc (CygwinCreateThread): Fix condition for adding the
2101         guardsize to the stacksize.  Fix accompanying comment.
2102
2103 2011-05-20  Corinna Vinschen  <corinna@vinschen.de>
2104
2105         * miscfuncs.cc (CygwinCreateThread): Add accidentally missing comment.
2106
2107 2011-05-20  Corinna Vinschen  <corinna@vinschen.de>
2108
2109         * fhandler_process.cc (struct heap_info): Change type of base and end
2110         members to char *.  Print "shared" rather than "share".
2111         (struct stack_info): New class to fetch process stack information.
2112         (format_process_maps): Initialize and check for stack information.
2113
2114 2011-05-20  Corinna Vinschen  <corinna@vinschen.de>
2115
2116         * miscfuncs.cc (thread_wrapper): Remove statements added for debugging
2117         purposes.
2118
2119 2011-05-20  Corinna Vinschen  <corinna@vinschen.de>
2120
2121         * child_info.h (CURR_CHILD_INFO_MAGIC): Update.
2122         (class child_info_fork): Remove stacksize, add stackaddr and guardsize
2123         members.
2124         * dcrt0.cc (child_info_fork::alloc_stack_hard_way): Partial rewrite
2125         to regenerate the stack exactly as in the parent.
2126         (child_info_fork::alloc_stack): Set stackaddr to 0, rather than
2127         stacksize.
2128         (dll_crt0_1): Check for stackaddr before changing the stack addresses
2129         in the TEB.
2130         * fork.cc (frok::child): Check for stackaddr here.
2131         (frok::parent): Set ch.stackaddr and ch.guardsize if not called from
2132         the main thread.
2133         * init.cc (dll_entry): Replace pointer to NT_TIB with pointer to TEB.
2134         Fix incorrectly changed address test before removing _my_tls.
2135         Set StackLimit to NULL on Windows 2000.  Explain why.
2136         * miscfuncs.cc (struct thread_wrapper_arg): Store stackbase rather
2137         than stacksize, store commitaddr, remove guardsize.  Store all pointers
2138         as char * for easier address arithmetic.
2139         (thread_wrapper): Rewrite to remove OS stack before calling thread
2140         function.  Add lots of comments to explain what we do.
2141         (CygwinCreateThread): Reserve our own stack in case we got no
2142         application stack.  Add comments.
2143         * ntdll.h (struct _TEB): Extend defintion up to DeallocationStack
2144         member.
2145         * thread.cc (pthread_attr::pthread_attr): Use "(size_t) -1"
2146         rather then 0xffffffff.
2147         * wincap.h (wincaps::has_stack_size_param_is_a_reservation): New
2148         element.
2149         * wincap.cc: Implement above element throughout.
2150
2151 2011-05-19  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
2152
2153         * thread.cc: Mark psiginfo and psignal as available in list of
2154         optional cancellation points.
2155
2156 2011-05-19  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
2157
2158         * cygwin.din (__fpurge): Export.
2159         * posix.sgml (std-solaris): Add __fpurge.
2160         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2161
2162 2011-05-18  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
2163
2164         * posix.sgml (std-susv4): Remove chroot, futimes, hstrerror.
2165         (std-deprec): Add chroot.
2166         (std-bsd): Add futimes, hstrerror.
2167         (std-notimpl): Add clock_nanosleep, nexttoward, nexttowardf.
2168         Remove initstate, which is implemented and listed in std-susv4.
2169
2170 2011-05-17  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
2171
2172         * cygwin.din (error): Export.
2173         (error_at_line): Export.
2174         (error_message_count): Export.
2175         (error_one_per_line): Export.
2176         (error_print_progname): Export.
2177         * errno.cc (error_message_count): Define.
2178         (error_one_per_line): Define.
2179         (error_print_progname): Define.
2180         (_verror): New static function.
2181         (error): New function.
2182         (error_at_line): New function.
2183         * posix.sgml (std-gnu): Add error, error_at_line.
2184         * include/error.h: New header.
2185         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2186
2187 2011-05-17  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
2188
2189         * cygwin.din (clock_getcpuclockid): Export.
2190         (pthread_getcpuclockid): Export.
2191         * hires.h (PID_TO_CLOCKID): New macro.
2192         (CLOCKID_TO_PID): New macro.
2193         (CLOCKID_IS_PROCESS): New macro.
2194         (THREADID_TO_CLOCKID): New macro.
2195         (CLOCKID_TO_THREADID): New macro.
2196         (CLOCKID_IS_THREAD): New macro.
2197         * ntdll.h (enum _THREAD_INFORMATION_CLASS): Add ThreadTimes.
2198         * posix.sgml (std-notimpl): Add clock_getcpuclockid and
2199         pthread_getcpuclockid from here...
2200         (std-susv4): ... to here.
2201         (std-notes): Remove limitations of clock_getres and clock_gettime.
2202         Note limitation of timer_create to CLOCK_REALTIME.
2203         * sysconf.cc (sca): Set _SC_CPUTIME to _POSIX_CPUTIME, and
2204         _SC_THREAD_CPUTIME to _POSIX_THREAD_CPUTIME.
2205         * thread.cc (pthread_getcpuclockid): New function.
2206         * timer.cc (timer_create): Set errno to ENOTSUP for CPU-time clocks.
2207         * times.cc (clock_gettime): Handle CLOCK_PROCESS_CPUTIME_ID and
2208         CLOCK_THREAD_CPUTIME_ID.
2209         (clock_getres): Ditto.
2210         (clock_settime): Set errno to EPERM for CPU-time clocks.
2211         (clock_getcpuclockid): New function.
2212         * include/pthread.h (pthread_getcpuclockid): Declare.
2213         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2214
2215 2011-05-17  Corinna Vinschen  <corinna@vinschen.de>
2216
2217         * miscfuncs.cc (thread_wrapper): Remove unused _cygtls record.
2218         * mmap.cc (is_mmapped_region): Avoid crash if no mmaps exist.
2219
2220 2011-05-16  Corinna Vinschen  <corinna@vinschen.de>
2221
2222         * globals.cc (__getlogin_username): Remove.
2223         * uinfo.cc (getlogin_r): Fetch username from cygheap.
2224         (getlogin): Add static buffer username and fetch username from
2225         getlogin_r.
2226
2227 2011-05-16  Corinna Vinschen  <corinna@vinschen.de>
2228
2229         * cygtls.h (struct _local_storage): Remove unused members rarg and
2230         _localtime_buf.  Remove username in favor of a global buffer.  Reorder
2231         slightly to keep the net.cc stuff together.
2232         * globals.cc (__getlogin_username): New global char buffer.
2233         * tlsoffsets.h: Regenerate.
2234         * uinfo.cc (getlogin): Copy username into __getlogin_username.
2235
2236 2011-05-16  Corinna Vinschen  <corinna@vinschen.de>
2237
2238         * heap.cc (heap_init): Rewrite initial heap allocation to use addresses
2239         beyond 0x20000000.  Explain why and how.
2240         * shared.cc (shared_info::heap_slop_size): Remove.
2241         * shared_info.h (class shared_info): Remove heap_slop_inited and
2242         heap_slop members.  Remove heap_slop_size declaration.
2243         (CURR_SHARED_MAGIC): Update.
2244         * wincap.cc: Throughout, drop heapslop.
2245         * wincap.h (struct wincaps): Drop heapslop.
2246
2247 2011-05-16  Corinna Vinschen  <corinna@vinschen.de>
2248
2249         * dcrt0.cc (child_info_fork::alloc_stack_hard_way): Check if the
2250         requested stack is application-provided within the user heap or an
2251         mmapped region.  If so, just use it.  Add comment to explain why.
2252         * miscfuncs.cc (thread_wrapper): If an application-provided stack
2253         has been given, implement cygtls area at the stackbase.  Fix comment.
2254         * mmap.cc (is_mmapped_region): New function.
2255         * winsup.h (is_mmapped_region): Declare.
2256
2257 2011-05-15  Corinna Vinschen  <corinna@vinschen.de>
2258
2259         * miscfuncs.cc (thread_wrapper): Add comments to assembler code.
2260
2261 2011-05-15  Corinna Vinschen  <corinna@vinschen.de>
2262
2263         * cygwin.din (pthread_attr_getguardsize): Export.
2264         (pthread_attr_setguardsize): Export.
2265         (pthread_attr_setstack): Export.
2266         (pthread_attr_setstackaddr): Export.
2267         * init.cc (dll_entry): Remove wow64_test_stack_marker.  Check for
2268         unusual stack address by testing stack addresses from current TEB.
2269         Check validity of _my_tls by testing if it's within the stack as
2270         given in current TEB.
2271         * miscfuncs.cc (struct thread_wrapper_arg): New structure used to
2272         push all required information to thread_wrapper function.
2273         (thread_wrapper): Wrapper function for actual thread function.
2274         If an application stack has been given, change %ebp and %esp so that
2275         the thread function runs on that stack.  If the thread has been created
2276         by CygwinCreateThread, set up the POSIX guard pages if necessary.
2277         (CygwinCreateThread): New function.
2278         * miscfuncs.h (CygwinCreateThread): Declare.
2279         * ntdll.h (struct _TEB): Define all members up to Peb.
2280         * posix.sgml (std-susv4): Move pthread_attr_getguardsize,
2281         pthread_attr_setguardsize and pthread_attr_setstack here.
2282         (std-deprec): Add pthread_attr_setstackaddr.
2283         * sysconf.cc (sca): Set _SC_THREAD_ATTR_STACKADDR to
2284         _POSIX_THREAD_ATTR_STACKADDR.
2285         * thread.cc (pthread::precreate): Copy pthread_attr stackaddr and
2286         guardsize members.
2287         (pthread::create): Call CygwinCreateThread.
2288         (pthread_attr::pthread_attr): Initialize guardsize.
2289         (pthread_attr_setstack): New function.
2290         (pthread_attr_setstackaddr): New function.
2291         (pthread_attr_setguardsize): New function.
2292         (pthread_attr_getguardsize): New function.
2293         (pthread_getattr_np): Copy attr.guardsize.
2294         * thread.h (pthread_attr): Add member guardsize.
2295         * include/pthread.h (pthread_attr_getguardsize): Declare.
2296         (pthread_attr_setguardsize): Declare.
2297         * include/cygwin/version.h: Bump API minor number.
2298
2299 2011-05-13  Corinna Vinschen  <corinna@vinschen.de>
2300
2301         * fhandler_process.cc (struct heap_info::heap): Convert base to
2302         uintptr_t.  Add heap_id, end, flags members.
2303         (heap_info::heap_vm_chunks): Rename from heaps.
2304         (heap_info::heap_info): Rearrange using RtlQueryProcessDebugInformation
2305         to get information of heap virtual memory blocks.  Store heap id and
2306         flags, as well as end address of each block.
2307         (heap_info::fill_if_match): Check incoming base address against full
2308         address range of heap chunks.  Convert flag values in extra heap
2309         information.
2310         (format_process_maps): Change order so that heap check is done before
2311         MEM_MAPPED check since there are shareable heaps.
2312         * ntdll.h (PDI_HEAP_BLOCKS): Define.
2313         (HEAP_FLAG_NOSERIALIZE): Define.
2314         (HEAP_FLAG_GROWABLE): Define.
2315         (HEAP_FLAG_EXCEPTIONS): Define.
2316         (HEAP_FLAG_NONDEFAULT): Define.
2317         (HEAP_FLAG_SHAREABLE): Define.
2318         (HEAP_FLAG_EXECUTABLE): Define.
2319         (HEAP_FLAG_DEBUGGED): Define.
2320         (struct _DEBUG_HEAP_ARRAY): Define.
2321         (struct _DEBUG_HEAP_BLOCK): Define.
2322
2323 2011-05-12  Corinna Vinschen  <corinna@vinschen.de>
2324
2325         Based on newlib patch to strptime by Peter Rosin <peda@lysator.liu.se>:
2326         * libc/time/strptime.c (is_leap_year): New static function.
2327         (first_day): Ditto.
2328         (__strptime): Fill in tm_yday when all of tm_year, tm_mon and tm_mday
2329         are updated. Fill in tm_mon, tm_mday and tm_wday when both of tm_year
2330         and tm_yday are updated.
2331
2332 2011-05-12  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
2333
2334         * fhandler_proc.cc (format_proc_meminfo): Rewrite to use sysinfo().
2335         Support RAM and swap space larger than 4GB.
2336         Remove output elements not found with modern Linux kernels.
2337         (format_proc_swaps): Support paging files larger than 4GB.
2338
2339 2011-05-11  Corinna Vinschen  <corinna@vinschen.de>
2340
2341         * autoload.cc: Remove useless comment.
2342
2343 2011-05-11  Corinna Vinschen  <corinna@vinschen.de>
2344
2345         * autoload.cc (EnumProcessModules): Remove.
2346         * dlfcn.cc (dlopen): Make sure errno is set if an error occurs.
2347         (dlsym): Rewrite using RtlQueryProcessDebugInformation instead of
2348         EnumProcessModules.
2349         * ntdll.h (struct _DEBUG_MODULE_ARRAY): Define.
2350         (RtlCreateQueryDebugBuffer): Declare.
2351         (RtlDestroyQueryDebugBuffer): Declare.
2352         (RtlQueryProcessDebugInformation): Declare.
2353
2354 2011-05-11  Corinna Vinschen  <corinna@vinschen.de>
2355
2356         * autoload.cc (GetModuleFileNameExW): Remove.
2357         * autoload.cc (GetModuleInformation): Remove.
2358
2359 2011-05-11  Corinna Vinschen  <corinna@vinschen.de>
2360
2361         * autoload.cc (QueryWorkingSet): Remove.
2362
2363 2011-05-11  Ryan Johnson  <ryan.johnson@cs.utoronto.ca>
2364
2365         * fhandler_process.cc (format_process_maps): Rework to report
2366         all mapped address space in a process (committed or reserved),
2367         identifying the nature of the mapping (mapped file/image, heap,
2368         shared memory) when possible.
2369         (dos_drive_mappings): New helper classes.
2370         (heap_info): Ditto.
2371         * ntdll.h (struct _MEMORY_SECTION_NAME): Define.
2372
2373 2011-05-11  Corinna Vinschen  <corinna@vinschen.de>
2374
2375         * autoload.cc (GetProcessMemoryInfo): Remove.
2376         * resource.cc (fill_rusage): Call NtQueryInformationProcess rather than
2377         GetProcessMemoryInfo to drop a psapi dependency.
2378
2379 2011-05-11  Corinna Vinschen  <corinna@vinschen.de>
2380
2381         * fhandler_socket.cc (get_inet_addr): Rearrange for better readability.
2382         Make waiting loop interruptible and cancelable.  Check for SYSTEM DOS
2383         flag before reading the file.  Change return value to return 0 on
2384         success, SOCKET_ERROR on failure.
2385         (fhandler_socket::bind): Only set R/O DOS flag on filesystems not
2386         supporting ACLs.
2387         (fhandler_socket::connect): Accommodate changed return values from
2388         get_inet_addr.  Use SOCKET_ERROR instead of -1.
2389         (fhandler_socket::sendto): Accommodate changed return values from
2390         get_inet_addr.
2391         * syslog.cc (connect_syslogd): Ditto.
2392
2393 2011-05-10  Christian Franke  <franke@computer.org>
2394
2395         * security.cc (check_registry_access): Handle missing
2396         security descriptor of HKEY_PERFORMANCE_DATA.
2397
2398 2011-05-10  Corinna Vinschen  <corinna@vinschen.de>
2399
2400         * lc_msg.h: Regenerate.
2401
2402 2011-05-10  Corinna Vinschen  <corinna@vinschen.de>
2403
2404         * fhandler_proc.cc (format_proc_uptime): Don't call GetSystemInfo.
2405         Fetch CPU count from wincap.
2406         (format_proc_stat): Ditto.
2407         * globals.cc (system_info): Move to wincap.
2408         * heap.cc (heap_init): Fetch page size from wincap.
2409         * syscalls.cc (getpagesize): Fetch allocation granularity from wincap.
2410         (getsystempagesize): Fetch page size from wincap.
2411         * wincap.cc (wincap_2003): Default is_server to false.
2412         (wincapc::init): Call GetSystemInfo here.  Always set is_server value.
2413         * wincap.h (class wincapc): Add system_info as private member.
2414         (wincapc::cpu_count): New public method.
2415         (wincapc::page_size): Ditto.
2416         (wincapc::allocation_granularity): Ditto.
2417
2418 2011-05-10  Corinna Vinschen  <corinna@vinschen.de>
2419
2420         * environ.cc (set_chunksize): Remove.
2421         (parse_thing): Remove forkchunk entry.
2422         * fork.cc (child_copy): Drop handling external chunksize setting.
2423         * wincap.cc: Througout, drop chunksize.
2424         (wincapc::set_chunksize): Remove.
2425         * wincap.h (struct wincaps): Drop chunksize and declaration of
2426         set_chunksize.
2427
2428 2011-05-08  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
2429
2430         * times.cc (settimeofday): Add EFAULT handler.
2431         Set errno to EINVAL if tv.tv_nsec is invalid, and to EPERM if
2432         SetSystemTime fails.  Return -1 in case of failure, all for
2433         compatibility with BSD and Linux.
2434         (clock_settime): New function.
2435         * cygwin.din (clock_settime): Export.
2436         * posix.sgml (std-susv4): Add clock_settime.
2437         Move clock_setres from here...
2438         (std-deprec): ... to here.
2439         (std-notes): Correct limitation of clock_setres to only CLOCK_REALTIME.
2440         Add limitation of clock_settime to only CLOCK_REALTIME.
2441         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2442
2443 2011-05-07  Corinna Vinschen  <corinna@vinschen.de>
2444
2445         * registry.cc (get_registry_hive_path): Change system_printf to
2446         debug_printf.
2447         (load_registry_hive): Ditto.
2448
2449 2011-05-06  Christopher Faylor  <me.cygwin2011@cgf.cx>
2450
2451         * fhandler.h (fhandler_base::close_with_arch): Make non-virtual.
2452         (fhandler_base::open_fs): Move closer to it's close counterpart.
2453
2454 2011-05-06  Christopher Faylor  <me.cygwin2011@cgf.cx>
2455
2456         * fhandler.cc (fhandler_base::dup): Avoid duping a handle when an
2457         fhandler has an archetype.
2458         * fhandler_console.cc (fhandler_console::invisible_console): Move to
2459         the top.
2460         (fhandler_console::set_close_on_exec): Don't set close-on-exec on
2461         handle since it's an archetype and you don't know how many things could
2462         be using it.
2463
2464 2011-05-06  Christopher Faylor  <me.cygwin2011@cgf.cx>
2465
2466         * fhandler.h (fhandler_dev_dsp): Cosmetic change.
2467
2468         * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Put back
2469         Sleep(10) for tty_master case.
2470
2471         * sigproc.cc (stopped_or_terminated): Don't consider a pid which has
2472         been reaped to be terminated.
2473
2474 2011-05-06  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
2475
2476         * sysconf.cc (sysinfo): New function.
2477         * cygwin.din (sysinfo): Export.
2478         * posix.sgml (std-gnu): Add sysinfo.
2479         * include/sys/sysinfo.h (struct sysinfo): Define.
2480         (sysinfo): Declare.
2481         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2482
2483 2011-05-06  Corinna Vinschen  <corinna@vinschen.de>
2484
2485         * libc/minires-os-if.c (get_dns_info): Drop printing uninitialized
2486         value of dwRetVal in debug output.
2487
2488 2011-05-06  Corinna Vinschen  <corinna@vinschen.de>
2489
2490         * fhandler.h (fhandler_socket::read): Declare.
2491         (fhandler_socket::write): Declare.
2492         * fhandler_procsys.cc (fhandler_procsys::read): Add FIXME comment.
2493         (fhandler_procsys::write): Ditto.
2494         * fhandler_socket.cc (fhandler_socket::read): New method.
2495         (fhandler_socket::write): New method.
2496         * syscalls.cc: Rearrange order of read/write functions.
2497         (read): Call fhandler read method directly instead of just readv.
2498         (readv): Remove EINTR loop.  This is done in all affected fhandler's
2499         now.
2500         (write): Call fhandler write method directly instead of just writev.
2501         Fix debug output.
2502
2503 2011-05-05  Christopher Faylor  <me.cygwin2011@cgf.cx>
2504
2505         * cygheap.cc (cygheap::close_ctty): Close ctty via close_with_arch().
2506         * debug.cc (close_handle): Call debugger on failure.
2507         * devices.in (device::tty_to_real_device): Delete.
2508         * devices.h (device::tty_to_real_device): Ditto.
2509         * devices.cc: Regenerate.
2510         * dtable.cc: Delete old ifdef'ed vfork code.
2511         (dtable::release): Don't handle archetype here.
2512         (dtable::init_std_file_from_handle): Consolidate console tests.
2513         Generate major/minor for tty ASAP.  Fix incorrect setting of DEV_TTYS*
2514         for serial.
2515         (fh_alloc): New function derived from build_fh_pc.  Pass current tty
2516         when building tty.
2517         (build_pc_pc): Use fh_alloc to create.  Set name from fh->dev if
2518         appropriate.  Generate an archetype or point to one here.
2519         (dtable::dup_worker): Deal with archetypes.  Rely on = operator copying
2520         whole class rather than just fhandler_base.
2521         (dtable::fixup_after_exec): Call close_with_arch to handle closing of
2522         fhandlers with archetypes.
2523         * fhandler.cc (fhandler_base::operator =): Call memcpy with fhandler's
2524         size() rather than sizeof fhandler_base.
2525         (fhandler_base::open_with_arch): New function.  Handles opening of
2526         fhandler's with archetypes, dealing with usecounts, etc.
2527         (fhandler_base::close_with_arch): Ditto for close.
2528         * fhandler.h: Many changes for archetypes.
2529         (fhandler_base::set_name): Set both normalized path and regular path.
2530         (fhandler_base::open_with_arch): New function.
2531         (fhandler_base::open_setup): Ditto.
2532         (fhandler_base::use_archetype): Ditto.
2533         (fhandler_base::_archetype_usecount): Ditto.
2534         (fhandler_*::size): Ditto.
2535         (fhandler_dev_tape::open): Remove virtual decoration.
2536         (fhandler_console::use_archetype): New function.  Return true.
2537         (fhandler_console::open_setup): New function.
2538         (fhandler_console::dup): Delete.
2539         (fhandler_tty_slave::fhandler_tty_slave): Redeclare to take an
2540         argument.
2541         (fhandler_tty_slave::use_archetype): New function.  Return true.
2542         (fhandler_tty_slave::cleanup): New function.
2543         (fhandler_pty_master::use_archetype): New function.  Return true.
2544         (fhandler_pty_master::cleanup): New function.
2545         (fhandler_pty_master::is_tty_master): New function.  Return false.
2546         (fhandler_tty_master::is_tty_master): New function.  Return true.
2547         (fhandler_dev_dsp::fhandler_dev_dsp): New function.  Return true.
2548         (report_tty_counts): Only report on archetype's usecount if there is
2549         one.
2550         * fhandler_console.cc (fhandler_console::get_tty_stuff): Remove
2551         handling of setsid, set_ctty, set_flags, and manage_console_count.
2552         (fhandler_console::open_setup): New function.  Implement functionality
2553         removed from get_tty_stuff.
2554         (fhandler_console::dup): Delete.
2555         (fhandler_console::output_tcsetattr): Set errno on error.
2556         (fhandler_console::fhandler_console): Set device early.
2557         (fhandler_console::init): Use open_with_arch to open console handles.
2558         (fhandler_console::fixup_after_fork_exec): Nuke most of the stuff for
2559         dealing with console handles.
2560         * fhandler_dsp.cc (fhandler_dev_dsp::open): Remove archetype handling.
2561         (fhandler_dev_dsp::write): Ditto.
2562         (fhandler_dev_dsp::read): Ditto.
2563         (fhandler_dev_dsp::close): Ditto.
2564         (fhandler_dev_dsp::dup): Ditto.
2565         (fhandler_dev_dsp::ioctl): Ditto.
2566         (fhandler_dev_dsp::fixup_after_fork): Ditto.
2567         (fhandler_dev_dsp::fixup_after_exec): Ditto.
2568         * fhandler_tty.cc (fhandler_tty_common::__acquire_output_mutex): Add a
2569         little more debugging.
2570         (fhandler_tty_common::__release_output_mutex): Ditto.
2571         (fhandler_pty_master::process_slave_output): Ditto.  Don't do signal
2572         handling or pthread_cancel handling in the tty master thread.
2573         (process_output): Minor reorg.
2574         (fhandler_tty_slave::fhandler_tty_slave): Set device based on new ntty
2575         argument.
2576         (fhandler_tty_slave::open): Remove archetype handling.  Move some
2577         processing into open_setup().
2578         (fhandler_tty_slave::open_setup): New function.
2579         (fhandler_tty_slave::cleanup): New function.
2580         (fhandler_tty_slave::close): Remove archetype handling.  Move some
2581         processing into cleanup().
2582         (fhandler_tty_slave::init): Rename argument from f to h.  Open device
2583         using open_with_arch().  Remove archetype handling.
2584         (fhandler_pty_master::dup): Ditto.
2585         (fhandler_pty_master::open): Ditto.
2586         (fhandler_pty_master::close): Ditto.  Move some handling to cleanup().
2587         (fhandler_pty_master::cleanup): New function.
2588         (fhandler_tty_master::init_console): Give unique name to captive
2589         console fhandler.
2590         * pinfo.cc (_pinfo::set_ctty): Rename argument from arch to fh.
2591         Eliminate archetype assumption.
2592         * syscalls.cc (close_all_files): Use close_with_arch for closing.
2593         (open): Use open_with_arch() rather than open().
2594         (close): Use close_with_arch() rather than close().
2595
2596 2011-05-05  Corinna Vinschen  <corinna@vinschen.de>
2597
2598         * pinfo.h (class push_process_state): New class to push a process state
2599         flag temporarily into myself->process_state.
2600         * fhandler_console.cc (fhandler_console::read): Add push_process_state
2601         handler.
2602         (fhandler_console::write): Call bg_check from here.  Add
2603         push_process_state handler.
2604         * fhandler_tty.cc (fhandler_tty_slave::write): Ditto.
2605         (fhandler_tty_slave::read): Ditto.
2606         (fhandler_pty_master::write): Ditto.
2607         (fhandler_pty_master::read): Ditto.
2608         * syscalls.cc (readv): Remove bg_check call and setting process state.
2609         (writev): Ditto.
2610
2611 2011-05-05  Corinna Vinschen  <corinna@vinschen.de>
2612
2613         * syscalls.cc (readv): Add myfault handler.  Don't check repeatedly
2614         open state of file handler.  Streamline loop.
2615         (writev): Add myfault handler.
2616
2617 2011-05-05  Christopher Faylor  <me.cygwin2011@cgf.cx>
2618
2619         * fhandler.cc (fhandler_base_overlapped::raw_read): Rename from
2620         read_overlapped.
2621         (fhandler_base_overlapped::raw_e): Rename from write_overlapped.
2622         * fhandler.h (fhandler_*::raw_read): Add reparm decoration.
2623         (fhandler_*::raw_write): Ditto.
2624         (fhandler_base_overlapped::raw_read): Rename from read_overlapped.
2625         (fhandler_base_overlapped::raw_write): Rename from write_overlapped.
2626         (fhandler_pipe::raw_read): Delete.
2627         (fhandler_pipe::raw_write): Ditto.
2628         (fhandler_mailslot::raw_read): Ditto.
2629         * fhandler_fifo.cc (fhandler_fifo::raw_read): Reflect read_overlapped
2630         -> raw_read rename.
2631         (fhandler_fifo::raw_write): Ditto.
2632         * fhandler_mailslot.cc (fhandler_mailslot::raw_read): Delete.
2633         (fhandler_mailslot::raw_write): Reflect read_overlapped -> raw_read
2634         rename.
2635         * pipe.cc (fhandler_pipe::raw_read): Delete.
2636         (fhandler_pipe::raw_write): Ditto.
2637
2638 2011-05-05  Christopher Faylor  <me.cygwin2011@cgf.cx>
2639
2640         * fork.cc (fork): Clear PID_REAPED.
2641         * pinfo.cc (pinfo_init): Ditto.
2642         (pinfo::init): Check for PID_REAPED.
2643         * sigproc.cc (stopped_or_terminated): Ditto.
2644
2645 2011-05-05  Christopher Faylor  <me.cygwin2011@cgf.cx>
2646
2647         * pinfo.cc (_pinfo::exists): Check for PID_REAPED.
2648
2649 2011-05-05  Corinna Vinschen  <corinna@vinschen.de>
2650
2651         * fhandler_disk_file.cc (fhandler_disk_file::pread): Correctly return
2652         with errno set to EBADF if file open mode is incorrect.
2653         (fhandler_disk_file::pwrite): Ditto.
2654
2655 2011-05-05  Corinna Vinschen  <corinna@vinschen.de>
2656
2657         * fhandler.cc (is_at_eof): Drop static storage class.  Drop err
2658         parameter since we don't change the Win32 error here anymore.
2659         (fhandler_base::raw_read): Accommodate change to is_at_eof.
2660
2661         * fhandler_disk_file.cc (fhandler_disk_file::pread): In binary mode use
2662         direct call to NtReadFile, rather than lseek/read.
2663         (fhandler_disk_file::pwrite): In binary mode use direct call to
2664         NtWriteFile, rather than lseek/write.
2665
2666 2011-05-05  Corinna Vinschen  <corinna@vinschen.de>
2667
2668         * dcrt0.cc (dll_crt0_1): Reset locale to "C" even when dynamically
2669         loaded.
2670
2671 2011-05-05  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
2672
2673         * posix.sgml (std-notimpl): Remove bsd_signal, setcontext, and
2674         swapcontext, marked obsolete in SUSv3 and not present in SUSv4.
2675
2676 2011-05-05  Christian Franke  <franke@computer.org>
2677
2678         * fhandler_registry.cc (fhandler_registry::exists): Fix regression
2679         in EACCES handling.
2680         (fhandler_registry::open): Fix "%val" case.
2681
2682 2011-05-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
2683
2684         * signal.cc (_pinfo::kill): Return success on kill(0) only if pid
2685         exists or is in PID_EXITED state.  Report pid 0 when pid does not exist
2686         rather than pid -1.  Make debug output reflect actual function call.
2687         * sigproc.cc (stopped_or_terminated): Set process state to reaped when
2688         we've finished waiting for it.
2689         * include/sys/cygwin.h (PID_REAPED): New enum.
2690
2691 2011-05-04  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
2692
2693         * cygwin.din (psiginfo): Export.
2694         (psignal): Export.
2695         (sys_siglist): Export.
2696         * posix.sgml (std-notimpl): Move psiginfo and psignal from here...
2697         (std-susv4): ... to here.
2698         (std-deprec): Add sys_siglist.
2699         * strsig.cc (sys_siglist): New array.
2700         (psiginfo): New function.
2701         * include/cygwin/signal.h (sys_siglist): Declare.
2702         (psiginfo): Declare.
2703         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2704
2705 2011-05-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
2706
2707         * dll_list::detach (dll_list::detach): Avoid doing anything with detach
2708         during a failing fork.
2709
2710 2011-05-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
2711
2712         * dll_init.cc (dll_global_dtors): Avoid calling destructors during
2713         failing fork().
2714
2715 2011-05-04  Corinna Vinschen  <corinna@vinschen.de>
2716
2717         * fhandler.h (class fhandler_base): Remove uninterruptible_io status
2718         flag.
2719         (fhandler_base::ready_for_read): Remove declaration.
2720         (fhandler_socket::ready_for_read): Ditto.
2721         (fhandler_pipe::ready_for_read): Ditto.
2722         (fhandler_tty_master::is_slow): Remove.
2723         * fhandler_console.cc (fhandler_console::open): Drop setting
2724         uninterruptible_io.
2725         * fhandler_serial.cc (fhandler_serial::open): Ditto.
2726         * fhandler_tty.cc (fhandler_tty_slave::fhandler_tty_slave): Ditto.
2727         (fhandler_tty_master::init_console): Ditto.
2728         * pipe.cc (fhandler_pipe::fhandler_pipe): Ditto.
2729         (fhandler_pipe::open): Ditto.
2730         (_pipe): Ditto.
2731         * select.cc (fhandler_pipe::ready_for_read): Remove.
2732         (fhandler_base::ready_for_read): Remove.
2733         * syscalls.cc (readv): Drop unneeded wait variable.  Remove entire test
2734         which might lead to calling ready_for_read.  Remove now unused label
2735         out.
2736
2737 2011-05-04  Corinna Vinschen  <corinna@vinschen.de>
2738
2739         * fhandler.h (class fhandler_mailslot): Move down in file and change
2740         parent class to fhandler_base_overlapped.  Remove declaration of
2741         method write.  Add declaraiotns for raw_read and raw_write.
2742         * fhandler_mailslot.cc (fhandler_mailslot::fhandler_mailslot): Call
2743         fhandler_base_overlapped constructor.
2744         (fhandler_mailslot::fstat): Call fhandler_base_overlapped::fstat.
2745         (fhandler_mailslot::open): Drop FILE_SYNCHRONOUS_IO_NONALERT flag from
2746         call to NtOpenFile.
2747         (fhandler_mailslot::raw_read): New method.
2748         (fhandler_mailslot::raw_write): Ditto.  Take over length algorithm from
2749         former write method.
2750         (fhandler_mailslot::write): Remove.
2751         (fhandler_mailslot::ioctl): Call fhandler_base_overlapped::ioctl.
2752
2753 2011-05-04  Corinna Vinschen  <corinna@vinschen.de>
2754
2755         * fhandler.h (fhandler_dev_tape::_lock): Add bool parameter.
2756         * fhandler_tape.cc (lock): Call _lock with false argument.
2757         (_lock): Take bool cancelable parameter.  Handle O_NONBLOCK.
2758         Make cancelable if cancelabe parameter is true.
2759         (fhandler_dev_tape::raw_read): Call _lock with true argument.
2760         (fhandler_dev_tape::raw_write): Ditto.
2761
2762 2011-05-04  Corinna Vinschen  <corinna@vinschen.de>
2763
2764         * fhandler_dsp.cc (fhandler_dev_dsp::Audio): Add fh member.
2765         (fhandler_dev_dsp::Audio_out::Audio_out): Take pointer to encapsulating
2766         fhandler_dev_dsp as parameter.
2767         (fhandler_dev_dsp::Audio_in::Audio_in): Ditto.
2768         (fhandler_dev_dsp::Audio::Audio): Take pointer to encapsulating
2769         fhandler_dev_dsp as parameter and store in fh.
2770         (fhandler_dev_dsp::Audio_out::write): Change return type to int and
2771         return number of bytes written.  Return -1 if waitforspace returns false
2772         and no bytes have been written so far.
2773         (fhandler_dev_dsp::Audio_out::waitforspace): Change return type to bool.
2774         Handle O_NONBLOCK.  Make waiting loop interruptible and cancelable.
2775         Return false in any of these cases, otherwise true.
2776         (fhandler_dev_dsp::Audio_in::read): Set returned nBytes to -1 if
2777         waitfordata returns false and nothing has been read so far.
2778         (fhandler_dev_dsp::Audio_in::waitfordata): Change return type to bool.
2779         Handle O_NONBLOCK.  Make waiting loop interruptible and cancelable.
2780         Return false in any of these cases, otherwise true.
2781         (fhandler_dev_dsp::write): Call Audio_out constructor with this as
2782         parameter.
2783         (fhandler_dev_dsp::read): Call Audio_in constructor with this as
2784         parameter.
2785
2786 2011-05-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
2787
2788         * thread.h (pthread::static_cancel_self): Mark as noreturn.
2789         (pthread::cancel_self): Ditto.
2790         * thread.cc (pthread::cancel_self): Explicitly use pthread::exit to
2791         avoid a "function returns" error.
2792
2793 2011-05-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
2794
2795         * pinfo.h (pinfo::pinfo): Set procinfo to NULL to avoid potential
2796         cleanup of uninitialized garbage.  (Suggested by Ryan Johnson)
2797
2798 2011-05-03  Corinna Vinschen  <corinna@vinschen.de>
2799
2800         * select.cc (cygwin_select): Make degenerate case cancelable.
2801         (select_stuff::destroy): New inline method to delete memory taken
2802         by select_stuff.
2803         (select_stuff::~select_stuff): Call destroy.
2804         (select_stuff::wait): Add case to allow canceling select.
2805         * select.h (select_stuff::destroy): Declare.
2806         * thread.cc: Mark poll, pselect and poll as cancelable.
2807
2808 2011-05-03  Corinna Vinschen  <corinna@vinschen.de>
2809
2810         * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Make
2811         cancelable.  Remove test for main thread, always add signal_arrived
2812         to waited objects.
2813
2814 2011-05-03  Corinna Vinschen  <corinna@vinschen.de>
2815
2816         * fhandler_tty.cc (fhandler_tty_slave::read): Set WFMO timeout to 0 for
2817         nonblocking case.  Drop useless waiter variable.  Rewrite wait for
2818         input_available_event to use a switch statement.  Handle timeout and
2819         failure more gracefully.  Make restartable and cancelable.  Rewrite
2820         wait for input_mutex to use WFMO and a switch statement.  Handle
2821         timeout and failure more gracefully.  Make restartable and cancelable.
2822
2823 2011-05-02  Christopher Faylor  <me.cygwin2011@cgf.cx>
2824
2825         * signal.cc (_pinfo::kill): Avoid referencing 'pid' after ESRCH.
2826
2827 2011-05-02  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
2828
2829         * cygwin.din (pthread_attr_getstack): Export.
2830         (pthread_attr_getstackaddr): Export.
2831         (pthread_getattr_np): Export.
2832         * ntdll.h (enum _THREAD_INFORMATION_CLASS): Add ThreadBasicInformation.
2833         (struct _THREAD_BASIC_INFORMATION): Define.
2834         (NtQueryInformationThread): Declare.
2835         * posix.sgml (std-susv4): Add pthread_attr_getstack.
2836         (std-gnu): Add pthread_getattr_np.
2837         (std-deprec): Add pthread_attr_getstackaddr.
2838         (std-notimpl): Remove pthread_attr_[gs]etstackaddr, as they were
2839         removed from SUSv4.
2840         * thread.cc (pthread_attr::pthread_attr): Initialize stackaddr.
2841         (pthread_attr_getstack): New function.
2842         (pthread_attr_getstackaddr): New function.
2843         (pthread_attr_setstacksize): Return EINVAL if passed size less than
2844         PTHREAD_STACK_MIN, as required by POSIX.
2845         (pthread_getattr_np): New function.
2846         * thread.h (class pthread_attr): Add stackaddr member.
2847         * include/pthread.h (pthread_attr_getstack): Declare.
2848         (pthread_attr_getstackaddr): Declare unconditionally.
2849         (pthread_attr_setstack): Declare inside false conditional for reference.
2850         (pthread_getattr_np): Declare.
2851         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2852
2853 2011-05-02  Christopher Faylor  <me.cygwin2011@cgf.cx>
2854
2855         * Makefile.in: Allow CFLAGS to be overridden from the environment.
2856
2857 2011-05-02  Corinna Vinschen  <corinna@vinschen.de>
2858
2859         * thread.cc (cancelable_wait): Remove test for main thread.
2860         * fhandler_fifo.cc (fhandler_fifo::open_nonserver): Ditto.
2861
2862 2011-05-02  Corinna Vinschen  <corinna@vinschen.de>
2863
2864         * fhandler_tty.cc (andler_pty_master::process_slave_output): Make
2865         interruptible and cancelable.  Fix nonblocking case.
2866
2867 2011-05-02  Corinna Vinschen  <corinna@vinschen.de>
2868
2869         * fhandler_console.cc (fhandler_console::read): Make restartable and
2870         cancelable.
2871
2872 2011-05-02  Christopher Faylor  <me.cygwin2011@cgf.cx>
2873
2874         * strace.cc (strace::vprntf): Avoid closing unopened handle.
2875
2876 2011-05-02  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
2877
2878         * sysconf.cc (sca): Set _SC_SPIN_LOCKS to _POSIX_SPIN_LOCKS.
2879
2880 2011-05-02  Christopher Faylor  <me.cygwin2011@cgf.cx>
2881
2882         * dll_init.cc (dll_list::alloc): Reset 'p' in forked process.
2883
2884         * select.cc (select_stuff::wait): Move cleanup() closer to WFMO to
2885         minimize unavoidable (?) race.
2886
2887 2011-05-02  Corinna Vinschen  <corinna@vinschen.de>
2888
2889         * fhandler_serial.cc (fhandler_serial::raw_read): Add restartability
2890         after a signal.  Add cancelability.
2891         (fhandler_serial::raw_write): Wait for write to succeed if O_NONBLOCK
2892         is not set.  Add signal handling and cancelability.
2893
2894 2011-05-01  Corinna Vinschen  <corinna@vinschen.de>
2895
2896         * fhandler_windows.cc (fhandler_windows::read): Use
2897         pthread::get_cancel_event to fetch thread's cancel event.
2898         * flock.cc (lf_setlock): Ditto.
2899         * posix_ipc.cc (ipc_cond_timedwait): Ditto.
2900         * thread.cc (pthread::get_cancel_event): New static method.
2901         * thread.h (pthread::get_cancel_event): Declare.
2902
2903 2011-05-01  Corinna Vinschen  <corinna@vinschen.de>
2904
2905         * libc/minires-os-if.c (get_dns_info): Remove unnecessary test for
2906         existence of DnsQuery_A.
2907
2908 2011-05-01  Corinna Vinschen  <corinna@vinschen.de>
2909
2910         Throughout, use user32 UNICODE functions rather than ANSI functions.
2911         * autoload.cc: Convert all definitions for ANSI user32 functions to
2912         definitions for the corresponding UNICODE function.
2913         (SendMessageA): Remove.
2914         (SendNotifyMessageW): Define.
2915         * fhandler.h (fhandler_windows::is_slow): Remove.
2916         * fhandler_windows.cc (fhandler_windows::write): Use SendNotifyMessageW
2917         call rather than SendMessage to make function always return immediately.
2918         (fhandler_windows::read): Make function interruptible and a cancellation
2919         point.  Handle O_NONBLOCK.
2920         * select.cc (peek_serial): Don't wait for signal_arrived here.
2921         * window.cc (wininfo::winthread): Call CreateWindowExW directly rather
2922         than CreateWindow wrapper.
2923
2924 2011-05-01  Corinna Vinschen  <corinna@vinschen.de>
2925
2926         * net.cc (fdsock): Drop setting uninterruptible_io to true.
2927
2928 2011-05-01  Corinna Vinschen  <corinna@vinschen.de>
2929
2930         * fhandler.h (fhandler_socket::is_slow): Remove.
2931
2932 2011-04-30  Corinna Vinschen  <corinna@vinschen.de>
2933
2934         * fcntl.cc (fcntl64): Call pthread_testcancel.
2935         * fhandler_socket.cc (fhandler_socket::connect): Ditto.
2936         (fhandler_socket::accept4): Ditto.
2937         (fhandler_socket::recvfrom): Ditto.
2938         (fhandler_socket::recvmsg): Ditto.
2939         (fhandler_socket::sendto): Ditto.
2940         (fhandler_socket::sendmsg): Ditto.
2941         * flock.cc (lf_setlock): Allow to cancel thread running blocking
2942         file lock.  Try to make code more readable.
2943         (lockf): Call pthread_testcancel.
2944         * mmap.cc (msync): Ditto.
2945         * posix_ipc.cc (ipc_cond_timedwait): Call pthread::static_cancel_self
2946         rather than pthread_testcancel.
2947         * select.cc (cygwin_select): Call pthread_testcancel.
2948         * syscalls.cc (pread): Ditto.
2949         (pwrite): Ditto.
2950         (readv): Ditto.
2951         (writev): Ditto.
2952         (open): Ditto.
2953         (close): Ditto.
2954         (fsync): Ditto.
2955         * termios.cc (tcdrain): Ditto.
2956         * thread.cc: Align list of cancellation points with above changes.
2957         Mark not-implemented functions, too.
2958         (cancelable_wait): Don't set unused object indices to WAIT_FAILED
2959         since that could result in wrong behaviour.  Set them to the invalid
2960         value WAIT_TIMEOUT + 1 instead.
2961
2962 2011-04-30  Corinna Vinschen  <corinna@vinschen.de>
2963
2964         * thread.h (class pthread): Add bool member canceled.
2965         * thread.cc (pthread::pthread): Initialize canceled to false.
2966         (pthread::cancel): Set canceled before setting cancel_event.
2967         (pthread::testcancel): Check for canceled.  Only wait for cancel_event
2968         if canceled is true.  Explain why.
2969         (pthread::_fixup_after_fork): Set canceled to false.
2970
2971 2011-04-29  Corinna Vinschen  <corinna@vinschen.de>
2972
2973         * errno.cc (errmap): Sort.  Map ERROR_EXE_MACHINE_TYPE_MISMATCH to
2974         ENOEXEC.
2975
2976 2011-04-29  Corinna Vinschen  <corinna@vinschen.de>
2977
2978         * thread.cc: Update comment listing cancellation points per POSIX.
2979
2980 2011-04-29  Corinna Vinschen  <corinna@vinschen.de>
2981
2982         * advapi32.cc: Add comment.
2983         (EqualSid): Remove.
2984         (CopySid): Remove.
2985         (AddAccessAllowedAce): Remove.
2986         (AddAccessDeniedAce): Remove.
2987         (MakeSelfRelativeSD): Remove.
2988         * flock.cc: Replace above functions throughout with their ntdll.dll
2989         equivalent.
2990         * sec_acl.cc: Ditto.
2991         * sec_auth.cc: Ditto.
2992         * sec_helper.cc: Ditto.
2993         * security.cc: Ditto.
2994         * security.h: Ditto.
2995         (RtlEqualSid): Declare.  Explain why.
2996         (RtlCopySid): Ditto.
2997
2998 2011-04-29  Corinna Vinschen  <corinna@vinschen.de>
2999
3000         * advapi32.cc (AccessCheck): Remove.
3001         (PrivilegeCheck): Remove.
3002         (OpenThreadToken): Remove.
3003         * fhandler_tty.cc: Replace above functions throughout with their
3004         ntdll.dll equivalent.
3005         * security.cc: Ditto.
3006
3007 2011-04-29  Corinna Vinschen  <corinna@vinschen.de>
3008
3009         * ntdll.h (IsEventSignalled): New inline function.
3010         * cygthread.cc (cygthread::terminate_thread): Use IsEventSignalled in
3011         place of WaitForSingleObject on event with 0 timeout.
3012         * fhandler.cc (fhandler_base_overlapped::has_ongoing_io): Ditto.
3013         * fhandler_fifo.cc (fhandler_fifo::open_nonserver): Ditto.
3014         (fhandler_fifo::wait): Ditto.
3015         * fhandler_termios.cc (fhandler_termios::bg_check): Ditto.
3016         * select.cc (verify_tty_slave): Ditto.
3017         * thread.cc (pthread::testcancel): Ditto.
3018
3019 2011-04-29  Corinna Vinschen  <corinna@vinschen.de>
3020
3021         * advapi32.cc (GetTokenInformation): Remove.
3022         (SetTokenInformation): Remove.
3023         * grp.cc: Replace above functions throughout with their ntdll.dll
3024         equivalent.
3025         * sec_auth.cc: Ditto.
3026         * syscalls.cc: Ditto.
3027         * uinfo.cc: Ditto.
3028
3029 2011-04-29  Corinna Vinschen  <corinna@vinschen.de>
3030
3031         * posix_ipc.cc (ipc_cond_timedwait): Only wait for pthread's
3032         cancel_event if thread's cancelability isn't disabled.
3033
3034 2011-04-28  Corinna Vinschen  <corinna@vinschen.de>
3035
3036         * advapi32.cc (SetSecurityDescriptorDacl): Remove.
3037         (SetSecurityDescriptorGroup): Remove.
3038         (SetSecurityDescriptorOwner): Remove.
3039         * pinfo.cc: Replace above functions throughout with their ntdll.dll
3040         equivalent.
3041         * sec_acl.cc: Ditto.
3042         * sec_helper.cc: Ditto.
3043         * security.cc: Ditto.
3044
3045         * sec_helper.cc (__sec_user): Remove old comment.
3046
3047 2011-04-28  Corinna Vinschen  <corinna@vinschen.de>
3048
3049         * posix_ipc.cc (ipc_cond_timedwait): Also wait for pthread's
3050         cancel_event, if any.  Call pthread_testcancel if cancel_event has been
3051         signalled.
3052
3053 2011-04-28  Corinna Vinschen  <corinna@vinschen.de>
3054
3055         * posix_ipc.cc (ipc_cond_timedwait): Remove pthread_testcancel calls.
3056         (_mq_send): Add pthread_testcancel call at start of function.
3057         (_mq_receive): Ditto.
3058
3059 2011-04-28  Corinna Vinschen  <corinna@vinschen.de>
3060
3061         * cygerrno.h (geterrno_from_nt_status): Declare.
3062         * errno.cc (geterrno_from_nt_status): Define.
3063         * flock.cc: Fix copyright dates.
3064         * ntdll.h (enum _TIMER_TYPE): Define.
3065         (PTIMER_APC_ROUTINE): Define.
3066         (NtCancelTimer): Declare.
3067         (NtCreateTimer): Declare.
3068         (NtSetTimer): Declare.
3069         * posix_ipc.cc (ipc_cond_timedwait): Rewrite to make interruptible and
3070         restartable.  Call pthread_testcancel in case of timeout to enable
3071         pthread_cancel on waiting thread.  Replace WFMO timeout with waiting
3072         for a waitable timer.  Explain why.  Replace single call to WFMO with
3073         two calls, one for the event, one for the mutex.  Don't lock mutex in
3074         case of error.
3075         (ipc_cond_signal): Make void function.
3076         (ipc_cond_close): Ditto.
3077         (_mq_send): Immediately return -1 in case of error from
3078         ipc_cond_timedwait.
3079         (_mq_receive): Ditto.
3080
3081 2011-04-28  Corinna Vinschen  <corinna@vinschen.de>
3082
3083         * advapi32.cc (GetSecurityDescriptorDacl): Remove.
3084         (GetSecurityDescriptorGroup): Remove.
3085         (GetSecurityDescriptorOwner): Remove.
3086         * sec_acl.cc: Replace above functions throughout with their ntdll.dll
3087         equivalent.  Remove redundant debug output.
3088         * sec_auth.cc: Ditto.
3089         * security.cc: Ditto.
3090         * uinfo.cc: Ditto.
3091
3092 2011-04-28  Corinna Vinschen  <corinna@vinschen.de>
3093
3094         * advapi32.cc (InitializeAcl): Remove.
3095         (AddAce): Remove.
3096         (FindFirstFreeAce): Remove.
3097         (GetAce): Remove.
3098         (InitializeSecurityDescriptor): Remove.
3099         (OpenProcessToken): Remove.
3100         * dcrt0.cc: Replace above functions throughout with their ntdll.dll
3101         equivalent.
3102         * fhandler_tty.cc: Ditto.
3103         * flock.cc: Ditto.
3104         * pinfo.cc: Ditto.  Drop unnecessary error handling.
3105         * sec_acl.cc: Ditto.
3106         * sec_auth.cc: Ditto.
3107         * sec_helper.cc: Ditto.
3108         * security.cc: Ditto.
3109
3110 2011-04-28  Corinna Vinschen  <corinna@vinschen.de>
3111
3112         * advapi32.cc (InitializeSid): Remove.
3113         (EqualPrefixSid): Remove.
3114         (GetLengthSid): Remove.
3115         (GetSidSubAuthority): Remove.
3116         (GetSidSubAuthorityCount): Remove.
3117         (GetSidIdentifierAuthority): Remove.
3118         * fhandler_disk_file.cc: Replace above functions throughout with their
3119         ntdll.dll equivalent.
3120         * sec_auth.cc: Ditto.
3121         * sec_helper.cc: Ditto.
3122         * security.cc: Ditto.
3123
3124 2011-04-28  Corinna Vinschen  <corinna@vinschen.de>
3125
3126         * advapi32.cc (AllocateLocallyUniqueId): Remove.
3127         * fhandler_disk_file.cc (fhandler_base::open_fs): Replace call to
3128         AllocateLocallyUniqueId with call to NtAllocateLocallyUniqueId;
3129         * posix_ipc.cc (mq_open): Ditto.  Drop error handling for that call.
3130         (sem_open): Ditto.
3131
3132 2011-04-28  Corinna Vinschen  <corinna@vinschen.de>
3133
3134         * autoload.cc (GetSecurityInfo): Remove.
3135         * ntdll.h (RtlConvertToAutoInheritSecurityObject): Declare.
3136         (RtlDeleteSecurityObject): Declare.
3137         (RtlGetControlSecurityDescriptor): Declare.
3138         (RtlLengthSecurityDescriptor): Declare.
3139         * security.cc (file_mapping): New global variable.
3140         (get_file_sd): Rewrite.  Clean up code.  Get rid of GetSecurityInfo
3141         call.
3142         (alloc_sd): Call RtlSetControlSecurityDescriptor to set
3143         SE_DACL_PROTECTED flag.
3144         (check_file_access): Remove mapping.  Use file_mapping instead.
3145         (check_registry_access): Rename mapping to reg_mapping.
3146         * wincap.cc: Througout, drop use_get_sec_info_on_dirs,
3147         * wincap.h (struct wincaps): Drop use_get_sec_info_on_dirs.
3148
3149 2011-04-24  Corinna Vinschen  <corinna@vinschen.de>
3150
3151         * include/fenv.h: Add missing _FENV_H_ define.
3152
3153 2011-04-23  Corinna Vinschen  <corinna@vinschen.de>
3154
3155         * registry.cc (reg_key::get_dword): Rename from get_int, use DWORD
3156         rather than int type.  Avoid compiler warning.
3157         (reg_key::set_dword): Rename from set_int, use DWORD rather than int
3158         type.  Change return type to NTSTATUS.
3159         (reg_key::get_string): Change return type to NTSTATUS.
3160         (reg_key::set_string): Ditto.
3161         * registry.h: Accommodate above changes.
3162         * environ.cc (regopt): Test return value of reg_key::get_string as
3163         NTSTATUS.
3164         * sched.cc (sched_rr_get_interval): Change local int vars to DWORD.
3165         Call reg_key::get_dword instead of reg_key::get_int.
3166         * shared.cc (init_installation_root): Test return value of
3167         reg_key::get_string as NTSTATUS.
3168         (shared_info::heap_slop_size): Call reg_key::get_dword rather than
3169         reg_key::get_int.
3170         (shared_info::heap_chunk_size): Ditto.
3171         * shared_info.h (CURR_SHARED_MAGIC): Update.
3172         (class shared_info): Change heap_chunk and heap_slop to DWORD  values.
3173
3174 2011-04-21  Corinna Vinschen  <corinna@vinschen.de>
3175
3176         * cygtls.cc (_cygtls::init_thread): Drop setting locals.process_logmask.
3177         * cygtls.cc (_cygtls::remove): Always free mallocated TLS storage on
3178         thread exit.  Drop freeing locals.process_ident.
3179         * cygtls.h (struct _local_storage): Remove syslog-related members.
3180         * syslog.cc (syslog_globals): New static storage for global syslog
3181         settings.  Use throughout instead of _my_tls.locals.
3182         (openlog): Set new syslog_globals.process_ident value more carefully.
3183         * tlsoffsets.h: Regenerate.
3184
3185 2011-04-21  Thomas Stalder <cygwinml@gmail.com>
3186
3187         * include/sys/poll.h: Include signal.h to get definition of sigset_t.
3188
3189 2011-04-20  Christopher Faylor  <me.cygwin2011@cgf.cx>
3190
3191         * cygheap.cc (init_cygheap::close_ctty): Avoid closing console-cttys
3192         since they don't use archetypes and this will just result in double
3193         frees.
3194         * dll_init.cc (dll_list::protect): Define.
3195         (dll_list::alloc): Guard list access.
3196         (dll_list::detach): Ditto.
3197         * dll_init.h (dll_list::protect): Declare new muto.
3198         (dll_list::guard): Define/declare function to guard list access.
3199         * fhandler_termios.cc (fhandler_termios::sigflush): Avoid SEGV in
3200         pathological condition of get_ttyp() == NULL.
3201
3202 2011-04-20  Christopher Faylor  <me.cygwin2011@cgf.cx>
3203
3204         * select.cc (serial_cleanup): Make sure that device_specific_pipe is
3205         always deleted regardless of whether it has a unique thread associated
3206         with it
3207         (socket_cleanup): Ditto.
3208         (mailslot_cleanup): Ditto.
3209
3210 2011-04-20  Corinna Vinschen  <corinna@vinschen.de>
3211
3212         * devices.h: Renumber internal devices so that FH_PROCESS is part of
3213         the /proc family of virtual devices.
3214         (FH_PROC_MAX_MINOR): Define.
3215         * path.h (isproc_dev): Use FH_PROC_MAX_MINOR rather than FH_PROC.
3216
3217 2011-04-19  Peter Rosin  <peda@lysator.liu.se>
3218
3219         * select.cc (pipe_cleanup): Make sure that device_specific_pipe is
3220         always deleted regardless of whether it has a unique thread associated
3221         with it.
3222
3223 2011-04-19  Jon TURNEY  <jon.turney@dronecode.org.uk>
3224
3225         * thread.cc (semaphore::init): We cannot reliably infer anything from
3226         the existing contents of sem, so merely warn rather than return EBUSY
3227         if it looks like we are reinitialising a semaphore.
3228
3229 2011-04-19  Corinna Vinschen  <corinna@vinschen.de>
3230
3231         * autoload.cc (GetConsoleWindow): Drop.
3232         (GetSystemWindowsDirectoryW): Drop.
3233         * fhandler_console.cc (beep): Call GetSystemWindowsDirectoryW instead of
3234         GetWindowsDirectoryW.
3235         * uinfo.cc (cygheap_user::env_systemroot): Call
3236         GetSystemWindowsDirectoryW and convert to multibyte on the fly.
3237         * winlean.h (GetWindowsDirectoryW): Redefine to something invalid.
3238         Explain why.
3239
3240 2011-04-19  Corinna Vinschen  <corinna@vinschen.de>
3241
3242         * Makefile.in (DLL_IMPORTS): Drop advapi32.dll.
3243         * autoload.cc: Enable autoloading advapi32 functions.
3244         * environ.cc (regopt): Use wide char arguments in reg_key functions.
3245         * fhandler_console.cc (beep): Ditto.  Use WCHAR throughout.
3246         * registry.cc (reg_key): Rewrite reg_key class to use native NT registry
3247         functions.  Use WCHAR string parameters throughout.  Use PCWSTR rather
3248         than const WCHAR.  Drop multibyte char functionality.  Drop unused
3249         methods.
3250         (get_registry_hive_path): Use RtlQueryRegistryValues to fetch path from
3251         registry.
3252         (load_registry_hive): Drop useless check for user hive being available.
3253         Load hive using NtLoadKey.
3254         * registry.h: Accommodate above changes.
3255         * sched.cc (sched_rr_get_interval): Use wide char arguments in reg_key
3256         functions.
3257         * shared.cc (init_installation_root): Ditto.
3258         (shared_info::init_obcaseinsensitive): Use RtlQueryRegistryValues to
3259         fetch obcaseinsensitive value.
3260         (shared_info::heap_slop_size): Use wide char arguments in reg_key
3261         functions.
3262         (shared_info::heap_chunk_size): Ditto.
3263         * syscalls.cc (gethostid): Ditto.
3264         * winsup.h (__WIDE): Define.
3265         (_WIDE): Define.
3266         * libc/minires-os-if.c (get_registry_dns_items): Don't fetch values
3267         from registry.  Just extract them from given UNICODE_STRING parameter.
3268         (get_registry_dns): Fetch all registry values at once using
3269         RtlQueryRegistryValues.
3270
3271 2011-04-19  Corinna Vinschen  <corinna@vinschen.de>
3272
3273         * net.cc (get_ipv4fromreg_ipcnt): Rearrange to fetch all registry
3274         values at once using RtlQueryRegistryValues.
3275         (get_ipv4fromreg): Ditto.
3276
3277 2011-04-19  Corinna Vinschen  <corinna@vinschen.de>
3278
3279         * fhandler_registry.cc (fhandler_registry::fstat): Use RegQueryInfoKeyW.
3280
3281 2011-04-19  Corinna Vinschen  <corinna@vinschen.de>
3282
3283         * fhandler_proc.cc (read_value): Remove definition.
3284         (print): Simplify.
3285         (format_proc_cpuinfo): Drop useless call to GetSystemInfo.  Rearrange
3286         to use Rtl registry functions.  Rename dwOldThreadAffinityMask to
3287         orig_affinity_mask.
3288
3289 2011-04-18  Corinna Vinschen  <corinna@vinschen.de>
3290
3291         * localtime.cc (tzload): Don't change global timezone information
3292         when called from gmtime or gmtime_r.
3293         (tzparse): Ditto.
3294
3295 2011-04-18  Corinna Vinschen  <corinna@vinschen.de>
3296
3297         * cygtls.cc (_cygtls::remove): Always close sockevt handle.
3298
3299 2011-04-18  Corinna Vinschen  <corinna@vinschen.de>
3300
3301         * cygwin.din (ppoll): Export.
3302         * poll.cc (ppoll): Implement.
3303         * posix.sgml (std-gnu): Add ppoll.
3304         * include/cygwin/version.h: Bump API minor number.
3305         * include/sys/poll.h (ppoll): Declare.
3306
3307 2011-04-18  Corinna Vinschen  <corinna@vinschen.de>
3308
3309         * fhandler_socket.cc (fhandler_socket::evaluate_events): Handle the
3310         FD_CLOSE event specially when called from accept.  Explain why.
3311         (fhandler_socket::shutdown): Fake success on not-connected socket and
3312         trigger socket event if the read side of a socket is affected.  Explain
3313         why.
3314         * poll.cc (poll): Check for saw_shutdown_read on sockets to generate
3315         POLLHUP as well.
3316
3317 2011-04-18  Corinna Vinschen  <corinna@vinschen.de>
3318
3319         * Fix various copyrights.
3320
3321 2011-04-17  Christopher Faylor  <me.cygwin2011@cgf.cx>
3322
3323         * signal.cc (_pinfo::kill): Set this_process_state when process
3324         exists.
3325
3326 2011-04-17  Christopher Faylor  <me.cygwin2011@cgf.cx>
3327
3328         * signal.cc (_pinfo::kill): Return 0 when attempting to test for
3329         existence of an existed process which has not yet been reaped.
3330
3331 2011-04-17  Christopher Faylor  <me.cygwin2011@cgf.cx>
3332
3333         * cygheap.h (init_cygheap::ctty): Use base class so that console can
3334         join in the fun.
3335         * dtable.cc (dtable::stdio_init): Remove special-case call to
3336         set_console_ctty ().
3337         * exceptions.cc (sigpacket::process): Conditionally flush terminal
3338         input on certain signals.
3339         * fhandler.h (fhandler_console::get_tty_stuff): Make non-static.
3340         (fhandler_termios::get_ttyp): Move here.
3341         (fhandler_termios::sigflush): Declare.
3342         (fhandler_tty_common::get_ttyp): Delete.
3343         * fhandler_console.cc (fhandler_console::get_tty_stuff): Pass this as
3344         "arch" argument.
3345         (set_console_ctty): Delete.
3346         (tty_list::get_tty): Just return pointer to shared console region,
3347         delaying get_tty_stuff until open().
3348         (fhandler_console::init): Treat NULL handle as signifying that console
3349         should be opened with O_NOCTTY flag.  Rename handle argument to the
3350         more common 'h'.
3351         * fhandler_termios.cc (fhandler_termios::sigflush): Define.
3352         * fhandler_tty.cc (handler_tty_master::init_console): Pass NULL as
3353         first argument to fhandler_console::init.
3354         * pinfo.cc (_pinfo::set_ctty): Change third parameter to
3355         fhandler_termios *.  Add extra debugging.
3356         * pinfo.h (_pinfo::set_ctty): Change third parameter to
3357         fhandler_termios *.
3358
3359         * sigproc.cc (handle_sigsuspend): Don't special-case non-main threads.
3360
3361 2011-04-15  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
3362
3363         * thread.cc (pthread_setschedprio): New function.
3364         * include/pthread.h (pthread_setschedprio): Declare.
3365         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
3366         * cygwin.din (pthread_setschedprio): Export.
3367         * posix.sgml (std-notimpl) Move pthread_setschedprio from here...
3368         (std-susv4) ...to here.
3369
3370 2011-04-10  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
3371
3372         * fhandler_proc.cc (proc_tab): Add /proc/swaps virtual file.
3373         (format_proc_swaps): New function.
3374
3375 2011-04-06  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
3376
3377         * Makefile.in: Move srcdir definition before others which uses it.
3378
3379 2011-04-06  Jon TURNEY  <jon.turney@dronecode.org.uk>
3380
3381         * dll_init.cc (reserve_at, release_at): New functions.
3382         (load_after_fork): If the DLL was loaded higher than the required
3383         address, assume that it loaded at it's base address and also reserve
3384         memory there to force it to be relocated.
3385
3386 2011-04-04  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
3387
3388         * include/cygwin/types.h: Move #include <sys/sysmacros.h> to
3389         end of header so that it gets the dev_t typedef.
3390         * include/sys/sysmacros.h (gnu_dev_major, gnu_dev_minor,
3391         gnu_dev_makedev): Prototype and define as inline functions.
3392         (major, minor, makedev): Redefine in terms of gnu_dev_*.
3393
3394 2011-04-04  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
3395
3396         * include/cygwin/types.h: Move multiple inclusion guards to
3397         beginning and end of header.
3398
3399 2011-04-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
3400
3401         * Makefile.in: Move Makefile.common include earlier to fix problems
3402         with relative ${srcdir} path which confuses make.
3403
3404 2011-04-04  Corinna Vinschen  <corinna@vinschen.de>
3405
3406         Drop NT4 support.
3407         * autoload.cc (DnsQuery_A): Fatal if not available.
3408         (DnsRecordListFree): Ditto.
3409         (DsGetDcNameW): Ditto.
3410         (NetGetAnyDCName): Remove.
3411         (NetGetDCName): Remove.
3412         (EnumProcessModules): Fatal if not available.
3413         (GetModuleFileNameExW): Ditto.
3414         (GetModuleInformation): Ditto.
3415         (GetProcessMemoryInfo): Ditto.
3416         (QueryWorkingSet): Ditto.
3417         (LsaRegisterLogonProcess): Ditto.
3418         * fenv.cc (_feinitialise): Drop supports_sse condition.
3419         * fhandler_disk_file.cc (path_conv::isgood_inode): Fix comment.
3420         (fhandler_base::fstat_by_name): Drop has_fileid_dirinfo condition.
3421         (fhandler_disk_file::opendir): Ditto.
3422         * fhandler_netdrive.cc (fhandler_netdrive::readdir): Fix comment.
3423         * fhandler_proc.cc (format_proc_partitions): Drop NT4-only code.
3424         * fhandler_process.cc (get_process_state): Ditto.
3425         * kernel32.cc (GetWindowsDirectoryW): Remove.
3426         (GetWindowsDirectoryA): Remove.
3427         * miscfuncs.cc (nice_to_winprio): Drop NT4-only code.
3428         * mount.cc (fs_info::update): Fix comments.
3429         * net.cc (get_2k_ifs): Drop NT4-only code.
3430         * sec_auth.cc (get_logon_server): Ditto.
3431         (lsaauth): Drop NT4-specific error handling.
3432         * security.cc (alloc_sd): Set SE_DACL_PROTECTED unconditionally.
3433         * select.cc (select_stuff::wait): Always use MWMO_INPUTAVAILABLE.
3434         (peek_windows): Drop NT4-only condition in call to PeekMessage.
3435         * syscalls.cc (gethostid): Remove NT4-only workaround.
3436         * wincap.cc: Througout, drop has_dacl_protect,
3437         has_broken_if_oper_status, has_process_io_counters,
3438         has_terminal_services, has_extended_priority_class, has_guid_volumes,
3439         has_fileid_dirinfo, has_mwmo_inputavailable and supports_sse from
3440         wincaps.
3441         (wincap_nt4sp4): Remove.
3442         (wincap_minimal): Set to wincap_2000.
3443         (wincapc::init): Rely on availability of OSVERSIONINFOEX structure.
3444         Treat error from GetVersionEx as fatal.  Treat NT4 as fatal.
3445         * wincap.h (struct wincaps): Drop has_dacl_protect,
3446         has_broken_if_oper_status, has_process_io_counters,
3447         has_terminal_services, has_extended_priority_class, has_guid_volumes,
3448         has_fileid_dirinfo, has_mwmo_inputavailable and supports_sse flags
3449         and methods.
3450         * winlean.h (GetWindowsDirectoryW) Define as GetSystemWindowsDirectoryW.
3451         (GetWindowsDirectoryA): Define as GetSystemWindowsDirectoryA.
3452
3453 2011-04-04  Corinna Vinschen  <corinna@vinschen.de>
3454
3455         * dtable.cc (dtable::init_std_file_from_handle): Fix a comment to
3456         reflect the current state.
3457
3458 2011-04-04  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
3459
3460         * Makefile.in (fhandler_proc_CFLAGS): Define USERNAME, HOSTNAME,
3461         and GCC_VERSION.
3462         * fhandler_proc.cc (format_proc_version):  Add build machine and GCC
3463         version information as on Linux.
3464
3465 2011-04-04  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
3466             Corinna Vinschen  <corinna@vinschen.de>
3467
3468         * devices.h (fh_devices): Define FH_PROC_MIN_MINOR.
3469         Reorder major-0 devices so that all /proc directories fall
3470         between FH_PROC and FH_PROC_MIN_MINOR.
3471         * path.h (isproc_dev): Redefine accordingly.
3472
3473 2011-04-04  Corinna Vinschen  <corinna@vinschen.de>
3474
3475         * cygserver_setpwd.h (setlsapwd): Add username parameter to declaration.
3476         * external.cc (cygwin_internal): In the CW_SET_PRIV_KEY case, fetch
3477         additional username parameter.
3478         * setlsapwd.cc (setlsapwd): Add username parameter.  Allow admin to
3479         set the hidden password for other users.
3480
3481 2011-04-04  Corinna Vinschen  <corinna@vinschen.de>
3482
3483         * sec_auth.cc (get_user_groups): Mark well-known groups as well-known.
3484         (get_user_local_groups): Ditto.
3485         (verify_token): Drop useless label.
3486         * sec_helper.cc (cygsid::get_sid): Check for well-known SID if
3487         well_known isn't set.
3488         * security.h (well_known_sid_type): New inline function.
3489
3490 2011-04-02  Corinna Vinschen  <corinna@vinschen.de>
3491
3492         * autoload.cc (FindFirstVolumeA): Remove.
3493         (FindNextVolumeA): Remove.
3494         (FindVolumeClose): Remove.
3495         (GetVolumeNameForVolumeMountPointA): Remove.
3496         * ntdll.h (NtFlushBuffersFile): Declare.
3497         * syscalls.cc (sync_worker): Rewrite using native NT functions.
3498         (sync): Ditto.
3499
3500 2011-04-02  Corinna Vinschen  <corinna@vinschen.de>
3501
3502         * fhandler_proc.cc (format_proc_partitions): Express length in WCHAR
3503         size.
3504
3505 2011-04-02  Corinna Vinschen  <corinna@vinschen.de>
3506
3507         * autoload.cc (GetExtendedTcpTable): Remove.
3508         (GetTcpTable): Remove.
3509         (CharNextExA): Remove.
3510         (FindWindowA): Remove.
3511         (ShowWindowAsync): Remove.
3512         * dcrt0.cc (disable_dep): Remove unused function.
3513         (dll_crt0_0): Drop comment babbling about TS & DEP.
3514         * fhandler_socket.cc (address_in_use): Remove unused function.
3515         * wincap.cc: Throughout, drop ts_has_dep_problem from wincaps.
3516         (wincapc::init): Drop code setting ts_has_dep_problem flag.
3517         * wincap.h (struct wincaps): Drop ts_has_dep_problem flags and method.
3518
3519 2011-04-01  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
3520
3521         Implement /proc/sysvipc/*
3522         * devices.in (dev_procsysvipc_storage): Add.
3523         * devices.cc: Regenerate.
3524         * devices.h (fh_devices): Add FH_PROCSYSVIPC.
3525         * dtable.cc (build_fh_pc): Add case FH_PROCSYSVIPC.
3526         * fhandler.h (class fhandler_procsysvipc): Declare.
3527         (fhandler_union): Add __procsysvipc.
3528         * fhandler_proc.cc (proc_tab): Add sysvipc virt_directory.
3529         * fhandler_procsysvipc.cc: New file.
3530         * Makefile.in (DLL_OFILES): Add fhandler_procsysvipc.o.
3531         * path.h (isproc_dev): Add FH_PROCSYSVIPC to conditional.
3532
3533 2011-04-01  Corinna Vinschen  <corinna@vinschen.de>
3534
3535         * Makefile.in (DLL_OFILES): Add avapi32.o.
3536         * advapi32.cc: New file.
3537         * autoload.cc: Add block of remaining advapi32 functions used by
3538         Cygwin.  Keep commented out.  Explain why.
3539
3540 2011-04-01  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
3541
3542         * fhandler_proc.cc (format_proc_loadavg): Add running/total
3543         processes as fourth component of output.
3544         * fhandler_process.cc (get_process_state): Make non-static.
3545         Add FIXME about generating an 'O' flag.
3546
3547 2011-04-01  Corinna Vinschen  <corinna@vinschen.de>
3548
3549         * fhandler_random.cc (fhandler_dev_random::crypt_gen_random):
3550         Use CryptAcquireContextW.
3551         * ntdll.h (STATUS_PROCEDURE_NOT_FOUND): Define.
3552         * sec_auth.cc (open_local_policy): Rename NTSTATUS variable ret to
3553         status.  Drop usage of LsaNtStatusToWinError.
3554         (verify_token): Call NtQuerySecurityObject instead of
3555         GetKernelObjectSecurity.
3556         (create_token): Rename NTSTATUS variable ret to status.  Rename ret2 to
3557         sub_status.  Drop usage of LsaNtStatusToWinError.  In case LsaLogonUser
3558         fails, report the sub_status as well.
3559
3560 2011-04-01  Corinna Vinschen  <corinna@vinschen.de>
3561
3562         * libc/strptime.c: Remove misleading comment.
3563
3564 2011-03-31  Corinna Vinschen  <corinna@vinschen.de>
3565
3566         * ntdll.h: Allow usage from plain C code.
3567         (FSCTL_PIPE_IMPERSONATE): Define.
3568         (enum _THREAD_INFORMATION_CLASS): Define.
3569         (RTL_QUERY_REGISTRY_xxx): Define.
3570         (RTL_REGISTRY_xxx): Define.
3571         (PRTL_QUERY_REGISTRY_ROUTINE): Define.
3572         (struct _RTL_QUERY_REGISTRY_TABLE): Define.
3573         (enum _KEY_VALUE_INFORMATION_CLASS): Define.
3574         (struct _KEY_VALUE_PARTIAL_INFORMATION): Define.
3575         (NtAccessCheck): Declare.
3576         (NtAllocateLocallyUniqueId): Declare.
3577         (NtCreateKey): Declare.
3578         (NtDuplicateToken): Declare.
3579         (NtLoadKey): Declare.
3580         (NtOpenKey): Declare.
3581         (NtOpenProcessToken): Declare.
3582         (NtOpenThreadToken): Declare.
3583         (NtPrivilegeCheck): Declare.
3584         (NtQueryInformationToken): Declare.
3585         (NtQueryValueKey): Declare.
3586         (NtSetInformationThread): Declare.
3587         (NtSetInformationToken): Declare.
3588         (NtSetValueKey): Declare.
3589         (RtlAbsoluteToSelfRelativeSD): Declare.
3590         (RtlAddAccessAllowedAce): Declare.
3591         (RtlAddAccessDeniedAce): Declare.
3592         (RtlAddAce): Declare.
3593         (RtlCheckRegistryKey): Declare.
3594         (RtlCopySid): Declare.
3595         (RtlCreateAcl): Declare.
3596         (RtlCreateRegistryKey): Declare.
3597         (RtlCreateSecurityDescriptor): Declare.
3598         (RtlEqualPrefixSid): Declare.
3599         (RtlEqualSid): Declare.
3600         (RtlFirstFreeAce): Declare.
3601         (RtlGetAce): Declare.
3602         (RtlGetDaclSecurityDescriptor): Declare.
3603         (RtlGetGroupSecurityDescriptor): Declare.
3604         (RtlGetOwnerSecurityDescriptor): Declare.
3605         (RtlIdentifierAuthoritySid): Declare.
3606         (RtlInitializeSid): Declare.
3607         (RtlLengthSid): Declare.
3608         (RtlQueryRegistryValues): Declare.
3609         (RtlSetControlSecurityDescriptor): Declare.
3610         (RtlSetDaclSecurityDescriptor): Declare.
3611         (RtlSetGroupSecurityDescriptor): Declare.
3612         (RtlSetOwnerSecurityDescriptor): Declare.
3613         (RtlSubAuthorityCountSid): Declare.
3614         (RtlSubAuthoritySid): Declare.
3615         (RtlWriteRegistryValue): Declare.
3616
3617 2011-03-31  Corinna Vinschen  <corinna@vinschen.de>
3618
3619         * uinfo.cc (cygheap_user::init): Don't call GetUserName.  Fetch username
3620         from Windows environment instead.  Explain why.
3621         (cygheap_user::env_domain): Use MAX_DOMAIN_NAME_LEN rather than DNLEN
3622         to specify the size of the domain name buffer.
3623
3624 2011-03-30  Corinna Vinschen  <corinna@vinschen.de>
3625
3626         * hires.h: Fix copyright.
3627         * times.cc: Ditto.
3628         (FACTOR): Add comment.
3629         (NSPERSEC): Ditto.
3630         (JITTER): New definition.  Comment.
3631         (systime_ns): Avoid gratuitous copying of the value returned by
3632         GetSystemTimeAsFileTime.
3633         (corelocaltime, localtime, gmtime): Remove very old, unused code block.
3634         (cygwin_tzset): Remove.
3635         (hires_ms::timeGetTime_ns): Add missing semicolon in comment.
3636         (hires_ms::nsecs): Redefine check for difference between internal
3637         timer value and system time.
3638
3639 2011-03-30  Corinna Vinschen  <corinna@vinschen.de>
3640
3641         * times.cc (hires_ms::resolution): Make sure resolution is never 0.
3642         (clock_setres): Ditto.
3643
3644 2011-03-29  Corinna Vinschen  <corinna@vinschen.de>
3645
3646         * cygtls.h (struct _local_storage): Redefine process_ident as wchar_t
3647         pointer.
3648         * syslog.cc (CYGWIN_LOG_NAME): Convert to wide char constant.
3649         (openlog): Convert incoming ident string to wide char.  Fix formatting.
3650         (vsyslog): Print ident string as wide char string.  Convert message
3651         string to wide char and call UNICODE Win32 Event functions to make sure
3652         to use correct codeset.
3653         * tlsoffset.h: Regenerate.
3654
3655 2011-03-29  Corinna Vinschen  <corinna@vinschen.de>
3656
3657         * fhandler_socket.cc (get_inet_addr): Make externally available.
3658         * autoload.cc (GetUdpTable): Define.
3659         * syslog.cc (connect_syslogd): Use get_inet_addr rather than _stat64
3660         to check for local socket file.  Create socket with type returned by
3661         get_inet_addr.  If connect on UDP socket works, test if there's
3662         really a listening peer, otherwise fall back to Windows event log.
3663         (try_connect_syslogd): Use syslogd_inited flag to check if syslogd
3664         is available.
3665
3666 2011-03-29  Corinna Vinschen  <corinna@vinschen.de>
3667
3668         * uinfo.cc (cygheap_user::env_domain): Use LookupAccountSidW and
3669         convert user and domain to multibyte strings to make sure to use
3670         correct codeset.
3671
3672 2011-03-29  Corinna Vinschen  <corinna@vinschen.de>
3673
3674         * autoload.cc (UuidCreate): Remove.
3675         (UuidCreateSequential): Remove.
3676         * passwd.cc (internal_getpwsid): Avoid a strict-aliasing compiler
3677         error with gcc 4.5.1.
3678         * fhandler_floppy.cc (fhandler_dev_floppy::get_drive_info): Ditto.
3679         * ntdll.h (NtAllocateUuids): Declare.
3680         * syscalls.cc (gethostid): Use NtAllocateUuids function rather than
3681         UuidCreateSequential/UuidCreate to get rid of rpcrt4 dependency.
3682
3683 2011-03-29  Corinna Vinschen  <corinna@vinschen.de>
3684
3685         * cygwin.din (pthread_spin_destroy): Export.
3686         (pthread_spin_init): Export.
3687         (pthread_spin_lock): Export.
3688         (pthread_spin_trylock): Export.
3689         (pthread_spin_unlock): Export.
3690         * posix.sgml (std-susv4): Add pthread_spin_destroy, pthread_spin_init,
3691         pthread_spin_lock, pthread_spin_trylock, pthread_spin_unlock.
3692         (std-notimpl): Remove pthread_spin_[...].
3693         * pthread.cc (pthread_spin_init): New function.
3694         * thread.cc (pthread_spinlock::is_good_object): New function.
3695         (pthread_mutex::pthread_mutex): Rearrange initializers to accommodate
3696         protected data in pthread_mutex.
3697         (pthread_spinlock::pthread_spinlock): New constructor.
3698         (pthread_spinlock::lock): New method.
3699         (pthread_spinlock::unlock): New method.
3700         (pthread_spinlock::init): New method.
3701         (pthread_spin_lock): New function.
3702         (pthread_spin_trylock): New function.
3703         (pthread_spin_unlock): New function.
3704         (pthread_spin_destroy): New function.
3705         * thread.h (PTHREAD_SPINLOCK_MAGIC): Define.
3706         (class pthread_mutex): Change access level of members shared with
3707         derived classes to protected.
3708         (pthread_mutex::set_shared): New protected method.
3709         (class pthread_spinlock): New class, derived class of pthread_mutex.
3710         * include/pthread.h (pthread_spin_destroy): Declare.
3711         (pthread_spin_init): Declare.
3712         (pthread_spin_lock): Declare.
3713         (pthread_spin_trylock): Declare.
3714         (pthread_spin_unlock): Declare.
3715         * include/cygwin/types.h (pthread_spinlock_t): New typedef.
3716         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
3717
3718 2011-03-29  Corinna Vinschen  <corinna@vinschen.de>
3719
3720         * net.cc (SIO_BASE_HANDLE): Define.
3721         (fdsock): If we got an LSP handle, try to create a copy of the base
3722         handle instead.  Change comment to explain.
3723
3724 2011-03-29  Corinna Vinschen  <corinna@vinschen.de>
3725
3726         * include/cygwin/version.h: Bump CYGWIN_VERSION_DLL_MINOR to 10.
3727
3728 2011-03-29  Corinna Vinschen  <corinna@vinschen.de>
3729
3730         * autoload.cc (winmm): Remove time functions.  Don't treat
3731         unloadable wave functions as fatal.
3732         * hires.h (hires_ms::timeGetTime_ns): New private method.
3733         (hires_ms::dmsecs): Call timeGetTime_ns here.
3734         * ntdll.h (struct _KSYSTEM_TIME): Define.
3735         (KUSER_SHARED_DATA): Redefine to allow access to InterruptTime.
3736         (SharedUserData): Define here.
3737         (NtQueryTimerResolution): Declare.
3738         (NtSetTimerResolution): Declare.
3739         * path.cc (SharedUserData): Move to ntdll.h.
3740         * times.cc (hires_ms::timeGetTime_ns): New private method.
3741         Use throughout instead of timeGetTime.  Document entire functionality
3742         of timeGetTime in case we need it.
3743         (hires_ms::resolution): Try a call to NtQueryTimerResolution
3744         to fetch current period.  Fall back to heuristic if that fails.
3745         Cast to DWORD in assignments to minperiod.
3746         (clock_setres): Align period to possible values per a call to
3747         NtQueryTimerResolution.  Explain why.  Replace calls to timeBeginPeriod
3748         and timeEndPeriod with underlying call to NtSetTimerResolution.  Use
3749         status code from NtSetTimerResolution to compute errno.
3750         Convert period to ULONGLONG and store 100ns value to simplify code.
3751
3752 2011-03-29  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
3753             Corinna Vinschen  <corinna@vinschen.de>
3754
3755         * include/sys/xattr.h: New file.
3756
3757 2011-03-28  Jon TURNEY  <jon.turney@dronecode.org.uk>
3758
3759         * thread.cc (semaphore::init, destroy, close): Standards conformance
3760         fix.  On a failure, return -1 and set errno.
3761         * thread.h (semaphore::terminate): Save errno since semaphore::close()
3762         may now modify it.
3763
3764 2011-03-27  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
3765
3766         * cygwin.din (strchrnul): Export.
3767         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
3768         * posix.sgml (std-gnu): Add strchrnul.
3769
3770 2011-03-27  Christopher Faylor  <me.cygwin2011@cgf.cx>
3771
3772         * dll_init.cc (dll::init): Accommodate ill-behaved dlls who don't fill
3773         out p.envptr.
3774
3775 2011-03-25  Corinna Vinschen  <corinna@vinschen.de>
3776
3777         * mmap.cc (mmap64): Add a cheat to let a certain autoconf test succeed
3778         on 64 bit systems.  Explain why.
3779
3780 2011-03-23  Christopher Faylor  <me.cygwin2011@cgf.cx>
3781
3782         * wincap.cc (wincap_2003): Set use_dont_resolve_hack to true.
3783
3784 2011-03-23  Christopher Faylor  <me.cygwin2011@cgf.cx>
3785
3786         * autoload.cc (dll_load): Change error message to make it clear if a
3787         newer DLL is being run.
3788
3789 2011-03-20  Corinna Vinschen  <corinna@vinschen.de>
3790
3791         * fenv.cc (_feinitialise): Don't use SSE instructions on systems not
3792         supporting them.
3793         * wincap.h (wincaps::supports_sse): New element.
3794         * wincap.cc: Implement above element throughout.
3795
3796 2011-03-18  Corinna Vinschen  <corinna@vinschen.de>
3797
3798         * cygwin.sc: Raise default cygheap size to 2 Megs.
3799
3800 2011-03-18  Christopher Faylor  <me.cygwin2011@cgf.cx>
3801
3802         * fhandler.h (DEFAULT_PIPEBUFSIZE): Reset to 64K.
3803
3804 2011-03-18  Corinna Vinschen  <corinna@vinschen.de>
3805
3806         * mmap.cc (mmap_record::alloc_fh): Initialize name strings in fdev to
3807         empty strings or suffer a SEGV.  Drop second parameter in call to
3808         build_fh_dev.
3809
3810 2011-03-18  Corinna Vinschen  <corinna@vinschen.de>
3811
3812         * mmap.cc (class mmap_record): Pack 4 byte-aligned.  Convert member dev
3813         to plain int.
3814         (mmap_record::alloc_fh): Create temporary device from dev and use in
3815         call to build_fh_dev.
3816
3817 2011-03-18  Corinna Vinschen  <corinna@vinschen.de>
3818
3819         * mmap.cc (mmap_record::page_map): Define as variable array rather than
3820         as pointer.
3821         (mmap_record::alloc_page_map): Remove.
3822         (mmap_record::free_page_map): Remove.
3823         (mmap_record::init_page_map): New method.
3824         (mmap_record::add_record): Take mmap_record parameter by reference
3825         rather than by value.
3826         (mmap_record::map_pages): Fix comment.
3827         (mmap_list::add_record): Allocate space for mmap_record including the
3828         page_map in a single ccalloc call.  Call init_page_map afterwards.
3829         (mmap_list::del_record): Remove call to mmap_record::free_page_map.
3830
3831 2011-03-16  Corinna Vinschen  <corinna@vinschen.de>
3832
3833         * crt0.c (mainCRTStartup): Move call to _feinitialise from here...
3834         * dcrt0.cc (_dll_crt0): ...to here.
3835
3836 2011-03-16  Corinna Vinschen  <corinna@vinschen.de>
3837
3838         * winver.rc: Fix copyright dates.
3839
3840 2011-03-14  Corinna Vinschen  <corinna@vinschen.de>
3841
3842         * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Only use
3843         file id as inode number if it masters the isgood_inode check.
3844
3845 2011-03-13  Christopher Faylor  <me.cygwin2011@cgf.cx>
3846
3847         * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Remove
3848         special treatment for ERROR_NO_SYSTEM_RESOURCES.  Cancel I/O and reset
3849         the overlapped handle on error.
3850         (fhandler_base_overlapped::write_overlapped): Limit writes to
3851         max_atomic_write bytes in blocking case.  Incorporate code from
3852         now-defunct write_overlapped_fallback.  Fix serious oversight where ptr
3853         was not advanced as buffer was written.
3854         (fhandler_base_overlapped::write_overlapped_fallback): Eliminate.
3855         * fhandler.h (fhandler_base_overlapped::write_overlapped_fallback):
3856         Ditto for declaration.
3857         (DEFAULT_PIPEBUFSIZE): Lower size to slightly less than documented
3858         worst-case atomic write size.
3859         (fhandler_overlapped::wait_return): Remove unused element.
3860
3861 2011-03-09  Christopher Faylor  <me.cygwin2011@cgf.cx>
3862
3863         * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Handle
3864         overlapped_fallback error condition like other error conditions.  Set
3865         res carefully and specifically for each condition rather than resorting
3866         to a default.
3867         (fhandler_base_overlapped::write_overlapped): Preserve errno in
3868         overlapped_fallback condition.  Correct write_overlapped_fallback to
3869         avoid inappropriate looping.
3870         (fhandler_base_overlapped::write_overlapped_fallback): Add some more
3871         comments.
3872
3873 2011-03-09  Christopher Faylor  <me.cygwin2011@cgf.cx>
3874
3875         * fhandler.cc (fhandler_base_overlapped::write_overlapp): Oops!
3876         Accommodate change in arguments to wait_overlapped.
3877
3878 2011-03-09  Christopher Faylor  <me+cygwin@cgf.cx>
3879
3880         * errno.cc (errmap): Change mapping of NO_SYSTEM_RESOURCES to EFBIG.
3881         * fhandler.cc (MAX_OVERLAPPED_WRITE_LEN): New constant.
3882         (MIN_OVERLAPPED_WRITE_LEN): Ditto.
3883         (fhandler_base_overlapped::close): Accommodate change in arguments to
3884         wait_overlapped.
3885         (fhandler_base_overlapped::setup_overlapped): Add __stdcall and regparm
3886         modifiers.
3887         (fhandler_base_overlapped::destroy_overlapped): Ditto.
3888         (fhandler_base_overlapped::has_ongoing_io): Ditto.
3889         (fhandler_base_overlapped::wait_overlapped): Modify to return an enum
3890         returning various states.  Accept nonblocking parameter.
3891         (fhandler_base_overlapped::read_overlapped): Add __stdcall and regparm
3892         modifiers.  Rework to attempt to be smarter about reacting to states
3893         returned by wait_overlapped.
3894         (fhandler_base_overlapped::write_overlapped): Ditto.  Add fallback
3895         option for when wait_overlapped detects that smaller chunks must be
3896         written.
3897         (fhandler_base_overlapped::write_overlapped_fallback): Ditto.
3898         * fhandler.h (DEFAULT_PIPEBUFSIZE): Move definition here from pipe.cc.
3899         (fhandler_base::has_ongoing_io): Define with __stdcall and regparm
3900         modifiers.
3901         (fhandler_base_overlapped::wait_return): New enum.
3902         (fhandler_base_overlapped::max_atomic_write): New variable.
3903         (fhandler_base_overlapped:: wait_overlapped): Accommodate changes
3904         mentioned above to arguments and modifiers.
3905         (fhandler_base_overlapped::setup_overlapped): Ditto for modifiers.
3906         (fhandler_base_overlapped::read_overlapped): Ditto.
3907         (fhandler_base_overlapped::write_overlapped): Ditto.
3908         (fhandler_base_overlapped::destroy_overlapped): Ditto.
3909         (fhandler_base_overlapped::has_ongoing_io): Ditto.
3910         (fhandler_base_overlapped::fhandler_base_overlapped): Zero
3911         max_atomic_write.
3912         * fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Set max_atomic_write
3913         to the size of the DEFAULT_PIPEBUFSIZE.
3914         (fhandler_fifo::wait): Accommodate change in arguments to
3915         wait_overlapped.
3916         * pipe.cc (fhandler_pipe::fhandler_pipe): Set max_atomic_write to the
3917         size of the DEFAULT_PIPEBUFSIZE.
3918         (fhandler_pipe::create_selectable): Allow minimum size of DEFAULT_PIPEBUFSIZE.
3919         (DEFAULT_PIPEBUFSIZE): Delete here, move to fhandler.h.
3920
3921 2011-03-08  Corinna Vinschen  <corinna@vinschen.de>
3922
3923         * security.cc: Fix copyright dates.
3924
3925 2011-03-08  Corinna Vinschen  <corinna@vinschen.de>
3926
3927         * fhandler.cc (fhandler_base::open): When creating a file on a
3928         filesystem supporting ACLs, create the file with WRITE_DAC access.
3929         Explain why.
3930         * fhandler_disk_file.cc (fhandler_disk_file::mkdir): Ditto for
3931         directories.
3932         * fhandler_socket.cc (fhandler_socket::bind): Ditto for sockets.
3933         * path.cc (symlink_worker): Ditto for symlinks.
3934         * security.cc (get_file_sd): Always call GetSecurityInfo for directories
3935         on XP and Server 2003.  Improve comment to explain why.
3936         (set_file_attribute): Explicitely cast mode_t value to bool in call to
3937         get_file_sd.
3938         * wincap.h (wincaps::use_get_sec_info_on_dirs): New element.
3939         * wincap.cc: Implement above element throughout.
3940
3941 2011-03-04  Corinna Vinschen  <corinna@vinschen.de>
3942
3943         * fhandler_procsys.cc (fhandler_procsys::exists): Rewrite.
3944         (fhandler_procsys::fill_filebuf): Fill buffer with valid string even if
3945         reading the symlink fails.
3946
3947 2011-03-03  Corinna Vinschen  <corinna@vinschen.de>
3948
3949         * posix_ipc.cc (ipc_cond_timedwait): If ipc_mutex_unlock fails, return
3950         actual error number.
3951         (_mq_send): Break loop if ipc_cond_timedwait returns with error.
3952         (_mq_receive): Ditto.
3953
3954 2011-03-03  Corinna Vinschen  <corinna@vinschen.de>
3955
3956         * errno.cc (__xpg_strerror_r): Add accidentally missing condition.
3957
3958 2011-03-02  Corinna Vinschen  <corinna@vinschen.de>
3959
3960         * fhandler_procsys.cc (fhandler_procsys::open): Call worker exists
3961         method, rather than wrapper.
3962
3963 2011-03-01  Christopher Faylor  <me+cygwin@cgf.cx>
3964
3965         * autoload.cc (dll_load): Avoid in_forkee test since this apparently
3966         fails even when not forked.
3967
3968 2011-03-01  Christopher Faylor  <me+cygwin@cgf.cx>
3969
3970         * include/cygwin/version.h: Bump CYGWIN_VERSION_DLL_MINOR to 9.
3971
3972 2011-02-28  Christopher Faylor  <me+cygwin@cgf.cx>
3973
3974         * autoload.cc (dll_load): Only perform DONT_RESOLVE_DLL_REFERENCES hack
3975         on systems which need it.
3976         * wincap.cc (use_dont_resolve_hack): Set as appropriate.
3977         * wincap.h (use_dont_resolve_hack): Define.
3978
3979 2011-02-28  Christopher Faylor  <me+cygwin@cgf.cx>
3980
3981         * autoload.cc (dll_load): Make inline.  Clarify logic.
3982
3983 2011-02-27  Corinna Vinschen  <corinna@vinschen.de>
3984
3985         * autoload.cc (dll_load): Only call LoadLibraryExW with
3986         DONT_RESOLVE_DLL_REFERENCES if a normal LoadLibrary call failed with
3987         ERROR_INVALID_ADDRESS.
3988         (LsaRegisterLogonProcess): Align comment to previous change.
3989
3990 2011-02-26  Christopher Faylor  <me+cygwin@cgf.cx>
3991
3992         * autoload.cc: Use LoadDLLfuncEx3 for all winmm functions.  Accommodate
3993         changes to LoadDLLprime.
3994         (LoadDLLprime): Take an extra argument indicating whether this dll
3995         needs special handling on fork.  Place this information in the "handle"
3996         location.
3997         (LoadDLLfuncEx3): Eliminate "func" handling.  Pass new
3998         no_resolve_on_fork argument to LoadDLLprime.
3999         (dll_load): New function.
4000         (std_dll_init): Accommodate changes to dll_info::handle.  Use dll_load
4001         to load DLL in both cases where it is used.
4002
4003 2011-02-26  Corinna Vinschen  <corinna@vinschen.de>
4004
4005         * autoload.cc: Make autoloaded ntdll function non-optional.  Ditto for
4006         secur32 functions, except for LsaRegisterLogonProcess.  Change return
4007         value to ERROR_PROC_NOT_FOUND.  Explain why.
4008         * sec_auth.cc (lsaauth): Handle ERROR_PROC_NOT_FOUND from call to
4009         LsaRegisterLogonProcess when generating the errno value.
4010
4011 2011-02-22  Corinna Vinschen  <corinna@vinschen.de>
4012
4013         * dcrt0.cc: Fix copyright dates.
4014         * winsup.h: Ditto.
4015         * syscalls.cc (_read): Move EXPORT_ALIAS to its rightful place.
4016
4017 2011-02-21  Christopher Faylor  <me+cygwin@cgf.cx>
4018
4019         * cygwin.din: Mark __assert* and _abort as NOSIGFE.
4020
4021 2011-02-21  Corinna Vinschen  <corinna@vinschen.de>
4022
4023         * fhandler_socket (fhandler_socket::readv): Call recv_internal directly,
4024         rather than recvmsg.
4025         (fhandler_socket::writev): Call send_internal directly, rather than
4026         sendmsg.
4027         * net.cc (cygwin_recv): Call fhandler_socket::recvfrom directly, rather
4028         than cygwin_recvfrom.
4029         (cygwin_send): Call fhandler_socket::sendto directly, rather than
4030         cygwin_sendto.
4031
4032 2011-02-20  Christopher Faylor  <me+cygwin@cgf.cx>
4033
4034         * fhandler.cc (fhandler_base_overlapped::close): Finish any pending I/O
4035         before closing.
4036         (fhandler_base_overlapped::wait_overlapped): Defensively zero bytes
4037         read.  Add more info to debugging output.
4038
4039 2011-02-18  Christopher Faylor  <me+cygwin@cgf.cx>
4040
4041         * dcrt0.cc (dll_crt0_1): Add a CYGHEAP_DEBUG conditional for debugging
4042         which allocates a lot of space at startup.
4043
4044 2011-02-18  Corinna Vinschen  <corinna@vinschen.de>
4045
4046         * cygwin.sc: Set alignment of .cygheap section to 64K.
4047
4048 2011-02-15  Corinna Vinschen  <corinna@vinschen.de>
4049
4050         * spawn.cc (spawn_guts): Only set PID_NOTCYGWIN in _P_OVERLAY mode.
4051         Drop flag if creating new process failed.
4052
4053 2011-02-15  Corinna Vinschen  <corinna@vinschen.de>
4054
4055         * Throughout fix copyright dates.
4056
4057 2011-02-15  Corinna Vinschen  <corinna@vinschen.de>
4058
4059         * devices.in: Throughout use slashes instead of backslashes in the
4060         native path of devices not backed by native NT devices.
4061         * devices.cc: Regenerate.
4062         * globals.cc (ro_u_pmem): Use correct case.
4063         (ro_u_globalroot): New R/O unicode string.
4064         * path.cc (path_conv::check): Fix incorrect handling of /proc/sys
4065         block devices if they are just visited due to a component check.
4066         (symlink_info::posixify): Fix typo in comment.
4067         (cygwin_conv_path): Use ro_u_globalroot instead of string constant.
4068         (fast_cwd_version): New shared variable to store FAST_CWD version
4069         used on the system.
4070         (find_fast_cwd_pointer): Rename from find_fast_cwd_pointers.  Don't
4071         set global fast_cwd_ptr pointer here.  Return pointer value instead.
4072         (find_fast_cwd): New function to set fast_cwd_ptr and fast_cwd_version.
4073         (cwdstuff::override_win32_cwd): Call find_fast_cwd from here.
4074         Check for fast_cwd_version to differ between old and new FAST_CWD
4075         structure.  Check old_cwd for NULL to avoid SEGV.  Don't set CWD if
4076         we have neitehr a valid fast_cwd_ptr, nor a valid CWD handle in the
4077         process parameter block.
4078         (cwdstuff::set): Create Win32 path taking /proc/sys paths into account.
4079         * spawn.cc (spawn_guts): Recode creating runpath.  Also take /proc/sys
4080         paths into account.  Drop special CWD handling when starting non-Cygwin
4081         processes.
4082
4083 2011-02-15  Corinna Vinschen  <corinna@vinschen.de>
4084
4085         * fhandler_procsys.cc (fhandler_procsys::opendir): Avoid SEGV if
4086         opening object directory fails.
4087         * fhandler_virtual.cc (fhandler_virtual::opendir): Don't leak memory.
4088
4089 2011-02-15  Corinna Vinschen  <corinna@vinschen.de>
4090
4091         * fhandler_disk_file.cc (fhandler_disk_file::readdir_helper): Don't
4092         append slash if there is one already.
4093
4094 2011-02-15  Corinna Vinschen  <corinna@vinschen.de>
4095
4096         Revert change from 2010-08-31:
4097         * path.cc (normalize_posix_path): Drop support for //./ and //?/
4098         prefixes.
4099         (path_conv::check): Ditto.
4100
4101 2011-02-15  Corinna Vinschen  <corinna@vinschen.de>
4102
4103         * fhandler_disk_file.cc (fhandler_disk_file::readdir_helper): Use POSIX
4104         path to check for symlink.
4105
4106 2011-02-14  Corinna Vinschen  <corinna@vinschen.de>
4107
4108         * config/i386/profile.h: Sync with Mingw.
4109
4110 2011-02-13  Corinna Vinschen  <corinna@vinschen.de>
4111
4112         * path.cc (struct _FAST_CWD): Redefine to new layout used since patch
4113         for KB 2393802.  Adjust comments throughout.
4114         (struct _FAST_CWD_OLD): Rename former definition.
4115         (cwdstuff::override_win32_cwd): Check if the OS is using the old or the
4116         new FAST_CWD structure layout and handle accordingly.
4117
4118 2011-02-11  Christopher Faylor  <me+cygwin@cgf.cx>
4119
4120         * mkstatic: Make sure that we are not cd'ed to temporary directory on
4121         exit to avoid bogus warnings on directory cleanup.
4122         * speclib: Ditto.
4123         * mkimport: Ditto.
4124
4125 2011-02-11  Christopher Faylor  <me+cygwin@cgf.cx>
4126
4127         * cygwin.sc: Eliminate __cygheap_mid.
4128         * cygheap.cc: Ditto.
4129
4130 2011-02-11  Christopher Faylor  <me+cygwin@cgf.cx>
4131
4132         * cygheap.cc (_cygheap_mid): Drop unneeded section attribute.
4133         (cygheap_init): Just zero cygheap structure.
4134         * cygwin.sc: Keep 16 byte alignment but drop all other alignments
4135         related to cygheap.  Eliminate unused __cygheap_end1.
4136
4137 2011-02-11  Corinna Vinschen  <corinna@vinschen.de>
4138
4139         * cygwin.sc: Raise default cygheap size to 1 Meg.  Set alignment to
4140         standard 64K.
4141
4142 2011-02-11  Corinna Vinschen  <corinna@vinschen.de>
4143
4144         * include/endian.h: Move definitions of __BIG_ENDIAN, __LITTLE_ENDIAN,
4145         and __BYTE_ORDER into ...
4146         * include/bits/endian.h: New file.
4147         * include/arpa/nameser_compat.h: Include endian.h rather than defining
4148         BYTE_ORDER here.
4149         * include/asm/byteorder.h: Include bits/endian.h.  Drop definition of
4150         __LITTLE_ENDIAN.
4151         * include/netinet/ip.h: Include bits/endian.h.  Drop definitions of
4152         BIG_ENDIAN, LITTLE_ENDIAN, and BYTE_ORDER.  Use underscored variants
4153         of aforementioned constants.
4154         * include/netinet/tcp.h: Ditto.
4155         * include/sys/param.h: Drop disabled definitions of BIG_ENDIAN,
4156         LITTLE_ENDIAN, and BYTE_ORDER.
4157
4158         * include/netinet/ip.h: Reformat.  Define setsockopt IP_TOS options
4159         matching recent RFCs.  Tweak comments.
4160
4161 2011-02-10  Eric Blake  <eblake@redhat.com>
4162
4163         * errno.cc (includes): Avoid compilation failure if <string.h>
4164         settles on wrong strerror_r signature.
4165
4166         * errno.cc (__xpg_strerror_r): New function.
4167         (strerror_r): Update to copy newlib's fixes.
4168         (strerror): Set errno on failure.
4169         (_sys_errlist): Cause EINVAL failure for reserved values.
4170         * cygwin.din: Export new function.
4171         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Combine
4172         this into minor 236.
4173
4174 2011-02-09  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
4175
4176         * cygwin.din (pthread_yield): Export as alias to sched_yield.
4177         * include/pthread.h (pthread_yield): Declare.
4178         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
4179         * posix.sgml (std-deprec): Add pthread_yield.
4180
4181 2011-02-09  Christopher Faylor  <me+cygwin@cgf.cx>
4182
4183         * cygheap.cc: Add some __stdcall decoration where appropriate.
4184         * lib/cygwin_crt0.c: __attribute -> __attribute__.
4185
4186 2011-02-09  Christopher Faylor  <me+cygwin@cgf.cx>
4187
4188         * hookapi.cc (hook_or_detect_cygwin): Prevent i from being considered
4189         uninitialized by gcc.
4190
4191 2011-02-09  Christopher Faylor  <me+cygwin@cgf.cx>
4192
4193         * exception.h: Remove DEBUG_EXCEPTION left over debugging ifdef.
4194
4195 2011-02-08  Christopher Faylor  <me+cygwin@cgf.cx>
4196
4197         * dll_init.cc: Fix typo in comment.
4198
4199 2011-02-07  Corinna Vinschen  <corinna@vinschen.de>
4200
4201         * configure.in: Remove AC_ALLOCA test and test for __builtin_memset.
4202         * configure: Regenerate.
4203
4204 2011-02-07  Corinna Vinschen  <corinna@vinschen.de>
4205
4206         * fhandler_console.cc (fhandler_console::write_normal): Remove
4207         erroneous premature return after collecting truncated multibyte
4208         sequence in trunc_buf.  Rather fall through to printing routine.
4209         Fix return value to take trunc_buf content into account.  Improve
4210         comments.
4211
4212 2011-02-05  Christopher Faylor  <me+cygwin@cgf.cx>
4213
4214         * autoload.cc (wsock_init): Properly define WSAStartup function pointer
4215         to avoid stack damage.
4216
4217 2011-02-02  Corinna Vinschen  <corinna@vinschen.de>
4218
4219         * libc/bsdlib.cc: Include err.h.
4220
4221 2011-02-02  Eric Blake  <eblake@redhat.com>
4222
4223         * include/err.h: Fix loss of semicolons in previous patch.
4224
4225 2011-02-02  Corinna Vinschen  <corinna@vinschen.de>
4226
4227         * include/err.h (err): Add noreturn attribute.
4228         (errx): Ditto.
4229         (verr): Ditto.
4230         (verrx): Ditto.
4231
4232 2011-02-02  Corinna Vinschen  <corinna@vinschen.de>
4233
4234         * path.cc (conv_path_list): Remove enclosing quotes and trailing
4235         backslashes from Win32 environment path lists.
4236
4237 2011-02-01  Christian Franke  <franke@computer.org>
4238
4239         * fhandler.cc (fhandler_base::fsync): Ignore ERROR_INVALID_FUNCTION
4240         error from FlushFileBuffers().
4241
4242 2011-01-31  Corinna Vinschen  <corinna@vinschen.de>
4243
4244         * syscalls.cc (utmp_data): Fix potential buffer overflow.
4245
4246 2011-01-31  Corinna Vinschen  <corinna@vinschen.de>
4247
4248         * fhandler_socket.cc (address_in_use): Improve comment readability.
4249
4250 2011-01-30  Corinna Vinschen  <corinna@vinschen.de>
4251
4252         * fhandler_socket.cc (address_in_use): Disable.  Add comment.
4253         (fhandler_socket::bind): Change comment to explain setting the
4254         SO_EXCLUSIVEADDRUSE socket option.  Remove code which checks for
4255         address in use.
4256         * net.cc (cygwin_setsockopt): Never set SO_REUSEADDR option.  Improve
4257         comment to compensate for the deleted comment in fhandler_socket::bind.
4258         * wincap.cc: Throughout, drop has_enhanced_socket_security from wincaps.
4259         * wincap.h (struct wincaps): Drop has_enhanced_socket_security flags
4260         and method.
4261
4262 2011-01-28 Peter Foley <jpfoley2@verizon.net>
4263
4264         * configure.in: Define LIBSERVER regardless of cross_host.
4265         * configure: Regenerate.
4266
4267 2011-01-28  Corinna Vinschen  <corinna@vinschen.de>
4268
4269         * fhandler_socket.cc (fhandler_socket::wait_for_events): Call
4270         pthread_testcancel in case of timeout to enable pthread_cancel
4271         on waiting thread.
4272
4273 2011-01-27  Corinna Vinschen  <corinna@vinschen.de>
4274
4275         * include/features.h (__STDC_ISO_10646__): Move to newlib's
4276         sys/features.h.
4277
4278 2011-01-26  Corinna Vinschen  <corinna@vinschen.de>
4279
4280         * fhandler_disk_file.cc (fhandler_base::fstat_by_nfs_ea): Fix
4281         computation of st_blocks.
4282         (fhandler_base::fstat_helper): Fix formatting.
4283
4284 2011-01-24  Corinna Vinschen  <corinna@vinschen.de>
4285
4286         * include/features.h (__STDC_ISO_10646__): Define.  Add comment.
4287
4288 2011-01-21  Corinna Vinschen  <corinna@vinschen.de>
4289
4290         * syscalls.cc (rename): Fix permission problem with symlinks on NFS.
4291         Rework how NtOpenFile gets called to make it more readable.  Change
4292         comment.
4293
4294 2011-01-20  Corinna Vinschen  <corinna@vinschen.de>
4295
4296         * exec.cc: Include pinfo.h.
4297         * winf.h: Move definitions of _P_PATH_TYPE_EXEC and _P_MODE from here...
4298         * pinfo.h: ...to here.
4299         (_P_PATH_TYPE_EXEC): Redefine to be bigger than _P_SYSTEM.
4300         (_P_MODE): Redefine so as not to mask out _P_SYSTEM.
4301         * spawn.cc (spawnlp): Add _P_PATH_TYPE_EXEC flag in call to spawnve.
4302         (spawnlpe): Ditto.
4303         (spawnvp): Ditto.
4304
4305 2011-01-19  Corinna Vinschen  <corinna@vinschen.de>
4306
4307         * spawn.cc (av::fixup): Reenable #! handling for all exec functions.
4308         Return ENOEXEC in !p_type_exec case only for unrecognized files.
4309         Fix comment formatting.
4310
4311 2011-01-19  Corinna Vinschen  <corinna@vinschen.de>
4312
4313         * exec.cc (execlp): Add missing _P_PATH_TYPE_EXEC flag in call to
4314         spawnve.
4315
4316 2011-01-19  Corinna Vinschen  <corinna@vinschen.de>
4317
4318         * exec.cc: Rearrange functions in alphabetical order.
4319         (_execve): Drop temporary define and drop export alias.
4320         (execl): Call spawnve.
4321         (execle): New function.
4322         (execlp): New function.
4323         (execv): Call spawnve.
4324         (execve): Drop converting NULL envp to emtpy envp.
4325         (execvp): Call spawnve.
4326         (execvpe): Drop converting NULL envp to emtpy envp.  Call spawnve.
4327         (fexecve): Call spawnve.
4328         * spawn.cc (spawnve): Convert NULL envp to emtpy envp.  Remove outdated
4329         comment.
4330         (spawnlp): Call spawnve.
4331         (spawnlpe): Ditto.
4332         (spawnvp): Ditto.
4333         (spawnvpe): Fix formatting.
4334
4335 2011-01-19  Corinna Vinschen  <corinna@vinschen.de>
4336
4337         * exec.cc (strccpy): Move function from here...
4338         * strfuncs.cc (strccpy): ...to here.
4339         * string.h (strccpy): Declare.
4340         * winsup.h (strccpy): Drop declaration.
4341
4342 2011-01-19  Corinna Vinschen  <corinna@vinschen.de>
4343
4344         * errno.cc (errmap): Add error codes for invalid binaries.
4345         * exec.cc (execvp): Call spawnve with _P_PATH_TYPE_EXEC flag
4346         from here.
4347         (execvpe): Ditto.
4348         * spawn.cc (spawn_guts): Filter _P_PATH_TYPE_EXEC from mode and
4349         store in p_type_exec.  Call av::fixup with addtional p_type_exec
4350         argument.
4351         (spawnve): Check for filtered mode.
4352         (spawnvpe): Add _P_PATH_TYPE_EXEC flag when calling spawnve.
4353         (av::fixup): Accept additional bool parameter p_type_exec.  Only check
4354         for script if p_type_exec is true.
4355         * winf.h (_P_PATH_TYPE_EXEC): Define.
4356         (_P_MODE): Define.
4357         (av::fixup): Declare with additional bool parameter.
4358
4359 2011-01-17  Corinna Vinschen  <corinna@vinschen.de>
4360
4361         * fhandler_proc.cc (format_proc_partitions): Fix compiler warning.
4362
4363 2011-01-17  Corinna Vinschen  <corinna@vinschen.de>
4364
4365         * path.cc (path_conv::check): Don't follow reparse point symlinks if
4366         PC_SYM_NOFOLLOW_REP flag is set.
4367         (cygwin_conv_path): Set PC_SYM_NOFOLLOW_REP flag when converting from
4368         POSIX to Win32.
4369         * path.h (enum pathconv_arg): Define PC_SYM_NOFOLLOW_REP flag.
4370
4371 2011-01-17  Corinna Vinschen  <corinna@vinschen.de>
4372
4373         * fhandler_proc.cc (proc_tab_cmp): Fix typo in comment.
4374         (fhandler_proc::fill_filebuf): Handle return value of 0 from format
4375         function as error.
4376         (format_proc_stat): Set errno when returning 0 size.
4377         (format_proc_partitions): Rewrite method to fetch partition info.
4378
4379 2011-01-13  Corinna Vinschen  <corinna@vinschen.de>
4380
4381         * fhandler_disk_file.cc (fhandler_base::fstat_helper): Always set
4382         st_size of directories to 0.  Explain why.
4383
4384 2011-01-12  Corinna Vinschen  <corinna@vinschen.de>
4385
4386         * posix.sgml: Add madvise to BSD list.
4387
4388 2011-01-12  Corinna Vinschen  <corinna@vinschen.de>
4389
4390         * cygwin.din (madvise): Export posix_madvise as madvise.
4391         * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR.
4392         * include/sys/mman.h: Define madvise constants, keep Linux-specific
4393         constants undefined.
4394         (madvise): Declare.
4395
4396 2011-01-12  Corinna Vinschen  <corinna@vinschen.de>
4397
4398         * fhandler.h (struct part_t): New type.
4399         (class fhandler_dev_floppy): Convert partitions to part_t pointer.
4400         Add lock_partition method.
4401         * fhandler_floppy.cc (fhandler_dev_floppy::lock_partition): New method
4402         to implement ondemand partition locking.
4403         (fhandler_dev_floppy::write_file): Call lock_partition from here if
4404         writing failed due to a potential write restriction on a disk
4405         partition.
4406         (fhandler_dev_floppy::open): Don't lock partitions here.
4407         (fhandler_dev_floppy::close): Keep track of partition handle reference
4408         count.  Close handles and remove partitions pointer ony if count is 0.
4409         (fhandler_dev_floppy::dup): Just copy partitions pointer and increment
4410         reference count.
4411
4412 2011-01-11  Corinna Vinschen  <corinna@vinschen.de>
4413
4414         * fhandler.h (MAX_PARTITIONS): New definition.
4415         (class fhandler_dev_floppy): Add partitions array member.  Add close
4416         method.
4417         * fhandler_floppy.cc (fhandler_dev_floppy::fhandler_dev_floppy): Zero
4418         out partitions array.
4419         (fhandler_dev_floppy::open): Fix "entire disk" condition for call to
4420         DeviceIoControl (FSCTL_ALLOW_EXTENDED_DASD_IO).
4421         When opening disks for writing, call DeviceIoControl (FSCTL_LOCK_VOLUME)
4422         on all affected disk partitions starting with Vista.
4423         (fhandler_dev_floppy::close): New method.
4424         (fhandler_dev_floppy::dup): Duplicate handles in partitions, if any.
4425         * wincap.h (wincaps::has_restricted_raw_disk_access): New element.
4426         * wincap.cc: Implement above element throughout.
4427
4428 2011-01-11  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
4429
4430         * termios.cc (cfgetospeed, cfgetispeed): Constify argument per POSIX.
4431         * include/sys/termios.h (cfgetospeed, cfgetispeed): Declare functions.
4432         Move macros after declarations and make conditional on !__cplusplus.
4433
4434 2011-01-11  Corinna Vinschen  <corinna@vinschen.de>
4435
4436         * cygtls.cc (_cygtls::init_thread): Call _REENT_INIT_PTR.  Drop setting
4437         current locale and calling srand48.
4438
4439 2011-01-02  Christopher Faylor  <me+cygwin@cgf.cx>
4440
4441         * ChangeLog-2010: Create from ChangeLog.
4442         * ChangeLog: Start fresh.