source: azure_iot_hub/trunk/musl-1.1.18/src/dirent/readdir_r.c@ 388

Last change on this file since 388 was 388, checked in by coas-nagasima, 5 years ago

Azure IoT Hub Device C SDK を使ったサンプルの追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-csrc
File size: 527 bytes
Line 
1#include <dirent.h>
2#include <errno.h>
3#include <string.h>
4#include "__dirent.h"
5#include "libc.h"
6
7int readdir_r(DIR *restrict dir, struct dirent *restrict buf, struct dirent **restrict result)
8{
9 struct dirent *de;
10 int errno_save = errno;
11 int ret;
12
13 LOCK(dir->lock);
14 errno = 0;
15 de = readdir(dir);
16 if ((ret = errno)) {
17 UNLOCK(dir->lock);
18 return ret;
19 }
20 errno = errno_save;
21 if (de) memcpy(buf, de, de->d_reclen);
22 else buf = NULL;
23
24 UNLOCK(dir->lock);
25 *result = buf;
26 return 0;
27}
28
29LFS64_2(readdir_r, readdir64_r);
Note: See TracBrowser for help on using the repository browser.