File: Shell_sys.html

package info (click to toggle)
ocamlnet 4.1.9-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 54,024 kB
  • sloc: ml: 151,939; ansic: 11,071; sh: 2,003; makefile: 1,310
file content (1267 lines) | stat: -rw-r--r-- 75,757 bytes parent folder | download | duplicates (4)
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="Start" href="index.html">
<link rel="previous" href="Rpc_intro_gss.html">
<link rel="next" href="Shell.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of extensions" rel=Appendix href="index_extensions.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of class attributes" rel=Appendix href="index_attributes.html">
<link title="Index of class methods" rel=Appendix href="index_methods.html">
<link title="Index of classes" rel=Appendix href="index_classes.html">
<link title="Index of class types" rel=Appendix href="index_class_types.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Uq_gtk" rel="Chapter" href="Uq_gtk.html">
<link title="Uq_tcl" rel="Chapter" href="Uq_tcl.html">
<link title="Equeue" rel="Chapter" href="Equeue.html">
<link title="Unixqueue" rel="Chapter" href="Unixqueue.html">
<link title="Unixqueue_pollset" rel="Chapter" href="Unixqueue_pollset.html">
<link title="Unixqueue_select" rel="Chapter" href="Unixqueue_select.html">
<link title="Uq_resolver" rel="Chapter" href="Uq_resolver.html">
<link title="Uq_engines" rel="Chapter" href="Uq_engines.html">
<link title="Uq_multiplex" rel="Chapter" href="Uq_multiplex.html">
<link title="Uq_transfer" rel="Chapter" href="Uq_transfer.html">
<link title="Uq_socks5" rel="Chapter" href="Uq_socks5.html">
<link title="Uq_io" rel="Chapter" href="Uq_io.html">
<link title="Uq_lwt" rel="Chapter" href="Uq_lwt.html">
<link title="Uq_libevent" rel="Chapter" href="Uq_libevent.html">
<link title="Uq_mt" rel="Chapter" href="Uq_mt.html">
<link title="Uq_client" rel="Chapter" href="Uq_client.html">
<link title="Uq_server" rel="Chapter" href="Uq_server.html">
<link title="Uq_datagram" rel="Chapter" href="Uq_datagram.html">
<link title="Uq_engines_compat" rel="Chapter" href="Uq_engines_compat.html">
<link title="Equeue_intro" rel="Chapter" href="Equeue_intro.html">
<link title="Equeue_howto" rel="Chapter" href="Equeue_howto.html">
<link title="Netcamlbox" rel="Chapter" href="Netcamlbox.html">
<link title="Netcgi_apache" rel="Chapter" href="Netcgi_apache.html">
<link title="Netcgi_modtpl" rel="Chapter" href="Netcgi_modtpl.html">
<link title="Netcgi_plex" rel="Chapter" href="Netcgi_plex.html">
<link title="Netcgi_common" rel="Chapter" href="Netcgi_common.html">
<link title="Netcgi" rel="Chapter" href="Netcgi.html">
<link title="Netcgi_ajp" rel="Chapter" href="Netcgi_ajp.html">
<link title="Netcgi_scgi" rel="Chapter" href="Netcgi_scgi.html">
<link title="Netcgi_cgi" rel="Chapter" href="Netcgi_cgi.html">
<link title="Netcgi_fcgi" rel="Chapter" href="Netcgi_fcgi.html">
<link title="Netcgi_dbi" rel="Chapter" href="Netcgi_dbi.html">
<link title="Netcgi1_compat" rel="Chapter" href="Netcgi1_compat.html">
<link title="Netcgi_test" rel="Chapter" href="Netcgi_test.html">
<link title="Netcgi_porting" rel="Chapter" href="Netcgi_porting.html">
<link title="Nethttp_client_conncache" rel="Chapter" href="Nethttp_client_conncache.html">
<link title="Nethttp_client" rel="Chapter" href="Nethttp_client.html">
<link title="Nettelnet_client" rel="Chapter" href="Nettelnet_client.html">
<link title="Netftp_data_endpoint" rel="Chapter" href="Netftp_data_endpoint.html">
<link title="Netftp_client" rel="Chapter" href="Netftp_client.html">
<link title="Nethttp_fs" rel="Chapter" href="Nethttp_fs.html">
<link title="Netftp_fs" rel="Chapter" href="Netftp_fs.html">
<link title="Netsmtp" rel="Chapter" href="Netsmtp.html">
<link title="Netpop" rel="Chapter" href="Netpop.html">
<link title="Netldap" rel="Chapter" href="Netldap.html">
<link title="Netclient_tut" rel="Chapter" href="Netclient_tut.html">
<link title="Netgss_bindings" rel="Chapter" href="Netgss_bindings.html">
<link title="Netgss" rel="Chapter" href="Netgss.html">
<link title="Nethttpd_types" rel="Chapter" href="Nethttpd_types.html">
<link title="Nethttpd_kernel" rel="Chapter" href="Nethttpd_kernel.html">
<link title="Nethttpd_reactor" rel="Chapter" href="Nethttpd_reactor.html">
<link title="Nethttpd_engine" rel="Chapter" href="Nethttpd_engine.html">
<link title="Nethttpd_services" rel="Chapter" href="Nethttpd_services.html">
<link title="Nethttpd_plex" rel="Chapter" href="Nethttpd_plex.html">
<link title="Nethttpd_util" rel="Chapter" href="Nethttpd_util.html">
<link title="Nethttpd_intro" rel="Chapter" href="Nethttpd_intro.html">
<link title="Netmcore" rel="Chapter" href="Netmcore.html">
<link title="Netmcore_camlbox" rel="Chapter" href="Netmcore_camlbox.html">
<link title="Netmcore_mempool" rel="Chapter" href="Netmcore_mempool.html">
<link title="Netmcore_heap" rel="Chapter" href="Netmcore_heap.html">
<link title="Netmcore_ref" rel="Chapter" href="Netmcore_ref.html">
<link title="Netmcore_array" rel="Chapter" href="Netmcore_array.html">
<link title="Netmcore_sem" rel="Chapter" href="Netmcore_sem.html">
<link title="Netmcore_mutex" rel="Chapter" href="Netmcore_mutex.html">
<link title="Netmcore_condition" rel="Chapter" href="Netmcore_condition.html">
<link title="Netmcore_queue" rel="Chapter" href="Netmcore_queue.html">
<link title="Netmcore_buffer" rel="Chapter" href="Netmcore_buffer.html">
<link title="Netmcore_matrix" rel="Chapter" href="Netmcore_matrix.html">
<link title="Netmcore_hashtbl" rel="Chapter" href="Netmcore_hashtbl.html">
<link title="Netmcore_process" rel="Chapter" href="Netmcore_process.html">
<link title="Netmcore_tut" rel="Chapter" href="Netmcore_tut.html">
<link title="Netmcore_basics" rel="Chapter" href="Netmcore_basics.html">
<link title="Netplex_types" rel="Chapter" href="Netplex_types.html">
<link title="Netplex_mp" rel="Chapter" href="Netplex_mp.html">
<link title="Netplex_mt" rel="Chapter" href="Netplex_mt.html">
<link title="Netplex_log" rel="Chapter" href="Netplex_log.html">
<link title="Netplex_controller" rel="Chapter" href="Netplex_controller.html">
<link title="Netplex_container" rel="Chapter" href="Netplex_container.html">
<link title="Netplex_sockserv" rel="Chapter" href="Netplex_sockserv.html">
<link title="Netplex_workload" rel="Chapter" href="Netplex_workload.html">
<link title="Netplex_main" rel="Chapter" href="Netplex_main.html">
<link title="Netplex_config" rel="Chapter" href="Netplex_config.html">
<link title="Netplex_kit" rel="Chapter" href="Netplex_kit.html">
<link title="Rpc_netplex" rel="Chapter" href="Rpc_netplex.html">
<link title="Netplex_cenv" rel="Chapter" href="Netplex_cenv.html">
<link title="Netplex_semaphore" rel="Chapter" href="Netplex_semaphore.html">
<link title="Netplex_sharedvar" rel="Chapter" href="Netplex_sharedvar.html">
<link title="Netplex_mutex" rel="Chapter" href="Netplex_mutex.html">
<link title="Netplex_encap" rel="Chapter" href="Netplex_encap.html">
<link title="Netplex_mbox" rel="Chapter" href="Netplex_mbox.html">
<link title="Netplex_internal" rel="Chapter" href="Netplex_internal.html">
<link title="Netplex_intro" rel="Chapter" href="Netplex_intro.html">
<link title="Netplex_advanced" rel="Chapter" href="Netplex_advanced.html">
<link title="Netplex_admin" rel="Chapter" href="Netplex_admin.html">
<link title="Netshm" rel="Chapter" href="Netshm.html">
<link title="Netshm_data" rel="Chapter" href="Netshm_data.html">
<link title="Netshm_hashtbl" rel="Chapter" href="Netshm_hashtbl.html">
<link title="Netshm_array" rel="Chapter" href="Netshm_array.html">
<link title="Netshm_intro" rel="Chapter" href="Netshm_intro.html">
<link title="Netstring_pcre" rel="Chapter" href="Netstring_pcre.html">
<link title="Netconversion" rel="Chapter" href="Netconversion.html">
<link title="Netchannels" rel="Chapter" href="Netchannels.html">
<link title="Netstream" rel="Chapter" href="Netstream.html">
<link title="Netmime_string" rel="Chapter" href="Netmime_string.html">
<link title="Netmime" rel="Chapter" href="Netmime.html">
<link title="Netsendmail" rel="Chapter" href="Netsendmail.html">
<link title="Neturl" rel="Chapter" href="Neturl.html">
<link title="Netaddress" rel="Chapter" href="Netaddress.html">
<link title="Netbuffer" rel="Chapter" href="Netbuffer.html">
<link title="Netmime_header" rel="Chapter" href="Netmime_header.html">
<link title="Netmime_channels" rel="Chapter" href="Netmime_channels.html">
<link title="Neturl_ldap" rel="Chapter" href="Neturl_ldap.html">
<link title="Netdate" rel="Chapter" href="Netdate.html">
<link title="Netencoding" rel="Chapter" href="Netencoding.html">
<link title="Netulex" rel="Chapter" href="Netulex.html">
<link title="Netaccel" rel="Chapter" href="Netaccel.html">
<link title="Netaccel_link" rel="Chapter" href="Netaccel_link.html">
<link title="Nethtml" rel="Chapter" href="Nethtml.html">
<link title="Netstring_str" rel="Chapter" href="Netstring_str.html">
<link title="Netmappings" rel="Chapter" href="Netmappings.html">
<link title="Netaux" rel="Chapter" href="Netaux.html">
<link title="Nethttp" rel="Chapter" href="Nethttp.html">
<link title="Netpagebuffer" rel="Chapter" href="Netpagebuffer.html">
<link title="Netfs" rel="Chapter" href="Netfs.html">
<link title="Netglob" rel="Chapter" href="Netglob.html">
<link title="Netauth" rel="Chapter" href="Netauth.html">
<link title="Netsockaddr" rel="Chapter" href="Netsockaddr.html">
<link title="Netnumber" rel="Chapter" href="Netnumber.html">
<link title="Netxdr_mstring" rel="Chapter" href="Netxdr_mstring.html">
<link title="Netxdr" rel="Chapter" href="Netxdr.html">
<link title="Netcompression" rel="Chapter" href="Netcompression.html">
<link title="Netunichar" rel="Chapter" href="Netunichar.html">
<link title="Netasn1" rel="Chapter" href="Netasn1.html">
<link title="Netasn1_encode" rel="Chapter" href="Netasn1_encode.html">
<link title="Netoid" rel="Chapter" href="Netoid.html">
<link title="Netstring_tstring" rel="Chapter" href="Netstring_tstring.html">
<link title="Netdn" rel="Chapter" href="Netdn.html">
<link title="Netx509" rel="Chapter" href="Netx509.html">
<link title="Netascii_armor" rel="Chapter" href="Netascii_armor.html">
<link title="Nettls_support" rel="Chapter" href="Nettls_support.html">
<link title="Netmech_scram" rel="Chapter" href="Netmech_scram.html">
<link title="Netmech_scram_gssapi" rel="Chapter" href="Netmech_scram_gssapi.html">
<link title="Netmech_scram_sasl" rel="Chapter" href="Netmech_scram_sasl.html">
<link title="Netmech_scram_http" rel="Chapter" href="Netmech_scram_http.html">
<link title="Netgssapi_support" rel="Chapter" href="Netgssapi_support.html">
<link title="Netgssapi_auth" rel="Chapter" href="Netgssapi_auth.html">
<link title="Netchannels_crypto" rel="Chapter" href="Netchannels_crypto.html">
<link title="Netx509_pubkey" rel="Chapter" href="Netx509_pubkey.html">
<link title="Netx509_pubkey_crypto" rel="Chapter" href="Netx509_pubkey_crypto.html">
<link title="Netsaslprep" rel="Chapter" href="Netsaslprep.html">
<link title="Netmech_plain_sasl" rel="Chapter" href="Netmech_plain_sasl.html">
<link title="Netmech_crammd5_sasl" rel="Chapter" href="Netmech_crammd5_sasl.html">
<link title="Netmech_digest_sasl" rel="Chapter" href="Netmech_digest_sasl.html">
<link title="Netmech_digest_http" rel="Chapter" href="Netmech_digest_http.html">
<link title="Netmech_krb5_sasl" rel="Chapter" href="Netmech_krb5_sasl.html">
<link title="Netmech_gs2_sasl" rel="Chapter" href="Netmech_gs2_sasl.html">
<link title="Netmech_spnego_http" rel="Chapter" href="Netmech_spnego_http.html">
<link title="Netchannels_tut" rel="Chapter" href="Netchannels_tut.html">
<link title="Netmime_tut" rel="Chapter" href="Netmime_tut.html">
<link title="Netsendmail_tut" rel="Chapter" href="Netsendmail_tut.html">
<link title="Netulex_tut" rel="Chapter" href="Netulex_tut.html">
<link title="Neturl_tut" rel="Chapter" href="Neturl_tut.html">
<link title="Netsys" rel="Chapter" href="Netsys.html">
<link title="Netsys_posix" rel="Chapter" href="Netsys_posix.html">
<link title="Netsys_pollset" rel="Chapter" href="Netsys_pollset.html">
<link title="Netlog" rel="Chapter" href="Netlog.html">
<link title="Netexn" rel="Chapter" href="Netexn.html">
<link title="Netsys_win32" rel="Chapter" href="Netsys_win32.html">
<link title="Netsys_pollset_posix" rel="Chapter" href="Netsys_pollset_posix.html">
<link title="Netsys_pollset_win32" rel="Chapter" href="Netsys_pollset_win32.html">
<link title="Netsys_pollset_generic" rel="Chapter" href="Netsys_pollset_generic.html">
<link title="Netsys_signal" rel="Chapter" href="Netsys_signal.html">
<link title="Netsys_oothr" rel="Chapter" href="Netsys_oothr.html">
<link title="Netsys_xdr" rel="Chapter" href="Netsys_xdr.html">
<link title="Netsys_rng" rel="Chapter" href="Netsys_rng.html">
<link title="Netsys_crypto_types" rel="Chapter" href="Netsys_crypto_types.html">
<link title="Netsys_types" rel="Chapter" href="Netsys_types.html">
<link title="Netsys_mem" rel="Chapter" href="Netsys_mem.html">
<link title="Netsys_tmp" rel="Chapter" href="Netsys_tmp.html">
<link title="Netsys_sem" rel="Chapter" href="Netsys_sem.html">
<link title="Netsys_pmanage" rel="Chapter" href="Netsys_pmanage.html">
<link title="Netsys_crypto" rel="Chapter" href="Netsys_crypto.html">
<link title="Netsys_tls" rel="Chapter" href="Netsys_tls.html">
<link title="Netsys_ciphers" rel="Chapter" href="Netsys_ciphers.html">
<link title="Netsys_digests" rel="Chapter" href="Netsys_digests.html">
<link title="Netsys_crypto_modes" rel="Chapter" href="Netsys_crypto_modes.html">
<link title="Netsys_gssapi" rel="Chapter" href="Netsys_gssapi.html">
<link title="Netsys_sasl_types" rel="Chapter" href="Netsys_sasl_types.html">
<link title="Netsys_sasl" rel="Chapter" href="Netsys_sasl.html">
<link title="Netsys_polypipe" rel="Chapter" href="Netsys_polypipe.html">
<link title="Netsys_polysocket" rel="Chapter" href="Netsys_polysocket.html">
<link title="Netsys_global" rel="Chapter" href="Netsys_global.html">
<link title="Nettls_gnutls_bindings" rel="Chapter" href="Nettls_gnutls_bindings.html">
<link title="Nettls_nettle_bindings" rel="Chapter" href="Nettls_nettle_bindings.html">
<link title="Nettls_gnutls" rel="Chapter" href="Nettls_gnutls.html">
<link title="Netunidata" rel="Chapter" href="Netunidata.html">
<link title="Netgzip" rel="Chapter" href="Netgzip.html">
<link title="Rpc_auth_local" rel="Chapter" href="Rpc_auth_local.html">
<link title="Rpc_xti_client" rel="Chapter" href="Rpc_xti_client.html">
<link title="Rpc" rel="Chapter" href="Rpc.html">
<link title="Rpc_program" rel="Chapter" href="Rpc_program.html">
<link title="Rpc_util" rel="Chapter" href="Rpc_util.html">
<link title="Rpc_portmapper_aux" rel="Chapter" href="Rpc_portmapper_aux.html">
<link title="Rpc_packer" rel="Chapter" href="Rpc_packer.html">
<link title="Rpc_transport" rel="Chapter" href="Rpc_transport.html">
<link title="Rpc_client" rel="Chapter" href="Rpc_client.html">
<link title="Rpc_simple_client" rel="Chapter" href="Rpc_simple_client.html">
<link title="Rpc_portmapper_clnt" rel="Chapter" href="Rpc_portmapper_clnt.html">
<link title="Rpc_portmapper" rel="Chapter" href="Rpc_portmapper.html">
<link title="Rpc_server" rel="Chapter" href="Rpc_server.html">
<link title="Rpc_auth_sys" rel="Chapter" href="Rpc_auth_sys.html">
<link title="Rpc_auth_gssapi" rel="Chapter" href="Rpc_auth_gssapi.html">
<link title="Rpc_proxy" rel="Chapter" href="Rpc_proxy.html">
<link title="Rpc_intro" rel="Chapter" href="Rpc_intro.html">
<link title="Rpc_mapping_ref" rel="Chapter" href="Rpc_mapping_ref.html">
<link title="Rpc_intro_gss" rel="Chapter" href="Rpc_intro_gss.html">
<link title="Shell_sys" rel="Chapter" href="Shell_sys.html">
<link title="Shell" rel="Chapter" href="Shell.html">
<link title="Shell_uq" rel="Chapter" href="Shell_uq.html">
<link title="Shell_fs" rel="Chapter" href="Shell_fs.html">
<link title="Shell_intro" rel="Chapter" href="Shell_intro.html">
<link title="Intro" rel="Chapter" href="Intro.html">
<link title="Platform" rel="Chapter" href="Platform.html">
<link title="Foreword" rel="Chapter" href="Foreword.html">
<link title="Ipv6" rel="Chapter" href="Ipv6.html">
<link title="Regexp" rel="Chapter" href="Regexp.html">
<link title="Tls" rel="Chapter" href="Tls.html">
<link title="Crypto" rel="Chapter" href="Crypto.html">
<link title="Authentication" rel="Chapter" href="Authentication.html">
<link title="Credentials" rel="Chapter" href="Credentials.html">
<link title="Gssapi" rel="Chapter" href="Gssapi.html">
<link title="Ocamlnet4" rel="Chapter" href="Ocamlnet4.html">
<link title="Get" rel="Chapter" href="Get.html"><link title="Common exceptions" rel="Section" href="#1_Commonexceptions">
<link title="Environments" rel="Section" href="#1_Environments">
<link title="Commands" rel="Section" href="#1_Commands">
<link title="Processes" rel="Section" href="#1_Processes">
<link title="Jobs" rel="Section" href="#1_Jobs">
<link title="Removed functions" rel="Section" href="#1_Removedfunctions">
<link title="Debugging" rel="Section" href="#1_Debugging">
<title>Ocamlnet 4 Reference Manual : Shell_sys</title>
</head>
<body>
<div class="navbar"><a class="pre" href="Rpc_intro_gss.html" title="Rpc_intro_gss">Previous</a>
&nbsp;<a class="up" href="index.html" title="Index">Up</a>
&nbsp;<a class="post" href="Shell.html" title="Shell">Next</a>
</div>
<h1>Module <a href="type_Shell_sys.html">Shell_sys</a></h1>

<pre><span id="MODULEShell_sys"><span class="keyword">module</span> Shell_sys</span>: <code class="code">sig</code> <a href="Shell_sys.html">..</a> <code class="code">end</code></pre><div class="info module top">
<div class="info-desc">
<p>Calls external programs, creates pipelines, etc. (full interface)</p>
</div>
</div>
<hr width="100%">
<p>This module is now thread-safe (as of May 2009), provided the
    threads do no share the same <code class="code">Shell</code> or <code class="code">Shell_sys</code> values.
    Problems reported earlier here have been resolved.</p>
<p>If you get errors like "Netsys_posix.watch_subprocess: uninitialized"
    you should call <a href="Shell_sys.html#VALinstall_job_handlers"><code class="code">Shell_sys.install_job_handlers</code></a>.</p>
<h2 id="1_Commonexceptions">Common exceptions</h2>
<pre><span id="EXCEPTIONFatal_error"><span class="keyword">exception</span> Fatal_error</span> <span class="keyword">of</span> <code class="type">exn</code></pre>
<div class="info ">
<div class="info-desc">
<p>An error is fatal if it is not possible to recover from it in a
 predictable manner. In this case, many function wrap such exceptions
 <code class="code">x</code> into <code class="code">Fatal_error x</code>.</p>
</div>
</div>
<h2 id="1_Environments">Environments</h2>
<pre><span id="TYPEenvironment"><span class="keyword">type</span> <code class="type"></code>environment</span> </pre>
<div class="info ">
<div class="info-desc">
<p>The abstract type of a process environment</p>
</div>
</div>


<pre><span id="VALcreate_env"><span class="keyword">val</span> create_env</span> : <code class="type">unit -> <a href="Shell_sys.html#TYPEenvironment">environment</a></code></pre><div class="info ">
<div class="info-desc">
<p>Creates an empty environment</p>
</div>
</div>

<pre><span id="VALcurrent_env"><span class="keyword">val</span> current_env</span> : <code class="type">unit -> <a href="Shell_sys.html#TYPEenvironment">environment</a></code></pre><div class="info ">
<div class="info-desc">
<p>Returns the environment of the current process as abstract environment
 value</p>
</div>
</div>

<pre><span id="VALcopy_env"><span class="keyword">val</span> copy_env</span> : <code class="type"><a href="Shell_sys.html#TYPEenvironment">environment</a> -> <a href="Shell_sys.html#TYPEenvironment">environment</a></code></pre><div class="info ">
<div class="info-desc">
<p>Copies an environment</p>
</div>
</div>

<pre><span id="VALset_env"><span class="keyword">val</span> set_env</span> : <code class="type"><a href="Shell_sys.html#TYPEenvironment">environment</a> -> string array -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Sets the contents of the environment to the passed string array</p>
</div>
</div>

<pre><span id="VALget_env"><span class="keyword">val</span> get_env</span> : <code class="type"><a href="Shell_sys.html#TYPEenvironment">environment</a> -> string array</code></pre><div class="info ">
<div class="info-desc">
<p>Gets the contents of the environment as string array</p>
</div>
</div>

<pre><span id="VALiter_env"><span class="keyword">val</span> iter_env</span> : <code class="type">f:(string -> unit) -> <a href="Shell_sys.html#TYPEenvironment">environment</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Iterates over the strings of the environment, and calls
 <code class="code">f s</code> for every string <code class="code">s</code>.</p>
</div>
</div>

<pre><span id="VALset_env_var"><span class="keyword">val</span> set_env_var</span> : <code class="type"><a href="Shell_sys.html#TYPEenvironment">environment</a> -> string -> string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">set_env_var env varname varval</code>: Sets the value of the variable
 <code class="code">varname</code> in the environment <code class="code">env</code> to <code class="code">varval</code>.</p>
</div>
</div>

<pre><span id="VALget_env_var"><span class="keyword">val</span> get_env_var</span> : <code class="type"><a href="Shell_sys.html#TYPEenvironment">environment</a> -> string -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Returns the value of the variable in the environment</p>
</div>
</div>

<pre><span id="VALiter_env_vars"><span class="keyword">val</span> iter_env_vars</span> : <code class="type">f:(string -> string -> unit) -> <a href="Shell_sys.html#TYPEenvironment">environment</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Iterates over the variables of the environment, and calls
 <code class="code">f name value</code> for every variable with <code class="code">name</code> and <code class="code">value</code>.</p>
</div>
</div>
<h2 id="1_Commands">Commands</h2>
<pre><span id="TYPEcommand"><span class="keyword">type</span> <code class="type"></code>command</span> </pre>
<div class="info ">
<div class="info-desc">
<p>A command describes how to start a new process</p>
</div>
</div>


<pre><span id="VALcommand"><span class="keyword">val</span> command</span> : <code class="type">?cmdname:string -><br>       ?arguments:string array -><br>       ?chdir:string -><br>       ?environment:<a href="Shell_sys.html#TYPEenvironment">environment</a> -><br>       ?descriptors:Unix.file_descr list -><br>       ?assignments:(Unix.file_descr * Unix.file_descr) list -><br>       filename:string -> unit -> <a href="Shell_sys.html#TYPEcommand">command</a></code></pre><div class="info ">
<div class="info-desc">
<p>Creates a command from the passed arguments:</p>

</div>
</div>
<div class="param_info"><code class="code">cmdname</code> : The name of the command passed in <code class="code">argv[0]</code>. By
   default, this argument is derived from <code class="code">filename</code>.</div>
<div class="param_info"><code class="code">arguments</code> : The arguments of the command (starting with the
   first real argument, skipping <code class="code">cmdname</code>). By default <code class="code"> [] </code>.</div>
<div class="param_info"><code class="code">chdir</code> : Before the command is executed it is changed to
   this directory.</div>
<div class="param_info"><code class="code">environment</code> : The environment of the command. By default, the
   current environment</div>
<div class="param_info"><code class="code">descriptors</code> : The list of file descriptors to share with the
   current process. In the subprocess only those descriptors remain open
   that are either mentioned in <code class="code">descriptors</code>, or that are the final target
   of assignments. By default, <code class="code"> [stdin; stdout; stderr] </code>.

 Note that only the <b>final targets</b> of assignments remain open in the
 subprocess (unless they are also listed in <code class="code">descriptors</code>). If there
 are cascaded assignments like <code class="code"> (fd1, fd2); (fd2, fd3) </code> the intermediate
 descriptors like <code class="code">fd2</code> are not considered as final targets; only <code class="code">fd3</code>
 would be a final target in this example.</div>
<div class="param_info"><code class="code">assignments</code> : A list of descriptor pairs <code class="code"> (fd_from,fd_to) </code>.
   The descriptor <code class="code">fd_from</code> in the current process will be assigned
   to <code class="code">fd_to</code> in the subprocess started for the command. 
   The list of assignments is executed sequentially, so
   later assignments must take the effect of previous assignments
   into account. For example, to make stderr of the subprocess write 
   to stdout of the parent process, pass <code class="code"> [(stdout; stderr)] </code>. <ul>
<li>By default, there are no assignments.</li>
</ul>
</div>
<div class="param_info"><code class="code">filename</code> : The name of the executable to start. The executable
   file is not searched, use <a href="Shell_sys.html#VALlookup_executable"><code class="code">Shell_sys.lookup_executable</code></a> for this
   purpose.</div>

<pre><span id="EXCEPTIONExecutable_not_found"><span class="keyword">exception</span> Executable_not_found</span> <span class="keyword">of</span> <code class="type">string</code></pre>
<div class="info ">
<div class="info-desc">
<p>Raised when an executable file cannot be found; the argument is the
  search name</p>
</div>
</div>

<pre><span id="VALlookup_executable"><span class="keyword">val</span> lookup_executable</span> : <code class="type">?path:string list -> string -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Searches an executable file. If the passed search name contains a
 slash, it is expected that this name is already the path name of the
 executable. If the search name does not contain a slash character,
 it is searched in the directories enumerated by the search path.</p>

</div>
</div>
<div class="param_info"><code class="code">path</code> : The search path. By default, the contents of the
   variable PATH of the current environment, split by ':', are
   used (Win32: SearchPath is used)</div>

<pre><span id="VALget_cmdname"><span class="keyword">val</span> get_cmdname</span> : <code class="type"><a href="Shell_sys.html#TYPEcommand">command</a> -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Returns the name of the command</p>
</div>
</div>

<pre><span id="VALget_arguments"><span class="keyword">val</span> get_arguments</span> : <code class="type"><a href="Shell_sys.html#TYPEcommand">command</a> -> string array</code></pre><div class="info ">
<div class="info-desc">
<p>Returns the argument array of the command (skipping the command name)</p>
</div>
</div>

<pre><span id="VALget_chdir"><span class="keyword">val</span> get_chdir</span> : <code class="type"><a href="Shell_sys.html#TYPEcommand">command</a> -> string option</code></pre><div class="info ">
<div class="info-desc">
<p>Returns the <code class="code">chdir</code> parameter of the command</p>
</div>
</div>

<pre><span id="VALget_environment"><span class="keyword">val</span> get_environment</span> : <code class="type"><a href="Shell_sys.html#TYPEcommand">command</a> -> <a href="Shell_sys.html#TYPEenvironment">environment</a></code></pre><div class="info ">
<div class="info-desc">
<p>Returns the designated environment of the command</p>
</div>
</div>

<pre><span id="VALget_descriptors"><span class="keyword">val</span> get_descriptors</span> : <code class="type"><a href="Shell_sys.html#TYPEcommand">command</a> -> Unix.file_descr list</code></pre><div class="info ">
<div class="info-desc">
<p>Returns the list of active descriptors</p>
</div>
</div>

<pre><span id="VALget_assignments"><span class="keyword">val</span> get_assignments</span> : <code class="type"><a href="Shell_sys.html#TYPEcommand">command</a> -> (Unix.file_descr * Unix.file_descr) list</code></pre><div class="info ">
<div class="info-desc">
<p>Returns the list of assignments <code class="code"> (fd_from,fd_to) </code></p>
</div>
</div>

<pre><span id="VALget_filename"><span class="keyword">val</span> get_filename</span> : <code class="type"><a href="Shell_sys.html#TYPEcommand">command</a> -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Returns the file name of the executable</p>
</div>
</div>

<pre><span id="VALset_cmdname"><span class="keyword">val</span> set_cmdname</span> : <code class="type"><a href="Shell_sys.html#TYPEcommand">command</a> -> string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Sets the command name</p>
</div>
</div>

<pre><span id="VALset_arguments"><span class="keyword">val</span> set_arguments</span> : <code class="type"><a href="Shell_sys.html#TYPEcommand">command</a> -> string array -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Sets the argument array</p>
</div>
</div>

<pre><span id="VALset_chdir"><span class="keyword">val</span> set_chdir</span> : <code class="type"><a href="Shell_sys.html#TYPEcommand">command</a> -> string option -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Sets the <code class="code">chdir</code> parameter of the command</p>
</div>
</div>

<pre><span id="VALset_environment"><span class="keyword">val</span> set_environment</span> : <code class="type"><a href="Shell_sys.html#TYPEcommand">command</a> -> <a href="Shell_sys.html#TYPEenvironment">environment</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Sets the environment</p>
</div>
</div>

<pre><span id="VALset_descriptors"><span class="keyword">val</span> set_descriptors</span> : <code class="type"><a href="Shell_sys.html#TYPEcommand">command</a> -> Unix.file_descr list -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Sets the list of active descriptors</p>
</div>
</div>

<pre><span id="VALset_assignments"><span class="keyword">val</span> set_assignments</span> : <code class="type"><a href="Shell_sys.html#TYPEcommand">command</a> -> (Unix.file_descr * Unix.file_descr) list -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Sets the list of assignments <code class="code"> (fd_from,fd_to) </code></p>
</div>
</div>

<pre><span id="VALset_filename"><span class="keyword">val</span> set_filename</span> : <code class="type"><a href="Shell_sys.html#TYPEcommand">command</a> -> string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Sets the file name of the executable to start</p>
</div>
</div>

<pre><span id="VALcopy_command"><span class="keyword">val</span> copy_command</span> : <code class="type"><a href="Shell_sys.html#TYPEcommand">command</a> -> <a href="Shell_sys.html#TYPEcommand">command</a></code></pre><div class="info ">
<div class="info-desc">
<p>Returns a duplicate of the command description</p>
</div>
</div>

<pre><span id="VALis_executable"><span class="keyword">val</span> is_executable</span> : <code class="type"><a href="Shell_sys.html#TYPEcommand">command</a> -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Returns <code class="code">true</code> if there is an executable file for the command, and
 it is permitted to run this file (as stated by the file permissions).</p>

<p><code class="code">false</code> means that the command can definitely not be executed. However,
 even if the function returns <code class="code">true</code> there may be still reasons that
 execution will fail.</p>
</div>
</div>
<h2 id="1_Processes">Processes</h2>
<pre><span id="TYPEprocess"><span class="keyword">type</span> <code class="type"></code>process</span> </pre>
<div class="info ">
<div class="info-desc">
<p>A process is the running instance of a command (a Unix process)</p>
</div>
</div>


<pre><code><span id="TYPEgroup_action"><span class="keyword">type</span> <code class="type"></code>group_action</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTgroup_action.New_bg_group"><span class="constructor">New_bg_group</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Start process in new background process group</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTgroup_action.New_fg_group"><span class="constructor">New_fg_group</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Start process in new foreground process group</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTgroup_action.Join_group"><span class="constructor">Join_group</span></span> <span class="keyword">of</span> <code class="type">int</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Started process joins this existing process group</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTgroup_action.Current_group"><span class="constructor">Current_group</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Started process remains in the current group</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>

<div class="info ">
<div class="info-desc">
<p>Determines in which process group the new process will run</p>
</div>
</div>


<pre><code><span id="TYPEfwd_mode"><span class="keyword">type</span> <code class="type"></code>fwd_mode</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTfwd_mode.No_forward"><span class="constructor">No_forward</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>No forwarding of keyboard signals</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTfwd_mode.Forward_to_process"><span class="constructor">Forward_to_process</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Forward signals directly to subprocess</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTfwd_mode.Forward_to_group"><span class="constructor">Forward_to_group</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Forward signals to the process group of the subprocess</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>

<div class="info ">
<div class="info-desc">
<p>Determines whether and how keyboard signals (SIGINT, SIGQUIT) are
      forwarded from the caller to the new child. There is no forwarding
      in Win32 - all console applications get the keyboard signals anyway.</p>
</div>
</div>


<pre><span id="VALrun"><span class="keyword">val</span> run</span> : <code class="type">?group:<a href="Shell_sys.html#TYPEgroup_action">group_action</a> -><br>       ?forward_mode:<a href="Shell_sys.html#TYPEfwd_mode">fwd_mode</a> -><br>       ?pipe_assignments:(Unix.file_descr * Unix.file_descr) list -><br>       <a href="Shell_sys.html#TYPEcommand">command</a> -> <a href="Shell_sys.html#TYPEprocess">process</a></code></pre><div class="info ">
<div class="info-desc">
<p>Executes the command concurrently with the current process. The function
 does not wait until the process terminates; it returns immediately after
 the <code class="code">exec</code> system call has been successfully performed; errors that
 occur until <code class="code">exec</code> are caught and reported as exception (even errors
 in the fresh subprocess).</p>

<p>On error, one can assume that the process state has been cleaned up:
 any forked child process has terminated; any modifications of the global
 process state has been restored.</p>

<p>File descriptor assignments: First, the assignments in <code class="code">pipe_assignments</code>
 are performed, then the assignments contained in the command. The
 <code class="code">pipe_assignments</code> are interpreted as parallel assignment, not
 as sequential assignment.</p>

<p>Note: For users without very special needs, it is recommended to run
 jobs instead of processes. See below for the job API.</p>

</div>
</div>
<div class="param_info"><code class="code">group</code> : Determines in which process group the new process will
   run. By default <code class="code">Current_group</code>.</div>
<div class="param_info"><code class="code">forward_mode</code> : Whether and how to forward keyboard signals
   to the new child. By default <code class="code">No_forward</code>. The Win32 implementation
   ignores this argument.</div>
<div class="param_info"><code class="code">pipe_assignments</code> : A list of descriptor pairs <code class="code">(fd_from,fd_to)</code>.
   The descriptor <code class="code">fd_from</code> in the current process will be assigned
   to <code class="code">fd_to</code> in the started subprocess. In order to
   take effect, <code class="code">fd_to</code> must also be passed in the <code class="code">descriptors</code>
   property of the started command.
   Furthermore, <code class="code">fd_from</code> may or may not be member of <code class="code">descriptors</code>;
   in the first case it will remain open, in the latter case it will
   be closed. The list of assignments is executed in parallel. For
   example, to swap the roles of stdout and stderr, pass the list
   <code class="code"> [(stdout,stderr); (stderr,stdout)] </code>.</div>

<pre><span id="VALprocess_id"><span class="keyword">val</span> process_id</span> : <code class="type"><a href="Shell_sys.html#TYPEprocess">process</a> -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Returns the process ID of the process</p>
</div>
</div>

<pre><span id="VALstatus"><span class="keyword">val</span> status</span> : <code class="type"><a href="Shell_sys.html#TYPEprocess">process</a> -> Unix.process_status</code></pre><div class="info ">
<div class="info-desc">
<p>Reports the status so far known: If the process 
 has terminated, the status of the process is returned.
 If the process is still running, <code class="code">Not_found</code> will be raised.</p>
</div>
</div>

<pre><span id="VALcommand_of_process"><span class="keyword">val</span> command_of_process</span> : <code class="type"><a href="Shell_sys.html#TYPEprocess">process</a> -> <a href="Shell_sys.html#TYPEcommand">command</a></code></pre><div class="info ">
<div class="info-desc">
<p>Returns the command that is now running as the process</p>
</div>
</div>

<pre><span id="VALcall"><span class="keyword">val</span> call</span> : <code class="type"><a href="Shell_sys.html#TYPEcommand">command</a> -> <a href="Shell_sys.html#TYPEprocess">process</a></code></pre><div class="info ">
<div class="info-desc">
<p>Executes the command and waits until the process terminates
 (synchronous execution a la <code class="code">system</code>, but no intermediate shell).
 <code class="code">status</code> is guaranteed to return WEXITED or WSIGNALED.</p>
</div>
</div>

<pre><span id="VALkill"><span class="keyword">val</span> kill</span> : <code class="type">?signal:int -> <a href="Shell_sys.html#TYPEprocess">process</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Sends a signal to the passed process.</p>

</div>
</div>
<div class="param_info"><code class="code">signal</code> : The signal to send, by default SIGTERM</div>
<h2 id="1_Jobs">Jobs</h2><p>A <code class="code">job</code> is the description of how to run several commands which are
 linked by pipelines (or which are just a logical unit). A <code class="code">job_instance</code>
 is the running instance of a job.</p>

<p>Jobs are implemented on a higher layer than commands; the
 following means of the operating system are used by job
 invocations:</p>
<ul>
<li>Normally a <code class="code">job_instance</code> corresponds to a Unix process group. In
   this case the last added command will result in the process group
   leader.</li>
<li>Controlling the execution of jobs requires that signal
   handlers are set in many cases (see <code class="code">install_job_handlers</code>)</li>
<li>The processes of jobs are often interconnected by pipelines
   (see <code class="code">add_pipeline</code>).</li>
<li>It is possible to handle pipelines between the current process and
   processes of the job (see <code class="code">add_producer</code> and <code class="code">add_consumer</code>)</li>
</ul>
<p><b>Important:</b></p>

<p>In order to run jobs efficiently (without busy waiting) and properly
 it is strongly recommended to install the signal handlers using
 <code class="code">install_job_handlers</code></p>

<pre><span id="TYPEjob"><span class="keyword">type</span> <code class="type"></code>job</span> </pre>


<pre><span id="TYPEjob_instance"><span class="keyword">type</span> <code class="type"></code>job_instance</span> </pre>


<pre><span id="VALnew_job"><span class="keyword">val</span> new_job</span> : <code class="type">unit -> <a href="Shell_sys.html#TYPEjob">job</a></code></pre><div class="info ">
<div class="info-desc">
<p>Creates a new job descriptor. Initially the job is empty, but you can
 fill it with commands (<code class="code">add_command</code>), pipelines (<code class="code">add_pipeline</code>), 
 consumers (<code class="code">add_consumer</code>) and producers (<code class="code">add_producer</code>).
 When the job is set up, you can start it (<code class="code">run_job</code>/<code class="code">finish_job</code> or
 <code class="code">call_job</code>).</p>
</div>
</div>

<pre><span id="VALadd_command"><span class="keyword">val</span> add_command</span> : <code class="type"><a href="Shell_sys.html#TYPEcommand">command</a> -> <a href="Shell_sys.html#TYPEjob">job</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Adds a command to a job.</p>

<p>Note that you cannot add the same command twice; however you can
 add a copy of a command already belonging to the job.</p>
</div>
</div>

<pre><span id="VALadd_pipeline"><span class="keyword">val</span> add_pipeline</span> : <code class="type">?bidirectional:bool -><br>       ?src_descr:Unix.file_descr -><br>       ?dest_descr:Unix.file_descr -><br>       src:<a href="Shell_sys.html#TYPEcommand">command</a> -> dest:<a href="Shell_sys.html#TYPEcommand">command</a> -> <a href="Shell_sys.html#TYPEjob">job</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Adds a pipeline which redirects the output of the command <code class="code">src</code> to the
 input of the command <code class="code">dest</code>.</p>

</div>
</div>
<div class="param_info"><code class="code">bidirectional</code> : if <code class="code">false</code> (default), a classical pipe is created
    to connect the file descriptors. This normally restricts the data
    flow to one direction. If <code class="code">true</code>, a socketpair is created which is
    roughly a bidirectional pipe. In this case, data flow in both
    directions is possible.</div>
<div class="param_info"><code class="code">src_descr</code> : determines the file descriptor of the source command
    which is redirected. This is by default <code class="code">stdout</code>.</div>
<div class="param_info"><code class="code">dest_descr</code> : determines the file descriptor of the destination
    command to which the data stream is sent. This is by default <code class="code">stdin</code>.</div>

<pre><span id="VALadd_producer"><span class="keyword">val</span> add_producer</span> : <code class="type">?descr:Unix.file_descr -><br>       producer:(Unix.file_descr -> bool) -><br>       <a href="Shell_sys.html#TYPEcommand">command</a> -> <a href="Shell_sys.html#TYPEjob">job</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Adds a producer to the job. A producer transfers data to the
 subprocess realizing the passed command. To do so, a pipe is created
 between the file descriptor <code class="code">descr</code> of the subprocess and another
 descriptor <code class="code">descr'</code> which is open in the current process. The
 function <code class="code">producer</code> is called when data can be written into the
 pipe. The argument of <code class="code">producer</code> is the writing end of the pipe
 <code class="code">descr'</code>. This file descriptor is in non-blocking mode. The
 function <code class="code">producer</code> must close <code class="code">descr'</code> when all data are
 transferred. The return value of <code class="code">producer</code> indicates whether
 the descriptor is still open.</p>

</div>
</div>
<div class="param_info"><code class="code">descr</code> : The descriptor of the subprocess to which the reading
    end of the pipe is dup'ed. By default <code class="code">stdin</code>.</div>

<pre><span id="VALfrom_string"><span class="keyword">val</span> from_string</span> : <code class="type">?pos:int -><br>       ?len:int -> ?epipe:(unit -> unit) -> string -> Unix.file_descr -> bool</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">from_string ?pos ?len ?epipe s</code> returns a function which can be
 used as <code class="code">producer</code> argument for <code class="code">add_producer</code>. The data transferred
 to the subprocess is taken from the string <code class="code">s</code>. After these data
 are sent, the pipeline is closed.</p>

</div>
</div>
<div class="param_info"><code class="code">pos</code> : The position in <code class="code">s</code> where the data slice to transfer begins.
    By default <code class="code">0</code>.</div>
<div class="param_info"><code class="code">len</code> : The length of the data slice to transfer. By default,
    all bytes from the start position <code class="code">pos</code> to the end of the 
    string are taken.</div>
<div class="param_info"><code class="code">epipe</code> : This function is called when the pipeline breaks
    (EPIPE). Default: the empty function. EPIPE exceptions are
    always caught, and implicitly handled by closing the pipeline.</div>

<pre><span id="VALfrom_tstring"><span class="keyword">val</span> from_tstring</span> : <code class="type">?pos:int -><br>       ?len:int -><br>       ?epipe:(unit -> unit) -> <a href="Netsys_types.html#TYPEtstring">Netsys_types.tstring</a> -> Unix.file_descr -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Same for tagged strings</p>
</div>
</div>

<pre><span id="VALfrom_stream"><span class="keyword">val</span> from_stream</span> : <code class="type">?epipe:(unit -> unit) -> string Stdlib.Stream.t -> Unix.file_descr -> bool</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">from_stream ?epipe s</code> returns a function which can be
 used as <code class="code">producer</code> argument for <code class="code">add_producer</code>. The data transferred
 to the subprocess is taken from the string stream <code class="code">s</code>. After these data
 are sent, the pipeline is closed.</p>

</div>
</div>
<div class="param_info"><code class="code">epipe</code> : This function is called when the pipeline breaks
    (EPIPE). Default: the empty function. EPIPE exceptions are
    always caught, and implicitly handled by closing the pipeline.</div>

<pre><span id="VALadd_consumer"><span class="keyword">val</span> add_consumer</span> : <code class="type">?descr:Unix.file_descr -><br>       consumer:(Unix.file_descr -> bool) -><br>       <a href="Shell_sys.html#TYPEcommand">command</a> -> <a href="Shell_sys.html#TYPEjob">job</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Adds a consumer to the job. A consumer transfers data from the
 subprocess realizing the passed command to the current process. 
 To do so, a pipe is created between the file descriptor <code class="code">descr</code>
 of the subprocess and another descriptor <code class="code">descr'</code> which is open
 in the current process. The function <code class="code">consumer</code> is called when 
 data can be read from the pipe. The argument of <code class="code">consumer</code> is 
 reading end of the pipe <code class="code">descr'</code>. This file descriptor is in
 non-blocking mode. The function <code class="code">consumer</code> must close <code class="code">descr'</code> 
 after EOF is detected. The return value of <code class="code">consumer</code> indicates whether
 the descriptor is still open.</p>

</div>
</div>
<div class="param_info"><code class="code">descr</code> : The descriptor of the subprocess to which the writing
    end of the pipe is dup'ed. By default <code class="code">stdout</code>.</div>

<pre><span id="VALto_buffer"><span class="keyword">val</span> to_buffer</span> : <code class="type">Stdlib.Buffer.t -> Unix.file_descr -> bool</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">to_buffer b</code> returns a function which can be
 used as <code class="code">consumer</code> argument for <code class="code">add_consumer</code>. The data received
 from the subprocess is added to the buffer <code class="code">b</code>.</p>
</div>
</div>

<pre><span id="VALto_netbuffer"><span class="keyword">val</span> to_netbuffer</span> : <code class="type"><a href="Netbuffer.html#TYPEt">Netbuffer.t</a> -> Unix.file_descr -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Same for a <a href="Netbuffer.html"><code class="code">Netbuffer</code></a></p>
</div>
</div>

<pre><code><span id="TYPEgroup_mode"><span class="keyword">type</span> <code class="type"></code>group_mode</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTgroup_mode.Same_as_caller"><span class="constructor">Same_as_caller</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>The job runs in the same process group as the current process</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTgroup_mode.Foreground"><span class="constructor">Foreground</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>The job runs in a new foreground process group</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTgroup_mode.Background"><span class="constructor">Background</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>The job runs in a new background process group</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>

<div class="info ">
<div class="info-desc">
<p>Specifies how the job instance is related to process groups</p>
</div>
</div>


<pre><span id="VALrun_job"><span class="keyword">val</span> run_job</span> : <code class="type">?mode:<a href="Shell_sys.html#TYPEgroup_mode">group_mode</a> -><br>       ?forward_signals:bool -> <a href="Shell_sys.html#TYPEjob">job</a> -> <a href="Shell_sys.html#TYPEjob_instance">job_instance</a></code></pre><div class="info ">
<div class="info-desc">
<p>Invokes the commands of the job such that they run concurrently
 with the main process.</p>

<p>The function returns a <code class="code">job_instance</code>, i.e. a value recording which
 processes are started, and how they are related. Furthermore, the
 function has the side effect of adding the
 job to the global list of current jobs.</p>

<p>The <code class="code">mode</code> argument specifies whether a new Unix process group is
 created for the job instance. A process group has the advantage that
 it is possible to send signals to all processes of the group at
 once. For example, one can terminate a group by sending SIGTERM
 to it: All member processes get the signal. Usually, these are not only
 the subprocesses initially created, but also further processes 
 started by the initial members.</p>

<p>So if it is necessary to send signals to the processes of the job,
 it will be advantegous to run it in a new process group. However,
 this also means that signals sent to the current process group
 are not automatically forwarded to the created process group. For
 example, if the current process group is terminated, the job
 will continue running, because it is member of a different process
 group. One has to explicitly catch and forward signals to avoid
 wild-running jobs.</p>

<p>The moral of the story is that one should only create new process
 groups when it is necessary (e.g. the user must be able to stop
 an action at any time). Furthermore, signal forwarding must be
 configured.</p>

<p>The Unix shell also allows the programmer to specify process group
 handling to a certain extent. Normally, commands are executed in the
 same process group as the caller. The syntax "command &amp;" forces that
 the command is run in a new background process group. There is another
 situation when new process groups are created: when a new <b>interactive</b> 
 shell is started the commands are run in new foreground process groups
 (so the keyboard signals like CTRL-C work).</p>

</div>
</div>
<div class="param_info"><code class="code">mode</code> : Specifies the process group handling. By default, the
   job is executed in the same process group as the current process
   (<code class="code">Same_as_caller</code>). The value <code class="code">Background</code> causes that a new
   background process group is started. The value <code class="code">Foreground</code> causes
   that a new foreground process group is started. For the latter,
   it is required that there is a controlling terminal (i.e. it
   does not work for daemons). Any existing foreground process group
   (there is at most one) is put into the background, but this is
   not restored when the job is over (the caller must do this).
   Foreground process groups should be avoided unless you are
   writing an interactive shell interpreter.</div>
<div class="param_info"><code class="code">forward_signals</code> : If <code class="code">true</code>, the default, keyboard signals
   (SIGINT, SIGQUIT) delivered to the current process are forwarded to 
   the job. This has only a meaning if the job is running as 
   background process group. Furthermore, it is required that
   <code class="code">install_job_handlers</code> has been called to enable signal 
   forwarding.

 The function returns normally if at least one process could be started.
 If no process was startable (i.e. the first command was not startable), 
 an exception is raised. If one or more processes could be started but
 not all, <code class="code">job_status</code> will return <code class="code">Job_partially_running</code>. The caller 
 should then discard the job and any intermediate result that might
 already have been produced by the partial job.

 When all processes could be started and no other exceptional condition
 happened, the function sets <code class="code">job_status</code> to <code class="code">Job_running</code>.</div>

<pre><span id="TYPEjob_handler_engine_type"><span class="keyword">class type</span> <code class="type">['t]</code> <a href="Shell_sys.job_handler_engine_type-c.html">job_handler_engine_type</a></span> = <code class="code">object</code> <a href="Shell_sys.job_handler_engine_type-c.html">..</a> <code class="code">end</code></pre><div class="info">
<p>This type of engine also returns the <code class="code">job</code> and the <code class="code">job_instance</code>.</p>

</div>

<pre><span id="TYPEjob_engine"><span class="keyword">class</span> <a href="Shell_sys.job_engine-c.html">job_engine</a></span> : <code class="type"><a href="Unixqueue.event_system-c.html">Unixqueue.event_system</a> -> <a href="Shell_sys.html#TYPEjob_instance">job_instance</a> -> </code><code class="type">[unit]</code> <code class="type"><a href="Shell_sys.job_handler_engine_type-c.html">job_handler_engine_type</a></code></pre><div class="info">
<p>The <code class="code">job_engine</code> watches the job, and looks whether the processes
      are finished, and if so, it records the process statuses.</p>

</div>

<pre><span id="VALfinish_job"><span class="keyword">val</span> finish_job</span> : <code class="type"><a href="Shell_sys.html#TYPEjob_instance">job_instance</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>This creates a <code class="code">job_engine</code> internally and runs until it is
 finished, i.e. until the job has been executed.</p>

<p>In previous version of Ocamlnet there was an optional <code class="code">sys</code>
 argument. This is gone now. Also, the error handling is different.
 It is no longer possible to restart <code class="code">finish_job</code> when an error
 happens.</p>
</div>
</div>

<pre><span id="VALcall_job"><span class="keyword">val</span> call_job</span> : <code class="type">?mode:<a href="Shell_sys.html#TYPEgroup_mode">group_mode</a> -><br>       ?forward_signals:bool -><br>       ?onerror:(<a href="Shell_sys.html#TYPEjob_instance">job_instance</a> -> unit) -><br>       <a href="Shell_sys.html#TYPEjob">job</a> -> <a href="Shell_sys.html#TYPEjob_instance">job_instance</a></code></pre><div class="info ">
<div class="info-desc">
<p>Starts the job (see <code class="code">run_job</code>) and waits until it finishes (see
 <code class="code">finish_job</code>); i.e. <code class="code">call_job = run_job + finish_job</code>.
 The function returns normally if all processes can be started; you can
 examine <code class="code">job_status</code> of the result to get the information whether all
 processes returned the exit code 0.</p>

</div>
</div>
<div class="param_info"><code class="code">mode</code> : See <code class="code">run_job</code></div>
<div class="param_info"><code class="code">forward_signals</code> : See <code class="code">run_job</code></div>
<div class="param_info"><code class="code">onerror</code> : If not all of the processes can be started, the
    function passed by <code class="code">onerror</code> is invoked. By default, this
    function calls <code class="code">abandon_job</code> to stop the already running
    processes. After the <code class="code">onerror</code> function has returned, the original 
    exception is raised again. Fatal error conditions are not caught.</div>

<pre><span id="VALprocesses"><span class="keyword">val</span> processes</span> : <code class="type"><a href="Shell_sys.html#TYPEjob_instance">job_instance</a> -> <a href="Shell_sys.html#TYPEprocess">process</a> list</code></pre><div class="info ">
<div class="info-desc">
<p>Returns the processes that have actually been started for this job
 by <code class="code">run_job</code>; note that the corresponding Unix process group
 may have additional processes (e.g. indirectly started processes).</p>
</div>
</div>

<pre><span id="EXCEPTIONNo_Unix_process_group"><span class="keyword">exception</span> No_Unix_process_group</span></pre>
<div class="info ">
<div class="info-desc">
<p>Raised by functions referring to Unix process groups when the
 job has not been started in its own process group.</p>
</div>
</div>

<pre><span id="VALprocess_group_leader"><span class="keyword">val</span> process_group_leader</span> : <code class="type"><a href="Shell_sys.html#TYPEjob_instance">job_instance</a> -> <a href="Shell_sys.html#TYPEprocess">process</a></code></pre><div class="info ">
<div class="info-desc">
<p>Returns the process group leader process.
 This function is not available for jobs in the mode <code class="code">Same_as_caller</code>.</p>
</div>
</div>

<pre><span id="VALprocess_group_id"><span class="keyword">val</span> process_group_id</span> : <code class="type"><a href="Shell_sys.html#TYPEjob_instance">job_instance</a> -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Returns the Unix ID of the process group as number &gt; 1.
 This function is not available for jobs in the mode <code class="code">Same_as_caller</code>.</p>
</div>
</div>

<pre><code><span id="TYPEjob_status"><span class="keyword">type</span> <code class="type"></code>job_status</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTjob_status.Job_running"><span class="constructor">Job_running</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>All commands could be started, and at least
 one process is still running</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTjob_status.Job_partially_running"><span class="constructor">Job_partially_running</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Not all commands could be started, and at least
 one process is still running</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTjob_status.Job_ok"><span class="constructor">Job_ok</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>all processes terminated with exit code 0</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTjob_status.Job_error"><span class="constructor">Job_error</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>all processes terminated but some abnormally</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTjob_status.Job_abandoned"><span class="constructor">Job_abandoned</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>the job has been abandoned (see <code class="code">abandon_job</code>)</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>

<div class="info ">
<div class="info-desc">
<p>Indicates the status of the job</p>
</div>
</div>


<pre><span id="VALjob_status"><span class="keyword">val</span> job_status</span> : <code class="type"><a href="Shell_sys.html#TYPEjob_instance">job_instance</a> -> <a href="Shell_sys.html#TYPEjob_status">job_status</a></code></pre><div class="info ">
<div class="info-desc">
<p>Returns the status. The status may only change after <code class="code">finish_job</code>
 has been called:</p>

<ul>
<li>after <code class="code">run_job</code>: status is <code class="code">Job_running</code> or <code class="code">Job_partially_running</code></li>
<li>after <code class="code">finish_job</code>: if returning normally: status is <code class="code">Job_ok</code> or 
   <code class="code">Job_error</code>. After an exception happened the other states are possible,
   too</li>
</ul>
</div>
</div>

<pre><span id="VALkill_process_group"><span class="keyword">val</span> kill_process_group</span> : <code class="type">?signal:int -> <a href="Shell_sys.html#TYPEjob_instance">job_instance</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Kills the process group if it is still (at least partially) running.
 This operation is not available if the mode is <code class="code">Same_as_caller</code>
 (exception <code class="code">No_Unix_process_group</code>).</p>

<p>Note 1: In the Unix terminology, "killing a job" only means to send
 a signal to the job. So the job may continue running, or it may
 terminate; in general we do not know this. Because of this, the job
 will still have an entry in the job list.</p>

<p>Note 2: Because sub-sub-processes are also killed, this function may send
 the signal to more processes than kill_processes (below). On the other
 hand, it is possible that sub-processes change their group ID such that
 it is also possible that this function sends the signal to fewer processes
 than kill_processes.</p>

</div>
</div>
<div class="param_info"><code class="code">signal</code> : The signal number to send (O'Caml signal numbers as
    used by the <code class="code">Sys</code> module). Default is <code class="code">Sys.sigterm</code>.</div>

<pre><span id="VALkill_processes"><span class="keyword">val</span> kill_processes</span> : <code class="type">?signal:int -> <a href="Shell_sys.html#TYPEjob_instance">job_instance</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Kills the individual processes of the job which are still running.</p>

</div>
</div>
<div class="param_info"><code class="code">signal</code> : The signal number to send (O'Caml signal numbers as
    used by the <code class="code">Sys</code> module). Default is <code class="code">Sys.sigterm</code>.</div>

<pre><span id="VALcancel_job"><span class="keyword">val</span> cancel_job</span> : <code class="type">?signal:int -> <a href="Shell_sys.html#TYPEjob_instance">job_instance</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Tries to get rid of a running job. If the mode is <code class="code">Same_as_caller</code>, the
 signal is sent to the processes individually. If the mode is
 <code class="code">Foreground</code> or <code class="code">Background</code>, the signal is sent to the process group 
 corresponding to the job.</p>

<p>This function removes the job from the job list; i.e. it is no longer
 watched. Because of some magic spells it is guaranteed that the job dies
 immediately without becoming a zombie (provided you have a SIGCHLD
 handler).</p>

</div>
</div>
<div class="param_info"><code class="code">signal</code> : The signal number to send (O'Caml signal numbers as
    used by the <code class="code">Sys</code> module). Default is <code class="code">Sys.sigterm</code>.</div>

<pre><span id="VALabandon_job"><span class="keyword">val</span> abandon_job</span> : <code class="type">?signal:int -> <a href="Shell_sys.html#TYPEjob_instance">job_instance</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><b>Deprecated</b> name for <code class="code">cancel_job</code></p>
</div>
</div>

<pre><span id="EXCEPTIONAlready_installed"><span class="keyword">exception</span> Already_installed</span></pre>
<div class="info ">
<div class="info-desc">
<p>Raised when the job handlers are already installed</p>
</div>
</div>

<pre><span id="VALconfigure_job_handlers"><span class="keyword">val</span> configure_job_handlers</span> : <code class="type">?catch_sigint:bool -><br>       ?catch_sigquit:bool -><br>       ?catch_sigterm:bool -> ?catch_sighup:bool -> ?at_exit:bool -> unit -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Configures signal and at_exit handlers for jobs:</p>
<ul>
<li>The keyboard signals SIGINT and SIGQUIT are forwarded to all jobs
   which are running in the background (and thus are not
   automatically notified) and want to get such signals (<code class="code">forward_signals</code>).</li>
<li>The signals SIGTERM and SIGHUP are (if the handler is installed) 
   forwarded to all dependent processes (regardless whether they are
   running in their own Unix process group or not, and regardless of
   <code class="code">forward_signals</code>).</li>
<li>The <code class="code">at_exit</code> handler sends a SIGTERM to all dependent processes, too.</li>
</ul>
<p>In previous versions of Ocamlnet it was also possible to configure
 <code class="code">catch_sigchld</code> to set whether a SIGCHLD handler is installed. This
 is now always done.</p>

<p>In previous versions of Ocamlnet there was also a <code class="code">set_sigpipe</code> flag.
 This flag is gone as a SIGPIPE handler is now always installed.</p>

<p>The handlers are now managed by <a href="Netsys_signal.html"><code class="code">Netsys_signal</code></a>. The handlers of this
 module set the <code class="code">keep_default</code> flag for SIGINT, SIGQUIT, SIGTERM, and
 SIGHUP, so that the default action for these signals is executed after
 the forwarding to the child processes is done. By setting another
 handler in <a href="Netsys_signal.html"><code class="code">Netsys_signal</code></a> without that flag this behavior can be
 overridden.</p>

<p>Note that if an uncaught exception leads to program termination,
 this situation will not be detected; any running jobs will
 not be terminated (sorry, this cannot be fixed).</p>

<p>This function sets only which handlers will be installed when
 <code class="code">install_job_handlers</code> (below) is invoked.
 The function fails if the handlers are already installed.</p>

<p>Win32: No handlers are installed. It would be desirable to some extent
 that at least <code class="code">at_exit</code> is honoured, however, this is not yet done.</p>

</div>
</div>
<div class="param_info"><code class="code">catch_sigint</code> : whether to install a SIGINT handler (default: <code class="code">true</code>)</div>
<div class="param_info"><code class="code">catch_sigquit</code> : whether to install a SIGQUIT handler (default: <code class="code">true</code>)</div>
<div class="param_info"><code class="code">catch_sigterm</code> : whether to install a SIGTERM handler (default: <code class="code">true</code>)</div>
<div class="param_info"><code class="code">catch_sighup</code> : whether to install a SIGHUP handler (default: <code class="code">true</code>)</div>
<div class="param_info"><code class="code">at_exit</code> : whether to set the <code class="code">at_exit</code> handler (default: <code class="code">true</code>)</div>

<pre><span id="VALinstall_job_handlers"><span class="keyword">val</span> install_job_handlers</span> : <code class="type">unit -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Installs handlers as configured before.
 Raises <code class="code">Already_installed</code> if the handlers are already installed.</p>
</div>
</div>
<h2 id="1_Removedfunctions">Removed functions</h2><p>The functions <code class="code">add_rd_polling</code> and <code class="code">add_wr_polling</code> have been removed.
 They were added prior to the merge with the equeue library. Use a 
 Unixqueue now, which is much more powerful.</p>
<p>Also no longer supported because the type <code class="code">system_handler</code> is gone:</p>

<pre class="codepre"><code class="code">type system_handler</code></pre>
<pre class="codepre"><code class="code"> type process_event </code></pre>
<pre class="codepre"><code class="code">val wait : 
      ?wnohang:bool -&gt;                     (* default: false *)
      ?wuntraced:bool -&gt;                   (* default: false *)
      ?restart:bool -&gt;                     (* default: false *)
      ?check_interval:float -&gt;             (* default: 0.1 *)
      ?read:(Unix.file_descr list) -&gt;      (* default: [] *)
      ?write:(Unix.file_descr list) -&gt;     (* default: [] *)
      ?except:(Unix.file_descr list) -&gt;    (* default: [] *)
      process list -&gt;
        process_event list
    </code></pre><pre class="codepre"><code class="code">val register_job : system_handler -&gt; job_instance -&gt; unit</code></pre>
<pre class="codepre"><code class="code">val iter_job_instances : f:(job_instance -&gt; unit) -&gt;  unit</code></pre>
<pre class="codepre"><code class="code">val watch_for_zombies : unit -&gt; unit</code></pre>
<pre class="codepre"><code class="code">val process_group_expects_signals : job_instance -&gt; bool</code></pre><h2 id="1_Debugging">Debugging</h2>
<pre><span id="MODULEDebug"><span class="keyword">module</span> <a href="Shell_sys.Debug.html">Debug</a></span>: <code class="code">sig</code> <a href="Shell_sys.Debug.html">..</a> <code class="code">end</code></pre></body></html>