… | |
… | |
7 | use IO::FDPass; |
7 | use IO::FDPass; |
8 | |
8 | |
9 | =head1 DESCRIPTION |
9 | =head1 DESCRIPTION |
10 | |
10 | |
11 | This small low-level module only has one purpose: pass a file descriptor |
11 | This small low-level module only has one purpose: pass a file descriptor |
12 | to another process, using a unix domain socket (on POSIX systems) or any |
12 | to another process, using a (streaming) unix domain socket (on POSIX |
13 | socket (on WIN32 systems). |
13 | systems) or any (streaming) socket (on WIN32 systems). |
14 | |
14 | |
15 | =head1 FUNCTIONS |
15 | =head1 FUNCTIONS |
16 | |
16 | |
17 | =over 4 |
17 | =over 4 |
18 | |
18 | |
19 | =cut |
19 | =cut |
20 | |
20 | |
21 | package IO::FDPass; |
21 | package IO::FDPass; |
22 | |
22 | |
23 | BEGIN { |
23 | BEGIN { |
24 | $VERSION = '0.0'; |
24 | $VERSION = '0.1'; |
25 | |
25 | |
26 | require XSLoader; |
26 | require XSLoader; |
27 | XSLoader::load (__PACKAGE__, $VERSION); |
27 | XSLoader::load (__PACKAGE__, $VERSION); |
28 | } |
28 | } |
29 | |
29 | |
… | |
… | |
67 | |
67 | |
68 | =back |
68 | =back |
69 | |
69 | |
70 | =head1 PORTABILITY NOTES |
70 | =head1 PORTABILITY NOTES |
71 | |
71 | |
72 | This module has been tested on NetBSD 6, OS X 10.5, Windows 2000 |
72 | This module has been tested on GNU/Linux x86 and amd64, NetBSD 6, OS X |
73 | ActivePerl 5.10, Solaris 10, OpenBSD 4.4, 4.5, 4.8 and 5.0, DragonFly |
73 | 10.5, Windows 2000 ActivePerl 5.10, Solaris 10, OpenBSD 4.4, 4.5, 4.8 and |
74 | BSD, FreeBSD 7, 8 and 9, Windows 7 + ActivePerl 5.16.3 32 and 64 bit |
74 | 5.0, DragonFly BSD, FreeBSD 7, 8 and 9, Windows 7 + ActivePerl 5.16.3 32 |
75 | and Strawberry Perl 5.16.3 32 and 64 bit, and found to work, although |
75 | and 64 bit and Strawberry Perl 5.16.3 32 and 64 bit, and found to work, |
76 | ActivePerl 32 bit needed a newer MinGW version (that supports XP and |
76 | although ActivePerl 32 bit needed a newer MinGW version (that supports XP |
77 | higher). |
77 | and higher). |
78 | |
78 | |
79 | However, windows doesn't support asynchronous file descriptor passing, so |
79 | However, windows doesn't support asynchronous file descriptor passing, so |
80 | C<send> and C<recv> will have to "rendezvous", that is, they have to wait |
80 | C<send> and C<recv> will have to "rendezvous", that is, they have to wait |
81 | for each other. Therefore, on windows, it's advisable to run them at the |
81 | for each other. Therefore, on windows, it's advisable to run them at the |
82 | same time to avoid any unnecessary delays. |
82 | same time to avoid any unnecessary delays. |
83 | |
83 | |
84 | Also, on windows, the passing process must give the receiving process the |
84 | Also, on windows, the passing process must give the receiving process the |
85 | PROCESS_DUP_HANDLE access right for this module to work. |
85 | PROCESS_DUP_HANDLE access right for this module to work. |
|
|
86 | |
|
|
87 | Cygwin is not supported at the moment, as file descriptor passing in |
|
|
88 | cygwin is not supported, and cannot be rolled on your own as cygwin has no |
|
|
89 | (working) method of opening a handle as fd. That is, it has one, but that |
|
|
90 | one isn't exposed to programs, and only used for stdin/out/err. Sigh. |
86 | |
91 | |
87 | =head1 OTHER MODULES |
92 | =head1 OTHER MODULES |
88 | |
93 | |
89 | At the time of this writing, the author of this module was aware of two |
94 | At the time of this writing, the author of this module was aware of two |
90 | other file descriptor passing modules on CPAN: L<Linux::FDPasser> and |
95 | other file descriptor passing modules on CPAN: L<Linux::FDPasser> and |