From mbpaz@REDACTED Mon Dec 12 12:43:18 2005 From: mbpaz@REDACTED (Miguel Barreiro) Date: Mon, 12 Dec 2005 12:43:18 +0100 Subject: Large files Message-ID: <1134387798.439d6256a84e9@webmail.alfa21.com> Hi, Support for large files (large being >= 2GB which is actually "moderately sized files" these days) works ok on 64-bit systems. Doesn't anyone else use large files on 32-bit systems? In case people is interested it works with the following recipe: - Either patch the file driver to open files with O_LARGEFILE and change a couple variables from off_t to off64_t and make sure they are correctly packed into 64-bit commands and responses or, much simpler: $ export CFLAGS="-D_FILE_OFFSET_BITS=64" ; ./configure ; make (remember to use clean sources). See the libc documentation for details on the _FILE_OFFSET_BITS flag. - Apply the attached patch to make file:position/2 work correctly (everything else works without the patch, AFAIK). Currently erts/emulator/drivers/common/efile_drv.c packs the return value of lseek(2) using reply_Uint (which BTW is a bit misleading -- Uint is typedef'ed to a pointer-sized variable and not an unsigned int as I would tend to expect. These don't always match). The return value of lseek is off_t which may not be Uint sized, so I added a reply_off_t function. Patch generated against R108-B. Regards, Miguel -------------- next part -------------- A non-text attachment was scrubbed... Name: reply_off_t.patch Type: text/x-patch Size: 1238 bytes Desc: not available URL: From raimo@REDACTED Mon Dec 12 16:31:12 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 12 Dec 2005 16:31:12 +0100 Subject: Large files References: <1134387798.439d6256a84e9@webmail.alfa21.com> Message-ID: This feature was actually on its way into R10B-9, but in the last minute it turned out that it broke the possibility of using cpu_timestamp on call traces, so we are working on an improved solution... mbpaz@REDACTED (Miguel Barreiro) writes: > Hi, > > Support for large files (large being >= 2GB which is actually "moderately sized > files" these days) works ok on 64-bit systems. Doesn't anyone else use large > files on 32-bit systems? In case people is interested it works with the > following recipe: > - Either patch the file driver to open files with O_LARGEFILE and change a > couple variables from off_t to off64_t and make sure they are correctly packed > into 64-bit commands and responses or, much simpler: > $ export CFLAGS="-D_FILE_OFFSET_BITS=64" ; ./configure ; make > (remember to use clean sources). See the libc documentation for details on the > _FILE_OFFSET_BITS flag. > > - Apply the attached patch to make file:position/2 work correctly (everything > else works without the patch, AFAIK). Currently > erts/emulator/drivers/common/efile_drv.c packs the return value of lseek(2) > using reply_Uint (which BTW is a bit misleading -- Uint is typedef'ed to a > pointer-sized variable and not an unsigned int as I would tend to expect. These > don't always match). The return value of lseek is off_t which may not be Uint > sized, so I added a reply_off_t function. > Patch generated against R108-B. > > > Regards, > > Miguel > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From mbpaz@REDACTED Mon Dec 12 21:41:00 2005 From: mbpaz@REDACTED (Miguel Barreiro) Date: Mon, 12 Dec 2005 21:41:00 +0100 Subject: Large files In-Reply-To: References: <1134387798.439d6256a84e9@webmail.alfa21.com> Message-ID: <1134420060.439de05c466d4@webmail.alfa21.com> Raimo Niskanen wrote: > This feature was actually on its way into R10B-9, but in the last > minute it turned out that it broke the possibility of using > cpu_timestamp on call traces, so we are working on an improved > solution... Could you please elaborate on how the cpu_timestamp trace option interacts with this? I'm intrigued. > > Hi, > > > > Support for large files (large being >= 2GB which is actually "moderately > sized > > files" these days) works ok on 64-bit systems. Doesn't anyone else use > large > > files on 32-bit systems? In case people is interested it works with the > > following recipe: > > - Either patch the file driver to open files with O_LARGEFILE and change a > > couple variables from off_t to off64_t and make sure they are correctly > packed > > into 64-bit commands and responses or, much simpler: > > $ export CFLAGS="-D_FILE_OFFSET_BITS=64" ; ./configure ; make > > (remember to use clean sources). See the libc documentation for details on > the > > _FILE_OFFSET_BITS flag. > > > > - Apply the attached patch to make file:position/2 work correctly > (everything > > else works without the patch, AFAIK). Currently > > erts/emulator/drivers/common/efile_drv.c packs the return value of lseek(2) > > using reply_Uint (which BTW is a bit misleading -- Uint is typedef'ed to a > > pointer-sized variable and not an unsigned int as I would tend to expect. > These > > don't always match). The return value of lseek is off_t which may not be > Uint > > sized, so I added a reply_off_t function. > > Patch generated against R108-B. > > > > > > Regards, > > > > Miguel > > > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > From raimo@REDACTED Tue Dec 13 09:41:39 2005 From: raimo@REDACTED (Raimo Niskanen) Date: 13 Dec 2005 09:41:39 +0100 Subject: Large files References: <1134387798.439d6256a84e9@webmail.alfa21.com>, , <1134420060.439de05c466d4@webmail.alfa21.com> Message-ID: Ok, elaborating... To activate cpu_timestamp the process has to activate micro-level- process accounting like this (from sys.c): int sys_start_hrvtime(void) { long msacct = PR_MSACCT; int fd; if ( (fd = open("/proc/self", O_WRONLY)) == -1) { return -1; } if (ioctl(fd, PIOCSET, &msacct) < 0) { close(fd); return -2; } close(fd); return 0; } that is: write an ioctl to the /proc filesystem, and in the lfcompile(5) man page it says: NOTES Certain system-specific or non-portable interfaces are not usable in the large file compilation environment. Known cases are: : : o Interfaces to /proc defined in . Programs that use these interfaces should not be compiled in the large file compilation environment. As a partial safe- guard against making this mistake, including either of the or header files will induce a com- pilation error when the large file compilation environment is enabled. So, the configure test for this feature does not even compile. We will try to work around this problem by compiling just the file containing sys_start_hrvtime without the large file compilation flags -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64, and hope that file still can be linked with the others and that it works. ...elaboration done. > Raimo Niskanen wrote: > > > This feature was actually on its way into R10B-9, but in the last > > minute it turned out that it broke the possibility of using > > cpu_timestamp on call traces, so we are working on an improved > > solution... > > Could you please elaborate on how the cpu_timestamp trace option interacts with > this? I'm intrigued. > > > > Hi, > > > > > > Support for large files (large being >= 2GB which is actually "moderately > > sized > > > files" these days) works ok on 64-bit systems. Doesn't anyone else use > > large > > > files on 32-bit systems? In case people is interested it works with the > > > following recipe: > > > - Either patch the file driver to open files with O_LARGEFILE and change a > > > couple variables from off_t to off64_t and make sure they are correctly > > packed > > > into 64-bit commands and responses or, much simpler: > > > $ export CFLAGS="-D_FILE_OFFSET_BITS=64" ; ./configure ; make > > > (remember to use clean sources). See the libc documentation for details on > > the > > > _FILE_OFFSET_BITS flag. > > > > > > - Apply the attached patch to make file:position/2 work correctly > > (everything > > > else works without the patch, AFAIK). Currently > > > erts/emulator/drivers/common/efile_drv.c packs the return value of lseek(2) > > > using reply_Uint (which BTW is a bit misleading -- Uint is typedef'ed to a > > > pointer-sized variable and not an unsigned int as I would tend to expect. > > These > > > don't always match). The return value of lseek is off_t which may not be > > Uint > > > sized, so I added a reply_off_t function. > > > Patch generated against R108-B. > > > > > > > > > Regards, > > > > > > Miguel > > > > > > > -- > > > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > > -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From rikard.johansson@REDACTED Tue Dec 13 12:16:16 2005 From: rikard.johansson@REDACTED (Rikard Johansson) Date: Tue, 13 Dec 2005 12:16:16 +0100 Subject: Bug in etop_txt format Message-ID: <439EAD80.6070506@mobilearts.com> etop_txt presents the values wrong. The Format and Arguments in io:fwrite(?SYSFORM, [...]) are mismatched. This bug exists in at least R10B-6. The following patch corrects the problem. # diff etop_txt.erl.orig etop_txt.erl 57,59c57,61 < io:fwrite(Fd,?SYSFORM, [Config#opts.node,Clock,Cpu,Tot,NProcs,Procs, < RQ,Atom,Bin,Code,Ets]), < io:nl(Fd), --- > io:fwrite(Fd,?SYSFORM, [Config#opts.node,Clock, > Cpu,Tot,Bin, > NProcs,Procs,Code, > RQ,Atom,Ets]), > io:nl(Fd), /Rikard From mickael.remond@REDACTED Fri Dec 16 10:56:44 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Fri, 16 Dec 2005 10:56:44 +0100 Subject: Kernel poll Linux 2.6 support Message-ID: <20051216095644.GA8127@memphis.process-one.net> Hello, Here is a patch we have been using with succes on several production site. It enables Linux 2.6 kernel poll support (enabled with ./configure --enable-kernel-poll) Then, you can enable Kernel polling from the command-line ./bin/erl +K true (This is what has already been integrated for FreeBSD). I have talk about it with some developers during EUC, and it seems that it could be a good addition to Erlang/OTP. Heavy networking is really impressive with this patch: CPU consumption is dramatically reduced. -- Micka?l R?mond http://www.process-one.net/ From mickael.remond@REDACTED Fri Dec 16 10:59:20 2005 From: mickael.remond@REDACTED (Mickael Remond) Date: Fri, 16 Dec 2005 10:59:20 +0100 Subject: Kernel poll Linux 2.6 support In-Reply-To: <20051216095644.GA8127@memphis.process-one.net> References: <20051216095644.GA8127@memphis.process-one.net> Message-ID: <20051216095920.GB7849@memphis.process-one.net> * Mickael Remond [2005-12-16 10:56:44 +0100]: > Hello, > > Here is a patch we have been using with succes on several production > site. > It enables Linux 2.6 kernel poll support > (enabled with ./configure --enable-kernel-poll) > > Then, you can enable Kernel polling from the command-line > ./bin/erl +K true > (This is what has already been integrated for FreeBSD). > > I have talk about it with some developers during EUC, and it seems that > it could be a good addition to Erlang/OTP. > Heavy networking is really impressive with this patch: CPU consumption > is dramatically reduced. Here is the patch. -- Micka?l R?mond http://www.process-one.net/ -------------- next part -------------- diff -ru ORIG_otp_src_R10B-8/erts/acconfig.h otp_src_R10B-8/erts/acconfig.h --- ORIG_otp_src_R10B-8/erts/acconfig.h 2005-06-21 09:37:40.000000000 -0700 +++ otp_src_R10B-8/erts/acconfig.h 2005-11-09 14:25:58.330158793 -0800 @@ -188,6 +188,9 @@ /* Define if you have the header file. */ #undef HAVE_LINUX_KPOLL_H +/* Define if you have the header file. */ +#undef HAVE_LINUX_EPOLL_H + /* Define if you have the header file. */ #undef HAVE_SYS_EVENT_H @@ -224,7 +227,7 @@ #if !defined(USE_SELECT) # if defined(ENABLE_KERNEL_POLL) -# if defined(HAVE_SYS_DEVPOLL_H) || defined(HAVE_LINUX_KPOLL_H) || defined(HAVE_SYS_EVENT_H) +# if defined(HAVE_SYS_DEVPOLL_H) || defined(HAVE_LINUX_KPOLL_H) || defined(HAVE_SYS_EVENT_H) || defined(HAVE_LINUX_KPOLL_H) # define USE_KERNEL_POLL # endif # endif diff -ru ORIG_otp_src_R10B-8/erts/config.h.in otp_src_R10B-8/erts/config.h.in --- ORIG_otp_src_R10B-8/erts/config.h.in 2005-10-25 02:50:42.000000000 -0700 +++ otp_src_R10B-8/erts/config.h.in 2005-11-09 14:25:58.330158793 -0800 @@ -175,6 +175,8 @@ /* Define if you have the header file. */ #undef HAVE_LINUX_KPOLL_H +/* Define if you have the header file. */ +#undef HAVE_LINUX_EPOLL_H /* Define if you have the header file. */ #undef HAVE_SYS_EVENT_H @@ -399,7 +401,7 @@ #if !defined(USE_SELECT) # if defined(ENABLE_KERNEL_POLL) -# if defined(HAVE_SYS_DEVPOLL_H) || defined(HAVE_LINUX_KPOLL_H) || defined(HAVE_SYS_EVENT_H) +# if defined(HAVE_SYS_DEVPOLL_H) || defined(HAVE_LINUX_KPOLL_H) || defined(HAVE_SYS_EVENT_H) || defined(HAVE_LINUX_EPOLL_H) # define USE_KERNEL_POLL # endif # endif Only in otp_src_R10B-8/erts: config.h.in.orig diff -ru ORIG_otp_src_R10B-8/erts/configure otp_src_R10B-8/erts/configure --- ORIG_otp_src_R10B-8/erts/configure 2005-10-25 02:50:36.000000000 -0700 +++ otp_src_R10B-8/erts/configure 2005-11-09 14:25:58.334158707 -0800 @@ -3716,6 +3716,151 @@ fi + +if test "${ac_cv_header_sys_epoll_h+set}" = set; then + echo "$as_me:$LINENO: checking for sys/epoll.h" >&5 +echo $ECHO_N "checking for sys/epoll.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_epoll_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_epoll_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_epoll_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking sys/epoll.h usability" >&5 +echo $ECHO_N "checking sys/epoll.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking sys/epoll.h presence" >&5 +echo $ECHO_N "checking sys/epoll.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: sys/epoll.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sys/epoll.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/epoll.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: sys/epoll.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: sys/epoll.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sys/epoll.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/epoll.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sys/epoll.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/epoll.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: sys/epoll.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/epoll.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: sys/epoll.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/epoll.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/epoll.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/epoll.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: sys/epoll.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for sys/epoll.h" >&5 +echo $ECHO_N "checking for sys/epoll.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_epoll_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_sys_epoll_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_epoll_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_epoll_h" >&6 + +fi +if test $ac_cv_header_sys_epoll_h = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_LINUX_EPOLL_H 1 +_ACEOF + +fi + echo $ac_n "checking for SO_BSDCOMPAT declaration""... $ac_c" 1>&6 echo "configure:3721: checking for SO_BSDCOMPAT declaration" >&5 if eval "test \"`echo '$''{'ac_cv_decl_so_bsdcompat'+set}'`\" = set"; then diff -ru ORIG_otp_src_R10B-8/erts/configure.in otp_src_R10B-8/erts/configure.in --- ORIG_otp_src_R10B-8/erts/configure.in 2005-10-24 02:43:05.000000000 -0700 +++ otp_src_R10B-8/erts/configure.in 2005-11-09 14:25:58.335158685 -0800 @@ -651,6 +651,7 @@ AC_CHECK_HEADER(sys/devpoll.h, AC_DEFINE(HAVE_SYS_DEVPOLL_H)) AC_CHECK_HEADER(linux/kpoll.h, AC_DEFINE(HAVE_LINUX_KPOLL_H)) AC_CHECK_HEADER(sys/event.h, AC_DEFINE(HAVE_SYS_EVENT_H)) +AC_CHECK_HEADER(sys/epoll.h, AC_DEFINE(HAVE_LINUX_EPOLL_H)) LM_DECL_SO_BSDCOMPAT LM_DECL_INADDR_LOOPBACK Only in otp_src_R10B-8/erts: configure.in.orig Only in otp_src_R10B-8/erts: configure.orig diff -ru ORIG_otp_src_R10B-8/erts/emulator/sys/unix/sys.c otp_src_R10B-8/erts/emulator/sys/unix/sys.c --- ORIG_otp_src_R10B-8/erts/emulator/sys/unix/sys.c 2005-08-29 06:13:36.000000000 -0700 +++ otp_src_R10B-8/erts/emulator/sys/unix/sys.c 2005-11-09 14:25:58.337158642 -0800 @@ -13,6 +13,12 @@ * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings * AB. All Rights Reserved.'' * + * 2005-08-31 + * This has been modified by Matthew Reilly of SIPphone Inc. to + * enable kernel poll (+K true) support via the epoll mechanism in Linux 2.6 + * Portions created by SIPphone Inc. are Copyright 2005, SIPphone Inc. + * These modifications are released under the Erlang Public License. + * * $Id$ */ @@ -50,6 +56,9 @@ # define USE_DEVPOLL # include # endif +# ifdef HAVE_LINUX_EPOLL_H /* Too minimize code changes, we pretend we have HAVE_LINUX_KPOLL_H as well */ +# define HAVE_LINUX_KPOLL_H 1 +# endif # ifdef HAVE_LINUX_KPOLL_H # define USE_DEVPOLL # include @@ -58,7 +67,11 @@ # ifndef POLLREMOVE # define POLLREMOVE 0x1000 /* some day it will make it to bits/poll.h ;-) */ # endif -# include +# ifdef HAVE_LINUX_EPOLL_H +# include +# else +# include +# endif # endif # ifdef USE_DEVPOLL /* can only use one of them ... */ # ifdef USE_KQUEUE @@ -201,8 +214,17 @@ static int dev_poll_fd; /* fd for /dev/poll */ #ifdef HAVE_LINUX_KPOLL_H + +#ifdef HAVE_LINUX_EPOLL_H +static struct epoll_event* dev_epoll_map; +/* XXX Implement correct mapping from POLLIN/POLLOUT to/from EPOLLIN/EPOLLOUT */ +/* Currenltly POLLIN/POLLOUT == EPOLLIN/EPOLLOUT. So these macros will work */ +#define EPOLL_TO_POLL(bit_map) (bit_map) +#define POLL_TO_EPOLL(bit_map) (bit_map & (EPOLLIN|EPOLLOUT)) +#else static char * dev_poll_map; /* mmap'ed area from kernel /dev/kpoll */ static struct k_poll dev_poll; /* control block for /dev/kpoll */ +#endif /* HAVE_LINUX_KPOLL_H */ static int max_poll_idx; /* highest non /dev/kpoll fd */ static void kpoll_enable(); @@ -212,7 +234,7 @@ static struct pollfd* dev_poll_rfds = NULL; /* Allocated at startup */ static void devpoll_init(void); -static void devpoll_update_pix(int pix); +static void devpoll_update_pix(int pix, int old_events); #ifdef HAVE_SYS_DEVPOLL_H static void devpoll_clear_pix(int pix); #endif /* HAVE_SYS_DEVPOLL_H */ @@ -2021,7 +2043,7 @@ #ifdef USE_DEVPOLL if (poll_fds[pix].events != old_events) - devpoll_update_pix(pix); + devpoll_update_pix(pix, old_events); #endif #ifdef USE_KQUEUE if (poll_fds[pix].events != old_events) @@ -2077,7 +2099,7 @@ if ( old_events && (dev_poll_fd != -1) ) { /* Tell /dev/[k]poll that we are not interested any more ... */ poll_fds[pix].events = POLLREMOVE; - devpoll_update_pix(pix); + devpoll_update_pix(pix, old_events); /* devpoll_update_pix may change the pix */ pix = fd_data[fd].pix; poll_fds[pix].events = 0; @@ -2134,7 +2156,7 @@ #ifdef HAVE_SYS_DEVPOLL_H devpoll_clear_pix(pix); #endif /* HAVE_SYS_DEVPOLL_H */ - devpoll_update_pix(pix); + devpoll_update_pix(pix, old_events); } #endif #ifdef USE_KQUEUE @@ -2692,6 +2714,27 @@ nof_ready_fds = vr; #if HAVE_LINUX_KPOLL_H +#ifdef HAVE_LINUX_EPOLL_H + if ( do_event_poll ) { + if ((r = epoll_wait(dev_poll_fd,dev_epoll_map,max_fd_plus_one,0)) > 0) { + for (i = 0; (i < r); i++) { + short revents = dev_epoll_map[i].events; + + if (revents != 0) { + int fd = dev_epoll_map[i].data.fd; + rp->pfd.fd = fd; + rp->pfd.events = poll_fds[fd_data[fd].pix].events; + rp->pfd.revents = EPOLL_TO_POLL(revents); + rp->iport = fd_data[fd].inport; + rp->oport = fd_data[fd].outport; + rp++; + nof_ready_fds ++; + } + } + } + } + +#else if ( do_event_poll ) { /* Now do the fast poll */ dev_poll.kp_timeout = 0; @@ -2714,6 +2757,7 @@ nof_ready_fds += r; } } +#endif /*HAVE_LINUX_EPOLL_H */ #endif } else { @@ -3622,6 +3666,20 @@ poll_fds[pix].revents = 0; } +#ifdef HAVE_LINUX_EPOLL_H +static void epoll_init() +{ + /* max_files is just a hint to the kernel */ + if ( (dev_poll_fd=epoll_create(max_files)) < 0 ) { + DEBUGF(("Will use poll()\n")); + dev_poll_fd = -1; /* We will not use ekpoll */ + } else { + DEBUGF(("Will use epoll\n")); + dev_epoll_map = (struct epoll_event *) erts_alloc(ERTS_ALC_T_POLL_FDS, (sizeof(struct epoll_event) * max_files)); + erts_sys_misc_mem_sz += sizeof(struct epoll_event) * max_files; + } +} +#else static void kpoll_init() { if ( (dev_poll_fd=open("/dev/kpoll",O_RDWR)) < 0 ) { @@ -3643,6 +3701,7 @@ dev_poll_rfds = NULL; } } +#endif /* HAVE_LINUX_EPOLL_H */ #endif /* HAVE_LINUX_KPOLL_H */ @@ -3672,7 +3731,11 @@ } else { /* Determine use of poll vs. /dev/poll at runtime */ #ifdef HAVE_LINUX_KPOLL_H +#ifdef HAVE_LINUX_EPOLL_H + epoll_init(); +#else kpoll_init(); +#endif #else #ifdef HAVE_SYS_DEVPOLL_H solaris_devpoll_init(); @@ -3698,7 +3761,7 @@ return count; } -static void devpoll_update_pix(int pix) +static void devpoll_update_pix(int pix, int old_events) { int res; @@ -3713,10 +3776,33 @@ #endif if ( dev_poll_fd != -1 ) { +#ifdef HAVE_LINUX_EPOLL_H + int events = poll_fds[pix].events; + int fd = poll_fds[pix].fd; + if (old_events && events & POLLREMOVE) { + /* Delete file descriptor from epoll list */ + res = epoll_ctl(dev_poll_fd,EPOLL_CTL_DEL,fd,NULL); + /* XXX check return code */ + } else { + struct epoll_event epoll_ctl_event; + epoll_ctl_event.data.fd = fd; + epoll_ctl_event.events = POLL_TO_EPOLL(events); + if (old_events) { + /* Modify exiting fd */ + res = epoll_ctl(dev_poll_fd,EPOLL_CTL_MOD,fd,&epoll_ctl_event); + /* XXX check return code */ + } else { + /* Add fd to epoll list */ + res = epoll_ctl(dev_poll_fd,EPOLL_CTL_ADD,fd,&epoll_ctl_event); + /* XXX check return code */ + } + } +#else if ( (res=devpoll_write(dev_poll_fd,&poll_fds[pix],sizeof(struct pollfd))) != (sizeof(struct pollfd)) ) { erl_exit(1,"Can't write to /dev/poll\n"); } +#endif /* HAVE_LINUX_EPOLL_H */ } #if HAVE_LINUX_KPOLL_H } else { From mange@REDACTED Fri Dec 16 22:58:54 2005 From: mange@REDACTED (Magnus Henoch) Date: Fri, 16 Dec 2005 22:58:54 +0100 Subject: Patch for setuid_socket_wrap Message-ID: <8764povh41.fsf@zemdatav.stor.no-ip.org> Simple patch for setuid_socket_wrap. On platforms where "char" is "unsigned char", c can never be EOF (since EOF is -1). Using an int instead fixes the problem. Magnus --- /usr/local/lib/erlang/erts-5.4.4/src/setuid_socket_wrap.c 2005-02-25 01:09:03.000000000 +0100 +++ setuid_socket_wrap.c 2005-12-16 22:50:03.000000000 +0100 @@ -175,7 +175,7 @@ { struct sock_list *sl = NULL, *sltmp = NULL; int count = 0; - char c; + int c; while ((c = getopt(argc, argv, "s:d:r:")) != EOF) switch (c) { From neumann@REDACTED Sat Dec 31 02:28:52 2005 From: neumann@REDACTED (Francois-Denis Gonthier) Date: Fri, 30 Dec 2005 20:28:52 -0500 Subject: Debian Bug #328031, Erlang 10.b.9 compile bug on Debian GNU/Linux SPARC Message-ID: <200512302028.59015.neumann@lostwebsite.net> tags 328031 + pending thanks Hello all this patch has been sent to me through Debian Bug Tracking system by Jurij Smakov. Link: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=328031 Here is what he has to say about the patch: "I am forwarding the information from upstream to the bug so that it will not get lost (see below). I've checked the build procedure and, indeed, the architecture detection is done by looking at the output of 'uname -m'. On Solaris this returns "sun4u" on ultrasparc hardware, our kernel returns 'sparc64'. I've made a simple patch against configure.ac (attached), which fixes the detection. When I apply this patch and the one mentioned earlier, the package builds fine. So if you have the reason to upload the 10.b.9 soon, please include them, at least it will not die while building on sparc. I see two other issues to take care of: the unreliability of the floating point exceptions which upstream mentioned, and the special flags which are passed to the assembler while building erlang. The former I'll have to look into, the latter might prevent the resulting binaries from working on sparc32 hardware. However, whether the support for such hardware will be included in etch is uncertain at this point, so this is not of immediate concern." I will include the patch in the Debian package, but I think it should also be considered for upstream inclusion. -------------- next part -------------- A non-text attachment was scrubbed... Name: erlang-arch.patch Type: text/x-diff Size: 294 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From neumann@REDACTED Sat Dec 31 03:17:30 2005 From: neumann@REDACTED (Francois-Denis Gonthier) Date: Fri, 30 Dec 2005 21:17:30 -0500 Subject: Debian Bug 345204: erlang: FTBFS on GNU/kFreeBSD Message-ID: <200512302117.30479.neumann@lostwebsite.net> tags 345204 pending thanks Hello, got this patch from Aurelien Jarno. erlang configure files do not detect the FreeBSD kernel on Debian GNU/kfreebsd. "erlang fails to build on GNU/kFreeBSD because of wrong checks in the configure file. It detects the Linux kernel instead of detecting GNU libc. Please find attached a patch to fix that. It would be nice if you could apply it in the next upload." GNU/kfreebsd is a port of the Debian GNU system to the FreeBSD kernel: http://www.debian.org/ports/kfreebsd-gnu/ http://bugs.debian.org/345204 -------------- next part -------------- A non-text attachment was scrubbed... Name: erlang.diff Type: text/x-diff Size: 786 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: