From owner-FreeBSD-users-jp@jp.freebsd.org  Thu Sep 18 18:54:13 1997
Received: by jaz.jp.freebsd.org (8.8.7+2.7Wbeta7/8.7.3) id SAA23642
	Thu, 18 Sep 1997 18:54:13 +0900 (JST)
Received: by jaz.jp.freebsd.org (8.8.7+2.7Wbeta7/8.7.3) with ESMTP id SAA23606
	for <FreeBSD-users-jp@jp.freebsd.org>; Thu, 18 Sep 1997 18:54:07 +0900 (JST)
Received: (from kyowa-hi@localhost) by tuucp1.space.ad.jp (8.8.7+2.7Wbeta7/3.3W997040315) with UUCP id SAA16694 for FreeBSD-users-jp@jp.freebsd.org; Thu, 18 Sep 1997 18:45:12 +0900 (JST)
X-Authentication-Warning: tuucp1.space.ad.jp: kyowa-hi set sender to ogimoto@kyowa-hi.co.jp using -f
Received: from gigant ([192.168.0.30]) by donkey.kyowa-hi.co.jp (8.8.5/3.4W4-GREG-LOCAL-MASTER-1.0) with ESMTP id SAA26953 for <FreeBSD-users-jp@jp.freebsd.org>; Thu, 18 Sep 1997 18:05:01 +0900 (JST)
Message-Id: <199709180905.SAA26953@donkey.kyowa-hi.co.jp>
From: "ogimoto" <ogimoto@kyowa-hi.co.jp>
To: <FreeBSD-users-jp@jp.freebsd.org>
Date: Thu, 18 Sep 1997 17:57:36 -0000
X-MSMail-Priority: Normal
X-Priority: 3
X-Mailer: Microsoft Internet Mail 4.70.1155
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-2022-JP
Content-Transfer-Encoding: 8bit
Reply-To: FreeBSD-users-jp@jp.freebsd.org
Precedence: bulk
X-Distribute: distribute [version 2.1 (Alpha) patchlevel=20]
X-Sequence: FreeBSD-users-jp 18246
Subject: [FreeBSD-users-jp 18246] =?ISO-2022-JP?B?GyRCNiZNLSVhJWIlaiROO0gkJEp9JEskRCQkJEY2NSQoJEYkLyRAJDUbKEo=?=
	=?ISO-2022-JP?B?GyRCJCQhIxsoSg==?=
Errors-To: owner-FreeBSD-users-jp@jp.freebsd.org
Sender: owner-FreeBSD-users-jp@jp.freebsd.org


FreeBSD 2.2.2 $B$G2<$N%W%m%0%i%`!J6&M-%a%b%j$r;H$C$F?F;R4V$G(J
$B%?%$%_%s%0$r<h$k!K$r(J $ g++ sm.cc $B$G%3%s%Q%$%k$7!"<B9T$9$k$H(J

$ a.out
Bad system call (core dumped)

$B$HE\$i$l$F$7$^$$$^$9!#(J

$B%G%P%C%0%i%$%H$rF~$l$k$H(J 14$B9TL\$N(J shmget() $B$r8F$s$@$H$3$m$G(J
SIGSYS $B$,5/$3$C$F$7$^$&$h$&$J$N$G$9$,!"$3$l$O(J HP-UX 10.20
$B$G$OLdBj$J$/F0$/$N$G!V%7%9%F%`$N4D6-$,$*$+$7$$$N$+$J$"!W$H(J
$B;W$C$F$$$k$N$G$9$,!"$I$J$?$+$*CN7C$rB_$7$F$/$@$5$$!#(J

$B$h$m$7$/$*4j$$$7$^$9!#(J

------------------------- sm.cc ------------------------
#include	<stdio.h>
#include	<unistd.h>
#include	<sys/stat.h>
#include	<sys/types.h>
#include	<sys/ipc.h>
#include	<sys/shm.h>
#include	<sys/wait.h>

void *smalloc( int siz )
{
	int	sid;
	char	*shmp;

	if(( sid = shmget( IPC_PRIVATE, siz, IPC_CREAT|SHM_R|SHM_W )) == -1 ){
		return	NULL;
	}

	if(( shmp = (char*)(shmat( sid, 0, 0 ))) == (char*)-1 ){
		return NULL;
	}

	(void)shmctl( sid, IPC_RMID, NULL );

	return shmp;
}

int smfree( char *shmp )
{
	return( shmdt( shmp ));
}

int main( void )
{
	int*	pn = ( int * )smalloc( sizeof( int ));
	*pn = 0;

	if( pn == NULL ){
		perror( "smaaloc" );
		return( -1 );
	}

	if( fork() == 0 ){
		for( int i = 0 ; i < 10 ; i++ ){
			sleep( 2 );
			*pn = i;
		}
	}
	else{
		while( *pn <  9 ){
			printf( "COUNT %d\n", *pn );
			sleep( 1 );
		}
		int	stat;
		wait( &stat );
	}

	smfree( (char*)pn );
}
--------------------------------------------------------


    /
   / $B3t<02q<R(J $B6&OB%O%$%F%C%/(J $B%7%9%F%`;v6HIt(J
  / $B2.K\(J $BK~51(J $B!J$*$.$b$H(J $B$_$D$F$k!K(J
 / E-mail : ogimoto@kyowa-hi.co.jp
/ TEL : 0424-88-1121 FAX : 0424-99-4593
