/* include px_ipc_name */
#include "unpipc.h" char *
px_ipc_name(const char *name)
{ char *dir, *dst, *slash; if ( (dst = malloc(PATH_MAX)) == NULL)
return(NULL); /* 4can override default directory with environment variable */
if ( (dir = getenv("PX_IPC_NAME")) == NULL) { #ifdef POSIX_IPC_PREFIX
dir = POSIX_IPC_PREFIX; /* from "config.h" */
#else
dir = "/tmp/"; /* default */
#endif }
/* 4dir must end in a slash */
slash = (dir[strlen(dir) - ] == '/') ? "" : "/";
snprintf(dst, PATH_MAX, "%s%s%s", dir, slash, name); return(dst); /* caller can free() this pointer */ }
/* end px_ipc_name */ char *
Px_ipc_name(const char *name)
{ char *ptr; if ( (ptr = px_ipc_name(name)) == NULL)
err_sys("px_ipc_name error for %s", name);
return(ptr); }

px_ipc_name.c的更多相关文章

  1. Unix IPC之基于共享内存的计数器

    目的 本文主要实现一个基于共享内存的计数器,通过父子进程对其访问. 本文程序需基于<<Unix网络编程-卷2>>的环境才能运行.程序中大写开头的函数为其小写同名函数的包裹函数, ...

  2. 一些IPC常用头文件

    //my_err.h#include <errno.h> /* for definition of errno */ #include <stdarg.h> /* ISO C ...

  3. UNIX 进程间通讯(IPC)概念(Posix,System V IPC)

     IPC(Inter-Process Communication,进程间通讯)可以有三种信息共享方式(随文件系统,随内核,随共享内存).(当然这里虽然说是进程间通讯,其实也是可以和线程相通的). 相对 ...

随机推荐

  1. Codeforces Round #267 (Div. 2) C. George and Job DP

                                                  C. George and Job   The new ITone 6 has been released ...

  2. windows脚本定时执行

    linux下可以直接用cron定时任务,window下可以使用schtasks 命令代替. 第一次在win7 cmd输入: schtasks 如果出现错误:“错误:无法加载列表资源” 的问题原因很简单 ...

  3. 关于post和get传递参数的区别

    今天一朋友给我一段代码,说使用request.querystrin得不到传过来的值,我们一起找到很长时间,终于给找到了,错误的原因是他将form中的method参数写成了get了,所以使用reques ...

  4. asp.net控件开发基础(1)(转)原文更多内容

    asp.net本身提供了很多控件,提供给我们这些比较懒惰的人使用,我认为控件的作用就在此,因为我们不想重复工作,所以要创建它,这个本身便是一个需求的关系,所以学习控件开发很有意思. wrox网站上有本 ...

  5. 水题 HDOJ 4727 The Number Off of FFF

    题目传送门 /* 水题:判断前后的差值是否为1,b[i]记录差值,若没有找到,则是第一个出错 */ #include <cstdio> #include <iostream> ...

  6. Travelling

    Travelling Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  7. velocity 判断 变量 是否不是空或empty

    原先的 #if($mobile) 这种写法是不准确的 ,请换成 "$!{ mobile}"!="" 说明 :    #if($mobile)   这种写法 只能 ...

  8. linux安装apache的纠结过程

    本以为linux下安装apache是件很简单的过程.三命令就可以搞定,jxvf解压,make 编译,make install 安装就OK了.没想到这个过程还颇费周折.可能和环境有关吧.先说一下我的环境 ...

  9. [leetCode][003] Intersection of Two Linked Lists

    [题目]: Write a program to find the node at which the intersection of two singly linked lists begins. ...

  10. 转:移动端html页面优化

    对于访问量大的网站来说,前端的优化是必须的,即使是优化1KB的大小对其影响也很大,下面来看看来自ISUX的米随随讲讲移动手机平台的HTML5前端优化,或许对你有帮助和启发. 概述 1. PC优化手段在 ...