663b0e1bcadb5792387e1ee600d306583b662335
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / uclibc / 0.9.33.2 / 0003-Add-dup3-syscall.patch
1 From 518bc50ae42540574bba360225c8a65b56b79148 Mon Sep 17 00:00:00 2001
2 From: Jonas Bonn <jonas@southpole.se>
3 Date: Tue, 6 Sep 2011 10:30:40 +0200
4 Subject: [PATCH 3/8] Add dup3 syscall
5
6 Signed-off-by: Jonas Bonn <jonas@southpole.se>
7 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
8 ---
9  include/unistd.h                 |  4 ++++
10  libc/sysdeps/linux/common/dup3.c | 17 +++++++++++++++++
11  2 files changed, 21 insertions(+)
12  create mode 100644 libc/sysdeps/linux/common/dup3.c
13
14 diff --git a/include/unistd.h b/include/unistd.h
15 index 1b2fd4d..f7d070b 100644
16 --- a/include/unistd.h
17 +++ b/include/unistd.h
18 @@ -513,6 +513,10 @@ extern int dup (int __fd) __THROW __wur;
19  extern int dup2 (int __fd, int __fd2) __THROW;
20  libc_hidden_proto(dup2)
21  
22 +/* Duplicate FD to FD2, closing FD2 and making it open on the same file.  */
23 +extern int dup3 (int __fd, int __fd2, int __flags) __THROW;
24 +libc_hidden_proto(dup3)
25 +
26  /* NULL-terminated array of "NAME=VALUE" environment variables.  */
27  extern char **__environ;
28  #ifdef __USE_GNU
29 diff --git a/libc/sysdeps/linux/common/dup3.c b/libc/sysdeps/linux/common/dup3.c
30 new file mode 100644
31 index 0000000..7b57438
32 --- /dev/null
33 +++ b/libc/sysdeps/linux/common/dup3.c
34 @@ -0,0 +1,17 @@
35 +/* vi: set sw=4 ts=4: */
36 +/*
37 + * dup3() for uClibc
38 + *
39 + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
40 + *
41 + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
42 + */
43 +
44 +#include <sys/syscall.h>
45 +#include <unistd.h>
46 +
47 +
48 +#ifdef __NR_dup3
49 +_syscall3(int, dup3, int, oldfd, int, newfd, int, flags)
50 +libc_hidden_def(dup3)
51 +#endif
52 -- 
53 1.8.1.2
54