From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS47066 71.19.144.0/20 X-Spam-Status: No, score=-1.9 required=3.0 tests=AWL,BAYES_00, MSGID_FROM_MTA_HEADER shortcircuit=no autolearn=unavailable version=3.3.2 Path: news.gmane.org!not-for-mail From: Eric Wong Newsgroups: gmane.comp.lang.ruby.clogger.general Subject: [PATCH 1/6] blocking_helpers: remove fstat wrapper Date: Sat, 15 Feb 2014 23:09:03 +0000 Message-ID: <1392505748-13740-1-git-send-email-normalperson@yhbt.net> References: <1392505748-13740-1-git-send-email-normalperson@yhbt.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1392505760 6996 80.91.229.3 (15 Feb 2014 23:09:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 15 Feb 2014 23:09:20 +0000 (UTC) To: clogger@librelist.org Original-X-From: clogger@librelist.org Sun Feb 16 00:09:28 2014 Return-path: Envelope-to: gcrcg-clogger@m.gmane.org In-Reply-To: <1392505748-13740-1-git-send-email-normalperson@yhbt.net> List-Archive: List-Help: List-Id: List-Post: List-Subscribe: List-Unsubscribe: Precedence: list Original-Sender: clogger@librelist.org Xref: news.gmane.org gmane.comp.lang.ruby.clogger.general:63 Archived-At: Received: from zedshaw2.xen.prgmr.com ([71.19.156.177]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WEoMS-0000wz-BA for gcrcg-clogger@m.gmane.org; Sun, 16 Feb 2014 00:09:28 +0100 Received: from zedshaw2.xen.prgmr.com (unknown [IPv6:::1]) by zedshaw2.xen.prgmr.com (Postfix) with ESMTP id 69A657501A for ; Sat, 15 Feb 2014 23:18:30 +0000 (UTC) The fstat syscall should never take long, even on sockets and slow FSes. --- ext/clogger_ext/blocking_helpers.h | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/ext/clogger_ext/blocking_helpers.h b/ext/clogger_ext/blocking_helpers.h index dd46cea..bb366ff 100644 --- a/ext/clogger_ext/blocking_helpers.h +++ b/ext/clogger_ext/blocking_helpers.h @@ -18,22 +18,6 @@ static int my_stat(const char *path, struct stat *buf) rb_thread_blocking_region((fn),(data), RUBY_UBF_IO, 0) #endif -struct fstat_args { int fd; struct stat *buf; }; -static VALUE ng_fstat(void *ptr) -{ - struct fstat_args *a = ptr; - return (VALUE)fstat(a->fd, a->buf); -} - -static int my_fstat(int fd, struct stat *buf) -{ - struct fstat_args a; - - a.fd = fd; - a.buf = buf; - return (int)rb_thread_io_blocking_region(ng_fstat, &a, fd); -} - struct write_args { int fd; const void *buf; size_t count; }; static VALUE ng_write(void *ptr) { @@ -53,6 +37,5 @@ static ssize_t my_write(int fd, const void *buf, size_t count) return r; } # define stat(fd,buf) my_stat((fd),(buf)) -# define fstat(fd,buf) my_fstat((fd),(buf)) # define write(fd,buf,count) my_write((fd),(buf),(count)) #endif -- 1.9.0.rc3.13.gda73b5f