´úÂ룺
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
typedef struct{
char name[4];
int age;
}people;
int main(int argc, char *argv[])
{
int shm_id,i;
key_t key;
char temp;
people *p_map;
char *path = "/home/program/mmapfile.cc";
key = ftok(path,0);
if(key == -1)
{
perror("ftok error \n");
return -1;
}
shm_id = shmget(key,4096,IPC_CREAT);
if(shm_id == -1)
{
perror("shmget error \n");
return -1;
}
p_map = (people*)shmat(shm_id,NULL,0);
temp = 'a';
for(i = 0; i < 10; i++)
{
temp +=1;
memcpy((*(p_map+i)).name,&temp,1);
(*(p_map+i)).age = 20+i;
}
system("ipcs -m");
if(shmdt(p_map) == -1)
{
perror("detach error");
}
system("ipcs -m");
}
GDBµ÷ÊÔ£º
GNU gdb (GDB) 7.0-ubuntu
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
Ïà¹ØÎÊ´ð£º
ʹÓÃStruts2ÉÏ´«Îļþ£¬ÔÚlinuxϱ¨´í
2009-09-29 14:56:20,801 [org.apache.struts2.interceptor.FileUploadInterceptor]-[ERROR] Processing of multipart/form-data request failed. c:/temp/upload__1dcd07ee_12 ......
LinuxÐÂÊÖ£¬Çë´ó¸ç´ó½ã²»Òª¼ûЦ¡£
ÎÒÓÃrootÓû§µÇ¼µ½Linuxϵͳ¡£ÔÚ¸ùĿ¼ÏÂÃæ½¨ÁËĿ¼dir1£¬ºóÓÃÃüÁîcd /dir1½øÈëµ½dir1Ŀ¼Ï£¬È»ºóÔÙÓÃmkdir dir2½¨Á¢ÁËĿ¼dir2 £¬ÔÙºóÀ´ÓÃÃüÁîcd /dir2ÊÇ£¬ÌáʾΪ£º-bush ......
linuxϰ²×°ÁËjdk1.4µ«°æ±¾»¹ÊÇ1.3.1£¬ÓÖ°²×°Íê1.5ҲͬÑù°æ±¾»¹ÊÇ1.3.1 ÓÐÈ¥ÅäÖÃ.bashrcÎļþÄÚÈÝÈçÏ ¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡set JAVA_HOME=/usr/share/jdk1.5.0_05
¡¡¡¡¡¡¡¡¡¡¡¡export JAVA_HOME
¡¡¡¡ ......
linux Ͻø³Ì´´½¨¡£
ʹÓÃvfork() º¯Êý´´½¨ÁË×Ó½ø³Ìºó£¬×Ó½ø³ÌÏÈÐÐÖ´ÐУ¬ÔÚ×Ó½ø³Ìµ÷ÓÃexit»òexec֮ǰ¸¸½ø³Ì´¦ÓÚʲô״̬£¿£¿
²»ÖªµÀ£»Ê×ÏÈδ±ØÊÇ×Ó½ø³ÌÏÈÖ´ÐУ»µÚ2¸¸½ø³ÌÒ²´¦ÓÚÖ´ÐÐ״̬£»ÖÁÓÚ¸¸½ø³Ìµ½µ××öʲô£»¿´´ ......