passenger 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

@@ -602,164 +602,172 @@
602
602
  <a name="l00577"></a>00577 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ret;
603
603
  <a name="l00578"></a>00578 <span class="keywordflow">try</span> {
604
604
  <a name="l00579"></a>00579 ret = Passenger::readExact(fd, buf, size, &amp;t);
605
- <a name="l00580"></a>00580 *timeout = llroundl((<span class="keywordtype">long</span> <span class="keywordtype">double</span>) t / 1000);
606
- <a name="l00581"></a>00581 <span class="keywordflow">return</span> ret == size;
607
- <a name="l00582"></a>00582 } <span class="keywordflow">catch</span> (...) {
608
- <a name="l00583"></a>00583 *timeout = llroundl((<span class="keywordtype">long</span> <span class="keywordtype">double</span>) t / 1000);
609
- <a name="l00584"></a>00584 <span class="keywordflow">throw</span>;
610
- <a name="l00585"></a>00585 }
611
- <a name="l00586"></a>00586 } <span class="keywordflow">else</span> {
612
- <a name="l00587"></a>00587 <span class="keywordflow">return</span> Passenger::readExact(fd, buf, size) == size;
613
- <a name="l00588"></a>00588 }
614
- <a name="l00589"></a>00589 }
615
- <a name="l00590"></a>00590 <span class="comment"></span>
616
- <a name="l00591"></a>00591 <span class="comment"> /**</span>
617
- <a name="l00592"></a>00592 <span class="comment"> * Receive a file descriptor, which had been passed over the underlying</span>
618
- <a name="l00593"></a>00593 <span class="comment"> * file descriptor.</span>
619
- <a name="l00594"></a>00594 <span class="comment"> *</span>
620
- <a name="l00595"></a>00595 <span class="comment"> * @param negotiate See Ruby&#39;s MessageChannel#send_io method&#39;s comments.</span>
621
- <a name="l00596"></a>00596 <span class="comment"> * @return The passed file descriptor.</span>
622
- <a name="l00597"></a>00597 <span class="comment"> * @throws SystemException If something went wrong during the</span>
623
- <a name="l00598"></a>00598 <span class="comment"> * receiving of a file descriptor. Perhaps the underlying</span>
624
- <a name="l00599"></a>00599 <span class="comment"> * file descriptor isn&#39;t a Unix socket.</span>
625
- <a name="l00600"></a>00600 <span class="comment"> * @throws IOException Whatever was received doesn&#39;t seem to be a</span>
626
- <a name="l00601"></a>00601 <span class="comment"> * file descriptor.</span>
627
- <a name="l00602"></a>00602 <span class="comment"> * @throws boost::thread_interrupted</span>
628
- <a name="l00603"></a>00603 <span class="comment"> */</span>
629
- <a name="l00604"></a><a class="code" href="classPassenger_1_1MessageChannel.html#a1a28ba9d078f38f2831673092ac9dcbc">00604</a> <span class="keywordtype">int</span> <a class="code" href="classPassenger_1_1MessageChannel.html#a1a28ba9d078f38f2831673092ac9dcbc" title="Receive a file descriptor, which had been passed over the underlying file descriptor...">readFileDescriptor</a>(<span class="keywordtype">bool</span> negotiate = <span class="keyword">true</span>) {
630
- <a name="l00605"></a>00605 <span class="comment">// See message_channel.rb for more info about negotiation.</span>
631
- <a name="l00606"></a>00606 <span class="keywordflow">if</span> (negotiate) {
632
- <a name="l00607"></a>00607 <a class="code" href="classPassenger_1_1MessageChannel.html#a150f68bc47e060dcc6ca35bee047914d" title="Send an array message, which consists of the given elements, over the underlying...">write</a>(<span class="stringliteral">&quot;pass IO&quot;</span>, NULL);
633
- <a name="l00608"></a>00608 }
634
- <a name="l00609"></a>00609
635
- <a name="l00610"></a>00610 <span class="keyword">struct </span>msghdr msg;
636
- <a name="l00611"></a>00611 <span class="keyword">struct </span>iovec vec;
637
- <a name="l00612"></a>00612 <span class="keywordtype">char</span> dummy[1];
638
- <a name="l00613"></a>00613 <span class="preprocessor"> #if defined(__APPLE__) || defined(__SOLARIS__) || defined(__arm__)</span>
639
- <a name="l00614"></a>00614 <span class="preprocessor"></span> <span class="comment">// File descriptor passing macros (CMSG_*) seem to be broken</span>
640
- <a name="l00615"></a>00615 <span class="comment">// on 64-bit MacOS X. This structure works around the problem.</span>
641
- <a name="l00616"></a>00616 <span class="keyword">struct </span>{
642
- <a name="l00617"></a>00617 <span class="keyword">struct </span>cmsghdr header;
643
- <a name="l00618"></a>00618 <span class="keywordtype">int</span> fd;
644
- <a name="l00619"></a>00619 } control_data;
645
- <a name="l00620"></a>00620 <span class="preprocessor"> #define EXPECTED_CMSG_LEN sizeof(control_data)</span>
646
- <a name="l00621"></a>00621 <span class="preprocessor"></span><span class="preprocessor"> #else</span>
647
- <a name="l00622"></a>00622 <span class="preprocessor"></span> <span class="keywordtype">char</span> control_data[CMSG_SPACE(<span class="keyword">sizeof</span>(<span class="keywordtype">int</span>))];
648
- <a name="l00623"></a>00623 <span class="preprocessor"> #define EXPECTED_CMSG_LEN CMSG_LEN(sizeof(int))</span>
649
- <a name="l00624"></a>00624 <span class="preprocessor"></span><span class="preprocessor"> #endif</span>
650
- <a name="l00625"></a>00625 <span class="preprocessor"></span> <span class="keyword">struct </span>cmsghdr *control_header;
651
- <a name="l00626"></a>00626 <span class="keywordtype">int</span> ret;
652
- <a name="l00627"></a>00627
653
- <a name="l00628"></a>00628 msg.msg_name = NULL;
654
- <a name="l00629"></a>00629 msg.msg_namelen = 0;
655
- <a name="l00630"></a>00630
656
- <a name="l00631"></a>00631 dummy[0] = <span class="charliteral">&#39;\0&#39;</span>;
657
- <a name="l00632"></a>00632 vec.iov_base = dummy;
658
- <a name="l00633"></a>00633 vec.iov_len = <span class="keyword">sizeof</span>(dummy);
659
- <a name="l00634"></a>00634 msg.msg_iov = &amp;vec;
660
- <a name="l00635"></a>00635 msg.msg_iovlen = 1;
661
- <a name="l00636"></a>00636
662
- <a name="l00637"></a>00637 msg.msg_control = (caddr_t) &amp;control_data;
663
- <a name="l00638"></a>00638 msg.msg_controllen = <span class="keyword">sizeof</span>(control_data);
664
- <a name="l00639"></a>00639 msg.msg_flags = 0;
665
- <a name="l00640"></a>00640
666
- <a name="l00641"></a>00641 ret = syscalls::recvmsg(fd, &amp;msg, 0);
667
- <a name="l00642"></a>00642 <span class="keywordflow">if</span> (ret == -1) {
668
- <a name="l00643"></a>00643 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a>(<span class="stringliteral">&quot;Cannot read file descriptor with recvmsg()&quot;</span>, errno);
669
- <a name="l00644"></a>00644 }
670
- <a name="l00645"></a>00645
671
- <a name="l00646"></a>00646 control_header = CMSG_FIRSTHDR(&amp;msg);
672
- <a name="l00647"></a>00647 <span class="keywordflow">if</span> (control_header == NULL) {
673
- <a name="l00648"></a>00648 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1IOException.html" title="Represents an error that occured during an I/O operation.">IOException</a>(<span class="stringliteral">&quot;No valid file descriptor received.&quot;</span>);
674
- <a name="l00649"></a>00649 }
675
- <a name="l00650"></a>00650 <span class="keywordflow">if</span> (control_header-&gt;cmsg_len != EXPECTED_CMSG_LEN
676
- <a name="l00651"></a>00651 || control_header-&gt;cmsg_level != SOL_SOCKET
677
- <a name="l00652"></a>00652 || control_header-&gt;cmsg_type != SCM_RIGHTS) {
678
- <a name="l00653"></a>00653 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1IOException.html" title="Represents an error that occured during an I/O operation.">IOException</a>(<span class="stringliteral">&quot;No valid file descriptor received.&quot;</span>);
679
- <a name="l00654"></a>00654 }
680
- <a name="l00655"></a>00655
681
- <a name="l00656"></a>00656 <span class="preprocessor"> #if defined(__APPLE__) || defined(__SOLARIS__) || defined(__arm__)</span>
682
- <a name="l00657"></a>00657 <span class="preprocessor"></span> <span class="keywordtype">int</span> fd = control_data.fd;
683
- <a name="l00658"></a>00658 <span class="preprocessor"> #else</span>
684
- <a name="l00659"></a>00659 <span class="preprocessor"></span> <span class="keywordtype">int</span> fd = *((<span class="keywordtype">int</span> *) CMSG_DATA(control_header));
685
- <a name="l00660"></a>00660 <span class="preprocessor"> #endif</span>
686
- <a name="l00661"></a>00661 <span class="preprocessor"></span>
687
- <a name="l00662"></a>00662 <span class="keywordflow">if</span> (negotiate) {
688
- <a name="l00663"></a>00663 <span class="keywordflow">try</span> {
689
- <a name="l00664"></a>00664 <a class="code" href="classPassenger_1_1MessageChannel.html#a150f68bc47e060dcc6ca35bee047914d" title="Send an array message, which consists of the given elements, over the underlying...">write</a>(<span class="stringliteral">&quot;got IO&quot;</span>, NULL);
690
- <a name="l00665"></a>00665 } <span class="keywordflow">catch</span> (...) {
691
- <a name="l00666"></a>00666 this_thread::disable_syscall_interruption dsi;
692
- <a name="l00667"></a>00667 <a class="code" href="classPassenger_1_1MessageChannel.html#a06309e208fc5e10642a2e9bbe0f351eb" title="Close the underlying file descriptor.">syscalls::close</a>(fd);
693
- <a name="l00668"></a>00668 <span class="keywordflow">throw</span>;
694
- <a name="l00669"></a>00669 }
695
- <a name="l00670"></a>00670 }
696
- <a name="l00671"></a>00671
697
- <a name="l00672"></a>00672 <span class="keywordflow">return</span> fd;
698
- <a name="l00673"></a>00673 }
699
- <a name="l00674"></a>00674 <span class="comment"></span>
700
- <a name="l00675"></a>00675 <span class="comment"> /**</span>
701
- <a name="l00676"></a>00676 <span class="comment"> * Set the timeout value for reading data from this channel.</span>
702
- <a name="l00677"></a>00677 <span class="comment"> * If no data can be read within the timeout period, then a</span>
703
- <a name="l00678"></a>00678 <span class="comment"> * SystemException will be thrown by one of the read methods,</span>
704
- <a name="l00679"></a>00679 <span class="comment"> * with error code EAGAIN or EWOULDBLOCK.</span>
705
- <a name="l00680"></a>00680 <span class="comment"> *</span>
706
- <a name="l00681"></a>00681 <span class="comment"> * @param msec The timeout, in milliseconds. If 0 is given,</span>
707
- <a name="l00682"></a>00682 <span class="comment"> * there will be no timeout.</span>
708
- <a name="l00683"></a>00683 <span class="comment"> * @throws SystemException Cannot set the timeout.</span>
709
- <a name="l00684"></a>00684 <span class="comment"> */</span>
710
- <a name="l00685"></a><a class="code" href="classPassenger_1_1MessageChannel.html#aeb69bffbbb148c9bc8662e20b416c4e2">00685</a> <span class="keywordtype">void</span> <a class="code" href="classPassenger_1_1MessageChannel.html#aeb69bffbbb148c9bc8662e20b416c4e2" title="Set the timeout value for reading data from this channel.">setReadTimeout</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> msec) {
711
- <a name="l00686"></a>00686 <span class="comment">// See the comment for setWriteTimeout().</span>
712
- <a name="l00687"></a>00687 <span class="keyword">struct </span>timeval tv;
713
- <a name="l00688"></a>00688 <span class="keywordtype">int</span> ret;
714
- <a name="l00689"></a>00689
715
- <a name="l00690"></a>00690 tv.tv_sec = msec / 1000;
716
- <a name="l00691"></a>00691 tv.tv_usec = msec % 1000 * 1000;
717
- <a name="l00692"></a>00692 ret = syscalls::setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO,
718
- <a name="l00693"></a>00693 &amp;tv, <span class="keyword">sizeof</span>(tv));
719
- <a name="l00694"></a>00694 <span class="preprocessor"> #ifndef __SOLARIS__</span>
720
- <a name="l00695"></a>00695 <span class="preprocessor"></span> <span class="comment">// SO_RCVTIMEO is unimplemented and returns an error on Solaris</span>
721
- <a name="l00696"></a>00696 <span class="comment">// 9 and 10 SPARC. Seems to work okay without it.</span>
722
- <a name="l00697"></a>00697 <span class="keywordflow">if</span> (ret == -1) {
723
- <a name="l00698"></a>00698 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a>(<span class="stringliteral">&quot;Cannot set read timeout for socket&quot;</span>, errno);
724
- <a name="l00699"></a>00699 }
725
- <a name="l00700"></a>00700 <span class="preprocessor"> #endif</span>
726
- <a name="l00701"></a>00701 <span class="preprocessor"></span> }
727
- <a name="l00702"></a>00702 <span class="comment"></span>
728
- <a name="l00703"></a>00703 <span class="comment"> /**</span>
729
- <a name="l00704"></a>00704 <span class="comment"> * Set the timeout value for writing data to this channel.</span>
730
- <a name="l00705"></a>00705 <span class="comment"> * If no data can be written within the timeout period, then a</span>
731
- <a name="l00706"></a>00706 <span class="comment"> * SystemException will be thrown, with error code EAGAIN or</span>
732
- <a name="l00707"></a>00707 <span class="comment"> * EWOULDBLOCK.</span>
733
- <a name="l00708"></a>00708 <span class="comment"> *</span>
734
- <a name="l00709"></a>00709 <span class="comment"> * @param msec The timeout, in milliseconds. If 0 is given,</span>
735
- <a name="l00710"></a>00710 <span class="comment"> * there will be no timeout.</span>
736
- <a name="l00711"></a>00711 <span class="comment"> * @throws SystemException Cannot set the timeout.</span>
737
- <a name="l00712"></a>00712 <span class="comment"> */</span>
738
- <a name="l00713"></a><a class="code" href="classPassenger_1_1MessageChannel.html#a77c5d7c47f387cf43992ebeb14e3c6c7">00713</a> <span class="keywordtype">void</span> <a class="code" href="classPassenger_1_1MessageChannel.html#a77c5d7c47f387cf43992ebeb14e3c6c7" title="Set the timeout value for writing data to this channel.">setWriteTimeout</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> msec) {
739
- <a name="l00714"></a>00714 <span class="comment">// People say that SO_RCVTIMEO/SO_SNDTIMEO are unreliable and</span>
740
- <a name="l00715"></a>00715 <span class="comment">// not well-implemented on all platforms.</span>
741
- <a name="l00716"></a>00716 <span class="comment">// http://www.developerweb.net/forum/archive/index.php/t-3439.html</span>
742
- <a name="l00717"></a>00717 <span class="comment">// That&#39;s why we use APR&#39;s timeout facilities as well (see Hooks.cpp).</span>
743
- <a name="l00718"></a>00718 <span class="keyword">struct </span>timeval tv;
744
- <a name="l00719"></a>00719 <span class="keywordtype">int</span> ret;
745
- <a name="l00720"></a>00720
746
- <a name="l00721"></a>00721 tv.tv_sec = msec / 1000;
747
- <a name="l00722"></a>00722 tv.tv_usec = msec % 1000 * 1000;
748
- <a name="l00723"></a>00723 ret = syscalls::setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO,
749
- <a name="l00724"></a>00724 &amp;tv, <span class="keyword">sizeof</span>(tv));
750
- <a name="l00725"></a>00725 <span class="preprocessor"> #ifndef __SOLARIS__</span>
751
- <a name="l00726"></a>00726 <span class="preprocessor"></span> <span class="comment">// SO_SNDTIMEO is unimplemented and returns an error on Solaris</span>
752
- <a name="l00727"></a>00727 <span class="comment">// 9 and 10 SPARC. Seems to work okay without it.</span>
753
- <a name="l00728"></a>00728 <span class="keywordflow">if</span> (ret == -1) {
754
- <a name="l00729"></a>00729 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a>(<span class="stringliteral">&quot;Cannot set read timeout for socket&quot;</span>, errno);
755
- <a name="l00730"></a>00730 }
756
- <a name="l00731"></a>00731 <span class="preprocessor"> #endif</span>
757
- <a name="l00732"></a>00732 <span class="preprocessor"></span> }
758
- <a name="l00733"></a>00733 };
759
- <a name="l00734"></a>00734
760
- <a name="l00735"></a>00735 } <span class="comment">// namespace Passenger</span>
761
- <a name="l00736"></a>00736
762
- <a name="l00737"></a>00737 <span class="preprocessor">#endif </span><span class="comment">/* _PASSENGER_MESSAGE_CHANNEL_H_ */</span>
605
+ <a name="l00580"></a>00580 <span class="preprocessor"> #ifdef __NetBSD__</span>
606
+ <a name="l00581"></a>00581 <span class="preprocessor"></span> *timeout = llround((<span class="keywordtype">double</span>) t / 1000);
607
+ <a name="l00582"></a>00582 <span class="preprocessor"> #else</span>
608
+ <a name="l00583"></a>00583 <span class="preprocessor"></span> *timeout = llroundl((<span class="keywordtype">long</span> <span class="keywordtype">double</span>) t / 1000);
609
+ <a name="l00584"></a>00584 <span class="preprocessor"> #endif</span>
610
+ <a name="l00585"></a>00585 <span class="preprocessor"></span> <span class="keywordflow">return</span> ret == size;
611
+ <a name="l00586"></a>00586 } <span class="keywordflow">catch</span> (...) {
612
+ <a name="l00587"></a>00587 <span class="preprocessor"> #ifdef __NetBSD__</span>
613
+ <a name="l00588"></a>00588 <span class="preprocessor"></span> *timeout = llround((<span class="keywordtype">double</span>) t / 1000);
614
+ <a name="l00589"></a>00589 <span class="preprocessor"> #else</span>
615
+ <a name="l00590"></a>00590 <span class="preprocessor"></span> *timeout = llroundl((<span class="keywordtype">long</span> <span class="keywordtype">double</span>) t / 1000);
616
+ <a name="l00591"></a>00591 <span class="preprocessor"> #endif</span>
617
+ <a name="l00592"></a>00592 <span class="preprocessor"></span> <span class="keywordflow">throw</span>;
618
+ <a name="l00593"></a>00593 }
619
+ <a name="l00594"></a>00594 } <span class="keywordflow">else</span> {
620
+ <a name="l00595"></a>00595 <span class="keywordflow">return</span> Passenger::readExact(fd, buf, size) == size;
621
+ <a name="l00596"></a>00596 }
622
+ <a name="l00597"></a>00597 }
623
+ <a name="l00598"></a>00598 <span class="comment"></span>
624
+ <a name="l00599"></a>00599 <span class="comment"> /**</span>
625
+ <a name="l00600"></a>00600 <span class="comment"> * Receive a file descriptor, which had been passed over the underlying</span>
626
+ <a name="l00601"></a>00601 <span class="comment"> * file descriptor.</span>
627
+ <a name="l00602"></a>00602 <span class="comment"> *</span>
628
+ <a name="l00603"></a>00603 <span class="comment"> * @param negotiate See Ruby&#39;s MessageChannel#send_io method&#39;s comments.</span>
629
+ <a name="l00604"></a>00604 <span class="comment"> * @return The passed file descriptor.</span>
630
+ <a name="l00605"></a>00605 <span class="comment"> * @throws SystemException If something went wrong during the</span>
631
+ <a name="l00606"></a>00606 <span class="comment"> * receiving of a file descriptor. Perhaps the underlying</span>
632
+ <a name="l00607"></a>00607 <span class="comment"> * file descriptor isn&#39;t a Unix socket.</span>
633
+ <a name="l00608"></a>00608 <span class="comment"> * @throws IOException Whatever was received doesn&#39;t seem to be a</span>
634
+ <a name="l00609"></a>00609 <span class="comment"> * file descriptor.</span>
635
+ <a name="l00610"></a>00610 <span class="comment"> * @throws boost::thread_interrupted</span>
636
+ <a name="l00611"></a>00611 <span class="comment"> */</span>
637
+ <a name="l00612"></a><a class="code" href="classPassenger_1_1MessageChannel.html#a1a28ba9d078f38f2831673092ac9dcbc">00612</a> <span class="keywordtype">int</span> <a class="code" href="classPassenger_1_1MessageChannel.html#a1a28ba9d078f38f2831673092ac9dcbc" title="Receive a file descriptor, which had been passed over the underlying file descriptor...">readFileDescriptor</a>(<span class="keywordtype">bool</span> negotiate = <span class="keyword">true</span>) {
638
+ <a name="l00613"></a>00613 <span class="comment">// See message_channel.rb for more info about negotiation.</span>
639
+ <a name="l00614"></a>00614 <span class="keywordflow">if</span> (negotiate) {
640
+ <a name="l00615"></a>00615 <a class="code" href="classPassenger_1_1MessageChannel.html#a150f68bc47e060dcc6ca35bee047914d" title="Send an array message, which consists of the given elements, over the underlying...">write</a>(<span class="stringliteral">&quot;pass IO&quot;</span>, NULL);
641
+ <a name="l00616"></a>00616 }
642
+ <a name="l00617"></a>00617
643
+ <a name="l00618"></a>00618 <span class="keyword">struct </span>msghdr msg;
644
+ <a name="l00619"></a>00619 <span class="keyword">struct </span>iovec vec;
645
+ <a name="l00620"></a>00620 <span class="keywordtype">char</span> dummy[1];
646
+ <a name="l00621"></a>00621 <span class="preprocessor"> #if defined(__APPLE__) || defined(__SOLARIS__) || defined(__arm__)</span>
647
+ <a name="l00622"></a>00622 <span class="preprocessor"></span> <span class="comment">// File descriptor passing macros (CMSG_*) seem to be broken</span>
648
+ <a name="l00623"></a>00623 <span class="comment">// on 64-bit MacOS X. This structure works around the problem.</span>
649
+ <a name="l00624"></a>00624 <span class="keyword">struct </span>{
650
+ <a name="l00625"></a>00625 <span class="keyword">struct </span>cmsghdr header;
651
+ <a name="l00626"></a>00626 <span class="keywordtype">int</span> fd;
652
+ <a name="l00627"></a>00627 } control_data;
653
+ <a name="l00628"></a>00628 <span class="preprocessor"> #define EXPECTED_CMSG_LEN sizeof(control_data)</span>
654
+ <a name="l00629"></a>00629 <span class="preprocessor"></span><span class="preprocessor"> #else</span>
655
+ <a name="l00630"></a>00630 <span class="preprocessor"></span> <span class="keywordtype">char</span> control_data[CMSG_SPACE(<span class="keyword">sizeof</span>(<span class="keywordtype">int</span>))];
656
+ <a name="l00631"></a>00631 <span class="preprocessor"> #define EXPECTED_CMSG_LEN CMSG_LEN(sizeof(int))</span>
657
+ <a name="l00632"></a>00632 <span class="preprocessor"></span><span class="preprocessor"> #endif</span>
658
+ <a name="l00633"></a>00633 <span class="preprocessor"></span> <span class="keyword">struct </span>cmsghdr *control_header;
659
+ <a name="l00634"></a>00634 <span class="keywordtype">int</span> ret;
660
+ <a name="l00635"></a>00635
661
+ <a name="l00636"></a>00636 msg.msg_name = NULL;
662
+ <a name="l00637"></a>00637 msg.msg_namelen = 0;
663
+ <a name="l00638"></a>00638
664
+ <a name="l00639"></a>00639 dummy[0] = <span class="charliteral">&#39;\0&#39;</span>;
665
+ <a name="l00640"></a>00640 vec.iov_base = dummy;
666
+ <a name="l00641"></a>00641 vec.iov_len = <span class="keyword">sizeof</span>(dummy);
667
+ <a name="l00642"></a>00642 msg.msg_iov = &amp;vec;
668
+ <a name="l00643"></a>00643 msg.msg_iovlen = 1;
669
+ <a name="l00644"></a>00644
670
+ <a name="l00645"></a>00645 msg.msg_control = (caddr_t) &amp;control_data;
671
+ <a name="l00646"></a>00646 msg.msg_controllen = <span class="keyword">sizeof</span>(control_data);
672
+ <a name="l00647"></a>00647 msg.msg_flags = 0;
673
+ <a name="l00648"></a>00648
674
+ <a name="l00649"></a>00649 ret = syscalls::recvmsg(fd, &amp;msg, 0);
675
+ <a name="l00650"></a>00650 <span class="keywordflow">if</span> (ret == -1) {
676
+ <a name="l00651"></a>00651 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a>(<span class="stringliteral">&quot;Cannot read file descriptor with recvmsg()&quot;</span>, errno);
677
+ <a name="l00652"></a>00652 }
678
+ <a name="l00653"></a>00653
679
+ <a name="l00654"></a>00654 control_header = CMSG_FIRSTHDR(&amp;msg);
680
+ <a name="l00655"></a>00655 <span class="keywordflow">if</span> (control_header == NULL) {
681
+ <a name="l00656"></a>00656 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1IOException.html" title="Represents an error that occured during an I/O operation.">IOException</a>(<span class="stringliteral">&quot;No valid file descriptor received.&quot;</span>);
682
+ <a name="l00657"></a>00657 }
683
+ <a name="l00658"></a>00658 <span class="keywordflow">if</span> (control_header-&gt;cmsg_len != EXPECTED_CMSG_LEN
684
+ <a name="l00659"></a>00659 || control_header-&gt;cmsg_level != SOL_SOCKET
685
+ <a name="l00660"></a>00660 || control_header-&gt;cmsg_type != SCM_RIGHTS) {
686
+ <a name="l00661"></a>00661 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1IOException.html" title="Represents an error that occured during an I/O operation.">IOException</a>(<span class="stringliteral">&quot;No valid file descriptor received.&quot;</span>);
687
+ <a name="l00662"></a>00662 }
688
+ <a name="l00663"></a>00663
689
+ <a name="l00664"></a>00664 <span class="preprocessor"> #if defined(__APPLE__) || defined(__SOLARIS__) || defined(__arm__)</span>
690
+ <a name="l00665"></a>00665 <span class="preprocessor"></span> <span class="keywordtype">int</span> fd = control_data.fd;
691
+ <a name="l00666"></a>00666 <span class="preprocessor"> #else</span>
692
+ <a name="l00667"></a>00667 <span class="preprocessor"></span> <span class="keywordtype">int</span> fd = *((<span class="keywordtype">int</span> *) CMSG_DATA(control_header));
693
+ <a name="l00668"></a>00668 <span class="preprocessor"> #endif</span>
694
+ <a name="l00669"></a>00669 <span class="preprocessor"></span>
695
+ <a name="l00670"></a>00670 <span class="keywordflow">if</span> (negotiate) {
696
+ <a name="l00671"></a>00671 <span class="keywordflow">try</span> {
697
+ <a name="l00672"></a>00672 <a class="code" href="classPassenger_1_1MessageChannel.html#a150f68bc47e060dcc6ca35bee047914d" title="Send an array message, which consists of the given elements, over the underlying...">write</a>(<span class="stringliteral">&quot;got IO&quot;</span>, NULL);
698
+ <a name="l00673"></a>00673 } <span class="keywordflow">catch</span> (...) {
699
+ <a name="l00674"></a>00674 this_thread::disable_syscall_interruption dsi;
700
+ <a name="l00675"></a>00675 <a class="code" href="classPassenger_1_1MessageChannel.html#a06309e208fc5e10642a2e9bbe0f351eb" title="Close the underlying file descriptor.">syscalls::close</a>(fd);
701
+ <a name="l00676"></a>00676 <span class="keywordflow">throw</span>;
702
+ <a name="l00677"></a>00677 }
703
+ <a name="l00678"></a>00678 }
704
+ <a name="l00679"></a>00679
705
+ <a name="l00680"></a>00680 <span class="keywordflow">return</span> fd;
706
+ <a name="l00681"></a>00681 }
707
+ <a name="l00682"></a>00682 <span class="comment"></span>
708
+ <a name="l00683"></a>00683 <span class="comment"> /**</span>
709
+ <a name="l00684"></a>00684 <span class="comment"> * Set the timeout value for reading data from this channel.</span>
710
+ <a name="l00685"></a>00685 <span class="comment"> * If no data can be read within the timeout period, then a</span>
711
+ <a name="l00686"></a>00686 <span class="comment"> * SystemException will be thrown by one of the read methods,</span>
712
+ <a name="l00687"></a>00687 <span class="comment"> * with error code EAGAIN or EWOULDBLOCK.</span>
713
+ <a name="l00688"></a>00688 <span class="comment"> *</span>
714
+ <a name="l00689"></a>00689 <span class="comment"> * @param msec The timeout, in milliseconds. If 0 is given,</span>
715
+ <a name="l00690"></a>00690 <span class="comment"> * there will be no timeout.</span>
716
+ <a name="l00691"></a>00691 <span class="comment"> * @throws SystemException Cannot set the timeout.</span>
717
+ <a name="l00692"></a>00692 <span class="comment"> */</span>
718
+ <a name="l00693"></a><a class="code" href="classPassenger_1_1MessageChannel.html#aeb69bffbbb148c9bc8662e20b416c4e2">00693</a> <span class="keywordtype">void</span> <a class="code" href="classPassenger_1_1MessageChannel.html#aeb69bffbbb148c9bc8662e20b416c4e2" title="Set the timeout value for reading data from this channel.">setReadTimeout</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> msec) {
719
+ <a name="l00694"></a>00694 <span class="comment">// See the comment for setWriteTimeout().</span>
720
+ <a name="l00695"></a>00695 <span class="keyword">struct </span>timeval tv;
721
+ <a name="l00696"></a>00696 <span class="keywordtype">int</span> ret;
722
+ <a name="l00697"></a>00697
723
+ <a name="l00698"></a>00698 tv.tv_sec = msec / 1000;
724
+ <a name="l00699"></a>00699 tv.tv_usec = msec % 1000 * 1000;
725
+ <a name="l00700"></a>00700 ret = syscalls::setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO,
726
+ <a name="l00701"></a>00701 &amp;tv, <span class="keyword">sizeof</span>(tv));
727
+ <a name="l00702"></a>00702 <span class="preprocessor"> #ifndef __SOLARIS__</span>
728
+ <a name="l00703"></a>00703 <span class="preprocessor"></span> <span class="comment">// SO_RCVTIMEO is unimplemented and returns an error on Solaris</span>
729
+ <a name="l00704"></a>00704 <span class="comment">// 9 and 10 SPARC. Seems to work okay without it.</span>
730
+ <a name="l00705"></a>00705 <span class="keywordflow">if</span> (ret == -1) {
731
+ <a name="l00706"></a>00706 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a>(<span class="stringliteral">&quot;Cannot set read timeout for socket&quot;</span>, errno);
732
+ <a name="l00707"></a>00707 }
733
+ <a name="l00708"></a>00708 <span class="preprocessor"> #endif</span>
734
+ <a name="l00709"></a>00709 <span class="preprocessor"></span> }
735
+ <a name="l00710"></a>00710 <span class="comment"></span>
736
+ <a name="l00711"></a>00711 <span class="comment"> /**</span>
737
+ <a name="l00712"></a>00712 <span class="comment"> * Set the timeout value for writing data to this channel.</span>
738
+ <a name="l00713"></a>00713 <span class="comment"> * If no data can be written within the timeout period, then a</span>
739
+ <a name="l00714"></a>00714 <span class="comment"> * SystemException will be thrown, with error code EAGAIN or</span>
740
+ <a name="l00715"></a>00715 <span class="comment"> * EWOULDBLOCK.</span>
741
+ <a name="l00716"></a>00716 <span class="comment"> *</span>
742
+ <a name="l00717"></a>00717 <span class="comment"> * @param msec The timeout, in milliseconds. If 0 is given,</span>
743
+ <a name="l00718"></a>00718 <span class="comment"> * there will be no timeout.</span>
744
+ <a name="l00719"></a>00719 <span class="comment"> * @throws SystemException Cannot set the timeout.</span>
745
+ <a name="l00720"></a>00720 <span class="comment"> */</span>
746
+ <a name="l00721"></a><a class="code" href="classPassenger_1_1MessageChannel.html#a77c5d7c47f387cf43992ebeb14e3c6c7">00721</a> <span class="keywordtype">void</span> <a class="code" href="classPassenger_1_1MessageChannel.html#a77c5d7c47f387cf43992ebeb14e3c6c7" title="Set the timeout value for writing data to this channel.">setWriteTimeout</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> msec) {
747
+ <a name="l00722"></a>00722 <span class="comment">// People say that SO_RCVTIMEO/SO_SNDTIMEO are unreliable and</span>
748
+ <a name="l00723"></a>00723 <span class="comment">// not well-implemented on all platforms.</span>
749
+ <a name="l00724"></a>00724 <span class="comment">// http://www.developerweb.net/forum/archive/index.php/t-3439.html</span>
750
+ <a name="l00725"></a>00725 <span class="comment">// That&#39;s why we use APR&#39;s timeout facilities as well (see Hooks.cpp).</span>
751
+ <a name="l00726"></a>00726 <span class="keyword">struct </span>timeval tv;
752
+ <a name="l00727"></a>00727 <span class="keywordtype">int</span> ret;
753
+ <a name="l00728"></a>00728
754
+ <a name="l00729"></a>00729 tv.tv_sec = msec / 1000;
755
+ <a name="l00730"></a>00730 tv.tv_usec = msec % 1000 * 1000;
756
+ <a name="l00731"></a>00731 ret = syscalls::setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO,
757
+ <a name="l00732"></a>00732 &amp;tv, <span class="keyword">sizeof</span>(tv));
758
+ <a name="l00733"></a>00733 <span class="preprocessor"> #ifndef __SOLARIS__</span>
759
+ <a name="l00734"></a>00734 <span class="preprocessor"></span> <span class="comment">// SO_SNDTIMEO is unimplemented and returns an error on Solaris</span>
760
+ <a name="l00735"></a>00735 <span class="comment">// 9 and 10 SPARC. Seems to work okay without it.</span>
761
+ <a name="l00736"></a>00736 <span class="keywordflow">if</span> (ret == -1) {
762
+ <a name="l00737"></a>00737 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a>(<span class="stringliteral">&quot;Cannot set read timeout for socket&quot;</span>, errno);
763
+ <a name="l00738"></a>00738 }
764
+ <a name="l00739"></a>00739 <span class="preprocessor"> #endif</span>
765
+ <a name="l00740"></a>00740 <span class="preprocessor"></span> }
766
+ <a name="l00741"></a>00741 };
767
+ <a name="l00742"></a>00742
768
+ <a name="l00743"></a>00743 } <span class="comment">// namespace Passenger</span>
769
+ <a name="l00744"></a>00744
770
+ <a name="l00745"></a>00745 <span class="preprocessor">#endif </span><span class="comment">/* _PASSENGER_MESSAGE_CHANNEL_H_ */</span>
763
771
  </pre></div></div>
764
772
  <hr size="1"/><address style="text-align: right;"><small>Generated by&nbsp;
765
773
  <a href="http://www.doxygen.org/index.html">
@@ -83,80 +83,81 @@
83
83
  <a name="l00058"></a>00058
84
84
  <a name="l00059"></a>00059 <span class="keyword">public</span>:
85
85
  <a name="l00060"></a>00060 <a class="code" href="classPassenger_1_1ResourceLocator.html" title="Locates various Phusion Passenger resources on the filesystem.">ResourceLocator</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;rootOrFile) {
86
- <a name="l00061"></a>00061 <span class="keywordflow">if</span> (<a class="code" href="group__Support.html#ga15298b031377d3ecb80295bd5b1a8180" title="Check whether &amp;#39;filename&amp;#39; exists and what kind of file it is.">getFileType</a>(rootOrFile) == <a class="code" href="namespacePassenger.html#a14174b712df6046cb823cde43d7ef07dabb09dbba1071b4770913363db2462eee" title="A directory.">FT_DIRECTORY</a>) {
87
- <a name="l00062"></a>00062 <span class="keywordtype">string</span> root = rootOrFile;
88
- <a name="l00063"></a>00063 <span class="keywordtype">bool</span> nativelyPackaged = !<a class="code" href="group__Support.html#ga2a62e38a72c6c65992e3361f6d80c7ef" title="Check whether the specified file exists.">fileExists</a>(root + <span class="stringliteral">&quot;/Rakefile&quot;</span>) ||
89
- <a name="l00064"></a>00064 !<a class="code" href="group__Support.html#ga2a62e38a72c6c65992e3361f6d80c7ef" title="Check whether the specified file exists.">fileExists</a>(root + <span class="stringliteral">&quot;/DEVELOPERS.TXT&quot;</span>);
90
- <a name="l00065"></a>00065
91
- <a name="l00066"></a>00066 <span class="keywordflow">if</span> (nativelyPackaged) {
92
- <a name="l00067"></a>00067 agentsDir = <span class="stringliteral">&quot;/usr/lib/phusion-passenger/agents&quot;</span>;
93
- <a name="l00068"></a>00068 helperScriptsDir = <span class="stringliteral">&quot;/usr/share/phusion-passenger/helper-scripts&quot;</span>;
94
- <a name="l00069"></a>00069 resourcesDir = <span class="stringliteral">&quot;/usr/share/phusion-passenger&quot;</span>;
95
- <a name="l00070"></a>00070 docDir = <span class="stringliteral">&quot;/usr/share/doc/phusion-passenger&quot;</span>;
96
- <a name="l00071"></a>00071 rubyLibDir = <span class="stringliteral">&quot;&quot;</span>;
97
- <a name="l00072"></a>00072 compilableSourceDir = <span class="stringliteral">&quot;/usr/share/phusion-passenger/compilable-source&quot;</span>;
98
- <a name="l00073"></a>00073 apache2Module = <span class="stringliteral">&quot;/usr/lib/apache2/modules/mod_passenger.so&quot;</span>;
99
- <a name="l00074"></a>00074 } <span class="keywordflow">else</span> {
100
- <a name="l00075"></a>00075 agentsDir = root + <span class="stringliteral">&quot;/agents&quot;</span>;
101
- <a name="l00076"></a>00076 helperScriptsDir = root + <span class="stringliteral">&quot;/helper-scripts&quot;</span>;
102
- <a name="l00077"></a>00077 resourcesDir = root + <span class="stringliteral">&quot;/resources&quot;</span>;
103
- <a name="l00078"></a>00078 docDir = root + <span class="stringliteral">&quot;/doc&quot;</span>;
104
- <a name="l00079"></a>00079 rubyLibDir = root + <span class="stringliteral">&quot;/lib&quot;</span>;
105
- <a name="l00080"></a>00080 compilableSourceDir = root;
106
- <a name="l00081"></a>00081 apache2Module = root + <span class="stringliteral">&quot;ext/apache2/mod_passenger.so&quot;</span>;
107
- <a name="l00082"></a>00082 }
108
- <a name="l00083"></a>00083
109
- <a name="l00084"></a>00084 } <span class="keywordflow">else</span> {
110
- <a name="l00085"></a>00085 <span class="keywordtype">string</span> file = rootOrFile;
111
- <a name="l00086"></a>00086 IniFileSectionPtr options = IniFile(file).section(<span class="stringliteral">&quot;locations&quot;</span>);
112
- <a name="l00087"></a>00087 agentsDir = getOption(file, options, <span class="stringliteral">&quot;agents&quot;</span>);
113
- <a name="l00088"></a>00088 helperScriptsDir = getOption(file, options, <span class="stringliteral">&quot;helper_scripts&quot;</span>);
114
- <a name="l00089"></a>00089 resourcesDir = getOption(file, options, <span class="stringliteral">&quot;resources&quot;</span>);
115
- <a name="l00090"></a>00090 docDir = getOption(file, options, <span class="stringliteral">&quot;doc&quot;</span>);
116
- <a name="l00091"></a>00091 rubyLibDir = getOption(file, options, <span class="stringliteral">&quot;rubylib&quot;</span>);
117
- <a name="l00092"></a>00092 compilableSourceDir = getOption(file, options, <span class="stringliteral">&quot;compilable_source&quot;</span>);
118
- <a name="l00093"></a>00093 apache2Module = getOption(file, options, <span class="stringliteral">&quot;apache2_module&quot;</span>);
119
- <a name="l00094"></a>00094 }
120
- <a name="l00095"></a>00095 }
121
- <a name="l00096"></a>00096
122
- <a name="l00097"></a>00097 <span class="keywordtype">string</span> getAgentsDir()<span class="keyword"> const </span>{
123
- <a name="l00098"></a>00098 <span class="keywordflow">return</span> agentsDir;
124
- <a name="l00099"></a>00099 }
125
- <a name="l00100"></a>00100
126
- <a name="l00101"></a>00101 <span class="keywordtype">string</span> getHelperScriptsDir()<span class="keyword"> const </span>{
127
- <a name="l00102"></a>00102 <span class="keywordflow">return</span> helperScriptsDir;
128
- <a name="l00103"></a>00103 }
129
- <a name="l00104"></a>00104
130
- <a name="l00105"></a>00105 <span class="keywordtype">string</span> getSpawnServerFilename()<span class="keyword"> const </span>{
131
- <a name="l00106"></a>00106 <span class="keywordflow">return</span> getHelperScriptsDir() + <span class="stringliteral">&quot;/passenger-spawn-server&quot;</span>;
132
- <a name="l00107"></a>00107 }
133
- <a name="l00108"></a>00108
134
- <a name="l00109"></a>00109 <span class="keywordtype">string</span> getResourcesDir()<span class="keyword"> const </span>{
135
- <a name="l00110"></a>00110 <span class="keywordflow">return</span> resourcesDir;
136
- <a name="l00111"></a>00111 }
137
- <a name="l00112"></a>00112
138
- <a name="l00113"></a>00113 <span class="keywordtype">string</span> getDocDir()<span class="keyword"> const </span>{
139
- <a name="l00114"></a>00114 <span class="keywordflow">return</span> docDir;
140
- <a name="l00115"></a>00115 }
141
- <a name="l00116"></a>00116
142
- <a name="l00117"></a>00117 <span class="comment">// Can be empty.</span>
143
- <a name="l00118"></a>00118 <span class="keywordtype">string</span> getRubyLibDir()<span class="keyword"> const </span>{
144
- <a name="l00119"></a>00119 <span class="keywordflow">return</span> rubyLibDir;
145
- <a name="l00120"></a>00120 }
146
- <a name="l00121"></a>00121
147
- <a name="l00122"></a>00122 <span class="keywordtype">string</span> getCompilableSourceDir()<span class="keyword"> const </span>{
148
- <a name="l00123"></a>00123 <span class="keywordflow">return</span> compilableSourceDir;
149
- <a name="l00124"></a>00124 }
150
- <a name="l00125"></a>00125
151
- <a name="l00126"></a>00126 <span class="keywordtype">string</span> getApache2ModuleFilename()<span class="keyword"> const </span>{
152
- <a name="l00127"></a>00127 <span class="keywordflow">return</span> apache2Module;
153
- <a name="l00128"></a>00128 }
154
- <a name="l00129"></a>00129 };
155
- <a name="l00130"></a>00130
86
+ <a name="l00061"></a>00061 <a class="code" href="namespacePassenger.html#a14174b712df6046cb823cde43d7ef07d" title="Enumeration which indicates what kind of file a file is.">FileType</a> rootOrFileType = <a class="code" href="group__Support.html#ga15298b031377d3ecb80295bd5b1a8180" title="Check whether &amp;#39;filename&amp;#39; exists and what kind of file it is.">getFileType</a>(rootOrFile);
87
+ <a name="l00062"></a>00062 <span class="keywordflow">if</span> (rootOrFileType == <a class="code" href="namespacePassenger.html#a14174b712df6046cb823cde43d7ef07dabb09dbba1071b4770913363db2462eee" title="A directory.">FT_DIRECTORY</a> || rootOrFileType == <a class="code" href="namespacePassenger.html#a14174b712df6046cb823cde43d7ef07da9fc66834fe96c52799397496b8df8486" title="The file doesn&amp;#39;t exist.">FT_NONEXISTANT</a>) {
88
+ <a name="l00063"></a>00063 <span class="keywordtype">string</span> root = rootOrFile;
89
+ <a name="l00064"></a>00064 <span class="keywordtype">bool</span> nativelyPackaged = !<a class="code" href="group__Support.html#ga2a62e38a72c6c65992e3361f6d80c7ef" title="Check whether the specified file exists.">fileExists</a>(root + <span class="stringliteral">&quot;/Rakefile&quot;</span>) ||
90
+ <a name="l00065"></a>00065 !<a class="code" href="group__Support.html#ga2a62e38a72c6c65992e3361f6d80c7ef" title="Check whether the specified file exists.">fileExists</a>(root + <span class="stringliteral">&quot;/DEVELOPERS.TXT&quot;</span>);
91
+ <a name="l00066"></a>00066
92
+ <a name="l00067"></a>00067 <span class="keywordflow">if</span> (nativelyPackaged) {
93
+ <a name="l00068"></a>00068 agentsDir = <span class="stringliteral">&quot;/usr/lib/phusion-passenger/agents&quot;</span>;
94
+ <a name="l00069"></a>00069 helperScriptsDir = <span class="stringliteral">&quot;/usr/share/phusion-passenger/helper-scripts&quot;</span>;
95
+ <a name="l00070"></a>00070 resourcesDir = <span class="stringliteral">&quot;/usr/share/phusion-passenger&quot;</span>;
96
+ <a name="l00071"></a>00071 docDir = <span class="stringliteral">&quot;/usr/share/doc/phusion-passenger&quot;</span>;
97
+ <a name="l00072"></a>00072 rubyLibDir = <span class="stringliteral">&quot;&quot;</span>;
98
+ <a name="l00073"></a>00073 compilableSourceDir = <span class="stringliteral">&quot;/usr/share/phusion-passenger/compilable-source&quot;</span>;
99
+ <a name="l00074"></a>00074 apache2Module = <span class="stringliteral">&quot;/usr/lib/apache2/modules/mod_passenger.so&quot;</span>;
100
+ <a name="l00075"></a>00075 } <span class="keywordflow">else</span> {
101
+ <a name="l00076"></a>00076 agentsDir = root + <span class="stringliteral">&quot;/agents&quot;</span>;
102
+ <a name="l00077"></a>00077 helperScriptsDir = root + <span class="stringliteral">&quot;/helper-scripts&quot;</span>;
103
+ <a name="l00078"></a>00078 resourcesDir = root + <span class="stringliteral">&quot;/resources&quot;</span>;
104
+ <a name="l00079"></a>00079 docDir = root + <span class="stringliteral">&quot;/doc&quot;</span>;
105
+ <a name="l00080"></a>00080 rubyLibDir = root + <span class="stringliteral">&quot;/lib&quot;</span>;
106
+ <a name="l00081"></a>00081 compilableSourceDir = root;
107
+ <a name="l00082"></a>00082 apache2Module = root + <span class="stringliteral">&quot;ext/apache2/mod_passenger.so&quot;</span>;
108
+ <a name="l00083"></a>00083 }
109
+ <a name="l00084"></a>00084
110
+ <a name="l00085"></a>00085 } <span class="keywordflow">else</span> {
111
+ <a name="l00086"></a>00086 <span class="keywordtype">string</span> file = rootOrFile;
112
+ <a name="l00087"></a>00087 IniFileSectionPtr options = IniFile(file).section(<span class="stringliteral">&quot;locations&quot;</span>);
113
+ <a name="l00088"></a>00088 agentsDir = getOption(file, options, <span class="stringliteral">&quot;agents&quot;</span>);
114
+ <a name="l00089"></a>00089 helperScriptsDir = getOption(file, options, <span class="stringliteral">&quot;helper_scripts&quot;</span>);
115
+ <a name="l00090"></a>00090 resourcesDir = getOption(file, options, <span class="stringliteral">&quot;resources&quot;</span>);
116
+ <a name="l00091"></a>00091 docDir = getOption(file, options, <span class="stringliteral">&quot;doc&quot;</span>);
117
+ <a name="l00092"></a>00092 rubyLibDir = getOption(file, options, <span class="stringliteral">&quot;rubylib&quot;</span>);
118
+ <a name="l00093"></a>00093 compilableSourceDir = getOption(file, options, <span class="stringliteral">&quot;compilable_source&quot;</span>);
119
+ <a name="l00094"></a>00094 apache2Module = getOption(file, options, <span class="stringliteral">&quot;apache2_module&quot;</span>);
120
+ <a name="l00095"></a>00095 }
121
+ <a name="l00096"></a>00096 }
122
+ <a name="l00097"></a>00097
123
+ <a name="l00098"></a>00098 <span class="keywordtype">string</span> getAgentsDir()<span class="keyword"> const </span>{
124
+ <a name="l00099"></a>00099 <span class="keywordflow">return</span> agentsDir;
125
+ <a name="l00100"></a>00100 }
126
+ <a name="l00101"></a>00101
127
+ <a name="l00102"></a>00102 <span class="keywordtype">string</span> getHelperScriptsDir()<span class="keyword"> const </span>{
128
+ <a name="l00103"></a>00103 <span class="keywordflow">return</span> helperScriptsDir;
129
+ <a name="l00104"></a>00104 }
130
+ <a name="l00105"></a>00105
131
+ <a name="l00106"></a>00106 <span class="keywordtype">string</span> getSpawnServerFilename()<span class="keyword"> const </span>{
132
+ <a name="l00107"></a>00107 <span class="keywordflow">return</span> getHelperScriptsDir() + <span class="stringliteral">&quot;/passenger-spawn-server&quot;</span>;
133
+ <a name="l00108"></a>00108 }
134
+ <a name="l00109"></a>00109
135
+ <a name="l00110"></a>00110 <span class="keywordtype">string</span> getResourcesDir()<span class="keyword"> const </span>{
136
+ <a name="l00111"></a>00111 <span class="keywordflow">return</span> resourcesDir;
137
+ <a name="l00112"></a>00112 }
138
+ <a name="l00113"></a>00113
139
+ <a name="l00114"></a>00114 <span class="keywordtype">string</span> getDocDir()<span class="keyword"> const </span>{
140
+ <a name="l00115"></a>00115 <span class="keywordflow">return</span> docDir;
141
+ <a name="l00116"></a>00116 }
142
+ <a name="l00117"></a>00117
143
+ <a name="l00118"></a>00118 <span class="comment">// Can be empty.</span>
144
+ <a name="l00119"></a>00119 <span class="keywordtype">string</span> getRubyLibDir()<span class="keyword"> const </span>{
145
+ <a name="l00120"></a>00120 <span class="keywordflow">return</span> rubyLibDir;
146
+ <a name="l00121"></a>00121 }
147
+ <a name="l00122"></a>00122
148
+ <a name="l00123"></a>00123 <span class="keywordtype">string</span> getCompilableSourceDir()<span class="keyword"> const </span>{
149
+ <a name="l00124"></a>00124 <span class="keywordflow">return</span> compilableSourceDir;
150
+ <a name="l00125"></a>00125 }
151
+ <a name="l00126"></a>00126
152
+ <a name="l00127"></a>00127 <span class="keywordtype">string</span> getApache2ModuleFilename()<span class="keyword"> const </span>{
153
+ <a name="l00128"></a>00128 <span class="keywordflow">return</span> apache2Module;
154
+ <a name="l00129"></a>00129 }
155
+ <a name="l00130"></a>00130 };
156
156
  <a name="l00131"></a>00131
157
- <a name="l00132"></a>00132 }
158
- <a name="l00133"></a>00133
159
- <a name="l00134"></a>00134 <span class="preprocessor">#endif </span><span class="comment">/* _PASSENGER_RESOURCE_LOCATOR_H_ */</span>
157
+ <a name="l00132"></a>00132
158
+ <a name="l00133"></a>00133 }
159
+ <a name="l00134"></a>00134
160
+ <a name="l00135"></a>00135 <span class="preprocessor">#endif </span><span class="comment">/* _PASSENGER_RESOURCE_LOCATOR_H_ */</span>
160
161
  </pre></div></div>
161
162
  <hr size="1"/><address style="text-align: right;"><small>Generated by&nbsp;
162
163
  <a href="http://www.doxygen.org/index.html">