mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-14 20:37:06 +00:00
parent
066b09c2b1
commit
f8a926bebe
|
@ -131,6 +131,11 @@ int scandir_b(const char *, struct dirent ***,
|
||||||
int (^)(const struct dirent **, const struct dirent **));
|
int (^)(const struct dirent **, const struct dirent **));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#if __BSD_VISIBLE
|
||||||
|
int scandirat(int, const char *, struct dirent ***,
|
||||||
|
int (*)(const struct dirent *), int (*)(const struct dirent **,
|
||||||
|
const struct dirent **));
|
||||||
|
#endif
|
||||||
#if __XSI_VISIBLE
|
#if __XSI_VISIBLE
|
||||||
void seekdir(DIR *, long);
|
void seekdir(DIR *, long);
|
||||||
long telldir(DIR *);
|
long telldir(DIR *);
|
||||||
|
|
|
@ -439,6 +439,7 @@ FBSD_1.7 {
|
||||||
posix_spawn_file_actions_addchdir_np;
|
posix_spawn_file_actions_addchdir_np;
|
||||||
posix_spawn_file_actions_addclosefrom_np;
|
posix_spawn_file_actions_addclosefrom_np;
|
||||||
posix_spawn_file_actions_addfchdir_np;
|
posix_spawn_file_actions_addfchdir_np;
|
||||||
|
scandirat;
|
||||||
sched_getaffinity;
|
sched_getaffinity;
|
||||||
sched_setaffinity;
|
sched_setaffinity;
|
||||||
sched_getcpu;
|
sched_getcpu;
|
||||||
|
|
|
@ -42,8 +42,10 @@ __FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
#include "namespace.h"
|
#include "namespace.h"
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include "un-namespace.h"
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#ifdef I_AM_SCANDIR_B
|
#ifdef I_AM_SCANDIR_B
|
||||||
|
@ -159,6 +161,25 @@ scandir(const char *dirname, struct dirent ***namelist,
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef I_AM_SCANDIR_B
|
#ifndef I_AM_SCANDIR_B
|
||||||
|
int
|
||||||
|
scandirat(int dirfd, const char *dirname, struct dirent ***namelist,
|
||||||
|
int (*select)(const struct dirent *), int (*dcomp)(const struct dirent **,
|
||||||
|
const struct dirent **))
|
||||||
|
{
|
||||||
|
DIR *dirp;
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
fd = _openat(dirfd, dirname, O_RDONLY | O_DIRECTORY | O_CLOEXEC);
|
||||||
|
if (fd == -1)
|
||||||
|
return (-1);
|
||||||
|
dirp = fdopendir(fd);
|
||||||
|
if (dirp == NULL) {
|
||||||
|
_close(fd);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
return (scandir_dirp(dirp, namelist, select, dcomp));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Alphabetic order comparison routine for those who want it.
|
* Alphabetic order comparison routine for those who want it.
|
||||||
* POSIX 2008 requires that alphasort() uses strcoll().
|
* POSIX 2008 requires that alphasort() uses strcoll().
|
||||||
|
|
Loading…
Reference in a new issue