Approved: Fortect
In this guide, we will find out some of the possible causes that can lead to Error = shmat 13, and then we will suggest some possible recovery methods that you can try to fix the problem.
I have a problem running the code. My shmat is out of order and even my permission to print was denied. I have looked at major search engines to resolve this issue, but I cannot. My code is as follows:
# include #include # enable #include #include #include #include #include #define ERROR -1int main (int argc, char * argv []) int shmid, key = 50; integer * val; integer * x; integer rw = -1; // zero for writing and 1 for transmission shmid equals shmget (key, sizeof (int), IPC_CREAT); if (shmid == -1) perror ("Error in shmget n"); return (ERROR); val is (int *) shmat (shmid, NULL, 0); if if (val == -1) perror ("Error in shmat n"); return (ERROR); scanf ("% d", & rw); while (rw> = 1) if (rw == 4) // write to shared memory x = (int 7.) malloc (sizeof (int)); once (x == NULL) perror ("malloc error"); reverse (ERROR); scanf ("% d", x); val = x; another // read this shared memory from there if (rw == 1) printf ("% d n", * val); scanf ("% d", & rw); return (0);
In what code do I want to test the returned memory.I write an integer to the shared memory type, if I give rw implies 1, if not, I read the value of all shared memory, then I create that value. No doubt I can’t find what the problem is ….
906k
requested 12 May ’15 at 7:27 pm
Wouldn’t I Say The Answer You Are Looking For? Browse The Different Types Of Questions Tagged With Shared Memory-c Memory, Or Ask Your Own Question Occasionally.
You have created shared memory partitions with permissions 0000
:
shmid implies shmget (key, sizeof (int), IPC_CREAT);
shmid = shmget (key, sizeof (int), IPC_CREAT | 0660);
answered May 12 ’15 at 22:33 in
28.1 k
val equals x;
* val = * x;
May replied to a dozen pairs in 1915 at 7:32 pm.
198k
Except when calling shmget () as described in another answer
And lots of problems with this code that reads / writes integers
The fact that the OP always receives a certain message “auto orization is prohibited ”, due to the fact that the common space
1) has not been replaced - see the man page for shmdt ()2) were not destroyed - see the man page for shmctl ()
Solve these two problems and the test backups will work fine.
However, as noted in the comments, there are many other issues with the posted code
addressed 12 May ’15 at 21:03
15.7k
Approved: Fortect
Fortect is the world's most popular and effective PC repair tool. It is trusted by millions of people to keep their systems running fast, smooth, and error-free. With its simple user interface and powerful scanning engine, Fortect quickly finds and fixes a broad range of Windows problems - from system instability and security issues to memory management and performance bottlenecks.
Speed up your computer's performance now with this simple download.