diff options
author | Will Andrews <will@FreeBSD.org> | 2001-12-04 03:47:18 +0000 |
---|---|---|
committer | Will Andrews <will@FreeBSD.org> | 2001-12-04 03:47:18 +0000 |
commit | 1d206a3483e848f4589962473bdf169313ea740f (patch) | |
tree | 269caee3e56d61cd6318b44d85c3ff64b32d57b6 /x11/kdebase3/files/patch-diskstat.c | |
parent | Make this port PREFIX clean. Required for KDE 2.2.2 upgrade, as well as (diff) |
Upgrade KDE to 2.2.2:
* General:
- Support for objprelink.
- Hack for autoconf 2.13/automake 1.4. Note that we can't use
the standard USE_AUTO* because they change things in work/*;
KDE has its own way of doing that.
- Light cleanup of extra dirs in the PLISTs provided by
my mkplistpkg[1] script.
- Speedups of both compile and runtime through the usage of
--disable-debug and --enable-final. The latter did not work
with the kdemultimedia package, unfortunately.
- Patch updates.
* audio/kdemultimedia2:
- Patch to fix KSCD on FreeBSD[2]. It works very well now.
* deskutils/kdepim:
- Enable kpilot[3]. Pull in the latest pilot-link stuff.
* devel/kdesdk,
* devel/kdevelop:
- No specific changes.
* devel/qt-designer:
- Make this port depend almost entirely on qt23 to make it more
maintainable, so I don't have to keep hacking the patches to
get them to apply.
* editors/koffice,
* games/kdegames,
* graphics/kdegraphics:
- No specific changes.
* misc/kdeaddons:
- SDL is required now. Cull SDL PLIST_SUB and such.
- Fix breakage from hardcoding "sdl-config".
* misc/kdeutils2:
- Fix problem with klaptopdaemon[4] where it didn't properly
display the battery time. This patch is untested, but applied.
* net/kdenetwork2:
- Fix DCC for KSIRC[5].
- Remove ktalkd from the build. It requires some weird thing
in the configure script that I don't have time to look at.
* sysutils/kdeadmin:
- No specific changes.
* textproc/kdoc:
- Remove bogus requirement that kdoc requires Perl 5.6.0; it sure
seems to operate fine with >= 5.005. But I'll let time tell.
* www/quanta:
- No specific changes (--disable-debug support only).
* x11/kde2:
- No specific changes.
* x11/kdebase2:
- Fix ksysguard compile by merging the files from the HEAD branch
of KDE CVS that were missing at release time for FreeBSD[6]. :\
* x11/kdelibs2:
- Recognize CUPS' spinoff[7].
- Add libxslt dependency since it was removed from kdelibs.
- Fix libxml compile problems[8] (accomplished by upgrading).
- Remove libkformula from port Makefile; this library has been
spun off into koffice.
- Fix mode problems with DCOP[9]. This allows you to save files
properly. It also seems to be a FreeBSD specific problem.
- Fix bashisms in kdeprint/imagetops script[10].
* x11-clocks/kdetoys2:
- No specific changes.
* x11-toolkits/qt23:
- Do NOT upgrade to QT 2.3.2[11].
- Allow devel/qt-designer to depend on this port entirely for the
patches by adding a perlre to accomplish this.
* x11-wm/kdeartwork:
- No specific changes.
Thanks to the FreeBSD/KDE[1] team[12] who helped me test these out!
[1] http://freebsd.kde.org/;
http://www.databits.net/cgi-bin/cvsweb.cgi/scripts/portbuild/mkplistpkg
[2] Submitted by: Matthew Holmes <matt@speakeasy.net>
[3] PR: 31914
Submitted by: Alan Eldridge <alane@geeksrus.net>
[4] PR: 28475
Submitted by: Arun Sharma <arun@sharmas.dhs.org>
[5] Submitted by: Luc Morin <luc_m@videotron.ca>
[6] Found at: http://webcvs.kde.org/kdebase/ksysguard/ksysguardd/FreeBSD/
[7] PR: 32321
Reported by: gad
Submitted by: James A. Halstead <jah4007@cs.rit.edu>
[8] PR: 32055
Reported by: William Richard <wrichard@trivalley.com>, others
[9] PR: 31629
Submitted by: Alan Eldridge <alane@geeksrus.net>
[10] PR: 32358
Submitted by: Alexander N. Kabaev <ak03@gte.com>
[11] PR: 31809
Requested by: Nathan Ahlstrom <nrahlstr@winternet.com> (denied)
[12] http://freebsd.kde.org/contact.shtml;
http://lists.csociety.org/pipermail/kde-freebsd;
http://lists.csociety.org/listinfo/kde-freebsd
Notes
Notes:
svn path=/head/; revision=51005
Diffstat (limited to 'x11/kdebase3/files/patch-diskstat.c')
-rw-r--r-- | x11/kdebase3/files/patch-diskstat.c | 260 |
1 files changed, 260 insertions, 0 deletions
diff --git a/x11/kdebase3/files/patch-diskstat.c b/x11/kdebase3/files/patch-diskstat.c new file mode 100644 index 000000000000..5535e580a673 --- /dev/null +++ b/x11/kdebase3/files/patch-diskstat.c @@ -0,0 +1,260 @@ +--- /dev/null Mon Nov 19 17:14:17 2001 ++++ ksysguard/ksysguardd/FreeBSD/diskstat.c Mon Nov 19 17:07:01 2001 +@@ -0,0 +1,257 @@ ++/* ++ KSysGuard, the KDE System Guard ++ ++ Copyright (c) 2001 Tobias Koenig <tokoe82@yahoo.de> ++ ++ This program is free software; you can redistribute it and/or ++ modify it under the terms of version 2 of the GNU General Public ++ License as published by the Free Software Foundation. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ ++ $Id: diskstat.c,v 1.2 2001/09/18 14:03:53 tokoe Exp $ ++*/ ++ ++#include <stdio.h> ++#include <stdlib.h> ++#include <string.h> ++#include <sys/param.h> ++#include <sys/stat.h> ++#include <sys/ucred.h> ++#include <sys/mount.h> ++#include <time.h> ++#include <unistd.h> ++ ++#include "Command.h" ++#include "ccont.h" ++#include "diskstat.h" ++#include "ksysguardd.h" ++ ++typedef struct { ++ char device[256]; ++ char mntpnt[256]; ++ long blocks; ++ long bfree; ++ long bused; ++ int bused_percent; ++} DiskInfo; ++ ++static CONTAINER DiskStatList = 0; ++ ++char *getMntPnt(const char *cmd) ++{ ++ static char device[1024]; ++ char *ptr; ++ ++ memset(device, 0, sizeof(device)); ++ sscanf(cmd, "partitions%1024s", device); ++ ++ ptr = (char *)rindex(device, '/'); ++ *ptr = '\0'; ++ ++ return (char *)device; ++} ++ ++int numMntPnt(void) ++{ ++ struct statfs *fs_info; ++ int i, n, counter = 0; ++ ++ n = getmntinfo(&fs_info, MNT_WAIT); ++ for (i = 0; i < n; i++) ++ if (strcmp(fs_info[i].f_fstypename, "procfs") && strcmp(fs_info[i].f_fstypename, "swap") && strcmp(fs_info[i].f_fstypename, "devfs")) ++ counter++; ++ ++ return counter; ++} ++ ++/* ------------------------------ public part --------------------------- */ ++ ++void initDiskStat(void) ++{ ++ char monitor[1024]; ++ int i; ++ ++ DiskStatList = new_ctnr(CT_DLL); ++ ++ updateDiskStat(); ++ ++ registerMonitor("partitions/list", "listview", printDiskStat, printDiskStatInfo); ++ ++ for (i = 0; i < level_ctnr(DiskStatList); i++) { ++ DiskInfo* disk_info = get_ctnr(DiskStatList, i); ++ snprintf(monitor, sizeof(monitor), "partitions%s/usedspace", disk_info->mntpnt); ++ registerMonitor(monitor, "integer", printDiskStatUsed, printDiskStatUsedInfo); ++ snprintf(monitor, sizeof(monitor), "partitions%s/freespace", disk_info->mntpnt); ++ registerMonitor(monitor, "integer", printDiskStatFree, printDiskStatFreeInfo); ++ snprintf(monitor, sizeof(monitor), "partitions%s/filllevel", disk_info->mntpnt); ++ registerMonitor(monitor, "integer", printDiskStatPercent, printDiskStatPercentInfo); ++ } ++} ++ ++void checkDiskStat(void) ++{ ++ if (numMntPnt() != level_ctnr(DiskStatList)) { ++ /* a filesystem was mounted or unmounted ++ so we do a reset */ ++ exitDiskStat(); ++ initDiskStat(); ++ } ++} ++ ++void exitDiskStat(void) ++{ ++ DiskInfo *disk_info; ++ char monitor[1024]; ++ int i; ++ ++ removeMonitor("partitions/list"); ++ ++ for (i = 0; i < level_ctnr(DiskStatList); i++) { ++ disk_info = remove_ctnr(DiskStatList, i--); ++ ++ snprintf(monitor, sizeof(monitor), "partitions%s/usedspace", disk_info->mntpnt); ++ removeMonitor(monitor); ++ snprintf(monitor, sizeof(monitor), "partitions%s/freespace", disk_info->mntpnt); ++ removeMonitor(monitor); ++ snprintf(monitor, sizeof(monitor), "partitions%s/filllevel", disk_info->mntpnt); ++ removeMonitor(monitor); ++ ++ free(disk_info); ++ } ++ ++ if (DiskStatList) ++ destr_ctnr(DiskStatList, free); ++} ++ ++int updateDiskStat(void) ++{ ++ struct statfs *fs_info; ++ struct statfs fs; ++ float percent; ++ int i, mntcount; ++ DiskInfo *disk_info; ++ ++ /* let's hope there is no difference between the DiskStatList and ++ the number of mounted filesystems */ ++ for (i = 0; i < level_ctnr(DiskStatList); i++) ++ free(remove_ctnr(DiskStatList, i--)); ++ ++ mntcount = getmntinfo(&fs_info, MNT_WAIT); ++ ++ for (i = 0; i < mntcount; i++) { ++ fs = fs_info[i]; ++ if (strcmp(fs.f_fstypename, "procfs") && strcmp(fs.f_fstypename, "devfs") && strcmp(fs.f_fstypename, "devfs")) { ++ percent = (((float)fs.f_blocks - (float)fs.f_bfree)/(float)fs.f_blocks); ++ percent = percent * 100; ++ if ((disk_info = (DiskInfo *)malloc(sizeof(DiskInfo))) == NULL) { ++ continue; ++ } ++ memset(disk_info, 0, sizeof(DiskInfo)); ++ strncpy(disk_info->device, fs.f_mntfromname, 255); ++ if (!strcmp(fs.f_mntonname, "/")) { ++ strncpy(disk_info->mntpnt, "/root", 6); ++ } else { ++ strncpy(disk_info->mntpnt, fs.f_mntonname, 255); ++ } ++ disk_info->blocks = fs.f_blocks; ++ disk_info->bfree = fs.f_bfree; ++ disk_info->bused = (fs.f_blocks - fs.f_bfree); ++ disk_info->bused_percent = (int)percent; ++ ++ push_ctnr(DiskStatList, disk_info); ++ } ++ } ++ ++ return 0; ++} ++ ++void printDiskStat(const char* cmd) ++{ ++ int i; ++ ++ for (i = 0; i < level_ctnr(DiskStatList); i++) { ++ DiskInfo* disk_info = get_ctnr(DiskStatList, i); ++ fprintf(CurrentClient, "%s\t%ld\t%ld\t%ld\t%d\t%s\n", ++ disk_info->device, ++ disk_info->blocks, ++ disk_info->bused, ++ disk_info->bfree, ++ disk_info->bused_percent, ++ disk_info->mntpnt); ++ } ++ ++ fprintf(CurrentClient, "\n"); ++} ++ ++void printDiskStatInfo(const char* cmd) ++{ ++ fprintf(CurrentClient, "Device\tBlocks\tUsed\tAvailable\tUsed %%\tMountPoint\n"); ++} ++ ++void printDiskStatUsed(const char* cmd) ++{ ++ int i; ++ char *mntpnt = (char *)getMntPnt(cmd); ++ ++ for (i = 0; i < level_ctnr(DiskStatList); i++) { ++ DiskInfo* disk_info = get_ctnr(DiskStatList, i); ++ if (!strcmp(mntpnt, disk_info->mntpnt)) { ++ fprintf(CurrentClient, "%ld\n", disk_info->bused); ++ } ++ } ++ ++ fprintf(CurrentClient, "\n"); ++} ++ ++void printDiskStatUsedInfo(const char* cmd) ++{ ++ fprintf(CurrentClient, "Used Blocks\t0\t-\tBlocks\n"); ++} ++ ++void printDiskStatFree(const char* cmd) ++{ ++ int i; ++ char *mntpnt = (char *)getMntPnt(cmd); ++ ++ for (i = 0; i < level_ctnr(DiskStatList); i++) { ++ DiskInfo* disk_info = get_ctnr(DiskStatList, i); ++ if (!strcmp(mntpnt, disk_info->mntpnt)) { ++ fprintf(CurrentClient, "%ld\n", disk_info->bfree); ++ } ++ } ++ ++ fprintf(CurrentClient, "\n"); ++} ++ ++void printDiskStatFreeInfo(const char* cmd) ++{ ++ fprintf(CurrentClient, "Free Blocks\t0\t-\tBlocks\n"); ++} ++ ++void printDiskStatPercent(const char* cmd) ++{ ++ int i; ++ char *mntpnt = (char *)getMntPnt(cmd); ++ ++ for (i = 0; i < level_ctnr(DiskStatList); i++) { ++ DiskInfo* disk_info = get_ctnr(DiskStatList, i); ++ if (!strcmp(mntpnt, disk_info->mntpnt)) { ++ fprintf(CurrentClient, "%d\n", disk_info->bused_percent); ++ } ++ } ++ ++ fprintf(CurrentClient, "\n"); ++} ++ ++void printDiskStatPercentInfo(const char* cmd) ++{ ++ fprintf(CurrentClient, "Used Blocks\t0\t100\t%%\n"); ++} |