Commit Graph

37 Commits

Author SHA1 Message Date
Sami Kerola 77eb13b965 setarch: reindent code
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:02 +01:00
Ruediger Meier ae2c3b5bee setarch: add generic support for setarch $(uname -m) ...
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-29 09:52:26 +02:00
Ruediger Meier f6eb160c6e setarch: add shortcut binary uname26
There are some uname26 binaries flying around. Let's make it available
everywhere.

Internal SUSE references: fate313476, sr226509

CC: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-22 09:25:12 +00:00
Ruediger Meier 34c265f01c setarch: flush output streams before exec
This fixes the following (non-deterministic) discrepancy:

$ setarch x86_64 -RFZLvXBIST3 --uname-2.6 echo success
Switching on READ_IMPLIES_EXEC.
Switching on ADDR_LIMIT_32BIT.
Switching on SHORT_INODE.
Switching on WHOLE_SECONDS.
Switching on STICKY_TIMEOUTS.
Switching on ADDR_LIMIT_3GB.
Switching on UNAME26.
success

$ setarch x86_64 -RFZLvXBIST3 --uname-2.6 echo success  &> /tmp/bla; cat /tmp/bla
success

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-22 09:41:24 +02:00
Anton Blanchard 95bf26fd68 setarch: Fix ppc64le architectures
setarch currently fails on ppc64le because it tries to
use big endian architecture names. Fix it.

Signed-off-by: Anton Blanchard <anton@samba.org>
2014-04-07 12:38:22 +02:00
Sami Kerola f29a3d1868 setarch: prefer preprocessor rather than autotools check
It seems to be pointless to spend time in ./configure phase when
preprocessor has to perform #ifndef check anyway.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-01 13:35:26 +02:00
Sami Kerola 69d00b75df setarch: clean up usage()
Requested-by: Karel Zak <kzak@redhat.com>
References: http://marc.info/?l=util-linux-ng&m=136516351523680&w=2
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-09 12:17:05 +02:00
Sami Kerola 5d1607e260 setarch: add option to list settable architectures
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-05 14:03:07 +02:00
Sami Kerola 07ff972eb6 translation: unify exec error messages
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-02-06 11:51:17 +01:00
Karel Zak 5b90f817d8 setarch: fix compiler warning [-Wmissing-prototypes]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-16 18:51:27 +02:00
Sami Kerola edf1cf0af5 setarch: disallow unknown command line options
Exit with instruction to run --help if unknown option is encountered.
Before the following example printed error, but resulted to an attempt
to run argument.

$ x86_64 -x ls

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-17 17:59:59 +02:00
Sami Kerola 50f32c363a setarch: do not use -1 as array index [cppcheck]
Negative array index does technically work, but looks awkward and
can confuse static analyser such as cppcheck.

[sys-utils/setarch.c:267]: (error) Array index -1 is out of bounds

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-09 22:51:10 +02:00
Sami Kerola efb8854f4c sys-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04 19:49:40 +02:00
Karel Zak b7fcd7ab6a setarch: minor changes to usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-27 13:26:59 +02:00
Sami Kerola b446402b79 setarch: add version printing
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-09-10 21:33:47 +02:00
Sami Kerola cf1377a431 setarch: use program_invocation_short_name
Trust that the c.h is setting program name correctly.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-09-10 19:37:37 +02:00
Sami Kerola 745627993b setarch: move options struct to function scope
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-09-10 19:37:19 +02:00
Ben Hutchings 70eebc40e2 setarch: add --uname-2.6 option for personality flag UNAME26
[kzak@redhat.com: - minor change in usage()]

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-29 11:16:25 +02:00
Karel Zak cfe2d24951 setarch: fix compiler warnings [-Wsign-compare]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-01 13:16:21 +02:00
Francesco Cosoleto c60103a9f3 fstrim, setarch: replace error() with err()
This should improve a bit the portability as error() is a GNU extension and
util-linux provides fallbacks for err.h functions.

Fix compilation with icc, broken due to a reference to `__builtin_va_arg_pack'
in error.h using the -gcc default option.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-06-08 13:09:18 +02:00
Karel Zak 6c7d5ae9a2 move struct option to .rodata
It does not make sense to have writable large arrays of "struct
option" on the stack.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-03 15:00:30 +01:00
Karel Zak 601d12fb10 rename util-linux-ng back to util-linux
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-30 11:41:59 +01:00
Karel Zak 2d281745d9 setarch: add fallback for linux/personality
setarch.c:248: error: 'ADDR_NO_RANDOMIZE' undeclared (first use in this function)
setarch.c:248: error: (Each undeclared identifier is reported only once
setarch.c:248: error: for each function it appears in.)
setarch.c:251: error: 'FDPIC_FUNCPTRS' undeclared (first use in this function)
setarch.c:257: error: 'ADDR_COMPAT_LAYOUT' undeclared (first use in this function)
setarch.c:260: error: 'READ_IMPLIES_EXEC' undeclared (first use in this function)

Linux gzp1 2.4.36.1-gzp1 #1 SMP Tue Feb 19 10:23:48 CET 2008 i686 GNU/Linux

Reported-By: Gabor Z. Papp <gzp@papp.hu>
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-05-13 14:00:39 +02:00
Dmitry V. Levin 3c52010c68 setarch: provide backwards compatibility
The getopt_long(3) use introduced by commit
8df90dec2b
broke backwards compatibility.

Old behavior:
$ i386 uname -m
i686

New behavior:
$ i386 uname -m
i386: invalid option -- m
Linux

Traditional method to fix it is to disable program arguments reordering
by prefixing getopt_long's optstring with '+' character.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-04-16 11:20:09 +02:00
Oliver Falk adf88e666a setarch: add missing alpha subarchs
Signed-off-by: Oliver Falk <oliver@linux-kernel.at>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-12-03 13:34:42 +01:00
Benno Schulenberg 2e2d3ff6a3 setarch: tweak the help text, and gettextize a forgotten message
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2007-11-06 01:09:04 +01:00
LaMont Jones 0901c3a467 setarch: fix compiler warning
NULL is not 0L.  It's (void*)0.  Passing that as a parameter to a function
that takes an unsigned long results in a warning about the lack of a cast.

Signed-off-by: LaMont Jones <lamont@debian.org>
2007-09-23 21:34:33 +02:00
Karel Zak bf928360f2 build-sys: remove hardcoded _GNU_SOURCE
We have AC_GNU_SOURCE, so we needn't any extra hardcoded _GNU_SOURCE.

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-09-20 00:57:01 +02:00
Karel Zak 8df90dec2b setarch: add long options to setarch and update manpage
Co-Author: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-09-05 17:12:18 +02:00
Karel Zak 1e322675f9 setarch: add --3gb option fot compatibility with Debian linux{32,64} command
Debian had a pre-existing linux{32,64} command which supported only
--3gb and --4gb. Adding support for those options allows setarch to
replace that package.

(Note that long options are expected for all setarch flags in the next
release.)

Signed-off-by: LaMont Jones <lamont@mmjgroup.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-08-27 23:34:08 +02:00
Karel Zak eeadb4f4cb setarch: finish adding parisc support
Signed-off-by: LaMont Jones <lamont@mmjgroup.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-08-27 23:16:28 +02:00
LaMont Jones 782e198d93 setarch: add parisc/parisc64 support
Signed-off-by: LaMont Jones <lamont@mmjgroup.com>
2007-08-27 10:47:05 +02:00
Karel Zak 8855c38d04 setarch: cleanup licensing note
Signed-off-by: Jindrich Novy <jnovy@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-08-21 10:52:02 +02:00
Balint Cristian 9e19737a08 setarch: add __alpha__ support
Signed-off-by: Balint Cristian <cbalint@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-08-21 10:00:58 +02:00
Dennis Gilmore ee7401c58e setarch: add sparc32bash alias to keep compatibility with sparc32
Signed-off-by: Dennis Gilmore <dennis@ausil.us>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-08-21 09:55:28 +02:00
Karel Zak a5b47e0a39 setarch: add NLS support
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-07-03 01:36:03 +02:00
Karel Zak 8b3a46d2b0 sys-utils: added setarch command
This patch merges setarch command to util-linux-ng code.

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-07-02 13:48:15 +02:00