[PATCH] librt: Add shm_open and shm_unlink + testcase

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Tue Jun 2 15:04:27 UTC 2009


On Tue, Jun 02, 2009 at 10:29:55AM +0200, Mikael Lund Jepsen, ICCC wrote:
> Hi all,
> As I have received interest from multiple sides over the last week or so  
> in getting shm to work, I guess it is time I took this up again and  
> finished it.
> (Alexander: Your mailprovider blocks my IP for unknown reasons, so I  
> have not been able to get through to you).
>
> I have however run into a few problems:
>
> Bernhard Reutner-Fischer wrote:
>> The argument name should be flagged with attribute_nonnull.
>>   
> I cannot get this to work. As per some googling and grepping for nonnull  
> in other uclibc sources, I've tried
> __nonnull;
> __nonnull((1));
> __attribute((nonnull(1)));
> and possibly a few more variations thereof. The result is however always  
> in the lines of:
>    error: expected identifier or '(' before '{' token
> I guess I'm missing a point somewhere, but fail to see it. Can someone  
> please enlighten me?

has do be put on the fn-decl e.g.:
static ssize_t foo(char *x, int i) __nonnull((1));
static ssize_t foo(char *x, int i) {return strlen(x);}
>
>> Most of those two function's bodies are a common thing, i.e. should
>> be in some
>> static char* get_shm_name(const char*name)
>> which returns the malloc'ed, 0 terminated path to operate on
>>   
> This also gives me some trouble. How do I go about creating a function  
> shared between two source files?
> I've just dropped my .c and .h files in librt and issued a make, which  
> automatically picks up my source files fine, but the dependency is  
> obviously not right:
> ../librt/shm_create_name.c:16: warning: 'create_shm_name' defined but  
> not used
> ../librt/shm_create_name.h:10: warning: 'create_shm_name' used but never  
> defined
> Any help would be greatly appreciated...

I suggest you base off the (completely untested) b32dd708df63d90f9d755b6c0de2588200e432ca
Please also add testsuite entries.

TIA,


More information about the uClibc mailing list