File 6636to6639.patch of Package ia32el
diff -ur src.6636//ia32toia64/Makefile src.6639//ia32toia64/Makefile
--- src.6636//ia32toia64/Makefile 2008-11-21 16:16:18.000000000 +0800
+++ src.6639//ia32toia64/Makefile 2008-12-01 09:35:32.000000000 +0800
@@ -39,7 +39,7 @@
#
# version
#
-BUILD_NO:=11
+BUILD_NO:=13
RELEASE=1
diff -ur src.6636//ia32toia64/ia32_ioctl.c src.6639//ia32toia64/ia32_ioctl.c
--- src.6636//ia32toia64/ia32_ioctl.c 2008-11-21 16:16:18.000000000 +0800
+++ src.6639//ia32toia64/ia32_ioctl.c 2008-12-01 09:35:23.000000000 +0800
@@ -529,7 +529,7 @@
ss32.closing_wait = ss64.closing_wait;
ss32.closing_wait2 = ss64.closing_wait2;
ss32.iomem_base = IS_HIGH_ZERO(UL(ss64.iomem_base))?
- (__u32)UL(ss64.iomem_base) : (__u32)NULL;
+ (__u32)UL(ss64.iomem_base) : (__u32)UL(NULL);
ss32.iomem_reg_shift = ss64.iomem_reg_shift;
ss32.port_high = ss64.port_high;
ss32.reserved[0] = ss64.reserved[0];
@@ -1036,7 +1036,7 @@
if (ret == 0) {
si32.pack_id = si64.pack_id;
si32.usr_ptr = IS_HIGH_ZERO(UL(si64.usr_ptr))?
- (__u32)UL(si64.usr_ptr) : (__u32)NULL;
+ (__u32)UL(si64.usr_ptr) : (__u32)UL(NULL);
si32.status = si64.status;
si32.masked_status = si64.masked_status;
si32.msg_status = si64.msg_status;
diff -ur src.6636//ia32toia64/ia32_process.c src.6639//ia32toia64/ia32_process.c
--- src.6636//ia32toia64/ia32_process.c 2008-11-21 16:16:18.000000000 +0800
+++ src.6639//ia32toia64/ia32_process.c 2008-12-01 09:35:24.000000000 +0800
@@ -443,8 +443,11 @@
int retval;
struct timespec ts64;
struct timespec *pts64 = (struct timespec *)(long)timeout;
+ int cmd;
- if ((op == FUTEX_WAIT) && (I2P(timeout) != NULL)) {
+ cmd = op & FUTEX_CMD_MASK;
+
+ if ((cmd == FUTEX_WAIT) && (I2P(timeout) != NULL)) {
if (get_timespec ((struct timespec32 *)I2P(timeout), &ts64) < 0) {
return -EFAULT;
}
diff -ur src.6636//ia32toia64/make_ia32_ioctl_h.c src.6639//ia32toia64/make_ia32_ioctl_h.c
--- src.6636//ia32toia64/make_ia32_ioctl_h.c 2008-11-21 16:16:18.000000000 +0800
+++ src.6639//ia32toia64/make_ia32_ioctl_h.c 2008-12-01 09:35:24.000000000 +0800
@@ -39,6 +39,13 @@
#define MAX_IOCTLCMD_NAME_LENGTH MAX_HANDLER_NAME_LENGTH
#define MAX_BUFF_SIZE 4096
+extern void * malloc (size_t);
+extern char *strcpy(char *dest, const char *src);
+extern void *memset(void *s, int c, size_t n);
+extern void free(void *ptr);
+extern int snprintf(char *str, size_t size, const char *format, ...);
+extern void exit(int status);
+
static inline void insert_func_name (char * func_name);
static int insert_ht (unsigned int cmd,
char * cmd_name,
diff -ur src.6636//ia32toia64/user32.c src.6639//ia32toia64/user32.c
--- src.6636//ia32toia64/user32.c 2008-11-21 16:16:18.000000000 +0800
+++ src.6639//ia32toia64/user32.c 2008-12-01 09:35:24.000000000 +0800
@@ -39,7 +39,7 @@
#include "ia32toia64.h"
#include "list.h"
-#define CONVERS_TAB_MAX_INDEX (310)
+#define CONVERS_TAB_MAX_INDEX (332)
#if DEBUG
long HIDDEN g_initialized = 0;
#endif // DEBUG
diff -ur src.6636//ia32toia64/user32_convers_tab.c src.6639//ia32toia64/user32_convers_tab.c
--- src.6636//ia32toia64/user32_convers_tab.c 2008-11-21 16:16:18.000000000 +0800
+++ src.6639//ia32toia64/user32_convers_tab.c 2008-12-01 09:35:24.000000000 +0800
@@ -366,6 +366,28 @@
/*308 pselect*/ SYS_WRAPPER(sys32_pselect),
/*309 ppoll*/ SYS_WRAPPER(sys32_ppoll),
/*310 unshare*/ SYS_DIRECT(unshare),
+/*311 set_robust_list*/ SYS_WRAPPER(sys32_ni_syscall),
+/*312 get_robust_list*/ SYS_WRAPPER(sys32_ni_syscall),
+/*313 splice*/ SYS_WRAPPER(sys32_ni_syscall),
+/*314 sync_file_range*/ SYS_DIRECT(sync_file_range),
+/*315 tee*/ SYS_DIRECT(tee),
+/*316 vmsplice*/ SYS_WRAPPER(sys32_ni_syscall),
+/*317 move_pages*/ SYS_WRAPPER(sys32_ni_syscall),
+/*318 getcpu*/ SYS_WRAPPER(sys32_ni_syscall),
+/*319 epoll_pwait*/ SYS_DIRECT(epoll_pwait),
+/*320 utimensat*/ SYS_WRAPPER(sys32_ni_syscall),
+/*321 signalfd*/ SYS_WRAPPER(sys32_ni_syscall),
+/*322 timerfd_create*/ SYS_DIRECT(timerfd_create),
+/*323 eventfd*/ SYS_DIRECT(eventfd),
+/*324 fallocate*/ SYS_WRAPPER(sys32_ni_syscall),
+/*325 timerfd_settime*/ SYS_WRAPPER(sys32_ni_syscall),
+/*326 timerfd_gettime*/ SYS_WRAPPER(sys32_ni_syscall),
+/*327 signalfd4*/ SYS_WRAPPER(sys32_ni_syscall),
+/*328 eventfd2*/ SYS_WRAPPER(sys32_ni_syscall),
+/*329 epoll_create1*/ SYS_WRAPPER(sys32_ni_syscall),
+/*330 dup3*/ SYS_DIRECT(dup3),
+/*331 pipe2*/ SYS_WRAPPER(sys32_pipe2),
+/*332 inotify_init1*/ SYS_WRAPPER(sys32_ni_syscall),
/* NEXT LINE MUST BE THE LAST IN THE TABLE */
/* end of table */ {-1, 0}
};
diff -ur src.6636//ia32toia64/user32_ia32_syscall_prototypes.h src.6639//ia32toia64/user32_ia32_syscall_prototypes.h
--- src.6636//ia32toia64/user32_ia32_syscall_prototypes.h 2008-11-21 16:16:18.000000000 +0800
+++ src.6639//ia32toia64/user32_ia32_syscall_prototypes.h 2008-12-01 09:35:24.000000000 +0800
@@ -161,4 +161,5 @@
long HIDDEN sys32_getpriority (int which, int who);
long HIDDEN sys32_ni_syscall ();
+long HIDDEN sys32_pipe2 (__u32 fds, int flags);
#endif // _USER32_IA32_SYSCALL_PROTOTYPES_H
diff -ur src.6636//ia32toia64/user32_ipc.c src.6639//ia32toia64/user32_ipc.c
--- src.6636//ia32toia64/user32_ipc.c 2008-11-21 16:16:18.000000000 +0800
+++ src.6639//ia32toia64/user32_ipc.c 2008-12-01 09:35:24.000000000 +0800
@@ -213,3 +213,18 @@
}
+long HIDDEN
+sys32_pipe2 (__u32 fds, int flags)
+{
+ long retval;
+ int kfd[2];
+
+ /* libc's pipe is not good enough */
+ retval = SYSCALL (pipe2, (kfd, flags));
+
+ if (!IS_SYS_ERROR(retval)) {
+ retval = (g_safe_memcpy (I2P(fds), kfd, sizeof(kfd)) < 0) ? -EFAULT : 0;
+ }
+
+ return retval;
+}
diff -ur src.6636//ia32x/Makefile src.6639//ia32x/Makefile
--- src.6636//ia32x/Makefile 2008-11-21 16:16:19.000000000 +0800
+++ src.6639//ia32x/Makefile 2008-12-01 09:35:32.000000000 +0800
@@ -39,7 +39,7 @@
#
# version
#
-BUILD_NO:=6636
+BUILD_NO:=6639
RELEASE=1
SYSBTG=1
@@ -78,7 +78,7 @@
WARNS:=-Werror -Wall -Wcast-align -W -Wunused \
-Wshadow -Waggregate-return -Wunused-parameter \
-Wmissing-declarations -Wmissing-prototypes \
- -Wconversion -Wsign-compare
+ -Wsign-compare
INCDIRS:=-I. -I../ia32toia64 -I../ia32x_utils -I../ia32x_utils/include -I../loader
CFLAGS=-fpic -ffixed-r13 -nostdinc $(DEFS) $(INCDIRS) $(WARNS)
DEBUG_SW:=-g -DDEBUG=1
diff -ur src.6636//ia32x/btlib.h src.6639//ia32x/btlib.h
--- src.6636//ia32x/btlib.h 2008-11-21 16:16:19.000000000 +0800
+++ src.6639//ia32x/btlib.h 2008-12-01 09:35:21.000000000 +0800
@@ -288,7 +288,9 @@
#define IA32_SYSCALL_PSELECT 308ul
#define IA32_SYSCALL_PPOLL 309ul
#define IA32_SYSCALL_UNSHARE 310ul
-#define MAX_IA32_SYSCALL IA32_SYSCALL_UNSHARE
+#define IA32_SYSCALL_INOTIFY_INIT1 332ul
+
+#define MAX_IA32_SYSCALL IA32_SYSCALL_INOTIFY_INIT1
/*****************************************************************************/
/* STACK */
diff -ur src.6636//ia32x/btlib_ptemu.c src.6639//ia32x/btlib_ptemu.c
--- src.6636//ia32x/btlib_ptemu.c 2008-11-21 16:16:19.000000000 +0800
+++ src.6639//ia32x/btlib_ptemu.c 2008-12-01 09:35:22.000000000 +0800
@@ -2427,8 +2427,8 @@
handler = get_debugee_handler (debugee, signo);
DBPRINT (0, "signo=%d handler=%u\n", signo, handler);
- if ((handler != (unsigned) SIG_DFL) &&
- (handler != (unsigned) SIG_IGN)) {
+ if ((handler != (unsigned) P2U(SIG_DFL)) &&
+ (handler != (unsigned) P2U(SIG_IGN))) {
handled = 1;
}
}
@@ -3482,11 +3482,11 @@
}
handler = get_debugee_handler (debugee, signo);
- if (handler == (unsigned)SIG_IGN) {
+ if (handler == (unsigned) P2U(SIG_IGN)) {
goto out;
}
- if (handler == (unsigned)SIG_DFL) {
+ if (handler == (unsigned) P2U(SIG_DFL)) {
if (SIGNAL_DEFAULT_STOP (signo) || SIGNAL_DEFAULT_IGNORE (signo)) {
goto out;
}
diff -ur src.6636//ia32x/btlib_signal.c src.6639//ia32x/btlib_signal.c
--- src.6636//ia32x/btlib_signal.c 2008-11-21 16:16:19.000000000 +0800
+++ src.6639//ia32x/btlib_signal.c 2008-12-01 09:35:22.000000000 +0800
@@ -754,8 +754,8 @@
/* for signals with half permanent signal handler, BTLib
must intercept SIG_DFL to enable core file */
- if ((sa32->handler == (unsigned) SIG_IGN) ||
- ((sa32->handler == (unsigned) SIG_DFL) && !half_perm)) {
+ if ((sa32->handler == (unsigned) P2U(SIG_IGN)) ||
+ ((sa32->handler == (unsigned) P2U(SIG_DFL)) && !half_perm)) {
sa.sa_handler = (__sighandler_t)U2P(sa32->handler);
} else {
sigfillset (&sa.sa_mask);
@@ -887,13 +887,13 @@
DBPRINT (0, "signo=%d,handler=0x%x\n", signo, handler);
/* if there is no handler then return */
- if ((handler == (unsigned) SIG_IGN) || (handler == (unsigned) SIG_DFL)) {
+ if ((handler == (unsigned) P2U(SIG_IGN)) || (handler == (unsigned) P2U(SIG_DFL))) {
btlib_release_lock (BTL_LOCK_IND_SIGHAND);
return (unsigned) handler;
}
/* if we got here then there is a registered signal handler */
- assert ((handler != (unsigned) SIG_DFL) && (handler != (unsigned) SIG_IGN));
+ assert ((handler != (unsigned) P2U(SIG_DFL)) && (handler != (unsigned) P2U(SIG_IGN)));
bt_memcpy (handler_desc, &cur_thread_data->sighandlers->handlers[signo],
sizeof (*handler_desc));
@@ -1153,9 +1153,9 @@
DBPRINT (btl_prt_sig, "find_prepare=%x\n", handler);
- if (handler == (unsigned) SIG_DFL) {
+ if (handler == (unsigned) P2U(SIG_DFL)) {
action = SIGNAL_DEFAULT_IGNORE (signo) ? IGNORE : TERMINATE;
- } else if (handler == (unsigned) SIG_IGN) {
+ } else if (handler == (unsigned) P2U(SIG_IGN)) {
/* sync signals cannot be ignored */
action = is_async_signal (siginfo) ? IGNORE : TERMINATE;
} else {
diff -ur src.6636//ia32x/btlib_signal_syscalls.c src.6639//ia32x/btlib_signal_syscalls.c
--- src.6636//ia32x/btlib_signal_syscalls.c 2008-11-21 16:16:19.000000000 +0800
+++ src.6639//ia32x/btlib_signal_syscalls.c 2008-12-01 09:35:22.000000000 +0800
@@ -315,7 +315,7 @@
set32->sig[0] = 0; /* clear the first bit */
for (j = 1; j < sigset_size * CHAR_BIT; j ++) {
- if (cur_thread_data->sighandlers->handlers[j].sa.handler > (unsigned)SIG_IGN) {
+ if (cur_thread_data->sighandlers->handlers[j].sa.handler > (unsigned)P2U(SIG_IGN)) {
sigaddset32 (set32, j);
} else {
sigdelset32 (set32, j);
@@ -334,7 +334,7 @@
set32->sig[0] = 0; /* clear the first bit */
for (j = 1; j < sigset_size * CHAR_BIT; j ++) {
- if (cur_thread_data->sighandlers->handlers[j].sa.handler == (unsigned)SIG_IGN) {
+ if (cur_thread_data->sighandlers->handlers[j].sa.handler == (unsigned)P2U(SIG_IGN)) {
sigaddset32 (set32, j);
} else {
sigdelset32 (set32, j);
diff -ur src.6636//ia32x/btlib_syscall.c src.6639//ia32x/btlib_syscall.c
--- src.6636//ia32x/btlib_syscall.c 2008-11-21 16:16:19.000000000 +0800
+++ src.6639//ia32x/btlib_syscall.c 2008-12-01 09:35:22.000000000 +0800
@@ -1520,14 +1520,35 @@
sigset32_t pending, ignored, catch;
char *ubuf;
unsigned ubuf_size;
+ off_t cur_offset;
+ long lseek_ret;
+ lseek_ret = SYSCALL (lseek, (sf->fd, 0UL, SEEK_CUR));
+ if (IS_SYS_ERROR (lseek_ret)) {
+ ret = lseek_ret;
+ goto out;
+ }
+ cur_offset=lseek_ret;
DBPRINT (btl_prt_syscall, "fd=%d\n", sf->fd);
/* first read the file */
do {
- ret = SYSCALL (pread, (sf->fd, bufp, size, 0UL));
+ lseek_ret = SYSCALL (lseek, (sf->fd, 0UL, SEEK_SET));
+ if (IS_SYS_ERROR (lseek_ret)) {
+ ret = lseek_ret;
+ goto out;
+ }
+ ret = SYSCALL (read, (sf->fd, bufp, size));
+ /* after read, the original file offset should be recovered.*/
if (IS_SYS_ERROR (ret)) {
+ lseek_ret = SYSCALL (lseek, (sf->fd, cur_offset, SEEK_SET));
goto out;
+ } else {
+ lseek_ret = SYSCALL (lseek, (sf->fd, cur_offset, SEEK_SET));
+ if (IS_SYS_ERROR (lseek_ret)) {
+ ret = lseek_ret;
+ goto out;
+ }
}
if ((unsigned long) ret == size) {
/* need to enlarge the buffer */
diff -ur src.6636//ia32x/btlib_thread.c src.6639//ia32x/btlib_thread.c
--- src.6636//ia32x/btlib_thread.c 2008-11-21 16:16:19.000000000 +0800
+++ src.6639//ia32x/btlib_thread.c 2008-12-01 09:35:22.000000000 +0800
@@ -2144,7 +2144,7 @@
if (act.sa_handler == SIG_IGN) {
DBPRINT (0, "ignored %d\n", j);
cur_thread_data->sighandlers->handlers[j].sa.handler =
- (unsigned) SIG_IGN;
+ (unsigned) P2U(SIG_IGN);
}
}
}
diff -ur src.6636//ia32x_utils/Makefile src.6639//ia32x_utils/Makefile
--- src.6636//ia32x_utils/Makefile 2008-11-21 16:16:18.000000000 +0800
+++ src.6639//ia32x_utils/Makefile 2008-12-01 09:35:32.000000000 +0800
@@ -39,7 +39,7 @@
#
# version
#
-BUILD_NO:=09
+BUILD_NO:=11
RELEASE=1
@@ -70,7 +70,7 @@
-W -Wunused -Werror \
-Wshadow -Waggregate-return \
-Wmissing-declarations -Wmissing-prototypes \
- -Wconversion -Wsign-compare \
+ -Wsign-compare \
-DBUILD_NO="\"$(BUILD_NO)\"" -DMODE="\"$(MODE)\"" -D_GNU_SOURCE \
-nostdinc
diff -ur src.6636//ia32x_utils/include/ia64_syscalls.h src.6639//ia32x_utils/include/ia64_syscalls.h
--- src.6636//ia32x_utils/include/ia64_syscalls.h 2008-11-21 16:16:18.000000000 +0800
+++ src.6639//ia32x_utils/include/ia64_syscalls.h 2008-12-01 09:35:18.000000000 +0800
@@ -360,6 +360,10 @@
//extern int sys_ioprio_set(int which, int who, int ioprio); //direct
//extern int inotify_init(void); //direct
//extern int inotify_add_watch(int fd, char *pathname, uint32_t mask); //
+//extern long sys_signalfd4(int ufd, sigset_t *user_mask, size_t sizemask, int flags);
+extern long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags);
+extern long sys_pipe2(int *fildes, int flags);
+//extern long sys_inotify_init1(int flags);
# define SYSCALL(s,p) sys_##s p
diff -ur src.6636//ia32x_utils/include/kernel_subst64.h src.6639//ia32x_utils/include/kernel_subst64.h
--- src.6636//ia32x_utils/include/kernel_subst64.h 2008-11-21 16:16:18.000000000 +0800
+++ src.6639//ia32x_utils/include/kernel_subst64.h 2008-12-01 09:35:18.000000000 +0800
@@ -309,9 +309,32 @@
#define __NR_readlinkat 1291
#define __NR_fchmodat 1292
#define __NR_faccessat 1293
-/*1294, 1295 are reserved for pselect/ppoll*/
+#define __NR_pselect6 1294
+#define __NR_ppoll 1295
#define __NR_unshare 1296
-
+#define __NR_splice 1297
+#define __NR_set_robust_list 1298
+#define __NR_get_robust_list 1299
+#define __NR_sync_file_range 1300
+#define __NR_tee 1301
+#define __NR_vmsplice 1302
+#define __NR_fallocate 1303
+#define __NR_getcpu 1304
+#define __NR_epoll_pwait 1305
+#define __NR_utimensat 1306
+/* #define __NR_signalfd 1307 */
+#define __NR_timerfd 1308
+#define __NR_eventfd 1309
+#define __NR_timerfd_create 1310
+#define __NR_timerfd_settime 1311
+#define __NR_timerfd_gettime 1312
+#define __NR_signalfd4 1313
+#define __NR_eventfd2 1314
+#define __NR_epoll_create1 1315
+#define __NR_dup3 1316
+#define __NR_pipe2 1317
+#define __NR_inotify_init1 1318
+
#define __BREAK_SYSCALL __IA64_BREAK_SYSCALL
/* from bits/syscall.h */
@@ -583,6 +606,30 @@
#define SYS_faccessat __NR_faccessat
/*pselect, ppoll*/
#define SYS_unshare __NR_unshare
+#define SYS_splice __NR_splice
+#define SYS_set_robust_list __NR_set_robust_list
+#define SYS_get_robust_list __NR_get_robust_list
+#define SYS_sync_file_range __NR_sync_file_range
+#define SYS_tee __NR_tee
+#define SYS_vmsplice __NR_vmsplice
+#define SYS_fallocate __NR_fallocate
+#define SYS_getcpu __NR_getcpu
+#define SYS_epoll_pwait __NR_epoll_pwait
+#define SYS_utimensat __NR_utimensat
+/* #define SYS_signalfd __NR_signalfd */
+#define SYS_timerfd __NR_timerfd
+#define SYS_eventfd __NR_eventfd
+#define SYS_timerfd_create __NR_timerfd_create
+#define SYS_timerfd_settime __NR_timerfd_settime
+#define SYS_timerfd_gettime __NR_timerfd_gettime
+#define SYS_move_pages __NR_move_pages
+
+//#define SYS_signalfd4 __NR_signalfd4
+#define SYS_eventfd2 __NR_eventfd2
+#define SYS_epoll_create1 __NR_epoll_create1
+#define SYS_dup3 __NR_dup3
+#define SYS_pipe2 __NR_pipe2
+#define SYS_inotify_init1 __NR_inotify_init1
#ifndef __ASSEMBLER__
@@ -1198,6 +1245,12 @@
#ifndef FUTEX_WAKE
#define FUTEX_WAKE (1)
#endif
+#ifndef FUTEX_PRIVATE_FLAG
+#define FUTEX_PRIVATE_FLAG 128
+#endif
+#ifndef FUTEX_CMD_MASK
+#define FUTEX_CMD_MASK ~FUTEX_PRIVATE_FLAG
+#endif
/* from asm/statfs.h */
struct k_statfs {
diff -ur src.6636//ia32x_utils/strings.dir/strnlen.c src.6639//ia32x_utils/strings.dir/strnlen.c
--- src.6636//ia32x_utils/strings.dir/strnlen.c 2008-11-21 16:16:18.000000000 +0800
+++ src.6639//ia32x_utils/strings.dir/strnlen.c 2008-12-01 09:35:18.000000000 +0800
@@ -38,15 +38,15 @@
/* Find the length of STRING, but scan at most MAXLEN characters.
If no '\0' terminator is found in that many characters, return MAXLEN. */
-static void * memchr (const void *__s, int __c, unsigned long __n);
+static void * bt_memchr (const void *__s, int __c, unsigned long __n);
unsigned long bt_strnlen (const char * string, unsigned long maxlen)
{
const char *end;
- end = memchr (string, '\0', maxlen);
+ end = bt_memchr (string, '\0', maxlen);
return end ? (unsigned long) (end - string) : maxlen;
}
-static void * memchr (const void * str, int chr, unsigned long count)
+static void * bt_memchr (const void * str, int chr, unsigned long count)
{
unsigned long j = 0;
const char * p = str;
diff -ur src.6636//ia32x_utils/syscalls.dir/syscalls.S src.6639//ia32x_utils/syscalls.dir/syscalls.S
--- src.6636//ia32x_utils/syscalls.dir/syscalls.S 2008-11-21 16:16:18.000000000 +0800
+++ src.6639//ia32x_utils/syscalls.dir/syscalls.S 2008-12-01 09:35:18.000000000 +0800
@@ -349,3 +349,10 @@
/*FSYSCALL(ppoll)*/
/*FSYSCALL()*/
+FSYSCALL(sync_file_range)
+FSYSCALL(tee)
+FSYSCALL(epoll_pwait)
+FSYSCALL(timerfd_create)
+FSYSCALL(eventfd)
+FSYSCALL(pipe2)
+FSYSCALL(dup3)