source: azure_iot_hub/trunk/musl-1.1.18/src/unistd/dup3.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: 613 bytes
Line 
1#define _GNU_SOURCE
2#include <unistd.h>
3#include <errno.h>
4#include <fcntl.h>
5#include "syscall.h"
6#include "libc.h"
7
8int __dup3(int old, int new, int flags)
9{
10 int r;
11#ifdef SYS_dup2
12 if (old==new) return __syscall_ret(-EINVAL);
13 if (flags & O_CLOEXEC) {
14 while ((r=__syscall(SYS_dup3, old, new, flags))==-EBUSY);
15 if (r!=-ENOSYS) return __syscall_ret(r);
16 }
17 while ((r=__syscall(SYS_dup2, old, new))==-EBUSY);
18 if (flags & O_CLOEXEC) __syscall(SYS_fcntl, new, F_SETFD, FD_CLOEXEC);
19#else
20 while ((r=__syscall(SYS_dup3, old, new, flags))==-EBUSY);
21#endif
22 return __syscall_ret(r);
23}
24
25weak_alias(__dup3, dup3);
Note: See TracBrowser for help on using the repository browser.