solaris

How do I know if an C program's executable is run in foreground or background?

江枫思渺然 提交于 2019-12-07 07:27:23
问题 In my C program I want to know if my executable is run in foreground like this $./a.out or like this $./a.out & 回答1: If you are the foreground job, getpgrp() == tcgetpgrp(STDOUT_FILENO) or STDIN_FILENO or STDERR_FILENO or whichever file descriptor you're attached to your controlling terminal by. (If you're not sure, open("/dev/tty") will always get you a file descriptor to your controlling terminal, if one exists.) This is what openssh does, and is a bit easier than handling SIGTTIN/SIGTTOU

expect utility is not working when executing from jenkins

陌路散爱 提交于 2019-12-07 01:32:53
问题 we have a unix script which uses expect utility for interactive execution. This script works well when we run from unix server. If we run this script from Jenkins, it is not working. Below is the script var="xxxxx" expect -c " spawn sudo cp /abcd/sjws/config/obj.conf /abcd/sjws/config/obj.conf_jenkins expect { "Password:" { send $var\r;interact } } exit " Below is the output when we run from jenkins spawn sudo cp /abcd/sjws/config/obj.conf /abcd/sjws/config/obj.conf_jenkins Password: Password

Solaris linker equivalent to the GNU LD --export-dynamic flag

自古美人都是妖i 提交于 2019-12-07 00:53:31
Like the question says: We are building on Linux using the GNU linker, and on Solaris using the solaris ld . GNU ld supports the --export-dynamic flag, which: When creating a dynamically linked executable, add all symbols to the dynamic symbol table. The dynamic symbol table is the set of symbols which are visible from dynamic objects at run time. What is the equivalent to this flag using the solaris linker? Is there an equivalent? vladr The Sun Studio linker ( ld ), by default, exports all symbols. You can find the complete reference for the Sun linker on docs.sun.com. Search for the "Linker

What's the Solaris equivalent to the BSD's 'tail -n100'?

前提是你 提交于 2019-12-06 21:08:24
问题 I've looked this up a thousand times, and I always forget it, so, here for eternity: Solaris has a bit of an awkward syntax for tail . How do I do the equivalent of BSD's tail -n N ? What I want are the last N lines from tail's input. 回答1: Just remove the "n" tail -100 回答2: Or you can use: /usr/xpg4/bin/tail which does behave like you want ( tail -n N ). xpg4 = Xopen Portability Guide Issue 4, contains binaries strictly compliant with several POSIX and other standards. The differences with

Instruct CMake to use CXX and CXXFLAGS when driving link?

廉价感情. 提交于 2019-12-06 16:34:01
We are catching link errors on Solaris with makefiles generated by CMake 3.6.2. In the testing below, we are using GCC and not SunCC. From the looks of it, CMake is applying our options inconsistently: Typical compile command [ 2%] Building CXX object CMakeFiles/cryptopp-object.dir/cpu.cpp.o /bin/c++ -fPIC -march=native -m64 -Wa,--divide -o CMakeFiles/cryptopp-object.dir/cryptlib.cpp.o -c /export/home/jwalton/cryptopp/cpu.cpp Abbreviated link command /bin/c++ CMakeFiles/cryptest.dir/bench1.cpp.o CMakeFiles/cryptest.dir/bench2.cpp.o ... CMakeFiles/cryptest.dir/fipstest.cpp.o -o cryptest.exe

Force use gcc to compile (instead of cc) in ./configure under Solaris Sparc

人盡茶涼 提交于 2019-12-06 13:56:52
I want to build fossil code on Solaris. wget http://www.fossil-scm.org/index.html/tarball/tip.tar.xz tar xf tip.tar.xz ; cd tip.tar ./configure CC=gcc CXX=g++ C=gcc BCC=gcc # no error It will cause $make cc -o bld/translate ./src/translate.c /usr/ucb/cc: language optional software package not installed $which cc /usr/ucb/cc $which gcc /usr/local/bin/gcc $which g++ /usr/local/bin/g++ I'm sure my gcc/g++ are workable. After I add a dirty hack on replace the 'BCC = cc' line of Makefilewith 'BCC = gcc' after ./configure. It compilable. But I don't know how to fix the source code. I downloaded that

declaring a vector as a class member

梦想的初衷 提交于 2019-12-06 12:10:55
问题 I have simple class in a header file: a.hh #ifndef a_hh #define a_hh class a { public: int i; a() { i = 0; } }; #endif Then i have a file: b.cc #include <iostream> #include "a.hh" using namespace std; int main(int argc, char** argv) { a obj; obj.i = 10; cout << obj.i << endl; return 0; } > Till this point everything is fine. I compile the code and it compiles fine. But as soon as i add a vector in the class: #ifndef a_hh #define a_hh class a { public: int i; vector < int > x; a() { i = 0; } }

How to reverse a string in ksh

只谈情不闲聊 提交于 2019-12-06 09:31:43
please help me with this problem, i have an array witch includes 1000 lines with number which are treated as strings and i want for all of them to reverse them one by one, my problem is how to reverse them because i have to use ksh or else with bash or something it would be so easy..... what i have now is this, but rev="$rev${copy:$y:1}" doesnt work in ksh. i=0 while [[ $i -lt 999 ]] do rev="" var=${xnumbers[$i]} copy=${var} len=${#copy} y=$(expr $len - 1) while [[ $y -ge 0 ]] do rev="$rev${copy:$y:1}" echo "y = " $y y=$(expr $y - 1) done echo "i = " $i echo "rev = " $rev #xnumbers[$i]=$(expr

Why can't I build Perl modules that load Socket.so on Solaris 10?

瘦欲@ 提交于 2019-12-06 09:05:56
I am trying to build Convert::ASN1 module but I get an error in the process. I am using Perl 5.12.0 on Solaris 10. perl Makefile.PL runs without trouble, same for make , but 'make test' throws this error: MOST CRUCIAL PART OF IT IMO: t/00prim.t ....... Can't load '/usr/local/lib/perl5/5.12.0/sun4-solari +s/auto/Socket /Socket.so' for module Socket: ld.so.1: perl5.12.0: fata +l: relocation error: file /usr/local/lib/perl5/5.12.0/sun4-solaris/au +to/Socket/Socket.so: symbol inet_aton: referenced symbol not found at + /usr/local/lib/perl5/5.12.0/XSLoader.pm line 70. Same error occured when I

How to compile C in both Linux and Solaris?

丶灬走出姿态 提交于 2019-12-06 08:10:40
I want to make a Makefile to can compile both in Linux and in Solaris. I know how to do so individually, but how can I combine both and be able to detect what kind of OS I am using? I am trying to do this for just a simple C file - but it is the name of the compiler that changes. GNU Autoconf was designed to solve this very problem: Autoconf is an extensible package of M4 macros that produce shell scripts to automatically configure software source code packages. These scripts can adapt the packages to many kinds of UNIX-like systems without manual user intervention. Autoconf creates a