Simplest way of determining process bitness on Solaris and Linux [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I'm looking for a simple and reliable way of determining the bitness of a running process using standard shell commands.
While I've seen solution for Solaris and Linux I'd like to find one solution that works for both for extra simplicity, reliability and portability.
In Linux this can be done using /proc/$PID/exe, /proc/$PID/maps, /proc/$PID/auxv for example but these methods are either not present on Solaris or cannot easily be invoked from sh.
In Solaris a way of doing this is pflags $PID however pflags is not installed on most stock Linux distributions.

On Solaris, the utility /bin/pflags will give you the information you need:
$ /bin/pflags $$ | fgrep "data model"
data model = _ILP32 flags = ORPHAN|MSACCT|MSFORK
_ILP32 is a 32-bit process, while _LP64 is a 64-bit process.
On Linux, there is nothing directly similar. You may want to check the very complete answer there: https://unix.stackexchange.com/questions/106234/determine-if-a-specific-process-is-32-or-64-bit

file /proc/<pid>/object/a.out will tell you the bitness of a Solaris process

Related

Where is the memusage command in Ubuntu? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
On my Ubuntu LTS system, I have a manpage for memusage:
$ man memusage
MEMUSAGE(1) Linux user manual MEMUSAGE(1)
NAME
memusage - profile memory usage of a program
...
Yet, when I try to run memusage, it is not found.
And searching of occurrences on my system yields this:
$ dpkg -S memusage
libc6-i386: /lib32/libmemusage.so
manpages: /usr/share/man/man1/memusage.1.gz
libc6-dbg:amd64: /usr/lib/debug/lib/x86_64-linux-gnu/libmemusage.so
libc6:i386: /lib/i386-linux-gnu/libmemusage.so
libreoffice-script-provider-bsh: /usr/lib/libreoffice/share/Scripts/beanshell/MemoryUsage/memusage.bsh
libc6:amd64: /lib/x86_64-linux-gnu/libmemusage.so
manpages: /usr/share/man/man1/memusagestat.1.gz
Why is there a manual page for memusage, but not the command itself?
Is it maybe something that is for 32-bit Ubuntu only, and not 64-bit Ubuntu?
Note: that gmemusage (as suggested by Ubuntu) is a totally different thing.
PS: Any alternatives that let's me find allocation hot-spots in my program? I'm trying to see where all my memory is going in my code.
OS: Ubuntu 18.04.4 LTS
This is a bug in Debian.
Fortunately, there is heaptrack which is exactly what you need to track memory allocations back to source code.
It will print out two lists, one sorted by allocation count, and one sorted by allocation volume. And each list entry is the callstack with source code line numbers.

why is htop command displaying a black screen [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
first I am new on linux, I was trying this windows wsl while following a tutorial, enabled it and downloaded ubuntu... like everything works fine. but when I tried to run htop it is just returning a black frozen screen. I did strace htop 2> strace_log.txt and this is the result but I have no Idea what's happening can someone please help
It's a bug caused by an incompatible glibc call involving CLOCK_REALTIME in WSL.
From bugs.launchpad.net/ubuntu/+source/htop/+bug/1871129:
The issue is happening because WSL is currently not POSIX compliant and any call to glibc that uses CLOCK_REALTIME will fail with EINVAL (-1) (such as clock_gettime() or clock_nanosleep()). It is likely that a glibc change has made this to appear (instead of the htop different version).
Related:
[WSL1] [glibc] sleep: cannot read realtime clock: Invalid argument #4898
IN short, DO USE UBUNTU 20.04 if you are using WSL1
USe 18.04 instead

How to create a ISO file from a bootloader on windows 10 64bit [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I want to write a simple OS from scratch. I found a tutorial that i want to use. One of the requirements for a setup is VFD, but VFD does not work on 64bit systems. So im now trying to find supstitutions. My one thought was to maybe try to make the code and stuff into an iso file and mount it in virtualBox, but i dont know how to make an iso file.
How do i create an iso file from sourcecode or is there a way to get VFD or equivalent wokring on 64bit windows?
I think you can create a binary file using nasm and load it as a floppy device from virtual box.
Alternatively, you can load the binary image from qemu...(at least on Linux)
I'm not an expert, but I think it should work.
I got the solution. DD for windows and imdisk.
dd if=bootloader.bin of=bootloader.flp
imdisk -a -m A: -f bootloader.flp -s 1440K

How do I make Linux run a foreign program (almost) as if native [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I read, some years ago, that you could get linux to invoke the java command to run java programs by adding a bit of linux magic, but I can't remember how to do it or where I read it.
Back then I got it working and, if I recall correctly, it was fairly easy to do; just tell linux to use java to run .jar or similar files. I believe I also got it to run powerpc binaries, through qemu, using the same technique. Naturally, you would still have to mark them as exeutable.
I am not talking running java java_program_to_run or using some shell script that will, essentially, just call the same command. Nor am I asking for a way to convert a java program to an x86 binary for any particular operating system.
It was a technique that would allow Linux to deal with exectuables that wheren't native to the system, almost, as if they where native (some simulation required).
You want to checkout binfmt. More specifically, follow the instructions for java. I realize the usual practice is to copy the details into the answer, but they're quite long and it doesn't feel right to copy-and-paste the whole thing into the answer.

Linux kernel version discrepancy [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
This is maybe a basic question.
I am relatively new to Linux and I use Fedora 20. When I run:
uname -r
command, I get
3.11.10-301.fc20.x86_64
When I run:
rpm -qa kernel
I get:
kernel-3.11.10-301.fc20.x86_64
kernel-3.13.10-200.fc20.x86_64
kernel-3.14.4-200.fc20.x86_64
Regarding this discrepancy, may I please ask some basic questions:
What are the differences between the two commands? Don't they both search for the version information of the kernel?
What causes that discrepancy?
What can I do to correct them?
Any insight would be appreciated. Thank you.
What are the differences between the two commands? Don't they both search for the version information of the kernel?
The first gives the version of the currently running kernel. The second gives the name, version, release, and arch of all kernel packages installed. Two completely different things.
What causes that discrepancy?
You can only run one kernel at a time, chosen either at boot or via kexec.
What can I do to correct them?
There is nothing wrong, and hence nothing to correct.

Resources