[Dovecot] conflict name of si_code on NetBSD

Tatsuyoshi rs27 at tatsuyoshi.net
Mon Apr 6 07:08:36 EEST 2009


Hi.
I compiled 1.2.rc2 on NetBSD.

[toyota at sernpidal]% uname -rsm
NetBSD 3.1 i386
[toyota at sernpidal]% ./configure; make
--- snip ---
gcc -DHAVE_CONFIG_H -I. -I../..      -std=gnu99 -g -O2 -Wall -W
-Wmissing-prototypes -Wmissing-declarations -Wpointer-arith
-Wchar-subscripts -Wformat=2 -Wbad-function-cast -MT child-wait.o -MD
-MP -MF .deps/child-wait.Tpo -c -o child-wait.o child-wait.c
In file included from child-wait.c:4:
lib-signals.h:9: error: parse error before '.' token
*** Error code 1

Stop.

Error occurred. I changed some code, and find out the source
of the trouble.

[toyota at sernpidal]% grep -w si_code /usr/include/sys/siginfo.h
#define si_code         _info._code
/** si_code */
/** si_code */

The 'si_code' name is conflicted, and I need change the name of
'si_code'. The following is quick patch for NetBSD, just change
si_code to sicode.

[toyota at sernpidal]% diff -crN dovecot-1.2.rc2_bak dovecot-1.2.rc2
diff -crN dovecot-1.2.rc2_bak/src/lib/lib-signals.c
dovecot-1.2.rc2/src/lib/lib-signals.c
*** dovecot-1.2.rc2_bak/src/lib/lib-signals.c   Thu Apr  2 02:08:21 2009
--- dovecot-1.2.rc2/src/lib/lib-signals.c       Mon Apr  6 12:45:42 2009
***************
*** 27,36 ****
  static bool signals_initialized = FALSE;
  static struct io *io_sig = NULL;

! const char *lib_signal_code_to_str(int signo, int si_code)
  {
        /* common */
!       switch (si_code) {
        case SI_USER:
                return "kill";
  #ifdef SI_KERNEL
--- 27,36 ----
  static bool signals_initialized = FALSE;
  static struct io *io_sig = NULL;

! const char *lib_signal_code_to_str(int signo, int sicode)
  {
        /* common */
!       switch (sicode) {
        case SI_USER:
                return "kill";
  #ifdef SI_KERNEL
***************
*** 43,49 ****

        switch (signo) {
        case SIGSEGV:
!               switch (si_code) {
                case SEGV_MAPERR:
                        return "address not mapped";
                case SEGV_ACCERR:
--- 43,49 ----

        switch (signo) {
        case SIGSEGV:
!               switch (sicode) {
                case SEGV_MAPERR:
                        return "address not mapped";
                case SEGV_ACCERR:
***************
*** 51,57 ****
                }
                break;
        case SIGBUS:
!               switch (si_code) {
                case BUS_ADRALN:
                        return "invalid address alignment";
                case BUS_ADRERR:
--- 51,57 ----
                }
                break;
        case SIGBUS:
!               switch (sicode) {
                case BUS_ADRALN:
                        return "invalid address alignment";
                case BUS_ADRERR:
***************
*** 60,66 ****
                        return "object-specific hardware error";
                }
        }
!       return t_strdup_printf("unknown %d", si_code);
  }

  static void sig_handler(int signo, siginfo_t *si, void *context ATTR_UNUSED)
--- 60,66 ----
                        return "object-specific hardware error";
                }
        }
!       return t_strdup_printf("unknown %d", sicode);
  }

  static void sig_handler(int signo, siginfo_t *si, void *context ATTR_UNUSED)
diff -crN dovecot-1.2.rc2_bak/src/lib/lib-signals.h
dovecot-1.2.rc2/src/lib/lib-signals.h
*** dovecot-1.2.rc2_bak/src/lib/lib-signals.h   Thu Apr  2 01:59:55 2009
--- dovecot-1.2.rc2/src/lib/lib-signals.h       Mon Apr  6 12:46:00 2009
***************
*** 5,12 ****

  typedef void signal_handler_t(const siginfo_t *si, void *context);

! /* Convert si_code to string */
! const char *lib_signal_code_to_str(int signo, int si_code);

  /* Set signal handler for specific signal. If delayed is TRUE, the handler
     will be called later, ie. not as a real signal handler. */
--- 5,12 ----

  typedef void signal_handler_t(const siginfo_t *si, void *context);

! /* Convert sicode to string */
! const char *lib_signal_code_to_str(int signo, int sicode);

  /* Set signal handler for specific signal. If delayed is TRUE, the handler
     will be called later, ie. not as a real signal handler. */

--
Tatsuyoshi Toyota
rs27 at tatsuyoshi.net


More information about the dovecot mailing list