From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14825 invoked by alias); 21 May 2013 20:33:06 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 14815 invoked by uid 89); 21 May 2013 20:33:06 -0000 X-Spam-SWARE-Status: No, score=-7.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS,TW_DJ,TW_GP,TW_JG,TW_SD autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 21 May 2013 20:33:05 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4LKX4Z1009156 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 21 May 2013 16:33:04 -0400 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r4LKX39q001280 for ; Tue, 21 May 2013 16:33:03 -0400 Subject: [PATCH] common/filestuff.c: No sockets on DJGPP. To: gdb-patches@sourceware.org From: Pedro Alves Date: Tue, 21 May 2013 20:33:00 -0000 Message-ID: <20130521203302.23510.45135.stgit@brno.lan> User-Agent: StGit/0.16 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-SW-Source: 2013-05/txt/msg00787.txt.bz2 Building gdb with --host=i586-pc-msdosdjgpp ends up with: i586-pc-msdosdjgpp-gcc -g -O2 -I../../src/gdb/config/djgpp -I. -I../../src/gdb -I../../src/gdb/common -I../../src/gdb/config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I../../src/gdb/../include/opcode -I../../src/gdb/../opcodes/.. -I../../src/gdb/../readline/.. -I../bfd -I../../src/gdb/../bfd -I../../src/gdb/../include -I../libdecnumber -I../../src/gdb/../libdecnumber -I./../intl -I../../src/gdb/gnulib/import -Ibuild-gnulib/import -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Werror -c -o filestuff.o -MT filestuff.o -MMD -MP -MF .deps/filestuff.Tpo ../../src/gdb/common/filestuff.c ../../src/gdb/common/filestuff.c:38:24: fatal error: sys/socket.h: No such file or directory There are no sockets on djgpp. This #ifdef's out the bits in the file that use sockets, depending on whether winsock or sys/socket.h is available. As alternative approach, given ser-tcp.c, ser-pipe.c, etc. are split into separate files, and which to use is selected by configure.ac: dnl Figure out which of the many generic ser-*.c files the _host_ supports. SER_HARDWIRE="ser-base.o ser-unix.o ser-pipe.o ser-tcp.o" case ${host} in *go32* ) SER_HARDWIRE=ser-go32.o ;; *djgpp* ) SER_HARDWIRE=ser-go32.o ;; *mingw32*) SER_HARDWIRE="ser-base.o ser-tcp.o ser-mingw.o" ;; esac AC_SUBST(SER_HARDWIRE) ... I considered splitting filestuff.c similarly. But I quickly gave up on the idea, as it looked like a lot more complication over this approach, for no real gain. Plus, there are uses of these functions outside the ser*.c framework. gdbserver's configure.ac is already checking for sys/socket.h. gdb/ 2013-05-21 Pedro Alves * common/filestuff.c [USE_WIN32API]: Define HAVE_SOCKETS. [HAVE_SYS_SOCKET_H]: Define HAVE_SOCKETS. (socket_mark_cloexec, gdb_socketpair_cloexec, gdb_socket_cloexec): Only define if HAVE_SOCKETS is defined. * configure.ac: Check for sys/socket.h. * config.in, configure: Regenerate. --- 0 files changed diff --git a/gdb/common/filestuff.c b/gdb/common/filestuff.c index e7af3a5..daf96d9 100644 --- a/gdb/common/filestuff.c +++ b/gdb/common/filestuff.c @@ -34,10 +34,12 @@ #ifdef USE_WIN32API #include #include -#else +#define HAVE_SOCKETS 1 +#elif defined HAVE_SYS_SOCKET_H #include /* Define HAVE_F_GETFD if we plan to use F_GETFD. */ #define HAVE_F_GETFD F_GETFD +#define HAVE_SOCKETS 1 #endif #ifdef HAVE_SYS_RESOURCE_H @@ -277,6 +279,8 @@ maybe_mark_cloexec (int fd) mark_cloexec (fd); } +#ifdef HAVE_SOCKETS + /* Like maybe_mark_cloexec, but for callers that use SOCK_CLOEXEC. */ static void @@ -286,6 +290,8 @@ socket_mark_cloexec (int fd) mark_cloexec (fd); } +#endif + /* See filestuff.h. */ @@ -335,6 +341,7 @@ gdb_fopen_cloexec (const char *filename, const char *opentype) return result; } +#ifdef HAVE_SOCKETS /* See filestuff.h. */ int @@ -367,6 +374,7 @@ gdb_socket_cloexec (int namespace, int style, int protocol) return result; } +#endif /* See filestuff.h. */ diff --git a/gdb/config.in b/gdb/config.in index 6223b92..7cd22e3 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -509,6 +509,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SELECT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H diff --git a/gdb/configure b/gdb/configure index 5de43e7..383d634 100755 --- a/gdb/configure +++ b/gdb/configure @@ -8911,7 +8911,7 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # elf_hp.h is for HP/UX 64-bit shared library support. -for ac_header in nlist.h machine/reg.h poll.h sys/poll.h proc_service.h \ +for ac_header in nlist.h machine/reg.h poll.h sys/poll.h sys/socket.h proc_service.h \ thread_db.h signal.h stddef.h \ stdlib.h string.h memory.h strings.h sys/fault.h \ sys/file.h sys/filio.h sys/ioctl.h sys/param.h \ diff --git a/gdb/configure.ac b/gdb/configure.ac index 5fcec52..46a97bd 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1089,7 +1089,7 @@ fi AC_HEADER_DIRENT AC_HEADER_STDC # elf_hp.h is for HP/UX 64-bit shared library support. -AC_CHECK_HEADERS([nlist.h machine/reg.h poll.h sys/poll.h proc_service.h \ +AC_CHECK_HEADERS([nlist.h machine/reg.h poll.h sys/poll.h sys/socket.h proc_service.h \ thread_db.h signal.h stddef.h \ stdlib.h string.h memory.h strings.h sys/fault.h \ sys/file.h sys/filio.h sys/ioctl.h sys/param.h \