dir.c revision 9acbbeaf2a1ffe5c14b244867d427714fab43c5c
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <string.h>
#include <stddef.h>
#include <errno.h>
#include <unistd.h>
#include <assert.h>
#include <sys/lx_debug.h>
#define LX_NAMEMAX 256
struct lx_dirent {
long d_ino; /* not l_ino_t */
long d_off;
char d_name[LX_NAMEMAX];
};
struct lx_dirent64 {
char d_name[LX_NAMEMAX];
};
/*
* Read in one dirent structure from fd into dirp.
* p3 (count) is ignored.
*/
/*ARGSUSED*/
int
{
int rc = 0;
/*
* The return value from getdents is not applicable, as
* it might have squeezed more than one dirent in the buffer
* we provided.
*
* getdents() will deal with the case of dirp == NULL
*/
return (-errno);
/*
* Set rc 1 (pass), or 0 (end of directory).
*/
return (-errno);
return (rc);
}
/*
* Read in dirent64 structures from p1 (fd) into p2 (buffer).
* p3 (count) is the size of the memory area.
*/
int
{
int sbufsz;
int namelen;
struct lx_dirent64 *ld;
if (lbufsz < sizeof (struct lx_dirent64))
return (-EINVAL);
/*
* The Linux dirent64 is bigger than the Solaris dirent64. To
* avoid inadvertently consuming more of the directory than we can
* pass back to the Linux app, we hand the kernel a smaller buffer
* than the app handed us.
*/
return (-ENOMEM);
return (-errno);
/* munge the Solaris buffer to a linux buffer. */
rc = 0;
while (bytes > 0) {
if (namelen >= LX_NAMEMAX)
}
/* now copy the lbuf to the userland buffer */
return (-EFAULT);
return (rc);
}