Questions tagged [posix]

POSIX (Portable Operating System Interface) is a set of standards defining programming APIs, a command interpreter, and common utilities for Unix-like operating systems.

POSIX (an acronym for "Portable Operating System Interface") is a family of standards that specifies the behaviour of Unix-like operating systems.

These standards define:

  • A standard operating system interface and environment
  • A programming API for the C programming language
  • The behavior of a command interpreter (or "shell")
  • The behavior of common utility programs invocable from the shell

The POSIX standards are developed by the Austin Common Standards Revision Group, a joint technical working group led by representatives from IEEE PASC, ISO/IEC JTC 1/SC 22, and The Open Group.

The current set of POSIX standards is available online.

POSIX is a trademark of the IEEE.

5973 questions
52
votes
4 answers

Distinguishing between Java threads and OS threads?

How do I distinguish running Java threads and native threads? In Linux there will be Parent process for every child process, and they say 0 is the parent of all the process, will there be a Parent thread of all the forked Java threads? How do I know…
karthi
  • 1,405
  • 2
  • 14
  • 13
51
votes
4 answers

Automatically executed functions when loading shared libraries

When loading shared libraries in Windows, LoadLibrary() call causes DllMain in library to execute for each new process and thread library attaches to, and for each process and thread library deattaches from. Is there similar mechanism for Mac OS X,…
toriningen
  • 7,196
  • 3
  • 46
  • 68
50
votes
2 answers

whoami in python

What is the best way to find out the user that a python process is running under? I could do this: name = os.popen('whoami').read() But that has to start a whole new process. os.environ["USER"] works sometimes, but sometimes that environment…
Josh Gibson
  • 21,808
  • 28
  • 67
  • 63
50
votes
1 answer

Why are sem_init(), sem_getvalue(), sem_destroy() deprecated on Mac OS X — and what replaces them?

When I compile a program using the POSIX sem_init() function, I get a compilation warning (error because I normally use -Werror) that the function has been deprecated when I compile on Mac OS X 10.10.1 (Yosemite) with GCC 4.9.1 or the version of…
Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
50
votes
5 answers

unlink vs remove in c++

What is the difference between remove and unlink functions in C++?
SyBer
  • 5,407
  • 13
  • 55
  • 64
49
votes
6 answers

Getting the highest allocated file descriptor

Is there a portable way (POSIX) to get the highest allocated file descriptor number for the current process? I know that there's a nice way to get the number on AIX, for example, but I'm looking for a portable method. The reason I'm asking is that I…
Ville Laurikari
  • 28,380
  • 7
  • 60
  • 55
49
votes
2 answers

Why & How fish does not support POSIX?

I have heard about fish that it's a friendly and out-of-box shell but also it doesn't support POSIX standard. On the other hand I read about POSIX standard (and also I tested it on my Fedora, It's amazing and out-of-box shell now I want to change…
Cy8099
  • 623
  • 1
  • 5
  • 10
49
votes
4 answers

How to check if stdin is from the terminal or a pipe in a shell script?

I am writing a POSIX shell script that may or may not receive input from stdin as in foo.sh < test.txt, non-interactively. How do I check whether there is anything on stdin, to avoid halting on while read -r line...?
l0b0
  • 55,365
  • 30
  • 138
  • 223
48
votes
9 answers

Is there a way to flush a POSIX socket?

Is there a standard call for flushing the transmit side of a POSIX socket all the way through to the remote end or does this need to be implemented as part of the user level protocol? I looked around the usual headers but couldn't find anything.
Gordon Wrigley
  • 11,015
  • 10
  • 48
  • 62
48
votes
7 answers

How can I convert a windows path to posix path using node path

I'm developing on windows, but need to know how to convert a windows path (with backslashes \) into a POSIX path with forward slashes (/)? My goal is to convert C:\repos\vue-t\tests\views\index\home.vue to…
Dominus Vilicus
  • 903
  • 2
  • 8
  • 12
48
votes
4 answers

Checking if a file is a directory or just a file

I'm writing a program to check if something is a file or is a directory. Is there a better way to do it than this? #include #include #include #include int isFile(const char* name) { DIR* directory =…
Jookia
  • 6,544
  • 13
  • 50
  • 60
48
votes
4 answers

Signals and interrupts a comparison

Based on various references, my subjective definition of signals in Linux is "The triggers that are used to notify the processes about an occurrence of a specific event.Event here may refer to a software exception.Additionally signals may also be…
Vivek Maran
  • 2,623
  • 5
  • 38
  • 52
48
votes
3 answers

Should command line options in POSIX-style operating systems be underscore style?

Should the name of command line options for a program in a POSIX-style operating system be underscore-style, like --cure_world_hunger or maybe some other style? --cureworldhunger --cure-world-hunger --cureWorldHunger What's most common? What's…
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
47
votes
5 answers

Kill Thread in Pthread Library

I use pthread_create(&thread1, &attrs, //... , //...); and need if some condition occured need to kill this thread how to kill this ?
Sajad Bahmani
  • 17,325
  • 27
  • 86
  • 108
47
votes
3 answers

NPM package 'bin' script for Windows

Cucumber.js is supplying a command-line "binary" which is a simple .js file containing a shebang instruction: #!/usr/bin/env node var Cucumber = require('../lib/cucumber'); // ... The binary is specified in package.json with the "bin" configuration…
jbpros
  • 1,637
  • 1
  • 15
  • 17