Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Aug 2007 18:19:24 GMT
From:      Poul-Henning Kamp <phk@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 125147 for review
Message-ID:  <200708141819.l7EIJO6S074413@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=125147

Change 125147 by phk@phk_critter on 2007/08/14 18:19:05

	add three more syscalls:
		sys_thr_self
		sys_thr_set_name
		sys_rtprio_thread

Affected files ...

.. //depot/projects/valgrind/coregrind/m_syswrap/priv_syswrap-freebsd.h#3 edit
.. //depot/projects/valgrind/coregrind/m_syswrap/syswrap-freebsd.c#4 edit
.. //depot/projects/valgrind/include/vki-freebsd.h#2 edit

Differences ...

==== //depot/projects/valgrind/coregrind/m_syswrap/priv_syswrap-freebsd.h#3 (text+ko) ====

@@ -197,6 +197,9 @@
 DECL_TEMPLATE(freebsd, sys_statfs6);
 DECL_TEMPLATE(freebsd, sys_fstatfs6);
 DECL_TEMPLATE(freebsd, sys_fhstatfs6);
+DECL_TEMPLATE(freebsd, sys_thr_self);
+DECL_TEMPLATE(freebsd, sys_thr_set_name);
+DECL_TEMPLATE(freebsd, sys_rtprio_thread);
 DECL_TEMPLATE(freebsd, sys_fork);
 DECL_TEMPLATE(freebsd, sys_vfork);
 DECL_TEMPLATE(freebsd, sys_modfind);

==== //depot/projects/valgrind/coregrind/m_syswrap/syswrap-freebsd.c#4 (text+ko) ====

@@ -1724,6 +1724,47 @@
 #endif
 
 /* ---------------------------------------------------------------------
+   thr* wrappers
+   ------------------------------------------------------------------ */
+
+PRE(sys_thr_self)
+{
+   PRINT( "sys_thr_self ( %p )", ARG1 );
+   PRE_REG_READ1(long, "thr_self", long *, "id");
+   PRE_MEM_WRITE( "thr_self()", ARG1, sizeof(long));
+}
+POST(sys_thr_self)
+{
+   POST_MEM_WRITE( ARG1, sizeof(long));
+}
+
+PRE(sys_thr_set_name)
+{
+   PRINT( "sys_thr_set_name ( %d, %p )", ARG1, ARG2 );
+   PRE_REG_READ2(long, "thr_set_name", long, "id", const char *, "name");
+   PRE_MEM_RASCIIZ( "sys_thr_set_name(threadname)", ARG2);
+}
+
+PRE(sys_rtprio_thread)
+{
+   PRINT( "sys_rtprio_thread ( %d, %d, %p )", ARG1, ARG2, ARG3 );
+   PRE_REG_READ3(long, "rtprio_thread",
+      int, "function", __vki_lwpid_t, "lwpid", struct vki_rtprio *, "rtp");
+   if (ARG1 == VKI_RTP_SET) {
+      PRE_MEM_READ( "rtprio_thread(set)", ARG3, sizeof(struct vki_rtprio));
+   } else if (ARG1 == VKI_RTP_LOOKUP) {
+      PRE_MEM_WRITE( "rtprio_thread(lookup)", ARG3, sizeof(struct vki_rtprio));
+   } else {
+	/* PHK ?? */
+   }
+}
+POST(sys_rtprio_thread)
+{
+   if (ARG1 == VKI_RTP_LOOKUP && RES == 0)
+      POST_MEM_WRITE( ARG3, sizeof(struct vki_rtprio));
+}
+
+/* ---------------------------------------------------------------------
    sig* wrappers
    ------------------------------------------------------------------ */
 
@@ -2628,7 +2669,7 @@
    // thr_create							   430
    // thr_exit								   431
 
-   // thr_self								   432
+   BSDXY(__NR_thr_self, 		sys_thr_self),			// 432
    // thr_kill								   433
    // _umtx_lock							   434
    // _umtx_unlock							   435
@@ -2668,9 +2709,9 @@
    // kmq_unlink							   462
    // abort2								   463
 
-   // thr_set_name							   464
+   BSDX_(__NR_thr_set_name,		sys_thr_set_name),		// 464
    // aio_fsync								   465
-   // rtprio_thread							   466
+   BSDXY(__NR_rtprio_thread,		sys_rtprio_thread),		// 466
    // nosys								   467
 
    // nosys								   468

==== //depot/projects/valgrind/include/vki-freebsd.h#2 (text+ko) ====

@@ -1658,6 +1658,18 @@
 	vki_modspecific_t data;
 };
 
+//----------------------------------------------------------------------
+// From sys/rtprio.h
+//----------------------------------------------------------------------
+
+struct vki_rtprio {
+	vki_uint16_t	type;
+	vki_uint16_t	prio;
+};
+
+#define VKI_RTP_LOOKUP	0
+#define VKI_RTP_SET	1
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200708141819.l7EIJO6S074413>