[parisc-linux] Re: [parisc-linux-cvs] linux-2.6 kyle

Kyle McMartin kyle at mcmartin.ca
Sun Apr 16 11:38:40 MDT 2006


On Sun, Apr 16, 2006 at 11:34:30AM -0600, Kyle McMartin wrote:
> 	Play catchup with new syscalls.
>

Pretty much the following diff, except sys_tee isn't in 2.6.17-rc1, so
it is ni_syscall for now. Testcase for robust syscalls currently fails,
will debug later today. These syscalls are apparently needed for coming
glibc.

--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -393,5 +393,11 @@
 	ENTRY_SAME(readlinkat)		/* 285 */
 	ENTRY_SAME(fchmodat)
 	ENTRY_SAME(faccessat)
+	ENTRY_SAME(unshare)
+	ENTRY_COMP(set_robust_list)
+	ENTRY_COMP(get_robust_list)	/* 290 */
+	ENTRY_SAME(splice)
+	ENTRY_SAME(sync_file_range)
+	ENTRY_SAME(tee)
 	/* Nothing yet */
 
--- a/include/asm-parisc/unistd.h
+++ b/include/asm-parisc/unistd.h
@@ -780,8 +780,14 @@
 #define __NR_readlinkat		(__NR_Linux + 285)
 #define __NR_fchmodat		(__NR_Linux + 286)
 #define __NR_faccessat		(__NR_Linux + 287)
+#define __NR_unshare		(__NR_Linux + 288)
+#define __NR_set_robust_list	(__NR_Linux + 289)
+#define __NR_get_robust_list	(__NR_Linux + 290)
+#define __NR_splice		(__NR_Linux + 291)
+#define __NR_sync_file_range	(__NR_Linux + 292)
+#define __NR_tee		(__NR_Linux + 293)
 
-#define __NR_Linux_syscalls     288
+#define __NR_Linux_syscalls     294
 
 #define HPUX_GATEWAY_ADDR       0xC0000004
 #define LINUX_GATEWAY_ADDR      0x100


--
/* ingo-robust-testcase.c */ 
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/wait.h>
#include <linux/futex.h>
#include <sys/time.h>
#include <asm/unistd.h>

struct robust_list {
	struct robust_list *next;
};

struct lock {
	unsigned int futex_val;
	struct robust_list entry;
};

struct robust_list_head {
	struct robust_list list;
	unsigned long futex_offset;
	struct robust_list *pending_lock;
};

#define __NR_sys_set_robust_list 289
#define __NR_sys_get_robust_list 290

_syscall2 (long, sys_set_robust_list, struct robust_list_head *, head, size_t, len)
_syscall3 (long, sys_get_robust_list, int, tid, struct robust_list_head **, head, size_t *, len_ptr)

static struct robust_list_head head;
#define NR_LOCKS 1000
static struct lock locks[NR_LOCKS];

int main (void)
{
	struct robust_list_head *tmp = NULL;
	struct robust_list *prev;
	struct lock *lock;
	size_t len;
	long ret;
	int i;

	printf("locks size: %d\n", sizeof(struct lock) * NR_LOCKS);
#if 0
	// create a deliberately circular list:
	locks[0].entry.next = &locks[0].entry;
	locks[0].futex_val = getpid();
	head.list.next = &locks[0].entry;
#else
	prev = &head.list;
	for (i = 0; i < NR_LOCKS; i++) {
		lock = locks + i;
		lock->futex_val = getpid();
		prev->next = &lock->entry;
		prev = &lock->entry;
	}
	lock->entry.next = &head.list;
	head.pending_lock = &lock->entry;
#endif

	head.futex_offset = (unsigned long) &lock->futex_val -
				(unsigned long) &lock->entry;
	printf("offset: %08lx\n", head.futex_offset);

	printf("head: %p, head.next: %p\n", &head, head.list.next);
	ret = sys_set_robust_list(&head, sizeof(head));
	printf("set_robust_list(%p): %ld\n", &head, ret);

	ret = sys_get_robust_list(0, &tmp, &len);
	printf("get_robust_list(): %ld, %p, %d\n", ret, tmp, len);
	ret = sys_get_robust_list(getppid(), &tmp, &len);
	printf("get_robust_list(parent): %ld, %p, %d\n", ret, tmp, len);
	ret = sys_get_robust_list(1, &tmp, &len);
	printf("get_robust_list(init): %ld, %p, %d\n", ret, tmp, len);

	return 0;
}




More information about the parisc-linux mailing list