本文整理汇总了C++中pmap_unset函数的典型用法代码示例。如果您正苦于以下问题:C++ pmap_unset函数的具体用法?C++ pmap_unset怎么用?C++ pmap_unset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pmap_unset函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argn, char *argc[])
{
//Program parameters : argc[1] : HostName or Host IP
// argc[2] : Server Program Number
// other arguments depend on test case
//run_mode can switch into stand alone program or program launch by shell script
//1 : stand alone, debug mode, more screen information
//0 : launch by shell script as test case, only one printf -> result status
int run_mode = 0;
int test_status = 1; //Default test result set to FAILED
int progNum = 5000000; //This test doesn't care with progNum, just local test of reg/unreg...
int port = 600;
SVCXPRT *transp = NULL;
//Initialization
pmap_unset(progNum, VERSNUM);
if (run_mode)
{
printf("Before creation\n");
}
transp = svcudp_create(RPC_ANYSOCK);
pmap_set(progNum, VERSNUM, IPPROTO_UDP, port);
test_status = !pmap_unset(progNum, VERSNUM);
//This last printf gives the result status to the tests suite
//normally should be 0: test has passed or 1: test has failed
printf("%d\n", test_status);
return test_status;
}
示例2: main
int
main(int argc, char *argv[])
{
SVCXPRT *transp;
int sock = 0;
int proto = 0;
struct sockaddr_in from;
int fromlen;
if (argc == 2)
closedown = atoi(argv[1]);
if (closedown <= 0)
closedown = 20;
/*
* See if inetd started us
*/
fromlen = sizeof(from);
if (getsockname(0, (struct sockaddr *)&from, &fromlen) < 0) {
from_inetd = 0;
sock = RPC_ANYSOCK;
proto = IPPROTO_UDP;
}
if (!from_inetd) {
daemon(0, 0);
(void)pmap_unset(RSTATPROG, RSTATVERS_TIME);
(void)pmap_unset(RSTATPROG, RSTATVERS_SWTCH);
(void)pmap_unset(RSTATPROG, RSTATVERS_ORIG);
(void) signal(SIGINT, cleanup);
(void) signal(SIGTERM, cleanup);
(void) signal(SIGHUP, cleanup);
}
openlog("rpc.rstatd", LOG_CONS|LOG_PID, LOG_DAEMON);
transp = svcudp_create(sock);
if (transp == NULL) {
syslog(LOG_ERR, "cannot create udp service");
exit(1);
}
if (!svc_register(transp, RSTATPROG, RSTATVERS_TIME, rstat_service, proto)) {
syslog(LOG_ERR, "unable to register (RSTATPROG, RSTATVERS_TIME, %s)", proto?"udp":"(inetd)");
exit(1);
}
if (!svc_register(transp, RSTATPROG, RSTATVERS_SWTCH, rstat_service, proto)) {
syslog(LOG_ERR, "unable to register (RSTATPROG, RSTATVERS_SWTCH, %s)", proto?"udp":"(inetd)");
exit(1);
}
if (!svc_register(transp, RSTATPROG, RSTATVERS_ORIG, rstat_service, proto)) {
syslog(LOG_ERR, "unable to register (RSTATPROG, RSTATVERS_ORIG, %s)", proto?"udp":"(inetd)");
exit(1);
}
svc_run();
syslog(LOG_ERR, "svc_run returned");
exit(1);
}
示例3: cleanup
void
cleanup(int sig)
{
(void) pmap_unset(RSTATPROG, RSTATVERS_TIME);
(void) pmap_unset(RSTATPROG, RSTATVERS_SWTCH);
(void) pmap_unset(RSTATPROG, RSTATVERS_ORIG);
exit(0);
}
示例4: unregister_services
static void
unregister_services (void)
{
if (nfs_version & (0x1 << 1)) {
pmap_unset (MOUNTPROG, MOUNTVERS);
pmap_unset (MOUNTPROG, MOUNTVERS_POSIX);
}
if (nfs_version & (0x1 << 2))
pmap_unset (MOUNTPROG, MOUNTVERS_NFSV3);
}
示例5: daemon_simulator
static void
daemon_simulator (void)
{
signal (SIGHUP, sim_killer);
signal (SIGINT, sim_killer);
signal (SIGTERM, sim_killer);
pmap_unset (sim_port, SIM_SM_VERS);
/* this registers both UDP and TCP services */
rpc_init("statd", sim_port, SIM_SM_VERS, sim_sm_prog_1, 0);
svc_run ();
pmap_unset (sim_port, SIM_SM_VERS);
}
示例6: main
int
main (int argc, char **argv)
{
register SVCXPRT *transp;
pmap_unset (DEVICE_ASYNC, DEVICE_ASYNC_VERSION);
pmap_unset (DEVICE_CORE, DEVICE_CORE_VERSION);
pmap_unset (DEVICE_INTR, DEVICE_INTR_VERSION);
transp = svcudp_create(RPC_ANYSOCK);
if (transp == NULL) {
fprintf (stderr, "%s", "cannot create udp service.");
exit(1);
}
if (!svc_register(transp, DEVICE_ASYNC, DEVICE_ASYNC_VERSION, device_async_1, IPPROTO_UDP)) {
fprintf (stderr, "%s", "unable to register (DEVICE_ASYNC, DEVICE_ASYNC_VERSION, udp).");
exit(1);
}
if (!svc_register(transp, DEVICE_CORE, DEVICE_CORE_VERSION, device_core_1, IPPROTO_UDP)) {
fprintf (stderr, "%s", "unable to register (DEVICE_CORE, DEVICE_CORE_VERSION, udp).");
exit(1);
}
if (!svc_register(transp, DEVICE_INTR, DEVICE_INTR_VERSION, device_intr_1, IPPROTO_UDP)) {
fprintf (stderr, "%s", "unable to register (DEVICE_INTR, DEVICE_INTR_VERSION, udp).");
exit(1);
}
transp = svctcp_create(RPC_ANYSOCK, 0, 0);
if (transp == NULL) {
fprintf (stderr, "%s", "cannot create tcp service.");
exit(1);
}
if (!svc_register(transp, DEVICE_ASYNC, DEVICE_ASYNC_VERSION, device_async_1, IPPROTO_TCP)) {
fprintf (stderr, "%s", "unable to register (DEVICE_ASYNC, DEVICE_ASYNC_VERSION, tcp).");
exit(1);
}
if (!svc_register(transp, DEVICE_CORE, DEVICE_CORE_VERSION, device_core_1, IPPROTO_TCP)) {
fprintf (stderr, "%s", "unable to register (DEVICE_CORE, DEVICE_CORE_VERSION, tcp).");
exit(1);
}
if (!svc_register(transp, DEVICE_INTR, DEVICE_INTR_VERSION, device_intr_1, IPPROTO_TCP)) {
fprintf (stderr, "%s", "unable to register (DEVICE_INTR, DEVICE_INTR_VERSION, tcp).");
exit(1);
}
svc_run ();
fprintf (stderr, "%s", "svc_run returned");
exit (1);
/* NOTREACHED */
}
示例7: leave
void
leave (int type, int wait)
{
struct task *task;
switch (type)
{
case MASTER:
pmap_unset (LOSH, MASTER);
break;
case SLAVE:
switch (wait)
{
case TRUE:
stopslave_call ();
while (slave -> task_number ||
slave -> imported_task_number);
break;
case FALSE:
deletetask_broadcast (slave);
task = NULL;
while (TRUE)
{
/* Foreach imported task: */
task = (struct task *) list_next (&slave -> imported_tasks,
(task == NULL));
if (task == NULL)
break;
/* Kill it: */
if (task -> pid != -1)
{
kill (task -> pid, SIGKILL);
#ifdef DEBUG
printf ("SLAV (info) killed task %d\n", (int) task -> pid);
#endif
}
}
break;
}
removeslave_call ();
pmap_unset (LOSH, SLAVE);
break;
}
}
示例8: main
int
main(int argc, char **argv)
{
register SVCXPRT *transp;
signal(SIGCHLD, sigchld);
(void) pmap_unset(SCSI_PROG, SCSI_VERS);
transp = svcudp_create(RPC_ANYSOCK);
if (transp == NULL) {
fprintf(stderr, "cannot create udp service.");
exit(1);
}
if (!svc_register(transp, SCSI_PROG, SCSI_VERS, scsi_prog_1, IPPROTO_UDP)) {
fprintf(stderr, "unable to register (SCSI_PROG, SCSI_VERS, udp).");
exit(1);
}
transp = svctcp_create(RPC_ANYSOCK, 0, 0);
if (transp == NULL) {
fprintf(stderr, "cannot create tcp service.");
exit(1);
}
if (!svc_register(transp, SCSI_PROG, SCSI_VERS, scsi_prog_1, IPPROTO_TCP)) {
fprintf(stderr, "unable to register (SCSI_PROG, SCSI_VERS, tcp).");
exit(1);
}
svc_run();
fprintf(stderr, "svc_run returned");
exit(1);
/* NOTREACHED */
}
示例9: main
int
main (int argc, char **argv)
{
register SVCXPRT *transp;
pmap_unset (DISPLAY_PRG, DISPLAY_VER);
transp = svcudp_create(RPC_ANYSOCK);
if (transp == NULL) {
fprintf (stderr, "%s", "cannot create udp service.");
exit(1);
}
if (!svc_register(transp, DISPLAY_PRG, DISPLAY_VER, display_prg_1, IPPROTO_UDP)) {
fprintf (stderr, "%s", "unable to register (DISPLAY_PRG, DISPLAY_VER, udp).");
exit(1);
}
transp = svctcp_create(RPC_ANYSOCK, 0, 0);
if (transp == NULL) {
fprintf (stderr, "%s", "cannot create tcp service.");
exit(1);
}
if (!svc_register(transp, DISPLAY_PRG, DISPLAY_VER, display_prg_1, IPPROTO_TCP)) {
fprintf (stderr, "%s", "unable to register (DISPLAY_PRG, DISPLAY_VER, tcp).");
exit(1);
}
svc_run ();
fprintf (stderr, "%s", "svc_run returned");
exit (1);
/* NOTREACHED */
}
示例10: rpc2_server
void *
rpc2_server()
{
register SVCXPRT *transp;
pmap_unset (RPC2_RPC_PROG, RPC2_RPC_VERS1);
transp = svcudp_create(RPC_ANYSOCK);
if (transp == NULL) {
fprintf (stderr, "%s", "cannot create udp service.");
exit(1);
}
if (!svc_register(transp, RPC2_RPC_PROG, RPC2_RPC_VERS1, rpc2_rpc_prog_1, IPPROTO_UDP)) {
fprintf (stderr, "%s", "unable to register (RPC2_RPC_PROG, RPC2_RPC_VERS1, udp).");
exit(1);
}
transp = svctcp_create(RPC_ANYSOCK, 0, 0);
if (transp == NULL) {
fprintf (stderr, "%s", "cannot create tcp service.");
exit(1);
}
if (!svc_register(transp, RPC2_RPC_PROG, RPC2_RPC_VERS1, rpc2_rpc_prog_1, IPPROTO_TCP)) {
fprintf (stderr, "%s", "unable to register (RPC2_RPC_PROG, RPC2_RPC_VERS1, tcp).");
exit(1);
}
svc_run ();
fprintf (stderr, "%s", "svc_run returned");
exit (1);
/* NOTREACHED */
}
示例11: register_server
void register_server(int client_id)
{
register SVCXPRT *transp;
pmap_unset (CALLBACK_SEMAPHORE, V1 + client_id);
transp = svcudp_create(RPC_ANYSOCK);
if (transp == NULL) {
fprintf (stderr, "%s", "cannot create udp service.");
exit(1);
}
if (!svc_register(transp, CALLBACK_SEMAPHORE, V1 + client_id, callback_semaphore_1, IPPROTO_UDP)) {
fprintf (stderr, "%s", "unable to register (CALLBACK_SEMAPHORE, V1, udp).");
exit(1);
}
transp = svctcp_create(RPC_ANYSOCK, 0, 0);
if (transp == NULL) {
fprintf (stderr, "%s", "cannot create tcp service.");
exit(1);
}
if (!svc_register(transp, CALLBACK_SEMAPHORE, V1 + client_id, callback_semaphore_1, IPPROTO_TCP)) {
fprintf (stderr, "%s", "unable to register (CALLBACK_SEMAPHORE, V1, tcp).");
exit(1);
}
//svc_run ();
//fprintf (stderr, "%s", "svc_run returned");
//exit (1);
}
示例12: main
main()
{
SVCXPRT *transp;
(void)pmap_unset(KUNDENPROG, KUNDENVERS);
transp = svcudp_create(RPC_ANYSOCK);
if (transp == NULL) {
(void)fprintf(stderr, "cannot create udp service.\n");
exit(1);
}
if (!svc_register(transp, KUNDENPROG, KUNDENVERS, kundenprog_1, IPPROTO_UDP)) {
(void)fprintf(stderr, "unable to register (KUNDENPROG, KUNDENVERS, udp).\n");
exit(1);
}
transp = svctcp_create(RPC_ANYSOCK, 0, 0);
if (transp == NULL) {
(void)fprintf(stderr, "cannot create tcp service.\n");
exit(1);
}
if (!svc_register(transp, KUNDENPROG, KUNDENVERS, kundenprog_1, IPPROTO_TCP)) {
(void)fprintf(stderr, "unable to register (KUNDENPROG, KUNDENVERS, tcp).\n");
exit(1);
}
svc_run();
(void)fprintf(stderr, "svc_run returned\n");
exit(1);
}
示例13: main
int
main (int argc, char **argv)
{
register SVCXPRT *transp;
pmap_unset (NAMENODE, NN);
transp = svcudp_create(RPC_ANYSOCK);
if (transp == NULL) {
fprintf (stderr, "%s", "cannot create udp service.");
exit(1);
}
if (!svc_register(transp, NAMENODE, NN, namenode_1, IPPROTO_UDP)) {
fprintf (stderr, "%s", "unable to register (NAMENODE, NN, udp).");
exit(1);
}
transp = svctcp_create(RPC_ANYSOCK, 0, 0);
if (transp == NULL) {
fprintf (stderr, "%s", "cannot create tcp service.");
exit(1);
}
if (!svc_register(transp, NAMENODE, NN, namenode_1, IPPROTO_TCP)) {
fprintf (stderr, "%s", "unable to register (NAMENODE, NN, tcp).");
exit(1);
}
svc_run ();
fprintf (stderr, "%s", "svc_run returned");
exit (1);
/* NOTREACHED */
}
示例14: nfs_svc_unregister
/**
* nfs_svc_unregister - remove service registrations from local rpcbind database
* @program: RPC program number to unregister
* @version: RPC version number to unregister
*
* Removes all registrations for [ @program, @version ] .
*/
void
nfs_svc_unregister(const rpcprog_t program, const rpcvers_t version)
{
if (pmap_unset((unsigned long)program, (unsigned long)version) == FALSE)
xlog(D_GENERAL, "Failed to unregister program %lu, version %lu",
(unsigned long)program, (unsigned long)version);
}
示例15: main
int
main (int argc, char **argv)
{
register SVCXPRT *transp;
pmap_unset (ARRAYSUM_CALC, ARRAYSUM_CALC_1);
transp = svcudp_create(RPC_ANYSOCK);
if (transp == NULL) {
fprintf (stderr, "%s", "cannot create udp service.");
exit(1);
}
if (!svc_register(transp, ARRAYSUM_CALC, ARRAYSUM_CALC_1, arraysum_calc_1, IPPROTO_UDP)) {
fprintf (stderr, "%s", "unable to register (ARRAYSUM_CALC, ARRAYSUM_CALC_1, udp).");
exit(1);
}
transp = svctcp_create(RPC_ANYSOCK, 0, 0);
if (transp == NULL) {
fprintf (stderr, "%s", "cannot create tcp service.");
exit(1);
}
if (!svc_register(transp, ARRAYSUM_CALC, ARRAYSUM_CALC_1, arraysum_calc_1, IPPROTO_TCP)) {
fprintf (stderr, "%s", "unable to register (ARRAYSUM_CALC, ARRAYSUM_CALC_1, tcp).");
exit(1);
}
svc_run ();
fprintf (stderr, "%s", "svc_run returned");
exit (1);
/* NOTREACHED */
}