public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "David Engraf" <engraf.david@netcom-sicherheitstechnik.de>
To: <linux-kernel@vger.kernel.org>
Cc: "'Andrew Morton'" <akpm@osdl.org>
Subject: [PATCH] Win32 equivalent to GetTickCount systemcall (i386)
Date: Tue, 6 Dec 2005 11:36:42 +0100	[thread overview]
Message-ID: <009201c5fa50$f3f58a10$0a016696@EW10> (raw)

This patch adds a new systemcall on i386 architectures returning the jiffies
value to the application. 
As a kernel developer you can use jiffies but from the user space there is
no equivalent function which counts every millisecond like the Win32
GetTickCount.

linux-2.6.15-rc5-mm1



diff -puN include/asm-i386/unistd_orig.h include/asm-i386/unistd.h
--- include/asm-i386/unistd_orig.h	2005-12-06 12:07:16.000000000 +0100
+++ include/asm-i386/unistd.h	2005-12-06 12:10:07.000000000 +0100
@@ -300,8 +300,9 @@
 #define __NR_inotify_add_watch	292
 #define __NR_inotify_rm_watch	293
 #define __NR_migrate_pages	294
+#define __NR_tickcount	295
 
-#define NR_syscalls 295
+#define NR_syscalls 296
 
 /*
  * user-visible error numbers are in the range -1 - -128: see




diff -puN arch/i386/kernel/syscall_table_orig.S
arch/i386/kernel/syscall_table.S
--- arch/i386/kernel/syscall_table_orig.S	2005-12-06
12:07:14.000000000 +0100
+++ arch/i386/kernel/syscall_table.S	2005-12-06 12:10:40.000000000 +0100
@@ -294,3 +294,4 @@ ENTRY(sys_call_table)
 	.long sys_inotify_add_watch
 	.long sys_inotify_rm_watch
 	.long sys_migrate_pages
+	.long sys_tickcount



diff -puN kernel/sys_orig.c kernel/sys.c
--- kernel/sys_orig.c	2005-12-06 12:06:49.000000000 +0100
+++ kernel/sys.c	2005-12-06 12:08:57.000000000 +0100
@@ -1855,3 +1855,9 @@ asmlinkage long sys_prctl(int option, un
 	}
 	return error;
 }
+
+asmlinkage long sys_tickcount(long __user *ret)
+{
+	if (copy_to_user(ret, (void*)&jiffies, sizeof(long)))
+	return 0;
+}



Thanks
David Engraf


____________
Virus checked by G DATA AntiVirusKit
Version: AVK 16.2037 from 06.12.2005
Virus news: www.antiviruslab.com


             reply	other threads:[~2005-12-06 10:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-06 10:36 David Engraf [this message]
2005-12-06 10:44 ` [PATCH] Win32 equivalent to GetTickCount systemcall (i386) Arjan van de Ven
2005-12-06 11:23   ` David Engraf
2005-12-06 11:29     ` Ingo Molnar
2005-12-06 12:06       ` David Engraf
2005-12-06 11:35     ` Arjan van de Ven
2005-12-06 11:37     ` Jakub Jelinek
2005-12-06 12:13     ` Bernd Petrovitsch
2005-12-06 12:26       ` David Engraf
2005-12-06 19:48         ` Andi Kleen
2005-12-06 18:00           ` Eric Dumazet
2005-12-06 18:01             ` Andi Kleen
2005-12-06 19:47 ` Andi Kleen
2005-12-06 15:25   ` AW: " David Engraf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='009201c5fa50$f3f58a10$0a016696@EW10' \
    --to=engraf.david@netcom-sicherheitstechnik.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox