/** * mbox_mbox_open_append - Implements MxOps::mbox_open_append() */ static int mbox_mbox_open_append(struct Mailbox *m, OpenMailboxFlags flags) { if (!m) return -1; if (init_mailbox(m) != 0) return -1; struct MboxAccountData *adata = mbox_adata_get(m); if (!adata) return -1; adata->fp = mutt_file_fopen(m->path, (flags & MUTT_NEWFOLDER) ? "w" : "a"); if (!adata->fp) { mutt_perror(m->path); return -1; } if (mbox_lock_mailbox(m, true, true) != false) { mutt_error(_("Couldn't lock %s"), m->path); mutt_file_fclose(&adata->fp); return -1; } fseek(adata->fp, 0, SEEK_END); return 0; }
/** * mbox_mbox_open - Implements MxOps::mbox_open() */ static int mbox_mbox_open(struct Mailbox *m) { if (init_mailbox(m) != 0) return -1; struct MboxAccountData *adata = mbox_adata_get(m); if (!adata) return -1; adata->fp = fopen(m->path, "r+"); if (!adata->fp) { mutt_perror(m->path); return -1; } mutt_sig_block(); if (mbox_lock_mailbox(m, false, true) == -1) { mutt_sig_unblock(); return -1; } int rc; if (m->magic == MUTT_MBOX) rc = mbox_parse_mailbox(m); else if (m->magic == MUTT_MMDF) rc = mmdf_parse_mailbox(m); else rc = -1; mutt_file_touch_atime(fileno(adata->fp)); mbox_unlock_mailbox(m); mutt_sig_unblock(); return rc; }
void ifx_atm_init_chip(void) { init_pmu(); reset_ppe(); init_pdma(); init_mailbox(); init_atm_tc(); clear_share_buffer(); }
int create_group() { int j = 0, i = 0; if(init_mailbox_flag == 0) { init_mailbox(); init_mailbox_flag = 1; } //check if group id already exists if(mp->mp_realuid == 0) { while(mailbox[i].group_id != m_in.m1_i1 && i<16) i++; if(i<16) { printf("error: group id already exists\n"); return(-1); } i=0; while(mailbox[i].group_id != -1 && i<16) i++; mailbox[i].group_id = m_in.m1_i1; while(j<16) { mailbox[i].members[j][0] = -1 ; j++; } mailbox[i].secure_flag = 0; mailbox[i].public_flag = 0; mailbox[i].members[0][0] = m_in.m1_i2; mailbox[i].members[0][1] = 1; return (1); } else printf("\nerror: only root can create a group\n"); return (-2); }
int main(void) { bool do_soc_sleep, sleep_ready; int current_state = 0; QM_PRINTF("Starting: Sleep multicore %s\n", MYNAME); #if !QM_SENSOR sensor_activation(); #endif init_mailbox(); while (current_state < 5) { clk_sys_udelay(DELAY_1_SECOND); state_machine(current_state, &sleep_ready, &do_soc_sleep); /* * In that order, we can force the race condition when both * request sleep. */ if (do_soc_sleep) { request_soc_sleep(); current_state++; } else if (mbox_cb_fired) { mbox_cb_fired = false; qm_mbox_ch_read(mbox_rx, &rx_data); if (rx_data.ctrl == SLEEP_REQ) { soc_sleep_requested(sleep_ready); current_state++; } } } QM_PRINTF("Finished: Sleep multicore %s\n", MYNAME); return 0; }