From patchwork Tue Jun 21 05:07:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 13267 Received: (qmail 29774 invoked by alias); 21 Jun 2016 05:13:37 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 20791 invoked by uid 89); 21 Jun 2016 05:13:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=19922015, 1992-2015, 1996-2016, 19962016 X-HELO: na01-bl2-obe.outbound.protection.outlook.com Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; From: Yury Norov To: , CC: , , , , , , , , , Yury Norov , Yury Norov Subject: [PATCH 22/27] [AARCH64] ILP32: support stat syscall family Date: Tue, 21 Jun 2016 08:07:06 +0300 Message-ID: <1466485631-3532-24-git-send-email-ynorov@caviumnetworks.com> In-Reply-To: <1466485631-3532-1-git-send-email-ynorov@caviumnetworks.com> References: <1466485631-3532-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-ClientProxiedBy: HE1PR03CA0030.eurprd03.prod.outlook.com (10.163.170.168) To SN1PR07MB2254.namprd07.prod.outlook.com (10.164.47.148) X-MS-Office365-Filtering-Correlation-Id: 34a801bd-6046-44ca-5e64-08d399928afd X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2254; 2:531d5rZs3EsDo6jOSkSXBXWoA7PtJGrsGgRZksj792qkvdxaKFaOGaCP0R/fMZ91ir6qsowJdwXThXonNyzGsFh60DwEpcWjMiUc1W7095R6JoecqiH+XaBWAN/tnLvm3kulK6WDQhRaD4beBI7xKlqnJkBGYauZQ89+WUxQiu91tTZM+0JDjAUknV3SizcY; 3:64TJAsB4geOJqt079sZcVWjlluDoj/l7wJ91zY9fEti9Ascm+89+1mD32q7NeCwCARC014miJHQGxWXRaaLMwFSUh9hUc0q4mtGvutgyZ2a5n2U0PIKBTfOFWFzukuqK; 25:npY0TpLLrfyMaKP2d28wo5n6b4d/+j37OqFPqVV6/YYPineugU7KNI+b/wMbjvGpYN1aog4LX8gfdPt+4DyN6a73EN3fd/k33u1OA5SHeQ4qCOHjU8JCJkAhUmr3Ms2av/BrkTgCZ8Eg6ZfBjGoC08SRoFIsEEeqAXkQAVu/72cVNc46KVwD6ZlXaKcmvoPQGRb/ZmXoGmBEvIVPkGdBW6p/lUwP0EG5ioHfdfw9drzzsvVBWih/c1pApNunw2eKgkfOHGib2bK+GskHm/k6E9qQU5ov74+ZkQ6El77Iz6GIMWQmXFiGYzHPmYHIWB1jCoc5yuQyI5eoShG/toUlZYuBXeKOfeKEG+kboQVbA2VPGUQwVrX0gdjAJ6MINlHQt//uTVbYGOzZKMqEsYP5zIVplx7Yyj42jioS5kK817I= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR07MB2254; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2254; 20:xQXM8kk+KYIHXj9h9bSOYvO5X8jJdBizdszBHBAb0pbjgumDDi60R2hbfD00WxXqsiZ+b9KAbrin7GRSCSiRYtUK3Om6KfLQalsETDP+wxz7HZTYFexYfdqj0aTKTOCtPwj1/scHX8AoXFLc9Y9HRGOnVo77y66A5suxKuLh+R4SmhKMYhkzoLoZ2wxcUKGBvn6BZDF15KdY+s2m1KF+cWt6xfBU35cfx18Vs4XXHlMgX92B1GKhSJlZWEN0ajnctIufhor5sgifB7ZRvHDUrXv7vBJtQcjW524LkQk2abfROPe9CpWoohN7b5hUfc4skp0986NBFaGEYh10zDNyPHa+VJRRqPk1iX98/SxthxqKH8gFXrxYqsynjwM+Iu0sWwb0uH3UXGet0rzpDUxkkP1tkedf56/t86nr1nk+I1Tnx3biuw3oB2PuB7f1H74Qhx4ccsf0ugsRpeJCPSE1iHsQhuG/I8g23cu8gR0Lu2GJHwnN0XHl76QVx1z48CetNUp5Q1mOGXDm7Lg+WdxPnXkSIcjIWPzVNBPGJhZUjJeN2cDTap7YeiohtqAGaopCf/Qt8oiK1M5kZlJcDtjj7Oenv6MSwH0oa+GocXE6LEQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(250305191791016)(22074186197030); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:SN1PR07MB2254; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2254; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2254; 4:zrG07iGVTq5U5XtMMsE8VbNA3CeAsaYNQSGDUivKsttSV5jt+iUwr4dl/mUpjjWjy3ygVdvfjLWku6u16+Pb2zDJZt3G9Eik2t76biHtoTniOrKIx01pws/I3p2djrsf50k19GTu2yxzv2jySz0XsgTJebgZgQesmlOWI0MiP4/5dRj5RqHTAorDgOGdFiX13VclJAcnYU+NPQ/n6NdAtSiSFbDYmAflFl/dk53ZblA/UtL7QKhpSF8Hgr6SvyxY2iKhGbJgOFsQp3T3kEqYS/Xc/djEEc8XxcwFpwZ7S6mPbVErDIqlrxmQbfdvrPjeF9cS+ZpfbK7HG4yfuzxoie97GIz8mMdJYUmTY4Nrge3OF+RO00Q6fQq0XolbBTJRfkQ2nqRGt15qWCjSWXMQYHjvsRkVGGcm4XBmH25GCDaJgfskatCRpZ2kVhMHELQg X-Forefront-PRVS: 098076C36C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(199003)(189002)(40224003)(66066001)(4001430100002)(4326007)(5003940100001)(36756003)(2906002)(47776003)(19580395003)(50226002)(7736002)(5001770100001)(42186005)(97736004)(19580405001)(189998001)(106356001)(15975445007)(81166006)(92566002)(81156014)(8676002)(77096005)(33646002)(105586002)(50986999)(76176999)(586003)(2950100001)(48376002)(76506005)(68736007)(101416001)(107886002)(7846002)(3846002)(50466002)(229853001)(6116002)(575784001)(2004002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2254; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR07MB2254; 23:LZLSc7dKMjvAVbaHIou7eYU5IQkNTy3XmNOcQCnqZ?= =?us-ascii?Q?iKX+RAI/FWfcRbikgR0njYq8RL+yUxxJisWyYF2Qml/AhfGaGRC3KFZqI4Zo?= =?us-ascii?Q?shiktSrNjZydsXMYHsJVelmpgl6YxVPuvePDwEWdlAmrovYICEnZtyqG6HkM?= =?us-ascii?Q?0iKESaXYYmk+NDfIeMntzDMq7PYPP+B872E1ERHHJyCDvYEhDgkf3Yy96rZV?= =?us-ascii?Q?Jx0Hev7pmWf57Txix38dVjRlodGfIeaqkZgAfYhGcx7btkwebqtRmwV3LuUy?= =?us-ascii?Q?3d2vR8gZ0BbOZrJpC0z00dByUIvmJFjPydNKwvWLwi/TuYBv0U3IDnatZLrG?= =?us-ascii?Q?nfKJ9fcZhKtPDJvUrQVTsn89WSI2vb9IwaQRXi2uhcUyoKR8ow/l+IuPWDZo?= =?us-ascii?Q?IPexqolEFPif85PCWhpkEtCcPZq0Jn8Vxyzc5nld2SV2NwnkjxWZmkmQWs0+?= =?us-ascii?Q?BS8WZ2tGfBt5+Zjc4sQt0691WrlfgmDsZ+L43fRpoo1RL4+hOYaKO0ZFqhgt?= =?us-ascii?Q?iGBMdirVajdsjgGVAnDtJ9H6MwVykphujoL+e86h2iA/9uwUD/kRATkHv676?= =?us-ascii?Q?4bf57mL7vu5Esal37TdurRkMJ4asaTVPCMNVV84mIy8xNRGAGyOhKFx4Ehwh?= =?us-ascii?Q?+UAhM6316u3+W0YgiV5Ozu+9XB0W10J3Bw/N43t3xs5BfKNo3MT8tGmNA+Eo?= =?us-ascii?Q?dGemGKn6DlAtJx2sFD0v/dCSuv2W9hsa7h0LL9htqlql/3dKLKhUNaLn1p7p?= =?us-ascii?Q?BVtAtf2xJRt9gAHArTlNktFmmhIhLjKzOdrP0tb2cvDfXi+IJGh7tsetOIwv?= =?us-ascii?Q?X5/SgvsGVMeVhUhcpL6y9W/MdjuWWp+0wUw52wtRkc9DphoCKUsAMNHvm487?= =?us-ascii?Q?d+ZbSM1EdqD94OsVqrzORq7jocxdbWBhaxt778jUyVzGrXq65VHXnRijhzbw?= =?us-ascii?Q?95Lz53IlmSKJeoaxbNUeHyjEkOlo1N5OF69O3bSiZHXb1kjv3x5IW07GOvj5?= =?us-ascii?Q?dB+j+5iEeqmi4rbESQBGcN+3vSp3eoZS3/8soYMPLfT18ZI0n+MN1Ji1PFLU?= =?us-ascii?Q?QABSxnYmkmeeiPTVWY6n+6suDT4O7aK4ttVMNBo8gizA83vh8UhLhvSyVjxx?= =?us-ascii?Q?0ZGSiMvfI6X6KHRoUOU2FOOm7tbegdlDvFXvoBI1kSlPzm9sIWblcuEO3NaH?= =?us-ascii?Q?Z8vlqWl18Z72ZqWAmxxs+EKdVRLGPqDvALt7k+yi9Tn4zac/RU5yyPHnQ=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2254; 6:mpC29YqJNnxtbbPlVZizoM2mkjKB+JB0JW9OO/HsNqMjqvrYqmeFVkqsWgrZtPYkJODsbEfM/2q5P/Dh2qF8P7kxjrRzahQBduRsqWFO7jJQQmdgCIrVRjdXE9ghXUR4VB0PT281BSo2KydGMCXYq0mDTZQqp+zHh4U9M426pij4Ue1Dx34VoXlt5PmwH4k9xeZ1h6Tw/oRyt7kleMVT5ndfU7IJekyBEUPOeHRout8rDAPyMpeNTPW68NcecRQeL7pLXzBjd2kl9qgB+oLgvzboABoJsfHd9GYQ1CZeNvE=; 5:USWv+7RJvnOwY11Z0fbnAw6k0gVsenyK2RP1Sw59NYbHhlHu0Z8BpLCBALh2Ehh63dlRi7z1xaTHEFJp4dtcmQ2yqHeWu/ZSGB4iFGBSUIy9ZnTxzXHSt++nAWF58qYG380rTXi/3zJXPD7XSc31VQ==; 24:Xf+5/pZqpBjMd6qNPooaN+KsDzYkrOqUZx8mkr8ll+iZookBEh2p1loYbr05kVlxRXztiJ18nholHAdfzbKYRw3CJ4TinY6RTDkgiN+DHbY=; 7:/USt8P48Amg5ac895b2Sn/+3f9jRz5Sz288Pt7zYOysRDGXBW5QWTkfD2FHO4Dlxu/kBvbiVL5uuB5cQD84k99D9e3pYUze5og+xuJhsAxKsm+OE8Le88s5IDt8KNCtUV4VFz+ng7Wl0lJ74fx8njnqJB5YseG9ymbIJENMuFoAFx3+Bmn+L5Snv8B82fYvjhBpnX4Mt1lUv5W5+cSuK+Wd+I2PqXV3cRvEWDo2ddBmpnqQQFhqU9HdvN2kJGY5S SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2016 05:11:46.0683 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2254 From: Yury Norov stat and statfs structures has their layouts identical to lp64 after changing off_t, ino_t etc sizes to 64-bit. It means we can pass it to kernel same way as lp64 does. Signed-off-by: Yury Norov --- sysdeps/unix/sysv/linux/aarch64/bits/stat.h | 195 +++++++++++++++++++++ sysdeps/unix/sysv/linux/aarch64/bits/statfs.h | 72 ++++++++ sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs.c | 29 +++ sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c | 72 ++++++++ sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c | 51 ++++++ sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c | 54 ++++++ sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c | 48 +++++ sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c | 52 ++++++ sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c | 47 +++++ sysdeps/unix/sysv/linux/aarch64/ilp32/statfs.c | 30 ++++ sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c | 29 +++ sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c | 47 +++++ sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c | 47 +++++ 13 files changed, 773 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/stat.h create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/statfs.h create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs.c create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs.c create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c create mode 100644 sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/stat.h b/sysdeps/unix/sysv/linux/aarch64/bits/stat.h new file mode 100644 index 0000000..eec6789 --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/bits/stat.h @@ -0,0 +1,195 @@ +/* Copyright (C) 1992-2015 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#if !defined _SYS_STAT_H && !defined _FCNTL_H +# error "Never include directly; use instead." +#endif + +#ifndef _BITS_STAT_H +#define _BITS_STAT_H 1 + +/* Versions of the `struct stat' data structure. */ +#define _STAT_VER_KERNEL 0 +#define _STAT_VER_LINUX 0 +#define _STAT_VER _STAT_VER_KERNEL + +/* Versions of the `xmknod' interface. */ +#define _MKNOD_VER_LINUX 0 + +#ifdef __ILP32__ +#include +struct __kernel_timespec + { + unsigned long long tv_sec; /* Seconds. */ + long long tv_nsec; /* Nanoseconds. */ + }; +#define conv_timespec(u, k) do { \ + (u)->tv_sec = (k)->tv_sec; \ + (u)->tv_nsec = (k)->tv_nsec; \ +} while (0) +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define __type3264(type, name) \ + type (name); type name##_pad +#else +#define __type3264(type, name) \ + type name##_pad; type name +#endif + +#else +#define __kernel_timespec timespec +#define conv_timespec(u, k) +#define __type3264(type, name) type name +#endif /* __ILP32__ */ + +struct stat + { + __dev_t st_dev; /* Device. */ + __ino_t st_ino; /* File serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + __dev_t __pad1; + __off_t st_size; /* Size of file, in bytes. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + int __pad2; + + __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ +#ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + union { + struct timespec st_atim; /* Time of last access. */ + struct __kernel_timespec __st_atim; + }; + union { + struct timespec st_mtim; /* Time of last modification. */ + struct __kernel_timespec __st_mtim; + }; + union { + struct timespec st_ctim; /* Time of last status change. */ + struct __kernel_timespec __st_ctim; + }; +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else + __type3264(__time_t, st_atime); /* Time of last access. */ + __type3264(unsigned long int, st_atimensec); /* Nsecs of last access. */ + __type3264(__time_t, st_mtime); /* Time of last modification. */ + __type3264(unsigned long int, st_mtimensec); /* Nsecs of last modification. */ + __type3264(__time_t, st_ctime); /* Time of last status change. */ + __type3264(unsigned long int, st_ctimensec); /* Nsecs of last status change. */ +#endif + int __glibc_reserved[2]; + }; + +#ifdef __USE_LARGEFILE64 +struct stat64 + { + __dev_t st_dev; /* Device. */ + __ino_t st_ino; /* File serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + __dev_t __pad1; + __off_t st_size; /* Size of file, in bytes. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + int __pad2; + + __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ +#ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + union { + struct timespec st_atim; /* Time of last access. */ + struct __kernel_timespec __st_atim; + }; + union { + struct timespec st_mtim; /* Time of last modification. */ + struct __kernel_timespec __st_mtim; + }; + union { + struct timespec st_ctim; /* Time of last status. */ + struct __kernel_timespec __st_ctim; + }; +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else + __type3264(__time_t, st_atime); /* Time of last access. */ + __type3264(unsigned long int, st_atimensec); /* Nsecs of last access. */ + __type3264(__time_t, st_mtime); /* Time of last modification. */ + __type3264(unsigned long int, st_mtimensec); /* Nsecs of last modification. */ + __type3264(__time_t, st_ctime); /* Time of last status change. */ + __type3264(unsigned long int, st_ctimensec); /* Nsecs of last status change. */ +#endif + int __glibc_reserved[2]; + }; +#endif + +/* Tell code we have these members. */ +#define _STATBUF_ST_BLKSIZE +#define _STATBUF_ST_RDEV +/* Nanosecond resolution time values are supported. */ +#define _STATBUF_ST_NSEC + +/* Encoding of the file mode. */ + +#define __S_IFMT 0170000 /* These bits determine file type. */ + +/* File types. */ +#define __S_IFDIR 0040000 /* Directory. */ +#define __S_IFCHR 0020000 /* Character device. */ +#define __S_IFBLK 0060000 /* Block device. */ +#define __S_IFREG 0100000 /* Regular file. */ +#define __S_IFIFO 0010000 /* FIFO. */ +#define __S_IFLNK 0120000 /* Symbolic link. */ +#define __S_IFSOCK 0140000 /* Socket. */ + +/* POSIX.1b objects. Note that these macros always evaluate to zero. But + they do it by enforcing the correct use of the macros. */ +#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) +#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) +#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) + +/* Protection bits. */ + +#define __S_ISUID 04000 /* Set user ID on execution. */ +#define __S_ISGID 02000 /* Set group ID on execution. */ +#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ +#define __S_IREAD 0400 /* Read by owner. */ +#define __S_IWRITE 0200 /* Write by owner. */ +#define __S_IEXEC 0100 /* Execute by owner. */ + +#ifdef __USE_ATFILE +# define UTIME_NOW ((1l << 30) - 1l) +# define UTIME_OMIT ((1l << 30) - 2l) +#endif + +#endif /* bits/stat.h */ diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/statfs.h b/sysdeps/unix/sysv/linux/aarch64/bits/statfs.h new file mode 100644 index 0000000..81a8626 --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/bits/statfs.h @@ -0,0 +1,72 @@ +/* Copyright (C) 2011-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Chris Metcalf , 2011. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _SYS_STATFS_H +# error "Never include directly; use instead." +#endif + +#include +#include +#include + +/* 64-bit libc uses the kernel's 'struct statfs', accessed via the + statfs() syscall; 32-bit libc uses the kernel's 'struct statfs64' + and accesses it via the statfs64() syscall. All the various + APIs offered by libc use the kernel shape for their struct statfs + structure; the only difference is that 32-bit programs not + using __USE_FILE_OFFSET64 only see the low 32 bits of some + of the fields (the __fsblkcnt_t and __fsfilcnt_t fields). */ + +struct statfs + { + unsigned long long f_type; + unsigned long long f_bsize; + __fsblkcnt_t f_blocks; + __fsblkcnt_t f_bfree; + __fsblkcnt_t f_bavail; + __fsfilcnt_t f_files; + __fsfilcnt_t f_ffree; + __fsid_t f_fsid; + unsigned long long f_namelen; + unsigned long long f_frsize; + unsigned long long f_flags; + unsigned long long f_spare[4]; + }; + +#ifdef __USE_LARGEFILE64 +struct statfs64 + { + unsigned long long f_type; + unsigned long long f_bsize; + __fsblkcnt_t f_blocks; + __fsblkcnt_t f_bfree; + __fsblkcnt_t f_bavail; + __fsfilcnt_t f_files; + __fsfilcnt_t f_ffree; + __fsid_t f_fsid; + unsigned long long f_namelen; + unsigned long long f_frsize; + unsigned long long f_flags; + unsigned long long f_spare[4]; + }; +#endif + +/* Tell code we have these members. */ +#define _STATFS_F_NAMELEN +#define _STATFS_F_FRSIZE +#define _STATFS_F_FLAGS diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs.c new file mode 100644 index 0000000..8e900fd --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs.c @@ -0,0 +1,29 @@ +/* Copyright (C) 2011-2015 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Chris Metcalf , 2011. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#include +#include +#include + +/* Return information about the filesystem on which FD resides. */ +int +__fstatfs (int fd, struct statfs *buf) +{ + return INLINE_SYSCALL (fstatfs64, 2, fd, buf); +} +weak_alias (__fstatfs, fstatfs) diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c new file mode 100644 index 0000000..d7b90bb --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fstatfs64.c @@ -0,0 +1,72 @@ +/* Return information about the filesystem on which FD resides. + Copyright (C) 1996-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include +#include +#include + +/* Defined in statfs64.c. */ +extern int __no_statfs64 attribute_hidden; + +/* Return information about the filesystem on which FD resides. */ +int +__fstatfs64 (int fd, struct statfs64 *buf) +{ +#ifdef __NR_fstatfs64 +# if __ASSUME_STATFS64 == 0 + if (! __no_statfs64) +# endif + { + int result = INLINE_SYSCALL (fstatfs64, 2, fd, buf); + +# if __ASSUME_STATFS64 == 0 + if (result == 0 || errno != ENOSYS) +# endif + return result; + +# if __ASSUME_STATFS64 == 0 + __no_statfs64 = 1; +# endif + } +#endif + +#if __ASSUME_STATFS64 == 0 + struct statfs buf32; + + if (__fstatfs (fd, &buf32) < 0) + return -1; + + buf->f_type = buf32.f_type; + buf->f_bsize = buf32.f_bsize; + buf->f_blocks = buf32.f_blocks; + buf->f_bfree = buf32.f_bfree; + buf->f_bavail = buf32.f_bavail; + buf->f_files = buf32.f_files; + buf->f_ffree = buf32.f_ffree; + buf->f_fsid = buf32.f_fsid; + buf->f_namelen = buf32.f_namelen; + buf->f_frsize = buf32.f_frsize; + memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); + + return 0; +#endif +} +weak_alias (__fstatfs64, fstatfs64) diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c new file mode 100644 index 0000000..83df0e4 --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat.c @@ -0,0 +1,51 @@ +//#include +/* Copyright (C) 2011-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Chris Metcalf , 2011. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#include +#include +#include +#include +#include + +#include +#include + +/* Get information about the file FD in BUF. */ +int +__fxstat (int vers, int fd, struct stat *buf) +{ + if (vers == _STAT_VER_KERNEL) + { + int rc = INLINE_SYSCALL (fstat64, 2, fd, buf); + if (!rc) { + conv_timespec(&buf->st_atim, &buf->__st_atim); + conv_timespec(&buf->st_mtim, &buf->__st_mtim); + conv_timespec(&buf->st_ctim, &buf->__st_ctim); + } + + return rc; + + } + + errno = EINVAL; + return -1; +} + +hidden_def (__fxstat) +weak_alias (__fxstat, _fxstat); diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c new file mode 100644 index 0000000..f651921 --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstat64.c @@ -0,0 +1,54 @@ +/* fxstat64 using Linux fstat64 system call. + Copyright (C) 1997-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include + +#include +#include + +#include + +/* Get information about the file FD in BUF. */ + +int +___fxstat64 (int vers, int fd, struct stat64 *buf) +{ + int result; + result = INLINE_SYSCALL (fstat64, 2, fd, buf); + if (!result) { + conv_timespec(&buf->st_atim, &buf->__st_atim); + conv_timespec(&buf->st_mtim, &buf->__st_mtim); + conv_timespec(&buf->st_ctim, &buf->__st_ctim); + } + return result; +} + +#include + +#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2) +versioned_symbol (libc, ___fxstat64, __fxstat64, GLIBC_2_2); +strong_alias (___fxstat64, __old__fxstat64) +compat_symbol (libc, __old__fxstat64, __fxstat64, GLIBC_2_1); +hidden_ver (___fxstat64, __fxstat64) +#else +strong_alias (___fxstat64, __fxstat64) +hidden_def (__fxstat64) +#endif diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c new file mode 100644 index 0000000..fb03a7d --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat.c @@ -0,0 +1,48 @@ +//#include +/* Copyright (C) 2011-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Chris Metcalf , 2011. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +/* Get information about the file NAME in BUF. */ +int +__fxstatat (int vers, int fd, const char *file, struct stat *buf, int flag) +{ + if (vers == _STAT_VER_KERNEL) + { + int rc = INLINE_SYSCALL (fstatat64, 4, fd, file, buf, flag); + if (!rc) { + conv_timespec(&buf->st_atim, &buf->__st_atim); + conv_timespec(&buf->st_mtim, &buf->__st_mtim); + conv_timespec(&buf->st_ctim, &buf->__st_ctim); + } + return rc; + } + + errno = EINVAL; + return -1; +} +libc_hidden_def (__fxstatat) diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c new file mode 100644 index 0000000..9d36ff4 --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/fxstatat64.c @@ -0,0 +1,52 @@ +//#include +/* Copyright (C) 2005-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +/* Get information about the file NAME in BUF. */ + +int +__fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag) +{ + if (__glibc_unlikely (vers != _STAT_VER_LINUX)) + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); + + int result; + INTERNAL_SYSCALL_DECL (err); + + result = INTERNAL_SYSCALL (fstatat64, err, 4, fd, file, st, flag); + if (!__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1)) { + conv_timespec(&st->st_atim, &st->__st_atim); + conv_timespec(&st->st_mtim, &st->__st_mtim); + conv_timespec(&st->st_ctim, &st->__st_ctim); + return 0; + } + else + return INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (result, + err)); +} +libc_hidden_def (__fxstatat64) diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c new file mode 100644 index 0000000..e8de70e --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/lxstat.c @@ -0,0 +1,47 @@ +//#include +/* Copyright (C) 2011-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Chris Metcalf , 2011. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#include +#include +#include +#include +#include + +#include +#include + +/* Get information about the file NAME in BUF. */ +int +__lxstat (int vers, const char *name, struct stat *buf) +{ + if (vers == _STAT_VER_KERNEL) + { + int rc = INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf, + AT_SYMLINK_NOFOLLOW); + if (!rc) { + conv_timespec(&buf->st_atim, &buf->__st_atim); + conv_timespec(&buf->st_mtim, &buf->__st_mtim); + conv_timespec(&buf->st_ctim, &buf->__st_ctim); + } + return rc; + } + errno = EINVAL; + return -1; +} +hidden_def (__lxstat) diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/statfs.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/statfs.c new file mode 100644 index 0000000..bf70a7a --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/statfs.c @@ -0,0 +1,30 @@ +/* Copyright (C) 2011-2015 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Chris Metcalf , 2011. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#include +#include +#include + +/* Return information about the filesystem on which FILE resides. */ +int +__statfs (const char *file, struct statfs *buf) +{ + return INLINE_SYSCALL (statfs64, 2, file, buf); +} +libc_hidden_def (__statfs) +weak_alias (__statfs, statfs) diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c new file mode 100644 index 0000000..b99ab94 --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/statfs64.c @@ -0,0 +1,29 @@ +/* Copyright (C) 2011-2015 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Chris Metcalf , 2011. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#include +#include +#include + +/* Return information about the filesystem on which FILE resides. */ +int +__statfs64 (const char *file, struct statfs64 *buf) +{ + return INLINE_SYSCALL (statfs64, 2, file, buf); +} +weak_alias (__statfs64,statfs64) diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c new file mode 100644 index 0000000..b4e8423 --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat.c @@ -0,0 +1,47 @@ +//#include +/* Copyright (C) 2011-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Chris Metcalf , 2011. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#include +#include +#include +#include +#include + +#include +#include + +/* Get information about the file NAME in BUF. */ +int +__xstat (int vers, const char *name, struct stat *buf) +{ + if (vers == _STAT_VER_KERNEL) + { + int rc = INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf, 0); + if (!rc) { + conv_timespec(&buf->st_atim, &buf->__st_atim); + conv_timespec(&buf->st_mtim, &buf->__st_mtim); + conv_timespec(&buf->st_ctim, &buf->__st_ctim); + } + return rc; + } + + errno = EINVAL; + return -1; +} +hidden_def (__xstat) diff --git a/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c b/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c new file mode 100644 index 0000000..e4f4cd5 --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/ilp32/xstat64.c @@ -0,0 +1,47 @@ +//#include +/* Copyright (C) 2011-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Chris Metcalf , 2011. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#include +#include +#include +#include +#include + +#include +#include + +/* Get information about the file NAME in BUF. */ +int +__xstat64 (int vers, const char *name, struct stat64 *buf) +{ + if (vers == _STAT_VER_KERNEL) { + int rc = INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf, 0); + if (!rc) { + conv_timespec(&buf->st_atim, &buf->__st_atim); + conv_timespec(&buf->st_mtim, &buf->__st_mtim); + conv_timespec(&buf->st_ctim, &buf->__st_ctim); + } + + return rc; + } + + errno = EINVAL; + return -1; +} +hidden_def (__xstat64)