Linux: Use our own signalfd wrapper, rather than libstddjb
selfpipe already does a fine job of interfacing to signalfd. But Debian and
Ubuntu want us to depend on the skalibs-dev package rather than build libstddjb
ourselves. That would be fine except that skalibs-dev has static libraries
only, and they aren't built with -fPIC. This interferes with building
mosh-{client,server} as position-independent executables, which is a desirable
security measure.
So we have our own wrapper, which invokes either signalfd or selfpipe. And we
build it ourselves with our own flags, because it's part of the Mosh project
proper.
(closes #108)
This commit is contained in:
committed by
Keith Winstein
parent
93325d3ef0
commit
0eec0b60f0
@@ -38,10 +38,7 @@
|
||||
#include <util.h>
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
#include "selfpipe.h"
|
||||
}
|
||||
|
||||
#include "sigfd.h"
|
||||
#include "swrite.h"
|
||||
#include "completeterminal.h"
|
||||
#include "user.h"
|
||||
|
||||
@@ -50,10 +50,7 @@
|
||||
#include "swrite.h"
|
||||
#include "fatal_assert.h"
|
||||
#include "locale_utils.h"
|
||||
|
||||
extern "C" {
|
||||
#include "selfpipe.h"
|
||||
}
|
||||
#include "sigfd.h"
|
||||
|
||||
const size_t buf_size = 16384;
|
||||
|
||||
@@ -197,13 +194,13 @@ bool tick( Terminal::Framebuffer &state, Terminal::Framebuffer &new_frame,
|
||||
void emulate_terminal( int fd )
|
||||
{
|
||||
/* establish WINCH fd and start listening for signal */
|
||||
int signal_fd = selfpipe_init();
|
||||
int signal_fd = sigfd_init();
|
||||
if ( signal_fd < 0 ) {
|
||||
perror( "selfpipe" );
|
||||
perror( "sigfd_init" );
|
||||
return;
|
||||
}
|
||||
|
||||
fatal_assert( selfpipe_trap(SIGWINCH) == 0 );
|
||||
fatal_assert( sigfd_trap(SIGWINCH) == 0 );
|
||||
|
||||
/* get current window size */
|
||||
struct winsize window_size;
|
||||
@@ -291,7 +288,7 @@ void emulate_terminal( int fd )
|
||||
}
|
||||
} else if ( pollfds[ 2 ].revents & POLLIN ) {
|
||||
/* resize */
|
||||
fatal_assert( selfpipe_read() == SIGWINCH );
|
||||
fatal_assert( sigfd_read() == SIGWINCH );
|
||||
|
||||
/* get new size */
|
||||
if ( ioctl( STDIN_FILENO, TIOCGWINSZ, &window_size ) < 0 ) {
|
||||
|
||||
Reference in New Issue
Block a user