wangzhengquan
2020-12-24 0fd19aa1c8a2bf543099d6b1077ff19078f9074e
test/test.c
@@ -1,35 +1,10 @@
#include "test.h"
#define MKEY 0x2222
int testmatshm() {
  int shmid = -1;
  void *shmp;
  shmid = shmget(MKEY, 1024, IPC_CREAT | IPC_EXCL | OBJ_PERMS);
  if (shmid == -1 && errno == EEXIST) {
    printf("first create\n");
    shmid = shmget(MKEY, 0, 0);
  }
  if (shmid == -1)
    err_exit(errno, "testmatshm shmget");
  shmp = shmat(shmid, NULL, 0);
#include "usg_common.h"
static void sig_quit(int);
#define SIGCLOSE1   (SIGRTMIN +1)
int
main(void)
{
 printf("%d, %d , %d\n", SIGRTMIN, SIGRTMAX, SIGCLOSE1);
  /* SIGQUIT here will terminate with core file */
}
typedef struct buf_t { char buf[7]; } buf_t;
void test(int size) {
  char buf[size];
  printf("size = %d\n", sizeof(buf));
}
char msg[10];
int main() {
  // testmatshm();
  // testmatshm();
  // sleep(60);
  // printf("size = %d, msg = %d\n", sizeof(buf_t), sizeof(msg));
  test(12);
}