Calling sem_open on Solaris as ordinary user - solaris

This call fails on Solaris with EACCES when ran as ordinary user:
sem_open(fileName.c_str(), O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO, 1);
When process is started as root, it runs fine. Is this expected behavior?
Environment:
$ uname -a
SunOS solaris 5.11 11.0 i86pc i386 i86pc
$ g++ --version
g++ (GCC) 4.5.2

At the command line try:
prctl $$
These are the system enforced resource limits your process has. Note there are
process.max-sem-ops
process.max-sem-nsems
project.max-sem-ids
These are limits that have a number, if you do not see them (or the limits are already reached) then you have to add them to your account's profile with projadd or projmod to increase them if your project already exists.
If you cannot do this (no root access) consult with your sysadmin, s/he probably has some reason for not allowing semapahore access.
Note carefully:
sempahores are kernel persistent. If you ran your code a bunch of times the sempahores you created are likely still out there.
To see existing semaphores try ipcs -as
To remove lingering sempahores that your code should have removed use ipcrm

Related

Tests for libffi fail on LFS

I am working on a Linux From Scratch project and I've run into some (potential) issues. In chapter 6.49: Libffi-3.2.1, I executed the "sed", "configure" and "make" commands successfully but when I executed "make check", it appears that every test fails:
MAKE x86_64-unknown-linux-gnu : 0 * check
...stuff...
Test run by root on Fri Jul 13 23:51:21 2018
Native configuration is x86_64-unknown-linux-gnu
=== libffi tests ===
Schedule of variations:
unix
Running target unix
...a lot of failures...
FAIL: libffi.call/va_struct3.c -W -Wall -Wno-psabi -Os (test for excess errors)
FAIL: libffi.call/va_struct3.c -W -Wall -Wno-psabi -O2 -fomit-frame-pointer (test for excess errors)
=== libffi Summary ===
# of unexpected failures 685
# of unresolved testcases 685
I've been following the book pretty closely, but maybe I missed something along the way. Should I even worry about this or should I just install it anyway and move on?
Let me know if more information is needed.
Nevermind, I solved it. I basically went back and redid everything.
I usually I copy and paste the commands from the LFS book into a bash script and run it that way (if I can get a away with it). Well, apparently I forgot to write one for the diffutils package. But this seems strange to me because I wouldn't think that missing that script would cause issues with a test that seems to use DejaGNU let alone get me that far without any troubles.
Anyway, my LFS is up and running now! 😁

Installanywhere Openjdk 1.7.0_111

i have a problem.
i'm using installanywhere for some product. (installanywhere 2014 SP1)
setting installanywhere option,
Product > JVM Settings > VM valid List : JDK_1.7+, IBM_JDK_1.7+
this option installer choose openjdk.
i'm success install in openjdk 1.7.0_65, redhat 6.x 64bit os.
but install failed in openjdk 1.7.0_111, redbat 6.x 64bit os.
error message -
===============================================================================
This Test installer (created with InstallAnywhere)
-------------------------------------------------------------------------------
Preparing CONSOLE Mode Installation...
This installer was created with an unlicensed version
of InstallAnywhere. The evaluation period has expired.
Please contact sales#flexerasoftware.com about licensing.
so, commanding [export LAX_DEBUG=true] and install.
under line debug message.
Preparing to install...
Checking for POSIX df.
Found POSIX df.
Checking tail options...
Using tail -n 1.
True location of the self extractor: /opt/Test/Test_Setup_RedHat.bin
Forcing install base (including tmp dir) to: /opt/Test/tmp
Creating installer data directory: /opt/Test/tmp/install.dir.27084
Creating installer data directory: /opt/Test/tmp/install.dir.27084/InstallerData
Gathering free-space information...
Space needed to complete the self-extraction: 16376 blocks
Available space: 242730896 blocks
Available blocks: 242730896 Needed blocks: 16376 (block = 512 bytes)
This installation does not contain a VM.
Extracting the installation resources from the installer archive...
Extracting install.zip from ./Test_Setup_RedHat.bin to /opt/Test/tmp/install.dir.27084/InstallerData/installer.zip ...
Extracting to padded done, exit code = 0
Extracting from padded to zip done, exit code = 0
Creating disk1 data directory: /opt/Test/tmp/install.dir.27084/InstallerData/Disk1
Creating instdata data directory: /opt/Test/tmp/install.dir.27084/InstallerData/Disk1/InstData
Extracting resources from ./Test_Setup_RedHat.bin to /opt/Test/tmp/install.dir.27084/InstallerData/Disk1/InstData/Resource1.zip ...
Extracting done, exit code = 0
Configuring the installer for this system's environment...
[7m========= Analyzing UNIX Environment =================================[0m
Setting UNIX (linux) flavor specifics.
Importing UNIX environment into LAX properties.
Checking for POSIX awk.
[7m========= Analyzing LAX ==============================================[0m
LAX found............................ OK.
LAX properties read.................. OK.
[7m========= Finding VM =================================================[0m
[1mValid VM types.......................... JDK_1.7+, IBM_JDK_1.7+[0m
[1mExpanded Valid VM types................. JDK_1.7+, IBM_JDK_1.7+ [0m
Found jvmspecs.properties
JVM Spec Build Option Specified Without VM
Searching without JVM specs
Searching without JVM specs
[1mWARNING! No valid lax.nl.current.vm available.[0m
/usr/xpg4/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/var/cfengine/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
[1mSearching for VMs in PATH:[0m
Looking in:............................. /usr/xpg4/bin
Looking in:............................. /usr/local/bin
Looking in:............................. /bin
Looking in:............................. /usr/bin
Found VM:............................. /usr/bin/java
Version:............................. 1.7.0_111
Looking in:............................. /usr/local/sbin
Looking in:............................. /usr/sbin
Looking in:............................. /sbin
Looking in:............................. /var/cfengine/bin
Looking in:............................. /bin
Looking in:............................. /usr/bin
Found VM:............................. /usr/bin/java
Version:............................. 1.7.0_111
Looking in:............................. /sbin
Looking in:............................. /usr/sbin
Looking in:............................. /usr/local/bin
checking: "1.7.0_111" against "JDK_1.7+,": failed (wrong version)
checking: "1.7.0_111" against "JDK_1.7+,": failed (wrong version)
checking: "1.7.0_111" against "IBM_JDK_1.7+": passed
[1m Using VM:............................. /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java[0m
[7m========= Virtual Machine Options ====================================[0m
LAX properties incorporated............. OK.
classpath............................... "/opt/Test/tmp/install.dir.27084/InstallerData:/opt/Test/tmp/install.dir.27084/InstallerData/installer.zip"
main class.............................. "com.zerog.ia.installer.Main"
.lax file path.......................... "/opt/Test/tmp/install.dir.27084/temp.lax"
user directory.......................... "/opt/Test/tmp/install.dir.27084"
stdout to............................... "console"
sterr to................................ "console"
install directory....................... ""
JIT..................................... none
option (verify)......................... off
option (verbosity)...................... none
option (garbage collection extent)...... none
option (garbage collection thread)...... none
option (native stack max size).......... none
option (java stack max size)............ none
option (java heap max size)............. 50331648
option (java heap initial size)......... 16777216
option (lax.nl.java.option.additional).. none
[7m========= Display settings ===========================================[0m
X display............................... not set
[1mWARNING: This shell's DISPLAY variable has not been set.
This installer is configured to run in GUI and will probably
fail. Try running this installer in console or silent mode,
or on another UNIX host which has the DISPLAY variable set,
if the installer unexpectedly fails.[0m
UI mode................................. gui
Launching installer...
[7m========= VM Command Line ============================================[0m
[1moptions:[0m
[7mCLASSPATH:[0m/opt/Test/tmp/install.dir.27084/InstallerData:/opt/Test/tmp/install.dir.27084/InstallerData/installer.zip:
[7m========= Forking JAVA =============================================[0m
OpenJDK 64-Bit Server VM warning: Insufficient space for shared memory file:
27084
Try using the -Djava.io.tmpdir= option to select an alternate temp location.
===============================================================================
This Test installer (created with InstallAnywhere)
-------------------------------------------------------------------------------
Preparing CONSOLE Mode Installation...
This installer was created with an unlicensed version
of InstallAnywhere. The evaluation period has expired.
Please contact sales#flexerasoftware.com about licensing.
what should i do? success running open jdk 1.7.0_65, but open jdk 1.7.0_111 failed.
CentOS 6.2 and OpenJDK1.7.0_111 running success.

SIGSEGV on memory access in Beaglebone Black (ARM) cross-compilation w/ Eclipse - Linaro

I am new to this, or better rusted (being 62).
Trying to develop on Beaglebone Black running Debian over IP using Eclipse Luna CDT and linaro tools.
I succeed in running and debugging standard helloworld.c.
Need to control GPIO fast (to connect to uncommon peripheral) but
all attempts to read or write to memory mapped registers fail.
Instruction
i = (*((volatile unsigned int *)(0x4804c130)))
which should read GPIO status register results in
Child terminated with signal = 0xb (SIGSEGV)
GDBserver exiting
logout
This is the source (hellobone.c) I compile without errors:
int main(void)
{
unsigned int i = 1;
i = (*((volatile unsigned int *)(0x4804c130))) ;
}
(I tried all variations on this pointer arithmetic)
Makefile trace: (ignore includes)
---COMPILE--- C:/hellobone/source/hellobone.c
"C:\gcc-linaro\bin\arm-linux-gnueabihf-gcc.exe" -c -o C:/hellobone/object/hellobone.o C:/hellobone/source/hellobone.c -marm -O0 -g -I. -IC:/hellobone/include
.
---LINK---
"C:\gcc-linaro\bin\arm-linux-gnueabihf-gcc.exe" -o hellobone C:/hellobone/object/hellobone.o C:/hellobone/object/tools.o C:/hellobone/object/gpio_v2.o -marm -O0 -g -I. -IC:/hellobone/include
.
The binary also crashes running as root from TTY:
root#beaglebone:~# ./hellobone
Segmentation fault
I installed Eclipse on the BBB Debian and read and write to memory works just fine. Just too slow compiling, and unstable, to be practical.
Reading memory should be doable. What am I doing wrong?
I suspect
GNU gdbserver (GDB) 7.4.1-debian
This gdbserver was configured as "arm-linux-gnueabihf"
But maybe I am missing something obvious, have not seen any post on this problem...
Really stuck. Being working on this for months now. Setting up toolchain very frustrating, nothing works as in YouTube videos..
Any help would be really appreciated
Marco
You need to mmap /dev/mem to access memory mapped peripherals through physical addresses. Easiest example / code I know does this goes by the name devmem2.
Thank you a lot, that certainly helped.
I compiled the program you gave me and it worked perfect in run mode in Eclipse, and in terminal on the remote machine.
Curiously, when running the Eclipse debugger, it crashes executing:
if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) FATAL;
I get this error message from gdbserver
Remote debugging from host 192.168.1.2
/root/hellobone: relocation error: /root/hellobone: symbol �pen, version GLIBC_2.4 not defined in file libc.so.6 with link time reference
Child exited with status 127
GDBserver exiting
Have been trying to use fopen but that gives a segmentation fault. Anyhow, I think that is a toolchain issue and not a programming issue.

Unable to install Image::ExifTool due to 'make test' hanging

I have a Netgear ReadyNAS NV+ on which I'm trying to do some things using perl.
Since the perl installation from the vendor is compiled without the uselargefiles-flag I've tried to compile/install my own version to run in parallell with the system one.
When I first tried to compile perl on the machine itself I ran into trouble as the system is lacking alot of regular system tools which prevents the Configure-script from running properly.
# ./Configure -des -Dprefix=$HOME/perl-5.16.2
First let's make sure your kit is complete. Checking...
./Configure: line 1986: split: command not found
cat: /root/dload/perl-5.16.2/UU/x??: No such file or directory
Locating common programs...
I don't know where 'comm' is, and my life depends on it.
Go find a public domain implementation or fix your PATH setting!
To get around that I installed and used this cross-compiler to build perl on another machine.
I could not figure out how to cross-compile using the standard configure-script from perl, so I used this.
After that I could just copy my new perl-folder onto the NAS and have thing like the following work:
# ~/sparc-perl-5.16.2/bin/perl -version
This is perl 5, version 16, subversion 2 (v5.16.2) built for sparc-linux
Copyright 1987-2012, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
# ~/sparc-perl-5.16.2/bin/perl -e 'print "A string!\n";'
A string!
So in some sense I feel I've been successful in my quest to get "my" perl working on the machine.
I get in trouble when I try to install extra modules though.
I've tried installing Image::ExifTool using cpanp (among others), but the installation never finishes.
Today I resorted to trying the installation manually.
wget http://search.cpan.org/CPAN/authors/id/E/EX/EXIFTOOL/Image-ExifTool-9.12.tar.gz
tar xzf Image-ExifTool-9.12.tar.gz
cd Image-ExifTool-9.12
~/sparc-perl-5.16.2/bin/perl Makefile.pl
make
All work as they're supposed to.
when I get to make test however it hangs indefinitely like so:
# make test
PERL_DL_NONLAZY=1 /root/sparc-perl-5.16.2/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/AFCP.t ...........
Looking at the running processes I think these are the ones representing the command:
# ps aux | grep per[l]
root 26187 0.5 0.7 12000 7808 pts/0 S+ 10:31 0:07 /root/sparc-perl-5.16.2/bin/perl -MExtUtils::Command::MM -e test_harness(0, 'blib/lib', 'blib/arch') t/AFCP.t t/AIFF.t t/APE.t t/ASF.t t/BigTIFF.t t/BMP.t t/CanonRaw.t t/Canon.t t/CanonVRD.t t/Casio.t t/DICOM.t t/DjVu.t t/DNG.t t/DV.t t/EXE.t t/ExifTool.t t/FLAC.t t/FlashPix.t t/Flash.t t/Font.t t/FotoStation.t t/FujiFilm.t t/Geotag.t t/GeoTiff.t t/GE.t t/GIF.t t/GIMP.t t/GPS.t t/HTML.t t/InDesign.t t/IPTC.t t/ITC.t t/Jpeg2000.t t/JVC.t t/Kodak.t t/KyoceraRaw.t t/Lang.t t/LNK.t t/M2TS.t t/Matroska.t t/MIE.t t/MIFF.t t/Minolta.t t/MP3.t t/MWG.t t/MXF.t t/Nikon.t t/Olympus.t t/OpenEXR.t t/Panasonic.t t/PDF.t t/Pentax.t t/PGF.t t/PhotoCD.t t/PhotoMechanic.t t/Photoshop.t t/PICT.t t/PNG.t t/PostScript.t t/PPM.t t/PSP.t t/QuickTime.t t/Radiance.t t/Real.t t/Ricoh.t t/RIFF.t t/RTF.t t/Sanyo.t t/Sigma.t t/Sony.t t/Unknown.t t/Vorbis.t t/Writer.t t/XMP.t t/ZIP.t
root 26189 1.7 0.0 0 0 pts/0 Z+ 10:31 0:24 [perl] <defunct>
This is completely consistent with what happens when I try the same installation using cpanp.
I guess I could just run make install and hope that it won't be to much of a problem that the test is unable to run/complete, but that makes me feel a bit uneasy. I'd much rather figure out what is wrong.
I also find it odd that the test hangs the way it does, I could accept that it fails, but that it just keeps running in a non-productive manner feels weird.
Since it is the first time I've built perl from source and the first time I've used a cross-compiler I would not be surprised to learn I've done something very wrong, any help identifying what is very welcome.
What am I doing wrong?
EDIT - compiling on the mahcine:
Figured out how to get the Configure script working natively on the machine.
Will try to build there to see if that will work better. It'll take some time though, the machine is slow.
To be able to run the configure script I needed:
GCC
apt-get install libc6-dev gcc gdb libtag1-dev uuid-dev
coreutils
apt-get install coreutils
-Dcc=gcc
./Configure -des -Dprefix=$HOME/perl-5.16.2 -Dcc=gcc
EDIT2 - compile failed:
Most shortlived success ever:
# make
`sh cflags "optimize='-O2'" perlmini.o` -DPERL_IS_MINIPERL -DPERL_EXTERNAL_GLOB perlmini.c
CCCMD = gcc -DPERL_CORE -c -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -Wall
In file included from perl.c:33:
perl.h:699: error: conflicting types for `syscall'
/usr/include/unistd.h:939: error: previous declaration of `syscall'
ake: *** [perlmini.o] Error 1
EDIT3 - testdriving fork:
Tried the following to verify that fork works as it should. I believe that the test is successful, but I've never tried fork before, so please let me know if I read the output wrong.
# cat test_forkwait.px
#!/root/sparc-perl-5.16.2/bin/perl
$pid = fork();
die if $pid < 0;
$SIG{CHLD} = sub { warn "SIGCHLD\n"; };
if($pid) {
$status = waitpid($pid, 0);
warn "wait status: $status\n";
} else {
warn "Child starting\n";
sleep 1;
warn "Child terminating\n";
}
# ./test_forkwait.px
Child starting
Child terminating
SIGCHLD
wait status: 29913
I'm a bit late with this comment, and don't have any ideas about your "make test" hang, but I wanted to point out the Image::ExifTool is pure Perl, so it does not require compilation. The install step is as simple as copying the distribution files to the proper directories.
Phil
Gave up on figuring out why the test fails. Ended up using the module anyways. Seems to work OK with my files.

Error with PAR module

I have been trying to build .exe through PAR in windows XP and
my perl version is 5.8.8.. I installed the latest PAR from PPM
I gave the following command in the command prompt,
C:\Documents and Settings\abc\Desktop\serial>pp -o serial.exe serial.pl
Set up gcc environment - 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
Program too big to fit in memory
Access is denied.
Also it throws me the following error popup..
C:\DOCUME~1\abc\LOCALS~1\Temp\parlLoYJMpa.exe is not a valid Win32 application.
Actually my script in just one line code..
I am confused...
Please help me....
Worked fine for me, but then I use pp all the time with no problem. I didn't get any "Set up gcc environment..." message, no messages at all. I'm putting this as an answer because not enough room in the comment for all this:
I did a gcc -v and got:
C:\tools\perl\tests>gcc -v
Reading specs from c:/Perl/site/lib/auto/MinGW/bin/../lib/gcc/mingw32/3.4.5/spec
s
Configured with: ../gcc-3.4.5-20060117-3/configure --with-gcc --with-gnu-ld
--with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads
--disable-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry
--disable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt
--without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter
--enable-hash-synchronization --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.5 (mingw-vista special r3)