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