Browse Source

--- Merging r23696 into '.':
U rtl/unix/cwstring.pp
U rtl/unix/clocale.pp
--- Merging r24536 into '.':
U rtl/bsd/ostypes.inc

# revisions: 23696,24536
r23696 | pierre | 2013-03-05 12:40:24 +0100 (Tue, 05 Mar 2013) | 1 line
Changed paths:
M /trunk/rtl/unix/clocale.pp
M /trunk/rtl/unix/cwstring.pp

+ Use __setlocale_mb_len_max_32 for netbsd as suggested by linker warning
r24536 | marco | 2013-05-20 17:30:40 +0200 (Mon, 20 May 2013) | 2 lines
Changed paths:
M /trunk/rtl/bsd/ostypes.inc

* some O_ constants. Patch by Barlone.

git-svn-id: branches/fixes_2_6@24925 -

marco 12 years ago
parent
commit
bcdb280a19
3 changed files with 38 additions and 4 deletions
  1. 11 0
      rtl/bsd/ostypes.inc
  2. 7 1
      rtl/unix/clocale.pp
  3. 20 3
      rtl/unix/cwstring.pp

+ 11 - 0
rtl/bsd/ostypes.inc

@@ -221,6 +221,17 @@ CONST
     O_APPEND    =     8;        { Writes append to the file.        }
     O_NONBLOCK  =     4;        { Non-blocking I/O.                 }
 
+{$ifdef freebsd}
+    { Other }
+    O_SHLOCK    =   $10;        { Open with shared file lock }
+    O_EXLOCK    =   $20;        { Open with exclusive file lock }
+    O_ASYNC     =   $40;        { Signal pgrp when data ready }
+    O_FSYNC     =   $80;        { Synchronous writes }
+    O_SYNC      =   $80;        { POSIX synonym for O_FSYNC }
+    O_NOFOLLOW  =  $100;        { Don't follow symlinks }
+    O_DIRECT    =$10000;        { Attempt to bypass buffer cache }
+{$endif}
+
     { mode_t possible values                                 }
     S_IRUSR =  %0100000000;     { Read permission for owner   }
     S_IWUSR =  %0010000000;     { Write permission for owner  }

+ 7 - 1
rtl/unix/clocale.pp

@@ -88,8 +88,14 @@ Const
  _NL_MONETARY_CRNCYSTR = (__INT_CURR_SYMBOL)+15;
  {$endif}
 
-
+{$ifdef netbsd}
+  { NetBSD has a new setlocale function defined in /usr/include/locale.h
+    that should be used }
+function setlocale(category: cint; locale: pchar): pchar; cdecl; external clib name '__setlocale_mb_len_max_32';
+{$else}
 function setlocale(category: cint; locale: pchar): pchar; cdecl; external clib name 'setlocale';
+{$endif}
+
 function nl_langinfo(__item: cint):Pchar;cdecl;external clib name 'nl_langinfo';
 
 procedure GetFormatSettings(out fmts: TFormatSettings);

+ 20 - 3
rtl/unix/cwstring.pp

@@ -26,7 +26,18 @@ implementation
 
 {$linklib c}
 
-{$if not defined(linux) and not defined(solaris)}  // Linux (and maybe glibc platforms in general), have iconv in glibc.
+// Linux (and maybe glibc platforms in general), have iconv in glibc.
+{$if defined(linux) or defined(solaris)}
+  {$define iconv_is_in_libc}
+{$endif}
+
+{$ifdef netbsd}
+  {$ifdef TEST_ICONV_LIBC}
+    {$define iconv_is_in_libc}
+  {$endif}
+{$endif}
+
+{$ifndef iconv_is_in_libc}
  {$if defined(haiku)}
    {$linklib textencoding}
    {$linklib locale}
@@ -34,7 +45,7 @@ implementation
    {$linklib iconv}
  {$endif}
  {$define useiconv}
-{$endif linux}
+{$endif not iconv_is_in_libc}
 
 Uses
   BaseUnix,
@@ -60,7 +71,13 @@ function towupper(__wc:wint_t):wint_t;cdecl;external clib name 'towupper';
 
 function wcscoll (__s1:pwchar_t; __s2:pwchar_t):cint;cdecl;external clib name 'wcscoll';
 function strcoll (__s1:pchar; __s2:pchar):cint;cdecl;external clib name 'strcoll';
+{$ifdef netbsd}
+  { NetBSD has a new setlocale function defined in /usr/include/locale.h
+    that should be used }
+function setlocale(category: cint; locale: pchar): pchar; cdecl; external clib name '__setlocale_mb_len_max_32';
+{$else}
 function setlocale(category: cint; locale: pchar): pchar; cdecl; external clib name 'setlocale';
+{$endif}
 {$ifndef beos}
 function mbrtowc(pwc: pwchar_t; const s: pchar; n: size_t; ps: pmbstate_t): size_t; cdecl; external clib name 'mbrtowc';
 function wcrtomb(s: pchar; wc: wchar_t; ps: pmbstate_t): size_t; cdecl; external clib name 'wcrtomb';
@@ -152,7 +169,7 @@ type
   {$endif}
 {$endif}
 
-{$if (not defined(bsd) and not defined(beos)) or (defined(darwin) and not defined(cpupowerpc32))}
+{$if (not defined(bsd) and not defined(beos)) or defined(iconv_is_in_libc) or (defined(darwin) and not defined(cpupowerpc32))}
 function iconv_open(__tocode:pchar; __fromcode:pchar):iconv_t;cdecl;external libiconvname name 'iconv_open';
 function iconv(__cd:iconv_t; __inbuf:ppchar; __inbytesleft:psize_t; __outbuf:ppchar; __outbytesleft:psize_t):size_t;cdecl;external libiconvname name 'iconv';
 function iconv_close(__cd:iconv_t):cint;cdecl;external libiconvname name 'iconv_close';