solaris

How to detect that arrow key is pressed using C under Linux or Solaris?

戏子无情 提交于 2019-12-19 19:00:11
问题 What is the best way to detect in a C program that arrow key is pressed under Linux or Solaris? As I know there is no standard C function that can do it. I don't want to use int86 function. I need to do it in a portable way. Edit : I am asking about console applications. 回答1: You should look at the curses/ncurses library which will give you advanced screen and keyboard handling for console applications. There is a lot of documentation available for curses, which is an extensive library. There

“POSIX”是什么意思?

℡╲_俬逩灬. 提交于 2019-12-19 11:34:42
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 什么是POSIX? 我已阅读 维基百科的文章 ,每次遇到这个词时我都会阅读它。 事实是,我从来没有真正理解它是什么。 任何人都可以通过解释“对POSIX的需求”向我解释一下吗? #1楼 POSIX是操作系统的标准,应该可以更容易地编写跨平台软件。 这在Unix世界中是一个特别重要的事情。 #2楼 POSIX 是: POSIX(发音为/pɒzɪks/)或“便携式操作系统接口[用于Unix]” 1 是IEEE指定的一系列相关标准的名称,用于定义应用程序编程接口(API),以及用于软件的shell和实用程序接口虽然该标准适用于任何操作系统,但与Unix操作系统的变体兼容。 基本上,它是一组措施,通过(大多数)常见的API和实用程序来缓解开发和使用不同版本UNIX的痛苦。 有限的POSIX合规性也扩展到各种版本的Windows。 #3楼 POSIX是IEEE和The Open Group提出的一套标准,描述了理想的Unix如何运作。 程序员,用户和管理员都可以熟悉POSIX文档,并期望POSIX投诉Unix提供所有提到的标准工具。 由于每个Unix的工作方式都有所不同 - Solaris,Mac OS X,IRIX,BSD和Linux都有它们的怪癖 - POSIX对业界人士特别有用,因为它定义了一个标准的操作环境。例如

Is write() safe to be called from multiple threads simultaneously?

左心房为你撑大大i 提交于 2019-12-19 11:29:50
问题 Assuming I have opened dev/poll as mDevPoll , is it safe for me to call code like this struct pollfd tmp_pfd; tmp_pfd.fd = fd; tmp_pfd.events = POLLIN; // Write pollfd to /dev/poll write(mDevPoll, &tmp_pfd, sizeof(struct pollfd)); ...simultaneously from multiple threads, or do I need to add my own synchronisation primitive around mDevPoll ? 回答1: Solaris 10 claims to be POSIX compliant. The write() function is not among the handful of system interfaces that POSIX permits to be non-thread-safe,

Issues with CORBA communication

南笙酒味 提交于 2019-12-19 09:19:34
问题 This maybe too localized, but I am hoping someone can help me articulate my questions properly. So, we have a front end web server that communicates with a back end app server using CORBA. I have been asked to port the back end application to a LINUX box, which I did. But, in order to test it, I am trying to point the front end web server to the LINUX back end. We are using omniORB-4.1.4, and here is how the instance of the back end system is obtained: String args[] = new String[0]; System

Bash script to monitor process and sendmail if failed

折月煮酒 提交于 2019-12-19 04:14:24
问题 I realize that I can’t reliably count on ps | grep or variants to accurately tell me what PID is started. However I know what I need for interim until this problem is resolved in the next release. I have a process named Foo that is the parent, TEST1 and TEST2 are the child processes. If TEST1 and/or TEST2 dies off Foo will continue to run and will not respawn TEST1 and/or TEST2 which is needed to function properly. How do I know this because the program to restart TEST1 and/or TEST2 requires

What are possible reason for socket error EINPROGRESS in solaris?

我怕爱的太早我们不能终老 提交于 2019-12-19 02:58:06
问题 What are possible reason for socket error EINPROGRESS in Solaris? How we can check the root cause? tcp api is : connect 回答1: You have a non-blocking socket and you are calling connect() in it. Since connect() needs the 3-way handshake to happen (so a network roundtrip), it either blocks waiting for the SYN-ACK in blocking sockets, or gives you some indication that it hasn't succeded yet in non-blocking sockets. Normally, non-blocking sockets return EAGAIN/EWOULDBLOCK to tell you that they

JVM OutOfMemory error “death spiral” (not memory leak)

爱⌒轻易说出口 提交于 2019-12-18 12:13:16
问题 We have recently been migrating a number of applications from running under RedHat linux JDK1.6.0_03 to Solaris 10u8 JDK1.6.0_16 (much higher spec machines) and we have noticed what seems to be a rather pressing problem: under certain loads our JVMs get themselves into a "Death Spiral" and eventually go out of memory. Things to note: this is not a case of a memory leak . These are applications which have been running just fine (in one case for over 3 years) and the out-of-memory errors are

Computation of Cpu percentage by a single process in unix by the “top” command

坚强是说给别人听的谎言 提交于 2019-12-18 08:32:35
问题 I would like to know how does the "top" command compute the cpu percentage used by any process. I have tried reading the "psinfo" binary file in the /proc directory , but it didnt help in finding the result. Please provide any information how it can be done. Thanks in advance. 回答1: The top command computes the CPU usage using the data in the proc file system. The actual file containing the CPU usage data can vary from one platform to another. For example, in Linux it is found in /proc/<pid>

Sun Studio linking gcc libs: exceptions do not work

妖精的绣舞 提交于 2019-12-18 06:23:19
问题 I need to build an application with Sun Studio. This application uses a shared library which can only be build with Gnu C++. The shared lib has a C Interface, so that the code is callable by the Sun Compiler (this is to avoid name mangling issues, see also this question). Everything besides exception handling works fine. When an exception is thrown in the shared library, the program segfaults. This happens only when the main program is compiled using the Sun Studio Compiler. Compiling the

How to test your code on a machine with big-endian architecture?

試著忘記壹切 提交于 2019-12-18 04:35:08
问题 Both ideone.com and codepad.org have Little-Endian architechtures. I want to test my code on some machine with Big-Endian architechture (for example - Solaris - which I don't have). Is there some easy way that you know about? 回答1: Googling "big endian online emulator" lead me to PearPC. I assume that if you have the patience you can install Mandrake Linux, get gcc, and go party. 回答2: QEMU supports emulating several big-endian architectures. Note that some architectures support both