From e152b0b85bb70101cb4cb890868981128affc88b Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Sat, 3 Mar 2018 18:13:45 +0100
Subject: [PATCH] Remove some sendsys()/waitsys() remains.

---
 sys/platform/pc64/x86_64/genassym.c |  2 -
 sys/sys/vmmeter.h                   |  3 --
 test/sysmsg/Makefile                | 17 -------
 test/sysmsg/syscall.h               | 92 -------------------------------------
 test/sysmsg/sysmsg1.c               | 61 ------------------------
 test/sysmsg/sysmsg2.c               | 63 -------------------------
 6 files changed, 238 deletions(-)
 delete mode 100644 test/sysmsg/Makefile
 delete mode 100644 test/sysmsg/syscall.h
 delete mode 100644 test/sysmsg/sysmsg1.c
 delete mode 100644 test/sysmsg/sysmsg2.c

diff --git a/sys/platform/pc64/x86_64/genassym.c b/sys/platform/pc64/x86_64/genassym.c
index 567692ec69..073e76b75b 100644
--- a/sys/platform/pc64/x86_64/genassym.c
+++ b/sys/platform/pc64/x86_64/genassym.c
@@ -92,8 +92,6 @@ ASSYM(KERNBASE,	KERNBASE);
 
 ASSYM(V_TRAP, offsetof(struct vmmeter, v_trap));
 ASSYM(V_SYSCALL, offsetof(struct vmmeter, v_syscall));
-ASSYM(V_SENDSYS, offsetof(struct vmmeter, v_sendsys));
-ASSYM(V_WAITSYS, offsetof(struct vmmeter, v_waitsys));
 ASSYM(V_INTR, offsetof(struct vmmeter, v_intr));
 ASSYM(V_FORWARDED_INTS, offsetof(struct vmmeter, v_forwarded_ints));
 ASSYM(V_FORWARDED_HITS, offsetof(struct vmmeter, v_forwarded_hits));
diff --git a/sys/sys/vmmeter.h b/sys/sys/vmmeter.h
index 85d066a0f9..dfa9fa25b9 100644
--- a/sys/sys/vmmeter.h
+++ b/sys/sys/vmmeter.h
@@ -28,7 +28,6 @@
  *
  *	@(#)vmmeter.h	8.2 (Berkeley) 7/10/94
  * $FreeBSD: src/sys/sys/vmmeter.h,v 1.21.2.2 2002/10/10 19:28:21 dillon Exp $
- * $DragonFly: src/sys/sys/vmmeter.h,v 1.10 2006/05/20 02:42:13 dillon Exp $
  */
 
 #ifndef _SYS_VMMETER_H_
@@ -96,8 +95,6 @@ struct vmmeter {
 	u_int v_forwarded_ints; /* forwarded interrupts due to MP lock */
 	u_int v_forwarded_hits;
 	u_int v_forwarded_misses;
-	u_int v_sendsys;	/* calls to sendsys() */
-	u_int v_waitsys;	/* calls to waitsys() */
 	u_int v_smpinvltlb;	/* nasty global invltlbs */
 	u_int v_ppwakeups;	/* wakeups on processes stalled on VM */
 	u_int v_lock_colls;	/* # of token, lock, or spin collisions */
diff --git a/test/sysmsg/Makefile b/test/sysmsg/Makefile
deleted file mode 100644
index 1a21977169..0000000000
--- a/test/sysmsg/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-# $DragonFly: src/test/sysmsg/Makefile,v 1.2 2004/09/02 11:21:12 eirikn Exp $
-#
-
-TARGETS=/tmp/sysmsg1 /tmp/sysmsg2
-
-CFLAGS= -O2 -g -I/usr/src/sys
-
-all:	$(TARGETS)
-
-/tmp/sysmsg1: sysmsg1.c syscall.h
-	$(CC) $(CFLAGS) sysmsg1.c -o /tmp/sysmsg1
-
-/tmp/sysmsg2: sysmsg2.c syscall.h
-	$(CC) $(CFLAGS) sysmsg2.c -o /tmp/sysmsg2
-
-clean:
-	rm -f $(TARGETS)
diff --git a/test/sysmsg/syscall.h b/test/sysmsg/syscall.h
deleted file mode 100644
index bac09b9e9c..0000000000
--- a/test/sysmsg/syscall.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2004 Eirik Nygaard.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of The DragonFly Project nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific, prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
- * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#define __syscall_args nosys_args
-
-#include <sys/types.h>
-#include <sys/msgport.h>
-#include <sys/syscall.h>
-#include <sys/sysproto.h>
-
-#include <stdlib.h>
-#include <errno.h>
-
-#define INITMSGSYSCALL(name, flags) do {				\
-	bzero(&__CONCAT(name, msg), sizeof(__CONCAT(name, msg)));	\
-	(__CONCAT(name, msg)).usrmsg.umsg.ms_cmd.cm_op =		\
-	        (__CONCAT(SYS_,name));					\
-	(__CONCAT(name, msg)).usrmsg.umsg.ms_flags = (flags);		\
-} while (0)
-
-#define DOMSGSYSCALL(name) do {						\
-	error = sendsys(NULL, &__CONCAT(name,msg).usrmsg,		\
-	        sizeof(__CONCAT(name,msg)));				\
-} while (0)
-
-#define FINISHMSGSYSCALL(name, error) do {				\
-	if (__CONCAT(name,msg).usrmsg.umsg.ms_error == EASYNC) {	\
-		for (;;) {						\
-			int rmsg;					\
-			rmsg = waitsys(NULL, (void *)error, 0);		\
-			if (error == rmsg)				\
-				break;					\
-			else if (rmsg != 0) {				\
-				errno = rmsg;				\
-				return(-1);				\
-			}						\
-		}							\
-	}								\
-	if (__CONCAT(name,msg).usrmsg.umsg.ms_error) {			\
-		errno = __CONCAT(name,msg).usrmsg.umsg.ms_error;	\
-		return(-1);						\
-	}								\
-	else								\
-		return(__CONCAT(name,msg).usrmsg.umsg.u.ms_result);	\
-} while(0)
-
-static __inline int
-sendsys(void *port, void *msg, int msgsize)
-{
-	int error;
-
-	__asm __volatile("int $0x81" : "=a"(error), "=c"(msg), "=d"(msgsize) :
-	                 "0"(port), "1"(msg), "2"(msgsize) : "memory");
-	return(error);
-}
-
-static __inline int
-waitsys(void *port, void *msg, int msgsize)
-{
-	int error;
-
-	__asm __volatile("int $0x82" : "=a"(error), "=c"(msg),
-			"=d"(msgsize) : "0"(port), "1"(msg), "2"(msgsize) :
-			"memory");
-	return(error);
-}
diff --git a/test/sysmsg/sysmsg1.c b/test/sysmsg/sysmsg1.c
deleted file mode 100644
index b7bfd91ec3..0000000000
--- a/test/sysmsg/sysmsg1.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * sysmsg1.c
- * 
- * $DragonFly: src/test/sysmsg/sysmsg1.c,v 1.3 2004/09/02 11:21:12 eirikn Exp $
- */
-
-#include <time.h>
-
-#include "syscall.h"
-
-__attribute__((weak))
-
-int
-write_test(int fd, void * buf, size_t nbyte)
-{
-	struct write_args writemsg;
-	int error;
-
-	INITMSGSYSCALL(write, 0);
-	writemsg.fd = fd;
-	writemsg.buf = buf;
-	writemsg.nbyte = nbyte;
-	DOMSGSYSCALL(write);
-	printf("write: error: %d\n", error);
-	printf("write: ms_error: %d\n", writemsg.usrmsg.umsg.ms_error);
-	printf("write: ms_result: %d\n", writemsg.usrmsg.umsg.u.ms_result);
-	FINISHMSGSYSCALL(write, error);
-}
-
-int
-nanosleep_test(const struct timespec * rqtp, struct timespec * rmtp)
-{
-	struct nanosleep_args nanosleepmsg;
-	int error;
-
-	INITMSGSYSCALL(nanosleep, 0);
-	nanosleepmsg.rqtp = rqtp;
-	nanosleepmsg.rmtp = rmtp;
-	DOMSGSYSCALL(nanosleep);
-	printf("nanosleep: error: %d\n", error);
-	printf("nanosleep: ms_error: %d\n", nanosleepmsg.usrmsg.umsg.ms_error);
-	printf("nanosleep: ms_result: %d\n", nanosleepmsg.usrmsg.umsg.u.ms_result);
-	FINISHMSGSYSCALL(nanosleep, error);
-}
-
-int
-main(void)
-{
-	struct timespec ts, ts2;
-	int error;
-
-	printf("synchronous sendsys() test: write 'hello!' and 1.5 second nanosleep\n");
-	error = write_test(1, "hello!\n", 7);
-	if (error == -1)
-		err(1, "write");
-	ts.tv_sec = 1;
-	ts.tv_nsec = 500 * 1000000;
-	error = nanosleep_test(&ts, &ts2);
-	if (error == -1)
-		err(1, "nanosleep");
-}
diff --git a/test/sysmsg/sysmsg2.c b/test/sysmsg/sysmsg2.c
deleted file mode 100644
index cbc879fd07..0000000000
--- a/test/sysmsg/sysmsg2.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * sysmsg2.c
- *
- * $DragonFly: src/test/sysmsg/sysmsg2.c,v 1.3 2004/09/02 11:21:12 eirikn Exp $
- */
-
-#include <time.h>
-
-#include "syscall.h"
-
-__attribute__((weak))
-
-int
-write_test(int fd, void * buf, size_t nbyte)
-{
-	struct write_args writemsg;
-	int error;
-
-	INITMSGSYSCALL(write, MSGF_ASYNC);
-	writemsg.fd = fd;
-	writemsg.buf = buf;
-	writemsg.nbyte = nbyte;
-	DOMSGSYSCALL(write);
-	printf("write: error: %d\n", error);
-	printf("write: ms_error: %d\n", writemsg.usrmsg.umsg.ms_error);
-	printf("write: ms_result: %d\n", writemsg.usrmsg.umsg.u.ms_result);
-	FINISHMSGSYSCALL(write, error);
-}
-
-int
-nanosleep_test(const struct timespec * rqtp, struct timespec * rmtp)
-{
-	struct nanosleep_args nanosleepmsg;
-	int error;
-
-	INITMSGSYSCALL(nanosleep, MSGF_ASYNC);
-	nanosleepmsg.rqtp = rqtp;
-	nanosleepmsg.rmtp = rmtp;
-	DOMSGSYSCALL(nanosleep);
-	printf("nanosleep: error: %d\n", error);
-	printf("nanosleep: ms_error: %d\n", nanosleepmsg.usrmsg.umsg.ms_error);
-	printf("nanosleep: ms_result: %d\n", nanosleepmsg.usrmsg.umsg.u.ms_result);
-	FINISHMSGSYSCALL(nanosleep, error);
-}
-
-int
-main(void)
-{
-	struct timespec ts, ts2;
-	int error;
-
-	printf("test synchronous syscall msg write 'hello!', with async hint\n");
-	printf("test ASynchronous syscall msg nanosleep for 1.5 seconds\n");
-	printf("WARNING! super-user only, do not ^C the test program!\n");
-	error = write_test(1, "hello!\n", 7);
-	if (error == -1)
-		err(1, "write");
-	ts.tv_sec = 1;
-	ts.tv_nsec = 500 * 1000000;
-	error = nanosleep_test(&ts, &ts2);
-	if (error == -1)
-		err(1, "nanosleep");
-}
-- 
2.15.1

