File: manual035.html

package info (click to toggle)
ocaml-doc 3.09-1
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 10,428 kB
  • ctags: 4,963
  • sloc: ml: 9,244; makefile: 2,413; ansic: 122; sh: 49; asm: 17
file content (178 lines) | stat: -rw-r--r-- 7,361 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="manual.css">
<TITLE>
The unix library: Unix system calls
</TITLE>
</HEAD>
<BODY >
<A HREF="manual034.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="manual036.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H1 CLASS="chapter"><A NAME="htoc253">Chapter&nbsp;21</A>&nbsp;&nbsp;The unix library: Unix system calls</H1>

The <TT>unix</TT> library makes many Unix
system calls and system-related library functions available to
Objective Caml programs. This chapter describes briefly the functions
provided. Refer to sections 2&nbsp;and&nbsp;3 of the Unix manual for more
details on the behavior of these functions.<BR>
<BR>
Not all functions are provided by all Unix variants. If some functions
are not available, they will raise <TT>Invalid_arg</TT> when called.<BR>
<BR>
Programs that use the <TT>unix</TT> library must be linked as follows:
<PRE>
        ocamlc <I>other options</I> unix.cma <I>other files</I>
        ocamlopt <I>other options</I> unix.cmxa <I>other files</I>
</PRE>
For interactive use of the <TT>unix</TT> library, do:
<PRE>
        ocamlmktop -o mytop unix.cma
        ./mytop
</PRE>
or (if dynamic linking of C libraries is supported on your platform),
start <TT>ocaml</TT> and type <TT>#load "unix.cma";;</TT>.<BR>
<BR>

&nbsp;&nbsp;<FONT COLOR=purple>Windows:</FONT>
<BLOCKQUOTE CLASS="quote">
A fairly complete emulation of the Unix system calls is provided in
the Windows version of Objective Caml. The end of this chapter gives
more information on the functions that are not supported under Windows.
</BLOCKQUOTE>

<ul>
<li><a HREF="libref/Unix.html"> Module <tt>Unix</tt>: Unix system calls</a> <img alt="updated" src="updated_tiny.gif"></li>
<li><a HREF="libref/UnixLabels.html"> Module <tt>UnixLabels</tt>: Labeled Unix system calls</a></li>
</ul>
<BR>
<BR>

&nbsp;&nbsp;<FONT COLOR=purple>Windows:</FONT>
<BLOCKQUOTE CLASS="quote">
The Cygwin port of Objective Caml fully implements all functions from
the Unix module. The native Win32 ports implement a subset of them.
Below is a list of the functions that are not implemented, or only
partially implemented, by the Win32 ports. Functions not mentioned are
fully implemented and behave as described previously in this chapter.<BR>
<BR>
<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>
<TR><TD VALIGN=top ALIGN=left NOWRAP>
<TT>fork</TT></TD>
<TD VALIGN=top ALIGN=left>not implemented, use <TT>create_process</TT> or threads</TD>
</TR>
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>wait</TT></TD>
<TD VALIGN=top ALIGN=left>not implemented, use <TT>waitpid</TT></TD>
</TR>
<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>
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>getppid</TT></TD>
<TD VALIGN=top ALIGN=left>not implemented (meaningless under Windows)</TD>
</TR>
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>nice</TT></TD>
<TD VALIGN=top ALIGN=left>not implemented</TD>
</TR>
<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
95, 98, ME; works fine under NT, 2000, XP</TD>
</TR>
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>out_channel_of_descr</TT></TD>
<TD VALIGN=top ALIGN=left>ditto</TD>
</TR>
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>truncate</TT>, <TT>ftruncate</TT></TD>
<TD VALIGN=top ALIGN=left>not implemented</TD>
</TR>
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>lstat</TT>, <TT>fstat</TT></TD>
<TD VALIGN=top ALIGN=left>not implemented</TD>
</TR>
<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
Windows)</TD>
</TR>
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>fchmod</TT></TD>
<TD VALIGN=top ALIGN=left>not implemented</TD>
</TR>
<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
file system)</TD>
</TR>
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>umask</TT></TD>
<TD VALIGN=top ALIGN=left>not implemented</TD>
</TR>
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>set_nonblock</TT>, <TT>clear_nonblock</TT></TD>
<TD VALIGN=top ALIGN=left>implemented as dummy
functions; use threads instead of non-blocking I/O</TD>
</TR>
<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>
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>mkfifo</TT></TD>
<TD VALIGN=top ALIGN=left>not implemented</TD>
</TR>
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>select</TT></TD>
<TD VALIGN=top ALIGN=left>implemented, but works only for sockets; use threads
 if you need to wait on other kinds of file descriptors</TD>
</TR>
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>lockf</TT></TD>
<TD VALIGN=top ALIGN=left>not implemented</TD>
</TR>
<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>
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>alarm</TT>, <TT>times</TT></TD>
<TD VALIGN=top ALIGN=left>not implemented</TD>
</TR>
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>getitimer</TT>, <TT>setitimer</TT></TD>
<TD VALIGN=top ALIGN=left>not implemented</TD>
</TR>
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>getuid</TT>, <TT>getgid</TT></TD>
<TD VALIGN=top ALIGN=left>always return 1</TD>
</TR>
<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>
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>setuid</TT>, <TT>setgid</TT></TD>
<TD VALIGN=top ALIGN=left>not implemented</TD>
</TR>
<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>
<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>
<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;
<TT>PF_INET</TT> is fully supported</TD>
</TR>
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>open_connection</TT></TD>
<TD VALIGN=top ALIGN=left>does not work under Windows
95, 98, ME; works fine under NT, 2000, XP</TD>
</TR>
<TR><TD VALIGN=top ALIGN=left NOWRAP><TT>establish_server</TT></TD>
<TD VALIGN=top ALIGN=left>not implemented; use threads</TD>
</TR>
<TR><TD VALIGN=top ALIGN=left NOWRAP>terminal functions (<TT>tc*</TT>)</TD>
<TD VALIGN=top ALIGN=left>not implemented</TD>
</TR></TABLE></DIV></BLOCKQUOTE>



<HR>
<A HREF="manual034.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="manual036.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>