/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the "License"). You may not use this file except
* in compliance with the License.
*
* You can obtain a copy of the license at
* See the License for the specific language governing
* permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* HEADER in each file and include the License file at
* usr/src/OPENSOLARIS.LICENSE. If applicable,
* add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your
* own identifying information: Portions Copyright [yyyy]
* [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <netdb.h>
#include <pthread.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include "libmicro.h"
typedef struct {
int ts_once;
int ts_in;
int ts_out;
int ts_in2;
int ts_out2;
int ts_lsn;
} tsd_t;
#define MD_SINGLE 0
NULL};
#define XP_PIPES 0
int
{
lm_tsdsize = sizeof (tsd_t);
" [-m mode (st|mt|mp, default %s)]\n"
" [-s buffer-size (default %d)]\n"
" [-x transport (pipe|fifo|sock|tcp, default %s)]\n"
"notes: measures write()/read() across various transports\n",
return (0);
}
int
{
int x;
switch (opt) {
case 'm':
if (x == -1)
return (-1);
optm = x;
break;
case 's':
break;
case 'x':
if (x == -1)
return (-1);
optx = x;
break;
default:
return (-1);
}
return (0);
}
int
{
if (geteuid() != 0) {
(void) printf("sorry, must be root to create fifos\n");
exit(1);
}
}
return (0);
}
int
{
int result;
int i;
switch (optx) {
case XP_SOCKETPAIR:
break;
case XP_LOCALTCP:
break;
case XP_FIFOS:
break;
case XP_PIPES:
default:
break;
}
if (result == -1) {
return (1);
}
switch (optm) {
case MD_MULTITHREAD:
if (result == -1) {
return (1);
}
break;
case MD_MULTIPROCESS:
switch (pid) {
case 0:
exit(0);
break;
case -1:
return (-1);
default:
break;
}
break;
case MD_SINGLE:
default:
break;
}
/* Prime the loopback */
return (1);
}
return (1);
}
return (0);
}
int
{
int i;
int n;
for (i = 0; i < lm_optB; i++) {
continue;
}
if (n == -1) {
continue;
}
}
return (0);
}
int
{
/* Terminate the loopback */
switch (optm) {
case MD_MULTITHREAD:
break;
case MD_MULTIPROCESS:
break;
case MD_SINGLE:
default:
break;
}
(void) cleanup_fifos(ts);
}
return (0);
}
char *
{
return (result);
}
int
{
size_t n;
for (;;) {
if (n < 1) {
return (-1);
}
total += n;
return (total);
}
}
}
void *
{
int i, n, m;
/* Include priming and termination */
m = lm_optB + 2;
for (i = 0; i < m; i++) {
if (n == -1) {
break;
}
break;
}
}
return (NULL);
}
int
{
int j;
j = FIRSTPORT;
return (-1);
}
&opt, sizeof (int)) == -1) {
return (-1);
}
return (-1);
}
for (;;) {
sizeof (struct sockaddr_in));
sizeof (struct sockaddr_in)) == 0) {
break;
}
if (errno != EADDRINUSE) {
return (-1);
}
}
return (-1);
}
return (0);
}
int
{
int result;
return (-1);
}
}
return (-1);
}
return (-1);
}
sizeof (struct sockaddr_in));
return (-1);
}
return (-1);
}
if (result == -1) {
return (-1);
}
&opt, sizeof (int)) == -1) {
return (-1);
}
&opt, sizeof (int)) == -1) {
return (-1);
}
} else {
}
return (0);
}
int
{
int s[2];
return (-1);
}
} else {
}
return (0);
}
int
{
getpid(), pthread_self());
return (-1);
}
} else {
getpid(), pthread_self());
return (-1);
}
}
return (0);
}
/*ARGSUSED*/
int
{
return (0);
}
int
{
int p[2];
if (pipe(p) == -1) {
return (-1);
}
} else {
if (pipe(p) == -1) {
return (-1);
}
if (pipe(p) == -1) {
return (-1);
}
}
return (0);
}
char *
{
int i = 0;
if (x == i) {
return (names[i]);
}
i++;
}
return (NULL);
}
int
{
int i = 0;
return (i);
}
i++;
}
return (-1);
}