From owner-freebsd-hackers@FreeBSD.ORG Mon Jan 15 01:41:42 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6CB0A16A416 for ; Mon, 15 Jan 2007 01:41:42 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.freebsd.org (Postfix) with ESMTP id 337B413C455 for ; Mon, 15 Jan 2007 01:41:42 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.6/8.13.8) id l0F1ffMm065542; Sun, 14 Jan 2007 19:41:41 -0600 (CST) (envelope-from dan) Date: Sun, 14 Jan 2007 19:41:41 -0600 From: Dan Nelson To: girish r Message-ID: <20070115014141.GG46272@dan.emsphone.com> References: <628825.38045.qm@web62001.mail.re1.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <628825.38045.qm@web62001.mail.re1.yahoo.com> X-OS: FreeBSD 6.2-PRERELEASE User-Agent: Mutt/1.5.13 (2006-08-11) Cc: freebsd-hackers@freebsd.org Subject: Re: semaphore.h does'nt include fcntl.h ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jan 2007 01:41:42 -0000 In the last episode (Jan 14), girish r said: > I am trying to use sem_open(3) but gcc complains that O_CREAT and > O_EXCL is undeclared. According to the man page only semaphore.h > needs to be included. But including fcntl.h solves the problem. Looks like a semaphore.h needs to define O_CREAT and O_EXCL (just having it include fcntl.h looks to be okay according to http://www.opengroup.org/onlinepubs/009695399/basedefs/semaphore.h.html ) > sem_t *lock = sem_open("example_lock", O_CREAT | O_EXCL, 0600, 1); > Another thing, a program with the above function call compiles but > when I execute it, it spits out "Bad system call (core dump)". > Specifically, I am trying to run this program given here: > "http://www.informit.com/articles/article.asp?p=679545&seqNum=3&rl=1". You'll need to include "options P1003_1B_SEMAPHORES" in your kernel config, or load the "sem" kernel module. -- Dan Nelson dnelson@allantgroup.com