From owner-svn-src-projects@FreeBSD.ORG Tue Dec 23 08:40:29 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 96CB7E39; Tue, 23 Dec 2014 08:40:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F1AA64AC7; Tue, 23 Dec 2014 08:40:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBN8eTB4092258; Tue, 23 Dec 2014 08:40:29 GMT (envelope-from gleb@FreeBSD.org) Received: (from gleb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBN8eP6I092238; Tue, 23 Dec 2014 08:40:25 GMT (envelope-from gleb@FreeBSD.org) Message-Id: <201412230840.sBN8eP6I092238@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gleb set sender to gleb@FreeBSD.org using -f From: Gleb Kurtsou Date: Tue, 23 Dec 2014 08:40:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r276120 - in projects/ino64: include lib/libc/gen X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Dec 2014 08:40:29 -0000 Author: gleb Date: Tue Dec 23 08:40:24 2014 New Revision: 276120 URL: https://svnweb.freebsd.org/changeset/base/276120 Log: libc: Compat shims for fts, glob, readdir and related functions. Added: projects/ino64/lib/libc/gen/gen-compat.h (contents, props changed) Modified: projects/ino64/include/dirent.h projects/ino64/lib/libc/gen/Makefile.inc projects/ino64/lib/libc/gen/Symbol.map projects/ino64/lib/libc/gen/devname-compat10.c projects/ino64/lib/libc/gen/fts-compat.c projects/ino64/lib/libc/gen/fts-compat.h projects/ino64/lib/libc/gen/fts-compat10.c projects/ino64/lib/libc/gen/fts-compat10.h projects/ino64/lib/libc/gen/ftw-compat10.c projects/ino64/lib/libc/gen/gen-private.h projects/ino64/lib/libc/gen/getmntinfo-compat10.c projects/ino64/lib/libc/gen/glob-compat10.c projects/ino64/lib/libc/gen/glob-compat10.h projects/ino64/lib/libc/gen/nftw-compat10.c projects/ino64/lib/libc/gen/readdir-compat10.c projects/ino64/lib/libc/gen/scandir-compat10.c projects/ino64/lib/libc/gen/telldir.h Modified: projects/ino64/include/dirent.h ============================================================================== --- projects/ino64/include/dirent.h Tue Dec 23 08:26:15 2014 (r276119) +++ projects/ino64/include/dirent.h Tue Dec 23 08:40:24 2014 (r276120) @@ -40,6 +40,21 @@ #include #include +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +#ifndef _SSIZE_T_DECLARED +typedef __ssize_t ssize_t; +#define _SSIZE_T_DECLARED +#endif + +#ifndef _OFF_T_DECLARED +typedef __off_t off_t; +#define _OFF_T_DECLARED +#endif + #if __XSI_VISIBLE /* * XXX this is probably illegal in the __XSI_VISIBLE case, but brings us closer @@ -81,8 +96,8 @@ int dirfd(DIR *); #if __BSD_VISIBLE DIR *__opendir2(const char *, int); int fdclosedir(DIR *); -int getdents(int, char *, int); -int getdirentries(int, char *, int, long *); +ssize_t getdents(int, char *, size_t); +ssize_t getdirentries(int, char *, size_t, off_t *); #endif DIR *opendir(const char *); DIR *fdopendir(int); Modified: projects/ino64/lib/libc/gen/Makefile.inc ============================================================================== --- projects/ino64/lib/libc/gen/Makefile.inc Tue Dec 23 08:26:15 2014 (r276119) +++ projects/ino64/lib/libc/gen/Makefile.inc Tue Dec 23 08:40:24 2014 (r276120) @@ -26,6 +26,7 @@ SRCS+= __getosreldate.c \ ctermid.c \ daemon.c \ devname.c \ + devname-compat10.c \ dirfd.c \ dirname.c \ disklabel.c \ @@ -49,7 +50,9 @@ SRCS+= __getosreldate.c \ ftok.c \ fts.c \ fts-compat.c \ + fts-compat10.c \ ftw.c \ + ftw-compat10.c \ getbootfile.c \ getbsize.c \ getcap.c \ @@ -61,6 +64,7 @@ SRCS+= __getosreldate.c \ getloadavg.c \ getlogin.c \ getmntinfo.c \ + getmntinfo-compat10.c \ getnetgrent.c \ getosreldate.c \ getpagesize.c \ @@ -73,6 +77,7 @@ SRCS+= __getosreldate.c \ getutxent.c \ getvfsbyname.c \ glob.c \ + glob-compat10.c \ initgroups.c \ isatty.c \ isinf.c \ @@ -84,6 +89,7 @@ SRCS+= __getosreldate.c \ lrand48.c \ mrand48.c \ nftw.c \ + nftw-compat10.c \ nice.c \ nlist.c \ nrand48.c \ @@ -97,9 +103,11 @@ SRCS+= __getosreldate.c \ pw_scan.c \ raise.c \ readdir.c \ + readdir-compat10.c \ readpassphrase.c \ rewinddir.c \ scandir.c \ + scandir-compat10.c \ seed48.c \ seekdir.c \ semctl.c \ Modified: projects/ino64/lib/libc/gen/Symbol.map ============================================================================== --- projects/ino64/lib/libc/gen/Symbol.map Tue Dec 23 08:26:15 2014 (r276119) +++ projects/ino64/lib/libc/gen/Symbol.map Tue Dec 23 08:40:24 2014 (r276120) @@ -80,8 +80,6 @@ FBSD_1.0 { ctermid; ctermid_r; daemon; - devname; - devname_r; dirname; getdiskbyname; dladdr; @@ -134,9 +132,6 @@ FBSD_1.0 { setfsent; endfsent; ftok; - ftw; - glob; - globfree; getbootfile; getbsize; cgetset; @@ -169,7 +164,6 @@ FBSD_1.0 { getloadavg; getlogin; getlogin_r; - getmntinfo; setnetgrent; getnetgrent; endnetgrent; @@ -215,7 +209,6 @@ FBSD_1.0 { lrand48; modf; mrand48; - nftw; nice; nlist; nrand48; @@ -226,13 +219,9 @@ FBSD_1.0 { pclose; psignal; raise; - readdir; - readdir_r; readpassphrase; getpass; rewinddir; - scandir; - alphasort; seed48; seekdir; user_from_uid; @@ -320,14 +309,6 @@ FBSD_1.1 { fdevname_r; fdopendir; feature_present; - fts_children; - fts_close; - fts_get_clientptr; - fts_get_stream; - fts_open; - fts_read; - fts_set; - fts_set_clientptr; posix_spawn; posix_spawn_file_actions_addclose; posix_spawn_file_actions_adddup2; @@ -410,6 +391,25 @@ FBSD_1.3 { }; FBSD_1.4 { + alphasort; + devname; + devname_r; + fts_children; + fts_close; + fts_get_clientptr; + fts_get_stream; + fts_open; + fts_read; + fts_set; + fts_set_clientptr; + ftw; + getmntinfo; + glob; + globfree; + nftw; + readdir; + readdir_r; + scandir; scandir_b; }; Modified: projects/ino64/lib/libc/gen/devname-compat10.c ============================================================================== --- projects/ino64/lib/libc/gen/devname-compat10.c Tue Dec 23 08:26:15 2014 (r276119) +++ projects/ino64/lib/libc/gen/devname-compat10.c Tue Dec 23 08:40:24 2014 (r276120) @@ -1,6 +1,6 @@ -/* - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. +/*- + * Copyright (c) 2011 Gleb Kurtsou + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,14 +10,11 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) @@ -27,49 +24,29 @@ * SUCH DAMAGE. */ -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)devname.c 8.2 (Berkeley) 4/29/95"; -#endif /* LIBC_SCCS and not lint */ #include __FBSDID("$FreeBSD$"); #include -#include - -#include -#include -#include -#include #include +#include + +char *freebsd10_devname(uint32_t dev, mode_t type); +char *freebsd10_devname_r(uint32_t dev, mode_t type, char *buf, int len); char * -devname_r(dev_t dev, mode_t type, char *buf, int len) +freebsd10_devname(uint32_t dev, mode_t type) { - int i; - size_t j; - if (dev == NODEV || !(S_ISCHR(type) || S_ISBLK(dev))) { - strlcpy(buf, "#NODEV", len); - return (buf); - } - - if (S_ISCHR(type)) { - j = len; - i = sysctlbyname("kern.devname", buf, &j, &dev, sizeof (dev)); - if (i == 0) - return (buf); - } - - /* Finally just format it */ - snprintf(buf, len, "#%c:%#jx", - S_ISCHR(type) ? 'C' : 'B', (uintmax_t)dev); - return (buf); + return (devname(dev, type)); } char * -devname(dev_t dev, mode_t type) +freebsd10_devname_r(uint32_t dev, mode_t type, char *buf, int len) { - static char buf[SPECNAMELEN + 1]; - return (devname_r(dev, type, buf, sizeof(buf))); + return (devname_r(dev, type, buf, len)); } + +__sym_compat(devname, freebsd10_devname, FBSD_1.0); +__sym_compat(devname_r, freebsd10_devname_r, FBSD_1.0); Modified: projects/ino64/lib/libc/gen/fts-compat.c ============================================================================== --- projects/ino64/lib/libc/gen/fts-compat.c Tue Dec 23 08:26:15 2014 (r276119) +++ projects/ino64/lib/libc/gen/fts-compat.c Tue Dec 23 08:40:24 2014 (r276120) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include "gen-compat.h" #include "fts-compat.h" #include "un-namespace.h" @@ -96,8 +97,8 @@ static int fts_ufslinks(FTS *, const FT */ struct _fts_private { FTS ftsp_fts; - struct statfs ftsp_statfs; - dev_t ftsp_dev; + struct freebsd10_statfs ftsp_statfs; + uint32_t ftsp_dev; int ftsp_linksreliable; }; @@ -639,7 +640,7 @@ fts_build(sp, type) FTS *sp; int type; { - struct dirent *dp; + struct freebsd10_dirent *dp; FTSENT *p, *head; int nitems; FTSENT *cur, *tail; @@ -751,7 +752,8 @@ fts_build(sp, type) /* Read the directory, attaching each entry to the `link' pointer. */ doadjust = 0; - for (head = tail = NULL, nitems = 0; dirp && (dp = readdir(dirp));) { + for (head = tail = NULL, nitems = 0; + dirp && (dp = freebsd10_readdir(dirp));) { dnamlen = dp->d_namlen; if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name)) continue; @@ -907,9 +909,9 @@ fts_stat(sp, p, follow) int follow; { FTSENT *t; - dev_t dev; - ino_t ino; - struct stat *sbp, sb; + uint32_t dev; + uint32_t ino; + struct freebsd10_stat *sbp, sb; int saved_errno; /* If user needs stat info, stat buffer already allocated. */ @@ -932,16 +934,16 @@ fts_stat(sp, p, follow) * fail, set the errno from the stat call. */ if (ISSET(FTS_LOGICAL) || follow) { - if (stat(p->fts_accpath, sbp)) { + if (freebsd10_stat(p->fts_accpath, sbp)) { saved_errno = errno; - if (!lstat(p->fts_accpath, sbp)) { + if (!freebsd10_lstat(p->fts_accpath, sbp)) { errno = 0; return (FTS_SLNONE); } p->fts_errno = saved_errno; goto err; } - } else if (lstat(p->fts_accpath, sbp)) { + } else if (freebsd10_lstat(p->fts_accpath, sbp)) { p->fts_errno = errno; err: memset(sbp, 0, sizeof(struct stat)); return (FTS_NS); @@ -1041,7 +1043,7 @@ fts_alloc(sp, name, namelen) struct ftsent_withstat { FTSENT ent; - struct stat statbuf; + struct freebsd10_stat statbuf; }; /* @@ -1177,14 +1179,14 @@ fts_safe_changedir(sp, p, fd, path) char *path; { int ret, oerrno, newfd; - struct stat sb; + struct freebsd10_stat sb; newfd = fd; if (ISSET(FTS_NOCHDIR)) return (0); if (fd < 0 && (newfd = _open(path, O_RDONLY | O_CLOEXEC, 0)) < 0) return (-1); - if (_fstat(newfd, &sb)) { + if (freebsd10_fstat(newfd, &sb)) { ret = -1; goto bail; } @@ -1219,7 +1221,7 @@ fts_ufslinks(FTS *sp, const FTSENT *ent) * avoidance. */ if (priv->ftsp_dev != ent->fts_dev) { - if (statfs(ent->fts_path, &priv->ftsp_statfs) != -1) { + if (freebsd10_statfs(ent->fts_path, &priv->ftsp_statfs) != -1) { priv->ftsp_dev = ent->fts_dev; priv->ftsp_linksreliable = 0; for (cpp = ufslike_filesystems; *cpp; cpp++) { Modified: projects/ino64/lib/libc/gen/fts-compat.h ============================================================================== --- projects/ino64/lib/libc/gen/fts-compat.h Tue Dec 23 08:26:15 2014 (r276119) +++ projects/ino64/lib/libc/gen/fts-compat.h Tue Dec 23 08:40:24 2014 (r276120) @@ -37,7 +37,7 @@ typedef struct { struct _ftsent *fts_cur; /* current node */ struct _ftsent *fts_child; /* linked list of children */ struct _ftsent **fts_array; /* sort array */ - dev_t fts_dev; /* starting device # */ + uint32_t fts_dev; /* starting device # */ char *fts_path; /* path for this descent */ int fts_rfd; /* fd for root */ int fts_pathlen; /* sizeof(path) */ @@ -82,9 +82,9 @@ typedef struct _ftsent { u_short fts_pathlen; /* strlen(fts_path) */ u_short fts_namelen; /* strlen(fts_name) */ - ino_t fts_ino; /* inode */ - dev_t fts_dev; /* device */ - nlink_t fts_nlink; /* link count */ + uint32_t fts_ino; /* inode */ + uint32_t fts_dev; /* device */ + uint16_t fts_nlink; /* link count */ #define FTS_ROOTPARENTLEVEL -1 #define FTS_ROOTLEVEL 0 @@ -117,7 +117,7 @@ typedef struct _ftsent { #define FTS_SKIP 4 /* discard node */ u_short fts_instr; /* fts_set() instructions */ - struct stat *fts_statp; /* stat(2) information */ + struct freebsd10_stat *fts_statp; /* stat(2) information */ char *fts_name; /* file name */ FTS *fts_fts; /* back pointer to main FTS */ } FTSENT; Modified: projects/ino64/lib/libc/gen/fts-compat10.c ============================================================================== --- projects/ino64/lib/libc/gen/fts-compat10.c Tue Dec 23 08:26:15 2014 (r276119) +++ projects/ino64/lib/libc/gen/fts-compat10.c Tue Dec 23 08:40:24 2014 (r276120) @@ -46,10 +46,11 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include +#include "gen-compat.h" +#include "fts-compat10.h" #include "un-namespace.h" #include "gen-private.h" @@ -86,8 +87,8 @@ static int fts_ufslinks(FTS *, const FT */ struct _fts_private { FTS ftsp_fts; - struct statfs ftsp_statfs; - dev_t ftsp_dev; + struct freebsd10_statfs ftsp_statfs; + uint32_t ftsp_dev; int ftsp_linksreliable; }; @@ -110,7 +111,7 @@ static const char *ufslike_filesystems[] }; FTS * -fts_open(argv, options, compar) +freebsd10_fts_open(argv, options, compar) char * const *argv; int options; int (*compar)(const FTSENT * const *, const FTSENT * const *); @@ -248,7 +249,7 @@ fts_load(FTS *sp, FTSENT *p) } int -fts_close(FTS *sp) +freebsd10_fts_close(FTS *sp) { FTSENT *freep, *p; int saved_errno; @@ -302,7 +303,7 @@ fts_close(FTS *sp) ? p->fts_pathlen - 1 : p->fts_pathlen) FTSENT * -fts_read(FTS *sp) +freebsd10_fts_read(FTS *sp) { FTSENT *p, *tmp; int instr; @@ -500,7 +501,7 @@ name: t = sp->fts_path + NAPPEND(p->fts */ /* ARGSUSED */ int -fts_set(FTS *sp, FTSENT *p, int instr) +freebsd10_fts_set(FTS *sp, FTSENT *p, int instr) { if (instr != 0 && instr != FTS_AGAIN && instr != FTS_FOLLOW && instr != FTS_NOINSTR && instr != FTS_SKIP) { @@ -512,7 +513,7 @@ fts_set(FTS *sp, FTSENT *p, int instr) } FTSENT * -fts_children(FTS *sp, int instr) +freebsd10_fts_children(FTS *sp, int instr) { FTSENT *p; int fd; @@ -579,29 +580,29 @@ fts_children(FTS *sp, int instr) return (sp->fts_child); } -#ifndef fts_get_clientptr -#error "fts_get_clientptr not defined" +#ifndef freebsd10_fts_get_clientptr +#error "freebsd10_fts_get_clientptr not defined" #endif void * -(fts_get_clientptr)(FTS *sp) +(freebsd10_fts_get_clientptr)(FTS *sp) { - return (fts_get_clientptr(sp)); + return (freebsd10_fts_get_clientptr(sp)); } -#ifndef fts_get_stream -#error "fts_get_stream not defined" +#ifndef freebsd10_fts_get_stream +#error "freebsd10_fts_get_stream not defined" #endif FTS * -(fts_get_stream)(FTSENT *p) +(freebsd10_fts_get_stream)(FTSENT *p) { - return (fts_get_stream(p)); + return (freebsd10_fts_get_stream(p)); } void -fts_set_clientptr(FTS *sp, void *clientptr) +freebsd10_fts_set_clientptr(FTS *sp, void *clientptr) { sp->fts_clientptr = clientptr; @@ -624,7 +625,7 @@ fts_set_clientptr(FTS *sp, void *clientp static FTSENT * fts_build(FTS *sp, int type) { - struct dirent *dp; + struct freebsd10_dirent *dp; FTSENT *p, *head; FTSENT *cur, *tail; DIR *dirp; @@ -736,7 +737,8 @@ fts_build(FTS *sp, int type) /* Read the directory, attaching each entry to the `link' pointer. */ doadjust = 0; - for (head = tail = NULL, nitems = 0; dirp && (dp = readdir(dirp));) { + for (head = tail = NULL, nitems = 0; + dirp && (dp = freebsd10_readdir(dirp));) { dnamlen = dp->d_namlen; if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name)) continue; @@ -872,9 +874,9 @@ static int fts_stat(FTS *sp, FTSENT *p, int follow, int dfd) { FTSENT *t; - dev_t dev; - ino_t ino; - struct stat *sbp, sb; + uint32_t dev; + uint32_t ino; + struct freebsd10_stat *sbp, sb; int saved_errno; const char *path; @@ -903,16 +905,16 @@ fts_stat(FTS *sp, FTSENT *p, int follow, * fail, set the errno from the stat call. */ if (ISSET(FTS_LOGICAL) || follow) { - if (fstatat(dfd, path, sbp, 0)) { + if (freebsd10_fstatat(dfd, path, sbp, 0)) { saved_errno = errno; - if (!fstatat(dfd, path, sbp, AT_SYMLINK_NOFOLLOW)) { + if (!freebsd10_fstatat(dfd, path, sbp, AT_SYMLINK_NOFOLLOW)) { errno = 0; return (FTS_SLNONE); } p->fts_errno = saved_errno; goto err; } - } else if (fstatat(dfd, path, sbp, AT_SYMLINK_NOFOLLOW)) { + } else if (freebsd10_fstatat(dfd, path, sbp, AT_SYMLINK_NOFOLLOW)) { p->fts_errno = errno; err: memset(sbp, 0, sizeof(struct stat)); return (FTS_NS); @@ -1006,7 +1008,7 @@ fts_alloc(FTS *sp, char *name, size_t na struct ftsent_withstat { FTSENT ent; - struct stat statbuf; + struct freebsd10_stat statbuf; }; /* @@ -1121,7 +1123,7 @@ static int fts_safe_changedir(FTS *sp, FTSENT *p, int fd, char *path) { int ret, oerrno, newfd; - struct stat sb; + struct freebsd10_stat sb; newfd = fd; if (ISSET(FTS_NOCHDIR)) @@ -1129,7 +1131,7 @@ fts_safe_changedir(FTS *sp, FTSENT *p, i if (fd < 0 && (newfd = _open(path, O_RDONLY | O_DIRECTORY | O_CLOEXEC, 0)) < 0) return (-1); - if (_fstat(newfd, &sb)) { + if (freebsd10_fstat(newfd, &sb)) { ret = -1; goto bail; } @@ -1164,7 +1166,7 @@ fts_ufslinks(FTS *sp, const FTSENT *ent) * avoidance. */ if (priv->ftsp_dev != ent->fts_dev) { - if (statfs(ent->fts_path, &priv->ftsp_statfs) != -1) { + if (freebsd10_statfs(ent->fts_path, &priv->ftsp_statfs) != -1) { priv->ftsp_dev = ent->fts_dev; priv->ftsp_linksreliable = 0; for (cpp = ufslike_filesystems; *cpp; cpp++) { @@ -1180,3 +1182,12 @@ fts_ufslinks(FTS *sp, const FTSENT *ent) } return (priv->ftsp_linksreliable); } + +__sym_compat(fts_open, freebsd10_fts_open, FBSD_1.1); +__sym_compat(fts_close, freebsd10_fts_close, FBSD_1.1); +__sym_compat(fts_read, freebsd10_fts_read, FBSD_1.1); +__sym_compat(fts_set, freebsd10_fts_set, FBSD_1.1); +__sym_compat(fts_children, freebsd10_fts_children, FBSD_1.1); +__sym_compat(fts_get_clientptr, freebsd10_fts_get_clientptr, FBSD_1.1); +__sym_compat(fts_get_stream, freebsd10_fts_get_stream, FBSD_1.1); +__sym_compat(fts_set_clientptr, freebsd10_fts_set_clientptr, FBSD_1.1); Modified: projects/ino64/lib/libc/gen/fts-compat10.h ============================================================================== --- projects/ino64/lib/libc/gen/fts-compat10.h Tue Dec 23 08:26:15 2014 (r276119) +++ projects/ino64/lib/libc/gen/fts-compat10.h Tue Dec 23 08:40:24 2014 (r276120) @@ -30,16 +30,14 @@ * $FreeBSD$ */ -#ifndef _FTS_H_ -#define _FTS_H_ - -#include +#ifndef _FTS_COPMAT10_H_ +#define _FTS_COPMAT10_H_ typedef struct { struct _ftsent *fts_cur; /* current node */ struct _ftsent *fts_child; /* linked list of children */ struct _ftsent **fts_array; /* sort array */ - __dev_t fts_dev; /* starting device # */ + uint32_t fts_dev; /* starting device # */ char *fts_path; /* path for this descent */ int fts_rfd; /* fd for root */ __size_t fts_pathlen; /* sizeof(path) */ @@ -77,9 +75,9 @@ typedef struct _ftsent { __size_t fts_pathlen; /* strlen(fts_path) */ __size_t fts_namelen; /* strlen(fts_name) */ - __ino_t fts_ino; /* inode */ - __dev_t fts_dev; /* device */ - __nlink_t fts_nlink; /* link count */ + uint32_t fts_ino; /* inode */ + uint32_t fts_dev; /* device */ + uint16_t fts_nlink; /* link count */ #define FTS_ROOTPARENTLEVEL -1 #define FTS_ROOTLEVEL 0 @@ -112,25 +110,21 @@ typedef struct _ftsent { #define FTS_SKIP 4 /* discard node */ int fts_instr; /* fts_set() instructions */ - struct stat *fts_statp; /* stat(2) information */ + struct freebsd10_stat *fts_statp; /* stat(2) information */ char *fts_name; /* file name */ FTS *fts_fts; /* back pointer to main FTS */ } FTSENT; -#include - -__BEGIN_DECLS -FTSENT *fts_children(FTS *, int); -int fts_close(FTS *); -void *fts_get_clientptr(FTS *); -#define fts_get_clientptr(fts) ((fts)->fts_clientptr) -FTS *fts_get_stream(FTSENT *); -#define fts_get_stream(ftsent) ((ftsent)->fts_fts) -FTS *fts_open(char * const *, int, +FTSENT *freebsd10_fts_children(FTS *, int); +int freebsd10_fts_close(FTS *); +void *freebsd10_fts_get_clientptr(FTS *); +#define freebsd10_fts_get_clientptr(fts) ((fts)->fts_clientptr) +FTS *freebsd10_fts_get_stream(FTSENT *); +#define freebsd10_fts_get_stream(ftsent) ((ftsent)->fts_fts) +FTS *freebsd10_fts_open(char * const *, int, int (*)(const FTSENT * const *, const FTSENT * const *)); -FTSENT *fts_read(FTS *); -int fts_set(FTS *, FTSENT *, int); -void fts_set_clientptr(FTS *, void *); -__END_DECLS +FTSENT *freebsd10_fts_read(FTS *); +int freebsd10_fts_set(FTS *, FTSENT *, int); +void freebsd10_fts_set_clientptr(FTS *, void *); -#endif /* !_FTS_H_ */ +#endif /* !_FTS_COMPAT10_H_ */ Modified: projects/ino64/lib/libc/gen/ftw-compat10.c ============================================================================== --- projects/ino64/lib/libc/gen/ftw-compat10.c Tue Dec 23 08:26:15 2014 (r276119) +++ projects/ino64/lib/libc/gen/ftw-compat10.c Tue Dec 23 08:40:24 2014 (r276120) @@ -26,12 +26,13 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include +#include "fts-compat10.h" + int -ftw(const char *path, int (*fn)(const char *, const struct stat *, int), - int nfds) +freebsd10_ftw(const char *path, + int (*fn)(const char *, const struct freebsd10_stat *, int), int nfds) { char * const paths[2] = { (char *)path, NULL }; FTSENT *cur; @@ -44,10 +45,11 @@ ftw(const char *path, int (*fn)(const ch return (-1); } - ftsp = fts_open(paths, FTS_LOGICAL | FTS_COMFOLLOW | FTS_NOCHDIR, NULL); + ftsp = freebsd10_fts_open(paths, + FTS_LOGICAL | FTS_COMFOLLOW | FTS_NOCHDIR, NULL); if (ftsp == NULL) return (-1); - while ((cur = fts_read(ftsp)) != NULL) { + while ((cur = freebsd10_fts_read(ftsp)) != NULL) { switch (cur->fts_info) { case FTS_D: fnflag = FTW_D; @@ -83,9 +85,11 @@ ftw(const char *path, int (*fn)(const ch } done: sverrno = errno; - if (fts_close(ftsp) != 0 && error == 0) + if (freebsd10_fts_close(ftsp) != 0 && error == 0) error = -1; else errno = sverrno; return (error); } + +__sym_compat(ftw, freebsd10_ftw, FBSD_1.0); Added: projects/ino64/lib/libc/gen/gen-compat.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ino64/lib/libc/gen/gen-compat.h Tue Dec 23 08:40:24 2014 (r276120) @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2012 Gleb Kurtsou + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _GEN_COMPAT_H_ +#define _GEN_COMPAT_H_ + +#include + +#define FREEBSD10_DIRSIZ(dp) \ + (sizeof(struct freebsd10_dirent) - sizeof((dp)->d_name) + \ + (((dp)->d_namlen + 1 + 3) &~ 3)) + +struct freebsd10_dirent; +struct freebsd10_stat; +struct freebsd10_statfs; + +struct freebsd10_dirent *freebsd10_readdir(DIR *); +int freebsd10_readdir_r(DIR *, struct freebsd10_dirent *, + struct freebsd10_dirent **); +int freebsd10_stat(const char *, struct freebsd10_stat *); +int freebsd10_lstat(const char *, struct freebsd10_stat *); +int freebsd10_fstat(int, struct freebsd10_stat *); +int freebsd10_fstatat(int, const char *, struct freebsd10_stat *, int); + +int freebsd10_statfs(const char *, struct freebsd10_statfs *); +int freebsd10_getfsstat(struct freebsd10_statfs *, long, int); +int freebsd10_getmntinfo(struct freebsd10_statfs **, int); + +#endif /* _GEN_COMPAT_H_ */ Modified: projects/ino64/lib/libc/gen/gen-private.h ============================================================================== --- projects/ino64/lib/libc/gen/gen-private.h Tue Dec 23 08:26:15 2014 (r276119) +++ projects/ino64/lib/libc/gen/gen-private.h Tue Dec 23 08:40:24 2014 (r276120) @@ -47,7 +47,7 @@ struct _dirdesc { long dd_size; /* amount of data returned by getdirentries */ char *dd_buf; /* data buffer */ int dd_len; /* size of data buffer */ - long dd_seek; /* magic cookie returned by getdirentries */ + off_t dd_seek; /* magic cookie returned by getdirentries */ int dd_flags; /* flags for readdir */ struct pthread_mutex *dd_lock; /* lock */ struct _telldir *dd_td; /* telldir position recording */ Modified: projects/ino64/lib/libc/gen/getmntinfo-compat10.c ============================================================================== --- projects/ino64/lib/libc/gen/getmntinfo-compat10.c Tue Dec 23 08:26:15 2014 (r276119) +++ projects/ino64/lib/libc/gen/getmntinfo-compat10.c Tue Dec 23 08:40:24 2014 (r276120) @@ -27,42 +27,40 @@ * SUCH DAMAGE. */ -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)getmntinfo.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD$"); - #include #include #include #include +#include "gen-compat.h" + /* * Return information about mounted filesystems. */ int -getmntinfo(mntbufp, flags) - struct statfs **mntbufp; - int flags; +freebsd10_getmntinfo(struct freebsd10_statfs **mntbufp, int flags) { - static struct statfs *mntbuf; + static struct freebsd10_statfs *mntbuf; static int mntsize; static long bufsize; - if (mntsize <= 0 && (mntsize = getfsstat(0, 0, MNT_NOWAIT)) < 0) + if (mntsize <= 0 && + (mntsize = freebsd10_getfsstat(0, 0, MNT_NOWAIT)) < 0) return (0); - if (bufsize > 0 && (mntsize = getfsstat(mntbuf, bufsize, flags)) < 0) + if (bufsize > 0 && + (mntsize = freebsd10_getfsstat(mntbuf, bufsize, flags)) < 0) return (0); - while (bufsize <= mntsize * sizeof(struct statfs)) { + while (bufsize <= mntsize * sizeof(struct freebsd10_statfs)) { if (mntbuf) free(mntbuf); - bufsize = (mntsize + 1) * sizeof(struct statfs); - if ((mntbuf = (struct statfs *)malloc(bufsize)) == 0) + bufsize = (mntsize + 1) * sizeof(struct freebsd10_statfs); + if ((mntbuf = (struct freebsd10_statfs *)malloc(bufsize)) == 0) return (0); - if ((mntsize = getfsstat(mntbuf, bufsize, flags)) < 0) + if ((mntsize = freebsd10_getfsstat(mntbuf, bufsize, flags)) < 0) return (0); } *mntbufp = mntbuf; return (mntsize); } + +__sym_compat(getmntinfo, freebsd10_getmntinfo, FBSD_1.0); Modified: projects/ino64/lib/libc/gen/glob-compat10.c ============================================================================== --- projects/ino64/lib/libc/gen/glob-compat10.c Tue Dec 23 08:26:15 2014 (r276119) +++ projects/ino64/lib/libc/gen/glob-compat10.c Tue Dec 23 08:40:24 2014 (r276120) @@ -82,7 +82,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -93,6 +92,8 @@ __FBSDID("$FreeBSD$"); #include #include "collate.h" +#include "gen-compat.h" +#include "glob-compat10.h" /* * glob(3) expansion limits. Stop the expansion if any of these limits @@ -165,13 +166,13 @@ typedef char Char; static int compare(const void *, const void *); static int g_Ctoc(const Char *, char *, size_t); -static int g_lstat(Char *, struct stat *, glob_t *); +static int g_lstat(Char *, struct freebsd10_stat *, glob_t *); static DIR *g_opendir(Char *, glob_t *); static const Char *g_strchr(const Char *, wchar_t); #ifdef notdef static Char *g_strcat(Char *, const Char *); #endif -static int g_stat(Char *, struct stat *, glob_t *); +static int g_stat(Char *, struct freebsd10_stat *, glob_t *); static int glob0(const Char *, glob_t *, struct glob_limit *); static int glob1(Char *, glob_t *, struct glob_limit *); static int glob2(Char *, Char *, Char *, Char *, glob_t *, @@ -190,7 +191,7 @@ static void qprintf(const char *, Char #endif int -glob(const char * __restrict pattern, int flags, +freebsd10_glob(const char * __restrict pattern, int flags, int (*errfunc)(const char *, int), glob_t * __restrict pglob) { struct glob_limit limit = { 0, 0, 0, 0, 0 }; @@ -577,7 +578,7 @@ static int glob2(Char *pathbuf, Char *pathend, Char *pathend_last, Char *pattern, glob_t *pglob, struct glob_limit *limit) { - struct stat sb; + struct freebsd10_stat sb; Char *p, *q; int anymeta; @@ -645,7 +646,7 @@ glob3(Char *pathbuf, Char *pathend, Char Char *pattern, Char *restpattern, glob_t *pglob, struct glob_limit *limit) { - struct dirent *dp; + struct freebsd10_dirent *dp; DIR *dirp; int err; char buf[MAXPATHLEN]; @@ -656,7 +657,7 @@ glob3(Char *pathbuf, Char *pathend, Char * and dirent.h as taking pointers to differently typed opaque * structures. */ - struct dirent *(*readdirfunc)(); + struct freebsd10_dirent *(*readdirfunc)(); if (pathend > pathend_last) return (GLOB_ABORTED); @@ -681,7 +682,7 @@ glob3(Char *pathbuf, Char *pathend, Char if (pglob->gl_flags & GLOB_ALTDIRFUNC) readdirfunc = pglob->gl_readdir; else - readdirfunc = readdir; + readdirfunc = freebsd10_readdir; while ((dp = (*readdirfunc)(dirp))) { char *sc; Char *dc; @@ -857,7 +858,7 @@ match(Char *name, Char *pat, Char *paten /* Free allocated data belonging to a glob_t structure. */ void -globfree(glob_t *pglob) +freebsd10_globfree(glob_t *pglob) { size_t i; char **pp; @@ -891,7 +892,7 @@ g_opendir(Char *str, glob_t *pglob) } static int -g_lstat(Char *fn, struct stat *sb, glob_t *pglob) +g_lstat(Char *fn, struct freebsd10_stat *sb, glob_t *pglob) { char buf[MAXPATHLEN]; @@ -901,11 +902,11 @@ g_lstat(Char *fn, struct stat *sb, glob_ } if (pglob->gl_flags & GLOB_ALTDIRFUNC) return((*pglob->gl_lstat)(buf, sb)); - return (lstat(buf, sb)); + return (freebsd10_lstat(buf, sb)); } static int -g_stat(Char *fn, struct stat *sb, glob_t *pglob) +g_stat(Char *fn, struct freebsd10_stat *sb, glob_t *pglob) { char buf[MAXPATHLEN]; @@ -915,7 +916,7 @@ g_stat(Char *fn, struct stat *sb, glob_t } if (pglob->gl_flags & GLOB_ALTDIRFUNC) return ((*pglob->gl_stat)(buf, sb)); - return (stat(buf, sb)); + return (freebsd10_stat(buf, sb)); } static const Char * @@ -967,3 +968,6 @@ qprintf(const char *str, Char *s) (void)printf("\n"); } #endif + +__sym_compat(glob, freebsd10_glob, FBSD_1.0); +__sym_compat(globfree, freebsd10_globfree, FBSD_1.0); Modified: projects/ino64/lib/libc/gen/glob-compat10.h ============================================================================== --- projects/ino64/lib/libc/gen/glob-compat10.h Tue Dec 23 08:26:15 2014 (r276119) +++ projects/ino64/lib/libc/gen/glob-compat10.h Tue Dec 23 08:40:24 2014 (r276120) @@ -33,8 +33,8 @@ *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***