From owner-freebsd-standards Sun Sep 22 21: 6:37 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 115C837B401 for ; Sun, 22 Sep 2002 21:06:33 -0700 (PDT) Received: from espresso.q9media.com (espresso.q9media.com [65.39.129.122]) by mx1.FreeBSD.org (Postfix) with ESMTP id A068743E3B for ; Sun, 22 Sep 2002 21:06:32 -0700 (PDT) (envelope-from mike@espresso.q9media.com) Received: by espresso.q9media.com (Postfix, from userid 1002) id C23F79C11; Sun, 22 Sep 2002 23:59:43 -0400 (EDT) Date: Sun, 22 Sep 2002 23:59:43 -0400 From: Mike Barcroft To: standards@FreeBSD.org Cc: Josef Karthauser Subject: select.diff for review Message-ID: <20020922235943.G91924@espresso.q9media.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="RIYY1s2vRbPFwWeW" Content-Disposition: inline Organization: The FreeBSD Project Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --RIYY1s2vRbPFwWeW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Attached is a patch which makes much more conformant by bringing over components from . Comments appreciated. Best regards, Mike Barcroft --RIYY1s2vRbPFwWeW Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="select.diff" o Move select() helper macros from to . o Include from in the __BSD_VISIBLE case, so applications and base software can be slowly updated. o Prototype select() in . It was previously only prototyped in . o Add some XXX's to . Index: include/unistd.h =================================================================== RCS file: /work/repo/src/include/unistd.h,v retrieving revision 1.58 diff -u -r1.58 unistd.h --- include/unistd.h 21 Sep 2002 02:08:32 -0000 1.58 +++ include/unistd.h 23 Sep 2002 00:32:15 -0000 @@ -489,7 +489,12 @@ int rresvport_af(int *, int); int ruserok(const char *, int, const char *, const char *); void *sbrk(intptr_t); +#if __BSD_VISIBLE +#ifndef _SELECT_DECLARED +#define _SELECT_DECLARED int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); +#endif +#endif int setdomainname(const char *, int); int setgroups(int, const gid_t *); void sethostid(long); Index: sys/sys/select.h =================================================================== RCS file: /work/repo/src/sys/sys/select.h,v retrieving revision 1.13 diff -u -r1.13 select.h --- sys/sys/select.h 16 Jun 2002 18:40:16 -0000 1.13 +++ sys/sys/select.h 23 Sep 2002 03:49:52 -0000 @@ -43,23 +43,61 @@ #include /* + * XXX * Other things required for this header which we do not presently implement: * * struct timeval (with suseconds_t) - * fd_set - * FD_* macros - * - * Temporarily get all of these things from , which has too - * much pollution to be used here but will do for now. (Eventually, the - * latter two will move to this file and be included *from* - * in the BSD namespace.) */ -#include /* XXX dependency reversed */ + +typedef unsigned long __fd_mask; +#if __BSD_VISIBLE +typedef __fd_mask fd_mask; +#endif + +/* + * Select uses bit masks of file descriptors in longs. These macros + * manipulate such bit fields (the filesystem macros use chars). + * FD_SETSIZE may be defined by the user, but the default here should + * be enough for most uses. + */ +#ifndef FD_SETSIZE +#define FD_SETSIZE 1024U +#endif + +#define _NFDBITS (sizeof(__fd_mask) * 8) /* bits per mask */ +#if __BSD_VISIBLE +#define NFDBITS _NFDBITS +#endif + +#ifndef _howmany +#define _howmany(x, y) (((x) + ((y) - 1U)) / (y)) +#endif + +typedef struct fd_set { + __fd_mask fds_bits[_howmany(FD_SETSIZE, _NFDBITS)]; +} fd_set; + +#define _fdset_mask(n) ((fd_mask)1 << ((n) % _NFDBITS)) +#define FD_CLR(n, p) ((p)->fds_bits[(n)/_NFDBITS] &= ~_fdset_mask(n)) +#if __BSD_VISIBLE +/* XXX bcopy() not in scope, so is required; see also FD_ZERO(). */ +#define FD_COPY(f, t) bcopy(f, t, sizeof(*(f))) +#endif +#define FD_ISSET(n, p) ((p)->fds_bits[(n)/_NFDBITS] & _fdset_mask(n)) +#define FD_SET(n, p) ((p)->fds_bits[(n)/_NFDBITS] |= _fdset_mask(n)) +#define FD_ZERO(p) bzero(p, sizeof(*(p))) #ifndef _KERNEL +struct timeval; + __BEGIN_DECLS int pselect(int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, const struct timespec *__restrict, const sigset_t *__restrict); +#ifndef _SELECT_DECLARED +#define _SELECT_DECLARED +/* XXX missing restrict type-qualifier */ +int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); +#endif __END_DECLS #endif /* !_KERNEL */ Index: sys/sys/types.h =================================================================== RCS file: /work/repo/src/sys/sys/types.h,v retrieving revision 1.70 diff -u -r1.70 types.h --- sys/sys/types.h 17 Sep 2002 05:05:14 -0000 1.70 +++ sys/sys/types.h 23 Sep 2002 00:33:48 -0000 @@ -255,41 +255,28 @@ #define _TIMER_T_DECLARED #endif -#if __BSD_VISIBLE -#define NBBY 8 /* number of bits in a byte */ - /* - * Select uses bit masks of file descriptors in longs. These macros - * manipulate such bit fields (the filesystem macros use chars). - * FD_SETSIZE may be defined by the user, but the default here should - * be enough for most uses. + * The following are all things that really shouldn't exist in this header, + * since its purpose is to provide typedefs, not miscellaneous doodads. */ -#ifndef FD_SETSIZE -#define FD_SETSIZE 1024U -#endif +#if __BSD_VISIBLE -typedef unsigned long fd_mask; -#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ +#include +/* XXX should be moved to . */ +#define NBBY 8 /* number of bits in a byte */ + +/* XXX should be removed, since has this. */ #ifndef howmany #define howmany(x, y) (((x) + ((y) - 1U)) / (y)) #endif -typedef struct fd_set { - fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; -} fd_set; - -#define _fdset_mask(n) ((fd_mask)1 << ((n) % NFDBITS)) -#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= _fdset_mask(n)) -#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~_fdset_mask(n)) -#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & _fdset_mask(n)) -#define FD_COPY(f, t) bcopy(f, t, sizeof(*(f))) -#define FD_ZERO(p) bzero(p, sizeof(*(p))) - /* * These declarations belong elsewhere, but are repeated here and in * to give broken programs a better chance of working with * 64-bit off_t's. + * + * XXX is this still needed? */ #ifndef _KERNEL __BEGIN_DECLS --RIYY1s2vRbPFwWeW-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Mon Sep 23 6:45:33 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B1F8837B401; Mon, 23 Sep 2002 06:45:32 -0700 (PDT) Received: from smtp02.iprimus.net.au (smtp02.iprimus.net.au [210.50.76.70]) by mx1.FreeBSD.org (Postfix) with ESMTP id D296143E65; Mon, 23 Sep 2002 06:45:31 -0700 (PDT) (envelope-from tim@robbins.dropbear.id.au) Received: from dilbert.robbins.dropbear.id.au ([210.50.81.159]) by smtp02.iprimus.net.au with Microsoft SMTPSVC(5.0.2195.4617); Mon, 23 Sep 2002 23:45:29 +1000 Received: from dilbert.robbins.dropbear.id.au (irdmttc5mx3dpfl8@localhost [127.0.0.1]) by dilbert.robbins.dropbear.id.au (8.12.6/8.12.6) with ESMTP id g8NDjQCj027636; Mon, 23 Sep 2002 23:45:27 +1000 (EST) (envelope-from tim@dilbert.robbins.dropbear.id.au) Received: (from tim@localhost) by dilbert.robbins.dropbear.id.au (8.12.6/8.12.6/Submit) id g8NDjNhL027635; Mon, 23 Sep 2002 23:45:23 +1000 (EST) (envelope-from tim) Date: Mon, 23 Sep 2002 23:45:23 +1000 From: Tim Robbins To: Mike Barcroft Cc: standards@FreeBSD.org, Josef Karthauser Subject: Re: select.diff for review Message-ID: <20020923234523.A27512@dilbert.robbins.dropbear.id.au> References: <20020922235943.G91924@espresso.q9media.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20020922235943.G91924@espresso.q9media.com>; from mike@FreeBSD.org on Sun, Sep 22, 2002 at 11:59:43PM -0400 X-OriginalArrivalTime: 23 Sep 2002 13:45:30.0527 (UTC) FILETIME=[7B5AE2F0:01C26307] Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, Sep 22, 2002 at 11:59:43PM -0400, Mike Barcroft wrote: > Attached is a patch which makes much more conformant by > bringing over components from . Comments appreciated. [...] > Index: include/unistd.h [...] > +#if __BSD_VISIBLE > +#ifndef _SELECT_DECLARED > +#define _SELECT_DECLARED > int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); > +#endif > +#endif I think it's probably better if you don't test whether select() has been declared, and simply declare it anyway. If the two prototypes get out of sync with each other, the compiler will warn, otherwise it's harmless. Tim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Mon Sep 23 9: 0:25 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CD3D637B401; Mon, 23 Sep 2002 09:00:24 -0700 (PDT) Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by mx1.FreeBSD.org (Postfix) with ESMTP id 30ACC43E3B; Mon, 23 Sep 2002 09:00:24 -0700 (PDT) (envelope-from wollman@khavrinen.lcs.mit.edu) Received: from khavrinen.lcs.mit.edu (localhost [IPv6:::1]) by khavrinen.lcs.mit.edu (8.12.3/8.12.5) with ESMTP id g8NG0NVo081959 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Mon, 23 Sep 2002 12:00:23 -0400 (EDT) (envelope-from wollman@khavrinen.lcs.mit.edu) Received: (from wollman@localhost) by khavrinen.lcs.mit.edu (8.12.3/8.12.5/Submit) id g8NG0Mod081956; Mon, 23 Sep 2002 12:00:22 -0400 (EDT) (envelope-from wollman) Date: Mon, 23 Sep 2002 12:00:22 -0400 (EDT) From: Garrett Wollman Message-Id: <200209231600.g8NG0Mod081956@khavrinen.lcs.mit.edu> To: Tim Robbins Cc: standards@FreeBSD.ORG Subject: Re: select.diff for review In-Reply-To: <20020923234523.A27512@dilbert.robbins.dropbear.id.au> References: <20020922235943.G91924@espresso.q9media.com> <20020923234523.A27512@dilbert.robbins.dropbear.id.au> Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG < said: > I think it's probably better if you don't test whether select() has been > declared, and simply declare it anyway. If the two prototypes get out of > sync with each other, the compiler will warn, otherwise it's harmless. It's harmless except when GCC is compiling both definitions under -Werror -Wredundant-decls. See the implementation of WARNS in bsd.*.mk. -GAWollman To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Tue Sep 24 4:10: 8 2002 Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A7D7A37B401 for ; Tue, 24 Sep 2002 04:10:06 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0370E43E77 for ; Tue, 24 Sep 2002 04:10:05 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g8OBA5Co021374 for ; Tue, 24 Sep 2002 04:10:05 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g8OBA5cD021373; Tue, 24 Sep 2002 04:10:05 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 947C737B40A; Tue, 24 Sep 2002 04:01:55 -0700 (PDT) Received: from fafoe.dyndns.org (chello212186121237.14.vie.surfer.at [212.186.121.237]) by mx1.FreeBSD.org (Postfix) with ESMTP id D226843E91; Tue, 24 Sep 2002 04:01:54 -0700 (PDT) (envelope-from stefan@fafoe.dyndns.org) Received: by frog.fafoe (Postfix, from userid 1001) id 264562C; Tue, 24 Sep 2002 13:01:54 +0200 (CEST) Message-Id: <20020924110154.264562C@frog.fafoe> Date: Tue, 24 Sep 2002 13:01:54 +0200 (CEST) From: Stefan Farfeleder Reply-To: Stefan Farfeleder To: FreeBSD-gnats-submit@FreeBSD.org Cc: mike@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: standards/43326: [PATCH?] needs previous inclusion of Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG >Number: 43326 >Category: standards >Synopsis: [PATCH?] needs previous inclusion of >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-standards >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Sep 24 04:10:05 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Stefan Farfeleder >Release: FreeBSD 5.0-CURRENT i386 >Organization: >Environment: System: FreeBSD frog.fafoe 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Mon Sep 23 18:09:18 CEST 2002 freebsd@frog.fafoe:/freebsd/current/obj/freebsd/current/src/sys/FROG i386 >Description: This commit: mike 2002/09/17 22:51:23 PDT Modified files: include nl_types.h sys/sys _types.h Log: Move definition of nl_item type to , so that it can be shared. Revision Changes Path 1.9 +5 -1 src/include/nl_types.h 1.8 +1 -0 src/sys/sys/_types.h made it necessary to include sys/_types.h before including nl_types.h since the new typedef of __nl_item was put into the former header. >How-To-Repeat: ports/x11-wm/blackbox doens't build anymore on -current because of this. According to catopen(3), the following test program should compile: #include int main(void) { catopen("", 0); return 0; } >Fix: If nl_types.h would include sys/_types.h itself instead of sys/cdefs.h, the old behaviour would be restored. I don't know whether this would introduce any namespace pollution. --- nl_types.h.orig Mon Sep 23 19:35:23 2002 +++ nl_types.h Tue Sep 24 12:03:27 2002 @@ -34,7 +34,7 @@ #ifndef _NL_TYPES_H_ #define _NL_TYPES_H_ -#include +#include #define NL_SETD 0 #define NL_CAT_LOCALE 1 >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Tue Sep 24 8:30:10 2002 Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ACFC637B401 for ; Tue, 24 Sep 2002 08:30:08 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 914C543E6E for ; Tue, 24 Sep 2002 08:30:07 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g8OFU7Co028558 for ; Tue, 24 Sep 2002 08:30:07 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g8OFU7fh028557; Tue, 24 Sep 2002 08:30:07 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3174637B401 for ; Tue, 24 Sep 2002 08:23:22 -0700 (PDT) Received: from mta10.srv.hcvlny.cv.net (mta10.srv.hcvlny.cv.net [167.206.5.45]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9442643E65 for ; Tue, 24 Sep 2002 08:23:21 -0700 (PDT) (envelope-from agapon@excite.com) Received: from edge.foundation.invalid (ool-182f9083.dyn.optonline.net [24.47.144.131]) by mta10.srv.hcvlny.cv.net (iPlanet Messaging Server 5.2 HotFix 0.9 (built Jul 29 2002)) with ESMTP id <0H2Y004WN82W3R@mta10.srv.hcvlny.cv.net> for FreeBSD-gnats-submit@freebsd.org; Tue, 24 Sep 2002 11:23:20 -0400 (EDT) Received: from edge.foundation.invalid (localhost.foundation.invalid [127.0.0.1]) by edge.foundation.invalid (8.12.3/8.12.3) with ESMTP id g8OFNJCZ081509 for ; Tue, 24 Sep 2002 11:23:19 -0400 Received: (from avg@localhost) by edge.foundation.invalid (8.12.3/8.12.3/Submit) id g8OFNJp8081508; Tue, 24 Sep 2002 11:23:19 -0400 (EDT) Message-Id: <200209241523.g8OFNJp8081508@edge.foundation.invalid> Date: Tue, 24 Sep 2002 11:23:19 -0400 (EDT) From: Andriy Gapon Reply-To: Andriy Gapon To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: standards/43335: libc_r: execve() and close-on-exec flag, interrupted write() Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG >Number: 43335 >Category: standards >Synopsis: libc_r: execve() and close-on-exec flag, interrupted write() >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-standards >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Sep 24 08:30:05 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Andriy Gapon >Release: FreeBSD 4.6.2-RELEASE-p2 i386 >Organization: none >Environment: System: FreeBSD edge.foundation.invalid 4.6.2-RELEASE-p2 FreeBSD 4.6.2-RELEASE-p2 #5: Sat Sep 21 22:13:59 EDT 2002 avg@edge.foundation.invalid:/sys-devel/obj/sys-devel/src/sys/EDGE_ATAPICAM i386 >Description: 1. write() doesn't set errno to EINTR if thread receives a signal while being on a queue waiting for a data on a descriptor. 2. in the case above, write() always returns -1 regardless of wheather it was able to write part of data on previous attempts, I believe it should return number of bytes written thus far. 3. likewise, in the case "real" write() system call returns value < 0, libc_r write() retruns the same value, although some data might have been written on the previous attempts. 4. libc_r execve() sets all descriptors that were not set expicitely to non-blocking mode to blocking mode before doing "real" execve, which is good and done with non-multithreaded programs possibly being exec'ed in mind. However, it has a painful effect if this is done as part of spawning another process (fork+exec), obviously all descriptors in a parent become blocking that effectively kills multithreading during IO. I think there is no other option if a programmer really means to share descriptors between a multithreaded and a singlethreaded program. However, in the case close-on-exec flag is set on the descriptor, I think, it's better to leave the descriptor as is, in the non-blocking mode. >How-To-Repeat: sorry, that there is no test code, but for 1-3 possibility is obvious from the code. for 4, all you need to do is set close-on-exec flag on some descriptor that references for example a fifo, spawn a child process and see that if read from the fifo would block the whole process is blocked instead of a calling thread only. >Fix: see attached file >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Tue Sep 24 8:40: 8 2002 Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C6EEE37B401 for ; Tue, 24 Sep 2002 08:40:05 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6949F43E75 for ; Tue, 24 Sep 2002 08:40:05 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g8OFe5Co048918 for ; Tue, 24 Sep 2002 08:40:05 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g8OFe4k8048917; Tue, 24 Sep 2002 08:40:04 -0700 (PDT) Date: Tue, 24 Sep 2002 08:40:04 -0700 (PDT) Message-Id: <200209241540.g8OFe4k8048917@freefall.freebsd.org> To: freebsd-standards@FreeBSD.org Cc: From: Andriy Gapon Subject: Re: standards/43335: libc_r: execve() and close-on-exec flag, interrupted write() Reply-To: Andriy Gapon Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG The following reply was made to PR standards/43335; it has been noted by GNATS. From: Andriy Gapon To: FreeBSD-gnats-submit@FreeBSD.org Cc: Subject: Re: standards/43335: libc_r: execve() and close-on-exec flag, interrupted write() Date: Tue, 24 Sep 2002 11:38:55 -0400 (EDT) sorry send-pr has not attached a patch file somehow here it is: diff -crN lib/libc_r/uthread.orig/uthread_execve.c lib/libc_r/uthread/uthread_execve.c *** lib/libc_r/uthread.orig/uthread_execve.c Mon Sep 23 20:27:51 2002 --- lib/libc_r/uthread/uthread_execve.c Mon Sep 23 20:28:11 2002 *************** *** 67,76 **** /* Check if this file descriptor is in use: */ if (_thread_fd_table[i] != NULL && !(_thread_fd_table[i]->flags & O_NONBLOCK)) { ! /* Get the current flags: */ ! flags = _thread_sys_fcntl(i, F_GETFL, NULL); ! /* Clear the nonblocking file descriptor flag: */ ! _thread_sys_fcntl(i, F_SETFL, flags & ~O_NONBLOCK); } } --- 67,83 ---- /* Check if this file descriptor is in use: */ if (_thread_fd_table[i] != NULL && !(_thread_fd_table[i]->flags & O_NONBLOCK)) { ! /* get close-on-exec flag */ ! int fd_flags = _thread_sys_fcntl(i, F_GETFD, NULL); ! if (fd_flags & FD_CLOEXEC == 1) { ! /* don't bother */ ! } ! else { ! /* Get the current flags: */ ! flags = _thread_sys_fcntl(i, F_GETFL, NULL); ! /* Clear the nonblocking file descriptor flag: */ ! _thread_sys_fcntl(i, F_SETFL, flags & ~O_NONBLOCK); ! } } } diff -crN lib/libc_r/uthread.orig/uthread_write.c lib/libc_r/uthread/uthread_write.c *** lib/libc_r/uthread.orig/uthread_write.c Mon Sep 23 20:27:51 2002 --- lib/libc_r/uthread/uthread_write.c Mon Sep 23 20:28:11 2002 *************** *** 108,115 **** * interrupted by a signal */ if (_thread_run->interrupted) { ! /* Return an error: */ ! ret = -1; } /* --- 108,120 ---- * interrupted by a signal */ if (_thread_run->interrupted) { ! if(num > 0) ! ret = num; ! else { ! /* Return an error: */ ! errno = EINTR; ! ret = -1; ! } } /* -- Andriy Gapon * Hang on tightly, let go lightly. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Tue Sep 24 10:30:52 2002 Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6C70137B401; Tue, 24 Sep 2002 10:30:51 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 78DE043EB2; Tue, 24 Sep 2002 10:30:49 -0700 (PDT) (envelope-from mike@FreeBSD.org) Received: from freefall.freebsd.org (mike@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g8OHUnCo081513; Tue, 24 Sep 2002 10:30:49 -0700 (PDT) (envelope-from mike@freefall.freebsd.org) Received: (from mike@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g8OHUmol081502; Tue, 24 Sep 2002 10:30:48 -0700 (PDT) Date: Tue, 24 Sep 2002 10:30:48 -0700 (PDT) From: Mike Barcroft Message-Id: <200209241730.g8OHUmol081502@freefall.freebsd.org> To: e0026813@stud3.tuwien.ac.at, mike@FreeBSD.org, freebsd-standards@FreeBSD.org Subject: Re: standards/43326: [PATCH?] needs previous inclusion of Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Synopsis: [PATCH?] needs previous inclusion of State-Changed-From-To: open->closed State-Changed-By: mike State-Changed-When: Tue Sep 24 10:29:51 PDT 2002 State-Changed-Why: Problem fixed. http://www.freebsd.org/cgi/query-pr.cgi?pr=43326 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message