static TIMER_CALLBACK( link_cb ) { gaelco_serial_state *state = (gaelco_serial_state *) ptr; shmem_lock(state->m_shmem); state->m_out_ptr->cnt++; sync_link(state); shmem_unlock(state->m_shmem); }
/** atomically allocate a Message-ID unless it's already present. * to avoid texpire nuking the file right away, you must give another * file name that is linked into the Message-ID directory. * \return * - 0 for success * - 1 if MID already in use * - -1 for OS trouble. */ int msgid_allocate(const char *file /** file to link into message.id */, const char *mid /** Non-NULL Message-ID to allocate */) { char *m = lookup(mid); if (mkdir_parent(m, 0700)) return 0; if (sync_link(file, m) == 0) { return 0; } if (errno == EEXIST) return 1; return -1; }