From owner-freebsd-questions Mon Sep 18 14:19:02 1995 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id OAA03050 for questions-outgoing; Mon, 18 Sep 1995 14:19:02 -0700 Received: from lucky.ca.sandia.gov (lucky.ca.sandia.gov [146.246.238.50]) by freefall.freebsd.org (8.6.12/8.6.6) with SMTP id OAA03045 for ; Mon, 18 Sep 1995 14:18:58 -0700 Received: by lucky.ca.sandia.gov id AA23402 (931110.SGI/IDA-1.4.4); Mon, 18 Sep 95 14:18:53 -0700 From: Tim Strayer Message-Id: <9509182118.AA23402@lucky.ca.sandia.gov> Subject: Shared Memory and ftok() To: questions@freebsd.org Date: Mon, 18 Sep 1995 14:18:53 -0700 (PDT) X-Mailer: ELM [version 2.4 PL23] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 1987 Sender: owner-questions@freebsd.org Precedence: bulk Hello, I am trying to use shm and ftok on FreeBSD 2.1.0. The function call "shmget()", when called, produces Bad system call (core dumped) Does shared memory exist in FreeBSD 2.1? Here's the test program I used: #include #include #include #include #include main() { int shmflg = 0606 | IPC_CREAT | IPC_EXCL; int shmid = shmget(15, 200, shmflg); if (shmid == -1) { perror("shmget"); exit(1); } printf("shmid: %d\n", shmid); } I compiled it with g++ and no other flags. This works on all of my other machines. The function call "ftok()" is supposed to create a toke to use with the SysV IPC facilities like shared memory. I have tried a simple program that calls ftok: #include #include #include main() { key_t my_key; my_key = ftok("/etc/passwd", (char)15); printf("hello: %d\n", (int)my_key); } compiled with g++, gcc, and cc, and including the compatibility library libcompat.a. The error .o: Undefined symbol `_ftok' referenced from text segment always occurs. When I pull the "ftok.o" out of /usr/lib/libcompat.a and include that file on the compile line, the program compiles and runs just fine. Is there something else I need in order to get the program to compile with this library? I've used shared memory and ftok on many architectures, and I know that each one is somewhat different and requires something special to get it to compile and run. If you know of special things I have to do for FreeBSD, I would appreciate hearing from you. Thanks for your help, -Tim. -------------------------------------------------------------------- W. Timothy Strayer Sandia National Laboratories Distributed Systems Research P.O. Box 969, Mailstop 9011 (510) 294-3671 (OFFICE) Livermore, CA 94551-0969 (510) 294-1225 (FAX) strayer@ca.sandia.gov