ALT Linux Team development discussions
 help / color / mirror / Atom feed
* [devel] Fw: Re: [sisyphus] Shared memory
@ 2004-03-25  8:10 Grigory Batalov
  2004-03-25  8:25 ` Denis Ovsienko
  2004-03-25  8:44 ` Grigory Batalov
  0 siblings, 2 replies; 4+ messages in thread
From: Grigory Batalov @ 2004-03-25  8:10 UTC (permalink / raw)
  To: devel

Date: Thu, 25 Mar 2004 02:59:41 -0500
From: Ivan Adzhubey <iadzhubey@rics.bwh.harvard.edu>
To: ALT Linux Sisyphus discussion list <sisyphus@altlinux.ru>
Subject: Re: [sisyphus] Shared memory - HELP PLEASE!

<skip>

Так, слегка запутался:

man shmget:

int shmget(key_t key, int size, int shmflg);

...shmget() returns the identifier of the shared memory segment associated
with the value of the argument key.  A new shared memory segment,  with
size  equal to the value of size rounded up to a multiple of PAGE_SIZE, ...

PAGE_SIZE у нас вроде бы 0x400 == 1024 bytes
shm.h: #define SHMMIN 1    /* min shared seg size (bytes) */
но shmget работает как-то странно:

shmtest.c:
shmid = shmget(IPC_PRIVATE, 1, IPC_CREAT|0700);

ipcs:
------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x00000000 1966087    ivan      700        0          1

<size=2...1022> аналогично

shmtest.c:
shmid = shmget(IPC_PRIVATE, 1023, IPC_CREAT|0700);

ipcs:
------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x00000000 1966087    ivan      700        0          1

то есть никакой памяти не выделяется, хотя и ошибки тоже не генерируется.

shmtest.c:
shmid = shmget(IPC_PRIVATE, 1024, IPC_CREAT|0700);

ipcs:
------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x00000000 1966087    ivan      700        4096          1

Опа, сразу 4 страницы!

shmtest.c:
shmid = shmget(IPC_PRIVATE, 2*1024, IPC_CREAT|0700);

ipcs:
------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x00000000 1966087    ivan      700        8192          1

И так далее, в два раза больше чем запрошено.

Грустно, но курение манов совершенно не помогает.

Не перекинет ли кто из подписантов этот тред в devel@? Может гуру курят что-то 
более подходящее к случаю и смогут помочь мне узреть истину?

-- 
Иван

_______________________________________________
Sisyphus mailing list
Sisyphus@altlinux.ru
http://lists.altlinux.ru/mailman/listinfo/sisyphus


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-03-25  8:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-25  8:10 [devel] Fw: Re: [sisyphus] Shared memory Grigory Batalov
2004-03-25  8:25 ` Denis Ovsienko
2004-03-25  8:43   ` Grigory Batalov
2004-03-25  8:44 ` Grigory Batalov

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git