Commit Graph

2990 Commits

Author SHA1 Message Date
Sami Kerola 78b0fdd3d7 ul.c: close files and free memory after usage
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-05-17 15:58:05 +02:00
Sami Kerola 565239b034 ul.c: code style and comment fixes
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-05-17 15:58:05 +02:00
Sami Kerola 2afa872ffc ul.c: fix compier warnings
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-05-17 15:56:30 +02:00
Sami Kerola cc319747b5 ul.c: magic constant removal
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-05-17 15:56:30 +02:00
Sami Kerola a3b761801c ul.c: use long options
This commit introduces help & version options.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-05-17 15:56:30 +02:00
Sami Kerola cdbe31fc6a ul.c: convert definition to function
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-17 15:56:22 +02:00
Karel Zak ca8e91a4bf agetty: don't use xalloc.h stuff
agetty logs errors and warnings to syslog, we shouldn't use err.h
stuff here.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-17 14:02:57 +02:00
Karel Zak 3fc62fd3a5 agetty: remove unnecessary options synonyms
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-17 13:21:45 +02:00
Karel Zak a694957a9a agetty: use a generic function for strings concatenation
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-17 13:03:52 +02:00
Karel Zak 763d7a8705 agetty: remove unnecessary space and "(void)" junk
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-17 11:36:02 +02:00
Dr. Werner Fink e85281a8ac aggety: further mingetty features
Allow the system adminstrator to provide options to the login
program.   Some changes for several layouts of the agetty
prompt like short host name or full qualified host name.
Four options enables the user to delay agetty after start,
to change the working directory, to change the root directory,
and to modified scheduling priority.

Signed-off-by: Werner Fink <werner@suse.de>
2011-05-17 11:13:19 +02:00
Werner Fink eb8e1f9f0c agetty: add an autologin feature
Add an autologin feature to agetty, that is that a user can be
automatically logged in.  For this the options of for the
login program has to used.  Make it possible to pass-through
options to the login program which requires a security check.

Signed-off-by: Werner Fink <werner@suse.de>
2011-05-17 11:13:06 +02:00
Dr. Werner Fink 1683f6bf20 agetty: better support of virtual console
Better support of virtual console due support of UTF-8 login names
provided by e.g. LDAP.  Set default size 24/80 on serial modem lines
if not found by the kernel.

Signed-off-by: Werner Fink <werner@suse.de>
2011-05-17 11:11:30 +02:00
Werner Fink 0da025da8e agetty: check virtual console for UTF-8 support
Check out a virtual console line for UTF-8 support, also skip
modem specific setups on a virtual console line.

Signed-off-by: Werner Fink <werner@suse.de>
2011-05-17 11:10:36 +02:00
Werner Fink 3aa6b68f7e agetty: proper session on the terminal line
Ensure a proper session on the terminal line, that is do a
vhangup() and become the controlling terminal.  After this
determine if the terminal line a virtual console by using
the ioctl TIOCMGET to get the status modem bits of a serial
line which is a invalid argument on a virtual console.

Signed-off-by: Werner Fink <werner@suse.de>
2011-05-17 11:10:21 +02:00
Werner Fink 729def03e1 agetty: cleanup argv parsing, utmp update, use writeall(), etc.
Next cleanup, that is split off special character parsing in do_prompt()
and parse_args(), handle name of line of virtual console and use it in
utmp update as well as the session id.  Also move the initial TERM
variable to open_tty() as we use this later in open_tty().  Use writeall()
but avoid repeat to often for EAGAIN (compare with info page of the
(g)libc, description of the macro EAGAIN).

Signed-off-by: Werner Fink <werner@suse.de>
2011-05-17 11:10:03 +02:00
Werner Fink bde20e1b2b agetty: more code cleanup
More code cleanup, that is use bit mask for eight bit option, use
modern speed_t type, split local error() into local log_err(), log_warn(),
and dolog() for fine graduated logging with syslogger.

Signed-off-by: Werner Fink <werner@suse.de>
2011-05-17 11:08:49 +02:00
Karel Zak d8a84552fb libblkid: use stuff from sysfs.h and at.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-16 20:22:52 +02:00
Karel Zak 766ab9b08d lsblk: use generic sysfs functions
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-16 20:22:52 +02:00
Karel Zak 7fe16fdaf4 lib: add generic sysfs utils
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-16 20:22:52 +02:00
Karel Zak ac8874cad3 libblkid: use cached buffers for nested PT probing
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-16 20:22:52 +02:00
Karel Zak fd9f45e158 libblkid: make whole disk probing more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-16 20:22:52 +02:00
Karel Zak 0915c58167 tests: update for recent fdisk changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-16 20:22:52 +02:00
Karel Zak ccdf9fda90 libblkid: cleanup prober initialization
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-16 20:22:52 +02:00
Karel Zak a9eef56c4a libblkid: cleanup flags
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-16 20:22:52 +02:00
Karel Zak 15dc088cad mount: remove note about obsolete volume_id library from man page
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-12 18:32:08 +02:00
John Lindgren a2e9096fe3 blkid: don't read past end of FAT32 cluster chain
When looking for a volume label on a FAT32 filesystem, blkid does not
correctly handle special cluster values in the range 0x0FFFFFF8 to
0x0FFFFFFF, which mark the last cluster in a chain. As a result, it
begins to read [what it treats as] FAT entries from past the end of the
FAT. Depending on the data read, it may then try to parse random data
from the filesystem (including user files, free space, and other
directories) as though it were part of the root directory.

Because parsing stops early when a volume label is found, the problem
only occurs on filesystems without a volume label. When it occurs, it
may result in a long sequence of lseek and read calls; on an older IDE
drive with a 2 GB FAT32 partition, this amounted to around 3 seconds of
disk I/O.

After patching, blkid stop parsing as soon as it reaches a cluster value
greater than or equal to the number of entries in the FAT.

[kzak@redhat.com: - add le32_to_cpu()]

Signed-off-by: John Lindgren <john.lindgren@tds.net>
2011-05-12 00:20:56 +02:00
Karel Zak a646661fd0 tests: add mount(8) test for fstab entries without options
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-11 17:55:10 +02:00
Karel Zak f53edda83e mount: -a segfaults when 4th field is omitted (mount options)
# echo 'tmpd /tmp/x tmpfs' >> /etc/fstab
 # mkdir /tmp/x
 # mount -a
 segfault

Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-11 17:07:55 +02:00
Davidlohr Bueso 42708f12f0 taskset: make threads aware
Add a new '-a' option to view/modify the CPU affinity for an entire
group of threads belonging to a given PID.  We create two new
functions, print_affinity() and do_taskset() for code simplification.

Example:

zeus@jilguero:~/src/util-linux/schedutils$ ./taskset -a -p 01 3142
pid 3142's current affinity mask: 2
pid 3142's new affinity mask: 1
pid 3164's current affinity mask: 2
pid 3164's new affinity mask: 1
pid 854's current affinity mask: 2
pid 854's new affinity mask: 1

[kzak@redhat.com: - clean up
                  - move variables to struct taskset]

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Tested-by: Jonathan Gonzalez <zeus@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-11 16:17:56 +02:00
Davidlohr Bueso dd29a76293 taskset: use xalloc lib
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-05-11 10:06:58 +02:00
Francesco Cosoleto 7439604895 fdisk: accept digits-space-suffix format
This is for users who are used to separate with a space numbers from units.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-05-10 14:33:33 +02:00
Davidlohr Bueso f82ce2aab1 chrt.1: fix grammar
Corrent the English grammar for the new -a option.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-05-10 14:21:33 +02:00
Francesco Cosoleto 11187bfadd fdisk: print logical partition number while adding it
[kzak@redhat.com: - merged two Francesco's patches]

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-05-10 14:13:14 +02:00
Francesco Cosoleto b25c9df7c7 fdisk: quit from partition type dialog after invalid response
This gets rid of the while() loop and fixes indentation.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-05-10 13:50:16 +02:00
Francesco Cosoleto 37b4484fe6 fdisk: add a default response for the partition type dialog
The default response is 'p' until three primary partitions are created,
then 'e'.

The original idea is from Karel Zak.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-05-10 13:50:11 +02:00
Francesco Cosoleto ffde29b2bd fdisk: change primary or extended partition type dialog
Mainly this appends a colon for the prompt, reverses order of the list,
reports the number of primary partitions used and unused.

Old version:
 Command action
    e   extended
    p   primary partition (1-4)
 p

New version:
 Partition type:
    p   primary (0 primary, 0 extended, 4 free)
    e   extended
 Select: p

Old version:
 Command action
    l   logical (5 or over)
    p   primary partition (1-4)
 l

New version:
 Partition type:
    p   primary (0 primary, 1 extended, 3 free)
    l   logical (numbered from 5)
 Select: l

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-05-10 13:50:06 +02:00
Karel Zak b152e3595c findmnt: add columns description to the --help output
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-10 12:06:39 +02:00
Karel Zak 8ed48785e1 partx: add --pairs to output in key="value" format
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-10 11:39:51 +02:00
Karel Zak 49e9fd3a0d findmnt: add --pairs to output in key="value" format
... usable in scripts, for example:

findmnt --pairs -o "SOURCE,TARGET,FSTYPE" $1 | while read line; do
        eval $line
        echo "$SOURCE is mounted on $TARGET [$FSTYPE]"
done

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-10 11:16:41 +02:00
Karel Zak d783ee0be0 findmnt: fix leak
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-10 10:39:14 +02:00
Karel Zak 6ea1bdd32c lsblk: add --pairs to output in key="value" format
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-10 10:38:29 +02:00
Karel Zak bfe695ff5b lib: [tt.c] support key="value" output format
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-10 10:37:39 +02:00
Andrea Galbusera e82810c6cf sfdisk: returns non-zero on failed BLKRRPART ioctl
Make sfdisk(8) return non-zero value on failed BLKRRPART ioctl().
This will happen for either partition table re-reads after partition
changes or on explicit use of -R switch.

The function reread_disk_partition() was changed from 'void' to 'int'
and now returns a result to let the calling functions decide to exit(1).

Signed-off-by: Andrea Galbusera <gizero@gmail.com>
2011-05-06 13:03:43 +02:00
Karel Zak fe9a226158 libblkid: ignore hfsplus superblocks with blocksize < 512
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-06 13:00:07 +02:00
Timo Warns b61b85c7d9 libblkid: validate hfs blocksize != 0
Validate that blocksize != 0 as a blocksize == 0 can cause
a division-by-zero error.

Signed-off-by: Timo Warns <warns@pre-sense.de>
2011-05-06 12:37:36 +02:00
Karel Zak 282974088a docs: update TODO file
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-05 14:56:53 +02:00
Anton V. Boyarshinov f3dd91d056 addpart: multiplication on 512 deleted
Multiplication on 512 now placed in partx/kpartx.h in '<< 9' form.
Double moutiplication causes an error.
2011-05-05 14:53:35 +02:00
Karel Zak 503cbbe1d4 chrt: allow to use --all-tasks when retrieve info
master thread:
 $ chrt --pid $(pidof firefox)

all threads:
 $ chrt --all-tasks --pid $(pidof firefox)

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-05 14:23:38 +02:00
Davidlohr Bueso 78904e7647 chrt: make threads aware
Currently this program works only with the master thread. Add a '-t'
option to propagate changes to the entire group of threads.

Example:

root@offworld:~/projects/util-linux/schedutils# ls /proc/2111/task/
2111  2112  2119  2121  2138  2139  2159  2160
root@offworld:~/projects/util-linux/schedutils# ./chrt -p 2111
pid 2111's current scheduling policy: SCHED_RR
pid 2111's current scheduling priority: 3
root@offworld:~/projects/util-linux/schedutils# ./chrt -t -p 2 2111
root@offworld:~/projects/util-linux/schedutils# ./chrt -p 2112
pid 2112's current scheduling policy: SCHED_RR
pid 2112's current scheduling priority: 2
root@offworld:~/projects/util-linux/schedutils# ./chrt -p 2111
pid 2111's current scheduling policy: SCHED_RR
pid 2111's current scheduling priority: 2

[kzak@redhat.com: - rename -t/--thread to -a/--all-tasks]

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-05 14:02:34 +02:00