summaryrefslogtreecommitdiff
path: root/wrapper/ppswrapper-msgget.c
blob: ecf975b96cd2b7ae61e86c267bf041e0198e183a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* PPSWrapper

 * Copyright (C) 2009- Luo Jinghua <sunmoon1997@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more
 */
#define _GNU_SOURCE
#include <dlfcn.h>

#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>

#include <stdio.h>

int msgget (key_t key, int msgflg)
{
  static int (*old_msgget)(key_t, int);
  
  if (!old_msgget)
  	old_msgget = dlsym (RTLD_NEXT, "msgget");

  //printf ("msgget(0x%x, 0x%x)\n", key, msgflg);
  //printf ("changed to msgget(0x%x, 0x%x)\n", key, msgflg | 0600);
   return old_msgget (key, msgflg | 0600);
}