Removed the `lockfile' argument; we now use a configure check to determine

2000-02-06  Martin Baulig  <martin@home-of-linux.org>

	* include/glibtop/ppp.h (glibtop_get_ppp): Removed the `lockfile'
	argument; we now use a configure check to determine the modem
	lockfile.

	* include/glibtop/error.h (GLIBTOP_ERROR_NEED_MODEM_LOCKFILE):
	Removed this now obsolete error constant again.

	* configure.in (--with-modem-lockfile): New configure parameter
	to manually specify the modem lockfile.
	(LIBGTOP_MODEM_LOCKFILE): Define this to be a printf-format string
	for the modem lockfile; takes the interface number as argument.
This commit is contained in:
Martin Baulig
2000-02-06 13:21:14 +00:00
committed by Martin Baulig
parent a691993a86
commit 2eab7cfc48
12 changed files with 49 additions and 22 deletions

View File

@@ -1,3 +1,17 @@
2000-02-06 Martin Baulig <martin@home-of-linux.org>
* include/glibtop/ppp.h (glibtop_get_ppp): Removed the `lockfile'
argument; we now use a configure check to determine the modem
lockfile.
* include/glibtop/error.h (GLIBTOP_ERROR_NEED_MODEM_LOCKFILE):
Removed this now obsolete error constant again.
* configure.in (--with-modem-lockfile): New configure parameter
to manually specify the modem lockfile.
(LIBGTOP_MODEM_LOCKFILE): Define this to be a printf-format string
for the modem lockfile; takes the interface number as argument.
2000-02-05 Martin Baulig <martin@home-of-linux.org>
* include/glibtop/interfaces.h (glibtop_ipv6_scope): New

View File

@@ -176,3 +176,7 @@
/* Define if you have the libxml library */
#undef HAVE_LIBXML
/* Modem lockfile for PPP support. This is a printf-like format string
* which takes the interface number as argument
* (default '/var/lock/LCK..ttyS%u'). */
#undef LIBGTOP_MODEM_LOCKFILE

View File

@@ -21,4 +21,4 @@ retval|@fsusage|ulong(blocks,bfree,bavail,files,ffree)|string(mount_dir)
array(glibtop_interface)|interface_names|array|ulong(interface,number,instance,strategy)
array(glibtop_ifaddr)|netinfo|array:ulong(if_flags,transport,mtu)|string(interface):ulong(transport)
retval|netload|ulong(packets_in,packets_out,packets_total,bytes_in,bytes_out,bytes_total,errors_in,errors_out,errors_total,collisions)|string(interface):unsigned(transport,protocol)
retval|ppp|ulong(state,bytes_in,bytes_out)|ushort(device,use_isdn):string(lockfile)
retval|ppp|ulong(state,bytes_in,bytes_out)|ushort(device,use_isdn)

View File

@@ -49,9 +49,8 @@ BEGIN_LIBGTOP_DECLS
#define GLIBTOP_ERROR_NO_BACKEND_OPENED 12
#define GLIBTOP_ERROR_DEMARSHAL_ERROR 13
#define GLIBTOP_ERROR_NEED_MODEM_LOCKFILE 14
#define GLIBTOP_MAX_ERROR 15
#define GLIBTOP_MAX_ERROR 14
char *
glibtop_get_error_string_l (glibtop *server, unsigned error_number);

View File

@@ -53,7 +53,7 @@ struct _glibtop_ppp
bytes_out; /* GLIBTOP_PPP_BYTES_OUT */
};
#define glibtop_get_ppp(ppp,device,use_isdn,lockfile) glibtop_get_ppp_l(glibtop_global_server, ppp, device, use_isdn, lockfile)
#define glibtop_get_ppp(ppp,device,use_isdn) glibtop_get_ppp_l(glibtop_global_server, ppp, device, use_isdn)
#if GLIBTOP_SUID_PPP
#define glibtop_get_ppp_r glibtop_get_ppp_p
@@ -61,14 +61,14 @@ struct _glibtop_ppp
#define glibtop_get_ppp_r glibtop_get_ppp_s
#endif
int glibtop_get_ppp_l (glibtop *server, glibtop_ppp *buf, unsigned short device, unsigned short use_isdn, const char *lockfile);
int glibtop_get_ppp_l (glibtop *server, glibtop_ppp *buf, unsigned short device, unsigned short use_isdn);
#if GLIBTOP_SUID_PPP
int glibtop_init_ppp_p (glibtop *server);
int glibtop_get_ppp_p (glibtop *server, glibtop_ppp *buf, unsigned short device, unsigned short use_isdn, const char *lockfile);
int glibtop_get_ppp_p (glibtop *server, glibtop_ppp *buf, unsigned short device, unsigned short use_isdn);
#else
int glibtop_init_ppp_s (glibtop *server);
int glibtop_get_ppp_s (glibtop *server, glibtop_ppp *buf, unsigned short device, unsigned short use_isdn, const char *lockfile);
int glibtop_get_ppp_s (glibtop *server, glibtop_ppp *buf, unsigned short device, unsigned short use_isdn);
#endif
#ifdef GLIBTOP_NAMES

View File

@@ -348,6 +348,17 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
;;
esac
AC_MSG_CHECKING(for Modem lockfile)
AC_ARG_WITH(modem-lockfile,
[ --with-modem-lockfile Modem lockfile for PPP support],[libgtop_modem_lockfile="$withval"],
[if test -f /dev/modem ; then
libgtop_modem_lockfile='/var/lock/LCK..modem'
else
libgtop_modem_lockfile='/var/lock/LCK..ttyS%u'
fi])
AC_MSG_RESULT($libgtop_modem_lockfile)
AC_DEFINE_UNQUOTED(LIBGTOP_MODEM_LOCKFILE, "$libgtop_modem_lockfile")
AC_MSG_CHECKING(for machine.h in libgtop sysdeps dir)
AC_MSG_RESULT($libgtop_use_machine_h)

View File

@@ -94,7 +94,7 @@ glibtop_init_ppp_p (glibtop *server)
int
glibtop_get_ppp_p (glibtop *server, glibtop_ppp *buf, unsigned short device,
unsigned short isdn, const char *lockfile)
unsigned short isdn)
{
#ifdef HAVE_I4B
#ifdef HAVE_I4B_ACCT

View File

@@ -116,7 +116,7 @@ get_ISDN_stats (glibtop *server, int *in, int *out)
}
static int
is_ISDN_on (glibtop *server, int *online)
is_ISDN_on (glibtop *server, int device, int *online)
{
FILE *f = 0;
char buffer [BUFSIZ], *p;
@@ -211,11 +211,13 @@ is_ISDN_on (glibtop *server, int *online)
}
static int
is_Modem_on (glibtop *server, const char *lock_file)
is_Modem_on (glibtop *server, int device)
{
FILE *f = 0;
gchar buf[64];
gchar buf[64], lock_file [BUFSIZ];
pid_t pid = -1;
FILE *f = 0;
sprintf (lock_file, LIBGTOP_MODEM_LOCKFILE, device);
f = fopen (lock_file, "r");
@@ -275,7 +277,7 @@ get_Modem_stats (int device, int *in, int *out)
int
glibtop_get_ppp_s (glibtop *server, glibtop_ppp *buf, unsigned short device,
unsigned short use_isdn, const char *lockfile)
unsigned short use_isdn)
{
int in, out, online;
@@ -285,7 +287,7 @@ glibtop_get_ppp_s (glibtop *server, glibtop_ppp *buf, unsigned short device,
if (use_isdn) {
/* ISDN */
if (is_ISDN_on (server, &online)) {
if (is_ISDN_on (server, device, &online)) {
buf->state = online ? GLIBTOP_PPP_STATE_ONLINE :
GLIBTOP_PPP_STATE_HANGUP;
buf->flags |= (1L << GLIBTOP_PPP_STATE);
@@ -299,10 +301,7 @@ glibtop_get_ppp_s (glibtop *server, glibtop_ppp *buf, unsigned short device,
}
} else {
/* Modem */
if (!lockfile)
return -GLIBTOP_ERROR_NEED_MODEM_LOCKFILE;
buf->state = is_Modem_on (server, lockfile) ?
buf->state = is_Modem_on (server, device) ?
GLIBTOP_PPP_STATE_ONLINE : GLIBTOP_PPP_STATE_HANGUP;
buf->flags |= (1L << GLIBTOP_PPP_STATE);

View File

@@ -43,7 +43,7 @@ glibtop_init_ppp_s (glibtop *server)
int
glibtop_get_ppp_s (glibtop *server, glibtop_ppp *buf, unsigned short device,
unsigned short isdn, const char *lockfile)
unsigned short isdn)
{
memset (buf, 0, sizeof (glibtop_ppp));
return 0;

View File

@@ -43,7 +43,7 @@ glibtop_init_ppp_s (glibtop *server)
int
glibtop_get_ppp_s (glibtop *server, glibtop_ppp *buf, unsigned short device,
unsigned short isdn, const char *lockfile)
unsigned short isdn)
{
memset (buf, 0, sizeof (glibtop_ppp));

View File

@@ -43,7 +43,7 @@ glibtop_init_ppp_s (glibtop *server)
int
glibtop_get_ppp_s (glibtop *server, glibtop_ppp *buf, unsigned short device,
unsigned short isdn, const char *lockfile)
unsigned short isdn)
{
memset (buf, 0, sizeof (glibtop_ppp));

View File

@@ -45,7 +45,7 @@ glibtop_init_ppp_p (glibtop *server)
int
glibtop_get_ppp_p (glibtop *server, glibtop_ppp *buf, unsigned short device,
unsigned short isdn, const char *lockfile)
unsigned short isdn)
{
glibtop_init_p (server, GLIBTOP_SYSDEPS_PPP, 0);