O víkendu (15:00 až 23:00) probíha EmacsConf 2025, tj. online konference vývojářů a uživatelů editoru GNU Emacs. Sledovat ji lze na stránkách konference. Záznamy budou k dispozici přímo z programu.
Provozovatel internetové encyklopedie Wikipedia jedná s velkými technologickými firmami o uzavření dohod podobných té, kterou má s Googlem. Snaží se tak zpeněžit rostoucí závislost firem zabývajících se umělou inteligencí (AI) na svém obsahu. Firmy využívají volně dostupná data z Wikipedie k trénování jazykových modelů, což zvyšuje náklady, které musí nezisková organizace provozující Wikipedii sama nést. Automatické programy
… více »Evropská komise obvinila síť 𝕏 z porušení unijních pravidel, konkrétně nařízení Evropské unie o digitálních službách (DSA). Vyměřila jí za to pokutu 120 milionů eur (2,9 miliardy Kč). Pokuta je podle názoru amerického ministra zahraničí útokem zahraničních vlád na americký lid. K pokutě se vyjádřil i americký viceprezident: „EU by měla podporovat svobodu projevu, a ne útočit na americké společnosti kvůli nesmyslům“.
Společnost Jolla spustila kampaň na podporu svého nového telefonu Jolla Phone se Sailfish OS. Dodání je plánováno na první polovinu příštího roku. Pokud bude alespoň 2 000 zájemců. Záloha na telefon je 99 €. Cena telefonu v rámci kampaně je 499 €.
Netflix kupuje Warner Bros. včetně jejích filmových a televizních studií HBO Max a HBO. Za 72 miliard dolarů (asi 1,5 bilionu korun).
V Las Vegas dnes končí pětidenní konference AWS re:Invent 2025. Společnost Amazon Web Services (AWS) na ní představila celou řadu novinek. Vypíchnout lze 192jádrový CPU Graviton5 nebo AI chip Trainium3.
Firma Proxmox vydala novou serverovou distribuci Datacenter Manager ve verzi 1.0 (poznámky k vydání). Podobně jako Virtual Environment, Mail Gateway či Backup Server je založená na Debianu, k němuž přidává integraci ZFS, webové administrační rozhraní a další. Datacenter Manager je určený ke správě instalací právě ostatních distribucí Proxmox.
Byla vydána nová verze 2.4.66 svobodného multiplatformního webového serveru Apache (httpd). Řešeno je mimo jiné 5 bezpečnostních chyb.
Programovací jazyk JavaScript (Wikipedie) dnes slaví 30 let od svého oficiálního představení 4. prosince 1995.
Byly zveřejněny informace o kritické zranitelnosti CVE-2025-55182 s CVSS 10.0 v React Server Components. Zranitelnost je opravena v Reactu 19.0.1, 19.1.2 a 19.2.1.
time caller: messageA dale vytvorit knihovnu s funkcí pro zápis do této roury. dalším parametrem daemona je interval, ve kterém daemon zapisuje vlastní statistiku (počet obdržených zpráv) do syslogu. Daemon jsem napsal pomoci fce select(), ale nemuzu odstranit chybu, ktera spociva v ukonceni programu pote, co si precte prvni zpravu z roury a korektne ji zapise do zadaneho logu. V nasledujicim prubehu WHILE funkce select vrati hodnotu vetsi nez nula, jakoby dosla dalsi zprava, ale funkce read vrati nulu. Zajimalo by me, kde je chyba. Je to nekde v souboru s rourou, nebo v samotnem spatnem pouziti select ? Kod daemona:
/*
#define DEFAULT_INTERVAL 2
#define SIZE 256
char* get_current_time() {
time_t current_time;
char* c_time_string;
int j;
current_time = time(NULL); /* Obtain current time as seconds elapsed since the Epoch. */
if (current_time == ((time_t)-1)) {
(void) fprintf(stderr, "Failure to compute the current time.");
exit(EXIT_FAILURE);
}
c_time_string = ctime(¤t_time); /* Convert to local time format. */
for ( j = 0; c_time_string[j] != '\n'; j++) /*Get rid EOL*/
;
c_time_string[j] = '\0';
if (c_time_string == NULL) {
(void) fprintf(stderr, "Failure to convert the current time.");
exit(EXIT_FAILURE);
}
return c_time_string;
}
void print_help() {
printf("Programme must be run with with 2 arguments:\n"
"argv[1] is a name of the file which the daemon wil be writting in\n"
"argv[2] is an interval the daemon will be sending logs into syslog\n");
}
int main(int argc, char *argv[]) {
if (argc != 3) {
print_help();
exit(1);
}
int c;
while((c = getopt(argc, argv, "h")) != -1) {
switch (c) {
case 'h':
print_help();
break;
case '?':
printf("try -h for help");
break;
default:
break;
}
}
FILE *fw;
int fp;
char buf[SIZE];
char *linesep;
int line, i, count;
buf[0] = '\0'; // in case there is nothing to read
buf[SIZE] = '\0'; // guarentee a end-of-line
fd_set readfds;
struct timeval timeout;
int r;
int interval = atoi(argv[2]);
openlog ("exampleprog", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
fprintf(stderr, "Daemonizing...\n");
//daemon(0,0);
unlink("/tmp/pb173_syslog");
mkfifo("/tmp/pb173_syslog", S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH);
fp = open("/tmp/pb173_syslog", O_RDONLY | O_NONBLOCK);
if(fp == -1) {
syslog (LOG_CRIT, "Could not open the pipe: %s\n", strerror(errno));
exit(1);
}
fw = fopen(argv[1], "a+");
if(fw == NULL) {
openlog ("exampleprog", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
syslog (LOG_CRIT, "Error openning logfile : %s\n", strerror(errno));
exit(1);
}
timeout.tv_sec = interval;
timeout.tv_usec = 0;
count = 0;
line = 0;
r = 0;
while(1) {
FD_ZERO(&readfds);
FD_SET(fp,&readfds);
r = select(fp+1, &readfds, NULL, NULL, &timeout);
if (r == -1) {
openlog ("daemon", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
syslog (LOG_CRIT, "Error openning logfile : %s\n", strerror(errno));
close(fp);
fclose(fw);
exit(1);
}
if (r == 0) {
timeout.tv_sec = interval;
timeout.tv_usec = 0;
setlogmask (LOG_UPTO (LOG_NOTICE));
openlog ("daemon", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
syslog (LOG_NOTICE, "Number of received messages: %d\n", count );
closelog ();
} else {
line += (r = read(fp, buf+line, SIZE-line-1));
if (r == 0) {
close(fp);
fclose(fw);
exit(EXIT_SUCCESS);
}
buf[line] = '\0';
if (line && (linesep = strstr(buf, "\n"))) {
*linesep = '\0';
char *caller;
int callerLength;
char *message;
caller = strtok(buf, "^");
callerLength = strlen(caller);
message = caller + callerLength + 1;
fprintf(fw, "%s %s: %s\n", get_current_time(), caller, message);
fflush(fw);
memmove(buf, linesep + 1, (line = strlen(linesep + 1)) + 1);
count++;
}
}
}
close(fp);
fclose(fw);
exit(EXIT_SUCCESS);
}
A kod funkce, ktera zapisuje do roury:
int sl_log(const char *caller, const char* message) {
int fp;
fp = open("/tmp/pb173_syslog", O_WRONLY);
char *msg;
if (fp == -1) {
perror("Could not open the pipe\n");
exit(1);
}
asprintf(&msg, "%s^%s\n", caller, message);
write(fp, msg, strlen(msg));
free(msg);
close(fp);
return 0;
}
Řešení dotazu:
Tiskni
Sdílej: