linuxÏÂntpʵÏÖ
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define NTP_SERVER "clock.via.net"
#define NTP_PORT 123
//
//rfc1305 defined from 1900 so also 2208988800 (1900 - 1970 ) seconds left
//
//timeval.tv_sec + JAN_1970 = timestamp.coarse
#define JAN_1970 0x83aa7e80
//timeval.tv_usec=>timestamp.fine
#define NTPFRAC(x) (4294 * (x) + ((1981 * (x))>>11))
//timeval.tv_usec<=timestamp.fine
#define USEC(x) (((x) >> 12) - 759 * ((((x) >> 10) + 32768) >> 16))
#define Data(i) ntohl(((unsigned int *)data)[i])
#define LI 0
#define VN 3
#define MODE 3
#define STRATUM 0
#define POLL 4
#define PREC -6
struct ntptime
{
unsigned int coarse;
unsigned int fine;
};
void send_packet(int fd)
{
unsigned int data[12];
struct timeval now;
int ret;
if (sizeof(data) != 48)
{
fprintf(stderr,"size error\n");
return;
}
memset((char*)data, 0, sizeof(data));
data[0] = htonl((LI << 30) | (VN << 27) | (MODE << 24)
| (STRATUM << 16) | (POLL << 8) | (PREC & 0xff));
data[1] = htonl(1<<16); /* Root Delay (seconds) */
data[2] = htonl(1<<16); /* Root Dispersion (seconds) */
gettimeofday(&now, NULL);
data[10] = htonl(now.tv_sec + JAN_1970); /* Transmit Timestamp coarse */
data[11] = htonl(NTPFRAC(now.tv_usec)); /* Transmit Timestamp fine */
send(fd, data, 48, 0);
}
void get_udp_arrival_local_timestamp(struct ntptime *udp_arrival_local_timestamp)
{
struct timeval udp_arrival_local_time;
gettimeofday(&udp_arrival_local_time, NULL);
//print just precise to second
printf("local time=>%s\n",ctime(&(udp_arrival_local_time.tv_sec)));
}
void get_new_time(unsigned i
Ïà¹ØÎĵµ£º
°²×°rpm°ü
ÅäÖãº
ÖØÆðvsftpd·þÎñ£ºservice vsftpd restart
Æô¶¯vsftpd·þÎñ£ºservice vsftpd start
1£® ÄäÃû·þÎñÆ÷µÄÁ¬½Ó£¨¶ÀÁ¢µÄ·þÎñÆ÷£©
ÐÞ¸Ä/etc/vsftpd/vsftpd.confÅäÖÃÎļþÒ»ÏÂÏûÓÐÔòÌí¼Ó£º
Anonymous_enable=yes (ÔÊÐíÄäÃûµÇ½)
Dirmessage_enable=yes
£¨Çл»Ä¿Â¼Ê±£¬ÏÔʾĿ¼ÏÂ.messageµÄÄÚÈÝ£©
Loca ......
linux limits.conf ÅäÖÃ
¡¡¡¡limits.conf Îļþʵ¼ÊÊÇ Linux PAM£¨²åÈëʽÈÏ֤ģ¿é£¬Pluggable Authentication Modules£©ÖÐ pam_limits.so µÄÅäÖÃÎļþ£¬¶øÇÒÖ»Õë¶ÔÓÚµ¥¸ö»á»°¡£
¡¡¡¡limits.confµÄ¸ñʽÈçÏ£º
¡¡¡¡username|@groupname type resource limit
¡¡¡¡username|@groupname£ºÉèÖÃÐèÒª±»ÏÞÖÆµÄÓû§Ãû£¬×éÃûÇ°Ãæ¼Ó@º ......
Ò»£®Ç°ÑÔ
¡¡¡¡LinuxÓµÓзḻ¸÷ÖÖÔ´´úÂë×ÊÔ´,µ«ÊǴ󲿷ִúÂëÔÚWindowsƽ̨Çé¿öÊÇÎÞ·¨Õý³£±àÒëµÄ¡£Windowsƽ̨¸ù±¾ÎÞ·¨Ö±½ÓÀûÓÃÕâЩԴ´úÂë×ÊÔ´¡£Èç¹ûÏëҪʹÓÃÍêÕûµÄ´úÂ룬¾ÍÒª×öÒÆÖ²¹¤×÷¡£ÒòΪC/C++ LibraryµÄ²»Í¬ºÍÆäËûµÄһЩÔÒò£¬ÒÆÖ²C/C++´úÂëÊÇÒ»ÏîÀ§ÄѵŤ×÷¡£±¾ÎĽ«ÒÔÒ»¸öʵ¼ÊµÄÀý×Ó£¨Tar£©À´ËµÃ÷ÈçºÎ°ÑLinux´úÂëÒÆÖ² ......
ÒýÓãºhttp://blog.chinaunix.net/u/12207/showart_2061214.html
¹ØÓÚ2.6.31Óöµ½µÄÎÊÌâ
´íÎóÌáʾ1£º
drivers/built-in.o(.init.text+0x3bad): In function `con_init':
include/trace/events/kmem.h:47: undefined reference to `.L1452'
½â¾ö£º
vi /usr/src/linux/drivers/char/vt.c ÕÒµ½static int __init con_init ......