author | aw148015 |
Tue, 26 Feb 2008 11:39:00 -0800 | |
changeset 6084 | d5f45b4dae7e |
parent 5184 | da60d2b4a9e2 |
child 6212 | d9dcad6dd79c |
permissions | -rw-r--r-- |
5184 | 1 |
/* |
2 |
* CDDL HEADER START |
|
3 |
* |
|
4 |
* The contents of this file are subject to the terms of the |
|
5 |
* Common Development and Distribution License (the "License"). |
|
6 |
* You may not use this file except in compliance with the License. |
|
7 |
* |
|
8 |
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
|
9 |
* or http://www.opensolaris.org/os/licensing. |
|
10 |
* See the License for the specific language governing permissions |
|
11 |
* and limitations under the License. |
|
12 |
* |
|
13 |
* When distributing Covered Code, include this CDDL HEADER in each |
|
14 |
* file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
|
15 |
* If applicable, add the following below this CDDL HEADER, with the |
|
16 |
* fields enclosed by brackets "[]" replaced with your own identifying |
|
17 |
* information: Portions Copyright [yyyy] [name of copyright owner] |
|
18 |
* |
|
19 |
* CDDL HEADER END |
|
20 |
*/ |
|
21 |
/* |
|
6084
d5f45b4dae7e
6581656 invalid data should be friendlier to users
aw148015
parents:
5184
diff
changeset
|
22 |
* Copyright 2008 Sun Microsystems, Inc. All rights reserved. |
5184 | 23 |
* Use is subject to license terms. |
24 |
*/ |
|
25 |
||
26 |
#ifndef _FB_THREADFLOW_H |
|
27 |
#define _FB_THREADFLOW_H |
|
28 |
||
29 |
#pragma ident "%Z%%M% %I% %E% SMI" |
|
30 |
||
31 |
#include "config.h" |
|
32 |
#include <pthread.h> |
|
33 |
||
34 |
#ifndef HAVE_CADDR_T1 |
|
35 |
/* typedef char *caddr_t; */ |
|
36 |
#endif |
|
37 |
||
38 |
#ifdef LINUX_PORT |
|
39 |
#include <linux/types.h> /* for "caddr_t" */ |
|
40 |
#endif |
|
41 |
||
42 |
||
43 |
#ifdef HAVE_AIO |
|
44 |
#include <aio.h> |
|
45 |
#endif |
|
46 |
#ifdef HAVE_PROCFS |
|
47 |
#include <procfs.h> |
|
48 |
#endif |
|
49 |
#include "vars.h" |
|
50 |
#include "procflow.h" |
|
51 |
#include "fileset.h" |
|
52 |
||
53 |
#ifdef __cplusplus |
|
54 |
extern "C" { |
|
55 |
#endif |
|
56 |
||
57 |
#define AL_READ 1 |
|
58 |
#define AL_WRITE 2 |
|
59 |
||
60 |
||
61 |
#ifdef HAVE_AIO |
|
62 |
typedef struct aiolist { |
|
63 |
int al_type; |
|
64 |
struct aiolist *al_next; |
|
65 |
struct aiolist *al_worknext; |
|
66 |
struct aiocb64 al_aiocb; |
|
67 |
} aiolist_t; |
|
68 |
#endif |
|
69 |
||
70 |
#define THREADFLOW_MAXFD 128 |
|
71 |
#define THREADFLOW_USEISM 0x1 |
|
72 |
||
73 |
typedef struct threadflow { |
|
74 |
char tf_name[128]; /* Name */ |
|
75 |
int tf_attrs; /* Attributes */ |
|
76 |
int tf_instance; /* Instance number */ |
|
77 |
int tf_running; /* Thread running indicator */ |
|
78 |
int tf_abort; /* Shutdown thread */ |
|
79 |
int tf_utid; /* Unique id for thread */ |
|
80 |
struct procflow *tf_process; /* Back pointer to process */ |
|
81 |
pthread_t tf_tid; /* Thread id */ |
|
82 |
pthread_mutex_t tf_lock; /* Mutex around threadflow */ |
|
83 |
var_integer_t tf_instances; /* Number of instances for this flow */ |
|
84 |
struct threadflow *tf_next; /* Next on proc list */ |
|
85 |
struct flowop *tf_ops; /* Flowop list */ |
|
86 |
caddr_t tf_mem; /* Private Memory */ |
|
87 |
var_integer_t tf_memsize; /* Private Memory size */ |
|
88 |
int tf_fd[THREADFLOW_MAXFD + 1]; /* Thread local fd's */ |
|
89 |
filesetentry_t *tf_fse[THREADFLOW_MAXFD + 1]; /* Thread local files */ |
|
90 |
int tf_fdrotor; /* Rotating fd within set */ |
|
91 |
flowstat_t tf_stats; /* Thread statistics */ |
|
92 |
hrtime_t tf_stime; /* Start time of op */ |
|
93 |
#ifdef HAVE_PROCFS |
|
94 |
struct prusage tf_susage; /* Resource usage snapshot, start */ |
|
95 |
struct prusage tf_eusage; /* Resource usage snapshot, end */ |
|
96 |
#endif |
|
97 |
int tf_lwpusagefd; /* /proc lwp usage fd */ |
|
98 |
#ifdef HAVE_AIO |
|
99 |
aiolist_t *tf_aiolist; /* List of async I/Os */ |
|
100 |
#endif |
|
101 |
||
102 |
} threadflow_t; |
|
103 |
||
104 |
/* Thread attrs */ |
|
105 |
#define THREADFLOW_DEFAULTMEM 1024*1024LL; |
|
106 |
||
107 |
threadflow_t *threadflow_define(procflow_t *, char *name, threadflow_t *inherit, |
|
108 |
var_integer_t instances); |
|
109 |
threadflow_t *threadflow_find(threadflow_t *, char *); |
|
110 |
int threadflow_init(procflow_t *); |
|
111 |
void flowop_start(threadflow_t *threadflow); |
|
112 |
void threadflow_usage(void); |
|
113 |
void threadflow_allstarted(pid_t pid, threadflow_t *threadflow); |
|
6084
d5f45b4dae7e
6581656 invalid data should be friendlier to users
aw148015
parents:
5184
diff
changeset
|
114 |
void threadflow_delete_all(threadflow_t **threadlist, int wait_cnt); |
5184 | 115 |
|
116 |
#ifdef __cplusplus |
|
117 |
} |
|
118 |
#endif |
|
119 |
||
120 |
#endif /* _FB_THREADFLOW_H */ |