Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Aug 2006 11:05:41 GMT
From:      Roman Divacky <rdivacky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 103328 for review
Message-ID:  <200608061105.k76B5fAU042697@repoman.freebsd.org>

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

Change 103328 by rdivacky@rdivacky_witten on 2006/08/06 11:04:59

	Implementation of linux_tgkill() syscall. Firefox uses it.

Affected files ...

.. //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_signal.c#2 edit
.. //depot/projects/soc2006/rdivacky_linuxolator/i386/linux/linux_dummy.c#9 edit

Differences ...

==== //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_signal.c#2 (text+ko) ====

@@ -50,6 +50,9 @@
 #include <compat/linux/linux_signal.h>
 #include <compat/linux/linux_util.h>
 
+struct linux_emuldata *em_find(pid_t pid, int locked);
+extern struct rwlock emul_lock;
+
 void
 linux_to_bsd_sigset(l_sigset_t *lss, sigset_t *bss)
 {
@@ -447,3 +450,46 @@
 	tmp.pid = args->pid;
 	return (kill(td, &tmp));
 }
+
+int
+linux_tgkill(struct thread *td, struct linux_tgkill_args *args)
+{
+   	struct linux_emuldata *em;
+	struct linux_kill_args ka;
+	struct proc *p;
+
+#ifdef DEBUG
+	if (ldebug(tgkill))
+		printf(ARGS(tgkill, "%d, %d, %d"), args->tgid, args->pid, args->sig);
+#endif
+
+	ka.pid = args->pid;
+	ka.signum = args->sig;
+
+	if (args->tgid == -1)
+	   	return linux_kill(td, &ka);
+
+	if ((p = pfind(args->pid)) == NULL)
+	      	return ESRCH;
+
+	if (p->p_sysent != &elf_linux_sysvec)
+		return ESRCH;
+
+	PROC_UNLOCK(p);
+
+	em = em_find(args->pid, EMUL_UNLOCKED);
+
+	if (em == NULL) {
+#ifdef DEBUG
+		printf("emuldata not found.\n");
+#endif
+		return ESRCH;
+	}
+
+	if (em->shared->group_pid != args->tgid)
+	   	return ESRCH;
+
+	EMUL_RUNLOCK(&emul_lock);
+
+	return linux_kill(td, &ka);
+}

==== //depot/projects/soc2006/rdivacky_linuxolator/i386/linux/linux_dummy.c#9 (text+ko) ====

@@ -75,7 +75,6 @@
 DUMMY(remap_file_pages);
 DUMMY(statfs64);
 DUMMY(fstatfs64);
-DUMMY(tgkill);
 DUMMY(utimes);
 DUMMY(fadvise64_64);
 DUMMY(mbind);



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