delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/03/11/05:20:37

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:date:message-id:subject:from:to
:content-type; q=dns; s=default; b=O8E9CN5E7rGeeeENq4n8ZZU8j/GRi
vhdeH4rozYl1L7oIH+iNHhqwSJNhkhKg+HsBTtwV1oSm+XjYLulEyBHl6P4KkiDb
QbmPnVJcxOisY5katdYoSdbFl1LtM3nAV52G/b0BHZPgVR6PA5DNWbz9uoKiWqzK
cRoBd69OfRqNCA=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:date:message-id:subject:from:to
:content-type; s=default; bh=IutD+vAwTeRjFP2Dgmzk7zs5swA=; b=DzO
gq4QaNWZItOSnyML3OA1fGKSpsXTl6nb2uCf1VjvKL2HHjSqm9nrK8FikjFD1XRF
s4fDeW/i+RhDctFaaLoOAFdxmOlN0GFYspLze3hX3f+1Lv1CRR4FAfK6p7hMcp4s
phBanl+8Yh7PC3azXyESNifK4qrrrWjbO8Z9BZzA=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=semaphore
X-HELO: mail-wm0-f53.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to; bh=6j1yi1hy/q8rBCMDIZQK0Ar6Y7zHYo+/iOSqGDwQeLw=; b=hiGTwy3xCFbYRQFam6F2eCDERfg0SBY8rFAx5lg5fhMdns+1mFRXkyvvW3r0MTfMna ci20Peyv8482uRQD6okcRBrdbtK2E71le4q9tjaf7L7Y7zChsKZawIWCVwRGVQpxPRYZ 7DZlyvcJwBR1WekQKKjLZux2xJ5HsHvr+TS70DTp+Bh9xKi2ZSLpL7w3UCr5kfp7v4wE 3LKj08yBTelrburIbVR50Rm08qOT94/GAK5vVdT4KZy4ZObv2qHAqMdDA7OvYH+Ua2H+ afaAApnXmunYCIQ3uyR9E4k2yx1UTXyK3mkKafrFt465vAS0ihsSvPt5mB6CCSaa9sC2 gdpQ==
X-Gm-Message-State: AD7BkJIpbg5UZpy4HaMsIRWG0gir3dZ/+MEndaSvG/hvuLXpo2ntEbbAUe1njWqUr86xQ/Z8akBI6axfPRAd6Q==
MIME-Version: 1.0
X-Received: by 10.28.63.13 with SMTP id m13mr2068866wma.55.1457691544577; Fri, 11 Mar 2016 02:19:04 -0800 (PST)
Date: Fri, 11 Mar 2016 15:49:04 +0530
Message-ID: <CAAeFwS2mbvRMkqQLuSZoAyUHLgzzijLWvLOKoWSVXeFw25PcgQ@mail.gmail.com>
Subject: SEMCTL fails with error 22
From: Meenakshi Pant <meenakshi DOT pant28 AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes

Hi,

My program creates a semaphore, but moving further the SEMCTL function
is failing with error 22 with the latest CYGWIN 2.4. The cygserver is
up.

Below is the simplified code as a test case.It fails with the same
error as my original program.

/* semtest.c - program to test semaphore */

#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
extern int errno;
#define KEY (1492)

void main()
{
   int id;

   printf("\n Semaphore Test");

union semun {
int val;
struct semid_ds *buf;
ushort * array;
} argument;

   argument.val = 0;

   id = semget(KEY, 1, 0666 | IPC_CREAT);

   if(id < 0)
   {
      printf("\n Unable to obtain semaphore %d ", errno);
      exit(0);
   }

      printf("\n Semaphore created successfully  %d ", id);
      printf("\n Value before errno = %d", errno );

   errno = 0;

   if( semctl(id, 0, SETVAL, argument) < 0)
   {
      printf("\nCannot set semaphore value.errno = %d", errno );
   }
   else
   {
      printf("Semaphore %d initialized.\n", KEY);
   }
}




Thanks

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019