1 2005-09-28 Corinna Vinschen <corinna@vinschen.de>
3 * fhandler.h (class fhandler_dev_raw): Delete current_position and
4 eof_detected status flag. Delete is_eom and is_eof methods.
5 Move drive_size, bytes_per_sector, eom_detected status flag, as well
6 as the methods read_file, write_file, raw_read and raw_write to ...
7 (class fhandler_dev_floppy): ... here. Remove is_eom and is_eof
8 methods. Add dup method.
9 * fhandler_floppy.cc (IS_EOM): New macro.
10 (fhandler_dev_floppy::is_eom): Remove.
11 (fhandler_dev_floppy::is_eof): Remove.
12 (fhandler_dev_floppy::fhandler_dev_floppy): Initialize status flags.
13 (fhandler_dev_floppy::get_drive_info): Only call EX functions on
14 systems supporting them and stop suffering strange delays.
15 (fhandler_dev_floppy::read_file): Move here, drop setting
17 (fhandler_dev_floppy::write_file): Move here, drop setting
19 (fhandler_dev_floppy::open): Rearrange comment.
20 (fhandler_dev_floppy::dup): New method.
21 (fhandler_dev_floppy::get_current_position): New inline method. Use
22 instead of former current_position were appropriate.
23 (fhandler_dev_floppy::raw_read): Move here. Drop EOF handling.
24 (fhandler_dev_floppy::raw_write): Move here. Drop EOF handling.
25 (fhandler_dev_floppy::lseek): Remove useless conditions. Convert
26 sector_aligned_offset to LARGE_INTEGER to improve SetFilePointer call.
27 (fhandler_dev_floppy::ioctl): Move blocksize check in RDSETBLK case
29 * fhandler_raw.cc (fhandler_dev_raw::is_eom): Remove.
30 (fhandler_dev_raw::is_eof): Remove.
31 (fhandler_dev_raw::write_file): Remove.
32 (fhandler_dev_raw::read_file): Remove.
33 (fhandler_dev_raw::raw_read): Remove.
34 (fhandler_dev_raw::raw_write): Remove.
35 (fhandler_dev_raw::dup): Drop copying removed members.
36 (fhandler_dev_raw::ioctl): Drop blocksize testing.
37 * wincap.h: Implement has_disk_ex_ioctls throughout.
39 (wincap_vista): Preliminary wincaps for Windows Vista/Longhorn.
40 (wincapc::init): Add Vista/Longhorn handling.
42 2005-09-28 Christopher Faylor <cgf@timesys.com>
44 * dcrt0.cc (getstack): New function.
45 (alloc_stack): Use tls stuff for stack info rather than calling
47 (dll_crt0_0): Initialize _impure_ptr stuff much earlier. Move
48 init_console_handler here.
49 * fork.cc (class frok): New class renamed from local fork() struct.
50 (stack_base): Change argument type. Use tls stuff to determine stack
51 info rather than calling VirtualQuery.
52 (frok::child): Rename from fork_child. Eliminate now unneeded
54 (frok::parent): Rename from fork_parent and ditto. Set error and errno
55 as appropriate. Fixup impersonation in cleanup, if needed. Try harder
56 to set errno appropriately.
57 (fork): Define "grouped" as a frok type. Deal with errors from
59 * init.cc (dll_entry): Remove init_console_handler call.
61 2005-09-28 Christopher Faylor <cgf@timesys.com>
63 * pinfo.cc (_pinfo::dup_proc_pipe): Ignore error if the child process
66 2005-09-27 Christopher Faylor <cgf@timesys.com>
68 * init.cc (prime_threads): Make this static, as it should be.
69 (dll_entry): Apply cosmetic changes to define closer to the way MSDN
72 2005-09-27 Corinna Vinschen <corinna@vinschen.de>
74 * pthread.cc (mangle_sem_name): Use cygheap->shared_prefix instead
75 of fiddling with wincap.has_terminal_services manually.
77 2005-09-27 Corinna Vinschen <corinna@vinschen.de>
79 * cygheap.cc (cygheap_init): Add GLOBAL_PRIV to hProcToken explicitely
80 since hProcImpToken isn't initialized here.
81 * shared.cc (open_shared): Always print mapname instead of name in
84 2005-09-27 Christopher Faylor <cgf@timesys.com>
86 * strace.cc (strace::vsprntf): Avoid printing a zero pid.
88 2005-09-27 Corinna Vinschen <corinna@vinschen.de>
90 * init.cc (dll_entry): Call IsWow64Process with GetCurrentProcess
91 as process handle since hMainProc isn't initialized here.
93 2005-09-27 Corinna Vinschen <corinna@vinschen.de>
95 * fhandler_floppy.cc (fhandler_dev_floppy::get_drive_info): Always
96 try IOCTL_DISK_GET_DRIVE_GEOMETRY_EX and
97 IOCTL_DISK_GET_PARTITION_INFO_EX ioctls first, to allow access to GPT
98 partitioned disks. Fall back to old non-EX ioctls otherwise.
99 Add comment to explain NT4 weirdness.
101 2005-09-26 Corinna Vinschen <corinna@vinschen.de>
103 * errno.cc (errmap): Map ERROR_SEEK and ERROR_SECTOR_NOT_FOUND.
105 2005-09-26 Christopher Faylor <cgf@timesys.com>
107 * exceptions.cc (_cygtls::call_signal_handler): Minor cleanup.
109 2005-09-26 Corinna Vinschen <corinna@vinschen.de>
111 * fhandler.h (class fhandler_dev_raw): Add drive information members
112 drive_size, current_position and bytes_per_sector.
113 (fhandler_dev_floppy::get_drive_info): Declare.
114 * fhandler_floppy.cc (fhandler_dev_floppy::is_eom): Define ERROR_SEEK
115 and ERROR_SECTOR_NOT_FOUND as end-of-medium conditions.
116 (fhandler_dev_floppy::get_drive_info): New method to have one function
117 retrieving drive info.
118 (fhandler_dev_floppy::open): Call get_drive_info to get drive
119 information right from the start.
120 (fhandler_dev_floppy::lseek): Use and set drive information members.
121 Especially keep track of current_position.
122 (fhandler_dev_floppy::ioctl): Ditto.
123 * fhandler_raw.cc (fhandler_dev_raw::write_file): Keep track of
125 (fhandler_dev_raw::read_file): Ditto.
126 (fhandler_dev_raw::raw_read): Never try to read beyond end-of-medium.
127 (fhandler_dev_raw::dup): Handle new drive information members.
129 2005-09-26 Christopher Faylor <cgf@timesys.com>
131 * exceptions.cc (handle_exceptions): Just si_code to SI_KERNEL first
132 and let it be overridden.
134 2005-09-26 Yitzchak Scott-Thoennes <sthoenna@efn.org>
136 * exceptions.cc (_cygtls::call_signal_handler): Call signal handler
137 with extra siginfo_t * and void * parameters when SA_SIGINFO flag is
139 * signal.cc (signal): Clear SA_SIGINFO flag.
140 (sigqueue): Fix incorrect setting of si_code.
141 * sigproc.cc (signal_fixup_after_exec): Clear SA_SIGINFO flag when
142 setting handler to SIG_DFL.
144 2005-09-26 Christopher Faylor <cgf@timesys.com>
146 * pinfo.cc (proc_waiter): Properly fill out si_code as according to SUSv3.
148 2005-09-26 Christopher Faylor <cgf@timesys.com>
150 * exceptions.cc (handle_exceptions): Properly fill out si_code as
153 2005-09-25 Christopher Faylor <cgf@timesys.com>
155 * sigproc.cc (wait_sig): Cosmetic change.
156 * pinfo.cc (pinfo::exit): Don't explicitly remove myself since some
157 other thread may still be using it.
159 2005-09-24 Christopher Faylor <cgf@timesys.com>
161 * sigproc.cc (sigproc_terminate): More reversion of
162 always-exit-from-sigthread change.
164 2005-09-23 Christopher Faylor <cgf@timesys.com>
166 * shared.cc (open_shared): Add crucial bit of debugging info.
168 2005-09-23 Christopher Faylor <cgf@timesys.com>
170 Semi-reversion of always-exit-from-sigthread change of 2005-09-15.
171 * exceptions.cc (sigpacket::process): Eliminate return after call to
172 reinstated noreturn function.
173 (signal_exit): Allow function to exit when a captive process has been
175 * pinfo.cc (pinfo::exit): Enter exit_lock here. Once again exit here
176 under control of exit_lock.
177 * sigproc.cc (sig_send): Don't wait for completion if process is exiting.
178 Remove special __SIGEXIT accommodations.
179 (wait_sig): Just exit the thread when a __SIGEXIT has been detected.
180 Don't exit the process.
182 2005-09-23 Christopher Faylor <cgf@timesys.com>
184 * net.cc (cygwin_gethostbyname): Remove debugging cruft.
186 2005-09-23 Christopher Faylor <cgf@timesys.com>
188 * pinfo.cc (pinfo::exit): Call ExitProcess if called from signal
191 2005-09-23 Christopher Faylor <cgf@timesys.com>
193 * pinfo.cc (pinfo::exit): Eliminate use of _my_tls.thread_handle.
194 * tlsoffsets.h: Regenerate.
196 2005-09-23 Christopher Faylor <cgf@timesys.com>
198 * cygtls.h (struct _cygtls::thread_handle): Remove/revert.
199 * sigproc.h (struct sipacket::thread_handle): Put thread_handle here.
200 * sigproc.cc (sigproc_terminate): Move setting of thread_handle...
201 (sig_send): ...to here. Put it in packet being sent. Only close
202 pack.wakeup when we're waiting for completion.
203 (wait_sig): Use thread_handle directly from received packet.
205 2005-09-22 Christopher Faylor <cgf@timesys.com>
207 * cygheap.cc (cygheap_fixup_in_child): It's not just for exec.
208 * cygtls.h (struct _cygtls::thread_handle): New field.
209 * dcrt0.cc (exit_lock): Remove declaration.
210 * winsup.h (exit_lock): Add declaration.
211 * exceptions.cc (sigpacket::process): Properly return after
213 * pinfo.cc (pinfo::exit): Only exit the process if
214 _my_tls.thread_handle has not been filled out -- which should be an
216 * sigproc.cc (sigproc_terminate): Fillout _my_tls.thread_handle to
217 provide something for wait_sig to wait for. Use the siginfo_t version
218 of sig_send and fill out the tls argument with _my_tls.
219 (wait_sig): Wait for the thread specified in pack.tls or (for now)
220 complain bitterly if it doesn't exit.
221 * tlsoffsets.h: Regenerate.
223 2005-09-22 Christopher Faylor <cgf@timesys.com>
225 * pinfo.cc (set_myself): Call strace.hello unconditionally when
227 (pinfo::init): Sleep and issue debugging output before looping when a
230 2005-09-22 Corinna Vinschen <corinna@vinschen.de>
232 * fhandler_disk_file.cc (fhandler_base::fstat_helper): Fix copy/paste
235 2005-09-22 Christopher Faylor <cgf@timesys.com>
237 * strace.cc (strace::vsprntf): Avoid accessing myself->pid if !myself.
239 2005-09-22 Christopher Faylor <cgf@timesys.com>
241 * include/sys/strace.h (_STRACE_ON): Remove semicolon from definition.
242 (_STRACE_OFF): Remove semicolon from definition.
244 2005-09-22 Corinna Vinschen <corinna@vinschen.de>
246 * fhandler.h (fhandler_base::fstat_helper): Declare with additional
247 file attributes argument.
248 * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Use
249 file attributes evaluated from NtQueryFileInformation or
250 FileInformationByHandle in call to fstat_helper.
251 Set pc.fileattr from just evaluated file attributes here.
252 (fhandler_base::fstat_by_name): Use file attributes evaluated from
253 FindFileFirst or default attribute in call to fstat_helper.
254 Set pc.fileattr from just evaluated file attributes here.
255 (fhandler_base::fstat_helper): Use file attributes given as argument,
256 not file attributes stored in this fhandler, since this information
257 is potentially wrong. Add comment to explain this.
258 * path.h (has_attribute): New global inline function.
259 (path_conv::set_attributes): New method to change fileattr.
261 2005-09-21 Christopher Faylor <cgf@timesys.com>
263 * cygthread.cc (cygthread::operator new): Just use getenv() to look for
264 CYGWIN_FREERANGE_NOCHECK since the Windows environment may be truncated
265 by being previously execed.
267 2005-09-20 Christopher Faylor <cgf@timesys.com>
269 * spawn.cc (av::fixup): Just blindly run any file if it has a .bat or
272 2005-09-19 Christopher Faylor <cgf@timesys.com>
274 * dcrt0.cc (do_exit): Only call sigproc_terminate from one location --
276 * pinfo.cc (pinfo::exit): Move sigproc_terminate later so that signals
277 can be processed while waiting for hExeced child.
278 (pinfo::maybe_set_exit_code_from_windows): Set exit code from sigExeced
279 if it is non-zero. Set exit_state to ES_EXEC_EXIT prior to waiting for
280 captive process exit code.
281 * exceptions.cc (sigExeced): New global variable.
282 (signal_exit): Remove noreturn attribute from declaration.
283 (signal_exit): Just terminate captive process and return if hExeced on
284 the theory that the exit will be subsequently handled in the main
286 * sigproc.cc (sigproc_terminate): Eliminate test for
287 ES_SIGPROCTERMINATE and use ES_FINAL instead.
288 (sig_send): Use no_signals_available instead of duplicate test.
289 * winsup.h (ES_EXEC_EXIT): New enum.
290 (ES_SIGPROCTERMINATE): Delete.
292 2005-09-19 Christopher Faylor <cgf@timesys.com>
294 * sigproc.cc (talktome): Take siginfo_t argument. Don't scan all pids
295 trying to find one that's talking to me. Just use the pid from
297 (wait_pid): Pass siginfo_t argument to talktome.
299 2005-09-17 Christopher Faylor <cgf@timesys.com>
301 * pipe.cc (fhandler_pipe::open): Use 'cfree' to free buffer since it is
302 now allocated by cmalloc.
304 2005-09-17 Corinna Vinschen <corinna@vinschen.de>
306 * net.cc (cygwin_inet_ntop): Change len argument to socklen_t to
308 * include/arpa/inet.h (inet_ntop): Ditto.
309 * include/cygwin/in.h: Include cygwin/socket.h to get socklen_t.
311 2005-09-16 Christopher Faylor <cgf@timesys.com>
313 * environ.cc (build_env): Use "kilo"bytes not "mega"bytes. Return
314 immediately on error.
315 * spawn.cc (spawn_guts): Set return value to -1 on error from
318 2005-09-16 Christopher Faylor <cgf@timesys.com>
320 * environ.cc (build_env): Clear envblock and return NULL on attempt to
322 * spawn.cc (spawn_guts): Set E2BIG if build_env detects an error.
324 2005-09-16 Christopher Faylor <cgf@timesys.com>
326 * environ.cc (environ_init): Protect with a 'myfault' in case
327 GetEnvironmentStrings misbehaves.
329 2005-09-16 Christopher Faylor <cgf@timesys.com>
331 * environ.cc (environ_init): Add debugging output with value returned
332 from GetEnvironmentStrings.
334 2005-09-16 Christopher Faylor <cgf@timesys.com>
336 * environ.cc (environ_init): Issue an error if GetEnvironmentStrings
339 2005-09-15 Christopher Faylor <cgf@timesys.com>
341 * pinfo.h (EXITCODE_SET): Move out of range of Windows error.
342 (EXITCODE_NOSET): Ditto.
343 * sigproc.cc (no_signals_available): Remove check for hwait_sig. Just
344 rely on my_sendsig. Pass in an argument controlling when it is
345 appropriate to test EXITCODE_SET.
346 (proc_can_be_signalled): Remove checks for myself since this function
347 is never called in that context.
348 (sigproc_init): Pre-initialize my_sendsig to non-zero so that
349 proc_can_be_signalled will know that we expect to be signalable soon.
350 (sig_send): Change debugging output.
352 2005-09-15 Christopher Faylor <cgf@timesys.com>
354 * sigproc.cc (no_signals_available): Return true if sending to self
355 from the signal thread.
356 (wait_sig): Correct so that WaitForSingleObject is called when
357 hMainThread is != 0, rather than the reverse.
359 * cygheap.cc (cygheap_fixup_in_child): Clarify potential error message.
361 * fork.cc (fork_copy): Cosmetic change.
363 2005-09-15 Christopher Faylor <cgf@timesys.com>
365 * sigproc.cc (wait_sig): Reorganize exit case so that ExitProcess is
366 always called, since that is the intent of sending a __SIGEXIT. Wait
367 forever for main thread to go away since, presumably, the main thread
368 told us it was going away.
370 2005-09-14 Christopher Faylor <cgf@timesys.com>
372 * spawn.cc (av::fixup): Avoid breaking out of the wrong "loop".
374 2005-09-14 Christopher Faylor <cgf@timesys.com>
376 * hookapi.cc (hook_or_detect_cygwin): Simplify very slightly.
377 * spawn.cc (av::fixup): Guard against problems reading an executable
378 which does not match Microsoft's documentation about PE format.
380 2005-09-14 Christopher Faylor <cgf@timesys.com>
382 * spawn.cc (av::error): Eliminate.
383 (av::av): Remove reference to error.
384 (av::replace0_maybe): Ditto.
385 (av::dup_maybe): Ditto.
386 (av::dup_all): Ditto.
387 (av::unshift): Ditto.
388 (spawn_guts): On a fault, return E2BIG only if ENOMEM has been set.
389 Otherwise return EFAULT.
391 2005-09-14 Christopher Faylor <cgf@timesys.com>
393 * cygtls.h (san): New structure.
394 (cygtls::andreas): New element. Replaces _myfault and _myfault_errno.
395 (cygtls::fault_guarded): Use andreas.
396 (cygtls::return_from_fault): Ditto.
397 (cygtls::setup_fault): Add a parameter denoting where to store old
398 fault handler, if any and use it to "stack" faults.
399 (cygtls::reset_fault): Restore fault from parameter.
400 (myfault::sebastian): New variable.
401 (myfault::~myfault): Pass sebastian to reset_fault.
402 (myfault::myfault): Store old fault values in sebastian.
404 2005-09-14 Christopher Faylor <cgf@timesys.com>
406 * heap.cc (heap_init): Revert 2005-09-11 patch as it seems to
407 inexplicably cause problems with emacs.
409 2005-09-14 Christopher Faylor <cgf@timesys.com>
411 Remove some more unneeded 'return;'s throughout.
413 2005-09-14 Christopher Faylor <cgf@timesys.com>
415 * sigproc.h: Protect declaration so that it only happens when
418 2005-09-14 Christopher Faylor <cgf@timesys.com>
420 * exceptions.cc (sigtid): Remove declaration.
421 (handle_exceptions): Use _sig_tls rather than sigtid to determine if
422 this is the signal thread.
423 (set_signal_mask): Ditto for conditionalized CGF code.
424 * pinfo.cc (pinfo::exit): Exit the thread if we forcefully terminated
426 * sigproc.cc (sigtid): Delete.
428 (sig_clear): Use _sig_tls rather than sigtid to determine if this is
430 (sig_dispatch_pending): Ditto.
431 (wait_sig): Set _sig_tls here.
433 2005-09-13 Christopher Faylor <cgf@timesys.com>
435 * dcrt0.cc (do_exit): Move sigproc_terminate call later since signal
436 handling was still needed for subsequent stuff. Call sigproc_terminate
437 with new exit_state value.
438 * pinfo.cc (pinfo::exit): Call sigproc_terminate with new exit_state
440 * sigproc.cc (proc_terminate): Remove unnecessary (void) parameter.
441 (sigproc_terminate): Ditto. Add new argument to accept exit state to
443 (wait_sig): Reorganize __SIGEXIT handling. Add more debugging output.
444 * winsup.h (sigproc_terminate): Declare with new exit_state argument.
445 (exit_states): Reorganize to reflect new exit ordering of
448 2005-09-13 Christopher Faylor <cgf@timesys.com>
450 * dcrt0.cc (do_exit): Rely on sigproc_terminate to set exit_state
452 * pinfo.cc (pinfo::exit): Always call sigproc_terminate here. Rely on
453 sigproc_terminate to signal signal thread to handle eventual process
455 * sigproc.cc (no_signals_available): Change criteria for determining if
456 this process can handle signals to itself.
457 (my_sendsig): New variable. Copy of my sendsig handle.
458 (proc_can_be_signalled): Don't send signals if exit code is set.
459 (sigproc_terminate): Use and set exit_state appropriately to determine
460 when to do anything. Send __SIGEXIT to self to control process exit.
461 (sig_send): Use my_sendsig for sending signals. Don't call
462 proc_can_be_signalled for myself since the criteria is now different
463 for sending signals to myself.
464 (wait_sig): Copy myself->sendsig to my_sendsig for future use. Exit
465 signal loop when __SIGEXIT is received. Wait for main thread to exit
466 and use its exit status to actually exit process.
467 * sigproc.h (__SIGEXIT): New enum.
469 2005-09-13 Christopher Faylor <cgf@timesys.com>
471 * dcrt0.cc (alloc_stack): Eliminate superfluous "return;".
472 * debug.cc (add_handle): Ditto.
473 * devices.in (device::parse): Ditto.
474 * dtable.cc (dtable::vfork_parent_restore): Ditto.
475 (dtable::vfork_child_fixup): Ditto.
476 * environ.cc (parse_options): Ditto.
477 * errno.cc (seterrno_from_win_error): Ditto.
478 * exceptions.cc (sig_handle_tty_stop): Ditto.
479 (set_signal_mask): Ditto.
480 * fhandler.cc (fhandler_base::read): Ditto.
481 (fhandler_base::operator delete): Ditto.
482 (fhandler_base::seekdir): Ditto.
483 (fhandler_base::rewinddir): Ditto.
484 * fhandler_console.cc (fhandler_console::read): Ditto.
485 (fhandler_console::fixup_after_exec): Ditto.
486 * sigproc.cc (sigproc_init): Ditto.
487 (sigproc_terminate): Ditto.
489 * devices.cc: Regenerate.
491 2005-09-13 Christopher Faylor <cgf@timesys.com>
493 * sigproc.cc (wait_sig): Be more defensive about detecting when we're
496 2005-09-12 Christopher Faylor <cgf@timesys.com>
498 * cygthread.cc (cygthread::cygthread): Add more info to fatal error.
500 * fhandler_disk_file.cc (fhandler_disk_file::readdir): Temporarily
501 remove insertion of /dev into root directory.
502 * path.cc (path_conv::check): Ditto.
504 2005-09-11 Christopher Faylor <cgf@timesys.com>
506 * heap.cc (heap_init): Allocate heap from top down as a hedge against
507 subsequent ERROR_INVALID_ADDRESS in forked processes when CTRL-C is
510 2005-09-09 Christopher Faylor <cgf@timesys.com>
512 * heap.cc (heap_init): Be slightly more aggressive when trying to
513 allocate heap. Change fatal error message to avoid confusion with
516 * spawn.cc (linebuf::finish): New function.
517 (linebuf::add): Cosmetic change.
518 (spawn_guts): Only avoid building windows command line if the program
519 being executed was actually mounted with -X. Don't return E2BIG if we
520 hit the 32K size and we're executing a detected cygwin program. Just
521 silently truncate the windows command line, instead.
523 2005-09-08 Christopher Faylor <cgf@timesys.com>
525 * fhandler_serial.cc (fhandler_serial::tcgetattr): Just zero c_cflag
526 here rather than clearing CBAUD after the fact.
527 * termios.cc (tcgetattr): Revert previous change.
529 2005-09-08 Christopher Faylor <cgf@timesys.com>
531 * fhandler_serial.cc (fhandler_serial::ioctl): Always return 0 for
533 * termios.cc (tcgetattr): Clear out baud part of c_cflag since it is
536 2005-09-08 Corinna Vinschen <corinna@vinschen.de>
538 * exceptions.cc (ctrl_c_handler): Disable any special CTRL_LOGOFF_EVENT
539 handling and add longish comment about the reasons.
541 2005-09-07 Christopher Faylor <cgf@timesys.com>
543 * hookapi.cc (rvadelta): Change argument to DWORD to eliminate a
546 * path.h (path_conv::set_cygexec): New function.
547 * spawn.cc (av::iscygwin): Eliminate.
548 (av::av): Don't initialize iscygwin.
549 (spawn_guts): Just use real_path.iscygexec for all tests.
550 (av::fixup): Short circuit test if .exe extension and known cygexec.
551 Set cygexec flag appropriately if we find that program uses cygwin1.dll.
553 2005-09-06 Christopher Faylor <cgf@timesys.com>
555 * dcrt0.cc (initial_env): Don't attempt stracing if dynamically loaded.
556 (dll_crt0_0): Move console initialization earlier.
557 * init.cc (dll_entry): Move console initialization here.
558 * exceptions.cc (init_console_handler): Fully remove any old console
560 (handle_sigsuspend): Make cancelable when called from non-main thread.
562 * spawn.cc (spawn_guts): Don't fill out windows argv if we've deduced
563 that this is a cygwin-using program.
564 (av::fixup): Always check executables to see if they are using
565 cygwin1.dll. Don't consider .com files to be scripts.
566 * hookapi.cc (rvadelta): New function.
567 (PEHeaderFromHModule): Simplify slightly.
568 (hook_or_detect_cygwin): Use passed in name argument for "HMODULE"
569 rather than incorrectly reading current program. Calculate delta
570 needed to read image data and file names if this isn't a real
573 2005-09-06 Corinna Vinschen <corinna@vinschen.de>
575 * thread.h: Revert patch from 2005-09-05.
576 * thread.cc (pthread_mutex::can_be_unlocked): Return true also if
577 mutex is owned by MUTEX_OWNER_ANONYMOUS.
579 2005-09-05 Christopher Faylor <cgf@timesys.com>
581 * cygheap.cc (cygheap_init): Eliminate debugging #if.
583 * fork.cc (fork_parent): Don't issue errors if "somebody" has set the
584 PID_EXITED flag on a child. Don't close process handle if it has
585 potentially already been closed.
586 * pinfo.cc (winpids::add): Eliminate PID_ALLPIDS handling which was
587 obsoleted by previous changes.
589 * spawn.cc (av::fixup): Do win16 detection for .com files. Make sure
590 that buffer has been unmapped in all cases.
592 2005-09-05 Corinna Vinschen <corinna@vinschen.de>
594 * thread.h (pthread_mutex::get_pthread_self): Remove.
595 (pthread_mutex::lock): Use ::pthread_self as self parameter.
596 (pthread_mutex::trylock): Ditto.
597 (pthread_mutex::unlock): Ditto.
598 (pthread_mutex::destroy): Ditto.
600 2005-09-02 Dave Korn <dave.korn@artimi.com>
602 * Makefile.in (CXXFLAGS): Use 'override' to correctly set flags to
603 generate dependencies when invoked from top-level make.
605 2005-08-28 Christopher Faylor <cgf@timesys.com>
607 * exceptions.cc (set_process_mask_delta): Conditionalize debugging
609 * sigproc.cc (proc_subproc): Make strace output a little more verbose.
611 2005-08-28 Christopher Faylor <cgf@timesys.com>
613 * cygtls.h (__ljfault): Declare.
614 (_cygtls::return_from_fault): Use __ljfault.
615 * exceptions.cc (set_signal_mask): Revert previous checkin.
616 * gendef (__sjfault): Split out into a separate function which doesn't
617 bother with any special signal locking.
618 (_ljfault): Return from a __sjfault without bothering with signals.
620 2005-08-28 Christopher Faylor <cgf@timesys.com>
622 * cygtls.h (_local_storage::strerror_buf): Allocate more space.
623 * errno.cc (strerror_worker): New function, adapted from strerror.
624 (strerror): Use strerror_worker.
625 * tlsoffsets.h: Regenerate.
627 * exceptions.cc (set_signal_mask): Minimize time during which mask_sync
630 2005-08-28 Christopher Faylor <cgf@timesys.com>
632 * cygwin.din: Correct readdir_r typo.
634 2005-08-27 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
636 * dir.cc (readdir_r): Invert sense on error test.
638 2005-08-25 Corinna Vinschen <corinna@vinschen.de>
640 * path.cc (normalize_posix_path): Keep two leading slashes
642 (normalize_win32_path): Revert to only checking for slash.
643 (realpath): Convert drive letters to cygdrive paths before
645 * shared_info.h (mount_info::cygdrive_posix_path): Make public.
647 2005-08-25 Corinna Vinschen <corinna@vinschen.de>
649 * path.cc (realpath): Drop call to mount_info::conv_to_posix_path
650 in favor of calling path_conv with PC_POSIX flag. Align error
651 handling closer to POSIX. As on Linux, return user space allocated
652 memory if second parameter is NULL.
654 2005-08-25 Corinna Vinschen <corinna@vinschen.de>
656 * path.cc (normalize_win32_path): Honor network paths. Fold more
657 than two leading dir separators into one. Check for dir separator
658 instead of just slashes to handle incoming Win32 paths correctly.
660 2005-08-25 Christopher Faylor <cgf@timesys.com>
662 * errno.cc (errmap): Translate ERROR_NO_MORE_ITEMS to ENMFILE.
664 2005-08-24 Christopher Faylor <cgf@timesys.com>
666 * exceptions.cc (handle_sigsuspend): Just sleep forever if called from
668 (sigpacket:process): Simplify logic which determines when and how a
669 signal is masked. Don't trigger sigwait if there is a signal handler.
670 * sigproc.cc (wait_sig): Update comment. Try to process a signal which
671 is in the queue if it isn't queued for the target thread (this is still
674 2005-08-24 Christopher Faylor <cgf@timesys.com>
676 * spawn.cc (perhaps_suffix): Record errno-type error value in third
678 (find_exec): On error, set errno returned from perhaps_suffix.
681 2005-08-24 Christopher Faylor <cgf@timesys.com>
683 * fhandler_virtual.cc (fhandler_virtual::close): Don't free filebuf if
685 * pinfo.cc (_pinfo::commune_send): Fix test for incorrect number of
686 bytes read from pipe.
688 2005-08-24 Corinna Vinschen <corinna@vinschen.de>
690 * syscalls.cc (endusershell): Reset shell_fp to NULL to allow
691 subsequent getusershell calls.
693 2005-08-24 Christopher Faylor <cgf@timesys.com>
695 * path.cc (path_conv::check): Fill in fileattr for /dev, defaulting to
696 directory if /dev doesn't actually exist.
697 (win32_device_name): Don't consider FH_DEV to be a device since it's
698 really a directory which should go through mount processing.
700 2005-08-24 Christopher Faylor <cgf@timesys.com>
702 * cygheap.h (cygheap_types): Add HEAP_COMMUNE.
703 * fhandler_proc.cc: Use cygheap rather than user heap for allocation of
705 * fhandler_registry.cc: Ditto.
706 * fhandler_virtual.cc: Ditto.
707 * fhandler_process.cc: Ditto.
708 (get_mem_values): Use malloc/realloc/free rather than new.
709 * pinfo.cc (_pinfo::commune_send): Allocate on cygwin heap rather than
710 user heap. Avoid calling ReadFile when correct number of characters
711 have been read or suffer buffer corruption.
712 (_pinfo::fd): Allocate on cygwin heap rather than user heap.
713 (_pinfo::fds): Ditto.
714 (_pinfo::root): Ditto.
715 (_pinfo::cwd): Ditto.
716 (_pinfo::cmdline): Ditto.
718 * devices.h (FH_DEV): New define.
719 * devices.in: Detect lone /dev.
720 * devices.cc: Regenerate.
721 * path.cc (path_conv::check): Treat FH_DEV as a special case.
723 2005-08-23 Christopher Faylor <cgf@timesys.com>
725 * sigproc.h (set_signal_mask): Remove default on second parameter and
726 make pass by reference.
727 * signal.cc (abort): Accommodate change to set_signal_mask.
728 * select.cc (pselect): Ditto.
729 * exceptions.cc (handle_sigsuspend): Ditto.
730 (ctrl_c_handler): Ditto.
733 (set_process_mask_delta): Ditto.
734 (_cygtls::call_signal_handler): Ditto.
736 * fhandler_disk_file.cc (fhandler_disk_file::readdir): Return ENMFILE
737 if __handle is not set. Set __handle to NULL when out of files.
738 (fhandler_disk_file::rewinddir): Don't close handle if it's NULL.
739 (fhandler_disk_file::closedir): Ditto.
741 2005-08-22 Christopher Faylor <cgf@timesys.com>
743 * dir.cc (readdir_worker): Make static. Only add '.' and '..' when
744 readdir fails due to ENMFILE.
745 * fhandler_disk_file.cc (fhandler_disk_file::readdir): Only close
746 handle on error != ENMFILE.
748 2005-08-22 Corinna Vinschen <corinna@vinschen.de>
750 * mtinfo.h (mtinfo_drive::error): Fix argument bug in debug_printf call.
752 2005-08-20 Christopher Faylor <cgf@timesys.com>
754 * cygerrno.h (geterrno_from_win_error): Change declaration to default
755 to using GetLastError and EACCESS.
756 * cygwin.din: Export readdir_r.
757 * include/cygwin/version.h: Bump API version number to 138.
758 * syscalls.cc (readdir_worker): New function, renamed from old
760 (readdir): Use readdir_worker.
761 (readdir_r): New function.
762 * fhandler.h (fhandler_base::readdir): Accommodate second argument
763 indicating dirent buffer.
764 (fhandler_disk_file::readdir): Ditto.
765 (fhandler_cygdrive::readdir): Ditto.
766 (fhandler_proc::readdir): Ditto.
767 (fhandler_netdrive::readdir): Ditto.
768 (fhandler_registry::readdir): Ditto.
769 (fhandler_process::readdir): Ditto.
770 * fhandler.cc (fhandler_base::readdir): Ditto.
771 * fhandler_disk_file.cc (fhandler_disk_file::readdir): Ditto.
772 * fhandler_cygdrive.cc (fhandler_cygdrive::readdir): Ditto.
773 * fhandler_proc.cc (fhandler_proc::readdir): Ditto.
774 * fhandler_netdrive.cc (fhandler_netdrive::readdir): Ditto.
775 * fhandler_registry.cc (fhandler_registry::readdir): Ditto.
776 * fhandler_process.cc (fhandler_process::readdir): Ditto.
777 * include/sys/dirent.h (readdir_r): Add declaration.
779 2005-08-19 Christopher Faylor <cgf@timesys.com>
781 * fhandler.h (dirent_states): Add dirent_saw_proc.
782 * fhandler_disk_file.cc (fhandler_disk_file::readdir): Fill in "proc"
783 if it is the root dir and it is missing.
785 2005-08-19 Christopher Faylor <cgf@timesys.com>
787 * fhandler.h (dirent_states): Add dirent_isroot, dirent_saw_cygdrive,
789 * dir.cc (opendir): Don't zero __flags here. Push that responsibility
791 (seekdir): Preserve dirent_isroot in __flags.
793 * fhandler_disk_file.cc (fhandler_disk_file::opendir): Set
794 dirent_isroot appropriately.
795 (fhandler_disk_file::readdir): Fill in "cygdrive" and "dev" if it is
796 the root dir and they are missing.
797 * fhandler_process.cc (fhandler_process::opendir): Set __flags here.
798 * fhandler_virtual.cc (fhandler_virtual::opendir): Set __flags here.
800 2005-08-19 Christopher Faylor <cgf@timesys.com>
802 * winsup.h (create_pipe): Declare new function.
803 (CreatePipe): New define.
804 * miscfuncs.cc (create_pipe): Define new function.
806 2005-08-18 Christopher Faylor <cgf@timesys.com>
808 * fhandler.h (fhandler_tty_common::lseek): Declare new method.
809 (fhandler_tty_slave::lseek): Delete old method.
810 (fhandler_tty_master::lseek): Delete old method.
811 * fhandler_tty.cc (fhandler_tty_common::lseek): Define new method.
813 2005-08-18 Corinna Vinschen <corinna@vinschen.de>
815 * fhandler_socket.cc (fhandler_socket::recvfrom): Always initialize
817 (fhandler_socket::recvmsg): Ditto.
819 2005-08-18 Corinna Vinschen <corinna@vinschen.de>
821 * errno.cc (strerror): Check errnum for underflow.
823 2005-08-17 Christopher Faylor <cgf@timesys.com>
825 * dcrt0.cc (dll_crt0_1): Tweak debugging stuff.
827 2005-08-17 Pavel Tsekov <ptsekov@gmx.net>
829 * fhandler_tty.cc (fhandler_tty_common::close): Rearrange the code so
830 that the master end of the input and output pipes is closed before
831 signalling an EOF event to the slave.
832 (fhandler_pty_master::close): Likewise.
834 2005-08-14 Corinna Vinschen <corinna@vinschen.de>
836 * init.cc (respawn_wow64_process): Make inline function. Remove
837 "noreturn" attribute. Add additional check if parent process is
838 actually a 64 bit process.
839 (dll_entry): Only test WOW64 processes with a stack in the usual
840 "dangerous" process space area.
842 2005-08-11 Troy Curtiss <trcurtiss@gmail.com>
844 * fhandler_serial.cc (fhandler_serial::tcgetattr): Return current baud
845 rate regardless of current DTR state.
847 2005-08-11 Christopher Faylor <cgf@timesys.com>
849 * dcrt0.cc: Remove ld_preload declaration.
850 * winsup.h: Move ld_preload declaration here.
851 * fork.cc (fork_child): Call ld_preload() before returning.
853 2005-08-11 Christopher Faylor <cgf@timesys.com>
855 * child_info. (CURR_CHILD_INFO_MAGIC): Refresh.
856 (child_info::child_info()): New constructor.
857 (child_info_spawn::child_info_spawn()): Ditto.
858 (child_info_spawn::operator new): New operator.
859 (child_info_spawn::set): New function.
860 * spawn.cc (av()): New constructor.
861 (av::operator new): New operator.
862 (av::set): New function.
863 (spawn_guts): Reorganize so that classes which allocate are defined
864 early in the function so that it can be properly cleaned up after an
865 efault. Set errno to E2BIG in the event of a SEGV situation.
867 2005-08-08 Christopher Faylor <cgf@timesys.com>
869 * include/sys/cdefs.h: Remove extra line.
871 2005-08-08 Corinna Vinschen <corinna@vinschen.de>
873 * security.cc (get_reg_security): New static function.
874 (get_nt_object_security): Call get_reg_security for registry keys
875 to circumvent problems with predefined registry keys.
877 2005-08-08 Corinna Vinschen <corinna@vinschen.de>
879 * fhandler_process.cc (fhandler_process::open): Allow opening of
880 /proc/<pid>/fd for reading.
881 * fhandler_registry.cc (fhandler_registry::open): Ditto for registry
884 2005-08-08 Christopher Faylor <cgf@timesys.com>
886 * include/sys/cdefs.h (__CONCAT): Define.
887 * include/elf.h: New file.
888 * include/sys/elf32.h: Ditto.
889 * include/sys/elf64.h: Ditto.
890 * include/sys/elf_common.h: Ditto.
891 * include/sys/elf_generic.h: Ditto.
893 2005-08-08 Christopher Faylor <cgf@timesys.com>
895 * cygwin.sc: Use simpler method to align .cygheap.
896 * dllfixdbg: Just copy .stab and .stabstr sections when making
897 cygwin1.dbg, rather than relying on objcopy to keep only the debug
898 sections since objcopy seems to get it wrong.
900 2005-08-08 Corinna Vinschen <corinna@vinschen.de>
902 * dtable.cc (build_fh_pc): Check setting fh to fhandler_nodevice for
905 2005-08-08 Corinna Vinschen <corinna@vinschen.de>
907 * ftw.c: Include winsup.h.
909 * include/ftw.h: Guard declarations appropriately.
911 2005-08-08 Corinna Vinschen <corinna@vinschen.de>
913 * Makefile.in (DLL_OFILES): Add fts.o, ftw.o, nftw.o.
914 * cygwin.din: Export fts_children, fts_close, fts_get_clientptr,
915 fts_get_stream, fts_open, fts_read, fts_set, fts_set_clientptr,
917 * fts.c: New file, imported from FreeBSD.
920 * include/fts.h: Ditto.
921 * include/ftw.h: Ditto.
922 * include/cygwin/version.h: Bump API minor number.
924 2005-08-07 Christopher Faylor <cgf@timesys.com>
926 * Makefile.in (dtable_CFLAGS): Use -fomit-frame-pointer and
928 * cygheap.cc (cmalloc): Only emit system_printf warnings on failure if
932 * dtable.cc (build_fh_name): Treat NULL return from cnew as indicative
934 (build_fh_dev): Ditto.
935 (dtable::dup_worker): Handle NULL return from build_fh_pc.
936 (dtable::vfork_child_dup): Trust dup_worker to set errno.
937 * fhandler.h (fhandler_base::new): Mark as nothrow.
939 2005-08-07 Christopher Faylor <cgf@timesys.com>
941 * dllfixdbg: New perl script.
942 * configure.in: Detect objcopy, objdump, strip.
943 * configure: Regenerate.
944 * Makefile.in: Pass target objcopy/objdump to new dllfixdbg script.
945 Remove previous perl check.
946 * cygwin.sc: Add .gnu_debuglink_overlay section for eventual
947 replacement with .gnu_debuglink section. Revert move of cygheap to end
950 2005-08-06 Corinna Vinschen <corinna@vinschen.de>
952 * Makefile.in: Allow previous patch to work in a 64 bit environment.
954 2005-08-06 Christopher Faylor <cgf@timesys.com>
956 * Makefile.in: Warn when end of cygheap is not on 64k boundary.
957 * cygwin.sc: Try harder to ensure that cygheap is on a 64k boundary.
958 Move cygheap to end of image to stop interference from unstripped debug
961 2005-08-06 Christopher Faylor <cgf@timesys.com>
963 * include/endian.h: Move everything into this file and define things
965 * include/cygwin/types.h: Include endian.h.
966 * include/sys/dirent.h: Define DT_* types and conversion macros.
968 * pinfo.cc (pinfo::init): Remove special handling for PID_ALLPIDS and
969 execed code, even though it probably still isn't quite right.
971 2005-08-05 Michael Gorse <mgorse@alum.wpi.edu>
973 * thread.cc (pthread::create(3 args)): Make bool.
974 (pthread_null::create): Ditto.
975 (pthread::create(4 args)): Check return of inner create rather than
976 calling is_good_object().
979 2005-08-05 Vaclav Haisman <v.haisman@sh.cvut.cz>
981 * fhandler_tty.cc (fhandler_tty_slave::tcflush): Return either 0 or -1.
983 2005-08-05 Corinna Vinschen <corinna@vinschen.de>
985 * thread.cc (pthread_cond_timedwait): Check abstime for validity
986 according to SUSv3. Rewrite timeout check and waitlength calculation
987 to avoid overflow problems.
989 2005-08-02 Yitzchak Scott-Thoennes <sthoenna@efn.org>
991 * include/sys/termios.h: Define TIOCMBIS and TIOCMBIC.
992 * fhandler.h (class fhandler_serial): Declare switch_modem_lines.
993 * fhandler_serial.cc (fhandler_serial::switch_modem_lines): New
994 static function to set or clear DTR and/or RTS.
995 (fhandler_serial::ioctl): Use switch_modem_lines for TIOCMSET
996 and new TIOCMBIS and TIOCMBIC.
997 * include/cygwin/version.h: Bump API minor number.
999 2005-07-29 Christopher Faylor <cgf@timesys.com>
1001 * fhandler_disk_file.cc (fhandler_base::pread): Don't move file offset
1003 (fhandler_base::pwrite): Ditto.
1005 2005-07-29 Christopher Faylor <cgf@timesys.com>
1007 * fhandler.h (fhandler_base::pread): Declare new function.
1008 (fhandler_base::pwrite): Ditto.
1009 (fhandler_disk_file::pread): Ditto.
1010 (fhandler_disk_file::pwrite): Ditto.
1011 * fhandler.cc (fhandler_base::pread): Define new function.
1012 (fhandler_base::pwrite): Ditto.
1013 * fhandler_disk_file.cc (fhandler_base::pread): Ditto.
1014 (fhandler_base::pwrite): Ditto.
1015 * syscalls.cc (pread): Define new function.
1017 * cygwin.din: Export pread, pwrite.
1019 * include/sys/ioctl.h: Guard some _IO* declarations to avoid conflict
1022 2005-07-29 Christopher Faylor <cgf@timesys.com>
1024 * include/sys/ioctl.h: Add some linux defines.
1026 2005-07-29 Christopher Faylor <cgf@timesys.com>
1028 * pinfo.cc (pinfo::init): Put back accidentally removed debug_printf.
1030 2005-07-29 Arto Huusko <arto.huusko@wmdata.fi>
1032 * cygthread.cc (cygthread::simplestub): Wait for h to be filled out
1033 by main thread before assigning it.
1035 2005-07-29 Arto Huusko <arto.huusko@wmdata.fi>
1037 * pinfo.cc (pinfo::init): Sleep before retrying open_shared().
1039 2005-07-29 Arto Huusko <arto.huusko@wmdata.fi>
1041 * fork.cc (fork_parent): Fix null deref if pinfo creation fails.
1043 2005-07-28 Christopher Faylor <cgf@timesys.com>
1045 * cygmalloc.h (MSPACES): Define. This dropped through the cracks after
1046 the last malloc update.
1047 * dcrt0.cc: Fix a comment.
1048 * malloc.cc (internal_malloc): Fix definition so that it can be safely
1051 2005-07-27 Christopher Faylor <cgf@timesys.com>
1053 * include/cygwin/in.h (INET_ADDRSTRLEN): Add new definition.
1055 2005-07-27 Christopher Faylor <cgf@timesys.com>
1057 * gendef: Use nocr to remove \r's from input.
1058 gendef (nocr): New function.
1060 2005-07-27 Christopher Faylor <cgf@timesys.com>
1062 * fhandler_clipboard.cc (fhandler_dev_clipboard::close): Set membuffer
1064 (fhandler_dev_clipboard::fixup_after_exec): Don't call close here.
1065 Just set variables directly.
1067 2005-07-25 Christopher Faylor <cgf@timesys.com>
1069 * include/byteswap.h: New file.
1071 2005-07-25 Christopher Faylor <cgf@timesys.com>
1073 * include/cygwin/types.h: Define loff_t.
1075 2005-07-16 Christopher Faylor <cgf@timesys.com>
1077 * child_info.h (child_info::sync): Pass pid and HANDLE rather than
1079 (child_info::child_info): Accept an argument controlling whether to
1080 create proc_subproc.
1081 (child_info_spawn::child_info_spawn): Ditto.
1082 * sigproc.cc (child_info::child_info): Ditto.
1083 (child_info_spawn::child_info_spawn): Ditto.
1084 (child_info::sync): Use passed in pid and HANDLE.
1085 * fork.cc (fork_parent): Reflect additional arguments required for
1087 * hookapi.cc (hook_or_detect_cygwin): Rename. Change so that NULL 'fn'
1088 argument just returns "true", indicating that program uses cygwin1.dll.
1089 * spawn.cc (av::win16_exe): New element.
1090 * spawn.cc (av::iscygwin): New element.
1091 (av::fixup): New function.
1092 (spawn_guts): Protect against SEGV. Use fixup function to detect when
1093 it is safe to wait for a spawned (as opposed to an execed) program.
1094 Reflect changes in child_info::sync arguments.
1095 * external.cc (cygwin_internal): Reflect function renaming to
1096 hook_or_detect_cygwin.
1098 * cygheap.cc (cygheap_fixup_in_child): Close handle after debug fixup
1099 has been done to prevent false positives in handle collision.
1101 * exceptions.cc (try_to_debug): Notify debugger if already being
1104 2005-07-09 Christopher Faylor <cgf@timesys.com>
1106 * path.cc (mount): Only check win32_path when we know we need it.
1108 2005-07-09 Nicholas Wourms <nwourms@gmail.com>
1110 * cygwin.din (getline): Export.
1112 * include/sys/stdio.h (getline): Replace macro with function prototype.
1113 (getdelim): Likewise.
1114 * include/cygwin/version.h: Bump API minor number.
1116 2005-07-08 Corinna Vinschen <corinna@vinschen.de>
1118 * cygwin.din (__getline): Export.
1119 (__getdelim): Export.
1120 * include/sys/stdio.h (getline): Define as __getline.
1121 (getdelim): Define as __getdelim.
1122 * include/cygwin/version.h: Bump API minor number.
1124 2005-07-06 Christopher Faylor <cgf@timesys.com>
1126 Eliminate (void) cast on standalone function calls throughout.
1128 2005-07-05 Christopher Faylor <cgf@timesys.com>
1130 * dcrt0.cc (cygwin_exit): Mark as "noreturn".
1131 * sigproc.cc (child_info::ready): Don't signal parent that we are a
1132 cygwin process if we are dynamically loaded.
1134 2005-07-05 Christopher Faylor <cgf@timesys.com>
1136 * malloc.cc: Update to version 2.8.2.
1138 2005-07-05 Corinna Vinschen <corinna@vinschen.de>
1140 * fhandler_tape.cc (fhandler_dev_tape::close): Don't do "extra stuff"
1141 when we know we're execing.
1143 2005-07-04 Christopher Faylor <cgf@timesys.com>
1145 Change foo (void) to foo () for all c++ functions throughout.
1146 Remove all fhandler_*::dump functions throughout.
1148 * fhandler.h (fhandler_dev_mem::close): Remove pass-through function in
1149 favor of virtual method.
1150 (handler_dev_raw::close): Ditto.
1151 (fhandler_dev_clipboard::fixup_after_exec): New method.
1152 * fhandler_dev_mem.cc (fhandler_dev_mem::close): Eliminate pass through
1153 function in favor of virtual method.
1154 * fhandler_dev_raw.cc (fhandler_dev_raw::close): Ditto.
1155 * fhandler_clipboard.cc (fhandler_dev_clipboard::close): Don't go to
1156 extra effort when execing.
1157 (fhandler_dev_clipboard::fixup_after_exec): New function.
1158 * fhandler_console.cc (fhandler_console::close): Don't do "extra stuff"
1159 when we know we're execing.
1160 * fhandler_disk_file.cc (fhandler_disk_file::close): Ditto.
1161 * fhandler_dsp.cc (fhandler_dev_dsp::close): Ditto.
1162 * fhandler_fifo.cc (fhandler_fifo.cc::close): Ditto. function in favor
1164 * fhandler_random.cc (fhandler_dev_random::close): Ditto.
1165 * fhandler_registry.cc (fhandler_registry::close): Ditto.
1166 * fhandler_tty.cc (fhandler_tty_slave::close): Ditto.
1167 * fhandler_virtual.cc (fhandler_virtual::close): Ditto.
1169 * pinfo.cc (proc_waiter): Remove unneeded hExeced declaration.
1170 * sigproc.cc: Ditto.
1171 * winsup.h (hExeced): Define here.
1173 * fhandler_virtual.cc (fhandler_virtual::fixup_after_exec): Just call
1174 close() to reinitialize things to known state.
1176 2005-07-04 Christopher Faylor <cgf@timesys.com>
1178 * cygtls.h (_cygtls): Perform minor reformatting.
1180 * winsup.h (close_all_files): Reflect argument change.
1181 * dtable.cc (close_all_files): Ditto.
1183 * fhandler.h: Ditto.
1184 * spawn.cc (spawn_guts): Move close_all_files back to its original
1185 location in first P_OVERLAY test but use argument denoting that handles
1186 are only supposed to be closed, not released (more work to be done
1188 * syscalls.cc (close_all_files): Take an argument denoting whether to
1189 release closed files or not.
1191 * path.cc (symlink): Change argument names to reflect linux man page.
1192 (symlink_worker): Ditto. Also appropriately set ENOENT for empty
1196 2005-07-04 Pierre Humblet <pierre.humblet@ieee.org>
1198 * cygheap.h (struct init_cygheap): Delete cygwin_regname member.
1199 * external.cc (cygwin_internal): Use cygpsid::get_id for
1200 CW_GET_UID_FROM_SID and CW_GET_GID_FROM_SID.
1201 Turn CW_SET_CYGWIN_REGISTRY_NAME and CW_GET_CYGWIN_REGISTRY_NAME
1204 2005-07-03 Christopher Faylor <cgf@timesys.com>
1206 * thread.cc (pthread_mutex::init): Remove unneeded efault/mutex check.
1208 2005-07-02 Christopher Faylor <cgf@timesys.com>
1210 * thread.h (verifyable_object_state verifyable_object_isvalid): Delete
1211 function declaration that should have been static.
1212 * thread.cc (verifyable_object_state verifyable_object_isvalid): Make
1214 (pthread*::is_good_object): Move to directly after
1215 verifyable_object_state verifyable_object_isvalid and make inline.
1216 (check_valid_pointer): Delete function.
1217 (pthread_cond_timedwait): Use myfault to detect valid pointer.
1218 (pthread_mutex::init): Ditto.
1220 2005-07-02 Christopher Faylor <cgf@timesys.com>
1222 Replace valid memory checks with new myfault class "exception
1223 handling", almost everywhere. Leave some thread.cc stuff alone for
1225 * cygtls.h: Kludge some definitions to avoid including a problematic
1227 (_cygtls::_myfault): New entry.
1228 (_cygtls::_myfault_errno): Ditto.
1229 (_cygtls::fault_guarded): New function.
1230 (_cygtls::setup_fault): Ditto.
1231 (_cygtls::return_from_fault): Ditto.
1232 (_cygtls::clear_fault): Ditto.
1233 (myfault): New class.
1234 * exceptions.cc (handle_exceptions): Handle case of guarded fault in
1236 * gendef: Add another entry point for setjmp that the compiler doesn't
1237 know about and won't complain about.
1238 * gentls_offsets: Just include windows.h rather than kludging a HANDLE
1240 * miscfuncs.cc (check_null_str): Delete.
1241 (check_null_empty_str): Ditto.
1242 (check_null_empty_str_errno): Ditto.
1243 (check_null_str_errno): Ditto.
1244 (__check_null_invalid_struct): Ditto.
1245 (__check_null_invalid_struct_errno): Ditto.
1246 (__check_invalid_read_ptr): Ditto.
1247 (__check_invalid_read_ptr_errno): Ditto.
1248 (dummytest): New function.
1249 (check_iovec_for_read): Delete.
1250 (chec_iovec): Rename from check_iovec_for_write. Take a read/write
1252 * tlsoffsets.h: Regenerate.
1253 * winsup.h: Remove check_* declarations.
1254 (check_iovec_for_read): Delete declaration. Turn into a define
1256 (check_iovec_for_write): Ditto.
1257 (check_iovec): New declaration.
1259 * thread.h: Use ifdef guard name consistent with other header files.
1261 2005-07-02 Christopher Faylor <cgf@timesys.com>
1263 * include/cygwin/version.h: Bump DLL minor number to 19.
1265 2005-06-30 Corinna Vinschen <corinna@vinschen.de>
1267 * fhandler.cc (fhandler_base::readv): Use malloc/free instead of alloca.
1268 (fhandler_base::writev): Ditto.
1270 2005-06-29 Christopher Faylor <cgf@timesys.com>
1272 * cygerrno.h: Make multi-inclusion safe.
1273 * fhandler_termios.cc (fhandler_termios::tcsetpgrp): Deal with EINTR.
1274 * dcrt0.cc (dll_crt0_0): Accommodate init_console_handler argument
1277 * fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
1278 * exceptions.cc (init_console_handler): Ditto. Ignore console events
1279 if we're not attached to a terminal.
1280 * fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
1281 * wincap.cc: Implement has_null_console_handler_routine throughout.
1284 2005-06-29 Christopher Faylor <cgf@timesys.com>
1286 * autoload.cc (LoadDLLprime): Use a more descriptive name for autoload
1290 2005-06-27 Corinna Vinschen <corinna@vinschen.de>
1292 * fhandler_disk_file.cc (fhandler_disk_file::facl): Add missing break.
1294 2005-06-24 Corinna Vinschen <corinna@vinschen.de>
1296 * path.cc (path_conv::check): Don't strip trailing dots and spaces
1297 at the start of the path.
1299 2005-06-24 Corinna Vinschen <corinna@vinschen.de>
1301 * fhandler.cc (rootdir): Don't set errno.
1302 * syscalls.cc (statvfs): Set errno to ENOTDIR if rootdir() failed.
1304 2005-06-22 Corinna Vinschen <corinna@vinschen.de>
1306 * fhandler.h (class fhandler_dev_tape): Add declaration for
1307 fixup_after_fork and set_close_on_exec.
1308 * fhandler_tape.cc (fhandler_dev_tape::open): Create mt_mtx mutex
1310 (fhandler_dev_tape::close): Close mt_mtx.
1311 (fhandler_dev_tape::dup): Duplicate mt_mtx and mt_evt as necessary.
1312 (fhandler_dev_tape::fixup_after_fork): New method.
1313 (fhandler_dev_tape::set_close_on_exec): New method.
1315 2005-06-21 Corinna Vinschen <corinna@vinschen.de>
1317 * security.cc (get_initgroups_sidlist): Drop special_pgrp parameter.
1318 (get_setgroups_sidlist): Avoid duplicate groups in group list.
1319 (create_token): Remove special_pgrp local variable. Accomodate
1320 change to get_initgroups_sidlist call.
1322 2005-06-21 Corinna Vinschen <corinna@vinschen.de>
1324 * uinfo.cc (uinfo_init): Call reimpersonate to set the main thread's
1325 impersonation token.
1327 2005-06-20 Corinna Vinschen <corinna@vinschen.de>
1329 * fhandler_proc.cc (format_proc_partitions): Only list recognized
1330 partitions. Use partition number given by PartitionNumber member.
1332 2005-06-18 Corinna Vinschen <corinna@vinschen.de>
1334 * glob.c: (glob0): New local variable `limit`. Use in calls to glob1
1336 (glob1): Add `limit' parameter.
1339 (globextend): Ditto. Implement GLOB_LIMIT handling.
1340 * include/glob.h (GLOB_LIMIT): New define.
1341 * include/cygwin/version.h: Bump API minor number.
1343 2005-06-17 Christopher Faylor <cgf@timesys.com>
1345 * wincap.h (wincaps::detect_win16_exe): Declare.
1346 (wincapc::detect_win16_exe): Implement.
1347 * wincap.cc: Populate detect_win16_exe where appropriate.
1348 * spawn.cc (spawn_guts): Only go out of the way to detect 16-bit apps
1349 on systems which are flummoxed by them.
1351 2005-06-17 Christopher Faylor <cgf@timesys.com>
1353 * spawn.cc (spawn_guts): Detect when executing a 16-bit application and
1354 avoid setting the process pipe since this causes conniptions in Windows
1357 2005-06-17 Corinna Vinschen <corinna@vinschen.de>
1359 * cygwin.din (inet_pton): Export.
1360 (inet_ntop): Export.
1361 * net.cc (cygwin_inet_pton): Implement inet_pton for AF_INET for now.
1362 (cygwin_inet_ntop): Implement inet_ntop for AF_INET for now.
1363 * include/arpa/inet.h (inet_pton): Declare.
1364 (inet_ntop): Declare.
1365 * include/cygwin/version.h: Bump API minor number.
1367 2005-06-17 Corinna Vinschen <corinna@vinschen.de>
1369 * fhandler.h (fhandler_union): Add missing members corresponding to
1370 fhandler_fifo and fhandler_netdrive.
1372 2005-06-16 Corinna Vinschen <corinna@vinschen.de>
1374 * syscalls.cc (statvfs): Handle the case when GetDiskFreeSpaceEx
1375 succeeds but GetDiskFreeSpace fails by faking bytes-per-sector and
1376 sectors-per-cluster values.
1378 2005-06-15 Christopher Faylor <cgf@timesys.com>
1380 * cygthread.cc (cygthread::detach): Fix debugging output.
1381 * dcrt0.cc (dll_crt0_1): Create signal_arrived early -- before any
1382 filename manipulation.
1383 * sigproc.cc (sigproc_init): Don't create signal_arrived here.
1384 * fork.cc (fork_child): Ditto.
1385 * sigproc.h (create_signal_arrived): Declare.
1387 2005-06-14 Christopher Faylor <cgf@timesys.com>
1389 * path.cc (path_conv::check): Always reset to FH_FS when component != 0
1390 and FH_NETDRIVE to fix problems with strict case checking.
1392 2005-06-12 Corinna Vinschen <corinna@vinschen.de>
1394 * fhandler_socket.cc (fhandler_socket::recvmsg): Avoid SEGV in OpenSSH
1395 when trying to pass file descriptor by setting msg->msg_accrightslen
1398 2005-06-11 Christopher Faylor <cgf@timesys.com>
1400 * Makefile.in: Avoid initial heap allocation since cygwin has its own
1403 2005-06-11 Christopher Faylor <cgf@timesys.com>
1405 * fhandler_console.cc (fhandler_console::read): Fix a compiler warning.
1407 2005-06-10 Christopher Faylor <cgf@timesys.com>
1409 * include/pthread.h: Change PTHREAD_MUTEX_DEFAULT to
1410 PTHREAD_MUTEX_NORMAL. Revert PTHREAD_MUTEX_INITIALIZER to
1411 PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP since that is actually closer
1413 * thread.h (cw_cancel_action): New enum.
1414 (cancelable_wait): Use cw_cancel_action as third argument.
1415 * thread.cc (cancelable_wait): Ditto. Don't wait for cancel if
1416 cancel_action == cw_no_cancel.
1417 (pthread::create): Don't wait for cancel event since that is racy.
1418 (pthread_mutex::pthread_mutex): Set default to PTHREAD_MUTEX_ERRORCHECK.
1419 (pthread_mutexattr::pthread_mutexattr): Ditto.
1420 (pthread_mutex::_lock): Tell cancelable_wait not to wait for
1422 (semaphore::_timedwait): Accommodate change in cancelable_wait args.
1423 (pthread::join): Ditto.
1425 2005-06-10 Corinna Vinschen <corinna@vinschen.de>
1427 * fhandler_socket.cc (fhandler_socket::sendto): Always initialize
1429 (fhandler_socket::sendmsg): Ditto.
1431 2005-06-10 Corinna Vinschen <corinna@vinschen.de>
1433 * cygwin.din (imaxabs): Export.
1437 (strtoimax): Export.
1438 (strtoumax): Export.
1439 * include/inttypes.h (imaxabs): Activate declaration.
1443 * include/cygwin/version.h: Bump API minor.
1445 2005-06-09 Christopher Faylor <cgf@timesys.com>
1447 * cygthread.cc (cygthread::detach): Improve diagnostics for what should
1448 be an impossible failure condition.
1450 2005-06-09 Christopher Faylor <cgf@timesys.com>
1452 * cygtls.h (_local_storage::setmode_file): New element.
1453 (_local_storage::setmode_mode): New element.
1454 * tlsoffsets.h: Regenerate.
1455 * cygwin.din (setmode): Define as cygwin_getmode.
1456 * syscalls.cc (setmode_helper): Use setmode_* variables from tls rather
1457 than using unthreadsafe static.
1458 (setmode): Break out fwalk stuff.
1459 (cygwin_setmode): New function. Put fwalk stdio stuff here.
1461 2005-06-09 Christopher Faylor <cgf@timesys.com>
1463 * thread.cc (pthread_mutex::_lock): Use cancelable_wait rather than
1464 WaitForSingleObject.
1466 2005-06-09 Christopher Faylor <cgf@timesys.com>
1468 * cygwin.sc: Place .cygwin_dll_common in a more sensible spot.
1470 2005-06-09 Christopher Faylor <cgf@timesys.com>
1472 * cygwin.sc: Place .cygwin_dll_common.
1473 * init.cc (threadfunc_ix): Use a more common name for the section name.
1475 2005-06-09 Christopher Faylor <cgf@timesys.com>
1477 * include/pthread.h (PTHREAD_MUTEX_INITIALIZER): Change to
1478 PTHREAD_NORMAL_MUTEX_INITIALIZER_NP to be closer to linux default.
1480 2005-06-09 Christopher Faylor <cgf@timesys.com>
1482 * thread.cc (cancelable_wait): No-op change to make sure that res is
1483 always a valid WFMO return.
1485 2005-06-09 Christopher Faylor <cgf@timesys.com>
1487 Change pthread::cancelable_wait to just cancelable_wait, throughout.
1488 * thread.h (cw_sig_wait): New enum.
1489 (fast_mutex::lock): Use cancelable_wait with resumable signal.
1490 (cancelable_wait): Change fourth argument to cw_sig_wait enum.
1491 * thread.cc (cancelable_wait): Ditto. Loop on signal detection if
1492 fourth argument == cw_sig_resume.
1494 2005-06-08 Christopher Faylor <cgf@timesys.com>
1496 * cygwin.sc: Apparently nonloading sections need to go last.
1498 2005-06-08 Christopher Faylor <cgf@timesys.com>
1500 * cygwin.sc: Restore resource and reloc sections and use more modern
1501 syntax for stabs sections.
1503 2005-06-08 Christopher Faylor <cgf@timesys.com>
1505 * environ.cc (spenvs): Remove cut/paste error which associated
1506 CYGWIN_DEBUG with HOME.
1508 2005-06-08 Corinna Vinschen <corinna@vinschen.de>
1510 * security.cc (cygwin_logon_user): Run LogonUser in the primary
1511 process token context. Fix potential handle leak.
1513 2005-06-07 Corinna Vinschen <corinna@vinschen.de>
1515 * pinfo.cc (pinfo::init): Define sa_buf as PSECURITY_ATTRIBUTES and
1516 allocate dynamically.
1517 (pinfo::set_acl): Replace sa_buf by dynamically allocated acl_buf.
1518 * sec_acl.cc (setacl): Allocate acl dynamically.
1519 * sec_helper.cc (sec_acl): Add test for alignment of acl when
1520 DEBUGGING is defined.
1521 (__sec_user): Same for sa_buf.
1522 * security.cc (verify_token): Define sd_buf as PSECURITY_DESCRIPTOR
1523 and allocate dynamically.
1524 (alloc_sd): Allocate acl dynamically.
1525 security.h (sec_user_nih): Change first parameter to
1526 SECURITY_ATTRIBUTES *.
1528 * sigproc.cc (wait_sig): Define sa_buf as PSECURITY_ATTRIBUTES and
1529 allocate dynamically.
1530 * syscalls.cc (seteuid32): Define dacl_buf as PACL and allocate
1532 * uinfo.cc (cygheap_user::init): Define sa_buf as PSECURITY_ATTRIBUTES
1533 and allocate dynamically.
1534 * winbase.h (ilockincr): Mark first argument of inline assembly as
1538 2005-06-07 Christopher Faylor <cgf@timesys.com>
1540 * cygthread.cc (cygthread::detach): Make error message a little more
1542 * fhandler.cc (fhandler_base::raw_read): Ditto for debug message.
1543 * dcrt0.cc (do_exit): Add some more synchronization tests.
1544 * fhandler_fifo.cc (fhandler_fifo::dup): Don't duplicate a nonexistent
1545 handle. Use derived return value rather than always retuning 0.
1546 * fhandler_netdrive.cc (fhandler_netdrive::exists): Wnet -> WNet.
1547 * winsup.h (exit_states): Add a couple of new exit states.
1549 2005-06-06 Corinna Vinschen <corinna@vinschen.de>
1551 * path.cc (symlink_info::check): If GetFileAttributes returns
1552 with ERROR_SHARING_VIOLATION, the file exists.
1554 2005-06-06 Corinna Vinschen <corinna@vinschen.de>
1556 * uname.cc (uname): Change "amd64" to "x86_64" as on Linux.
1558 2005-06-06 Corinna Vinschen <corinna@vinschen.de>
1560 * uname.cc (uname): Add missing break.
1562 2005-06-05 Christopher Faylor <cgf@timesys.com>
1564 * Makefile.in: Build sync.o with -fomit-frame-pointer and -O3.
1566 2005-06-05 Christopher Faylor <cgf@timesys.com>
1568 * sync.cc (muto::acquire): Remove unneeded brackets and fix whitespace.
1570 2005-06-04 Christopher Faylor <cgf@timesys.com>
1572 * malloc.cc: Update to Doug Lea's malloc v2.8.0.
1574 2005-06-03 Max Kaehn <slothman@electric-cloud.com>
1576 * dcrt0.cc (cygwin_dll_init): Initialize main_environ and cygtls. Add
1577 comment to explain the caveats of this method.
1578 * how-cygtls-works.txt: New file.
1580 2005-06-02 Christopher Faylor <cgf@timesys.com>
1582 * dlfcn.cc (get_full_path_of_dll): Use a relative path when converting
1583 so that the standard Windows rules for finding a library will be used
1584 if no path is given. Stop explicitly searching /usr/bin since that is
1587 2005-06-01 Christopher Faylor <cgf@timesys.com>
1589 Revert 2005-05-30 close_all_files changes.
1590 * spawn.cc (spawn_guts): When execing, close all files after the child
1593 2005-06-01 Christopher Faylor <cgf@timesys.com>
1595 * fhandler_disk_file.cc (fhandler_disk_file::fchown): Make sure that
1596 disk open is called in case we're passed in a non-existent device.
1598 2005-06-01 Christopher Faylor <cgf@timesys.com>
1600 * include/machine/stdlib.h: New file.
1602 2005-06-01 Christopher Faylor <cgf@timesys.com>
1604 * thread.h (List_remove): Revert most of 2005-05-30 change.
1606 2005-06-01 Christopher Faylor <cgf@timesys.com>
1608 * cygwin.sc: Don't output .reloc or .rsrc sections. Clean up stuff
1609 around .cygheap and use a workaround to get things working with newer
1612 2005-05-31 Christopher Faylor <cgf@timesys.com>
1614 * cygheap.cc (cygheap_end): Remove bogus section attribute.
1615 * cygwin.sc: Make __cygheap_mid absolute. Remove unused _cygheap_foo.
1617 2005-05-30 Christopher Faylor <cgf@timesys.com>
1619 * child_info.h (child_info::cygheap_h): Delete.
1620 (child_info::dwProcessId): New field.
1621 * cygheap.cc (init_cheap): Delete.
1623 (cygheap_setup_for_child): Ditto.
1624 (cygheap_setup_for_child_cleanup): Ditto.
1625 (cygheap_fixup_in_child): Simplify. Use new "child_copy" function to
1626 copy heap from parent.
1627 (_csbrk): Don't attempt allocation if within cygheap section. Fix so
1628 that more than one allocation will succeed.
1629 (cygheap_init): Reset possibly-nonzero region to zero.
1630 * cygheap.h (cygheap_setup_for_child): Delete declaration.
1631 (cygheap_setup_for_child_cleanup): Ditto.
1632 (cygheap_start): Define as an array.
1633 * cygwin.sc: Modernize. Remove unneeded sections. Define cygheap
1635 * dcrt0.cc (do_exit): Reflect argument change to close_all_files.
1636 * dtable.cc (dtable::vfork_parent_restore): Ditto.
1638 * fhandler.h: Ditto.
1639 * fork.cc (fork_copy): Call ReadProcessMemory if there is no thread
1640 (indicating that we're execing).
1641 (fork_child): Don't mess with hParent.
1642 (fork_parent): Remove hParent stuff. It happens earlier now.
1643 Remove call to cygheap_setup_for_child* stuff.
1644 (fork): Put child_info_stuff in grouped structure. Issue error if
1645 parent handle is not set.
1646 (child_copy): New function.
1647 * sigproc.cc (child_info::child_info): Put cygheap settings here. Set
1649 (child_info::~child_info): Close parent handle if it exists.
1650 * spawn.cc (spawn_guts): Reorganize so that ciresrv is allocated at
1651 only the last minute so that cygheap changes are reflected. Delete
1652 cygheap_setup* calls.
1653 * syscalls.cc (close_all_files): Add an argument to flag when the fd
1654 entry should be released.
1655 * winsup.h (close_all_files): Add an argument to close_all_files
1656 declaration. Declare child_copy.
1658 2005-05-30 Vaclav Haisman <v.haisman@sh.cvut.cz>
1660 * thread.h (List_remove): Make node parameter const. Use simple
1661 comparison and assignment rather than InterlockedCompareExchangePointer
1662 since access is already synchronized.
1664 2005-05-30 Christopher Faylor <cgf@timesys.com>
1666 * dlfcn.cc (set_dl_error): Use UNIX error rather than Windows error.
1668 2005-05-29 Christopher Faylor <cgf@timesys.com>
1670 * cygmagic: Remove debugging cruft missed on 2005-05-21.
1672 2005-05-29 Corinna Vinschen <corinna@vinschen.de>
1674 * path.cc (path_conv::check): Move component to function scope. Set
1675 PATH_RO only on *real* FH_NETDRIVEs or on non-FH_NETDRIVE virtual
1676 paths. Allow non-retrievable shares to be handled as files.
1678 2005-05-29 Eric Blake <ebb9@byu.net>
1680 * include/limits.h (LLONG_MIN, LLONG_MAX, ULLONG_MAX): Always define.
1682 2005-05-28 Christopher Faylor <cgf@timesys.com>
1684 * thread.h (pthread_key::set): Inline.
1685 (pthread_key::get): Ditto.
1686 * thread.cc (pthread::set): Delete.
1687 (pthread::get): Ditto.
1689 2005-05-28 Christopher Faylor <cgf@timesys.com>
1691 * cygwin.din: Remove signal front end from pthread_[gs]etspecific.
1693 2005-05-28 Christopher Faylor <cgf@timesys.com>
1695 * fhandler_tty.cc (fhandler_tty_slave:tcflush): Use signed comparison.
1697 2005-05-28 Christopher Faylor <cgf@timesys.com>
1699 * times.cc (time_ms::usecs): Coerce comparison to signed or whole test
1702 2005-05-27 Christopher Faylor <cgf@timesys.com>
1704 * cygheap.h: Reference _cygheap_start via .cygheap section.
1706 * environ.cc: Fix force_into_environment typo throughout.
1707 (spenvs): Export CYGWIN_DEBUG if DEBUGGING.
1709 2005-05-26 Christopher Faylor <cgf@timesys.com>
1711 * include/cygwin/version.h: Bump DLL minor number to 18.
1713 2005-05-25 Pierre Humblet <pierre.humblet@ieee.org>
1715 * fhandler.h (fhandler_base::mkdir): New virtual method.
1716 (fhandler_base::rmdir): Ditto.
1717 (fhandler_disk_file:mkdir): New method.
1718 (fhandler_disk_file:rmdir): Ditto.
1719 * dir.cc (mkdir): Implement with fhandlers.
1721 * fhandler.cc (fhandler_base::mkdir): New virtual method.
1722 (fhandler_base::rmdir): Ditto.
1723 (fhandler_disk_file::mkdir): New method.
1724 (fhandler_disk_file::rmdir): Ditto.
1726 2005-05-24 Christopher Faylor <cgf@timesys.com>
1728 * include/cygwin/version.h: Bump API minor number to 129.
1730 2005-05-24 Christopher Faylor <cgf@timesys.com>
1732 * cygwin.din: Export mkdtemp.
1733 * mktemp.cc: New file.
1734 * Makefile.in (DLL_OFILES): Add mktemp.o
1736 2005-05-23 Eric Blake <ebb9@byu.net>
1738 * include/stdint.h (INTMAX_C, UINTMAX_C): Fix definition.
1740 2005-05-21 Christopher Faylor <cgf@timesys.com>
1742 * spawn.cc (find_exec): Accept a PATH-like string in place of an
1743 environment variable.
1744 * dlfcn.cc (get_full_path_of_dll): Search /usr/bin (for windows
1745 compatibility) and /usr/lib (for UNIX compatibility) when looking for
1747 * environ.cc (conv_envvars): Put back LD_LIBRARY_PATH since it is used
1748 by get_full_path_of_dll().
1749 * errno.cc (errmap): Map MOD_NOT_FOUND to ENOENT.
1751 * cygmagic: Remove debugging cruft.
1753 2005-05-19 Corinna Vinschen <corinna@vinschen.de>
1755 * include/cygwin/in.h: Add comment.
1757 2005-05-19 Corinna Vinschen <corinna@vinschen.de>
1759 * include/cygwin/in.h: Define IPPROTO_xxx values as macros to
1762 2005-05-19 Christopher Faylor <cgf@timesys.com>
1764 * include/limits.h: Include features.h, as on linux.
1766 2005-05-19 Christopher Faylor <cgf@timesys.com>
1768 * include/endian.h: New file.
1770 2005-05-19 Corinna Vinschen <corinna@vinschen.de>
1772 * cygwin.sc: Add Dwarf-2 debug sections.
1774 2005-05-19 Corinna Vinschen <corinna@vinschen.de>
1776 * mmap.cc (mmap64): Make granularity an automatic variable.
1778 2005-05-19 Christopher Faylor <cgf@timesys.com>
1780 * fhandler.h (fhandler_cygdrive::seekdir): Delete declaration.
1781 (fhandler_cygdrive::seekdir): Delete.
1783 2005-05-19 Pierre Humblet <pierre.humblet@ieee.org>
1785 * fhandler.h (fhandler_cygdrive::iscygdrive_root): Delete method.
1786 (fhandler_cygdrive::telldir): Delete declaration.
1787 * fhandler_disk_file.cc: Remove all uses of
1788 fhandler_cygdrive::iscygdrive_root.
1789 (fhandler_disk_file::mkdir): New method.
1790 (fhandler_disk_file::rmdir): Ditto.
1791 (fhandler_cygdrive::telldir): Delete.
1793 2005-05-18 Christopher Faylor <cgf@timesys.com>
1795 * external.cc: Move pids declaration to file scope and use less
1796 enthusiastic constructor.
1797 * pinfo.h (winpids::winpids): Remove default setting.
1798 * fhandler_fifo.cc (fhandler_fifo::open_not_mine): Accommodate removal
1800 * fhandler_proc.cc (fhandler_proc::readdir): Ditto.
1802 2005-05-18 Christopher Faylor <cgf@timesys.com>
1804 * cygtls.h (_local_storage::unknown_thread_name): New buffer.
1805 * tlsoffsets.h: Regenerate.
1806 * cygthread.cc (cygthread::name): Use new thread-local buffer.
1807 * exceptions.cc (handle_exceptions): Avoid unnecessary initialization
1808 of static variables to zero.
1809 * fork.cc (slow_pid_reuse) Ditto.
1811 2005-05-18 Corinna Vinschen <corinna@vinschen.de>
1813 * mmap.cc (mmap64): Avoid compiler warning.
1814 * ntea.cc (NTReadEA): Ditto.
1815 * hires.h (hires_base): Remove useless usecs function.
1817 2005-05-18 Corinna Vinschen <corinna@vinschen.de>
1819 * fhandler_netdrive.cc (fhandler_netdrive::telldir): Remove since it's
1820 equivalent to fhandler_virtual::telldir now anyway.
1821 * fhandler.h (class fhandler_netdrive): Remove telldir.
1823 2005-05-18 Corinna Vinschen <corinna@vinschen.de>
1825 * fhandler_netdrive.cc (fhandler_netdrive::telldir): Implement.
1826 (fhandler_netdrive::seekdir): Implement.
1827 (fhandler_netdrive::closedir): Call rewinddir to have only one point
1828 of calling WNetCloseEnum.
1830 2005-05-17 Corinna Vinschen <corinna@vinschen.de>
1832 * fhandler.h (class fhandler_netdrive): Add method rewinddir.
1833 * fhandler_netdrive.cc (struct netdriveinf): New structure to
1834 store thread arguments.
1835 (thread_netdrive): Thread handling all potentially blocking
1837 (create_thread_and_wait): Start and wait for above thread.
1838 (fhandler_netdrive::exists): Change to call create_thread_and_wait
1839 instead of calling WNet... function.
1840 (fhandler_netdrive::readdir): Ditto. Fix error handling.
1841 (fhandler_netdrive::rewinddir): New method.
1843 2005-05-17 Corinna Vinschen <corinna@vinschen.de>
1845 * external.cc (cygwin_internal): Avoid compiler warning.
1847 2005-05-16 Christopher Faylor <cgf@timesys.com>
1849 * dcrt0.cc (dll_crt0_0): Don't do fixup_after_exec if dynamically
1850 loaded since the state of fds is unknown at this point.
1852 2005-05-16 Christopher Faylor <cgf@timesys.com>
1854 * include/sys/cygwin.h (enum cygwin_getinfo_types): Add CW_DEBUG_SELF.
1855 * external.cc (cygwin_internal): Implement CW_DEBUG_SELF.
1857 * init.cc (dll_entry): Minor rearrangement of code.
1859 2005-05-16 Christopher Faylor <cgf@timesys.com>
1861 * path.cc (path_conv::check): Remove embedded dots before slashes.
1863 2005-05-16 Corinna Vinschen <corinna@vinschen.de>
1865 * environ.cc (conv_envvars): Remove LD_LIBRARY_PATH entirely.
1866 It doesn't belong here.
1868 2005-05-15 Corinna Vinschen <corinna@vinschen.de>
1870 * environ.cc (conv_envvars): Treat LD_LIBRARY_PATH as path list.
1872 2005-05-14 Corinna Vinschen <corinna@vinschen.de>
1874 * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Check
1875 return code from GetFileSize and set file size to 0 if necessary.
1876 * fhandler_netdrive.cc (fhandler_netdrive::fstat): Set permissions
1877 to read/execute for all.
1879 2005-05-13 Christopher Faylor <cgf@timesys.com>
1881 * path.cc (normalize_posix_path): Do normalization on . and .. after
1884 2005-05-13 Corinna Vinschen <corinna@vinschen.de>
1886 * fhandler.h (fhandler_netdrive::readdir): Remove useless comment.
1888 2005-05-13 Corinna Vinschen <corinna@vinschen.de>
1890 * autoload.cc (WNetGetResourceParentA): Import.
1891 (WNetOpenEnumA): Import.
1892 (WNetEnumResourceA): Import.
1893 (WNetCloseEnum): Import.
1894 * fhandler.h (fhandler_netdrive::telldir): Add declaration.
1895 (fhandler_netdrive::seekdir): Ditto.
1896 (fhandler_netdrive::closedir): Ditto.
1897 * fhandler_netdrive.cc: Drop explicit including windows.h. Include
1898 winnetwk.h instead of shlwapi.h. Include dirent.h.
1899 (fhandler_netdrive::readdir): Implement.
1900 (fhandler_netdrive::telldir): New method.
1901 (fhandler_netdrive::seekdir): New method.
1902 (fhandler_netdrive::closedir): Ditto.
1904 2005-05-13 Christopher Faylor <cgf@timesys.com>
1906 Remove PC_FULL from path_conv usage throughout.
1907 * path.h (enum pathconv_arg): Change PC_FULL to PC_NOFULL.
1908 * path.cc (path_conv::check): Test for PC_NOFULL rather than !PC_FULL.
1909 (cygwin_conv_to_win32_path): Use PC_NOFULL to force non-absolute path.
1911 2005-05-13 Christopher Faylor <cgf@timesys.com>
1913 * fhandler_netdrive.cc (fhandler_netdrive::exists): Assert that "//"
1916 2005-05-12 Christopher Faylor <cgf@timesys.com>
1918 * cygtls.cc (_cygtls::remove): Eliminate compiler warning.
1920 * dir.cc (mkdir): Check path for writability.
1921 (rmdir): Ditto. Remove check for special directories.
1922 * path.cc (path_conv::check): Set PATH_RO for virtual devices. Set
1923 error if read-only and asked for writability.
1924 * path.h (pathconv_arg): Add PC_WRITABLE.
1925 (path_types): Add PATH_RO.
1926 (path_conv::isro): Add (currently unused) check for read-only
1927 filesystem. Return "ENOSHARE" when we know a share doesn't exist.
1928 * include/sys/mount.h: Add MOUNT_RO flag.
1929 * autoload.cc (WNetGetResourceInformationA): Import.
1930 * fhandler_netdrive.cc (fhandler_netdrive::exists): Detect actual
1931 existence of remote system rather than always assuming that it exists.
1933 2005-05-11 Christopher Faylor <cgf@timesys.com>
1935 * dcrt0.cc (do_global_dtors): Don't call dll_global_dtors here.
1936 (__main): Reinstate atexit of do_global_dtors.
1937 (cygwin_exit): Call dll_global_dtors here.
1938 (do_exit): And here.
1941 2005-05-10 Christopher Faylor <cgf@timesys.com>
1943 * cygtls.cc (_cygtls::remove): Clear exitsock after close.
1944 * fhandler_console.cc (fhandler_console::write_normal): Store character
1945 in a local variable for potential future inspection.
1947 2005-05-10 Corinna Vinschen <corinna@vinschen.de>
1949 * Makefile.in (DLL_OFILES): Add fhandler_mailslot.o.
1950 * devices.h (FH_KMSG): Define new device.
1951 * devices.in: Add "/dev/kmsg" entry.
1952 * devices.cc: Regenerate.
1953 * dtable.cc (build_fh_pc): Handle case FH_KMSG.
1954 * fhandler.h (class fhandler_mailslot): New class.
1955 (class select_stuff): Add device_specific_mailslot pointer.
1956 * fhandler_mailslot.cc: New file.
1957 * select.cc (peek_mailslot): New function.
1958 (verify_mailslot): Ditto.
1959 (struct mailslotinf): New stuct to handle select on mailslots.
1960 (thread_mailslot): New function.
1961 (start_thread_mailslot): Ditto.
1962 (mailslot_cleanup): Ditto.
1963 (fhandler_mailslot::select_read): New method.
1964 * syslog.cc (klog_guard): New muto.
1965 (dev_kmsg): Local mailslot for kernel message device.
1966 (vklog): New function.
1968 * winsup.h (vklog): Declare.
1970 * include/sys/syslog.h: Define _PATH_KLOG.
1972 2005-05-10 Christopher Faylor <cgf@timesys.com>
1974 * dcrt0.cc (dll_crt0_1): Call cygwin_exit to ensure that destructors
1975 are handled correctly.
1977 2005-05-10 Corinna Vinschen <corinna@vinschen.de>
1979 * path.cc (path_conv::check): Set correct file attributes for socket
1982 2005-05-09 Pierre Humblet <pierre.humblet@ieee.org>
1984 * fhandler.h (class fhandler_netdrive): New class.
1985 * fhandler_netdrive.cc (fhandler_netdrive::fhandler_netdrive): New constructor.
1986 (fhandler_netdrive::exists): New method.
1987 (fhandler_netdrive::fstat): Ditto.
1988 (fhandler_netdrive::readdir): Ditto.
1989 (fhandler_netdrive::open): Ditto.
1990 * dtable.cc (build_fh_pc): Handle case FH_NETDRIVE.
1991 * path.cc (isvirtual_dev): Add FH_NETDRIVE.
1992 (mount_info::conv_to_win32_path): Detect netdrive device and bypass mount
1993 search for network paths.
1995 2005-05-08 Christopher Faylor <cgf@timesys.com>
1997 * dcrt0.cc (get_cygwin_startup_info): New function pulled from
1999 (dll_crt0_0): Use get_cygwin_startup_info to retrieve cygwin-specific
2001 * external.cc (cygwin_internal): Implement CW_ARGV and CW_ENVP.
2002 * include/sys/cygwin.h: Implement CW_ARGV and CW_ENVP.
2004 2005-05-07 Christopher Faylor <cgf@timesys.com>
2006 * path.cc (normalize_posix_path): Don't treat '//' specially since
2007 newer versions of bash now get this right.
2009 2005-05-07 Christopher Faylor <cgf@timesys.com>
2011 * devices.cc: Regenerate with correct name for dev_netdrive_storage.
2013 2005-05-06 Christopher Faylor <cgf@timesys.com>
2015 * Makefile.in (DLL_O_FILES): Add fhandler_netdrive.o.
2016 * fhandler_netdrive.cc: Placeholder file for future development.
2017 * devices.h (FH_NETDRIVE): Define new virtual device type.
2018 (netdrive_dev): Define.
2019 * devices.in (dev_netdrive_storage): Define.
2020 * devices.cc: Regenerate.
2022 2005-05-04 Corinna Vinschen <corinna@vinschen.de>
2024 * cygerrno.h (__set_errno): Remove useless parentheses.
2026 2005-05-04 Corinna Vinschen <corinna@vinschen.de>
2028 * cygerrno.h (__set_errno): Define as inline function here.
2029 (set_errno): Always define as call to __set_errno.
2030 * debug.cc (__set_errno): Move to cygerrno.h.
2032 2005-05-03 Christopher Faylor <cgf@timesys.com>
2034 * shared.cc (user_shared_initialize): Rework locking so that nothing is
2035 checked until cb is non-zero.
2037 2005-05-03 Corinna Vinschen <corinna@vinschen.de>
2039 * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Don't treat
2040 inability to open file as failure if only SetFileAttributes is
2041 going to be called. Only call set_file_attribute if really necessary.
2043 2005-05-03 Corinna Vinschen <corinna@vinschen.de>
2045 * fhandler_socket.cc (get_inet_addr): Add missing __seterrno call.
2047 2005-05-01 Christopher Faylor <cgf@timesys.com>
2049 * fhandler_tty.cc (fhandler_tty_slave::read): Actually read input when
2052 2005-04-30 Christopher Faylor <cgf@timesys.com>
2054 * environ.cc (spenv::force_into_environment): Rename from add_always.
2055 (spenv::add_if_exists): Rename from force.
2056 (build_env): Accommodate name changes. Make sure that stuff that is
2057 always supposed to be in the environment is actually added to the
2060 * shared.cc (open_shared): Restore VirtualFree eliminated by 2005-04-28
2063 2005-04-30 Christopher Faylor <cgf@timesys.com>
2065 * errno.cc (errmap): Sort table.
2067 2005-04-29 Christopher Faylor <cgf@timesys.com>
2069 * errno.cc (errmap): Map ERROR_NETNAME_DELETED to ENOSHARE.
2071 2005-04-28 Corinna Vinschen <corinna@vinschen.de>
2073 * shared_info.h (cygwin_shared_address): Bump to a higher value to avoid
2074 collision with large data areas.
2076 2005-04-28 Christopher Faylor <cgf@timesys.com>
2078 * fhandler_console.cc (fhandler_console::get_tty_stuff): Accommodate
2079 changes to open_shared arguments.
2080 * fhandler_tape.cc (mtinfo_init): Ditto.
2081 * pinfo.cc (pinfo::init): Use open_shared rather than win32 mmap calls.
2082 * shared.cc (user_shared_initialize): Ditto.
2083 (memory_init): Ditto.
2084 (open_shared): Change to allow use a smore general mmap handler.
2085 * shared_info.h (shared_locations): Add SH_JUSTCREATE, SH_JUSTOPEN.
2086 (open_shared): Change declaration to match new usage.
2088 * autoload.cc (LoadDLLfuncEx2): Define in terms of LoadDLLfuncEx3.
2089 (LoadDLLfuncEx3): New macro.
2091 2005-04-27 Christopher Faylor <cgf@timesys.com>
2093 * fhandler.cc (fhandler_base::open_9x): Remove (broken) check for
2095 * syscalls.cc (open): Do O_CREAT|O_EXCL check here first.
2097 2005-04-26 Christopher Faylor <cgf@timesys.com>
2099 * environ.cc (build_env): Ensure that win32 array is properly filled in
2100 when a missing value has to be generated.
2102 2005-04-26 Christopher Faylor <cgf@timesys.com>
2104 * include/cygwin/version.h: Bump DLL minor number to 17.
2106 2005-04-24 Pavel Tsekov <ptsekov@gmx.net>
2108 * how-to-debug-cygwin.txt: Fix typo.
2110 2005-04-22 Christopher Faylor <cgf@timesys.com>
2112 * shared.cc (user_shared_initialize): Implement locking similar to
2113 shared_info when initializing shared region.
2115 2005-04-22 Christopher Faylor <cgf@timesys.com>
2117 * fhandler.h (dev_console::set_color): Define new function.
2118 (dev_console::set_default_attr): Ditto, moved from fhandler_console.
2119 (dev_console::fillin_info): Ditto. Accommodate this change throughout
2121 (fhandler_console::get_win32_attr): Eliminate.
2122 * fhandler_console.cc (fhandler_console::get_tty_stuff): Properly set
2123 default attributes on initialization.
2124 (fhandler_console::open): Set current attributes rather than default
2126 (fhandler_console::get_win32_attr): Eliminate.
2127 (dev_console::set_color): New function. Move get_win32_attr stuff
2129 (dev_console::set_default_attr): New function, moved from
2131 (dev_console::fillin_info): Ditto.
2132 (fhandler_console::char_command): Call set_color to set screen
2135 2005-04-22 Christopher Faylor <cgf@timesys.com>
2137 * fhandler.cc (fhandler_base::read): Remove unused signal state tweaks.
2138 * fhandler.h (fhandler_pipe::create_selectable): Declare.
2139 (fhandler_fifo::close_one_end): Declare.
2140 * fhandler_fifo.cc (fhandler_fifo::close_one_end): Define.
2141 (fhandler_fifo::open_not_mine): Use close_one_end to close appropriate
2143 * pinfo.cc (_pinfo::commune_recv): Ditto.
2144 * pipe.cc (fhandler_pipe::create_selectable): Rename from
2145 create_selectable_pipe. Reorganize.
2146 (fhandler_pipe::create): Use create_selectable.
2148 2005-04-21 Christopher Faylor <cgf@timesys.com>
2150 * shared.cc (shared_info::initialize): Test previous version of shared
2151 memory magic rather than current version when determining if there has
2152 been a shared memory mismatch.
2154 2005-04-20 Christopher Faylor <cgf@timesys.com>
2156 * sigproc.cc (proc_subproc): Fix handling of waiting for pids with zero
2159 * strace.cc (strace::hello): Report parent pid of executing process.
2161 2005-04-20 Christopher Faylor <cgf@timesys.com>
2163 * path.cc (path_conv::check): Fix problem reading symlinks introduced
2164 in below change by reverting the change and adding an additional test
2165 for nonexistent files in /proc.
2167 2005-04-20 Christopher Faylor <cgf@timesys.com>
2169 * path.cc (path_conv::check): Punt when attempting to access a
2170 nonexistent directory or file in /proc.
2172 2005-04-19 Corinna Vinschen <corinna@vinschen.de>
2174 * security.cc (alloc_sd): Remove DELETE bit from user's ACE if
2175 allow_traverse is set.
2177 2005-04-19 Corinna Vinschen <corinna@vinschen.de>
2179 * cygwin.din (pselect): Export.
2180 * select.cc (pselect): New function.
2181 * include/cygwin/version.h: Bump API minor number.
2182 * include/sys/select.h: Include signal.h. Declare pselect.
2184 2005-04-18 Corinna Vinschen <corinna@vinschen.de>
2186 * fhandler.h (enum conn_state): Add connect_failed state.
2187 * fhandler_socket.cc (fhandler_socket::connect): Set connect_state to
2188 connect_failed when connect failed.
2189 * poll.cc (poll): Change errno to EINVAL if allocating memory fails,
2190 according to SUSv3. Add socket descriptors always to except_fds. Test
2191 for failed connect and set revents flags appropriately.
2192 * select.cc (set_bits): Set connect_state to connect_failed when
2193 select indicates failed nonblocking connect.
2194 (fhandler_dev_null::select_except): Set except_ready to false so that
2195 /dev/null is not always in except state.
2196 (peek_socket): Fix bogus conditional.
2197 (fhandler_socket::select_write): Treat all connect_states except
2198 unconnected equivalent to return consistent results.
2199 (fhandler_windows::select_except): Set except_ready to false so that
2200 /dev/windows is not always in except state.
2202 2005-04-18 Christopher Faylor <cgf@timesys.com>
2204 * include/cygwin/version.h: Bump DLL minor number to 16.
2206 2005-04-18 Pierre Humblet <pierre.humblet@ieee.org>
2208 * grp.cc (initgroups32): Return the correct value.
2210 2005-04-16 Corinna Vinschen <corinna@vinschen.de>
2212 * fhandler_disk_file.cc (fhandler_base::utimes_fs): Ignore
2213 ERROR_NOT_SUPPORTED to workaround Win9x weirdness.
2214 * path.cc (symlink_info::check): Remap ERROR_INVALID_FUNTION to
2215 ERROR_FILE_NOT_FOUND for the same reason.
2217 2005-04-16 Corinna Vinschen <corinna@vinschen.de>
2218 Pierre Humblet <pierre.humblet@ieee.org>
2220 * security.h (cygsidlist::addfromgr): Allow duplicate entries.
2221 (get_server_groups): Declare new function.
2222 * security.cc (is_group_member): Simplify.
2223 (get_server_groups): New function.
2224 (get_initgroups_sidlist): Call get_server_groups.
2225 (verify_token): Allow token when supplementary sids are not in
2226 /etc/group but are in the token.
2227 Streamline the code.
2228 * grp.cc (initgroups32): New implementation.
2229 (getgroups32): Handle case where the supplementary groups are set.
2231 2005-04-16 Corinna Vinschen <corinna@vinschen.de>
2233 * environ.cc (environ_init): Don't set traverse checking as default.
2235 2005-04-16 Corinna Vinschen <corinna@vinschen.de>
2237 * fhandler_disk_file.cc (fhandler_base::utimes_fs): Drop touching
2240 2005-04-16 Christopher Faylor <cgf@timesys.com>
2242 * fhandler.cc (fhandler::dup): Duplicate flags, too.
2243 * fhandler.h (fhandler_fifo::owner): Eliminate.
2244 * fhandler_disk_file.cc (fhandler_base::fstat_fs): Handle on-disk
2246 (fhandler_base::fstat_helper): Ditto.
2247 * fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Don't initialize
2249 (fhandler_fifo::open_not_mine): Add some debugging. Duplicate correct
2250 handle when we own it.
2251 (fhandler_fifo::open): Set flags from input, not from first pipe. Flag
2252 that fork fixup is needed.
2253 (fhandler_fifo::dup): Set errno correctly when DuplicateHandle fails.
2254 * pinfo.cc (commune_send): Add debugging for fifo.
2256 * cygwin/version.h: Bump API minor version to 127 to reflect exporting
2259 2005-04-14 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
2261 * syscalls.cc (setuid32): Correct debugging output.
2263 2005-04-14 Christopher Faylor <cgf@timesys.com>
2265 * dcrt0.cc (do_global_dtors): Run DLL dtors.
2266 (__main): Don't rely on atexit to run dtors.
2267 (do_exit): Specifically call do_global_dtors here.
2268 (cygwin_exit): Ditto.
2269 * dll_init.cc (dll_global_dtors): Make global. Only run dtors once.
2270 (dll_list::init): Just set flag that dtors should be run. Don't rely on atexit.
2271 * dll_init.h (dll_global_dtors): Declare.
2273 * exceptions.cc (sigrelse): Define.
2275 * path.h (is_fs_device): New method.
2276 (is_lnk_special): Ditto.
2277 * fhandler_disk_file.cc (fhandler_disk_file::link): Use
2278 "is_lnk_special" rather than "is_lnk_symlink".
2279 * syscalls.cc (rename): Ditto.
2281 * hookapi.cc (ld_preload): Use colon as a separator rather than space.
2283 2005-04-13 Corinna Vinschen <corinna@vinschen.de>
2285 * fhandler.h (class fhandler_socket): Remove utimes.
2286 * fhandler_socket.cc (fhandler_socket::utimes): Remove.
2288 2005-04-13 Corinna Vinschen <corinna@vinschen.de>
2290 * cygerrno.h (__seterrno_from_nt_status): Define. Always set Win32
2291 error code as well as errno. Use throughout where errno is set from
2293 (set_errno): Evaluate val only once.
2294 * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Fix typo in
2296 * fhandler_mem.cc (fhandler_dev_mem::open): Rely on
2297 __seterrno_from_nt_status setting Win32 error code in debug output.
2298 * fhandler_proc.cc (format_proc_uptime): Ditto.
2299 (format_proc_stat): Ditto.
2300 * fhandler_process.cc (format_process_stat): Ditto.
2301 * sysconf.cc (sysconf): Ditto.
2303 2005-04-13 Christopher Faylor <cgf@timesys.com>
2305 * fhandler.h (fhandler_base::utimes_fs): New method.
2306 * fhandler.cc (fhandler_base::utimes): Call utimes_fs if on-disk
2308 * fhandler_disk_file.cc (fhandler_disk_file::utimes): Use utimes_fs.
2309 (fhandler_base::utimes_fs): Handle on-disk device files.
2311 2005-04-13 Corinna Vinschen <corinna@vinschen.de>
2313 * fhandler_disk_file.cc (fhandler_disk_file::utimes): Don't set errno
2314 if open fails, it has already been set by open.
2316 2005-04-12 Corinna Vinschen <corinna@vinschen.de>
2318 * autoload.cc (NtQueryVolumeInformationFile): Add.
2319 * fhandler.cc (fhandler_base::raw_write): Don't touch has_changed flag.
2320 * fhandler.h (enum change_state): Remove.
2321 (fhandler_base::status): Revert has_changed to a simple bit.
2322 (fhandler_base::fstat_helper): Add nAllocSize parameter. Rename
2323 ftCreationTime to ftChangeTime.
2324 * fhandler_disk_file.cc: Call fstat_helper with additional
2325 allocation size throughout.
2326 (fhandler_base::fstat_by_handle): Use NT native functions to get
2327 full file information on NT. Call fstat_helper with LastWriteTime
2328 as ctime, if ChangeTime is not available.
2329 (fhandler_base::fstat_by_name): Call fstat_helper with LastWriteTime
2331 (fhandler_base::fstat_helper): Add comment. Drop special FAT
2332 handling since it's useless. Use nAllocSize for st_blocks if available.
2333 (fhandler_disk_file::touch_ctime): Only touch LastWriteTime.
2334 (fhandler_disk_file::fchmod): Set has_changed on 9x only.
2335 (fhandler_disk_file::fchown): Don't set has_changed.
2336 (fhandler_disk_file::facl): Ditto.
2337 (fhandler_disk_file::ftruncate): Ditto.
2338 (fhandler_disk_file::link): Set has_changed on 9x only and on original
2340 (fhandler_base::open_fs): Don't set has_changed in O_TRUNC case.
2341 * ntdll.h (FILE_BASIC_INFORMATION): Define.
2342 (FILE_STANDARD_INFORMATION): Define.
2343 (FILE_INTERNAL_INFORMATION): Define.
2344 (FILE_EA_INFORMATION): Define.
2345 (FILE_ACCESS_INFORMATION): Define.
2346 (FILE_POSITION_INFORMATION): Define.
2347 (FILE_MODE_INFORMATION): Define.
2348 (FILE_ALIGNMENT_INFORMATION): Define.
2349 (FILE_NAME_INFORMATION): Don't define with arbitrary FileName size.
2350 (FILE_ALL_INFORMATION): Define.
2351 (FILE_INFORMATION_CLASS): Add FileAllInformation.
2352 (FILE_FS_VOLUME_INFORMATION): Define.
2353 (FS_INFORMATION_CLASS): Define.
2354 (NtQueryVolumeInformationFile): Define.
2356 2005-04-11 Corinna Vinschen <corinna@vinschen.de>
2358 Revert previous patch.
2359 * autoload.cc (GetVolumePathNamesForVolumeNameA): Remove.
2360 (GetVolumeNameForVolumeMountPointA): Add.
2361 * syscalls.cc (sync): Rewrite guid case to skip floppies also on
2364 2005-04-11 Corinna Vinschen <corinna@vinschen.de>
2366 * syscalls.cc (sync): Use renamed has_get_volume_pathnames wincap.
2367 * wincap.h (wincaps::has_get_volume_pathnames): Rename from
2369 * wincap.cc: Accomodate above rename throughout. Set to false on
2372 2005-04-08 Christopher Faylor <cgf@timesys.com>
2374 * pipe.cc (fhandler_pipe::open): Remove O_CREAT limitation.
2376 2005-04-07 Corinna Vinschen <corinna@vinschen.de>
2378 * syslog.cc (try_connect_guard): Remove useless conditionalized code.
2380 2005-04-07 Corinna Vinschen <corinna@vinschen.de>
2382 * syslog.cc: Include sys/socket.h.
2383 (try_connect_guard): New static variable.
2384 (syslogd_inited): Ditto.
2385 (syslogd_sock): Ditto.
2386 (try_connect_syslogd): New function to connect and write syslog to
2388 (vsyslog): Log to stderr if LOG_PERROR flag has been given to openlog.
2389 Try logging to syslogd. Use Event Log resp. log file as fallback.
2390 (closelog): Close socket to syslogd.
2391 * include/sys/syslog.h (_PATH_LOG): Define.
2392 (INTERNAL_NOPRI): Define if SYSLOG_NAMES is defined.
2393 (INTERNAL_MARK): Ditto.
2394 (struct _code): Ditto.
2395 (prioritynames): Ditto.
2396 (facilitynames): Ditto.
2398 2005-04-06 Corinna Vinschen <corinna@vinschen.de>
2400 * fhandler_socket.cc (get_inet_addr): Add type parameter to return
2401 unix socket type. Read socket type from unix socket file.
2402 (fhandler_socket::bind): Write socket type to unix socket file.
2403 (fhandler_socket::connect): Return with errno EPROTOTYPE if
2404 socket type of socket doesn't match socket type of unix socket
2405 trying to connect to.
2407 2005-04-06 Pierre Humblet <pierre.humblet@ieee.org>
2409 * security.h (cygsidlist::addfromgr): Avoid duplicate entries.
2410 * grp.cc (initgrousp): Add syscall_printf.
2411 (setgroups): Add syscall_printf and make sure sids are added only once.
2413 2005-04-06 Christopher Faylor <cgf@timesys.com>
2415 * net.cc (cygwin_getservbyname): Return (possibly NULL) return value of
2416 dup_ent rather than assuming that tls buffer is valid.
2417 (cygwin_getservbyport): Ditto.
2418 (cygwin_gethostbyname): Ditto.
2419 (cygwin_gethostbyaddr): Ditto.
2421 2005-04-05 Christopher Faylor <cgf@timesys.com>
2423 * cygtls.cc (_cygtls::remove): Don't free or close stuff if we're being
2424 called in a "non-standard" way.
2426 2005-04-05 Christopher Faylor <cgf@timesys.com>
2428 * sync.h (muto::initforce): Delete flawed implementation.
2429 * pwdgrp.h (pwdgrp::pglock): Make static.
2430 * grp.cc (pwdgrp::pwdgrp): Eliminate use of initforce.
2432 2005-04-05 Christopher Faylor <cgf@timesys.com>
2434 * sync.h (muto::initforce): Force initialization even when name !=
2436 * grp.cc (pwdgrp::pwdgrp): Use initforce since the enclosing structure
2439 2005-04-05 Christopher Faylor <cgf@timesys.com>
2441 * sync.h (muto::operator int): New operator.
2442 (locker): Remove unused class.
2445 (new_muto_name): Ditto.
2446 * cygheap.cc (cygheap_setup_for_child): Reflect use of static storage
2447 for muto rather than pointer.
2452 * cygheap.h (cwdstuff::cwd_lock): Ditto.
2453 (cwdstuff::get_drive): Ditto.
2454 * cygmalloc.h (__malloc_lock): Ditto.
2455 (__malloc_unlock): Ditto.
2456 * cygtls.cc (sentry::lock): Ditto.
2457 (sentry::sentry): Ditto.
2459 (_cygtls::init): Ditto.
2461 (cygwin_atexit): Ditto.
2462 (cygwin_exit): Ditto.
2463 * debug.cc (lock_debug::locker): Ditto.
2464 (lock_debug::lock_debug): Ditto.
2465 (lock_debug::unlock): Ditto.
2466 (debug_init): Ditto.
2467 * dtable.cc (dtable::init_lock): Ditto.
2468 * dtable.h (dtable::lock_cs): Ditto.
2469 (dtable::lock): Ditto.
2470 (dtable::unlock): Ditto.
2471 * exceptions.cc (mask_sync): Ditto.
2473 (set_process_mask_delta): Ditto.
2474 (set_signal_mask): Ditto.
2475 (events_init): Ditto.
2476 * grp.cc (pwdgrp::pwdgrp): Ditto.
2477 * malloc_wrapper.cc (mallock): Ditto.
2478 (malloc_init): Ditto.
2479 * path.cc (cwdstuff::cwd_lock): Ditto.
2480 (cwdstuff::get_hash): Ditto.
2481 (cwdstuff::get_hash): Ditto.
2482 (cwdstuff::init): Ditto.
2483 (cwdstuff::set): Ditto.
2484 (cwdstuff::get): Ditto.
2485 * pwdgrp.h (pwdgrp::pglock): Ditto.
2486 (pwdgrp::refresh): Ditto.
2487 * sigproc.cc (sync_proc_subproc): Ditto.
2488 (get_proc_lock): Ditto.
2489 (proc_subproc): Ditto.
2490 (_cygtls::remove_wq): Ditto.
2491 (proc_terminate): Ditto.
2492 (sigproc_init): Ditto.
2493 * timer.cc (lock_timer_tracker::protect): Ditto.
2494 (lock_timer_tracker::lock_timer_tracker): Ditto.
2495 (lock_timer_tracker::~lock_timer_tracker): Ditto.
2496 * wininfo.cc (wininfo::_lock;): Ditto.
2497 (wininfo::winthread): Ditto.
2498 (operator HWND): Ditto.
2499 (wininfo::lock): Ditto.
2500 (wininfo::release): Ditto.
2501 * wininfo.h (wininfo::_lock;): Ditto.
2503 2005-04-04 Christopher Faylor <cgf@timesys.com>
2505 * path.cc (path_conv::check): Only check for PC_NO_ACCESS_CHECK in end
2508 2005-04-04 Corinna Vinschen <corinna@vinschen.de>
2510 * dcrt0.cc (dll_crt0_1): Don't call set_cygwin_privileges on 9x.
2512 * fhandler.h (enum change_state): Add.
2513 (fhandler_base::status): Add a bit to has_changed flag.
2514 (fhandler_base::has_changed): Implement with type change_state.
2515 * fhandler.cc (fhandler_base::raw_write): Accommodate type change
2517 * fhandler_disk_file.cc (fhandler_disk_file::touch_ctime): Also
2518 touch modification time if has_changed == data_changed.
2519 (fhandler_disk_file::fchmod): Also open on 9x, otherwise we can't
2520 touch ctime. Accommodate type change of has_changed.
2521 (fhandler_disk_file::fchown): Accommodate type change of has_changed.
2522 (fhandler_disk_file::facl): Ditto.
2523 (fhandler_disk_file::ftruncate): Ditto.
2524 (fhandler_disk_file::link): Ditto.
2525 (fhandler_base::open_fs): Ditto.
2527 2005-04-03 Corinna Vinschen <corinna@vinschen.de>
2529 * cygheap.cc (cygheap_init): Accommodate set_process_privilege change.
2530 * cygheap.h (cygheap_user::curr_primary_token): New member.
2531 (cygheap_user::primary_token): New method.
2532 (cygheap_user::deimpersonate): Always revert to processes'
2533 impersonation token.
2534 (cygheap_user::reimpersonate): Set processes' or setuid token as
2536 (cygheap_user::has_impersonation_tokens): Look for curr_primary_token
2538 (cygheap_user::close_impersonation_tokens): Close curr_primary_token
2539 here if necessary. Don't reset token values to NO_IMPERSONATION since
2540 that's done in uinfo_init anyway.
2541 (init_cygheap::luid): New LUID array keeping privilege LUIDs.
2542 * cygtls.cc (_cygtls::init_thread): Call cygheap->user.reimpersonate.
2543 * dcrt0.cc (hProcToken): New global variable to keep process token.
2544 (hProcImpToken): Ditto for process impersonation token.
2545 (dll_crt0_0): Open process token here once. Duplicate to create
2547 (dll_crt0_1): Call set_cygwin_privileges.
2548 * environ.cc (allow_ntea): Drop duplicate declaration.
2549 (allow_smbntsec): Ditto.
2550 (set_traverse): Only set allow_traverse here.
2551 (environ_init): Ditto.
2552 * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Drop call to
2553 enable_restore_privilege.
2554 (fhandler_disk_file::fchown): Ditto.
2555 (fhandler_disk_file::facl): Ditto.
2556 * fork.cc (fork_child): Move call to cygheap->user.reimpersonate after
2557 syn with parent. Call set_cygwin_privileges.
2558 * grp.cc (internal_getgroups): Use hProcImpToken instead of opening
2560 * path.cc (fs_info::update): Bypass traverse checking when retrieving
2561 volume information using push/pop_thread_privileges.
2562 * registry.cc (load_registry_hive): Drop setting restore privilege
2563 since it's already set if available.
2564 * sec_helper.cc: Include cygtls.h.
2565 (cygpriv): Privilege string array.
2566 (privilege_luid): New function, evaluate LUID from cygpriv_idx.
2567 (privilege_luid_by_name): New function, evaluate LUID from privilege
2569 (privilege_name): New function, evaluate privilege string from
2571 (set_privilege): New static function called by set_process_privilege
2572 and set_thread_privilege. Call privilege_luid to get privilege LUID.
2573 Fix bug in return value evaluation. Improve debug output.
2574 (set_cygwin_privileges): New function.
2575 (set_process_privilege): Remove.
2576 (enable_restore_privilege): Remove.
2577 * security.cc (allow_traverse): New global variable.
2578 (sys_privs): Change type to cygpriv_idx and store privilege indices
2580 (SYSTEM_PRIVILEGES_COUNT): Renamed from SYSTEM_PERMISSION_COUNT.
2581 (get_system_priv_list): Don't use numerical constant in malloc call.
2582 Use privilege_luid to get privilege LUIDs.
2583 (get_priv_list): Call privilege_luid_by_name to get LUIDs. Improve
2584 inner privilege LUID comparison loop.
2585 (create_token): Enable create token privilege using
2586 push/pop_self_privileges. Use hProcToken instead of opening process
2587 token. Use default DACL when duplicating token.
2588 (subauth): Enable tcb privilege using push/pop_self_privileges.
2589 Use sec_none instead of homw made security attributes when duplicating
2591 (check_file_access): Don't duplicate access token, use active
2592 impersonation token as is.
2593 * security.h (enum cygpriv_idx): New enumeration type enumerating
2594 possible privileges.
2595 (privilege_luid): Declare new function.
2596 (privilege_luid_by_name): Ditto.
2597 (privilege_name): Ditto.
2598 (allow_traverse): Declare.
2599 (set_privilege): Declare function.
2600 (set_process_privilege): Define as macro.
2601 (enable_restore_privilege): Remove declaration.
2602 (_push_thread_privilege): Define macro.
2603 (push_thread_privilege): Ditto.
2604 (pop_thread_privilege): Ditto.
2605 (pop_self_privilege): Ditto.
2606 * spawn.cc (spawn_guts): Use cygheap->user.primary_token instead of
2607 cygheap->user.token.
2608 * syscalls.cc (statvfs): Bypass traverse checking when retrieving
2609 volume information using push/pop_thread_privileges. Rearrange code
2610 to simplify push/pop bracketing.
2611 (seteuid32): Use hProcToken instead of opening process token. Call
2612 cygheap->user.deimpersonate instead of RevertToSelf. Create
2613 impersonation token from primary internal or external token. Set
2614 cygheap->user.curr_primary_token and cygheap->user.current_token
2615 privileges once here. Drop "failed" and "failed_ptok" labels.
2616 Drop setting DefaultDacl of process token.
2617 (setegid32): Use hProcToken and hProcImpToken instead of opening
2618 process token. Always reimpersonate afterwards.
2619 * uinfo.cc (cygheap_user::init): Use hProcToken instead of opening
2621 (internal_getlogin): Ditto. Set hProcImpToken, too.
2622 (uinfo_init): Initialize cygheap->user.curr_primary_token.
2623 * winsup.h (hProcToken): Declare.
2624 (hProcImpToken): Declare.
2626 2005-04-03 Corinna Vinschen <corinna@vinschen.de>
2628 Unify usage of CYG_MAX_PATH throughout. Change buffers from
2629 size CYG_MAX_PATH + 1 to CYG_MAX_PATH. Change length tests
2632 2005-04-02 Christopher Faylor <cgf@timesys.com>
2634 * include/cygwin/version.h: Bump DLL minor number to 15.
2636 2005-04-01 Corinna Vinschen <corinna@vinschen.de>
2638 * fork.cc (fork_child): Add missing __stdcall.
2640 2005-04-01 Christopher Faylor <cgf@timesys.com>
2642 * sigproc.cc (create_signal_arrive): New (temporary?) function to
2643 create signal_arrived event.
2644 (sigproc_init): Use create_signal_arrived.
2645 * fork.cc (fork_child): Create signal_arrived early.
2647 2005-04-01 Corinna Vinschen <corinna@vinschen.de>
2649 * fork.cc (fork_child): Fixup SYSV IPC shared memory before fixing
2652 2005-03-31 Corinna Vinschen <corinna@vinschen.de>
2654 * gentls_offsets: Add '-m32' flag to native compiler call to satisfy
2655 cross platform builds.
2657 2005-03-31 Corinna Vinschen <corinna@vinschen.de>
2659 * errno.cc (NO_SYSTEM_RESOURCES): Map to EAGAIN.
2660 (NONPAGED_SYSTEM_RESOURCES): Ditto.
2661 (PAGED_SYSTEM_RESOURCES): Ditto.
2662 (WORKING_SET_QUOTA): Ditto.
2663 (PAGEFILE_QUOTA): Ditto.
2664 (COMMITMENT_LIMIT): Ditto.
2666 2005-03-30 Christopher Faylor <cgf@timesys.com>
2668 * environ.cc (spenvs): Re-force SYSTEMROOT to always be included in
2672 2005-03-30 Christopher Faylor <cgf@timesys.com>
2674 * environ.cc (spenv::retrieve): Revert most of previous change.
2675 (build_env): Ditto. Rework to track environment variables which need
2676 to always be in the windows environment in a separate array.
2678 2005-03-30 Igor Pechtchanski <pechtcha@cs.nyu.edu>
2680 * path.cc (symlink_info::case_check): Ignore trailing characters
2681 in paths when comparing case.
2683 2005-03-30 Christopher Faylor <cgf@timesys.com>
2685 * environ.h (win_env::immediate): Declare new field.
2686 (win_env::operator = ): Declare new operator.
2687 (win_env::reset): Declare new function.
2688 (win_env::~win_env): Declare new destructor.
2689 (getwinenv): Add optional third argument to declaration.
2690 * environ.cc (conv_envvars): Accommodate immediate field.
2691 (win_env::operator =): Define new operator.
2692 (win_env::~win_env): Define new destructor.
2693 (win_env::add_cache): Add value to environment immediately if
2695 (getwinenv): Accept optional third argument which will be used to store
2696 "cached" values to avoid overwriting real cache.
2697 (spenv::force): Declare new field.
2698 (spenvs): Accommodate force field. Add "PATH=" with force set to true.
2699 (spenv::retrieve): Avoid duping anything if we're not building an
2701 (build_env): Ditto. Use size of potentially constructed new
2702 environment block to determine if we need to create an environment
2703 block. Pass getwinenv temporary storage to avoid inappropriately
2704 overwriting the environment cache.
2706 2005-03-29 Eric Blake <ebb9@byu.net>
2708 * include/limits.h (NAME_MAX): New define.
2709 (PATH_MAX): POSIX allows PATH_MAX to include trailing NUL.
2711 2005-03-29 Corinna Vinschen <corinna@vinschen.de>
2713 * path.cc (is_floppy): Make externally available.
2714 * path.h (is_floppy): Declare.
2715 * syscalls.cc (sync): Check for floppies on A: and B: in guid case.
2716 Don't call setmntent in non-guid case but evaluate drive bit mask
2719 2005-03-29 Corinna Vinschen <corinna@vinschen.de>
2721 * fhandler_process.cc: Re-add exename.
2723 2005-03-28 Christopher Faylor <cgf@timesys.com>
2725 * include/ctype.h: Accommodate building in newlib.
2727 2005-03-28 Christopher Faylor <cgf@timesys.com>
2729 * timer.cc (getitimer): Check that ovalue is a valid pointer, not just
2732 2005-03-28 Christopher Faylor <cgf@timesys.com>
2734 * timer.cc (timer_tracker::settime): Set times to zero when just
2737 2005-03-28 Christopher Faylor <cgf@timesys.com>
2739 * cygthread.cc (cygthread::detach): Revert to just waiting for thread
2740 event since waiting for anything else is racy.
2741 * timer.cc (timer_tracker::hcancel): Rename from cancel.
2742 (timer_tracker::cancel): New method.
2743 (timer_tracker::th): Remove.
2744 (timer_tracker::~timer_tracker): Call cancel method.
2745 (timer_tracker::timer_tracker): Ditto.
2746 (timer_tracker::timer_tracker): Always, clear cancel, even though it is
2747 probably not strictly necessary for ttstart.
2748 (timer_thread): Accommodate cancel -> hcancel rename.
2749 (timer_tracker::settime): Ditto.
2750 (timer_tracker::gettime): Ditto.
2751 (timer_delete): Ditto.
2753 * cygwin.din: Export _ctype_.
2754 * include/ctype.h: Mark that _ctype_ is imported.
2756 2005-03-28 Christopher Faylor <cgf@timesys.com>
2758 * timer.cc (timer_tracker::timer_tracker): Eliminate simple
2760 (ttstart): Fully initialize.
2762 * errno.cc: Fix typo introduced in previous change.
2764 2005-03-28 Eric Blake <ebb9@byu.net>
2766 * errno.cc (FILENAME_EXCED_RANGE): Map to ENAMETOOLONG.
2768 2005-03-27 Christopher Faylor <cgf@timesys.com>
2770 * signal.cc (nanosleep): Revert tv_sec < 0 check as it is fixed
2771 properly in the below change to hires.h.
2773 2005-03-27 Pierre Humblet <pierre.humblet@ieee.org>
2775 * times.cc (hires_ms::usecs): Compare the difference.
2776 * hires.h: Add parentheses to HIRES_DELAY_MAX.
2778 2005-03-26 Christopher Faylor <cgf@timesys.com>
2780 * timer.cc (nanosleep): Treat tv_sec < 0 as invalid.
2782 * include/search.h: Make declarations consistent with newlib.
2784 2005-03-26 Pierre Humblet <pierre.humblet@ieee.org>
2785 Christopher Faylor <cgf@timesys.com>
2787 * wininfo.h (wininfo::timer_active): Delete.
2788 (wininfo::itv): Ditto.
2789 (wininfo::start_time): Ditto.
2790 (wininfo::window_started): Ditto.
2791 (wininfo::getitimer): Ditto.
2792 (wininfo::setitimer): Ditto.
2793 (wininfo::wininfo): Ditto.
2794 (wininfo::lock): New method.
2795 (wininfo::release): Ditto.
2796 * window.cc: Use new lock/acquire wininfo methods throughout.
2797 (wininfo::wininfo): Delete
2798 (wininfo::getitimer): Ditto.
2799 (wininfo::setitimer): Ditto.
2804 (wininfo::lock): Define new function.
2805 (wininfo::release): Ditto.
2806 (wininfo::process): Delete WM_TIMER handling.
2807 * timer.cc (struct timetracker): Delete it, flags. Add it_interval,
2808 interval_us, sleepto_us, running, init_muto(), syncthread, and
2810 (ttstart): Make NO_COPY.
2811 (lock_timer_tracker): New class.
2812 (timer_tracker::timer_tracker): Distinguish ttstart case.
2813 (timer_tracker::~timer_tracker): New destructor. Clean out events, and
2815 (timer_tracker::init_muto): New method.
2816 (to_us): Round up as per POSIX.
2817 (timer_thread): Reorganize to match timer_tracker::settime and
2818 timer_tracker::gettime. Call sig_send without wait. Call
2820 (timer_tracker::settime): Reorganize logic to avoid race. Call gettime
2821 to recover old value.
2822 (timer_tracker::gettime): New method.
2823 (timer_create): Properly set errno on invalid timerid. Use new
2824 lock_timer_tracker method.
2825 (timer_delete): Ditto. Simplify code slightly.
2826 (timer_gettime): New function.
2827 (fixup_timers_after_fork): Reinit ttstart.
2828 (getitimer): New implementation.
2832 * cygwin.din: Export timer_gettime.
2833 * winsup.h: Remove has has_visible_window_station declaration.
2835 2005-03-26 Christopher Faylor <cgf@timesys.com>
2837 * Makefile.in (DLL_OFILES): Add lsearch.o.
2838 * cygthread.h (cygthread::notify_detached): New element.
2839 (cygthread::cygthread): Take optional fourth argument signifying event
2840 to signal on thread completion.
2841 * cygthread.cc (cygthread::stub): Signal notify_detached event, if it
2843 (cygthread::cygthread): Initialize notify_detached from fourth argument.
2844 (cygthread::detach): Wait for notify_detached field is present.
2846 * lsearch.cc: New file.
2848 * include/cygwin/version.h: Bump API minor number to 126.
2849 * cygwin.din: Export lsearch, lfind.
2851 2005-03-23 Corinna Vinschen <corinna@vinschen.de>
2853 * fhandler.h (fhandler_socket::secret_event): Remove.
2854 (fhandler_socket::af_local_set_secret): New function combining former
2855 set_connect_secret and get_connect_secret into one function.
2856 (fhandler_socket::af_local_setblocking): Rename from eid_setblocking.
2857 (fhandler_socket::af_local_unsetblocking): Rename from
2859 (fhandler_socket::af_local_set_cred): New method.
2860 (fhandler_socket::af_local_copy): New method.
2861 (fhandler_socket::af_local_recv_secret): New method.
2862 (fhandler_socket::af_local_send_secret): New method.
2863 (fhandler_socket::af_local_recv_cred): Rename from eid_recv.
2864 (fhandler_socket::af_local_send_cred): Rename from eid_send.
2865 (fhandler_socket::af_local_accept): New method.
2866 (fhandler_socket::af_local_set_sockpair_cred): Rename from
2867 set_socketpair_eids.
2868 (fhandler_socket::eid_accept): Remove.
2869 (fhandler_socket::eid_connect): Remove.
2870 (fhandler_socket::set_connect_secret): Remove.
2871 (fhandler_socket::get_connect_secret): Remove.
2872 (fhandler_socket::create_secret_event): Remove.
2873 (fhandler_socket::check_peer_secret_event): Remove.
2874 (fhandler_socket::signal_secret_event): Remove.
2875 (fhandler_socket::close_secret_event): Remove.
2876 (fhandler_socket::sec_event_accept): Remove.
2877 (fhandler_socket::sec_event_connect): Remove.
2878 * fhandler_socket.cc (secret_event_name): Remove.
2879 (fhandler_socket::af_local_set_sockpair_cred): Rename from
2880 set_socketpair_eids.
2881 (fhandler_socket::af_local_setblocking): Rename from eid_setblocking.
2882 (fhandler_socket::af_local_unsetblocking): Rename from
2884 (fhandler_socket::af_local_recv_secret): New function to receive
2885 AF_LOCAL connect secret over socket itself.
2886 (fhandler_socket::af_local_send_secret): New function to send AF_LOCAL
2887 connect secret over socket itself.
2888 (fhandler_socket::af_local_recv_cred): Rename from eid_recv.
2889 (fhandler_socket::af_local_send_cred): Rename from eid_send.
2890 (fhandler_socket::eid_connect): Remove.
2891 (fhandler_socket::af_local_connect): Take over connect side handling
2892 of AF_LOCAL secret and credential handshake.
2893 (fhandler_socket::eid_accept): Remove.
2894 (fhandler_socket::af_local_accept): New method, take over accept side
2895 handling of AF_LOCAL secret and credential handshake.
2896 (fhandler_socket::af_local_set_cred): New method, set eid credentials
2898 (fhandler_socket::af_local_copy): New method, copy secret and
2899 credentials to another socket.
2900 (fhandler_socket::af_local_set_secret): New function combining former
2901 set_connect_secret and get_connect_secret into one function.
2902 (fhandler_socket::create_secret_event): Remove.
2903 (fhandler_socket::signal_secret_event): Remove.
2904 (fhandler_socket::close_secret_event): Remove.
2905 (fhandler_socket::check_peer_secret_event): Remove.
2906 (fhandler_socket::sec_event_connect): Remove.
2907 (fhandler_socket::sec_event_accept): Remove.
2908 (fhandler_socket::fixup_after_fork): Drop secret_event handling.
2909 (fhandler_socket::bind): Call af_local_set_secret.
2910 (fhandler_socket::connect): Call af_local_set_cred and af_local_connect.
2911 (fhandler_socket::listen): Call af_local_set_cred.
2912 (fhandler_socket::accept): Call af_local_copy and af_local_accept on
2914 (fhandler_socket::close): Don't call close_secret_event.
2915 (fhandler_socket::set_close_on_exec): Don't set secret_event
2917 * net.cc (cygwin_getsockopt): Add debug output.
2918 (socketpair): Call af_local_set_sockpair_cred instead of
2919 set_socketpair_eids.
2920 * select.cc (set_bits): Drop AF_LOCAL special handling in case
2923 2005-03-23 Christopher Faylor <cgf@timesys.com>
2925 * include/ctype.h: Always define macros when inside cygwin.
2926 (isblank): New macro.
2928 2005-03-23 Corinna Vinschen <corinna@vinschen.de>
2930 * fhandler.h (fhandler_socket::eid_connect): Make private.
2931 (fhandler_socket::set_connect_secret): Ditto.
2932 (fhandler_socket::get_connect_secret): Ditto.
2933 (fhandler_socket::create_secret_event): Ditto. Remove secret argument.
2934 (fhandler_socket::check_peer_secret_event): Ditto.
2935 (fhandler_socket::signal_secret_event): Make private.
2936 (fhandler_socket::close_secret_event): Ditto.
2937 (fhandler_socket::sec_event_accept): New private method.
2938 (fhandler_socket::sec_event_connect): Ditto.
2939 (fhandler_socket::af_local_connect): New public method.
2940 * fhandler_socket.cc: Use 'struct sockaddr' and 'struct sockaddr_in'
2941 rather than just 'sockaddr' and 'sockaddr_in' throughout.
2942 (fhandler_socket::eid_connect): Drop AF_LOCAL/SOCK_STREAM test.
2943 (fhandler_socket::create_secret_event): Remove secret argument.
2944 Always use connect_secret instead.
2945 (fhandler_socket::check_peer_secret_event): Ditto.
2946 (fhandler_socket::sec_event_connect): New method, combining entire
2947 secret event handshake on connect side.
2948 (fhandler_socket::af_local_connect): New method, combining secret
2949 event handshake and eid credential transaction on connect side, to
2950 be called from select.
2951 (fhandler_socket::sec_event_accept): New method, combining entire
2952 secret event handshake on accept side.
2953 (fhandler_socket::connect): Drop secret, use connect_secret instead.
2954 Move entire secret event handshake to sec_event_connect.
2955 (fhandler_socket::accept): Move entire secret event handshake to
2957 * select.cc (set_bits): Just call af_local_connect here.
2959 2005-03-23 Christopher Faylor <cgf@timesys.com>
2961 * include/cygwin/version.h: Change comment for most recent API version
2962 bump to reflect new additions to the DLL and to remove change obsoleted
2963 by the previous checkin.
2965 2005-03-23 Christopher Faylor <cgf@timesys.com>
2967 * include/ctype.h: New file.
2969 * Makefile.in: Add ctype.o to DLL_OFILES.
2970 * cygwin.din: Remove _ctype_ptr (for now?).
2972 2005-03-22 Christopher Faylor <cgf@timesys.com>
2974 * Makefile.in (DLL_OFILES): Add hookapi.o. Eliminate some cruft.
2975 * cygheap.h (cygheap_types): Add new enum: HEAP_1_HOOK.
2976 (hook_chain): New struct.
2977 (init_cygheap::hooks): Define new element.
2978 * cygheap.cc (cygheap_fixup_in_child): Zero hook chain on exec.
2979 * dcrt0.cc (dll_crt0_1): Call ld_preload just before calling main function.
2980 * external.cc (cygwin_internal): Implement CW_HOOK.
2981 * fork.cc (fork_child): Call fixup_hooks_after_fork.
2982 * init.cc (cygwin_hmodule): Reinstate after a long absence.
2983 * include/sys/cygwin.h: Define CW_HOOK.
2984 * hookapi.cc: New file.
2986 * select.cc (start_thread_socket): Add debugging output.
2988 * fhandler_disk_file.cc (fhandler_disk_file::fchmod): gcc 4.x
2991 * fhandler_socket.cc (fhandler_socket::connect): Make sure that err is
2994 2005-03-22 Corinna Vinschen <corinna@vinschen.de>
2996 * cygwin.din (__ctype_ptr): Export.
2997 * include/cygwin/version.h: Bump API minor version.
2999 2005-03-21 Corinna Vinschen <corinna@vinschen.de>
3001 * fhandler.h (class cygthread): Remove forward declaration.
3003 2005-03-21 Corinna Vinschen <corinna@vinschen.de>
3005 * fhandler.h (class cygthread): Forward declare.
3006 (fhandler_socket::sec_pipe): Remove.
3007 (fhandler_socket::eid_pipe_name): Remove.
3008 (fhandler_socket::eid_setblocking): New private method.
3009 (fhandler_socket::eid_unsetblocking): Ditto
3010 (fhandler_socket::eid_recv): Ditto
3011 (fhandler_socket::eid_send): Ditto
3012 (fhandler_socket::eid_accept): Ditto
3013 (fhandler_socket::eid_connect): New public method.
3014 * fhandler_socket.cc (ASYNC_MASK): Move to beginning of file.
3015 (fhandler_socket::eid_pipe_name): Remove.
3016 (fhandler_socket::set_socketpair_eids): Move down to fhandler_socket
3018 (fhandler_socket::fhandler_socket): Drop initializing sec_pipe.
3019 (fhandler_socket::~fhandler_socket): Drop closing sec_pipe.
3020 (fhandler_socket::eid_setblocking): New method.
3021 (fhandler_socket::eid_unsetblocking): New method.
3022 (fhandler_socket::eid_recv): New method.
3023 (fhandler_socket::eid_send): New method.
3024 (fhandler_socket::eid_connect): New method.
3025 (fhandler_socket::eid_accept): New method.
3026 (fhandler_socket::dup): Drop sec_pipe handling.
3027 (fhandler_socket::connect): Fix WinSock error handling. Prepare
3028 eid credential transaction. Call eid_connect on successful connect.
3029 (fhandler_socket::listen): Drop creating sec_pipe.
3030 (fhandler_socket::accept): Slightly simplify code. Call eid_accept
3032 (fhandler_socket::getpeereid): Reshuffle code for readability. Fix
3033 test for invalid pid.
3034 * select.cc (set_bits): Call eid_connect on successfully connected
3037 2005-03-19 Christopher Faylor <cgf@timesys.com>
3039 * child_info.h (fork_info): Use different method to alias variable.
3040 (spawn_info): Ditto.
3041 * cxx.cc (__cxa_guard_acquire): New function (needed for gcc 4.x).
3042 (__cxa_guard_release): Ditto.
3043 * devices.in: Make sure stuff is correctly bracketed (for gcc 4.x).
3044 * devices.cc: Regenerate.
3045 * fhandler.h (fhandler_disk_file::fchmod): Avoid left coercion (for gcc
3047 * smallprint.c (__rn): Declare as __fastcall since gcc 4.x complains
3048 about use of regparm, for some reason.
3049 * sync.h (sync::init_lock): Remove.
3050 * sync.cc (sync::init_lock): Ditto.
3052 2005-03-18 Christopher Faylor <cgf@timesys.com>
3054 * net.cc (cygwin_getprotobyname): Don't try to be fancy with return
3056 (cygwin_getprotobynumber): Ditto.
3058 2005-03-17 Corinna Vinschen <corinna@vinschen.de>
3060 * fhandler_disk_file.cc (fhandler_disk_file::utimes): Handle opening
3061 directories under 9x gracefully.
3063 2005-03-17 Corinna Vinschen <corinna@vinschen.de>
3065 * fhandler_socket.cc (fhandler_socket::connect): Always set sun_path
3066 in case of a successful or pending connect.
3067 (fhandler_socket::accept): Don't run secret event and eid credential
3068 transactions if OS accept returned WSAEWOULDBLOCK.
3070 2005-03-16 Christopher Faylor <cgf@timesys.com>
3072 * fhandler_tape.cc (get_ll): This is a generally useful function so
3074 * winsup.h (get_ll): to here.
3075 * security.cc (get_token_group_sidlist): Use get_ll to figure out the
3076 long long version of the luid since QuadPart is not part of the
3077 standard Windows API.
3079 2005-03-16 Christopher Faylor <cgf@timesys.com>
3081 * dir.cc: Rename opendir_* to dirent_* throughout.
3082 (opendir_states): Move and rename.
3083 * fhandler.h (dirent_states): to here.
3084 * fhandler_disk_file.cc (fhandler_disk_file::readdir): Use raw readdir
3085 when skipping through entries since it is keeping track of "." and
3087 (fhandler_cygdrive::seekdir): Use fhandler_disk_file::readdir to do
3089 * fhandler_virtual.cc (fhandler_virtual::opendir): Set flag indicating
3090 that we provide . and ..
3091 (fhandler_virtual::seekdir): Ditto.
3092 (fhandler_virtual::rewinddir): Ditto.
3093 * fhandler_registry.cc (fhandler_registry::rewinddir): Ditto.
3095 2005-03-16 Christopher Faylor <cgf@timesys.com>
3097 * cygtls.cc (free_local): New macro.
3098 (_cygtls::remove): Use free_local to free known-malloced local
3100 * cygtls.h: Mark some variables as "malloced".
3101 * net.cc (enum struct_type): Rename from is_* to t_* for clarity.
3102 (dump_protoent): Delete.
3103 (dup_ent): New macro.
3104 (__dup_ent): Renamed from dup_ent. Change arguments for convenience.
3105 Replace first argument with newly alloced value. Allocate a rounded
3106 number of bytes in an attempt to try to reuse space. Subsume
3108 (cygwin_getprotobyname): Simplify using new dup_ent functionality.
3109 (cygwin_getprotobynumber): Ditto.
3110 (cygwin_getservbyname): Ditto.
3111 (cygwin_getservbyport): Ditto.
3112 (cygwin_gethostname): Ditto.
3113 (cygwin_gethostbyname): Ditto.
3114 * tlsoffsets.h: Regenerate.
3116 * syslog.cc (openlog): Use NULL rather than 0, for consistency with the
3118 (pass_handler::initialize): Use unbuffered I/O in pass one.
3120 2005-03-15 Christopher Faylor <cgf@timesys.com>
3122 * errno.cc (errmap): Correct typo in previous change.
3124 2005-03-15 Christopher Faylor <cgf@timesys.com>
3126 * cygtls.cc (_cygtls::remove): Free process_ident, if it exists.
3128 * errno.cc (errmap): ERROR_DISK_CORRUPT -> EIO.
3130 2005-03-11 Christopher Faylor <cgf@timesys.com>
3132 * path.h (pathconv_arg): Define PC_NO_ACCESS_CHECK.
3133 (path_types): Define PATH_NO_ACCESS_CHECK == PC_NO_ACCESS_CHECK.
3134 * path.cc (symlink_info::check_sysfile): Move to symlink_info class and
3135 eliminate arguments that are part of class. Use set_error.
3136 (symlink_info::check_shortcut): Ditto.
3137 (symlink_info::set_error): New function.
3138 (path_conv::check): Pass PC_NO_ACCESS_CHECK to symlink_info::check.
3139 (symlink_info::check): Preserve PC_NO_ACCESS_CHECK in pflags. Use
3142 2005-03-10 Corinna Vinschen <corinna@vinschen.de>
3144 * path.cc (is_floppy): New function.
3145 (setmntent): Drop floppy drives on A: and B: from logical drive DWORD.
3146 * syscalls.cc (sync): Don't sync floppies on A: and B:.
3148 2005-03-10 Christopher Faylor <cgf@timesys.com>
3150 * autoload.cc (LoadDLLprime): Use nocopy segment or forked processes
3151 will not initialize properly.
3153 2005-03-10 Christopher Faylor <cgf@timesys.com>
3155 * autoload.cc (LoadDLLprime): Scrap use of .linkonce and just use an
3156 ifdef guard to load .foo_init into data segment.
3158 * dcrt0.cc (initial_env): Allow colon or space as CYGWIN_DEBUG
3159 separator for consistency.
3161 2005-03-09 Christopher Faylor <cgf@timesys.com>
3163 * pinfo.h (pinfo::pinfo): Clear more elements in the constructor.
3165 2005-03-09 Christopher Faylor <cgf@timesys.com>
3167 * net.cc (dup_ent): Revert older stupid test for null. Don't copy name
3170 2005-03-09 Corinna Vinschen <corinna@vinschen.de>
3172 * fhandler_socket.cc (fhandler_socket::eid_pipe_name): Fix format
3174 (fhandler_socket::connect): Set sun_path before running eid credential
3175 transaction. Run transaction only if OS connect was successful.
3176 (fhandler_socket::accept): Run transaction only if OS accept was
3179 2005-03-09 Corinna Vinschen <corinna@vinschen.de>
3181 * signal.cc (sigprocmask): Rename first parameter to "how".
3182 (handle_sigprocmask): Ditto. Check "how" for being a valid "how" value.
3183 Fix call order in case of wrong "how" value.
3185 2005-03-09 Christopher Faylor <cgf@timesys.com>
3187 * net.cc (dup_ent): Revert previous stupid change.
3189 2005-03-09 Christopher Faylor <cgf@timesys.com>
3191 * net.cc (dup_ent): Avoid dereferencing a null pointer in a debug_printf.
3193 2005-03-09 Christopher Faylor <cgf@timesys.com>
3195 * path.cc (path_conv::check): Treat ENOSHARE similarly to ENOENT when
3196 determining if there was a problem with a symlink.
3198 2005-03-08 Corinna Vinschen <corinna@vinschen.de>
3200 * fhandler_socket.cc (fhandler_socket::listen): Don't limit the number
3203 2005-03-08 Christopher Faylor <cgf@timesys.com>
3205 * pinfo.cc (pinfo::exit): Right shift exit value by eight when not
3206 started in a cygwin environment.
3208 2005-03-07 Corinna Vinschen <corinna@vinschen.de>
3210 * mmap.cc (mmap64): Handle MAP_AUTOGROW flag.
3211 (fhandler_disk_file::mmap): Ditto. Clean conditional for readability.
3212 * include/sys/mman.h: Add MAP_AUTOGROW flag.
3213 * include/cygwin/version.h: Bump API minor version.
3215 2005-03-08 Christopher Faylor <cgf@timesys.com>
3217 * dcrt0.cc (dll_crt0_0): Eliminate muto::init call.
3218 * sync.h (locker): New, currently unused class.
3219 (muto::init): Eliminate.
3220 * sync.cc (muto::init): Ditto.
3221 (muto::init): Eliminate critical section lock and instead use name as a
3222 guard to prevent against multiple attempts to initialize the same muto.
3224 * pinfo.cc (pinfo::init): Set myself procinfo when not execing and pid
3225 matches windows pid or cygwin pid.
3227 2005-03-06 Pavel Tsekov <ptsekov@gmx.net>
3229 * path.cc (mount_info::read_cygdrive_info_from_registry): Use the user
3230 prefix if it exists.
3232 2005-03-06 Christopher Faylor <cgf@timesys.com>
3234 * sync.h (sync::init_lock): Declare new static member.
3235 (sync::init()): Declare new static function.
3236 * sync.cc (sync::init): Define.
3237 (sync::init): Lock attempt to initialize a muto to stop multiple
3238 threads from colliding.
3239 * dcrt0.cc (dll_crt0_0): Initialize muto environment.
3241 2005-03-06 Christopher Faylor <cgf@timesys.com>
3243 * path.cc (special_name): Reorganize to always detect the use of
3244 special names first, before detecting special characters.
3246 2005-03-04 Christopher Faylor <cgf@timesys.com>
3248 * fhandler_clipboard.cc: Use int for cygnativeformat rather than UINT
3249 as that is what is returned by GetPriorityClipboardFormat.
3250 (fhandler_dev_clipboard::read): Ditto for the format variable.
3252 2005-03-04 Corinna Vinschen <corinna@vinschen.de>
3254 * fhandler.cc (fhandler_base::open_9x): Satisfy query_open values.
3256 2005-03-04 Pierre Humblet <pierre.humblet@ieee.org>
3258 * fhandler_socket.cc (fhandler_socket::ioctl): Only cancel
3259 WSAAsyncSelect when async mode is on.
3261 2005-03-03 Corinna Vinschen <corinna@vinschen.de>
3263 * cygwin.din (utmpxname): Export.
3264 * syscalls.cc (utmpxname): Create export alias to utmpname.
3265 * include/utmpx.h: Define ut_name and ut_xtime if not already defined.
3266 (utmpxname): Add prototype.
3267 * include/sys/utmp.h: Only define ut_name if not already defined.
3268 * include/cygwin/version.h: Bump API minor version.
3270 2005-03-03 Christopher Faylor <cgf@timesys.com>
3272 * cygthread.cc (cygthread::detach): Use a slightly higher priority when
3273 waiting for thread signalling.
3275 2005-03-02 Christopher Faylor <cgf@timesys.com>
3277 * autoload.cc (std_dll_init): Save and restore fpu control register
3278 around LoadAddress to prevent loaded dlls (like msvcrt.dll) from
3279 setting unwanted stuff.
3281 2005-03-02 Christopher Faylor <cgf@timesys.com>
3283 * cygtls.cc (_cygtls::remove): Don't attempt any removal activities if
3286 2005-03-02 Christopher Faylor <cgf@timesys.com>
3288 * cygtls.cc (_cygtls::init_thread): Move exitsock setting later. It
3289 should always be set.
3290 (_cygtls::remove): Detect zero exitsock. Not quite sure why this is needed.
3292 2005-03-02 Christopher Faylor <cgf@timesys.com>
3294 * autoload.cc (LoadDLLprime): Mask error code to low-order 16 bits.
3295 (noload): Preserve sign when returning error code.
3297 2005-03-02 Christopher Faylor <cgf@timesys.com>
3299 * spawn.cc (do_cleanup): Properly restore SIGINT/SIGQUIT even if they
3300 had previously been SIG_DFL.
3302 2005-03-01 Corinna Vinschen <corinna@vinschen.de>
3304 * fhandler_disk_file.cc (fhandler_disk_file::touch_ctime): Replace
3305 GetSystemTime/SystemTimeToFileTime with GetSystemTimeAsFileTime.
3306 * times.cc (time_as_timestruc_t): Ditto.
3309 2005-03-01 Christopher Faylor <cgf@timesys.com>
3311 * include/cygwin/version.h: Bump DLL minor number to 14.
3313 2005-03-01 Corinna Vinschen <corinna@vinschen.de>
3315 * fhandler_clipboard.cc (fhandler_dev_clipboard::write): Never set
3317 (fhandler_dev_clipboard::read): Ditto.
3318 * fhandler_windows.cc (fhandler_windows::read): Ditto.
3319 * scandir.cc (scandir): Ditto.
3320 * syscalls.cc (_fstat64_r): Ditto.
3325 * mmap.cc (mmap64): Fix /dev/zero mapping.
3327 2005-02-28 Corinna Vinschen <corinna@vinschen.de>
3329 * fhandler.h (class fhandler_socket): Declare new method
3330 set_socketpair_eids.
3331 * fhandler_socket.cc (fhandler_socket::set_socketpair_eids): New method.
3332 (fhandler_socket::dup): Duplicate sec_pipe if necessary.
3333 (fhandler_socket::listen): Only create sec_pipe if named pipes are
3334 available. Initialized sec_peer_pid to 0 as on Linux.
3335 (fhandler_socket::connect): Only run eid credential transaction if
3336 named pipes are available. Fake otherwise. Initialized sec_peer_pid
3338 (fhandler_socket::accept): Ditto.
3339 (fhandler_socket::close): Move closing sec_pipe handle from here...
3340 (fhandler_socket::~fhandler_socket): ... to here.
3341 * net.cc (socketpair): Set eid credentials by calling
3342 fhandler_socket::set_socketpair_eids() on both socket ends.
3343 * wincap.h (wincaps::has_named_pipes): New element.
3344 * wincap.cc: Implement above element throughout.
3346 2005-02-26 Christopher Faylor <cgf@timesys.com>
3348 * sigproc.cc (_pinfo::set_ctty): Move function
3349 * pinfo.cc (_pinfo::set_ctty): to here.
3351 * fhandler_mem.cc (fhandler_dev_mem::fstat): Don't fill out structure
3352 if this is an on-disk device rather than an "auto" device.
3353 * fhandler_raw.cc (fhandler_dev_raw::fstat): Ditto.
3355 * path.cc (normalize_posix_path): Don't treat a standalone '//' as
3356 introducing a UNC path.
3357 (normalize_win32_path): Ditto.
3359 2005-02-26 Christopher Faylor <cgf@timesys.com>
3361 * debug.cc (delete_handle): Report on handle value in debugging output.
3363 * pinfo.h (_pinfo::exists): Declare "new" function.
3364 (_pinfo::kill): Ditto.
3365 * fhandler_termios.cc (tty_min::kill_pgrp): Use _pinfo::exists rather
3367 * pinfo.cc (pinfo::init): Ditto. Don't do a low_priority_sleep(0) when
3368 looping to find exec'ed procinfo.
3369 (pinfo::release): Be more careful about unmapping and closing.
3370 * signal.cc (_pinfo::kill): Rename from kill_worker. Accommodate entry
3372 (kill0): Use _pinfo::kill rather than kill_worker.
3373 (kill_pgrp): Ditto. Use _pinfo::exists rather than proc_exists.
3374 * sigproc.cc (_pinfo::exists): Rename from proc_exists.
3375 (pid_exists): Use _pinfo::exists rather than proc_exists.
3376 (remove_proc): Ditto.
3377 * sigproc.h (proc_exists): Delete declaration.
3379 2005-02-25 Corinna Vinschen <corinna@vinschen.de>
3381 * fhandler.h (class fhandler_base): Declare fixup_mmap_after_fork
3382 with additional flags parameter. Change offset parameter to _off64_t.
3383 (class fhandler_disk_file): Ditto.
3384 (class fhandler_dev_mem): Ditto.
3385 * fhandler_mem.cc (fhandler_dev_mem::fixup_mmap_after_fork):
3386 Accommodate new parameters.
3387 * mmap.cc: Include ntdll.h.
3388 (class mmap_record): Add flags member.
3389 (mmap_record::mmap_record): Add flags parameter.
3390 (mmap_record::get_flags): New method.
3391 (class map): Add next_anon_addr member to store next anonymous mapping
3393 (map::get_next_anon_addr): New method.
3394 (map::set_next_anon_addr): New method.
3395 (mmap64): Don't align offset and length to granularity in case of
3396 MAP_ANONYMOUS on NT. Check for already existing mapping only on 9x.
3397 Call mmap_record::mmap_record with additional flags argument.
3398 (fhandler_base::fixup_mmap_after_fork): Accommodate new parameters.
3399 (fhandler_disk_file::mmap): Use NtMapViewOfSection with
3400 AT_ROUND_TO_PAGE flag for anonymous mappings on NT. If addr is NULL,
3401 try to map adjacent to previous mapping.
3402 (fhandler_disk_file::fixup_mmap_after_fork): Add flags argument.
3403 Change offset parameter to _off64_t. Use NtMapViewOfSection to
3404 re-create anonymous mappings on NT.
3405 (fixup_mmaps_after_fork): Accommodate new parameters when calling
3406 fhandler's fixup_mmaps_after_fork function.
3407 * ntdll.h (AT_ROUND_TO_PAGE): New define.
3409 2005-02-25 Corinna Vinschen <corinna@vinschen.de>
3411 * mmap.cc (mmap64): Handle anonymous MAP_FIXED request on
3412 non-granulation boundary.
3414 2005-02-25 Corinna Vinschen <corinna@vinschen.de>
3416 * mmap.cc (class mmap_record): Declare new map_pages method with
3418 (mmap_record::map_pages): New method with address parameter.
3419 (mmap64): Evaluate access mode before checking if already existing
3420 mapping can be used.
3421 Only use existing mapping if requested access mode matches the one
3422 in the existing mapping.
3423 Add check for existing mapping for anonymous MAP_FIXED case.
3425 2005-02-23 Corinna Vinschen <corinna@vinschen.de>
3427 * localtime.cc: Implement setting __tzrule's offset member using
3428 newlib's __gettzinfo () interface.
3430 (timezone): Define as long according to POSIX.
3432 2005-02-23 Eric Blake <ebb9@byu.net>
3434 * devices.in (parsedisk): Fix typo.
3435 * devices.cc: Regenerate.
3437 2005-02-23 Corinna Vinschen <corinna@vinschen.de>
3439 * cygwin.din (getpeereid): Export.
3440 * fhandler.h (class fhandler_socket): Add pipe and id members to
3441 exchange eid credentials for AF_LOCAL sockets.
3442 (eid_pipe_name): Declare new method.
3443 (getpeereid): Ditto.
3444 * fhandler_socket.cc (fhandler_socket::eid_pipe_name): New method.
3445 (fhandler_socket::fhandler_socket): Initialize sec_pipe.
3446 (fhandler_socket::connect): Exchange eid credentials with accepting
3448 (fhandler_socket::listen): Prepare eid credential transaction.
3449 (fhandler_socket::accept): Exchange eid credentials with connecting
3451 (fhandler_socket::close): Close eid credentials pipe if open.
3452 (fhandler_socket::getpeereid): New method.
3453 * net.cc (cygwin_getsockopt): Add SO_PEERCRED handling.
3454 (getpeereid): New function.
3455 * include/asm/socket.h (SO_PEERCRED): Define.
3456 * include/cygwin/socket.h (struct ucred): Define new type.
3457 * include/cygwin/version.h: Bump API minor version.
3459 2005-02-23 Corinna Vinschen <corinna@vinschen.de>
3461 * include/sys/statvfs.h (ST_RDONLY): Define.
3462 (ST_NOSUID): Define.
3464 2005-02-23 Corinna Vinschen <corinna@vinschen.de>
3466 * cygwin.din (fstatvfs): Export.
3468 * syscalls.cc: Include sys/statvfs.h.
3469 (statvfs): New function. Move statfs functionality here.
3470 (fstatvfs): New function.
3471 (statfs): Just call statvfs and copy structure. Check validity of
3472 incoming struct statfs pointer.
3473 * include/cygwin/types.h (fsblkcnt_t): Define.
3474 (fsfilcnt_t): Define.
3475 * include/cygwin/version.h: Bump API minor version.
3476 * include/sys/statvfs.h: New file.
3478 2005-02-23 Corinna Vinschen <corinna@vinschen.de>
3480 * devices.h: Switch FH_ZERO and FH_PORT as on Linux. Add FH_FULL.
3481 * devices.in: Add /dev/full.
3482 * devices.cc: Regenerate.
3483 * dtable.cc (build_fh_pc): Add FH_FULL.
3484 * fhandler.cc (fhandler_base::fstat): Set FH_FULL permission bits
3486 * fhandler_zero.cc (fhandler_dev_zero::write): Set errno to ENOSPC
3487 and return -1 if device is FH_FULL.
3489 2005-02-22 Christopher Faylor <cgf@timesys.com>
3491 * fhandler_disk_file.cc (fhandler_cygdrive::closedir): Return 0 when
3492 closing cygdrive_root.
3494 2005-02-22 Corinna Vinschen <corinna@vinschen.de>
3496 * cygwin.din (basename): Export.
3498 * path.cc (basename): New function.
3499 (dirname): New function.
3500 * include/libgen.h: New file.
3501 * include/cygwin/version.h: Bump API minor version.
3503 2005-02-22 Corinna Vinschen <corinna@vinschen.de>
3505 * select.cc (peek_pipe): Disable new pipe code until there's
3506 a working substitute.
3508 2005-02-22 Corinna Vinschen <corinna@vinschen.de>
3510 * cygwin.din (fdatasync): Export.
3511 * fhandler.cc (fhandler_base::fsync): Return with EINVAL if no
3512 handle is available.
3513 * syscalls.cc (fdatasync): Create export alias to fsync.
3514 * include/cygwin/version.h: Bump API minor version.
3516 2005-02-20 Corinna Vinschen <corinna@vinschen.de>
3518 * fhandler.h (fhandler_base::fstat_helper): Declare with additional
3519 dwVolumeSerialNumber argument. Drop default values for last three
3521 * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Pass
3522 dwVolumeSerialNumber from GetFileInformationByHandle to fstat_helper.
3523 (fhandler_base::fstat_by_name): Pass pc.volser () to fstat_helper.
3524 Accommodate dropping default values for last three arguments of
3526 (fhandler_base::fstat_helper): Add dwVolumeSerialNumber argument.
3527 Use for st_dev member unless 0 in which case pc.volser () is used.
3529 2005-02-20 Corinna Vinschen <corinna@vinschen.de>
3531 * autoload.cc (FindFirstVolumeA): Add.
3532 (FindNextVolumeA): Add.
3533 (FindVolumeClose): Add.
3534 (GetVolumePathNamesForVolumeNameA): Add.
3535 * fhandler.h (class fhandler_base): Declare new method fsync.
3536 * fhandler.cc (fhandler_base::fsync): New method.
3537 * syscalls.cc (fsync): Move functionality into fhandler method fsync.
3538 Just call this method from here.
3539 (sync_worker): New static function.
3540 (sync): Fill with life for NT systems.
3541 * wincap.h (wincaps::has_guid_volumes): New element.
3542 * wincap.cc: Implement above element throughout.
3544 2005-02-20 Corinna Vinschen <corinna@vinschen.de>
3546 * fhandler.h (enum query_state): Add query_write_attributes state.
3547 (fhandler_base::status.query_open): Add a bit to make room for more
3549 (class fhandler_base): Declare new method utimes.
3550 (class fhandler_socket): Ditto.
3551 (class fhandler_disk_file): Ditto.
3552 (fhandler_disk_file::fhandler_disk_file): Add constructor with
3553 path_conv parameter.
3554 * fhandler.cc (fhandler_base::open): Add query_write_attributes
3556 (fhandler_base::utimes): New method.
3557 * fhandler_disk_file.cc (fhandler_disk_file::link): Simplify.
3558 Open file with query_write_attributes instead of query_write_control.
3559 (fhandler_disk_file::utimes): New method.
3560 (fhandler_disk_file::fhandler_disk_file): Add constructor with
3561 path_conv parameter setting pc member immediately.
3562 * fhandler_socket.cc (fhandler_socket::fchmod): Use new
3563 fhandler_disk_file constructor.
3564 (fhandler_socket::fchown): Ditto.
3565 (fhandler_socket::facl): Ditto.
3566 (fhandler_socket::link): Ditto.
3567 (fhandler_socket::utimes): New method.
3568 * times.cc: Include dtable.h.
3569 (timeval_to_filetime): Make non-static.
3570 (utimes): Move functionality into fhandler method utimes. Just call
3571 this method from here.
3572 * winsup.h: Simplify declarations of time helper functions.
3573 (timeval_to_filetime): Add extern declaration.
3575 2005-02-19 Corinna Vinschen <corinna@vinschen.de>
3577 * fhandler.h (class fhandler_base): Declare new method link.
3578 (class fhandler_socket): Ditto.
3579 (class fhandler_disk_file): Ditto.
3580 * fhandler.cc (fhandler_base::open): Add FILE_WRITE_ATTRIBUTES
3581 to query_write_control access flags.
3582 (fhandler_base::link): New method.
3583 * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Don't try to
3584 open with O_WRONLY since query_write_control includes
3585 FILE_WRITE_ATTRIBUTES.
3586 (fhandler_disk_file::fchown): Ditto.
3587 (fhandler_disk_file::facl): Ditto.
3588 (fhandler_disk_file::link): New method. Touch st_ctime on successful
3590 * fhandler_socket.cc (fhandler_socket::link): New method.
3591 * syscalls.cc (link): Move functionality into fhandler method link.
3592 Just call this method from here.
3594 2005-02-19 Corinna Vinschen <corinna@vinschen.de>
3596 * fhandler.h (class fhandler_socket): Declare new methods fchown,
3598 * fhandler_socket.cc (fhandler_socket::fstat): Handle AF_LOCAL
3600 (fhandler_socket::fchmod): New method.
3601 (fhandler_socket::fchown): New method.
3602 (fhandler_socket::facl): New method.
3604 2005-02-19 Corinna Vinschen <corinna@vinschen.de>
3606 * localtime.cc: Temporary implementation of setting __tzrule's offset
3607 member to be used by strftime.
3608 (__tzrule): New global variable.
3609 (tzparse): Set __tzrule's offset member appropriately.
3611 2005-02-17 Christopher Faylor <cgf@timesys.com>
3613 * path.cc (path_conv::check): Set fs flag when a unix-domain socket
3616 2005-02-17 Corinna Vinschen <corinna@vinschen.de>
3618 * fhandler_disk_file.cc (fhandler_disk_file::fstat): Set st_ctime if
3619 has_changed flag is set.
3620 (fhandler_disk_file::touch_ctime): Reset has_changed flag on success.
3622 2005-02-17 Corinna Vinschen <corinna@vinschen.de>
3624 * times.cc (utimes): Open files with FILE_WRITE_ATTRIBUTES first,
3625 if that fails, try opeing with GENERIC_WRITE. Fix comments.
3627 2005-02-15 Christopher Faylor <cgf@timesys.com>
3629 * path.h (path_conv::issocket): Return true if device == FH_UNIX rather
3630 than expecting path_conv to set a flag.
3632 2005-02-11 Corinna Vinschen <corinna@vinschen.de>
3634 * fhandler.cc (fhandler_base::raw_write): Mark as changed on
3636 * fhandler.h (fhandler_base::status_flags): Add 'has_changed' flag.
3637 * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Call
3638 fhandler_disk_file's own open and close instead of open_fs and
3639 close_fs. Mark as changed on success.
3640 (fhandler_disk_file::fchown): Ditto.
3641 (fhandler_disk_file::facl): Ditto.
3642 (fhandler_disk_file::ftruncate): Ditto.
3643 (fhandler_base::open_fs): Mark as changed when O_TRUNC flag on existing
3645 (fhandler_disk_file::close): Set st_ctime if has_changed flag is set.
3647 2005-02-11 Christopher Faylor <cgf@timesys.com>
3649 * cygthread.cc (cygthread::release): Reset ev here if it exists.
3650 (cygthread::terminate_thread): Eliminate racy code which reset ev and
3651 thread_sync. Remove a few nonsensical inuse checks. Exit at the
3653 (cygthread::detach): Rewrite to again try to ensure that we don't say
3654 we're signalled when we are not signalled.
3655 * fhandler.cc (fhandler_base::raw_read): Revert to signalling read
3657 * pipe.cc (fhandler_pipe::close): Use base method to close handle.
3658 * sigproc.h (WAIT_SIG_PRIORITY): Just trundle along at normal priority
3659 to allow the pipe thread to do its thing if possible.
3661 * pinfo.h (pinfo::zap_cwd): Declare new function.
3662 (pinfo::zap_cwd): Move 'cd out of the way code' here.
3663 (pinfo::exit): Use it here.
3664 * spawn.cc (spawn_guts): And here.
3666 2005-02-11 Corinna Vinschen <corinna@vinschen.de>
3668 * times.cc (utimes): Open files with GENERIC_WRITE on file systems
3669 not supporting ACLs.
3671 2005-02-09 Corinna Vinschen <corinna@vinschen.de>
3673 * fhandler_disk_file.cc (fhandler_disk_file::ftruncate): Fix checking
3676 2005-02-08 Corinna Vinschen <corinna@vinschen.de>
3678 * times.cc (timeval_to_filetime): Define first parameter const.
3679 (utimes): Define second parameter to const according to SUSv3.
3681 * include/sys/utime.h (utime) : Change declaration accordingly.
3683 2005-02-08 Corinna Vinschen <corinna@vinschen.de>
3685 * cygthread.cc (cygthread::detach): Just test thread handle after
3686 signal arrived, don't wait infinitely for it.
3688 2005-02-08 Christopher Faylor <cgf@timesys.com>
3690 * pipe.cc (fhandler_pipe::read): Remove hold over from old read_state
3693 2005-02-06 Yitzchak Scott-Thoennes <sthoenna@efn.org>
3695 * net.cc (cygwin_gethostbyname): Be more picky about what's a numeric
3696 address string, and use tls in that case too.
3698 2005-02-07 Christopher Faylor <cgf@timesys.com>
3700 * exceptions.cc: Make windows_system_directory non-static.
3701 * pinfo.cc (pinfo::exit): Change innocuous cd'ed location to one that
3702 is more likely to exist.
3704 2005-02-06 Corinna Vinschen <corinna@vinschen.de>
3706 * path.cc (path_conv::check): Leave symlink expansion loop in case
3707 a not-ENOENT error happens.
3709 * cygheap.h (cygheap_fdmanip::fhandler_pipe *): New cast operator.
3710 * pinfo.cc (_pinfo::commune_recv): Add PICOM_PIPE_FHANDLER handling.
3711 (_pinfo::commune_send): Ditto.
3712 (_pinfo::pipe_fhandler): New method.
3713 * pinfo.h (enum picom): Add PICOM_PIPE_FHANDLER.
3714 (_pinfo::pipe_fhandler): Declare.
3715 * pipe.cc (fhandler_pipe::open): Rewrite. Allow to open foreign
3718 2005-02-03 Christopher Faylor <cgf@timesys.com>
3720 * cygthread.h (cygthread::terminate_thread): Reflect return value.
3721 * cygthread.cc (cygthread::detach): Be more careful about ensuring that
3722 sigwait is properly waited for to avoid later missynchronization.
3723 (cygthread::terminate_thread): Return true if thread was actually
3724 terminated and all handles were closed.
3725 * fhandler_base.cc (fhandler_base::raw_read): Use signal_read_state
3726 rather than raw calls to win32 api.
3727 (fhandler_base::read): Ditto.
3728 * fhandler.h (fhandler_pipe::fixup_after_exec): Use method to create
3729 read_state signalling.
3730 (fhandler_pipe::create): Ditto.
3732 * Makefile.in: Make some more files -fomit-frame-pointer.
3734 2005-02-02 Corinna Vinschen <corinna@vinschen.de>
3736 * fhandler.h (fhandler_base::ftruncate): Define new virtual method.
3737 (fhandler_disk_file::ftruncate): Ditto.
3738 * fhandler.cc (fhandler_base::ftruncate): New method.
3739 * fhandler_disk_file.cc (fhandler_disk_file::ftruncate): Ditto.
3740 * syscalls.cc (ftruncate64): Move functionality into fhandlers.
3741 Call fhandler method from here.
3743 2005-02-02 Corinna Vinschen <corinna@vinschen.de>
3745 * pipe.cc (fhandler_pipe::dup): Fix conditionals in case of error.
3747 2005-02-02 Corinna Vinschen <corinna@vinschen.de>
3749 * times.cc (utimes): Mark st_ctime for update according to SUSv3.
3751 2005-02-01 Christopher Faylor <cgf@timesys.com>
3753 * fhandler_proc.cc (format_proc_partitions): Remove PartitionType check
3754 since it could skip over partitions that are actually interesting.
3756 2005-02-01 Christopher Faylor <cgf@timesys.com>
3758 * cygthread.cc (cygthread::terminate_thread): Wait briefly for
3759 notification event in the event that the thread was actually in the
3762 * pipe.cc (fhandler_pipe::dup): read_state is not supposed to be
3763 inheritable. Fix that.
3765 * path.cc (path_conv::check): Set symlen = 0 to avoid a compiler
3768 * devices.h (devices::parsedisk): Declare new function.
3769 * devices.in (devices::parsedisk): Define new function.
3770 * dtable.cc (dtable::init_std_file_from_handle): Use device numbers
3772 * fhandler_proc.cc (format_proc_partitions): Use parsedisk to generate
3773 disk names from numeric codes. (This was broken on two of my
3774 systems previously and is still broken now)
3776 2005-02-01 Corinna Vinschen <corinna@vinschen.de>
3778 * pipe.cc (fhandler_pipe::open): Allow re-opening of /proc/<pid>/fd
3779 pipes of the current process.
3781 2005-02-01 Corinna Vinschen <corinna@vinschen.de>
3783 * fhandler.cc (fhandler_base::get_proc_fd_name): Don't generate
3785 * fhandler.h (fhandler_socket::open): New method.
3786 (fhandler_pipe::open): New method.
3787 * fhandler_proc.cc (fhandler_proc::exists): Return -2 in case of
3789 * fhandler_process.cc (fhandler_process::exists): Return -2 in
3790 case of symlinks, -3 for pipes and -4 for sockets.
3791 (fhandler_process::fstat): Handle pipes and sockets.
3792 (fhandler_process::open): Handle opening /proc/<pid>/fd.
3793 (fhandler_process::fill_filebuf): Generate empty names for
3794 non exisiting file descriptors.
3795 * fhandler_socket.cc (fhandler_socket::get_proc_fd_name): Always
3796 generate "socket:[number]" strings as on Linux.
3797 (fhandler_socket::open): New method.
3798 (fhandler_socket::fstat): Always return socket type.
3799 * path.cc (symlink_info::set): Remove unused second parameter.
3800 (path_conv::check): Handle pipes and sockets in /proc.
3801 Set correct device type for AF_LOCAL sockets.
3802 * pinfo.cc (_pinfo::commune_recv): Generate empty names for
3803 non exisiting file descriptors.
3804 (_pinfo::fd): Ditto.
3805 * pipe.cc (fhandler_pipe::open): New method.
3807 2005-01-31 Christopher Faylor <cgf@timesys.com>
3809 * path.h (path_conv::set_name): Declare new function.
3810 * path.cc (path_conv::set_name): Define new function.
3811 * fhandler.h (fhandler_dev_null::open): Declare new function.
3812 * fhandler.cc (fhandler_dev_null::open): Define new function.
3814 2005-01-31 Christopher Faylor <cgf@timesys.com>
3816 * smallprint.c (rnarg): Use long rather than unsigned long so that we
3817 get proper sign extension.
3819 2005-01-31 Corinna Vinschen <corinna@vinschen.de>
3821 * environ.cc (set_traverse): New function.
3822 (parse_thing): Add "traverse" option. Sort options alphabetically.
3823 (environ_init): On NT, switch on traverse checking by default.
3825 2005-01-31 Christopher Faylor <cgf@timesys.com>
3827 * smallprint.c (__rn): Regparmize.
3829 2005-01-31 Christopher Faylor <cgf@timesys.com>
3831 * smallprint.c (rnarg): New macro.
3833 (__rn): Rename from 'rn', add a mask argument, and use the mask
3834 argument to control how many significant digits to care about.
3835 (__small_vsprintf): Use __rn, rnarg, rnargLL, as appropriate.
3837 2005-01-31 Christopher Faylor <cgf@timesys.com>
3839 * pinfo.cc (pinfo::exit): Only return low-order 16 bits when exiting.
3841 2005-01-31 Corinna Vinschen <corinna@vinschen.de>
3843 * fhandler_process.cc (format_process_maps): Get destbuf argument by
3844 reference. Allow resizing of destbuf as necessary. Fix string
3847 2005-01-31 Corinna Vinschen <corinna@vinschen.de>
3849 * cygheap.h (class cygheap_fdenum): New class to enumerate used
3851 * dtable.h (class dtable): Add cygheap_fdenum as friend class.
3852 * fhandler.h (fhandler_base::get_proc_fd_name): New virtual method
3853 to return a name for /proc/<pid>/fd.
3854 (fhandler_socket::get_proc_fd_name): Ditto.
3855 (fhandler_pipe::get_proc_fd_name): Ditto.
3856 (fhandler_virtual::opendir): Make virtual method.
3857 (fhandler_process::opendir): New method.
3858 * fhandler.cc (fhandler_base::get_proc_fd_name): New method.
3859 * fhandler_process.cc: Include ctype.h.
3860 (PROCESS_FD): Define.
3861 (process_listing): Add "fd".
3862 (fhandler_process::exists): Fix comment. Return 1 in case of "fd"
3863 directory. Handle files below "fd".
3864 (fhandler_process::fstat): Drop "self" handling. Set correct link
3865 count for directories.
3866 (fhandler_process::opendir): New method to handle "fd" directory.
3867 (fhandler_process::readdir): Add "fd" handling.
3868 (fhandler_process::open): Drop "self" handling.
3869 (fhandler_process::fill_filebuf): Ditto. Add "fd" handling. Fix
3870 "maps" output string.
3871 * fhandler_registry.cc (fhandler_registry::fstat): Set correct link
3872 count for directories.
3873 * fhandler_socket.cc (fhandler_socket::get_proc_fd_name): New method.
3874 * path.cc (symlink_info::set): Fix thinko.
3875 * pinfo.cc (_pinfo::commune_recv): Rename pathbuf to path throughout.
3876 Drop local path variable in PICOM_FIFO case. Fix debug output.
3877 Close handles as early as possible. Add PICOM_FDS and PICOM_FD
3879 (_pinfo::commune_send): Add PICOM_FDS and PICOM_FD handling.
3880 (_pinfo::fd): New method.
3881 (_pinfo::fds): New method.
3882 * pinfo.h (enum picom): Add PICOM_FDS and PICOM_FD.
3883 (_pinfo::fd): Declare.
3884 (_pinfo::fds): Declare.
3885 * pipe.cc (fhandler_pipe::get_proc_fd_name): New method.
3887 2005-01-29 Corinna Vinschen <corinna@vinschen.de>
3889 * smallprint.c (rn): Change uval to unsigned long long to fix 64 bit
3891 * fhandler_process.cc (format_process_maps): Print major, minor and
3892 inode numbers correctly.
3894 2005-01-29 Corinna Vinschen <corinna@vinschen.de>
3896 * autoload.cc (GetModuleFileNameExA): Add.
3897 (GetModuleInformation): Add.
3898 (QueryWorkingSet): Add.
3899 * fhandler.h (fhandler_virtual::get_filebuf): New method.
3900 * fhandler_proc.cc (PROC_SELF): Define.
3901 (proc_fhandlers): Change type of self to FH_PROC.
3902 (fhandler_proc::exists): Return -3 if self.
3903 (fhandler_proc::fstat): Handle self as symlink.
3904 (fhandler_proc::fill_filebuf): Handle self.
3905 * fhandler_process.cc: Include psapi.h.
3906 (PROCESS_EXENAME): Remove.
3907 (PROCESS_MAPS): Define.
3908 (PROCESS_ROOT): Define.
3909 (PROCESS_EXE): Define.
3910 (PROCESS_CWD): Define.
3911 (process_listing): Remove "exename", add "maps, "root", "exe" and
3913 (fhandler_process::exists): Return -2 for symlinks.
3914 (fhandler_process::fstat): Handle symlinks.
3915 (fill_filebuf): Evaluate pid if pid is 0. Use exename handling for
3916 exe. Handle maps, root and cwd.
3917 (format_process_maps): New function evaluating "maps".
3918 * path.cc (symlink_info::set): New method to fill symlink_info
3919 with data matching virtual symlinks.
3920 (path_conv::check): Handle virtual symlinks.
3921 * pinfo.cc (_pinfo::commune_recv): Add PICOM_CWD and PICOM_ROOT
3923 (_pinfo::commune_send): Ditto.
3924 (_pinfo::root): New function.
3925 (_pinfo::cwd): New function.
3926 * pinfo.h (enum picom): Add PICOM_CWD and PICOM_ROOT.
3927 (_pinfo::root): Declare.
3928 (_pinfo::cwd): Declare.
3930 2005-01-29 Christopher Faylor <cgf@timesys.com>
3932 * cygthread.cc (new): Add a little more debugging.
3933 * thread.cc (pthread_null::exit): Add a _my_tls.remove() for safety.
3935 2005-01-28 Christopher Faylor <cgf@timesys.com>
3937 * cygtls.cc (cygtls::call2): Move socket cleanup.
3938 (cygtls::remove): Move socket cleanup here. Don't use _my_tls to
3941 2005-01-26 Christopher Faylor <cgf@timesys.com>
3943 * pinfo.cc (pinfo::init): Avoid a compiler warning.
3945 2005-01-25 Corinna Vinschen <corinna@vinschen.de>
3947 * syscalls.cc (setpriority): Implement PRIO_PGRP, PRIO_USER and
3948 setting priority in other Cygwin processes.
3949 (getpriority): Implement PRIO_PGRP, PRIO_USER and getting nice value
3950 from other processes.
3952 2005-01-26 Pierre Humblet <pierre.humblet@ieee.org>
3954 * path.cc (path_conv::check): Return ENOTDIR rather than ENOENT
3955 when a component is not a directory. Remove unreachable code.
3958 2005-01-25 Christopher Faylor <cgf@timesys.com>
3960 * pinfo.h (pinfo::init): Make third parameter non-optional and
3961 propagate change throughout.
3962 * pinfo.cc (set_myself): Pass INVALID_HANDLE_POINTER if h is NULL.
3963 (pinfo::init): Make third parameter non-optional. Eliminate use of
3964 PID_EXECED as an argument. Put setting of handle back inside loop but
3965 reorganize to try to open it only when necessary.
3967 2005-01-25 Corinna Vinschen <corinna@vinschen.de>
3969 * cygwin.din: Export getpriority and setpriority.
3970 * fork.cc (fork_parent): Copy parent's nice value into child.
3971 * spawn.cc (spawn_guts): Ditto.
3972 * miscfuncs.cc (winprio_to_nice): New function.
3973 (nice_to_winprio): Ditto.
3974 * pinfo.cc (pinfo_init): If parent is not a Cygwin process, set
3975 default nice value according to current Win32 priority class.
3976 * pinfo.h (class _pinfo): Add nice member.
3977 * syscalls.cc (setpriority): New function, only implementing
3978 PRIO_PROCESS for now.
3979 (getpriority): Ditto.
3980 (nice): Just call setpriority.
3981 * wincap.h (wincaps::has_extended_priority_class): New element.
3982 * wincap.cc: Implement above element throughout.
3983 * winsup.h: Add prototypes for winprio_to_nice and nice_to_winprio.
3984 * include/limits.h (NZERO): New define.
3985 * include/cygwin/types.h (id_t): New datatype.
3986 * include/cygwin/version.h: Bump API minor version.
3987 * include/sys/resource.h: Add PRIO_XXX defines and prototypes for
3988 getpriority and setpriority.
3990 2005-01-25 Corinna Vinschen <corinna@vinschen.de>
3992 * path.cc (realpath): Allow to expand with .exe suffix.
3994 2005-01-22 Christopher Faylor <cgf@timesys.com>
3996 * spawn.cc (spawn_guts): Perform same "cd" as in pinfo::exit below to
3997 make sure that a stub process does not keep the current working
3998 directory busy after the "execed" process has exited.
4000 2005-01-22 Christopher Faylor <cgf@timesys.com>
4002 * pinfo.cc (pinfo::init): Move everything but the MapViewOfFileEx out
4003 of the loop since trying multiple times to call CreateFileMapping
4004 doesn't make much sense. Try to structure the loop a little better so
4005 that exiting with a break does the right thing.
4006 (pinfo::release): Release shared memory area if it exists and close
4007 handle if it exists.
4009 2005-01-22 Christopher Faylor <cgf@timesys.com>
4011 * pinfo.cc (pinfo::maybe_set_exit_code_from_windows): Make sure that
4012 process has exited before getting an error code.
4013 (pinfo::exit): "cd" to innocuous location before exiting to make sure
4014 that process does not keep the current working directory busy while it
4015 is in the process of really exiting.
4017 2005-01-18 Corinna Vinschen <corinna@vinschen.de>
4019 * autoload.cc (CoInitialize): Remove.
4020 (CoUninitialize): Remove.
4021 (CoCreateInstance): Remove.
4022 (CoTaskMemFree): Add.
4023 (SHGetDesktopFolder): Add.
4024 * path.cc (shortcut_header): Remove.
4025 (shortcut_initalized): Remove.
4026 (GUID_shortcut): New static GUID.
4027 (struct win_shortcut_hdr): New struct describing Windows shortcut
4029 (symlink_worker): Rewrite creating Windows shortcuts. Create
4030 ITEMIDLIST if target exists. Only write once.
4031 (cmp_shortcut_header): Use win_shortcut_hdr structure for comparison.
4032 (check_shortcut): Rewrite to read only once from file. Allow skipping
4033 an ITIMIDLIST in the file.
4035 2005-01-16 Christopher Faylor <cgf@timesys.com>
4037 * pinfo.h (maybe_set_exit_code_from_windows): Renamed from
4039 * pinfo.cc (pinfo::exit): Use renamed function.
4040 (proc_waiter): Ditto. Make a copy of input argument to avoid problems
4041 when procs array is shuffled. Flag when copy is made so that
4042 remove_proc knows when it is safe to reshuffle.
4043 * sigproc.cc (proc_terminate): Don't flag process_state as PID_EXITED.
4044 (remove_proc): Wait for waiter to finish copying pinfo element before
4045 moving it (an actual wait should be an extremely rare event).
4047 2005-01-15 Christopher Faylor <cgf@timesys.com>
4049 * init.cc (dll_entry): Remove unused extern.
4051 * include/sys/cygwin.h: Remove PID_ZOMBIE.
4052 * pinfo.h: Rename EXITCODE_* defines.
4053 (pinfo::set_exit_state): Remove parameter.
4054 * pinfo.cc (set_exit_state): Remove parameter. Reverse sense of test
4055 so that exitcode is checked for having been set rather than not having
4056 been set. Set flag when exitcode has been established. Don't set
4058 (pinfo::init): Remove exitcode initialization.
4059 (pinfo::exit): Reflect change in EXITCODE_* naming. Set flag when
4060 exitcode has been established. Reflect change in arguments to
4062 (proc_waiter): Reflect change in arguments to set_process_state. Set
4063 process_state here and only here.
4064 * fhandler_process.cc (fhandler_process::fill_filebuf): Reflect removal
4065 of PID_ZOMBIE define.
4066 (format_process_stat): Ditto.
4067 (format_process_status): Ditto.
4068 * sigproc.cc (pid_exists): Ditto.
4069 (stopped_or_terminated): Ditto. Make sure that only low-order 16 bits of
4071 * spawn.cc (spawn_guts): Reflect change in EXITCODE_* naming.
4073 2005-01-15 Christopher Faylor <cgf@timesys.com>
4075 * sigproc.cc (sig_send): Don't complain if attempt to send signal to
4076 myself fails after I've "execed".
4078 2005-01-14 Corinna Vinschen <corinna@vinschen.de>
4080 * fhandler_disk_file.cc (fhandler_disk_file::facl): Pretend successful
4081 SETACL if no acls are available.
4082 * fhandler.cc (fhandler_base::facl): Implement to return sensible
4083 values on GETACL and GETACLCNT. Pretend successful SETACL.
4084 * fhandler_virtual.cc (fhandler_virtual::facl): Ditto.
4086 2005-01-13 Corinna Vinschen <corinna@vinschen.de>
4088 * fhandler.h (fhandler_disk_file::touch_ctime): Declare.
4089 * fhandler_disk_file.cc (fhandler_disk_file::touch_ctime): New method
4090 to set file's ctime.
4091 (fhandler_disk_file::fchmod): Try opening file for writing first.
4092 Set file's ctime on success.
4093 (fhandler_disk_file::fchown): Ditto.
4094 (fhandler_disk_file::facl): Ditto.
4096 2005-01-13 Corinna Vinschen <corinna@vinschen.de>
4098 * pinfo.cc (pinfo::exit): Don't access self after releasing it.
4099 * path.h (path_conv::path_conv): Fill path with native device
4100 name in case of device argument.
4102 2005-01-13 Corinna Vinschen <corinna@vinschen.de>
4104 * fhandler_serial.cc (fhandler_serial::dup): Call overlapped_setup
4105 for child, not for parent.
4107 2005-01-13 Christopher Faylor <cgf@timesys.com>
4109 * init.cc (dll_entry): Nuke attempt to set exit code since parent will
4110 use windows exit code if needed.
4111 * pinfo.cc (pinfo::exit): Move release() here to minimize pid creation
4112 race (suggested by Pierre Humblet).
4114 2005-01-12 Christopher Faylor <cgf@timesys.com>
4116 Reorganize header file inclusion throughout so that cygerrno.h comes
4118 * fhandler.h (select_record::thread_errno): Save any encountered errno
4120 (select_record::set_select_errno): New function.
4121 (select_record::saw_error): New function.
4122 (select_record::select_record): Initialize thread_errno to zero.
4123 * select.cc (set_handle_or_return_if_not_open): Set thread_errno on
4125 (select_stuff::wait): Record errno for later resurrection in calling
4127 (peek_serial): Ditto.
4129 2005-01-12 Christopher Faylor <cgf@timesys.com>
4131 * syscalls.cc (system): Use "/bin/sh" as per linux and (sorta) SUSv3.
4133 2005-01-12 Christopher Faylor <cgf@timesys.com>
4135 * pinfo.cc (pinfo::exit): Don't assume that this == myself.
4137 2005-01-11 Christopher Faylor <cgf@timesys.com>
4139 * pinfo.cc (pinfo::init): Don't close input handle on temporary (?)
4142 2005-01-11 Christopher Faylor <cgf@timesys.com>
4144 * pinfo.h (_pinfo::set_exit_state): Declare new function.
4145 (pinfo::exit): Move here from _pinfo::exit.
4146 * sigproc.cc (child_info::sync): Use new function to set exitcode and
4148 * pinfo.cc (_pinfo::exit): Ditto.
4149 (proc_waiter): Ditto.
4150 (_pinfo::set_exit_state): Define new function.
4151 (_pinfo::dup_proc_pipe): Close handle when there is no parent process
4152 around to care about the exit value.
4153 * dcrt0.cc (dll_crt0_0): Move subproc_ready synchronization later to
4154 make sure that myself is still mapped in parent.
4155 (do_exit): Reflect movement to pinfo::exit.
4156 (__api_fatal): Ditto.
4157 * exceptions.cc (signal_exit): Ditto.
4158 * errno.cc (errmap): Map PROC_NOT_FOUND.
4159 * init.cc (dll_entry): Release myself before exiting.
4160 * sigproc.cc (proc_can_be_signalled): Set errno appropriately.
4161 (sig_send): Ditto. Also remove ill-advised test for !myself->sendsig
4162 since this is an indication of a process which is still initializating
4163 -- it is not an error.
4164 (child_info::sync): Don't set exitcode here. Assume that will happen
4165 in proc_waiter, if necessary.
4166 * spawn.cc (spawn_guts): Delay "wait_for_myself" logic until later.
4167 Don't wait at all if the process has already exited. Reflect movement
4170 2005-01-11 Corinna Vinschen <corinna@vinschen.de>
4172 * environ.cc (build_env): Disallow empty strings and strings starting
4173 with '=' in Win32 environment.
4175 2005-01-08 Pierre Humblet <pierre.humblet@ieee.org>
4177 * syscalls.cc (seteuid32): Only change the default dacl when
4178 seteuid succeeds. Do not close HKCU.
4180 2005-01-06 Corinna Vinschen <corinna@vinschen.de>
4182 * fhandler_process.cc: Use strcasematch instead of strcasecmp
4185 2005-01-06 Corinna Vinschen <corinna@vinschen.de>
4187 * syscalls.cc (rename): Fix behaviour in case of renaming directories
4190 2005-01-06 Corinna Vinschen <corinna@vinschen.de>
4192 * fhandler_disk_file.cc (fhandler_base::open_fs): Don't allow
4193 opening directories for writing.
4195 2005-01-06 Christopher Faylor <cgf@timesys.com>
4197 * timer.cc (timer_thread): Pass sigev pointer value as per SuSv3 rather
4198 than pointer to sigev.
4200 2005-01-05 Christopher Faylor <cgf@timesys.com>
4202 * dcrt0.cc (multiple_cygwin_problem): Reorganize error message to not
4203 always talk about a "version" when it's not a version.
4204 (dll_crt0_0): Change info passed to multiple_cygwin_problem to be a
4205 little more precise.
4206 * shared.cc (user_shared_initialize): Ditto.
4207 (shared_info::initialize): Ditto.
4209 2005-01-03 Christopher Faylor <cgf@timesys.com>
4211 * pinfo.cc (_pinfo::dup_proc_pipe): Can't close proc pipe when execing
4212 or we will suffer an exit code race.
4214 2005-01-03 Corinna Vinschen <corinna@vinschen.de>
4216 * signal.cc (abort): Call _GLOBAL_REENT's __cleanup.
4218 2005-01-03 Corinna Vinschen <corinna@vinschen.de>
4220 * syscalls.cc (setmode): Call _fwalk with _GLOBAL_REENT.
4222 2005-01-01 Christopher Faylor <cgf@timesys.com>
4224 * cygthread.cc (cygthread::stub): Set inuse to false when exiting.
4225 (cygthread::cygthread): Actually pass name as argument to debugging
4226 output to avoid SEGV when strace'ing.
4227 (cygthread::release): Don't set stack_ptr to NULL, since it is only set
4228 once on first entry to a stub not on each stub iteration.
4229 (cygthead::exit_thread): Remove obsolete function.
4230 * cygthread.h (cygthread::exit_thread): Ditto.
4232 2005-01-01 Christopher Faylor <cgf@timesys.com>
4234 * shared.cc (open_shared): Don't attempt VirtualAlloc magic if first
4235 attempt to map memory fails.