Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 67633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:17:25+00:00 2026-05-10T19:17:25+00:00

I have two Slackware Linux systems on which the POSIX semaphore sem_open() call fails

  • 0

I have two Slackware Linux systems on which the POSIX semaphore sem_open() call fails with errno set to 38. Sample code to reproduce below (the code works fine on CentOS / RedHat).

Are there any kernel or system configuration options that could cause this? Other suggestions?

Systems with issue are Slackware 10.1.0 kernel 2.6.11 /lib/librt-2.3.4.so /lib/libpthread-0.10.so, but the same code works on the much older RedHat 9 kernel 2.4.20 /lib/librt-2.3.2.so /lib/tls/libpthread-0.29.so. (and also works on CentOS 5 kernel 2.6.18 /lib/librt-2.5.so /lib/i686/nosegneg/libpthread-2.5.so).

man sem_open suggests this errno means sem_open() is not supported by system.

#define ENOSYS          38      /* Function not implemented */ 

The sem_open() userspace is in librt which we link against dynamically and librt is present on the affected systems.

The affected system claims to support POSIX semaphores: _POSIX_SEMAPHORES is true and sysconf(_SC_SEMAPHORES) confirms this.

Thanks, Kieran

Edit 1: I’ve added more detail on the software versions in use and removed some irrelevant comments.

Edit 2: /dev/shm is mounted on the good systems and not mounted on the bad systems. Mounting it did not change the behaviour on the affected systems. I think /dev/shm is necessary too but sem_open() is failing before that, and strace supports this.

# /* Quick'n'dirty test program to illustrate sem_open failure #Run this file to auto-build test and run as a.out  # Build gcc $0 -lrt if [ $? -ne 0 ] ; then exit ; fi  # Run $( dirname $0)/a.out exit */  #include <stdio.h> #include <fcntl.h> #include <errno.h> #include <unistd.h> #include <semaphore.h>   int main(int argc, char *argv[]) {   const char *SEM_NAME = 'SHRMEM_SCXL';  /* name of mutex */  sem_t *mutex = SEM_FAILED;             /* ptr to mutex */  #ifdef _POSIX_SEMAPHORES   printf('_POSIX_SEMAPHORES %ld\n', _POSIX_SEMAPHORES); #else   puts('Undefined'); #endif   printf('sysconf %s\n', sysconf(_SC_SEMAPHORES) ? 'Yes' : 'No' );   mutex = sem_open(SEM_NAME, O_CREAT, 0666, 1);   if (mutex == SEM_FAILED) printf('Failed %d\n', errno);  else {         puts('Success - pause while you check /dev/shm ');         sleep(5);         sem_close(mutex);         sem_unlink(SEM_NAME);  } } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T19:17:26+00:00Added an answer on May 10, 2026 at 7:17 pm

    Is /dev/shm mounted? Older versions of slackware may not have mounted this filesystem at boot. From /etc/fstab:

    tmpfs  /dev/shm  tmpfs  defaults  0   0 

    Edit: That is probably not the problem after all. I think you may just need to upgrade your kernel or maybe even librt.

    Edit2: I think that for slackware 11, which I think you are using, you’ll need a kernel newer than 2.6.13 to use the NPTL threading libraries (libs in /lib/tls) which appear to be required for the sem_open to work.

    Edit3: I managed to get it to work with a slackware 11 box I have by a) mounting /dev/shm and b) setting the environment variable LD_ASSUME_KERNEL to 2.6.13 (any kernel version > 2.6.12 will work). That seems to work even though the kernel is 2.6.11.11, but other things like threads might not.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 67k
  • Answers 67k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer This is a difficult question to answer because 'open source… May 11, 2026 at 12:01 pm
  • added an answer You can get Glassfish to delete the log files, in… May 11, 2026 at 12:01 pm
  • added an answer First, ensure you have using System.Linq; at the top of… May 11, 2026 at 12:01 pm

Related Questions

I have two Slackware Linux systems on which the POSIX semaphore sem_open() call fails
I have two applications written in Java that communicate with each other using XML
I have two arrays of animals (for example). $array = array( array( 'id' =>
I have two arrays of System.Data.DataRow objects which I want to compare. The rows
I have two elements: <input a> <input b onclick=...> When b is clicked, I
I have two identical tables and need to copy rows from table to another.
I have two classes, and want to include a static instance of one class
I have two threads, one needs to poll a bunch of separate static resources
I have two spreadsheets... when one gets modified in a certain way I want
I have two webapplication, one is a simple authenticationsite which can authenticate the logged

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.