OSDN Git Service

* spawn.cc (spawn_guts): Detect when executing a 16-bit application and avoid
[pf3gnuchains/pf3gnuchains3x.git] / winsup / cygwin / ChangeLog
1 2005-06-17  Christopher Faylor  <cgf@timesys.com>
2
3         * spawn.cc (spawn_guts): Detect when executing a 16-bit application and
4         avoid setting the process pipe since this causes conniptions in Windows
5         9x.
6
7 2005-06-17  Corinna Vinschen  <corinna@vinschen.de>
8
9         * cygwin.din (inet_pton): Export.
10         (inet_ntop): Export.
11         * net.cc (cygwin_inet_pton): Implement inet_pton for AF_INET for now.
12         (cygwin_inet_ntop): Implement inet_ntop for AF_INET for now.
13         * include/arpa/inet.h (inet_pton): Declare.
14         (inet_ntop): Declare.
15         * include/cygwin/version.h: Bump API minor number.
16
17 2005-06-17  Corinna Vinschen  <corinna@vinschen.de>
18
19         * fhandler.h (fhandler_union): Add missing members corresponding to
20         fhandler_fifo and fhandler_netdrive.
21
22 2005-06-16  Corinna Vinschen  <corinna@vinschen.de>
23
24         * syscalls.cc (statvfs): Handle the case when GetDiskFreeSpaceEx
25         succeeds but GetDiskFreeSpace fails by faking bytes-per-sector and
26         sectors-per-cluster values.
27
28 2005-06-15  Christopher Faylor  <cgf@timesys.com>
29
30         * cygthread.cc (cygthread::detach): Fix debugging output.
31         * dcrt0.cc (dll_crt0_1): Create signal_arrived early -- before any
32         filename manipulation.
33         * sigproc.cc (sigproc_init): Don't create signal_arrived here.
34         * fork.cc (fork_child): Ditto.
35         * sigproc.h (create_signal_arrived): Declare.
36
37 2005-06-14  Christopher Faylor  <cgf@timesys.com>
38
39         * path.cc (path_conv::check): Always reset to FH_FS when component != 0
40         and FH_NETDRIVE to fix problems with strict case checking.
41
42 2005-06-12  Corinna Vinschen  <corinna@vinschen.de>
43
44         * fhandler_socket.cc (fhandler_socket::recvmsg): Avoid SEGV in OpenSSH
45         when trying to pass file descriptor by setting msg->msg_accrightslen
46         to 0.
47
48 2005-06-11  Christopher Faylor  <cgf@timesys.com>
49
50         * Makefile.in: Avoid initial heap allocation since cygwin has its own
51         heap.
52
53 2005-06-11  Christopher Faylor  <cgf@timesys.com>
54
55         * fhandler_console.cc (fhandler_console::read): Fix a compiler warning.
56
57 2005-06-10  Christopher Faylor  <cgf@timesys.com>
58
59         * include/pthread.h: Change PTHREAD_MUTEX_DEFAULT to
60         PTHREAD_MUTEX_NORMAL.  Revert PTHREAD_MUTEX_INITIALIZER to
61         PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP since that is actually closer
62         to what linux does.
63         * thread.h (cw_cancel_action): New enum.
64         (cancelable_wait): Use cw_cancel_action as third argument.
65         * thread.cc (cancelable_wait): Ditto.  Don't wait for cancel if
66         cancel_action == cw_no_cancel.
67         (pthread::create): Don't wait for cancel event since that is racy.
68         (pthread_mutex::pthread_mutex): Set default to PTHREAD_MUTEX_ERRORCHECK.
69         (pthread_mutexattr::pthread_mutexattr): Ditto.
70         (pthread_mutex::_lock): Tell cancelable_wait not to wait for
71         cancellation event.
72         (semaphore::_timedwait): Accommodate change in cancelable_wait args.
73         (pthread::join): Ditto.
74
75 2005-06-10  Corinna Vinschen  <corinna@vinschen.de>
76
77         * fhandler_socket.cc (fhandler_socket::sendto): Always initialize
78         ret to 0.
79         (fhandler_socket::sendmsg): Ditto.
80
81 2005-06-10  Corinna Vinschen  <corinna@vinschen.de>
82
83         * cygwin.din (imaxabs): Export.
84         (imaxdiv): Export.
85         (llabs): Export.
86         (lldiv): Export.
87         (strtoimax): Export.
88         (strtoumax): Export.
89         * include/inttypes.h (imaxabs): Activate declaration.
90         (imaxdiv): Ditto.
91         (strtoimax): Ditto.
92         (strtoumax): Ditto.
93         * include/cygwin/version.h: Bump API minor.
94
95 2005-06-09  Christopher Faylor  <cgf@timesys.com>
96
97         * cygthread.cc (cygthread::detach): Improve diagnostics for what should
98         be an impossible failure condition.
99
100 2005-06-09  Christopher Faylor  <cgf@timesys.com>
101
102         * cygtls.h (_local_storage::setmode_file): New element.
103         (_local_storage::setmode_mode): New element.
104         * tlsoffsets.h: Regenerate.
105         * cygwin.din (setmode): Define as cygwin_getmode.
106         * syscalls.cc (setmode_helper): Use setmode_* variables from tls rather
107         than using unthreadsafe static.
108         (setmode): Break out fwalk stuff.
109         (cygwin_setmode): New function.  Put fwalk stdio stuff here.
110
111 2005-06-09  Christopher Faylor  <cgf@timesys.com>
112
113         * thread.cc (pthread_mutex::_lock): Use cancelable_wait rather than
114         WaitForSingleObject.
115
116 2005-06-09  Christopher Faylor  <cgf@timesys.com>
117
118         * cygwin.sc: Place .cygwin_dll_common in a more sensible spot.
119
120 2005-06-09  Christopher Faylor  <cgf@timesys.com>
121
122         * cygwin.sc: Place .cygwin_dll_common.
123         * init.cc (threadfunc_ix): Use a more common name for the section name.
124
125 2005-06-09  Christopher Faylor  <cgf@timesys.com>
126
127         * include/pthread.h (PTHREAD_MUTEX_INITIALIZER): Change to
128         PTHREAD_NORMAL_MUTEX_INITIALIZER_NP to be closer to linux default.
129
130 2005-06-09  Christopher Faylor  <cgf@timesys.com>
131
132         * thread.cc (cancelable_wait): No-op change to make sure that res is
133         always a valid WFMO return.
134
135 2005-06-09  Christopher Faylor  <cgf@timesys.com>
136
137         Change pthread::cancelable_wait to just cancelable_wait, throughout.
138         * thread.h (cw_sig_wait): New enum.
139         (fast_mutex::lock): Use cancelable_wait with resumable signal.
140         (cancelable_wait): Change fourth argument to cw_sig_wait enum.
141         * thread.cc (cancelable_wait): Ditto.  Loop on signal detection if
142         fourth argument == cw_sig_resume.
143
144 2005-06-08  Christopher Faylor  <cgf@timesys.com>
145
146         * cygwin.sc: Apparently nonloading sections need to go last.
147
148 2005-06-08  Christopher Faylor  <cgf@timesys.com>
149
150         * cygwin.sc: Restore resource and reloc sections and use more modern
151         syntax for stabs sections.
152
153 2005-06-08  Christopher Faylor  <cgf@timesys.com>
154
155         * environ.cc (spenvs): Remove cut/paste error which associated
156         CYGWIN_DEBUG with HOME.
157
158 2005-06-08  Corinna Vinschen  <corinna@vinschen.de>
159
160         * security.cc (cygwin_logon_user): Run LogonUser in the primary
161         process token context.  Fix potential handle leak.
162
163 2005-06-07  Corinna Vinschen  <corinna@vinschen.de>
164
165         * pinfo.cc (pinfo::init): Define sa_buf as PSECURITY_ATTRIBUTES and
166         allocate dynamically.
167         (pinfo::set_acl): Replace sa_buf by dynamically allocated acl_buf.
168         * sec_acl.cc (setacl): Allocate acl dynamically.
169         * sec_helper.cc (sec_acl): Add test for alignment of acl when
170         DEBUGGING is defined.
171         (__sec_user): Same for sa_buf.
172         * security.cc (verify_token): Define sd_buf as PSECURITY_DESCRIPTOR
173         and allocate dynamically.
174         (alloc_sd): Allocate acl dynamically.
175         security.h (sec_user_nih): Change first parameter to
176         SECURITY_ATTRIBUTES *.
177         (sec_user): Ditto.
178         * sigproc.cc (wait_sig): Define sa_buf as PSECURITY_ATTRIBUTES and
179         allocate dynamically.
180         * syscalls.cc (seteuid32): Define dacl_buf as PACL and allocate
181         dynamically.
182         * uinfo.cc (cygheap_user::init): Define sa_buf as PSECURITY_ATTRIBUTES
183         and allocate dynamically.
184         * winbase.h (ilockincr): Mark first argument of inline assembly as
185         earlyclobber.
186         (ilockdecr): Ditto.
187
188 2005-06-07  Christopher Faylor  <cgf@timesys.com>
189
190         * cygthread.cc (cygthread::detach): Make error message a little more
191         detailed.
192         * fhandler.cc (fhandler_base::raw_read): Ditto for debug message.
193         * dcrt0.cc (do_exit): Add some more synchronization tests.
194         * fhandler_fifo.cc (fhandler_fifo::dup): Don't duplicate a nonexistent
195         handle.  Use derived return value rather than always retuning 0.
196         * fhandler_netdrive.cc (fhandler_netdrive::exists): Wnet -> WNet.
197         * winsup.h (exit_states): Add a couple of new exit states.
198
199 2005-06-06  Corinna Vinschen  <corinna@vinschen.de>
200
201         * path.cc (symlink_info::check): If GetFileAttributes returns
202         with ERROR_SHARING_VIOLATION, the file exists.
203
204 2005-06-06  Corinna Vinschen  <corinna@vinschen.de>
205
206         * uname.cc (uname): Change "amd64" to "x86_64" as on Linux.
207
208 2005-06-06  Corinna Vinschen  <corinna@vinschen.de>
209
210         * uname.cc (uname): Add missing break.
211
212 2005-06-05  Christopher Faylor  <cgf@timesys.com>
213
214         * Makefile.in: Build sync.o with -fomit-frame-pointer and -O3.
215
216 2005-06-05  Christopher Faylor  <cgf@timesys.com>
217
218         * sync.cc (muto::acquire): Remove unneeded brackets and fix whitespace.
219
220 2005-06-04  Christopher Faylor  <cgf@timesys.com>
221
222         * malloc.cc: Update to Doug Lea's malloc v2.8.0.
223
224 2005-06-03  Max Kaehn <slothman@electric-cloud.com>
225
226         * dcrt0.cc (cygwin_dll_init): Initialize main_environ and cygtls.  Add
227         comment to explain the caveats of this method.
228         * how-cygtls-works.txt: New file.
229
230 2005-06-02  Christopher Faylor  <cgf@timesys.com>
231
232         * dlfcn.cc (get_full_path_of_dll): Use a relative path when converting
233         so that the standard Windows rules for finding a library will be used
234         if no path is given.  Stop explicitly searching /usr/bin since that is
235         now in effect.
236
237 2005-06-01  Christopher Faylor  <cgf@timesys.com>
238
239         Revert 2005-05-30 close_all_files changes.
240         * spawn.cc (spawn_guts): When execing, close all files after the child
241         has synced with us.
242
243 2005-06-01  Christopher Faylor  <cgf@timesys.com>
244
245         * fhandler_disk_file.cc (fhandler_disk_file::fchown): Make sure that
246         disk open is called in case we're passed in a non-existent device.
247
248 2005-06-01  Christopher Faylor  <cgf@timesys.com>
249
250         * include/machine/stdlib.h: New file.
251
252 2005-06-01  Christopher Faylor  <cgf@timesys.com>
253
254         * thread.h (List_remove): Revert most of 2005-05-30 change.
255
256 2005-06-01  Christopher Faylor  <cgf@timesys.com>
257
258         * cygwin.sc: Don't output .reloc or .rsrc sections.  Clean up stuff
259         around .cygheap and use a workaround to get things working with newer
260         (broken?) binutils.
261
262 2005-05-31  Christopher Faylor  <cgf@timesys.com>
263
264         * cygheap.cc (cygheap_end): Remove bogus section attribute.
265         * cygwin.sc: Make __cygheap_mid absolute.  Remove unused _cygheap_foo.
266
267 2005-05-30  Christopher Faylor  <cgf@timesys.com>
268
269         * child_info.h (child_info::cygheap_h): Delete.
270         (child_info::dwProcessId): New field.
271         * cygheap.cc (init_cheap): Delete.
272         (dup_now): Ditto.
273         (cygheap_setup_for_child): Ditto.
274         (cygheap_setup_for_child_cleanup): Ditto.
275         (cygheap_fixup_in_child): Simplify.  Use new "child_copy" function to
276         copy heap from parent.
277         (_csbrk): Don't attempt allocation if within cygheap section.  Fix so
278         that more than one allocation will succeed.
279         (cygheap_init): Reset possibly-nonzero region to zero.
280         * cygheap.h (cygheap_setup_for_child): Delete declaration.
281         (cygheap_setup_for_child_cleanup): Ditto.
282         (cygheap_start): Define as an array.
283         * cygwin.sc: Modernize.  Remove unneeded sections.  Define cygheap
284         here.
285         * dcrt0.cc (do_exit): Reflect argument change to close_all_files.
286         * dtable.cc (dtable::vfork_parent_restore): Ditto.
287         * dtable.h: Ditto.
288         * fhandler.h: Ditto.
289         * fork.cc (fork_copy): Call ReadProcessMemory if there is no thread
290         (indicating that we're execing).
291         (fork_child): Don't mess with hParent.
292         (fork_parent): Remove hParent stuff.  It happens earlier now.
293         Remove call to cygheap_setup_for_child* stuff.
294         (fork): Put child_info_stuff in grouped structure.  Issue error if
295         parent handle is not set.
296         (child_copy): New function.
297         * sigproc.cc (child_info::child_info): Put cygheap settings here.  Set
298         parent handle.
299         (child_info::~child_info): Close parent handle if it exists.
300         * spawn.cc (spawn_guts): Reorganize so that ciresrv is allocated at
301         only the last minute so that cygheap changes are reflected.  Delete
302         cygheap_setup* calls.
303         * syscalls.cc (close_all_files): Add an argument to flag when the fd
304         entry should be released.
305         * winsup.h (close_all_files): Add an argument to close_all_files
306         declaration.  Declare child_copy.
307
308 2005-05-30  Vaclav Haisman  <v.haisman@sh.cvut.cz>
309
310         * thread.h (List_remove): Make node parameter const.  Use simple
311         comparison and assignment rather than InterlockedCompareExchangePointer
312         since access is already synchronized.
313
314 2005-05-30  Christopher Faylor  <cgf@timesys.com>
315
316         * dlfcn.cc (set_dl_error): Use UNIX error rather than Windows error.
317
318 2005-05-29  Christopher Faylor  <cgf@timesys.com>
319
320         * cygmagic: Remove debugging cruft missed on 2005-05-21.
321
322 2005-05-29  Corinna Vinschen  <corinna@vinschen.de>
323
324         * path.cc (path_conv::check): Move component to function scope. Set
325         PATH_RO only on *real* FH_NETDRIVEs or on non-FH_NETDRIVE virtual
326         paths. Allow non-retrievable shares to be handled as files.
327
328 2005-05-29  Eric Blake  <ebb9@byu.net>
329
330         * include/limits.h (LLONG_MIN, LLONG_MAX, ULLONG_MAX): Always define.
331
332 2005-05-28  Christopher Faylor  <cgf@timesys.com>
333
334         * thread.h (pthread_key::set): Inline.
335         (pthread_key::get): Ditto.
336         * thread.cc (pthread::set): Delete.
337         (pthread::get): Ditto.
338
339 2005-05-28  Christopher Faylor  <cgf@timesys.com>
340
341         * cygwin.din: Remove signal front end from pthread_[gs]etspecific.
342
343 2005-05-28  Christopher Faylor  <cgf@timesys.com>
344
345         * fhandler_tty.cc (fhandler_tty_slave:tcflush): Use signed comparison.
346
347 2005-05-28  Christopher Faylor  <cgf@timesys.com>
348
349         * times.cc (time_ms::usecs): Coerce comparison to signed or whole test
350         is a no-op.
351
352 2005-05-27  Christopher Faylor  <cgf@timesys.com>
353
354         * cygheap.h: Reference _cygheap_start via .cygheap section.
355
356         * environ.cc: Fix force_into_environment typo throughout.
357         (spenvs): Export CYGWIN_DEBUG if DEBUGGING.
358
359 2005-05-26  Christopher Faylor  <cgf@timesys.com>
360
361         * include/cygwin/version.h: Bump DLL minor number to 18.
362
363 2005-05-25  Pierre Humblet  <pierre.humblet@ieee.org>
364
365         * fhandler.h (fhandler_base::mkdir): New virtual method.
366         (fhandler_base::rmdir): Ditto.
367         (fhandler_disk_file:mkdir): New method.
368         (fhandler_disk_file:rmdir): Ditto.
369         * dir.cc (mkdir): Implement with fhandlers.
370         (rmdir): Ditto.
371         * fhandler.cc (fhandler_base::mkdir): New virtual method.
372         (fhandler_base::rmdir): Ditto.
373         (fhandler_disk_file::mkdir): New method.
374         (fhandler_disk_file::rmdir): Ditto.
375
376 2005-05-24  Christopher Faylor  <cgf@timesys.com>
377
378         * include/cygwin/version.h: Bump API minor number to 129.
379
380 2005-05-24  Christopher Faylor  <cgf@timesys.com>
381
382         * cygwin.din: Export mkdtemp.
383         * mktemp.cc: New file.
384         * Makefile.in (DLL_OFILES): Add mktemp.o
385
386 2005-05-23  Eric Blake  <ebb9@byu.net>
387
388         * include/stdint.h (INTMAX_C, UINTMAX_C): Fix definition.
389
390 2005-05-21  Christopher Faylor  <cgf@timesys.com>
391
392         * spawn.cc (find_exec): Accept a PATH-like string in place of an
393         environment variable.
394         * dlfcn.cc (get_full_path_of_dll): Search /usr/bin (for windows
395         compatibility) and /usr/lib (for UNIX compatibility) when looking for
396         shared libraries.
397         * environ.cc (conv_envvars): Put back LD_LIBRARY_PATH since it is used
398         by get_full_path_of_dll().
399         * errno.cc (errmap): Map MOD_NOT_FOUND to ENOENT.
400
401         * cygmagic: Remove debugging cruft.
402
403 2005-05-19  Corinna Vinschen  <corinna@vinschen.de>
404
405         * include/cygwin/in.h: Add comment.
406
407 2005-05-19  Corinna Vinschen  <corinna@vinschen.de>
408
409         * include/cygwin/in.h: Define IPPROTO_xxx values as macros to
410         accomodate SUSv3.
411
412 2005-05-19  Christopher Faylor  <cgf@timesys.com>
413
414         * include/limits.h: Include features.h, as on linux.
415
416 2005-05-19  Christopher Faylor  <cgf@timesys.com>
417
418         * include/endian.h: New file.
419
420 2005-05-19  Corinna Vinschen  <corinna@vinschen.de>
421
422         * cygwin.sc: Add Dwarf-2 debug sections.
423
424 2005-05-19  Corinna Vinschen  <corinna@vinschen.de>
425
426         * mmap.cc (mmap64): Make granularity an automatic variable.
427
428 2005-05-19  Christopher Faylor  <cgf@timesys.com>
429
430         * fhandler.h (fhandler_cygdrive::seekdir): Delete declaration.
431         (fhandler_cygdrive::seekdir): Delete.
432
433 2005-05-19  Pierre Humblet  <pierre.humblet@ieee.org>
434
435         * fhandler.h (fhandler_cygdrive::iscygdrive_root): Delete method.
436         (fhandler_cygdrive::telldir): Delete declaration.
437         * fhandler_disk_file.cc: Remove all uses of
438         fhandler_cygdrive::iscygdrive_root.
439         (fhandler_disk_file::mkdir): New method.
440         (fhandler_disk_file::rmdir): Ditto.
441         (fhandler_cygdrive::telldir): Delete.
442
443 2005-05-18  Christopher Faylor  <cgf@timesys.com>
444
445         * external.cc: Move pids declaration to file scope and use less
446         enthusiastic constructor.
447         * pinfo.h (winpids::winpids): Remove default setting.
448         * fhandler_fifo.cc (fhandler_fifo::open_not_mine): Accommodate removal
449         of default setting.
450         * fhandler_proc.cc (fhandler_proc::readdir): Ditto.
451
452 2005-05-18  Christopher Faylor  <cgf@timesys.com>
453
454         * cygtls.h (_local_storage::unknown_thread_name): New buffer.
455         * tlsoffsets.h: Regenerate.
456         * cygthread.cc (cygthread::name): Use new thread-local buffer.
457         * exceptions.cc (handle_exceptions): Avoid unnecessary initialization
458         of static variables to zero.
459         * fork.cc (slow_pid_reuse) Ditto.
460
461 2005-05-18  Corinna Vinschen  <corinna@vinschen.de>
462
463         * mmap.cc (mmap64): Avoid compiler warning.
464         * ntea.cc (NTReadEA): Ditto.
465         * hires.h (hires_base): Remove useless usecs function.
466
467 2005-05-18  Corinna Vinschen  <corinna@vinschen.de>
468
469         * fhandler_netdrive.cc (fhandler_netdrive::telldir): Remove since it's
470         equivalent to fhandler_virtual::telldir now anyway.
471         * fhandler.h (class fhandler_netdrive): Remove telldir.
472
473 2005-05-18  Corinna Vinschen  <corinna@vinschen.de>
474
475         * fhandler_netdrive.cc (fhandler_netdrive::telldir): Implement.
476         (fhandler_netdrive::seekdir): Implement.
477         (fhandler_netdrive::closedir): Call rewinddir to have only one point
478         of calling WNetCloseEnum.
479
480 2005-05-17  Corinna Vinschen  <corinna@vinschen.de>
481
482         * fhandler.h (class fhandler_netdrive): Add method rewinddir.
483         * fhandler_netdrive.cc (struct netdriveinf): New structure to
484         store thread arguments.
485         (thread_netdrive): Thread handling all potentially blocking
486         WNet... calls.
487         (create_thread_and_wait): Start and wait for above thread.
488         (fhandler_netdrive::exists): Change to call create_thread_and_wait
489         instead of calling WNet... function.
490         (fhandler_netdrive::readdir): Ditto.  Fix error handling.
491         (fhandler_netdrive::rewinddir): New method.
492
493 2005-05-17  Corinna Vinschen  <corinna@vinschen.de>
494
495         * external.cc (cygwin_internal): Avoid compiler warning.
496
497 2005-05-16  Christopher Faylor  <cgf@timesys.com>
498
499         * dcrt0.cc (dll_crt0_0): Don't do fixup_after_exec if dynamically
500         loaded since the state of fds is unknown at this point.
501
502 2005-05-16  Christopher Faylor  <cgf@timesys.com>
503
504         * include/sys/cygwin.h (enum cygwin_getinfo_types): Add CW_DEBUG_SELF.
505         * external.cc (cygwin_internal): Implement CW_DEBUG_SELF.
506
507         * init.cc (dll_entry): Minor rearrangement of code.
508
509 2005-05-16  Christopher Faylor  <cgf@timesys.com>
510
511         * path.cc (path_conv::check): Remove embedded dots before slashes.
512
513 2005-05-16  Corinna Vinschen  <corinna@vinschen.de>
514
515         * environ.cc (conv_envvars): Remove LD_LIBRARY_PATH entirely.
516         It doesn't belong here.
517
518 2005-05-15  Corinna Vinschen  <corinna@vinschen.de>
519
520         * environ.cc (conv_envvars): Treat LD_LIBRARY_PATH as path list.
521
522 2005-05-14  Corinna Vinschen  <corinna@vinschen.de>
523
524         * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Check
525         return code from GetFileSize and set file size to 0 if necessary.
526         * fhandler_netdrive.cc (fhandler_netdrive::fstat): Set permissions
527         to read/execute for all.
528
529 2005-05-13  Christopher Faylor  <cgf@timesys.com>
530
531         * path.cc (normalize_posix_path): Do normalization on .  and ..  after
532         a '//'.
533
534 2005-05-13  Corinna Vinschen  <corinna@vinschen.de>
535
536         * fhandler.h (fhandler_netdrive::readdir): Remove useless comment.
537
538 2005-05-13  Corinna Vinschen  <corinna@vinschen.de>
539
540         * autoload.cc (WNetGetResourceParentA): Import.
541         (WNetOpenEnumA): Import.
542         (WNetEnumResourceA): Import.
543         (WNetCloseEnum): Import.
544         * fhandler.h (fhandler_netdrive::telldir): Add declaration.
545         (fhandler_netdrive::seekdir): Ditto.
546         (fhandler_netdrive::closedir): Ditto.
547         * fhandler_netdrive.cc: Drop explicit including windows.h.  Include
548         winnetwk.h instead of shlwapi.h.  Include dirent.h.
549         (fhandler_netdrive::readdir): Implement.
550         (fhandler_netdrive::telldir): New method.
551         (fhandler_netdrive::seekdir): New method.
552         (fhandler_netdrive::closedir): Ditto.
553
554 2005-05-13  Christopher Faylor  <cgf@timesys.com>
555
556         Remove PC_FULL from path_conv usage throughout.
557         * path.h (enum pathconv_arg): Change PC_FULL to PC_NOFULL.
558         * path.cc (path_conv::check): Test for PC_NOFULL rather than !PC_FULL.
559         (cygwin_conv_to_win32_path): Use PC_NOFULL to force non-absolute path.
560
561 2005-05-13  Christopher Faylor  <cgf@timesys.com>
562
563         * fhandler_netdrive.cc (fhandler_netdrive::exists): Assert that "//"
564         exists.
565
566 2005-05-12  Christopher Faylor  <cgf@timesys.com>
567
568         * cygtls.cc (_cygtls::remove): Eliminate compiler warning.
569
570         * dir.cc (mkdir): Check path for writability.
571         (rmdir): Ditto.  Remove check for special directories.
572         * path.cc (path_conv::check): Set PATH_RO for virtual devices.  Set
573         error if read-only and asked for writability.
574         * path.h (pathconv_arg): Add PC_WRITABLE.
575         (path_types): Add PATH_RO.
576         (path_conv::isro): Add (currently unused) check for read-only
577         filesystem.  Return "ENOSHARE" when we know a share doesn't exist.
578         * include/sys/mount.h: Add MOUNT_RO flag.
579         * autoload.cc (WNetGetResourceInformationA): Import.
580         * fhandler_netdrive.cc (fhandler_netdrive::exists): Detect actual
581         existence of remote system rather than always assuming that it exists.
582
583 2005-05-11  Christopher Faylor  <cgf@timesys.com>
584
585         * dcrt0.cc (do_global_dtors): Don't call dll_global_dtors here.
586         (__main): Reinstate atexit of do_global_dtors.
587         (cygwin_exit): Call dll_global_dtors here.
588         (do_exit): And here.
589
590
591 2005-05-10  Christopher Faylor  <cgf@timesys.com>
592
593         * cygtls.cc (_cygtls::remove): Clear exitsock after close.
594         * fhandler_console.cc (fhandler_console::write_normal): Store character
595         in a local variable for potential future inspection.
596
597 2005-05-10  Corinna Vinschen  <corinna@vinschen.de>
598
599         * Makefile.in (DLL_OFILES): Add fhandler_mailslot.o.
600         * devices.h (FH_KMSG): Define new device.
601         * devices.in: Add "/dev/kmsg" entry.
602         * devices.cc: Regenerate.
603         * dtable.cc (build_fh_pc): Handle case FH_KMSG.
604         * fhandler.h (class fhandler_mailslot): New class.
605         (class select_stuff): Add device_specific_mailslot pointer.
606         * fhandler_mailslot.cc: New file.
607         * select.cc (peek_mailslot): New function.
608         (verify_mailslot): Ditto.
609         (struct mailslotinf): New stuct to handle select on mailslots.
610         (thread_mailslot): New function.
611         (start_thread_mailslot): Ditto.
612         (mailslot_cleanup): Ditto.
613         (fhandler_mailslot::select_read): New method.
614         * syslog.cc (klog_guard): New muto.
615         (dev_kmsg): Local mailslot for kernel message device.
616         (vklog): New function.
617         (klog): Ditto.
618         * winsup.h (vklog): Declare.
619         (klog): Ditto.
620         * include/sys/syslog.h: Define _PATH_KLOG.
621
622 2005-05-10  Christopher Faylor  <cgf@timesys.com>
623
624         * dcrt0.cc (dll_crt0_1): Call cygwin_exit to ensure that destructors
625         are handled correctly.
626
627 2005-05-10  Corinna Vinschen  <corinna@vinschen.de>
628
629         * path.cc (path_conv::check): Set correct file attributes for socket
630         files.
631
632 2005-05-09  Pierre Humblet <pierre.humblet@ieee.org>
633
634         * fhandler.h (class fhandler_netdrive): New class.
635         * fhandler_netdrive.cc (fhandler_netdrive::fhandler_netdrive): New constructor.
636         (fhandler_netdrive::exists): New method.
637         (fhandler_netdrive::fstat): Ditto.
638         (fhandler_netdrive::readdir): Ditto.
639         (fhandler_netdrive::open): Ditto.
640         * dtable.cc (build_fh_pc): Handle case FH_NETDRIVE.
641         * path.cc (isvirtual_dev): Add FH_NETDRIVE.
642         (mount_info::conv_to_win32_path): Detect netdrive device and bypass mount
643         search for network paths.
644
645 2005-05-08  Christopher Faylor  <cgf@timesys.com>
646
647         * dcrt0.cc (get_cygwin_startup_info): New function pulled from
648         dll_crt0_0.
649         (dll_crt0_0): Use get_cygwin_startup_info to retrieve cygwin-specific
650         startup pointer.
651         * external.cc (cygwin_internal): Implement CW_ARGV and CW_ENVP.
652         * include/sys/cygwin.h: Implement CW_ARGV and CW_ENVP.
653
654 2005-05-07  Christopher Faylor  <cgf@timesys.com>
655
656         * path.cc (normalize_posix_path): Don't treat '//' specially since
657         newer versions of bash now get this right.
658
659 2005-05-07  Christopher Faylor  <cgf@timesys.com>
660
661         * devices.cc: Regenerate with correct name for dev_netdrive_storage.
662
663 2005-05-06  Christopher Faylor  <cgf@timesys.com>
664
665         * Makefile.in (DLL_O_FILES): Add fhandler_netdrive.o.
666         * fhandler_netdrive.cc: Placeholder file for future development.
667         * devices.h (FH_NETDRIVE): Define new virtual device type.
668         (netdrive_dev): Define.
669         * devices.in (dev_netdrive_storage): Define.
670         * devices.cc: Regenerate.
671
672 2005-05-04  Corinna Vinschen  <corinna@vinschen.de>
673
674         * cygerrno.h (__set_errno): Remove useless parentheses.
675
676 2005-05-04  Corinna Vinschen  <corinna@vinschen.de>
677
678         * cygerrno.h (__set_errno): Define as inline function here.
679         (set_errno): Always define as call to __set_errno.
680         * debug.cc (__set_errno): Move to cygerrno.h.
681
682 2005-05-03  Christopher Faylor  <cgf@timesys.com>
683
684         * shared.cc (user_shared_initialize): Rework locking so that nothing is
685         checked until cb is non-zero.
686
687 2005-05-03  Corinna Vinschen  <corinna@vinschen.de>
688
689         * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Don't treat
690         inability to open file as failure if only SetFileAttributes is
691         going to be called.  Only call set_file_attribute if really necessary.
692
693 2005-05-03  Corinna Vinschen  <corinna@vinschen.de>
694
695         * fhandler_socket.cc (get_inet_addr): Add missing __seterrno call.
696
697 2005-05-01  Christopher Faylor  <cgf@timesys.com>
698
699         * fhandler_tty.cc (fhandler_tty_slave::read): Actually read input when
700         vmin == vtime == 0.
701
702 2005-04-30  Christopher Faylor  <cgf@timesys.com>
703
704         * environ.cc (spenv::force_into_environment): Rename from add_always.
705         (spenv::add_if_exists): Rename from force.
706         (build_env): Accommodate name changes.  Make sure that stuff that is
707         always supposed to be in the environment is actually added to the
708         environment.
709
710         * shared.cc (open_shared): Restore VirtualFree eliminated by 2005-04-28
711         change.
712
713 2005-04-30  Christopher Faylor  <cgf@timesys.com>
714
715         * errno.cc (errmap): Sort table.
716
717 2005-04-29  Christopher Faylor  <cgf@timesys.com>
718
719         * errno.cc (errmap): Map ERROR_NETNAME_DELETED to ENOSHARE.
720
721 2005-04-28  Corinna Vinschen  <corinna@vinschen.de>
722
723         * shared_info.h (cygwin_shared_address): Bump to a higher value to avoid
724         collision with large data areas.
725
726 2005-04-28  Christopher Faylor  <cgf@timesys.com>
727
728         * fhandler_console.cc (fhandler_console::get_tty_stuff): Accommodate
729         changes to open_shared arguments.
730         * fhandler_tape.cc (mtinfo_init): Ditto.
731         * pinfo.cc (pinfo::init): Use open_shared rather than win32 mmap calls.
732         * shared.cc (user_shared_initialize): Ditto.
733         (memory_init): Ditto.
734         (open_shared): Change to allow use a smore general mmap handler.
735         * shared_info.h (shared_locations): Add SH_JUSTCREATE, SH_JUSTOPEN.
736         (open_shared): Change declaration to match new usage.
737
738         * autoload.cc (LoadDLLfuncEx2): Define in terms of LoadDLLfuncEx3.
739         (LoadDLLfuncEx3): New macro.
740
741 2005-04-27  Christopher Faylor  <cgf@timesys.com>
742
743         * fhandler.cc (fhandler_base::open_9x): Remove (broken) check for
744         O_CREAT|O_EXCL.
745         * syscalls.cc (open): Do O_CREAT|O_EXCL check here first.
746
747 2005-04-26  Christopher Faylor  <cgf@timesys.com>
748
749         * environ.cc (build_env): Ensure that win32 array is properly filled in
750         when a missing value has to be generated.
751
752 2005-04-26  Christopher Faylor  <cgf@timesys.com>
753
754         * include/cygwin/version.h: Bump DLL minor number to 17.
755
756 2005-04-24  Pavel Tsekov <ptsekov@gmx.net>
757
758         * how-to-debug-cygwin.txt: Fix typo.
759
760 2005-04-22  Christopher Faylor  <cgf@timesys.com>
761
762         * shared.cc (user_shared_initialize): Implement locking similar to
763         shared_info when initializing shared region.
764
765 2005-04-22  Christopher Faylor  <cgf@timesys.com>
766
767         * fhandler.h (dev_console::set_color): Define new function.
768         (dev_console::set_default_attr): Ditto, moved from fhandler_console.
769         (dev_console::fillin_info): Ditto.  Accommodate this change throughout
770         this file.
771         (fhandler_console::get_win32_attr): Eliminate.
772         * fhandler_console.cc (fhandler_console::get_tty_stuff): Properly set
773         default attributes on initialization.
774         (fhandler_console::open): Set current attributes rather than default
775         color on open.
776         (fhandler_console::get_win32_attr): Eliminate.
777         (dev_console::set_color): New function.  Move get_win32_attr stuff
778         here.
779         (dev_console::set_default_attr): New function, moved from
780         fhandler_console.
781         (dev_console::fillin_info): Ditto.
782         (fhandler_console::char_command): Call set_color to set screen
783         characteristics.
784
785 2005-04-22  Christopher Faylor  <cgf@timesys.com>
786
787         * fhandler.cc (fhandler_base::read): Remove unused signal state tweaks.
788         * fhandler.h (fhandler_pipe::create_selectable): Declare.
789         (fhandler_fifo::close_one_end): Declare.
790         * fhandler_fifo.cc (fhandler_fifo::close_one_end): Define.
791         (fhandler_fifo::open_not_mine): Use close_one_end to close appropriate
792         end of pipe.
793         * pinfo.cc (_pinfo::commune_recv): Ditto.
794         * pipe.cc (fhandler_pipe::create_selectable): Rename from
795         create_selectable_pipe.  Reorganize.
796         (fhandler_pipe::create): Use create_selectable.
797
798 2005-04-21  Christopher Faylor  <cgf@timesys.com>
799
800         * shared.cc (shared_info::initialize): Test previous version of shared
801         memory magic rather than current version when determining if there has
802         been a shared memory mismatch.
803
804 2005-04-20  Christopher Faylor  <cgf@timesys.com>
805
806         * sigproc.cc (proc_subproc): Fix handling of waiting for pids with zero
807         value.
808
809         * strace.cc (strace::hello): Report parent pid of executing process.
810
811 2005-04-20  Christopher Faylor  <cgf@timesys.com>
812
813         * path.cc (path_conv::check): Fix problem reading symlinks introduced
814         in below change by reverting the change and adding an additional test
815         for nonexistent files in /proc.
816
817 2005-04-20  Christopher Faylor  <cgf@timesys.com>
818
819         * path.cc (path_conv::check): Punt when attempting to access a
820         nonexistent directory or file in /proc.
821
822 2005-04-19  Corinna Vinschen  <corinna@vinschen.de>
823
824         * security.cc (alloc_sd): Remove DELETE bit from user's ACE if
825         allow_traverse is set.
826
827 2005-04-19  Corinna Vinschen  <corinna@vinschen.de>
828
829         * cygwin.din (pselect): Export.
830         * select.cc (pselect): New function.
831         * include/cygwin/version.h: Bump API minor number.
832         * include/sys/select.h: Include signal.h.  Declare pselect.
833
834 2005-04-18  Corinna Vinschen  <corinna@vinschen.de>
835
836         * fhandler.h (enum conn_state): Add connect_failed state.
837         * fhandler_socket.cc (fhandler_socket::connect): Set connect_state to
838         connect_failed when connect failed.
839         * poll.cc (poll): Change errno to EINVAL if allocating memory fails,
840         according to SUSv3. Add socket descriptors always to except_fds. Test
841         for failed connect and set revents flags appropriately.
842         * select.cc (set_bits): Set connect_state to connect_failed when
843         select indicates failed nonblocking connect.
844         (fhandler_dev_null::select_except): Set except_ready to false so that
845         /dev/null is not always in except state.
846         (peek_socket): Fix bogus conditional.
847         (fhandler_socket::select_write): Treat all connect_states except
848         unconnected equivalent to return consistent results.
849         (fhandler_windows::select_except): Set except_ready to false so that
850         /dev/windows is not always in except state.
851
852 2005-04-18  Christopher Faylor  <cgf@timesys.com>
853
854         * include/cygwin/version.h: Bump DLL minor number to 16.
855
856 2005-04-18  Pierre Humblet <pierre.humblet@ieee.org>
857
858         * grp.cc (initgroups32): Return the correct value.
859
860 2005-04-16  Corinna Vinschen  <corinna@vinschen.de>
861
862         * fhandler_disk_file.cc (fhandler_base::utimes_fs): Ignore
863         ERROR_NOT_SUPPORTED to workaround Win9x weirdness.
864         * path.cc (symlink_info::check): Remap ERROR_INVALID_FUNTION to
865         ERROR_FILE_NOT_FOUND for the same reason.
866
867 2005-04-16  Corinna Vinschen  <corinna@vinschen.de>
868             Pierre Humblet <pierre.humblet@ieee.org>
869
870         * security.h (cygsidlist::addfromgr): Allow duplicate entries.
871         (get_server_groups): Declare new function.
872         * security.cc (is_group_member): Simplify.
873         (get_server_groups): New function.
874         (get_initgroups_sidlist): Call get_server_groups.
875         (verify_token): Allow token when supplementary sids are not in
876         /etc/group but are in the token.
877         Streamline the code.
878         * grp.cc (initgroups32): New implementation.
879         (getgroups32): Handle case where the supplementary groups are set.
880
881 2005-04-16  Corinna Vinschen  <corinna@vinschen.de>
882
883         * environ.cc (environ_init): Don't set traverse checking as default.
884
885 2005-04-16  Corinna Vinschen  <corinna@vinschen.de>
886
887         * fhandler_disk_file.cc (fhandler_base::utimes_fs): Drop touching
888         ChangeTime.
889
890 2005-04-16  Christopher Faylor  <cgf@timesys.com>
891
892         * fhandler.cc (fhandler::dup): Duplicate flags, too.
893         * fhandler.h (fhandler_fifo::owner): Eliminate.
894         * fhandler_disk_file.cc (fhandler_base::fstat_fs): Handle on-disk
895         devices better.
896         (fhandler_base::fstat_helper): Ditto.
897         * fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Don't initialize
898         obsolete "owner".
899         (fhandler_fifo::open_not_mine): Add some debugging.  Duplicate correct
900         handle when we own it.
901         (fhandler_fifo::open): Set flags from input, not from first pipe.  Flag
902         that fork fixup is needed.
903         (fhandler_fifo::dup): Set errno correctly when DuplicateHandle fails.
904         * pinfo.cc (commune_send): Add debugging for fifo.
905
906         * cygwin/version.h: Bump API minor version to 127 to reflect exporting
907         of sigrelese.
908
909 2005-04-14  Kazuhiro Fujieda  <fujieda@jaist.ac.jp>
910
911         * syscalls.cc (setuid32): Correct debugging output.
912
913 2005-04-14  Christopher Faylor  <cgf@timesys.com>
914
915         * dcrt0.cc (do_global_dtors): Run DLL dtors.
916         (__main): Don't rely on atexit to run dtors.
917         (do_exit): Specifically call do_global_dtors here.
918         (cygwin_exit): Ditto.
919         * dll_init.cc (dll_global_dtors): Make global.  Only run dtors once.
920         (dll_list::init): Just set flag that dtors should be run.  Don't rely on atexit.
921         * dll_init.h (dll_global_dtors): Declare.
922
923         * exceptions.cc (sigrelse): Define.
924
925         * path.h (is_fs_device): New method.
926         (is_lnk_special): Ditto.
927         * fhandler_disk_file.cc (fhandler_disk_file::link): Use
928         "is_lnk_special" rather than "is_lnk_symlink".
929         * syscalls.cc (rename): Ditto.
930
931         * hookapi.cc (ld_preload): Use colon as a separator rather than space.
932
933 2005-04-13  Corinna Vinschen  <corinna@vinschen.de>
934
935         * fhandler.h (class fhandler_socket): Remove utimes.
936         * fhandler_socket.cc (fhandler_socket::utimes): Remove.
937
938 2005-04-13  Corinna Vinschen  <corinna@vinschen.de>
939
940         * cygerrno.h (__seterrno_from_nt_status): Define. Always set Win32
941         error code as well as errno. Use throughout where errno is set from
942         NT status.
943         (set_errno): Evaluate val only once.
944         * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Fix typo in
945         debug output.
946         * fhandler_mem.cc (fhandler_dev_mem::open): Rely on
947         __seterrno_from_nt_status setting Win32 error code in debug output.
948         * fhandler_proc.cc (format_proc_uptime): Ditto.
949         (format_proc_stat): Ditto.
950         * fhandler_process.cc (format_process_stat): Ditto.
951         * sysconf.cc (sysconf): Ditto.
952
953 2005-04-13  Christopher Faylor  <cgf@timesys.com>
954
955         * fhandler.h (fhandler_base::utimes_fs): New method.
956         * fhandler.cc (fhandler_base::utimes): Call utimes_fs if on-disk
957         special file.
958         * fhandler_disk_file.cc (fhandler_disk_file::utimes): Use utimes_fs.
959         (fhandler_base::utimes_fs): Handle on-disk device files.
960
961 2005-04-13  Corinna Vinschen  <corinna@vinschen.de>
962
963         * fhandler_disk_file.cc (fhandler_disk_file::utimes): Don't set errno
964         if open fails, it has already been set by open.
965
966 2005-04-12  Corinna Vinschen  <corinna@vinschen.de>
967
968         * autoload.cc (NtQueryVolumeInformationFile): Add.
969         * fhandler.cc (fhandler_base::raw_write): Don't touch has_changed flag.
970         * fhandler.h (enum change_state): Remove.
971         (fhandler_base::status): Revert has_changed to a simple bit.
972         (fhandler_base::fstat_helper): Add nAllocSize parameter.  Rename
973         ftCreationTime to ftChangeTime.
974         * fhandler_disk_file.cc: Call fstat_helper with additional
975         allocation size throughout.
976         (fhandler_base::fstat_by_handle): Use NT native functions to get
977         full file information on NT.  Call fstat_helper with LastWriteTime
978         as ctime, if ChangeTime is not available.
979         (fhandler_base::fstat_by_name): Call fstat_helper with LastWriteTime
980         as ctime.
981         (fhandler_base::fstat_helper): Add comment. Drop special FAT
982         handling since it's useless. Use nAllocSize for st_blocks if available.
983         (fhandler_disk_file::touch_ctime): Only touch LastWriteTime.
984         (fhandler_disk_file::fchmod): Set has_changed on 9x only.
985         (fhandler_disk_file::fchown): Don't set has_changed.
986         (fhandler_disk_file::facl): Ditto.
987         (fhandler_disk_file::ftruncate): Ditto.
988         (fhandler_disk_file::link): Set has_changed on 9x only and on original
989         file only.
990         (fhandler_base::open_fs): Don't set has_changed in O_TRUNC case.
991         * ntdll.h (FILE_BASIC_INFORMATION): Define.
992         (FILE_STANDARD_INFORMATION): Define.
993         (FILE_INTERNAL_INFORMATION): Define.
994         (FILE_EA_INFORMATION): Define.
995         (FILE_ACCESS_INFORMATION): Define.
996         (FILE_POSITION_INFORMATION): Define.
997         (FILE_MODE_INFORMATION): Define.
998         (FILE_ALIGNMENT_INFORMATION): Define.
999         (FILE_NAME_INFORMATION): Don't define with arbitrary FileName size.
1000         (FILE_ALL_INFORMATION): Define.
1001         (FILE_INFORMATION_CLASS): Add FileAllInformation.
1002         (FILE_FS_VOLUME_INFORMATION): Define.
1003         (FS_INFORMATION_CLASS): Define.
1004         (NtQueryVolumeInformationFile): Define.
1005
1006 2005-04-11  Corinna Vinschen  <corinna@vinschen.de>
1007
1008         Revert previous patch.
1009         * autoload.cc (GetVolumePathNamesForVolumeNameA): Remove.
1010         (GetVolumeNameForVolumeMountPointA): Add.
1011         * syscalls.cc (sync): Rewrite guid case to skip floppies also on
1012         Windows 2000.
1013
1014 2005-04-11  Corinna Vinschen  <corinna@vinschen.de>
1015
1016         * syscalls.cc (sync): Use renamed has_get_volume_pathnames wincap.
1017         * wincap.h (wincaps::has_get_volume_pathnames): Rename from
1018         has_guid_volumes
1019         * wincap.cc: Accomodate above rename throughout.  Set to false on
1020         Windows 2000.
1021
1022 2005-04-08  Christopher Faylor  <cgf@timesys.com>
1023
1024         * pipe.cc (fhandler_pipe::open): Remove O_CREAT limitation.
1025
1026 2005-04-07  Corinna Vinschen  <corinna@vinschen.de>
1027
1028         * syslog.cc (try_connect_guard): Remove useless conditionalized code.
1029
1030 2005-04-07  Corinna Vinschen  <corinna@vinschen.de>
1031
1032         * syslog.cc: Include sys/socket.h.
1033         (try_connect_guard): New static variable.
1034         (syslogd_inited): Ditto.
1035         (syslogd_sock): Ditto.
1036         (try_connect_syslogd): New function to connect and write syslog to
1037         local syslogd.
1038         (vsyslog): Log to stderr if LOG_PERROR flag has been given to openlog.
1039         Try logging to syslogd.  Use Event Log resp. log file as fallback.
1040         (closelog): Close socket to syslogd.
1041         * include/sys/syslog.h (_PATH_LOG): Define.
1042         (INTERNAL_NOPRI): Define if SYSLOG_NAMES is defined.
1043         (INTERNAL_MARK): Ditto.
1044         (struct _code): Ditto.
1045         (prioritynames): Ditto.
1046         (facilitynames): Ditto.
1047
1048 2005-04-06  Corinna Vinschen  <corinna@vinschen.de>
1049
1050         * fhandler_socket.cc (get_inet_addr): Add type parameter to return
1051         unix socket type.  Read socket type from unix socket file.
1052         (fhandler_socket::bind): Write socket type to unix socket file.
1053         (fhandler_socket::connect): Return with errno EPROTOTYPE if
1054         socket type of socket doesn't match socket type of unix socket
1055         trying to connect to.
1056
1057 2005-04-06  Pierre Humblet <pierre.humblet@ieee.org>
1058
1059         * security.h (cygsidlist::addfromgr): Avoid duplicate entries.
1060         * grp.cc (initgrousp): Add syscall_printf.
1061         (setgroups): Add syscall_printf and make sure sids are added only once.
1062
1063 2005-04-06  Christopher Faylor  <cgf@timesys.com>
1064
1065         * net.cc (cygwin_getservbyname): Return (possibly NULL) return value of
1066         dup_ent rather than assuming that tls buffer is valid.
1067         (cygwin_getservbyport): Ditto.
1068         (cygwin_gethostbyname): Ditto.
1069         (cygwin_gethostbyaddr): Ditto.
1070
1071 2005-04-05  Christopher Faylor  <cgf@timesys.com>
1072
1073         * cygtls.cc (_cygtls::remove): Don't free or close stuff if we're being
1074         called in a "non-standard" way.
1075
1076 2005-04-05  Christopher Faylor  <cgf@timesys.com>
1077
1078         * sync.h (muto::initforce): Delete flawed implementation.
1079         * pwdgrp.h (pwdgrp::pglock): Make static.
1080         * grp.cc (pwdgrp::pwdgrp): Eliminate use of initforce.
1081
1082 2005-04-05  Christopher Faylor  <cgf@timesys.com>
1083
1084         * sync.h (muto::initforce): Force initialization even when name !=
1085         NULL.
1086         * grp.cc (pwdgrp::pwdgrp): Use initforce since the enclosing structure
1087         is !NO_COPY.
1088
1089 2005-04-05  Christopher Faylor  <cgf@timesys.com>
1090
1091         * sync.h (muto::operator int): New operator.
1092         (locker): Remove unused class.
1093         (new_muto): Delete.
1094         (new_muto1): Ditto.
1095         (new_muto_name): Ditto.
1096         * cygheap.cc (cygheap_setup_for_child): Reflect use of static storage
1097         for muto rather than pointer.
1098         (_csbrk): Ditto.
1099         (_cmalloc): Ditto.
1100         (_cmalloc): Ditto.
1101         (_cfree): Ditto.
1102         * cygheap.h (cwdstuff::cwd_lock): Ditto.
1103         (cwdstuff::get_drive): Ditto.
1104         * cygmalloc.h (__malloc_lock): Ditto.
1105         (__malloc_unlock): Ditto.
1106         * cygtls.cc (sentry::lock): Ditto.
1107         (sentry::sentry): Ditto.
1108         (~sentry): Ditto.
1109         (_cygtls::init): Ditto.
1110         * dcrt0.cc: Ditto.
1111         (cygwin_atexit): Ditto.
1112         (cygwin_exit): Ditto.
1113         * debug.cc (lock_debug::locker): Ditto.
1114         (lock_debug::lock_debug): Ditto.
1115         (lock_debug::unlock): Ditto.
1116         (debug_init): Ditto.
1117         * dtable.cc (dtable::init_lock): Ditto.
1118         * dtable.h (dtable::lock_cs): Ditto.
1119         (dtable::lock): Ditto.
1120         (dtable::unlock): Ditto.
1121         * exceptions.cc (mask_sync): Ditto.
1122         (sighold): Ditto.
1123         (set_process_mask_delta): Ditto.
1124         (set_signal_mask): Ditto.
1125         (events_init): Ditto.
1126         * grp.cc (pwdgrp::pwdgrp): Ditto.
1127         * malloc_wrapper.cc (mallock): Ditto.
1128         (malloc_init): Ditto.
1129         * path.cc (cwdstuff::cwd_lock): Ditto.
1130         (cwdstuff::get_hash): Ditto.
1131         (cwdstuff::get_hash): Ditto.
1132         (cwdstuff::init): Ditto.
1133         (cwdstuff::set): Ditto.
1134         (cwdstuff::get): Ditto.
1135         * pwdgrp.h (pwdgrp::pglock): Ditto.
1136         (pwdgrp::refresh): Ditto.
1137         * sigproc.cc (sync_proc_subproc): Ditto.
1138         (get_proc_lock): Ditto.
1139         (proc_subproc): Ditto.
1140         (_cygtls::remove_wq): Ditto.
1141         (proc_terminate): Ditto.
1142         (sigproc_init): Ditto.
1143         * timer.cc (lock_timer_tracker::protect): Ditto.
1144         (lock_timer_tracker::lock_timer_tracker): Ditto.
1145         (lock_timer_tracker::~lock_timer_tracker): Ditto.
1146         * wininfo.cc (wininfo::_lock;): Ditto.
1147         (wininfo::winthread): Ditto.
1148         (operator HWND): Ditto.
1149         (wininfo::lock): Ditto.
1150         (wininfo::release): Ditto.
1151         * wininfo.h (wininfo::_lock;): Ditto.
1152
1153 2005-04-04  Christopher Faylor  <cgf@timesys.com>
1154
1155         * path.cc (path_conv::check): Only check for PC_NO_ACCESS_CHECK in end
1156         component.
1157
1158 2005-04-04  Corinna Vinschen  <corinna@vinschen.de>
1159
1160         * dcrt0.cc (dll_crt0_1): Don't call set_cygwin_privileges on 9x.
1161
1162         * fhandler.h (enum change_state): Add.
1163         (fhandler_base::status): Add a bit to has_changed flag.
1164         (fhandler_base::has_changed): Implement with type change_state.
1165         * fhandler.cc (fhandler_base::raw_write): Accommodate type change
1166         of has_changed.
1167         * fhandler_disk_file.cc (fhandler_disk_file::touch_ctime): Also
1168         touch modification time if has_changed == data_changed.
1169         (fhandler_disk_file::fchmod): Also open on 9x, otherwise we can't
1170         touch ctime.  Accommodate type change of has_changed.
1171         (fhandler_disk_file::fchown): Accommodate type change of has_changed.
1172         (fhandler_disk_file::facl): Ditto.
1173         (fhandler_disk_file::ftruncate): Ditto.
1174         (fhandler_disk_file::link): Ditto.
1175         (fhandler_base::open_fs): Ditto.
1176
1177 2005-04-03  Corinna Vinschen  <corinna@vinschen.de>
1178
1179         * cygheap.cc (cygheap_init): Accommodate set_process_privilege change.
1180         * cygheap.h (cygheap_user::curr_primary_token): New member.
1181         (cygheap_user::primary_token): New method.
1182         (cygheap_user::deimpersonate): Always revert to processes'
1183         impersonation token.
1184         (cygheap_user::reimpersonate): Set processes' or setuid token as
1185         necessary.
1186         (cygheap_user::has_impersonation_tokens): Look for curr_primary_token
1187         value.
1188         (cygheap_user::close_impersonation_tokens): Close curr_primary_token
1189         here if necessary.  Don't reset token values to NO_IMPERSONATION since
1190         that's done in uinfo_init anyway.
1191         (init_cygheap::luid): New LUID array keeping privilege LUIDs.
1192         * cygtls.cc (_cygtls::init_thread): Call cygheap->user.reimpersonate.
1193         * dcrt0.cc (hProcToken): New global variable to keep process token.
1194         (hProcImpToken): Ditto for process impersonation token.
1195         (dll_crt0_0): Open process token here once.  Duplicate to create
1196         hProcImpToken.
1197         (dll_crt0_1): Call set_cygwin_privileges.
1198         * environ.cc (allow_ntea): Drop duplicate declaration.
1199         (allow_smbntsec): Ditto.
1200         (set_traverse): Only set allow_traverse here.
1201         (environ_init): Ditto.
1202         * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Drop call to
1203         enable_restore_privilege.
1204         (fhandler_disk_file::fchown): Ditto.
1205         (fhandler_disk_file::facl): Ditto.
1206         * fork.cc (fork_child): Move call to cygheap->user.reimpersonate after
1207         syn with parent. Call set_cygwin_privileges.
1208         * grp.cc (internal_getgroups): Use hProcImpToken instead of opening
1209         process token.
1210         * path.cc (fs_info::update): Bypass traverse checking when retrieving
1211         volume information using push/pop_thread_privileges.
1212         * registry.cc (load_registry_hive): Drop setting restore privilege
1213         since it's already set if available.
1214         * sec_helper.cc: Include cygtls.h.
1215         (cygpriv): Privilege string array.
1216         (privilege_luid): New function, evaluate LUID from cygpriv_idx.
1217         (privilege_luid_by_name): New function, evaluate LUID from privilege
1218         string.
1219         (privilege_name): New function, evaluate privilege string from
1220         cygpriv_idx.
1221         (set_privilege): New static function called by set_process_privilege
1222         and set_thread_privilege.  Call privilege_luid to get privilege LUID.
1223         Fix bug in return value evaluation. Improve debug output.
1224         (set_cygwin_privileges): New function.
1225         (set_process_privilege): Remove.
1226         (enable_restore_privilege): Remove.
1227         * security.cc (allow_traverse): New global variable.
1228         (sys_privs): Change type to cygpriv_idx and store privilege indices
1229         instead of strings.
1230         (SYSTEM_PRIVILEGES_COUNT): Renamed from SYSTEM_PERMISSION_COUNT.
1231         (get_system_priv_list): Don't use numerical constant in malloc call.
1232         Use privilege_luid to get privilege LUIDs.
1233         (get_priv_list): Call privilege_luid_by_name to get LUIDs. Improve
1234         inner privilege LUID comparison loop.
1235         (create_token): Enable create token privilege using
1236         push/pop_self_privileges. Use hProcToken instead of opening process
1237         token. Use default DACL when duplicating token.
1238         (subauth): Enable tcb privilege using push/pop_self_privileges.
1239         Use sec_none instead of homw made security attributes when duplicating
1240         token.
1241         (check_file_access): Don't duplicate access token, use active
1242         impersonation token as is.
1243         * security.h (enum cygpriv_idx): New enumeration type enumerating
1244         possible privileges.
1245         (privilege_luid): Declare new function.
1246         (privilege_luid_by_name): Ditto.
1247         (privilege_name): Ditto.
1248         (allow_traverse): Declare.
1249         (set_privilege): Declare function.
1250         (set_process_privilege): Define as macro.
1251         (enable_restore_privilege): Remove declaration.
1252         (_push_thread_privilege): Define macro.
1253         (push_thread_privilege): Ditto.
1254         (pop_thread_privilege): Ditto.
1255         (pop_self_privilege): Ditto.
1256         * spawn.cc (spawn_guts): Use cygheap->user.primary_token instead of
1257         cygheap->user.token.
1258         * syscalls.cc (statvfs): Bypass traverse checking when retrieving
1259         volume information using push/pop_thread_privileges. Rearrange code
1260         to simplify push/pop bracketing.
1261         (seteuid32): Use hProcToken instead of opening process token. Call
1262         cygheap->user.deimpersonate instead of RevertToSelf.  Create
1263         impersonation token from primary internal or external token.  Set
1264         cygheap->user.curr_primary_token and cygheap->user.current_token
1265         privileges once here.  Drop "failed" and "failed_ptok" labels.
1266         Drop setting DefaultDacl of process token.
1267         (setegid32): Use hProcToken and hProcImpToken instead of opening
1268         process token. Always reimpersonate afterwards.
1269         * uinfo.cc (cygheap_user::init): Use hProcToken instead of opening
1270         process token.
1271         (internal_getlogin): Ditto. Set hProcImpToken, too.
1272         (uinfo_init): Initialize cygheap->user.curr_primary_token.
1273         * winsup.h (hProcToken): Declare.
1274         (hProcImpToken): Declare.
1275
1276 2005-04-03  Corinna Vinschen  <corinna@vinschen.de>
1277
1278         Unify usage of CYG_MAX_PATH throughout.  Change buffers from
1279         size CYG_MAX_PATH + 1 to CYG_MAX_PATH.  Change length tests
1280         accordingly.
1281
1282 2005-04-02  Christopher Faylor  <cgf@timesys.com>
1283
1284         * include/cygwin/version.h: Bump DLL minor number to 15.
1285
1286 2005-04-01  Corinna Vinschen  <corinna@vinschen.de>
1287
1288         * fork.cc (fork_child): Add missing __stdcall.
1289
1290 2005-04-01  Christopher Faylor  <cgf@timesys.com>
1291
1292         * sigproc.cc (create_signal_arrive): New (temporary?) function to
1293         create signal_arrived event.
1294         (sigproc_init): Use create_signal_arrived.
1295         * fork.cc (fork_child): Create signal_arrived early.
1296
1297 2005-04-01  Corinna Vinschen  <corinna@vinschen.de>
1298
1299         * fork.cc (fork_child): Fixup SYSV IPC shared memory before fixing
1300         up fdtab.
1301
1302 2005-03-31  Corinna Vinschen  <corinna@vinschen.de>
1303
1304         * gentls_offsets: Add '-m32' flag to native compiler call to satisfy
1305         cross platform builds.
1306
1307 2005-03-31  Corinna Vinschen  <corinna@vinschen.de>
1308
1309         * errno.cc (NO_SYSTEM_RESOURCES): Map to EAGAIN.
1310         (NONPAGED_SYSTEM_RESOURCES): Ditto.
1311         (PAGED_SYSTEM_RESOURCES): Ditto.
1312         (WORKING_SET_QUOTA): Ditto.
1313         (PAGEFILE_QUOTA): Ditto.
1314         (COMMITMENT_LIMIT): Ditto.
1315
1316 2005-03-30  Christopher Faylor  <cgf@timesys.com>
1317
1318         * environ.cc (spenvs): Re-force SYSTEMROOT to always be included in
1319         environment.
1320         (build_env): Ditto.
1321
1322 2005-03-30  Christopher Faylor  <cgf@timesys.com>
1323
1324         * environ.cc (spenv::retrieve): Revert most of previous change.
1325         (build_env): Ditto.  Rework to track environment variables which need
1326         to always be in the windows environment in a separate array.
1327
1328 2005-03-30  Igor Pechtchanski  <pechtcha@cs.nyu.edu>
1329
1330         * path.cc (symlink_info::case_check): Ignore trailing characters
1331         in paths when comparing case.
1332
1333 2005-03-30  Christopher Faylor  <cgf@timesys.com>
1334
1335         * environ.h (win_env::immediate): Declare new field.
1336         (win_env::operator = ): Declare new operator.
1337         (win_env::reset): Declare new function.
1338         (win_env::~win_env): Declare new destructor.
1339         (getwinenv): Add optional third argument to declaration.
1340         * environ.cc (conv_envvars): Accommodate immediate field.
1341         (win_env::operator =): Define new operator.
1342         (win_env::~win_env): Define new destructor.
1343         (win_env::add_cache): Add value to environment immediately if
1344         "immediate" is set.
1345         (getwinenv): Accept optional third argument which will be used to store
1346         "cached" values to avoid overwriting real cache.
1347         (spenv::force): Declare new field.
1348         (spenvs): Accommodate force field.  Add "PATH=" with force set to true.
1349         (spenv::retrieve): Avoid duping anything if we're not building an
1350         envblock.
1351         (build_env): Ditto.  Use size of potentially constructed new
1352         environment block to determine if we need to create an environment
1353         block.  Pass getwinenv temporary storage to avoid inappropriately
1354         overwriting the environment cache.
1355
1356 2005-03-29  Eric Blake  <ebb9@byu.net>
1357
1358         * include/limits.h (NAME_MAX): New define.
1359         (PATH_MAX): POSIX allows PATH_MAX to include trailing NUL.
1360
1361 2005-03-29  Corinna Vinschen  <corinna@vinschen.de>
1362
1363         * path.cc (is_floppy): Make externally available.
1364         * path.h (is_floppy): Declare.
1365         * syscalls.cc (sync): Check for floppies on A: and B: in guid case.
1366         Don't call setmntent in non-guid case but evaluate drive bit mask
1367         locally.
1368
1369 2005-03-29  Corinna Vinschen  <corinna@vinschen.de>
1370
1371         * fhandler_process.cc: Re-add exename.
1372
1373 2005-03-28  Christopher Faylor  <cgf@timesys.com>
1374
1375         * include/ctype.h: Accommodate building in newlib.
1376
1377 2005-03-28  Christopher Faylor  <cgf@timesys.com>
1378
1379         * timer.cc (getitimer): Check that ovalue is a valid pointer, not just
1380         NULL.
1381
1382 2005-03-28  Christopher Faylor  <cgf@timesys.com>
1383
1384         * timer.cc (timer_tracker::settime): Set times to zero when just
1385         cancelling a timer.
1386
1387 2005-03-28  Christopher Faylor  <cgf@timesys.com>
1388
1389         * cygthread.cc (cygthread::detach): Revert to just waiting for thread
1390         event since waiting for anything else is racy.
1391         * timer.cc (timer_tracker::hcancel): Rename from cancel.
1392         (timer_tracker::cancel): New method.
1393         (timer_tracker::th): Remove.
1394         (timer_tracker::~timer_tracker): Call cancel method.
1395         (timer_tracker::timer_tracker): Ditto.
1396         (timer_tracker::timer_tracker): Always, clear cancel, even though it is
1397         probably not strictly necessary for ttstart.
1398         (timer_thread): Accommodate cancel -> hcancel rename.
1399         (timer_tracker::settime): Ditto.
1400         (timer_tracker::gettime): Ditto.
1401         (timer_delete): Ditto.
1402
1403         * cygwin.din: Export _ctype_.
1404         * include/ctype.h: Mark that _ctype_ is imported.
1405
1406 2005-03-28  Christopher Faylor  <cgf@timesys.com>
1407
1408         * timer.cc (timer_tracker::timer_tracker): Eliminate simple
1409         constructor.
1410         (ttstart): Fully initialize.
1411
1412         * errno.cc: Fix typo introduced in previous change.
1413
1414 2005-03-28  Eric Blake  <ebb9@byu.net>
1415
1416         * errno.cc (FILENAME_EXCED_RANGE): Map to ENAMETOOLONG.
1417
1418 2005-03-27  Christopher Faylor  <cgf@timesys.com>
1419
1420         * signal.cc (nanosleep): Revert tv_sec < 0 check as it is fixed
1421         properly in the below change to hires.h.
1422
1423 2005-03-27  Pierre Humblet <pierre.humblet@ieee.org>
1424
1425         * times.cc (hires_ms::usecs): Compare the difference.
1426         * hires.h: Add parentheses to HIRES_DELAY_MAX.
1427
1428 2005-03-26  Christopher Faylor  <cgf@timesys.com>
1429
1430         * timer.cc (nanosleep): Treat tv_sec < 0 as invalid.
1431
1432         * include/search.h: Make declarations consistent with newlib.
1433
1434 2005-03-26  Pierre Humblet <pierre.humblet@ieee.org>
1435             Christopher Faylor <cgf@timesys.com>
1436
1437         * wininfo.h (wininfo::timer_active): Delete.
1438         (wininfo::itv): Ditto.
1439         (wininfo::start_time): Ditto.
1440         (wininfo::window_started): Ditto.
1441         (wininfo::getitimer): Ditto.
1442         (wininfo::setitimer): Ditto.
1443         (wininfo::wininfo): Ditto.
1444         (wininfo::lock): New method.
1445         (wininfo::release): Ditto.
1446         * window.cc:  Use new lock/acquire wininfo methods throughout.
1447          (wininfo::wininfo): Delete
1448         (wininfo::getitimer): Ditto.
1449         (wininfo::setitimer): Ditto.
1450         (getitimer): Ditto.
1451         (setitimer): Ditto.
1452         (ualarm): Ditto.
1453         (alarm): Ditto.
1454         (wininfo::lock): Define new function.
1455         (wininfo::release): Ditto.
1456         (wininfo::process): Delete WM_TIMER handling.
1457         * timer.cc (struct timetracker): Delete it, flags.  Add it_interval,
1458         interval_us, sleepto_us, running, init_muto(), syncthread, and
1459         gettime().
1460         (ttstart): Make NO_COPY.
1461         (lock_timer_tracker): New class.
1462         (timer_tracker::timer_tracker): Distinguish ttstart case.
1463         (timer_tracker::~timer_tracker): New destructor.  Clean out events, and
1464         reset magic.
1465         (timer_tracker::init_muto): New method.
1466         (to_us): Round up as per POSIX.
1467         (timer_thread): Reorganize to match timer_tracker::settime and
1468         timer_tracker::gettime.  Call sig_send without wait.  Call
1469         auto_release.
1470         (timer_tracker::settime): Reorganize logic to avoid race.  Call gettime
1471         to recover old value.
1472         (timer_tracker::gettime): New method.
1473         (timer_create): Properly set errno on invalid timerid.  Use new
1474         lock_timer_tracker method.
1475         (timer_delete): Ditto.  Simplify code slightly.
1476         (timer_gettime): New function.
1477         (fixup_timers_after_fork): Reinit ttstart.
1478         (getitimer): New implementation.
1479         (setitimer): Ditto.
1480         (ualarm): Ditto.
1481         (alarm): Ditto.
1482         * cygwin.din: Export timer_gettime.
1483         * winsup.h: Remove has has_visible_window_station declaration.
1484
1485 2005-03-26  Christopher Faylor  <cgf@timesys.com>
1486
1487         * Makefile.in (DLL_OFILES): Add lsearch.o.
1488         * cygthread.h (cygthread::notify_detached): New element.
1489         (cygthread::cygthread): Take optional fourth argument signifying event
1490         to signal on thread completion.
1491         * cygthread.cc (cygthread::stub): Signal notify_detached event, if it
1492         exists.
1493         (cygthread::cygthread): Initialize notify_detached from fourth argument.
1494         (cygthread::detach): Wait for notify_detached field is present.
1495
1496         * lsearch.cc: New file.
1497         * search.h: Ditto.
1498         * include/cygwin/version.h: Bump API minor number to 126.
1499         * cygwin.din: Export lsearch, lfind.
1500
1501 2005-03-23  Corinna Vinschen  <corinna@vinschen.de>
1502
1503         * fhandler.h (fhandler_socket::secret_event): Remove.
1504         (fhandler_socket::af_local_set_secret): New function combining former
1505         set_connect_secret and get_connect_secret into one function.
1506         (fhandler_socket::af_local_setblocking): Rename from eid_setblocking.
1507         (fhandler_socket::af_local_unsetblocking): Rename from
1508         eid_unsetblocking.
1509         (fhandler_socket::af_local_set_cred): New method.
1510         (fhandler_socket::af_local_copy): New method.
1511         (fhandler_socket::af_local_recv_secret): New method.
1512         (fhandler_socket::af_local_send_secret): New method.
1513         (fhandler_socket::af_local_recv_cred): Rename from eid_recv.
1514         (fhandler_socket::af_local_send_cred): Rename from eid_send.
1515         (fhandler_socket::af_local_accept): New method.
1516         (fhandler_socket::af_local_set_sockpair_cred): Rename from
1517         set_socketpair_eids.
1518         (fhandler_socket::eid_accept): Remove.
1519         (fhandler_socket::eid_connect): Remove.
1520         (fhandler_socket::set_connect_secret): Remove.
1521         (fhandler_socket::get_connect_secret): Remove.
1522         (fhandler_socket::create_secret_event): Remove.
1523         (fhandler_socket::check_peer_secret_event): Remove.
1524         (fhandler_socket::signal_secret_event): Remove.
1525         (fhandler_socket::close_secret_event): Remove.
1526         (fhandler_socket::sec_event_accept): Remove.
1527         (fhandler_socket::sec_event_connect): Remove.
1528         * fhandler_socket.cc (secret_event_name): Remove.
1529         (fhandler_socket::af_local_set_sockpair_cred): Rename from
1530         set_socketpair_eids.
1531         (fhandler_socket::af_local_setblocking): Rename from eid_setblocking.
1532         (fhandler_socket::af_local_unsetblocking): Rename from
1533         eid_unsetblocking.
1534         (fhandler_socket::af_local_recv_secret): New function to receive
1535         AF_LOCAL connect secret over socket itself.
1536         (fhandler_socket::af_local_send_secret): New function to send AF_LOCAL
1537         connect secret over socket itself.
1538         (fhandler_socket::af_local_recv_cred): Rename from eid_recv.
1539         (fhandler_socket::af_local_send_cred): Rename from eid_send.
1540         (fhandler_socket::eid_connect): Remove.
1541         (fhandler_socket::af_local_connect): Take over connect side handling
1542         of AF_LOCAL secret and credential handshake.
1543         (fhandler_socket::eid_accept): Remove.
1544         (fhandler_socket::af_local_accept): New method, take over accept side
1545         handling of AF_LOCAL secret and credential handshake.
1546         (fhandler_socket::af_local_set_cred): New method, set eid credentials
1547         to start values.
1548         (fhandler_socket::af_local_copy): New method, copy secret and
1549         credentials to another socket.
1550         (fhandler_socket::af_local_set_secret): New function combining former
1551         set_connect_secret and get_connect_secret into one function.
1552         (fhandler_socket::create_secret_event): Remove.
1553         (fhandler_socket::signal_secret_event): Remove.
1554         (fhandler_socket::close_secret_event): Remove.
1555         (fhandler_socket::check_peer_secret_event): Remove.
1556         (fhandler_socket::sec_event_connect): Remove.
1557         (fhandler_socket::sec_event_accept): Remove.
1558         (fhandler_socket::fixup_after_fork): Drop secret_event handling.
1559         (fhandler_socket::bind): Call af_local_set_secret.
1560         (fhandler_socket::connect): Call af_local_set_cred and af_local_connect.
1561         (fhandler_socket::listen): Call af_local_set_cred.
1562         (fhandler_socket::accept): Call af_local_copy and af_local_accept on
1563         accepted socket.
1564         (fhandler_socket::close): Don't call close_secret_event.
1565         (fhandler_socket::set_close_on_exec): Don't set secret_event
1566         inheritance.
1567         * net.cc (cygwin_getsockopt): Add debug output.
1568         (socketpair): Call af_local_set_sockpair_cred instead of
1569         set_socketpair_eids.
1570         * select.cc (set_bits): Drop AF_LOCAL special handling in case
1571         of except bit set.
1572
1573 2005-03-23  Christopher Faylor  <cgf@timesys.com>
1574
1575         * include/ctype.h: Always define macros when inside cygwin.
1576         (isblank): New macro.
1577
1578 2005-03-23  Corinna Vinschen  <corinna@vinschen.de>
1579
1580         * fhandler.h (fhandler_socket::eid_connect): Make private.
1581         (fhandler_socket::set_connect_secret): Ditto.
1582         (fhandler_socket::get_connect_secret): Ditto.
1583         (fhandler_socket::create_secret_event): Ditto. Remove secret argument.
1584         (fhandler_socket::check_peer_secret_event): Ditto.
1585         (fhandler_socket::signal_secret_event): Make private.
1586         (fhandler_socket::close_secret_event): Ditto.
1587         (fhandler_socket::sec_event_accept): New private method.
1588         (fhandler_socket::sec_event_connect): Ditto.
1589         (fhandler_socket::af_local_connect): New public method.
1590         * fhandler_socket.cc: Use 'struct sockaddr' and 'struct sockaddr_in'
1591         rather than just 'sockaddr' and 'sockaddr_in' throughout.
1592         (fhandler_socket::eid_connect): Drop AF_LOCAL/SOCK_STREAM test.
1593         (fhandler_socket::create_secret_event): Remove secret argument.
1594         Always use connect_secret instead.
1595         (fhandler_socket::check_peer_secret_event): Ditto.
1596         (fhandler_socket::sec_event_connect): New method, combining entire
1597         secret event handshake on connect side.
1598         (fhandler_socket::af_local_connect): New method, combining secret
1599         event handshake and eid credential transaction on connect side, to
1600         be called from select.
1601         (fhandler_socket::sec_event_accept): New method, combining entire
1602         secret event handshake on accept side.
1603         (fhandler_socket::connect): Drop secret, use connect_secret instead.
1604         Move entire secret event handshake to sec_event_connect.
1605         (fhandler_socket::accept): Move entire secret event handshake to
1606         sec_event_accept.
1607         * select.cc (set_bits): Just call af_local_connect here.
1608
1609 2005-03-23  Christopher Faylor  <cgf@timesys.com>
1610
1611         * include/cygwin/version.h: Change comment for most recent API version
1612         bump to reflect new additions to the DLL and to remove change obsoleted
1613         by the previous checkin.
1614
1615 2005-03-23  Christopher Faylor  <cgf@timesys.com>
1616
1617         * include/ctype.h: New file.
1618         * ctype.cc: Ditto.
1619         * Makefile.in: Add ctype.o to DLL_OFILES.
1620         * cygwin.din: Remove _ctype_ptr (for now?).
1621
1622 2005-03-22  Christopher Faylor  <cgf@timesys.com>
1623
1624         * Makefile.in (DLL_OFILES): Add hookapi.o.  Eliminate some cruft.
1625         * cygheap.h (cygheap_types): Add new enum: HEAP_1_HOOK.
1626         (hook_chain): New struct.
1627         (init_cygheap::hooks): Define new element.
1628         * cygheap.cc (cygheap_fixup_in_child): Zero hook chain on exec.
1629         * dcrt0.cc (dll_crt0_1): Call ld_preload just before calling main function.
1630         * external.cc (cygwin_internal): Implement CW_HOOK.
1631         * fork.cc (fork_child): Call fixup_hooks_after_fork.
1632         * init.cc (cygwin_hmodule): Reinstate after a long absence.
1633         * include/sys/cygwin.h: Define CW_HOOK.
1634         * hookapi.cc: New file.
1635
1636         * select.cc (start_thread_socket): Add debugging output.
1637
1638         * fhandler_disk_file.cc (fhandler_disk_file::fchmod): gcc 4.x
1639         accommodation.
1640
1641         * fhandler_socket.cc (fhandler_socket::connect): Make sure that err is
1642         initialized.
1643
1644 2005-03-22  Corinna Vinschen  <corinna@vinschen.de>
1645
1646         * cygwin.din (__ctype_ptr): Export.
1647         * include/cygwin/version.h: Bump API minor version.
1648
1649 2005-03-21  Corinna Vinschen  <corinna@vinschen.de>
1650
1651         * fhandler.h (class cygthread): Remove forward declaration.
1652
1653 2005-03-21  Corinna Vinschen  <corinna@vinschen.de>
1654
1655         * fhandler.h (class cygthread): Forward declare.
1656         (fhandler_socket::sec_pipe): Remove.
1657         (fhandler_socket::eid_pipe_name): Remove.
1658         (fhandler_socket::eid_setblocking): New private method.
1659         (fhandler_socket::eid_unsetblocking): Ditto
1660         (fhandler_socket::eid_recv): Ditto
1661         (fhandler_socket::eid_send): Ditto
1662         (fhandler_socket::eid_accept): Ditto
1663         (fhandler_socket::eid_connect): New public method.
1664         * fhandler_socket.cc (ASYNC_MASK): Move to beginning of file.
1665         (fhandler_socket::eid_pipe_name): Remove.
1666         (fhandler_socket::set_socketpair_eids): Move down to fhandler_socket
1667         methods.
1668         (fhandler_socket::fhandler_socket): Drop initializing sec_pipe.
1669         (fhandler_socket::~fhandler_socket): Drop closing sec_pipe.
1670         (fhandler_socket::eid_setblocking): New method.
1671         (fhandler_socket::eid_unsetblocking): New method.
1672         (fhandler_socket::eid_recv): New method.
1673         (fhandler_socket::eid_send): New method.
1674         (fhandler_socket::eid_connect): New method.
1675         (fhandler_socket::eid_accept): New method.
1676         (fhandler_socket::dup): Drop sec_pipe handling.
1677         (fhandler_socket::connect): Fix WinSock error handling. Prepare
1678         eid credential transaction. Call eid_connect on successful connect.
1679         (fhandler_socket::listen): Drop creating sec_pipe.
1680         (fhandler_socket::accept): Slightly simplify code. Call eid_accept
1681         on accepted socket.
1682         (fhandler_socket::getpeereid): Reshuffle code for readability. Fix
1683         test for invalid pid.
1684         * select.cc (set_bits): Call eid_connect on successfully connected
1685         socket.
1686
1687 2005-03-19  Christopher Faylor  <cgf@timesys.com>
1688
1689         * child_info.h (fork_info): Use different method to alias variable.
1690         (spawn_info): Ditto.
1691         * cxx.cc (__cxa_guard_acquire): New function (needed for gcc 4.x).
1692         (__cxa_guard_release): Ditto.
1693         * devices.in: Make sure stuff is correctly bracketed (for gcc 4.x).
1694         * devices.cc: Regenerate.
1695         * fhandler.h (fhandler_disk_file::fchmod): Avoid left coercion (for gcc
1696         4.x).
1697         * smallprint.c (__rn): Declare as __fastcall since gcc 4.x complains
1698         about use of regparm, for some reason.
1699         * sync.h (sync::init_lock): Remove.
1700         * sync.cc (sync::init_lock): Ditto.
1701
1702 2005-03-18  Christopher Faylor  <cgf@timesys.com>
1703
1704         * net.cc (cygwin_getprotobyname): Don't try to be fancy with return
1705         values.
1706         (cygwin_getprotobynumber): Ditto.
1707
1708 2005-03-17  Corinna Vinschen  <corinna@vinschen.de>
1709
1710         * fhandler_disk_file.cc (fhandler_disk_file::utimes): Handle opening
1711         directories under 9x gracefully.
1712
1713 2005-03-17  Corinna Vinschen  <corinna@vinschen.de>
1714
1715         * fhandler_socket.cc (fhandler_socket::connect): Always set sun_path
1716         in case of a successful or pending connect.
1717         (fhandler_socket::accept): Don't run secret event and eid credential
1718         transactions if OS accept returned WSAEWOULDBLOCK.
1719
1720 2005-03-16  Christopher Faylor  <cgf@timesys.com>
1721
1722         * fhandler_tape.cc (get_ll): This is a generally useful function so
1723         move it
1724         * winsup.h (get_ll): to here.
1725         * security.cc (get_token_group_sidlist): Use get_ll to figure out the
1726         long long version of the luid since QuadPart is not part of the
1727         standard Windows API.
1728
1729 2005-03-16  Christopher Faylor  <cgf@timesys.com>
1730
1731         * dir.cc: Rename opendir_* to dirent_* throughout.
1732         (opendir_states): Move and rename.
1733         * fhandler.h (dirent_states): to here.
1734         * fhandler_disk_file.cc (fhandler_disk_file::readdir): Use raw readdir
1735         when skipping through entries since it is keeping track of "." and
1736         "..".
1737         (fhandler_cygdrive::seekdir): Use fhandler_disk_file::readdir to do
1738         everything.
1739         * fhandler_virtual.cc (fhandler_virtual::opendir): Set flag indicating
1740         that we provide .  and ..
1741         (fhandler_virtual::seekdir): Ditto.
1742         (fhandler_virtual::rewinddir): Ditto.
1743         * fhandler_registry.cc (fhandler_registry::rewinddir): Ditto.
1744
1745 2005-03-16  Christopher Faylor  <cgf@timesys.com>
1746
1747         * cygtls.cc (free_local): New macro.
1748         (_cygtls::remove): Use free_local to free known-malloced local
1749         variables.
1750         * cygtls.h: Mark some variables as "malloced".
1751         * net.cc (enum struct_type): Rename from is_* to t_* for clarity.
1752         (dump_protoent): Delete.
1753         (dup_ent): New macro.
1754         (__dup_ent): Renamed from dup_ent.  Change arguments for convenience.
1755         Replace first argument with newly alloced value.  Allocate a rounded
1756         number of bytes in an attempt to try to reuse space.  Subsume
1757         "dump_protent".
1758         (cygwin_getprotobyname): Simplify using new dup_ent functionality.
1759         (cygwin_getprotobynumber): Ditto.
1760         (cygwin_getservbyname): Ditto.
1761         (cygwin_getservbyport): Ditto.
1762         (cygwin_gethostname): Ditto.
1763         (cygwin_gethostbyname): Ditto.
1764         * tlsoffsets.h: Regenerate.
1765
1766         * syslog.cc (openlog): Use NULL rather than 0, for consistency with the
1767         rest of cygwin.
1768         (pass_handler::initialize): Use unbuffered I/O in pass one.
1769
1770 2005-03-15  Christopher Faylor  <cgf@timesys.com>
1771
1772         * errno.cc (errmap): Correct typo in previous change.
1773
1774 2005-03-15  Christopher Faylor  <cgf@timesys.com>
1775
1776         * cygtls.cc (_cygtls::remove): Free process_ident, if it exists.
1777
1778         * errno.cc (errmap): ERROR_DISK_CORRUPT -> EIO.
1779
1780 2005-03-11  Christopher Faylor  <cgf@timesys.com>
1781
1782         * path.h (pathconv_arg): Define PC_NO_ACCESS_CHECK.
1783         (path_types): Define PATH_NO_ACCESS_CHECK == PC_NO_ACCESS_CHECK.
1784         * path.cc (symlink_info::check_sysfile): Move to symlink_info class and
1785         eliminate arguments that are part of class.  Use set_error.
1786         (symlink_info::check_shortcut): Ditto.
1787         (symlink_info::set_error): New function.
1788         (path_conv::check): Pass PC_NO_ACCESS_CHECK to symlink_info::check.
1789         (symlink_info::check): Preserve PC_NO_ACCESS_CHECK in pflags.  Use
1790         set_error.
1791
1792 2005-03-10  Corinna Vinschen  <corinna@vinschen.de>
1793
1794         * path.cc (is_floppy): New function.
1795         (setmntent): Drop floppy drives on A: and B: from logical drive DWORD.
1796         * syscalls.cc (sync): Don't sync floppies on A: and B:.
1797
1798 2005-03-10  Christopher Faylor  <cgf@timesys.com>
1799
1800         * autoload.cc (LoadDLLprime): Use nocopy segment or forked processes
1801         will not initialize properly.
1802
1803 2005-03-10  Christopher Faylor  <cgf@timesys.com>
1804
1805         * autoload.cc (LoadDLLprime): Scrap use of .linkonce and just use an
1806         ifdef guard to load .foo_init into data segment.
1807
1808         * dcrt0.cc (initial_env): Allow colon or space as CYGWIN_DEBUG
1809         separator for consistency.
1810
1811 2005-03-09  Christopher Faylor  <cgf@timesys.com>
1812
1813         * pinfo.h (pinfo::pinfo): Clear more elements in the constructor.
1814
1815 2005-03-09  Christopher Faylor  <cgf@timesys.com>
1816
1817         * net.cc (dup_ent): Revert older stupid test for null.  Don't copy name
1818         if it is NULL.
1819
1820 2005-03-09  Corinna Vinschen  <corinna@vinschen.de>
1821
1822         * fhandler_socket.cc (fhandler_socket::eid_pipe_name): Fix format
1823         string.
1824         (fhandler_socket::connect): Set sun_path before running eid credential
1825         transaction.  Run transaction only if OS connect was successful.
1826         (fhandler_socket::accept): Run transaction only if OS accept was
1827         successful.
1828
1829 2005-03-09  Corinna Vinschen  <corinna@vinschen.de>
1830
1831         * signal.cc (sigprocmask): Rename first parameter to "how".
1832         (handle_sigprocmask): Ditto.  Check "how" for being a valid "how" value.
1833         Fix call order in case of wrong "how" value.
1834
1835 2005-03-09  Christopher Faylor  <cgf@timesys.com>
1836
1837         * net.cc (dup_ent): Revert previous stupid change.
1838
1839 2005-03-09  Christopher Faylor  <cgf@timesys.com>
1840
1841         * net.cc (dup_ent): Avoid dereferencing a null pointer in a debug_printf.
1842
1843 2005-03-09  Christopher Faylor  <cgf@timesys.com>
1844
1845         * path.cc (path_conv::check): Treat ENOSHARE similarly to ENOENT when
1846         determining if there was a problem with a symlink.
1847
1848 2005-03-08  Corinna Vinschen  <corinna@vinschen.de>
1849
1850         * fhandler_socket.cc (fhandler_socket::listen): Don't limit the number
1851         of pipe instances.
1852
1853 2005-03-08  Christopher Faylor  <cgf@timesys.com>
1854
1855         * pinfo.cc (pinfo::exit): Right shift exit value by eight when not
1856         started in a cygwin environment.
1857
1858 2005-03-07  Corinna Vinschen  <corinna@vinschen.de>
1859
1860         * mmap.cc (mmap64): Handle MAP_AUTOGROW flag.
1861         (fhandler_disk_file::mmap): Ditto. Clean conditional for readability.
1862         * include/sys/mman.h: Add MAP_AUTOGROW flag.
1863         * include/cygwin/version.h: Bump API minor version.
1864
1865 2005-03-08  Christopher Faylor  <cgf@timesys.com>
1866
1867         * dcrt0.cc (dll_crt0_0): Eliminate muto::init call.
1868         * sync.h (locker): New, currently unused class.
1869         (muto::init): Eliminate.
1870         * sync.cc (muto::init): Ditto.
1871         (muto::init): Eliminate critical section lock and instead use name as a
1872         guard to prevent against multiple attempts to initialize the same muto.
1873
1874         * pinfo.cc (pinfo::init): Set myself procinfo when not execing and pid
1875         matches windows pid or cygwin pid.
1876
1877 2005-03-06  Pavel Tsekov  <ptsekov@gmx.net>
1878
1879         * path.cc (mount_info::read_cygdrive_info_from_registry): Use the user
1880         prefix if it exists.
1881
1882 2005-03-06  Christopher Faylor  <cgf@timesys.com>
1883
1884         * sync.h (sync::init_lock): Declare new static member.
1885         (sync::init()): Declare new static function.
1886         * sync.cc (sync::init): Define.
1887         (sync::init): Lock attempt to initialize a muto to stop multiple
1888         threads from colliding.
1889         * dcrt0.cc (dll_crt0_0): Initialize muto environment.
1890
1891 2005-03-06  Christopher Faylor  <cgf@timesys.com>
1892
1893         * path.cc (special_name): Reorganize to always detect the use of
1894         special names first, before detecting special characters.
1895
1896 2005-03-04  Christopher Faylor  <cgf@timesys.com>
1897
1898         * fhandler_clipboard.cc: Use int for cygnativeformat rather than UINT
1899         as that is what is returned by GetPriorityClipboardFormat.
1900         (fhandler_dev_clipboard::read): Ditto for the format variable.
1901
1902 2005-03-04  Corinna Vinschen  <corinna@vinschen.de>
1903
1904         * fhandler.cc (fhandler_base::open_9x): Satisfy query_open values.
1905
1906 2005-03-04  Pierre Humblet <pierre.humblet@ieee.org>
1907
1908         * fhandler_socket.cc (fhandler_socket::ioctl): Only cancel
1909         WSAAsyncSelect when async mode is on.
1910
1911 2005-03-03  Corinna Vinschen  <corinna@vinschen.de>
1912
1913         * cygwin.din (utmpxname): Export.
1914         * syscalls.cc (utmpxname): Create export alias to utmpname.
1915         * include/utmpx.h: Define ut_name and ut_xtime if not already defined.
1916         (utmpxname): Add prototype.
1917         * include/sys/utmp.h: Only define ut_name if not already defined.
1918         * include/cygwin/version.h: Bump API minor version.
1919
1920 2005-03-03  Christopher Faylor  <cgf@timesys.com>
1921
1922         * cygthread.cc (cygthread::detach): Use a slightly higher priority when
1923         waiting for thread signalling.
1924
1925 2005-03-02  Christopher Faylor  <cgf@timesys.com>
1926
1927         * autoload.cc (std_dll_init): Save and restore fpu control register
1928         around LoadAddress to prevent loaded dlls (like msvcrt.dll) from
1929         setting unwanted stuff.
1930
1931 2005-03-02  Christopher Faylor  <cgf@timesys.com>
1932
1933         * cygtls.cc (_cygtls::remove): Don't attempt any removal activities if
1934         exitsock is zero.
1935
1936 2005-03-02  Christopher Faylor  <cgf@timesys.com>
1937
1938         * cygtls.cc (_cygtls::init_thread): Move exitsock setting later.  It
1939         should always be set.
1940         (_cygtls::remove): Detect zero exitsock.  Not quite sure why this is needed.
1941
1942 2005-03-02  Christopher Faylor  <cgf@timesys.com>
1943
1944         * autoload.cc (LoadDLLprime): Mask error code to low-order 16 bits.
1945         (noload): Preserve sign when returning error code.
1946
1947 2005-03-02  Christopher Faylor  <cgf@timesys.com>
1948
1949         * spawn.cc (do_cleanup): Properly restore SIGINT/SIGQUIT even if they
1950         had previously been SIG_DFL.
1951
1952 2005-03-01  Corinna Vinschen  <corinna@vinschen.de>
1953
1954         * fhandler_disk_file.cc (fhandler_disk_file::touch_ctime): Replace
1955         GetSystemTime/SystemTimeToFileTime with GetSystemTimeAsFileTime.
1956         * times.cc (time_as_timestruc_t): Ditto.
1957         (time): Ditto.
1958
1959 2005-03-01  Christopher Faylor  <cgf@timesys.com>
1960
1961         * include/cygwin/version.h: Bump DLL minor number to 14.
1962
1963 2005-03-01  Corinna Vinschen  <corinna@vinschen.de>
1964
1965         * fhandler_clipboard.cc (fhandler_dev_clipboard::write): Never set
1966         errno to 0.
1967         (fhandler_dev_clipboard::read): Ditto.
1968         * fhandler_windows.cc (fhandler_windows::read): Ditto.
1969         * scandir.cc (scandir): Ditto.
1970         * syscalls.cc (_fstat64_r): Ditto.
1971         (_fstat_r): Ditto.
1972         (_stat64_r): Ditto.
1973         (_stat_r): Ditto.
1974
1975         * mmap.cc (mmap64): Fix /dev/zero mapping.
1976
1977 2005-02-28  Corinna Vinschen  <corinna@vinschen.de>
1978
1979         * fhandler.h (class fhandler_socket): Declare new method
1980         set_socketpair_eids.
1981         * fhandler_socket.cc (fhandler_socket::set_socketpair_eids): New method.
1982         (fhandler_socket::dup): Duplicate sec_pipe if necessary.
1983         (fhandler_socket::listen): Only create sec_pipe if named pipes are
1984         available. Initialized sec_peer_pid to 0 as on Linux.
1985         (fhandler_socket::connect): Only run eid credential transaction if
1986         named pipes are available.  Fake otherwise. Initialized sec_peer_pid
1987         to 0 as on Linux.
1988         (fhandler_socket::accept): Ditto.
1989         (fhandler_socket::close): Move closing sec_pipe handle from here...
1990         (fhandler_socket::~fhandler_socket): ... to here.
1991         * net.cc (socketpair): Set eid credentials by calling
1992         fhandler_socket::set_socketpair_eids() on both socket ends.
1993         * wincap.h (wincaps::has_named_pipes): New element.
1994         * wincap.cc: Implement above element throughout.
1995
1996 2005-02-26  Christopher Faylor  <cgf@timesys.com>
1997
1998         * sigproc.cc (_pinfo::set_ctty): Move function
1999         * pinfo.cc (_pinfo::set_ctty): to here.
2000
2001         * fhandler_mem.cc (fhandler_dev_mem::fstat): Don't fill out structure
2002         if this is an on-disk device rather than an "auto" device.
2003         * fhandler_raw.cc (fhandler_dev_raw::fstat): Ditto.
2004
2005         * path.cc (normalize_posix_path): Don't treat a standalone '//' as
2006         introducing a UNC path.
2007         (normalize_win32_path): Ditto.
2008
2009 2005-02-26  Christopher Faylor  <cgf@timesys.com>
2010
2011         * debug.cc (delete_handle): Report on handle value in debugging output.
2012
2013         * pinfo.h (_pinfo::exists): Declare "new" function.
2014         (_pinfo::kill): Ditto.
2015         * fhandler_termios.cc (tty_min::kill_pgrp): Use _pinfo::exists rather
2016         than proc_exists.
2017         * pinfo.cc (pinfo::init): Ditto.  Don't do a low_priority_sleep(0) when
2018         looping to find exec'ed procinfo.
2019         (pinfo::release): Be more careful about unmapping and closing.
2020         * signal.cc (_pinfo::kill): Rename from kill_worker.  Accommodate entry
2021         into _pinfo class.
2022         (kill0): Use _pinfo::kill rather than kill_worker.
2023         (kill_pgrp): Ditto.  Use _pinfo::exists rather than proc_exists.
2024         * sigproc.cc (_pinfo::exists): Rename from proc_exists.
2025         (pid_exists): Use _pinfo::exists rather than proc_exists.
2026         (remove_proc): Ditto.
2027         * sigproc.h (proc_exists): Delete declaration.
2028
2029 2005-02-25  Corinna Vinschen  <corinna@vinschen.de>
2030
2031         * fhandler.h (class fhandler_base): Declare fixup_mmap_after_fork
2032         with additional flags parameter.  Change offset parameter to _off64_t.
2033         (class fhandler_disk_file): Ditto.
2034         (class fhandler_dev_mem): Ditto.
2035         * fhandler_mem.cc (fhandler_dev_mem::fixup_mmap_after_fork):
2036         Accommodate new parameters.
2037         * mmap.cc: Include ntdll.h.
2038         (class mmap_record): Add flags member.
2039         (mmap_record::mmap_record): Add flags parameter.
2040         (mmap_record::get_flags): New method.
2041         (class map): Add next_anon_addr member to store next anonymous mapping
2042         address suggestion.
2043         (map::get_next_anon_addr): New method.
2044         (map::set_next_anon_addr): New method.
2045         (mmap64): Don't align offset and length to granularity in case of
2046         MAP_ANONYMOUS on NT.  Check for already existing mapping only on 9x.
2047         Call mmap_record::mmap_record with additional flags argument.
2048         (fhandler_base::fixup_mmap_after_fork): Accommodate new parameters.
2049         (fhandler_disk_file::mmap): Use NtMapViewOfSection with
2050         AT_ROUND_TO_PAGE flag for anonymous mappings on NT.  If addr is NULL,
2051         try to map adjacent to previous mapping.
2052         (fhandler_disk_file::fixup_mmap_after_fork): Add flags argument.
2053         Change offset parameter to _off64_t.  Use NtMapViewOfSection to
2054         re-create anonymous mappings on NT.
2055         (fixup_mmaps_after_fork): Accommodate new parameters when calling
2056         fhandler's fixup_mmaps_after_fork function.
2057         * ntdll.h (AT_ROUND_TO_PAGE): New define.
2058
2059 2005-02-25  Corinna Vinschen  <corinna@vinschen.de>
2060
2061         * mmap.cc (mmap64): Handle anonymous MAP_FIXED request on
2062         non-granulation boundary.
2063
2064 2005-02-25  Corinna Vinschen  <corinna@vinschen.de>
2065
2066         * mmap.cc (class mmap_record): Declare new map_pages method with
2067         address parameter.
2068         (mmap_record::map_pages): New method with address parameter.
2069         (mmap64): Evaluate access mode before checking if already existing
2070         mapping can be used.
2071         Only use existing mapping if requested access mode matches the one
2072         in the existing mapping.
2073         Add check for existing mapping for anonymous MAP_FIXED case.
2074
2075 2005-02-23  Corinna Vinschen  <corinna@vinschen.de>
2076
2077         * localtime.cc: Implement setting __tzrule's offset member using
2078         newlib's __gettzinfo () interface.
2079         (__tzrule): Remove.
2080         (timezone): Define as long according to POSIX.
2081
2082 2005-02-23  Eric Blake  <ebb9@byu.net>
2083
2084         * devices.in (parsedisk): Fix typo.
2085         * devices.cc: Regenerate.
2086
2087 2005-02-23  Corinna Vinschen  <corinna@vinschen.de>
2088
2089         * cygwin.din (getpeereid): Export.
2090         * fhandler.h (class fhandler_socket): Add pipe and id members to
2091         exchange eid credentials for AF_LOCAL sockets.
2092         (eid_pipe_name): Declare new method.
2093         (getpeereid): Ditto.
2094         * fhandler_socket.cc (fhandler_socket::eid_pipe_name): New method.
2095         (fhandler_socket::fhandler_socket): Initialize sec_pipe.
2096         (fhandler_socket::connect): Exchange eid credentials with accepting
2097         socket process.
2098         (fhandler_socket::listen): Prepare eid credential transaction.
2099         (fhandler_socket::accept): Exchange eid credentials with connecting
2100         socket process.
2101         (fhandler_socket::close): Close eid credentials pipe if open.
2102         (fhandler_socket::getpeereid): New method.
2103         * net.cc (cygwin_getsockopt): Add SO_PEERCRED handling.
2104         (getpeereid): New function.
2105         * include/asm/socket.h (SO_PEERCRED): Define.
2106         * include/cygwin/socket.h (struct ucred): Define new type.
2107         * include/cygwin/version.h: Bump API minor version.
2108
2109 2005-02-23  Corinna Vinschen  <corinna@vinschen.de>
2110
2111         * include/sys/statvfs.h (ST_RDONLY): Define.
2112         (ST_NOSUID): Define.
2113
2114 2005-02-23  Corinna Vinschen  <corinna@vinschen.de>
2115
2116         * cygwin.din (fstatvfs): Export.
2117         (statvfs): Export.
2118         * syscalls.cc: Include sys/statvfs.h.
2119         (statvfs): New function.  Move statfs functionality here.
2120         (fstatvfs): New function.
2121         (statfs): Just call statvfs and copy structure.  Check validity of
2122         incoming struct statfs pointer.
2123         * include/cygwin/types.h (fsblkcnt_t): Define.
2124         (fsfilcnt_t): Define.
2125         * include/cygwin/version.h: Bump API minor version.
2126         * include/sys/statvfs.h: New file.
2127
2128 2005-02-23  Corinna Vinschen  <corinna@vinschen.de>
2129
2130         * devices.h: Switch FH_ZERO and FH_PORT as on Linux.  Add FH_FULL.
2131         * devices.in: Add /dev/full.
2132         * devices.cc: Regenerate.
2133         * dtable.cc (build_fh_pc): Add FH_FULL.
2134         * fhandler.cc (fhandler_base::fstat): Set FH_FULL permission bits
2135         correctly.
2136         * fhandler_zero.cc (fhandler_dev_zero::write): Set errno to ENOSPC
2137         and return -1 if device is FH_FULL.
2138
2139 2005-02-22  Christopher Faylor  <cgf@timesys.com>
2140
2141         * fhandler_disk_file.cc (fhandler_cygdrive::closedir): Return 0 when
2142         closing cygdrive_root.
2143
2144 2005-02-22  Corinna Vinschen  <corinna@vinschen.de>
2145
2146         * cygwin.din (basename): Export.
2147         (dirname): Export.
2148         * path.cc (basename): New function.
2149         (dirname): New function.
2150         * include/libgen.h: New file.
2151         * include/cygwin/version.h: Bump API minor version.
2152
2153 2005-02-22  Corinna Vinschen  <corinna@vinschen.de>
2154
2155         * select.cc (peek_pipe): Disable new pipe code until there's
2156         a working substitute.
2157
2158 2005-02-22  Corinna Vinschen  <corinna@vinschen.de>
2159
2160         * cygwin.din (fdatasync): Export.
2161         * fhandler.cc (fhandler_base::fsync): Return with EINVAL if no
2162         handle is available.
2163         * syscalls.cc (fdatasync): Create export alias to fsync.
2164         * include/cygwin/version.h: Bump API minor version.
2165
2166 2005-02-20  Corinna Vinschen  <corinna@vinschen.de>
2167
2168         * fhandler.h (fhandler_base::fstat_helper): Declare with additional
2169         dwVolumeSerialNumber argument.  Drop default values for last three
2170         arguments.
2171         * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Pass
2172         dwVolumeSerialNumber from GetFileInformationByHandle to fstat_helper.
2173         (fhandler_base::fstat_by_name): Pass pc.volser () to fstat_helper.
2174         Accommodate dropping default values for last three arguments of
2175         fstat_helper.
2176         (fhandler_base::fstat_helper): Add dwVolumeSerialNumber argument.
2177         Use for st_dev member unless 0 in which case pc.volser () is used.
2178
2179 2005-02-20  Corinna Vinschen  <corinna@vinschen.de>
2180
2181         * autoload.cc (FindFirstVolumeA): Add.
2182         (FindNextVolumeA): Add.
2183         (FindVolumeClose): Add.
2184         (GetVolumePathNamesForVolumeNameA): Add.
2185         * fhandler.h (class fhandler_base): Declare new method fsync.
2186         * fhandler.cc (fhandler_base::fsync): New method.
2187         * syscalls.cc (fsync): Move functionality into fhandler method fsync.
2188         Just call this method from here.
2189         (sync_worker): New static function.
2190         (sync): Fill with life for NT systems.
2191         * wincap.h (wincaps::has_guid_volumes): New element.
2192         * wincap.cc: Implement above element throughout.
2193
2194 2005-02-20  Corinna Vinschen  <corinna@vinschen.de>
2195
2196         * fhandler.h (enum query_state): Add query_write_attributes state.
2197         (fhandler_base::status.query_open): Add a bit to make room for more
2198         states.
2199         (class fhandler_base): Declare new method utimes.
2200         (class fhandler_socket): Ditto.
2201         (class fhandler_disk_file): Ditto.
2202         (fhandler_disk_file::fhandler_disk_file): Add constructor with
2203         path_conv parameter.
2204         * fhandler.cc (fhandler_base::open): Add query_write_attributes
2205         handling.
2206         (fhandler_base::utimes): New method.
2207         * fhandler_disk_file.cc (fhandler_disk_file::link): Simplify.
2208         Open file with query_write_attributes instead of query_write_control.
2209         (fhandler_disk_file::utimes): New method.
2210         (fhandler_disk_file::fhandler_disk_file): Add constructor with
2211         path_conv parameter setting pc member immediately.
2212         * fhandler_socket.cc (fhandler_socket::fchmod): Use new
2213         fhandler_disk_file constructor.
2214         (fhandler_socket::fchown): Ditto.
2215         (fhandler_socket::facl): Ditto.
2216         (fhandler_socket::link): Ditto.
2217         (fhandler_socket::utimes): New method.
2218         * times.cc: Include dtable.h.
2219         (timeval_to_filetime): Make non-static.
2220         (utimes): Move functionality into fhandler method utimes. Just call
2221         this method from here.
2222         * winsup.h: Simplify declarations of time helper functions.
2223         (timeval_to_filetime): Add extern declaration.
2224
2225 2005-02-19  Corinna Vinschen  <corinna@vinschen.de>
2226
2227         * fhandler.h (class fhandler_base): Declare new method link.
2228         (class fhandler_socket): Ditto.
2229         (class fhandler_disk_file): Ditto.
2230         * fhandler.cc (fhandler_base::open): Add FILE_WRITE_ATTRIBUTES
2231         to query_write_control access flags.
2232         (fhandler_base::link): New method.
2233         * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Don't try to
2234         open with O_WRONLY since query_write_control includes
2235         FILE_WRITE_ATTRIBUTES.
2236         (fhandler_disk_file::fchown): Ditto.
2237         (fhandler_disk_file::facl): Ditto.
2238         (fhandler_disk_file::link): New method.  Touch st_ctime on successful
2239         link.
2240         * fhandler_socket.cc (fhandler_socket::link): New method.
2241         * syscalls.cc (link): Move functionality into fhandler method link.
2242         Just call this method from here.
2243
2244 2005-02-19  Corinna Vinschen  <corinna@vinschen.de>
2245
2246         * fhandler.h (class fhandler_socket): Declare new methods fchown,
2247         fchmod and facl.
2248         * fhandler_socket.cc (fhandler_socket::fstat): Handle AF_LOCAL
2249         sockets.
2250         (fhandler_socket::fchmod): New method.
2251         (fhandler_socket::fchown): New method.
2252         (fhandler_socket::facl): New method.
2253
2254 2005-02-19  Corinna Vinschen  <corinna@vinschen.de>
2255
2256         * localtime.cc: Temporary implementation of setting __tzrule's offset
2257         member to be used by strftime.
2258         (__tzrule): New global variable.
2259         (tzparse): Set __tzrule's offset member appropriately.
2260
2261 2005-02-17  Christopher Faylor  <cgf@timesys.com>
2262
2263         * path.cc (path_conv::check): Set fs flag when a unix-domain socket
2264         is detected.
2265
2266 2005-02-17  Corinna Vinschen  <corinna@vinschen.de>
2267
2268         * fhandler_disk_file.cc (fhandler_disk_file::fstat): Set st_ctime if
2269         has_changed flag is set.
2270         (fhandler_disk_file::touch_ctime): Reset has_changed flag on success.
2271
2272 2005-02-17  Corinna Vinschen  <corinna@vinschen.de>
2273
2274         * times.cc (utimes): Open files with FILE_WRITE_ATTRIBUTES first,
2275         if that fails, try opeing with GENERIC_WRITE.  Fix comments.
2276
2277 2005-02-15  Christopher Faylor  <cgf@timesys.com>
2278
2279         * path.h (path_conv::issocket): Return true if device == FH_UNIX rather
2280         than expecting path_conv to set a flag.
2281
2282 2005-02-11  Corinna Vinschen  <corinna@vinschen.de>
2283
2284         * fhandler.cc (fhandler_base::raw_write): Mark as changed on
2285         successful write.
2286         * fhandler.h (fhandler_base::status_flags): Add 'has_changed' flag.
2287         * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Call
2288         fhandler_disk_file's own open and close instead of open_fs and
2289         close_fs.  Mark as changed on success.
2290         (fhandler_disk_file::fchown): Ditto.
2291         (fhandler_disk_file::facl): Ditto.
2292         (fhandler_disk_file::ftruncate): Ditto.
2293         (fhandler_base::open_fs): Mark as changed when O_TRUNC flag on existing
2294         file is set.
2295         (fhandler_disk_file::close): Set st_ctime if has_changed flag is set.
2296
2297 2005-02-11  Christopher Faylor  <cgf@timesys.com>
2298
2299         * cygthread.cc (cygthread::release): Reset ev here if it exists.
2300         (cygthread::terminate_thread): Eliminate racy code which reset ev and
2301         thread_sync.  Remove a few nonsensical inuse checks.  Exit at the
2302         bottom.
2303         (cygthread::detach): Rewrite to again try to ensure that we don't say
2304         we're signalled when we are not signalled.
2305         * fhandler.cc (fhandler_base::raw_read): Revert to signalling read
2306         success quickly.
2307         * pipe.cc (fhandler_pipe::close): Use base method to close handle.
2308         * sigproc.h (WAIT_SIG_PRIORITY): Just trundle along at normal priority
2309         to allow the pipe thread to do its thing if possible.
2310
2311         * pinfo.h (pinfo::zap_cwd): Declare new function.
2312         (pinfo::zap_cwd): Move 'cd out of the way code' here.
2313         (pinfo::exit): Use it here.
2314         * spawn.cc (spawn_guts): And here.
2315
2316 2005-02-11  Corinna Vinschen  <corinna@vinschen.de>
2317
2318         * times.cc (utimes): Open files with GENERIC_WRITE on file systems
2319         not supporting ACLs.
2320
2321 2005-02-09  Corinna Vinschen  <corinna@vinschen.de>
2322
2323         * fhandler_disk_file.cc (fhandler_disk_file::ftruncate): Fix checking
2324         lseek return code.
2325
2326 2005-02-08  Corinna Vinschen  <corinna@vinschen.de>
2327
2328         * times.cc (timeval_to_filetime): Define first parameter const.
2329         (utimes): Define second parameter to const according to SUSv3.
2330         (utime): Ditto.
2331         * include/sys/utime.h (utime) : Change declaration accordingly.
2332
2333 2005-02-08  Corinna Vinschen  <corinna@vinschen.de>
2334
2335         * cygthread.cc (cygthread::detach): Just test thread handle after
2336         signal arrived, don't wait infinitely for it.
2337
2338 2005-02-08  Christopher Faylor  <cgf@timesys.com>
2339
2340         * pipe.cc (fhandler_pipe::read): Remove hold over from old read_state
2341         implementation.
2342
2343 2005-02-06  Yitzchak Scott-Thoennes <sthoenna@efn.org>
2344
2345         * net.cc (cygwin_gethostbyname): Be more picky about what's a numeric
2346         address string, and use tls in that case too.
2347
2348 2005-02-07  Christopher Faylor  <cgf@timesys.com>
2349
2350         * exceptions.cc: Make windows_system_directory non-static.
2351         * pinfo.cc (pinfo::exit): Change innocuous cd'ed location to one that
2352         is more likely to exist.
2353
2354 2005-02-06  Corinna Vinschen  <corinna@vinschen.de>
2355
2356         * path.cc (path_conv::check): Leave symlink expansion loop in case
2357         a not-ENOENT error happens.
2358
2359         * cygheap.h (cygheap_fdmanip::fhandler_pipe *): New cast operator.
2360         * pinfo.cc (_pinfo::commune_recv): Add PICOM_PIPE_FHANDLER handling.
2361         (_pinfo::commune_send): Ditto.
2362         (_pinfo::pipe_fhandler): New method.
2363         * pinfo.h (enum picom): Add PICOM_PIPE_FHANDLER.
2364         (_pinfo::pipe_fhandler): Declare.
2365         * pipe.cc (fhandler_pipe::open): Rewrite.  Allow to open foreign
2366         pipe handles.
2367
2368 2005-02-03  Christopher Faylor  <cgf@timesys.com>
2369
2370         * cygthread.h (cygthread::terminate_thread): Reflect return value.
2371         * cygthread.cc (cygthread::detach): Be more careful about ensuring that
2372         sigwait is properly waited for to avoid later missynchronization.
2373         (cygthread::terminate_thread): Return true if thread was actually
2374         terminated and all handles were closed.
2375         * fhandler_base.cc (fhandler_base::raw_read): Use signal_read_state
2376         rather than raw calls to win32 api.
2377         (fhandler_base::read): Ditto.
2378         * fhandler.h (fhandler_pipe::fixup_after_exec): Use method to create
2379         read_state signalling.
2380         (fhandler_pipe::create): Ditto.
2381
2382         * Makefile.in: Make some more files -fomit-frame-pointer.
2383
2384 2005-02-02  Corinna Vinschen  <corinna@vinschen.de>
2385
2386         * fhandler.h (fhandler_base::ftruncate): Define new virtual method.
2387         (fhandler_disk_file::ftruncate): Ditto.
2388         * fhandler.cc (fhandler_base::ftruncate): New method.
2389         * fhandler_disk_file.cc (fhandler_disk_file::ftruncate): Ditto.
2390         * syscalls.cc (ftruncate64): Move functionality into fhandlers.
2391         Call fhandler method from here.
2392
2393 2005-02-02  Corinna Vinschen  <corinna@vinschen.de>
2394
2395         * pipe.cc (fhandler_pipe::dup): Fix conditionals in case of error.
2396
2397 2005-02-02  Corinna Vinschen  <corinna@vinschen.de>
2398
2399         * times.cc (utimes): Mark st_ctime for update according to SUSv3.
2400
2401 2005-02-01  Christopher Faylor  <cgf@timesys.com>
2402
2403         * fhandler_proc.cc (format_proc_partitions): Remove PartitionType check
2404         since it could skip over partitions that are actually interesting.
2405
2406 2005-02-01  Christopher Faylor  <cgf@timesys.com>
2407
2408         * cygthread.cc (cygthread::terminate_thread): Wait briefly for
2409         notification event in the event that the thread was actually in the
2410         process of exiting.
2411
2412         * pipe.cc (fhandler_pipe::dup): read_state is not supposed to be
2413         inheritable.  Fix that.
2414
2415         * path.cc (path_conv::check): Set symlen = 0 to avoid a compiler
2416         warning.
2417
2418         * devices.h (devices::parsedisk): Declare new function.
2419         * devices.in (devices::parsedisk): Define new function.
2420         * dtable.cc (dtable::init_std_file_from_handle): Use device numbers
2421         rather than name.
2422         * fhandler_proc.cc (format_proc_partitions): Use parsedisk to generate
2423         disk names from numeric codes.  (This was broken on two of my
2424         systems previously and is still broken now)
2425
2426 2005-02-01  Corinna Vinschen  <corinna@vinschen.de>
2427
2428         * pipe.cc (fhandler_pipe::open):  Allow re-opening of /proc/<pid>/fd
2429         pipes of the current process.
2430
2431 2005-02-01  Corinna Vinschen  <corinna@vinschen.de>
2432
2433         * fhandler.cc (fhandler_base::get_proc_fd_name): Don't generate
2434         "device:" entry.
2435         * fhandler.h (fhandler_socket::open): New method.
2436         (fhandler_pipe::open): New method.
2437         * fhandler_proc.cc (fhandler_proc::exists): Return -2 in case of
2438         /proc/self.
2439         * fhandler_process.cc (fhandler_process::exists): Return -2 in
2440         case of symlinks, -3 for pipes and -4 for sockets.
2441         (fhandler_process::fstat): Handle pipes and sockets.
2442         (fhandler_process::open): Handle opening /proc/<pid>/fd.
2443         (fhandler_process::fill_filebuf): Generate empty names for
2444         non exisiting file descriptors.
2445         * fhandler_socket.cc (fhandler_socket::get_proc_fd_name): Always
2446         generate "socket:[number]" strings as on Linux.
2447         (fhandler_socket::open): New method.
2448         (fhandler_socket::fstat): Always return socket type.
2449         * path.cc (symlink_info::set): Remove unused second parameter.
2450         (path_conv::check): Handle pipes and sockets in /proc.
2451         Set correct device type for AF_LOCAL sockets.
2452         * pinfo.cc (_pinfo::commune_recv): Generate empty names for
2453         non exisiting file descriptors.
2454         (_pinfo::fd): Ditto.
2455         * pipe.cc (fhandler_pipe::open): New method.
2456
2457 2005-01-31  Christopher Faylor  <cgf@timesys.com>
2458
2459         * path.h (path_conv::set_name): Declare new function.
2460         * path.cc (path_conv::set_name): Define new function.
2461         * fhandler.h (fhandler_dev_null::open): Declare new function.
2462         * fhandler.cc (fhandler_dev_null::open): Define new function.
2463
2464 2005-01-31  Christopher Faylor  <cgf@timesys.com>
2465
2466         * smallprint.c (rnarg): Use long rather than unsigned long so that we
2467         get proper sign extension.
2468
2469 2005-01-31  Corinna Vinschen  <corinna@vinschen.de>
2470
2471         * environ.cc (set_traverse): New function.
2472         (parse_thing): Add "traverse" option.  Sort options alphabetically.
2473         (environ_init): On NT, switch on traverse checking by default.
2474
2475 2005-01-31  Christopher Faylor  <cgf@timesys.com>
2476
2477         * smallprint.c (__rn): Regparmize.
2478
2479 2005-01-31  Christopher Faylor  <cgf@timesys.com>
2480
2481         * smallprint.c (rnarg): New macro.
2482         (rnargLL): Ditto.
2483         (__rn): Rename from 'rn', add a mask argument, and use the mask
2484         argument to control how many significant digits to care about.
2485         (__small_vsprintf): Use __rn, rnarg, rnargLL, as appropriate.
2486
2487 2005-01-31  Christopher Faylor  <cgf@timesys.com>
2488
2489         * pinfo.cc (pinfo::exit): Only return low-order 16 bits when exiting.
2490
2491 2005-01-31  Corinna Vinschen  <corinna@vinschen.de>
2492
2493         * fhandler_process.cc (format_process_maps): Get destbuf argument by
2494         reference.  Allow resizing of destbuf as necessary.  Fix string
2495         handling.
2496
2497 2005-01-31  Corinna Vinschen  <corinna@vinschen.de>
2498
2499         * cygheap.h (class cygheap_fdenum): New class to enumerate used
2500         fhandlers.
2501         * dtable.h (class dtable): Add cygheap_fdenum as friend class.
2502         * fhandler.h (fhandler_base::get_proc_fd_name): New virtual method
2503         to return a name for /proc/<pid>/fd.
2504         (fhandler_socket::get_proc_fd_name): Ditto.
2505         (fhandler_pipe::get_proc_fd_name): Ditto.
2506         (fhandler_virtual::opendir): Make virtual method.
2507         (fhandler_process::opendir): New method.
2508         * fhandler.cc (fhandler_base::get_proc_fd_name): New method.
2509         * fhandler_process.cc: Include ctype.h.
2510         (PROCESS_FD): Define.
2511         (process_listing): Add "fd".
2512         (fhandler_process::exists): Fix comment.  Return 1 in case of "fd"
2513         directory. Handle files below "fd".
2514         (fhandler_process::fstat): Drop "self" handling.  Set correct link
2515         count for directories.
2516         (fhandler_process::opendir): New method to handle "fd" directory.
2517         (fhandler_process::readdir): Add "fd" handling.
2518         (fhandler_process::open): Drop "self" handling.
2519         (fhandler_process::fill_filebuf): Ditto.  Add "fd" handling.  Fix
2520         "maps" output string.
2521         * fhandler_registry.cc (fhandler_registry::fstat): Set correct link
2522         count for directories.
2523         * fhandler_socket.cc (fhandler_socket::get_proc_fd_name): New method.
2524         * path.cc (symlink_info::set): Fix thinko.
2525         * pinfo.cc (_pinfo::commune_recv): Rename pathbuf to path throughout.
2526         Drop local path variable in PICOM_FIFO case.  Fix debug output.
2527         Close handles as early as possible. Add PICOM_FDS and PICOM_FD
2528         handling.
2529         (_pinfo::commune_send): Add PICOM_FDS and PICOM_FD handling.
2530         (_pinfo::fd): New method.
2531         (_pinfo::fds): New method.
2532         * pinfo.h (enum picom): Add PICOM_FDS and PICOM_FD.
2533         (_pinfo::fd): Declare.
2534         (_pinfo::fds): Declare.
2535         * pipe.cc (fhandler_pipe::get_proc_fd_name): New method.
2536
2537 2005-01-29  Corinna Vinschen  <corinna@vinschen.de>
2538
2539         * smallprint.c (rn): Change uval to unsigned long long to fix 64 bit
2540         handling.
2541         * fhandler_process.cc (format_process_maps): Print major, minor and
2542         inode numbers correctly.
2543
2544 2005-01-29  Corinna Vinschen  <corinna@vinschen.de>
2545
2546         * autoload.cc (GetModuleFileNameExA): Add.
2547         (GetModuleInformation): Add.
2548         (QueryWorkingSet): Add.
2549         * fhandler.h (fhandler_virtual::get_filebuf): New method.
2550         * fhandler_proc.cc (PROC_SELF): Define.
2551         (proc_fhandlers): Change type of self to FH_PROC.
2552         (fhandler_proc::exists): Return -3 if self.
2553         (fhandler_proc::fstat): Handle self as symlink.
2554         (fhandler_proc::fill_filebuf): Handle self.
2555         * fhandler_process.cc: Include psapi.h.
2556         (PROCESS_EXENAME): Remove.
2557         (PROCESS_MAPS): Define.
2558         (PROCESS_ROOT): Define.
2559         (PROCESS_EXE): Define.
2560         (PROCESS_CWD): Define.
2561         (process_listing): Remove "exename", add "maps, "root", "exe" and
2562         "cwd" elements.
2563         (fhandler_process::exists): Return -2 for symlinks.
2564         (fhandler_process::fstat): Handle symlinks.
2565         (fill_filebuf): Evaluate pid if pid is 0.  Use exename handling for
2566         exe.  Handle maps, root and cwd.
2567         (format_process_maps): New function evaluating "maps".
2568         * path.cc (symlink_info::set): New method to fill symlink_info
2569         with data matching virtual symlinks.
2570         (path_conv::check): Handle virtual symlinks.
2571         * pinfo.cc (_pinfo::commune_recv): Add PICOM_CWD and PICOM_ROOT
2572         handling.
2573         (_pinfo::commune_send): Ditto.
2574         (_pinfo::root): New function.
2575         (_pinfo::cwd): New function.
2576         * pinfo.h (enum picom): Add PICOM_CWD and PICOM_ROOT.
2577         (_pinfo::root): Declare.
2578         (_pinfo::cwd): Declare.
2579
2580 2005-01-29  Christopher Faylor  <cgf@timesys.com>
2581
2582         * cygthread.cc (new): Add a little more debugging.
2583         * thread.cc (pthread_null::exit): Add a _my_tls.remove() for safety.
2584
2585 2005-01-28  Christopher Faylor  <cgf@timesys.com>
2586
2587         * cygtls.cc (cygtls::call2): Move socket cleanup.
2588         (cygtls::remove): Move socket cleanup here.  Don't use _my_tls to
2589         reference it.
2590
2591 2005-01-26  Christopher Faylor  <cgf@timesys.com>
2592
2593         * pinfo.cc (pinfo::init): Avoid a compiler warning.
2594
2595 2005-01-25  Corinna Vinschen  <corinna@vinschen.de>
2596
2597         * syscalls.cc (setpriority): Implement PRIO_PGRP, PRIO_USER and
2598         setting priority in other Cygwin processes.
2599         (getpriority): Implement PRIO_PGRP, PRIO_USER and getting nice value
2600         from other processes.
2601
2602 2005-01-26  Pierre Humblet <pierre.humblet@ieee.org>
2603
2604         * path.cc (path_conv::check): Return ENOTDIR rather than ENOENT
2605         when a component is not a directory. Remove unreachable code.
2606         (digits): Delete.
2607
2608 2005-01-25  Christopher Faylor  <cgf@timesys.com>
2609
2610         * pinfo.h (pinfo::init): Make third parameter non-optional and
2611         propagate change throughout.
2612         * pinfo.cc (set_myself): Pass INVALID_HANDLE_POINTER if h is NULL.
2613         (pinfo::init): Make third parameter non-optional.  Eliminate use of
2614         PID_EXECED as an argument.  Put setting of handle back inside loop but
2615         reorganize to try to open it only when necessary.
2616
2617 2005-01-25  Corinna Vinschen  <corinna@vinschen.de>
2618
2619         * cygwin.din: Export getpriority and setpriority.
2620         * fork.cc (fork_parent): Copy parent's nice value into child.
2621         * spawn.cc (spawn_guts): Ditto.
2622         * miscfuncs.cc (winprio_to_nice): New function.
2623         (nice_to_winprio): Ditto.
2624         * pinfo.cc (pinfo_init): If parent is not a Cygwin process, set
2625         default nice value according to current Win32 priority class.
2626         * pinfo.h (class _pinfo): Add nice member.
2627         * syscalls.cc (setpriority): New function, only implementing
2628         PRIO_PROCESS for now.
2629         (getpriority): Ditto.
2630         (nice): Just call setpriority.
2631         * wincap.h (wincaps::has_extended_priority_class): New element.
2632         * wincap.cc: Implement above element throughout.
2633         * winsup.h: Add prototypes for winprio_to_nice and nice_to_winprio.
2634         * include/limits.h (NZERO): New define.
2635         * include/cygwin/types.h (id_t): New datatype.
2636         * include/cygwin/version.h: Bump API minor version.
2637         * include/sys/resource.h: Add PRIO_XXX defines and prototypes for
2638         getpriority and setpriority.
2639
2640 2005-01-25  Corinna Vinschen  <corinna@vinschen.de>
2641
2642         * path.cc (realpath): Allow to expand with .exe suffix.
2643
2644 2005-01-22  Christopher Faylor  <cgf@timesys.com>
2645
2646         * spawn.cc (spawn_guts): Perform same "cd" as in pinfo::exit below to
2647         make sure that a stub process does not keep the current working
2648         directory busy after the "execed" process has exited.
2649
2650 2005-01-22  Christopher Faylor  <cgf@timesys.com>
2651
2652         * pinfo.cc (pinfo::init): Move everything but the MapViewOfFileEx out
2653         of the loop since trying multiple times to call CreateFileMapping
2654         doesn't make much sense.  Try to structure the loop a little better so
2655         that exiting with a break does the right thing.
2656         (pinfo::release): Release shared memory area if it exists and close
2657         handle if it exists.
2658
2659 2005-01-22  Christopher Faylor  <cgf@timesys.com>
2660
2661         * pinfo.cc (pinfo::maybe_set_exit_code_from_windows): Make sure that
2662         process has exited before getting an error code.
2663         (pinfo::exit): "cd" to innocuous location before exiting to make sure
2664         that process does not keep the current working directory busy while it
2665         is in the process of really exiting.
2666
2667 2005-01-18  Corinna Vinschen  <corinna@vinschen.de>
2668
2669         * autoload.cc (CoInitialize): Remove.
2670         (CoUninitialize): Remove.
2671         (CoCreateInstance): Remove.
2672         (CoTaskMemFree): Add.
2673         (SHGetDesktopFolder): Add.
2674         * path.cc (shortcut_header): Remove.
2675         (shortcut_initalized): Remove.
2676         (GUID_shortcut): New static GUID.
2677         (struct win_shortcut_hdr): New struct describing Windows shortcut
2678         header structure.
2679         (symlink_worker): Rewrite creating Windows shortcuts.  Create
2680         ITEMIDLIST if target exists.  Only write once.
2681         (cmp_shortcut_header): Use win_shortcut_hdr structure for comparison.
2682         (check_shortcut): Rewrite to read only once from file.  Allow skipping
2683         an ITIMIDLIST in the file.
2684
2685 2005-01-16  Christopher Faylor  <cgf@timesys.com>
2686
2687         * pinfo.h (maybe_set_exit_code_from_windows): Renamed from
2688         set_exit_state.
2689         * pinfo.cc (pinfo::exit): Use renamed function.
2690         (proc_waiter): Ditto.  Make a copy of input argument to avoid problems
2691         when procs array is shuffled.  Flag when copy is made so that
2692         remove_proc knows when it is safe to reshuffle.
2693         * sigproc.cc (proc_terminate): Don't flag process_state as PID_EXITED.
2694         (remove_proc): Wait for waiter to finish copying pinfo element before
2695         moving it (an actual wait should be an extremely rare event).
2696
2697 2005-01-15  Christopher Faylor  <cgf@timesys.com>
2698
2699         * init.cc (dll_entry): Remove unused extern.
2700
2701         * include/sys/cygwin.h: Remove PID_ZOMBIE.
2702         * pinfo.h: Rename EXITCODE_* defines.
2703         (pinfo::set_exit_state): Remove parameter.
2704         * pinfo.cc (set_exit_state): Remove parameter.  Reverse sense of test
2705         so that exitcode is checked for having been set rather than not having
2706         been set.  Set flag when exitcode has been established.  Don't set
2707         PID_STATE here.
2708         (pinfo::init): Remove exitcode initialization.
2709         (pinfo::exit): Reflect change in EXITCODE_* naming.  Set flag when
2710         exitcode has been established.  Reflect change in arguments to
2711         set_process_state.
2712         (proc_waiter): Reflect change in arguments to set_process_state.  Set
2713         process_state here and only here.
2714         * fhandler_process.cc (fhandler_process::fill_filebuf): Reflect removal
2715         of PID_ZOMBIE define.
2716         (format_process_stat): Ditto.
2717         (format_process_status): Ditto.
2718         * sigproc.cc (pid_exists): Ditto.
2719         (stopped_or_terminated): Ditto.  Make sure that only low-order 16 bits of
2720         exitcode are used.
2721         * spawn.cc (spawn_guts): Reflect change in EXITCODE_* naming.
2722
2723 2005-01-15  Christopher Faylor  <cgf@timesys.com>
2724
2725         * sigproc.cc (sig_send): Don't complain if attempt to send signal to
2726         myself fails after I've "execed".
2727
2728 2005-01-14  Corinna Vinschen  <corinna@vinschen.de>
2729
2730         * fhandler_disk_file.cc (fhandler_disk_file::facl): Pretend successful
2731         SETACL if no acls are available.
2732         * fhandler.cc (fhandler_base::facl): Implement to return sensible
2733         values on GETACL and GETACLCNT.  Pretend successful SETACL.
2734         * fhandler_virtual.cc (fhandler_virtual::facl): Ditto.
2735
2736 2005-01-13  Corinna Vinschen  <corinna@vinschen.de>
2737
2738         * fhandler.h (fhandler_disk_file::touch_ctime): Declare.
2739         * fhandler_disk_file.cc (fhandler_disk_file::touch_ctime): New method
2740         to set file's ctime.
2741         (fhandler_disk_file::fchmod): Try opening file for writing first.
2742         Set file's ctime on success.
2743         (fhandler_disk_file::fchown): Ditto.
2744         (fhandler_disk_file::facl): Ditto.
2745
2746 2005-01-13  Corinna Vinschen  <corinna@vinschen.de>
2747
2748         * pinfo.cc (pinfo::exit): Don't access self after releasing it.
2749         * path.h (path_conv::path_conv): Fill path with native device
2750         name in case of device argument.
2751
2752 2005-01-13  Corinna Vinschen  <corinna@vinschen.de>
2753
2754         * fhandler_serial.cc (fhandler_serial::dup): Call overlapped_setup
2755         for child, not for parent.
2756
2757 2005-01-13  Christopher Faylor  <cgf@timesys.com>
2758
2759         * init.cc (dll_entry): Nuke attempt to set exit code since parent will
2760         use windows exit code if needed.
2761         * pinfo.cc (pinfo::exit): Move release() here to minimize pid creation
2762         race (suggested by Pierre Humblet).
2763
2764 2005-01-12  Christopher Faylor  <cgf@timesys.com>
2765
2766         Reorganize header file inclusion throughout so that cygerrno.h comes
2767         first.
2768         * fhandler.h (select_record::thread_errno): Save any encountered errno
2769         here.
2770         (select_record::set_select_errno): New function.
2771         (select_record::saw_error): New function.
2772         (select_record::select_record): Initialize thread_errno to zero.
2773         * select.cc (set_handle_or_return_if_not_open): Set thread_errno on
2774         failure.
2775         (select_stuff::wait): Record errno for later resurrection in calling
2776         thread.
2777         (peek_serial): Ditto.
2778
2779 2005-01-12  Christopher Faylor  <cgf@timesys.com>
2780
2781         * syscalls.cc (system): Use "/bin/sh" as per linux and (sorta) SUSv3.
2782
2783 2005-01-12  Christopher Faylor  <cgf@timesys.com>
2784
2785         * pinfo.cc (pinfo::exit): Don't assume that this == myself.
2786
2787 2005-01-11  Christopher Faylor  <cgf@timesys.com>
2788
2789         * pinfo.cc (pinfo::init): Don't close input handle on temporary (?)
2790         failure.
2791
2792 2005-01-11  Christopher Faylor  <cgf@timesys.com>
2793
2794         * pinfo.h (_pinfo::set_exit_state): Declare new function.
2795         (pinfo::exit): Move here from _pinfo::exit.
2796         * sigproc.cc (child_info::sync): Use new function to set exitcode and
2797         process_state.
2798         * pinfo.cc (_pinfo::exit): Ditto.
2799         (proc_waiter): Ditto.
2800         (_pinfo::set_exit_state): Define new function.
2801         (_pinfo::dup_proc_pipe): Close handle when there is no parent process
2802         around to care about the exit value.
2803         * dcrt0.cc (dll_crt0_0): Move subproc_ready synchronization later to
2804         make sure that myself is still mapped in parent.
2805         (do_exit): Reflect movement to pinfo::exit.
2806         (__api_fatal): Ditto.
2807         * exceptions.cc (signal_exit): Ditto.
2808         * errno.cc (errmap): Map PROC_NOT_FOUND.
2809         * init.cc (dll_entry): Release myself before exiting.
2810         * sigproc.cc (proc_can_be_signalled): Set errno appropriately.
2811         (sig_send): Ditto.  Also remove ill-advised test for !myself->sendsig
2812         since this is an indication of a process which is still initializating
2813         -- it is not an error.
2814         (child_info::sync): Don't set exitcode here.  Assume that will happen
2815         in proc_waiter, if necessary.
2816         * spawn.cc (spawn_guts): Delay "wait_for_myself" logic until later.
2817         Don't wait at all if the process has already exited.  Reflect movement
2818         to pinfo::exit.
2819
2820 2005-01-11  Corinna Vinschen  <corinna@vinschen.de>
2821
2822         * environ.cc (build_env): Disallow empty strings and strings starting
2823         with '=' in Win32 environment.
2824
2825 2005-01-08  Pierre Humblet <pierre.humblet@ieee.org>
2826
2827         * syscalls.cc (seteuid32): Only change the default dacl when
2828         seteuid succeeds. Do not close HKCU.
2829
2830 2005-01-06  Corinna Vinschen  <corinna@vinschen.de>
2831
2832         * fhandler_process.cc: Use strcasematch instead of strcasecmp
2833         throughout.
2834
2835 2005-01-06  Corinna Vinschen  <corinna@vinschen.de>
2836
2837         * syscalls.cc (rename): Fix behaviour in case of renaming directories
2838         according to SUSv3.
2839
2840 2005-01-06  Corinna Vinschen  <corinna@vinschen.de>
2841
2842         * fhandler_disk_file.cc (fhandler_base::open_fs): Don't allow
2843         opening directories for writing.
2844
2845 2005-01-06  Christopher Faylor  <cgf@timesys.com>
2846
2847         * timer.cc (timer_thread): Pass sigev pointer value as per SuSv3 rather
2848         than pointer to sigev.
2849
2850 2005-01-05  Christopher Faylor  <cgf@timesys.com>
2851
2852         * dcrt0.cc (multiple_cygwin_problem): Reorganize error message to not
2853         always talk about a "version" when it's not a version.
2854         (dll_crt0_0): Change info passed to multiple_cygwin_problem to be a
2855         little more precise.
2856         * shared.cc (user_shared_initialize): Ditto.
2857         (shared_info::initialize): Ditto.
2858
2859 2005-01-03  Christopher Faylor  <cgf@timesys.com>
2860
2861         * pinfo.cc (_pinfo::dup_proc_pipe): Can't close proc pipe when execing
2862         or we will suffer an exit code race.
2863
2864 2005-01-03  Corinna Vinschen  <corinna@vinschen.de>
2865
2866         * signal.cc (abort): Call _GLOBAL_REENT's __cleanup.
2867
2868 2005-01-03  Corinna Vinschen  <corinna@vinschen.de>
2869
2870         * syscalls.cc (setmode): Call _fwalk with _GLOBAL_REENT.
2871
2872 2005-01-01  Christopher Faylor  <cgf@timesys.com>
2873
2874         * cygthread.cc (cygthread::stub): Set inuse to false when exiting.
2875         (cygthread::cygthread): Actually pass name as argument to debugging
2876         output to avoid SEGV when strace'ing.
2877         (cygthread::release): Don't set stack_ptr to NULL, since it is only set
2878         once on first entry to a stub not on each stub iteration.
2879         (cygthead::exit_thread): Remove obsolete function.
2880         * cygthread.h (cygthread::exit_thread): Ditto.
2881
2882 2005-01-01  Christopher Faylor  <cgf@timesys.com>
2883
2884         * shared.cc (open_shared): Don't attempt VirtualAlloc magic if first
2885         attempt to map memory fails.