Skip to content

Commit 43ef46d

Browse files
committed
add st-1.9
1 parent 7dc6200 commit 43ef46d

40 files changed

+14660
-1
lines changed

Makefile

Lines changed: 469 additions & 0 deletions
Large diffs are not rendered by default.

README

Lines changed: 394 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,394 @@
1+
WELCOME!
2+
3+
The State Threads Library is a small application library which provides
4+
a foundation for writing fast and highly scalable Internet applications
5+
(such as web servers, proxy servers, mail transfer agents, and so on,
6+
really any network-data-driven application) on UNIX-like platforms. It
7+
combines the simplicity of the multithreaded programming paradigm, in
8+
which one thread supports each simultaneous connection, with the
9+
performance and scalability of an event-driven state machine
10+
architecture. In other words, this library offers a threading API for
11+
structuring an Internet application as a state machine. For more
12+
details, please see the library documentation in the "docs" directory or
13+
on-line at
14+
15+
http://state-threads.sourceforge.net/docs/
16+
17+
The State Threads Project is an open source project for maintaining and
18+
enhancing the State Threads Library. For more information about this
19+
project, please see
20+
21+
http://state-threads.sourceforge.net/
22+
23+
24+
BUILDING
25+
26+
To build the library by hand, use the GNU make utility. Run the make
27+
command (e.g., `gmake') with no arguments to display all supported
28+
targets.
29+
30+
To build more or less automatically, first set the CONFIG_GUESS_PATH
31+
variable in either osguess.sh or your environment then run "make
32+
default" which guesses your OS and builds. Requires the "config.guess"
33+
utility from GNU autoconf (not included with ST). You can use one from
34+
a larger "main" software project or just use any config.guess available
35+
on your system. You can also get it directly from GNU:
36+
ftp://ftp.gnu.org/gnu/autoconf/
37+
38+
To build rpms (RedHat Linux 6.2 or later, Linux/Mandrake, Solaris with
39+
gnome, etc.):
40+
download the latest st-x.y.tar.gz
41+
# rpm -ta st-x.y.tar.gz
42+
The .rpms will land in /usr/src/RPMS/<arch>. Install them with:
43+
# rpm -i libst*.rpm
44+
Requires GNU automake and rpm 3.0.3 or later.
45+
46+
Debian users:
47+
If you run potato, please upgrade to woody.
48+
If you run woody, "apt-get install libst-dev" will get you v1.3.
49+
If you run testing/unstable, you will get the newest available version.
50+
If you *must* have the newest libst in woody, you may follow these
51+
not-recommended instructions:
52+
1. Add "deb-src <your-favourite-debian-mirror> unstable main" to your
53+
/etc/apt/sources.list
54+
2. apt-get update
55+
3. apt-get source st
56+
4. cd st-1.4 (or whatever version you got)
57+
5. debuild
58+
6. dpkg -i ../*.deb
59+
60+
If your application uses autoconf to search for dependencies and you
61+
want to search for a given version of libst, you can simply add
62+
PKG_CHECK_MODULES(MYAPP, st >= 1.3 mumble >= 0.2.23)
63+
to your configure.ac/in. This will define @MYAPP_LIBS@ and
64+
@MYAPP_CFLAGS@ which you may then use in your Makefile.am/in files to
65+
link against mumble and st.
66+
67+
68+
LICENSE
69+
70+
The State Threads library is a derivative of the Netscape Portable
71+
Runtime library (NSPR). All source code in this directory is
72+
distributed under the terms of the Mozilla Public License (MPL) version
73+
1.1 or the GNU General Public License (GPL) version 2 or later. For
74+
more information about these licenses please see
75+
http://www.mozilla.org/MPL/ and http://www.gnu.org/copyleft/.
76+
77+
All source code in the "examples" directory is distributed under the BSD
78+
style license.
79+
80+
81+
PLATFORMS
82+
83+
Please see the "docs/notes.html" file for the list of currently
84+
supported platforms.
85+
86+
87+
DEBUGGER SUPPORT
88+
89+
It's almost impossible to print SP and PC in a portable way. The only
90+
way to see thread's stack platform-independently is to actually jump to
91+
the saved context. That's what the _st_iterate_threads() function does.
92+
Do the following to iterate over all threads:
93+
94+
- set the _st_iterate_threads_flag to 1 in debugger
95+
- set breakpoint at the _st_show_thread_stack() function
96+
(which does nothing)
97+
- call the _st_iterate_threads() function which jumps to the
98+
next thread
99+
- at each break you can explore thread's stack
100+
- continue
101+
- when iteration is complete, you return to the original
102+
point (you can see thread id and a message as arguments of
103+
the _st_show_thread_stack() function).
104+
105+
You can call _st_iterate_threads() in three ways:
106+
107+
- Insert it into your source code at the point you want to
108+
go over threads.
109+
- Just run application and this function will be called at
110+
the first context switch.
111+
- Call it directly from the debugger at any point.
112+
113+
This works with gdb and dbx.
114+
115+
Example using gdb:
116+
117+
(gdb) set _st_iterate_threads_flag = 1
118+
(gdb) b _st_show_thread_stack
119+
...
120+
(gdb) call _st_iterate_threads()
121+
...
122+
(gdb) bt
123+
...
124+
(gdb) c
125+
...
126+
(gdb) bt
127+
...
128+
(gdb) c
129+
...
130+
and so on...
131+
132+
_st_iterate_threads_flag will be set to 0 automatically
133+
after iteration is over or you can set it to 0 at any time
134+
to stop iteration.
135+
136+
Sometimes gdb complains about SIGSEGV when you call a function
137+
directly at gdb command-line. It can be ignored -- just call the
138+
same function right away again, it works just fine. For example:
139+
140+
(gdb) set _st_iterate_threads_flag = 1
141+
(gdb) b _st_show_thread_stack
142+
Breakpoint 1 at 0x809bbbb: file sched.c, line 856.
143+
(gdb) call _st_iterate_threads()
144+
Program received signal SIGSEGV, Segmentation fault.
145+
....
146+
(gdb) # just call the function again:
147+
(gdb) call _st_iterate_threads()
148+
Breakpoint 1, _st_show_thread_stack (thread=0x4017aee4, messg=0x80ae7a2
149+
"Iteration started") at sched.c:856
150+
856 }
151+
....
152+
153+
You can use simple gdb command-line scripting to display
154+
all threads and their stack traces at once:
155+
156+
(gdb) while _st_iterate_threads_flag
157+
>bt
158+
>c
159+
>end
160+
....
161+
162+
Another script to stop at the thread with the specific thread id
163+
(e.g., 0x40252ee4):
164+
165+
(gdb) # set the flag again:
166+
(gdb) set _st_iterate_threads_flag = 1
167+
(gdb) call _st_iterate_threads()
168+
Breakpoint 1, _st_show_thread_stack (thread=0x4017aee4, messg=0x80ae7a2
169+
"Iteration started") at sched.c:856
170+
856 }
171+
....
172+
(gdb) while thread != 0x40252ee4
173+
>c
174+
>end
175+
....
176+
....
177+
Breakpoint 1, _st_show_thread_stack (thread=0x40252ee4, messg=0x0) at
178+
sched.c:856
179+
856 }
180+
(gdb) bt
181+
....
182+
(gdb) # don't want to continue iteration, unset the flag:
183+
(gdb) set _st_iterate_threads_flag = 0
184+
(gdb) c
185+
Continuing.
186+
Breakpoint 1, _st_show_thread_stack (thread=0x0, messg=0x80ae78e "Iteration
187+
completed")
188+
at sched.c:856
189+
856 }
190+
(gdb) c
191+
Continuing.
192+
(gdb) return
193+
Make selected stack frame return now? (y or n) y
194+
#0 0x4011254e in __select ()
195+
from /lib/libc.so.6
196+
(gdb) detach
197+
198+
199+
CHANGE LOG
200+
201+
Changes from 1.8 to 1.9.
202+
------------------------
203+
o Support 32-bit and 64-bit Intel Macs.
204+
205+
o Added ST_VERSION string, and ST_VERSION_MAJOR and ST_VERSION_MINOR
206+
[bug 1796801].
207+
208+
o Fixed some compiler warnings, based on a patch from Brian Wellington
209+
[bug 1932741].
210+
211+
212+
Changes from 1.7 to 1.8.
213+
--------------------------
214+
o Added support for kqueue and epoll on platforms that support them.
215+
Added ability to choose the event notification system at program
216+
startup.
217+
218+
o Long-overdue public definitions of ST_UTIME_NO_TIMEOUT (-1ULL) and
219+
ST_UTIME_NO_WAIT (0) [bug 1514436].
220+
221+
o Documentation patch for st_utime() [bug 1514484].
222+
223+
o Documentation patch for st_timecache_set() [bug 1514486].
224+
225+
o Documentation patch for st_netfd_serialize_accept() [bug 1514494].
226+
227+
o Added st_writev_resid() [rfe 1538344].
228+
229+
o Added st_readv_resid() [rfe 1538768] and, for symmetry, st_readv().
230+
231+
232+
Changes from 1.6 to 1.7.
233+
------------------------
234+
o Support glibc 2.4, which breaks programs that manipulate jump buffers.
235+
Replaced Linux IA64 special cases with new md.S that covers all
236+
Linux.
237+
238+
239+
Changes from 1.5.2 to 1.6.
240+
--------------------------
241+
none
242+
243+
244+
Changes from 1.5.1 to 1.5.2.
245+
----------------------------
246+
o Alfred Perlstein's context switch callback feature.
247+
248+
o Claus Assmann's st_recvmsg/st_sendmsg wrappers.
249+
250+
o Extra stack padding for platforms that need it.
251+
252+
o Ron Arts's timeout clarifications in the reference manual.
253+
254+
o Raymond Bero and Anton Berezin's AMD64 FreeBSD port.
255+
256+
o Claus Assmann's AMD64 SunOS 5.10 port.
257+
258+
o Claus Assmann's AMD64 OpenBSD port.
259+
260+
o Michael Abd-El-Malek's Mac OS X port.
261+
262+
o Michael Abd-El-Malek's stack printing patch.
263+
264+
265+
Changes from 1.5.0 to 1.5.1.
266+
----------------------------
267+
o Andreas Gustafsson's USE_POLL fix.
268+
269+
o Gene's st_set_utime_function() enhancement.
270+
271+
272+
Changes from 1.4 to 1.5.0.
273+
--------------------------
274+
o Andreas Gustafsson's performance patch.
275+
276+
o New extensions: Improved DNS resolver, generic LRU cache, in-process
277+
DNS cache, and a program to test the resolver and cache.
278+
279+
o Support for AMD Opteron 64-bit CPUs under Linux.
280+
281+
o Support for SPARC-64 under Solaris.
282+
283+
o Andreas Gustafsson's support for VAX under NetBSD.
284+
285+
o Changed unportable #warning directives in md.h to #error.
286+
287+
288+
Changes from 1.3 to 1.4.
289+
------------------------
290+
o Andreas Gustafsson's NetBSD port.
291+
292+
o Wesley W. Terpstra's Darwin (MacOS X) port.
293+
294+
o Support for many CPU architectures under Linux and *BSD.
295+
296+
o Renamed private typedefs so they don't conflict with public ones any
297+
more.
298+
299+
o common.h now includes public.h for strict prototyping.
300+
301+
o Joshua Levy's recommendation to make st_connect() and st_sendto()
302+
accept const struct sockaddr pointers, as the originals do.
303+
304+
o Clarified the documentation regarding blocking vs. non-blocking I/O.
305+
306+
o Cygwin support.
307+
308+
o Created the extensions directory.
309+
310+
o Fixed warnings from ia64asm.S.
311+
312+
313+
Changes from 1.2 to 1.3.
314+
------------------------
315+
o Added st_read_resid() and st_write_resid() to allow the caller to know
316+
how much data was transferred before an error occurred. Updated
317+
documentation.
318+
319+
o Updated project link, copyrights, and documentation regarding
320+
timeouts. Added comment to st_connect().
321+
322+
o Optimized the _st_add_sleep_q() function in sched.c. Now we walk the
323+
sleep queue *backward* when inserting a thread into it. When you
324+
have lots (hundreds) of threads and several timeout values, it takes
325+
a while to insert a thread at the appropriate point in the sleep
326+
queue. The idea is that often this appropriate point is closer to
327+
the end of the queue rather than the beginning. Measurements show
328+
performance improves with this change. In any case this change
329+
should do no harm.
330+
331+
o Added a hint of when to define USE_POLL and when not to, to the
332+
Makefile.
333+
334+
o Added debugging support (files common.h and sched.c). See above.
335+
336+
o Decreased the number of reallocations of _ST_POLLFDS in sched.c.
337+
Inspired by Lev Walkin.
338+
339+
o Fixed st_usleep(-1) and st_sleep(-1), and added a warning to the
340+
documentation about too-large timeouts.
341+
342+
o Linux/*BSD Alpha port.
343+
344+
o Wesley W. Terpstra modernized the build process:
345+
- properly build relocatable libraries under bsd and linux
346+
- use library versioning
347+
- added rpm spec file
348+
- added debian/ files
349+
See above for build instructions.
350+
351+
352+
Changes from 1.1 to 1.2.
353+
------------------------
354+
o Added st_randomize_stacks().
355+
356+
o Added a patch contributed by Sascha Schumann.
357+
358+
359+
Changes from 1.0 to 1.1.
360+
------------------------
361+
o Relicensed under dual MPL-GPL.
362+
363+
o OpenBSD port.
364+
365+
o Compile-time option to use poll() instead of select() for
366+
event polling (see Makefile).
367+
This is useful if you want to support a large number of open
368+
file descriptors (larger than FD_SETSIZE) within a single
369+
process.
370+
371+
o Linux IA-64 port.
372+
Two issues make IA-64 different from other platforms:
373+
374+
- Besides the traditional call stack in memory, IA-64 uses the
375+
general register stack. Thus each thread needs a backing store
376+
for the register stack in addition to the memory stack.
377+
378+
- Current implementation of setjmp()/longjmp() can not be used
379+
for thread context-switching since it assumes that only one
380+
register stack exists. Using special assembly functions for
381+
context-switching is unavoidable.
382+
383+
o Thread stack capping on IRIX.
384+
This allows some profiling tools (such as SpeedShop) to know when
385+
to stop unwinding the stack. Without this libexc, used by SpeedShop,
386+
traces right off the stack and crashes.
387+
388+
o Miscellaneous documentation additions.
389+
390+
391+
COPYRIGHTS
392+
393+
Portions created by SGI are Copyright (C) 2000 Silicon Graphics, Inc.
394+
All Rights Reserved.

0 commit comments

Comments
 (0)