466
|
1 <refentry id="os9">
|
|
2 <refnamediv>
|
468
|
3 <refname>_os9</refname>
|
|
4 <refpurpose>system call interface from C programs</refpurpose>
|
466
|
5 </refnamediv>
|
|
6
|
|
7 <refsynopsisdiv>
|
|
8 <funcsynopsis>
|
468
|
9 <funcsynopsisinfo>
|
|
10 #include <os9.h>
|
|
11 </funcsynopsisinfo>
|
466
|
12 <funcprototype>
|
468
|
13 <funcdef><function>_os9</function></funcdef>
|
572
|
14 <paramdef>char <parameter>code</parameter></paramdef>
|
|
15 <paramdef>struct registers *<parameter>reg</parameter></paramdef>
|
466
|
16 </funcprototype>
|
|
17 </funcsynopsis>
|
|
18
|
|
19 </refsynopsisdiv>
|
|
20
|
|
21 <refsect1><title>Description</title>
|
|
22 <para>
|
|
23 Placeholder
|
|
24 </para>
|
|
25 </refsect1>
|
534
|
26
|
|
27 <refsect1><title>Diagnostics</title>
|
|
28 <para>
|
|
29 -1 is returned is the OS-9 call failed. 0 is returned on success.
|
|
30 </para>
|
|
31 </refsect1>
|
|
32
|
|
33 <refsect1><title>Program Example</title>
|
|
34 <programlisting>
|
|
35 #include <os9.h>
|
|
36 #include <modes.h>
|
|
37
|
|
38 /* this program does an I$GETSTT call to get file size */
|
|
39 main(argc,argv)
|
|
40 int argc;
|
|
41 char **argv;
|
|
42 {
|
|
43 struct registers reg;
|
|
44 int path;
|
|
45
|
|
46 /* tell linker we need longs */
|
|
47 pflinit();
|
|
48
|
|
49 /* low level open(file name is first command line param */
|
|
50 path=open(*++argv,S_IREAD);
|
|
51
|
|
52 /* set up regs for call to OS-9 */
|
|
53 reg.rg_a=path;
|
|
54 reg.rg_b=SS_SIZE;
|
|
55
|
|
56 if(_os9(I_GETSTT,&reg) == 0)
|
|
57 printf("filesize = %lx\n", /* success */
|
|
58 (long) (reg.rg_x << 16)+reg.rg_u);
|
|
59 else printf("OS9 error #%d\n",reg.rg_b & 0xff); /*failed*/
|
|
60
|
|
61 dumpregs(&reg); /* take a look at the registers */
|
|
62 }
|
|
63
|
|
64 dumpregs(r)
|
|
65 register struct registers *r;
|
|
66 {
|
|
67 printf("cc=%02x\n",r->rg_cc & 0xff);
|
|
68 printf(" a=%02x\n",r->rg_a & 0xff);
|
|
69 printf(" b=%02x\n",r->rg_b & 0xff);
|
|
70 printf("dp=%02x\n",r->rg_dp & 0xff);
|
|
71 printf(" x=%02x\n",r->rg_x);
|
|
72 printf(" y=%02x\n",r->rg_u);
|
|
73 printf(" u=%02x\n",r->rg_y);
|
|
74 }
|
|
75 </programlisting>
|
|
76 </refsect1>
|
466
|
77 </refentry>
|