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
+11
-14
@@ -37,10 +37,7 @@
|
||||
#include <util.h>
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
#include "selfpipe.h"
|
||||
}
|
||||
|
||||
#include "sigfd.h"
|
||||
#include "stmclient.h"
|
||||
#include "swrite.h"
|
||||
#include "completeterminal.h"
|
||||
@@ -105,19 +102,19 @@ void STMClient::shutdown( void )
|
||||
void STMClient::main_init( void )
|
||||
{
|
||||
/* establish a fd for signals */
|
||||
signal_fd = selfpipe_init();
|
||||
signal_fd = sigfd_init();
|
||||
if ( signal_fd < 0 ) {
|
||||
perror( "selfpipe_init" );
|
||||
perror( "sigfd_init" );
|
||||
return;
|
||||
}
|
||||
|
||||
fatal_assert( selfpipe_trap( SIGWINCH ) == 0 );
|
||||
fatal_assert( selfpipe_trap( SIGTERM ) == 0 );
|
||||
fatal_assert( selfpipe_trap( SIGINT ) == 0 );
|
||||
fatal_assert( selfpipe_trap( SIGHUP ) == 0 );
|
||||
fatal_assert( selfpipe_trap( SIGPIPE ) == 0 );
|
||||
fatal_assert( selfpipe_trap( SIGTSTP ) == 0 );
|
||||
fatal_assert( selfpipe_trap( SIGCONT ) == 0 );
|
||||
fatal_assert( sigfd_trap( SIGWINCH ) == 0 );
|
||||
fatal_assert( sigfd_trap( SIGTERM ) == 0 );
|
||||
fatal_assert( sigfd_trap( SIGINT ) == 0 );
|
||||
fatal_assert( sigfd_trap( SIGHUP ) == 0 );
|
||||
fatal_assert( sigfd_trap( SIGPIPE ) == 0 );
|
||||
fatal_assert( sigfd_trap( SIGTSTP ) == 0 );
|
||||
fatal_assert( sigfd_trap( SIGCONT ) == 0 );
|
||||
|
||||
/* get initial window size */
|
||||
if ( ioctl( STDIN_FILENO, TIOCGWINSZ, &window_size ) < 0 ) {
|
||||
@@ -325,7 +322,7 @@ void STMClient::main( void )
|
||||
}
|
||||
|
||||
if ( pollfds[ 2 ].revents & POLLIN ) {
|
||||
int signo = selfpipe_read();
|
||||
int signo = sigfd_read();
|
||||
|
||||
if ( signo == SIGWINCH ) {
|
||||
/* resize */
|
||||
|
||||
Reference in New Issue
Block a user