From owner-freebsd-standards@FreeBSD.ORG Sun Jan 3 01:10:02 2010 Return-Path: Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 778BF10656A3 for ; Sun, 3 Jan 2010 01:10:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 3AAE78FC22 for ; Sun, 3 Jan 2010 01:10:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id o031A2UN006543 for ; Sun, 3 Jan 2010 01:10:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id o031A2Tb006542; Sun, 3 Jan 2010 01:10:02 GMT (envelope-from gnats) Resent-Date: Sun, 3 Jan 2010 01:10:02 GMT Resent-Message-Id: <201001030110.o031A2Tb006542@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-standards@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Kevin Barry Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60DC11065676 for ; Sun, 3 Jan 2010 01:04:52 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 4F6408FC1A for ; Sun, 3 Jan 2010 01:04:52 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o0314pLL008677 for ; Sun, 3 Jan 2010 01:04:51 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o0314pUt008675; Sun, 3 Jan 2010 01:04:51 GMT (envelope-from nobody) Message-Id: <201001030104.o0314pUt008675@www.freebsd.org> Date: Sun, 3 Jan 2010 01:04:51 GMT From: Kevin Barry To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: standards/142255: scandir prototype in dirent.h isn't compliant with POSIX 2008 X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jan 2010 01:10:02 -0000 >Number: 142255 >Category: standards >Synopsis: scandir prototype in dirent.h isn't compliant with POSIX 2008 >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: Sun Jan 03 01:10:01 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Kevin Barry >Release: 8.0-RELEASE >Organization: >Environment: FreeBSD kpbarry.student.cwru.edu 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Sat Nov 21 15:02:08 UTC 2009 root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 >Description: The POSIX standard declares 'scandir' as follows, copied directly: int scandir(const char *dir, struct dirent ***namelist, int (*sel)(const struct dirent *), int (*compar)(const struct dirent **, const struct dirent **)); The problem in FreeBSD is the 'sel' argument, which is a pointer to a function taking a 'struct dirent *' without the 'const'. This is a problem when trying to write POSIX-portable code. In C I only receive a warning when trying to pass a function pointer of the correct type, however, in C++ this is an error. An argument cast isn't the solution because I still need my code to work in Linux; therefore, I've had to separate the call to 'scandir' in a C file, separate from the C++ code. Another solution is to C-cast a pointer to 'scandir' and dereference it, which I might consider. Thanks! Kevin Barry >How-To-Repeat: #include static int sel(const struct dirent*) { return 1; } int main() { scandir(0, 0, &sel, 0); } Compile the above with g++. >Fix: Change the prototype of 'scandir' in dirent.h. >Release-Note: >Audit-Trail: >Unformatted: From owner-freebsd-standards@FreeBSD.ORG Sun Jan 3 15:00:11 2010 Return-Path: Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E89251065676 for ; Sun, 3 Jan 2010 15:00:11 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id BD00A8FC13 for ; Sun, 3 Jan 2010 15:00:11 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id o03F0B8L042965 for ; Sun, 3 Jan 2010 15:00:11 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id o03F0BO3042964; Sun, 3 Jan 2010 15:00:11 GMT (envelope-from gnats) Date: Sun, 3 Jan 2010 15:00:11 GMT Message-Id: <201001031500.o03F0BO3042964@freefall.freebsd.org> To: freebsd-standards@FreeBSD.org From: Kostik Belousov Cc: Subject: Re: standards/142255: scandir prototype in dirent.h isn't compliant with POSIX 2008 X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Kostik Belousov List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jan 2010 15:00:12 -0000 The following reply was made to PR standards/142255; it has been noted by GNATS. From: Kostik Belousov To: Kevin Barry Cc: freebsd-gnats-submit@freebsd.org Subject: Re: standards/142255: scandir prototype in dirent.h isn't compliant with POSIX 2008 Date: Sun, 3 Jan 2010 16:35:48 +0200 --XIiC+We3v3zHqZ6Z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable The change of the prototype shall also fix alphasort(3). And then, each in-tree consumer should be updated. scandir(3) is historical BSD interface, that only appeared in SUSv4. It seems that Solaris and possibly glibc are conforming, so FreeBSD should probably follow the route. Test the patch below. diff --git a/include/dirent.h b/include/dirent.h index 63626b5..8d7e5c1 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -95,7 +95,7 @@ typedef void * DIR; __BEGIN_DECLS #if __BSD_VISIBLE DIR *__opendir2(const char *, int); -int alphasort(const void *, const void *); +int alphasort(const struct dirent **, const struct dirent **); int getdents(int, char *, int); int getdirentries(int, char *, int, long *); #endif @@ -109,7 +109,8 @@ int readdir_r(DIR *, struct dirent *, struct dirent **= ); void rewinddir(DIR *); #if __BSD_VISIBLE int scandir(const char *, struct dirent ***, - int (*)(struct dirent *), int (*)(const void *, const void *)); + int (*)(const struct dirent *), int (*)(const struct dirent **, + const struct dirent **)); #endif #if __XSI_VISIBLE void seekdir(DIR *, long); diff --git a/lib/libc/gen/opendir.c b/lib/libc/gen/opendir.c index 9625ec6..631c4d6 100644 --- a/lib/libc/gen/opendir.c +++ b/lib/libc/gen/opendir.c @@ -240,7 +240,8 @@ __opendir_common(int fd, const char *name, int flags) /* * This sort must be stable. */ - mergesort(dpv, n, sizeof(*dpv), alphasort); + mergesort(dpv, n, sizeof(*dpv), (int (*)(const + void *, const void *))alphasort); =20 dpv[n] =3D NULL; xp =3D NULL; diff --git a/lib/libc/gen/scandir.3 b/lib/libc/gen/scandir.3 index 42ccac2..c5367d3 100644 --- a/lib/libc/gen/scandir.3 +++ b/lib/libc/gen/scandir.3 @@ -28,7 +28,7 @@ .\" @(#)scandir.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd January 3, 2010 .Dt SCANDIR 3 .Os .Sh NAME @@ -41,9 +41,9 @@ .In sys/types.h .In dirent.h .Ft int -.Fn scandir "const char *dirname" "struct dirent ***namelist" "int \\*(lp*= select\\*(rp\\*(lpstruct dirent *\\*(rp" "int \\*(lp*compar\\*(rp\\*(lpcons= t void *, const void *\\*(rp" +.Fn scandir "const char *dirname" "struct dirent ***namelist" "int \\*(lp*= select\\*(rp\\*(lpconst struct dirent *\\*(rp" "int \\*(lp*compar\\*(rp\\*(= lpconst struct dirent **, const struct dirent **\\*(rp" .Ft int -.Fn alphasort "const void *d1" "const void *d2" +.Fn alphasort "const struct dirent **d1" "const struct dirent **d2" .Sh DESCRIPTION The .Fn scandir diff --git a/lib/libc/gen/scandir.c b/lib/libc/gen/scandir.c index 1dae85d..47fad1d 100644 --- a/lib/libc/gen/scandir.c +++ b/lib/libc/gen/scandir.c @@ -58,11 +58,9 @@ __FBSDID("$FreeBSD$"); (((dp)->d_namlen + 1 + 3) &~ 3)) =20 int -scandir(dirname, namelist, select, dcomp) - const char *dirname; - struct dirent ***namelist; - int (*select)(struct dirent *); - int (*dcomp)(const void *, const void *); +scandir(const char *dirname, struct dirent ***namelist, + int (*select)(const struct dirent *), int (*dcomp)(const struct dirent= **, + const struct dirent **)) { struct dirent *d, *p, **names =3D NULL; size_t nitems =3D 0; @@ -111,26 +109,25 @@ scandir(dirname, namelist, select, dcomp) } closedir(dirp); if (nitems && dcomp !=3D NULL) - qsort(names, nitems, sizeof(struct dirent *), dcomp); + qsort(names, nitems, sizeof(struct dirent *), + (int (*)(const void *, const void *))dcomp); *namelist =3D names; - return(nitems); + return (nitems); =20 fail: while (nitems > 0) free(names[--nitems]); free(names); closedir(dirp); - return -1; + return (-1); } =20 /* * Alphabetic order comparison routine for those who want it. */ int -alphasort(d1, d2) - const void *d1; - const void *d2; +alphasort(const struct dirent **d1, const struct dirent **d2) { - return(strcmp((*(struct dirent **)d1)->d_name, - (*(struct dirent **)d2)->d_name)); + + return (strcmp((*d1)->d_name, (*d2)->d_name)); } diff --git a/usr.bin/catman/catman.c b/usr.bin/catman/catman.c index ba3ad24..c17a091 100644 --- a/usr.bin/catman/catman.c +++ b/usr.bin/catman/catman.c @@ -589,9 +589,15 @@ process_section(char *mandir, char *section) } =20 static int -select_sections(struct dirent *entry) +select_sections(const struct dirent *entry) { - return directory_type(entry->d_name) =3D=3D MAN_SECTION_DIR; + char *name; + int ret; + + name =3D strdup(entry->d_name); + ret =3D directory_type(name) =3D=3D MAN_SECTION_DIR; + free(name); + return (ret); } =20 /* diff --git a/usr.bin/makewhatis/makewhatis.c b/usr.bin/makewhatis/makewhati= s.c index 6b2dce4..f2ae370 100644 --- a/usr.bin/makewhatis/makewhatis.c +++ b/usr.bin/makewhatis/makewhatis.c @@ -879,9 +879,9 @@ process_section(char *section_dir) * Returns whether the directory entry is a man page section. */ static int -select_sections(struct dirent *entry) +select_sections(const struct dirent *entry) { - char *p =3D &entry->d_name[3]; + const char *p =3D &entry->d_name[3]; =20 if (strncmp(entry->d_name, "man", 3) !=3D 0) return 0; diff --git a/usr.sbin/lpr/common_source/lp.h b/usr.sbin/lpr/common_source/l= p.h index 891ed2f..63f2ff1 100644 --- a/usr.sbin/lpr/common_source/lp.h +++ b/usr.sbin/lpr/common_source/lp.h @@ -280,7 +280,7 @@ void inform(const struct printer *_pp, char *_cf); void init_printer(struct printer *_pp); void init_request(struct request *_rp); int inlist(char *_uname, char *_cfile); -int iscf(struct dirent *_d); +int iscf(const struct dirent *_d); void ldump(const char *_nfile, const char *_datafile, int _copies); void lastprinter(void); int lockchk(struct printer *_pp, char *_slockf); diff --git a/usr.sbin/lpr/common_source/rmjob.c b/usr.sbin/lpr/common_sourc= e/rmjob.c index d6fd614..33fcdac 100644 --- a/usr.sbin/lpr/common_source/rmjob.c +++ b/usr.sbin/lpr/common_source/rmjob.c @@ -384,7 +384,7 @@ rmremote(const struct printer *pp) * Return 1 if the filename begins with 'cf' */ int -iscf(struct dirent *d) +iscf(const struct dirent *d) { return(d->d_name[0] =3D=3D 'c' && d->d_name[1] =3D=3D 'f'); } --XIiC+We3v3zHqZ6Z Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAktAq0MACgkQC3+MBN1Mb4ijXACgwBf2oKjKYmciIoRA00OMiv1B vyAAoI/K4gBuYPllsltnen9QS9Uwxu0M =aJqd -----END PGP SIGNATURE----- --XIiC+We3v3zHqZ6Z-- From owner-freebsd-standards@FreeBSD.ORG Mon Jan 4 11:07:06 2010 Return-Path: Delivered-To: freebsd-standards@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBCBF10656A3 for ; Mon, 4 Jan 2010 11:07:06 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B9FB98FC27 for ; Mon, 4 Jan 2010 11:07:06 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id o04B76r1065030 for ; Mon, 4 Jan 2010 11:07:06 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id o04B76p5065028 for freebsd-standards@FreeBSD.org; Mon, 4 Jan 2010 11:07:06 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 4 Jan 2010 11:07:06 GMT Message-Id: <201001041107.o04B76p5065028@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-standards@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-standards@FreeBSD.org X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2010 11:07:07 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o stand/142255 standards scandir prototype in dirent.h isn't compliant with POS s stand/141705 standards [libc] [request] libc lacks cexp (and friends) o stand/135307 standards Boot Loader problem on Acer Aspire 5735 o stand/130067 standards Wrong numeric limits in system headers? o stand/129524 standards FreeBSD 7.0 isnt detecting my hardrives with raid5 o stand/129196 standards Inconsistent errno in strtol() o bin/125855 standards sh(1) allows for multiline, non-escaped control struct o stand/124860 standards flockfile(3) doesn't work when the memory has been exh o stand/123688 standards POSIX standard changes in unistd.h and grp.h o stand/121921 standards [patch] Add leap second support to at(1), atrun(8) o stand/121568 standards [patch] ln(1): wrong "ln -s" behaviour o stand/120947 standards xsm ignores system.xsm and .xsmstartup o stand/116826 standards [patch] sh support for POSIX character classes o stand/116477 standards rm(1): rm behaves unexpectedly when using -r and relat o bin/116413 standards incorrect getconf(1) handling of unsigned constants gi o stand/116081 standards make does not work with the directive sinclude p stand/107561 standards [libc] [patch] [request] Missing SUS function tcgetsid o stand/104743 standards [headers] [patch] Wrong values for _POSIX_ minimal lim o stand/100017 standards [Patch] Add fuser(1) functionality to fstat(1) o stand/96236 standards [patch] [posix] sed(1) incorrectly describes a functio o stand/96016 standards [headers] clock_getres et al should be in o stand/94729 standards [libc] fcntl() throws undocumented ENOTTY o kern/93705 standards [headers] [patch] ENODATA and EGREGIOUS (for glibc com o stand/92362 standards [headers] [patch] Missing SIGPOLL in kernel headers a stand/86484 standards [patch] mkfifo(1) uses wrong permissions o stand/83845 standards [libm] [patch] add log2() and log2f() support for libm o stand/82654 standards C99 long double math functions are missing o stand/81287 standards [patch] fingerd(8) might send a line not ending in CRL a stand/80293 standards sysconf() does not support well-defined unistd values o stand/79056 standards [feature request] [atch] regex(3) regression tests o stand/70813 standards [patch] ls(1) not Posix compliant o stand/66357 standards make POSIX conformance problem ('sh -e' & '+' command- s kern/64875 standards [libc] [patch] [request] add a system call: fdatasync( s stand/62858 standards malloc(0) not C99 compliant o stand/56476 standards cd9660 unicode support simple hack o stand/54839 standards [pcvt] pcvt deficits o stand/54833 standards [pcvt] more pcvt deficits o stand/54410 standards one-true-awk not POSIX compliant (no extended REs) o stand/46119 standards Priority problems for SCHED_OTHER using pthreads o stand/44425 standards getcwd() succeeds even if current dir has perm 000. p stand/41576 standards POSIX compliance of ln(1) o stand/39256 standards snprintf/vsnprintf aren't POSIX-conformant for strings s stand/36076 standards Implementation of POSIX fuser command o kern/27835 standards [libc] execve() doesn't conform to execve(2) spec in s a docs/26003 standards getgroups(2) lists NGROUPS_MAX but not syslimits.h s stand/24590 standards timezone function not compatible witn Single Unix Spec o bin/24390 standards ln(1) Replacing old dir-symlinks when using /bin/ln o stand/21519 standards sys/dir.h should be deprecated some more s bin/14925 standards getsubopt isn't poisonous enough 49 problems total. From owner-freebsd-standards@FreeBSD.ORG Wed Jan 6 23:55:49 2010 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 426941065697 for ; Wed, 6 Jan 2010 23:55:49 +0000 (UTC) (envelope-from wollman@khavrinen.csail.mit.edu) Received: from khavrinen.csail.mit.edu (khavrinen.csail.mit.edu [128.30.28.20]) by mx1.freebsd.org (Postfix) with ESMTP id 01AEF8FC0C for ; Wed, 6 Jan 2010 23:55:48 +0000 (UTC) Received: from khavrinen.csail.mit.edu (localhost [127.0.0.1]) by khavrinen.csail.mit.edu (8.14.3/8.14.3) with ESMTP id o06Ntlx0018731 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL CN=khavrinen.csail.mit.edu issuer=Client+20CA); Wed, 6 Jan 2010 18:55:47 -0500 (EST) (envelope-from wollman@khavrinen.csail.mit.edu) Received: (from wollman@localhost) by khavrinen.csail.mit.edu (8.14.3/8.14.3/Submit) id o06NtlSJ018728; Wed, 6 Jan 2010 18:55:47 -0500 (EST) (envelope-from wollman) From: Garrett Wollman MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <19269.8963.733084.213387@khavrinen.csail.mit.edu> Date: Wed, 6 Jan 2010 18:55:47 -0500 To: Kostik Belousov In-Reply-To: <201001031500.o03F0BO3042964@freefall.freebsd.org> References: <201001031500.o03F0BO3042964@freefall.freebsd.org> X-Mailer: VM 7.17 under 21.4 (patch 22) "Instant Classic" XEmacs Lucid X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3 (khavrinen.csail.mit.edu [127.0.0.1]); Wed, 06 Jan 2010 18:55:48 -0500 (EST) Cc: freebsd-standards@freebsd.org Subject: Re: standards/142255: scandir prototype in dirent.h isn't compliant with POSIX 2008 X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2010 23:55:49 -0000 < said: > The change of the prototype shall also fix alphasort(3). And then, each > in-tree consumer should be updated. > scandir(3) is historical BSD interface, that only appeared in SUSv4. > It seems that Solaris and possibly glibc are conforming, so FreeBSD > should probably follow the route. I believe someone at least complained about the Standard's broken prototypes, subsequent to the approval of the current standard, although I don't recall what the outcome was. > @@ -95,7 +95,7 @@ typedef void * DIR; > __BEGIN_DECLS > #if __BSD_VISIBLE > DIR *__opendir2(const char *, int); > -int alphasort(const void *, const void *); > +int alphasort(const struct dirent **, const struct dirent **); > int getdents(int, char *, int); > int getdirentries(int, char *, int, long *); > #endif If we're going to break the historical 4.4BSD prototype to match the broken one in SUSv4, the declaration should be moved to an appropriate section of the header file. (I haven't checked -- is this interface in the base standard or the XSI option? If the latter we should just ignore it -- we should not be trying to implement XSI's mistakes.) -GAWollman From owner-freebsd-standards@FreeBSD.ORG Thu Jan 7 00:30:03 2010 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1EE24106568B for ; Thu, 7 Jan 2010 00:30:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (skuns.zoral.com.ua [91.193.166.194]) by mx1.freebsd.org (Postfix) with ESMTP id 6AC478FC0A for ; Thu, 7 Jan 2010 00:30:01 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o070BO7j021662 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 7 Jan 2010 02:11:24 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id o070BOX3069789; Thu, 7 Jan 2010 02:11:24 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id o070BO8G069788; Thu, 7 Jan 2010 02:11:24 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 7 Jan 2010 02:11:24 +0200 From: Kostik Belousov To: Garrett Wollman Message-ID: <20100107001124.GA57050@deviant.kiev.zoral.com.ua> References: <201001031500.o03F0BO3042964@freefall.freebsd.org> <19269.8963.733084.213387@khavrinen.csail.mit.edu> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="XUd+PsnCfaVdInSg" Content-Disposition: inline In-Reply-To: <19269.8963.733084.213387@khavrinen.csail.mit.edu> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-standards@freebsd.org Subject: Re: standards/142255: scandir prototype in dirent.h isn't compliant with POSIX 2008 X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2010 00:30:03 -0000 --XUd+PsnCfaVdInSg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 06, 2010 at 06:55:47PM -0500, Garrett Wollman wrote: > < = said: >=20 > > The change of the prototype shall also fix alphasort(3). And then, each > > in-tree consumer should be updated. > =20 > > scandir(3) is historical BSD interface, that only appeared in SUSv4. > > It seems that Solaris and possibly glibc are conforming, so FreeBSD > > should probably follow the route. > =20 > I believe someone at least complained about the Standard's broken > prototypes, subsequent to the approval of the current standard, > although I don't recall what the outcome was. >=20 > > @@ -95,7 +95,7 @@ typedef void * DIR; > > __BEGIN_DECLS > > #if __BSD_VISIBLE > > DIR *__opendir2(const char *, int); > > -int alphasort(const void *, const void *); > > +int alphasort(const struct dirent **, const struct dirent **); > > int getdents(int, char *, int); > > int getdirentries(int, char *, int, long *); > > #endif >=20 > If we're going to break the historical 4.4BSD prototype to match the > broken one in SUSv4, the declaration should be moved to an appropriate > section of the header file. (I haven't checked -- is this interface > in the base standard or the XSI option? If the latter we should just > ignore it -- we should not be trying to implement XSI's mistakes.) See r201602. --XUd+PsnCfaVdInSg Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAktFJqsACgkQC3+MBN1Mb4gy4gCfYlFMbuCwING/KlgKmCCA5zMx y50Ani+V3y2diBVtFMmI5A8MM1xpBy1G =1EqH -----END PGP SIGNATURE----- --XUd+PsnCfaVdInSg-- From owner-freebsd-standards@FreeBSD.ORG Thu Jan 7 16:01:44 2010 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 891E81065697 for ; Thu, 7 Jan 2010 16:01:44 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by mx1.freebsd.org (Postfix) with ESMTP id 2483B8FC22 for ; Thu, 7 Jan 2010 16:01:43 +0000 (UTC) Received: from c122-106-155-90.carlnfd1.nsw.optusnet.com.au (c122-106-155-90.carlnfd1.nsw.optusnet.com.au [122.106.155.90]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o07G1WZc007303 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 8 Jan 2010 03:01:34 +1100 Date: Fri, 8 Jan 2010 03:01:32 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Garrett Wollman In-Reply-To: <19269.8963.733084.213387@khavrinen.csail.mit.edu> Message-ID: <20100108025519.U56232@delplex.bde.org> References: <201001031500.o03F0BO3042964@freefall.freebsd.org> <19269.8963.733084.213387@khavrinen.csail.mit.edu> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-standards@freebsd.org Subject: Re: standards/142255: scandir prototype in dirent.h isn't compliant with POSIX 2008 X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2010 16:01:44 -0000 On Wed, 6 Jan 2010, Garrett Wollman wrote: > < said: > I believe someone at least complained about the Standard's broken > prototypes, subsequent to the approval of the current standard, > although I don't recall what the outcome was. There's no trace of it in the opengroup man page for alphasort+scandir most easily found by google (not clear how recent or authoritative this is), and I couldn't find the complaint either. >> @@ -95,7 +95,7 @@ typedef void * DIR; >> __BEGIN_DECLS >> #if __BSD_VISIBLE >> DIR *__opendir2(const char *, int); >> -int alphasort(const void *, const void *); >> +int alphasort(const struct dirent **, const struct dirent **); >> int getdents(int, char *, int); >> int getdirentries(int, char *, int, long *); >> #endif > > If we're going to break the historical 4.4BSD prototype to match the > broken one in SUSv4, the declaration should be moved to an appropriate > section of the header file. (I haven't checked -- is this interface > in the base standard or the XSI option? If the latter we should just > ignore it -- we should not be trying to implement XSI's mistakes.) This is done. What do you think about the single `const' in the broken prototypes? For fts, you preserved the struct pointer part of the brokenness but added a second `const'. I suppose the Standard intentionally left out the second `const' for the same reasons as for execve() and strtol(). Bruce From owner-freebsd-standards@FreeBSD.ORG Thu Jan 7 20:58:51 2010 Return-Path: Delivered-To: freebsd-standards@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF508106566B for ; Thu, 7 Jan 2010 20:58:51 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id B331A8FC20 for ; Thu, 7 Jan 2010 20:58:51 +0000 (UTC) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.3/8.14.2) with ESMTP id o07Kwofq056514; Thu, 7 Jan 2010 15:58:50 -0500 (EST) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.3/8.14.2/Submit) id o07Kwobg056513; Thu, 7 Jan 2010 15:58:50 -0500 (EST) (envelope-from das@FreeBSD.ORG) Date: Thu, 7 Jan 2010 15:58:50 -0500 From: David Schultz To: Mark Diekhans Message-ID: <20100107205850.GA55217@zim.MIT.EDU> Mail-Followup-To: Mark Diekhans , freebsd-standards@freebsd.org References: <200912310500.nBV50GMg081976@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200912310500.nBV50GMg081976@freefall.freebsd.org> Cc: freebsd-standards@FreeBSD.ORG Subject: Re: standards/83845: [libm] [patch] add log2() and log2f() support for libm X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2010 20:58:52 -0000 On Thu, Dec 31, 2009, Mark Diekhans wrote: > How about integrating the C99 math functions into libm? This PR has been pending > for four years. NetBSD already has them: > > http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libm/src/ > > Makes it hard to port software and to advocate for FreeBSD being a > standards-compliant platform. IIRC, the proposed implementation is a somewhat simplistic port of log(), and it generates rather inaccurate results. In particular, you might as well just #define log2(x) (log(x)/log(2)). The hope is that we'll get a real implementation of this function, rather than putting in a kludge so we can pretend we don't need one. I'm not going to have time for it on the near future myself, but Steve Kargl has been working on better math library functions for a while, and hopefully he will have some stuff ready soon.