Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "MessageChannel.h"
- using namespace Passenger;
- using namespace oxt;
- using namespace boost::this_thread;
- extern "C" int
- send_file_descriptor(int socket, int fd, char *error, unsigned int errorSize) {
- try {
- disable_syscall_interruption dsi;
- MessageChannel(socket).writeFileDescriptor(fd);
- return 1;
- } catch (SystemException &e) {
- strncpy(error, e.what(), errorSize - 1);
- error[errorSize - 1] = '\0';
- return 0;
- } catch (...) {
- strncpy(error, "Unknown exception occurred", errorSize - 1);
- error[errorSize - 1] = '\0';
- return 0;
- }
- }
- extern "C" int
- read_file_descriptor(int socket, char *error, unsigned int errorSize) {
- try {
- disable_syscall_interruption dsi;
- return MessageChannel(socket).readFileDescriptor();
- } catch (IOException &e) {
- strncpy(error, e.what(), errorSize - 1);
- error[errorSize - 1] = '\0';
- return -1;
- } catch (SystemException &e) {
- strncpy(error, e.what(), errorSize - 1);
- error[errorSize - 1] = '\0';
- return -1;
- } catch (...) {
- strncpy(error, "Unknown exception occurred", errorSize - 1);
- error[errorSize - 1] = '\0';
- return -1;
- }
- }
- extern "C" int
- get_errno() {
- return errno;
- }
Add Comment
Please, Sign In to add comment