From owner-freebsd-stable Sun Mar 23 1:19:12 2003 Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0602737B405 for ; Sun, 23 Mar 2003 01:19:11 -0800 (PST) Received: from web41215.mail.yahoo.com (web41215.mail.yahoo.com [66.218.93.48]) by mx1.FreeBSD.org (Postfix) with SMTP id 8A4A643F93 for ; Sun, 23 Mar 2003 01:19:10 -0800 (PST) (envelope-from stevensbsd@yahoo.com) Message-ID: <20030323091910.86987.qmail@web41215.mail.yahoo.com> Received: from [202.104.81.250] by web41215.mail.yahoo.com via HTTP; Sun, 23 Mar 2003 01:19:10 PST Date: Sun, 23 Mar 2003 01:19:10 -0800 (PST) From: Hongbo Li Subject: Posix semaphore problem To: stable@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I just run a example program from the book unp2v2 written W.Richard Stevens. The program includes a call to sem_open. The compilation was ok. But when I run it on FreeBSD 5-current(recent),the system print "Bad system call (core dumped)". The program code : #include #include #include #include #include #include #include #define FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) int main(int argc, char **argv) { int c, flags; sem_t *sem; unsigned int value; flags = O_RDWR | O_CREAT; value = 1; while ( (c = getopt(argc, argv, "ei:")) != -1) { switch (c) { case 'e': flags |= O_EXCL; break; case 'i': value = atoi(optarg); break; } } if (optind != argc - 1) { printf("usage: semcreate [ -e ] [ -i initalvalue ] "); exit(1); } if((sem = sem_open(argv[optind], flags, FILE_MODE, value))==SEM_FAILED) { perror("semaphore creation failed"); exit(1); } sem_close(sem); exit(0); } __________________________________________________ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message