… | |
… | |
14 | |
14 | |
15 | typedef void *InputStream; /* hack, but 5.6.1 is simply toooo old ;) */ |
15 | typedef void *InputStream; /* hack, but 5.6.1 is simply toooo old ;) */ |
16 | typedef void *OutputStream; /* hack, but 5.6.1 is simply toooo old ;) */ |
16 | typedef void *OutputStream; /* hack, but 5.6.1 is simply toooo old ;) */ |
17 | typedef void *InOutStream; /* hack, but 5.6.1 is simply toooo old ;) */ |
17 | typedef void *InOutStream; /* hack, but 5.6.1 is simply toooo old ;) */ |
18 | |
18 | |
19 | // 128 seems to be enough most everywhere. alpha needs 256. |
19 | #if __i386 || __amd64 |
20 | #define STACKSIZE (256 * sizeof (long)) |
20 | # define STACKSIZE ( 256 * sizeof (long)) |
|
|
21 | #elif __ia64 |
|
|
22 | # define STACKSIZE (8192 * sizeof (long)) |
|
|
23 | #else |
|
|
24 | # define STACKSIZE ( 512 * sizeof (long)) |
|
|
25 | #endif |
21 | |
26 | |
22 | enum { |
27 | enum { |
23 | REQ_QUIT, |
28 | REQ_QUIT, |
24 | REQ_OPEN, REQ_CLOSE, REQ_READ, REQ_WRITE, |
29 | REQ_OPEN, REQ_CLOSE, REQ_READ, REQ_WRITE, |
25 | REQ_STAT, REQ_LSTAT, REQ_FSTAT, REQ_UNLINK |
30 | REQ_STAT, REQ_LSTAT, REQ_FSTAT, REQ_UNLINK |
… | |
… | |
64 | aio_thread *thr; |
69 | aio_thread *thr; |
65 | |
70 | |
66 | New (0, thr, 1, aio_thread); |
71 | New (0, thr, 1, aio_thread); |
67 | |
72 | |
68 | if (clone (aio_proc, |
73 | if (clone (aio_proc, |
69 | &(thr->stack[STACKSIZE - sizeof (long)]), |
74 | &(thr->stack[STACKSIZE - 16]), |
70 | CLONE_VM|CLONE_FS|CLONE_FILES, |
75 | CLONE_VM|CLONE_FS|CLONE_FILES, |
71 | thr) >= 0) |
76 | thr) >= 0) |
72 | started++; |
77 | started++; |
73 | else |
78 | else |
74 | Safefree (thr); |
79 | Safefree (thr); |