aboutsummaryrefslogtreecommitdiff
path: root/debian/patches/kfreebsd-support-jdk.diff
blob: 290e540a246477fa8195a5985f830d15e6214e5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
From 9aa64548defe505931bde75daf8709e252766504 Mon Sep 17 00:00:00 2001
From: agx <agx@kfreebsd64.sigxcpu.org>
Date: Tue, 7 May 2013 13:05:15 +0200
Subject: [PATCH] kfreebsd-support-jdk

---
 jdk/make/com/sun/nio/Makefile                      |    4 +-
 jdk/make/common/shared/Defs-versions.gmk           |    4 +-
 jdk/make/common/shared/Platform.gmk                |    2 +-
 jdk/make/common/shared/Sanity-Settings.gmk         |    2 +
 jdk/make/common/shared/Sanity.gmk                  |    2 +
 jdk/make/java/nio/Makefile                         |   86 +++++-
 jdk/make/javax/sound/Makefile                      |    2 +
 .../classes/com/sun/servicetag/Installer.java      |    2 +-
 .../share/classes/com/sun/servicetag/Registry.java |    2 +-
 .../com/sun/servicetag/SystemEnvironment.java      |    2 +-
 .../classes/java/awt/GraphicsEnvironment.java      |    1 +
 jdk/src/share/classes/sun/font/FontUtilities.java  |    2 +-
 .../classes/sun/nio/cs/ext/ExtendedCharsets.java   |    1 +
 jdk/src/share/classes/sun/print/PSPrinterJob.java  |    4 +-
 .../classes/sun/security/jgss/GSSManagerImpl.java  |    1 +
 .../krb5/internal/ccache/FileCredentialsCache.java |    1 +
 .../native/java/lang/fdlibm/include/jfdlibm.h      |    2 +-
 .../share/native/sun/security/ec/impl/ecc_impl.h   |    2 +-
 jdk/src/solaris/bin/ergo_i586.c                    |    2 +-
 jdk/src/solaris/bin/jexec.c                        |   16 +-
 .../classes/sun/awt/X11/XScrollbarPeer.java        |    2 +-
 .../classes/sun/font/FcFontConfiguration.java      |    2 +-
 .../nio/ch/DefaultAsynchronousChannelProvider.java |    2 +-
 .../sun/nio/fs/DefaultFileSystemProvider.java      |    2 +-
 .../sun/nio/fs/LinuxDosFileAttributeView.java      |    3 -
 .../solaris/classes/sun/nio/fs/LinuxFileStore.java |    4 +-
 .../classes/sun/print/UnixPrintServiceLookup.java  |    1 +
 jdk/src/solaris/native/java/io/io_util_md.c        |    2 +-
 jdk/src/solaris/native/java/lang/UNIXProcess_md.c  |    4 +-
 jdk/src/solaris/native/java/lang/java_props_md.c   |   10 +-
 .../solaris/native/java/lang/java_props_md.c.orig  |    3 +-
 jdk/src/solaris/native/java/lang/locale_str.h      |   14 +-
 jdk/src/solaris/native/java/net/Inet4AddressImpl.c |    6 +-
 jdk/src/solaris/native/java/net/Inet6AddressImpl.c |    6 +-
 jdk/src/solaris/native/java/net/NetworkInterface.c |  313 ++++++++++++++++++++
 .../native/java/net/NetworkInterface.c.orig        |    2 +-
 .../native/java/net/PlainDatagramSocketImpl.c      |   13 +-
 jdk/src/solaris/native/java/net/PlainSocketImpl.c  |    6 +-
 jdk/src/solaris/native/java/net/net_util_md.c      |    5 +
 jdk/src/solaris/native/java/net/net_util_md.h      |    4 +-
 jdk/src/solaris/native/java/nio/MappedByteBuffer.c |    2 +-
 jdk/src/solaris/native/java/util/TimeZone_md.c     |   12 +-
 jdk/src/solaris/native/sun/awt/VDrawingArea.c      |    2 +-
 jdk/src/solaris/native/sun/awt/awt_Font.c          |    2 +-
 jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c   |   16 +-
 jdk/src/solaris/native/sun/awt/awt_InputMethod.c   |   56 ++--
 jdk/src/solaris/native/sun/awt/awt_MToolkit.c      |    4 +-
 jdk/src/solaris/native/sun/awt/awt_Robot.c         |    2 +-
 jdk/src/solaris/native/sun/awt/awt_util.c          |    4 +-
 jdk/src/solaris/native/sun/awt/awt_util.h          |    2 +-
 jdk/src/solaris/native/sun/awt/awt_xembed_server.c |    4 +-
 jdk/src/solaris/native/sun/awt/extutil.h           |    2 +-
 jdk/src/solaris/native/sun/awt/fontpath.c          |   14 +-
 jdk/src/solaris/native/sun/awt/multi_font.c        |    4 +-
 jdk/src/solaris/native/sun/java2d/j2d_md.h         |    3 +-
 .../native/sun/java2d/loops/vis_FuncArray.c        |    2 +-
 .../native/sun/net/dns/ResolverConfigurationImpl.c |    2 +-
 .../native/sun/net/spi/DefaultProxySelector.c      |    2 +-
 .../native/sun/nio/ch/DatagramChannelImpl.c        |    4 +-
 .../solaris/native/sun/nio/ch/DatagramDispatcher.c |    4 +-
 .../solaris/native/sun/nio/ch/FileChannelImpl.c    |   27 +-
 jdk/src/solaris/native/sun/nio/ch/NativeThread.c   |    8 +-
 jdk/src/solaris/native/sun/nio/ch/Net.c            |    6 +-
 jdk/src/solaris/native/sun/nio/ch/Sctp.h           |   32 +-
 .../solaris/native/sun/nio/ch/SctpChannelImpl.c    |    2 +-
 jdk/src/solaris/native/sun/nio/ch/SctpNet.c        |    2 +
 .../native/sun/nio/ch/ServerSocketChannelImpl.c    |    2 +-
 .../solaris/native/sun/nio/ch/SocketChannelImpl.c  |    2 +-
 .../native/sun/nio/fs/GnomeFileTypeDetector.c      |    2 +-
 .../native/sun/nio/fs/UnixNativeDispatcher.c       |    4 +-
 jdk/src/solaris/native/sun/xawt/XToolkit.c         |    4 +-
 jdk/src/solaris/transport/socket/socket_md.c       |    5 +-
 72 files changed, 632 insertions(+), 151 deletions(-)

diff --git openjdk/jdk/make/com/sun/nio/Makefile openjdk/jdk/make/com/sun/nio/Makefile
index 288b629..25f387b 100644
--- openjdk/jdk/make/com/sun/nio/Makefile
+++ openjdk/jdk/make/com/sun/nio/Makefile
@@ -38,7 +38,7 @@ endif
 
 
 all build clean clobber::
-	$(SUBDIRS-loop)
+#	$(SUBDIRS-loop)
 
 clean clobber::
-	$(RM) -r $(CLASSDESTDIR)/com/sun/nio
+#	$(RM) -r $(CLASSDESTDIR)/com/sun/nio
diff --git openjdk/jdk/make/common/shared/Defs-versions.gmk openjdk/jdk/make/common/shared/Defs-versions.gmk
index 570baad..ef02fa9 100644
--- openjdk/jdk/make/common/shared/Defs-versions.gmk
+++ openjdk/jdk/make/common/shared/Defs-versions.gmk
@@ -153,7 +153,9 @@ ifeq ($(PLATFORM), linux)
   REQUIRED_OS_VERSION         = 2.6
   REQUIRED_OS_VARIANT_NAME    = Fedora
   REQUIRED_OS_VARIANT_VERSION = 9
-  REQUIRED_ALSA_VERSION       = 0.9.1
+ifneq ($(SYSTEM_UNAME),GNU/kFreeBSD)
+   REQUIRED_ALSA_VERSION       = 0.9.1
+endif
   REQUIRED_COMPILER_NAME      = GCC4
   REQUIRED_COMPILER_VERSION   = GCC4
   REQUIRED_GCC_VER            = 2.95
diff --git openjdk/jdk/make/common/shared/Platform.gmk openjdk/jdk/make/common/shared/Platform.gmk
index 625019f..ad4e00a 100644
--- openjdk/jdk/make/common/shared/Platform.gmk
+++ openjdk/jdk/make/common/shared/Platform.gmk
@@ -152,7 +152,7 @@ ifeq ($(SYSTEM_UNAME), SunOS)
 endif
 
 # Platform settings specific to Linux
-ifeq ($(SYSTEM_UNAME), Linux)
+ifneq (,$(filter Linux GNU/kFreeBSD, $(SYSTEM_UNAME)))
   PLATFORM = linux
   # Arch and OS name/version
   ifdef CROSS_COMPILE_ARCH
diff --git openjdk/jdk/make/common/shared/Sanity-Settings.gmk openjdk/jdk/make/common/shared/Sanity-Settings.gmk
index ecc39c1..edc4017 100644
--- openjdk/jdk/make/common/shared/Sanity-Settings.gmk
+++ openjdk/jdk/make/common/shared/Sanity-Settings.gmk
@@ -186,8 +186,10 @@ ifeq ($(PLATFORM),windows)
 endif
 ifeq ($(PLATFORM),linux)
   ifdef REQUIRED_ALSA_VERSION
+  ifneq ($(SYSTEM_UNAME),GNU/kFreeBSD)
     ALL_SETTINGS+=$(call addRequiredSetting,ALSA_VERSION)
   endif
+  endif
 endif
 ALL_SETTINGS+=$(call addRequiredVersionSetting,OS_VERSION)
 ALL_SETTINGS+=$(call addOptionalSetting,OS_VARIANT_NAME)
diff --git openjdk/jdk/make/common/shared/Sanity.gmk openjdk/jdk/make/common/shared/Sanity.gmk
index 644c4e1..639280f 100644
--- openjdk/jdk/make/common/shared/Sanity.gmk
+++ openjdk/jdk/make/common/shared/Sanity.gmk
@@ -114,12 +114,14 @@ ifeq ($(PLATFORM), linux)
     elif [ -f /etc/lsb-release ] ; then \
       $(EGREP) DISTRIB_RELEASE /etc/lsb-release | $(SED) -e 's@.*DISTRIB_RELEASE=\(.*\)@\1@'; \
     fi)
+ifneq ($(SYSTEM_UNAME),GNU/kFreeBSD)
   ALSA_INCLUDE=/usr/include/alsa/version.h
   ALSA_LIBRARY=/usr/lib/libasound.so
   _ALSA_VERSION := $(shell $(EGREP) SND_LIB_VERSION_STR $(ALSA_INCLUDE) | \
            $(SED) -e 's@.*"\(.*\)".*@\1@' )
   ALSA_VERSION := $(call GetVersion,$(_ALSA_VERSION))
 endif
+endif
 
 ifeq ($(PLATFORM), macosx)
   # What kind of system we are using
diff --git openjdk/jdk/make/java/nio/Makefile openjdk/jdk/make/java/nio/Makefile
index 372569f..147ef0e 100644
--- openjdk/jdk/make/java/nio/Makefile
+++ openjdk/jdk/make/java/nio/Makefile
@@ -94,6 +94,70 @@ FILES_export += \
 
 else
 
+ifeq ($(SYSTEM_UNAME),GNU/kFreeBSD)
+
+FILES_java += \
+        sun/nio/ch/AbstractPollSelectorImpl.java \
+        sun/nio/ch/DevPollArrayWrapper.java \
+        sun/nio/ch/DevPollSelectorImpl.java \
+        sun/nio/ch/DevPollSelectorProvider.java \
+        sun/nio/ch/InheritedChannel.java \
+        sun/nio/ch/LinuxAsynchronousChannelProvider.java \
+        sun/nio/ch/PollSelectorProvider.java \
+        sun/nio/ch/PollSelectorImpl.java \
+        sun/nio/ch/Port.java \
+        sun/nio/ch/SimpleAsynchronousFileChannelImpl.java \
+        sun/nio/ch/SolarisAsynchronousChannelProvider.java \
+        sun/nio/ch/SolarisEventPort.java \
+        sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java \
+        sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \
+        \
+        sun/nio/fs/GnomeFileTypeDetector.java \
+        sun/nio/fs/LinuxDosFileAttributeView.java \
+        sun/nio/fs/LinuxFileStore.java \
+        sun/nio/fs/LinuxFileSystem.java \
+        sun/nio/fs/LinuxFileSystemProvider.java \
+        sun/nio/fs/LinuxUserDefinedFileAttributeView.java \
+        sun/nio/fs/LinuxNativeDispatcher.java \
+        sun/nio/fs/PollingWatchService.java \
+        sun/nio/fs/SolarisNativeDispatcher.java \
+        sun/nio/fs/SolarisWatchService.java \
+        sun/nio/fs/UnixChannelFactory.java \
+        sun/nio/fs/UnixCopyFile.java \
+        sun/nio/fs/UnixDirectoryStream.java \
+        sun/nio/fs/UnixException.java \
+        sun/nio/fs/UnixFileAttributeViews.java \
+        sun/nio/fs/UnixFileAttributes.java \
+        sun/nio/fs/UnixFileKey.java \
+        sun/nio/fs/UnixFileModeAttribute.java \
+        sun/nio/fs/UnixFileStore.java \
+        sun/nio/fs/UnixFileStoreAttributes.java \
+        sun/nio/fs/UnixFileSystem.java \
+        sun/nio/fs/UnixFileSystemProvider.java \
+        sun/nio/fs/UnixMountEntry.java \
+        sun/nio/fs/UnixNativeDispatcher.java \
+        sun/nio/fs/UnixPath.java \
+        sun/nio/fs/UnixSecureDirectoryStream.java \
+        sun/nio/fs/UnixUriUtils.java \
+        sun/nio/fs/UnixUserPrincipals.java
+
+FILES_export += \
+        sun/nio/ch/DevPollArrayWrapper.java \
+        sun/nio/ch/InheritedChannel.java \
+        sun/nio/ch/NativeThread.java \
+        sun/nio/ch/SolarisEventPort.java \
+        sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java \
+        sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \
+        \
+        sun/nio/fs/GnomeFileTypeDetector.java \
+        sun/nio/fs/LinuxNativeDispatcher.java \
+        sun/nio/fs/SolarisNativeDispatcher.java \
+        sun/nio/fs/SolarisWatchService.java \
+        sun/nio/fs/UnixCopyFile.java \
+        sun/nio/fs/UnixNativeDispatcher.java
+
+else
+
 FILES_java += \
         sun/nio/ch/AbstractPollSelectorImpl.java \
 	sun/nio/ch/DevPollArrayWrapper.java \
@@ -164,10 +228,12 @@ FILES_export += \
 	sun/nio/fs/UnixCopyFile.java \
 	sun/nio/fs/UnixNativeDispatcher.java
 
+endif # kFreeBSD
+
 FILES_gen += \
 	sun/nio/fs/UnixConstants.java
 
-endif
+endif # else
 
 ifeq ($(PLATFORM), solaris)
 
@@ -213,6 +279,22 @@ endif # PLATFORM = windows
 
 ifeq ($(PLATFORM), linux)
 
+ifeq ($(SYSTEM_UNAME),GNU/kFreeBSD)
+
+FILES_c += \
+        InheritedChannel.c \
+        NativeThread.c \
+        PollArrayWrapper.c \
+        UnixAsynchronousServerSocketChannelImpl.c \
+        UnixAsynchronousSocketChannelImpl.c \
+        \
+        GnomeFileTypeDetector.c \
+        LinuxNativeDispatcher.c \
+        UnixCopyFile.c \
+        UnixNativeDispatcher.c
+
+else
+
 FILES_c += \
 	EPoll.c \
 	EPollArrayWrapper.c \
@@ -229,6 +311,8 @@ FILES_c += \
 	UnixCopyFile.c \
 	UnixNativeDispatcher.c
 
+endif # kFreeBSD
+
 ifndef USE_SYSTEM_GIO
 FILES_c += \
 	gio_fp.c
diff --git openjdk/jdk/make/javax/sound/Makefile openjdk/jdk/make/javax/sound/Makefile
index cb455a7..ea4a710 100644
--- openjdk/jdk/make/javax/sound/Makefile
+++ openjdk/jdk/make/javax/sound/Makefile
@@ -105,10 +105,12 @@ ifeq ($(PLATFORM), windows)
 endif # PLATFORM win32
 
 ifeq ($(PLATFORM), linux)
+ifneq ($(SYSTEM_UNAME),GNU/kFreeBSD)
   # ALSA handles directaudio, ports, and MIDI
   SUBDIRS += jsoundalsa
   EXTRA_SOUND_JNI_LIBS += jsoundalsa
   #MXSPP_ADD = $(PLATFORM)-$(ARCH)/
+endif # kFreeBSD
 endif # PLATFORM linux
 
 ifeq ($(PLATFORM), macosx)
diff --git openjdk/jdk/src/share/classes/com/sun/servicetag/Installer.java openjdk/jdk/src/share/classes/com/sun/servicetag/Installer.java
index ae5ed4b..ed0ca75 100644
--- openjdk/jdk/src/share/classes/com/sun/servicetag/Installer.java
+++ openjdk/jdk/src/share/classes/com/sun/servicetag/Installer.java
@@ -549,7 +549,7 @@ public class Installer {
         Set<String> archs = new HashSet<String>();
 
         String os = System.getProperty("os.name");
-        if (os.equals("SunOS") || os.equals("Linux")) {
+        if (os.equals("SunOS") || os.equals("Linux") || os.equals("GNU/kFreeBSD")) {
             // Traverse the directories under <JRE>/lib.
             // If <JRE>/lib/<arch>/libjava.so exists, add <arch>
             // to the product defined ID
diff --git openjdk/jdk/src/share/classes/com/sun/servicetag/Registry.java openjdk/jdk/src/share/classes/com/sun/servicetag/Registry.java
index a9f3c8d..7090dc9 100644
--- openjdk/jdk/src/share/classes/com/sun/servicetag/Registry.java
+++ openjdk/jdk/src/share/classes/com/sun/servicetag/Registry.java
@@ -84,7 +84,7 @@ public class Registry {
             String os = System.getProperty("os.name");
             if (os.equals("SunOS")) {
                 stclient = new File(STCLIENT_SOLARIS);
-            } else if (os.equals("Linux")) {
+            } else if (os.equals("Linux") || os.equals("GNU/kFreeBSD")) {
                 stclient = new File(STCLIENT_LINUX);
             } else if (os.startsWith("Windows")) {
                 stclient = getWindowsStClientFile();
diff --git openjdk/jdk/src/share/classes/com/sun/servicetag/SystemEnvironment.java openjdk/jdk/src/share/classes/com/sun/servicetag/SystemEnvironment.java
index d1ec3fe..0821432 100644
--- openjdk/jdk/src/share/classes/com/sun/servicetag/SystemEnvironment.java
+++ openjdk/jdk/src/share/classes/com/sun/servicetag/SystemEnvironment.java
@@ -61,7 +61,7 @@ public class SystemEnvironment {
             String os = System.getProperty("os.name");
             if (os.equals("SunOS")) {
                 sysEnv = new SolarisSystemEnvironment();
-            } else if (os.equals("Linux")) {
+            } else if (os.equals("Linux") || os.equals("GNU/kFreeBSD")) {
                 sysEnv = new LinuxSystemEnvironment();
             } else if (os.startsWith("Windows")) {
                 sysEnv = new WindowsSystemEnvironment();
diff --git openjdk/jdk/src/share/classes/java/awt/GraphicsEnvironment.java openjdk/jdk/src/share/classes/java/awt/GraphicsEnvironment.java
index f3d49b7..6dc3d44 100644
--- openjdk/jdk/src/share/classes/java/awt/GraphicsEnvironment.java
+++ openjdk/jdk/src/share/classes/java/awt/GraphicsEnvironment.java
@@ -178,6 +178,7 @@ public abstract class GraphicsEnvironment {
                             } else {
                                 headless = defaultHeadless =
                                     Boolean.valueOf(("Linux".equals(osName) ||
+                                                     "GNU/kFreeBSD".equals(osName) ||
                                                      "SunOS".equals(osName) ||
                                                      "FreeBSD".equals(osName) ||
                                                      "NetBSD".equals(osName) ||
diff --git openjdk/jdk/src/share/classes/sun/font/FontUtilities.java openjdk/jdk/src/share/classes/sun/font/FontUtilities.java
index 2284c11..d595be7 100644
--- openjdk/jdk/src/share/classes/sun/font/FontUtilities.java
+++ openjdk/jdk/src/share/classes/sun/font/FontUtilities.java
@@ -76,7 +76,7 @@ public final class FontUtilities {
                 String osName = System.getProperty("os.name", "unknownOS");
                 isSolaris = osName.startsWith("SunOS");
 
-                isLinux = osName.startsWith("Linux");
+                isLinux = osName.startsWith("Linux") || osName.equals("GNU/kFreeBSD");
 
                 isMacOSX = osName.contains("OS X"); // TODO: MacOSX
 
diff --git openjdk/jdk/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java openjdk/jdk/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java
index 299db8f..c799768 100644
--- openjdk/jdk/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java
+++ openjdk/jdk/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java
@@ -1280,6 +1280,7 @@ public class ExtendedCharsets
         String osName = AccessController.doPrivileged(
             new GetPropertyAction("os.name"));
         if ("SunOS".equals(osName) || "Linux".equals(osName)
+               || "GNU/kFreeBSD".equals(osName)
                || osName.contains("OS X")) {
             charset("x-COMPOUND_TEXT", "COMPOUND_TEXT",
                     new String[] {
diff --git openjdk/jdk/src/share/classes/sun/print/PSPrinterJob.java openjdk/jdk/src/share/classes/sun/print/PSPrinterJob.java
index bd92706..00bdba9 100644
--- openjdk/jdk/src/share/classes/sun/print/PSPrinterJob.java
+++ openjdk/jdk/src/share/classes/sun/print/PSPrinterJob.java
@@ -1537,7 +1537,9 @@ public class PSPrinterJob extends RasterPrinterJob {
         }
 
        String osname = System.getProperty("os.name");
-       if (osname.equals("Linux") || osname.contains("OS X")) {
+       if (osname.equals("Linux") ||
+           osname.equals("GNU/kFreeBSD") ||
+           osname.contains("OS X")) {
             execCmd = new String[ncomps];
             execCmd[n++] = "/usr/bin/lpr";
             if ((pFlags & PRINTER) != 0) {
diff --git openjdk/jdk/src/share/classes/sun/security/jgss/GSSManagerImpl.java openjdk/jdk/src/share/classes/sun/security/jgss/GSSManagerImpl.java
index 8a60b8b..8b27320 100644
--- openjdk/jdk/src/share/classes/sun/security/jgss/GSSManagerImpl.java
+++ openjdk/jdk/src/share/classes/sun/security/jgss/GSSManagerImpl.java
@@ -48,6 +48,7 @@ public class GSSManagerImpl extends GSSManager {
                     public Boolean run() {
                             String osname = System.getProperty("os.name");
                             if (osname.startsWith("SunOS") ||
+                                osname.startsWith("GNU/kFreeBSD") ||
                                 osname.startsWith("Linux")) {
                                 return new Boolean(System.getProperty
                                     (USE_NATIVE_PROP));
diff --git openjdk/jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java openjdk/jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java
index f9b901f..e43b155 100644
--- openjdk/jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java
+++ openjdk/jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java
@@ -403,6 +403,7 @@ public class FileCredentialsCache extends CredentialsCache
             long uid = 0;
 
             if (osname.startsWith("SunOS") ||
+                osname.startsWith("GNU/kFreeBSD") ||
                 (osname.startsWith("Linux"))) {
                 try {
                     Class<?> c = Class.forName
diff --git openjdk/jdk/src/share/native/java/lang/fdlibm/include/jfdlibm.h openjdk/jdk/src/share/native/java/lang/fdlibm/include/jfdlibm.h
index 4525f4b..fdcb308 100644
--- openjdk/jdk/src/share/native/java/lang/fdlibm/include/jfdlibm.h
+++ openjdk/jdk/src/share/native/java/lang/fdlibm/include/jfdlibm.h
@@ -61,7 +61,7 @@
 #define log1p   jlog1p
 #define expm1   jexpm1
 
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(__GLIBC__)
 #define __ieee754_sqrt          __j__ieee754_sqrt
 #define __ieee754_acos          __j__ieee754_acos
 #define __ieee754_acosh         __j__ieee754_acosh
diff --git openjdk/jdk/src/share/native/sun/security/ec/impl/ecc_impl.h openjdk/jdk/src/share/native/sun/security/ec/impl/ecc_impl.h
index 8eaa6e8..443331d 100644
--- openjdk/jdk/src/share/native/sun/security/ec/impl/ecc_impl.h
+++ openjdk/jdk/src/share/native/sun/security/ec/impl/ecc_impl.h
@@ -49,7 +49,7 @@ extern "C" {
 /*
  * Multi-platform definitions
  */
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 #define B_FALSE FALSE
 #define B_TRUE TRUE
 typedef unsigned char uint8_t;
diff --git openjdk/jdk/src/solaris/bin/ergo_i586.c openjdk/jdk/src/solaris/bin/ergo_i586.c
index a3122a3..ca69380 100644
--- openjdk/jdk/src/solaris/bin/ergo_i586.c
+++ openjdk/jdk/src/solaris/bin/ergo_i586.c
@@ -106,7 +106,7 @@ ServerClassMachineImpl(void) {
 
 #endif /* __solaris__ */
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 
 /*
  * A utility method for asking the CPU about itself.
diff --git openjdk/jdk/src/solaris/bin/jexec.c openjdk/jdk/src/solaris/bin/jexec.c
index b2efc99..e64db5a 100644
--- openjdk/jdk/src/solaris/bin/jexec.c
+++ openjdk/jdk/src/solaris/bin/jexec.c
@@ -76,7 +76,7 @@
 #include <string.h>
 #include <limits.h>
 #include <errno.h>
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 #  include <sys/types.h>
 #  include <sys/stat.h>
 #  include <fcntl.h>
@@ -89,7 +89,7 @@ static const int BAD_MAGIC  = ENOEXEC;
 static const char * BAD_EXEC_MSG     = "jexec failed";
 static const char * CRAZY_EXEC_MSG   = "missing args";
 static const char * MISSING_JAVA_MSG = "can't locate java";
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 static const char * BAD_PATHNAME_MSG = "invalid path";
 static const char * BAD_FILE_MSG     = "invalid file";
 static const char * BAD_MAGIC_MSG    = "invalid file (bad magic number)";
@@ -98,7 +98,7 @@ static const char * UNKNOWN_ERROR    = "unknown error";
 
 /* Define a constant that represents the number of directories to pop off the
  * current location to find the java binary */
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 static const int RELATIVE_DEPTH = 2;
 #else /* Solaris */
 static const int RELATIVE_DEPTH = 3;
@@ -111,7 +111,7 @@ static const char * BIN_PATH = "/bin/java";
 static const char * JAR_FLAG = "-jar";
 
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 /* largest possible size for a local file header */
 static const size_t CHUNK_SIZE = 65535;
 
@@ -123,7 +123,7 @@ static const ssize_t MIN_SIZE = LOCHDR + 1 + 4;
 int main(int argc, const char * argv[]);
 void errorExit(int error, const char * message);
 int getJavaPath(const char * path, char * buf, int depth);
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 const char * isJar(const char * path);
 #endif
 
@@ -171,7 +171,7 @@ int main(int argc, const char * argv[]) {
     nargv = (const char **) malloc((argc + 2) * (sizeof (const char *)));
     nargv[nargc++] = java;
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
     /* The "-jar" flag is already in the original args list on Solaris,
      * so it only needs to be added on Linux. */
     nargv[nargc++] = JAR_FLAG;
@@ -181,7 +181,7 @@ int main(int argc, const char * argv[]) {
         const char * jarfile = argv[argi++];
         const char * message = NULL;
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
         /* On Linux we also need to make sure argv[1] is really a JAR
          * file (this will also resolve any symlinks, which helps). */
         char jarPath[PATH_MAX + 1];
@@ -290,7 +290,7 @@ int getJavaPath(const char * path, char * buf, int depth) {
 }
 
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 /*
  * Check if the given file is a JAR file.
  *
diff --git openjdk/jdk/src/solaris/classes/sun/awt/X11/XScrollbarPeer.java openjdk/jdk/src/solaris/classes/sun/awt/X11/XScrollbarPeer.java
index fecadfb..19da3ed 100644
--- openjdk/jdk/src/solaris/classes/sun/awt/X11/XScrollbarPeer.java
+++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XScrollbarPeer.java
@@ -74,7 +74,7 @@ class XScrollbarPeer extends XComponentPeer implements ScrollbarPeer, XScrollbar
      * Currently uses hardcoded values
      */
     private int getDefaultDimension() {
-        if (System.getProperty("os.name").equals("Linux")) {
+        if (System.getProperty("os.name").equals("Linux") || System.getProperty("os.name").equals("GNU/kFreeBSD")) {
             return DEFAULT_WIDTH_LINUX;
         } else {
             return DEFAULT_WIDTH_SOLARIS;
diff --git openjdk/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java openjdk/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java
index 36cb10a..9ea6bd3 100644
--- openjdk/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java
+++ openjdk/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java
@@ -295,7 +295,7 @@ public class FcFontConfiguration extends FontConfiguration {
 
         super.setOsNameAndVersion();
 
-        if (!osName.equals("Linux")) {
+        if (!(osName.equals("Linux") || osName.equals("GNU/kFreeBSD"))) {
             return;
         }
         try {
diff --git openjdk/jdk/src/solaris/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java openjdk/jdk/src/solaris/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java
index 3efecaa..9d568c0 100644
--- openjdk/jdk/src/solaris/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java
+++ openjdk/jdk/src/solaris/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java
@@ -48,7 +48,7 @@ public class DefaultAsynchronousChannelProvider {
             .doPrivileged(new GetPropertyAction("os.name"));
         if (osname.equals("SunOS"))
             return new SolarisAsynchronousChannelProvider();
-        if (osname.equals("Linux"))
+        if (osname.equals("Linux") || osname.equals("GNU/kFreeBSD"))
             return new LinuxAsynchronousChannelProvider();
         if (osname.contains("OS X"))
             return new BsdAsynchronousChannelProvider();
diff --git openjdk/jdk/src/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java openjdk/jdk/src/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java
index 9f8d479..f29b938 100644
--- openjdk/jdk/src/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java
+++ openjdk/jdk/src/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java
@@ -66,7 +66,7 @@ public class DefaultFileSystemProvider {
             .doPrivileged(new GetPropertyAction("os.name"));
         if (osname.equals("SunOS"))
             return createProvider("sun.nio.fs.SolarisFileSystemProvider");
-        if (osname.equals("Linux"))
+        if (osname.equals("Linux") || osname.equals("GNU/kFreeBSD"))
             return createProvider("sun.nio.fs.LinuxFileSystemProvider");
         if (osname.equals("Darwin") || osname.contains("OS X"))
             return createProvider("sun.nio.fs.BsdFileSystemProvider");
diff --git openjdk/jdk/src/solaris/classes/sun/nio/fs/LinuxDosFileAttributeView.java openjdk/jdk/src/solaris/classes/sun/nio/fs/LinuxDosFileAttributeView.java
index 4a97e09..f20badd 100644
--- openjdk/jdk/src/solaris/classes/sun/nio/fs/LinuxDosFileAttributeView.java
+++ openjdk/jdk/src/solaris/classes/sun/nio/fs/LinuxDosFileAttributeView.java
@@ -238,9 +238,6 @@ class LinuxDosFileAttributeView
             }
             throw new UnixException("Value of " + DOS_XATTR_NAME + " attribute is invalid");
         } catch (UnixException x) {
-            // default value when attribute does not exist
-            if (x.errno() == ENODATA)
-                return 0;
             throw x;
         } finally {
             buffer.release();
diff --git openjdk/jdk/src/solaris/classes/sun/nio/fs/LinuxFileStore.java openjdk/jdk/src/solaris/classes/sun/nio/fs/LinuxFileStore.java
index 0571227..e2e9a45 100644
--- openjdk/jdk/src/solaris/classes/sun/nio/fs/LinuxFileStore.java
+++ openjdk/jdk/src/solaris/classes/sun/nio/fs/LinuxFileStore.java
@@ -101,9 +101,7 @@ class LinuxFileStore
                 LinuxNativeDispatcher.fgetxattr(fd, "user.java".getBytes(), 0L, 0);
                 return true;
             } catch (UnixException e) {
-                // attribute does not exist
-                if (e.errno() == UnixConstants.ENODATA)
-                    return true;
+                return false;
             } finally {
                 UnixNativeDispatcher.close(fd);
             }
diff --git openjdk/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java openjdk/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java
index 72b184f..a7abbab 100644
--- openjdk/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java
+++ openjdk/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java
@@ -125,6 +125,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
 
     static boolean isBSD() {
         return (osname.equals("Linux") ||
+                osname.equals("GNU/kFreeBSD") ||
                 osname.contains("OS X"));
     }
 
diff --git openjdk/jdk/src/solaris/native/java/io/io_util_md.c openjdk/jdk/src/solaris/native/java/io/io_util_md.c
index 1d9abff..893ac56 100644
--- openjdk/jdk/src/solaris/native/java/io/io_util_md.c
+++ openjdk/jdk/src/solaris/native/java/io/io_util_md.c
@@ -73,7 +73,7 @@ fileOpen(JNIEnv *env, jobject this, jstring path, jfieldID fid, int flags)
     WITH_PLATFORM_STRING(env, path, ps) {
         FD fd;
 
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(__GLIBC__)
         /* Remove trailing slashes, since the kernel won't */
         char *p = (char *)ps + strlen(ps) - 1;
         while ((p > ps) && (*p == '/'))
diff --git openjdk/jdk/src/solaris/native/java/lang/UNIXProcess_md.c openjdk/jdk/src/solaris/native/java/lang/UNIXProcess_md.c
index 6904a44..a1700b5 100644
--- openjdk/jdk/src/solaris/native/java/lang/UNIXProcess_md.c
+++ openjdk/jdk/src/solaris/native/java/lang/UNIXProcess_md.c
@@ -102,7 +102,7 @@
 #define START_CHILD_USE_CLONE 0  /* clone() currently disabled; see above. */
 
 #ifndef START_CHILD_USE_CLONE
-  #ifdef __linux__
+  #if defined(__linux__) || defined(__GLIBC__)
     #define START_CHILD_USE_CLONE 1
   #else
     #define START_CHILD_USE_CLONE 0
@@ -111,7 +111,7 @@
 
 /* By default, use vfork() on Linux. */
 #ifndef START_CHILD_USE_VFORK
-  #ifdef __linux__
+  #if defined(__linux__) || defined(__GLIBC__)
     #define START_CHILD_USE_VFORK 1
   #else
     #define START_CHILD_USE_VFORK 0
diff --git openjdk/jdk/src/solaris/native/java/lang/java_props_md.c openjdk/jdk/src/solaris/native/java/lang/java_props_md.c
index 1c3ed11..f016f36 100644
--- openjdk/jdk/src/solaris/native/java/lang/java_props_md.c
+++ openjdk/jdk/src/solaris/native/java/lang/java_props_md.c
@@ -23,7 +23,7 @@
  * questions.
  */
 
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(__GLIBC__)
 #include <stdio.h>
 #include <ctype.h>
 #endif
@@ -57,7 +57,7 @@
 #include "java_props.h"
 
 #if !defined(_ALLBSD_SOURCE)
-#ifdef __linux__
+#ifdef __linux__ || defined(__GLIBC__)
   #ifndef CODESET
   #define CODESET _NL_CTYPE_CODESET_NAME
   #endif
@@ -151,7 +151,7 @@ static int ParseLocale(int cat, char ** std_language, char ** std_script,
     lc = setlocale(cat, NULL);
 #endif
 
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__GLIBC__)
     if (lc == NULL) {
         return 0;
     }
@@ -293,7 +293,7 @@ static int ParseLocale(int cat, char ** std_language, char ** std_script,
          * in order to use optimizations. */
         *std_encoding = (*p != '\0') ? p : "ISO8859-1";
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
         /*
          * Remap the encoding string to a different value for japanese
          * locales on linux so that customized converters are used instead
@@ -512,7 +512,7 @@ GetJavaProperties(JNIEnv *env)
      sprops.unicode_encoding = "UnicodeBig";
  #endif
 #else /* !_ALLBSD_SOURCE */
-#ifdef __linux__
+#ifdef __linux__ || defined(__GLIBC__)
 #if __BYTE_ORDER == __LITTLE_ENDIAN
     sprops.unicode_encoding = "UnicodeLittle";
 #else
diff --git openjdk/jdk/src/solaris/native/java/lang/java_props_md.c.orig openjdk/jdk/src/solaris/native/java/lang/java_props_md.c.orig
index 6505e4f..1c3ed11 100644
--- openjdk/jdk/src/solaris/native/java/lang/java_props_md.c.orig
+++ openjdk/jdk/src/solaris/native/java/lang/java_props_md.c.orig
@@ -558,6 +558,7 @@ GetJavaProperties(JNIEnv *env)
     sprops.path_separator = ":";
     sprops.line_separator = "\n";
 
+#ifndef __linux__
 #if !defined(_ALLBSD_SOURCE)
     /* Append CDE message and resource search path to NLSPATH and
      * XFILESEARCHPATH, in order to pick localized message for
@@ -566,7 +567,7 @@ GetJavaProperties(JNIEnv *env)
     setPathEnvironment("NLSPATH=/usr/dt/lib/nls/msg/%L/%N.cat");
     setPathEnvironment("XFILESEARCHPATH=/usr/dt/app-defaults/%L/Dt");
 #endif
-
+#endif
 
 #ifdef MACOSX
     setProxyProperties(&sprops);
diff --git openjdk/jdk/src/solaris/native/java/lang/locale_str.h openjdk/jdk/src/solaris/native/java/lang/locale_str.h
index d63e26c..a7108b5 100644
--- openjdk/jdk/src/solaris/native/java/lang/locale_str.h
+++ openjdk/jdk/src/solaris/native/java/lang/locale_str.h
@@ -48,7 +48,7 @@
     "gl", "gl_ES",
     "he", "iw_IL",
     "hr", "hr_HR",
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
     "hs", "en_US", // used on Linux, not clear what it stands for
 #endif
     "hu", "hu_HU",
@@ -78,14 +78,14 @@
     "sv", "sv_SE",
     "th", "th_TH",
     "tr", "tr_TR",
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
     "ua", "en_US", // used on Linux, not clear what it stands for
 #endif
     "uk", "uk_UA",
     "vi", "vi_VN",
     "wa", "wa_BE",
     "zh", "zh_CN",
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
     "bokmal", "nb_NO",
     "bokm\xE5l", "nb_NO",
     "catalan", "ca_ES",
@@ -146,13 +146,13 @@ static char *language_names[] = {
     "POSIX", "en",
     "cz", "cs",
     "he", "iw",
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
     "hs", "en", // used on Linux, not clear what it stands for
 #endif
     "id", "in",
     "sh", "sr", // sh is deprecated
     "su", "fi",
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
     "ua", "en", // used on Linux, not clear what it stands for
     "catalan", "ca",
     "croatian", "hr",
@@ -195,7 +195,7 @@ static char *language_names[] = {
  * Linux/Solaris script string to Java script name mapping table.
  */
 static char *script_names[] = {
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
     "cyrillic", "Cyrl",
     "devanagari", "Deva",
     "iqtelif", "Latn",
@@ -208,7 +208,7 @@ static char *script_names[] = {
  * Linux/Solaris country string to ISO3166 string mapping table.
  */
 static char *country_names[] = {
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
     "RN", "US", // used on Linux, not clear what it stands for
 #endif
     "YU", "CS", // YU has been removed from ISO 3166
diff --git openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
index 278ce13..1508c8b 100644
--- openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
+++ openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
@@ -340,7 +340,7 @@ Java_java_net_Inet4AddressImpl_getLocalHostName(JNIEnv *env, jobject this) {
         /* Something went wrong, maybe networking is not setup? */
         strcpy(hostname, "localhost");
     } else {
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
         /* On Linux gethostname() says "host.domain.sun.com".  On
          * Solaris gethostname() says "host", so extra work is needed.
          */
@@ -668,7 +668,7 @@ ping4(JNIEnv *env, jint fd, struct sockaddr_in* him, jint timeout,
       n = sendto(fd, sendbuf, plen, 0, (struct sockaddr *)him,
                  sizeof(struct sockaddr));
       if (n < 0 && errno != EINPROGRESS ) {
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
         if (errno != EINVAL)
           /*
            * On some Linuxes, when bound to the loopback interface, sendto
@@ -826,7 +826,7 @@ Java_java_net_Inet4AddressImpl_isReachable0(JNIEnv *env, jobject this,
         case ENETUNREACH: /* Network Unreachable */
         case EAFNOSUPPORT: /* Address Family not supported */
         case EADDRNOTAVAIL: /* address is not available on  the  remote machine */
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
         case EINVAL:
           /*
            * On some Linuxes, when bound to the loopback interface, connect
diff --git openjdk/jdk/src/solaris/native/java/net/Inet6AddressImpl.c openjdk/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
index ec2427d..a7687a7 100644
--- openjdk/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
+++ openjdk/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
@@ -73,7 +73,7 @@ Java_java_net_Inet6AddressImpl_getLocalHostName(JNIEnv *env, jobject this) {
     } else {
         // ensure null-terminated
         hostname[NI_MAXHOST] = '\0';
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(__GLIBC__)
         /* On Linux/FreeBSD gethostname() says "host.domain.sun.com".  On
          * Solaris gethostname() says "host", so extra work is needed.
          */
@@ -511,7 +511,7 @@ ping6(JNIEnv *env, jint fd, struct sockaddr_in6* him, jint timeout,
       plen = sizeof(struct icmp6_hdr) + sizeof(tv);
       n = sendto(fd, sendbuf, plen, 0, (struct sockaddr*) him, sizeof(struct sockaddr_in6));
       if (n < 0 && errno != EINPROGRESS) {
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
         if (errno != EINVAL)
           /*
            * On some Linuxes, when bound to the loopback interface, sendto
@@ -678,7 +678,7 @@ Java_java_net_Inet6AddressImpl_isReachable0(JNIEnv *env, jobject this,
         case ENETUNREACH: /* Network Unreachable */
         case EAFNOSUPPORT: /* Address Family not supported */
         case EADDRNOTAVAIL: /* address is not available on  the  remote machine */
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
         case EINVAL:
           /*
            * On some Linuxes, when bound to the loopback interface, connect
diff --git openjdk/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c openjdk/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
index 382ec4c..81ffc41 100644
--- openjdk/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
+++ openjdk/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
@@ -33,7 +33,7 @@
 #ifdef __solaris__
 #include <fcntl.h>
 #endif
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 #include <unistd.h>
 #include <sys/sysctl.h>
 #include <sys/utsname.h>
@@ -336,7 +336,7 @@ Java_java_net_PlainDatagramSocketImpl_disconnect0(JNIEnv *env, jobject this, jin
     /* The fdObj'fd */
     jint fd;
 
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(__GLIBC__)
     SOCKADDR addr;
     int len;
 #endif
@@ -346,7 +346,7 @@ Java_java_net_PlainDatagramSocketImpl_disconnect0(JNIEnv *env, jobject this, jin
     }
     fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
 
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(__GLIBC__)
 #ifdef __linux__
     if (isOldKernel) {
         int t = 1;
@@ -357,14 +357,21 @@ Java_java_net_PlainDatagramSocketImpl_disconnect0(JNIEnv *env, jobject this, jin
 #ifdef AF_INET6
         if (ipv6_available()) {
             struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)&addr;
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+            him6->sin6_family = AF_INET6;
+#else
             him6->sin6_family = AF_UNSPEC;
+#endif
             len = sizeof(struct sockaddr_in6);
         } else
 #endif
         {
             struct sockaddr_in *him4 = (struct sockaddr_in*)&addr;
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
             him4->sin_family = AF_UNSPEC;
+#else
             len = sizeof(struct sockaddr_in);
+#endif
         }
         JVM_Connect(fd, (struct sockaddr *)&addr, len);
 
diff --git openjdk/jdk/src/solaris/native/java/net/PlainSocketImpl.c openjdk/jdk/src/solaris/native/java/net/PlainSocketImpl.c
index 82616f2..ecbd6a5 100644
--- openjdk/jdk/src/solaris/native/java/net/PlainSocketImpl.c
+++ openjdk/jdk/src/solaris/native/java/net/PlainSocketImpl.c
@@ -32,7 +32,7 @@
 #endif
 #include <netinet/tcp.h>        /* Defines TCP_NODELAY, needed for 2.6 */
 #include <netinet/in.h>
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 #include <netinet/ip.h>
 #endif
 #include <netdb.h>
@@ -41,7 +41,7 @@
 #ifdef __solaris__
 #include <fcntl.h>
 #endif
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 #include <unistd.h>
 #include <sys/sysctl.h>
 #endif
@@ -468,7 +468,7 @@ Java_java_net_PlainSocketImpl_socketConnect(JNIEnv *env, jobject this,
     /* report the appropriate exception */
     if (connect_rv < 0) {
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
         /*
          * Linux/GNU distribution setup /etc/hosts so that
          * InetAddress.getLocalHost gets back the loopback address
diff --git openjdk/jdk/src/solaris/native/java/net/net_util_md.c openjdk/jdk/src/solaris/native/java/net/net_util_md.c
index f0c8230..0c0be34 100644
--- openjdk/jdk/src/solaris/native/java/net/net_util_md.c
+++ openjdk/jdk/src/solaris/native/java/net/net_util_md.c
@@ -56,6 +56,11 @@
 #include <net/route.h>
 #include <sys/utsname.h>
 
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#endif
+
 #ifndef IPV6_FLOWINFO_SEND
 #define IPV6_FLOWINFO_SEND      33
 #endif
diff --git openjdk/jdk/src/solaris/native/java/net/net_util_md.h openjdk/jdk/src/solaris/native/java/net/net_util_md.h
index c72a07b..2358676 100644
--- openjdk/jdk/src/solaris/native/java/net/net_util_md.h
+++ openjdk/jdk/src/solaris/native/java/net/net_util_md.h
@@ -37,7 +37,7 @@
 #endif
 
 
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
 extern int NET_Timeout(int s, long timeout);
 extern int NET_Read(int s, void* buf, size_t len);
 extern int NET_RecvFrom(int s, void *buf, int len, unsigned int flags,
@@ -147,7 +147,7 @@ extern jint NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout);
 /************************************************************************
  *  Utilities
  */
-#ifdef __linux__
+#if defined(__linux__)
 extern int kernelIsV22();
 extern int kernelIsV24();
 #endif
diff --git openjdk/jdk/src/solaris/native/java/nio/MappedByteBuffer.c openjdk/jdk/src/solaris/native/java/nio/MappedByteBuffer.c
index a87926f..501ba3f 100644
--- openjdk/jdk/src/solaris/native/java/nio/MappedByteBuffer.c
+++ openjdk/jdk/src/solaris/native/java/nio/MappedByteBuffer.c
@@ -40,7 +40,7 @@ Java_java_nio_MappedByteBuffer_isLoaded0(JNIEnv *env, jobject obj, jlong address
     int result = 0;
     int i = 0;
     void *a = (void *) jlong_to_ptr(address);
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
     unsigned char *vec = (unsigned char *)malloc(numPages * sizeof(char));
 #else
     char *vec = (char *)malloc(numPages * sizeof(char));
diff --git openjdk/jdk/src/solaris/native/java/util/TimeZone_md.c openjdk/jdk/src/solaris/native/java/util/TimeZone_md.c
index 30decbb..824e78e 100644
--- openjdk/jdk/src/solaris/native/java/util/TimeZone_md.c
+++ openjdk/jdk/src/solaris/native/java/util/TimeZone_md.c
@@ -49,7 +49,7 @@
 #define fileclose       fclose
 #endif
 
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(__GLIBC__)
 
 
 static const char *ETC_TIMEZONE_FILE = "/etc/timezone";
@@ -123,7 +123,7 @@ findZoneinfoFile(char *buf, size_t size, const char *dir)
         return NULL;
     }
 
-#if defined(__linux__) || defined(MACOSX) || (defined(__solaris__) \
+#if defined(__linux__) || defined(__GLIBC__) || defined(MACOSX) || (defined(__solaris__) \
     && (defined(_POSIX_PTHREAD_SEMANTICS) || defined(_LP64)))
     while (readdir_r(dirp, entry, &dp) == 0 && dp != NULL) {
 #else
@@ -212,7 +212,7 @@ findZoneinfoFile(char *buf, size_t size, const char *dir)
     return tz;
 }
 
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
 
 /*
  * Performs Linux specific mapping and returns a zone ID
@@ -228,7 +228,7 @@ getPlatformTimeZoneID()
     char *buf;
     size_t size;
 
-#ifdef __linux__
+#ifdef __linux__ || defined(__GLIBC__)
     /*
      * Try reading the /etc/timezone file for Debian distros. There's
      * no spec of the file format available. This parsing assumes that
@@ -633,7 +633,7 @@ findJavaTZ_md(const char *java_home_dir, const char *country)
 
     tz = getenv("TZ");
 
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(__GLIBC__)
     if (tz == NULL) {
 #else
 #ifdef __solaris__
@@ -659,7 +659,7 @@ findJavaTZ_md(const char *java_home_dir, const char *country)
 #endif
 
     if (tz != NULL) {
-#ifdef __linux__
+#if defined(__linux__)  || defined(__GLIBC__)
         /*
          * Ignore "posix/" prefix.
          */
diff --git openjdk/jdk/src/solaris/native/sun/awt/VDrawingArea.c openjdk/jdk/src/solaris/native/sun/awt/VDrawingArea.c
index c9ce812..001e6dd 100644
--- openjdk/jdk/src/solaris/native/sun/awt/VDrawingArea.c
+++ openjdk/jdk/src/solaris/native/sun/awt/VDrawingArea.c
@@ -33,7 +33,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 /* XXX: Shouldn't be necessary. */
 #include "awt_p.h"
 #endif /* __linux__ */
diff --git openjdk/jdk/src/solaris/native/sun/awt/awt_Font.c openjdk/jdk/src/solaris/native/sun/awt/awt_Font.c
index c36ab51..1cd2969 100644
--- openjdk/jdk/src/solaris/native/sun/awt/awt_Font.c
+++ openjdk/jdk/src/solaris/native/sun/awt/awt_Font.c
@@ -334,7 +334,7 @@ loadFont(Display * display, char *name, int32_t pointSize)
             if (strcmp(style, "regular") == 0) {
                 altstyle = "roman";
             }
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
             if (!strcmp(family, "lucidasans")) {
                 family = "lucida";
             }
diff --git openjdk/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c openjdk/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c
index 2c81ca4..ec5e6f1 100644
--- openjdk/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c
+++ openjdk/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c
@@ -123,7 +123,8 @@ static char *x11GraphicsConfigClassName = "sun/awt/X11GraphicsConfig";
  */
 
 #define MAXFRAMEBUFFERS 16
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
+
 typedef struct {
    int   screen_number;
    short x_org;
@@ -439,7 +440,7 @@ getAllConfigs (JNIEnv *env, int screen, AwtScreenDataPtr screenDataPtr) {
                                       RTLD_LAZY | RTLD_GLOBAL);
         }
 
-#ifndef __linux__ /* SOLARIS */
+#if ! defined(__linux__) && ! defined(__GLIBC__)  /* SOLARIS */
         if (xrenderLibHandle == NULL) {
             xrenderLibHandle = dlopen("/usr/sfw/lib/libXrender.so.1",
                                       RTLD_LAZY | RTLD_GLOBAL);
@@ -652,7 +653,8 @@ void checkNewXineramaScreen(JNIEnv* env, jobject peer, struct FrameData* wdata,
 #endif /* HEADLESS */
 
 #ifndef HEADLESS
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
+
 static void xinerama_init_linux()
 {
     void* libHandle = NULL;
@@ -703,7 +705,7 @@ static void xinerama_init_linux()
     }
 }
 #endif
-#if !defined(__linux__) && !defined(MACOSX) /* Solaris */
+#if !defined(__linux__) && !defined(MACOSX) && !defined(__GLIBC__) /* Solaris */
 static void xinerama_init_solaris()
 {
     void* libHandle = NULL;
@@ -763,11 +765,11 @@ static void xineramaInit(void) {
     }
 
     DTRACE_PRINTLN("Xinerama extension is available");
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
     xinerama_init_linux();
 #else /* Solaris */
     xinerama_init_solaris();
-#endif /* __linux__ || MACOSX */
+#endif /* __linux__ || MACOSX || __GLIBC__ */
 }
 #endif /* HEADLESS */
 
@@ -1642,7 +1644,7 @@ Java_sun_awt_X11GraphicsEnvironment_getXineramaCenterPoint(JNIEnv *env,
 {
     jobject point = NULL;
 #ifndef HEADLESS    /* return NULL in HEADLESS, Linux */
-#if !defined(__linux__) && !defined(MACOSX)
+#if !defined(__linux__) && !defined(MACOSX) && !defined(__GLIBC__)
     int x,y;
 
     AWT_LOCK();
diff --git openjdk/jdk/src/solaris/native/sun/awt/awt_InputMethod.c openjdk/jdk/src/solaris/native/sun/awt/awt_InputMethod.c
index d55ed83..bcdf894 100644
--- openjdk/jdk/src/solaris/native/sun/awt/awt_InputMethod.c
+++ openjdk/jdk/src/solaris/native/sun/awt/awt_InputMethod.c
@@ -67,7 +67,7 @@ static void PreeditDrawCallback(XIC, XPointer,
                                 XIMPreeditDrawCallbackStruct *);
 static void PreeditCaretCallback(XIC, XPointer,
                                  XIMPreeditCaretCallbackStruct *);
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
 static void StatusStartCallback(XIC, XPointer, XPointer);
 static void StatusDoneCallback(XIC, XPointer, XPointer);
 static void StatusDrawCallback(XIC, XPointer,
@@ -81,7 +81,7 @@ static void StatusDrawCallback(XIC, XPointer,
 #define PreeditDoneIndex        1
 #define PreeditDrawIndex        2
 #define PreeditCaretIndex       3
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
 #define StatusStartIndex        4
 #define StatusDoneIndex         5
 #define StatusDrawIndex         6
@@ -99,14 +99,14 @@ static XIMProc callback_funcs[NCALLBACKS] = {
     (XIMProc)PreeditDoneCallback,
     (XIMProc)PreeditDrawCallback,
     (XIMProc)PreeditCaretCallback,
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
     (XIMProc)StatusStartCallback,
     (XIMProc)StatusDoneCallback,
     (XIMProc)StatusDrawCallback,
 #endif
 };
 
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
 #define MAX_STATUS_LEN  100
 typedef struct {
     Window   w;                /*status window id        */
@@ -146,7 +146,7 @@ typedef struct _X11InputMethodData {
 #endif /* XAWT */
     jobject     x11inputmethod; /* global ref to X11InputMethod instance */
                                 /* associated with the XIC */
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
     StatusWindow *statusWindow; /* our own status window  */
 #else
 #ifndef XAWT
@@ -425,7 +425,7 @@ destroyX11InputMethodData(JNIEnv *env, X11InputMethodData *pX11IMData)
 static void
 freeX11InputMethodData(JNIEnv *env, X11InputMethodData *pX11IMData)
 {
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
     if (pX11IMData->statusWindow != NULL){
         StatusWindow *sw = pX11IMData->statusWindow;
         XFreeGC(awt_display, sw->lightGC);
@@ -531,7 +531,7 @@ awt_x11inputmethod_lookupString(XKeyPressedEvent *event, KeySym *keysymp)
     pX11IMData = getX11InputMethodData(env, currentX11InputMethodInstance);
 
     if (pX11IMData == NULL) {
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
         return False;
 #else
         return result;
@@ -539,7 +539,7 @@ awt_x11inputmethod_lookupString(XKeyPressedEvent *event, KeySym *keysymp)
     }
 
     if ((ic = pX11IMData->current_ic) == (XIC)0){
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
         return False;
 #else
         return result;
@@ -648,7 +648,7 @@ awt_x11inputmethod_lookupString(XKeyPressedEvent *event, KeySym *keysymp)
     return result;
 }
 
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
 static StatusWindow *createStatusWindow(
 #ifdef XAWT
                                 Window parent) {
@@ -993,7 +993,7 @@ void adjustStatusWindow(Widget shell){
         }
     }
 }
-#endif  /* __linux__ || MACOSX */
+#endif  /* __linux__ || MACOSX || __GLIBC__ */
 /*
  * Creates two XICs, one for active clients and the other for passive
  * clients. All information on those XICs are stored in the
@@ -1050,7 +1050,7 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
         return FALSE ;
     }
 
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
     on_the_spot_styles |= XIMStatusNothing;
 
     /*kinput does not support XIMPreeditCallbacks and XIMStatusArea
@@ -1063,7 +1063,7 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
             break;
         }
     }
-#else /*! __linux__ && !MACOSX */
+#else /*! __linux__ && !MACOSX && !__GLIBC__ */
 #ifdef XAWT
     on_the_spot_styles |= XIMStatusNothing;
 #else /* !XAWT */
@@ -1086,7 +1086,7 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
         on_the_spot_styles |= XIMStatusNothing;
 
 #endif /* XAWT */
-#endif /* __linux__ || MACOSX */
+#endif /* __linux__ || MACOSX || __GLIBC__ */
 
     for (i = 0; i < im_styles->count_styles; i++) {
         active_styles |= im_styles->supported_styles[i] & on_the_spot_styles;
@@ -1134,7 +1134,7 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
                         NULL);
         if (preedit == (XVaNestedList)NULL)
             goto err;
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
         /*always try XIMStatusCallbacks for active client...*/
         {
             status = (XVaNestedList)XVaCreateNestedList(0,
@@ -1156,7 +1156,7 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
             XFree((void *)status);
             XFree((void *)preedit);
         }
-#else /* !__linux__ && !MACOSX */
+#else /* !__linux__ && !MACOSX && !__GLIBC__ */
 #ifndef XAWT
         if (on_the_spot_styles & XIMStatusArea) {
             Widget parent;
@@ -1184,7 +1184,7 @@ createXIC(Widget w, X11InputMethodData *pX11IMData,
         }
 #endif /* XAWT */
         XFree((void *)preedit);
-#endif /* __linux__ || MACOSX */
+#endif /* __linux__ || MACOSX || __GLIBC__ */
         pX11IMData->ic_passive = XCreateIC(X11im,
                                            XNClientWindow, w,
                                            XNFocusWindow, w,
@@ -1343,7 +1343,7 @@ PreeditCaretCallback(XIC ic, XPointer client_data,
 
 }
 
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
 static void
 StatusStartCallback(XIC ic, XPointer client_data, XPointer call_data)
 {
@@ -1411,7 +1411,7 @@ StatusDrawCallback(XIC ic, XPointer client_data,
  finally:
     AWT_UNLOCK();
 }
-#endif /* __linux__ || MACOSX */
+#endif /* __linux__ || MACOSX || __GLIBC__ */
 
 static void CommitStringCallback(XIC ic, XPointer client_data, XPointer call_data) {
     JNIEnv *env = GetJNIEnv();
@@ -1517,14 +1517,14 @@ Java_sun_awt_motif_MInputMethod_openXIMNative(JNIEnv *env,
 /* Use IMInstantiate call back only on Linux, as there is a bug in Solaris
    (4768335)
 */
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
     registered = XRegisterIMInstantiateCallback(dpy, NULL, NULL,
                      NULL, (XIDProc)OpenXIMCallback, NULL);
     if (!registered) {
         /* directly call openXIM callback */
 #endif
         OpenXIMCallback(dpy, NULL, NULL);
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
     }
 #endif
 
@@ -1588,13 +1588,13 @@ Java_sun_awt_motif_MInputMethod_createXICNative(JNIEnv *env,
 #endif /* XAWT */
     globalRef = (*env)->NewGlobalRef(env, this);
     pX11IMData->x11inputmethod = globalRef;
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX)  || defined(__GLIBC__)
     pX11IMData->statusWindow = NULL;
-#else /* !__linux__ && !MACOSX */
+#else /* !__linux__ && !MACOSX && !__GLIBC__ */
 #ifndef XAWT
     pX11IMData->statusWidget = (Widget) NULL;
 #endif /* XAWT */
-#endif /* __linux__ || MACOSX */
+#endif /* __linux__ || MACOSX || __GLIBC__ */
 
     pX11IMData->lookup_buf = 0;
     pX11IMData->lookup_buf_len = 0;
@@ -1741,14 +1741,14 @@ Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env,
         setXICFocus(pX11IMData->current_ic, req);
         currentX11InputMethodInstance = pX11IMData->x11inputmethod;
         currentFocusWindow =  w;
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
         if (active && pX11IMData->statusWindow && pX11IMData->statusWindow->on)
             onoffStatusWindow(pX11IMData, w, True);
 #endif
     } else {
         currentX11InputMethodInstance = NULL;
         currentFocusWindow = 0;
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
         onoffStatusWindow(pX11IMData, 0, False);
         if (pX11IMData->current_ic != NULL)
 #endif
@@ -1765,7 +1765,7 @@ JNIEXPORT void JNICALL
 Java_sun_awt_X11InputMethod_turnoffStatusWindow(JNIEnv *env,
                                                 jobject this)
 {
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
     X11InputMethodData *pX11IMData;
     StatusWindow *statusWindow;
 
@@ -1862,7 +1862,7 @@ Java_sun_awt_motif_MInputMethod_configureStatusAreaNative(JNIEnv *env,
     X11InputMethodData *pX11IMData;
     XVaNestedList status;
 
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
       /*do nothing for linux? */
 #else
     AWT_LOCK();
@@ -1968,7 +1968,7 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11InputMethod_isCompositionEnabledNativ
 JNIEXPORT void JNICALL Java_sun_awt_X11_XInputMethod_adjustStatusWindow
   (JNIEnv *env, jobject this, jlong window)
 {
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
     AWT_LOCK();
     adjustStatusWindow(window);
     AWT_UNLOCK();
diff --git openjdk/jdk/src/solaris/native/sun/awt/awt_MToolkit.c openjdk/jdk/src/solaris/native/sun/awt/awt_MToolkit.c
index e341153..f7ccfd7 100644
--- openjdk/jdk/src/solaris/native/sun/awt/awt_MToolkit.c
+++ openjdk/jdk/src/solaris/native/sun/awt/awt_MToolkit.c
@@ -63,7 +63,7 @@
 extern JavaVM *jvm;
 
 #ifndef HEADLESS
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
 extern void statusWindowEventHandler(XEvent event);
 Boolean awt_dnd_process_event(XEvent* event);
 #endif
@@ -1643,7 +1643,7 @@ processOneEvent(XtInputMask iMask) {
               */
               Widget widget=XtWindowToWidget(awt_display, xev.xany.window);
               eventNumber++;
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
               statusWindowEventHandler(xev);
 #endif
               xembed_eventHandler(&xev);
diff --git openjdk/jdk/src/solaris/native/sun/awt/awt_Robot.c openjdk/jdk/src/solaris/native/sun/awt/awt_Robot.c
index 97d57cd..7ebfdf3 100644
--- openjdk/jdk/src/solaris/native/sun/awt/awt_Robot.c
+++ openjdk/jdk/src/solaris/native/sun/awt/awt_Robot.c
@@ -45,7 +45,7 @@
 #include "wsutils.h"
 #include "list.h"
 #include "multiVis.h"
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
 #include <sys/socket.h>
 #endif
 
diff --git openjdk/jdk/src/solaris/native/sun/awt/awt_util.c openjdk/jdk/src/solaris/native/sun/awt/awt_util.c
index bf48c09..0341f79 100644
--- openjdk/jdk/src/solaris/native/sun/awt/awt_util.c
+++ openjdk/jdk/src/solaris/native/sun/awt/awt_util.c
@@ -605,7 +605,7 @@ awt_WidgetAtXY(Widget root, Position pointerx, Position pointery) {
 
   return answer;
 }
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 
 
 #define MAXARGS 10
@@ -676,7 +676,7 @@ awt_util_getXICStatusAreaWindow(Widget w)
     return w;
 }
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 static XRectangle geometryRect;
 XVaNestedList awt_util_getXICStatusAreaList(Widget w)
 {
diff --git openjdk/jdk/src/solaris/native/sun/awt/awt_util.h openjdk/jdk/src/solaris/native/sun/awt/awt_util.h
index 9c6abc2..d746293 100644
--- openjdk/jdk/src/solaris/native/sun/awt/awt_util.h
+++ openjdk/jdk/src/solaris/native/sun/awt/awt_util.h
@@ -200,7 +200,7 @@ Widget awt_util_getXICStatusAreaWindow(Widget w);
 
 
 
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
 typedef struct _XmImRefRec {
   Cardinal      num_refs;       /* Number of referencing widgets. */
   Cardinal      max_refs;       /* Maximum length of refs array. */
diff --git openjdk/jdk/src/solaris/native/sun/awt/awt_xembed_server.c openjdk/jdk/src/solaris/native/sun/awt/awt_xembed_server.c
index d4eb5ea..d54550b 100644
--- openjdk/jdk/src/solaris/native/sun/awt/awt_xembed_server.c
+++ openjdk/jdk/src/solaris/native/sun/awt/awt_xembed_server.c
@@ -35,7 +35,7 @@
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
 #include <Xm/MwmUtil.h>
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 #include <execinfo.h>
 #endif
 #include <stdio.h>
@@ -835,7 +835,7 @@ Java_sun_awt_motif_GrabbedKey_initKeySymAndModifiers (JNIEnv *env, jobject this,
     AWT_UNLOCK();
 }
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 void
 print_stack (void)
 {
diff --git openjdk/jdk/src/solaris/native/sun/awt/extutil.h openjdk/jdk/src/solaris/native/sun/awt/extutil.h
index ba9f75a..8220ce0 100644
--- openjdk/jdk/src/solaris/native/sun/awt/extutil.h
+++ openjdk/jdk/src/solaris/native/sun/awt/extutil.h
@@ -58,7 +58,7 @@ in this Software without prior written authorization from The Open Group.
  */
 /* $XFree86: xc/include/extensions/extutil.h,v 1.5 2001/01/17 17:53:20 dawes Exp $ */
 
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
 
 #ifndef _EXTUTIL_H_
 #define _EXTUTIL_H_
diff --git openjdk/jdk/src/solaris/native/sun/awt/fontpath.c openjdk/jdk/src/solaris/native/sun/awt/fontpath.c
index 0dcdbc7..11790f5 100644
--- openjdk/jdk/src/solaris/native/sun/awt/fontpath.c
+++ openjdk/jdk/src/solaris/native/sun/awt/fontpath.c
@@ -23,7 +23,7 @@
  * questions.
  */
 
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
 #include <string.h>
 #endif /* __linux__ */
 #include <stdio.h>
@@ -50,7 +50,7 @@
 #define AWT_UNLOCK()
 #endif /* !HEADLESS */
 
-#if defined(__linux__) && !defined(MAP_FAILED)
+#if !defined(MAP_FAILED)
 #define MAP_FAILED ((caddr_t)-1)
 #endif
 
@@ -64,7 +64,7 @@ extern Display *awt_display;
 
 #define MAXFDIRS 512    /* Max number of directories that contain fonts */
 
-#if !defined(__linux__) && !defined(MACOSX)
+#if !defined(__linux__) && !defined(MACOSX) && !defined(__GLIBC__)
 /*
  * This can be set in the makefile to "/usr/X11" if so desired.
  */
@@ -381,7 +381,7 @@ static char **getX11FontPath ()
 
 #endif /* !HEADLESS */
 
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
 /* from awt_LoadLibrary.c */
 JNIEXPORT jboolean JNICALL AWTIsHeadless();
 #endif
@@ -506,7 +506,7 @@ static char *getPlatformFontPathChars(JNIEnv *env, jboolean noType1) {
      */
     fcdirs = getFontConfigLocations();
 
-#if defined(__linux__)
+#if defined(__linux__) || defined(__GLIBC__)
     knowndirs = fullLinuxFontPath;
 #elif defined(MACOSX)
     knowndirs = full_MACOSX_X11FontPath;
@@ -520,7 +520,7 @@ static char *getPlatformFontPathChars(JNIEnv *env, jboolean noType1) {
      * be initialised.
      */
 #ifndef HEADLESS
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
     /* There's no headless build on linux ... */
     if (!AWTIsHeadless()) { /* .. so need to call a function to check */
 #endif
@@ -536,7 +536,7 @@ static char *getPlatformFontPathChars(JNIEnv *env, jboolean noType1) {
         x11dirs = getX11FontPath();
     }
     AWT_UNLOCK();
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
     }
 #endif
 #endif /* !HEADLESS */
diff --git openjdk/jdk/src/solaris/native/sun/awt/multi_font.c openjdk/jdk/src/solaris/native/sun/awt/multi_font.c
index 0cb6e5b..7bcf4ae 100644
--- openjdk/jdk/src/solaris/native/sun/awt/multi_font.c
+++ openjdk/jdk/src/solaris/native/sun/awt/multi_font.c
@@ -348,7 +348,7 @@ awtJNI_IsMultiFontMetrics(JNIEnv * env, jobject this)
     return JNI_TRUE;
 }
 #ifndef XAWT
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 XmString
 unicodeXmStringCreate(char* text, char* tag, int len) {
     XmString ret_val;
@@ -433,7 +433,7 @@ awtJNI_MakeMultiFontString(JNIEnv * env, jstring s, jobject font)
             char *offsetStringData;
 
             offsetStringData = stringData + (4 * sizeof(char));
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
             len = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3];
             /* Motif XmStringCreate() API requests "text must be a NULL-terminated
                string" and its implementation uses "strlen()" to calculate the length
diff --git openjdk/jdk/src/solaris/native/sun/java2d/j2d_md.h openjdk/jdk/src/solaris/native/sun/java2d/j2d_md.h
index 3f5578f..8d74349 100644
--- openjdk/jdk/src/solaris/native/sun/java2d/j2d_md.h
+++ openjdk/jdk/src/solaris/native/sun/java2d/j2d_md.h
@@ -30,7 +30,8 @@
 /*
  * Linux and MACOSX's version of <sys/types.h> does not define intptr_t
  */
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
+
 #include <stdint.h>
 #endif /* __linux__ || MACOSX */
 
diff --git openjdk/jdk/src/solaris/native/sun/java2d/loops/vis_FuncArray.c openjdk/jdk/src/solaris/native/sun/java2d/loops/vis_FuncArray.c
index 0c59e10..c8f2582 100644
--- openjdk/jdk/src/solaris/native/sun/java2d/loops/vis_FuncArray.c
+++ openjdk/jdk/src/solaris/native/sun/java2d/loops/vis_FuncArray.c
@@ -804,7 +804,7 @@ static AnyFunc* hash_table_vis[HASH_SIZE];
 static int initialized;
 static int usevis = JNI_TRUE;
 
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__GLIBC__)
 #   define ULTRA_CHIP   "sparc64"
 #else
 #   define ULTRA_CHIP   "sun4u"
diff --git openjdk/jdk/src/solaris/native/sun/net/dns/ResolverConfigurationImpl.c openjdk/jdk/src/solaris/native/sun/net/dns/ResolverConfigurationImpl.c
index 3d26212..ef4fd10 100644
--- openjdk/jdk/src/solaris/native/sun/net/dns/ResolverConfigurationImpl.c
+++ openjdk/jdk/src/solaris/native/sun/net/dns/ResolverConfigurationImpl.c
@@ -33,7 +33,7 @@
 #include <strings.h>
 #endif
 
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(__GLIBC__)
 #include <string.h>
 #endif
 
diff --git openjdk/jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c openjdk/jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c
index a3a60bb..67573e5 100644
--- openjdk/jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c
+++ openjdk/jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c
@@ -29,7 +29,7 @@
 #include "jlong.h"
 #include "sun_net_spi_DefaultProxySelector.h"
 #include <stdio.h>
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(__GLIBC__)
 #include <string.h>
 #else
 #include <strings.h>
diff --git openjdk/jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c openjdk/jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
index 5cf1186..b082f45 100644
--- openjdk/jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
+++ openjdk/jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
@@ -35,7 +35,7 @@
 #include <string.h>
 #include <errno.h>
 
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(__GLIBC__)
 #include <netinet/in.h>
 #endif
 
@@ -81,7 +81,7 @@ Java_sun_nio_ch_DatagramChannelImpl_disconnect0(JNIEnv *env, jobject this,
     rv = connect(fd, 0, 0);
 #endif
 
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(__GLIBC__)
     {
         int len;
         SOCKADDR sa;
diff --git openjdk/jdk/src/solaris/native/sun/nio/ch/DatagramDispatcher.c openjdk/jdk/src/solaris/native/sun/nio/ch/DatagramDispatcher.c
index 6d5337c..9d3f558 100644
--- openjdk/jdk/src/solaris/native/sun/nio/ch/DatagramDispatcher.c
+++ openjdk/jdk/src/solaris/native/sun/nio/ch/DatagramDispatcher.c
@@ -73,7 +73,7 @@ Java_sun_nio_ch_DatagramDispatcher_readv0(JNIEnv *env, jclass clazz,
     m.msg_accrightslen = 0;
 #endif
 
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(__GLIBC__)
     m.msg_control = NULL;
     m.msg_controllen = 0;
 #endif
@@ -121,7 +121,7 @@ Java_sun_nio_ch_DatagramDispatcher_writev0(JNIEnv *env, jclass clazz,
     m.msg_accrightslen = 0;
 #endif
 
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(__GLIBC__)
     m.msg_control = NULL;
     m.msg_controllen = 0;
 #endif
diff --git openjdk/jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c openjdk/jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c
index 8e5c0fd..719a97a 100644
--- openjdk/jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c
+++ openjdk/jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c
@@ -39,7 +39,7 @@
 
 #if defined(__linux__) || defined(__solaris__)
 #include <sys/sendfile.h>
-#elif defined(_ALLBSD_SOURCE)
+#elif defined(_ALLBSD_SOURCE) || defined(__FreeBSD_kernel__)
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/uio.h>
@@ -228,6 +228,31 @@ Java_sun_nio_ch_FileChannelImpl_transferTo0(JNIEnv *env, jobject this,
     }
 
     return result;
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+    off_t numBytes;
+    int result;
+
+    numBytes = count;
+
+    result = sendfile(srcFD, dstFD, position, count, NULL, &numBytes, 0);
+
+    if (numBytes > 0)
+        return numBytes;
+
+    if (result == -1) {
+        if (errno == EAGAIN)
+            return IOS_UNAVAILABLE;
+        if (errno == EOPNOTSUPP || errno == ENOTSOCK || errno == ENOTCONN)
+            return IOS_UNSUPPORTED_CASE;
+        if ((errno == EINVAL) && ((ssize_t)count >= 0))
+            return IOS_UNSUPPORTED_CASE;
+        if (errno == EINTR)
+            return IOS_INTERRUPTED;
+        JNU_ThrowIOExceptionWithLastError(env, "Transfer failed");
+        return IOS_THROWN;
+    }
+
+    return result;
 #else
     return IOS_UNSUPPORTED_CASE;
 #endif
diff --git openjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c openjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
index 79a91a0..0824695 100644
--- openjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
+++ openjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
@@ -33,7 +33,7 @@
 #include "nio_util.h"
 
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 #include <pthread.h>
 #include <sys/signal.h>
 
@@ -51,7 +51,7 @@ nullHandler(int sig)
 JNIEXPORT void JNICALL
 Java_sun_nio_ch_NativeThread_init(JNIEnv *env, jclass cl)
 {
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 
     /* Install the null handler for INTERRUPT_SIGNAL.  This might overwrite the
      * handler previously installed by java/net/linux_close.c, but that's okay
@@ -74,7 +74,7 @@ Java_sun_nio_ch_NativeThread_init(JNIEnv *env, jclass cl)
 JNIEXPORT jlong JNICALL
 Java_sun_nio_ch_NativeThread_current(JNIEnv *env, jclass cl)
 {
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
     return (long)pthread_self();
 #else
     return -1;
@@ -84,7 +84,7 @@ Java_sun_nio_ch_NativeThread_current(JNIEnv *env, jclass cl)
 JNIEXPORT void JNICALL
 Java_sun_nio_ch_NativeThread_signal(JNIEnv *env, jclass cl, jlong thread)
 {
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
     if (pthread_kill((pthread_t)thread, INTERRUPT_SIGNAL))
         JNU_ThrowIOExceptionWithLastError(env, "Thread signal failed");
 #endif
diff --git openjdk/jdk/src/solaris/native/sun/nio/ch/Net.c openjdk/jdk/src/solaris/native/sun/nio/ch/Net.c
index 45c09c3..799f2be 100644
--- openjdk/jdk/src/solaris/native/sun/nio/ch/Net.c
+++ openjdk/jdk/src/solaris/native/sun/nio/ch/Net.c
@@ -86,7 +86,7 @@ struct my_group_source_req {
 #endif  /* __solaris__ */
 
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 
 #ifndef IP_BLOCK_SOURCE
 
@@ -259,7 +259,7 @@ Java_sun_nio_ch_Net_socket0(JNIEnv *env, jclass cl, jboolean preferIPv6,
             return -1;
         }
     }
-#if defined(__linux__) && defined(AF_INET6)
+#if ( defined(__linux__) || defined(__GLIBC__) ) && defined(AF_INET6)
     /* By default, Linux uses the route default */
     if (domain == AF_INET6 && type == SOCK_DGRAM) {
         int arg = 1;
@@ -576,7 +576,7 @@ Java_sun_nio_ch_Net_joinOrDrop6(JNIEnv *env, jobject this, jboolean join, jobjec
         optval = (void*)&mreq6;
         optlen = sizeof(mreq6);
     } else {
-#if defined (__linux__) || defined(MACOSX)
+#if defined (__linux__) || defined(MACOSX) || defined(__GLIBC__)
         /* Include-mode filtering broken on Mac OS & Linux at least to 2.6.24 */
         return IOS_UNAVAILABLE;
 #else
diff --git openjdk/jdk/src/solaris/native/sun/nio/ch/Sctp.h openjdk/jdk/src/solaris/native/sun/nio/ch/Sctp.h
index 0218523..27ef032 100644
--- openjdk/jdk/src/solaris/native/sun/nio/ch/Sctp.h
+++ openjdk/jdk/src/solaris/native/sun/nio/ch/Sctp.h
@@ -319,8 +319,36 @@ typedef int sctp_freepaddrs_func(struct sockaddr *addrs);
 typedef int sctp_bindx_func(int sd, struct sockaddr *addrs, int addrcnt, int flags);
 typedef int sctp_peeloff_func(int sock, sctp_assoc_t id);
 
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 
-#endif /* __linux__ */
+#include <stdint.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <bsd/sys/cdefs.h>
+#include <netinet/sctp.h>
+#include <netinet/sctp_peeloff.h>
+#include <netinet/sctp_uio.h>
+#include "jni.h"
+
+#define nio_sctp_getladdrs sctp_getladdrs
+#define nio_sctp_freeladdrs sctp_freeladdrs
+#define nio_sctp_getpaddrs sctp_getpaddrs
+#define nio_sctp_freepaddrs sctp_freepaddrs
+#define nio_sctp_bindx  sctp_bindx
+#define nio_sctp_peeloff sctp_peeloff
+
+#endif /* __FreeBSD_kernel__ || __FreeBSD_kernel__ */
+
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+
+#define nio_sctp_getladdrs sctp_getladdrs
+#define nio_sctp_freeladdrs sctp_freeladdrs
+#define nio_sctp_getpaddrs sctp_getpaddrs
+#define nio_sctp_freepaddrs sctp_freepaddrs
+#define nio_sctp_bindx  sctp_bindx
+#define nio_sctp_peeloff sctp_peeloff
+
+#else
 
 sctp_getladdrs_func* nio_sctp_getladdrs;
 sctp_freeladdrs_func* nio_sctp_freeladdrs;
@@ -329,6 +357,8 @@ sctp_freepaddrs_func* nio_sctp_freepaddrs;
 sctp_bindx_func* nio_sctp_bindx;
 sctp_peeloff_func* nio_sctp_peeloff;
 
+#endif
+
 jboolean loadSocketExtensionFuncs(JNIEnv* env);
 
 #endif /* !SUN_NIO_CH_SCTP_H */
diff --git openjdk/jdk/src/solaris/native/sun/nio/ch/SctpChannelImpl.c openjdk/jdk/src/solaris/native/sun/nio/ch/SctpChannelImpl.c
index 8d2af44..47ff912 100644
--- openjdk/jdk/src/solaris/native/sun/nio/ch/SctpChannelImpl.c
+++ openjdk/jdk/src/solaris/native/sun/nio/ch/SctpChannelImpl.c
@@ -441,7 +441,7 @@ JNIEXPORT jint JNICALL Java_sun_nio_ch_SctpChannelImpl_receive0
             } else if (errno == EINTR) {
                 return IOS_INTERRUPTED;
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
             } else if (errno == ENOTCONN) {
                 /* ENOTCONN when EOF reached */
                 rv = 0;
diff --git openjdk/jdk/src/solaris/native/sun/nio/ch/SctpNet.c openjdk/jdk/src/solaris/native/sun/nio/ch/SctpNet.c
index 3eaf402..3329339 100644
--- openjdk/jdk/src/solaris/native/sun/nio/ch/SctpNet.c
+++ openjdk/jdk/src/solaris/native/sun/nio/ch/SctpNet.c
@@ -58,6 +58,7 @@ static int preCloseFD = -1;     /* File descriptor to which we dup other fd's
  */
 jboolean loadSocketExtensionFuncs
   (JNIEnv* env) {
+#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
     if (dlopen(nativeSctpLib, RTLD_GLOBAL | RTLD_LAZY) == NULL) {
         JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
               dlerror());
@@ -105,6 +106,7 @@ jboolean loadSocketExtensionFuncs
               dlerror());
         return JNI_FALSE;
     }
+#endif /* __FreeBSD__ */
 
     funcsLoaded = JNI_TRUE;
     return JNI_TRUE;
diff --git openjdk/jdk/src/solaris/native/sun/nio/ch/ServerSocketChannelImpl.c openjdk/jdk/src/solaris/native/sun/nio/ch/ServerSocketChannelImpl.c
index 7a730cc..f6b1888 100644
--- openjdk/jdk/src/solaris/native/sun/nio/ch/ServerSocketChannelImpl.c
+++ openjdk/jdk/src/solaris/native/sun/nio/ch/ServerSocketChannelImpl.c
@@ -28,7 +28,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 
-#if __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 #include <netinet/in.h>
 #endif
 
diff --git openjdk/jdk/src/solaris/native/sun/nio/ch/SocketChannelImpl.c openjdk/jdk/src/solaris/native/sun/nio/ch/SocketChannelImpl.c
index 66c3254..d41e6ea 100644
--- openjdk/jdk/src/solaris/native/sun/nio/ch/SocketChannelImpl.c
+++ openjdk/jdk/src/solaris/native/sun/nio/ch/SocketChannelImpl.c
@@ -31,7 +31,7 @@
 #include <string.h>
 #include <poll.h>
 
-#if __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 #include <netinet/in.h>
 #endif
 
diff --git openjdk/jdk/src/solaris/native/sun/nio/fs/GnomeFileTypeDetector.c openjdk/jdk/src/solaris/native/sun/nio/fs/GnomeFileTypeDetector.c
index fc526cc..ef41f74 100644
--- openjdk/jdk/src/solaris/native/sun/nio/fs/GnomeFileTypeDetector.c
+++ openjdk/jdk/src/solaris/native/sun/nio/fs/GnomeFileTypeDetector.c
@@ -38,7 +38,7 @@
 #include <strings.h>
 #endif
 
-#if defined(__linux__) || defined(__APPLE__)
+#if defined(__linux__) || defined(__APPLE__) || defined(__GLIBC__)
 #include <string.h>
 #endif
 
diff --git openjdk/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c openjdk/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
index 876d0d1..5c3c83f 100644
--- openjdk/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
+++ openjdk/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
@@ -26,7 +26,7 @@
 /**
  * fstatat in glibc requires _ATFILE_SOURCE to be defined.
  */
-#if defined(__linux__)
+#if defined(__linux__) || defined(__GLIBC__)
 #define _ATFILE_SOURCE
 #endif
 
@@ -51,7 +51,7 @@
 #include <sys/mkdev.h>
 #endif
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 #include <string.h>
 #include <mntent.h>
 #endif
diff --git openjdk/jdk/src/solaris/native/sun/xawt/XToolkit.c openjdk/jdk/src/solaris/native/sun/xawt/XToolkit.c
index 0e6d021..c4519f2 100644
--- openjdk/jdk/src/solaris/native/sun/xawt/XToolkit.c
+++ openjdk/jdk/src/solaris/native/sun/xawt/XToolkit.c
@@ -27,7 +27,7 @@
 #include <X11/Xutil.h>
 #include <X11/Xos.h>
 #include <X11/Xatom.h>
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 #include <execinfo.h>
 #endif
 
@@ -785,7 +785,7 @@ JNIEXPORT jstring JNICALL Java_sun_awt_X11_XToolkit_getEnv
     return ret;
 }
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 void print_stack(void)
 {
   void *array[10];
diff --git openjdk/jdk/src/solaris/transport/socket/socket_md.c openjdk/jdk/src/solaris/transport/socket/socket_md.c
index 25973d9..3fd1f3f 100644
--- openjdk/jdk/src/solaris/transport/socket/socket_md.c
+++ openjdk/jdk/src/solaris/transport/socket/socket_md.c
@@ -36,7 +36,7 @@
 #ifdef __solaris__
 #include <thread.h>
 #endif
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(__GLIBC__)
 #include <pthread.h>
 #include <sys/poll.h>
 #endif
@@ -308,7 +308,8 @@ dbgsysTlsGet(int index) {
 
 #endif
 
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(__GLIBC__)
+
 int
 dbgsysTlsAlloc() {
     pthread_key_t key;
diff --git a/src/solaris/native/java/net/NetworkInterface.c b/src/solaris/native/java/net/NetworkInterface.c
index de94820..9b4ff93 100644
--- openjdk/jdk/src/solaris/native/java/net/NetworkInterface.c.orig
+++ openjdk/jdk/src/solaris/native/java/net/NetworkInterface.c
@@ -56,17 +56,17 @@
 #define _PATH_PROCNET_IFINET6           "/proc/net/if_inet6"
 #endif
 
-#if defined(_ALLBSD_SOURCE)
+#if defined(_ALLBSD_SOURCE) || defined(__FreeBSD_kernel__)
 #include <sys/param.h>
 #include <sys/ioctl.h>
 #include <sys/sockio.h>
-#if defined(__APPLE__)
+#if defined(__APPLE__) || defined(__FreeBSD_kernel__)
 #include <net/ethernet.h>
 #include <net/if_var.h>
 #include <net/if_dl.h>
 #include <netinet/in_var.h>
-#include <ifaddrs.h>
 #endif
+#include <ifaddrs.h>
 #endif
 
 #include "jvm.h"
@@ -1590,7 +1590,11 @@ static int getMacAddress(JNIEnv *env, int sock, const char *ifname,  const struc
      * try the old way.
      */
     memset(&lif, 0, sizeof(lif));
+#if defined(__FreeBSD_kernel__)
+    strcpy(lif.lifr_name, ifname);
+#else
     strlcpy(lif.lifr_name, ifname, sizeof(lif.lifr_name));
+#endif
 
     if (ioctl(sock, SIOCGLIFHWADDR, &lif) != -1) {
         struct sockaddr_dl *sp;
@@ -1675,7 +1679,7 @@ static int getFlags(int sock, const char *ifname) {
 
 
 /** BSD **/
-#ifdef _ALLBSD_SOURCE
+#if defined(_ALLBSD_SOURCE) || defined(__FreeBSD_kernel__)
 /* Open socket for further ioct calls, try v4 socket first and
  * if it falls return v6 socket
  */
@@ -1804,7 +1808,11 @@ static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) {
             continue;
 
         memset(&ifr6, 0, sizeof(ifr6));
+#if defined(__FreeBSD_kernel__)
+        strcpy(ifr6.ifr_name, ifa->ifa_name);
+#else
         strlcpy(ifr6.ifr_name, ifa->ifa_name, sizeof(ifr6.ifr_name));
+#endif
         memcpy(&ifr6.ifr_addr, ifa->ifa_addr, MIN(sizeof(ifr6.ifr_addr), ifa->ifa_addr->sa_len));
 
         if (ioctl(sock, SIOCGIFNETMASK_IN6, (caddr_t)&ifr6) < 0) {
--- openjdk/jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c.orig	2013-05-14 16:34:07.922316686 +0200
+++ openjdk/jdk/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c	2013-05-14 16:35:22.598286385 +0200
@@ -212,7 +212,7 @@
 
     JVM_Close(fd);
     return (jlong) psinfo.pr_size * 1024;
-#elif defined(__linux__)
+#elif defined(__linux__) || defined(__FreeBSD_kernel__)
     FILE *fp;
     unsigned long vsize = 0;