ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Grigory Batalov <bga@altlinux.ru>
To: devel@altlinux.ru
Subject: [devel] Fw: Re: [sisyphus] Shared memory
Date: Thu, 25 Mar 2004 11:10:59 +0300
Message-ID: <20040325111059.0162db1e.bga@altlinux.ru> (raw)

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


             reply	other threads:[~2004-03-25  8:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-25  8:10 Grigory Batalov [this message]
2004-03-25  8:25 ` Denis Ovsienko
2004-03-25  8:43   ` Grigory Batalov
2004-03-25  8:44 ` Grigory Batalov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040325111059.0162db1e.bga@altlinux.ru \
    --to=bga@altlinux.ru \
    --cc=devel@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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