您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ vstream_fileno函数代码示例

51自学网 2021-06-03 09:49:13
  C++
这篇教程C++ vstream_fileno函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中vstream_fileno函数的典型用法代码示例。如果您正苦于以下问题:C++ vstream_fileno函数的具体用法?C++ vstream_fileno怎么用?C++ vstream_fileno使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了vstream_fileno函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: clnt_stream_open

static void clnt_stream_open(CLNT_STREAM *clnt_stream){    /*     * Sanity check.     */    if (clnt_stream->vstream)	msg_panic("clnt_stream_open: stream is open");    /*     * Schedule a read event so that we can clean up when the remote side     * disconnects, and schedule a timer event so that we can cleanup an idle     * connection. Note that both events are handled by the same routine.     *      * Finally, schedule an event to force disconnection even when the     * connection is not idle. This is to prevent one client from clinging on     * to a server forever.     */    clnt_stream->vstream = mail_connect_wait(clnt_stream->class,					     clnt_stream->service);    close_on_exec(vstream_fileno(clnt_stream->vstream), CLOSE_ON_EXEC);    event_enable_read(vstream_fileno(clnt_stream->vstream), clnt_stream_event,		      (void *) clnt_stream);    event_request_timer(clnt_stream_event, (void *) clnt_stream,			clnt_stream->timeout);    event_request_timer(clnt_stream_ttl_event, (void *) clnt_stream,			clnt_stream->ttl);}
开发者ID:ii0,项目名称:postfix,代码行数:28,


示例2: return

DELIVER_REQUEST *deliver_request_read(VSTREAM *stream){    DELIVER_REQUEST *request;    /*     * Tell the queue manager that we are ready for this request.     */    if (deliver_request_initial(stream) != 0)	return (0);    /*     * Be prepared for the queue manager to change its mind after contacting     * us. This can happen when a transport or host goes bad.     */    (void) read_wait(vstream_fileno(stream), -1);    if (peekfd(vstream_fileno(stream)) <= 0)	return (0);    /*     * Allocate and read the queue manager's delivery request.     */#define XXX_DEFER_STATUS	-1    request = deliver_request_alloc();    if (deliver_request_get(stream, request) < 0) {	deliver_request_done(stream, request, XXX_DEFER_STATUS);	request = 0;    }    return (request);}
开发者ID:ystk,项目名称:debian-postfix,代码行数:30,


示例3: smtpd_peer_from_default

static void smtpd_peer_from_default(SMTPD_STATE *state){    /*     * The "no client" routine provides surrogate information so that the     * application can produce sensible logging when a client disconnects     * before the server wakes up. The "not inet" routine provides surrogate     * state for (presumably) local IPC channels.     */    state->sockaddr_len = sizeof(state->sockaddr);    state->dest_sockaddr_len = sizeof(state->dest_sockaddr);    if (getpeername(vstream_fileno(state->client),		    (struct sockaddr *) &state->sockaddr,		    &state->sockaddr_len) <0	|| getsockname(vstream_fileno(state->client),		       (struct sockaddr *) &state->dest_sockaddr,		       &state->dest_sockaddr_len) < 0) {	if (errno == ENOTSOCK)	    smtpd_peer_not_inet(state);	else	    smtpd_peer_no_client(state);    } else {	if (smtpd_peer_sockaddr_to_hostaddr(state) < 0)	    smtpd_peer_not_inet(state);    }}
开发者ID:bsmr-misc-forks,项目名称:postfix,代码行数:26,


示例4: multi_server_execute

static void multi_server_execute(int unused_event, char *context){    VSTREAM *stream = (VSTREAM *) context;    HTABLE *attr = (vstream_flags(stream) == multi_server_saved_flags ?		    (HTABLE *) vstream_context(stream) : 0);    if (multi_server_lock != 0	&& myflock(vstream_fileno(multi_server_lock), INTERNAL_LOCK,		   MYFLOCK_OP_NONE) < 0)	msg_fatal("select unlock: %m");    /*     * Do not bother the application when the client disconnected. Don't drop     * the already accepted client request after "postfix reload"; that would     * be rude.     */    if (peekfd(vstream_fileno(stream)) > 0) {	if (master_notify(var_pid, multi_server_generation, MASTER_STAT_TAKEN) < 0)	     /* void */ ;	multi_server_service(stream, multi_server_name, multi_server_argv);	if (master_notify(var_pid, multi_server_generation, MASTER_STAT_AVAIL) < 0)	    multi_server_abort(EVENT_NULL_TYPE, EVENT_NULL_CONTEXT);    } else {	multi_server_disconnect(stream);    }    if (attr)	htable_free(attr, myfree);}
开发者ID:LMDB,项目名称:postfix,代码行数:28,


示例5: anvil_service_done

static void anvil_service_done(VSTREAM *client_stream, char *unused_service,			               char **unused_argv){    ANVIL_LOCAL *anvil_local;    const char *myname = "anvil_service_done";    if (msg_verbose)	msg_info("%s fd=%d stream=0x%lx",		 myname, vstream_fileno(client_stream),		 (unsigned long) client_stream);    /*     * Look up the local server, and get rid of any remote connection state     * that we still have for this local server. Do not destroy remote client     * status information before it expires.     */    if ((anvil_local = (ANVIL_LOCAL *) vstream_context(client_stream)) != 0) {	if (msg_verbose)	    msg_info("%s: anvil_local 0x%lx",		     myname, (unsigned long) anvil_local);	ANVIL_LOCAL_DROP_ALL(client_stream, anvil_local);	myfree((char *) anvil_local);    } else if (msg_verbose)	msg_info("client socket not found for fd=%d",		 vstream_fileno(client_stream));}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:26,


示例6: vstream_tweak_tcp

int     vstream_tweak_tcp(VSTREAM *fp){    const char *myname = "vstream_tweak_tcp";    int     mss;    SOCKOPT_SIZE mss_len = sizeof(mss);    int     err;    /*     * Avoid Nagle delays when VSTREAM buffers are smaller than the MSS.     *      * Forcing TCP_NODELAY to be "always on" would hurt performance in the     * common case where VSTREAM buffers are larger than the MSS.     *      * Instead we ask the kernel what the current MSS is, and take appropriate     * action. Linux <= 2.2 getsockopt(TCP_MAXSEG) always returns zero (or     * whatever value was stored last with setsockopt()).     */    if ((err = getsockopt(vstream_fileno(fp), IPPROTO_TCP, TCP_MAXSEG,			  (char *) &mss, &mss_len)) < 0) {	msg_warn("%s: getsockopt TCP_MAXSEG: %m", myname);	return (err);    }    if (msg_verbose)	msg_info("%s: TCP_MAXSEG %d", myname, mss);    /*     * Fix for recent Postfix versions: increase the VSTREAM buffer size if     * the VSTREAM buffer is smaller than the MSS. Note: the MSS may change     * when the route changes and IP path MTU discovery is turned on, so we     * choose a somewhat larger buffer.     */#ifdef VSTREAM_CTL_BUFSIZE    if (mss > 0) {	if (mss < INT_MAX / 2)	    mss *= 2;	vstream_control(fp,			VSTREAM_CTL_BUFSIZE, (ssize_t) mss,			VSTREAM_CTL_END);    }    /*     * Workaround for older Postfix versions: turn on TCP_NODELAY if the     * VSTREAM buffer size is smaller than the MSS.     */#else    if (mss > VSTREAM_BUFSIZE) {	int     nodelay = 1;	if ((err = setsockopt(vstream_fileno(fp), IPPROTO_TCP, TCP_NODELAY,			      (char *) &nodelay, sizeof(nodelay))) < 0)	    msg_warn("%s: setsockopt TCP_NODELAY: %m", myname);    }#endif    return (err);}
开发者ID:VargMon,项目名称:netbsd-cvs-mirror,代码行数:55,


示例7: smtpd_proxy_replay_setup

static int smtpd_proxy_replay_setup(SMTPD_STATE *state){    const char *myname = "smtpd_proxy_replay_setup";    off_t   file_offs;    /*     * Where possible reuse an existing replay logfile, because creating a     * file is expensive compared to reading or writing. For security reasons     * we must truncate the file before reuse. For performance reasons we     * should truncate the file immediately after the end of a mail     * transaction. We enforce the security guarantee upon reuse, by     * requiring that no I/O happened since the file was truncated. This is     * less expensive than truncating the file redundantly.     */    if (smtpd_proxy_replay_stream != 0) {	/* vstream_ftell() won't invoke the kernel, so all errors are mine. */	if ((file_offs = vstream_ftell(smtpd_proxy_replay_stream)) != 0)	    msg_panic("%s: bad before-queue filter speed-adjust log offset %lu",		      myname, (unsigned long) file_offs);	vstream_clearerr(smtpd_proxy_replay_stream);	if (msg_verbose)	    msg_info("%s: reuse speed-adjust stream fd=%d", myname,		     vstream_fileno(smtpd_proxy_replay_stream));	/* Here, smtpd_proxy_replay_stream != 0 */    }    /*     * Create a new replay logfile.     */    if (smtpd_proxy_replay_stream == 0) {	smtpd_proxy_replay_stream = mail_queue_enter(MAIL_QUEUE_INCOMING, 0,						     (struct timeval *) 0);	if (smtpd_proxy_replay_stream == 0)	    return (smtpd_proxy_replay_rdwr_error(state));	if (unlink(VSTREAM_PATH(smtpd_proxy_replay_stream)) < 0)	    msg_warn("remove before-queue filter speed-adjust log %s: %m",		     VSTREAM_PATH(smtpd_proxy_replay_stream));	if (msg_verbose)	    msg_info("%s: new speed-adjust stream fd=%d", myname,		     vstream_fileno(smtpd_proxy_replay_stream));    }    /*     * Needed by our DATA-phase record emulation routines.     */    vstream_control(smtpd_proxy_replay_stream, VSTREAM_CTL_CONTEXT,		    (char *) state, VSTREAM_CTL_END);    return (0);}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:49,


示例8: multi_server_disconnect

void    multi_server_disconnect(VSTREAM *stream){    if (msg_verbose)	msg_info("connection closed fd %d", vstream_fileno(stream));    if (multi_server_pre_disconn)	multi_server_pre_disconn(stream, multi_server_name, multi_server_argv);    event_disable_readwrite(vstream_fileno(stream));    (void) vstream_fclose(stream);    client_count--;    /* Avoid integer wrap-around in a persistent process.  */    if (use_count < INT_MAX)	use_count++;    if (client_count == 0 && var_idle_limit > 0)	event_request_timer(multi_server_timeout, (char *) 0, var_idle_limit);}
开发者ID:LMDB,项目名称:postfix,代码行数:15,


示例9: connect_done

static void connect_done(int unused_event, char *context){    SESSION *session = (SESSION *) context;    int     fd = vstream_fileno(session->stream);    /*     * Try again after some delay when the connection failed, in case they     * run a Mickey Mouse protocol stack.     */    if (socket_error(fd) < 0) {        fail_connect(session);    } else {        non_blocking(fd, BLOCKING);        /* Disable write events. */        event_disable_readwrite(fd);        event_enable_read(fd, read_banner, (char *) session);        dequeue_connect(session);        /* Avoid poor performance when TCP MSS > VSTREAM_BUFSIZE. */        if (sa->sa_family == AF_INET#ifdef AF_INET6                || sa->sa_family == AF_INET6#endif           )            vstream_tweak_tcp(session->stream);    }}
开发者ID:KKcorps,项目名称:postfix,代码行数:26,


示例10: load_file

void    load_file(const char *path, LOAD_FILE_FN action, void *context){    VSTREAM *fp;    struct stat st;    time_t  before;    time_t  after;    /*     * Read the file again if it is hot. This may result in reading a partial     * parameter name or missing end marker when a file changes in the middle     * of a read.     */    for (before = time((time_t *) 0); /* see below */ ; before = after) {	if ((fp = vstream_fopen(path, O_RDONLY, 0)) == 0)	    msg_fatal("open %s: %m", path);	action(fp, context);	if (fstat(vstream_fileno(fp), &st) < 0)	    msg_fatal("fstat %s: %m", path);	if (vstream_ferror(fp) || vstream_fclose(fp))	    msg_fatal("read %s: %m", path);	after = time((time_t *) 0);	if (st.st_mtime < before - 1 || st.st_mtime > after)	    break;	if (msg_verbose)	    msg_info("pausing to let %s cool down", path);	doze(300000);    }}
开发者ID:ystk,项目名称:debian-postfix,代码行数:28,


示例11: psc_service

static void psc_service(VSTREAM *smtp_client_stream,			        char *unused_service,			        char **unused_argv){    /*     * For sanity, require that at least one of INET or INET6 is enabled.     * Otherwise, we can't look up interface information, and we can't     * convert names or addresses.     */    if (inet_proto_info()->ai_family_list[0] == 0)	msg_fatal("all network protocols are disabled (%s = %s)",		  VAR_INET_PROTOCOLS, var_inet_protocols);    /*     * This program handles all incoming connections, so it must not block.     * We use event-driven code for all operations that introduce latency.     *      * Note: instead of using VSTREAM-level timeouts, we enforce limits on the     * total amount of time to receive a complete SMTP command line.     */    non_blocking(vstream_fileno(smtp_client_stream), NON_BLOCKING);    /*     * Look up the remote SMTP client address and port.     */    psc_endpt_lookup(smtp_client_stream, psc_endpt_lookup_done);}
开发者ID:cloudbuy,项目名称:postfix,代码行数:28,


示例12: qmgr_deliver

void    qmgr_deliver(QMGR_TRANSPORT *transport, VSTREAM *stream){    QMGR_QUEUE *queue;    QMGR_ENTRY *entry;    /*     * Find out if this delivery process is really available. Once elected,     * the delivery process is supposed to express its happiness. If there is     * a problem, wipe the pending deliveries for this transport. This     * routine runs in response to an external event, so it does not run     * while some other queue manipulation is happening.     */    if (qmgr_deliver_initial_reply(stream) != 0) {	qmgr_transport_throttle(transport, "mail transport unavailable");	qmgr_defer_transport(transport, transport->reason);	(void) vstream_fclose(stream);	return;    }    /*     * Find a suitable queue entry. Things may have changed since this     * transport was allocated. If no suitable entry is found,     * unceremoniously disconnect from the delivery process. The delivery     * agent request reading routine is prepared for the queue manager to     * change its mind for no apparent reason.     */    if ((queue = qmgr_queue_select(transport)) == 0	|| (entry = qmgr_entry_select(queue)) == 0) {	(void) vstream_fclose(stream);	return;    }    /*     * Send the queue file info and recipient info to the delivery process.     * If there is a problem, wipe the pending deliveries for this transport.     * This routine runs in response to an external event, so it does not run     * while some other queue manipulation is happening.     */    if (qmgr_deliver_send_request(entry, stream) < 0) {	qmgr_entry_unselect(queue, entry);	qmgr_transport_throttle(transport, "mail transport unavailable");	qmgr_defer_transport(transport, transport->reason);	/* warning: entry and queue may be dangling pointers here */	(void) vstream_fclose(stream);	return;    }    /*     * If we get this far, go wait for the delivery status report.     */    qmgr_deliver_concurrency++;    entry->stream = stream;    event_enable_read(vstream_fileno(stream),		      qmgr_deliver_update, (char *) entry);    /*     * Guard against broken systems.     */    event_request_timer(qmgr_deliver_abort, (char *) entry, var_daemon_timeout);}
开发者ID:TonyChengTW,项目名称:Rmail,代码行数:60,


示例13: rset_done

static void rset_done(int unused_event, char *context){    SESSION *session = (SESSION *) context;    RESPONSE *resp;    int     except;    /*     * Get response to RSET command.     */    if ((except = vstream_setjmp(session->stream)) != 0)        msg_fatal("%s while sending message", exception_text(except));    if ((resp = response(session->stream, buffer))->code / 100 == 2) {        /* void */    } else if (allow_reject) {        msg_warn("rset rejected: %d %s", resp->code, resp->str);        if (resp->code == 421 || resp->code == 521) {            close_session(session);            return;        }    } else {        msg_fatal("rset rejected: %d %s", resp->code, resp->str);    }    /*     * Say goodbye or send the next message.     */    if (disconnect || message_count < 1) {        send_quit(session);    } else {        event_disable_readwrite(vstream_fileno(session->stream));        start_another(session);    }}
开发者ID:KKcorps,项目名称:postfix,代码行数:33,


示例14: send_rcpt

static void send_rcpt(int unused_event, char *context){    SESSION *session = (SESSION *) context;    int     except;    /*     * Send envelope recipient address.     */    if ((except = vstream_setjmp(session->stream)) != 0)        msg_fatal("%s while sending recipient", exception_text(except));    if (session->rcpt_count > 1 || number_rcpts > 0)        command(session->stream, "RCPT TO:<%d%s>",                number_rcpts ? number_rcpts++ : session->rcpt_count,                recipient);    else        command(session->stream, "RCPT TO:<%s>", recipient);    session->rcpt_count--;    session->rcpt_done++;    /*     * Prepare for the next event.     */    event_enable_read(vstream_fileno(session->stream), rcpt_done, (char *) session);}
开发者ID:KKcorps,项目名称:postfix,代码行数:25,


示例15: edit_file_close

int     edit_file_close(EDIT_FILE *ep){    VSTREAM *fp = ep->tmp_fp;    int     fd = vstream_fileno(fp);    int     saved_errno;    /*     * The rename/unlock portion of the protocol is relatively simple. The     * only things that really matter here are that we change permissions as     * late as possible, and that we rename the file to its final pathname     * before we lose the exclusive lock.     *      * Applications that are concerned about maximal safety should protect the     * edit_file_close() call with sigdelay() and sigresume() calls. It is     * not safe for us to call these functions directly, because the calls do     * not nest. It is also not nice to force every caller to run with     * interrupts turned off.     */    if (vstream_fflush(fp) < 0	|| fchmod(fd, ep->final_mode) < 0#ifdef HAS_FSYNC	|| fsync(fd) < 0#endif	|| rename(ep->tmp_path, ep->final_path) < 0) {	saved_errno = errno;	edit_file_cleanup(ep);	errno = saved_errno;	return (VSTREAM_EOF);    } else {	(void) vstream_fclose(ep->tmp_fp);	EDIT_FILE_FREE(ep);	return (0);    }}
开发者ID:ystk,项目名称:debian-postfix,代码行数:34,


示例16: anvil_remote_disconnect

static void anvil_remote_disconnect(VSTREAM *client_stream, const char *ident){    ANVIL_REMOTE *anvil_remote;    ANVIL_LOCAL *anvil_local;    const char *myname = "anvil_remote_disconnect";    if (msg_verbose)	msg_info("%s fd=%d stream=0x%lx ident=%s",		 myname, vstream_fileno(client_stream),		 (unsigned long) client_stream, ident);    /*     * Update local and remote info if this remote connection is listed for     * this local server.     */    if ((anvil_local = (ANVIL_LOCAL *) vstream_context(client_stream)) != 0	&& (anvil_remote =	    (ANVIL_REMOTE *) htable_find(anvil_remote_map, ident)) != 0	&& ANVIL_LOCAL_REMOTE_LINKED(anvil_local, anvil_remote)) {	ANVIL_REMOTE_DROP_ONE(anvil_remote);	ANVIL_LOCAL_DROP_ONE(anvil_local, anvil_remote);    }    if (msg_verbose)	msg_info("%s: anvil_local 0x%lx",		 myname, (unsigned long) anvil_local);    /*     * Respond to the local server.     */    attr_print_plain(client_stream, ATTR_FLAG_NONE,		     ATTR_TYPE_INT, ANVIL_ATTR_STATUS, ANVIL_STAT_OK,		     ATTR_TYPE_END);}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:33,


示例17: send_rset

static void send_rset(int unused_event, char *context){    SESSION *session = (SESSION *) context;    command(session->stream, "RSET");    event_enable_read(vstream_fileno(session->stream), rset_done, (char *) session);}
开发者ID:KKcorps,项目名称:postfix,代码行数:7,


示例18: close_session

static void close_session(SESSION *session){    event_disable_readwrite(vstream_fileno(session->stream));    vstream_fclose(session->stream);    session->stream = 0;    start_another(session);}
开发者ID:KKcorps,项目名称:postfix,代码行数:7,


示例19: read_data

static void read_data(int unused_event, void *context){    SINK_STATE *state = (SINK_STATE *) context;    int     fd = vstream_fileno(state->stream);    int     count;    /*     * Refill the VSTREAM buffer, if necessary.     */    if (VSTREAM_GETC(state->stream) == VSTREAM_EOF)	netstring_except(state->stream, vstream_ftimeout(state->stream) ?			 NETSTRING_ERR_TIME : NETSTRING_ERR_EOF);    state->count--;    /*     * Flush the VSTREAM buffer. As documented, vstream_fseek() discards     * unread input.     */    if ((count = vstream_peek(state->stream)) > 0) {	state->count -= count;	if (state->count <= 0) {	    send_reply(state);	    return;	}	vstream_fpurge(state->stream, VSTREAM_PURGE_BOTH);    }    /*     * Do not block while waiting for the arrival of more data.     */    event_disable_readwrite(fd);    event_enable_read(fd, read_data, context);}
开发者ID:DabeDotCom,项目名称:postfix,代码行数:33,


示例20: single_server_accept_inet

static void single_server_accept_inet(int unused_event, void *context){    int     listen_fd = CAST_ANY_PTR_TO_INT(context);    int     time_left = -1;    int     fd;    /*     * Be prepared for accept() to fail because some other process already     * got the connection. We use select() + accept(), instead of simply     * blocking in accept(), because we must be able to detect that the     * master process has gone away unexpectedly.     */    if (var_idle_limit > 0)	time_left = event_cancel_timer(single_server_timeout, (void *) 0);    if (single_server_pre_accept)	single_server_pre_accept(single_server_name, single_server_argv);    fd = inet_accept(listen_fd);    if (single_server_lock != 0	&& myflock(vstream_fileno(single_server_lock), INTERNAL_LOCK,		   MYFLOCK_OP_NONE) < 0)	msg_fatal("select unlock: %m");    if (fd < 0) {	if (errno != EAGAIN)	    msg_error("accept connection: %m");	if (time_left >= 0)	    event_request_timer(single_server_timeout, (void *) 0, time_left);	return;    }    single_server_wakeup(fd, (HTABLE *) 0);}
开发者ID:ureyni,项目名称:postfix.3.1,代码行数:31,


示例21: tlsp_service

static void tlsp_service(VSTREAM *plaintext_stream,                         char *service,                         char **argv){    TLSP_STATE *state;    int     plaintext_fd = vstream_fileno(plaintext_stream);    /*     * Sanity check. This service takes no command-line arguments.     */    if (argv[0])        msg_fatal("unexpected command-line argument: %s", argv[0]);    /*     * This program handles multiple connections, so it must not block. We     * use event-driven code for all operations that introduce latency.     * Except that attribute lists are sent/received synchronously, once the     * socket is found to be ready for transmission.     */    non_blocking(plaintext_fd, NON_BLOCKING);    vstream_control(plaintext_stream,                    CA_VSTREAM_CTL_PATH("plaintext"),                    CA_VSTREAM_CTL_TIMEOUT(5),                    CA_VSTREAM_CTL_END);    /*     * Receive postscreen's remote SMTP client address/port and socket.     */    state = tlsp_state_create(service, plaintext_stream);    event_enable_read(plaintext_fd, tlsp_get_request_event, (void *) state);    event_request_timer(tlsp_get_request_event, (void *) state,                        TLSP_INIT_TIMEOUT);}
开发者ID:vdukhovni,项目名称:postfix,代码行数:33,


示例22: multi_server_accept_inet

static void multi_server_accept_inet(int unused_event, char *context){    int     listen_fd = CAST_CHAR_PTR_TO_INT(context);    int     time_left = -1;    int     fd;    /*     * Be prepared for accept() to fail because some other process already     * got the connection (the number of processes competing for clients is     * kept small, so this is not a "thundering herd" problem). If the     * accept() succeeds, be sure to disable non-blocking I/O, in order to     * minimize confusion.     */    if (client_count == 0 && var_idle_limit > 0)	time_left = event_cancel_timer(multi_server_timeout, (char *) 0);    if (multi_server_pre_accept)	multi_server_pre_accept(multi_server_name, multi_server_argv);    fd = inet_accept(listen_fd);    if (multi_server_lock != 0	&& myflock(vstream_fileno(multi_server_lock), INTERNAL_LOCK,		   MYFLOCK_OP_NONE) < 0)	msg_fatal("select unlock: %m");    if (fd < 0) {	if (errno != EAGAIN)	    msg_error("accept connection: %m");	if (time_left >= 0)	    event_request_timer(multi_server_timeout, (char *) 0, time_left);	return;    }    multi_server_wakeup(fd, (HTABLE *) 0);}
开发者ID:LMDB,项目名称:postfix,代码行数:32,


示例23: flush_add_path

static int flush_add_path(const char *path, const char *queue_id){    const char *myname = "flush_add_path";    VSTREAM *log;    /*     * Sanity check.     */    if (!mail_queue_id_ok(path))	return (FLUSH_STAT_BAD);    /*     * Open the logfile or bust.     */    if ((log = mail_queue_open(MAIL_QUEUE_FLUSH, path,			       O_CREAT | O_APPEND | O_WRONLY, 0600)) == 0)	msg_fatal("%s: open fast flush logfile %s: %m", myname, path);    /*     * We must lock the logfile, so that we don't lose information due to     * concurrent access. If the lock takes too long, the Postfix watchdog     * will eventually take care of the problem, but it will take a while.     */    if (myflock(vstream_fileno(log), INTERNAL_LOCK, MYFLOCK_OP_EXCLUSIVE) < 0)	msg_fatal("%s: lock fast flush logfile %s: %m", myname, path);    /*     * Append the queue ID. With 15 bits of microsecond time, a queue ID is     * not recycled often enough for false hits to be a problem. If it does,     * then we could add other signature information, such as the file size     * in bytes.     */    vstream_fprintf(log, "%s/n", queue_id);    if (vstream_fflush(log))	msg_warn("write fast flush logfile %s: %m", path);    /*     * Clean up.     */    if (myflock(vstream_fileno(log), INTERNAL_LOCK, MYFLOCK_OP_NONE) < 0)	msg_fatal("%s: unlock fast flush logfile %s: %m", myname, path);    if (vstream_fclose(log) != 0)	msg_warn("write fast flush logfile %s: %m", path);    return (FLUSH_STAT_OK);}
开发者ID:Jingeun,项目名称:tongsu_smtp,代码行数:46,



注:本文中的vstream_fileno函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ vstream_printf函数代码示例
C++ vstream_fflush函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。