Corinna Vinschen [Sat, 23 Jan 2010 16:43:17 +0000 (16:43 +0000)]
* strfuncs.cc (__sjis_wctomb): Special handling for characters which
differ between SJIS and Windows codepage 932, if charset is "SJIS".
(__sjis_mbtowc): Ditto.
(_jis_wctomb): Remove.
(__jis_mbtowc): Remove.
Corinna Vinschen [Fri, 22 Jan 2010 22:32:42 +0000 (22:32 +0000)]
* new-features.sgml (ov-new1.7.2): Add chapter for news in 1.7.2.
* setup2.sgml (setup-locale-ov): Describe how valid locales are
determined by Windows locale support. Change description for modifiers
in locale environment variables.
(setup-locale-how): Describe new charset behaviour. Mention new
getlocale tool to fetch valid locale information from Windows.
(setup-locale-missing): Drop now implemented LC_foo options.
Explain missing LC_MESSAGES in more detail.
Corinna Vinschen [Fri, 22 Jan 2010 22:31:31 +0000 (22:31 +0000)]
* 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.
Corinna Vinschen [Fri, 22 Jan 2010 13:03:42 +0000 (13:03 +0000)]
* libc/locale/lmonetary.c (__monetary_load_locale): Take additional
parameters for wide char to multibyte conversion. Call
__set_lc_monetary_from_win on Cygwin.
* libc/locale/lmonetary.h: Make C++-safe.
(__monetary_load_locale): Change declaration.
* libc/locale/lnumeric.c (__numeric_load_locale): Take additional
parameters for wide char to multibyte conversion. Call
__set_lc_numeric_from_win on Cygwin.
* libc/locale/lnumeric.h: Make C++-safe.
(__numeric_load_locale): Change declaration.
* libc/locale/locale.c (lconv): De-constify for Cygwin.
(__set_charset_from_locale): Rename from
__set_charset_from_codepage. Take locale as parameter instead of
a codepage.
(loadlocale): Allow "EUC-JP" for "EUCJP" and "EUC-KR" for "EUCKR".
Change documnetation accordingly. Enable LC_COLLATE, LC_MONETARY,
LC_NUMERIC, and LC_TIME handling on Cygwin.
(_localeconv_r): On Cygwin, copy values from monetary and numeric
domain if change has been noted.
* libc/locale/nl_langinfo.c (nl_langinfo): Accommodate change of
am/pm layout in struct lc_time_T.
* libc/locale/timelocal.c (_C_time_locale): Accommodate
redefinition of am/pm members.
(__time_load_locale): Take additional parameters for wide char
to multibyte conversion. Call __set_lc_time_from_win on Cygwin.
* libc/locale/timelocal.h: Make C++-safe.
(struct lc_time_T): Convert am and pm to a am_pm array for easier
consumption by strftime and strptime.
(__time_load_locale): Change declaration.
* libc/time/strftime.c: Change documentation to reflect changes to
strftime. Remove locale constant strings in favor of access to
locale-specifc data.
(_ctloc): Define access method for locale-specifc data.
(TOLOWER): Define for tolower conversion.
(strftime): Throughout, convert locale-specific formats to use
locale-specific data. Add GNU-specific "%P" format.
* libc/time/strptime.c: Remove locale constant strings in favor of
access to locale-specifc data.
(_ctloc): Define access method for locale-specifc data.
(strptime): Throughout, convert locale-specific formats to use
locale-specific data.
Corinna Vinschen [Sat, 16 Jan 2010 10:25:58 +0000 (10:25 +0000)]
* cygpath.cc (get_mixed_name): Drop function. Replace with call to
convert_slashes throughout.
(do_sysfolders): Free allocated buffer.
(do_pathconv): Fix freeing last buffer.
Corinna Vinschen [Fri, 15 Jan 2010 21:34:27 +0000 (21:34 +0000)]
* fhandler_socket.cc (fhandler_socket::accept4): Set nonblocking
flag exactly according to flags, as on Linux.
* net.cc (cygwin_accept): Maintain BSD semantics here.
Corinna Vinschen [Fri, 15 Jan 2010 15:40:05 +0000 (15:40 +0000)]
* 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.
Corinna Vinschen [Thu, 14 Jan 2010 18:56:24 +0000 (18:56 +0000)]
* 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.
Corinna Vinschen [Thu, 14 Jan 2010 18:46:02 +0000 (18:46 +0000)]
* 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.
Corinna Vinschen [Tue, 12 Jan 2010 10:14:59 +0000 (10:14 +0000)]
* 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.
Corinna Vinschen [Mon, 11 Jan 2010 15:10:21 +0000 (15:10 +0000)]
* 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.
Corinna Vinschen [Sun, 10 Jan 2010 11:12:52 +0000 (11:12 +0000)]
* 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.
* 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.
Ralf Wildenhues [Thu, 7 Jan 2010 20:00:52 +0000 (20:00 +0000)]
Sync from GCC: Makefile.tpl (BASE_TARGET_EXPORTS) fix
/:
PR bootstrap/41818
* Makefile.tpl (BASE_TARGET_EXPORTS): Only add TARGET_LIB_PATH
to $(RPATH_ENVVAR) if bootstrapping. Fix typo in comment.
* Makefile.in: Regenerate.
* cygpath.cc (main): Remove enforcing "en_US.UTF-8" locale.
Revert usage of argz functions when reading input from file and
simplify option usage. Allow only one option argument and use
the rest as filename argument to allow spaces in filenames. Restrict
processing special folder type options to one line.
* dcrt0.cc (dll_crt0_1): Move internal locale setting prior to potential
globify to prevent creation of unglobbed filenames in the wrong character set.
Corinna Vinschen [Mon, 28 Dec 2009 17:24:03 +0000 (17:24 +0000)]
* 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.
Corinna Vinschen [Mon, 21 Dec 2009 15:16:28 +0000 (15:16 +0000)]
* 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.
Corinna Vinschen [Mon, 21 Dec 2009 10:11:27 +0000 (10:11 +0000)]
* 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.
Corinna Vinschen [Mon, 21 Dec 2009 09:38:25 +0000 (09:38 +0000)]
Throughout, revert ill-conceived replacement of hMainThread with
GetCurrentThread/NtCurrentThread.
* dcrt0.cc (dll_crt0_0): Duplicate main thread handle to hMainThread
again.
Corinna Vinschen [Sat, 19 Dec 2009 15:37:10 +0000 (15:37 +0000)]
* 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.
Corinna Vinschen [Fri, 18 Dec 2009 20:32:04 +0000 (20:32 +0000)]
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.
Corinna Vinschen [Fri, 18 Dec 2009 17:14:21 +0000 (17:14 +0000)]
* 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 *.
Jeff Johnston [Thu, 17 Dec 2009 20:04:43 +0000 (20:04 +0000)]
2009-12-17 Jerker Back <jerker.back@gmail.com>
* libc/iconv/lib/local.h[!__GNUC__]: Add alternative version of
ICONV_ZERO_MB_STATE_T macro.
* libc/iconv/lib/ucsconv.c (ucs_based_conversion_get_state): Use
temporary local variable nullstate to hold empty mbstate_t.
Jeff Johnston [Thu, 17 Dec 2009 19:43:43 +0000 (19:43 +0000)]
2009-12-17 Jerker Back <jerker.back@gmail.com>
* libc/include/_ansi.h: Add new _EXFNPTR macro for using with
function pointer arguments.
* libc/iconv/lib/conv.h: Use _EXFNPTR rather than _EXPARM macro.
* libc/iconv/lib/ucsconv.h: Ditto.
* libc/include/stdlib.h: Use new _EXFNPTR macro for function pointers.
* libc/include/sys/reent.h: Ditto.
* libc/include/sys/unistd.h: Ditto.
* libc/search/bsearch.c: Ditto.
* libc/stdio/fseek.c: Ditto.
* libc/stdio64/fseeko64.c: Ditto.
* libc/stdlib/atexit.c: Ditto.
* libc/stdlib/on_exit.c: Ditto.
Corinna Vinschen [Thu, 17 Dec 2009 18:33:05 +0000 (18:33 +0000)]
* 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.