OSDN Git Service

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