-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathlibinterface.html
466 lines (442 loc) · 25 KB
/
libinterface.html
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
<!Doctype html>
<html lang="en">
<head>
<title>High Level Library Interface For eXpOS</title>
<meta charset="UTF-8">
<!--<link rel="stylesheet" href="css/bootstrap.min.css">-->
<link rel="stylesheet" href="css/style_new.css">
<script src="js/jquery-1.12.1.min.js" charset="utf-8"></script>
<script src="js/bootstrap.min.js" charset="utf-8"></script>
<script src="js/sticky_sidebar.js" charset="utf-8"></script>
</head>
<body>
<div class="container">
<header id="navtop">
<a href="index.html" class="logo fleft"><img src="img/logo.png" alt=""></a>
<nav class="fright">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="about.html">About</a></li>
<!-- <li><a href="help.html">Help</a></li> -->
<li><a href="roadmap.html">Roadmap</a></li>
<li><a href="documentation.html" class="navactive">Documentation</a></li>
</ul>
</nav>
</header>
<div class="Services-page main grid-wrap">
<header class="grid col-full">
<hr/>
<!-- <p class="fleft">High Level Library Interface For eXpOS</p> -->
<!-- <br> -->
<br>
<!-- <a class="button" href="#">Download as PDF</a> -->
</header>
<aside class="grid col-one-quarter mq2-col-full sticky_sidebar">
</aside>
<section class="grid col-three-quarters mq2-col-full">
<div class="grid-wrap">
<article class="grid col-full" id="nav-intro">
<h2>High Level Library Interface For eXpOS</h2>
<p>
The High Level Library Interface is a unified interface to access system call routines and dynamic memory management functions from application programs. The ExpL language allows applications to access the OS routines only through the library interface. The syntax for the call to the library function in ExpL is :
</p>
<pre >
t = exposcall(fun_code, arg1, arg2, arg3);
</pre>
<p>
Depending on the fun_code the control is transferred to the system call routines (see below) .
</p>
<p>
<table class="doctable">
<tr>
<th>Library Function / System Call</th>
<th>Function Code</th>
<th>Argument 1</th>
<th>Argument 2</th>
<th>Argument 3</th>
<th>Return Values</th>
</tr>
<tr >
<td rowspan="3">Create</td>
<td rowspan="3"> "Create"</td>
<td rowspan="3">File Name (str)</td>
<td rowspan="3">Permission (int)</td>
<td rowspan="3">-</td>
<td>0 - Success</tr>
<td>-1 - No Space for file</tr>
<td>-2 - If the file already Exists</tr>
</tr>
<tr>
<td rowspan="4">Open</td>
<td rowspan="4">"Open"</td>
<td rowspan="4">File Name (str)</td>
<td rowspan="4">-</td>
<td rowspan="4">-</td>
<td>File Descriptor (int) - Success</tr>
<td>-1 - fFile not found or file is not a data or root file</tr>
<td>-2 - Process has reached its limit of resources</tr>
<td>-3 - System has reached its limit of open files</tr>
</tr>
<tr>
<td rowspan="3">Close</td>
<td rowspan="3">"Close"</td>
<td rowspan="3">File Descriptor (int)</td>
<td rowspan="3">-</td>
<td rowspan="3">-</td>
<td>0 - Success</tr>
<td>-1 - invalid File descriptor</tr>
<td>-2 - File locked by calling process</tr>
</tr>
<tr>
<td rowspan="4">Delete</td>
<td rowspan="4">"Delete"</td>
<td rowspan="4">File Name (str)</td>
<td rowspan="4">-</td>
<td rowspan="4">-</td>
<td>0 - Success</tr>
<td>-1 - File not found or file is not a data file</tr>
<td>-2 - File is open</tr>
<td>-3 - Permission denied</tr>
</tr>
<tr>
<td rowspan="2">Write</td>
<td rowspan="2"> "Write"</td>
<td rowspan="2">-2</td>
<td rowspan="2">Buffer (int/str)<font color="red">*</font></td>
<td rowspan="2">-</td>
<td>0 - Success</tr>
<td>-1 - File Descriptor given is invalid</tr>
</tr>
<tr>
<td rowspan="3">Seek</td>
<td rowspan="3">"Seek"</td>
<td rowspan="3">File Descriptor (int)</td>
<td rowspan="3">Offset (int)</td>
<td rowspan="3">-</td>
<td>0 - Success</tr>
<td>-1 - File Descriptor given is invalid</tr>
<td>-2 - Offset value moves the file pointer to a position outside the file</tr>
</tr>
<tr>
<td rowspan="3">Read</td>
<td rowspan="3">"Read"</td>
<td rowspan="3">File Descriptor (int)</td>
<td rowspan="3">Buffer (int/str)<font color="red">*</font></td>
<td rowspan="3">-</td>
<td>0 - Success</tr>
<td>-1 - File Descriptor given is invalid</tr>
<td>-2 - File pointer has reached the end of file</tr>
</tr>
<!--- -->
<tr>
<td rowspan="3">Fork</td>
<td rowspan="3">"Fork"</td>
<td rowspan="3">-</td>
<td rowspan="3">-</td>
<td rowspan="3">-</td>
<td>PID (int) - Success, the return value to the parent is the process descriptor(PID) of the child process.</tr>
<td>0 - Success, the return value to the child.</tr>
<td>-1 - Failure, Number of processes has reached the maximum limit. Returns to the parent</tr>
</tr>
<tr>
<td rowspan="2">Exec</td>
<td rowspan="2">"Exec"</td>
<td rowspan="2">File Name (str)</td>
<td rowspan="2">-</td>
<td rowspan="2">-</td>
<td>-1 - File not found or file is of invalid type</tr>
<td>-2 - Out of memory or disk swap space</tr>
</tr>
<tr>
<td>Exit</td>
<td>"Exit"</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td>Getpid</td>
<td>"Getpid"</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>Process Identifier (int) - Success</td>
</tr>
<tr>
<td>Getppid</td>
<td>"Getppid"</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>Parent Process Identifier (int) - Success</td>
</tr>
<tr>
<td rowspan="2">Wait</td>
<td rowspan="2">"Wait"</td>
<td rowspan="2">Process Identifier (int)</td>
<td rowspan="2">-</td>
<td rowspan="2">-</td>
<td>0 - Success</tr>
<td>-1 - Given process identifier is invalid or it is the pid of the invoking process.</tr>
</tr>
<tr>
<td>Signal</td>
<td>"Signal"</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>0 - Success</td>
</tr>
<tr>
<td rowspan="3">FLock</td>
<td rowspan="3">"FLock"</td>
<td rowspan="3">File Descriptor (int)</td>
<td rowspan="3">-</td>
<td rowspan="3">-</td>
<td>0 - Success</tr>
<td>-1 - File Descriptor is invalid</tr>
<td>-2 - Permission denied</tr>
</tr>
<tr>
<td rowspan="3">FUnLock</td>
<td rowspan="3">"FUnLock"</td>
<td rowspan="3">File Descriptor (int)</td>
<td rowspan="3">-</td>
<td rowspan="3">-</td>
<td>0 - Success</tr>
<td>-1 - File Descriptor is invalid</tr>
<td>-2 - File was not locked by the calling process</tr>
</tr>
<tr>
<td rowspan="3">Semget</td>
<td rowspan="3">"Semget"</td>
<td rowspan="3">-</td>
<td rowspan="3">-</td>
<td rowspan="3">-</td>
<td>SEMID (int) - Success, returns a semaphore descriptor(SEMID)</tr>
<td>-1 - Process has reached its limit of resources</tr>
<td>-2 - Number of semaphores has reached its maximum</tr>
</tr>
<tr>
<td rowspan="2">Semrelease</td>
<td rowspan="2">"Semrelease"</td>
<td rowspan="2">Semaphore Descriptor (int)</td>
<td rowspan="2">-</td>
<td rowspan="2">-</td>
<td>0 - Success</tr>
<td>-1 - Semaphore Descriptor is invalid</tr>
</tr>
<tr>
<td rowspan="2">SemLock</td>
<td rowspan="2">"SemLock" </td>
<td rowspan="2">Semaphore Descriptor (int)</td>
<td rowspan="2">-</td>
<td rowspan="2">-</td>
<td>0 - Success or the semaphore is already locked by the current process</tr>
<td>-1 - Semaphore Descriptor is invalid</tr>
</tr>
<tr>
<td rowspan="3">SemUnLock</td>
<td rowspan="3">"SemUnLock"</td>
<td rowspan="3">Semaphore Descriptor (int)</td>
<td rowspan="3">-</td>
<td rowspan="3">-</td>
<td>0 - Success</tr>
<td>-1 - Semaphore Descriptor is invalid</tr>
<td>-2 - Semaphore was not locked by the calling process</tr>
</tr>
<tr>
<td>Shutdown</td>
<td>"Shutdown"</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td style="color:red" rowspan="3">Newusr</td>
<td rowspan="3">"Newusr"</td>
<td rowspan="3">User name</td>
<td rowspan="3">Password</td>
<td rowspan="3">-</td>
<td>0 - Success</tr>
<td>-1 - User already exists</tr>
<td>-2 - Permission denied</tr>
</tr>
<tr>
<td style="color:red" rowspan="3">Remusr</td>
<td rowspan="3">"Remusr"</td>
<td rowspan="3">User name </td>
<td rowspan="3">-</td>
<td rowspan="3">-</td>
<td>0 - Success</tr>
<td>-1 - User does not exist</tr>
<td>-2 - Permission denied</tr>
</tr>
<tr>
<td style="color:red">Setpwd</td>
<td>"Setpwd"</td>
<td>User name</td>
<td>New Password</td>
<td>-</td>
<td>-1 - Unauthorised attempt to change password</td>
</tr>
<tr>
<td style="color:red" rowspan="2">Getuname</td>
<td rowspan="2">"Getuname"</td>
<td rowspan="2">User ID (int)</td>
<td rowspan="2">-</td>
<td rowspan="2">-</td>
<td>-1 - Invalid UserID</tr>
<td>User Name - Success</tr>
</tr>
<tr>
<td style="color:red" rowspan="2">Getuid</td>
<td rowspan="2">"Getuid"</td>
<td rowspan="2">User name</td>
<td rowspan="2">-</td>
<td rowspan="2">-</td>
<td>-1 - Invalid Username</tr>
<td>uid - Success</tr>
</tr>
<tr>
<td style="color:red" rowspan="2">Login</td>
<td rowspan="2">"Login"</td>
<td rowspan="2">User name (str)</td>
<td rowspan="2">Password (str)</td>
<td rowspan="2">-</td>
<td>-1 - Invalid username or password</tr>
<td>-2 - Permission denied</tr>
</tr>
<tr>
<td>Test</td>
<td>"Test"</td>
<td>Unspecified</td>
<td>Unspecified</td>
<td>Unspecified</td>
<td>-</td>
</tr>
<tr class = "active">
<td rowspan="2">Initialize</td>
<td rowspan="2">"Initialize"</td>
<td rowspan="2">-</td>
<td rowspan="2">-</td>
<td rowspan="2">-</td>
<td>0 - Success</tr>
<td>-1 - Failure</tr>
</tr>
<tr class = "active">
<td rowspan="2">Alloc</td>
<td rowspan="2">"Alloc"</td>
<td rowspan="2">Size (int)</td>
<td rowspan="2">-</td>
<td rowspan="2">-</td>
<td>Address in the heap allocated (int) </tr>
<td>-1 - No allocation</tr>
</tr>
<tr class = "active">
<td rowspan="2">Free</td>
<td rowspan="2">"Free"</td>
<td rowspan="2">Pointer (int)</td>
<td rowspan="2">-</td>
<td rowspan="2">-</td>
<td>0 - Success</tr>
<td>-1 - Failure</tr>
</tr>
</table>
<sup>
* Note: The Read() and Write() library functions expect a pointer to a memory address from (or to) which read or write is performed.
</sup>
</p>
<p>
The description of the system calls can be seen here. The dynamic memory management routines are described below.
</p>
</article>
<article class="grid col-full" id="nav-data-types">
<h2>Dynamic Memory Routines</h2>
<h4>Initialize</h4>
<p>
<p>Arguments: None </p>
<p>Return Value:</p>
<table class="doctable">
<tr>
<td>0</td>
<td>Success</td>
</tr>
<tr>
<td>-1</td>
<td>Failure</td>
</tr>
</table>
<br>
<p>
Description: Intitalizes the heap data structures and sets up the heap area of the process.It is the applications responsibility to invoke Initialize() before the first use of Alloc(). The behaviour of Alloc() and Free() when invoked without an Intialize() operation is undefined. Any memory allocated before an Intialize() operation will be reclaimed for future allocation.
</p>
</p>
<h4>Alloc</h4>
<p>
<p>Arguments: Size (int) </p>
<p>Return Value:</p>
<table class="doctable">
<tr>
<td>integer</td>
<td>Address in the heap allocated</td>
</tr>
<tr>
<td>-1</td>
<td>No allocation</td>
</tr>
</table>
<br>
<p>
Description: The Alloc operation takes as input an integer, allocates contiguous words equal to the input specified and returns a pointer (i.e., an integer memory address) to the beginning of the allocated memory in the heap.
</p>
</p>
<h4>Free</h4>
<p>
<p>Arguments: Pointer (int)</p>
<p>Return Value:</p>
<table class="doctable">
<tr>
<td>0</td>
<td>Success</td>
</tr>
<tr>
<td>-1</td>
<td>Failure</td>
</tr>
</table>
<br>
<p>
Description: The Free operation takes a pointer (i.e., an integer memory address) of a previously allocated memory block and returns it to the heap memory pool. If the pointer does not correspond to a valid reference to the beginning of a previously allocated memory block, the behaviour of Free is not defined.
</p>
</p>
</article>
</div>
</section>
</div>
</div>
<footer class="center part clearfix">
<ul class="grid col-one-third social">
<li><a href="http://github.com/silcnitc">Github</a></li>
<li> <a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/">
<img alt="Creative Commons License" style="border-width:0" src="img/creativecommons.png" /></a></li>
</ul>
<div class="grid col-one-third" style="color:black;">
<p style="font-weight: bold;">Contributed By : <a href="https://www.linkedin.com/in/dattathallam">Thallam Sai Sree Datta</a>, <a href="https://www.linkedin.com/in/n-ruthviik-0a0539100">N Ruthvik</a>
</p>
</div>
<nav class="grid col-one-third ">
<ul >
<li><a href="index.html">Home</a></li>
<li><a href="about.html">About</a></li>
<!-- <li><a href="uc.html">Contact</a></li> -->
</ul>
</nav>
<br>
</footer>
<script>window.jQuery || document.write('<script src="js/jquery-1.7.2.min.js"><\/script>')</script>
<script src="js/scripts.js"></script>
<script src="js/inject.js"></script>
</html>