EverKB

Knowledge Base Ever

Cách viết tiến trình daemon trên Linux

2019-11-18 11:13:25

Nhãn: Linux, daemon process, daemon,

Trên Linux, daemon có API tiêu chuẩn với chức năng gọi là daemon, được khai báo như sau:
daemon(int nochdir, int noclose);
Đây là một ví dụ đơn giản:
int main(int argc, char* argv[])
{
    daemon(0,0);
    while(1)
    {
        sleep(10)
        /*do something*/
    }

    return 0;
}

Nhãn

CentOS7 CentOS PHP Linux Python3 Python MySQL JavaScript MariaDB YUM Redis MySQL8 caching_sha2_password HTML mysql_native_password PHP7 CSS center Fatal Errors MongoDB4 sudoers DATE_SUB Phalcon SQL Server 2017 WiFi .htaccess Compiling PHP frequency conflict set_error_handler TestCase Elasticsearch7.3 PHPUnit ss5.conf apr daemon HTTP particles.js Slim Vincent Garreau Failed to build these modules: _uuid MongoDB Sudo DATE_ADD ip command pg_bha.conf SQL Server width Compiling Apache Frameworks MySQL-python scrollbar Tcp BBR Elasticsearch libpython3.7m.so.1.0 PHPStorm ss5-3.8.9 Apache2.4 CURLOPT_POSTFIELDS NodeJs show VIM Failed to build these modules: _ctypes Minimal ISO substr Bluetooth date sub INTERVAL PECL SQL Date Funcitons Wi-Fi CodeIgniter font-size root Tag Cloud dual network interfaces Laravel ss5 apache httpd CURLFille horiz-align node.js ShadowsocksR vertical-align exec mb_substr PyCharm SUBDATE BarManager date add IntelliJIDEA PEAR SOCKS5 Proxy Server WebStorm Chrome find remi Tag du jQuery PHP5.5 src Apache cURL hide nginx Shadowsocks-Python V2Ray eth0 MariaDB10.4 PostgreSQL sub folder availability date Install MongoDB pdo_sqlsrv SOCKS5 Web Server File Upload mssql-tools register_shutdown_function Symfony DevExpress JetBrain php-fpm sqlsrv Zend Framework ADDDATE height network interface Shadowsocks-Libev unixODBC-devel error_get_last Port 80 string Aura data INDENTIFIED BY password policy requirements SOCKS Web Development Fedora Media Writer msodbcsql Redis5 SVN Deepin jemalloc SQLAlchemy absolute convert FuelPHP mysqlclient Shadowsocks toggle Error Control Operator margin PHPUnit Framework ss5.passwd at-symbol daemon process IIS password SOCKET vps

Bài viết mới nhất