| 1966 | |
| 1967 | |
| 1968 | void Service::start(USHORT spb_length, const UCHAR* spb_data) |
| 1969 | { |
| 1970 | ExistenceGuard guard(this, FB_FUNCTION); |
| 1971 | |
| 1972 | if (svc_flags & SVC_detached) |
| 1973 | { |
| 1974 | // Service was already detached |
| 1975 | Arg::Gds(isc_bad_svc_handle).raise(); |
| 1976 | } |
| 1977 | |
| 1978 | try |
| 1979 | { |
| 1980 | if (!svcShutdown) |
| 1981 | svc_shutdown_request = svc_shutdown_in_progress = false; |
| 1982 | |
| 1983 | ClumpletReader spb(ClumpletReader::SpbStart, spb_data, spb_length); |
| 1984 | |
| 1985 | // The name of the service is the first element of the buffer |
| 1986 | if (spb.isEof()) |
| 1987 | { |
| 1988 | status_exception::raise(Arg::Gds(isc_service_att_err) << Arg::Gds(isc_spb_no_id)); |
| 1989 | } |
| 1990 | const UCHAR svc_id = spb.getClumpTag(); |
| 1991 | const serv_entry* serv; |
| 1992 | for (serv = services; serv->serv_action; serv++) |
| 1993 | { |
| 1994 | if (serv->serv_action == svc_id) |
| 1995 | break; |
| 1996 | } |
| 1997 | |
| 1998 | if (!serv->serv_name) |
| 1999 | status_exception::raise(Arg::Gds(isc_service_att_err) << Arg::Gds(isc_service_not_supported)); |
| 2000 | |
| 2001 | svc_service_run = serv; |
| 2002 | |
| 2003 | // currently we do not use "anonymous" service for any purposes but isc_service_query() |
| 2004 | if (svc_user_flag == SVC_user_none) |
| 2005 | { |
| 2006 | status_exception::raise(Arg::Gds(isc_bad_spb_form) << |
| 2007 | Arg::Gds(isc_svc_start_failed)); |
| 2008 | } |
| 2009 | |
| 2010 | if (!(svc_flags & SVC_finished)) |
| 2011 | status_exception::raise(Arg::Gds(isc_svc_in_use) << Arg::Str(serv->serv_name)); |
| 2012 | |
| 2013 | // Another service may have been started with this service block. |
| 2014 | // If so, we must reset the service flags. |
| 2015 | svc_switches.erase(); |
| 2016 | /*** |
| 2017 | if (!(svc_flags & SVC_detached)) |
| 2018 | { |
| 2019 | svc_flags = 0; |
| 2020 | } |
| 2021 | ***/ |
| 2022 | |
| 2023 | if (!svc_perm_sw.hasData()) |
| 2024 | { |
| 2025 | // If svc_perm_sw is not used -- call a command-line parsing utility |
nothing calls this directly
no test coverage detected