Skip to content

Commit

Permalink
Import version 2.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
veos-sxarr committed Apr 22, 2019
1 parent 71db6d1 commit 3c131e6
Show file tree
Hide file tree
Showing 31 changed files with 391 additions and 58 deletions.
3 changes: 2 additions & 1 deletion elf/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -3547,7 +3547,8 @@ enum
#define R_VE_DTPMOD64 22
#define R_VE_DTPOFF64 23
#define R_VE_TPOFF64 24

#define R_VE_CALL_HI32 35
#define R_VE_CALL_LO32 36


__END_DECLS
Expand Down
2 changes: 1 addition & 1 deletion glibc.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
%define _unpackaged_files_terminate_build 0
Name: glibc-ve
Version: 2.21
Release: 1%{?dist}
Release: 3%{?dist}
Group: System/Libraries
Summary: glibc library ported for VE
#Group:
Expand Down
6 changes: 3 additions & 3 deletions io/bits/fcntl2.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ open64 (const char *__path, int __oflag, ...)

if (__builtin_constant_p (__oflag))
{
if ((__oflag & O_CREAT) != 0 && __va_arg_pack_len () < 1)
if (__OPEN_NEEDS_MODE (__oflag) != 0 && __va_arg_pack_len () < 1)
{
__open64_missing_mode ();
return __open64_2 (__path, __oflag);
Expand Down Expand Up @@ -121,7 +121,7 @@ openat (int __fd, const char *__path, int __oflag, ...)

if (__builtin_constant_p (__oflag))
{
if ((__oflag & O_CREAT) != 0 && __va_arg_pack_len () < 1)
if (__OPEN_NEEDS_MODE (__oflag) && __va_arg_pack_len () < 1)
{
__openat_missing_mode ();
return __openat_2 (__fd, __path, __oflag);
Expand Down Expand Up @@ -155,7 +155,7 @@ openat64 (int __fd, const char *__path, int __oflag, ...)

if (__builtin_constant_p (__oflag))
{
if ((__oflag & O_CREAT) != 0 && __va_arg_pack_len () < 1)
if (__OPEN_NEEDS_MODE (__oflag) && __va_arg_pack_len () < 1)
{
__openat64_missing_mode ();
return __openat64_2 (__fd, __path, __oflag);
Expand Down
9 changes: 9 additions & 0 deletions io/fcntl.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ __BEGIN_DECLS
numbers and flag bits for `open', `fcntl', et al. */
#include <bits/fcntl.h>

/* Detect if open needs mode as a third argument (or for openat as a fourth
* argument). */
#ifdef __O_TMPFILE
# define __OPEN_NEEDS_MODE(oflag) \
(((oflag) & O_CREAT) != 0 || ((oflag) & __O_TMPFILE) == __O_TMPFILE)
#else
# define __OPEN_NEEDS_MODE(oflag) (((oflag) & O_CREAT) != 0)
#endif

/* POSIX.1-2001 specifies that these types are defined by <fcntl.h>.
Earlier POSIX standards permitted any type ending in `_t' to be defined
by any POSIX header, so we don't conditionalize the definitions here. */
Expand Down
3 changes: 2 additions & 1 deletion io/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* Changes by NEC Corporation for the VE port, 2017-2019 */

#include <errno.h>
#include <fcntl.h>
Expand All @@ -38,7 +39,7 @@ __libc_open (file, oflag)
return -1;
}

if (oflag & O_CREAT)
if (__OPEN_NEEDS_MODE (oflag))
{
va_list arg;
va_start(arg, oflag);
Expand Down
3 changes: 2 additions & 1 deletion io/open64.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* Changes by NEC Corporation for the VE port, 2017-2019 */

#include <errno.h>
#include <fcntl.h>
Expand All @@ -36,7 +37,7 @@ __libc_open64 (file, oflag)
return -1;
}

if (oflag & O_CREAT)
if (__OPEN_NEEDS_MODE (oflag))
{
va_list arg;
va_start (arg, oflag);
Expand Down
3 changes: 2 additions & 1 deletion io/open64_2.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* Changes by NEC Corporation for the VE port, 2017-2019 */

#include <fcntl.h>
#include <stdio.h>

int
__open64_2 (const char *file, int oflag)
{
if (oflag & O_CREAT)
if (__OPEN_NEEDS_MODE (oflag))
__fortify_fail ("invalid open64 call: O_CREAT without mode");

return __open64 (file, oflag);
Expand Down
3 changes: 2 additions & 1 deletion io/open_2.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* Changes by NEC Corporation for the VE port, 2017-2019 */

#include <fcntl.h>
#include <stdio.h>

int
__open_2 (const char *file, int oflag)
{
if (oflag & O_CREAT)
if (__OPEN_NEEDS_MODE (oflag))
__fortify_fail ("invalid open call: O_CREAT without mode");

return __open (file, oflag);
Expand Down
3 changes: 2 additions & 1 deletion io/openat.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* Changes by NEC Corporation for the VE port, 2017-2019 */

#include <errno.h>
#include <fcntl.h>
Expand Down Expand Up @@ -58,7 +59,7 @@ __openat (int fd, const char *file, int oflag, ...)
}
}

if (oflag & O_CREAT)
if (__OPEN_NEEDS_MODE (oflag))
{
va_list arg;
va_start (arg, oflag);
Expand Down
3 changes: 2 additions & 1 deletion io/openat64.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* Changes by NEC Corporation for the VE port, 2017-2019 */

#include <errno.h>
#include <fcntl.h>
Expand Down Expand Up @@ -51,7 +52,7 @@ __openat64 (int fd, const char *file, int oflag, ...)
}
}

if (oflag & O_CREAT)
if (__OPEN_NEEDS_MODE (oflag))
{
va_list arg;
va_start (arg, oflag);
Expand Down
3 changes: 2 additions & 1 deletion io/openat64_2.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* Changes by NEC Corporation for the VE port, 2017-2019 */

#include <fcntl.h>
#include <stdio.h>

int
__openat64_2 (int fd, const char *file, int oflag)
{
if (oflag & O_CREAT)
if (__OPEN_NEEDS_MODE (oflag))
__fortify_fail ("invalid openat64 call: O_CREAT without mode");

return __openat64 (fd, file, oflag);
Expand Down
3 changes: 2 additions & 1 deletion io/openat_2.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* Changes by NEC Corporation for the VE port, 2017-2019 */

#include <fcntl.h>
#include <stdio.h>

int
__openat_2 (int fd, const char *file, int oflag)
{
if (oflag & O_CREAT)
if (__OPEN_NEEDS_MODE (oflag))
__fortify_fail ("invalid openat call: O_CREAT without mode");

return __openat (fd, file, oflag);
Expand Down
4 changes: 2 additions & 2 deletions nptl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -496,10 +496,10 @@ tst-getpid2-ENV = LD_BIND_NOW=1

$(objpfx)tst-atfork2: $(libdl) $(shared-thread-library)
LDFLAGS-tst-atfork2 = -rdynamic
tst-atfork2-ENV = MALLOC_TRACE=$(objpfx)tst-atfork2.mtrace
tst-atfork2-ENV = VE_MALLOC_TRACE=$(objpfx)tst-atfork2.mtrace
$(objpfx)tst-atfork2mod.so: $(shared-thread-library)

tst-stack3-ENV = MALLOC_TRACE=$(objpfx)tst-stack3.mtrace
tst-stack3-ENV = VE_MALLOC_TRACE=$(objpfx)tst-stack3.mtrace
$(objpfx)tst-stack3-mem.out: $(objpfx)tst-stack3.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-stack3.mtrace > $@; \
$(evaluate-test)
Expand Down
14 changes: 6 additions & 8 deletions nptl/tst-cancel-wrappers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@ C["open"]=1
C["open64"]=1
C["pause"]=1
C["poll"]=1
C["pread"]=1
C["pread64"]=1
C["__libc_pread"]=1
C["pselect"]=1
C["pwrite"]=1
C["pwrite64"]=1
C["read"]=1
C["readv"]=1
C["__libc_pwrite"]=1
C["__libc_read"]=1
C["__readv"]=1
C["recv"]=1
C["recvfrom"]=1
C["recvmsg"]=1
Expand All @@ -58,8 +56,8 @@ C["tcdrain"]=1
C["wait"]=1
C["waitid"]=1
C["waitpid"]=1
C["write"]=1
C["writev"]=1
C["__libc_write"]=1
C["__writev"]=1
C["__xpg_sigpause"]=1
}
/:$/ {
Expand Down
3 changes: 2 additions & 1 deletion sysdeps/posix/open64.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* Changes by NEC Corporation for the VE port, 2017-2019 */

#include <fcntl.h>
#include <stdarg.h>
Expand All @@ -26,7 +27,7 @@ __libc_open64 (const char *file, int oflag, ...)
{
int mode = 0;

if (oflag & O_CREAT)
if (__OPEN_NEEDS_MODE (oflag))
{
va_list arg;
va_start (arg, oflag);
Expand Down
3 changes: 2 additions & 1 deletion sysdeps/unix/sysv/linux/dl-openat64.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* Changes by NEC Corporation for the VE port, 2017-2019 */

#include <assert.h>
#include <errno.h>
Expand All @@ -28,7 +29,7 @@ openat64 (dfd, file, oflag)
const char *file;
int oflag;
{
assert ((oflag & O_CREAT) == 0);
assert (!__OPEN_NEEDS_MODE (oflag));

#ifdef __NR_openat
return INLINE_SYSCALL (openat, 3, dfd, file, oflag | O_LARGEFILE);
Expand Down
5 changes: 3 additions & 2 deletions sysdeps/unix/sysv/linux/generic/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
/* Changes by NEC Corporation for the VE port, 2017-2019 */

#include <errno.h>
#include <fcntl.h>
Expand All @@ -29,7 +30,7 @@ __libc_open (const char *file, int oflag, ...)
{
int mode = 0;

if (oflag & O_CREAT)
if (__OPEN_NEEDS_MODE (oflag))
{
va_list arg;
va_start (arg, oflag);
Expand Down Expand Up @@ -59,7 +60,7 @@ __open_nocancel (const char *file, int oflag, ...)
{
int mode = 0;

if (oflag & O_CREAT)
if (__OPEN_NEEDS_MODE (oflag))
{
va_list arg;
va_start (arg, oflag);
Expand Down
3 changes: 2 additions & 1 deletion sysdeps/unix/sysv/linux/generic/open64.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
/* Changes by NEC Corporation for the VE port, 2017-2019 */

#include <errno.h>
#include <fcntl.h>
Expand All @@ -29,7 +30,7 @@ __libc_open64 (const char *file, int oflag, ...)
{
int mode = 0;

if (oflag & O_CREAT)
if (__OPEN_NEEDS_MODE (oflag))
{
va_list arg;
va_start (arg, oflag);
Expand Down
3 changes: 2 additions & 1 deletion sysdeps/unix/sysv/linux/open64.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* Changes by NEC Corporation for the VE port, 2017-2019 */

#include <errno.h>
#include <fcntl.h>
Expand All @@ -28,7 +29,7 @@ __libc_open64 (const char *file, int oflag, ...)
{
int mode = 0;

if (oflag & O_CREAT)
if (__OPEN_NEEDS_MODE (oflag))
{
va_list arg;
va_start (arg, oflag);
Expand Down
3 changes: 2 additions & 1 deletion sysdeps/unix/sysv/linux/openat.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* Changes by NEC Corporation for the VE port, 2017-2019 */

#include <errno.h>
#include <fcntl.h>
Expand Down Expand Up @@ -60,7 +61,7 @@ int
__OPENAT (int fd, const char *file, int oflag, ...)
{
mode_t mode = 0;
if (oflag & O_CREAT)
if (__OPEN_NEEDS_MODE (oflag))
{
va_list arg;
va_start (arg, oflag);
Expand Down
4 changes: 4 additions & 0 deletions sysdeps/unix/sysv/linux/ve/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ gen-as-const-headers += ucontext_i.sym
sysdep_routines += __start_context
endif

ifeq ($(subdir),csu)
gen-as-const-headers += ucontext_i.sym
endif

ifeq ($(subdir),elf)
sysdep_routines += dl-vdso
sysdep-dl-routines += dl-static
Expand Down
3 changes: 1 addition & 2 deletions sysdeps/unix/sysv/linux/ve/getsysstats.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,14 @@
#include <atomic.h>
#include <not-cancel.h>

#define SYS_sysve 316
#define VE_SYSVE_GET_VE_INFO 51

static ssize_t __ve_get_ve_info(const char *name, char *buffer, size_t size)
{
int res = -1;

INTERNAL_SYSCALL_DECL(err);
res = INTERNAL_SYSCALL_NCS(SYS_sysve, err, 4, VE_SYSVE_GET_VE_INFO, (uint64_t)name,
res = INTERNAL_SYSCALL (sysve, err, 4, VE_SYSVE_GET_VE_INFO, (uint64_t)name,
(uint64_t)buffer, size);
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err))) {
__set_errno (INTERNAL_SYSCALL_ERRNO (res, err));
Expand Down
3 changes: 1 addition & 2 deletions sysdeps/unix/sysv/linux/ve/gettimeofday.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
# include <sysdep.h>
# include <errno.h>

#define SYS_sysve 316
#define VE_SYSVE_GET_VE_INFO 51

static uint64_t base_clock; /* MHz */
Expand All @@ -34,7 +33,7 @@ ssize_t _ve_get_ve_info(const char *name, char *buffer, size_t size)
{
int res = -1;
INTERNAL_SYSCALL_DECL(err);
res = INTERNAL_SYSCALL_NCS(SYS_sysve, err, 4, VE_SYSVE_GET_VE_INFO, (uint64_t)name,
res = INTERNAL_SYSCALL (sysve, err, 4, VE_SYSVE_GET_VE_INFO, (uint64_t)name,
(uint64_t)buffer, size);
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)))
{
Expand Down
Loading

0 comments on commit 3c131e6

Please sign in to comment.