Commit Graph

5114 Commits

Author SHA1 Message Date
Corinna Vinschen e020bfa85b * nlsfuncs.cc (wcsxfrm): Call LCMapStringW with LCMAP_BYTEREV flag to
allow correct comparison using wcscmp.
2010-01-23 10:11:43 +00:00
Corinna Vinschen bc9fcc287d * posix.sgml (strfmon): Move to implemented SUSv4 API. 2010-01-22 22:33:22 +00:00
Corinna Vinschen 326fb376dd * Makefile.in (DLL_OFILES): Add nlsfunc.o and strfmon.o.
* autoload.cc (LocaleNameToLCID): Define.
	* cygwin.din (strfmon): Export.
	* nlsfuncs.cc: New file.  Define a lot of internal functions called
	from setlocale.
	(wcscoll): Implement locale-aware here, using CompareStringW function.
	(strcoll): Ditto.
	(wcsxfrm): Implement locale-aware here, usingLCMapStringW function.
	(strxfrm): Ditto.
	(__set_charset_from_locale): Replace __set_charset_from_codepage.
	Return Linux-compatible charset.
	* strfuncs.cc (__set_charset_from_codepage): Remove.
	* wchar.h (__set_charset_from_codepage): Drop definition.
	* wincap.h (wincaps::has_localenames): New element.
	* wincap.cc: Implement above element throughout.
	* libc/strfmon.c: New file.
	* libc/strptime.cc: Remove locale constant strings in favor of
	access to locale-specifc data.
	(strptime): Point _CurrentTimeLocale to locale-specific data.
	Throughout use correct locale-specific format fields for all
	locale-specific formats.
	* include/monetary.h: New file.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2010-01-22 22:31:31 +00:00
Corinna Vinschen 43b4aa0f7c * strfuncs.cc: Remove needless includes. 2010-01-18 16:07:22 +00:00
Corinna Vinschen 62910474ac * syscalls.cc (internal_setlocale): Use UTF-8 internally if external
charset is ASCII.
2010-01-17 09:41:01 +00:00
Corinna Vinschen 011560c87d * libc/fnmatch.c: Replace with multibyte capable version from FreeBSD. 2010-01-16 15:11:56 +00:00
Corinna Vinschen 1a8d1e1040 * fhandler_socket.cc (fhandler_socket::accept4): Reset async flag
on accepted socket.
2010-01-16 10:22:58 +00:00
Corinna Vinschen 9d5bf1b13c * fhandler_socket.cc (fhandler_socket::accept4): Set nonblocking
flag exactly according to flags, as on Linux.
	* net.cc (cygwin_accept): Maintain BSD semantics here.
2010-01-15 21:34:27 +00:00
Corinna Vinschen 0d6531551b * cygwin.din (accept4): Export.
* fhandler.h (fhandler_socket::accept4): Rename from accept.  Take
	additional flag parameter.
	* fhandler_socket.cc (fhandler_socket::accept4): Ditto.  Handle
	SOCK_NONBLOCK and SOCK_CLOEXEC flags.
	* net.cc (cygwin_socket): Handle SOCK_NONBLOCK and SOCK_CLOEXEC flags
	in type.  Check for invalid flag values.
	(socketpair): Ditto.
	(cygwin_accept): Accommodate renaming of fhandler_socket::accept
	function to accept4.
	(accept4): New function.
	* posix.sgml: Mention accept4 as GNU extensions.
	* include/cygwin/socket.h (SOCK_NONBLOCK): Define.
	(SOCK_CLOEXEC): Define.
	(_SOCK_FLAG_MASK): Define when building Cygwin.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
	* include/sys/socket.h (accept4): Declare.
2010-01-15 15:40:05 +00:00
Corinna Vinschen 14c800a5ba * posix.sgml: Mention dup3 and pipe2 as GNU extensions. 2010-01-15 14:22:42 +00:00
Corinna Vinschen 41d184bb62 * dcrt0.cc (dll_crt0_1): Reset locale to "C" at the last moment before
calling the application's main.
	* syscalls.cc (internal_setlocale): Don't reset locale to "C here.
	Change comment accordingly.
2010-01-14 18:56:24 +00:00
Corinna Vinschen e70fdfb99f * cygwin.din (dup3): Export.
(pipe2): Export.
	* dtable.cc (dtable::dup_worker): Take additional flags parameter.
	Handle O_CLOEXEC flag.
	(dtable::dup3): Rename from dup2.  Take additional flags parameter.
	Check for valid flags.  Drop check for newfd == oldfd.
	* dtable.h (dtable::dup_worker): Add flags parameter.
	(dtable::dup3): Rename from dup2.
	* fcntl.cc (fcntl64): Add F_DUPFD_CLOEXEC case.
	* fhandler.h (fhandler_mailslot::get_object_attr): Add flags parameter.
	* fhandler.cc (fhandler_base::open): Use security attribute with
	inheritance according to setting of O_CLOEXEC flag.
	* fhandler_console.cc (fhandler_console::open): Ditto.
	* fhandler_fifo.cc (sec_user_cloexec): New inline function to
	create security attribute with inheritance according to setting of
	O_CLOEXEC flag.
	(fhandler_fifo::open): Call sec_user_cloexec to fetch security
	attribute.
	(fhandler_fifo::wait): Ditto.
	* fhandler_mem.cc (fhandler_dev_mem::open): Ditto.
	* fhandler_mailslot.cc (fhandler_mailslot::get_object_attr): Take
	additional flags parameter.  Use security attribute with inheritance
	according to setting of O_CLOEXEC flag.
	(fhandler_mailslot::open): Call get_object_attr with flags parameter.
	* fhandler_registry.cc (fhandler_registry::open): Call set_close_on_exec
	on real handles to accommodate O_CLOEXEC flag.
	* fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
	* fhandler_tape.cc: Create mutex with inheritance according to setting
	of O_CLOEXEC flag.
	* pipe.cc: Replace usage of O_NOINHERIT with O_CLOEXEC.
	 (fhandler_pipe::init): Simplify setting close_on_exec flag.
	(fhandler_pipe::open): Remove setting close_on_exec flag.
	(fhandler_pipe::create): Use security attribute with inheritance
	according to setting of O_CLOEXEC flag.
	(pipe2): New exported function.
	* posix_ipc.cc: Throughout, open backing files with O_CLOEXEC
	flag to follow POSIX semantics.
	* security.h (sec_none_cloexec): New define.
	* syscalls.cc (dup): Add missing extern "C" qualifier.  Accommodate
	renaming of dtable::dup2 to dtable::dup3.
	(dup2): Ditto.  Check newfd == oldfd here.
	(dup3): New function.  Check newfd == oldfd here.
	(open): Set close_on_exec flag according to O_CLOEXEC flag before
	calling fhandler->open.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2010-01-14 18:46:02 +00:00
Corinna Vinschen 811de4bff3 * include/fcntl.h (O_TTY_INIT): Define as 0. 2010-01-13 16:51:37 +00:00
Corinna Vinschen c013520152 * fhandler_tty.cc (fhandler_tty_master::init): Don't erase all default
termios settings of slave console.
2010-01-13 11:06:21 +00:00
Corinna Vinschen 4bcdec7276 * syscalls.cc (rename): Don't exit prematurely with EROFS when trying
to rename an AF_LOCAL socket or when trying to replace an AF_LOCAL
	socket.
2010-01-13 09:45:18 +00:00
Corinna Vinschen c04ed45d82 * globals.cc (ro_u_nwfs): New R/O unicode string.
* mount.cc (fs_info::update): Check for NWFS filesystem.  Set
	has_buggy_basic_info, if so.  Add comment to explain why.
	(fillout_mntent): Add "nwfs" string to fs_names array.
	* mount.h (enum fs_info_type): Add nwfs.
	(class fs_info): Add has_buggy_basic_info status flag.  Add accessors
	for has_buggy_basic_info and is_nwfs.
	* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Accommodate
	filesystems with broken FileBasicInformation handling.
	* path.cc (symlink_info::check): Ditto.
	* path.h (path_conv::has_buggy_basic_info): Add method.
2010-01-12 14:47:46 +00:00
Corinna Vinschen 4ee93264fd * dtable.cc (build_fh_name_worker): Remove. Move all functionality
back into build_fh_name.
	(build_fh_name): Drop unused HANDLE parameter.  Drop call to pc.fillin.
	Remove disabled build_fh_name with UNICODE_STRING name parameter.
	* dtable.h (build_fh_name): Drop HANDLE parameter from declaration.
	Remove declaration for build_fh_name with UNICODE_STRING name parameter.
	* path.cc (path_conv::fillin): Remove.
	(symlink_info::check): Fix comment.
	* path.h (path_conv::fillin): Remove declaration.
	* dir.cc: Accommodate change in build_fh_name parameters throughout.
	* sec_acl.cc: Ditto.
	* syscalls.cc: Ditto.

	* ntea.cc (getxattr_worker): Fix debug output.
	(setxattr_worker): Ditto.
	* times.cc (utimens_worker): Ditto.
2010-01-12 10:14:59 +00:00
Corinna Vinschen 523a66d91d * fhandler_proc.cc (format_proc_stat): Use new in_buf.
(format_proc_cpuinfo): Replace szBuffer with a union in_buf.  Use type
	correct throughout.  Add a couple of missing or newer cpu flags.  Allow
	certain AMD flags for intel as well.
2010-01-11 15:10:21 +00:00
Corinna Vinschen f1817d368a * fhandler.h (fhandler_base::fstat_helper): Declare timestamps as
PLARGE_INTEGER.
	* fhandler_disk_file.cc (fhandler_base::fstat_by_handle):
	Accommodate fstat_helper change of timestamp arguments.
	(fhandler_base::fstat_by_name): Ditto.
	(fhandler_base::fstat_helper): Define with timestamps as PLARGE_INTEGER.
	Accommodate in call to to_timestruc_t.
2010-01-10 11:12:52 +00:00
Corinna Vinschen 9f00d74664 * sec_auth.cc (get_token_group_sidlist): Add BUILTIN\Users account
to all created tokens.
	* sec_helper.cc (well_known_users_sid): Define as BUILTIN\Users.
	* security.h (well_known_users_sid): Declare.
2010-01-08 15:55:27 +00:00
Christopher Faylor e1212c436b * dcrt0.cc: Bump copyright.
Do the changelog shuffle.
2010-01-01 19:28:15 +00:00
Christopher Faylor 1afba8e5f2 * dcrt0.cc (dll_crt0_1): Move internal locale setting prior to potential
globify to prevent creation of unglobbed filenames in the wrong character set.
2010-01-01 19:15:11 +00:00
Corinna Vinschen 935d37f116 * fhandler.h (fhandler_socket::wait_for_events): Drop parameter default
value.
	* fhandler_socket.cc (fhandler_socket::connect): Add false as second
	parameter to wait_for_events call.
	(fhandler_socket::accept): Ditto.
	(fhandler_socket::send_internal): Fix typo in call to wait_for_events.
2009-12-28 17:24:03 +00:00
Eric Blake 1c0a4c3a8e Make pty.h match recent glibc.
* include/pty.h (openpty, forkpty): Mark last two arguments const,
to match glibc 2.8.
* libc/bsdlib.cc (openpty, forkpty): Likewise.
2009-12-26 06:20:56 +00:00
Christopher Faylor 37520977df * fhandler_console.cc (handler_console::read): Use the tty's VERASE character
as the backspace keycode.
2009-12-25 17:38:46 +00:00
Corinna Vinschen 14c622c6e3 * path.cc (symlink_info::check): Set fileattr to
FILE_ATTRIBUTE_DIRECTORY in a certain error condition.  Explain why.
2009-12-24 12:53:43 +00:00
Christopher Faylor 4c9a77261e * select.cc (fhandler_fifo::select_read): Fill in device specific record.
(fhandler_fifo::select_write): Ditto.
(fhandler_fifo::select_except): Ditto.
2009-12-23 00:35:18 +00:00
Corinna Vinschen 59cb363a5f * path.cc (cygwin_conv_path): Add band-aid including comment to avoid
conversion from POSIX "." to Win32 ".\\".
2009-12-21 16:44:37 +00:00
Corinna Vinschen 6d63272b53 * exec.cc (execvp): Call find_exec with FE_NNF flag to enforce
a NULL return when executable isn't found in $PATH.  Convert NULL
	to "".
	(execvpe): Ditto.
	* spawn.cc (spawn_guts): Return with EFAULT if prog_arg is NULL.
	Return with ENOENT if prog_arg is empty string.  Add a comment.
2009-12-21 15:16:28 +00:00
Corinna Vinschen b2d6e5dfd3 * fhandler_console.cc (get_nonascii_key): Generate ESC prefix
for Alt modifier generically for function keys and keypad keys.
	Distinguish Normal, Ctrl, Shift, Ctrl-Shift rather
	than Normal, Ctrl, Shift, Alt, so that in combination with generic
	Alt handling all 8 combinations of these modifiers are distinguished.
	(keytable): Add escape sequences for remaining modified
	function keys as a compatible extension using rxvt escape codes.
	Also distinguish keypad keys modified with Ctrl, Shift, Ctrl-Shift
	using xterm-style modifier coding.
2009-12-21 10:11:27 +00:00
Corinna Vinschen 1b71ce005c Throughout, revert ill-conceived replacement of hMainThread with
GetCurrentThread/NtCurrentThread.
	* dcrt0.cc (dll_crt0_0): Duplicate main thread handle to hMainThread
	again.
2009-12-21 09:38:25 +00:00
Corinna Vinschen 57a2873a5d * fhandler_console.cc (__vt100_conv): Minor formatting change. 2009-12-19 15:40:31 +00:00
Corinna Vinschen 8fd4bd2bf1 * fhandler_console.cc (write_console): Check for VT100
graphics mode and transform wide characters in ASCII small
	letter range to corresponding graphics.
	(__vt100_conv): Table to transform small ASCII letters to line
	drawing graphics for use in VT100 graphics mode.
	(write_normal): Check for SO/SI control characters to
	enable/disable VT100 graphics mode.
	(base_chars): Enable SO/SI control characters for detection.
	(write): Check for ESC ( 0 / ESC ( B escape sequences to
	enable/disable VT100 graphics mode. Also detect ">" while
	parsing ESC [ sequences to distinguish specific requests.
	(char_command): Distinguish Secondary from Primary Device Attribute
	request to report more details about cygwin console terminal version.
	* fhandler.h (vt100_graphics_mode_active): New flag to indicate mode.
	(saw_greater_than_sign): New parse flag for ESC [ > sequences.
	(gotparen, gotrparen): New state values to parse ESC ( / ) sequences.

	* fhandler_console.cc (read): Allow combined Alt-AltGr modifiers
	to also produce an ESC prefix like a plain Alt modifier, e.g. to make
	Alt-@ work on a keyboard where @ is AltGr-q.
2009-12-19 15:37:10 +00:00
Eric Blake d954168ddb * signal.cc (nanosleep): Fix bug in previous patch. 2009-12-19 00:58:34 +00:00
Corinna Vinschen f16706de97 Throughout, replace hMainProc with GetCurrentProcess/NtCurrentProcess
according to context.  Throughout, replace hMainThread with
	GetCurrentThread/NtCurrentThread according to context.
	* dcrt0.cc (dll_crt0_0): Drop duplication of GetCurrentProcess to
	hMainProc.  Drop duplication of GetCurrentThread to hMainThread.
	* dtable.cc (dtable::stdio_init): Remove useless comment.
	* globals.cc (hMainProc): Remove.
	(hMainThread): Remove.
	* ntdll.h (NtCurrentProcess): Define.
	(NtCurrentThread: Define.
2009-12-18 20:32:04 +00:00
Corinna Vinschen 333a47d316 * fhandler.h (fhandler_registry::value_name): Convert to wchar_t*.
* fhandler_registry.cc: Call UNICODE registry functions throughout
	and convert to multibyte using current locale's charset.  Accommodate
	throughout.
	(must_encode): Take wchar_t.
	(encode_regname): Convert from wchar_t *.
	(decode_regname): Convert to wchar_t *.
2009-12-18 17:14:21 +00:00
Corinna Vinschen ae8547442b * path.sgml (func-cygwin-conv-path): Clarify meaning of size parameter.
(func-cygwin-conv-path-list): Fix typo.
	(func-cygwin-posix-path-list-p): Ditto.
2009-12-18 10:11:56 +00:00
Corinna Vinschen 314c2d2fed * syscalls.cc (try_to_bin): Handle remote shares as well. Just rename
files in this case, instead of moving them to the recycler.  Create
	even more unique filename.  Add comment to explain filename.
	(unlink_nt): Remove code returning with EBUSY on remote shares.
	Set bin_stat to move_to_bin except on NFS.  Add comment to explain.
2009-12-17 18:33:05 +00:00
Eric Blake 214f44da10 * signal.cc (nanosleep): Support 'infinite' sleep times.
(sleep): Avoid uninitialized memory.
2009-12-17 14:04:04 +00:00
Corinna Vinschen beeae48288 * fhandler_console.cc (read): Detect and handle mouse wheel scrolling
events (for completion of mouse reporting mode 1000) and mouse
	movement events (for additional mouse reporting modes 1002 and 1003).
	Use mouse_aware() as a guard and only condition for mouse
	reporting in order to enforce consistence of read() and select().
	Add focus reports (for additional focus reporting mode 1004).
	(mouse_aware): Enable detection of additional mouse events for select().
	Tune function to precisely match actual reporting criteria.
	Move adjustment of mouse position (by window scroll offset)
	here to avoid duplicate code.
	(char_command): Initialization of enhanced mouse reporting modes.
	Initialization of focus reporting mode.
	* fhandler.h (use_mouse): Change flag (bool->int) to indicate
	additional mouse modes. Add flag to indicate focus reporting.
	(mouse_aware): Move enhanced function into fhandler_console.cc.
	* select.cc (peek_console): Use modified mouse_aware() for more
	general detection of mouse events. Also check for focus reports.
2009-12-16 14:56:10 +00:00
Corinna Vinschen d1600b38c0 * registry.cc (cygnus_class): Remove.
(reg_key::build_reg): Don't set class when creating key.
2009-12-16 13:09:46 +00:00
Corinna Vinschen 2f5d8f7bd0 * net.cc (cygwin_setsockopt): Only skip calling setsockopt(SO_REUSEADDR)
on stream sockets under systems supporting enhanced socket security.
2009-12-15 17:08:20 +00:00
Corinna Vinschen f04f6d49fa * fhandler_console.cc (char_command): Fix code to select dim mode
to 2 rather than 9.  Add entries for mode 22 (normal, not bold)
	28 (visible, not invisible), 25 (not blinking).
2009-12-15 12:46:40 +00:00
Corinna Vinschen 5d5594597e * libc/getopt.c (getopt_internal): Set optreset according to optind
setting earlier.  Reevaluate POSIXLY_CORRECT if optreset is set to !0.
	Handle a leading '-' in options independently of posixly_correct.
2009-12-14 10:47:25 +00:00
Christopher Faylor d0f9de23a1 * fhandler_fifo.cc (fhandler_fifo::open): Avoid resetting errno after it has
been explicitly set.
* include/cygwin/version.h: Bump DLL minor version number to 2.
2009-12-09 16:52:43 +00:00
Corinna Vinschen 6d67afbe9c * include/cygwin/version.h: Bump DLL minor version number to 1. 2009-12-06 12:24:34 +00:00
Corinna Vinschen 2bc3381e5c * fhandler_socket.cc (send_internal): Don't split datagram messages
into pieces.

	* syslog.cc (vsyslog): Set default facility to LOG_USER if it hasn't
	been set yet.
2009-12-02 15:23:03 +00:00
Corinna Vinschen b4a3a3e367 * fhandler_registry.cc (fhandler_registry::open): Mark /proc/registry
directory and siblings as nohandle fhandler.
2009-12-01 16:31:04 +00:00
Christopher Faylor c84fd8fe23 * speclib: Use last dll found since that's the real name of the cygwin DLL. 2009-11-30 15:40:23 +00:00
Corinna Vinschen 667d9ad130 * fhandler_disk_file.cc (fhandler_base::fstat_helper): Fix typos in
comments.  Always open file synchronized when reading header bytes,
	otherwise suffer stack corruption.
2009-11-27 14:27:22 +00:00