1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-27 05:10:36 +00:00

- Updated to 1.8;

- Use SF macro;
- Use USE_LDCONFIG instead of deprecated INSTALLS_SHLIB;
- Makefile Cleanup;
- Update pkg-plist;
- Remove unnecessary patches.

PR:		ports/120853
Submitted by:	lippe
Approved by:	maintainer timeout (>2 weeks)
This commit is contained in:
Felippe de Meirelles Motta 2008-10-19 15:58:53 +00:00
parent 6461868929
commit 37037781ee
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=221796
9 changed files with 31 additions and 239 deletions

View File

@ -6,18 +6,21 @@
#
PORTNAME= st
PORTVERSION= 1.4
PORTREVISION= 1
PORTVERSION= 1.8
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= state-threads
MASTER_SITES= SF/state-threads
MAINTAINER= ports@FreeBSD.org
MAINTAINER= lippe@FreeBSD.org
COMMENT= State Threads Library for Internet Applications
USE_LDCONFIG= yes
ONLY_FOR_ARCHS= i386 alpha amd64
DOCS= fig.gif notes.html reference.html st.html \
timeout_heap.txt
EXAMPLES= Makefile README error.c lookupdns.c proxy.c \
res.c server.c
.include <bsd.port.pre.mk>
post-patch:
@ -26,22 +29,12 @@ post-patch:
@${CP} ${FILESDIR}/Makefile.examples ${WRKSRC}/examples/Makefile
post-install:
@${MKDIR} ${PREFIX}/include
@${INSTALL_DATA} ${WRKSRC}/public.h ${PREFIX}/include/st.h
@${MKDIR} ${PREFIX}/share/examples/st
@${INSTALL_DATA} ${WRKSRC}/examples/Makefile ${PREFIX}/share/examples/st
@${INSTALL_DATA} ${WRKSRC}/examples/README ${PREFIX}/share/examples/st
@${INSTALL_DATA} ${WRKSRC}/examples/error.c ${PREFIX}/share/examples/st
@${INSTALL_DATA} ${WRKSRC}/examples/lookupdns.c ${PREFIX}/share/examples/st
@${INSTALL_DATA} ${WRKSRC}/examples/proxy.c ${PREFIX}/share/examples/st
@${INSTALL_DATA} ${WRKSRC}/examples/res.c ${PREFIX}/share/examples/st
@${INSTALL_DATA} ${WRKSRC}/examples/server.c ${PREFIX}/share/examples/st
@${CP} ${WRKSRC}/public.h ${PREFIX}/include/st.h
.if !defined(NOPORTDOCS)
@${MKDIR} ${PREFIX}/share/doc/st
@${INSTALL_DATA} ${WRKSRC}/docs/fig.gif ${PREFIX}/share/doc/st
@${INSTALL_DATA} ${WRKSRC}/docs/notes.html ${PREFIX}/share/doc/st
@${INSTALL_DATA} ${WRKSRC}/docs/reference.html ${PREFIX}/share/doc/st
@${INSTALL_DATA} ${WRKSRC}/docs/st.html ${PREFIX}/share/doc/st
@${MKDIR} ${DOCSDIR}
@${INSTALL_DATA} ${DOCS:S,^,${WRKSRC}/docs/,} ${DOCSDIR}/
@${MKDIR} ${EXAMPLESDIR}
@${INSTALL_DATA} ${EXAMPLES:S,^,${WRKSRC}/examples/,} ${EXAMPLESDIR}/
.endif
.include <bsd.port.post.mk>

View File

@ -1,3 +1,3 @@
MD5 (st-1.4.tar.gz) = aac2e6a31a58b089be97c86e9c30f07b
SHA256 (st-1.4.tar.gz) = e3bef563069f3d459b921fe6f45d2384585ff1791f60b34e675a00274fce7fc0
SIZE (st-1.4.tar.gz) = 80245
MD5 (st-1.8.tar.gz) = 088515a622c1fa7724ab1c9aa7102238
SHA256 (st-1.8.tar.gz) = 1c2b27da32ed7618b3fda5b24d4c1e350ee0efd265b5ae0d3f8876f3d25061f5
SIZE (st-1.8.tar.gz) = 106604

View File

@ -6,7 +6,7 @@ LIBDIR= ${PREFIX}/lib
SHLIB_MAJOR= 1
SHLIB_MINOR= 1
LIB= st
NOPROFILE= yes
NO_PROFILE= yes
SRCS= io.c key.c sched.c stk.c sync.c
CFLAGS+= -DFREEBSD

View File

@ -1,49 +0,0 @@
diff -ur common.h common.h
--- common.h Fri Feb 22 12:55:46 2002
+++ common.h Fri Jan 21 15:14:51 2005
@@ -190,6 +190,7 @@
int on_ioq; /* Is it on ioq? */
} _st_pollq_t;
+typedef void (*_st_switch_cb_t)(void);
typedef struct _st_vp {
_st_thread_t *idle_thread; /* Idle thread for this vp */
@@ -204,6 +205,8 @@
#endif
st_utime_t sleep_max;
int pagesize;
+ _st_switch_cb_t switch_out_cb; /* called when a thread is switched out */
+ _st_switch_cb_t switch_in_cb; /* called when a thread is switched in */
#ifndef USE_POLL
int maxfd;
@@ -362,12 +365,22 @@
* Switch away from the current thread context by saving its state and
* calling the thread scheduler
*/
-#define _ST_SWITCH_CONTEXT(_thread) \
- ST_BEGIN_MACRO \
- if (!MD_SETJMP((_thread)->context)) { \
- _st_vp_schedule(); \
- } \
- ST_DEBUG_ITERATE_THREADS(); \
+#define _ST_SWITCH_CONTEXT(_thread) \
+ ST_BEGIN_MACRO \
+ if (_st_this_vp.switch_out_cb != NULL && \
+ _thread != _st_this_vp.idle_thread && \
+ _thread->state != _ST_ST_ZOMBIE) { \
+ _st_this_vp.switch_out_cb(); \
+ } \
+ if (!MD_SETJMP((_thread)->context)) { \
+ _st_vp_schedule(); \
+ } \
+ ST_DEBUG_ITERATE_THREADS(); \
+ if (_st_this_vp.switch_in_cb != NULL && \
+ _thread != _st_this_vp.idle_thread && \
+ _thread->state != _ST_ST_ZOMBIE) { \
+ _st_this_vp.switch_in_cb(); \
+ } \
ST_END_MACRO
/*

View File

@ -1,101 +0,0 @@
diff -ur docs/reference.html docs/reference.html
--- docs/reference.html Fri Oct 25 19:54:20 2002
+++ docs/reference.html Fri Jan 21 15:14:24 2005
@@ -13,6 +13,7 @@
<DL><DD><A HREF=#mutex_t>st_mutex_t</A></DD></DL>
<DL><DD><A HREF=#utime_t>st_utime_t</A></DD></DL>
<DL><DD><A HREF=#netfd_t>st_netfd_t</A></DD></DL>
+<DL><DD><A HREF=#switch_cb_t>st_switch_cb_t</A></DD></DL>
<P>
<DD><A HREF=#errors><B>Error Handling</B></A></DD>
<P>
@@ -20,6 +21,8 @@
<P>
<DL><DD><A HREF=#st_init>st_init()</A></DD></DL>
<DL><DD><A HREF=#st_getfdlimit>st_getfdlimit()</A></DD></DL>
+<DL><DD><A HREF=#st_set_switch_in_cb>st_set_switch_in_cb()</A></DD></DL>
+<DL><DD><A HREF=#st_set_switch_out_cb>st_set_switch_out_cb()</A></DD></DL>
<P>
<DD><A HREF=#threads><B>Thread Control and Identification</B></A></DD>
<P>
@@ -244,6 +247,29 @@
<HR>
<P>
+<A NAME="switch_cb_t">
+<H4>st_switch_cb_t</H4>
+</A>
+Context switch callback function type.
+<P>
+<H5>Syntax</H5>
+
+<PRE>
+#include &lt;st.h&gt;
+
+typedef void (*st_switch_cb_t)(void);
+</PRE>
+<P>
+<H5>Description</H5>
+
+This datatype is a convenience type for describing a pointer
+to a function that will be called when a thread is set to stop
+or set to run.
+
+<P>
+<HR>
+<P>
+
<A NAME="errors">
<H2>Error Handling</H2>
</A>
@@ -267,6 +293,8 @@
<DL>
<DD><A HREF=#st_init>st_init()</A></DD>
<DD><A HREF=#st_getfdlimit>st_getfdlimit()</A></DD>
+<DD><A HREF=#st_set_switch_in_cb>st_set_switch_in_cb()</A></DD>
+<DD><A HREF=#st_set_switch_out_cb>st_set_switch_out_cb()</A></DD>
</DL>
<P>
<HR>
@@ -343,6 +371,41 @@
<H5>Description</H5>
This function returns the limit on the number of open file descriptors which
is set by the <A HREF=#st_init>st_init()</A> function.
+<P>
+<HR>
+<P>
+
+<A NAME="st_set_switch_in_cb">
+<H4>st_set_switch_in_cb()</H4>
+</A>
+<A NAME="st_set_switch_out_cb">
+<H4>st_set_switch_out_cb()</H4>
+</A>
+Set the callback function for thread switches.
+<P>
+<H5>Syntax</H5>
+
+<PRE>
+#include &lt;st.h&gt;
+
+st_switch_cb_t st_set_switch_in_cb(st_switch_cb_t cb);
+st_switch_cb_t st_set_switch_out_cb(st_switch_cb_t cb);
+</PRE>
+<P>
+<H5>Parameters</H5>
+<TT>st_set_switch_in_cb()</TT> and <TT>st_set_switch_out_cb()</TT> have the
+following parameter:<P>
+<TT>cb</TT><P>
+A function to be called when a thread is resumed and stopped respectively.<P>
+<H5>Returns</H5>
+The previous callback function pointer.
+<P>
+<H5>Description</H5>
+These functions set the callback for when a thread is resumed and stopped
+respectively. After being called any thread switch will call the callback.
+It is suggested that thread specific data is used to differentiate between
+different threads.<P>
+These functions can be called at any time.
<P>
<HR>
<P>

View File

@ -1,16 +0,0 @@
diff -ur public.h public.h
--- public.h Thu Mar 28 21:09:08 2002
+++ public.h Fri Jan 21 15:14:24 2005
@@ -85,9 +85,12 @@
typedef struct _st_cond * st_cond_t;
typedef struct _st_mutex * st_mutex_t;
typedef struct _st_netfd * st_netfd_t;
+typedef void (*st_switch_cb_t)(void);
extern int st_init(void);
extern int st_getfdlimit(void);
+extern st_switch_cb_t st_set_switch_in_cb(st_switch_cb_t cb);
+extern st_switch_cb_t st_set_switch_out_cb(st_switch_cb_t cb);
extern st_thread_t st_thread_self(void);
extern void st_thread_exit(void *retval);

View File

@ -1,25 +0,0 @@
diff -ur sched.c sched.c
--- sched.c Wed Jan 30 19:46:11 2002
+++ sched.c Fri Jan 21 15:14:24 2005
@@ -232,6 +232,21 @@
return 0;
}
+st_switch_cb_t st_set_switch_in_cb(st_switch_cb_t cb)
+{
+ st_switch_cb_t ocb = _st_this_vp.switch_in_cb;
+
+ _st_this_vp.switch_in_cb = cb;
+ return (ocb);
+}
+
+st_switch_cb_t st_set_switch_out_cb(st_switch_cb_t cb)
+{
+ st_switch_cb_t ocb = _st_this_vp.switch_out_cb;
+
+ _st_this_vp.switch_out_cb = cb;
+ return (ocb);
+}
/*
* Start function for the idle thread

View File

@ -1,11 +0,0 @@
--- md.h.orig Thu Aug 11 11:15:00 2005
+++ md.h Thu Aug 11 11:33:23 2005
@@ -154,6 +154,8 @@
#define MD_JB_SP 2
#elif defined(__alpha__)
#define MD_JB_SP 34
+#elif defined(__amd64__)
+#define MD_JB_SP 2
#else
#error Unknown CPU architecture
#endif

View File

@ -2,16 +2,17 @@ include/st.h
lib/libst.a
lib/libst.so.1
lib/libst.so
%%PORTDOCS%%share/doc/st/fig.gif
%%PORTDOCS%%share/doc/st/notes.html
%%PORTDOCS%%share/doc/st/reference.html
%%PORTDOCS%%share/doc/st/st.html
%%PORTDOCS%%@dirrm share/doc/st
share/examples/st/Makefile
share/examples/st/README
share/examples/st/error.c
share/examples/st/lookupdns.c
share/examples/st/proxy.c
share/examples/st/res.c
share/examples/st/server.c
@dirrm share/examples/st
%%PORTDOCS%%%%DOCSDIR%%/fig.gif
%%PORTDOCS%%%%DOCSDIR%%/notes.html
%%PORTDOCS%%%%DOCSDIR%%/reference.html
%%PORTDOCS%%%%DOCSDIR%%/st.html
%%PORTDOCS%%%%DOCSDIR%%/timeout_heap.txt
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/Makefile
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/README
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/error.c
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/lookupdns.c
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/proxy.c
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/res.c
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/server.c
%%PORTEXAMPLES%%@dirrm %%EXAMPLESDIR%%
%%PORTDOCS%%@dirrm %%DOCSDIR%%