[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
pptop ChangeLog aux.c configure.ac options.c pp...
From: |
Samuel Thibault |
Subject: |
pptop ChangeLog aux.c configure.ac options.c pp... |
Date: |
Sun, 10 Feb 2013 10:59:51 +0000 |
CVSROOT: /cvsroot/hurdextras
Module name: pptop
Changes by: Samuel Thibault <sthibaul> 13/02/10 10:59:51
Modified files:
. : ChangeLog aux.c configure.ac options.c pptop.c
Log message:
2013-02-10 Samuel Thibault <address@hidden>
Fix build against libpthread.
* aux.c: Include pthread.h instead of cthreads.h.
* configure.ac: Link against libpthread instead of libthreads.
Also
link libihash, libshouldbeinlibc and libm.
* options.c: Include pthread.h instead of cthreads.h. Use
pthread
functions and types instead of cthreads functions and types.
* pptop.c: Likewise.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pptop/ChangeLog?cvsroot=hurdextras&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/pptop/aux.c?cvsroot=hurdextras&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/pptop/configure.ac?cvsroot=hurdextras&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/pptop/options.c?cvsroot=hurdextras&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/pptop/pptop.c?cvsroot=hurdextras&r1=1.11&r2=1.12
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/hurdextras/pptop/ChangeLog,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- ChangeLog 21 Jun 2006 14:24:46 -0000 1.12
+++ ChangeLog 10 Feb 2013 10:59:51 -0000 1.13
@@ -1,3 +1,14 @@
+2013-02-10 Samuel Thibault <address@hidden>
+
+ Fix build against libpthread.
+
+ * aux.c: Include pthread.h instead of cthreads.h.
+ * configure.ac: Link against libpthread instead of libthreads. Also
+ link libihash, libshouldbeinlibc and libm.
+ * options.c: Include pthread.h instead of cthreads.h. Use pthread
+ functions and types instead of cthreads functions and types.
+ * pptop.c: Likewise.
+
2006-06-21 Alfredo Beaumont Sainz <address@hidden>
* configure.ac: Updated contact email to
Index: aux.c
===================================================================
RCS file: /cvsroot/hurdextras/pptop/aux.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- aux.c 25 Aug 2002 19:17:31 -0000 1.11
+++ aux.c 10 Feb 2013 10:59:51 -0000 1.12
@@ -35,7 +35,7 @@
#include <error.h>
#include <termios.h>
#include <fcntl.h>
-#include <cthreads.h>
+#include <pthread.h>
#include <libintl.h>
#include <locale.h>
Index: configure.ac
===================================================================
RCS file: /cvsroot/hurdextras/pptop/configure.ac,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- configure.ac 21 Jun 2006 14:24:46 -0000 1.4
+++ configure.ac 10 Feb 2013 10:59:51 -0000 1.5
@@ -15,8 +15,10 @@
AC_CHECK_LIB([ncurses], [main])
# FIXME: Replace `main' with a function in `-lps':
AC_CHECK_LIB([ps], [main])
-# FIXME: Replace `main' with a function in `-lthreads':
-AC_CHECK_LIB([threads], [main])
+AC_CHECK_LIB([pthread], [pthread_create])
+AC_CHECK_LIB([ihash], [hurd_ihash_create])
+AC_CHECK_LIB([shouldbeinlibc], [idvec_contains])
+AC_CHECK_LIB([m], [lrintf])
# Checks for header files.
AC_HEADER_STDC
Index: options.c
===================================================================
RCS file: /cvsroot/hurdextras/pptop/options.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- options.c 27 Aug 2002 03:44:11 -0000 1.2
+++ options.c 10 Feb 2013 10:59:51 -0000 1.3
@@ -26,7 +26,7 @@
#include <ncurses.h>
#include <fcntl.h>
#include <libintl.h>
-#include <cthreads.h>
+#include <pthread.h>
#include <math.h>
#include "aux.h"
@@ -41,7 +41,7 @@
extern char *sort_key_name;
extern int sort_key_reverse;
extern int lines_to;
-extern mutex_t header_lock;
+extern pthread_mutex_t header_lock;
extern int show_threads;
int lines_to = 0;
@@ -53,7 +53,7 @@
int (*fn)();
};
-void
+void *
get_num (void *args)
{
char c[32], *d;
@@ -61,7 +61,7 @@
int in = fileno (stdin);
long l_c;
- mutex_lock (header_lock);
+ pthread_mutex_lock (&header_lock);
echo ();
mvaddstr (fix_head_count () - 1, 0, "");
clrtoeol ();
@@ -74,11 +74,11 @@
blah->fn (l_c);
fcntl (in, F_SETFL, fcntl (in, F_GETFL, 0) | O_NONBLOCK);
noecho ();
- mutex_unlock (header_lock);
- cthread_exit (0);
+ pthread_mutex_unlock (&header_lock);
+ return 0;
}
-void
+void *
get_string (void *args)
{
struct fork_type *blah = (struct fork_type *)args;
@@ -86,7 +86,7 @@
int in = fileno (stdin);
long l_c;
- mutex_lock (header_lock);
+ pthread_mutex_lock (&header_lock);
echo ();
mvaddstr (fix_head_count () - 1, 0, "");
clrtoeol ();
@@ -98,10 +98,10 @@
fcntl (in, F_SETFL, fcntl (in, F_GETFL, 0) | O_NONBLOCK);
noecho ();
blah->fn (c);
- mutex_unlock (header_lock);
+ pthread_mutex_unlock (&header_lock);
free (blah);
- cthread_exit (0);
+ return 0;
}
int
@@ -138,8 +138,8 @@
for (i = 0; i < max_loop; i++)
{
usleep (100000); /* 0.1 seconds */
- if (mutex_try_lock (header_lock))
- mutex_unlock (header_lock);
+ if (!pthread_mutex_trylock (&header_lock))
+ pthread_mutex_unlock (&header_lock);
else
continue;
@@ -203,11 +203,12 @@
case 'u':
{
struct fork_type *blah = malloc (sizeof (struct fork_type));
+ pthread_t t;
blah->to_trans = _("Which User (Blank for all): ");
blah->fn = change_user;
- cthread_detach(cthread_fork ((cthread_fn_t)get_string,
- (any_t)blah));
+ pthread_create(&t, NULL, get_string, blah);
+ pthread_detach(t);
}
break;
@@ -215,11 +216,12 @@
case '#':
{
struct fork_type *blah = malloc (sizeof (struct fork_type));
+ pthread_t t;
blah->to_trans = _("How many lines would you like to show (0 for
unlimited): ");
blah->fn = set_lines;
- cthread_detach(cthread_fork ((cthread_fn_t)get_num,
- (any_t)blah));
+ pthread_create(&t, NULL, get_num, blah);
+ pthread_detach(t);
}
break;
@@ -227,11 +229,12 @@
case 'd':
{
struct fork_type *blah = malloc (sizeof (struct fork_type));
+ pthread_t t;
blah->to_trans = _("Delay between updates: ");
blah->fn = set_delay;
- cthread_detach(cthread_fork ((cthread_fn_t)get_string,
- (any_t)blah));
+ pthread_create(&t, NULL, get_string, blah);
+ pthread_detach(t);
}
break;
Index: pptop.c
===================================================================
RCS file: /cvsroot/hurdextras/pptop/pptop.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- pptop.c 21 Jun 2006 14:24:46 -0000 1.11
+++ pptop.c 10 Feb 2013 10:59:51 -0000 1.12
@@ -53,7 +53,7 @@
#include <argz.h>
#include <signal.h> /* for sigwinch */
#include <fcntl.h>
-#include <cthreads.h>
+#include <pthread.h>
#include "pptop.h"
#include "aux.h"
@@ -70,7 +70,7 @@
char *global_fmt_string;
char *sort_key_name = "CPU";
int sort_key_reverse = 1;
-mutex_t header_lock;
+pthread_mutex_t header_lock;
int show_threads = 0;
void
@@ -177,7 +177,7 @@
if (err)
error (1, err, "Cannot initialize fields");
- header_lock = mutex_alloc ();
+ pthread_mutex_init(&header_lock, NULL);
setup_filters ();
@@ -192,7 +192,7 @@
{
free (strum);
undo_curses ();
- mutex_free (header_lock);
+ pthread_mutex_destroy (&header_lock);
return (0);
}
}
@@ -547,10 +547,10 @@
{
char *bar_string;
bar_string = extend_string (&strum_string, COLS, ' ');
- if (mutex_try_lock (header_lock))
+ if (!pthread_mutex_trylock (&header_lock))
{
rv_text (headers[TABLE_HEADER], bar_string);
- mutex_unlock (header_lock);
+ pthread_mutex_unlock (&header_lock);
}
else
mvaddstr (headers[TABLE_HEADER], 0,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- pptop ChangeLog aux.c configure.ac options.c pp...,
Samuel Thibault <=