File: erlang.3

package info (click to toggle)
erlang-manpages 1%3A12.b.3-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,188 kB
  • ctags: 2
  • sloc: makefile: 68; perl: 30; sh: 15
file content (5902 lines) | stat: -rw-r--r-- 178,278 bytes parent folder | download
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
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
.TH erlang 3 "kernel  2.12.3" "Ericsson AB" "ERLANG MODULE DEFINITION"
.SH MODULE
erlang \- The Erlang BIFs
.SH DESCRIPTION
.LP
By convention, most built-in functions (BIFs) are seen as being in the module \fIerlang\fR\&. A number of the BIFs are viewed more or less as part of the Erlang programming language and are \fIauto-imported\fR\&. Thus, it is not necessary to specify the module name and both the calls \fIatom_to_list(Erlang)\fR and \fIerlang:atom_to_list(Erlang)\fR are identical\&.
.LP
In the text, auto-imported BIFs are listed without module prefix\&. BIFs listed with module prefix are not auto-imported\&.
.LP
BIFs may fail for a variety of reasons\&. All BIFs fail with reason \fIbadarg\fR if they are called with arguments of an incorrect type\&. The other reasons that may make BIFs fail are described in connection with the description of each individual BIF\&.
.LP
Some BIFs may be used in guard tests, these are marked with "Allowed in guard tests"\&.

.SH DATA TYPES

.nf
ext_binary()
  a binary data object,
  structured according to the Erlang external term format

iodata() = iolist() | binary()

iolist() = [char() | binary() | iolist()]
  a binary is allowed as the tail of the list
.fi
.SH EXPORTS
.LP
.B
abs(Number) -> int() | float()
.br
.RS
.TP
Types
Number = number()
.br
.RE
.RS
.LP
Returns an integer or float which is the arithmetical absolute value of \fINumber\fR\&.

.nf
> abs(-3\&.33)\&.

3\&.33
> abs(-3)\&.

3
.fi
.LP
Allowed in guard tests\&.
.RE
.LP
.B
adler32(Data) -> int()
.br
.RS
.TP
Types
Data = iodata()
.br
.RE
.RS
.LP
Computes and returns the adler32 checksum for \fIData\fR\&.
.RE
.LP
.B
adler32(OldAdler, Data) -> int()
.br
.RS
.TP
Types
OldAdler = int()
.br
Data = iodata()
.br
.RE
.RS
.LP
Continue computing the adler32 checksum by combining the previous checksum, \fIOldAdler\fR, with the checksum of \fIData\fR\&.
.LP
The following code:

.nf
        X = adler32(Data1),
        Y = adler32(X,Data2)\&.
        
.fi
.LP
- would assign the same value to \fIY\fR as this would:

.nf
        Y = adler32([Data1,Data2])\&.
        
.fi
.RE
.LP
.B
adler32_combine(FirstAdler, SecondAdler, SecondSize) -> int()
.br
.RS
.TP
Types
FirstAdler = SecondAdler = int()
.br
SecondSize = int()
.br
.RE
.RS
.LP
Combines two previously computed adler32 checksums\&. This computation requires the size of the data object for the second checksum to be known\&.
.LP
The following code:

.nf
        Y = adler32(Data1),
        Z = adler32(Y,Data2)\&.
        
.fi
.LP
- would assign the same value to \fIZ\fR as this would:

.nf
        X = adler32(Data1),
        Y = adler32(Data2),
        Z = adler32_combine(X,Y,iolist_size(Data2))\&.
        
.fi
.RE
.LP
.B
erlang:append_element(Tuple1, Term) -> Tuple2
.br
.RS
.TP
Types
Tuple1 = Tuple2 = tuple()
.br
Term = term()
.br
.RE
.RS
.LP
Returns a new tuple which has one element more than \fITuple1\fR, and contains the elements in \fITuple1\fR followed by \fITerm\fR as the last element\&. Semantically equivalent to \fIlist_to_tuple(tuple_to_list(Tuple ++ [Term])\fR, but much faster\&.

.nf
> erlang:append_element({one, two}, three)\&.

{one,two,three}
.fi
.RE
.LP
.B
apply(Fun, Args) -> term() | empty()
.br
.RS
.TP
Types
Fun = fun()
.br
Args = [term()]
.br
.RE
.RS
.LP
Call a fun, passing the elements in \fIArgs\fR as arguments\&.
.LP
Note: If the number of elements in the arguments are known at compile-time, the call is better written as \fIFun(Arg1, Arg2, \&.\&.\&. ArgN)\fR\&.
.SS Warning:
.LP
Earlier, \fIFun\fR could also be given as \fI{Module, Function}\fR, equivalent to \fIapply(Module, Function, Args)\fR\&. This usage is deprecated and will stop working in a future release of Erlang/OTP\&.

.RE
.LP
.B
apply(Module, Function, Args) -> term() | empty()
.br
.RS
.TP
Types
Module = Function = atom()
.br
Args = [term()]
.br
.RE
.RS
.LP
Returns the result of applying \fIFunction\fR in \fIModule\fR to \fIArgs\fR\&. The applied function must be exported from \fIModule\fR\&. The arity of the function is the length of \fIArgs\fR\&.

.nf
> apply(lists, reverse, [[a, b, c]])\&.

[c,b,a]
.fi
.LP
\fIapply\fR can be used to evaluate BIFs by using the module name \fIerlang\fR\&.

.nf
> apply(erlang, atom_to_list, [\&'Erlang\&'])\&.

"Erlang"
.fi
.LP
Note: If the number of arguments are known at compile-time, the call is better written as \fIModule:Function(Arg1, Arg2, \&.\&.\&., ArgN)\fR\&.
.LP
Failure: \fIerror_handler:undefined_function/3\fR is called if the applied function is not exported\&. The error handler can be redefined (see process_flag/2)\&. If the \fIerror_handler\fR is undefined, or if the user has redefined the default \fIerror_handler\fR so the replacement module is undefined, an error with the reason \fIundef\fR is generated\&.
.RE
.LP
.B
atom_to_list(Atom) -> string()
.br
.RS
.TP
Types
Atom = atom()
.br
.RE
.RS
.LP
Returns a string which corresponds to the text representation of \fIAtom\fR\&.

.nf
> atom_to_list(\&'Erlang\&')\&.

"Erlang"
.fi
.RE
.LP
.B
binary_to_list(Binary) -> [char()]
.br
.RS
.TP
Types
Binary = binary()
.br
.RE
.RS
.LP
Returns a list of integers which correspond to the bytes of \fIBinary\fR\&.
.RE
.LP
.B
binary_to_list(Binary, Start, Stop) -> [char()]
.br
.RS
.TP
Types
Binary = binary()
.br
Start = Stop = 1\&.\&.byte_size(Binary)
.br
.RE
.RS
.LP
As \fIbinary_to_list/1\fR, but returns a list of integers corresponding to the bytes from position \fIStart\fR to position \fIStop\fR in \fIBinary\fR\&. Positions in the binary are numbered starting from 1\&.
.RE
.LP
.B
bitstring_to_list(Bitstring) -> [char()|bitstring()]
.br
.RS
.TP
Types
Bitstring = bitstring()
.br
.RE
.RS
.LP
Returns a list of integers which correspond to the bytes of \fIBitstring\fR\&. If the number of bits in the binary is not divisible by 8, the last element of the list will be a bitstring containing the remaining bits (1 up to 7 bits)\&.
.RE
.LP
.B
binary_to_term(Binary) -> term()
.br
.RS
.TP
Types
Binary = ext_binary()
.br
.RE
.RS
.LP
Returns an Erlang term which is the result of decoding the binary object \fIBinary\fR, which must be encoded according to the Erlang external term format\&. See also term_to_binary/1\&.
.RE
.LP
.B
bit_size(Bitstring) -> int()
.br
.RS
.TP
Types
Bitstring = bitstring()
.br
.RE
.RS
.LP
Returns an integer which is the size in bits of \fIBitstring\fR\&.

.nf
> bit_size(<<433:16,3:3>>)\&.

19
> bit_size(<<1,2,3>>)\&.

24
.fi
.LP
Allowed in guard tests\&.
.RE
.LP
.B
erlang:bump_reductions(Reductions) -> void()
.br
.RS
.TP
Types
Reductions = int()
.br
.RE
.RS
.LP
This implementation-dependent function increments the reduction counter for the calling process\&. In the Beam emulator, the reduction counter is normally incremented by one for each function and BIF call, and a context switch is forced when the counter reaches 1000\&.
.SS Warning:
.LP
This BIF might be removed in a future version of the Beam machine without prior warning\&. It is unlikely to be implemented in other Erlang implementations\&.

.RE
.LP
.B
byte_size(Bitstring) -> int()
.br
.RS
.TP
Types
Bitstring = bitstring()
.br
.RE
.RS
.LP
Returns an integer which is the number of bytes needed to contain \fIBitstring\fR\&. (That is, if the number of bits in \fIBitstring\fR is not divisible by 8, the resulting number of bytes will be rounded \fIup\fR\&.)

.nf
> byte_size(<<433:16,3:3>>)\&.

3
> byte_size(<<1,2,3>>)\&.

3
.fi
.LP
Allowed in guard tests\&.
.RE
.LP
.B
erlang:cancel_timer(TimerRef) -> Time | false
.br
.RS
.TP
Types
TimerRef = ref()
.br
Time = int()
.br
.RE
.RS
.LP
Cancels a timer, where \fITimerRef\fR was returned by either erlang:send_after/3 or erlang:start_timer/3\&. If the timer is there to be removed, the function returns the time in milliseconds left until the timer would have expired, otherwise \fIfalse\fR (which means that \fITimerRef\fR was never a timer, that it has already been cancelled, or that it has already delivered its message)\&.
.LP
See also erlang:send_after/3, erlang:start_timer/3, and erlang:read_timer/1\&.
.LP
Note: Cancelling a timer does not guarantee that the message has not already been delivered to the message queue\&.
.RE
.LP
.B
check_process_code(Pid, Module) -> bool()
.br
.RS
.TP
Types
Pid = pid()
.br
Module = atom()
.br
.RE
.RS
.LP
Returns \fItrue\fR if the process \fIPid\fR is executing old code for \fIModule\fR\&. That is, if the current call of the process executes old code for this module, or if the process has references to old code for this module, or if the process contains funs that references old code for this module\&. Otherwise, it returns \fIfalse\fR\&.

.nf
> check_process_code(Pid, lists)\&.

false
.fi
.LP
See also code(3)\&.
.RE
.LP
.B
concat_binary(ListOfBinaries)
.br
.RS
.LP
Do not use; use list_to_binary/1 instead\&.
.RE
.LP
.B
crc32(Data) -> int()
.br
.RS
.TP
Types
Data = iodata()
.br
.RE
.RS
.LP
Computes and returns the crc32 (IEEE 802\&.3 style) checksum for \fIData\fR\&.
.RE
.LP
.B
crc32(OldCrc, Data) -> int()
.br
.RS
.TP
Types
OldCrc = int()
.br
Data = iodata()
.br
.RE
.RS
.LP
Continue computing the crc32 checksum by combining the previous checksum, \fIOldCrc\fR, with the checksum of \fIData\fR\&.
.LP
The following code:

.nf
        X = crc32(Data1),
        Y = crc32(X,Data2)\&.
        
.fi
.LP
- would assign the same value to \fIY\fR as this would:

.nf
        Y = crc32([Data1,Data2])\&.
        
.fi
.RE
.LP
.B
crc32_combine(FirstCrc, SecondCrc, SecondSize) -> int()
.br
.RS
.TP
Types
FirstCrc = SecondCrc = int()
.br
SecondSize = int()
.br
.RE
.RS
.LP
Combines two previously computed crc32 checksums\&. This computation requires the size of the data object for the second checksum to be known\&.
.LP
The following code:

.nf
        Y = crc32(Data1),
        Z = crc32(Y,Data2)\&.
        
.fi
.LP
- would assign the same value to \fIZ\fR as this would:

.nf
        X = crc32(Data1),
        Y = crc32(Data2),
        Z = crc32_combine(X,Y,iolist_size(Data2))\&.
        
.fi
.RE
.LP
.B
date() -> {Year, Month, Day}
.br
.RS
.TP
Types
Year = Month = Day = int()
.br
.RE
.RS
.LP
Returns the current date as \fI{Year, Month, Day}\fR\&.
.LP
The time zone and daylight saving time correction depend on the underlying OS\&.

.nf
> date()\&.

{1995,2,19}
.fi
.RE
.LP
.B
delete_module(Module) -> true | undefined
.br
.RS
.TP
Types
Module = atom()
.br
.RE
.RS
.LP
Makes the current code for \fIModule\fR become old code, and deletes all references for this module from the export table\&. Returns \fIundefined\fR if the module does not exist, otherwise \fItrue\fR\&.
.SS Warning:
.LP
This BIF is intended for the code server (see code(3)) and should not be used elsewhere\&.

.LP
Failure: \fIbadarg\fR if there is already an old version of \fIModule\fR\&.
.RE
.LP
.B
erlang:demonitor(MonitorRef) -> true
.br
.RS
.TP
Types
MonitorRef = ref()
.br
.RE
.RS
.LP
If \fIMonitorRef\fR is a reference which the calling process obtained by calling erlang:monitor/2, this monitoring is turned off\&. If the monitoring is already turned off, nothing happens\&.
.LP
Once \fIerlang:demonitor(MonitorRef)\fR has returned it is guaranteed that no \fI{\&'DOWN\&', MonitorRef, _, _, _}\fR message due to the monitor will be placed in the callers message queue in the future\&. A \fI{\&'DOWN\&', MonitorRef, _, _, _}\fR message might have been placed in the callers message queue prior to the call, though\&. Therefore, in most cases, it is advisable to remove such a \fI\&'DOWN\&'\fR message from the message queue after monitoring has been stopped\&. erlang:demonitor(MonitorRef, [flush]) can be used instead of \fIerlang:demonitor(MonitorRef)\fR if this cleanup is wanted\&.
.SS Note:
.LP
Prior to OTP release R11B (erts version 5\&.5) \fIerlang:demonitor/1\fR behaved completely asynchronous, i\&.e\&., the monitor was active until the "demonitor signal" reached the monitored entity\&. This had one undesirable effect, though\&. You could never know when you were guaranteed \fInot\fR to receive a \fIDOWN\fR message due to the monitor\&.
.LP
Current behavior can be viewed as two combined operations: asynchronously send a "demonitor signal" to the monitored entity and ignore any future results of the monitor\&. 

.LP
Failure: It is an error if \fIMonitorRef\fR refers to a monitoring started by another process\&. Not all such cases are cheap to check; if checking is cheap, the call fails with \fIbadarg\fR (for example if \fIMonitorRef\fR is a remote reference)\&.
.RE
.LP
.B
erlang:demonitor(MonitorRef, OptionList) -> true
.br
.RS
.TP
Types
MonitorRef = ref()
.br
OptionList = [Option]
.br
Option = flush
.br
.RE
.RS
.LP
\fIerlang:demonitor(MonitorRef, [])\fR is equivalent to erlang:demonitor(MonitorRef)\&.
.LP
Currently the following \fIOption\fRs are valid:
.RS 2
.TP 4
.B
\fIflush\fR:
Remove (one) \fI{_, MonitorRef, _, _, _}\fR message, if there is one, from the callers message queue after monitoring has been stopped\&.
.RS 4
.LP

.LP
Calling \fIerlang:demonitor(MonitorRef, [flush])\fR is equivalent to:
.LP


.nf

    erlang:demonitor(MonitorRef),
    receive
        {_, MonitorRef, _, _, _} ->
            true
    after 0 ->
            true
    end
.fi
.RE
.RE
.SS Note:
.LP
More options may be added in the future\&.

.LP
Failure: \fIbadarg\fR if \fIOptionList\fR is not a list, or if \fIOption\fR is not a valid option, or the same failure as for erlang:demonitor/1
.RE
.LP
.B
disconnect_node(Node) -> bool() | ignored
.br
.RS
.TP
Types
Node = atom()
.br
.RE
.RS
.LP
Forces the disconnection of a node\&. This will appear to the node \fINode\fR as if the local node has crashed\&. This BIF is mainly used in the Erlang network authentication protocols\&. Returns \fItrue\fR if disconnection succeeds, otherwise \fIfalse\fR\&. If the local node is not alive, the function returns \fIignored\fR\&.
.RE
.LP
.B
erlang:display(Term) -> true
.br
.RS
.TP
Types
Term = term()
.br
.RE
.RS
.LP
Prints a text representation of \fITerm\fR on the standard output\&.
.SS Warning:
.LP
This BIF is intended for debugging only\&.

.RE
.LP
.B
element(N, Tuple) -> term()
.br
.RS
.TP
Types
N = 1\&.\&.tuple_size(Tuple)
.br
Tuple = tuple()
.br
.RE
.RS
.LP
Returns the \fIN\fRth element (numbering from 1) of \fITuple\fR\&.

.nf
> element(2, {a, b, c})\&.

b
.fi
.LP
Allowed in guard tests\&.
.RE
.LP
.B
erase() -> [{Key, Val}]
.br
.RS
.TP
Types
Key = Val = term()
.br
.RE
.RS
.LP
Returns the process dictionary and deletes it\&.

.nf
> put(key1, {1, 2, 3}),

put(key2, [a, b, c]),

erase()\&.

[{key1,{1,2,3}},{key2,[a,b,c]}]
.fi
.RE
.LP
.B
erase(Key) -> Val | undefined
.br
.RS
.TP
Types
Key = Val = term()
.br
.RE
.RS
.LP
Returns the value \fIVal\fR associated with \fIKey\fR and deletes it from the process dictionary\&. Returns \fIundefined\fR if no value is associated with \fIKey\fR\&.

.nf
> put(key1, {merry, lambs, are, playing}),

X = erase(key1),

{X, erase(key1)}\&.

{{merry,lambs,are,playing},undefined}
.fi
.RE
.LP
.B
erlang:error(Reason)
.br
.RS
.TP
Types
Reason = term()
.br
.RE
.RS
.LP
Stops the execution of the calling process with the reason \fIReason\fR, where \fIReason\fR is any term\&. The actual exit reason will be \fI{Reason, Where}\fR, where \fIWhere\fR is a list of the functions most recently called (the current function first)\&. Since evaluating this function causes the process to terminate, it has no return value\&.

.nf
> catch erlang:error(foobar)\&.

{\&'EXIT\&',{foobar,[{erl_eval,do_apply,5},
                 {erl_eval,expr,5},
                 {shell,exprs,6},
                 {shell,eval_exprs,6},
                 {shell,eval_loop,3}]}}
.fi
.RE
.LP
.B
erlang:error(Reason, Args)
.br
.RS
.TP
Types
Reason = term()
.br
Args = [term()]
.br
.RE
.RS
.LP
Stops the execution of the calling process with the reason \fIReason\fR, where \fIReason\fR is any term\&. The actual exit reason will be \fI{Reason, Where}\fR, where \fIWhere\fR is a list of the functions most recently called (the current function first)\&. \fIArgs\fR is expected to be the list of arguments for the current function; in Beam it will be used to provide the actual arguments for the current function in the \fIWhere\fR term\&. Since evaluating this function causes the process to terminate, it has no return value\&.
.RE
.LP
.B
exit(Reason)
.br
.RS
.TP
Types
Reason = term()
.br
.RE
.RS
.LP
Stops the execution of the calling process with the exit reason \fIReason\fR, where \fIReason\fR is any term\&. Since evaluating this function causes the process to terminate, it has no return value\&.

.nf
> exit(foobar)\&.

** exception exit: foobar
> catch exit(foobar)\&.

{\&'EXIT\&',foobar}
.fi
.RE
.LP
.B
exit(Pid, Reason) -> true
.br
.RS
.TP
Types
Pid = pid()
.br
Reason = term()
.br
.RE
.RS
.LP
Sends an exit signal with exit reason \fIReason\fR to the process \fIPid\fR\&.
.LP
The following behavior apply if \fIReason\fR is any term except \fInormal\fR or \fIkill\fR:
.LP
If \fIPid\fR is not trapping exits, \fIPid\fR itself will exit with exit reason \fIReason\fR\&. If \fIPid\fR is trapping exits, the exit signal is transformed into a message \fI{\&'EXIT\&', From, Reason}\fR and delivered to the message queue of \fIPid\fR\&. \fIFrom\fR is the pid of the process which sent the exit signal\&. See also process_flag/2\&.
.LP
If \fIReason\fR is the atom \fInormal\fR, \fIPid\fR will not exit\&. If it is trapping exits, the exit signal is transformed into a message \fI{\&'EXIT\&', From, normal}\fR and delivered to its message queue\&.
.LP
If \fIReason\fR is the atom \fIkill\fR, that is if \fIexit(Pid, kill)\fR is called, an untrappable exit signal is sent to \fIPid\fR which will unconditionally exit with exit reason \fIkilled\fR\&.
.RE
.LP
.B
erlang:fault(Reason)
.br
.RS
.TP
Types
Reason = term()
.br
.RE
.RS
.LP
This function is deprecated and will be removed in the next release\&. Used erlang:error(Reason) instead\&.
.RE
.LP
.B
erlang:fault(Reason, Args)
.br
.RS
.TP
Types
Reason = term()
.br
Args = [term()]
.br
.RE
.RS
.LP
This function is deprecated and will be removed in the next release\&. Use erlang:error(Reason, Args) instead\&.
.RE
.LP
.B
float(Number) -> float()
.br
.RS
.TP
Types
Number = number()
.br
.RE
.RS
.LP
Returns a float by converting \fINumber\fR to a float\&.

.nf
> float(55)\&.

55\&.0
.fi
.LP
Allowed in guard tests\&.
.SS Note:
.LP
Note that if used on the top-level in a guard, it will test whether the argument is a floating point number; for clarity, use is_float/1 instead\&.
.LP
When \fIfloat/1\fR is used in an expression in a guard, such as \&'\fIfloat(A) == 4\&.0\fR\&', it converts a number as described above\&.

.RE
.LP
.B
float_to_list(Float) -> string()
.br
.RS
.TP
Types
Float = float()
.br
.RE
.RS
.LP
Returns a string which corresponds to the text representation of \fIFloat\fR\&.

.nf
> float_to_list(7\&.0)\&.

"7\&.00000000000000000000e+00"
.fi
.RE
.LP
.B
erlang:fun_info(Fun) -> [{Item, Info}]
.br
.RS
.TP
Types
Fun = fun()
.br
Item, Info -- see below
.br
.RE
.RS
.LP
Returns a list containing information about the fun \fIFun\fR\&. Each element of the list is a tuple\&. The order of the tuples is not defined, and more tuples may be added in a future release\&.
.SS Warning:
.LP
This BIF is mainly intended for debugging, but it can occasionally be useful in library functions that might need to verify, for instance, the arity of a fun\&.

.LP
There are two types of funs with slightly different semantics:
.LP
A fun created by \fIfun M:F/A\fR is called an \fIexternal\fR fun\&. Calling it will always call the function \fIF\fR with arity \fIA\fR in the latest code for module \fIM\fR\&. Note that module \fIM\fR does not even need to be loaded when the fun \fIfun M:F/A\fR is created\&.
.LP
All other funs are called \fIlocal\fR\&. When a local fun is called, the same version of the code that created the fun will be called (even if newer version of the module has been loaded)\&.
.LP
The following elements will always be present in the list for both local and external funs:
.RS 2
.TP 4
.B
\fI{type, Type}\fR:
\fIType\fR is either \fIlocal\fR or \fIexternal\fR\&.
.TP 4
.B
\fI{module, Module}\fR:
\fIModule\fR (an atom) is the module name\&.
.RS 4
.LP

.LP
If \fIFun\fR is a local fun, \fIModule\fR is the module in which the fun is defined\&.
.LP

.LP
If \fIFun\fR is an external fun, \fIModule\fR is the module that the fun refers to\&.
.RE
.TP 4
.B
\fI{name, Name}\fR:
\fIName\fR (an atom) is a function name\&.
.RS 4
.LP

.LP
If \fIFun\fR is a local fun, \fIName\fR is the name of the local function that implements the fun\&. (This name was generated by the compiler, and is generally only of informational use\&. As it is a local function, it is not possible to call it directly\&.) If no code is currently loaded for the fun, \fI[]\fR will be returned instead of an atom\&.
.LP

.LP
If \fIFun\fR is an external fun, \fIName\fR is the name of the exported function that the fun refers to\&.
.RE
.TP 4
.B
\fI{arity, Arity}\fR:
\fIArity\fR is the number of arguments that the fun should be called with\&.
.TP 4
.B
\fI{env, Env}\fR:
\fIEnv\fR (a list) is the environment or free variables for the fun\&. (For external funs, the returned list is always empty\&.)
.RE
.LP
The following elements will only be present in the list if \fIFun\fR is local:
.RS 2
.TP 4
.B
\fI{pid, Pid}\fR:
\fIPid\fR is the pid of the process that originally created the fun\&.
.TP 4
.B
\fI{index, Index}\fR:
\fIIndex\fR (an integer) is an index into the module\&'s fun table\&.
.TP 4
.B
\fI{new_index, Index}\fR:
\fIIndex\fR (an integer) is an index into the module\&'s fun table\&.
.TP 4
.B
\fI{new_uniq, Uniq}\fR:
\fIUniq\fR (a binary) is a unique value for this fun\&.
.TP 4
.B
\fI{uniq, Uniq}\fR:
\fIUniq\fR (an integer) is a unique value for this fun\&.
.RE
.RE
.LP
.B
erlang:fun_info(Fun, Item) -> {Item, Info}
.br
.RS
.TP
Types
Fun = fun()
.br
Item, Info -- see below
.br
.RE
.RS
.LP
Returns information about \fIFun\fR as specified by \fIItem\fR, in the form \fI{Item, Info}\fR\&.
.LP
For any fun, \fIItem\fR can be any of the atoms \fImodule\fR, \fIname\fR, \fIarity\fR, or \fIenv\fR\&.
.LP
For a local fun, \fIItem\fR can also be any of the atoms \fIindex\fR, \fInew_index\fR, \fInew_uniq\fR, \fIuniq\fR, and \fIpid\fR\&. For an external fun, the value of any of these items is always the atom \fIundefined\fR\&.
.LP
See erlang:fun_info/1\&.
.RE
.LP
.B
erlang:fun_to_list(Fun) -> string()
.br
.RS
.TP
Types
Fun = fun()
.br
.RE
.RS
.LP
Returns a string which corresponds to the text representation of \fIFun\fR\&.
.RE
.LP
.B
erlang:function_exported(Module, Function, Arity) -> bool()
.br
.RS
.TP
Types
Module = Function = atom()
.br
Arity = int()
.br
.RE
.RS
.LP
Returns \fItrue\fR if the module \fIModule\fR is loaded and contains an exported function \fIFunction/Arity\fR; otherwise \fIfalse\fR\&.
.LP
Returns \fIfalse\fR for any BIF (functions implemented in C rather than in Erlang)\&.
.RE
.LP
.B
garbage_collect() -> true
.br
.RS
.LP
Forces an immediate garbage collection of the currently executing process\&. The function should not be used, unless it has been noticed -- or there are good reasons to suspect -- that the spontaneous garbage collection will occur too late or not at all\&. Improper use may seriously degrade system performance\&.
.LP
Compatibility note: In versions of OTP prior to R7, the garbage collection took place at the next context switch, not immediately\&. To force a context switch after a call to \fIerlang:garbage_collect()\fR, it was sufficient to make any function call\&.
.RE
.LP
.B
garbage_collect(Pid) -> bool()
.br
.RS
.TP
Types
Pid = pid()
.br
.RE
.RS
.LP
Works like \fIerlang:garbage_collect()\fR but on any process\&. The same caveats apply\&. Returns \fIfalse\fR if \fIPid\fR refers to a dead process; \fItrue\fR otherwise\&.
.RE
.LP
.B
get() -> [{Key, Val}]
.br
.RS
.TP
Types
Key = Val = term()
.br
.RE
.RS
.LP
Returns the process dictionary as a list of \fI{Key, Val}\fR tuples\&.

.nf
> put(key1, merry),

put(key2, lambs),

put(key3, {are, playing}),

get()\&.

[{key1,merry},{key2,lambs},{key3,{are,playing}}]
.fi
.RE
.LP
.B
get(Key) -> Val | undefined
.br
.RS
.TP
Types
Key = Val = term()
.br
.RE
.RS
.LP
Returns the value \fIVal\fRassociated with \fIKey\fR in the process dictionary, or \fIundefined\fR if \fIKey\fR does not exist\&.

.nf
> put(key1, merry),

put(key2, lambs),

put({any, [valid, term]}, {are, playing}),

get({any, [valid, term]})\&.

{are,playing}
.fi
.RE
.LP
.B
erlang:get_cookie() -> Cookie | nocookie
.br
.RS
.TP
Types
Cookie = atom()
.br
.RE
.RS
.LP
Returns the magic cookie of the local node, if the node is alive; otherwise the atom \fInocookie\fR\&.
.RE
.LP
.B
get_keys(Val) -> [Key]
.br
.RS
.TP
Types
Val = Key = term()
.br
.RE
.RS
.LP
Returns a list of keys which are associated with the value \fIVal\fR in the process dictionary\&.

.nf
> put(mary, {1, 2}),

put(had, {1, 2}),

put(a, {1, 2}),

put(little, {1, 2}),

put(dog, {1, 3}),

put(lamb, {1, 2}),

get_keys({1, 2})\&.

[mary,had,a,little,lamb]
.fi
.RE
.LP
.B
erlang:get_stacktrace() -> [{Module, Function, Arity | Args}]
.br
.RS
.TP
Types
Module = Function = atom()
.br
Arity = int()
.br
Args = [term()]
.br
.RE
.RS
.LP
Get the call stack back-trace (\fIstacktrace\fR) of the last exception in the calling process as a list of \fI{Module, Function, Arity}\fR tuples\&. The \fIArity\fR field in the first tuple may be the argument list of that function call instead of an arity integer, depending on the exception\&.
.LP
If there has not been any exceptions in a process, the stacktrace is []\&. After a code change for the process, the stacktrace may also be reset to []\&.
.LP
The stacktrace is the same data as the \fIcatch\fR operator returns, for example:
.LP
\fI{\&'EXIT\&', {badarg, Stacktrace}} = catch abs(x)\fR
.LP
See also erlang:error/1 and erlang:error/2\&.
.RE
.LP
.B
group_leader() -> GroupLeader
.br
.RS
.TP
Types
GroupLeader = pid()
.br
.RE
.RS
.LP
Returns the pid of the group leader for the process which evaluates the function\&.
.LP
Every process is a member of some process group and all groups have a \fIgroup leader\fR\&. All IO from the group is channeled to the group leader\&. When a new process is spawned, it gets the same group leader as the spawning process\&. Initially, at system start-up, \fIinit\fR is both its own group leader and the group leader of all processes\&.
.RE
.LP
.B
group_leader(GroupLeader, Pid) -> true
.br
.RS
.TP
Types
GroupLeader = Pid = pid()
.br
.RE
.RS
.LP
Sets the group leader of \fIPid\fR to \fIGroupLeader\fR\&. Typically, this is used when a processes started from a certain shell should have another group leader than \fIinit\fR\&.
.LP
See also group_leader/0\&.
.RE
.LP
.B
halt()
.br
.RS
.LP
Halts the Erlang runtime system and indicates normal exit to the calling environment\&. Has no return value\&.

.nf
> halt()\&.

os_prompt%
.fi
.RE
.LP
.B
halt(Status)
.br
.RS
.TP
Types
Status = int()>=0 | string()
.br
.RE
.RS
.LP
\fIStatus\fR must be a non-negative integer, or a string\&. Halts the Erlang runtime system\&. Has no return value\&. If \fIStatus\fR is an integer, it is returned as an exit status of Erlang to the calling environment\&. If \fIStatus\fR is a string, produces an Erlang crash dump with \fIString\fR as slogan, and then exits with a non-zero status code\&.
.LP
Note that on many platforms, only the status codes 0-255 are supported by the operating system\&.
.RE
.LP
.B
erlang:hash(Term, Range) -> Hash
.br
.RS
.LP
Returns a hash value for \fITerm\fR within the range \fI1\&.\&.Range\fR\&. The allowed range is 1\&.\&.2^27-1\&.
.SS Warning:
.LP
This BIF is deprecated as the hash value may differ on different architectures\&. Also the hash values for integer terms larger than 2^27 as well as large binaries are very poor\&. The BIF is retained for backward compatibility reasons (it may have been used to hash records into a file), but all new code should use one of the BIFs \fIerlang:phash/2\fR or \fIerlang:phash2/1, 2\fR instead\&.

.RE
.LP
.B
hd(List) -> term()
.br
.RS
.TP
Types
List = [term()]
.br
.RE
.RS
.LP
Returns the head of \fIList\fR, that is, the first element\&.

.nf
> hd([1,2,3,4,5])\&.

1
.fi
.LP
Allowed in guard tests\&.
.LP
Failure: \fIbadarg\fR if \fIList\fR is the empty list []\&.
.RE
.LP
.B
erlang:hibernate(Module, Function, Args)
.br
.RS
.TP
Types
Module = Function = atom()
.br
Args = [term()]
.br
.RE
.RS
.LP
Puts the calling process into a wait state where its memory allocation has been reduced as much as possible, which is useful if the process does not expect to receive any messages in the near future\&.
.LP
The process will be awaken when a message is sent to it, and control will resume in \fIModule:Function\fR with the arguments given by \fIArgs\fR with the call stack emptied, meaning that the process will terminate when that function returns\&. Thus \fIerlang:hibernate/3\fR will never return to its caller\&.
.LP
If the process has any message in its message queue, the process will be awaken immediately in the same way as described above\&.
.LP
In more technical terms, what \fIerlang:hibernate/3\fR does is the following\&. It discards the call stack for the process\&. Then it garbage collects the process\&. After the garbage collection, all live data is in one continuous heap\&. The heap is then shrunken to the exact same size as the live data which it holds (even if that size is less than the minimum heap size for the process)\&.
.LP
If the size of the live data in the process is less than the minimum heap size, the first garbage collection occurring after the process has been awaken will ensure that the heap size is changed to a size not smaller than the minimum heap size\&.
.LP
Note that emptying the call stack means that any surrounding \fIcatch\fR is removed and has to be re-inserted after hibernation\&. One effect of this is that processes started using \fIproc_lib\fR (also indirectly, such as \fIgen_server\fR processes), should use proc_lib:hibernate/3 instead to ensure that the exception handler continues to work when the process wakes up\&.
.RE
.LP
.B
integer_to_list(Integer) -> string()
.br
.RS
.TP
Types
Integer = int()
.br
.RE
.RS
.LP
Returns a string which corresponds to the text representation of \fIInteger\fR\&.

.nf
> integer_to_list(77)\&.

"77"
.fi
.RE
.LP
.B
erlang:integer_to_list(Integer, Base) -> string()
.br
.RS
.TP
Types
Integer = int()
.br
Base = 2\&.\&.36
.br
.RE
.RS
.LP
Returns a string which corresponds to the text representation of \fIInteger\fR in base \fIBase\fR\&.

.nf
> erlang:integer_to_list(1023, 16)\&.

"3FF"
.fi
.RE
.LP
.B
iolist_to_binary(IoListOrBinary) -> binary()
.br
.RS
.TP
Types
IoListOrBinary = iolist() | binary()
.br
.RE
.RS
.LP
Returns a binary which is made from the integers and binaries in \fIIoListOrBinary\fR\&.

.nf
> Bin1 = <<1,2,3>>\&.

<<1,2,3>>
> Bin2 = <<4,5>>\&.

<<4,5>>
> Bin3 = <<6>>\&.

<<6>>
> iolist_to_binary([Bin1,1,[2,3,Bin2],4|Bin3])\&.

<<1,2,3,1,2,3,4,5,4,6>>
.fi
.RE
.LP
.B
iolist_size(Item) -> int()
.br
.RS
.TP
Types
Item = iolist() | binary()
.br
.RE
.RS
.LP
Returns an integer which is the size in bytes of the binary that would be the result of \fIiolist_to_binary(Item)\fR\&.

.nf
> iolist_size([1,2|<<3,4>>])\&.

4
.fi
.RE
.LP
.B
is_alive() -> bool()
.br
.RS
.LP
Returns \fItrue\fR if the local node is alive; that is, if the node can be part of a distributed system\&. Otherwise, it returns \fIfalse\fR\&.
.RE
.LP
.B
is_atom(Term) -> bool()
.br
.RS
.TP
Types
Term = term()
.br
.RE
.RS
.LP
Returns \fItrue\fR if \fITerm\fR is an atom; otherwise returns \fIfalse\fR\&.
.LP
Allowed in guard tests\&.
.RE
.LP
.B
is_binary(Term) -> bool()
.br
.RS
.TP
Types
Term = term()
.br
.RE
.RS
.LP
Returns \fItrue\fR if \fITerm\fR is a binary; otherwise returns \fIfalse\fR\&.
.LP
A binary always contains a complete number of bytes\&.
.LP
Allowed in guard tests\&.
.RE
.LP
.B
is_bitstring(Term) -> bool()
.br
.RS
.TP
Types
Term = term()
.br
.RE
.RS
.LP
Returns \fItrue\fR if \fITerm\fR is a bitstring (including a binary); otherwise returns \fIfalse\fR\&.
.LP
Allowed in guard tests\&.
.RE
.LP
.B
is_boolean(Term) -> bool()
.br
.RS
.TP
Types
Term = term()
.br
.RE
.RS
.LP
Returns \fItrue\fR if \fITerm\fR is either the atom \fItrue\fR or the atom \fIfalse\fR (i\&.e\&. a boolean); otherwise returns \fIfalse\fR\&.
.LP
Allowed in guard tests\&.
.RE
.LP
.B
erlang:is_builtin(Module, Function, Arity) -> bool()
.br
.RS
.TP
Types
Module = Function = atom()
.br
Arity = int()
.br
.RE
.RS
.LP
Returns \fItrue\fR if \fIModule:Function/Arity\fR is a BIF implemented in C; otherwise returns \fIfalse\fR\&. This BIF is useful for builders of cross reference tools\&.
.RE
.LP
.B
is_float(Term) -> bool()
.br
.RS
.TP
Types
Term = term()
.br
.RE
.RS
.LP
Returns \fItrue\fR if \fITerm\fR is a floating point number; otherwise returns \fIfalse\fR\&.
.LP
Allowed in guard tests\&.
.RE
.LP
.B
is_function(Term) -> bool()
.br
.RS
.TP
Types
Term = term()
.br
.RE
.RS
.LP
Returns \fItrue\fR if \fITerm\fR is a fun; otherwise returns \fIfalse\fR\&.
.LP
Allowed in guard tests\&.
.RE
.LP
.B
is_function(Term, Arity) -> bool()
.br
.RS
.TP
Types
Term = term()
.br
Arity = int()
.br
.RE
.RS
.LP
Returns \fItrue\fR if \fITerm\fR is a fun that can be applied with \fIArity\fR number of arguments; otherwise returns \fIfalse\fR\&.
.LP
Allowed in guard tests\&.
.SS Warning:
.LP
Currently, \fIis_function/2\fR will also return \fItrue\fR if the first argument is a tuple fun (a tuple containing two atoms)\&. In a future release, tuple funs will no longer be supported and \fIis_function/2\fR will return \fIfalse\fR if given a tuple fun\&.

.RE
.LP
.B
is_integer(Term) -> bool()
.br
.RS
.TP
Types
Term = term()
.br
.RE
.RS
.LP
Returns \fItrue\fR if \fITerm\fR is an integer; otherwise returns \fIfalse\fR\&.
.LP
Allowed in guard tests\&.
.RE
.LP
.B
is_list(Term) -> bool()
.br
.RS
.TP
Types
Term = term()
.br
.RE
.RS
.LP
Returns \fItrue\fR if \fITerm\fR is a list with zero or more elements; otherwise returns \fIfalse\fR\&.
.LP
Allowed in guard tests\&.
.RE
.LP
.B
is_number(Term) -> bool()
.br
.RS
.TP
Types
Term = term()
.br
.RE
.RS
.LP
Returns \fItrue\fR if \fITerm\fR is either an integer or a floating point number; otherwise returns \fIfalse\fR\&.
.LP
Allowed in guard tests\&.
.RE
.LP
.B
is_pid(Term) -> bool()
.br
.RS
.TP
Types
Term = term()
.br
.RE
.RS
.LP
Returns \fItrue\fR if \fITerm\fR is a pid (process identifier); otherwise returns \fIfalse\fR\&.
.LP
Allowed in guard tests\&.
.RE
.LP
.B
is_port(Term) -> bool()
.br
.RS
.TP
Types
Term = term()
.br
.RE
.RS
.LP
Returns \fItrue\fR if \fITerm\fR is a port identifier; otherwise returns \fIfalse\fR\&.
.LP
Allowed in guard tests\&.
.RE
.LP
.B
is_process_alive(Pid) -> bool()
.br
.RS
.TP
Types
Pid = pid()
.br
.RE
.RS
.LP
\fIPid\fR must refer to a process at the local node\&. Returns \fItrue\fR if the process exists and is alive, that is, is not exiting and has not exited\&. Otherwise, returns \fIfalse\fR\&. 
.RE
.LP
.B
is_record(Term, RecordTag) -> bool()
.br
.RS
.TP
Types
Term = term()
.br
RecordTag = atom()
.br
.RE
.RS
.LP
Returns \fItrue\fR if \fITerm\fR is a tuple and its first element is \fIRecordTag\fR\&. Otherwise, returns \fIfalse\fR\&.
.SS Note:
.LP
Normally the compiler treats calls to \fIis_record/2\fR specially\&. It emits code to verify that \fITerm\fR is a tuple, that its first element is \fIRecordTag\fR, and that the size is correct\&. However, if the \fIRecordTag\fR is not a literal atom, the \fIis_record/2\fR BIF will be called instead and the size of the tuple will not be verified\&.

.LP
Allowed in guard tests, if \fIRecordTag\fR is a literal atom\&.
.RE
.LP
.B
is_record(Term, RecordTag, Size) -> bool()
.br
.RS
.TP
Types
Term = term()
.br
RecordTag = atom()
.br
Size = int()
.br
.RE
.RS
.LP
\fIRecordTag\fR must be an atom\&. Returns \fItrue\fR if \fITerm\fR is a tuple, its first element is \fIRecordTag\fR, and its size is \fISize\fR\&. Otherwise, returns \fIfalse\fR\&.
.LP
Allowed in guard tests, provided that \fIRecordTag\fR is a literal atom and \fISize\fR is a literal integer\&.
.SS Note:
.LP
This BIF is documented for completeness\&. In most cases \fIis_record/2\fR should be used\&.

.RE
.LP
.B
is_reference(Term) -> bool()
.br
.RS
.TP
Types
Term = term()
.br
.RE
.RS
.LP
Returns \fItrue\fR if \fITerm\fR is a reference; otherwise returns \fIfalse\fR\&.
.LP
Allowed in guard tests\&.
.RE
.LP
.B
is_tuple(Term) -> bool()
.br
.RS
.TP
Types
Term = term()
.br
.RE
.RS
.LP
Returns \fItrue\fR if \fITerm\fR is a tuple; otherwise returns \fIfalse\fR\&.
.LP
Allowed in guard tests\&.
.RE
.LP
.B
length(List) -> int()
.br
.RS
.TP
Types
List = [term()]
.br
.RE
.RS
.LP
Returns the length of \fIList\fR\&.

.nf
> length([1,2,3,4,5,6,7,8,9])\&.

9
.fi
.LP
Allowed in guard tests\&.
.RE
.LP
.B
link(Pid) -> true
.br
.RS
.TP
Types
Pid = pid() | port()
.br
.RE
.RS
.LP
Creates a link between the calling process and another process (or port) \fIPid\fR, if there is not such a link already\&. If a process attempts to create a link to itself, nothing is done\&. Returns \fItrue\fR\&.
.LP
If \fIPid\fR does not exist, the behavior of the BIF depends on if the calling process is trapping exits or not (see process_flag/2):
.RS 2
.TP 2
*
If the calling process is not trapping exits, and checking \fIPid\fR is cheap -- that is, if \fIPid\fR is local -- \fIlink/1\fR fails with reason \fInoproc\fR\&.
.TP 2
*
Otherwise, if the calling process is trapping exits, and/or \fIPid\fR is remote, \fIlink/1\fR returns \fItrue\fR, but an exit signal with reason \fInoproc\fR is sent to the calling process\&.
.RE
.RE
.LP
.B
list_to_atom(String) -> atom()
.br
.RS
.TP
Types
String = string()
.br
.RE
.RS
.LP
Returns the atom whose text representation is \fIString\fR\&.

.nf
> list_to_atom("Erlang")\&.

\&'Erlang\&'
.fi
.RE
.LP
.B
list_to_binary(IoList) -> binary()
.br
.RS
.TP
Types
IoList = iolist()
.br
.RE
.RS
.LP
Returns a binary which is made from the integers and binaries in \fIIoList\fR\&.

.nf
> Bin1 = <<1,2,3>>\&.

<<1,2,3>>
> Bin2 = <<4,5>>\&.

<<4,5>>
> Bin3 = <<6>>\&.

<<6>>
> list_to_binary([Bin1,1,[2,3,Bin2],4|Bin3])\&.

<<1,2,3,1,2,3,4,5,4,6>>
.fi
.RE
.LP
.B
list_to_bitstring(BitstringList) -> bitstring()
.br
.RS
.TP
Types
BitstringList = [BitstringList | bitstring() | char()]
.br
.RE
.RS
.LP
Returns a bitstring which is made from the integers and bitstrings in \fIBitstringList\fR\&. (The last tail in \fIBitstringList\fR is allowed to be a bitstring\&.)

.nf
> Bin1 = <<1,2,3>>\&.

<<1,2,3>>
> Bin2 = <<4,5>>\&.

<<4,5>>
> Bin3 = <<6,7:4,>>\&.

<<6>>
> list_to_binary([Bin1,1,[2,3,Bin2],4|Bin3])\&.

<<1,2,3,1,2,3,4,5,4,6,7:46>>
.fi
.RE
.LP
.B
list_to_existing_atom(String) -> atom()
.br
.RS
.TP
Types
String = string()
.br
.RE
.RS
.LP
Returns the atom whose text representation is \fIString\fR, but only if there already exists such atom\&.
.LP
Failure: \fIbadarg\fR if there does not already exist an atom whose text representation is \fIString\fR\&.
.RE
.LP
.B
list_to_float(String) -> float()
.br
.RS
.TP
Types
String = string()
.br
.RE
.RS
.LP
Returns the float whose text representation is \fIString\fR\&.

.nf
> list_to_float("2\&.2017764e+0")\&.

2\&.2017764
.fi
.LP
Failure: \fIbadarg\fR if \fIString\fR contains a bad representation of a float\&.
.RE
.LP
.B
list_to_integer(String) -> int()
.br
.RS
.TP
Types
String = string()
.br
.RE
.RS
.LP
Returns an integer whose text representation is \fIString\fR\&.

.nf
> list_to_integer("123")\&.

123
.fi
.LP
Failure: \fIbadarg\fR if \fIString\fR contains a bad representation of an integer\&.
.RE
.LP
.B
erlang:list_to_integer(String, Base) -> int()
.br
.RS
.TP
Types
String = string()
.br
Base = 2\&.\&.36
.br
.RE
.RS
.LP
Returns an integer whose text representation in base \fIBase\fR is \fIString\fR\&.

.nf
> erlang:list_to_integer("3FF", 16)\&.

1023
.fi
.LP
Failure: \fIbadarg\fR if \fIString\fR contains a bad representation of an integer\&.
.RE
.LP
.B
list_to_pid(String) -> pid()
.br
.RS
.TP
Types
String = string()
.br
.RE
.RS
.LP
Returns a pid whose text representation is \fIString\fR\&.
.SS Warning:
.LP
This BIF is intended for debugging and for use in the Erlang operating system\&. It should not be used in application programs\&.


.nf
> list_to_pid("<0\&.4\&.1>")\&.

<0\&.4\&.1>
.fi
.LP
Failure: \fIbadarg\fR if \fIString\fR contains a bad representation of a pid\&.
.RE
.LP
.B
list_to_tuple(List) -> tuple()
.br
.RS
.TP
Types
List = [term()]
.br
.RE
.RS
.LP
Returns a tuple which corresponds to \fIList\fR\&. \fIList\fR can contain any Erlang terms\&.

.nf
> list_to_tuple([share, [\&'Ericsson_B\&', 163]])\&.

{share, [\&'Ericsson_B\&', 163]}
.fi
.RE
.LP
.B
load_module(Module, Binary) -> {module, Module} | {error, Reason}
.br
.RS
.TP
Types
Module = atom()
.br
Binary = binary()
.br
Reason = badfile | not_purged | badfile
.br
.RE
.RS
.LP
If \fIBinary\fR contains the object code for the module \fIModule\fR, this BIF loads that object code\&. Also, if the code for the module \fIModule\fR already exists, all export references are replaced so they point to the newly loaded code\&. The previously loaded code is kept in the system as old code, as there may still be processes which are executing that code\&. It returns either \fI{module, Module}\fR, or \fI{error, Reason}\fR if loading fails\&. \fIReason\fR is one of the following:
.RS 2
.TP 4
.B
\fIbadfile\fR:
The object code in \fIBinary\fR has an incorrect format\&.
.TP 4
.B
\fInot_purged\fR:
\fIBinary\fR contains a module which cannot be loaded because old code for this module already exists\&.
.TP 4
.B
\fIbadfile\fR:
The object code contains code for another module than \fIModule\fR
.RE
.SS Warning:
.LP
This BIF is intended for the code server (see code(3)) and should not be used elsewhere\&.

.RE
.LP
.B
erlang:loaded() -> [Module]
.br
.RS
.TP
Types
Module = atom()
.br
.RE
.RS
.LP
Returns a list of all loaded Erlang modules (current and/or old code), including preloaded modules\&.
.LP
See also code(3)\&.
.RE
.LP
.B
erlang:localtime() -> {Date, Time}
.br
.RS
.TP
Types
Date = {Year, Month, Day}
.br
Time = {Hour, Minute, Second}
.br
Year = Month = Day = Hour = Minute = Second = int()
.br
.RE
.RS
.LP
Returns the current local date and time \fI{{Year, Month, Day}, {Hour, Minute, Second}}\fR\&.
.LP
The time zone and daylight saving time correction depend on the underlying OS\&.

.nf
> erlang:localtime()\&.

{{1996,11,6},{14,45,17}}
.fi
.RE
.LP
.B
erlang:localtime_to_universaltime({Date1, Time1}) -> {Date2, Time2}
.br
.RS
.TP
Types
Date1 = Date2 = {Year, Month, Day}
.br
Time1 = Time2 = {Hour, Minute, Second}
.br
Year = Month = Day = Hour = Minute = Second = int()
.br
.RE
.RS
.LP
Converts local date and time to Universal Time Coordinated (UTC), if this is supported by the underlying OS\&. Otherwise, no conversion is done and \fI{Date1, Time1}\fR is returned\&.

.nf
> erlang:localtime_to_universaltime({{1996,11,6},{14,45,17}})\&.

{{1996,11,6},{13,45,17}}
.fi
.LP
Failure: \fIbadarg\fR if \fIDate1\fR or \fITime1\fR do not denote a valid date or time\&.
.RE
.LP
.B
erlang:localtime_to_universaltime({Date1, Time1}, IsDst) -> {Date2, Time2}
.br
.RS
.TP
Types
Date1 = Date2 = {Year, Month, Day}
.br
Time1 = Time2 = {Hour, Minute, Second}
.br
Year = Month = Day = Hour = Minute = Second = int()
.br
IsDst = true | false | undefined
.br
.RE
.RS
.LP
Converts local date and time to Universal Time Coordinated (UTC) just like \fIerlang:localtime_to_universaltime/1\fR, but the caller decides if daylight saving time is active or not\&.
.LP
If \fIIsDst == true\fR the \fI{Date1, Time1}\fR is during daylight saving time, if \fIIsDst == false\fR it is not, and if \fIIsDst == undefined\fR the underlying OS may guess, which is the same as calling \fIerlang:localtime_to_universaltime({Date1, Time1})\fR\&.

.nf
> erlang:localtime_to_universaltime({{1996,11,6},{14,45,17}}, true)\&.

{{1996,11,6},{12,45,17}}
> erlang:localtime_to_universaltime({{1996,11,6},{14,45,17}}, false)\&.

{{1996,11,6},{13,45,17}}
> erlang:localtime_to_universaltime({{1996,11,6},{14,45,17}}, undefined)\&.

{{1996,11,6},{13,45,17}}
.fi
.LP
Failure: \fIbadarg\fR if \fIDate1\fR or \fITime1\fR do not denote a valid date or time\&.
.RE
.LP
.B
make_ref() -> ref()
.br
.RS
.LP
Returns an almost unique reference\&.
.LP
The returned reference will re-occur after approximately 2^82 calls; therefore it is unique enough for practical purposes\&.

.nf
> make_ref()\&.

#Ref<0\&.0\&.0\&.135>
.fi
.RE
.LP
.B
erlang:make_tuple(Arity, InitialValue) -> tuple()
.br
.RS
.TP
Types
Arity = int()
.br
InitialValue = term()
.br
.RE
.RS
.LP
Returns a new tuple of the given \fIArity\fR, where all elements are \fIInitialValue\fR\&.

.nf
> erlang:make_tuple(4, [])\&.

{[],[],[],[]}
.fi
.RE
.LP
.B
erlang:md5(Data) -> Digest
.br
.RS
.TP
Types
Data = iodata()
.br
Digest = binary()
.br
.RE
.RS
.LP
Computes an \fIMD5\fR message digest from \fIData\fR, where the length of the digest is 128 bits (16 bytes)\&. \fIData\fR is a binary or a list of small integers and binaries\&.
.LP
See The MD5 Message Digest Algorithm (RFC 1321) for more information about MD5\&.
.SS Warning:
.LP
The MD5 Message Digest Algorithm is \fInot\fR considered safe for code-signing or software integrity purposes\&.

.RE
.LP
.B
erlang:md5_final(Context) -> Digest
.br
.RS
.TP
Types
Context = Digest = binary()
.br
.RE
.RS
.LP
Finishes the update of an MD5 \fIContext\fR and returns the computed \fIMD5\fR message digest\&.
.RE
.LP
.B
erlang:md5_init() -> Context
.br
.RS
.TP
Types
Context = binary()
.br
.RE
.RS
.LP
Creates an MD5 context, to be used in subsequent calls to \fImd5_update/2\fR\&.
.RE
.LP
.B
erlang:md5_update(Context, Data) -> NewContext
.br
.RS
.TP
Types
Data = iodata()
.br
Context = NewContext = binary()
.br
.RE
.RS
.LP
Updates an MD5 \fIContext\fR with \fIData\fR, and returns a \fINewContext\fR\&.
.RE
.LP
.B
erlang:memory() -> [{Type, Size}]
.br
.RS
.TP
Types
Type, Size -- see below
.br
.RE
.RS
.LP
Returns a list containing information about memory dynamically allocated by the Erlang emulator\&. Each element of the list is a tuple \fI{Type, Size}\fR\&. The first element \fIType\fRis an atom describing memory type\&. The second element \fISize\fRis memory size in bytes\&. A description of each memory type follows:
.RS 2
.TP 4
.B
\fItotal\fR:
The total amount of memory currently allocated, which is the same as the sum of memory size for \fIprocesses\fR and \fIsystem\fR\&.
.TP 4
.B
\fIprocesses\fR:
The total amount of memory currently allocated by the Erlang processes\&.
.TP 4
.B
\fIprocesses_used\fR:
The total amount of memory currently used by the Erlang processes\&.
.RS 4
.LP

.LP
This memory is part of the memory presented as \fIprocesses\fR memory\&.
.RE
.TP 4
.B
\fIsystem\fR:
The total amount of memory currently allocated by the emulator that is not directly related to any Erlang process\&.
.RS 4
.LP

.LP
Memory presented as \fIprocesses\fR is not included in this memory\&.
.RE
.TP 4
.B
\fIatom\fR:
The total amount of memory currently allocated for atoms\&.
.RS 4
.LP

.LP
This memory is part of the memory presented as \fIsystem\fR memory\&.
.RE
.TP 4
.B
\fIatom_used\fR:
The total amount of memory currently used for atoms\&.
.RS 4
.LP

.LP
This memory is part of the memory presented as \fIatom\fR memory\&.
.RE
.TP 4
.B
\fIbinary\fR:
The total amount of memory currently allocated for binaries\&.
.RS 4
.LP

.LP
This memory is part of the memory presented as \fIsystem\fR memory\&.
.RE
.TP 4
.B
\fIcode\fR:
The total amount of memory currently allocated for Erlang code\&.
.RS 4
.LP

.LP
This memory is part of the memory presented as \fIsystem\fR memory\&.
.RE
.TP 4
.B
\fIets\fR:
The total amount of memory currently allocated for ets tables\&.
.RS 4
.LP

.LP
This memory is part of the memory presented as \fIsystem\fR memory\&.
.RE
.TP 4
.B
\fImaximum\fR:
The maximum total amount of memory allocated since the emulator was started\&.
.RS 4
.LP

.LP
This tuple is only present when the emulator is run with instrumentation\&.
.LP

.LP
For information on how to run the emulator with instrumentation see instrument(3) and/or erl(1)\&.
.RE
.RE
.SS Note:
.LP
The \fIsystem\fR value is not complete\&. Some allocated memory that should be part of the \fIsystem\fR value are not\&. For example, memory allocated by drivers is missing\&.
.LP
When the emulator is run with instrumentation, the \fIsystem\fR value is more accurate, but memory directly allocated by \fImalloc\fR (and friends) are still not part of the \fIsystem\fR value\&. Direct calls to \fImalloc\fR are only done from OS specific runtime libraries and perhaps from user implemented Erlang drivers that do not use the memory allocation functions in the driver interface\&.
.LP
Since the \fItotal\fR value is the sum of \fIprocesses\fR and \fIsystem\fR the error in \fIsystem\fR will propagate to the \fItotal\fR value\&.

.LP
The different values has the following relation to each other\&. Values beginning with an uppercase letter is not part of the result\&.

.nf
        total = processes + system
        processes = processes_used + ProcessesNotUsed
        system = atom + binary + code + ets + OtherSystem
        atom = atom_used + AtomNotUsed

        RealTotal = processes + RealSystem
        RealSystem = system + MissedSystem
.fi
.SS Note:
.LP
The \fItotal\fR value is supposed to be the total amount of memory dynamically allocated by the emulator\&. Shared libraries, the code of the emulator itself, and the emulator stack(s) are not supposed to be included\&. That is, the \fItotal\fR value is \fInot\fR supposed to be equal to the total size of all pages mapped to the emulator\&. Furthermore, due to fragmentation and pre-reservation of memory areas, the size of the memory segments which contain the dynamically allocated memory blocks can be substantially larger than the total size of the dynamically allocated memory blocks\&.

.LP
More tuples in the returned list may be added in the future\&.
.RE
.LP
.B
erlang:memory(Type | [Type]) -> Size | [{Type, Size}]
.br
.RS
.TP
Types
Type, Size -- see below
.br
.RE
.RS
.LP
Returns the memory size in bytes allocated for memory of type \fIType\fR\&. The argument can also be given as a list of \fIType\fR atoms, in which case a corresponding list of \fI{Type, Size}\fR tuples is returned\&.
.LP
See erlang:memory/0\&.
.LP
Failure: \fIbadarg\fR if the emulator is not run with instrumentation when \fIType == maximum\fR\&.
.RE
.LP
.B
module_loaded(Module) -> bool()
.br
.RS
.TP
Types
Module = atom()
.br
.RE
.RS
.LP
Returns \fItrue\fR if the module \fIModule\fR is loaded, otherwise returns \fIfalse\fR\&. It does not attempt to load the module\&.
.SS Warning:
.LP
This BIF is intended for the code server (see code(3)) and should not be used elsewhere\&.

.RE
.LP
.B
erlang:monitor(Type, Item) -> MonitorRef
.br
.RS
.TP
Types
Type = process
.br
Item = pid() | {RegName, Node} | RegName
.br
RegName = atom()
.br
Node = node()
.br
MonitorRef = reference()
.br
.RE
.RS
.LP
The calling process starts monitoring \fIItem\fR which is an object of type \fIType\fR\&.
.LP
Currently only processes can be monitored, i\&.e\&. the only allowed \fIType\fR is \fIprocess\fR, but other types may be allowed in the future\&.
.LP
\fIItem\fR can be:
.RS 2
.TP 4
.B
\fIpid()\fR:
The pid of the process to monitor\&.
.TP 4
.B
\fI{RegName, Node}\fR:
A tuple consisting of a registered name of a process and a node name\&. The process residing on the node \fINode\fR with the registered name \fIRegName\fR will be monitored\&.
.TP 4
.B
\fIRegName\fR:
The process locally registered as \fIRegName\fR will be monitored\&.
.RE
.SS Note:
.LP
When a process is monitored by registered name, the process that has the registered name at the time when \fIerlang:monitor/2\fR is called will be monitored\&. The monitor will not be effected, if the registered name is unregistered\&.

.LP
A \fI\&'DOWN\&'\fR message will be sent to the monitoring process if \fIItem\fR dies, if \fIItem\fR does not exist, or if the connection is lost to the node which \fIItem\fR resides on\&. A \fI\&'DOWN\&'\fR message has the following pattern:

.nf
{\&'DOWN\&', MonitorRef, Type, Object, Info}
.fi
.LP
where \fIMonitorRef\fR and \fIType\fR are the same as described above, and:
.RS 2
.TP 4
.B
\fIObject\fR:
A reference to the monitored object:
.RS 4
.LP

.RS 2
.TP 2
*
the pid of the monitored process, if \fIItem\fR was specified as a pid\&.
.TP 2
*
\fI{RegName, Node}\fR, if \fIItem\fR was specified as \fI{RegName, Node}\fR\&.
.TP 2
*
\fI{RegName, Node}\fR, if \fIItem\fR was specified as \fIRegName\fR\&. \fINode\fR will in this case be the name of the local node (\fInode()\fR)\&.
.RE
.RE
.TP 4
.B
\fIInfo\fR:
Either the exit reason of the process, \fInoproc\fR (non-existing process), or \fInoconnection\fR (no connection to \fINode\fR)\&.
.RE
.SS Note:
.LP
If/when \fIerlang:monitor/2\fR is extended (e\&.g\&. to handle other item types than \fIprocess\fR), other possible values for \fIObject\fR, and \fIInfo\fR in the \fI\&'DOWN\&'\fR message will be introduced\&.

.LP
The monitoring is turned off either when the \fI\&'DOWN\&'\fR message is sent, or when erlang:demonitor/1 is called\&.
.LP
If an attempt is made to monitor a process on an older node (where remote process monitoring is not implemented or one where remote process monitoring by registered name is not implemented), the call fails with \fIbadarg\fR\&.
.LP
Making several calls to \fIerlang:monitor/2\fR for the same \fIItem\fR is not an error; it results in as many, completely independent, monitorings\&.
.SS Note:
.LP
The format of the \fI\&'DOWN\&'\fR message changed in the 5\&.2 version of the emulator (OTP release R9B) for monitor \fIby registered name\fR\&. The \fIObject\fR element of the \fI\&'DOWN\&'\fR message could in earlier versions sometimes be the pid of the monitored process and sometimes be the registered name\&. Now the \fIObject\fR element is always a tuple consisting of the registered name and the node name\&. Processes on new nodes (emulator version 5\&.2 or greater) will always get \fI\&'DOWN\&'\fR messages on the new format even if they are monitoring processes on old nodes\&. Processes on old nodes will always get \fI\&'DOWN\&'\fR messages on the old format\&.

.RE
.LP
.B
monitor_node(Node, Flag) -> true
.br
.RS
.TP
Types
Node = node()
.br
Flag = bool()
.br
.RE
.RS
.LP
Monitors the status of the node \fINode\fR\&. If \fIFlag\fR is \fItrue\fR, monitoring is turned on; if \fIFlag\fR is \fIfalse\fR, monitoring is turned off\&.
.LP
Making several calls to \fImonitor_node(Node, true)\fR for the same \fINode\fR is not an error; it results in as many, completely independent, monitorings\&.
.LP
If \fINode\fR fails or does not exist, the message \fI{nodedown, Node}\fR is delivered to the process\&. If a process has made two calls to \fImonitor_node(Node, true)\fR and \fINode\fR terminates, two \fInodedown\fR messages are delivered to the process\&. If there is no connection to \fINode\fR, there will be an attempt to create one\&. If this fails, a \fInodedown\fR message is delivered\&.
.LP
Nodes connected through hidden connections can be monitored as any other node\&.
.LP
Failure: \fIbadarg\fRif the local node is not alive\&.
.RE
.LP
.B
erlang:monitor_node(Node, Flag, Options) -> true
.br
.RS
.TP
Types
Node = node()
.br
Flag = bool()
.br
Options = [Option]
.br
Option = allow_passive_connect
.br
.RE
.RS
.LP
Behaves as \fImonitor_node/2\fR except that it allows an extra option to be given, namely \fIallow_passive_connect\fR\&. The option allows the BIF to wait the normal net connection timeout for the \fImonitored node\fR to connect itself, even if it cannot be actively connected from this node (i\&.e\&. it is blocked)\&. The state where this might be useful can only be achieved by using the kernel option \fIdist_auto_connect once\fR\&. If that kernel option is not used, the \fIallow_passive_connect\fR option has no effect\&.
.SS Note:
.LP
The \fIallow_passive_connect\fR option is used internally and is seldom needed in applications where the network topology and the kernel options in effect is known in advance\&.

.LP
Failure: \fIbadarg\fR if the local node is not alive or the option list is malformed\&.
.RE
.LP
.B
node() -> Node
.br
.RS
.TP
Types
Node = node()
.br
.RE
.RS
.LP
Returns the name of the local node\&. If the node is not alive, \fInonode@nohost\fR is returned instead\&.
.LP
Allowed in guard tests\&.
.RE
.LP
.B
node(Arg) -> Node
.br
.RS
.TP
Types
Arg = pid() | port() | ref()
.br
Node = node()
.br
.RE
.RS
.LP
Returns the node where \fIArg\fR is located\&. \fIArg\fR can be a pid, a reference, or a port\&. If the local node is not alive, \fInonode@nohost\fR is returned\&.
.LP
Allowed in guard tests\&.
.RE
.LP
.B
nodes() -> Nodes
.br
.RS
.TP
Types
Nodes = [node()]
.br
.RE
.RS
.LP
Returns a list of all visible nodes in the system, excluding the local node\&. Same as \fInodes(visible)\fR\&.
.RE
.LP
.B
nodes(Arg | [Arg]) -> Nodes
.br
.RS
.TP
Types
Arg = visible | hidden | connected | this | known
.br
Nodes = [node()]
.br
.RE
.RS
.LP
Returns a list of nodes according to argument given\&. The result returned when the argument is a list, is the list of nodes satisfying the disjunction(s) of the list elements\&.
.LP
\fIArg\fR can be any of the following:
.RS 2
.TP 4
.B
\fIvisible\fR:
Nodes connected to this node through normal connections\&.
.TP 4
.B
\fIhidden\fR:
Nodes connected to this node through hidden connections\&.
.TP 4
.B
\fIconnected\fR:
All nodes connected to this node\&.
.TP 4
.B
\fIthis\fR:
This node\&.
.TP 4
.B
\fIknown\fR:
Nodes which are known to this node, i\&.e\&., connected, previously connected, etc\&.
.RE
.LP
Some equalities: \fI[node()] = nodes(this)\fR, \fInodes(connected) = nodes([visible, hidden])\fR, and \fInodes() = nodes(visible)\fR\&.
.LP
If the local node is not alive, \fInodes(this) == nodes(known) == [nonode@nohost]\fR, for any other \fIArg\fR the empty list [] is returned\&.
.RE
.LP
.B
now() -> {MegaSecs, Secs, MicroSecs}
.br
.RS
.TP
Types
MegaSecs = Secs = MicroSecs = int()
.br
.RE
.RS
.LP
Returns the tuple \fI{MegaSecs, Secs, MicroSecs}\fR which is the elapsed time since 00:00 GMT, January 1, 1970 (zero hour) on the assumption that the underlying OS supports this\&. Otherwise, some other point in time is chosen\&. It is also guaranteed that subsequent calls to this BIF returns continuously increasing values\&. Hence, the return value from \fInow()\fR can be used to generate unique time-stamps\&. It can only be used to check the local time of day if the time-zone info of the underlying operating system is properly configured\&.
.RE
.LP
.B
open_port(PortName, PortSettings) -> port()
.br
.RS
.TP
Types
PortName = {spawn, Command} | {fd, In, Out}
.br
Command = string()
.br
In = Out = int()
.br
PortSettings = [Opt]
.br
Opt = {packet, N} | stream | {line, L} | {cd, Dir} | {env, Env} | exit_status | use_stdio | nouse_stdio | stderr_to_stdout | in | out | binary | eof
.br
N = 1 | 2 | 4
.br
L = int()
.br
Dir = string()
.br
Env = [{Name, Val}]
.br
Name = string()
.br
Val = string() | false
.br
.RE
.RS
.LP
Returns a port identifier as the result of opening a new Erlang port\&. A port can be seen as an external Erlang process\&. \fIPortName\fR is one of the following:
.RS 2
.TP 4
.B
\fI{spawn, Command}\fR:
Starts an external program\&. \fICommand\fR is the name of the external program which will be run\&. \fICommand\fR runs outside the Erlang work space unless an Erlang driver with the name \fICommand\fR is found\&. If found, that driver will be started\&. A driver runs in the Erlang workspace, which means that it is linked with the Erlang runtime system\&.
.RS 4
.LP

.LP
When starting external programs on Solaris, the system call \fIvfork\fR is used in preference to \fIfork\fR for performance reasons, although it has a history of being less robust\&. If there are problems with using \fIvfork\fR, setting the environment variable \fIERL_NO_VFORK\fR to any value will cause \fIfork\fR to be used instead\&.
.RE
.TP 4
.B
\fI{fd, In, Out}\fR:
Allows an Erlang process to access any currently opened file descriptors used by Erlang\&. The file descriptor \fIIn\fR can be used for standard input, and the file descriptor \fIOut\fR for standard output\&. It is only used for various servers in the Erlang operating system (\fIshell\fR and \fIuser\fR)\&. Hence, its use is very limited\&.
.RE
.LP
\fIPortSettings\fR is a list of settings for the port\&. Valid settings are:
.RS 2
.TP 4
.B
\fI{packet, N}\fR:
Messages are preceded by their length, sent in \fIN\fR bytes, with the most significant byte first\&. Valid values for \fIN\fR are 1, 2, or 4\&.
.TP 4
.B
\fIstream\fR:
Output messages are sent without packet lengths\&. A user-defined protocol must be used between the Erlang process and the external object\&.
.TP 4
.B
\fI{line, L}\fR:
Messages are delivered on a per line basis\&. Each line (delimited by the OS-dependent newline sequence) is delivered in one single message\&. The message data format is \fI{Flag, Line}\fR, where \fIFlag\fR is either \fIeol\fR or \fInoeol\fR and \fILine\fR is the actual data delivered (without the newline sequence)\&.
.RS 4
.LP

.LP
\fIL\fR specifies the maximum line length in bytes\&. Lines longer than this will be delivered in more than one message, with the \fIFlag\fR set to \fInoeol\fR for all but the last message\&. If end of file is encountered anywhere else than immediately following a newline sequence, the last line will also be delivered with the \fIFlag\fR set to \fInoeol\fR\&. In all other cases, lines are delivered with \fIFlag\fR set to \fIeol\fR\&.
.LP

.LP
The \fI{packet, N}\fR and \fI{line, L}\fR settings are mutually exclusive\&.
.RE
.TP 4
.B
\fI{cd, Dir}\fR:
This is only valid for \fI{spawn, Command}\fR\&. The external program starts using \fIDir\fR as its working directory\&. \fIDir\fR must be a string\&. Not available on VxWorks\&.
.TP 4
.B
\fI{env, Env}\fR:
This is only valid for \fI{spawn, Command}\fR\&. The environment of the started process is extended using the environment specifications in \fIEnv\fR\&.
.RS 4
.LP

.LP
\fIEnv\fR should be a list of tuples \fI{Name, Val}\fR, where \fIName\fR is the name of an environment variable, and \fIVal\fR is the value it is to have in the spawned port process\&. Both \fIName\fR and \fIVal\fR must be strings\&. The one exception is \fIVal\fR being the atom \fIfalse\fR (in analogy with \fIos:getenv/1\fR), which removes the environment variable\&. Not available on VxWorks\&.
.RE
.TP 4
.B
\fIexit_status\fR:
This is only valid for \fI{spawn, Command}\fR where \fICommand\fR refers to an external program\&.
.RS 4
.LP

.LP
When the external process connected to the port exits, a message of the form \fI{Port, {exit_status, Status}}\fR is sent to the connected process, where \fIStatus\fR is the exit status of the external process\&. If the program aborts, on Unix the same convention is used as the shells do (i\&.e\&., 128+signal)\&.
.LP

.LP
If the \fIeof\fR option has been given as well, the \fIeof\fR message and the \fIexit_status\fR message appear in an unspecified order\&.
.LP

.LP
If the port program closes its stdout without exiting, the \fIexit_status\fR option will not work\&.
.RE
.TP 4
.B
\fIuse_stdio\fR:
This is only valid for \fI{spawn, Command}\fR\&. It allows the standard input and output (file descriptors 0 and 1) of the spawned (UNIX) process for communication with Erlang\&.
.TP 4
.B
\fInouse_stdio\fR:
The opposite of \fIuse_stdio\fR\&. Uses file descriptors 3 and 4 for communication with Erlang\&.
.TP 4
.B
\fIstderr_to_stdout\fR:
Affects ports to external programs\&. The executed program gets its standard error file redirected to its standard output file\&. \fIstderr_to_stdout\fR and \fInouse_stdio\fR are mutually exclusive\&.
.TP 4
.B
\fIin\fR:
The port can only be used for input\&.
.TP 4
.B
\fIout\fR:
The port can only be used for output\&.
.TP 4
.B
\fIbinary\fR:
All IO from the port are binary data objects as opposed to lists of bytes\&.
.TP 4
.B
\fIeof\fR:
The port will not be closed at the end of the file and produce an exit signal\&. Instead, it will remain open and a \fI{Port, eof}\fR message will be sent to the process holding the port\&.
.TP 4
.B
\fIhide\fR:
When running on Windows, suppress creation of a new console window when spawning the port program\&. (This option has no effect on other platforms\&.)
.RE
.LP
The default is \fIstream\fR for all types of port and \fIuse_stdio\fR for spawned ports\&.
.LP
Failure: If the port cannot be opened, the exit reason is \fIbadarg\fR, \fIsystem_limit\fR, or the Posix error code which most closely describes the error, or \fIeinval\fR if no Posix code is appropriate:
.RS 2
.TP 4
.B
\fIbadarg\fR:
Bad input arguments to \fIopen_port\fR\&.
.TP 4
.B
\fIsystem_limit\fR:
All available ports in the Erlang emulator are in use\&.
.TP 4
.B
\fIenomem\fR:
There was not enough memory to create the port\&.
.TP 4
.B
\fIeagain\fR:
There are no more available operating system processes\&.
.TP 4
.B
\fIenametoolong\fR:
The external command given was too long\&.
.TP 4
.B
\fIemfile\fR:
There are no more available file descriptors (for the operating system process that the Erlang emulator runs in)\&.
.TP 4
.B
\fIenfile\fR:
The file table is full (for the entire operating system)\&.
.RE
.LP
During use of a port opened using \fI{spawn, Name}\fR, errors arising when sending messages to it are reported to the owning process using signals of the form \fI{\&'EXIT\&', Port, PosixCode}\fR\&. See \fIfile(3)\fR for possible values of \fIPosixCode\fR\&.
.LP
 The maximum number of ports that can be open at the same time is 1024 by default, but can be configured by the environment variable \fIERL_MAX_PORTS\fR\&.
.RE
.LP
.B
erlang:phash(Term, Range) -> Hash
.br
.RS
.TP
Types
Term = term()
.br
Range = 1\&.\&.2^32
.br
Hash = 1\&.\&.Range
.br
.RE
.RS
.LP
Portable hash function that will give the same hash for the same Erlang term regardless of machine architecture and ERTS version (the BIF was introduced in ERTS 4\&.9\&.1\&.1)\&. Range can be between 1 and 2^32, the function returns a hash value for \fITerm\fR within the range \fI1\&.\&.Range\fR\&.
.LP
This BIF could be used instead of the old deprecated \fIerlang:hash/2\fR BIF, as it calculates better hashes for all data-types, but consider using \fIphash2/1, 2\fR instead\&.
.RE
.LP
.B
erlang:phash2(Term [, Range]) -> Hash
.br
.RS
.TP
Types
Term = term()
.br
Range = 1\&.\&.2^32
.br
Hash = 0\&.\&.Range-1
.br
.RE
.RS
.LP
Portable hash function that will give the same hash for the same Erlang term regardless of machine architecture and ERTS version (the BIF was introduced in ERTS 5\&.2)\&. Range can be between 1 and 2^32, the function returns a hash value for \fITerm\fR within the range \fI0\&.\&.Range-1\fR\&. When called without the \fIRange\fR argument, a value in the range \fI0\&.\&.2^27-1\fR is returned\&.
.LP
This BIF should always be used for hashing terms\&. It distributes small integers better than \fIphash/2\fR, and it is faster for bignums and binaries\&.
.LP
Note that the range \fI0\&.\&.Range-1\fR is different from the range of \fIphash/2\fR (\fI1\&.\&.Range\fR)\&.
.RE
.LP
.B
pid_to_list(Pid) -> string()
.br
.RS
.TP
Types
Pid = pid()
.br
.RE
.RS
.LP
Returns a string which corresponds to the text representation of \fIPid\fR\&.
.SS Warning:
.LP
This BIF is intended for debugging and for use in the Erlang operating system\&. It should not be used in application programs\&.

.RE
.LP
.B
port_close(Port) -> true
.br
.RS
.TP
Types
Port = port() | atom()
.br
.RE
.RS
.LP
Closes an open port\&. Roughly the same as \fIPort ! {self(), close}\fR except for the error behaviour (see below), and that the port does \fInot\fR reply with \fI{Port, closed}\fR\&. Any process may close a port with \fIport_close/1\fR, not only the port owner (the connected process)\&.
.LP
For comparison: \fIPort ! {self(), close}\fR fails with \fIbadarg\fR if \fIPort\fR cannot be sent to (i\&.e\&., \fIPort\fR refers neither to a port nor to a process)\&. If \fIPort\fR is a closed port nothing happens\&. If \fIPort\fR is an open port and the calling process is the port owner, the port replies with \fI{Port, closed}\fR when all buffers have been flushed and the port really closes, but if the calling process is not the port owner the \fIport owner\fR fails with \fIbadsig\fR\&.
.LP
Note that any process can close a port using \fIPort ! {PortOwner, close}\fR just as if it itself was the port owner, but the reply always goes to the port owner\&.
.LP
In short: \fIport_close(Port)\fR has a cleaner and more logical behaviour than \fIPort ! {self(), close}\fR\&.
.LP
Failure: \fIbadarg\fR if \fIPort\fR is not an open port or the registered name of an open port\&.
.RE
.LP
.B
port_command(Port, Data) -> true
.br
.RS
.TP
Types
Port = port() | atom()
.br
Data = iodata()
.br
.RE
.RS
.LP
Sends data to a port\&. Same as \fIPort ! {self(), {command, Data}}\fR except for the error behaviour (see below)\&. Any process may send data to a port with \fIport_command/2\fR, not only the port owner (the connected process)\&.
.LP
For comparison: \fIPort ! {self(), {command, Data}}\fR fails with \fIbadarg\fR if \fIPort\fR cannot be sent to (i\&.e\&., \fIPort\fR refers neither to a port nor to a process)\&. If \fIPort\fR is a closed port the data message disappears without a sound\&. If \fIPort\fR is open and the calling process is not the port owner, the \fIport owner\fR fails with \fIbadsig\fR\&. The port owner fails with \fIbadsig\fR also if \fIData\fR is not a valid IO list\&.
.LP
Note that any process can send to a port using \fIPort ! {PortOwner, {command, Data}}\fR just as if it itself was the port owner\&.
.LP
In short: \fIport_command(Port, Data)\fR has a cleaner and more logical behaviour than \fIPort ! {self(), {command, Data}}\fR\&.
.LP
Failure: \fIbadarg\fR if \fIPort\fR is not an open port or the registered name of an open port\&.
.RE
.LP
.B
port_connect(Port, Pid) -> true
.br
.RS
.TP
Types
Port = port() | atom()
.br
Pid = pid()
.br
.RE
.RS
.LP
Sets the port owner (the connected port) to \fIPid\fR\&. Roughly the same as \fIPort ! {self(), {connect, Pid}}\fR except for the following:
.RS 2
.TP 2
*
The error behavior differs, see below\&.
.TP 2
*
The port does \fInot\fR reply with \fI{Port, connected}\fR\&.
.TP 2
*
The new port owner gets linked to the port\&.
.RE
.LP
The old port owner stays linked to the port and have to call \fIunlink(Port)\fR if this is not desired\&. Any process may set the port owner to be any process with \fIport_connect/2\fR\&.
.LP
For comparison: \fIPort ! {self(), {connect, Pid}}\fR fails with \fIbadarg\fR if \fIPort\fR cannot be sent to (i\&.e\&., \fIPort\fR refers neither to a port nor to a process)\&. If \fIPort\fR is a closed port nothing happens\&. If \fIPort\fR is an open port and the calling process is the port owner, the port replies with \fI{Port, connected}\fR to the old port owner\&. Note that the old port owner is still linked to the port, and that the new is not\&. If \fIPort\fR is an open port and the calling process is not the port owner, the \fIport owner\fR fails with \fIbadsig\fR\&. The port owner fails with \fIbadsig\fR also if \fIPid\fR is not an existing local pid\&.
.LP
Note that any process can set the port owner using \fIPort ! {PortOwner, {connect, Pid}}\fR just as if it itself was the port owner, but the reply always goes to the port owner\&.
.LP
In short: \fIport_connect(Port, Pid)\fR has a cleaner and more logical behaviour than \fIPort ! {self(), {connect, Pid}}\fR\&.
.LP
Failure: \fIbadarg\fR if \fIPort\fR is not an open port or the registered name of an open port, or if \fIPid\fR is not an existing local pid\&.
.RE
.LP
.B
port_control(Port, Operation, Data) -> Res
.br
.RS
.TP
Types
Port = port() | atom()
.br
Operation = int()
.br
Data = Res = iodata()
.br
.RE
.RS
.LP
Performs a synchronous control operation on a port\&. The meaning of \fIOperation\fR and \fIData\fR depends on the port, i\&.e\&., on the port driver\&. Not all port drivers support this control feature\&.
.LP
Returns: a list of integers in the range 0 through 255, or a binary, depending on the port driver\&. The meaning of the returned data also depends on the port driver\&.
.LP
Failure: \fIbadarg\fR if \fIPort\fR is not an open port or the registered name of an open port, if \fIOperation\fR cannot fit in a 32-bit integer, if the port driver does not support synchronous control operations, or if the port driver so decides for any reason (probably something wrong with \fIOperation\fR or \fIData\fR)\&.
.RE
.LP
.B
erlang:port_call(Port, Operation, Data) -> term()
.br
.RS
.TP
Types
Port = port() | atom()
.br
Operation = int()
.br
Data = term()
.br
.RE
.RS
.LP
Performs a synchronous call to a port\&. The meaning of \fIOperation\fR and \fIData\fR depends on the port, i\&.e\&., on the port driver\&. Not all port drivers support this feature\&.
.LP
\fIPort\fR is a port identifier, referring to a driver\&.
.LP
\fIOperation\fR is an integer, which is passed on to the driver\&.
.LP
\fIData\fR is any Erlang term\&. This data is converted to binary term format and sent to the port\&.
.LP
Returns: a term from the driver\&. The meaning of the returned data also depends on the port driver\&.
.LP
Failure: \fIbadarg\fR if \fIPort\fR is not an open port or the registered name of an open port, if \fIOperation\fR cannot fit in a 32-bit integer, if the port driver does not support synchronous control operations, or if the port driver so decides for any reason (probably something wrong with \fIOperation\fR or \fIData\fR)\&.
.RE
.LP
.B
erlang:port_info(Port) -> [{Item, Info}] | undefined
.br
.RS
.TP
Types
Port = port() | atom()
.br
Item, Info -- see below
.br
.RE
.RS
.LP
Returns a list containing tuples with information about the \fIPort\fR, or \fIundefined\fR if the port is not open\&. The order of the tuples is not defined, nor are all the tuples mandatory\&.
.RS 2
.TP 4
.B
\fI{registered_name, RegName}\fR:
\fIRegName\fR (an atom) is the registered name of the port\&. If the port has no registered name, this tuple is not present in the list\&.
.TP 4
.B
\fI{id, Index}\fR:
\fIIndex\fR (an integer) is the internal index of the port\&. This index may be used to separate ports\&.
.TP 4
.B
\fI{connected, Pid}\fR:
\fIPid\fR is the process connected to the port\&.
.TP 4
.B
\fI{links, Pids}\fR:
\fIPids\fR is a list of pids to which processes the port is linked\&.
.TP 4
.B
\fI{name, String}\fR:
\fIString\fR is the command name set by \fIopen_port\fR\&.
.TP 4
.B
\fI{input, Bytes}\fR:
\fIBytes\fR is the total number of bytes read from the port\&.
.TP 4
.B
\fI{output, Bytes}\fR:
\fIBytes\fR is the total number of bytes written to the port\&.
.RE
.LP
Failure: \fIbadarg\fR if \fIPort\fR is not a local port\&.
.RE
.LP
.B
erlang:port_info(Port, Item) -> {Item, Info} | undefined | []
.br
.RS
.TP
Types
Port = port() | atom()
.br
Item, Info -- see below
.br
.RE
.RS
.LP
Returns information about \fIPort\fR as specified by \fIItem\fR, or \fIundefined\fR if the port is not open\&. Also, if \fIItem == registered_name\fR and the port has no registered name, [] is returned\&.
.LP
For valid values of \fIItem\fR, and corresponding values of \fIInfo\fR, see erlang:port_info/1\&.
.LP
Failure: \fIbadarg\fR if \fIPort\fR is not a local port\&.
.RE
.LP
.B
erlang:port_to_list(Port) -> string()
.br
.RS
.TP
Types
Port = port()
.br
.RE
.RS
.LP
Returns a string which corresponds to the text representation of the port identifier \fIPort\fR\&.
.SS Warning:
.LP
This BIF is intended for debugging and for use in the Erlang operating system\&. It should not be used in application programs\&.

.RE
.LP
.B
erlang:ports() -> [port()]
.br
.RS
.LP
Returns a list of all ports on the local node\&.
.RE
.LP
.B
pre_loaded() -> [Module]
.br
.RS
.TP
Types
Module = atom()
.br
.RE
.RS
.LP
Returns a list of Erlang modules which are pre-loaded in the system\&. As all loading of code is done through the file system, the file system must have been loaded previously\&. Hence, at least the module \fIinit\fR must be pre-loaded\&.
.RE
.LP
.B
erlang:process_display(Pid, Type) -> void()
.br
.RS
.TP
Types
Pid = pid()
.br
Type = back-trace
.br
.RE
.RS
.LP
Writes information about the local process \fIPid\fR on standard error\&. The currently allowed value for the atom \fIType\fR is \fIbacktrace\fR, which shows the contents of the call stack, including information about the call chain, with the most recent data printed last\&. The format of the output is not further defined\&.
.RE
.LP
.B
process_flag(Flag, Value) -> OldValue
.br
.RS
.TP
Types
Flag, Value, OldValue -- see below
.br
.RE
.RS
.LP
Sets certain flags for the process which calls this function\&. Returns the old value of the flag\&.
.RS 2
.TP 4
.B
\fIprocess_flag(trap_exit, Boolean)\fR:
When \fItrap_exit\fR is set to \fItrue\fR, exit signals arriving to a process are converted to \fI{\&'EXIT\&', From, Reason}\fR messages, which can be received as ordinary messages\&. If \fItrap_exit\fR is set to \fIfalse\fR, the process exits if it receives an exit signal other than \fInormal\fR and the exit signal is propagated to its linked processes\&. Application processes should normally not trap exits\&.
.RS 4
.LP

.LP
See also exit/2\&.
.RE
.TP 4
.B
\fIprocess_flag(error_handler, Module)\fR:
This is used by a process to redefine the error handler for undefined function calls and undefined registered processes\&. Inexperienced users should not use this flag since code auto-loading is dependent on the correct operation of the error handling module\&.
.TP 4
.B
\fIprocess_flag(min_heap_size, MinHeapSize)\fR:
This changes the minimum heap size for the calling process\&.
.TP 4
.B
\fIprocess_flag(priority, Level)\fR:
 
.RS 4
.LP
This sets the process priority\&. \fILevel\fR is an atom\&. There are currently four priority levels: \fIlow\fR, \fInormal\fR, \fIhigh\fR, and \fImax\fR\&. The default priority level is \fInormal\fR\&. \fINOTE\fR: The \fImax\fR priority level is reserved for internal use in the Erlang runtime system, and should \fInot\fR be used by others\&. 
.LP

.LP
Internally in each priority level processes are scheduled in a round robin fashion\&. 
.LP

.LP
Execution of processes on priority \fInormal\fR and priority \fIlow\fR will be interleaved\&. Processes on priority \fIlow\fR will be selected for execution less frequently than processes on priority \fInormal\fR\&. 
.LP

.LP
When there are runnable processes on priority \fIhigh\fR no processes on priority \fIlow\fR, or \fInormal\fR will be selected for execution\&. Note, however, that this does \fInot\fR mean that no processes on priority \fIlow\fR, or \fInormal\fR will be able to run when there are processes on priority \fIhigh\fR running\&. On the runtime system with SMP support there might be more processes running in parallel than processes on priority \fIhigh\fR, i\&.e\&., a \fIlow\fR, and a \fIhigh\fR priority process might execute at the same time\&. 
.LP

.LP
When there are runnable processes on priority \fImax\fR no processes on priority \fIlow\fR, \fInormal\fR, or \fIhigh\fR will be selected for execution\&. As with the \fIhigh\fR priority, processes on lower priorities might execute in parallel with processes on priority \fImax\fR\&. 
.LP

.LP
Scheduling is preemptive\&. Regardless of priority, a process is preempted when it has consumed more than a certain amount of reductions since the last time it was selected for execution\&. 
.LP

.LP
\fINOTE\fR: You should not depend on the scheduling to remain exactly as it is today\&. Scheduling, at least on the runtime system with SMP support, is very likely to be modified in the future in order to better utilize available processor cores\&. 
.LP

.LP
There is currently \fIno\fR automatic mechanism for avoiding priority inversion, such as priority inheritance, or priority ceilings\&. When using priorities you have to take this into account and handle such scenarios by yourself\&. 
.LP

.LP
Making calls from a \fIhigh\fR priority process into code that you don\&'t have control over may cause the \fIhigh\fR priority process to wait for a processes with lower priority, i\&.e\&., effectively decreasing the priority of the \fIhigh\fR priority process during the call\&. Even if this isn\&'t the case with one version of the code that you don\&'t have under your control, it might be the case in a future version of it\&. This might, for example, happen if a \fIhigh\fR priority process triggers code loading, since the code server runs on priority \fInormal\fR\&. 
.LP

.LP
Other priorities than \fInormal\fR are normally not needed\&. When other priorities are used, they need to be used with care, especially the \fIhigh\fR priority \fImust\fR be used with care\&. A process on \fIhigh\fR priority should only perform work for short periods of time\&. Busy looping for long periods of time in a \fIhigh\fR priority process will most likely cause problems, since there are important servers in OTP running on priority \fInormal\fR\&. 
.RE
.TP 4
.B
\fIprocess_flag(save_calls, N)\fR:
When there are runnable processes on priority \fImax\fR no processes on priority \fIlow\fR, \fInormal\fR, or \fIhigh\fR will be selected for execution\&. As with the \fIhigh\fR priority, processes on lower priorities might execute in parallel with processes on priority \fImax\fR\&. 
.RS 4
.LP

.LP
\fIN\fR must be an integer in the interval 0\&.\&.10000\&. If \fIN\fR > 0, call saving is made active for the process, which means that information about the \fIN\fR most recent global function calls, BIF calls, sends and receives made by the process are saved in a list, which can be retrieved with \fIprocess_info(Pid, last_calls)\fR\&. A global function call is one in which the module of the function is explicitly mentioned\&. Only a fixed amount of information is saved: a tuple \fI{Module, Function, Arity}\fR for function calls, and the mere atoms \fIsend\fR, \fI\&'receive\&'\fR and \fItimeout\fR for sends and receives (\fI\&'receive\&'\fR when a message is received and \fItimeout\fR when a receive times out)\&. If \fIN\fR = 0, call saving is disabled for the process, which is the default\&. Whenever the size of the call saving list is set, its contents are reset\&.
.RE
.TP 4
.B
\fIprocess_flag(sensitive, Boolean)\fR:
Set or clear the \fIsensitive\fR flag for the current process\&. When a process has been marked as sensitive by calling \fIprocess_flag(sensitive, true)\fR, features in the run-time system that can be used for examining the data and/or inner working of the process are silently disabled\&.
.RS 4
.LP

.LP
Features that are disabled include (but are not limited to) the following:
.LP

.LP
Tracing: Trace flags can still be set for the process, but no trace messages of any kind will be generated\&. (If the \fIsensitive\fR flag is turned off, trace messages will again be generated if there are any trace flags set\&.)
.LP

.LP
Sequential tracing: The sequential trace token will be propagated as usual, but no sequential trace messages will be generated\&.
.LP

.LP
\fIprocess_info/1, 2\fR cannot be used to read out the message queue or the process dictionary (both will be returned as empty lists)\&.
.LP

.LP
Stack back-traces cannot be displayed for the process\&.
.LP

.LP
In crash dumps, the stack, messages, and the process dictionary will be omitted\&.
.LP

.LP
If \fI{save_calls, N}\fR has been set for the process, no function calls will be saved to the call saving list\&. (The call saving list will not be cleared; furthermore, send, receive, and timeout events will still be added to the list\&.)
.RE
.RE
.RE
.LP
.B
process_flag(Pid, Flag, Value) -> OldValue
.br
.RS
.TP
Types
Pid = pid()
.br
Flag, Value, OldValue -- see below
.br
.RE
.RS
.LP
Sets certain flags for the process \fIPid\fR, in the same manner as process_flag/2\&. Returns the old value of the flag\&. The allowed values for \fIFlag\fR are only a subset of those allowed in \fIprocess_flag/2\fR, namely: \fIsave_calls\fR\&.
.LP
Failure: \fIbadarg\fR if \fIPid\fR is not a local process\&.
.RE
.LP
.B
process_info(Pid) -> InfoResult
.br
.RS
.TP
Types
Pid = pid()
.br
Item = atom()
.br
Info = term()
.br
InfoTuple = {Item, Info}
.br
InfoTupleList = [InfoTuple]
.br
InfoResult = InfoTupleList | undefined
.br
.RE
.RS
.LP
Returns a list containing \fIInfoTuple\fRs with miscellaneous information about the process identified by \fIPid\fR, or \fIundefined\fR if the process is not alive\&. 
.LP
The order of the \fIInfoTuple\fRs is not defined, nor are all the \fIInfoTuple\fRs mandatory\&. The \fIInfoTuple\fRs part of the result may be changed without prior notice\&. Currently \fIInfoTuple\fRs with the following \fIItem\fRs are part of the result: \fIcurrent_function\fR, \fIinitial_call\fR, \fIstatus\fR, \fImessage_queue_len\fR, \fImessages\fR, \fIlinks\fR, \fIdictionary\fR, \fItrap_exit\fR, \fIerror_handler\fR, \fIpriority\fR, \fIgroup_leader\fR, \fItotal_heap_size\fR, \fIheap_size\fR, \fIstack_size\fR, \fIreductions\fR, and \fIgarbage_collection\fR\&. If the process identified by \fIPid\fR has a registered name also an \fIInfoTuple\fR with \fIItem == registered_name\fR will appear\&. 
.LP
See process_info/2 for information about specific \fIInfoTuple\fRs\&.
.SS Warning:
.LP
This BIF is intended for \fIdebugging only\fR, use process_info/2 for all other purposes\&. 

.LP
Failure: \fIbadarg\fR if \fIPid\fR is not a local process\&.
.RE
.LP
.B
process_info(Pid, ItemSpec) -> InfoResult
.br
.RS
.TP
Types
Pid = pid()
.br
Item = atom()
.br
Info = term()
.br
ItemList = [Item]
.br
ItemSpec = Item | ItemList
.br
InfoTuple = {Item, Info}
.br
InfoTupleList = [InfoTuple]
.br
InfoResult = InfoTuple | InfoTupleList | undefined | []
.br
.RE
.RS
.LP
Returns information about the process identified by \fIPid\fR as specified by the \fIItemSpec\fR, or \fIundefined\fR if the process is not alive\&. 
.LP
If the process is alive and \fIItemSpec\fR is a single \fIItem\fR, the returned value is the corresponding \fIInfoTuple\fR unless \fIItemSpec == registered_name\fR and the process has no registered name\&. In this case \fI[]\fR is returned\&. This strange behavior is due to historical reasons, and is kept for backward compatibility\&. 
.LP
If \fIItemSpec\fR is an \fIItemList\fR, the result is an \fIInfoTupleList\fR\&. The \fIInfoTuple\fRs in the \fIInfoTupleList\fR will appear with the corresponding \fIItem\fRs in the same order as the \fIItem\fRs appeared in the \fIItemList\fR\&. Valid \fIItem\fRs may appear multiple times in the \fIItemList\fR\&. 
.SS Note:
.LP
If \fIregistered_name\fR is part of an \fIItemList\fR and the process has no name registered a \fI{registered_name, []}\fR \fIInfoTuple\fR \fIwill\fR appear in the resulting \fIInfoTupleList\fR\&. This behavior is different than when \fIItemSpec == registered_name\fR, and than when \fIprocess_info/1\fR is used\&. 

.LP
Currently the following \fIInfoTuple\fRs with corresponding \fIItem\fRs are valid:
.RS 2
.TP 4
.B
\fI{backtrace, Bin}\fR:
The binary \fIBin\fR contains the same information as the output from \fIerlang:process_display(Pid, backtrace)\fR\&. Use \fIbinary_to_list/1\fR to obtain the string of characters from the binary\&.
.TP 4
.B
\fI{binary, BinInfo}\fR:
\fIBinInfo\fR is a list containing miscellaneous information about binaries currently being referred to by this process\&. This \fIInfoTuple\fR may be changed or removed without prior notice\&.
.TP 4
.B
\fI{catchlevel, CatchLevel}\fR:
\fICatchLevel\fR is the number of currently active catches in this process\&. This \fIInfoTuple\fR may be changed or removed without prior notice\&.
.TP 4
.B
\fI{current_function, {Module, Function, Args}}\fR:
\fIModule\fR, \fIFunction\fR, \fIArgs\fR is the current function call of the process\&.
.TP 4
.B
\fI{dictionary, Dictionary}\fR:
\fIDictionary\fR is the dictionary of the process\&.
.TP 4
.B
\fI{error_handler, Module}\fR:
\fIModule\fR is the error handler module used by the process (for undefined function calls, for example)\&.
.TP 4
.B
\fI{garbage_collection, GCInfo}\fR:
\fIGCInfo\fR is a list which contains miscellaneous information about garbage collection for this process\&. The content of \fIGCInfo\fR may be changed without prior notice\&.
.TP 4
.B
\fI{group_leader, GroupLeader}\fR:
\fIGroupLeader\fR is group leader for the IO of the process\&.
.TP 4
.B
\fI{heap_size, Size}\fR:
\fISize\fR is the size in words of youngest heap generation of the process\&. This generation currently include the stack of the process\&. This information is highly implementation dependent, and may change if the implementation change\&. 
.TP 4
.B
\fI{initial_call, {Module, Function, Arity}}\fR:
\fIModule\fR, \fIFunction\fR, \fIArity\fR is the initial function call with which the process was spawned\&.
.TP 4
.B
\fI{links, Pids}\fR:
\fIPids\fR is a list of pids, with processes to which the process has a link\&.
.TP 4
.B
\fI{last_calls, false|Calls}\fR:
The value is \fIfalse\fR if call saving is not active for the process (see process_flag/3)\&. If call saving is active, a list is returned, in which the last element is the most recent called\&.
.TP 4
.B
\fI{memory, Size}\fR:
\fISize\fR is the size in bytes of the process\&. This includes call stack, heap and internal structures\&.
.TP 4
.B
\fI{message_binary, BinInfo}\fR:
\fIBinInfo\fR is a list containing miscellaneous information about binaries currently being referred to by the message area\&. This \fIInfoTuple\fR is only valid on an emulator using the hybrid heap type\&. This \fIInfoTuple\fR may be changed or removed without prior notice\&.
.TP 4
.B
\fI{message_queue_len, MessageQueueLen}\fR:
\fIMessageQueueLen\fR is the number of messages currently in the message queue of the process\&. This is the length of the list \fIMessageQueue\fR returned as the info item \fImessages\fR (see below)\&.
.TP 4
.B
\fI{messages, MessageQueue}\fR:
\fIMessageQueue\fR is a list of the messages to the process, which have not yet been processed\&.
.TP 4
.B
\fI{monitored_by, Pids}\fR:
A list of pids that are monitoring the process (with \fIerlang:monitor/2\fR)\&.
.TP 4
.B
\fI{monitors, Monitors}\fR:
A list of monitors (started by \fIerlang:monitor/2\fR) that are active for the process\&. For a local process monitor or a remote process monitor by pid, the list item is \fI{process, Pid}\fR, and for a remote process monitor by name, the list item is \fI{process, {RegName, Node}}\fR\&.
.TP 4
.B
\fI{priority, Level}\fR:
\fILevel\fR is the current priority level for the process\&. For more information on priorities see process_flag(priority, Level)\&.
.TP 4
.B
\fI{reductions, Number}\fR:
\fINumber\fR is the number of reductions executed by the process\&.
.TP 4
.B
\fI{registered_name, Atom}\fR:
\fIAtom\fR is the registered name of the process\&. If the process has no registered name, this tuple is not present in the list\&.
.TP 4
.B
\fI{sequential_trace_token, [] | SequentialTraceToken}\fR:
\fISequentialTraceToken\fR the sequential trace token for the process\&. This \fIInfoTuple\fR may be changed or removed without prior notice\&.
.TP 4
.B
\fI{stack_size, Size}\fR:
\fISize\fR is the stack size of the process in words\&.
.TP 4
.B
\fI{status, Status}\fR:
\fIStatus\fR is the status of the process\&. \fIStatus\fR is \fIwaiting\fR (waiting for a message), \fIrunning\fR, \fIrunnable\fR (ready to run, but another process is running), or \fIsuspended\fR (suspended on a "busy" port or by the \fIerlang:suspend_process/[1, 2]\fR BIF)\&.
.TP 4
.B
\fI{suspending, SuspendeeList}\fR:
\fISuspendeeList\fR is a list of \fI{Suspendee, ActiveSuspendCount, OutstandingSuspendCount}\fR tuples\&. \fISuspendee\fR is the pid of a process that have been or is to be suspended by the process identified by \fIPid\fR via the erlang:suspend_process/2 BIF, or the erlang:suspend_process/1 BIF\&. \fIActiveSuspendCount\fR is the number of times the \fISuspendee\fR has been suspended by \fIPid\fR\&. \fIOutstandingSuspendCount\fR is the number of not yet completed suspend requests sent by \fIPid\fR\&. That is, if \fIActiveSuspendCount /= 0\fR, \fISuspendee\fR is currently in the suspended state, and if \fIOutstandingSuspendCount /= 0\fR the \fIasynchronous\fR option of \fIerlang:suspend_process/2\fR has been used and the suspendee has not yet been suspended by \fIPid\fR\&. Note that the \fIActiveSuspendCount\fR and \fIOutstandingSuspendCount\fR are not the total suspend count on \fISuspendee\fR, only the parts contributed by \fIPid\fR\&. 
.TP 4
.B
\fI{total_heap_size, Size}\fR:
\fISize\fR is the total size in words of all heap fragments of the process\&. This currently include the stack of the process\&. 
.TP 4
.B
\fI{trace, InternalTraceFlags}\fR:
\fIInternalTraceFlags\fR is an integer representing internal trace flag for this process\&. This \fIInfoTuple\fR may be changed or removed without prior notice\&.
.TP 4
.B
\fI{trap_exit, Boolean}\fR:
\fIBoolean\fR is \fItrue\fR if the process is trapping exits, otherwise it is \fIfalse\fR\&.
.RE
.LP
Note however, that not all implementations support every one of the above \fIItems\fR\&.
.LP
Failure: \fIbadarg\fR if \fIPid\fR is not a local process, or if \fIItem\fR is not a valid \fIItem\fR\&.
.RE
.LP
.B
processes() -> [pid()]
.br
.RS
.LP
Returns a list of process identifiers corresponding to all the processes currently existing on the local node\&. 
.LP
Note that a process that is exiting, exists but is not alive, i\&.e\&., \fIis_process_alive/1\fR will return \fIfalse\fR for a process that is exiting, but its process identifier will be part of the result returned from \fIprocesses/0\fR\&. 

.nf
> processes()\&.

[<0\&.0\&.0>,<0\&.2\&.0>,<0\&.4\&.0>,<0\&.5\&.0>,<0\&.7\&.0>,<0\&.8\&.0>]
.fi
.RE
.LP
.B
purge_module(Module) -> void()
.br
.RS
.TP
Types
Module = atom()
.br
.RE
.RS
.LP
Removes old code for \fIModule\fR\&. Before this BIF is used, \fIerlang:check_process_code/2\fR should be called to check that no processes are executing old code in the module\&.
.SS Warning:
.LP
This BIF is intended for the code server (see code(3)) and should not be used elsewhere\&.

.LP
Failure: \fIbadarg\fR if there is no old code for \fIModule\fR\&.
.RE
.LP
.B
put(Key, Val) -> OldVal | undefined
.br
.RS
.TP
Types
Key = Val = OldVal = term()
.br
.RE
.RS
.LP
Adds a new \fIKey\fR to the process dictionary, associated with the value \fIVal\fR, and returns \fIundefined\fR\&. If \fIKey\fR already exists, the old value is deleted and replaced by \fIVal\fR and the function returns the old value\&.
.SS Note:
.LP
The values stored when \fIput\fR is evaluated within the scope of a \fIcatch\fR will not be retracted if a \fIthrow\fR is evaluated, or if an error occurs\&.


.nf
> X = put(name, walrus), Y = put(name, carpenter),

Z = get(name),

{X, Y, Z}\&.

{undefined,walrus,carpenter}
.fi
.RE
.LP
.B
erlang:raise(Class, Reason, Stacktrace)
.br
.RS
.TP
Types
Class = error | exit | throw
.br
Reason = term()
.br
Stacktrace = [{Module, Function, Arity | Args} | {Fun, Args}]
.br
Module = Function = atom()
.br
Arity = int()
.br
Args = [term()]
.br
Fun = [fun()]
.br
.RE
.RS
.LP
Stops the execution of the calling process with an exception of given class, reason and call stack backtrace (\fIstacktrace\fR)\&.
.SS Warning:
.LP
This BIF is intended for debugging and for use in the Erlang operating system\&. In general, it should be avoided in applications, unless you know very well what you are doing\&.

.LP
\fIClass\fR is one of \fIerror\fR, \fIexit\fR or \fIthrow\fR, so if it were not for the stacktrace \fIerlang:raise(Class, Reason, Stacktrace)\fR is equivalent to \fIerlang:Class(Reason)\fR\&. \fIReason\fR is any term and \fIStacktrace\fR is a list as returned from \fIget_stacktrace()\fR, that is a list of 3-tuples \fI{Module, Function, Arity | Args}\fR where \fIModule\fR and \fIFunction\fR are atoms and the third element is an integer arity or an argument list\&. The stacktrace may also contain \fI{Fun, Args}\fR tuples where \fIFun\fR is a local fun and \fIArgs\fR is an argument list\&.
.LP
The stacktrace is used as the exception stacktrace for the calling process; it will be truncated to the current maximum stacktrace depth\&.
.LP
Because evaluating this function causes the process to terminate, it has no return value - unless the arguments are invalid, in which case the function \fIreturns the error reason\fR, that is \fIbadarg\fR\&. If you want to be really sure not to return you can call \fIerlang:error(erlang:raise(Class, Reason, Stacktrace))\fR and hope to distinguish exceptions later\&.
.RE
.LP
.B
erlang:read_timer(TimerRef) -> int() | false
.br
.RS
.TP
Types
TimerRef = ref()
.br
.RE
.RS
.LP
\fITimerRef\fR is a timer reference returned by erlang:send_after/3 or erlang:start_timer/3\&. If the timer is active, the function returns the time in milliseconds left until the timer will expire, otherwise \fIfalse\fR (which means that \fITimerRef\fR was never a timer, that it has been cancelled, or that it has already delivered its message)\&.
.LP
See also erlang:send_after/3, erlang:start_timer/3, and erlang:cancel_timer/1\&.
.RE
.LP
.B
erlang:ref_to_list(Ref) -> string()
.br
.RS
.TP
Types
Ref = ref()
.br
.RE
.RS
.LP
Returns a string which corresponds to the text representation of \fIRef\fR\&.
.SS Warning:
.LP
This BIF is intended for debugging and for use in the Erlang operating system\&. It should not be used in application programs\&.

.RE
.LP
.B
register(RegName, Pid | Port) -> true
.br
.RS
.TP
Types
RegName = atom()
.br
Pid = pid()
.br
Port = port()
.br
.RE
.RS
.LP
Associates the name \fIRegName\fR with a pid or a port identifier\&. \fIRegName\fR, which must be an atom, can be used instead of the pid / port identifier in the send operator (\fIRegName ! Message\fR)\&.

.nf
> register(db, Pid)\&.

true
.fi
.LP
Failure: \fIbadarg\fR if \fIPid\fR is not an existing, local process or port, if \fIRegName\fR is already in use, if the process or port is already registered (already has a name), or if \fIRegName\fR is the atom \fIundefined\fR\&.
.RE
.LP
.B
registered() -> [RegName]
.br
.RS
.TP
Types
RegName = atom()
.br
.RE
.RS
.LP
Returns a list of names which have been registered using register/2\&.

.nf
> registered()\&.

[code_server, file_server, init, user, my_db]
.fi
.RE
.LP
.B
erlang:resume_process(Suspendee) -> true
.br
.RS
.TP
Types
Suspendee = pid()
.br
.RE
.RS
.LP
Decreases the suspend count on the process identified by \fISuspendee\fR\&. \fISuspendee\fR should previously have been suspended via erlang:suspend_process/2, or erlang:suspend_process/1 by the process calling \fIerlang:resume_process(Suspendee)\fR\&. When the suspend count on \fISuspendee\fR reach zero, \fISuspendee\fR will be resumed, i\&.e\&., the state of the \fISuspendee\fR is changed from suspended into the state \fISuspendee\fR was in before it was suspended\&. 
.SS Warning:
.LP
This BIF is intended for debugging only\&.

.LP
Failures:
.RS 2
.TP 4
.B
\fIbadarg\fR:
If \fISuspendee\fR isn\&'t a process identifier\&.
.TP 4
.B
\fIbadarg\fR:
If the process calling \fIerlang:resume_process/1\fR had not previously increased the suspend count on the process identified by \fISuspendee\fR\&.
.TP 4
.B
\fIbadarg\fR:
If the process identified by \fISuspendee\fR is not alive\&.
.RE
.RE
.LP
.B
round(Number) -> int()
.br
.RS
.TP
Types
Number = number()
.br
.RE
.RS
.LP
Returns an integer by rounding \fINumber\fR\&.

.nf
> round(5\&.5)\&.

6
.fi
.LP
Allowed in guard tests\&.
.RE
.LP
.B
self() -> pid()
.br
.RS
.LP
Returns the pid (process identifier) of the calling process\&.

.nf
> self()\&.

<0\&.26\&.0>
.fi
.LP
Allowed in guard tests\&.
.RE
.LP
.B
erlang:send(Dest, Msg) -> Msg
.br
.RS
.TP
Types
Dest = pid() | port() | RegName | {RegName, Node}
.br
Msg = term()
.br
RegName = atom()
.br
Node = node()
.br
.RE
.RS
.LP
Sends a message and returns \fIMsg\fR\&. This is the same as \fIDest ! Msg\fR\&.
.LP
\fIDest\fR may be a remote or local pid, a (local) port, a locally registered name, or a tuple \fI{RegName, Node}\fR for a registered name at another node\&.
.RE
.LP
.B
erlang:send(Dest, Msg, [Option]) -> Res
.br
.RS
.TP
Types
Dest = pid() | port() | RegName | {RegName, Node}
.br
RegName = atom()
.br
Node = node()
.br
Msg = term()
.br
Option = nosuspend | noconnect
.br
Res = ok | nosuspend | noconnect
.br
.RE
.RS
.LP
Sends a message and returns \fIok\fR, or does not send the message but returns something else (see below)\&. Otherwise the same as erlang:send/2\&. See also erlang:send_nosuspend/2,3\&. for more detailed explanation and warnings\&.
.LP
The possible options are:
.RS 2
.TP 4
.B
\fInosuspend\fR:
If the sender would have to be suspended to do the send, \fInosuspend\fR is returned instead\&.
.TP 4
.B
\fInoconnect\fR:
If the destination node would have to be auto-connected before doing the send, \fInoconnect\fR is returned instead\&.
.RE
.SS Warning:
.LP
As with \fIerlang:send_nosuspend/2, 3\fR: Use with extreme care!

.RE
.LP
.B
erlang:send_after(Time, Dest, Msg) -> TimerRef
.br
.RS
.TP
Types
Time = int()
.br
0 <= Time <= 4294967295
.br
Dest = pid() | RegName 
.br
LocalPid = pid() (of a process, alive or dead, on the local node)
.br
Msg = term()
.br
TimerRef = ref()
.br
.RE
.RS
.LP
Starts a timer which will send the message \fIMsg\fR to \fIDest\fR after \fITime\fR milliseconds\&.
.LP
If \fIDest\fR is an atom, it is supposed to be the name of a registered process\&. The process referred to by the name is looked up at the time of delivery\&. No error is given if the name does not refer to a process\&.
.LP
If \fIDest\fR is a pid, the timer will be automatically canceled if the process referred to by the pid is not alive, or when the process exits\&. This feature was introduced in erts version 5\&.4\&.11\&. Note that timers will not be automatically canceled when \fIDest\fR is an atom\&.
.LP
See also erlang:start_timer/3, erlang:cancel_timer/1, and erlang:read_timer/1\&.
.LP
Failure: \fIbadarg\fR if the arguments does not satisfy the requirements specified above\&.
.RE
.LP
.B
erlang:send_nosuspend(Dest, Msg) -> bool()
.br
.RS
.TP
Types
Dest = pid() | port() | RegName | {RegName, Node}
.br
RegName = atom()
.br
Node = node()
.br
Msg = term()
.br
.RE
.RS
.LP
The same as erlang:send(Dest, Msg, [nosuspend]), but returns \fItrue\fR if the message was sent and \fIfalse\fR if the message was not sent because the sender would have had to be suspended\&.
.LP
This function is intended for send operations towards an unreliable remote node without ever blocking the sending (Erlang) process\&. If the connection to the remote node (usually not a real Erlang node, but a node written in C or Java) is overloaded, this function \fIwill not send the message\fR but return \fIfalse\fR instead\&.
.LP
The same happens, if \fIDest\fR refers to a local port that is busy\&. For all other destinations (allowed for the ordinary send operator \fI\&'!\&'\fR) this function sends the message and returns \fItrue\fR\&.
.LP
This function is only to be used in very rare circumstances where a process communicates with Erlang nodes that can disappear without any trace causing the TCP buffers and the drivers queue to be over-full before the node will actually be shut down (due to tick timeouts) by \fInet_kernel\fR\&. The normal reaction to take when this happens is some kind of premature shutdown of the other node\&.
.LP
Note that ignoring the return value from this function would result in \fIunreliable\fR message passing, which is contradictory to the Erlang programming model\&. The message is \fInot\fR sent if this function returns \fIfalse\fR\&.
.LP
Note also that in many systems, transient states of overloaded queues are normal\&. The fact that this function returns \fIfalse\fR does not in any way mean that the other node is guaranteed to be non-responsive, it could be a temporary overload\&. Also a return value of \fItrue\fR does only mean that the message could be sent on the (TCP) channel without blocking, the message is not guaranteed to have arrived at the remote node\&. Also in the case of a disconnected non-responsive node, the return value is \fItrue\fR (mimics the behaviour of the \fI!\fR operator)\&. The expected behaviour as well as the actions to take when the function returns \fIfalse\fR are application and hardware specific\&.
.SS Warning:
.LP
Use with extreme care!

.RE
.LP
.B
erlang:send_nosuspend(Dest, Msg, Options) -> bool()
.br
.RS
.TP
Types
Dest = pid() | port() | RegName | {RegName, Node}
.br
RegName = atom()
.br
Node = node()
.br
Msg = term()
.br
Option = noconnect
.br
.RE
.RS
.LP
The same as erlang:send(Dest, Msg, [nosuspend | Options]), but with boolean return value\&.
.LP
This function behaves like erlang:send_nosuspend/2), but takes a third parameter, a list of options\&. The only currently implemented option is \fInoconnect\fR\&. The option \fInoconnect\fR makes the function return \fIfalse\fR if the remote node is not currently reachable by the local node\&. The normal behaviour is to try to connect to the node, which may stall the process for a shorter period\&. The use of the \fInoconnect\fR option makes it possible to be absolutely sure not to get even the slightest delay when sending to a remote process\&. This is especially useful when communicating with nodes who expect to always be the connecting part (i\&.e\&. nodes written in C or Java)\&.
.LP
Whenever the function returns \fIfalse\fR (either when a suspend would occur or when \fInoconnect\fR was specified and the node was not already connected), the message is guaranteed \fInot\fR to have been sent\&.
.SS Warning:
.LP
Use with extreme care!

.RE
.LP
.B
erlang:set_cookie(Node, Cookie) -> true
.br
.RS
.TP
Types
Node = node()
.br
Cookie = atom()
.br
.RE
.RS
.LP
Sets the magic cookie of \fINode\fR to the atom \fICookie\fR\&. If \fINode\fR is the local node, the function also sets the cookie of all other unknown nodes to \fICookie\fR (see Distributed Erlang in the Erlang Reference Manual)\&.
.LP
Failure: \fIfunction_clause\fR if the local node is not alive\&.
.RE
.LP
.B
setelement(Index, Tuple1, Value) -> Tuple2
.br
.RS
.TP
Types
Index = 1\&.\&.tuple_size(Tuple1)
.br
Tuple1 = Tuple2 = tuple()
.br
Value = term()
.br
.RE
.RS
.LP
Returns a tuple which is a copy of the argument \fITuple1\fR with the element given by the integer argument \fIIndex\fR (the first element is the element with index 1) replaced by the argument \fIValue\fR\&.

.nf
> setelement(2, {10, green, bottles}, red)\&.

{10,red,bottles}
.fi
.RE
.LP
.B
size(Item) -> int()
.br
.RS
.TP
Types
Item = tuple() | binary()
.br
.RE
.RS
.LP
Returns an integer which is the size of the argument \fIItem\fR, which must be either a tuple or a binary\&.

.nf
> size({morni, mulle, bwange})\&.

3
.fi
.LP
Allowed in guard tests\&.
.RE
.LP
.B
spawn(Fun) -> pid()
.br
.RS
.TP
Types
Fun = fun()
.br
.RE
.RS
.LP
Returns the pid of a new process started by the application of \fIFun\fR to the empty list \fI[]\fR\&. Otherwise works like spawn/3\&.
.RE
.LP
.B
spawn(Node, Fun) -> pid()
.br
.RS
.TP
Types
Node = node()
.br
Fun = fun()
.br
.RE
.RS
.LP
Returns the pid of a new process started by the application of \fIFun\fR to the empty list \fI[]\fR on \fINode\fR\&. If \fINode\fR does not exist, a useless pid is returned\&. Otherwise works like spawn/3\&.
.RE
.LP
.B
spawn(Module, Function, Args) -> pid()
.br
.RS
.TP
Types
Module = Function = atom()
.br
Args = [term()]
.br
.RE
.RS
.LP
Returns the pid of a new process started by the application of \fIModule:Function\fR to \fIArgs\fR\&. The new process created will be placed in the system scheduler queue and be run some time later\&.
.LP
\fIerror_handler:undefined_function(Module, Function, Args)\fR is evaluated by the new process if \fIModule:Function/Arity\fR does not exist (where \fIArity\fR is the length of \fIArgs\fR)\&. The error handler can be redefined (see process_flag/2)\&. If \fIerror_handler\fR is undefined, or the user has redefined the default \fIerror_handler\fR its replacement is undefined, a failure with the reason \fIundef\fR will occur\&.

.nf
> spawn(speed, regulator, [high_speed, thin_cut])\&.

<0\&.13\&.1>
.fi
.RE
.LP
.B
spawn(Node, Module, Function, ArgumentList) -> pid()
.br
.RS
.TP
Types
Node = node()
.br
Module = Function = atom()
.br
Args = [term()]
.br
.RE
.RS
.LP
Returns the pid of a new process started by the application of \fIModule:Function\fR to \fIArgs\fR on \fINode\fR\&. If \fINode\fR does not exists, a useless pid is returned\&. Otherwise works like spawn/3\&.
.RE
.LP
.B
spawn_link(Fun) -> pid()
.br
.RS
.TP
Types
Fun = fun()
.br
.RE
.RS
.LP
Returns the pid of a new process started by the application of \fIFun\fR to the empty list []\&. A link is created between the calling process and and the new process, atomically\&. Otherwise works like spawn/3\&.
.RE
.LP
.B
spawn_link(Node, Fun) ->
.br
.RS
.TP
Types
Node = node()
.br
Fun = fun()
.br
.RE
.RS
.LP
Returns the pid of a new process started by the application of \fIFun\fR to the empty list [] on \fINode\fR\&. A link is created between the calling process and and the new process, atomically\&. If \fINode\fR does not exist, a useless pid is returned (and due to the link, an exit signal with exit reason \fInoconnection\fR will be received)\&. Otherwise works like spawn/3\&.
.RE
.LP
.B
spawn_link(Module, Function, Args) -> pid()
.br
.RS
.TP
Types
Module = Function = atom()
.br
Args = [term()]
.br
.RE
.RS
.LP
Returns the pid of a new process started by the application of \fIModule:Function\fR to \fIArgs\fR\&. A link is created between the calling process and the new process, atomically\&. Otherwise works like spawn/3\&.
.RE
.LP
.B
spawn_link(Node, Module, Function, Args) -> pid()
.br
.RS
.TP
Types
Node = node()
.br
Module = Function = atom()
.br
Args = [term()]
.br
.RE
.RS
.LP
Returns the pid of a new process started by the application of \fIModule:Function\fR to \fIArgs\fR on \fINode\fR\&. A link is created between the calling process and the new process, atomically\&. If \fINode\fR does not exist, a useless pid is returned (and due to the link, an exit signal with exit reason \fInoconnection\fR will be received)\&. Otherwise works like spawn/3\&.
.RE
.LP
.B
spawn_monitor(Fun) -> {pid(),reference()}
.br
.RS
.TP
Types
Fun = fun()
.br
.RE
.RS
.LP
Returns the pid of a new process started by the application of \fIFun\fR to the empty list [] and reference for a monitor created to the new process\&. Otherwise works like spawn/3\&.
.RE
.LP
.B
spawn_monitor(Module, Function, Args) -> {pid(),reference()}
.br
.RS
.TP
Types
Module = Function = atom()
.br
Args = [term()]
.br
.RE
.RS
.LP
A new process is started by the application of \fIModule:Function\fR to \fIArgs\fR, and the process is monitored at the same time\&. Returns the pid and a reference for the monitor\&. Otherwise works like spawn/3\&.
.RE
.LP
.B
spawn_opt(Fun, [Option]) -> pid() | {pid(),reference()}
.br
.RS
.TP
Types
Fun = fun()
.br
Option = link | monitor | {priority, Level} | {fullsweep_after, Number} | {min_heap_size, Size}
.br
Level = low | normal | high
.br
Number = int()
.br
Size = int()
.br
.RE
.RS
.LP
Returns the pid of a new process started by the application of \fIFun\fR to the empty list \fI[]\fR\&. Otherwise works like spawn_opt/4\&.
.LP
If the option \fImonitor\fR is given, the newly created process will be monitored and both the pid and reference for the monitor will be returned\&.
.RE
.LP
.B
spawn_opt(Node, Fun, [Option]) -> pid()
.br
.RS
.TP
Types
Node = node()
.br
Fun = fun()
.br
Option = link | {priority, Level} | {fullsweep_after, Number} | {min_heap_size, Size}
.br
Level = low | normal | high
.br
Number = int()
.br
Size = int()
.br
.RE
.RS
.LP
Returns the pid of a new process started by the application of \fIFun\fR to the empty list \fI[]\fR on \fINode\fR\&. If \fINode\fR does not exist, a useless pid is returned\&. Otherwise works like spawn_opt/4\&.
.RE
.LP
.B
spawn_opt(Module, Function, Args, [Option]) -> pid() | {pid(),reference()}
.br
.RS
.TP
Types
Module = Function = atom()
.br
Args = [term()]
.br
Option = link | monitor | {priority, Level} | {fullsweep_after, Number} | {min_heap_size, Size}
.br
Level = low | normal | high
.br
Number = int()
.br
Size = int()
.br
.RE
.RS
.LP
Works exactly like spawn/3, except that an extra option list is given when creating the process\&.
.LP
If the option \fImonitor\fR is given, the newly created process will be monitored and both the pid and reference for the monitor will be returned\&.
.RS 2
.TP 4
.B
\fIlink\fR:
Sets a link to the parent process (like \fIspawn_link/3\fR does)\&.
.TP 4
.B
\fImonitor\fR:
Monitor the new process (just like erlang:monitor/2 does)\&.
.TP 4
.B
\fI{priority, Level}\fR:
Sets the priority of the new process\&. Equivalent to executing process_flag(priority, Level) in the start function of the new process, except that the priority will be set before the process is selected for execution for the first time\&. For more information on priorities see process_flag(priority, Level)\&.
.TP 4
.B
\fI{fullsweep_after, Number}\fR:
This option is only useful for performance tuning\&. In general, you should not use this option unless you know that there is problem with execution times and/or memory consumption, and you should measure to make sure that the option improved matters\&. 
.RS 4
.LP

.LP
The Erlang runtime system uses a generational garbage collection scheme, using an "old heap" for data that has survived at least one garbage collection\&. When there is no more room on the old heap, a fullsweep garbage collection will be done\&.
.LP

.LP
The \fIfullsweep_after\fR option makes it possible to specify the maximum number of generational collections before forcing a fullsweep even if there is still room on the old heap\&. Setting the number to zero effectively disables the general collection algorithm, meaning that all live data is copied at every garbage collection\&.
.LP

.LP
Here are a few cases when it could be useful to change \fIfullsweep_after\fR\&. Firstly, if binaries that are no longer used should be thrown away as soon as possible\&. (Set \fINumber\fR to zero\&.) Secondly, a process that mostly have short-lived data will be fullsweeped seldom or never, meaning that the old heap will contain mostly garbage\&. To ensure a fullsweep once in a while, set \fINumber\fR to a suitable value such as 10 or 20\&. Thirdly, in embedded systems with limited amount of RAM and no virtual memory, one might want to preserve memory by setting \fINumber\fR to zero\&. (The value may be set globally, see erlang:system_flag/2\&.)
.RE
.TP 4
.B
\fI{min_heap_size, Size}\fR:
This option is only useful for performance tuning\&. In general, you should not use this option unless you know that there is problem with execution times and/or memory consumption, and you should measure to make sure that the option improved matters\&. 
.RS 4
.LP

.LP
Gives a minimum heap size in words\&. Setting this value higher than the system default might speed up some processes because less garbage collection is done\&. Setting too high value, however, might waste memory and slow down the system due to worse data locality\&. Therefore, it is recommended to use this option only for fine-tuning an application and to measure the execution time with various \fISize\fR values\&.
.RE
.RE
.RE
.LP
.B
spawn_opt(Node, Module, Function, Args, [Option]) -> pid()
.br
.RS
.TP
Types
Node = node()
.br
Module = Function = atom()
.br
Args = [term()]
.br
Option = link | {priority, Level} | {fullsweep_after, Number} | {min_heap_size, Size}
.br
Level = low | normal | high
.br
Number = int()
.br
Size = int()
.br
.RE
.RS
.LP
Returns the pid of a new process started by the application of \fIModule:Function\fR to \fIArgs\fR on \fINode\fR\&. If \fINode\fR does not exist, a useless pid is returned\&. Otherwise works like spawn_opt/4\&.
.RE
.LP
.B
split_binary(Bin, Pos) -> {Bin1, Bin2}
.br
.RS
.TP
Types
Bin = Bin1 = Bin2 = binary()
.br
Pos = 1\&.\&.byte_size(Bin)
.br
.RE
.RS
.LP
Returns a tuple containing the binaries which are the result of splitting \fIBin\fR into two parts at position \fIPos\fR\&. This is not a destructive operation\&. After the operation, there will be three binaries altogether\&.

.nf
> B = list_to_binary("0123456789")\&.

<<"0123456789">>
> byte_size(B)\&.

10
> {B1, B2} = split_binary(B,3)\&.

{<<"012">>,<<"3456789">>}
> byte_size(B1)\&.

3
> byte_size(B2)\&.

7
.fi
.RE
.LP
.B
erlang:start_timer(Time, Dest, Msg) -> TimerRef
.br
.RS
.TP
Types
Time = int()
.br
0 <= Time <= 4294967295
.br
Dest = LocalPid | RegName 
.br
LocalPid = pid() (of a process, alive or dead, on the local node)
.br
RegName = atom()
.br
Msg = term()
.br
TimerRef = ref()
.br
.RE
.RS
.LP
Starts a timer which will send the message \fI{timeout, TimerRef, Msg}\fR to \fIDest\fR after \fITime\fR milliseconds\&.
.LP
If \fIDest\fR is an atom, it is supposed to be the name of a registered process\&. The process referred to by the name is looked up at the time of delivery\&. No error is given if the name does not refer to a process\&.
.LP
If \fIDest\fR is a pid, the timer will be automatically canceled if the process referred to by the pid is not alive, or when the process exits\&. This feature was introduced in erts version 5\&.4\&.11\&. Note that timers will not be automatically canceled when \fIDest\fR is an atom\&.
.LP
See also erlang:send_after/3, erlang:cancel_timer/1, and erlang:read_timer/1\&.
.LP
Failure: \fIbadarg\fR if the arguments does not satisfy the requirements specified above\&.
.RE
.LP
.B
statistics(Type) -> Res
.br
.RS
.TP
Types
Type, Res -- see below
.br
.RE
.RS
.LP
Returns information about the system as specified by \fIType\fR:
.RS 2
.TP 4
.B
\fIcontext_switches\fR:
Returns \fI{ContextSwitches, 0}\fR, where \fIContextSwitches\fR is the total number of context switches since the system started\&.
.TP 4
.B
\fIexact_reductions\fR:
 
.RS 4
.LP
Returns \fI{Total_Exact_Reductions, Exact_Reductions_Since_Last_Call}\fR\&.
.LP

.LP
\fINOTE:\fR\fIstatistics(exact_reductions)\fR is a more expensive operation than statistics(reductions) especially on an Erlang machine with SMP support\&.
.RE
.TP 4
.B
\fIgarbage_collection\fR:
Returns \fI{Number_of_GCs, Words_Reclaimed, 0}\fR\&. This information may not be valid for all implementations\&.
.TP 4
.B
\fIio\fR:
Returns \fI{{input, Input}, {output, Output}}\fR, where \fIInput\fR is the total number of bytes received through ports, and \fIOutput\fR is the total number of bytes output to ports\&.
.TP 4
.B
\fIreductions\fR:
 
.RS 4
.LP
Returns \fI{Total_Reductions, Reductions_Since_Last_Call}\fR\&.
.LP

.LP
\fINOTE:\fR From erts version 5\&.5 (OTP release R11B) this value does not include reductions performed in current time slices of currently scheduled processes\&. If an exact value is wanted, use statistics(exact_reductions)\&.
.RE
.TP 4
.B
\fIrun_queue\fR:
Returns the length of the run queue, that is, the number of processes that are ready to run\&.
.TP 4
.B
\fIruntime\fR:
Returns \fI{Total_Run_Time, Time_Since_Last_Call}\fR\&.
.TP 4
.B
\fIwall_clock\fR:
Returns \fI{Total_Wallclock_Time, Wallclock_Time_Since_Last_Call}\fR\&. \fIwall_clock\fR can be used in the same manner as \fIruntime\fR, except that real time is measured as opposed to runtime or CPU time\&.
.RE
.LP
All times are in milliseconds\&.

.nf
> statistics(runtime)\&.

{1690,1620}
> statistics(reductions)\&.

{2046,11}
> statistics(garbage_collection)\&.

{85,23961,0}
.fi
.RE
.LP
.B
erlang:suspend_process(Suspendee, OptList) -> true | false
.br
.RS
.TP
Types
Suspendee = pid()
.br
OptList = [Opt]
.br
Opt = atom()
.br
.RE
.RS
.LP
Increases the suspend count on the process identified by \fISuspendee\fR and puts it in the suspended state if it isn\&'t already in the suspended state\&. A suspended process will not be scheduled for execution until the process has been resumed\&. 
.LP
A process can be suspended by multiple processes and can be suspended multiple times by a single process\&. A suspended process will not leave the suspended state until its suspend count reach zero\&. The suspend count of \fISuspendee\fR is decreased when erlang:resume_process(Suspendee) is called by the same process that called \fIerlang:suspend_process(Suspendee)\fR\&. All increased suspend counts on other processes acquired by a process will automatically be decreased when the process terminates\&.
.LP
Currently the following options (\fIOpt\fRs) are available:
.RS 2
.TP 4
.B
\fIasynchronous\fR:
A suspend request is sent to the process identified by \fISuspendee\fR\&. \fISuspendee\fR will eventually suspend unless it is resumed before it was able to suspend\&. The caller of \fIerlang:suspend_process/2\fR will return immediately, regardless of whether the \fISuspendee\fR has suspended yet or not\&. Note that the point in time when the \fISuspendee\fR will actually suspend cannot be deduced from other events in the system\&. The only guarantee given is that the \fISuspendee\fR will \fIeventually\fR suspend (unless it is resumed)\&. If the \fIasynchronous\fR option has \fInot\fR been passed, the caller of \fIerlang:suspend_process/2\fR will be blocked until the \fISuspendee\fR has actually suspended\&.
.TP 4
.B
\fIunless_suspending\fR:
The process identified by \fISuspendee\fR will be suspended unless the calling process already is suspending the \fISuspendee\fR\&. If \fIunless_suspending\fR is combined with the \fIasynchronous\fR option, a suspend request will be sent unless the calling process already is suspending the \fISuspendee\fR or if a suspend request already has been sent and is in transit\&. If the calling process already is suspending the \fISuspendee\fR, or if combined with the \fIasynchronous\fR option and a send request already is in transit, \fIfalse\fR is returned and the suspend count on \fISuspendee\fR will remain unchanged\&.
.RE
.LP
If the suspend count on the process identified by \fISuspendee\fR was increased, \fItrue\fR is returned; otherwise, \fIfalse\fR is returned\&.
.SS Warning:
.LP
This BIF is intended for debugging only\&.

.LP
Failures:
.RS 2
.TP 4
.B
\fIbadarg\fR:
If \fISuspendee\fR isn\&'t a process identifier\&.
.TP 4
.B
\fIbadarg\fR:
If the process identified by \fISuspendee\fR is same the process as the process calling \fIerlang:suspend_process/2\fR\&.
.TP 4
.B
\fIbadarg\fR:
If the process identified by \fISuspendee\fR is not alive\&.
.TP 4
.B
\fIbadarg\fR:
If the process identified by \fISuspendee\fR resides on another node\&.
.TP 4
.B
\fIbadarg\fR:
If \fIOptList\fR isn\&'t a proper list of valid \fIOpt\fRs\&.
.TP 4
.B
\fIsystem_limit\fR:
If the process identified by \fISuspendee\fR has been suspended more times by the calling process than can be represented by the currently used internal data structures\&. The current system limit is larger than 2 000 000 000 suspends, and it will never be less than that\&.
.RE
.RE
.LP
.B
erlang:suspend_process(Suspendee) -> true
.br
.RS
.TP
Types
Suspendee = pid()
.br
.RE
.RS
.LP
Suspends the process identified by \fISuspendee\fR\&. The same as calling erlang:suspend_process(Suspendee, [])\&. For more information see the documentation of erlang:suspend_process/2\&. 
.SS Warning:
.LP
This BIF is intended for debugging only\&.

.RE
.LP
.B
erlang:system_flag(Flag, Value) -> OldValue
.br
.RS
.TP
Types
Flag, Value, OldValue -- see below
.br
.RE
.RS
.LP
Sets various system properties of the Erlang node\&. Returns the old value of the flag\&.
.RS 2
.TP 4
.B
\fIerlang:system_flag(backtrace_depth, Depth)\fR:
Sets the maximum depth of call stack back-traces in the exit reason element of \fI\&'EXIT\&'\fR tuples\&.
.TP 4
.B
\fIerlang:system_flag(fullsweep_after, Number)\fR:
\fINumber\fR is a non-negative integer which indicates how many times generational garbages collections can be done without forcing a fullsweep collection\&. The value applies to new processes; processes already running are not affected\&.
.RS 4
.LP

.LP
In low-memory systems (especially without virtual memory), setting the value to 0 can help to conserve memory\&.
.LP

.LP
An alternative way to set this value is through the (operating system) environment variable \fIERL_FULLSWEEP_AFTER\fR\&.
.RE
.TP 4
.B
\fIerlang:system_flag(min_heap_size, MinHeapSize)\fR:
Sets the default minimum heap size for processes\&. The size is given in words\&. The new \fImin_heap_size\fR only effects processes spawned after the change of \fImin_heap_size\fR has been made\&. The \fImin_heap_size\fR can be set for individual processes by use of spawn_opt/N or process_flag/2\&. 
.TP 4
.B
\fIerlang:system_flag(multi_scheduling, BlockState)\fR:
 
.RS 4
.LP
\fIBlockState = block | unblock\fR
.LP

.LP
If multi-scheduling is enabled, more than one scheduler thread is used by the emulator\&. Multi-scheduling can be blocked\&. When multi-scheduling has been blocked, only one scheduler thread will schedule Erlang processes\&.
.LP

.LP
If \fIBlockState =:= block\fR, multi-scheduling will be blocked\&. If \fIBlockState =:= unblock\fR and no-one else is blocking multi-scheduling and this process has only blocked one time, multi-scheduling will be unblocked\&. One process can block multi-scheduling multiple times\&. If a process has blocked multiple times, it has to unblock exactly as many times as it has blocked before it has released its multi-scheduling block\&. If a process that has blocked multi-scheduling exits, it will release its blocking of multi-scheduling\&.
.LP

.LP
The return values are \fIdisabled\fR, \fIblocked\fR, or \fIenabled\fR\&. The returned value describes the state just after the call to \fIerlang:system_flag(multi_scheduling, BlockState)\fR has been made\&. The return values are described in the documentation of erlang:system_info(multi_scheduling)\&.
.LP

.LP
\fINOTE\fR: Blocking of multi-scheduling should normally not be needed\&. If you feel that you need to block multi-scheduling, think through the problem at least a couple of times again\&. Blocking multi-scheduling should only be used as a last resort since it will most likely be a \fIvery inefficient\fR way to solve the problem\&.
.LP

.LP
See also erlang:system_info(multi_scheduling), erlang:system_info(multi_scheduling_blockers), and erlang:system_info(schedulers)\&.
.RE
.TP 4
.B
\fIerlang:system_flag(trace_control_word, TCW)\fR:
Sets the value of the node\&'s trace control word to \fITCW\fR\&. \fITCW\fR should be an unsigned integer\&. For more information see documentation of the set_tcw function in the match specification documentation in the ERTS User\&'s Guide\&.
.RE
.SS Note:
.LP
The \fIschedulers\fR option has been removed as of erts version 5\&.5\&.3\&. The number of scheduler threads is determined at emulator boot time, and cannot be changed after that\&.

.RE
.LP
.B
erlang:system_info(Type) -> Res
.br
.RS
.TP
Types
Type, Res -- see below
.br
.RE
.RS
.LP
Returns various information about the current system (emulator) as specified by \fIType\fR:
.RS 2
.TP 4
.B
\fIallocated_areas\fR:
 
.RS 4
.LP
Returns a list of tuples with information about miscellaneous allocated memory areas\&.
.LP

.LP
Each tuple contains an atom describing type of memory as first element and amount of allocated memory in bytes as second element\&. In those cases when there is information present about allocated and used memory, a third element is present\&. This third element contains the amount of used memory in bytes\&.
.LP

.LP
\fIerlang:system_info(allocated_areas)\fR is intended for debugging, and the content is highly implementation dependent\&. The content of the results will therefore change when needed without prior notice\&.
.LP

.LP
\fINote:\fR The sum of these values is \fInot\fR the total amount of memory allocated by the emulator\&. Some values are part of other values, and some memory areas are not part of the result\&. If you are interested in the total amount of memory allocated by the emulator see erlang:memory/0,1\&.
.RE
.TP 4
.B
\fIallocator\fR:
 
.RS 4
.LP
Returns \fI{Allocator, Version, Features, Settings}\&.\fR
.LP

.LP
Types:
.LP

.RS 2
.TP 2
*
\fIAllocator = undefined | elib_malloc | glibc\fR
.TP 2
*
\fIVersion = [int()]\fR
.TP 2
*
\fIFeatures = [atom()]\fR
.TP 2
*
\fISettings = [{Subsystem, [{Parameter, Value}]}]\fR
.TP 2
*
\fISubsystem = atom()\fR
.TP 2
*
\fIParameter = atom()\fR
.TP 2
*
\fIValue = term()\fR
.RE
.LP

.LP
Explanation:
.LP

.RS 2
.TP 2
*
\fIAllocator\fR corresponds to the \fImalloc()\fR implementation used\&. If \fIAllocator\fR equals \fIundefined\fR, the \fImalloc()\fR implementation used could not be identified\&. Currently \fIelib_malloc\fR and \fIglibc\fR can be identified\&.
.TP 2
*
\fIVersion\fR is a list of integers (but not a string) representing the version of the \fImalloc()\fR implementation used\&.
.TP 2
*
\fIFeatures\fR is a list of atoms representing allocation features used\&.
.TP 2
*
\fISettings\fR is a list of subsystems, their configurable parameters, and used values\&. Settings may differ between different combinations of platforms, allocators, and allocation features\&. Memory sizes are given in bytes\&.
.RE
.LP

.LP
See also "System Flags Effecting erts_alloc" in erts_alloc(3)\&.
.RE
.TP 4
.B
\fIalloc_util_allocators\fR:
 
.RS 4
.LP
Returns a list of the names of all allocators using the ERTS internal \fIalloc_util\fR framework as atoms\&. For more information see the "the alloc_util framework" section in the erts_alloc(3) documentation\&. 
.RE
.TP 4
.B
\fI{allocator, Alloc}\fR:
 
.RS 4
.LP
Returns information about the specified allocator\&. As of erts version 5\&.6\&.1 the return value is a list of \fI{instance, InstanceNo, InstanceInfo}\fR tuples where \fIInstanceInfo\fR contains information about a specific instance of the allocator\&. If \fIAlloc\fR is not a recognized allocator, \fIundefined\fR is returned\&. If \fIAlloc\fR is disabled, \fIfalse\fR is returned\&.
.LP

.LP
\fINote:\fR The information returned is highly implementation dependent and may be changed, or removed at any time without prior notice\&. It was initially intended as a tool when developing new allocators, but since it might be of interest for others it has been briefly documented\&.
.LP

.LP
The recognized allocators are listed in erts_alloc(3)\&. After reading the \fIerts_alloc(3)\fR documentation, the returned information should more or less speak for itself\&. But it can be worth explaining some things\&. Call counts are presented by two values\&. The first value is giga calls, and the second value is calls\&. \fImbcs\fR, and \fIsbcs\fR are abbreviations for, respectively, multi-block carriers, and single-block carriers\&. Sizes are presented in bytes\&. When it is not a size that is presented, it is the amount of something\&. Sizes and amounts are often presented by three values, the first is current value, the second is maximum value since the last call to \fIerlang:system_info({allocator, Alloc})\fR, and the third is maximum value since the emulator was started\&. If only one value is present, it is the current value\&. \fIfix_alloc\fR memory block types are presented by two values\&. The first value is memory pool size and the second value used memory size\&.
.RE
.TP 4
.B
\fI{allocator_sizes, Alloc}\fR:
 
.RS 4
.LP
Returns various size information for the specified allocator\&. The information returned is a subset of the information returned by erlang:system_info({allocator, Alloc})\&. 
.RE
.TP 4
.B
\fIc_compiler_used\fR:
Returns a two-tuple describing the C compiler used when compiling the runtime system\&. The first element is an atom describing the name of the compiler, or \fIundefined\fR if unknown\&. The second element is a term describing the version of the compiler, or \fIundefined\fR if unknown\&. 
.TP 4
.B
\fIcheck_io\fR:
Returns a list containing miscellaneous information regarding the emulators internal I/O checking\&. Note, the content of the returned list may vary between platforms and over time\&. The only thing guaranteed is that a list is returned\&.
.TP 4
.B
\fIcompat_rel\fR:
Returns the compatibility mode of the local node as an integer\&. The integer returned represents the Erlang/OTP release which the current emulator has been set to be backward compatible with\&. The compatibility mode can be configured at startup by using the command line flag \fI+R\fR, see erl(1)\&.
.TP 4
.B
\fIcreation\fR:
Returns the creation of the local node as an integer\&. The creation is changed when a node is restarted\&. The creation of a node is stored in process identifiers, port identifiers, and references\&. This makes it (to some extent) possible to distinguish between identifiers from different incarnations of a node\&. Currently valid creations are integers in the range 1\&.\&.3, but this may (probably will) change in the future\&. If the node is not alive, 0 is returned\&.
.TP 4
.B
\fIdebug_compiled\fR:
Returns \fItrue\fR if the emulator has been debug compiled; otherwise, \fIfalse\fR\&. 
.TP 4
.B
\fIdist\fR:
Returns a binary containing a string of distribution information formatted as in Erlang crash dumps\&. For more information see the "How to interpret the Erlang crash dumps" chapter in the ERTS User\&'s Guide\&.
.TP 4
.B
\fIdist_ctrl\fR:
Returns a list of tuples \fI{Node, ControllingEntity}\fR, one entry for each connected remote node\&. The \fINode\fR is the name of the node and the \fIControllingEntity\fR is the port or pid responsible for the communication to that node\&. More specifically, the \fIControllingEntity\fR for nodes connected via TCP/IP (the normal case) is the socket actually used in communication with the specific node\&.
.TP 4
.B
\fIdriver_version\fR:
Returns a string containing the erlang driver version used by the runtime system\&. It will be on the form "<major ver>\&.<minor ver>"\&.
.TP 4
.B
\fIelib_malloc\fR:
If the emulator uses the \fIelib_malloc\fR memory allocator, a list of two-element tuples containing status information is returned; otherwise, \fIfalse\fR is returned\&. The list currently contains the following two-element tuples (all sizes are presented in bytes):
.RS 4
.LP

.RS 2
.TP 4
.B
\fI{heap_size, Size}\fR:
Where \fISize\fR is the current heap size\&.
.TP 4
.B
\fI{max_alloced_size, Size}\fR:
Where \fISize\fR is the maximum amount of memory allocated on the heap since the emulator started\&.
.TP 4
.B
\fI{alloced_size, Size}\fR:
Where \fISize\fR is the current amount of memory allocated on the heap\&.
.TP 4
.B
\fI{free_size, Size}\fR:
Where \fISize\fR is the current amount of free memory on the heap\&.
.TP 4
.B
\fI{no_alloced_blocks, No}\fR:
Where \fINo\fR is the current number of allocated blocks on the heap\&.
.TP 4
.B
\fI{no_free_blocks, No}\fR:
Where \fINo\fR is the current number of free blocks on the heap\&.
.TP 4
.B
\fI{smallest_alloced_block, Size}\fR:
Where \fISize\fR is the size of the smallest allocated block on the heap\&.
.TP 4
.B
\fI{largest_free_block, Size}\fR:
Where \fISize\fR is the size of the largest free block on the heap\&.
.RE
.RE
.TP 4
.B
\fIfullsweep_after\fR:
Returns \fI{fullsweep_after, int()}\fR which is the \fIfullsweep_after\fR garbage collection setting used by default\&. For more information see \fIgarbage_collection\fR described below\&.
.TP 4
.B
\fIgarbage_collection\fR:
Returns a list describing the default garbage collection settings\&. A process spawned on the local node by a \fIspawn\fR or \fIspawn_link\fR will use these garbage collection settings\&. The default settings can be changed by use of system_flag/2\&. spawn_opt/4 can spawn a process that does not use the default settings\&.
.TP 4
.B
\fIglobal_heaps_size\fR:
Returns the current size of the shared (global) heap\&.
.TP 4
.B
\fIheap_sizes\fR:
Returns a list of integers representing valid heap sizes in words\&. All Erlang heaps are sized from sizes in this list\&.
.TP 4
.B
\fIheap_type\fR:
Returns the heap type used by the current emulator\&. Currently the following heap types exist:
.RS 4
.LP

.RS 2
.TP 4
.B
\fIprivate\fR:
Each process has a heap reserved for its use and no references between heaps of different processes are allowed\&. Messages passed between processes are copied between heaps\&.
.TP 4
.B
\fIshared\fR:
One heap for use by all processes\&. Messages passed between processes are passed by reference\&.
.TP 4
.B
\fIhybrid\fR:
A hybrid of the \fIprivate\fR and \fIshared\fR heap types\&. A shared heap as well as private heaps are used\&.
.RE
.RE
.TP 4
.B
\fIinfo\fR:
Returns a binary containing a string of miscellaneous system information formatted as in Erlang crash dumps\&. For more information see the "How to interpret the Erlang crash dumps" chapter in the ERTS User\&'s Guide\&.
.TP 4
.B
\fIkernel_poll\fR:
Returns \fItrue\fR if the emulator uses some kind of kernel-poll implementation; otherwise, \fIfalse\fR\&.
.TP 4
.B
\fIloaded\fR:
Returns a binary containing a string of loaded module information formatted as in Erlang crash dumps\&. For more information see the "How to interpret the Erlang crash dumps" chapter in the ERTS User\&'s Guide\&.
.TP 4
.B
\fIlogical_processors\fR:
Returns the number of logical processors detected on the system as an integer or the atom \fIunknown\fR if the emulator wasn\&'t able to detect any\&. 
.TP 4
.B
\fImachine\fR:
Returns a string containing the Erlang machine name\&.
.TP 4
.B
\fImodified_timing_level\fR:
Returns the modified timing level (an integer) if modified timing has been enabled; otherwise, \fIundefined\fR\&. See the \fI+T\fR command line flag in the documentation of the erl(1) command for more information on modified timing\&.
.TP 4
.B
\fImulti_scheduling\fR:
 
.RS 4
.LP
Returns \fIdisabled\fR, \fIblocked\fR, or \fIenabled\fR\&. A description of the return values:
.LP

.RS 2
.TP 4
.B
\fIdisabled\fR:
The emulator has only one scheduler thread\&. The emulator does not have SMP support, or have been started with only one scheduler thread\&.
.TP 4
.B
\fIblocked\fR:
The emulator has more than one scheduler thread, but all scheduler threads but one have been blocked, i\&.e\&., only one scheduler thread will schedule Erlang processes and execute Erlang code\&.
.TP 4
.B
\fIenabled\fR:
The emulator has more than one scheduler thread, and no scheduler threads have been blocked, i\&.e\&., all available scheduler threads will schedule Erlang processes and execute Erlang code\&.
.RE
.LP

.LP
See also erlang:system_flag(multi_scheduling, BlockState), erlang:system_info(multi_scheduling_blockers), and erlang:system_info(schedulers)\&.
.RE
.TP 4
.B
\fImulti_scheduling_blockers\fR:
 
.RS 4
.LP
Returns a list of \fIPID\fRs when multi-scheduling is blocked; otherwise, the empty list\&. The \fIPID\fRs in the list is \fIPID\fRs of the processes currently blocking multi-scheduling\&. A \fIPID\fR will only be present once in the list, even if the corresponding process has blocked multiple times\&.
.LP

.LP
See also erlang:system_flag(multi_scheduling, BlockState), erlang:system_info(multi_scheduling), and erlang:system_info(schedulers)\&.
.RE
.TP 4
.B
\fIotp_release\fR:
 
.RS 4
.LP
Returns a string containing the OTP release number\&.
.RE
.TP 4
.B
\fIprocess_count\fR:
Returns the number of processes currently existing at the local node as an integer\&. The same value as \fIlength(processes())\fR returns\&.
.TP 4
.B
\fIprocess_limit\fR:
Returns the maximum number of concurrently existing processes at the local node as an integer\&. This limit can be configured at startup by using the command line flag \fI+P\fR, see erl(1)\&.
.TP 4
.B
\fIprocs\fR:
Returns a binary containing a string of process and port information formatted as in Erlang crash dumps\&. For more information see the "How to interpret the Erlang crash dumps" chapter in the ERTS User\&'s Guide\&.
.TP 4
.B
\fIscheduler_id\fR:
 
.RS 4
.LP
Returns the scheduler id (\fISchedulerId\fR) of the scheduler thread that the calling process is executing on\&. \fISchedulerId\fR is a positive integer; where \fI1 <= SchedulerId <= erlang:system_info(schedulers)\fR\&. See also erlang:system_info(schedulers)\&.
.RE
.TP 4
.B
\fIschedulers\fR:
 
.RS 4
.LP
Returns the number of scheduler threads used by the emulator\&. A scheduler thread schedules Erlang processes and Erlang ports, and execute Erlang code and Erlang linked in driver code\&.
.LP

.LP
The number of scheduler threads is determined at emulator boot time and cannot be changed after that\&.
.LP

.LP
See also erlang:system_info(scheduler_id), erlang:system_flag(multi_scheduling, BlockState), erlang:system_info(multi_scheduling), and and erlang:system_info(multi_scheduling_blockers)\&.
.RE
.TP 4
.B
\fIsmp_support\fR:
Returns \fItrue\fR if the emulator has been compiled with smp support; otherwise, \fIfalse\fR\&.
.TP 4
.B
\fIsystem_version\fR:
Returns a string containing the emulator type and version as well as some important properties such as the size of the thread pool, etc\&.
.TP 4
.B
\fIsystem_architecture\fR:
Returns a string containing the processor and OS architecture the emulator is built for\&.
.TP 4
.B
\fIthreads\fR:
Returns \fItrue\fR if the emulator has been compiled with thread support; otherwise, \fIfalse\fR is returned\&.
.TP 4
.B
\fIthread_pool_size\fR:
 
.RS 4
.LP
Returns the number of async threads in the async thread pool used for asynchronous driver calls (driver_async()) as an integer\&.
.RE
.TP 4
.B
\fItrace_control_word\fR:
Returns the value of the node\&'s trace control word\&. For more information see documentation of the function \fIget_tcw\fR in "Match Specifications in Erlang", ERTS User\&'s Guide\&.
.TP 4
.B
\fIversion\fR:
 
.RS 4
.LP
Returns a string containing the version number of the emulator\&.
.RE
.TP 4
.B
\fIwordsize\fR:
Returns the word size in bytes as an integer, i\&.e\&. on a 32-bit architecture 4 is returned, and on a 64-bit architecture 8 is returned\&.
.RE
.SS Note:
.LP
The \fIscheduler\fR argument has changed name to \fIscheduler_id\fR\&. This in order to avoid mixup with the \fIschedulers\fR argument\&. The \fIscheduler\fR argument was introduced in ERTS version 5\&.5 and renamed in ERTS version 5\&.5\&.1\&.

.RE
.LP
.B
erlang:system_monitor() -> MonSettings
.br
.RS
.TP
Types
MonSettings -> {MonitorPid, Options} | undefined
.br
MonitorPid = pid()
.br
Options = [Option]
.br
Option = {long_gc, Time} | {large_heap, Size} | busy_port | busy_dist_port
.br
Time = Size = int()
.br
.RE
.RS
.LP
Returns the current system monitoring settings set by erlang:system_monitor/2 as \fI{MonitorPid, Options}\fR, or \fIundefined\fR if there are no settings\&. The order of the options may be different from the one that was set\&.
.RE
.LP
.B
erlang:system_monitor(undefined | {MonitorPid, Options}) -> MonSettings
.br
.RS
.TP
Types
MonitorPid, Options, MonSettings -- see below
.br
.RE
.RS
.LP
When called with the argument \fIundefined\fR, all system performance monitoring settings are cleared\&.
.LP
Calling the function with \fI{MonitorPid, Options}\fR as argument, is the same as calling erlang:system_monitor(MonitorPid, Options)\&.
.LP
Returns the previous system monitor settings just like erlang:system_monitor/0\&.
.RE
.LP
.B
erlang:system_monitor(MonitorPid, [Option]) -> MonSettings
.br
.RS
.TP
Types
MonitorPid = pid()
.br
Option = {long_gc, Time} | {large_heap, Size} | busy_port | busy_dist_port
.br
Time = Size = int()
.br
MonSettings = {OldMonitorPid, [Option]}
.br
OldMonitorPid = pid()
.br
.RE
.RS
.LP
Sets system performance monitoring options\&. \fIMonitorPid\fR is a local pid that will receive system monitor messages, and the second argument is a list of monitoring options:
.RS 2
.TP 4
.B
\fI{long_gc, Time}\fR:
If a garbage collection in the system takes at least \fITime\fR wallclock milliseconds, a message \fI{monitor, GcPid, long_gc, Info}\fR is sent to \fIMonitorPid\fR\&. \fIGcPid\fR is the pid that was garbage collected and \fIInfo\fR is a list of two-element tuples describing the result of the garbage collection\&. One of the tuples is \fI{timeout, GcTime}\fR where \fIGcTime\fR is the actual time for the garbage collection in milliseconds\&. The other tuples are tagged with \fIheap_size\fR, \fIheap_block_size\fR, \fIstack_size\fR, \fImbuf_size\fR, \fIold_heap_size\fR, and \fIold_heap_block_size\fR\&. These tuples are explained in the documentation of the gc_start trace message (see erlang:trace/3)\&. New tuples may be added, and the order of the tuples in the \fIInfo\fR list may be changed at any time without prior notice\&. 
.TP 4
.B
\fI{large_heap, Size}\fR:
If a garbage collection in the system results in the allocated size of a heap being at least \fISize\fR words, a message \fI{monitor, GcPid, large_heap, Info}\fR is sent to \fIMonitorPid\fR\&. \fIGcPid\fR and \fIInfo\fR are the same as for \fIlong_gc\fR above, except that the tuple tagged with \fItimeout\fR is not present\&. \fINote\fR: As of erts version 5\&.6 the monitor message is sent if the sum of the sizes of all memory blocks allocated for all heap generations is equal to or larger than \fISize\fR\&. Previously the monitor message was sent if the memory block allocated for the youngest generation was equal to or larger than \fISize\fR\&. 
.TP 4
.B
\fIbusy_port\fR:
If a process in the system gets suspended because it sends to a busy port, a message \fI{monitor, SusPid, busy_port, Port}\fR is sent to \fIMonitorPid\fR\&. \fISusPid\fR is the pid that got suspended when sending to \fIPort\fR\&.
.TP 4
.B
\fIbusy_dist_port\fR:
If a process in the system gets suspended because it sends to a process on a remote node whose inter-node communication was handled by a busy port, a message \fI{monitor, SusPid, busy_dist_port, Port}\fR is sent to \fIMonitorPid\fR\&. \fISusPid\fR is the pid that got suspended when sending through the inter-node communication port \fIPort\fR\&.
.RE
.LP
Returns the previous system monitor settings just like erlang:system_monitor/0\&.
.SS Note:
.LP
If a monitoring process gets so large that it itself starts to cause system monitor messages when garbage collecting, the messages will enlarge the process\&'s message queue and probably make the problem worse\&.
.LP
Keep the monitoring process neat and do not set the system monitor limits too tight\&.

.LP
Failure: \fIbadarg\fR if \fIMonitorPid\fR does not exist\&.
.RE
.LP
.B
erlang:system_profile() -> ProfilerSettings
.br
.RS
.TP
Types
ProfilerSettings -> {ProfilerPid, Options} | undefined
.br
ProfilerPid = pid() | port()
.br
Options = [Option]
.br
Option = runnable_procs | runnable_ports | scheduler | exclusive
.br
.RE
.RS
.LP
Returns the current system profiling settings set by erlang:system_profile/2 as \fI{ProfilerPid, Options}\fR, or \fIundefined\fR if there are no settings\&. The order of the options may be different from the one that was set\&.
.RE
.LP
.B
erlang:system_profile(ProfilerPid, Options) -> ProfilerSettings
.br
.RS
.TP
Types
ProfilerSettings -> {ProfilerPid, Options} | undefined
.br
ProfilerPid = pid() | port()
.br
Options = [Option]
.br
Option = runnable_procs | runnable_ports | scheduler | exclusive
.br
.RE
.RS
.LP
Sets system profiler options\&. \fIProfilerPid\fR is a local pid or port that will receive profiling messages\&. The receiver is excluded from all profiling\&. The second argument is a list of profiling options:
.RS 2
.TP 4
.B
\fIrunnable_procs\fR:
If a process is put into or removed from the runqueue a message, \fI{profile, Pid, State, Mfa, Ts}\fR, is sent to \fIProfilerPid\fR\&. Running processes that is reinsertet into the runqueue after completing its reductions does not trigger this message\&. 
.TP 4
.B
\fIrunnable_ports\fR:
If a port is put into or removed from the runqueue a message, \fI{profile, Port, State, 0, Ts}\fR, is sent to \fIProfilerPid\fR\&. 
.TP 4
.B
\fIscheduler\fR:
If a scheduler is put to sleep or awoken a message, \fI{profile, scheduler, Id, State, NoScheds, Ts}\fR, is sent to \fIProfilerPid\fR\&. 
.TP 4
.B
\fIexclusive\fR:
If a synchronous call to a port from a process is done, the calling process is considered not runnable during the call runtime to the port\&. The calling process is notified as \fIinactive\fR and subsequently \fIactive\fR when the port callback returns\&. 
.RE
.SS Note:
.LP
\fIerlang:system_profile\fR is considered experimental and its behaviour may change in the future\&.

.RE
.LP
.B
term_to_binary(Term) -> ext_binary()
.br
.RS
.TP
Types
Term = term()
.br
.RE
.RS
.LP
Returns a binary data object which is the result of encoding \fITerm\fR according to the Erlang external term format\&.
.LP
This can be used for a variety of purposes, for example writing a term to a file in an efficient way, or sending an Erlang term to some type of communications channel not supported by distributed Erlang\&.
.LP
See also binary_to_term/1\&.
.RE
.LP
.B
term_to_binary(Term, [Option]) -> ext_binary()
.br
.RS
.TP
Types
Term = term()
.br
Option = compressed | {compressed, Level} | {minor_version, Version}
.br
.RE
.RS
.LP
Returns a binary data object which is the result of encoding \fITerm\fR according to the Erlang external term format\&.
.LP
If the option \fIcompressed\fR is provided, the external term format will be compressed\&. The compressed format is automatically recognized by \fIbinary_to_term/1\fR in R7B and later\&.
.LP
It is also possible to specify a compression level by giving the option \fI{compressed, Level}\fR, where \fILevel\fR is an integer from 0 through 9\&. \fI0\fR means that no compression will be done (it is the same as not giving any \fIcompressed\fR option); \fI1\fR will take the least time but may not compress as well as the higher levels; \fI9\fR will take the most time and may produce a smaller result\&. Note the "mays" in the preceding sentence; depending on the input term, level 9 compression may or may not produce a smaller result than level 1 compression\&.
.LP
Currently, \fIcompressed\fR gives the same result as \fI{compressed, 6}\fR\&.
.LP
The option \fI{minor_version, Version}\fR can be use to control some details of the encoding\&. This option was introduced in R11B-4\&. Currently, the allowed values for \fIVersion\fR are \fI0\fR and \fI1\fR\&.
.LP
\fI{minor_version, 1}\fR forces any floats in the term to be encoded in a more space-efficient and exact way (namely in the 64-bit IEEE format, rather than converted to a textual representation)\&. \fIbinary_to_term/1\fR in R11B-4 and later is able decode the new representation\&.
.LP
\fI{minor_version, 0}\fR is currently the default, meaning that floats will be encoded using a textual representation; this option is useful if you want to ensure that releases prior to R11B-4 can decode resulting binary\&.
.LP
See also binary_to_term/1\&.
.RE
.LP
.B
throw(Any)
.br
.RS
.TP
Types
Any = term()
.br
.RE
.RS
.LP
A non-local return from a function\&. If evaluated within a \fIcatch\fR, \fIcatch\fR will return the value \fIAny\fR\&.

.nf
> catch throw({hello, there})\&.

{hello,there}
.fi
.LP
Failure: \fInocatch\fR if not evaluated within a catch\&.
.RE
.LP
.B
time() -> {Hour, Minute, Second}
.br
.RS
.TP
Types
Hour = Minute = Second = int()
.br
.RE
.RS
.LP
Returns the current time as \fI{Hour, Minute, Second}\fR\&.
.LP
The time zone and daylight saving time correction depend on the underlying OS\&.

.nf
> time()\&.

{9,42,44}
.fi
.RE
.LP
.B
tl(List1) -> List2
.br
.RS
.TP
Types
List1 = List2 = [term()]
.br
.RE
.RS
.LP
Returns the tail of \fIList1\fR, that is, the list minus the first element\&.

.nf
> tl([geesties, guilies, beasties])\&.

[guilies, beasties]
.fi
.LP
Allowed in guard tests\&.
.LP
Failure: \fIbadarg\fR if \fIList\fR is the empty list []\&.
.RE
.LP
.B
erlang:trace(PidSpec, How, FlagList) -> int()
.br
.RS
.TP
Types
PidSpec = pid() | existing | new | all
.br
How = bool()
.br
FlagList = [Flag]
.br
Flag -- see below
.br
.RE
.RS
.LP
Turns on (if \fIHow == true\fR) or off (if \fIHow == false\fR) the trace flags in \fIFlagList\fR for the process or processes represented by \fIPidSpec\fR\&.
.LP
\fIPidSpec\fR is either a pid for a local process, or one of the following atoms:
.RS 2
.TP 4
.B
\fIexisting\fR:
All processes currently existing\&.
.TP 4
.B
\fInew\fR:
All processes that will be created in the future\&.
.TP 4
.B
\fIall\fR:
All currently existing processes and all processes that will be created in the future\&.
.RE
.LP
\fIFlagList\fR can contain any number of the following flags (the "message tags" refers to the list of messages following below):
.RS 2
.TP 4
.B
\fIall\fR:
Set all trace flags except \fI{tracer, Tracer}\fR and \fIcpu_timestamp\fR that are in their nature different than the others\&.
.TP 4
.B
\fIsend\fR:
Trace sending of messages\&.
.RS 4
.LP

.LP
Message tags: \fIsend\fR, \fIsend_to_non_existing_process\fR\&.
.RE
.TP 4
.B
\fI\&'receive\&'\fR:
Trace receiving of messages\&.
.RS 4
.LP

.LP
Message tags: \fI\&'receive\&'\fR\&.
.RE
.TP 4
.B
\fIprocs\fR:
Trace process related events\&.
.RS 4
.LP

.LP
Message tags: \fIspawn\fR, \fIexit\fR, \fIregister\fR, \fIunregister\fR, \fIlink\fR, \fIunlink\fR, \fIgetting_linked\fR, \fIgetting_unlinked\fR\&.
.RE
.TP 4
.B
\fIcall\fR:
Trace certain function calls\&. Specify which function calls to trace by calling erlang:trace_pattern/3\&.
.RS 4
.LP

.LP
Message tags: \fIcall\fR, \fIreturn_from\fR\&.
.RE
.TP 4
.B
\fIsilent\fR:
Used in conjunction with the \fIcall\fR trace flag\&. The \fIcall\fR, \fIreturn_from\fR and \fIreturn_to\fR trace messages are inhibited if this flag is set, but if there are match specs they are executed as normal\&.
.RS 4
.LP

.LP
Silent mode is inhibited by executing \fIerlang:trace(_, false, [silent|_])\fR, or by a match spec executing the \fI{silent, false}\fR function\&.
.LP

.LP
The \fIsilent\fR trace flag facilitates setting up a trace on many or even all processes in the system\&. Then the interesting trace can be activated and deactivated using the \fI{silent, Bool}\fR match spec function, giving a high degree of control of which functions with which arguments that triggers the trace\&.
.LP

.LP
Message tags: \fIcall\fR, \fIreturn_from\fR, \fIreturn_to\fR\&. Or rather, the absence of\&.
.RE
.TP 4
.B
\fIreturn_to\fR:
Used in conjunction with the \fIcall\fR trace flag\&. Trace the actual return from a traced function back to its caller\&. Only works for functions traced with the \fIlocal\fR option to erlang:trace_pattern/3\&.
.RS 4
.LP

.LP
The semantics is that a trace message is sent when a call traced function actually returns, that is, when a chain of tail recursive calls is ended\&. There will be only one trace message sent per chain of tail recursive calls, why the properties of tail recursiveness for function calls are kept while tracing with this flag\&. Using \fIcall\fR and \fIreturn_to\fR trace together makes it possible to know exactly in which function a process executes at any time\&.
.LP

.LP
To get trace messages containing return values from functions, use the \fI{return_trace}\fR match_spec action instead\&.
.LP

.LP
Message tags: \fIreturn_to\fR\&.
.RE
.TP 4
.B
\fIrunning\fR:
Trace scheduling of processes\&.
.RS 4
.LP

.LP
Message tags: \fIin\fR, \fIout\fR\&.
.RE
.TP 4
.B
\fIgarbage_collection\fR:
Trace garbage collections of processes\&.
.RS 4
.LP

.LP
Message tags: \fIgc_start\fR, \fIgc_end\fR\&.
.RE
.TP 4
.B
\fItimestamp\fR:
Include a time stamp in all trace messages\&. The time stamp (Ts) is of the same form as returned by \fIerlang:now()\fR\&.
.TP 4
.B
\fIcpu_timestamp\fR:
A global trace flag for the Erlang node that makes all trace timestamps be in CPU time, not wallclock\&. It is only allowed with \fIPidSpec==all\fR\&. If the host machine operating system does not support high resolution CPU time measurements, \fItrace/3\fR exits with \fIbadarg\fR\&.
.TP 4
.B
\fIarity\fR:
Used in conjunction with the \fIcall\fR trace flag\&. \fI{M, F, Arity}\fR will be specified instead of \fI{M, F, Args}\fR in call trace messages\&.
.TP 4
.B
\fIset_on_spawn\fR:
Makes any process created by a traced process inherit its trace flags, including the \fIset_on_spawn\fR flag\&.
.TP 4
.B
\fIset_on_first_spawn\fR:
Makes the first process created by a traced process inherit its trace flags, excluding the \fIset_on_first_spawn\fR flag\&.
.TP 4
.B
\fIset_on_link\fR:
Makes any process linked by a traced process inherit its trace flags, including the \fIset_on_link\fR flag\&.
.TP 4
.B
\fIset_on_first_link\fR:
Makes the first process linked to by a traced process inherit its trace flags, excluding the \fIset_on_first_link\fR flag\&.
.TP 4
.B
\fI{tracer, Tracer}\fR:
Specify where to send the trace messages\&. \fITracer\fR must be the pid of a local process or the port identifier of a local port\&. If this flag is not given, trace messages will be sent to the process that called \fIerlang:trace/3\fR\&.
.RE
.LP
The effect of combining \fIset_on_first_link\fR with \fIset_on_link\fR is the same as having \fIset_on_first_link\fR alone\&. Likewise for \fIset_on_spawn\fR and \fIset_on_first_spawn\fR\&.
.LP
If the \fItimestamp\fR flag is not given, the tracing process will receive the trace messages described below\&. \fIPid\fR is the pid of the traced process in which the traced event has occurred\&. The third element of the tuple is the message tag\&.
.LP
If the \fItimestamp\fR flag is given, the first element of the tuple will be \fItrace_ts\fR instead and the timestamp is added last in the tuple\&.
.RS 2
.TP 4
.B
\fI{trace, Pid, \&'receive\&', Msg}\fR:
When \fIPid\fR receives the message \fIMsg\fR\&.
.TP 4
.B
\fI{trace, Pid, send, Msg, To}\fR:
When \fIPid\fR sends the message \fIMsg\fR to the process \fITo\fR\&.
.TP 4
.B
\fI{trace, Pid, send_to_non_existing_process, Msg, To}\fR:
When \fIPid\fR sends the message \fIMsg\fR to the non-existing process \fITo\fR\&.
.TP 4
.B
\fI{trace, Pid, call, {M, F, Args}}\fR:
When \fIPid\fR calls a traced function\&. The return values of calls are never supplied, only the call and its arguments\&.
.RS 4
.LP

.LP
Note that the trace flag \fIarity\fR can be used to change the contents of this message, so that \fIArity\fR is specified instead of \fIArgs\fR\&.
.RE
.TP 4
.B
\fI{trace, Pid, return_to, {M, F, Arity}}\fR:
When \fIPid\fR returns \fIto\fR the specified function\&. This trace message is sent if both the \fIcall\fR and the \fIreturn_to\fR flags are set, and the function is set to be traced on \fIlocal\fR function calls\&. The message is only sent when returning from a chain of tail recursive function calls where at least one call generated a \fIcall\fR trace message (that is, the functions match specification matched and \fI{message, false}\fR was not an action)\&.
.TP 4
.B
\fI{trace, Pid, return_from, {M, F, Arity}, ReturnValue}\fR:
When \fIPid\fR returns \fIfrom\fR the specified function\&. This trace message is sent if the \fIcall\fR flag is set, and the function has a match specification with a \fIreturn_trace\fR or \fIexception_trace\fR action\&.
.TP 4
.B
\fI{trace, Pid, exception_from, {M, F, Arity}, {Class, Value}}\fR:
When \fIPid\fR exits \fIfrom\fR the specified function due to an exception\&. This trace message is sent if the \fIcall\fR flag is set, and the function has a match specification with an \fIexception_trace\fR action\&.
.TP 4
.B
\fI{trace, Pid, spawn, Pid2, {M, F, Args}}\fR:
When \fIPid\fR spawns a new process \fIPid2\fR with the specified function call as entry point\&.
.RS 4
.LP

.LP
Note that \fIArgs\fR is supposed to be the argument list, but may be any term in the case of an erroneous spawn\&.
.RE
.TP 4
.B
\fI{trace, Pid, exit, Reason}\fR:
When \fIPid\fR exits with reason \fIReason\fR\&.
.TP 4
.B
\fI{trace, Pid, link, Pid2}\fR:
When \fIPid\fR links to a process \fIPid2\fR\&.
.TP 4
.B
\fI{trace, Pid, unlink, Pid2}\fR:
When \fIPid\fR removes the link from a process \fIPid2\fR\&.
.TP 4
.B
\fI{trace, Pid, getting_linked, Pid2}\fR:
When \fIPid\fR gets linked to a process \fIPid2\fR\&.
.TP 4
.B
\fI{trace, Pid, getting_unlinked, Pid2}\fR:
When \fIPid\fR gets unlinked from a process \fIPid2\fR\&.
.TP 4
.B
\fI{trace, Pid, register, RegName}\fR:
When \fIPid\fR gets the name \fIRegName\fR registered\&.
.TP 4
.B
\fI{trace, Pid, unregister, RegName}\fR:
When \fIPid\fR gets the name \fIRegName\fR unregistered\&. Note that this is done automatically when a registered process exits\&.
.TP 4
.B
\fI{trace, Pid, in, {M, F, Arity} | 0}\fR:
When \fIPid\fR is scheduled to run\&. The process will run in function \fI{M, F, Arity}\fR\&. On some rare occasions the current function cannot be determined, then the last element \fIArity\fR is 0\&.
.TP 4
.B
\fI{trace, Pid, out, {M, F, Arity} | 0}\fR:
When \fIPid\fR is scheduled out\&. The process was running in function {M, F, Arity}\&. On some rare occasions the current function cannot be determined, then the last element \fIArity\fR is 0\&.
.TP 4
.B
\fI{trace, Pid, gc_start, Info}\fR:
 
.RS 4
.LP
Sent when garbage collection is about to be started\&. \fIInfo\fR is a list of two-element tuples, where the first element is a key, and the second is the value\&. You should not depend on the tuples have any defined order\&. Currently, the following keys are defined:
.LP

.RS 2
.TP 4
.B
\fIheap_size\fR:
The size of the used part of the heap\&.
.TP 4
.B
\fIheap_block_size\fR:
The size of the memory block used for storing the heap and the stack\&.
.TP 4
.B
\fIold_heap_size\fR:
The size of the used part of the old heap\&.
.TP 4
.B
\fIold_heap_block_size\fR:
The size of the memory block used for storing the old heap\&.
.TP 4
.B
\fIstack_size\fR:
The actual size of the stack\&.
.TP 4
.B
\fIrecent_size\fR:
The size of the data that survived the previous garbage collection\&.
.TP 4
.B
\fImbuf_size\fR:
The combined size of message buffers associated with the process\&.
.RE
.LP

.LP
All sizes are in words\&.
.RE
.TP 4
.B
\fI{trace, Pid, gc_end, Info}\fR:
Sent when garbage collection is finished\&. \fIInfo\fR contains the same kind of list as in the \fIgc_start\fR message, but the sizes reflect the new sizes after garbage collection\&.
.RE
.LP
If the tracing process dies, the flags will be silently removed\&.
.LP
Only one process can trace a particular process\&. For this reason, attempts to trace an already traced process will fail\&.
.LP
Returns: A number indicating the number of processes that matched \fIPidSpec\fR\&. If \fIPidSpec\fR is a pid, the return value will be \fI1\fR\&. If \fIPidSpec\fR is \fIall\fR or \fIexisting\fR the return value will be the number of processes running, excluding tracer processes\&. If \fIPidSpec\fR is \fInew\fR, the return value will be \fI0\fR\&.
.LP
Failure: If specified arguments are not supported\&. For example \fIcpu_timestamp\fR is not supported on all platforms\&.
.RE
.LP
.B
erlang:trace_delivered(Tracee) -> Ref
.br
.RS
.TP
Types
Tracee = pid() | all
.br
Ref = reference()
.br
.RE
.RS
.LP
The delivery of trace messages is dislocated on the time-line compared to other events in the system\&. If you know that the \fITracee\fR has passed some specific point in its execution, and you want to know when at least all trace messages corresponding to events up to this point have reached the tracer you can use \fIerlang:trace_delivered(Tracee)\fR\&. A \fI{trace_delivered, Tracee, Ref}\fR message is sent to the caller of \fIerlang:trace_delivered(Tracee)\fR when it is guaranteed that all trace messages have been delivered to the tracer up to the point that the \fITracee\fR had reached at the time of the call to \fIerlang:trace_delivered(Tracee)\fR\&.
.LP
Note that the \fItrace_delivered\fR message does \fInot\fR imply that trace messages have been delivered; instead, it implies that all trace messages that \fIshould\fR be delivered have been delivered\&. It is not an error if \fITracee\fR isn\&'t, and hasn\&'t been traced by someone, but if this is the case, \fIno\fR trace messages will have been delivered when the \fItrace_delivered\fR message arrives\&.
.LP
Note that \fITracee\fR has to refer to a process currently, or previously existing on the same node as the caller of \fIerlang:trace_delivered(Tracee)\fR resides on\&. The special \fITracee\fR atom \fIall\fR denotes all processes that currently are traced in the node\&.
.LP
An example: Process \fIA\fR is tracee, port \fIB\fR is tracer, and process \fIC\fR is the port owner of \fIB\fR\&. \fIC\fR wants to close \fIB\fR when \fIA\fR exits\&. \fIC\fR can ensure that the trace isn\&'t truncated by calling \fIerlang:trace_delivered(A)\fR when \fIA\fR exits and wait for the \fI{trace_delivered, A, Ref}\fR message before closing \fIB\fR\&.
.LP
Failure: \fIbadarg\fR if \fITracee\fR does not refer to a process (dead or alive) on the same node as the caller of \fIerlang:trace_delivered(Tracee)\fR resides on\&.
.RE
.LP
.B
erlang:trace_info(PidOrFunc, Item) -> Res
.br
.RS
.TP
Types
PidOrFunc = pid() | new | {Module, Function, Arity} | on_load
.br
Module = Function = atom()
.br
Arity = int()
.br
Item, Res -- see below
.br
.RE
.RS
.LP
Returns trace information about a process or function\&.
.LP
To get information about a process, \fIPidOrFunc\fR should be a pid or the atom \fInew\fR\&. The atom \fInew\fR means that the default trace state for processes to be created will be returned\&. \fIItem\fR must have one of the following values:
.RS 2
.TP 4
.B
\fIflags\fR:
Return a list of atoms indicating what kind of traces is enabled for the process\&. The list will be empty if no traces are enabled, and one or more of the followings atoms if traces are enabled: \fIsend\fR, \fI\&'receive\&'\fR, \fIset_on_spawn\fR, \fIcall\fR, \fIreturn_to\fR, \fIprocs\fR, \fIset_on_first_spawn\fR, \fIset_on_link\fR, \fIrunning\fR, \fIgarbage_collection\fR, \fItimestamp\fR, and \fIarity\fR\&. The order is arbitrary\&.
.TP 4
.B
\fItracer\fR:
Return the identifier for process or port tracing this process\&. If this process is not being traced, the return value will be \fI[]\fR\&.
.RE
.LP
To get information about a function, \fIPidOrFunc\fR should be a three-element tuple: \fI{Module, Function, Arity}\fR or the atom \fIon_load\fR\&. No wildcards are allowed\&. Returns \fIundefined\fR if the function does not exist or \fIfalse\fR if the function is not traced at all\&. \fIItem\fR must have one of the following values:
.RS 2
.TP 4
.B
\fItraced\fR:
Return \fIglobal\fR if this function is traced on global function calls, \fIlocal\fR if this function is traced on local function calls (i\&.e local and global function calls), and \fIfalse\fR if neither local nor global function calls are traced\&.
.TP 4
.B
\fImatch_spec\fR:
Return the match specification for this function, if it has one\&. If the function is locally or globally traced but has no match specification defined, the returned value is \fI[]\fR\&.
.TP 4
.B
\fImeta\fR:
Return the meta trace tracer process or port for this function, if it has one\&. If the function is not meta traced the returned value is \fIfalse\fR, and if the function is meta traced but has once detected that the tracer proc is invalid, the returned value is []\&.
.TP 4
.B
\fImeta_match_spec\fR:
Return the meta trace match specification for this function, if it has one\&. If the function is meta traced but has no match specification defined, the returned value is \fI[]\fR\&.
.TP 4
.B
\fIcall_count\fR:
Return the call count value for this function or \fItrue\fR for the pseudo function \fIon_load\fR if call count tracing is active\&. Return \fIfalse\fR otherwise\&. See also erlang:trace_pattern/3\&.
.TP 4
.B
\fIall\fR:
Return a list containing the \fI{Item, Value}\fR tuples for all other items, or return \fIfalse\fR if no tracing is active for this function\&.
.RE
.LP
The actual return value will be \fI{Item, Value}\fR, where \fIValue\fR is the requested information as described above\&. If a pid for a dead process was given, or the name of a non-existing function, \fIValue\fR will be \fIundefined\fR\&.
.LP
If \fIPidOrFunc\fR is the \fIon_load\fR, the information returned refers to the default value for code that will be loaded\&.
.RE
.LP
.B
erlang:trace_pattern(MFA, MatchSpec) -> int()
.br
.RS
.LP
The same as erlang:trace_pattern(MFA, MatchSpec, []), retained for backward compatibility\&.
.RE
.LP
.B
erlang:trace_pattern(MFA, MatchSpec, FlagList) -> int()
.br
.RS
.TP
Types
MFA, MatchSpec, FlagList -- see below
.br
.RE
.RS
.LP
This BIF is used to enable or disable call tracing for exported functions\&. It must be combined with erlang:trace/3 to set the \fIcall\fR trace flag for one or more processes\&.
.LP
Conceptually, call tracing works like this: Inside the Erlang virtual machine there is a set of processes to be traced and a set of functions to be traced\&. Tracing will be enabled on the intersection of the set\&. That is, if a process included in the traced process set calls a function included in the traced function set, the trace action will be taken\&. Otherwise, nothing will happen\&.
.LP
Use erlang:trace/3 to add or remove one or more processes to the set of traced processes\&. Use \fIerlang:trace_pattern/2\fR to add or remove exported functions to the set of traced functions\&.
.LP
The \fIerlang:trace_pattern/3\fR BIF can also add match specifications to an exported function\&. A match specification comprises a pattern that the arguments to the function must match, a guard expression which must evaluate to \fItrue\fR and an action to be performed\&. The default action is to send a trace message\&. If the pattern does not match or the guard fails, the action will not be executed\&.
.LP
The \fIMFA\fR argument should be a tuple like \fI{Module, Function, Arity}\fR or the atom \fIon_load\fR (described below)\&. It can be the module, function, and arity for an exported function (or a BIF in any module)\&. The \fI\&'_\&'\fR atom can be used to mean any of that kind\&. Wildcards can be used in any of the following ways:
.RS 2
.TP 4
.B
\fI{Module, Function, \&'_\&'}\fR:
All exported functions of any arity named \fIFunction\fR in module \fIModule\fR\&.
.TP 4
.B
\fI{Module, \&'_\&', \&'_\&'}\fR:
All exported functions in module \fIModule\fR\&.
.TP 4
.B
\fI{\&'_\&', \&'_\&', \&'_\&'}\fR:
All exported functions in all loaded modules\&.
.RE
.LP
Other combinations, such as \fI{Module, \&'_\&', Arity}\fR, are not allowed\&. Local functions will match wildcards only if the \fIlocal\fR option is in the \fIFlagList\fR\&.
.LP
If the \fIMFA\fR argument is the atom \fIon_load\fR, the match specification and flag list will be used on all modules that are newly loaded\&.
.LP
The \fIMatchSpec\fR argument can take any of the following forms:
.RS 2
.TP 4
.B
\fIfalse\fR:
Disable tracing for the matching function(s)\&. Any match specification will be removed\&.
.TP 4
.B
\fItrue\fR:
Enable tracing for the matching function(s)\&.
.TP 4
.B
\fIMatchSpecList\fR:
A list of match specifications\&. An empty list is equivalent to \fItrue\fR\&. See the ERTS User\&'s Guide for a description of match specifications\&.
.TP 4
.B
\fIrestart\fR:
For the \fIFlagList\fR option \fIcall_count\fR: restart the existing counters\&. The behaviour is undefined for other \fIFlagList\fR options\&.
.TP 4
.B
\fIpause\fR:
For the \fIFlagList\fR option \fIcall_count\fR: pause the existing counters\&. The behaviour is undefined for other \fIFlagList\fR options\&.
.RE
.LP
The \fIFlagList\fR parameter is a list of options\&. The following options are allowed:
.RS 2
.TP 4
.B
\fIglobal\fR:
Turn on or off call tracing for global function calls (that is, calls specifying the module explicitly)\&. Only exported functions will match and only global calls will generate trace messages\&. This is the default\&.
.TP 4
.B
\fIlocal\fR:
Turn on or off call tracing for all types of function calls\&. Trace messages will be sent whenever any of the specified functions are called, regardless of how they are called\&. If the \fIreturn_to\fR flag is set for the process, a \fIreturn_to\fR message will also be sent when this function returns to its caller\&.
.TP 4
.B
\fImeta | {meta, Pid}\fR:
Turn on or off meta tracing for all types of function calls\&. Trace messages will be sent to the tracer process or port \fIPid\fR whenever any of the specified functions are called, regardless of how they are called\&. If no \fIPid\fR is specified, \fIself()\fR is used as a default tracer process\&.
.RS 4
.LP

.LP
Meta tracing traces all processes and does not care about the process trace flags set by \fItrace/3\fR, the trace flags are instead fixed to \fI[call, timestamp]\fR\&.
.LP

.LP
The match spec function \fI{return_trace}\fR works with meta trace and send its trace message to the same tracer process\&.
.RE
.TP 4
.B
\fIcall_count\fR:
Starts (\fIMatchSpec == true\fR) or stops (\fIMatchSpec == false\fR) call count tracing for all types of function calls\&. For every function a counter is incremented when the function is called, in any process\&. No process trace flags need to be activated\&.
.RS 4
.LP

.LP
If call count tracing is started while already running, the count is restarted from zero\&. Running counters can be paused with \fIMatchSpec == pause\fR\&. Paused and running counters can be restarted from zero with \fIMatchSpec == restart\fR\&.
.LP

.LP
The counter value can be read with erlang:trace_info/2\&.
.RE
.RE
.LP
The \fIglobal\fR and \fIlocal\fR options are mutually exclusive and \fIglobal\fR is the default (if no options are specified)\&. The \fIcall_count\fR and \fImeta\fR options perform a kind of local tracing, and can also not be combined with \fIglobal\fR\&. A function can be either globally or locally traced\&. If global tracing is specified for a specified set of functions; local, meta and call count tracing for the matching set of local functions will be disabled, and vice versa\&.
.LP
When disabling trace, the option must match the type of trace that is set on the function, so that local tracing must be disabled with the \fIlocal\fR option and global tracing with the \fIglobal\fR option (or no option at all), and so forth\&.
.LP
There is no way to directly change part of a match specification list\&. If a function has a match specification, you can replace it with a completely new one\&. If you need to change an existing match specification, use the erlang:trace_info/2 BIF to retrieve the existing match specification\&.
.LP
Returns the number of exported functions that matched the \fIMFA\fR argument\&. This will be zero if none matched at all\&.
.RE
.LP
.B
trunc(Number) -> int()
.br
.RS
.TP
Types
Number = number()
.br
.RE
.RS
.LP
Returns an integer by the truncating \fINumber\fR\&.

.nf
> trunc(5\&.5)\&.

5
.fi
.LP
Allowed in guard tests\&.
.RE
.LP
.B
tuple_size(Tuple) -> int()
.br
.RS
.TP
Types
Tuple = tuple()
.br
.RE
.RS
.LP
Returns an integer which is the number of elements in \fITuple\fR\&.

.nf
> tuple_size({morni, mulle, bwange})\&.

3
.fi
.LP
Allowed in guard tests\&.
.RE
.LP
.B
tuple_to_list(Tuple) -> [term()]
.br
.RS
.TP
Types
Tuple = tuple()
.br
.RE
.RS
.LP
Returns a list which corresponds to \fITuple\fR\&. \fITuple\fR may contain any Erlang terms\&.

.nf
> tuple_to_list({share, {\&'Ericsson_B\&', 163}})\&.

[share,{\&'Ericsson_B\&',163}]
.fi
.RE
.LP
.B
erlang:universaltime() -> {Date, Time}
.br
.RS
.TP
Types
Date = {Year, Month, Day}
.br
Time = {Hour, Minute, Second}
.br
Year = Month = Day = Hour = Minute = Second = int()
.br
.RE
.RS
.LP
Returns the current date and time according to Universal Time Coordinated (UTC), also called GMT, in the form \fI{{Year, Month, Day}, {Hour, Minute, Second}}\fR if supported by the underlying operating system\&. If not, \fIerlang:universaltime()\fR is equivalent to \fIerlang:localtime()\fR\&.

.nf
> erlang:universaltime()\&.

{{1996,11,6},{14,18,43}}
.fi
.RE
.LP
.B
erlang:universaltime_to_localtime({Date1, Time1}) -> {Date2, Time2}
.br
.RS
.TP
Types
Date1 = Date2 = {Year, Month, Day}
.br
Time1 = Time2 = {Hour, Minute, Second}
.br
Year = Month = Day = Hour = Minute = Second = int()
.br
.RE
.RS
.LP
Converts Universal Time Coordinated (UTC) date and time to local date and time, if this is supported by the underlying OS\&. Otherwise, no conversion is done, and \fI{Date1, Time1}\fR is returned\&.

.nf
> erlang:universaltime_to_localtime({{1996,11,6},{14,18,43}})\&.

{{1996,11,7},{15,18,43}}
.fi
.LP
Failure: \fIbadarg\fR if \fIDate1\fR or \fITime1\fR do not denote a valid date or time\&.
.RE
.LP
.B
unlink(Id) -> true
.br
.RS
.TP
Types
Id = pid() | port()
.br
.RE
.RS
.LP
Removes the link, if there is one, between the calling process and the process or port referred to by \fIId\fR\&.
.LP
Returns \fItrue\fR and does not fail, even if there is no link to \fIId\fR, or if \fIId\fR does not exist\&.
.LP
Once \fIunlink(Id)\fR has returned it is guaranteed that the link between the caller and the entity referred to by \fIId\fR has no effect on the caller in the future (unless the link is setup again)\&. If caller is trapping exits, an \fI{\&'EXIT\&', Id, _}\fR message due to the link might have been placed in the callers message queue prior to the call, though\&. Note, the \fI{\&'EXIT\&', Id, _}\fR message can be the result of the link, but can also be the result of \fIId\fR calling \fIexit/2\fR\&. Therefore, it \fImay\fR be appropriate to cleanup the message queue when trapping exits after the call to \fIunlink(Id)\fR, as follow:

.nf

    unlink(Id),
    receive
        {\&'EXIT\&', Id, _} ->
            true
    after 0 ->
            true
    end
.fi
.SS Note:
.LP
Prior to OTP release R11B (erts version 5\&.5) \fIunlink/1\fR behaved completely asynchronous, i\&.e\&., the link was active until the "unlink signal" reached the linked entity\&. This had one undesirable effect, though\&. You could never know when you were guaranteed \fInot\fR to be effected by the link\&.
.LP
Current behavior can be viewed as two combined operations: asynchronously send an "unlink signal" to the linked entity and ignore any future results of the link\&.

.RE
.LP
.B
unregister(RegName) -> true
.br
.RS
.TP
Types
RegName = atom()
.br
.RE
.RS
.LP
Removes the registered name \fIRegName\fR, associated with a pid or a port identifier\&.

.nf
> unregister(db)\&.

true
.fi
.LP
Users are advised not to unregister system processes\&.
.LP
Failure: \fIbadarg\fR if \fIRegName\fR is not a registered name\&.
.RE
.LP
.B
whereis(RegName) -> pid() | port() | undefined
.br
.RS
.LP
Returns the pid or port identifier with the registered name \fIRegName\fR\&. Returns \fIundefined\fR if the name is not registered\&.

.nf
> whereis(db)\&.

<0\&.43\&.0>
.fi
.RE
.LP
.B
erlang:yield() -> true
.br
.RS
.LP
Voluntarily let other processes (if any) get a chance to execute\&. Using \fIerlang:yield()\fR is similar to \fIreceive after 1 -> ok end\fR, except that \fIyield()\fR is faster\&.
.RE