nixp.ru v3.0

29 марта 2024,
пятница,
08:45:09 MSK

stealth написал 23 декабря 2006 года в 00:42 (911 просмотр) Ведет себя неопределенно; открыл 103 темы в форуме, оставил 124 комментария на сайте.

// /root/Desktop/new/cl.c

#include

#include

#include

#include

#include

#define ID 2007

void sys_err (char * msg)

{

puts (msg);

exit (1);

}

int main ()

{

int msqid;

if ( (msqid = msgget (ID, 0)) < 0)

sys_err («can’t get msg queue»);

}

[root@localhost ~]# ipcs -q

—— Message Queues ——--

key msqid owner perms used-bytes messages

[root@localhost Desktop]# cd /root/Desktop/new

[root@localhost new]# gcc cl.c

[root@localhost new]# ./a.out

can’t get msg queue

И почему же can’t ? Почему не создается очередь?

Попробовал явно задать permissions-

#define PRM 00644

if ( (msqid = msgget (ID, PRM)) < 0)

тот же can’t get msg queue…

Uncle Theodore

А вот так не хочешь попробовать?

if((msqid = msgget(ipc_key, IPC_CREAT|0644)) < 0)
              sys_err("can't get msg queue");
stealth

2 Uncle Theodore

Ну вот, так -

if ( (msqid = msgget (ID,IPC_CREAT|00644)) < 0)

10.X получилось :)

Это хорошо, но все же из за чего без принуждения и обозначения прав очередь не создается?

Uncle Theodore
stealth
2 Uncle Theodore

Ну вот, так -

if ( (msqid = msgget (ID,IPC_CREAT|00644)) < 0)

10.X получилось :)

Это хорошо, но все же из за чего без принуждения и обозначения прав очередь не создается?

Там в самом начале мануала написано.

A new message queue is created if key has

the value IPC_PRIVATE or key isn’t IPC_PRIVATE, no message queue with

the given key key exists, and IPC_CREAT is asserted in msgflg (i.e.,

msgflg&IPC_CREAT is nonzero).

Good Luck,

UT

stealth

2 Uncle Theodore

10.X ;)

Последние комментарии

ecobeingecobeing.ru
Экология и вегетарианство на благо всем живым существам Планеты.