Imported from util-linux-2.11b tarball.

This commit is contained in:
Karel Zak 2006-12-07 00:25:46 +01:00
parent 66ee8158b6
commit c07ebfa1e0
131 changed files with 5210 additions and 5769 deletions

38
HISTORY
View file

@ -1,3 +1,39 @@
util-linux 2.11b:
* Danish messages (Claus Hindsgaul)
* umount: mips does not support umount2 (Christoph Martin)
* fdisk: tiny fix
* mount.8: adfs options documented, xfs corrected
util-linux 2.11a:
* tsort: deleted - it is part of GNU textutils 2.0
* mount: fix rootdev() (Richard Kettlewell)
* mount: fix gid of mtab file
* mount: try /proc/filesystems after /etc/filesystems if the latter ends in "*"
* fdisk: added a few system types
util-linux 2.11:
* Jump to 2.11 to note that libc-4.5.26 is no longer supported,
and we require libc-4.6.27 (since now snprintf is used).
Also, kbdrate has now been removed. Find it in kbd-1.05.
Added -D_FILE_OFFSET_BITS=64 to CFLAGS.
* Danish messages (Claus Hindsgaul)
* fdisk: avoid loop in case of extended without logical
* ipcs: corrected interchanged report on msg_rtime/msg_stime (Arun Kumar U)
* kill: updated manpage
* last: very much faster with mmap (Marek Zelem)
* login: Applied PAM patch by David MacKenzie <djm@web.us.uu.net>
* login: do a setsid in the child (Erik Troan)
* mount: make "mount 192.168.1.8:/ /a -o bg" work again (Bjoern Voigt)
* mount: added constant MS_MOVE
* readprofile: added -M option, updated manpage (Andrew Morton)
* setsid: fork when it would fail otherwise (John Fremlin)
* simpleinit: updated (Richard Gooch et al.)
* vipw: also offer to edit shadow file (Erik Troan)
* xfs docs (Nathan Scott)
util-linux 2.10s:
* Danish messages (Claus Hindsgaul)
@ -275,7 +311,7 @@ util-linux 2.9n:
util-linux 2.9m:
* Added national language support (misiek@misiek.eu.org)
* Added national language support (misiek@pld.ORG.PL)
* minor improvements in mount, fdisk, cfdisk, agetty, more
util-linux 2.9l:

View file

@ -65,6 +65,13 @@ Warnings like
<asm/mman.h>:30: warning: this is the location of the previous definition
are caused by the libc/kernel combination.
Warnings like
setterm.c:805: warning: passing arg 1 of `tigetstr' discards qualifiers
from pointer target type
login.c:979: warning: passing arg 1 of `putenv' discards qualifiers
from pointer target type
are caused by bad ncurses or glibc header files.
All such warnings are harmless.
There should be no compilation errors.

View file

@ -80,10 +80,6 @@ HAVE_RESET=yes
# sln also comes with libc and glibc.
HAVE_SLN=no
# If HAVE_TSORT is set to "yes", then tsort won't be installed.
# GNU textutils 2.0 includes tsort.
HAVE_TSORT=no
# If HAVE_FDUTILS is set to "yes", then setfdprm won't be installed.
HAVE_FDUTILS=no
@ -168,6 +164,7 @@ INSTALLSUID= $(INSTALL) -m $(SUIDMODE) -o root
CFLAGS := $(CFLAGS) $(OPT) -I$(LIB) $(WARNFLAGS) \
$(CURSESFLAGS) $(SLANGFLAGS) \
-D_FILE_OFFSET_BITS=64 \
-DSBINDIR=\"$(SBINDIR)\" \
-DUSRSBINDIR=\"$(USRSBINDIR)\" \
-DLOGDIR=\"$(LOGDIR)\" \

View file

@ -19,8 +19,7 @@ SUBDIRS=po \
fdisk \
hwclock \
sys-utils \
text-utils \
kbd
text-utils
.PHONEY: all install clean now
all: defines.h

View file

@ -1 +1 @@
2.10s
2.11b

34
configure vendored
View file

@ -9,7 +9,7 @@
# H3. For kbd_rate.c: does <linux/kd.h> exist?
# H4. For nls.h: do we have <locale.h>?
# H5. For cal.c: do we have <langinfo.h>?
# H6. For mkswap.c: do we have <asm/page.h>?
# H6. For mkswap.c: do we have <sys/user.h> or <asm/page.h>?
# H7. For nfsmount.h (nfsmount_xdr.c: int32_t): do we have <asm/types.h>?
#
# Existence of functions:
@ -18,6 +18,7 @@
# F3. For agetty.c: is getdomainname() available?
# F4. For hwclock/kd.c: do we have nanosleep()?
# F5. For mkswap.c: do we have personality()?
# F6. For agetty.c: is updwtmp() available?
#
# 1. For sys-utils/cytune.c: do we need <linux/tqueue.h>?
# 2. For cfdisk, setterm, more, ul: do we have ncurses? How installed?
@ -114,11 +115,13 @@ if ./testincl "langinfo.h"; then
fi
#
# H6. For mkswap.c: do we have <asm/page.h>?
# H6. For mkswap.c: do we have <sys/user.h> or <asm/page.h>?
#
if ./testincl "asm/page.h"; then
if ./testincl "sys/user.h"; then
echo "#define HAVE_sys_user_h" >> defines.h
else if ./testincl "asm/page.h"; then
echo "#define HAVE_asm_page_h" >> defines.h
fi
fi fi
#
# H7. For nfsmount.h: do we have <asm/types.h>?
@ -234,6 +237,29 @@ else
fi
rm -f conftest conftest.c
#
# F6. For agetty.c: is updwtmp() available?
#
echo '
#include <string.h>
#include <utmp.h>
main(int a, char **v){
struct utmp ut;
memset (&ut, 0, sizeof(ut));
if (a == -1) /* false */
updwtmp("/nowhere/wtmp", &ut);
exit(0);
}
' > conftest.c
eval $compile
if test -s conftest && ./conftest 2>/dev/null; then
echo "#define HAVE_updwtmp" >> defines.h
echo "You have updwtmp()"
else
echo "You don't have updwtmp()"
fi
rm -f conftest conftest.c
#
# 1. cytune.c may need struct tq_struct

View file

@ -1,6 +1,6 @@
/* fdformat.c - Low-level formats a floppy disk - Werner Almesberger */
/* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
/* 1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
* 1999-03-20 Arnaldo Carvalho de Melo <acme@conectiva.com.br>
& - more i18n/nls translatable strings marked

View file

@ -62,7 +62,7 @@
* 06.11.96 - Added v2 code submitted by Joerg Dorchain, but written by
* Andreas Schwab.
*
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*
*
@ -211,10 +211,10 @@ die(const char *str) {
*/
static void
print_current_name(void) {
int i=0;
int i = 0;
while (i<name_depth)
printf("/%.*s",namelen,name_list[i++]);
while (i < name_depth)
printf("/%.*s", namelen, name_list[i++]);
if (i == 0)
printf ("/");
}
@ -978,7 +978,7 @@ check_file(struct minix_inode * dir, unsigned int offset) {
if (!inode)
return;
if (name_depth < MAX_DEPTH)
strncpy(name_list[name_depth],name,namelen);
strncpy(name_list[name_depth], name, namelen);
name_depth++;
if (list) {
if (verbose)

View file

@ -116,4 +116,5 @@ for the ext2 file system.
.BR mkfs.ext2 (8),
.BR mkfs.minix (8),
.BR mkfs.msdos (8),
.BR mkfs.xfs (8),
.BR mkfs.xiafs (8)

View file

@ -10,7 +10,7 @@
*
* Mon Jul 1 18:52:58 1996: janl@math.uio.no (Nicolai Langfeldt):
* Incorporated fix by Jonathan Kamens <jik@annex-1-slip-jik.cam.ov.com>
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*
*/
@ -92,7 +92,7 @@ int main(int argc, char *argv[])
}
sprintf(newpath, "%s:%s\n", SEARCH_PATH, oldpath);
putenv(newpath);
sprintf(progname, PROGNAME, fstype);
snprintf(progname, sizeof(progname), PROGNAME, fstype);
argv[--optind] = progname;
if (verbose) {

View file

@ -26,7 +26,7 @@
* V1_MAX_PAGES fixes, jj, 990325.
* sparc64 fixes, jj, 000219.
*
* 1999-02-22 Arkadiusz Mikiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Mikiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*
*/
@ -41,12 +41,16 @@
#include <sys/stat.h>
#include "nls.h"
/* Try to get PAGE_SIZE from libc or kernel includes */
#ifdef HAVE_sys_user_h
/* Note: <sys/user.h> says: for gdb only */
#include <sys/user.h> /* for PAGE_SIZE and PAGE_SHIFT */
#else
#ifdef HAVE_asm_page_h
#include <asm/page.h> /* for PAGE_SIZE and PAGE_SHIFT */
/* we also get PAGE_SIZE via getpagesize() */
/* recent glibc systems also define this in <sys/user.h> */
#endif
#endif
#ifndef _IO
/* pre-1.3.45 */

View file

@ -1,7 +1,7 @@
/* setfdprm.c - Sets user-provided floppy disk parameters, re-activates
autodetection and switches diagnostic messages. */
/* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
/* 1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*/

View file

@ -43,7 +43,7 @@ else
endif
endif
cfdisk: cfdisk.o llseek.o i386_sys_types.o
cfdisk: cfdisk.o llseek.o i386_sys_types.o $(LIB)/xstrncpy.o
ifeq "$(HAVE_SLANG)" "yes"
$(CC) $(LDFLAGS) $^ -o $@ $(LIBSLANG)
else

View file

@ -76,6 +76,7 @@
#include <linux/hdreg.h>
#include "nls.h"
#include "xstrncpy.h"
#include "common.h"
#if defined(__GNUC__) || defined(HAS_LONG_LONG)
@ -516,23 +517,26 @@ print_warning(char *s) {
static void
fatal(char *s, int ret) {
char *err = _("FATAL ERROR");
char *err1 = _("FATAL ERROR");
char *err2 = _("Press any key to exit cfdisk");
if (curses_started) {
char *str = xmalloc(strlen(s) + strlen(err) + 10);
/* snprintf does not compile on all libc's */
sprintf(str, "%s: %s", err, s);
char *str = xmalloc(strlen(s) + strlen(err1) + strlen(err2) + 10);
sprintf(str, "%s: %s", err1, s);
if (strlen(str) > COLS)
str[COLS] = 0;
str[COLS] = 0;
mvaddstr(WARNING_START, (COLS-strlen(str))/2, str);
sprintf(str, _("Press any key to exit cfdisk"));
sprintf(str, "%s", err2);
if (strlen(str) > COLS)
str[COLS] = 0;
mvaddstr(WARNING_START+1, (COLS-strlen(str))/2, str);
putchar(BELL); /* CTRL-G */
refresh();
(void)getch();
die_x(ret);
} else {
fprintf(stderr, "%s: %s\n", err, s);
fprintf(stderr, "%s: %s\n", err1, s);
exit(ret);
}
}
@ -1034,17 +1038,15 @@ menuUpdate( int y, int x, struct MenuItem *menuItems, int itemLength,
/* Print available buttons */
move( y, x ); clrtoeol();
for( i = 0; menuItems[i].key; i++ )
{
for( i = 0; menuItems[i].key; i++ ) {
char buff[20];
int lenName;
const char *mi;
/* Search next available button */
while( menuItems[i].key && !strchr(available, menuItems[i].key) )
{
i++;
}
if( !menuItems[i].key ) break; /* No more menu items */
/* If selected item is not available and we have bypassed it,
@ -1066,15 +1068,13 @@ menuUpdate( int y, int x, struct MenuItem *menuItems, int itemLength,
print_warning(_("Menu item too long. Menu may look odd."));
#endif
if (lenName >= sizeof(buff)) { /* truncate ridiculously long string */
strncpy( buff, mi, sizeof(buff)-1);
buff[sizeof(buff)-1] = 0;
} else
if( menuType & MENU_BUTTON )
sprintf( buff, "[%*s%-*s]", (itemLength - lenName) / 2, "",
(itemLength - lenName + 1) / 2 + lenName, mi );
else
sprintf( buff, "%*s%-*s", (itemLength - lenName) / 2, "",
(itemLength - lenName + 1) / 2 + lenName, mi );
xstrncpy( buff, mi, sizeof(buff));
} else {
snprintf(buff, sizeof(buff),
(menuType & MENU_BUTTON) ? "[%*s%-*s]" : "%*s%-*s",
(itemLength - lenName) / 2, "",
(itemLength - lenName + 1) / 2 + lenName, mi);
}
mvaddstr( y, x, buff );
/* Lowlight after selected item */
@ -1339,7 +1339,7 @@ new_part(int i) {
else
print_warning(_("!!! Internal error !!!"));
sprintf(def, "%.2f", num_sects/sectors_per_MB);
snprintf(def, sizeof(def), "%.2f", num_sects/sectors_per_MB);
mvaddstr(COMMAND_LINE_Y, COMMAND_LINE_X, _("Size (in MB): "));
if ((len = get_string(response, LINE_LENGTH, def)) <= 0 &&
len != GS_DEFAULT)
@ -1548,7 +1548,6 @@ fill_p_info(void) {
add_part(i, p->sys_ind, p->boot_ind,
((bs <= sectors) ? 0 : bs), bs + bsz - 1,
((bs <= sectors) ? bs : 0), 1, &errmsg)) {
/* avoid snprintf - it does not exist on ancient systems */
char *bad = _("Bad primary partition");
char *msg = (char *) xmalloc(strlen(bad) + strlen(errmsg) + 30);
sprintf(msg, "%s %d: %s", bad, i, errmsg);
@ -1579,7 +1578,6 @@ fill_p_info(void) {
logical_sectors[logical-1],
logical_sectors[logical-1] + bs + bsz - 1,
bs, 1, &errmsg)) {
/* avoid snprintf */
char *bad = _("Bad logical partition");
char *msg = (char *) xmalloc(strlen(bad) + strlen(errmsg) + 30);
sprintf(msg, "%s %d: %s", bad, i-1, errmsg);
@ -1751,8 +1749,10 @@ write_part_table(void) {
for (i = 0; i < num_parts; i++)
if (IS_PRIMARY(i) && p_info[i].flags == ACTIVE_FLAG)
ct++;
if (ct != 1)
print_warning(_("Not precisely one primary partition is bootable. DOS MBR cannot boot this."));
if (ct == 0)
print_warning(_("No primary partitions are marked bootable. DOS MBR cannot boot this."));
if (ct > 1)
print_warning(_("More than one primary partition is marked bootable. DOS MBR cannot boot this."));
}
static void
@ -1762,7 +1762,7 @@ fp_printf(FILE *fp, char *format, ...) {
int y, x;
va_start(args, format);
vsprintf(buf, format, args);
vsnprintf(buf, sizeof(buf), format, args);
va_end(args);
if (fp == NULL) {
@ -1818,7 +1818,8 @@ print_raw_table(void) {
if (to_file) {
if ((fp = fopen(fname, "w")) == NULL) {
char errstr[LINE_LENGTH];
sprintf(errstr, _("Cannot open file '%s'"), fname);
snprintf(errstr, sizeof(errstr),
_("Cannot open file '%s'"), fname);
print_warning(errstr);
return;
}

View file

@ -66,7 +66,7 @@ static void delete_partition(int i);
})
#define LINE_LENGTH 80
#define LINE_LENGTH 800
#define pt_offset(b, n) ((struct partition *)((b) + 0x1be + \
(n) * sizeof(struct partition)))
#define sector(s) ((s) & 0x3f)
@ -222,25 +222,31 @@ void fatal(enum failure why) {
" ...\n");
break;
case unable_to_open:
sprintf(error, _("Unable to open %s\n"), disk_device);
snprintf(error, sizeof(error),
_("Unable to open %s\n"), disk_device);
break;
case unable_to_read:
sprintf(error, _("Unable to read %s\n"), disk_device);
snprintf(error, sizeof(error),
_("Unable to read %s\n"), disk_device);
break;
case unable_to_seek:
sprintf(error, _("Unable to seek on %s\n"),disk_device);
snprintf(error, sizeof(error),
_("Unable to seek on %s\n"),disk_device);
break;
case unable_to_write:
sprintf(error, _("Unable to write %s\n"), disk_device);
snprintf(error, sizeof(error),
_("Unable to write %s\n"), disk_device);
break;
case ioctl_error:
sprintf(error, _("BLKGETSIZE ioctl failed on %s\n"),
snprintf(error, sizeof(error),
_("BLKGETSIZE ioctl failed on %s\n"),
disk_device);
break;
case out_of_memory:
message = _("Unable to allocate any more memory\n");
break;
default: message = _("Fatal error\n");
default:
message = _("Fatal error\n");
}
fputc('\n', stderr);
@ -282,7 +288,7 @@ read_pte(int fd, int pno, uint offset) {
pe->changed = 0;
pe->part_table = pe->ext_pointer = NULL;
}
static unsigned int
get_partition_start(struct pte *pe) {
return pe->offset + get_start_sect(pe->part_table);
@ -623,17 +629,18 @@ read_extended(int ext) {
for (i = 0; i < 4; i++, p++) if (get_nr_sects(p)) {
if (IS_EXTENDED (p->sys_ind)) {
if (pe->ext_pointer)
fprintf(stderr, _("Warning: extra link"
" pointer in partition table "
"%d\n"), partitions + 1);
fprintf(stderr,
_("Warning: extra link "
"pointer in partition table"
" %d\n"), partitions + 1);
else
pe->ext_pointer = p;
} else if (p->sys_ind) {
if (pe->part_table)
fprintf(stderr,
_("Warning: ignoring extra data "
"in partition table %d\n"),
partitions + 1);
_("Warning: ignoring extra "
"data in partition table"
" %d\n"), partitions + 1);
else
pe->part_table = p;
}
@ -662,7 +669,8 @@ read_extended(int ext) {
for (i = 4; i < partitions; i++) {
struct pte *pe = &ptes[i];
if (!get_nr_sects(pe->part_table)) {
if (!get_nr_sects(pe->part_table) &&
(partitions > 5 || ptes[4].part_table->sys_ind)) {
printf("omitting empty partition (%d)\n", i+1);
delete_partition(i);
goto remove; /* numbering changed */
@ -682,10 +690,10 @@ create_doslabel(void) {
sun_nolabel(); /* otherwise always recognised as sun */
sgi_nolabel(); /* otherwise always recognised as sgi */
for (i = 510-64; i < 510; i++)
MBRbuffer[i] = 0;
write_part_table_flag(MBRbuffer);
for (i = 0; i < 4; i++)
if (ptes[i].part_table)
clear_partition(ptes[i].part_table);
extended_offset = 0;
set_all_unchanged();
set_changed(0);
get_boot(create_empty);
@ -969,8 +977,8 @@ read_int(uint low, uint dflt, uint high, uint base, char *mesg)
static char *ms = NULL;
static int mslen = 0;
if (!ms || strlen(mesg)+50 > mslen) {
mslen = strlen(mesg)+100;
if (!ms || strlen(mesg)+100 > mslen) {
mslen = strlen(mesg)+200;
if (!(ms = realloc(ms,mslen)))
fatal(out_of_memory);
}
@ -979,9 +987,11 @@ read_int(uint low, uint dflt, uint high, uint base, char *mesg)
default_ok = 0;
if (default_ok)
sprintf(ms, _("%s (%d-%d, default %d): "), mesg, low, high, dflt);
snprintf(ms, mslen, _("%s (%d-%d, default %d): "),
mesg, low, high, dflt);
else
sprintf(ms, "%s (%d-%d): ", mesg, low, high);
snprintf(ms, mslen, "%s (%d-%d): ",
mesg, low, high);
while (1) {
int use_default = default_ok;
@ -1137,12 +1147,15 @@ delete_partition(int i) {
}
if (!q->sys_ind && i > 4) {
/* the last one in the chain - just delete */
--partitions;
--i;
clear_partition(ptes[i].ext_pointer);
ptes[i].changed = 1;
} else {
/* not the last one - further ones will be moved down */
if (i > 4) {
/* delete this link in the chain */
p = ptes[i-1].ext_pointer;
p->boot_ind = 0;
p->head = q->head;
@ -1156,6 +1169,7 @@ delete_partition(int i) {
set_nr_sects(p, get_nr_sects(q));
ptes[i-1].changed = 1;
} else if (partitions > 5) { /* 5 will be moved to 4 */
/* the first logical in a longer chain */
struct pte *pe = &ptes[5];
if(pe->part_table) /* prevent SEGFAULT */
@ -1173,6 +1187,7 @@ delete_partition(int i) {
i++;
}
} else
/* the only logical: clear only */
clear_partition(ptes[i].part_table);
}
}
@ -1185,12 +1200,12 @@ change_sysid(void) {
origsys = sys = get_sysid(i);
if (!sys && !sgi_label)
if (!sys && !sgi_label && !sun_label)
printf(_("Partition %d does not exist yet!\n"), i + 1);
else while (1) {
sys = read_hex (get_sys_types());
if (!sys && !sgi_label) {
if (!sys && !sgi_label && !sun_label) {
printf(_("Type 0 means free space to many systems\n"
"(but not to Linux). Having partitions of\n"
"type 0 is probably unwise. You can delete\n"
@ -1460,7 +1475,7 @@ list_table(int xtra) {
check_consistency(p, i);
}
}
/* Is partition table in disk order? It need not be, but... */
/* partition table entries are not checked for correct order if this
is a sgi, sun or aix labeled disk... */
@ -1543,7 +1558,7 @@ verify(void) {
int i, j;
uint total = 1;
uint first[partitions], last[partitions];
struct partition *p = part_table[0];
struct partition *p;
if (warn_geometry())
return;
@ -1642,7 +1657,7 @@ add_partition(int n, int sys) {
for (i = 0; i < partitions; i++)
first[i] = (cround(first[i]) - 1) * units_per_sector;
sprintf(mesg, _("First %s"), str_units(SINGULAR));
snprintf(mesg, sizeof(mesg), _("First %s"), str_units(SINGULAR));
do {
temp = start;
for (i = 0; i < partitions; i++) {
@ -1701,8 +1716,9 @@ add_partition(int n, int sys) {
if (cround(start) == cround(limit)) {
stop = limit;
} else {
sprintf(mesg, _("Last %s or +size or +sizeM or +sizeK"),
str_units(SINGULAR));
snprintf(mesg, sizeof(mesg),
_("Last %s or +size or +sizeM or +sizeK"),
str_units(SINGULAR));
stop = read_int(cround(start), cround(limit), cround(limit),
cround(start), mesg);
if (display_in_cyl_units) {
@ -1785,16 +1801,17 @@ new_partition(void) {
add_logical();
else
printf(_("You must delete some partition and add "
"an extended partition first\n"));
"an extended partition first\n"));
} else {
char c, line[LINE_LENGTH];
sprintf(line, _("Command action\n %s\n p primary "
"partition (1-4)\n"), extended_offset ?
_("l logical (5 or over)") : _("e extended"));
while (1)
snprintf(line, sizeof(line),
_("Command action\n %s\n p primary "
"partition (1-4)\n"), extended_offset ?
_("l logical (5 or over)") : _("e extended"));
while (1) {
if ((c = tolower(read_char(line))) == 'p') {
add_partition(get_partition(0, 4),
LINUX_NATIVE);
LINUX_NATIVE);
return;
}
else if (c == 'l' && extended_offset) {
@ -1803,13 +1820,13 @@ new_partition(void) {
}
else if (c == 'e' && !extended_offset) {
add_partition(get_partition(0, 4),
EXTENDED);
EXTENDED);
return;
}
else
printf(_("Invalid partition number "
"for type `%c'\n"), c);
"for type `%c'\n"), c);
}
}
}
@ -2052,7 +2069,7 @@ is_ide_cdrom(char *device) {
if (strncmp("/dev/hd", device, 7))
return 0;
sprintf(buf, "/proc/ide/%s/media", device+5);
snprintf(buf, sizeof(buf), "/proc/ide/%s/media", device+5);
procf = fopen(buf, "r");
if (procf != NULL && fgets(buf, sizeof(buf), procf))
return !strncmp(buf, "cdrom", 5);
@ -2068,34 +2085,34 @@ is_ide_cdrom(char *device) {
static void
try(char *device, int user_specified) {
disk_device = device;
if (!setjmp(listingbuf)) {
if (!user_specified)
if (is_ide_cdrom(device))
if (setjmp(listingbuf))
return;
if (!user_specified)
if (is_ide_cdrom(device))
return;
if ((fd = open(disk_device, type_open)) >= 0) {
if (get_boot(try_only) < 0) {
list_disk_geometry();
if (aix_label)
return;
if ((fd = open(disk_device, type_open)) >= 0) {
if (get_boot(try_only) < 0) {
list_disk_geometry();
if (aix_label)
return;
if (btrydev(device) < 0)
fprintf(stderr,
_("Disk %s doesn't contain a valid "
"partition table\n"), device);
close(fd);
} else {
close(fd);
list_table(0);
if (!sun_label && partitions > 4)
delete_partition(ext_index);
}
if (btrydev(device) < 0)
fprintf(stderr,
_("Disk %s doesn't contain a valid "
"partition table\n"), device);
close(fd);
} else {
/* Ignore other errors, since we try IDE
and SCSI hard disks which may not be
installed on the system. */
if(errno == EACCES) {
fprintf(stderr, _("Cannot open %s\n"), device);
return;
}
close(fd);
list_table(0);
if (!sun_label && partitions > 4)
delete_partition(ext_index);
}
} else {
/* Ignore other errors, since we try IDE
and SCSI hard disks which may not be
installed on the system. */
if(errno == EACCES) {
fprintf(stderr, _("Cannot open %s\n"), device);
return;
}
}
}
@ -2115,13 +2132,13 @@ tryprocpt(void) {
}
while (fgets(line, sizeof(line), procpt)) {
if (sscanf (line, " %d %d %d %[^\n]\n",
if (sscanf (line, " %d %d %d %[^\n ]",
&ma, &mi, &sz, ptname) != 4)
continue;
for(s = ptname; *s; s++);
if (isdigit(s[-1]))
continue;
sprintf(devname, "/dev/%s", ptname);
snprintf(devname, sizeof(devname), "/dev/%s", ptname);
try(devname, 0);
}
}

View file

@ -15,6 +15,8 @@
#define LINUX_SWAP 0x82
#define LINUX_NATIVE 0x83
#define LINUX_EXTENDED 0x85
#define LINUX_LVM 0x8e
#define LINUX_RAID 0xfd
#define IS_EXTENDED(i) \
((i) == EXTENDED || (i) == WIN98_EXTENDED || (i) == LINUX_EXTENDED)
@ -67,7 +69,6 @@ extern int fd,
extern uint display_in_cyl_units,
units_per_sector;
extern void change_units(void);
extern struct partition *part_table[];
extern void fatal(enum failure why);
extern void get_geometry(int fd, struct geom *);
extern int get_boot(enum action what);

View file

@ -273,14 +273,14 @@ xbsd_new_part (void)
end = xbsd_dlabel.d_secperunit - 1;
#endif
sprintf (mesg, _("First %s"), str_units(SINGULAR));
snprintf (mesg, sizeof(mesg), _("First %s"), str_units(SINGULAR));
begin = read_int (bsd_cround (begin), bsd_cround (begin), bsd_cround (end),
0, mesg);
if (display_in_cyl_units)
begin = (begin - 1) * xbsd_dlabel.d_secpercyl;
sprintf (mesg, _("Last %s or +size or +sizeM or +sizeK"),
snprintf (mesg, sizeof(mesg), _("Last %s or +size or +sizeM or +sizeK"),
str_units(SINGULAR));
end = read_int (bsd_cround (begin), bsd_cround (end), bsd_cround (end),
bsd_cround (begin), mesg);
@ -517,13 +517,13 @@ xbsd_write_bootstrap (void)
else
dkbasename = "wd";
printf (_("Bootstrap: %sboot -> boot%s (%s): "), dkbasename, dkbasename, dkbasename);
if (read_line ())
{
printf (_("Bootstrap: %sboot -> boot%s (%s): "),
dkbasename, dkbasename, dkbasename);
if (read_line ()) {
line_ptr[strlen (line_ptr)-1] = '\0';
dkbasename = line_ptr;
}
sprintf (path, "%s/%sboot", bootdir, dkbasename);
snprintf (path, sizeof(path), "%s/%sboot", bootdir, dkbasename);
if (!xbsd_get_bootstrap (path, disklabelbuffer, (int) xbsd_dlabel.d_secsize))
return;
@ -534,15 +534,14 @@ xbsd_write_bootstrap (void)
/* The disklabel will be overwritten by 0's from bootxx anyway */
bzero (d, sizeof (struct xbsd_disklabel));
sprintf (path, "%s/boot%s", bootdir, dkbasename);
snprintf (path, sizeof(path), "%s/boot%s", bootdir, dkbasename);
if (!xbsd_get_bootstrap (path, &disklabelbuffer[xbsd_dlabel.d_secsize],
(int) xbsd_dlabel.d_bbsize - xbsd_dlabel.d_secsize))
return;
e = d + sizeof (struct xbsd_disklabel);
for (p=d; p < e; p++)
if (*p)
{
if (*p) {
fprintf (stderr, _("Bootstrap overlaps with disk label!\n"));
exit ( EXIT_FAILURE );
}
@ -588,7 +587,7 @@ xbsd_get_part_index (int max)
char prompt[256];
char l;
sprintf (prompt, _("Partition (a-%c): "), 'a' + max - 1);
snprintf (prompt, sizeof(prompt), _("Partition (a-%c): "), 'a' + max - 1);
do
l = tolower (read_char (prompt));
while (l < 'a' || l > 'a' + max - 1);

View file

@ -76,23 +76,25 @@ isinfreelist( int b ) {
* end of free blocks section
*/
struct systypes sgi_sys_types[] = {
{SGI_VOLHDR, N_("SGI volhdr")},
{0x01, N_("SGI trkrepl")},
{0x02, N_("SGI secrepl")},
{SGI_SWAP, N_("SGI raw")},
{0x04, N_("SGI bsd")},
{0x05, N_("SGI sysv")},
{ENTIRE_DISK, N_("SGI volume")},
{SGI_EFS, N_("SGI efs")},
{0x08, N_("SGI lvol")},
{0x09, N_("SGI rlvol")},
{0x0a, N_("SGI xfs")},
{0x0b, N_("SGI xlvol")},
{0x0c, N_("SGI rxlvol")},
{LINUX_SWAP, N_("Linux swap")},
{LINUX_NATIVE,N_("Linux native")},
{0x8e, N_("Linux LVM")},
{0, NULL }
{SGI_VOLHDR, N_("SGI volhdr")},
{0x01, N_("SGI trkrepl")},
{0x02, N_("SGI secrepl")},
{SGI_SWAP, N_("SGI raw")},
{0x04, N_("SGI bsd")},
{0x05, N_("SGI sysv")},
{ENTIRE_DISK, N_("SGI volume")},
{SGI_EFS, N_("SGI efs")},
{0x08, N_("SGI lvol")},
{0x09, N_("SGI rlvol")},
{SGI_XFS, N_("SGI xfs")},
{SGI_XFSLOG, N_("SGI xfslog")},
{SGI_XLV, N_("SGI xlv")},
{SGI_XVM, N_("SGI xvm")},
{LINUX_SWAP, N_("Linux swap")},
{LINUX_NATIVE, N_("Linux native")},
{LINUX_LVM, N_("Linux LVM")},
{LINUX_RAID, N_("Linux RAID")},
{0, NULL }
};
static inline unsigned short
@ -357,7 +359,7 @@ create_sgiinfo(void)
/* I keep SGI's habit to write the sgilabel to the second block */
sgilabel->directory[0].vol_file_start = SSWAP32( 2 );
sgilabel->directory[0].vol_file_size = SSWAP32( sizeof( sgiinfo ) );
strncpy( sgilabel->directory[0].vol_file_name, "sgilabel",8 );
strncpy( sgilabel->directory[0].vol_file_name, "sgilabel", 8 );
}
sgiinfo * fill_sgiinfo(void);
@ -681,7 +683,7 @@ sgi_add_partition( int n, int sys )
printf(_("You got a partition overlap on the disk. Fix it first!\n"));
return;
}
sprintf(mesg, _("First %s"), str_units(SINGULAR));
snprintf(mesg, sizeof(mesg), _("First %s"), str_units(SINGULAR));
for(;;) {
if(sys == SGI_VOLUME) {
last = sgi_get_lastblock();
@ -708,7 +710,7 @@ sgi_add_partition( int n, int sys )
} else
break;
}
sprintf(mesg, _(" Last %s"), str_units(SINGULAR));
snprintf(mesg, sizeof(mesg), _(" Last %s"), str_units(SINGULAR));
last = read_int(scround(first), scround(last)-1, scround(last)-1,
scround(first), mesg)+1;
if (display_in_cyl_units)
@ -768,8 +770,12 @@ create_sgilabel(void)
memset(MBRbuffer, 0, sizeof(MBRbuffer));
sgilabel->magic = SSWAP32(SGI_LABEL_MAGIC);
sgilabel->boot_part = SSWAP16(0);
sgilabel->swap_part = SSWAP16(1); strncpy(
sgilabel->boot_file , "/unix\0\0\0\0\0\0\0\0\0\0\0", 16 );
sgilabel->swap_part = SSWAP16(1);
/* sizeof(sgilabel->boot_file) = 16 > 6 */
memset(sgilabel->boot_file, 0, 16);
strcpy(sgilabel->boot_file, "/unix");
sgilabel->devparam.skew = (0);
sgilabel->devparam.gap1 = (0);
sgilabel->devparam.gap2 = (0);

View file

@ -31,10 +31,18 @@ struct device_parameter { /* 48 bytes */
unsigned short xylogics_writecont;
};
#define SGI_VOLHDR 0x00
/* 1 and 2 were used for drive types no longer supported by SGI */
#define SGI_SWAP 0x03
/* 4 and 5 were for filesystem types SGI haven't ever supported on MIPS CPUs */
#define SGI_VOLUME 0x06
#define SGI_EFS 0x07
#define SGI_SWAP 0x03
#define SGI_VOLHDR 0x00
#define SGI_LVOL 0x08
#define SGI_RLVOL 0x09
#define SGI_XFS 0x0a
#define SGI_XFSLOG 0x0b
#define SGI_XLV 0x0c
#define SGI_XVM 0x0d
#define ENTIRE_DISK SGI_VOLUME
/*
* controller flags
@ -48,19 +56,19 @@ struct device_parameter { /* 48 bytes */
#define ENABLE_CMDTAGQ 0x40
typedef struct {
unsigned int magic; /* expect SGI_LABEL_MAGIC */
unsigned int magic; /* expect SGI_LABEL_MAGIC */
unsigned short boot_part; /* active boot partition */
unsigned short swap_part; /* active swap partition */
unsigned char boot_file[16]; /* name of the bootfile */
struct device_parameter devparam; /* 1 * 48 bytes */
struct volume_directory { /* 15 * 16 bytes */
unsigned char vol_file_name[8]; /* an character array */
unsigned char vol_file_name[8]; /* a character array */
unsigned int vol_file_start; /* number of logical block */
unsigned int vol_file_size; /* number of bytes */
} directory[15];
struct sgi_partition { /* 16 * 12 bytes */
unsigned int num_sectors; /* number of blocks */
unsigned int start_sector; /* sector must be cylinder aligned */
unsigned int start_sector; /* must be cylinder aligned */
unsigned int id;
} partitions[16];
unsigned int csum;

View file

@ -348,10 +348,11 @@ void create_sunlabel(void)
puts(_("You may change all the disk params from the x menu"));
}
sprintf(sunlabel->info, "%s%s%s cyl %d alt %d hd %d sec %d",
p ? p->vendor : "",
(p && *p->vendor) ? " " : "",
p ? p->model : (floppy ? _("3,5\" floppy") : _("Linux custom")),
snprintf(sunlabel->info, sizeof(sunlabel->info),
"%s%s%s cyl %d alt %d hd %d sec %d",
p ? p->vendor : "", (p && *p->vendor) ? " " : "",
p ? p->model
: (floppy ? _("3,5\" floppy") : _("Linux custom")),
cylinders, SSWAP16(sunlabel->nacyl), heads, sectors);
sunlabel->ntrks = SSWAP16(heads);
@ -514,7 +515,7 @@ add_sun_partition(int n, int sys) {
return;
}
}
sprintf(mesg, _("First %s"), str_units(SINGULAR));
snprintf(mesg, sizeof(mesg), _("First %s"), str_units(SINGULAR));
for (;;) {
if (whole_disk)
first = read_int(0, 0, 0, 0, mesg);
@ -549,7 +550,9 @@ and is of type `Whole disk'\n");
if (starts[i] > first && starts[i] < stop)
stop = starts[i];
}
sprintf(mesg, _("Last %s or +size or +sizeM or +sizeK"), str_units(SINGULAR));
snprintf(mesg, sizeof(mesg),
_("Last %s or +size or +sizeM or +sizeK"),
str_units(SINGULAR));
if (whole_disk)
last = read_int(scround(stop2), scround(stop2), scround(stop2),
0, mesg);

View file

@ -76,12 +76,15 @@ struct systypes i386_sys_types[] = {
{0xda, N_("Non-FS data")},
{0xdb, N_("CP/M / CTOS / ...")},/* CP/M or Concurrent CP/M or
Concurrent DOS or CTOS */
{0xde, N_("Dell Utility")}, /* Dell PowerEdge Server utilities */
{0xe1, N_("DOS access")}, /* DOS access or SpeedStor 12-bit FAT
extended partition */
{0xe3, N_("DOS R/O")}, /* DOS R/O or SpeedStor */
{0xe4, N_("SpeedStor")}, /* SpeedStor 16-bit FAT extended
partition < 1024 cyl. */
{0xeb, N_("BeOS fs")},
{0xee, N_("EFI GPT")}, /* Intel EFI GUID Partition Table */
{0xef, N_("EFI (FAT-12/16/32)")},/* Intel EFI System Partition */
{0xf1, N_("SpeedStor")},
{0xf4, N_("SpeedStor")}, /* SpeedStor large partition */
{0xf2, N_("DOS secondary")}, /* DOS 3.3+ secondary */

View file

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*/

View file

@ -1,5 +1,5 @@
20000630: Ported the Native Language Support patches from util-linux
They are written by Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
They are written by Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
20000627: Bumped up version number to 1.0.6
20000627: A few manpage tweaks
20000616: Introduced DESTDIR and directory creation in the Makefile.

View file

@ -34,7 +34,7 @@
* No important changes
* Version 1.1.0: Tue Jun 30 2000
* Added NLS support (partly written by Arkadiusz Mi<B6>kiewicz
* <misiek@misiek.eu.org>)
* <misiek@pld.ORG.PL>)
*/
#include <stdio.h>

View file

@ -241,7 +241,7 @@ main (int argc, char **argv )
/* If we are in MkLinux do not even bother trying to set the clock */
if(!access("/proc/osfmach3/version", R_OK))
{ // We're running MkLinux
{ /* We're running MkLinux */
if ( readit | writeit | setit | adjustit )
printf("You must change the clock setting in MacOS.\n");
exit(0);

View file

@ -61,10 +61,17 @@ int inb(int c){ return 0; }
#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
/* The epoch.
Unix uses 1900 as epoch for a struct tm, and 1970 for a time_t.
But what was written to CMOS?
Digital DECstations use 1928 - this is on a mips
Digital Unix uses 1952.
Windows NT uses 1980.
The ARC console expects to boot Windows NT and uses 1980.
(But a Ruffian uses 1900, just like SRM.)
It is reported that ALPHA_PRE_V1_2_SRM_CONSOLE uses 1958. */
#define TM_EPOCH 1900
int cmos_epoch = 1900; /* 1980 for an alpha in ARC console time */
/* One also sees 1952 (Digital Unix)
and 1958 (ALPHA_PRE_V1_2_SRM_CONSOLE) */
int cmos_epoch = 1900;
/* Martin Ostermann writes:
The problem with the Jensen is twofold: First, it has the clock at a
@ -576,7 +583,7 @@ get_permissions_cmos(void) {
} else {
rc = i386_iopl(3);
if (rc == -2) {
fprintf(stderr, _("I failed to get permission because I didnt try.\n"));
fprintf(stderr, _("I failed to get permission because I didn't try.\n"));
} else if (rc != 0) {
rc = errno;
fprintf(stderr, _("%s is unable to get I/O port access: "

View file

@ -53,7 +53,7 @@ what function to perform:
.TP
.B \-\-show
Read the Hardware Clock and print the time on Standard Output.
The time is always in local time, even if you keep your Hardware Clock
The time shown is always in local time, even if you keep your Hardware Clock
in Coordinated Universal Time. See the
.B \-\-utc
option.
@ -130,9 +130,12 @@ option.
.B \-\-epoch=year
Specifies the year which is the beginning of the Hardware Clock's
epoch. I.e. the number of years into AD to which a zero value in the
Hardware Clock's year counter refers.
Hardware Clock's year counter refers. It is used together with
the \-\-setepoch option to set the kernel's idea of the epoch of the
Hardware Clock, or otherwise to specify the epoch for use with
direct ISA access.
For example,
For example, on a Digital Unix machine:
.sp
.I hwclock --setepoch --epoch=1952
@ -226,48 +229,37 @@ whenever it finds your Hardware Clock set to 1994 or 1995.
.TP
.B \-\-srm
This option is equivalent to
.B \-\-epoch=1900
and is used to specify the most common epoch on Alphas
with SRM console.
.TP
.B \-\-arc
This option is equivalent to
.B \-\-epoch=1980
and is used to specify the most common epoch on Alphas
with ARC console (but Ruffians have epoch 1900).
.TP
.B \-\-jensen
.TP
.B \-\-funky\-toy
These options all tell
.B hwclock
what kind of Alpha machine you have. They
are invalid if you don't have an Alpha and shouldn't be necessary if you
do, because
These two options specify what kind of Alpha machine you have. They
are invalid if you don't have an Alpha and are usually unnecessary
if you do, because
.B hwclock
should be able to determine by itself what it's
running on, at least when
.I /proc
is mounted. These options make it possible for
is mounted.
(If you find you need one of these options to make
.B hwclock
to work even when
its environment does not conform to its expectations and thus it cannot
accurately determine what sort of system it is running on. If you think
hwclock is incorrectly determining the system's characteristics, try
running with the
.B \-\-debug
option to see what conclusions the program is
reaching and how. If you find you need one of these options to make
.B hwclock
work, contact the
.B hwclock
maintainer to see if the program can be improved to detect your system
automatically.
work, contact the maintainer to see if the program can be improved
to detect your system automatically. Output of `hwclock --debug'
and `cat /proc/cpuinfo' may be of interest.)
.B \-\-jensen
means you are running on a Jensen model.
.B \-\-arc
means your machine uses epoch 1980 in its hardware clock, as is commonly
the case for machines on ARC console (but Ruffians have epoch 1900).
.B \-\-srm
means your machine uses epoch 1900 in its hardware clock, as is commonly
the case for machines on SRM console.
.B \-\-funky\-toy
means that on your machine, one has to use the UF bit instead
of the UIP bit in the Hardware Clock to detect a time transition. "Toy"

View file

@ -124,7 +124,7 @@ set_hardware_clock_kd(const struct tm *new_broken_time) {
t.wday = new_broken_time->tm_wday;
if (ioctl(con_fd, KDSHWCLK, &t ) == -1) {
outsyserr(_("ioctl() to open /dev/tty1 failed"));
outsyserr(_("ioctl KDSHWCLK failed"));
exit(1);
}
return 0;

View file

@ -290,7 +290,7 @@ get_permissions_rtc(void) {
}
static struct clock_ops rtc = {
"/dev/rtc interface to clock",
RTC_DEV " interface to clock",
get_permissions_rtc,
read_hardware_clock_rtc,
set_hardware_clock_rtc,

View file

@ -1,25 +0,0 @@
# Makefile -- Makefile for util-linux Linux utilities
#
include ../make_include
include ../MCONFIG
# Where to put man pages?
MAN8= kbdrate.8
# Where to put binaries?
# See the "install" rule for the links. . .
SBIN= kbdrate
all: $(SBIN)
kbdrate: kbdrate.o
install: all
$(INSTALLDIR) $(SBINDIR) $(MAN8DIR)
$(INSTALLBIN) $(SBIN) $(SBINDIR)
$(INSTALLMAN) $(MAN8) $(MAN8DIR)
clean:
-rm -f *.o *~ core $(SBIN)

View file

@ -1,2 +0,0 @@
This stuff belongs in the kbd package and will disappear here.
It is left for a while - version in kbd* and here will be identical.

View file

@ -1,71 +0,0 @@
.\" Copyright 1992, 1994 Rickard E. Faith (faith@cs.unc.edu)
.\" May be distributed under the GNU General Public License
.\" Updated Wed Jun 22 21:09:43 1994, faith@cs.unc.edu
.\"
.TH KBDRATE 8 "22 June 1994" "Linux 1.1.19" "Linux Programmer's Manual"
.SH NAME
kbdrate \- reset the keyboard repeat rate and delay time
.SH SYNOPSIS
.B "kbdrate [ \-s ] [ \-r"
rate
.B "] [ \-d"
delay
.B ]
.SH DESCRIPTION
.B kbdrate
is used to change the keyboard repeat rate and delay time. The delay
is the amount of time that a key must be depressed before it will start to
repeat.
Using
.B kbdrate
without any options will reset the repeat rate to 10.9 characters per second (cps)
and the delay to 250 milliseconds (ms) for Intel- and M68K-based systems.
These are the IBM defaults. On SPARC-based systems it will reset the repeat rate
to 5 cps and the delay to 200 ms.
.SH OPTIONS
.TP
.B \-s
Silent. No messages are printed.
.TP
.BI \-r " rate"
Change the keyboard repeat rate to
.I rate
cps. For Intel-based systems, the allowable range is from 2.0 to 30.0 cps.
Only certain, specific values are possible, and the program will select the
nearest possible value to the one specified. The possible values are given,
in characters per second, as follows: 2.0, 2.1, 2.3, 2.5, 2.7, 3.0, 3.3, 3.7,
4.0, 4.3, 4.6, 5.0, 5.5, 6.0, 6.7, 7.5, 8.0, 8.6, 9.2, 10.0, 10.9, 12.0, 13.3,
15.0, 16.0, 17.1, 18.5, 20.0, 21.8, 24.0, 26.7, 30.0.
For SPARC-based systems, the allowable range is from 0 (no repeat) to 50 cps.
.TP
.BI \-d " delay"
Change the delay to
.I delay
milliseconds.
For Intel-based systems, the allowable range is from 250 to 1000 ms,
in 250 ms steps. For SPARC systems, possible values are between 10 ms and 1440 ms,
in 10 ms steps.
.TP
.B \-V
Display a version number and exit.
.SH BUGS
Not all keyboards support all rates.
.PP
Not all keyboards have the rates mapped in the same way.
.PP
Setting the repeat rate on the Gateway AnyKey keyboard does not work. If
someone with a Gateway figures out how to program the keyboard, please send
mail to util-linux@math.uio.no.
.PP
All this is very architecture dependent.
Nowadays
.B kbdrate
first tries the KDKBDREP and KIOCSRATE ioctls.
(The former usually works on an m68k machine, the latter for SPARC.)
When these ioctls fail an ioport interface as on i386 is assumed.
.SH FILES
.I /etc/rc.local
.br
.I /dev/port

View file

@ -1,282 +0,0 @@
/*
From: faith@cs.unc.edu (Rik Faith)
Subject: User mode keyboard rate changer
Date: 27 Apr 92 13:44:26 GMT
I put together this program, called kbdrate.c, which will reset the keyboard
repeat rate and delay in user mode. The program must have read/write
access to /dev/port, so if /dev/port is only read/writeable by group port,
then kbdrate must run setgid to group port (for example).
The "rate" is the rate in characters per second
The "delay" is the amount of time the key must remain depressed before it
will start to repeat.
Usage examples:
kbdrate set rate to IBM default (10.9 cps, 250ms delay)
kbdrate -r 30.0 set rate to 30 cps and delay to 250ms
kbdrate -r 20.0 -s set rate to 20 cps (delay 250ms) -- don't print message
kbdrate -r 0 -d 0 set rate to 2.0 cps and delay to 250 ms
I find it useful to put kbdrate in my /etc/rc file so that the keyboard
rate is set to something that I find comfortable at boot time. This sure
beats rebuilding the kernel!
kbdrate.c -- Set keyboard typematic rate (and delay)
Created: Thu Apr 23 12:24:30 1992
Author: Rickard E. Faith, faith@cs.unc.edu
Copyright 1992 Rickard E. Faith. Distributed under the GPL.
This program comes with ABSOLUTELY NO WARRANTY.
Usage: kbdrate [-r rate] [-d delay] [-s]
Rate can range from 2.0 to 30.0 (units are characters per second)
Delay can range from 250 to 1000 (units are milliseconds)
-s suppressed message
Compiles under gcc 2.1 for Linux (tested with the pre-0.96 kernel)
Wed Jun 22 21:35:43 1994, faith@cs.unc.edu:
Changed valid_rates per suggestion by Andries.Brouwer@cwi.nl.
Wed Jun 22 22:18:29 1994, faith@cs.unc.edu:
Added patch for AUSTIN notebooks from John Bowman
(bowman@hagar.ph.utexas.edu)
Linux/68k modifications by Roman Hodek
(Roman.Hodek@informatik.uni-erlangen.de):
Reading/writing the Intel I/O ports via /dev/port is not the
English way... Such hardware dependant stuff can never work on
other architectures.
Linux/68k has an new ioctl for setting the keyboard repeat rate
and delay. Both values are counted in msecs, the kernel will do
any rounding to values possible with the underlying hardware.
kbdrate now first tries if the KDKBDREP ioctl is available. If it
is, it is used, else the old method is applied.
1999-02-22 Arkadiusz Mikiewicz <misiek@misiek.eu.org>
- added Native Language Support
1999-03-17
Linux/SPARC modifications by Jeffrey Connell <ankh@canuck.gen.nz>:
It seems that the KDKBDREP ioctl is not available on this platform.
However, Linux/SPARC has its own ioctl for this, with yet another
different measurement system. Thus, try for KIOCSRATE, too.
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include "../defines.h"
#ifdef HAVE_kd_h
#include <linux/kd.h>
#endif
#ifdef __sparc__
#include <asm/param.h>
#include <asm/kbio.h>
#endif
#include "nls.h"
static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150,
133, 120, 109, 100, 92, 86, 80, 75, 67,
60, 55, 50, 46, 43, 40, 37, 33, 30, 27,
25, 23, 21, 20 };
#define RATE_COUNT (sizeof( valid_rates ) / sizeof( int ))
static int valid_delays[] = { 250, 500, 750, 1000 };
#define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int ))
static int
KDKBDREP_ioctl_ok(double rate, int delay, int silent) {
#ifdef KDKBDREP
/* This ioctl is defined in <linux/kd.h> but is not
implemented anywhere - must be in some m68k patches. */
struct kbd_repeat kbdrep_s;
/* don't change, just test */
kbdrep_s.rate = -1;
kbdrep_s.delay = -1;
if (ioctl( 0, KDKBDREP, &kbdrep_s )) {
if (errno == EINVAL)
return 0;
perror( "ioctl(KDKBDREP)" );
exit( 1 );
}
/* do the change */
if (rate == 0) /* switch repeat off */
kbdrep_s.rate = 0;
else
kbdrep_s.rate = 1000.0 / rate; /* convert cps to msec */
if (kbdrep_s.rate < 1)
kbdrep_s.rate = 1;
kbdrep_s.delay = delay;
if (kbdrep_s.delay < 1)
kbdrep_s.delay = 1;
if (ioctl( 0, KDKBDREP, &kbdrep_s )) {
perror( "ioctl(KDKBDREP)" );
exit( 1 );
}
/* report */
if (kbdrep_s.rate == 0)
rate = 0;
else
rate = 1000.0 / (double) kbdrep_s.rate;
if (!silent)
printf( _("Typematic Rate set to %.1f cps (delay = %d ms)\n"),
rate, kbdrep_s.delay );
return 1; /* success! */
#else /* no KDKBDREP */
return 0;
#endif /* KDKBDREP */
}
static int
KIOCSRATE_ioctl_ok(double rate, int delay, int silent) {
#ifdef KIOCSRATE
struct kbd_rate kbdrate_s;
int fd;
fd = open("/dev/kbd", O_RDONLY);
if (fd == -1) {
perror( "open(/dev/kbd)" );
exit( 1 );
}
kbdrate_s.rate = (int) (rate + 0.5); /* must be integer, so round up */
kbdrate_s.delay = delay * HZ / 1000; /* convert ms to Hz */
if (kbdrate_s.rate > 50)
kbdrate_s.rate = 50;
if (ioctl( fd, KIOCSRATE, &kbdrate_s )) {
perror( "ioctl(KIOCSRATE)" );
exit( 1 );
}
close( fd );
if (!silent)
printf( "Typematic Rate set to %d cps (delay = %d ms)\n",
kbdrate_s.rate, kbdrate_s.delay * 1000 / HZ );
return 1;
#else /* no KIOCSRATE */
return 0;
#endif /* KIOCSRATE */
}
int main( int argc, char **argv )
{
#ifdef __sparc__
double rate = 5.0; /* Default rate */
int delay = 200; /* Default delay */
#else
double rate = 10.9; /* Default rate */
int delay = 250; /* Default delay */
#endif
int value = 0x7f; /* Maximum delay with slowest rate */
/* DO NOT CHANGE this value */
int silent = 0;
int fd;
char data;
int c;
int i;
extern char *optarg;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
while ( (c = getopt( argc, argv, "r:d:svVh?" )) != EOF ) {
switch (c) {
case 'r':
rate = atof( optarg );
break;
case 'd':
delay = atoi( optarg );
break;
case 's':
silent = 1;
break;
case 'v':
case 'V':
fprintf( stderr, "util-linux %s kbdrate\n", UTIL_LINUX_VERSION);
exit(0);
case 'h':
case '?':
fprintf( stderr,
_("Usage: kbdrate [-V] [-s] [-r rate] [-d delay]\n"));
exit(0);
}
}
if(KDKBDREP_ioctl_ok(rate, delay, silent)) /* m68k? */
return 0;
if(KIOCSRATE_ioctl_ok(rate, delay, silent)) /* sparc? */
return 0;
/* The ioport way */
for (i = 0; i < RATE_COUNT; i++)
if (rate * 10 >= valid_rates[i]) {
value &= 0x60;
value |= i;
break;
}
for (i = 0; i < DELAY_COUNT; i++)
if (delay <= valid_delays[i]) {
value &= 0x1f;
value |= i << 5;
break;
}
if ( (fd = open( "/dev/port", O_RDWR )) < 0) {
perror( _("Cannot open /dev/port") );
exit( 1 );
}
do {
lseek( fd, 0x64, 0 );
read( fd, &data, 1 );
} while ((data & 2) == 2 ); /* wait */
lseek( fd, 0x60, 0 );
data = 0xf3; /* set typematic rate */
write( fd, &data, 1 );
do {
lseek( fd, 0x64, 0 );
read( fd, &data, 1 );
} while ((data & 2) == 2 ); /* wait */
lseek( fd, 0x60, 0 );
sleep( 1 );
write( fd, &value, 1 );
close( fd );
if (!silent)
printf( _("Typematic Rate set to %.1f cps (delay = %d ms)\n"),
valid_rates[value & 0x1f] / 10.0,
valid_delays[ (value & 0x60) >> 5 ] );
return 0;
}

View file

@ -1,7 +1,7 @@
include ../make_include
include ../MCONFIG
all: err.o my_reboot.o setproctitle.o env.o carefulputc.o
all: err.o my_reboot.o setproctitle.o env.o carefulputc.o xstrncpy.o
err.o: err.c
@ -13,6 +13,8 @@ setproctitle.o: setproctitle.h
carefulputc.o: carefulputc.h
xstrncpy.o: xstrncpy.h
.PHONY: clean
clean:
-rm -f *.o *~ core

View file

@ -1,7 +1,7 @@
/*
* Security checks of enviroment
* Added from shadow-utils package
* by Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
* by Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
*
*/

View file

@ -26,7 +26,7 @@
*
What is the history of these six, and related defines?
------------------------------------------------------------------------
_PATH_UTMP and UTMP_FILE and UTMP_FILENAME:
_PATH_UTMP and UTMP_FILE and UTMP_FILENAME
/etc/utmp > /var/adm/utmp > /var/run/utmp.
Traditionally we have /etc/utmp.
In <paths.h> we have /etc/utmp, but since 4.6.0 /var/adm/utmp
@ -34,7 +34,7 @@ and since 5.0.9 (and in glibc2) /var/run/utmp.
In login/pathnames.h we have /etc/utmp, but since 4.6.6 /var/adm/utmp.
In <utmp.h> UTMP_FILE is defined as /etc/utmp, but in 4.6.* as _PATH_UTMP.
_PATH_WTMP and WTMP_FILE and WTMP_FILENAME:
_PATH_WTMP and WTMP_FILE and WTMP_FILENAME
/etc/wtmp > /usr/adm/wtmp > /var/adm/wtmp > /var/log/wtmp.
Traditionally we have /etc/wtmp.
In <paths.h> we have /usr/adm/wtmp, but since 4.5.13 /var/adm/wtmp,
@ -43,21 +43,21 @@ In login/pathnames.h. we have /etc/wtmp, but since 4.6.6 /var/adm/wtmp.
In <utmp.h> WTMP_FILE is defined as /usr/adm/wtmp, but in 4.5.* as
/var/adm/wtmp, and in 4.6.* as _PATH_WTMP.
_PATH_DEFPATH)
_PATH_DEFPATH
Long ago this was ".:/bin:/usr/bin".
In <paths.h> libc 4.4.1-4.4.4 have "/usr/bin:/bin"
and libc 4.5.21-5.4.23 have "/usr/local/bin:/usr/bin:/bin:."
and libc 5.4.38-5.4.46 have "/usr/local/bin:/usr/bin:/bin".
In login/pathnames.h libc4 and libc5 have "/usr/local/bin:/bin:/usr/bin:."
_PATH_DEFPATH_ROOT)
_PATH_DEFPATH_ROOT
Long ago this was identical to _PATH_DEFPATH.
In <paths.h> no definition is present before libc 4.5.13.
Libc 4.5.13 has "/bin:/usr/bin:/etc"
Libc 4.5.14-5.4.46 have "/sbin:/bin:/usr/sbin:/usr/bin"
In login/pathnames.h libc4 and libc5 have "/bin:/usr/bin:/etc"
_PATH_LASTLOG)
_PATH_LASTLOG
/etc/lastlog > /usr/adm/lastlog > /var/adm/lastlog > /var/log/lastlog.
Traditionally we have /etc/lastlog.
In <bsd/utmp.h> libc 4.4.1-4.5.12 have /usr/adm/lastlog, 4.5.13 and
@ -65,7 +65,7 @@ later have /var/adm/lastlog.
In paths.h all libc5 and glibc2 versions have /var/log/lastlog.
In login/pathnames.h all libc4 and libc5 versions have /usr/adm/lastlog.
_PATH_MAILDIR)
_PATH_MAILDIR
/usr/spool/mail > /var/spool/mail > /var/mail.
Traditionally we have /usr/spool/mail.
In <paths.h> we have /usr/spool/mail, but since libc 4.5.13 /var/spool/mail.
@ -140,6 +140,12 @@ Libc5 and glibc 2.0-2.1 have /var/spool/mail, but glibc 2.1.1 has /var/mail.
#define _PATH_GROUP "/etc/group"
#define _PATH_GTMP "/etc/gtmp"
#define _PATH_GTMPTMP "/etc/gtmptmp"
#define _PATH_SHADOW_PASSWD "/etc/shadow"
#define _PATH_SHADOW_PTMP "/etc/sptmp"
#define _PATH_SHADOW_PTMPTMP "/etc/sptmptmp"
#define _PATH_SHADOW_GROUP "/etc/gshadow"
#define _PATH_SHADOW_GTMP "/etc/sgtmp"
#define _PATH_SHADOW_GTMPTMP "/etc/sgtmptmp"
/* used in misc-utils/look.c */
#define _PATH_WORDS "/usr/dict/words"

View file

@ -12,6 +12,14 @@
# include <libutf8.h>
#endif
#if 1
/* explicit prototypes, since sometimes <wchar.h> does not give them */
extern int wcwidth (wint_t c);
extern int wcswidth (const wchar_t *s, size_t n);
extern size_t wcslen (const wchar_t *s);
extern wchar_t *wcsdup (const wchar_t *s);
#endif
#else
# include <ctype.h>

9
lib/xstrncpy.c Normal file
View file

@ -0,0 +1,9 @@
/* NUL-terminated version of strncpy() */
#include <string.h>
#include "xstrncpy.h"
void
xstrncpy(char *dest, const char *src, size_t n) {
strncpy(dest, src, n-1);
dest[n-1] = 0;
}

1
lib/xstrncpy.h Normal file
View file

@ -0,0 +1 @@
extern void xstrncpy(char *dest, const char *src, size_t n);

View file

@ -96,17 +96,17 @@ shutdown.o simpleinit.o: $(LIB)/linux_reboot.h
wall.o: ttymsg.h $(LIB)/carefulputc.h
agetty: agetty.o
chfn: chfn.o islocal.o setpwnam.o $(LIB)/env.o
chfn: chfn.o islocal.o setpwnam.o $(LIB)/env.o $(LIB)/xstrncpy.o
$(CC) $(LDFLAGS) -o $@ $^ $(CRYPT) $(PAM)
chsh: chsh.o islocal.o setpwnam.o $(LIB)/env.o
$(CC) $(LDFLAGS) -o $@ $^ $(CRYPT) $(PAM)
last: last.o
ifeq "$(HAVE_PAM)" "yes"
login: login.o $(LIB)/setproctitle.o
login: login.o $(LIB)/setproctitle.o $(LIB)/xstrncpy.o
$(CC) $(LDFLAGS) -o $@ $^ $(CRYPT) $(PAM)
else
login: login.o $(LIB)/setproctitle.o checktty.o
login: login.o $(LIB)/xstrncpy.o $(LIB)/setproctitle.o checktty.o
$(CC) $(LDFLAGS) -o $@ $^ $(CRYPT)
endif
@ -115,20 +115,20 @@ mesg: mesg.o $(ERR_O)
newgrp: newgrp.o
$(CC) $(LDFLAGS) -o $@ $^ $(CRYPT) $(PAM)
shutdown: shutdown.o $(LIB)/my_reboot.o
shutdown: shutdown.o $(LIB)/my_reboot.o $(LIB)/xstrncpy.o
simpleinit: simpleinit.o $(LIB)/my_reboot.o
simpleinit: simpleinit.o $(LIB)/my_reboot.o $(LIB)/xstrncpy.o
$(CC) $(LDFLAGS) -o $@ $^ $(CRYPT)
initctl: initctl.o
$(CC) $(LDFLAGS) -o $@ $^
vipw: vipw.o
vipw: vipw.o $(LIB)/xstrncpy.o
newgrp.o: $(LIB)/pathnames.h
$(CC) -c $(CFLAGS) $(PAMFL) newgrp.c
wall: wall.o ttymsg.o $(LIB)/carefulputc.o
wall: wall.o ttymsg.o $(LIB)/carefulputc.o $(LIB)/xstrncpy.o
LOGINFLAGS=
ifeq "$(USE_TTY_GROUP)" "yes"
@ -145,7 +145,7 @@ login.o: login.c $(LIB)/pathnames.h $(LIB)/setproctitle.c $(LIB)/setproctitle.h
mesg.o: mesg.c $(LIB)/errs.h
$(CC) -c $(CFLAGS) $(LOGINFLAGS) mesg.c
passwd: passwd.o islocal.o setpwnam.o $(LIB)/env.o
passwd: passwd.o islocal.o setpwnam.o $(LIB)/env.o $(LIB)/xstrncpy.o
$(CC) $(LDFLAGS) -o $@ $^ $(CRYPT)
ifeq "$(REQUIRE_PASSWORD)" "yes"
@ -214,8 +214,8 @@ ifeq "$(USE_TTY_GROUP)" "yes"
chmod g+s $(USRBINDIR)/wall
endif
.PHONY: clean
clean:
.PHONY: clean distclean
clean distclean:
-rm -f *.o *~ core $(BIN.PASSWD) $(SBIN.GETTY) $(SBIN.INIT) \
$(USRBIN.MISC) $(USRBIN.PASSWD) $(USRBIN.PUTILS) \
$(USRSBIN.PUTILS) $(BIN.PUTILS)

View file

@ -5,7 +5,7 @@
-f option added by Eric Rasmussen <ear@usfirst.org> - 12/28/95
1999-02-22 Arkadiusz Mikiewicz <misiek@misiek.eu.org>
1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
- added Native Language Support
1999-05-05 Thorsten Kranzkowski <dl8bcu@gmx.net>
@ -564,7 +564,6 @@ update_utmp(line)
* entry in the utmp file.
*/
#ifdef __linux__
utmpname(_PATH_UTMP);
setutent();
while ((utp = getutent())
@ -578,7 +577,6 @@ update_utmp(line)
memset(&ut, 0, sizeof(ut));
strncpy(ut.ut_id, line + 3, sizeof(ut.ut_id));
}
/*endutent();*/
strncpy(ut.ut_user, "LOGIN", sizeof(ut.ut_user));
strncpy(ut.ut_line, line, sizeof(ut.ut_line));
@ -593,7 +591,7 @@ update_utmp(line)
endutent();
{
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
#ifdef HAVE_updwtmp
updwtmp(_PATH_WTMP, &ut);
#else
int ut_fd;
@ -610,31 +608,6 @@ update_utmp(line)
}
#endif
}
#else /* not __linux__ */
{ int ut_fd;
if ((ut_fd = open(UTMP_FILE, 2)) < 0) {
error(_("%s: open for update: %m"), UTMP_FILE);
} else {
long ut_size = sizeof(ut); /* avoid nonsense */
while (read(ut_fd, (char *) &ut, sizeof(ut)) == sizeof(ut)) {
if (ut.ut_type == INIT_PROCESS && ut.ut_pid == mypid) {
ut.ut_type = LOGIN_PROCESS;
ut.ut_time = time((long *) 0);
(void) strncpy(ut.ut_name, "LOGIN", sizeof(ut.ut_name));
(void) strncpy(ut.ut_line, line, sizeof(ut.ut_line));
if (fakehost)
(void) strncpy(ut.ut_host, fakehost, sizeof(ut.ut_host));
(void) lseek(ut_fd, -ut_size, 1);
(void) write(ut_fd, (char *) &ut, sizeof(ut));
(void) close(ut_fd);
return;
}
}
error(_("%s: no utmp entry"), line);
}
}
#endif /* __linux__ */
}
#endif

View file

@ -2,7 +2,7 @@
Created 25-Aug-95 by Peter Orbaek <poe@daimi.aau.dk>
Fixed by JDS June 1996 to clear lists and close files
1999-02-22 Arkadiusz Mikiewicz <misiek@misiek.eu.org>
1999-02-22 Arkadiusz Mikiewicz <misiek@pld.ORG.PL>
- added Native Language Support
*/
@ -30,6 +30,7 @@
#include "pathnames.h"
#include "login.h"
#include "xstrncpy.h"
#ifdef TESTING
struct hostent hostaddress;
@ -107,8 +108,7 @@ new_class(char *class)
tc->next = ttyclasses;
tc->first = NULL;
strncpy(tc->classname, class, CLASSNAMELEN);
tc->classname[CLASSNAMELEN-1] = 0;
xstrncpy(tc->classname, class, CLASSNAMELEN);
ttyclasses = tc;
return tc;
}
@ -128,8 +128,7 @@ add_to_class(struct ttyclass *tc, char *tty)
}
ge->next = tc->first;
strncpy(ge->name, tty, NAMELEN);
ge->name[NAMELEN-1] = 0;
xstrncpy(ge->name, tty, NAMELEN);
tc->first = ge;
}
@ -267,8 +266,7 @@ in_class(const char *tty, char *class)
if (class[0] == '[') {
if ((p = strchr(class, ']'))) {
*p = 0;
strncpy(timespec, class+1, sizeof(timespec));
timespec[sizeof(timespec)-1] = 0;
xstrncpy(timespec, class+1, sizeof(timespec));
*p = ']';
if(!timeok(tm, timespec)) return 0;
class = p+1;
@ -289,8 +287,7 @@ in_class(const char *tty, char *class)
if (n[0] == '[') {
if ((p = strchr(n, ']'))) {
*p = 0;
strncpy(timespec, n+1, sizeof(timespec));
timespec[sizeof(timespec)-1] = 0;
xstrncpy(timespec, n+1, sizeof(timespec));
*p = ']';
if(!timeok(tm, timespec)) continue;
n = p+1;
@ -373,8 +370,7 @@ checktty(const char *user, const char *tty, struct passwd *pwd)
if(*ptr == '#') *ptr = 0;
if (buf[0] == '*') {
strncpy(defaultbuf, buf, 256);
defaultbuf[255] = 0;
xstrncpy(defaultbuf, buf, 256);
continue;
}

View file

@ -16,7 +16,7 @@
* Hacked by Peter Breitenlohner, peb@mppmu.mpg.de,
* to remove trailing empty fields. Oct 5, 96.
*
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*
*
@ -36,6 +36,7 @@
#include "my_crypt.h"
#include "islocal.h"
#include "setpwnam.h"
#include "xstrncpy.h"
#include "nls.h"
#include "env.h"
@ -239,8 +240,7 @@ static boolean parse_argv (argc, argv, pinfo)
info_given = true;
status = 0;
strncpy (buf, whoami, sizeof(buf)-128);
buf[sizeof(buf)-128-1] = 0;
xstrncpy (buf, whoami, sizeof(buf)-128);
strcat (buf, ": ");
/* now store the argument */

View file

@ -17,7 +17,7 @@
* suggestion from Zefram. Disallowing users with shells not in /etc/shells
* from changing their shell.
*
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*
*

View file

@ -17,7 +17,7 @@
ftp://ftp.daimi.aau.dk/pub/linux/poe/poeigl-X.XX.tar.gz
1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
- added Native Language Support
*/

View file

@ -10,7 +10,7 @@
to distinguish user names where one is a prefix of the other,
and to use "pathnames.h". Oct 5, 96.
1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
- added Native Language Support

View file

@ -18,10 +18,14 @@
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
/* 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*/
/* 2001-02-14 Marek Zelem <marek@fornax.sk>
* - using mmap() on Linux - great speed improvement
*/
/*
* last
*/
@ -29,6 +33,7 @@
#include <sys/stat.h>
#include <sys/file.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <signal.h>
#include <string.h>
#include <time.h>
@ -197,8 +202,15 @@ wtmp(void) {
long delta; /* time difference */
char *crmsg = NULL;
char *ct = NULL;
#if USE_GETUTENT
struct utmp **utmplist = NULL;
int listlen = 0;
#else
int fd;
struct utmp *utl;
struct stat st;
int utl_len;
#endif
int listnr = 0;
int i;
@ -208,6 +220,7 @@ wtmp(void) {
(void)signal(SIGINT, onintr);
(void)signal(SIGQUIT, onintr);
#if USE_GETUTENT
setutent();
while((bp = getutent())) {
if(listnr >= listlen) {
@ -220,12 +233,31 @@ wtmp(void) {
memcpy(utmplist[listnr++], bp, sizeof(*bp));
}
endutent();
#else
if ((fd = open(file,O_RDONLY)) < 0)
exit(1);
fstat(fd, &st);
utl_len = st.st_size;
utl = mmap(NULL, utl_len, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FILE, fd, 0);
if (utl == NULL)
exit(1);
listnr = utl_len/sizeof(struct utmp);
#endif
if(listnr)
#if USE_GETUTENT
ct = ctime(&utmplist[0]->ut_time);
#else
ct = ctime(&utl[0].ut_time);
#endif
for(i = listnr - 1; i >= 0; i--) {
#if USE_GETUTENT
bp = utmplist[i];
#else
bp = utl+i;
#endif
/*
* if the terminal line is '~', the machine stopped.
* see utmp(5) for more info.
@ -245,7 +277,8 @@ wtmp(void) {
}
currentout = -bp->ut_time;
crmsg = strncmp(bp->ut_name, "shutdown", NMAX) ? "crash" : "down ";
crmsg = (strncmp(bp->ut_name, "shutdown", NMAX)
? "crash" : "down ");
if (!bp->ut_name[0])
(void)strcpy(bp->ut_name, "reboot");
if (want(bp, NO)) {
@ -295,9 +328,15 @@ wtmp(void) {
}
T->logout = bp->ut_time;
utmpbuf.ut_time = bp->ut_time;
#if USE_GETUTENT
free(bp);
}
if(utmplist) free(utmplist);
#else
}
munmap(utl,utl_len);
close(fd);
#endif
if(ct) printf(_("\nwtmp begins %s"), ct); /* ct already ends in \n */
}

View file

@ -52,7 +52,7 @@
From 1992 till now (1997) this code for Linux has been maintained at
ftp.daimi.aau.dk:/pub/linux/poe/
1999-02-22 Arkadiusz Mikiewicz <misiek@misiek.eu.org>
1999-02-22 Arkadiusz Mikiewicz <misiek@pld.ORG.PL>
- added Native Language Support
Sun Mar 21 1999 - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
- fixed strerr(errno) in gettext calls
@ -119,6 +119,7 @@
#include "pathnames.h"
#include "my_crypt.h"
#include "login.h"
#include "xstrncpy.h"
#include "nls.h"
#ifdef __linux__
@ -145,8 +146,11 @@
syslog(LOG_ERR,"%s",pam_strerror(pamh, retcode)); \
pam_end(pamh, retcode); exit(1); \
}
# define PAM_END { retcode = pam_close_session(pamh,0); \
pam_end(pamh,retcode); }
# define PAM_END { \
pam_setcred(pamh, PAM_DELETE_CRED); \
retcode = pam_close_session(pamh,0); \
pam_end(pamh,retcode); \
}
#endif
#ifndef __linux__
@ -190,13 +194,14 @@ struct lastlog
};
#endif
#ifndef USE_PAM
static void getloginname (void);
static void checknologin (void);
static int rootterm (char *ttyn);
#endif
static void timedout (int);
static void sigint (int);
static int rootterm (char *ttyn);
static void motd (void);
static void checknologin (void);
static void dolastlog (int quiet);
#ifndef __linux__
@ -355,8 +360,7 @@ main(int argc, char **argv)
* host to login so that it may be placed in utmp and wtmp
*/
gethostname(tbuf, sizeof(tbuf));
strncpy(thishost, tbuf, sizeof(thishost)-1);
thishost[sizeof(thishost)-1] = 0;
xstrncpy(thishost, tbuf, sizeof(thishost));
domain = index(tbuf, '.');
username = tty = hostname = NULL;
@ -590,14 +594,21 @@ main(int argc, char **argv)
First get the username that we are actually using, though.
*/
retcode = pam_get_item(pamh, PAM_USER, (const void **) &username);
setpwent();
pwd = getpwnam(username);
if (retcode == PAM_SUCCESS && username && *username) {
pwd = getpwnam(username);
}
/*
* Initialize the supplementary group list.
* This should be done before pam_setcred because
* the PAM modules might add groups during pam_setcred.
*/
if (pwd) initgroups(username, pwd->pw_gid);
retcode = pam_setcred(pamh, PAM_ESTABLISH_CRED);
retcode = pam_open_session(pamh, 0);
PAM_FAIL_CHECK;
retcode = pam_open_session(pamh, 0);
retcode = pam_setcred(pamh, PAM_ESTABLISH_CRED);
PAM_FAIL_CHECK;
#else /* ! USE_PAM */
@ -795,66 +806,6 @@ main(int argc, char **argv)
}
}
#ifndef __linux__
# ifdef KERBEROS
if (notickets && !quietlog)
printf(_("Warning: no Kerberos tickets issued\n"));
# endif
# ifndef USE_PAM /* PAM does all of this for us */
# define TWOWEEKS (14*24*60*60)
if (pwd->pw_change || pwd->pw_expire) {
struct timeval tp;
gettimeofday(&tp, (struct timezone *)NULL);
if (pwd->pw_change) {
if (tp.tv_sec >= pwd->pw_change) {
printf(_("Sorry -- your password has expired.\n"));
sleepexit(1);
}
else if (tp.tv_sec - pwd->pw_change < TWOWEEKS && !quietlog) {
struct tm *ttp;
ttp = localtime(&pwd->pw_change);
printf(_("Warning: your password expires on %d %s %d.\n"),
ttp->tm_mday, months[ttp->tm_mon],
TM_YEAR_BASE + ttp->tm_year);
}
}
if (pwd->pw_expire) {
if (tp.tv_sec >= pwd->pw_expire) {
printf(_("Sorry -- your account has expired.\n"));
sleepexit(1);
}
else if (tp.tv_sec - pwd->pw_expire < TWOWEEKS && !quietlog) {
struct tm *ttp;
ttp = localtime(&pwd->pw_expire);
printf(_("Warning: your account expires on %d %s %d.\n"),
ttp->tm_mday, months[ttp->tm_mon],
TM_YEAR_BASE + ttp->tm_year);
}
}
}
# endif /* !USE_PAM */
/* nothing else left to fail -- really log in */
{
struct utmp utmp;
memset((char *)&utmp, 0, sizeof(utmp));
time(&utmp.ut_time);
strncpy(utmp.ut_name, username, sizeof(utmp.ut_name));
/* ut_name may legally be non-null-terminated */
if (hostname) {
strncpy(utmp.ut_host, hostname, sizeof(utmp.ut_host));
utmp.ut_host[sizeof(utmp.ut_host)-1] = 0;
}
strncpy(utmp.ut_line, tty, sizeof(utmp.ut_line));
utmp.ut_line[sizeof(utmp.ut_line)-1] = 0;
login(&utmp);
}
#else /* __linux__ defined */
/* for linux, write entries in utmp and wtmp */
{
struct utmp ut;
@ -898,8 +849,7 @@ Michael Riepe <michael@stud.uni-hannover.de>
strncpy(ut.ut_id, ttyn + 8, sizeof(ut.ut_id));
strncpy(ut.ut_user, username, sizeof(ut.ut_user));
strncpy(ut.ut_line, ttyn + 5, sizeof(ut.ut_line));
ut.ut_line[sizeof(ut.ut_line)-1] = 0;
xstrncpy(ut.ut_line, ttyn + 5, sizeof(ut.ut_line));
#ifdef _HAVE_UT_TV /* in <utmpbits.h> included by <utmp.h> */
gettimeofday(&ut.ut_tv, NULL);
#else
@ -913,8 +863,7 @@ Michael Riepe <michael@stud.uni-hannover.de>
ut.ut_type = USER_PROCESS;
ut.ut_pid = mypid;
if (hostname) {
strncpy(ut.ut_host, hostname, sizeof(ut.ut_host));
ut.ut_host[sizeof(ut.ut_host)-1] = 0;
xstrncpy(ut.ut_host, hostname, sizeof(ut.ut_host));
if (hostaddress.h_addr_list)
memcpy(&ut.ut_addr, hostaddress.h_addr_list[0],
sizeof(ut.ut_addr));
@ -923,7 +872,7 @@ Michael Riepe <michael@stud.uni-hannover.de>
pututline(&ut);
endutent();
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
#ifdef HAVE_updwtmp
updwtmp(_PATH_WTMP, &ut);
#else
#if 0
@ -953,19 +902,11 @@ Michael Riepe <michael@stud.uni-hannover.de>
}
}
#endif
#endif /* __GLIBC__ */
#endif
}
#endif /* __linux__ */
dolastlog(quietlog);
#ifndef __linux__
if (!hflag) { /* XXX */
static struct winsize win = { 0, 0, 0, 0 };
ioctl(0, TIOCSWINSZ, &win);
}
#endif
chown(ttyn, pwd->pw_uid,
(gr = getgrnam(TTYGRPNAME)) ? gr->gr_gid : pwd->pw_gid);
chmod(ttyn, TTY_MODE);
@ -1012,17 +953,6 @@ Michael Riepe <michael@stud.uni-hannover.de>
memset(environ, 0, sizeof(char*));
}
#ifndef __linux__
setenv("HOME", pwd->pw_dir, 1);
setenv("SHELL", pwd->pw_shell, 1);
if (term[0] == '\0') {
strncpy(term, stypeof(tty), sizeof(term));
term[sizeof(term)-1] = 0;
}
setenv("TERM", term, 0);
setenv("USER", pwd->pw_name, 1);
setenv("PATH", _PATH_DEFPATH, 0);
#else
setenv("HOME", pwd->pw_dir, 0); /* legal to override */
if(pwd->pw_uid)
setenv("PATH", _PATH_DEFPATH, 1);
@ -1046,7 +976,6 @@ Michael Riepe <michael@stud.uni-hannover.de>
HP-UX 6.5 does it. We'll not allow modifying it.
*/
setenv("LOGNAME", pwd->pw_name, 1);
#endif
#ifdef USE_PAM
{
@ -1108,9 +1037,16 @@ Michael Riepe <michael@stud.uni-hannover.de>
signal(SIGHUP, SIG_DFL);
#ifdef USE_PAM
/* We must fork before setuid() because we need to call
/*
* We must fork before setuid() because we need to call
* pam_close_session() as root.
*/
/*
* Problem: if the user's shell is a shell like ash that doesnt do
* setsid() or setpgrp(), then a ctrl-\, sending SIGQUIT to every
* process in the pgrp, will kill us.
* Solution: use TIOCNOTTY and setsid().
*/
signal(SIGINT, SIG_IGN);
childPid = fork();
if (childPid < 0) {
@ -1121,11 +1057,16 @@ Michael Riepe <michael@stud.uni-hannover.de>
exit(0);
} else if (childPid) {
/* parent - wait for child to finish, then cleanup session */
signal(SIGHUP, SIG_IGN); /* ignore signal from TIOCNOTTY */
ioctl(0, TIOCNOTTY, NULL);
signal(SIGHUP, SIG_DFL);
wait(NULL);
PAM_END;
exit(0);
}
/* child */
setsid();
#endif
signal(SIGINT, SIG_DFL);
@ -1161,10 +1102,9 @@ Michael Riepe <michael@stud.uni-hannover.de>
childArgv[childArgc++] = buff;
} else {
tbuf[0] = '-';
strncpy(tbuf + 1, ((p = rindex(pwd->pw_shell, '/')) ?
xstrncpy(tbuf + 1, ((p = rindex(pwd->pw_shell, '/')) ?
p + 1 : pwd->pw_shell),
sizeof(tbuf)-1);
tbuf[sizeof(tbuf)-1] = 0;
childArgv[childArgc++] = pwd->pw_shell;
childArgv[childArgc++] = tbuf;
@ -1185,7 +1125,8 @@ Michael Riepe <michael@stud.uni-hannover.de>
exit(0);
}
void
#ifndef USE_PAM
static void
getloginname(void) {
int ch, cnt, cnt2;
char *p;
@ -1229,6 +1170,7 @@ getloginname(void) {
}
}
}
#endif
void
timedout(int sig) {
@ -1243,6 +1185,7 @@ timedout(int sig) {
exit(0);
}
#ifndef USE_PAM
int
rootterm(char * ttyn)
#ifndef __linux__
@ -1279,7 +1222,8 @@ rootterm(char * ttyn)
}
}
}
#endif
#endif /* !__linux__ */
#endif /* !USE_PAM */
jmp_buf motdinterrupt;
@ -1342,12 +1286,10 @@ dolastlog(int quiet) {
}
memset((char *)&ll, 0, sizeof(ll));
time(&ll.ll_time);
strncpy(ll.ll_line, tty, sizeof(ll.ll_line));
ll.ll_line[sizeof(ll.ll_line)-1] = 0;
if (hostname) {
strncpy(ll.ll_host, hostname, sizeof(ll.ll_host));
ll.ll_host[sizeof(ll.ll_host)-1] = 0;
}
xstrncpy(ll.ll_line, tty, sizeof(ll.ll_line));
if (hostname)
xstrncpy(ll.ll_host, hostname, sizeof(ll.ll_host));
write(fd, (char *)&ll, sizeof(ll));
close(fd);
}

View file

@ -39,7 +39,7 @@
* Modified Mon Jul 1 18:14:10 1996, janl@ifi.uio.no, writing to stdout
* as suggested by Michael Meskes <meskes@Informatik.RWTH-Aachen.DE>
*
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*
*

View file

@ -3,7 +3,7 @@
/* Vesa Roukonen added code for asking password */
/* Currently maintained at ftp://ftp.daimi.aau.dk/pub/linux/poe/ */
/* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
/* 1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*/

View file

@ -38,7 +38,7 @@
* auth.warning. (Of course, the password itself is not logged.)
*/
/* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
/* 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
* Sun Mar 21 1999 - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* - fixed strerr(errno) in gettext calls
@ -68,6 +68,7 @@
#include "my_crypt.h"
#include "setpwnam.h"
#include "islocal.h"
#include "xstrncpy.h"
#include "nls.h"
#include "env.h"
@ -375,8 +376,7 @@ main(int argc, char *argv[]) {
&& !check_passwd(pwdstr, pe->pw_passwd, user, pe->pw_gecos) )
goto redo_it;
strncpy(pwdstr1, pwdstr, 9);
pwdstr1[9] = 0;
xstrncpy(pwdstr1, pwdstr, sizeof(pwdstr1));
pwdstr = getpass(_("Re-type new password: "));
if(strncmp(pwdstr, pwdstr1, 8)) {

View file

@ -22,6 +22,15 @@
#define GROUP_FILE _PATH_GROUP
#define GTMP_FILE _PATH_GTMP
#define GTMPTMP_FILE _PATH_GTMPTMP
#define SHADOW_FILE _PATH_SHADOW_PASSWD
#define SPTMP_FILE _PATH_SHADOW_PTMP
#define SPTMPTMP_FILE _PATH_SHADOW_PTMPTMP
#define SGROUP_FILE _PATH_SHADOW_GROUP
#define SGTMP_FILE _PATH_SHADOW_GTMP
#define SGTMPTMP_FILE _PATH_SHADOW_GTMPTMP
#else
#define PASSWD_FILE "/tmp/passwd"
#define PTMP_FILE "/tmp/ptmp"
@ -30,6 +39,14 @@
#define GROUP_FILE "/tmp/group"
#define GTMP_FILE "/tmp/gtmp"
#define GTMPTMP_FILE "/tmp/gtmptmp"
#define SHADOW_FILE "/tmp/shadow"
#define SPTMP_FILE "/tmp/sptmp"
#define SPTMPTMP_FILE "/tmp/sptmptmp"
#define SGROUP_FILE "/tmp/gshadow"
#define SGTMP_FILE "/tmp/sgtmp"
#define SGTMPTMP_FILE "/tmp/sgtmptmp"
#endif
extern int setpwnam (struct passwd *pwd);

View file

@ -28,7 +28,7 @@
* Changes by Richard Gooch <rgooch@atnf.csiro.au> (butchered by aeb)
* introducing shutdown.conf.
*
* 1999-02-22 Arkadiusz Mikiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Mikiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*
* 2000-03-02 Richard Gooch <rgooch@atnf.csiro.au>
@ -71,6 +71,7 @@
#include <sys/utsname.h>
#include "linux_reboot.h"
#include "pathnames.h"
#include "xstrncpy.h"
#include "nls.h"
static void usage(void), int_handler(int), write_user(struct utmp *);
@ -249,8 +250,7 @@ main(int argc, char *argv[])
exit(1);
}
} else {
strncpy(message, argv[c], sizeof(message));
message[sizeof(message)-1] = '\0';
xstrncpy(message, argv[c], sizeof(message));
opt_msgset = 1;
}
}

View file

@ -1,8 +1,14 @@
/* simpleinit.c - poe@daimi.aau.dk */
/* Version 1.21 */
/* Version 2.0.1 */
/* 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
/* 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
* 2001-01-25 Richard Gooch <rgooch@atnf.csiro.au>
* - fixed bug with failed services so they may be later "reclaimed"
* 2001-02-02 Richard Gooch <rgooch@atnf.csiro.au>
* - fixed race when reading from pipe and reaping children
* 2001-02-18 sam@quux.dropbear.id.au
* - fixed bug in <get_path>: multiple INIT_PATH components did not work
*/
#include <sys/types.h>
@ -31,6 +37,7 @@
#include "my_crypt.h"
#include "pathnames.h"
#include "linux_reboot.h"
#include "xstrncpy.h"
#include "nls.h"
#include "simpleinit.h"
@ -77,7 +84,8 @@ static sigjmp_buf jmp_env;
static void do_single (void);
static int do_rc_tty (const char *path);
static int process_path ( const char *path, int (*func) (const char *path) );
static int process_path (const char *path, int (*func) (const char *path),
int ignore_dangling_symlink);
static int preload_file (const char *path);
static int run_file (const char *path);
static void spawn (int i), read_inittab (void);
@ -91,7 +99,7 @@ static void sigterm_handler (int sig);
static void set_tz (void);
#endif
static void write_wtmp (void);
static pid_t mywaitpid (pid_t pid, int *status);
static pid_t mywait (int *status);
static int run_command (const char *file, const char *name, pid_t pid);
@ -221,7 +229,7 @@ int main(int argc, char *argv[])
}
for ever {
pid = mywaitpid (-1, &vec);
pid = mywait (&vec);
if (pid < 1) continue;
/* clear utmp entry, and append to wtmp if possible */
@ -322,7 +330,7 @@ static int do_rc_tty (const char *path)
sigset_t ss;
if (caught_sigint) return 0;
process_path (path, preload_file);
process_path (path, preload_file, 0);
/* Launch off a subprocess to start a new session (required for frobbing
the TTY) and capture control-C */
switch ( child = fork () )
@ -344,10 +352,10 @@ static int do_rc_tty (const char *path)
break;
}
/* Parent */
process_path (path, run_file);
process_path (path, run_file, 0);
while (1)
{
if ( ( pid = mywaitpid (-1, &status) ) == child )
if ( ( pid = mywait (&status) ) == child )
return (WTERMSIG (status) == SIGINT) ? 0 : 1;
if (pid < 0) break;
}
@ -356,17 +364,27 @@ static int do_rc_tty (const char *path)
return 0;
} /* End Function do_rc_tty */
static int process_path ( const char *path, int (*func) (const char *path) )
static int process_path (const char *path, int (*func) (const char *path),
int ignore_dangling_symlink)
{
struct stat statbuf;
DIR *dp;
struct dirent *de;
if (stat (path, &statbuf) != 0)
if (lstat (path, &statbuf) != 0)
{
err (_ ("stat of path failed\n") );
err (_ ("lstat of path failed\n") );
return 1;
}
if ( S_ISLNK (statbuf.st_mode) )
{
if (stat (path, &statbuf) != 0)
{
if ( (errno == ENOENT) && ignore_dangling_symlink ) return 0;
err (_ ("stat of path failed\n") );
return 1;
}
}
if ( !( statbuf.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH) ) ) return 0;
if ( !S_ISDIR (statbuf.st_mode) ) return (*func) (path);
if ( ( dp = opendir (path) ) == NULL )
@ -382,7 +400,7 @@ static int process_path ( const char *path, int (*func) (const char *path) )
if (de->d_name[0] == '.') continue;
retval = sprintf (newpath, "%s/%s", path, de->d_name);
if (newpath[retval - 1] == '~') continue; /* Common mistake */
if ( ( retval = process_path (newpath, func) ) ) return retval;
if ( ( retval = process_path (newpath, func, 1) ) ) return retval;
}
closedir (dp);
return 0;
@ -545,11 +563,8 @@ static void read_inittab (void)
(void) strcpy(inittab[i].line, buf);
(void) strtok(inittab[i].line, ":");
(void) strncpy(inittab[i].tty, inittab[i].line, 10);
inittab[i].tty[9] = 0;
(void) strncpy(inittab[i].termcap,
strtok((char *)0, ":"), 30);
inittab[i].termcap[29] = 0;
xstrncpy(inittab[i].tty, inittab[i].line, 10);
xstrncpy(inittab[i].termcap, strtok((char *)0, ":"), 30);
getty = strtok((char *)0, ":");
(void) strtok(getty, " \t\n");
@ -566,10 +581,8 @@ static void read_inittab (void)
err(_("no TERM or cannot stat tty\n"));
} else {
/* is it a console tty? */
if(major(stb.st_rdev) == 4 && minor(stb.st_rdev) < 64) {
strncpy(inittab[i].termcap, termenv, 30);
inittab[i].termcap[29] = 0;
}
if(major(stb.st_rdev) == 4 && minor(stb.st_rdev) < 64)
xstrncpy(inittab[i].termcap, termenv, 30);
}
#endif
@ -752,40 +765,40 @@ static void show_scripts (FILE *fp, const struct script_struct *script,
static const char *get_path (const char *file);
static pid_t mywaitpid (pid_t pid, int *status)
static pid_t mywait (int *status)
/* [RETURNS] The pid for a process to be reaped, 0 if no process is to be
reaped, and less than 0 if the boot scripts appear to have finished.
*/
{
int ival;
sigset_t ss_new, ss_old;
pid_t pid;
sigset_t ss;
long buffer[COMMAND_SIZE / sizeof (long)];
struct command_struct *command = (struct command_struct *) buffer;
if (initctl_fd < 0) return waitpid (pid, status, 0);
if (status == NULL) status = &ival;
if ( ( pid = waitpid (pid, status, WNOHANG) ) > 0 )
if (initctl_fd < 0) return wait (status);
/* Some magic to avoid races which can result in lost signals */
command->command = -1;
if ( sigsetjmp (jmp_env, 1) )
{ /* Jump from signal handler */
do_longjmp = 0;
process_command (command);
return 0;
}
sigemptyset (&ss); /* Block SIGCHLD so wait status cannot be lost */
sigaddset (&ss, SIGCHLD);
sigprocmask (SIG_BLOCK, &ss, NULL);
if ( ( pid = waitpid (-1, status, WNOHANG) ) > 0 )
{
sigprocmask (SIG_UNBLOCK, &ss, NULL);
return process_pidstat (pid, *status);
}
/* Some magic to avoid races */
command->command = -1;
sigemptyset (&ss_new);
sigaddset (&ss_new, SIGCHLD);
sigprocmask (SIG_BLOCK, &ss_new, &ss_old);
ival = sigsetjmp (jmp_env, 0);
sigprocmask (SIG_SETMASK, &ss_old, NULL);
if (ival == 0) do_longjmp = 1;
else
{
do_longjmp = 0;
if (command->command < 0) return 0;
}
if (command->command < 0) read (initctl_fd, buffer, COMMAND_SIZE);
do_longjmp = 1; /* After this, SIGCHLD will cause a jump backwards */
sigprocmask (SIG_UNBLOCK, &ss, NULL);
read (initctl_fd, buffer, COMMAND_SIZE);
do_longjmp = 0;
process_command (command);
return 0;
} /* End Function mywaitpid */
} /* End Function mywait */
static pid_t process_pidstat (pid_t pid, int status)
/* [RETURNS] The pid for a process to be reaped, 0 if no process is to be
@ -978,7 +991,7 @@ static int run_command (const char *file, const char *name, pid_t pid)
script = find_script_byname (name, &starting_list, &service);
if (script == NULL)
service = find_service_in_list (name, unavailable_services);
if (script == NULL)
if (service == NULL)
{
int i;
char txt[1024];
@ -988,24 +1001,13 @@ static int run_command (const char *file, const char *name, pid_t pid)
if (needer != NULL) free (needer);
return SIG_FAILED;
}
service = calloc (1, strlen (name) + sizeof *service);
if (service == NULL)
{
service = calloc (1, strlen (name) + sizeof *service);
if (service == NULL)
{
free (script);
return SIG_FAILED;
}
strcpy (service->name, name);
}
else /* Unhook service from unavailable list */
{
if (service->prev == NULL) unavailable_services = service->next;
else service->prev->next = service->next;
if (service->next != NULL) service->next->prev = service->prev;
service->prev = NULL;
service->next = NULL;
free (script);
return SIG_FAILED;
}
strcpy (service->name, name);
switch ( script->pid = fork () )
{
case 0: /* Child */
@ -1063,6 +1065,7 @@ static struct script_struct *find_script_byname (const char *name,
return (script);
}
}
if (service != NULL) *service = NULL;
return NULL;
} /* End Function find_script_byname */
@ -1121,6 +1124,7 @@ static void handle_nonworking (struct script_struct *script)
next = service->next;
if (provider == NULL)
{
service->prev = NULL;
service->next = unavailable_services;
if (unavailable_services != NULL)
unavailable_services->prev = service;
@ -1180,7 +1184,7 @@ static const char *get_path (const char *file)
p2 = p1 + strlen (p1);
strncpy (path, p1, p2 - p1);
path[p2 - p1] = '/';
strcat (path + (p2 - p1) + 1, file);
strcpy (path + (p2 - p1) + 1, file);
if (*p2 == ':') ++p2;
if (access (path, X_OK) == 0) return path;
}

View file

@ -34,7 +34,7 @@
*
*/
/* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
/* 1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
* Sun Mar 21 1999 - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* - fixed strerr(errno) in gettext calls

View file

@ -38,7 +38,7 @@
*
* Martin Schulze's patches adapted to Util-Linux by Nicolai Langfeldt.
*
* 1999-02-22 Arkadiusz Mikiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Mikiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
* Sun Mar 21 1999 - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* - fixed strerr(errno) in gettext calls
@ -64,6 +64,7 @@ static char version_string[] = "vipw 1.4";
#include <unistd.h>
#include "setpwnam.h"
#include "xstrncpy.h"
#include "nls.h"
#define FILENAMELEN 67
@ -132,13 +133,6 @@ pw_lock(void) {
* that users can't get at the encrypted passwords while editing.
* Open should allow flock'ing the file; see 4.4BSD. XXX
*/
lockfd = open(orig_file, O_RDONLY, 0);
if (lockfd < 0) {
(void)fprintf(stderr, "%s: %s: %s\n",
progname, orig_file, strerror(errno));
exit(1);
}
#if 0 /* flock()ing is superfluous here, with the ptmp/ptmptmp system. */
if (flock(lockfd, LOCK_EX|LOCK_NB)) {
(void)fprintf(stderr,
@ -169,6 +163,16 @@ pw_lock(void) {
}
exit(1);
}
lockfd = open(orig_file, O_RDONLY, 0);
if (lockfd < 0) {
(void)fprintf(stderr, "%s: %s: %s\n",
progname, orig_file, strerror(errno));
unlink(tmp_file);
exit(1);
}
copyfile(lockfd, fd);
(void)close(lockfd);
(void)close(fd);
@ -253,9 +257,28 @@ pw_error(name, err, eval)
exit(eval);
}
static void
edit_file(void)
{
struct stat begin, end;
pw_init();
pw_lock();
if (stat(tmp_file, &begin))
pw_error(tmp_file, 1, 1);
pw_edit(0);
if (stat(tmp_file, &end))
pw_error(tmp_file, 1, 1);
if (begin.st_mtime == end.st_mtime) {
(void)fprintf(stderr, _("%s: no changes made\n"), progname);
pw_error((char *)NULL, 0, 0);
}
pw_unlock();
}
int main(int argc, char *argv[])
{
struct stat begin, end;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
@ -265,15 +288,14 @@ int main(int argc, char *argv[])
progname = (rindex(argv[0], '/')) ? rindex(argv[0], '/') + 1 : argv[0];
if (!strcmp(progname, "vigr")) {
program = VIGR;
strncpy(orig_file, GROUP_FILE, FILENAMELEN-1);
strncpy(tmp_file, GTMP_FILE, FILENAMELEN-1);
strncpy(tmptmp_file, GTMPTMP_FILE, FILENAMELEN-1);
}
else {
xstrncpy(orig_file, GROUP_FILE, sizeof(orig_file));
xstrncpy(tmp_file, GTMP_FILE, sizeof(tmp_file));
xstrncpy(tmptmp_file, GTMPTMP_FILE, sizeof(tmptmp_file));
} else {
program = VIPW;
strncpy(orig_file, PASSWD_FILE, FILENAMELEN-1);
strncpy(tmp_file, PTMP_FILE, FILENAMELEN-1);
strncpy(tmptmp_file, PTMPTMP_FILE, FILENAMELEN-1);
xstrncpy(orig_file, PASSWD_FILE, sizeof(orig_file));
xstrncpy(tmp_file, PTMP_FILE, sizeof(tmp_file));
xstrncpy(tmptmp_file, PTMPTMP_FILE, sizeof(tmptmp_file));
}
if ((argc > 1) &&
@ -282,18 +304,32 @@ int main(int argc, char *argv[])
exit(0);
}
pw_init();
pw_lock();
edit_file();
if (stat(tmp_file, &begin))
pw_error(tmp_file, 1, 1);
pw_edit(0);
if (stat(tmp_file, &end))
pw_error(tmp_file, 1, 1);
if (begin.st_mtime == end.st_mtime) {
(void)fprintf(stderr, _("%s: no changes made\n"), progname);
pw_error((char *)NULL, 0, 0);
if (program == VIGR) {
strncpy(orig_file, SGROUP_FILE, FILENAMELEN-1);
strncpy(tmp_file, SGTMP_FILE, FILENAMELEN-1);
strncpy(tmptmp_file, SGTMPTMP_FILE, FILENAMELEN-1);
} else {
strncpy(orig_file, SHADOW_FILE, FILENAMELEN-1);
strncpy(tmp_file, SPTMP_FILE, FILENAMELEN-1);
strncpy(tmptmp_file, SPTMPTMP_FILE, FILENAMELEN-1);
}
pw_unlock();
if (!access(orig_file, X_OK)) {
char response[80];
printf((program == VIGR)
? _("You are using shadow groups on this system.\n")
: _("You are using shadow passwords on this system.\n"));
printf(_("Would you like to edit %s now [y/n]? "), orig_file);
/* EOF means no */
if (fgets(response, sizeof(response), stdin)) {
if (response[0] == 'y' || response[0] == 'Y')
edit_file();
}
}
exit(0);
}

View file

@ -37,7 +37,7 @@
* This program is not related to David Wall, whose Stanford Ph.D. thesis
* is entitled "Mechanisms for Broadcast and Selective Broadcast".
*
* 1999-02-22 Arkadiusz Mikiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Mikiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*
*/
@ -53,10 +53,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <utmp.h>
#include "nls.h"
#include "xstrncpy.h"
#include "ttymsg.h"
#include "pathnames.h"
#include "carefulputc.h"
@ -115,14 +117,14 @@ usage:
iov.iov_len = mbufsize;
while((utmpptr = getutent())) {
if (!utmpptr->ut_name[0] ||
!strncmp(utmpptr->ut_name, IGNOREUSER, sizeof(utmpptr->ut_name)))
!strncmp(utmpptr->ut_name, IGNOREUSER,
sizeof(utmpptr->ut_name)))
continue;
#ifdef USER_PROCESS
if (utmpptr->ut_type != USER_PROCESS)
continue;
#endif
strncpy(line, utmpptr->ut_line, sizeof(utmpptr->ut_line));
line[sizeof(utmpptr->ut_line)-1] = '\0';
xstrncpy(line, utmpptr->ut_line, sizeof(utmpptr->ut_line));
if ((p = ttymsg(&iov, 1, line, 60*5)) != NULL)
(void)fprintf(stderr, "%s: %s\n", progname, p);
}

View file

@ -21,7 +21,7 @@ BIN= kill
USRBIN= cal chkdupexe ddate logger look mcookie \
namei rename script whereis write
MAYBE= reset setterm tsort
MAYBE= reset setterm
ifeq "$(HAVE_RESET)" "no"
USRBIN:=$(USRBIN) reset
@ -33,11 +33,6 @@ USRBIN:=$(USRBIN) setterm
MAN1:=$(MAN1) setterm.1
endif
ifeq "$(HAVE_TSORT)" "no"
USRBIN:=$(USRBIN) tsort
MAN1:=$(MAN1) tsort.1
endif
# For script only
LIBPTY=
ifeq "$(HAVE_OPENPTY)" "yes"

View file

@ -36,7 +36,7 @@
/* 1999-02-01 Jean-Francois Bignolles: added option '-m' to display
* monday as the first day of the week.
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*
* 2000-09-01 Michael Charles Pruznick <dummy@netwiz.net>

View file

@ -26,7 +26,7 @@
59 Bcy, 3161: PRAISE_BOB and KILL_BOB options split, other minor
changes.
1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
- added Native Language Support
2000-03-17 Burt Holzman <bnh@iname.com>

5
misc-utils/flushb.c Normal file
View file

@ -0,0 +1,5 @@
/*
* Some people submit a utility flushb.c.
* However, it is useless, BLKFLSBUF is already part of blockdev,
* so that "flushb device" is the same as "blockdev --flushbufs device".
*/

View file

@ -5,64 +5,83 @@
.SH NAME
kill \- terminate a process
.SH SYNOPSIS
.BR "kill" " [ \-s signal | \-p ] " " [ -a ] " "pid ..."
.BI "kill [ \-s " signal " | \-p ] [ \-a ] [ \-\- ] " "pid ..."
.br
.B "kill -l [ signal ]"
.BI "kill -l [ " signal " ]"
.SH DESCRIPTION
The command
.B kill
sends the specified signal to the specified process. If no signal is
specified, the TERM signal is sent. The TERM signal will kill processes
which do not catch this signal. For other processes, if may be necessary
to use the KILL (9) signal, since this signal cannot be caught.
Most modern shells have a builtin kill function.
sends the specified signal to the specified process or process group.
If no signal is specified, the TERM signal is sent. The TERM signal
will kill processes which do not catch this signal. For other processes,
it may be necessary to use the KILL (9) signal, since this signal cannot
be caught.
.PP
Most modern shells have a builtin kill function, with a usage rather similar
to that of the command described here. The `-a' and `-p' options,
and the possibility to specify pids by command name is a local extension.
.SH OPTIONS
.TP
.BR "pid ..."
.IR pid ...
Specify the list of processes that
.B kill
should signal. Each
.I pid
can be one of four things. A
.I "process name"
in which case processes called that will be signaled.
can be one of five things:
.RS
.TP
.I n
where
.I n
is larger than 0. The process with pid
.I n
will be signaled.
.I -1
in which case all processes from MAX_INT to 2 will be signaled,
as allowed by the issuing user.
.I -n
.TP
.B 0
All processes in the current process group are signaled.
.TP
.B -1
All processes with pid larger than 1 will be signaled.
.TP
.BI - n
where
.I n
is larger than 1, in which case processes in process group
is larger than 1.
All processes in process group
.I n
are signaled. IFF a negative argument is given the signal
.I must
be specified first, otherwise it will be taken as the signal to send.
are signaled. When an argument of the form `-n' is given,
and it is meant to denote a process group,
either the signal must be specified first, or the argument must be preceded
by a `--' option, otherwise it will be taken as the signal to send.
.TP
.BR \-s
.I commandname
All processes invoked using that name will be signaled.
.RE
.TP
.BI \-s " signal"
Specify the signal to send.
The signal may be given as a signal name or number.
.TP
.BR \-p
Specify that
.B kill
should only print the process id
.I (pid)
of the named process, and should not send it a signal.
.TP
.BR \-l
.B \-l
Print a list of signal names. These are found in
.I /usr/include/linux/signal.h
.TP
.B \-a
Do not restrict the commandname-to-pid conversion to processes
with the same uid as the present process.
.TP
.B \-p
Specify that
.B kill
should only print the process id (pid)
of the named processes, and not send any signals.
.SH "SEE ALSO"
.BR bash (1),
.BR tcsh (1),
.BR kill (2),
.BR sigvec (2)
.BR sigvec (2),
.BR signal (7)
.SH AUTHOR
Taken from BSD 4.4. The ability to translate process names to process
ids was added by Salvatore Valente <svalente@mit.edu>.

View file

@ -35,7 +35,7 @@
* modifications (c) salvatore valente <svalente@mit.edu>
* may be used / modified / distributed under the same terms as the original.
*
* 1999-02-22 Arkadiusz Mikiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Mikiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*
* 1999-11-13 aeb Accept signal numers 128+s.
@ -149,12 +149,12 @@ int kill_verbose (char *procname, int pid, int sig);
extern int *get_pids (char *, int);
char *whoami;
static char *progname;
int main (int argc, char *argv[])
{
int errors, numsig, pid;
char *ep, *arg, *progname, *p;
char *ep, *arg, *p;
int do_pid, do_kill, check_all;
int *pids, *ip;
@ -166,9 +166,8 @@ int main (int argc, char *argv[])
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
whoami = mybasename (*argv);
numsig = SIGTERM;
do_pid = (! strcmp (whoami, "pid"));
do_pid = (! strcmp (progname, "pid")); /* Yecch */
do_kill = 0;
check_all = 0;
@ -184,9 +183,6 @@ int main (int argc, char *argv[])
argc--, argv++;
break;
}
if (! strcmp (arg, "-u")) {
return usage (0);
}
if (! strcmp (arg, "-v") || ! strcmp (arg, "-V") ||
! strcmp (arg, "--version")) {
printf(_("%s from %s\n"), progname, util_linux_version);
@ -207,7 +203,7 @@ int main (int argc, char *argv[])
/* argc == 2, accept "kill -l $?" */
arg = argv[1];
if ((numsig = arg_to_signum (arg, 1)) < 0) {
fprintf (stderr, _("%s: unknown signal %s\n"), whoami, arg);
fprintf (stderr, _("%s: unknown signal %s\n"), progname, arg);
return 1;
}
printsig (numsig);
@ -238,6 +234,7 @@ int main (int argc, char *argv[])
so it's probably something like -HUP, or -1/-n
try to deal with it.
-n could be signal n, or pid -n (i.e. process group n).
In case of doubt POSIX tells us to assume a signal.
If a signal has been parsed, assume it's a pid, break */
if (do_kill)
break;
@ -270,7 +267,7 @@ int main (int argc, char *argv[])
if (! pids) {
errors++;
fprintf (stderr, _("%s: can't find process \"%s\"\n"),
whoami, arg);
progname, arg);
continue;
}
for (ip = pids; *ip >= 0; ip++)
@ -313,7 +310,7 @@ int arg_to_signum (char *arg, int maskbit)
void nosig (char *name)
{
fprintf (stderr, _("%s: unknown signal %s; valid signals:\n"), whoami, name);
fprintf (stderr, _("%s: unknown signal %s; valid signals:\n"), progname, name);
printsignals (stderr);
}
@ -353,8 +350,8 @@ int usage (int status)
FILE *fp;
fp = (status == 0 ? stdout : stderr);
fprintf (fp, _("usage: %s [ -s signal | -p ] [ -a ] pid ...\n"), whoami);
fprintf (fp, _(" %s -l [ signal ]\n"), whoami);
fprintf (fp, _("usage: %s [ -s signal | -p ] [ -a ] pid ...\n"), progname);
fprintf (fp, _(" %s -l [ signal ]\n"), progname);
return status;
}
@ -365,7 +362,7 @@ int kill_verbose (char *procname, int pid, int sig)
return 0;
}
if (kill (pid, sig) < 0) {
fprintf (stderr, "%s ", whoami);
fprintf (stderr, "%s ", progname);
perror (procname);
return 1;
}

View file

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
* Sun Mar 21 1999 - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* - fixed strerr(errno) in gettext calls

View file

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*/
/* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
/* 1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*/

View file

@ -14,7 +14,7 @@
* gather 128 bits of random information, so the magic cookie generated
* will be considerably easier to guess than one might expect.
*
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
* 1999-03-21 aeb: Added some fragments of code from Colin Plumb.
*

View file

@ -39,7 +39,7 @@ the maximum number of symbolic links this system can have.
The program exits with a 1 status ONLY if it finds it cannot
chdir to /, or if it encounters an unknown file type.
1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
- added Native Language Support
-------------------------------------------------------------*/

View file

@ -32,7 +32,7 @@
*/
/*
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*
* 2000-07-30 Per Andreas Buer <per@linpro.no> - added "q"-option

View file

@ -16,7 +16,7 @@
*
* Converted to terminfo by Kars de Jong (jongk@cs.utwente.nl)
*
* 1999-02-22 Arkadiusz Mikiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Mikiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*
*
@ -859,17 +859,17 @@ perform_sequence(int vcterm) {
/* -snow [on|off]. Vc only. */
if (opt_snow && vcterm) {
if (opt_sn_on)
printf("%s%s%s", DCS, _("snow.on"), ST);
printf("%s%s%s", DCS, "snow.on", ST);
else
printf("%s%s%s", DCS, _("snow.off"), ST);
printf("%s%s%s", DCS, "snow.off", ST);
}
/* -softscroll [on|off]. Vc only. */
if (opt_softscroll && vcterm) {
if (opt_so_on)
printf("%s%s%s", DCS, _("softscroll.on"), ST);
printf("%s%s%s", DCS, "softscroll.on", ST);
else
printf("%s%s%s", DCS, _("softscroll.off"), ST);
printf("%s%s%s", DCS, "softscroll.off", ST);
}
#endif
@ -1165,6 +1165,7 @@ try_ioctl:
}
rows = screenbuf[0];
cols = screenbuf[1];
for (i=0; i<rows; i++) {
strncpy(buf, screenbuf+2+(cols*i), cols);
buf[cols] = '\0';

View file

@ -1,74 +0,0 @@
.\" Copyright (c) 1990 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" This manual is derived from one contributed to Berkeley by
.\" Michael Rendell of Memorial University of Newfoundland.
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)tsort.1 6.3 (Berkeley) 4/23/91
.\"
.Dd April 23, 1991
.Dt TSORT 1
.Os
.Sh NAME
.Nm tsort
.Nd topological sort of a directed graph
.Sh SYNOPSIS
.Nm tsort
.Op Ar file
.Sh DESCRIPTION
.Nm Tsort
takes a list of pairs of node names representing directed arcs in
a graph and prints the nodes in topological order on standard output.
Input is taken from the named
.Ar file ,
or from standard input if no file
is given.
.Pp
Node names in the input are separated by white space and there must be an
even number of nodes.
.Pp
Presence of a node in a graph can be represented by an arc from the node
to itself.
This is useful when a node is not connected to any other nodes.
.Pp
If the graph contains a cycle (and therefore cannot be properly sorted),
one of the arcs in the cycle is ignored and the sort continues.
Cycles are reported on standard error.
.Sh SEE ALSO
.Xr ar 1
.Sh HISTORY
A
.Nm
command appeared in
.At v7 .
This
.Nm tsort
command and manual page are derived from sources contributed to Berkeley by
Michael Rendell of Memorial University of Newfoundland.

View file

@ -1,376 +0,0 @@
/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Michael Rendell of Memorial University of Newfoundland.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
* - added Native Language Support
*/
#include <sys/types.h>
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include "nls.h"
/*
* Topological sort. Input is a list of pairs of strings seperated by
* white space (spaces, tabs, and/or newlines); strings are written to
* standard output in sorted order, one per line.
*
* usage:
* tsort [inputfile]
* If no input file is specified, standard input is read.
*
* Should be compatable with AT&T tsort HOWEVER the output is not identical
* (i.e. for most graphs there is more than one sorted order, and this tsort
* usually generates a different one then the AT&T tsort). Also, cycle
* reporting seems to be more accurate in this version (the AT&T tsort
* sometimes says a node is in a cycle when it isn't).
*
* Michael Rendell, michael@stretch.cs.mun.ca - Feb 26, '90
*/
#define HASHSIZE 53 /* doesn't need to be big */
#define NF_MARK 0x1 /* marker for cycle detection */
#define NF_ACYCLIC 0x2 /* this node is cycle free */
typedef struct node_str NODE;
struct node_str {
char *n_name; /* name of this node */
NODE **n_prevp; /* pointer to previous node's n_next */
NODE *n_next; /* next node in graph */
NODE *n_hash; /* next node in hash table */
int n_narcs; /* number of arcs in n_arcs[] */
int n_arcsize; /* size of n_arcs[] array */
NODE **n_arcs; /* array of arcs to other nodes */
int n_refcnt; /* # of arcs pointing to this node */
int n_flags; /* NF_* */
};
typedef struct _buf {
char *b_buf;
int b_bsize;
} BUF;
NODE *add_node(char *), *find_node(char *);
void add_arc(char *, char *), no_memory(void);
void remove_node(NODE *), tsort(void);
char *grow_buf(char *, int);
int find_cycle(NODE *, NODE *, int, int);
NODE *graph;
NODE *hashtable[HASHSIZE];
NODE **cycle_buf;
NODE **longest_cycle;
int
main(int argc, char **argv) {
BUF *b;
int c, n;
FILE *fp;
int bsize, nused;
BUF bufs[2];
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
if (argc < 2)
fp = stdin;
/* == becomes > in next line per Volker Meyer_zu_Bexten
<vmzb@ims.fhg.de> -- faith@cs.unc.edu, Sat Feb 4 21:25:09 1995 */
else if (argc > 2) {
(void)fprintf(stderr, _("usage: tsort [ inputfile ]\n"));
exit(1);
} else if (!(fp = fopen(argv[1], "r"))) {
(void)fprintf(stderr, "tsort: %s.\n", strerror(errno));
exit(1);
}
for (b = bufs, n = 2; --n >= 0; b++)
b->b_buf = grow_buf((char *)NULL, b->b_bsize = 1024);
/* parse input and build the graph */
for (n = 0, c = getc(fp);;) {
while (c != EOF && isspace(c))
c = getc(fp);
if (c == EOF)
break;
nused = 0;
b = &bufs[n];
bsize = b->b_bsize;
do {
b->b_buf[nused++] = c;
if (nused == bsize) {
bsize *= 2;
b->b_buf = grow_buf(b->b_buf, bsize);
}
c = getc(fp);
} while (c != EOF && !isspace(c));
b->b_buf[nused] = '\0';
b->b_bsize = bsize;
if (n)
add_arc(bufs[0].b_buf, bufs[1].b_buf);
n = !n;
}
(void)fclose(fp);
if (n) {
(void)fprintf(stderr, _("tsort: odd data count.\n"));
exit(1);
}
/* do the sort */
tsort();
return 0;
}
/* double the size of oldbuf and return a pointer to the new buffer. */
char *
grow_buf(char *bp, int size) {
if (!(bp = realloc(bp, (u_int)size)))
no_memory();
return(bp);
}
/*
* add an arc from node s1 to node s2 in the graph. If s1 or s2 are not in
* the graph, then add them.
*/
void
add_arc(char *s1, char *s2) {
NODE *n1;
NODE *n2;
int bsize;
n1 = find_node(s1);
if (!n1)
n1 = add_node(s1);
if (!strcmp(s1, s2))
return;
n2 = find_node(s2);
if (!n2)
n2 = add_node(s2);
/*
* could check to see if this arc is here already, but it isn't
* worth the bother -- there usually isn't and it doesn't hurt if
* there is (I think :-).
*/
if (n1->n_narcs == n1->n_arcsize) {
if (!n1->n_arcsize)
n1->n_arcsize = 10;
bsize = n1->n_arcsize * sizeof(*n1->n_arcs) * 2;
n1->n_arcs = (NODE **)grow_buf((char *)n1->n_arcs, bsize);
n1->n_arcsize = bsize / sizeof(*n1->n_arcs);
}
n1->n_arcs[n1->n_narcs++] = n2;
++n2->n_refcnt;
}
static int
hash_string(char *s) {
int hash, i;
for (hash = 0, i = 1; *s; s++, i++)
hash += *s * i;
return(hash % HASHSIZE);
}
/*
* find a node in the graph and return a pointer to it - returns null if not
* found.
*/
NODE *
find_node(char *name) {
NODE *n;
for (n = hashtable[hash_string(name)]; n; n = n->n_hash)
if (!strcmp(n->n_name, name))
return(n);
return((NODE *)NULL);
}
/* Add a node to the graph and return a pointer to it. */
NODE *
add_node(char *name) {
NODE *n;
int hash;
if (!(n = (NODE *)malloc(sizeof(NODE))) || !(n->n_name = strdup(name)))
no_memory();
n->n_narcs = 0;
n->n_arcsize = 0;
n->n_arcs = (NODE **)NULL;
n->n_refcnt = 0;
n->n_flags = 0;
/* add to linked list */
if ((n->n_next = graph) != NULL)
graph->n_prevp = &n->n_next;
n->n_prevp = &graph;
graph = n;
/* add to hash table */
hash = hash_string(name);
n->n_hash = hashtable[hash];
hashtable[hash] = n;
return(n);
}
/* do topological sort on graph */
void
tsort(void) {
NODE *n, *next;
int cnt;
while (graph) {
/*
* keep getting rid of simple cases until there are none left,
* if there are any nodes still in the graph, then there is
* a cycle in it.
*/
do {
for (cnt = 0, n = graph; n; n = next) {
next = n->n_next;
if (n->n_refcnt == 0) {
remove_node(n);
++cnt;
}
}
} while (graph && cnt);
if (!graph)
break;
if (!cycle_buf) {
/*
* allocate space for two cycle logs - one to be used
* as scratch space, the other to save the longest
* cycle.
*/
for (cnt = 0, n = graph; n; n = n->n_next)
++cnt;
cycle_buf =
(NODE **)malloc((u_int)sizeof(NODE *) * cnt);
longest_cycle =
(NODE **)malloc((u_int)sizeof(NODE *) * cnt);
if (!cycle_buf || !longest_cycle)
no_memory();
}
for (n = graph; n; n = n->n_next)
if (!(n->n_flags & NF_ACYCLIC)) {
if ((cnt = find_cycle(n, n, 0, 0)) != 0) {
int i;
(void)fprintf(stderr,
_("tsort: cycle in data.\n"));
for (i = 0; i < cnt; i++)
(void)fprintf(stderr,
"tsort: %s.\n", longest_cycle[i]->n_name);
remove_node(n);
break;
} else
/* to avoid further checks */
n->n_flags = NF_ACYCLIC;
}
if (!n) {
(void)fprintf(stderr,
_("tsort: internal error -- could not find cycle.\n"));
exit(1);
}
}
}
/* print node and remove from graph (does not actually free node) */
void
remove_node(NODE *n) {
NODE **np;
int i;
(void)printf("%s\n", n->n_name);
for (np = n->n_arcs, i = n->n_narcs; --i >= 0; np++)
--(*np)->n_refcnt;
n->n_narcs = 0;
*n->n_prevp = n->n_next;
if (n->n_next)
n->n_next->n_prevp = n->n_prevp;
}
/* look for the longest cycle from node from to node to. */
int
find_cycle(NODE *from, NODE *to, int longest_len, int depth) {
NODE **np;
int i, len;
/*
* avoid infinite loops and ignore portions of the graph known
* to be acyclic
*/
if (from->n_flags & (NF_MARK|NF_ACYCLIC))
return(0);
from->n_flags = NF_MARK;
for (np = from->n_arcs, i = from->n_narcs; --i >= 0; np++) {
cycle_buf[depth] = *np;
if (*np == to) {
if (depth + 1 > longest_len) {
longest_len = depth + 1;
(void)memcpy((char *)longest_cycle,
(char *)cycle_buf,
longest_len * sizeof(NODE *));
}
} else {
len = find_cycle(*np, to, longest_len, depth + 1);
if (len > longest_len)
longest_len = len;
}
}
from->n_flags &= ~NF_MARK;
return(longest_len);
}
void
no_memory(void) {
(void)fprintf(stderr, "tsort: %s.\n", strerror(ENOMEM));
exit(1);
}

View file

@ -33,7 +33,7 @@
/* *:aeb */
/* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
/* 1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*/

View file

@ -40,7 +40,7 @@
* - Added fix from David.Chapell@mail.trincoll.edu enabeling daemons
* to use write.
* - ANSIed it since I was working on it anyway.
* 1999-02-22 Arkadiusz Mikiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*
*/
@ -197,11 +197,7 @@ void search_utmp(char *user, char *tty, char *mytty, uid_t myuid)
struct utmp *uptr;
time_t bestatime, atime;
int nloggedttys, nttys, msgsok, user_is_me;
#ifdef __linux__
char atty[sizeof(u.ut_line) + 1];
#else
char atty[UT_LINESIZE + 1];
#endif
utmpname(_PATH_UTMP);
setutent();
@ -213,13 +209,8 @@ void search_utmp(char *user, char *tty, char *mytty, uid_t myuid)
memcpy(&u, uptr, sizeof(u));
if (strncmp(user, u.ut_name, sizeof(u.ut_name)) == 0) {
++nloggedttys;
#ifdef __linux__
(void)strncpy(atty, u.ut_line, sizeof(u.ut_line));
atty[sizeof(u.ut_line)] = '\0';
#else
(void)strncpy(atty, u.ut_line, UT_LINESIZE);
atty[UT_LINESIZE] = '\0';
#endif
if (term_chk(atty, &msgsok, &atime, 0))
continue; /* bad term? skip */
if (myuid && !msgsok)
@ -228,10 +219,8 @@ void search_utmp(char *user, char *tty, char *mytty, uid_t myuid)
user_is_me = 1;
continue; /* don't write to yourself */
}
#ifdef __linux__
if (u.ut_type != USER_PROCESS)
continue; /* it's not a valid entry */
#endif
++nttys;
if (atime > bestatime) {
bestatime = atime;

View file

@ -24,14 +24,10 @@ PROGS = $(SUID_PROGS) $(NOSUID_PROGS)
MAYBE = pivot_root swapoff
# comment these out if you are not compiling in NFS support
LO_OBJS = lomount.o $(LIB)/xstrncpy.o
NFS_OBJS = nfsmount.o nfsmount_xdr.o nfsmount_clnt.o
# uncomment this if you don't have libc-4.2 but do have the rpclib
GEN_FILES = nfsmount.h nfsmount_xdr.c nfsmount_clnt.c
# comment these out if you are not compiling in loop support
LO_OBJS=lomount.o
all: $(PROGS)
install: $(PROGS)
@ -58,10 +54,10 @@ umount: umount.o fstab.o sundries.o realpath.o mntent.o getusername.o \
swapon: swapon.o version.o
$(LINK) $^ -o $@
losetup.o: lomount.c
main_losetup.o: lomount.c
$(COMPILE) -DMAIN lomount.c -o $@
losetup: losetup.o
losetup: main_losetup.o $(LIB)/xstrncpy.o
$(LINK) $^ -o $@
mount.o umount.o nfsmount.o losetup.o fstab.o realpath.o sundries.o: sundries.h

View file

@ -76,9 +76,11 @@ For NFS mounts one will have <host>:<dir>, e.g., `knuth.aeb.nl:/'.
For procfs, use `proc'.
.LP
Instead of giving the device explicitly, one may indicate
the (ext2) filesystem that is to be mounted by its UUID or
the (ext2 or XFS) filesystem that is to be mounted by its UUID or
volume label (cf.
.BR e2label (8)),
.BR e2label (8)
or
.BR xfs_admin (8)),
writing LABEL=<label> or UUID=<uuid>,
e.g., `LABEL=Boot' or `UUID=3e6be9de\%-8139\%-11d1\%-9106\%-a43f08d823a6'.
This will make the system more robust: adding or removing a SCSI disk
@ -113,6 +115,10 @@ features.
a local filesystem with longer filenames, larger inodes, and lots of other
features.
.TP
.I xfs
a local filesystem with journaling, scalability and lots of other
features.
.TP
.I msdos
a local filesystem for MS-DOS partitions.
.TP

View file

@ -1,4 +1,4 @@
/* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
/* 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
* Sun Mar 21 1999 - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* - fixed strerr(errno) in gettext calls
@ -538,6 +538,16 @@ update_mtab (const char *dir, struct mntent *instead) {
}
my_endmntent (mftmp);
{ /*
* If mount is setuid and some non-root user mounts sth,
* then mtab.tmp might get the group of this user. Copy uid/gid
* from the present mtab before renaming.
*/
struct stat sbuf;
if (stat (MOUNTED, &sbuf) == 0)
chown (MOUNTED_TEMP, sbuf.st_uid, sbuf.st_gid);
}
/* rename mtemp to mtab */
if (rename (MOUNTED_TEMP, MOUNTED) < 0) {
int errsv = errno;

View file

@ -2,7 +2,7 @@
/* Added vfs mount options - aeb - 960223 */
/* Removed lomount - aeb - 960224 */
/* 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
/* 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
* Sun Mar 21 1999 - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* - fixed strerr(errno) in gettext calls
@ -27,6 +27,7 @@
#include "loop.h"
#include "lomount.h"
#include "xstrncpy.h"
#include "nls.h"
extern int verbose;
@ -217,8 +218,7 @@ set_loop (const char *device, const char *file, int offset,
*loopro = (mode == O_RDONLY);
memset (&loopinfo, 0, sizeof (loopinfo));
strncpy (loopinfo.lo_name, file, LO_NAME_SIZE);
loopinfo.lo_name[LO_NAME_SIZE - 1] = 0;
xstrncpy (loopinfo.lo_name, file, LO_NAME_SIZE);
if (encryption && (loopinfo.lo_encrypt_type = crypt_type (encryption))
< 0) {
fprintf (stderr, _("Unsupported encryption type %s\n"),
@ -233,7 +233,7 @@ set_loop (const char *device, const char *file, int offset,
* passwd etc being swapped out and left somewhere on disk.
*/
if(mlockall(MCL_CURRENT|MCL_FUTURE)) {
if(mlockall(MCL_CURRENT | MCL_FUTURE)) {
perror("memlock");
fprintf(stderr, _("Couldn't lock into memory, exiting.\n"));
exit(1);
@ -246,8 +246,7 @@ set_loop (const char *device, const char *file, int offset,
break;
case LO_CRYPT_XOR:
pass = getpass (_("Password: "));
strncpy (loopinfo.lo_encrypt_key, pass, LO_KEY_SIZE);
loopinfo.lo_encrypt_key[LO_KEY_SIZE - 1] = 0;
xstrncpy (loopinfo.lo_encrypt_key, pass, LO_KEY_SIZE);
loopinfo.lo_encrypt_key_size = strlen(loopinfo.lo_encrypt_key);
break;
case LO_CRYPT_DES:

View file

@ -1,7 +1,7 @@
/* Private version of the libc *mntent() routines. */
/* Note slightly different prototypes. */
/* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
/* 1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*/

View file

@ -95,7 +95,7 @@ prints a version string; and just
.RE
lists all mounted file systems (of type
.IR type ).
The option \-l adds the (ext2) labels in this listing.
The option \-l adds the (ext2 and XFS) labels in this listing.
See below.
.\" In fact since 2.3.99. At first the syntax was mount -t bind.
@ -280,12 +280,12 @@ command is trying to do. It can also be used to add entries for devices
that were mounted earlier with the -n option.
.TP
.B \-l
Add the ext2 labels in the mount output. Mount must have permission to
Add the ext2 and XFS labels in the mount output. Mount must have permission to
read the disk device (e.g. be suid root) for this to work.
One can set such a label
using the
One can set such a label for ext2 using the
.BR e2label (8)
utility.
utility, or for XFS using
.BR xfs_admin (8).
.TP
.B \-n
Mount without writing in
@ -323,13 +323,13 @@ These two options require the file
The argument following the
.B \-t
is used to indicate the file system type. The file system types which are
currently supported are listed in
.IR linux/fs/filesystems.c :
currently supported are:
.IR adfs ,
.IR affs ,
.IR autofs ,
.IR coda ,
.IR coherent ,
.IR cramfs ,
.IR devpts ,
.IR efs ,
.IR ext ,
@ -352,6 +352,7 @@ currently supported are listed in
.IR umsdos ,
.IR vfat ,
.IR xenix ,
.IR xfs ,
.IR xiafs .
Note that coherent, sysv and xenix are equivalent and that
.I xenix
@ -391,7 +392,8 @@ option is given, or if the
.B auto
type is specified, the superblock is probed for the filesystem type
.RI ( minix ", " ext ", " ext2 ", " xiafs ", " iso9660 ", " romfs
.RI , ufs ", " ntfs ", " qnx4 ", " bfs
.RI , ufs ", " ntfs ", " qnx4 ", " bfs ", " xfs ", " cramfs ", " hfs
.RI , hpfs ", " adfs
are supported).
If this probe fails, mount will try to read the file
.IR /etc/filesystems ,
@ -494,7 +496,7 @@ This is the default.
.B remount
Attempt to remount an already-mounted file system. This is commonly
used to change the mount flags for a file system, especially to make a
readonly file system writeable.
readonly file system writeable. It does not change device or mount point.
.TP
.B ro
Mount the file system read-only.
@ -522,7 +524,16 @@ The following options apply only to certain file systems.
We sort them by file system. They all follow the
.B \-o
flag.
.SH "Mount options for adfs"
.TP
\fBuid=\fP\fIvalue\fP and \fBgid=\fP\fIvalue\fP
Set the owner and group of the files in the file system (default: uid=gid=0).
.TP
\fBownmask=\fP\fIvalue\fP and \fBothmask=\fP\fIvalue\fP
Set the permission mask for ADFS 'owner' permissions and 'other' permissions,
respectively (default: 0700 and 0077, respectively).
See also
.IR /usr/src/linux/Documentation/filesystems/adfs.txt .
.SH "Mount options for affs"
.TP
\fBuid=\fP\fIvalue\fP and \fBgid=\fP\fIvalue\fP
@ -863,6 +874,7 @@ that it is read-only, of course).
.B norock
Disable the use of Rock Ridge extensions, even if available. Cf.\&
.BR map .
.TP
.B nojoliet
Disable the use of Microsoft Joliet extensions, even if available. Cf.\&
.BR map .
@ -1218,6 +1230,102 @@ If `uni_xlate' gets set, UTF8 gets disabled.
.SH "Mount options for xenix"
None.
.SH "Mount options for xfs"
.TP
.BI biosize= size
Sets the preferred buffered I/O size (default size is 64K).
.I size
must be expressed as the logarithm (base2) of the desired I/O size.
Valid values for this option are 14 through 16, inclusive
(i.e. 16K, 32K, and 64K bytes).
On machines with a 4K pagesize, 13 (8K bytes) is also a valid
.IR size .
The preferred buffered I/O size can also be altered on an individual
file basis using the
.BR ioctl (2)
system call.
.TP
.B dmapi " / " xdsm
Enable the DMAPI (Data Management API) event callouts.
.TP
.BI logbufs= value
Set the number of in-memory log buffers.
Valid numbers range from 2-8 inclusive.
The default value is 8 buffers for filesystems with a blocksize of 64K,
4 buffers for filesystems with a blocksize of 32K,
3 buffers for filesystems with a blocksize of 16K,
and 2 buffers for all other configurations.
Increasing the number of buffers may increase performance on
some workloads at the cost of the memory used for the
additional log buffers and their associated control structures.
.TP
.BI logbsize= value
Set the size of each in-memory log buffer.
Valid sizes are 16384 (16K) and 32768 (32K).
The default value for machines with more than 32MB of memory is 32768,
machines with less memory use 16384 by default.
.TP
\fBlogdev=\fP\fIdevice\fP and \fBrtdev=\fP\fIdevice\fP
Use an external log (metadata journal) and/or real-time device.
An XFS filesystem has up to three parts: a data section, a log section,
and a real-time section.
The real-time section is optional, and the log section can be separate
from the data section or contained within it.
Refer to
.BR xfs (5).
.TP
.B noalign
Data allocations will not be aligned at stripe unit boundaries.
.TP
.B noatime
Access timestamps are not updated when a file is read.
.TP
.B norecovery
The filesystem will be mounted without running log recovery.
If the filesystem was not cleanly unmounted, it is likely to
be inconsistent when mounted in
.B norecovery
mode.
Some files or directories may not be accessible because of this.
Filesystems mounted
.B norecovery
must be mounted read-only or the mount will fail.
.TP
.B osyncisdsync
Make writes to files opened with the O_SYNC flag set behave
as if the O_DSYNC flag had been used instead.
This can result in better performance without compromising
data safety.
However if this option is in effect, timestamp updates from
O_SYNC writes can be lost if the system crashes.
.TP
.BR quota " / " usrquota " / " uqnoenforce
User disk quota accounting enabled, and limits (optionally) enforced.
.TP
.BR grpquota " / " gqnoenforce
Group disk quota accounting enabled and limits (optionally) enforced.
.TP
\fBsunit=\fP\fIvalue\fP and \fBswidth=\fP\fIvalue\fP
Used to specify the stripe unit and width for a RAID device or a stripe
volume.
.I value
must be specified in 512-byte block units.
If this option is not specified and the filesystem was made on a stripe
volume or the stripe width or unit were specified for the RAID device at
mkfs time, then the mount system call will restore the value from the
superblock.
For filesystems that are made directly on RAID devices, these options can be
used to override the information in the superblock if the underlying disk
layout changes after the filesystem has been created.
The
.B swidth
option is required if the
.B sunit
option has been specified,
and must be a multiple of the
.B sunit
value.
.SH "Mount options for xiafs"
None. Although nothing is wrong with xiafs, it is not used much,
and is not maintained. Probably one shouldn't use it.
@ -1275,7 +1383,9 @@ temporary file
.BR umount (8),
.BR swapon (8),
.BR nfs (5),
.BR xfs (5),
.BR e2label (8),
.BR xfs_admin (8),
.BR mountd (8),
.BR nfsd (8),
.BR mke2fs (8),

View file

@ -26,7 +26,7 @@
* Improve support for noncanonical names in /etc/fstab.
* Add support for volume labels and UUIDs.
*
* 1999-02-22 Arkadiusz Mikiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Mikiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
* 1999-03-21 Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* - fixed strerr(errno) in gettext calls
@ -101,10 +101,7 @@ static int optfork = 0;
/* Add volumelabel in a listing of mounted devices (-l). */
static int list_with_volumelabel = 0;
/* Nonzero for mount --bind */
static int bind = 0;
/* Nonzero for mount {--replace|--before|--after|--over} */
/* Nonzero for mount {--bind|--replace|--before|--after|--over|--move} */
static int mounttype = 0;
/* True if ruid != euid. */
@ -341,8 +338,6 @@ parse_opts (char *opts, int *flags, char **extra_opts) {
if (readwrite)
*flags &= ~MS_RDONLY;
*flags |= mounttype;
if (bind)
*flags |= MS_BIND;
}
/* Try to build a canonical options string. */
@ -466,7 +461,7 @@ guess_fstype_and_mount (char *spec, char *node, char **type,
if (*type && strcasecmp (*type, "auto") == 0)
*type = NULL;
if (!*type && (flags & MS_BIND))
if (!*type && (flags & (MS_BIND | MS_MOVE)))
*type = "none"; /* random, but not "bind" */
if (!*type && !(flags & MS_REMOUNT)) {
@ -1092,7 +1087,7 @@ mount_one (const char *spec, const char *node, char *type, const char *opts,
/* if -a then we may be rescued by a noauto option */
}
if (type == NULL && !bind) {
if (type == NULL && !mounttype) {
if (strchr (spec, ':') != NULL) {
type = "nfs";
if (verbose)
@ -1292,6 +1287,7 @@ static struct option longopts[] = {
{ "after", 0, 0, 130 },
{ "before", 0, 0, 131 },
{ "over", 0, 0, 132 },
{ "move", 0, 0, 133 },
{ NULL, 0, 0, 0 }
};
@ -1317,11 +1313,13 @@ usage (FILE *fp, int n) {
" mount --bind olddir newdir\n"
"A device can be given by name, say /dev/hda1 or /dev/cdrom,\n"
"or by label, using -L label or by uuid, using -U uuid .\n"
"Union or stack mounts are specified using one of\n"
" --replace, --after, --before, --over\n"
"Other options: [-nfFrsvw] [-o options].\n"
"For many more details, say man 8 mount .\n"
));
/*
"Union or stack mounts are specified using one of\n"
" --replace, --after, --before, --over\n"
*/
unlock_mtab();
exit (n);
}
@ -1408,7 +1406,7 @@ main (int argc, char *argv[]) {
break;
case 128: /* bind */
++bind;
mounttype = MS_BIND;
break;
case 129: /* replace */
mounttype = MS_REPLACE;
@ -1422,6 +1420,9 @@ main (int argc, char *argv[]) {
case 132: /* over */
mounttype = MS_OVER;
break;
case 133: /* move */
mounttype = MS_MOVE;
break;
case '?':
default:
@ -1435,15 +1436,15 @@ main (int argc, char *argv[]) {
specseen = (uuid || volumelabel) ? 1 : 0; /* yes, .. i know */
if (argc+specseen == 0 && !all) {
if (options || mounttype || bind)
if (options || mounttype)
usage (stderr, EX_USAGE);
return print_all (types);
}
if (getuid () != geteuid ()) {
suid = 1;
if (types || options || readwrite || nomtab || all || fake ||
bind || mounttype || (argc + specseen) != 1)
if (types || options || readwrite || nomtab || all ||
fake || mounttype || (argc + specseen) != 1)
die (EX_USAGE, _("mount: only root can do that"));
}

View file

@ -1,7 +1,7 @@
/*
* mount_by_label.c - aeb
*
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
* 2000-01-20 James Antill <james@and.org>
* - Added error message if /proc/partitions cannot be opened

View file

@ -36,13 +36,16 @@ if we have a stack or plain mount - mount atop of it, forming a stack. */
#define MS_OVER 0x200 /* 512 */
#endif
#ifndef MS_NOATIME
#define MS_NOATIME 1024 /* Do not update access times. */
#define MS_NOATIME 0x400 /* 1024: Do not update access times. */
#endif
#ifndef MS_NODIRATIME
#define MS_NODIRATIME 2048 /* Do not update directory access times */
#define MS_NODIRATIME 0x800 /* 2048: Don't update directory access times */
#endif
#ifndef MS_BIND
#define MS_BIND 4096
#define MS_BIND 0x1000 /* 4096: Mount existing tree also elsewhere */
#endif
#ifndef MS_MOVE
#define MS_MOVE 0x2000 /* 8192: Atomically move tree */
#endif
/*
* Magic mount flag number. Has to be or-ed to the flag values.

View file

@ -17,7 +17,7 @@
* detect *fat and then assume vfat, so perhaps /etc/filesystems isnt
* so useful anymore.]
*
* 1999-02-22 Arkadiusz Mikiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Mikiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*
* Fri Dec 1 23:31:00 2000: Sepp Wijnands <mrrazz@garbage-coderz.net>
@ -175,6 +175,9 @@ fstype(const char *device) {
|| read(fd, (char *) &sb, sizeof(sb)) != sizeof(sb))
goto io_error;
/* ext2 has magic in little-endian on disk, so "swapped" is
superfluous; however, there have existed strange byteswapped
PPC ext2 systems */
if (ext2magic(sb.e2s) == EXT2_SUPER_MAGIC
|| ext2magic(sb.e2s) == EXT2_PRE_02B_MAGIC
|| ext2magic(sb.e2s) == swapped(EXT2_SUPER_MAGIC))
@ -365,39 +368,55 @@ is_in_procfs(const char *type) {
int
procfsloop(int (*mount_fn)(struct mountargs *), struct mountargs *args,
char **type) {
FILE *procfs;
char *fsname;
int ret = 1;
int errsv = 0;
char *files[2] = { ETC_FILESYSTEMS, PROC_FILESYSTEMS };
FILE *procfs;
char *fsname;
int ret = 1;
int errsv = 0;
int i;
*type = NULL;
*type = NULL;
procfs = fopen(ETC_FILESYSTEMS, "r");
if (!procfs) {
procfs = fopen(PROC_FILESYSTEMS, "r");
if (!procfs)
return 1;
}
while ((fsname = procfsnext(procfs)) != NULL) {
if (tested (fsname))
continue;
args->type = fsname;
if (verbose) {
printf(_("Trying %s\n"), fsname);
fflush(stdout);
}
if ((*mount_fn) (args) == 0) {
*type = fsname;
ret = 0;
break;
} else if (errno != EINVAL && is_in_procfs(fsname) == 1) {
*type = "guess";
ret = -1;
errsv = errno;
break;
}
}
fclose(procfs);
errno = errsv;
return ret;
/* Use PROC_FILESYSTEMS only when ETC_FILESYSTEMS does not exist.
In some cases trying a filesystem that the kernel knows about
on the wrong data will crash the kernel; in such cases
ETC_FILESYSTEMS can be used to list the filesystems that we
are allowed to try, and in the order they should be tried.
End ETC_FILESYSTEMS with a line containing a single '*' only,
if PROC_FILESYSTEMS should be tried afterwards. */
for (i=0; i<2; i++) {
procfs = fopen(files[i], "r");
if (!procfs)
continue;
while ((fsname = procfsnext(procfs)) != NULL) {
if (!strcmp(fsname, "*")) {
fclose(procfs);
goto nexti;
}
if (tested (fsname))
continue;
args->type = fsname;
if (verbose) {
printf(_("Trying %s\n"), fsname);
fflush(stdout);
}
if ((*mount_fn) (args) == 0) {
*type = fsname;
ret = 0;
break;
} else if (errno != EINVAL &&
is_in_procfs(fsname) == 1) {
*type = "guess";
ret = -1;
errsv = errno;
break;
}
}
fclose(procfs);
errno = errsv;
return ret;
nexti:;
}
return 1;
}

View file

@ -25,7 +25,7 @@ rootdev(char *p) {
char *type = "hd";
char let;
int ma, mi;
char devname[8];
char devname[32];
devno = strtoul(p, &ep, 16);
if ((ep == p+3 || ep == p+4) && (*ep == ' ' || *ep == 0)) {

View file

@ -192,6 +192,9 @@ server performance penalty but it allows two different NFS clients
to get reasonable good results when both clients are actively
writing to common filesystem on the server.
.TP 1.5i
.I nolock
Do not use locking. Do not start lockd.
.TP 1.5i
.I tcp
Mount the NFS filesystem using the TCP protocol instead of the
default UDP protocol. Many NFS severs only support UDP.

View file

@ -21,7 +21,7 @@
* Wed Oct 1 23:55:28 1997: Dick Streefland <dick_streefland@tasking.com>
* Implemented the "bg", "fg" and "retry" mount options for NFS.
*
* 1999-02-22 Arkadiusz Mikiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Mikiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*
* Modified by Olaf Kirch and Trond Myklebust for new NFS code,
@ -132,45 +132,45 @@ get_mountport(struct sockaddr_in *server_addr,
long unsigned proto,
long unsigned port)
{
struct pmaplist *pmap;
static struct pmap p = {0, 0, 0, 0};
struct pmaplist *pmap;
static struct pmap p = {0, 0, 0, 0};
server_addr->sin_port = PMAPPORT;
pmap = pmap_getmaps(server_addr);
server_addr->sin_port = PMAPPORT;
pmap = pmap_getmaps(server_addr);
if (version > MAX_NFSPROT)
version = MAX_NFSPROT;
if (!prog)
prog = MOUNTPROG;
p.pm_prog = prog;
p.pm_vers = version;
p.pm_prot = proto;
p.pm_port = port;
if (version > MAX_NFSPROT)
version = MAX_NFSPROT;
if (!prog)
prog = MOUNTPROG;
p.pm_prog = prog;
p.pm_vers = version;
p.pm_prot = proto;
p.pm_port = port;
while (pmap) {
if (pmap->pml_map.pm_prog != prog)
goto next;
if (!version && p.pm_vers > pmap->pml_map.pm_vers)
goto next;
if (version > 2 && pmap->pml_map.pm_vers != version)
goto next;
if (version && version <= 2 && pmap->pml_map.pm_vers > 2)
goto next;
if (pmap->pml_map.pm_vers > MAX_NFSPROT ||
(proto && p.pm_prot && pmap->pml_map.pm_prot != proto) ||
(port && pmap->pml_map.pm_port != port))
goto next;
memcpy(&p, &pmap->pml_map, sizeof(p));
next:
pmap = pmap->pml_next;
}
if (!p.pm_vers)
p.pm_vers = MOUNTVERS;
if (!p.pm_port)
p.pm_port = MOUNTPORT;
if (!p.pm_prot)
p.pm_prot = IPPROTO_TCP;
return &p;
while (pmap) {
if (pmap->pml_map.pm_prog != prog)
goto next;
if (!version && p.pm_vers > pmap->pml_map.pm_vers)
goto next;
if (version > 2 && pmap->pml_map.pm_vers != version)
goto next;
if (version && version <= 2 && pmap->pml_map.pm_vers > 2)
goto next;
if (pmap->pml_map.pm_vers > MAX_NFSPROT ||
(proto && p.pm_prot && pmap->pml_map.pm_prot != proto) ||
(port && pmap->pml_map.pm_port != port))
goto next;
memcpy(&p, &pmap->pml_map, sizeof(p));
next:
pmap = pmap->pml_next;
}
if (!p.pm_vers)
p.pm_vers = MOUNTVERS;
if (!p.pm_port)
p.pm_port = MOUNTPORT;
if (!p.pm_prot)
p.pm_prot = IPPROTO_TCP;
return &p;
}
int nfsmount(const char *spec, const char *node, int *flags,
@ -230,7 +230,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
mclient = NULL;
if (strlen(spec) >= sizeof(hostdir)) {
fprintf(stderr, _("mount: "
"excessively long host:dir argument\n"));
"excessively long host:dir argument\n"));
goto fail;
}
strcpy(hostdir, spec);
@ -243,11 +243,11 @@ int nfsmount(const char *spec, const char *node, int *flags,
if ((s = strchr(hostdir, ','))) {
*s = '\0';
fprintf(stderr, _("mount: warning: "
"multiple hostnames not supported\n"));
"multiple hostnames not supported\n"));
}
} else {
fprintf(stderr, _("mount: "
"directory to mount not in host:dir format\n"));
"directory to mount not in host:dir format\n"));
goto fail;
}
@ -281,7 +281,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
old_opts = "";
if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) {
fprintf(stderr, _("mount: "
"excessively long option argument\n"));
"excessively long option argument\n"));
goto fail;
}
sprintf(new_opts, "%s%saddr=%s",
@ -356,7 +356,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
mountport = val;
else if (!strcmp(opt, "mounthost"))
mounthost=xstrndup(opteq+1,
strcspn(opteq+1," \t\n\r,"));
strcspn(opteq+1," \t\n\r,"));
else if (!strcmp(opt, "mountprog"))
mountprog = val;
else if (!strcmp(opt, "mountvers"))
@ -379,12 +379,12 @@ int nfsmount(const char *spec, const char *node, int *flags,
data.namlen = val;
else
#endif
printf(_("Warning: Option namlen is not supported.\n"));
printf(_("Warning: Option namlen is not supported.\n"));
} else if (!strcmp(opt, "addr"))
/* ignore */;
else {
printf(_("unknown nfs mount parameter: "
"%s=%d\n"), opt, val);
"%s=%d\n"), opt, val);
goto fail;
}
}
@ -424,7 +424,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
} else {
if (!sloppy) {
printf(_("unknown nfs mount option: "
"%s%s\n"), val ? "" : "no", opt);
"%s%s\n"), val ? "" : "no", opt);
goto fail;
}
}
@ -469,22 +469,22 @@ int nfsmount(const char *spec, const char *node, int *flags,
#ifdef NFS_MOUNT_DEBUG
printf("rsize = %d, wsize = %d, timeo = %d, retrans = %d\n",
data.rsize, data.wsize, data.timeo, data.retrans);
data.rsize, data.wsize, data.timeo, data.retrans);
printf("acreg (min, max) = (%d, %d), acdir (min, max) = (%d, %d)\n",
data.acregmin, data.acregmax, data.acdirmin, data.acdirmax);
data.acregmin, data.acregmax, data.acdirmin, data.acdirmax);
printf("port = %d, bg = %d, retry = %d, flags = %.8x\n",
port, bg, retry, data.flags);
port, bg, retry, data.flags);
printf("mountprog = %d, mountvers = %d, nfsprog = %d, nfsvers = %d\n",
mountprog, mountvers, nfsprog, nfsvers);
mountprog, mountvers, nfsprog, nfsvers);
printf("soft = %d, intr = %d, posix = %d, nocto = %d, noac = %d\n",
(data.flags & NFS_MOUNT_SOFT) != 0,
(data.flags & NFS_MOUNT_INTR) != 0,
(data.flags & NFS_MOUNT_POSIX) != 0,
(data.flags & NFS_MOUNT_NOCTO) != 0,
(data.flags & NFS_MOUNT_NOAC) != 0);
(data.flags & NFS_MOUNT_SOFT) != 0,
(data.flags & NFS_MOUNT_INTR) != 0,
(data.flags & NFS_MOUNT_POSIX) != 0,
(data.flags & NFS_MOUNT_NOCTO) != 0,
(data.flags & NFS_MOUNT_NOAC) != 0);
#if NFS_MOUNT_VERSION >= 2
printf("tcp = %d\n",
(data.flags & NFS_MOUNT_TCP) != 0);
(data.flags & NFS_MOUNT_TCP) != 0);
#endif
#endif
@ -509,25 +509,25 @@ int nfsmount(const char *spec, const char *node, int *flags,
/* create mount deamon client */
/* See if the nfs host = mount host. */
if (mounthost) {
if (mounthost[0] >= '0' && mounthost[0] <= '9') {
mount_server_addr.sin_family = AF_INET;
mount_server_addr.sin_addr.s_addr = inet_addr(hostname);
} else {
if ((hp = gethostbyname(mounthost)) == NULL) {
fprintf(stderr, _("mount: can't get address for %s\n"),
hostname);
goto fail;
} else {
if (hp->h_length > sizeof(struct in_addr)) {
fprintf(stderr,
_("mount: got bad hp->h_length?\n"));
hp->h_length = sizeof(struct in_addr);
}
mount_server_addr.sin_family = AF_INET;
memcpy(&mount_server_addr.sin_addr,
hp->h_addr, hp->h_length);
}
}
if (mounthost[0] >= '0' && mounthost[0] <= '9') {
mount_server_addr.sin_family = AF_INET;
mount_server_addr.sin_addr.s_addr = inet_addr(hostname);
} else {
if ((hp = gethostbyname(mounthost)) == NULL) {
fprintf(stderr, _("mount: can't get address for %s\n"),
hostname);
goto fail;
} else {
if (hp->h_length > sizeof(struct in_addr)) {
fprintf(stderr,
_("mount: got bad hp->h_length?\n"));
hp->h_length = sizeof(struct in_addr);
}
mount_server_addr.sin_family = AF_INET;
memcpy(&mount_server_addr.sin_addr,
hp->h_addr, hp->h_length);
}
}
}
/*
@ -554,8 +554,10 @@ int nfsmount(const char *spec, const char *node, int *flags,
prevt = 0;
t = 30;
val = 1;
for (;;) {
if (bg && stat(node, &statbuf) == -1) {
/* no mount point yet - sleep */
if (running_bg) {
sleep(val); /* 1, 2, 4, 8, 16, 30, ... */
val *= 2;
@ -568,10 +570,10 @@ int nfsmount(const char *spec, const char *node, int *flags,
sleep(30);
pm_mnt = get_mountport(&mount_server_addr,
mountprog,
mountvers,
proto,
mountport);
mountprog,
mountvers,
proto,
mountport);
/* contact the mount daemon via TCP */
mount_server_addr.sin_port = htons(pm_mnt->pm_port);
@ -580,53 +582,60 @@ int nfsmount(const char *spec, const char *node, int *flags,
switch (pm_mnt->pm_prot) {
case IPPROTO_UDP:
mclient = clntudp_create(&mount_server_addr,
pm_mnt->pm_prog,
pm_mnt->pm_vers,
retry_timeout,
&msock);
if (mclient)
break;
mount_server_addr.sin_port = htons(pm_mnt->pm_port);
msock = RPC_ANYSOCK;
case IPPROTO_TCP:
mclient = clnttcp_create(&mount_server_addr,
pm_mnt->pm_prog,
pm_mnt->pm_vers,
&msock, 0, 0);
break;
default:
mclient = 0;
pm_mnt->pm_prog,
pm_mnt->pm_vers,
retry_timeout,
&msock);
if (mclient)
break;
mount_server_addr.sin_port = htons(pm_mnt->pm_port);
msock = RPC_ANYSOCK;
case IPPROTO_TCP:
mclient = clnttcp_create(&mount_server_addr,
pm_mnt->pm_prog,
pm_mnt->pm_vers,
&msock, 0, 0);
break;
default:
mclient = 0;
}
if (mclient) {
/* try to mount hostname:dirname */
mclient->cl_auth = authunix_create_default();
/* make pointers in xdr_mountres3 NULL so
* that xdr_array allocates memory for us
*/
memset(&status, 0, sizeof(status));
/* make pointers in xdr_mountres3 NULL so
* that xdr_array allocates memory for us
*/
memset(&status, 0, sizeof(status));
if (pm_mnt->pm_vers == 3)
clnt_stat = clnt_call(mclient, MOUNTPROC3_MNT,
(xdrproc_t) xdr_dirpath,
(caddr_t) &dirname,
(xdrproc_t) xdr_mountres3,
(caddr_t) &status,
total_timeout);
else
clnt_stat = clnt_call(mclient, MOUNTPROC_MNT,
(xdrproc_t) xdr_dirpath,
(caddr_t) &dirname,
(xdrproc_t) xdr_fhstatus,
(caddr_t) &status,
total_timeout);
if (pm_mnt->pm_vers == 3)
clnt_stat = clnt_call(mclient,
MOUNTPROC3_MNT,
(xdrproc_t) xdr_dirpath,
(caddr_t) &dirname,
(xdrproc_t) xdr_mountres3,
(caddr_t) &status,
total_timeout);
else
clnt_stat = clnt_call(mclient,
MOUNTPROC_MNT,
(xdrproc_t) xdr_dirpath,
(caddr_t) &dirname,
(xdrproc_t) xdr_fhstatus,
(caddr_t) &status,
total_timeout);
if (clnt_stat == RPC_SUCCESS)
break; /* we're done */
#if 0
/* errno? who sets errno? */
/* this fragment breaks bg mounting */
if (errno != ECONNREFUSED) {
clnt_perror(mclient, "mount");
goto fail; /* don't retry */
}
#endif
if (!running_bg && prevt == 0)
clnt_perror(mclient, "mount");
auth_destroy(mclient->cl_auth);
@ -639,6 +648,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
}
prevt = t;
}
if (!bg)
goto fail;
if (!running_bg) {
@ -713,7 +723,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
if (port == 0) {
server_addr.sin_port = PMAPPORT;
port = pmap_getport(&server_addr, nfsprog, nfsvers,
tcp ? IPPROTO_TCP : IPPROTO_UDP);
tcp ? IPPROTO_TCP : IPPROTO_UDP);
if (port == 0)
port = NFS_PORT;
#ifdef NFS_MOUNT_DEBUG
@ -725,11 +735,11 @@ int nfsmount(const char *spec, const char *node, int *flags,
printf(_("using port %d for nfs deamon\n"), port);
#endif
server_addr.sin_port = htons(port);
/*
* connect() the socket for kernels 1.3.10 and below only,
* to avoid problems with multihomed hosts.
* --Swen
*/
/*
* connect() the socket for kernels 1.3.10 and below only,
* to avoid problems with multihomed hosts.
* --Swen
*/
if (linux_version_code() <= 66314
&& connect(fsock, (struct sockaddr *) &server_addr,
sizeof (server_addr)) < 0) {
@ -752,7 +762,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
/* abort */
fail:
fail:
if (msock != -1) {
if (mclient) {
auth_destroy(mclient->cl_auth);

View file

@ -4,7 +4,7 @@
*
* added fcntl locking by Kjetil T. (kjetilho@math.uio.no) - aeb, 950927
*
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*
*/

View file

@ -3,7 +3,7 @@
* swapon.c,v 1.1.1.1 1993/11/18 08:40:51 jrs Exp
* Added '-s' (Summary option) <Vincent.Renardias@waw.com> 02/1997.
*
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
* 1999-02-22 Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
* Sun Mar 21 1999 - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* - fixed strerr(errno) in gettext calls

View file

@ -52,7 +52,7 @@
#include <arpa/inet.h>
#endif
#if defined(MNT_FORCE) && !defined(__sparc__) && !defined(__arm__)
#if defined(MNT_FORCE) && !defined(__sparc__) && !defined(__arm__) && !defined(__mips__)
/* Interesting ... it seems libc knows about MNT_FORCE and presumably
about umount2 as well -- need not do anything */
#else /* MNT_FORCE */
@ -378,7 +378,7 @@ umount_one_bw (const char *file, struct mntentchn *mc) {
}
/* Unmount all filesystems of type VFSTYPES found in mtab. Since we are
concurrently updating mtab after every succesful umount, we have to
concurrently updating mtab after every successful umount, we have to
slurp in the entire file before we start. This isn't too bad, because
in any case it's important to umount mtab entries in reverse order
to mount, e.g. /usr/spool before /usr. */

View file

@ -1,5 +1,5 @@
1999-02-22
Arkadiusz Miśkiewicz <misiek@misiek.eu.org>
Arkadiusz Miśkiewicz <misiek@pld.ORG.PL>
- initial release
- things work not too well, yet

View file

@ -21,8 +21,11 @@ INSTALL = install -c
INSTALL_DATA = ${INSTALL} -m 644
# Not giving an explicit path improves the chances of finding these
# On the other hand, I have both xgettext 0.10.35 (in /usr/bin) and
# /usr/openwin/bin/xgettext, and only the former can be used here..
GENCAT = gencat
MSGFMT = msgfmt -c # -c: undocumented, but useful option
MSGFMT = msgfmt
# MSGFMT = msgfmt -c # -c: undocumented, but useful option
XGETTEXT = xgettext
MSGMERGE = msgmerge

View file

@ -1,15 +1,13 @@
hwclock/cmos.c
hwclock/hwclock.c
hwclock/kd.c
hwclock/rtc.c
hwclock/shhopt.c
disk-utils/blockdev.c
disk-utils/elvtune.c
disk-utils/fdformat.c
disk-utils/fsck.minix.c
disk-utils/isosize.c
disk-utils/mkfs.bfs.c
disk-utils/mkfs.c
disk-utils/mkfs.minix.c
disk-utils/mkswap.c
disk-utils/raw.c
disk-utils/setfdprm.c
fdisk/cfdisk.c
fdisk/fdisk.c
@ -19,18 +17,28 @@ fdisk/fdisksgilabel.c
fdisk/fdisksunlabel.c
fdisk/i386_sys_types.c
fdisk/llseek.c
fdisk/partname.c
fdisk/sfdisk.c
games/banner.c
getopt-1.1.0a/getopt.c
hwclock/clock-ppc.c
hwclock/cmos.c
hwclock/hwclock.c
hwclock/kd.c
hwclock/rtc.c
hwclock/shhopt.c
lib/carefulputc.c
lib/env.c
lib/err.c
lib/my_reboot.c
lib/setproctitle.c
lib/xstrncpy.c
login-utils/agetty.c
login-utils/checktty.c
login-utils/chfn.c
login-utils/chsh.c
login-utils/cryptocard.c
login-utils/initctl.c
login-utils/islocal.c
login-utils/last.c
login-utils/login.c
@ -52,11 +60,12 @@ misc-utils/mcookie.c
misc-utils/md5.c
misc-utils/namei.c
misc-utils/procs.c
misc-utils/rename.c
misc-utils/script.c
misc-utils/setterm.c
misc-utils/tsort.c
misc-utils/whereis.c
misc-utils/write.c
mount/bind.c
mount/fstab.c
mount/getusername.c
mount/lomount.c
@ -64,7 +73,9 @@ mount/mntent.c
mount/mount.c
mount/mount_by_label.c
mount/mount_guess_fstype.c
mount/mount_guess_rootdev.c
mount/nfsmount.c
mount/pivot_root.c
mount/realpath.c
mount/sundries.c
mount/swapon.c
@ -95,4 +106,3 @@ text-utils/odsyntax.c
text-utils/parse.c
text-utils/rev.c
text-utils/ul.c
kbd/kbdrate.c

File diff suppressed because it is too large Load diff

View file

@ -40,7 +40,7 @@ msgid "Cannot open /dev/port: %s"
msgstr "/dev/port nelze otevřít: %s"
#: clock/cmos.c:577
msgid "I failed to get permission because I didnt try.\n"
msgid "I failed to get permission because I didn't try.\n"
msgstr "Jelikož jsem se nesnažil, nepodařilo se mi získat práva pro přístup.\n"
#: clock/cmos.c:580
@ -6770,22 +6770,6 @@ msgstr "nelze
msgid "%s: $TERM is not defined.\n"
msgstr "%s: proměnná TERM není nastavena.\n"
#: misc-utils/tsort.c:117
msgid "usage: tsort [ inputfile ]\n"
msgstr "Pou¾ití: tsort [ soubor ]\n"
#: misc-utils/tsort.c:154
msgid "tsort: odd data count.\n"
msgstr "tsort: lichý poèet uzlù\n"
#: misc-utils/tsort.c:305
msgid "tsort: cycle in data.\n"
msgstr "tsort: smyèka v datech.\n"
#: misc-utils/tsort.c:318
msgid "tsort: internal error -- could not find cycle.\n"
msgstr "tsort: vnitøní chyba -- smyèku nelze najít.\n"
#: misc-utils/whereis.c:155
msgid "whereis [ -sbmu ] [ -SBM dir ... -f ] name...\n"
msgstr "whereis [ -sbmu ] [ -SBM adresář ... -f ] jméno...\n"

3518
po/da.po

File diff suppressed because it is too large Load diff

View file

@ -54,7 +54,7 @@ msgstr "/dev/port konnte nicht ge
# typo in the english version: didn't
#: clock/cmos.c:577
msgid "I failed to get permission because I didnt try.\n"
msgid "I failed to get permission because I didn't try.\n"
msgstr "Keine Erlaubnis, da sie nicht angefordert wurde.\n"
#: clock/cmos.c:580
@ -6924,22 +6924,6 @@ msgstr "Lesen von %s und Ausgabe von ioctl nicht m
msgid "%s: $TERM is not defined.\n"
msgstr "%s: Die Umgebungsvariable $TERM ist nicht definiert.\n"
#: misc-utils/tsort.c:117
msgid "usage: tsort [ inputfile ]\n"
msgstr "Verwendung: tsort [ Eingabedatei ]\n"
#: misc-utils/tsort.c:154
msgid "tsort: odd data count.\n"
msgstr "tsort: ungewöhnliche Datenzählung.\n"
#: misc-utils/tsort.c:305
msgid "tsort: cycle in data.\n"
msgstr "tsort: Zyklus in den Daten.\n"
#: misc-utils/tsort.c:318
msgid "tsort: internal error -- could not find cycle.\n"
msgstr "tsort: Interner Fehler -- Zyklus wurde nicht gefunden.\n"
#: misc-utils/whereis.c:155
msgid "whereis [ -sbmu ] [ -SBM dir ... -f ] name...\n"
msgstr "whereis [ -sbmu ] [ -SBM-Verzeichnis ... -f ] Name...\n"

View file

@ -40,7 +40,7 @@ msgid "Cannot open /dev/port: %s"
msgstr "No es posible abrir /dev/port: %s"
#: clock/cmos.c:577
msgid "I failed to get permission because I didnt try.\n"
msgid "I failed to get permission because I didn't try.\n"
msgstr "No se ha podido obtener permiso porque no se ha intentado.\n"
#: clock/cmos.c:580
@ -6902,22 +6902,6 @@ msgstr "No se ha podido leer %s y no se puede efectuar vuelco de ioctl\n"
msgid "%s: $TERM is not defined.\n"
msgstr "%s: $TERM no está definido.\n"
#: misc-utils/tsort.c:117
msgid "usage: tsort [ inputfile ]\n"
msgstr "uso: tsort [ archivoentrada ]\n"
#: misc-utils/tsort.c:154
msgid "tsort: odd data count.\n"
msgstr "tsort: número de datos impar.\n"
#: misc-utils/tsort.c:305
msgid "tsort: cycle in data.\n"
msgstr "tsort: ciclo en datos.\n"
#: misc-utils/tsort.c:318
msgid "tsort: internal error -- could not find cycle.\n"
msgstr "tsort: error interno -- no se ha podido encontrar el ciclo.\n"
#: misc-utils/whereis.c:155
msgid "whereis [ -sbmu ] [ -SBM dir ... -f ] name...\n"
msgstr "whereis [ -sbmu ] [ -SBM dir ... -f ] nombre...\n"

View file

@ -48,7 +48,7 @@ msgid "Cannot open /dev/port: %s"
msgstr "Impossible d'ouvrir /dev/port : %s"
#: clock/cmos.c:577
msgid "I failed to get permission because I didnt try.\n"
msgid "I failed to get permission because I didn't try.\n"
msgstr ""
"Je n'ai pas réussi à obtenir l'autorisation parce que je n'ai pas essayé.\n"
@ -6871,22 +6871,6 @@ msgstr "Lecture de %s impossible, et ioctl dump impossible.\n"
msgid "%s: $TERM is not defined.\n"
msgstr "%s : $TERM n'est pas défini.\n"
#: misc-utils/tsort.c:117
msgid "usage: tsort [ inputfile ]\n"
msgstr "Usage : tsort [ fichier entrée ]\n"
#: misc-utils/tsort.c:154
msgid "tsort: odd data count.\n"
msgstr "tsort : total données impaires.\n"
#: misc-utils/tsort.c:305
msgid "tsort: cycle in data.\n"
msgstr "tsort : cycle des données.\n"
#: misc-utils/tsort.c:318
msgid "tsort: internal error -- could not find cycle.\n"
msgstr "tsort : erreur interne -- cycle introuvable.\n"
#: misc-utils/whereis.c:155
msgid "whereis [ -sbmu ] [ -SBM dir ... -f ] name...\n"
msgstr "whereis [ -sbmu ] [ -SBM dir ... -f ] nom...\n"

View file

@ -40,7 +40,7 @@ msgid "Cannot open /dev/port: %s"
msgstr "Impossibile aprire /dev/port: %s"
#: clock/cmos.c:577
msgid "I failed to get permission because I didnt try.\n"
msgid "I failed to get permission because I didn't try.\n"
msgstr ""
"Non sono riuscito ad ottenere l'autorizzazione perché non ho provato.\n"
@ -6885,22 +6885,6 @@ msgstr "impossibile leggere %s e impossibile eseguire ioctl sul dump\n"
msgid "%s: $TERM is not defined.\n"
msgstr "%s: $TERM non è definito.\n"
#: misc-utils/tsort.c:117
msgid "usage: tsort [ inputfile ]\n"
msgstr "utilizzo: tsort [ inputfile ]\n"
#: misc-utils/tsort.c:154
msgid "tsort: odd data count.\n"
msgstr "tsort: conteggio dati strano.\n"
#: misc-utils/tsort.c:305
msgid "tsort: cycle in data.\n"
msgstr "tsort: ciclo nei dati.\n"
#: misc-utils/tsort.c:318
msgid "tsort: internal error -- could not find cycle.\n"
msgstr "tsort: errore interno - impossibile trovare il ciclo.\n"
#: misc-utils/whereis.c:155
msgid "whereis [ -sbmu ] [ -SBM dir ... -f ] name...\n"
msgstr "whereis [ -sbmu ] [ -SBM dir ... -f ] nome...\n"

View file

@ -43,7 +43,7 @@ msgid "Cannot open /dev/port: %s"
msgstr "/dev/port を開けません: %s"
#: clock/cmos.c:577
msgid "I failed to get permission because I didnt try.\n"
msgid "I failed to get permission because I didn't try.\n"
msgstr "許可の取得を試さなかったので、許可の取得に失敗しました。\n"
#: clock/cmos.c:580
@ -6742,22 +6742,6 @@ msgstr "%s
msgid "%s: $TERM is not defined.\n"
msgstr "%s: $TERM が定義されていません。\n"
#: misc-utils/tsort.c:117
msgid "usage: tsort [ inputfile ]\n"
msgstr "使い方: tsort [ 入力ファイル ]\n"
#: misc-utils/tsort.c:154
msgid "tsort: odd data count.\n"
msgstr "tsort: 変なデータカウントです。\n"
#: misc-utils/tsort.c:305
msgid "tsort: cycle in data.\n"
msgstr "tsort: データが循環しています。\n"
#: misc-utils/tsort.c:318
msgid "tsort: internal error -- could not find cycle.\n"
msgstr "tsort: 内部エラー -- 循環を見つけられませんでした。\n"
#: misc-utils/whereis.c:155
msgid "whereis [ -sbmu ] [ -SBM dir ... -f ] name...\n"
msgstr "whereis [ -sbmu ] [ -SBM ディレクトリ ... -f ] 名前 ...\n"

Some files were not shown because too many files have changed in this diff Show more