~ubuntu-branches/ubuntu/hardy/ocaml-doc/hardy

« back to all changes in this revision

Viewing changes to ocaml.html/manual035.html

  • Committer: Bazaar Package Importer
  • Author(s): Samuel Mimram
  • Date: 2007-09-08 01:49:22 UTC
  • mfrom: (0.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070908014922-lvihyehz0ndq7suu
Tags: 3.10-1
* New upstream release.
* Removed camlp4 documentation since it is not up-to-date.
* Updated to standards version 3.7.2, no changes needed.
* Updated my email address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
<HTML>
4
4
<HEAD>
5
5
 
6
 
 
7
 
 
8
6
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
9
 
<META name="GENERATOR" content="hevea 1.08">
 
7
<META name="GENERATOR" content="hevea 1.09">
10
8
<LINK rel="stylesheet" type="text/css" href="manual.css">
11
 
<TITLE>
12
 
The unix library: Unix system calls
13
 
</TITLE>
 
9
<TITLE>The unix library: Unix system calls</TITLE>
14
10
</HEAD>
15
11
<BODY >
16
 
<A HREF="manual034.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
17
 
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
18
 
<A HREF="manual036.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
 
12
<A HREF="manual034.html"><IMG SRC="previous_motif.gif" ALT="Previous"></A>
 
13
<A HREF="index.html"><IMG SRC="contents_motif.gif" ALT="Up"></A>
 
14
<A HREF="manual036.html"><IMG SRC="next_motif.gif" ALT="Next"></A>
19
15
<HR>
20
 
 
21
 
<H1 CLASS="chapter"><A NAME="htoc253">Chapter&nbsp;21</A>&nbsp;&nbsp;The unix library: Unix system calls</H1>
22
 
 
23
 
The <TT>unix</TT> library makes many Unix
 
16
<H1 CLASS="chapter"><A NAME="htoc253">Chapter�21</A>��The unix library: Unix system calls</H1><P>The <TT>unix</TT> library makes many Unix
24
17
system calls and system-related library functions available to
25
18
Objective Caml programs. This chapter describes briefly the functions
26
 
provided. Refer to sections 2&nbsp;and&nbsp;3 of the Unix manual for more
27
 
details on the behavior of these functions.<BR>
28
 
<BR>
29
 
Not all functions are provided by all Unix variants. If some functions
30
 
are not available, they will raise <TT>Invalid_arg</TT> when called.<BR>
31
 
<BR>
32
 
Programs that use the <TT>unix</TT> library must be linked as follows:
33
 
<PRE>
 
19
provided. Refer to sections 2�and�3 of the Unix manual for more
 
20
details on the behavior of these functions.</P><P>Not all functions are provided by all Unix variants. If some functions
 
21
are not available, they will raise <TT>Invalid_arg</TT> when called.</P><P>Programs that use the <TT>unix</TT> library must be linked as follows:
 
22
</P><PRE>
34
23
        ocamlc <I>other options</I> unix.cma <I>other files</I>
35
24
        ocamlopt <I>other options</I> unix.cmxa <I>other files</I>
36
 
</PRE>
 
25
</PRE><P>
37
26
For interactive use of the <TT>unix</TT> library, do:
38
 
<PRE>
 
27
</P><PRE>
39
28
        ocamlmktop -o mytop unix.cma
40
29
        ./mytop
41
 
</PRE>
 
30
</PRE><P>
42
31
or (if dynamic linking of C libraries is supported on your platform),
43
 
start <TT>ocaml</TT> and type <TT>#load "unix.cma";;</TT>.<BR>
44
 
<BR>
45
 
 
46
 
&nbsp;&nbsp;<FONT COLOR=purple>Windows:</FONT>
47
 
<BLOCKQUOTE CLASS="quote">
 
32
start <TT>ocaml</TT> and type <TT>#load "unix.cma";;</TT>.</P><BLOCKQUOTE CLASS="quote"><FONT COLOR=purple>Windows:</FONT>��
48
33
A fairly complete emulation of the Unix system calls is provided in
49
34
the Windows version of Objective Caml. The end of this chapter gives
50
35
more information on the functions that are not supported under Windows.
51
 
</BLOCKQUOTE>
52
 
 
53
 
<ul>
54
 
<li><a HREF="libref/Unix.html"> Module <tt>Unix</tt>: Unix system calls</a> <img alt="updated" src="updated_tiny.gif"></li>
55
 
<li><a HREF="libref/UnixLabels.html"> Module <tt>UnixLabels</tt>: Labeled Unix system calls</a></li>
56
 
</ul>
57
 
<BR>
58
 
<BR>
59
 
 
60
 
&nbsp;&nbsp;<FONT COLOR=purple>Windows:</FONT>
61
 
<BLOCKQUOTE CLASS="quote">
 
36
</BLOCKQUOTE><UL CLASS="ftoc2"><LI CLASS="li-links">
 
37
<A HREF="libref/Unix.html">Module <TT>Unix</TT>: Unix system calls</A>
 
38
</LI><LI CLASS="li-links"><A HREF="libref/UnixLabels.html">Module <TT>UnixLabels</TT>: Labeled Unix system calls</A>
 
39
</LI></UL><BLOCKQUOTE CLASS="quote"><FONT COLOR=purple>Windows:</FONT>��
62
40
The Cygwin port of Objective Caml fully implements all functions from
63
41
the Unix module. The native Win32 ports implement a subset of them.
64
42
Below is a list of the functions that are not implemented, or only
65
43
partially implemented, by the Win32 ports. Functions not mentioned are
66
 
fully implemented and behave as described previously in this chapter.<BR>
67
 
<BR>
68
 
<DIV CLASS="center"><TABLE BORDER=1 CELLSPACING=0 CELLPADDING=1 WIDTH="80%">
69
 
<TR><TD ALIGN=center NOWRAP><B>Functions</B></TD>
70
 
<TD ALIGN=center NOWRAP><B>Comment</B></TD>
71
 
</TR>
 
44
fully implemented and behave as described previously in this chapter.<DIV CLASS="center"><TABLE BORDER=1 CELLSPACING=0 CELLPADDING=1 WIDTH="80%"><TR><TD ALIGN=center NOWRAP><B>Functions</B></TD><TD ALIGN=center NOWRAP><B>Comment</B></TD></TR>
72
45
<TR><TD VALIGN=top ALIGN=left NOWRAP>
73
 
<TT>fork</TT></TD>
74
 
<TD VALIGN=top ALIGN=left>not implemented, use <TT>create_process</TT> or threads</TD>
75
 
</TR>
76
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>wait</TT></TD>
77
 
<TD VALIGN=top ALIGN=left>not implemented, use <TT>waitpid</TT></TD>
78
 
</TR>
79
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>waitpid</TT></TD>
80
 
<TD VALIGN=top ALIGN=left>can only wait for a given PID, not any child process</TD>
81
 
</TR>
82
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>getppid</TT></TD>
83
 
<TD VALIGN=top ALIGN=left>not implemented (meaningless under Windows)</TD>
84
 
</TR>
85
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>nice</TT></TD>
86
 
<TD VALIGN=top ALIGN=left>not implemented</TD>
87
 
</TR>
88
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>in_channel_of_descr</TT></TD>
89
 
<TD VALIGN=top ALIGN=left>does not work on sockets under Windows
90
 
95, 98, ME; works fine under NT, 2000, XP</TD>
91
 
</TR>
92
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>out_channel_of_descr</TT></TD>
93
 
<TD VALIGN=top ALIGN=left>ditto</TD>
94
 
</TR>
95
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>truncate</TT>, <TT>ftruncate</TT></TD>
96
 
<TD VALIGN=top ALIGN=left>not implemented</TD>
97
 
</TR>
98
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>lstat</TT>, <TT>fstat</TT></TD>
99
 
<TD VALIGN=top ALIGN=left>not implemented</TD>
100
 
</TR>
101
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>link</TT>, <TT>symlink</TT>, <TT>readlink</TT></TD>
102
 
<TD VALIGN=top ALIGN=left>not implemented (no links under
103
 
Windows)</TD>
104
 
</TR>
105
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>fchmod</TT></TD>
106
 
<TD VALIGN=top ALIGN=left>not implemented</TD>
107
 
</TR>
108
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>chown</TT>, <TT>fchown</TT></TD>
109
 
<TD VALIGN=top ALIGN=left>not implemented (make no sense on a DOS
110
 
file system)</TD>
111
 
</TR>
112
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>umask</TT></TD>
113
 
<TD VALIGN=top ALIGN=left>not implemented</TD>
114
 
</TR>
115
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>set_nonblock</TT>, <TT>clear_nonblock</TT></TD>
116
 
<TD VALIGN=top ALIGN=left>implemented as dummy
117
 
functions; use threads instead of non-blocking I/O</TD>
118
 
</TR>
119
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>rewinddir</TT></TD>
120
 
<TD VALIGN=top ALIGN=left>not implemented; re-open the directory instead</TD>
121
 
</TR>
122
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>mkfifo</TT></TD>
123
 
<TD VALIGN=top ALIGN=left>not implemented</TD>
124
 
</TR>
125
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>select</TT></TD>
126
 
<TD VALIGN=top ALIGN=left>implemented, but works only for sockets; use threads
127
 
 if you need to wait on other kinds of file descriptors</TD>
128
 
</TR>
129
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>lockf</TT></TD>
130
 
<TD VALIGN=top ALIGN=left>not implemented</TD>
131
 
</TR>
132
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>kill</TT>, <TT>pause</TT></TD>
133
 
<TD VALIGN=top ALIGN=left>not implemented (no inter-process signals in Windows)</TD>
134
 
</TR>
135
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>alarm</TT>, <TT>times</TT></TD>
136
 
<TD VALIGN=top ALIGN=left>not implemented</TD>
137
 
</TR>
138
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>getitimer</TT>, <TT>setitimer</TT></TD>
139
 
<TD VALIGN=top ALIGN=left>not implemented</TD>
140
 
</TR>
141
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>getuid</TT>, <TT>getgid</TT></TD>
142
 
<TD VALIGN=top ALIGN=left>always return 1</TD>
143
 
</TR>
144
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>getgid</TT>, <TT>getegid</TT>, <TT>getgroups</TT></TD>
145
 
<TD VALIGN=top ALIGN=left>not implemented</TD>
146
 
</TR>
147
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>setuid</TT>, <TT>setgid</TT></TD>
148
 
<TD VALIGN=top ALIGN=left>not implemented</TD>
149
 
</TR>
150
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>getpwnam</TT>, <TT>getpwuid</TT></TD>
151
 
<TD VALIGN=top ALIGN=left>always raise <TT>Not_found</TT></TD>
152
 
</TR>
153
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>getgrnam</TT>, <TT>getgrgid</TT></TD>
154
 
<TD VALIGN=top ALIGN=left>always raise <TT>Not_found</TT></TD>
155
 
</TR>
156
 
<TR><TD VALIGN=top ALIGN=left NOWRAP>type <TT>socket_domain</TT></TD>
157
 
<TD VALIGN=top ALIGN=left>the domain <TT>PF_UNIX</TT> is not supported;
158
 
<TT>PF_INET</TT> is fully supported</TD>
159
 
</TR>
160
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>open_connection</TT></TD>
161
 
<TD VALIGN=top ALIGN=left>does not work under Windows
162
 
95, 98, ME; works fine under NT, 2000, XP</TD>
163
 
</TR>
164
 
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>establish_server</TT></TD>
165
 
<TD VALIGN=top ALIGN=left>not implemented; use threads</TD>
166
 
</TR>
167
 
<TR><TD VALIGN=top ALIGN=left NOWRAP>terminal functions (<TT>tc*</TT>)</TD>
168
 
<TD VALIGN=top ALIGN=left>not implemented</TD>
169
 
</TR></TABLE></DIV></BLOCKQUOTE>
170
 
 
171
 
 
172
 
 
173
 
<HR>
174
 
<A HREF="manual034.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
175
 
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
176
 
<A HREF="manual036.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
 
46
<TT>fork</TT></TD><TD VALIGN=top ALIGN=left>not implemented, use <TT>create_process</TT> or threads</TD></TR>
 
47
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>wait</TT></TD><TD VALIGN=top ALIGN=left>not implemented, use <TT>waitpid</TT></TD></TR>
 
48
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>waitpid</TT></TD><TD VALIGN=top ALIGN=left>can only wait for a given PID, not any child process</TD></TR>
 
49
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>getppid</TT></TD><TD VALIGN=top ALIGN=left>not implemented (meaningless under Windows)</TD></TR>
 
50
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>nice</TT></TD><TD VALIGN=top ALIGN=left>not implemented</TD></TR>
 
51
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>in_channel_of_descr</TT></TD><TD VALIGN=top ALIGN=left>does not work on sockets under Windows
 
52
95, 98, ME; works fine under NT, 2000, XP</TD></TR>
 
53
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>out_channel_of_descr</TT></TD><TD VALIGN=top ALIGN=left>ditto</TD></TR>
 
54
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>truncate</TT>, <TT>ftruncate</TT></TD><TD VALIGN=top ALIGN=left>not implemented</TD></TR>
 
55
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>lstat</TT>, <TT>fstat</TT></TD><TD VALIGN=top ALIGN=left>not implemented</TD></TR>
 
56
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>link</TT>, <TT>symlink</TT>, <TT>readlink</TT></TD><TD VALIGN=top ALIGN=left>not implemented (no links under
 
57
Windows)</TD></TR>
 
58
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>fchmod</TT></TD><TD VALIGN=top ALIGN=left>not implemented</TD></TR>
 
59
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>chown</TT>, <TT>fchown</TT></TD><TD VALIGN=top ALIGN=left>not implemented (make no sense on a DOS
 
60
file system)</TD></TR>
 
61
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>umask</TT></TD><TD VALIGN=top ALIGN=left>not implemented</TD></TR>
 
62
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>set_nonblock</TT>, <TT>clear_nonblock</TT></TD><TD VALIGN=top ALIGN=left>implemented as dummy
 
63
functions; use threads instead of non-blocking I/O</TD></TR>
 
64
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>rewinddir</TT></TD><TD VALIGN=top ALIGN=left>not implemented; re-open the directory instead</TD></TR>
 
65
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>mkfifo</TT></TD><TD VALIGN=top ALIGN=left>not implemented</TD></TR>
 
66
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>select</TT></TD><TD VALIGN=top ALIGN=left>implemented, but works only for sockets; use threads
 
67
if you need to wait on other kinds of file descriptors</TD></TR>
 
68
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>lockf</TT></TD><TD VALIGN=top ALIGN=left>not implemented</TD></TR>
 
69
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>kill</TT>, <TT>pause</TT></TD><TD VALIGN=top ALIGN=left>not implemented (no inter-process signals in Windows)</TD></TR>
 
70
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>alarm</TT>, <TT>times</TT></TD><TD VALIGN=top ALIGN=left>not implemented</TD></TR>
 
71
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>getitimer</TT>, <TT>setitimer</TT></TD><TD VALIGN=top ALIGN=left>not implemented</TD></TR>
 
72
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>getuid</TT>, <TT>getgid</TT></TD><TD VALIGN=top ALIGN=left>always return 1</TD></TR>
 
73
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>getgid</TT>, <TT>getegid</TT>, <TT>getgroups</TT></TD><TD VALIGN=top ALIGN=left>not implemented</TD></TR>
 
74
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>setuid</TT>, <TT>setgid</TT></TD><TD VALIGN=top ALIGN=left>not implemented</TD></TR>
 
75
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>getpwnam</TT>, <TT>getpwuid</TT></TD><TD VALIGN=top ALIGN=left>always raise <TT>Not_found</TT></TD></TR>
 
76
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>getgrnam</TT>, <TT>getgrgid</TT></TD><TD VALIGN=top ALIGN=left>always raise <TT>Not_found</TT></TD></TR>
 
77
<TR><TD VALIGN=top ALIGN=left NOWRAP>type <TT>socket_domain</TT></TD><TD VALIGN=top ALIGN=left>the domain <TT>PF_UNIX</TT> is not supported;
 
78
<TT>PF_INET</TT> is fully supported</TD></TR>
 
79
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>open_connection</TT></TD><TD VALIGN=top ALIGN=left>does not work under Windows
 
80
95, 98, ME; works fine under NT, 2000, XP</TD></TR>
 
81
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>establish_server</TT></TD><TD VALIGN=top ALIGN=left>not implemented; use threads</TD></TR>
 
82
<TR><TD VALIGN=top ALIGN=left NOWRAP>terminal functions (<TT>tc*</TT>)</TD><TD VALIGN=top ALIGN=left>not implemented</TD></TR>
 
83
</TABLE></DIV></BLOCKQUOTE><HR>
 
84
<A HREF="manual034.html"><IMG SRC="previous_motif.gif" ALT="Previous"></A>
 
85
<A HREF="index.html"><IMG SRC="contents_motif.gif" ALT="Up"></A>
 
86
<A HREF="manual036.html"><IMG SRC="next_motif.gif" ALT="Next"></A>
177
87
</BODY>
178
88
</HTML>