]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
remove redundent LXC_TTY_HANDLER
authorJian Xiao <jian@linux.vnet.ibm.com>
Thu, 23 Feb 2012 08:57:13 +0000 (09:57 +0100)
committerDaniel Lezcano <daniel.lezcano@free.fr>
Thu, 23 Feb 2012 08:57:13 +0000 (09:57 +0100)
All the signals (except fatal ones) are redirected to signalfd at lxc_init,
so the LXC_TTY_HANDLERs are redundant. This patch removes them.

Signed-off-by: Jian Xiao <jian@linux.vnet.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/start.c
src/lxc/utils.h

index 18f6878c689a5eb60302979fa2d3c0de176e4d46..2c92a17a7abea986029fc193878428fdc54e3bc9 100644 (file)
@@ -129,9 +129,6 @@ int signalfd(int fd, const sigset_t *mask, int flags)
 
 lxc_log_define(lxc_start, lxc);
 
-LXC_TTY_HANDLER(SIGINT);
-LXC_TTY_HANDLER(SIGQUIT);
-
 static int match_fd(int fd)
 {
        return (fd == 0 || fd == 1 || fd == 2);
@@ -564,10 +561,6 @@ int __lxc_start(const char *name, struct lxc_conf *conf,
                goto out_fini;
        }
 
-       /* Avoid signals from terminal */
-       LXC_TTY_ADD_HANDLER(SIGINT);
-       LXC_TTY_ADD_HANDLER(SIGQUIT);
-
        err = lxc_poll(name, handler);
        if (err) {
                ERROR("mainloop exited with an error");
@@ -579,8 +572,6 @@ int __lxc_start(const char *name, struct lxc_conf *conf,
 
        err =  lxc_error_set_and_log(handler->pid, status);
 out_fini:
-       LXC_TTY_DEL_HANDLER(SIGQUIT);
-       LXC_TTY_DEL_HANDLER(SIGINT);
        lxc_cgroup_destroy(name);
        lxc_fini(name, handler);
        return err;
index 114b6688baa7e7dfd4c419cdb2940766b0de7833..d47c983bbe44892750859ebfaf7e6fe5b54a0f71 100644 (file)
 #ifndef _utils_h
 #define _utils_h
 
-#define LXC_TTY_HANDLER(s) \
-       static struct sigaction lxc_tty_sa_##s;                         \
-       static void tty_##s##_handler(int sig, siginfo_t *info, void *ctx) \
-       {                                                               \
-               if (lxc_tty_sa_##s.sa_handler == SIG_DFL ||             \
-                   lxc_tty_sa_##s.sa_handler == SIG_IGN)               \
-                       return;                                         \
-               (*lxc_tty_sa_##s.sa_sigaction)(sig, info, ctx); \
-       }
-
-#define LXC_TTY_ADD_HANDLER(s) \
-       do { \
-               struct sigaction sa; \
-               sa.sa_sigaction = tty_##s##_handler; \
-               sa.sa_flags = SA_SIGINFO; \
-               sigfillset(&sa.sa_mask); \
-               /* No error expected with sigaction. */ \
-               sigaction(s, &sa, &lxc_tty_sa_##s); \
-       } while (0)
-
-#define LXC_TTY_DEL_HANDLER(s) \
-       do { \
-               sigaction(s, &lxc_tty_sa_##s, NULL); \
-       } while (0)
-
-#endif
-
 extern int lxc_copy_file(const char *src, const char *dst);
 extern int lxc_setup_fs(void);
 extern int get_u16(ushort *val, const char *arg, int base);
 extern int mkdir_p(const char *dir, mode_t mode);
+
+#endif