diff options
author | Karel Zak | 2006-12-07 00:25:41 +0100 |
---|---|---|
committer | Karel Zak | 2006-12-07 00:25:41 +0100 |
commit | eb63b9b8f4cecb34c2478282567862bc48ef256d (patch) | |
tree | 99243f8eecb44c2bb6a559982b99c680fcb649e7 /sys-utils | |
parent | Imported from util-linux-2.9v tarball. (diff) | |
download | kernel-qcow2-util-linux-eb63b9b8f4cecb34c2478282567862bc48ef256d.tar.gz kernel-qcow2-util-linux-eb63b9b8f4cecb34c2478282567862bc48ef256d.tar.xz kernel-qcow2-util-linux-eb63b9b8f4cecb34c2478282567862bc48ef256d.zip |
Imported from util-linux-2.10f tarball.
Diffstat (limited to 'sys-utils')
-rw-r--r-- | sys-utils/Makefile | 9 | ||||
-rw-r--r-- | sys-utils/ipcs.c | 40 | ||||
-rw-r--r-- | sys-utils/readprofile.c | 17 | ||||
-rw-r--r-- | sys-utils/tunelp.c | 19 |
4 files changed, 59 insertions, 26 deletions
diff --git a/sys-utils/Makefile b/sys-utils/Makefile index 0109eb146..85173658a 100644 --- a/sys-utils/Makefile +++ b/sys-utils/Makefile @@ -11,9 +11,8 @@ include ../MCONFIG MAN1= arch.1 readprofile.1 MAN8= ctrlaltdel.8 cytune.8 dmesg.8 \ - ipcrm.8 ipcs.8 ramsize.8 renice.8 \ - rootflags.8 setsid.8 sln.8 swapdev.8 tunelp.8 \ - vidmode.8 + ipcrm.8 ipcs.8 renice.8 \ + setsid.8 sln.8 tunelp.8 # Where to put binaries? # See the "install" rule for the links. . . @@ -37,7 +36,7 @@ endif endif ifeq "$(CPU)" "intel" -MAN8:=$(MAN8) rdev.8 +MAN8:=$(MAN8) rdev.8 ramsize.8 rootflags.8 swapdev.8 vidmode.8 USRSBIN:=$(USRSBIN) rdev endif @@ -71,10 +70,12 @@ install: all $(INSTALLBIN) $(BIN) $(BINDIR) $(INSTALLBIN) $(USRBIN) $(USRBINDIR) $(INSTALLBIN) $(USRSBIN) $(USRSBINDIR) +ifeq "$(CPU)" "intel" (cd $(USRSBINDIR); ln -sf rdev swapdev) (cd $(USRSBINDIR); ln -sf rdev ramsize) (cd $(USRSBINDIR); ln -sf rdev vidmode) (cd $(USRSBINDIR); ln -sf rdev rootflags) +endif $(INSTALLDIR) $(MAN1DIR) $(MAN8DIR) $(INFODIR) $(INSTALLMAN) $(MAN1) $(MAN1DIR) $(INSTALLMAN) $(MAN8) $(MAN8DIR) diff --git a/sys-utils/ipcs.c b/sys-utils/ipcs.c index e628ce874..09dec45a0 100644 --- a/sys-utils/ipcs.c +++ b/sys-utils/ipcs.c @@ -28,11 +28,6 @@ #include <grp.h> #include "nls.h" -#include "../defines.h" /* for NEED_linkage_h */ -#ifdef NEED_linkage_h -#define __KERNEL__ /* required for SHM_DEST etc. */ -#include <linux/linkage.h> /* required for the keyword asmlinkage */ -#endif /* X/OPEN tells us to use <sys/{types,ipc,sem}.h> for semctl() */ /* X/OPEN tells us to use <sys/{types,ipc,msg}.h> for msgctl() */ /* X/OPEN tells us to use <sys/{types,ipc,shm}.h> for shmctl() */ @@ -41,9 +36,40 @@ #include <sys/sem.h> #include <sys/msg.h> #include <sys/shm.h> -#ifdef NEED_linkage_h -#undef __KERNEL__ + +/*-------------------------------------------------------------------*/ +/* SHM_DEST and SHM_LOCKED are defined in kernel headers, + but inside #ifdef __KERNEL__ ... #endif */ +#ifndef SHM_DEST +/* shm_mode upper byte flags */ +#define SHM_DEST 01000 /* segment will be destroyed on last detach */ +#define SHM_LOCKED 02000 /* segment will not be swapped */ +#endif + +/* For older kernels the same holds for the defines below */ +#ifndef MSG_STAT +#define MSG_STAT 11 +#define MSG_INFO 12 +#endif + +#ifndef SHM_STAT +#define SHM_STAT 13 +#define SHM_INFO 14 +struct shm_info { + int used_ids; + ulong shm_tot; /* total allocated shm */ + ulong shm_rss; /* total resident shm */ + ulong shm_swp; /* total swapped shm */ + ulong swap_attempts; + ulong swap_successes; +}; +#endif + +#ifndef SEM_STAT +#define SEM_STAT 18 +#define SEM_INFO 19 #endif +/*-------------------------------------------------------------------*/ /* The last arg of semctl is a union semun, but where is it defined? X/OPEN tells us to define it ourselves, but until recently diff --git a/sys-utils/readprofile.c b/sys-utils/readprofile.c index ba982f7c3..6a8d4d20f 100644 --- a/sys-utils/readprofile.c +++ b/sys-utils/readprofile.c @@ -21,6 +21,8 @@ /* * 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org> * - added Native Language Support + * 1999-09-01 Stephane Eranian <eranian@cello.hpl.hp.com> + * - 64bit clean patch */ #include <errno.h> @@ -79,9 +81,10 @@ FILE *pro; FILE *map; int proFd; char *mapFile, *proFile; -unsigned int len=0, add0=0, step, index=0; +unsigned long len=0, add0=0, index=0; +unsigned int step; unsigned int *buf, total, fn_len; -unsigned int fn_add, next_add; /* current and next address */ +unsigned long fn_add, next_add; /* current and next address */ char fn_name[S_LEN], next_name[S_LEN]; /* current and next name */ char mode[8]; int c; @@ -162,13 +165,13 @@ int popenMap; /* flag to tell if popen() has been used */ while(fgets(mapline,S_LEN,map)) { - if (sscanf(mapline,"%x %s %s",&fn_add,mode,fn_name)!=3) + if (sscanf(mapline,"%lx %s %s",&fn_add,mode,fn_name)!=3) { fprintf(stderr,_("%s: %s(%i): wrong map line\n"), prgname,mapFile, maplineno); exit(1); } - if (strcmp(fn_name,"_stext")) /* only elf works like this */ + if (!strcmp(fn_name,"_stext")) /* only elf works like this */ { add0=fn_add; break; @@ -188,12 +191,14 @@ int popenMap; /* flag to tell if popen() has been used */ { unsigned int this=0; - if (sscanf(mapline,"%x %s %s",&next_add,mode,next_name)!=3) + if (sscanf(mapline,"%lx %s %s",&next_add,mode,next_name)!=3) { fprintf(stderr,_("%s: %s(%i): wrong map line\n"), prgname,mapFile, maplineno); exit(1); } + /* ignore any LEADING (before a '[tT]' symbol is found) Absolute symbols */ + if (*mode == 'A' && total == 0) continue; if (*mode!='T' && *mode!='t') break; /* only text is profiled */ while (index < (next_add-add0)/step) @@ -204,7 +209,7 @@ int popenMap; /* flag to tell if popen() has been used */ if (fn_len && (this || optAll)) { if (optVerbose) - printf("%08x %-40s %6i %8.4f\n", + printf("%08lx %-40s %6i %8.4f\n", fn_add,fn_name,this,this/(double)fn_len); else printf("%6i %-40s %8.4f\n", diff --git a/sys-utils/tunelp.c b/sys-utils/tunelp.c index dfb30aa67..7292a0cad 100644 --- a/sys-utils/tunelp.c +++ b/sys-utils/tunelp.c @@ -61,7 +61,6 @@ #include <errno.h> #include "lp.h" #include "nls.h" -#include "../version.h" struct command { long op; @@ -70,8 +69,6 @@ struct command { }; - - void print_usage(char *progname) { printf(_("Usage: %s <device> [ -i <IRQ> | -t <TIME> | -c <CHARS> | -w <WAIT> | \n" " -a [on|off] | -o [on|off] | -C [on|off] | -q [on|off] | -s | \n" @@ -95,12 +92,12 @@ void *mylloc(long size) { return ptr; } - +static char *progname; long get_val(char *val) { long ret; if (!(sscanf(val, "%ld", &ret) == 1)) { - perror(_("sscanf error")); + fprintf(stderr, _("%s: bad value\n"), progname); exit(3); } return ret; @@ -113,16 +110,20 @@ long get_onoff(char *val) { return 0; } - - int main (int argc, char ** argv) { int c, fd, irq, status, show_irq, offset = 0, retval; - char *progname; - char *filename; + char *filename, *p; struct stat statbuf; struct command *cmds, *cmdst; progname = argv[0]; + if ((p = strrchr(progname, '/')) != NULL) + progname = p+1; + + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + if (argc < 2) print_usage(progname); cmdst = cmds = mylloc(sizeof(struct command)); |